fix proc_args when cmdline crosses first page boundry (seen w/ WebSphere)

This commit is contained in:
Doug MacEachern 2004-08-04 05:18:05 +00:00
parent 43f129a6f8
commit bbc1b99d32
2 changed files with 11 additions and 3 deletions

View File

@ -18,17 +18,25 @@ static int sigar_peb_get(sigar_t *sigar, HANDLE proc, DWORD *base)
{
MEMORY_BASIC_INFORMATION mbi;
DWORD bytes;
SIZE_T size = sigar->pagesize;
if (!sigar->peb) {
sigar->peb = malloc(sigar->pagesize);
sigar->peb = malloc(sigar->pagesize*2);
}
if (!VirtualQueryEx(proc, (char*)START_ADDRESS, &mbi, sizeof(mbi))) {
return GetLastError();
}
if (mbi.RegionSize > sigar->pagesize) {
/* in the event args crosses the first page boundry.
* seen with WebSphere.
*/
size *= 2;
}
if (!ReadProcessMemory(proc, mbi.BaseAddress, sigar->peb,
sigar->pagesize, &bytes))
size, &bytes))
{
return GetLastError();
}

View File

@ -19,7 +19,7 @@
/* see apr/include/arch/win32/atime.h */
#define EPOCH_DELTA INT64_C(11644473600000000)
#define SIGAR_CMDLINE_MAX (MAX_PATH * 3)
#define SIGAR_CMDLINE_MAX 4096
static __inline sigar_uint64_t FileTimeToTime(FILETIME *ft)
{