Bug 556415 - Crash on Windows 2000 in g_winhttp_vfs_init()

2008-11-12  Tor Lillqvist  <tml@novell.com>

	Bug 556415 - Crash on Windows 2000 in g_winhttp_vfs_init()

	* win32/gwinhttpvfs.h: Move the set of function pointers to
	winhttp.dll into a separate struct GWinHttpDllFuncs. Just have a
	pointer to that in the GWinHttpVfsClass.
	
	* win32/gwinhttpvfs.c: Move the lookup of functions from
	winhttp.dll into a function of its own, that stores the pointers
	in a separate GWinHttpDllFuncs variable. Add two bookeeping
	booleans lookup_done and funcs_found.

	Don't call g_io_extension_point_implement() to register the
	winhttp extension unless winhttp.dll has been successfully loaded
	and the required functions found in it.

	* win32/gwinhttp*.c: Adjust calls of the functions looked up from
	winhttp.dll correspondingly.


svn path=/trunk/; revision=7648
This commit is contained in:
Tor Lillqvist
2008-11-12 17:52:39 +00:00
committed by Tor Lillqvist
parent d442b59022
commit 2f575b95ac
6 changed files with 123 additions and 60 deletions

View File

@@ -44,6 +44,7 @@ G_BEGIN_DECLS
#define G_WINHTTP_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_WINHTTP_VFS, GWinHttpVfsClass))
typedef struct _GWinHttpVfs GWinHttpVfs;
typedef struct _GWinHttpDllFuncs GWinHttpDllFuncs;
typedef struct _GWinHttpVfsClass GWinHttpVfsClass;
struct _GWinHttpVfs
@@ -54,14 +55,8 @@ struct _GWinHttpVfs
HINTERNET session;
};
struct _GWinHttpVfsClass
struct _GWinHttpDllFuncs
{
GVfsClass parent_class;
/* As there is no import library for winhttp.dll in mingw, we must
* look up the functions we need dynamically. Store the pointers
* here.
*/
BOOL (WINAPI *pWinHttpCloseHandle) (HINTERNET);
BOOL (WINAPI *pWinHttpCrackUrl) (LPCWSTR,DWORD,DWORD,LPURL_COMPONENTS);
HINTERNET (WINAPI *pWinHttpConnect) (HINTERNET,LPCWSTR,INTERNET_PORT,DWORD);
@@ -76,6 +71,17 @@ struct _GWinHttpVfsClass
BOOL (WINAPI *pWinHttpWriteData) (HINTERNET,LPCVOID,DWORD,LPDWORD);
};
struct _GWinHttpVfsClass
{
GVfsClass parent_class;
/* As there is no import library for winhttp.dll in mingw, and
* winhttp.dll isn't present on Windows 2000 anyway, we must look up
* the functions we need dynamically. Store the pointers here.
*/
GWinHttpDllFuncs *funcs;
};
GType _g_winhttp_vfs_get_type (void) G_GNUC_CONST;