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;
LPBYTE peb; //scratch pad for getting peb info
int ht_enabled;
int winnt;
};
int sigar_wsa_init(sigar_t *sigar);

View File

@ -127,6 +127,7 @@ int sigar_os_open(sigar_t **sigar)
{
LONG result;
HINSTANCE h;
OSVERSIONINFO version;
*sigar = malloc(sizeof(**sigar));
(*sigar)->machine = ""; /* local machine */
@ -135,6 +136,11 @@ int sigar_os_open(sigar_t **sigar)
(*sigar)->perfbuf = NULL;
(*sigar)->perfbuf_size = 0;
version.dwOSVersionInfoSize = sizeof(version);
GetVersionEx(&version);
(*sigar)->winnt =
(version.dwPlatformId == VER_PLATFORM_WIN32_NT);
if (USING_WIDE_S(*sigar)) {
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_proc_modules_t *procmods)
{
/* XXX need to use psapi.dll for NT */
if (sigar->winnt) {
/* XXX need to use psapi.dll for NT */
return SIGAR_ENOTIMPL;
}
return sigar_proc_modules_get_toolhelp(sigar,
pid,
procmods);