From 93b1001c10a3137ba415e3cefdbd3dc1967beac4 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 18 Jul 2000 20:24:29 +0000 Subject: [PATCH] Don't #include when compiling with gcc, as it isn't provided. 2000-07-19 Tor Lillqvist * gmodule-win32.c: Don't #include when compiling with gcc, as it isn't provided. Declaration of a needed struct (from www.microsoft.com) inserted instead. --- gmodule/ChangeLog | 6 ++++++ gmodule/gmodule-win32.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index 211595b05..8661b909a 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -1,3 +1,9 @@ +2000-07-19 Tor Lillqvist + + * gmodule-win32.c: Don't #include when compiling with + gcc, as it isn't provided. Declaration of a needed struct (from + www.microsoft.com) inserted instead. + 2000-05-13 Tor Lillqvist * makefile.mingw.in: New file, with gmodule stuff diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index 76377bb2c..9811496ff 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -33,7 +33,34 @@ #include #include + +#ifdef __MSVC__ #include +#else + +/* The w32api headers supplied with the mingw gcc don't have + * tlhelp32.h. We really only need the MODULEENTRY32 struct and the + * TH32CS_SNAPMODULE value, so provide them here. + */ + +#define MAX_MODULE_NAME32 255 + +typedef struct +{ + DWORD dwSize; + DWORD th32ModuleID; + DWORD th32ProcessID; + DWORD GlblcntUsage; + DWORD ProccntUsage; + BYTE *modBaseAddr; + DWORD modBaseSize; + HMODULE hModule; + char szModule[MAX_MODULE_NAME32 + 1]; + char szExePath[MAX_PATH]; +} MODULEENTRY32; +#define TH32CS_SNAPMODULE 8 + +#endif static void set_error (void) @@ -82,10 +109,10 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name) typedef HANDLE (WINAPI *PFNCREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); static PFNCREATETOOLHELP32SNAPSHOT pfnCreateToolhelp32Snapshot = NULL; - typedef BOOL (WINAPI *PFNMODULE32FIRST)(HANDLE, LPMODULEENTRY32); + typedef BOOL (WINAPI *PFNMODULE32FIRST)(HANDLE, MODULEENTRY32*); static PFNMODULE32FIRST pfnModule32First= NULL; - typedef BOOL (WINAPI *PFNMODULE32NEXT)(HANDLE, LPMODULEENTRY32); + typedef BOOL (WINAPI *PFNMODULE32NEXT)(HANDLE, MODULEENTRY32*); static PFNMODULE32NEXT pfnModule32Next = NULL; static HMODULE kernel32;