summaryrefslogtreecommitdiff
path: root/gmodule
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2000-07-18 20:24:29 +0000
committerTor Lillqvist <tml@src.gnome.org>2000-07-18 20:24:29 +0000
commit93b1001c10a3137ba415e3cefdbd3dc1967beac4 (patch)
tree804e7b514c0973dcd9f6c8d0669e6d5ec8309ea3 /gmodule
parent9556b490538b92fa78192a242091ef299809430b (diff)
Don't #include <tlhelp32.h> when compiling with gcc, as it isn't provided.
2000-07-19 Tor Lillqvist <tml@iki.fi> * gmodule-win32.c: Don't #include <tlhelp32.h> when compiling with gcc, as it isn't provided. Declaration of a needed struct (from www.microsoft.com) inserted instead.
Diffstat (limited to 'gmodule')
-rw-r--r--gmodule/ChangeLog6
-rw-r--r--gmodule/gmodule-win32.c31
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 <tml@iki.fi>
+
+ * gmodule-win32.c: Don't #include <tlhelp32.h> 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 <tml@iki.fi>
* 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 <stdio.h>
#include <windows.h>
+
+#ifdef __MSVC__
#include <tlhelp32.h>
+#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;