From: nethack.allison Date: Wed, 21 Aug 2002 11:53:44 +0000 (+0000) Subject: win32 problem on NT4 X-Git-Tag: MOVE2GIT~2486 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e86d1a44368701b23ac412a7984e77c36764c7e5;p=nethack win32 problem on NT4 > Oops: > > "NetHack.exe - Entry Point Not Found > > The procedure entry point Process32Next could not be located in the dynamic link > library KERNEL32.dll." > > And the program refuses to run. Same goes for NetHackW.exe. > > Windows NT 4 (to be precise: 4.00.1381, SP6) > IE 5.0 (to be precise: 5.00.2919.6307) > > The Help for Process32Next shows the following compatibility list: > QuickInfo > Windows NT: Requires version 5.0 or later. > Windows: Requires Windows 95 or later. > Windows CE: Unsupported. > Header: Declared in tlhelp32.h. > Import Library: Use kernel32.lib. --- diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 155c2d059..3b711a0e8 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -243,7 +243,20 @@ int pid; HANDLE hProcessSnap = NULL; PROCESSENTRY32 pe32 = {0}; boolean bRet = FALSE; + HINSTANCE hinstLib; + genericptr_t ProcTest; + BOOL fFreeResult; + hinstLib = LoadLibrary("KERNEL32"); + if (hinstLib != NULL) { + ProcTest = (genericptr_t) GetProcAddress(hinstLib, "Process32Next"); + if (!ProcTest) { + fFreeResult = FreeLibrary(hinstLib); + return FALSE; + } + fFreeResult = FreeLibrary(hinstLib); + } + hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return FALSE; diff --git a/util/recover.c b/util/recover.c index fc6c173dc..f3b27a458 100644 --- a/util/recover.c +++ b/util/recover.c @@ -408,6 +408,20 @@ int pid; HANDLE hProcessSnap = NULL; PROCESSENTRY32 pe32 = {0}; boolean bRet = FALSE; + HINSTANCE hinstLib; + genericptr_t ProcTest; + BOOL fFreeResult; + + hinstLib = LoadLibrary("KERNEL32"); + if (hinstLib != NULL) { + ProcTest = (genericptr_t) GetProcAddress(hinstLib, "Process32Next"); + if (!ProcTest) { + fFreeResult = FreeLibrary(hinstLib); + return FALSE; + } + fFreeResult = FreeLibrary(hinstLib); + } + hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE)