diff options
author | Gerald Combs <gerald@wireshark.org> | 2010-08-25 20:30:59 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2010-08-25 20:30:59 +0000 |
commit | 607b228df6f1f754bf9bda6cfa21563913b1e7ff (patch) | |
tree | 6d1cf5c9dae154869fc6a13d181489834d7a190e /wsutil/file_util.h | |
parent | 43af5f6344d47af3ccfa574c1013dbc6a011904c (diff) | |
download | wireshark-607b228df6f1f754bf9bda6cfa21563913b1e7ff.tar.gz |
Add ws_load_library and ws_module_open, which respectively call
LoadLibrary and g_module_open only for the program directory and system
directory on Windows. Use them to replace a bunch of LoadLibrary and
g_module_open calls. Use the extension ".dll" for all the DLLs that we
load. Add comments about DLL loading in Python.
svn path=/trunk/; revision=33924
Diffstat (limited to 'wsutil/file_util.h')
-rw-r--r-- | wsutil/file_util.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/wsutil/file_util.h b/wsutil/file_util.h index e7ee04259f..bf5689905a 100644 --- a/wsutil/file_util.h +++ b/wsutil/file_util.h @@ -33,6 +33,7 @@ extern "C" { #ifdef _WIN32 #include <io.h> +#include <gmodule.h> #endif #ifdef HAVE_SYS_STAT_H @@ -114,6 +115,25 @@ extern FILE * ws_stdio_freopen (const gchar *filename, const gchar *mode, FILE * #define ws_dir_rewind g_dir_rewind #define ws_dir_close g_dir_close +/* DLL loading */ + +/** Load a DLL using LoadLibrary. + * Only the system and program directories are searched. + * + * @param library_name The name of the DLL. + * @return A handle to the DLL if found, NULL on failure. + */ + +void *ws_load_library(gchar *library_name); +/** Load a DLL using g_module_open. + * Only the system and program directories are searched. + * + * @param module_name The name of the DLL. + * @param flags Flags to be passed to g_module_open. + * @return A handle to the DLL if found, NULL on failure. + */ +GModule *ws_module_open(gchar *module_name, GModuleFlags flags); + /* XXX - remove include "dirent.h" */ /* XXX - remove include "direct.h" */ /* XXX - remove include "sys/stat.h" */ |