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

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

No files matched your search

+10 -2
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();
}