add winnt flag and use it in proc_modules

This commit is contained in:
Doug MacEachern 2004-06-22 17:15:10 +00:00
parent bfff8bc922
commit a23ff178db
2 changed files with 11 additions and 1 deletions

View File

@ -113,6 +113,7 @@ struct sigar_t {
int ws_error; int ws_error;
LPBYTE peb; //scratch pad for getting peb info LPBYTE peb; //scratch pad for getting peb info
int ht_enabled; int ht_enabled;
int winnt;
}; };
int sigar_wsa_init(sigar_t *sigar); int sigar_wsa_init(sigar_t *sigar);

View File

@ -127,6 +127,7 @@ int sigar_os_open(sigar_t **sigar)
{ {
LONG result; LONG result;
HINSTANCE h; HINSTANCE h;
OSVERSIONINFO version;
*sigar = malloc(sizeof(**sigar)); *sigar = malloc(sizeof(**sigar));
(*sigar)->machine = ""; /* local machine */ (*sigar)->machine = ""; /* local machine */
@ -135,6 +136,11 @@ int sigar_os_open(sigar_t **sigar)
(*sigar)->perfbuf = NULL; (*sigar)->perfbuf = NULL;
(*sigar)->perfbuf_size = 0; (*sigar)->perfbuf_size = 0;
version.dwOSVersionInfoSize = sizeof(version);
GetVersionEx(&version);
(*sigar)->winnt =
(version.dwPlatformId == VER_PLATFORM_WIN32_NT);
if (USING_WIDE_S(*sigar)) { if (USING_WIDE_S(*sigar)) {
WCHAR wmachine[MAX_PATH+1]; WCHAR wmachine[MAX_PATH+1];
@ -1212,7 +1218,10 @@ static int sigar_proc_modules_get_toolhelp(sigar_t *sigar,
SIGAR_DECLARE(int) sigar_proc_modules_get(sigar_t *sigar, sigar_pid_t pid, SIGAR_DECLARE(int) sigar_proc_modules_get(sigar_t *sigar, sigar_pid_t pid,
sigar_proc_modules_t *procmods) sigar_proc_modules_t *procmods)
{ {
if (sigar->winnt) {
/* XXX need to use psapi.dll for NT */ /* XXX need to use psapi.dll for NT */
return SIGAR_ENOTIMPL;
}
return sigar_proc_modules_get_toolhelp(sigar, return sigar_proc_modules_get_toolhelp(sigar,
pid, pid,
procmods); procmods);