fix proc_args when cmdline crosses first page boundry (seen w/ WebSphere)
This commit is contained in:
		
							parent
							
								
									43f129a6f8
								
							
						
					
					
						commit
						bbc1b99d32
					
				| @ -18,17 +18,25 @@ static int sigar_peb_get(sigar_t *sigar, HANDLE proc, DWORD *base) | |||||||
| { | { | ||||||
|     MEMORY_BASIC_INFORMATION mbi; |     MEMORY_BASIC_INFORMATION mbi; | ||||||
|     DWORD bytes; |     DWORD bytes; | ||||||
|  |     SIZE_T size = sigar->pagesize; | ||||||
| 
 | 
 | ||||||
|     if (!sigar->peb) { |     if (!sigar->peb) { | ||||||
|         sigar->peb = malloc(sigar->pagesize); |         sigar->peb = malloc(sigar->pagesize*2); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!VirtualQueryEx(proc, (char*)START_ADDRESS, &mbi, sizeof(mbi))) { |     if (!VirtualQueryEx(proc, (char*)START_ADDRESS, &mbi, sizeof(mbi))) { | ||||||
|         return GetLastError(); |         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, |     if (!ReadProcessMemory(proc, mbi.BaseAddress, sigar->peb, | ||||||
|                            sigar->pagesize, &bytes)) |                            size, &bytes)) | ||||||
|     { |     { | ||||||
|         return GetLastError(); |         return GetLastError(); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| /* see apr/include/arch/win32/atime.h */ | /* see apr/include/arch/win32/atime.h */ | ||||||
| #define EPOCH_DELTA INT64_C(11644473600000000) | #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) | static __inline sigar_uint64_t FileTimeToTime(FILETIME *ft) | ||||||
| { | { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Doug MacEachern
						Doug MacEachern