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

@@ -64,7 +64,7 @@ g_winhttp_file_output_stream_finalize (GObject *object)
winhttp_stream = G_WINHTTP_FILE_OUTPUT_STREAM (object);
if (winhttp_stream->connection != NULL)
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (winhttp_stream->connection);
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (winhttp_stream->connection);
G_OBJECT_CLASS (g_winhttp_file_output_stream_parent_class)->finalize (object);
}
@@ -121,7 +121,7 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
wchar_t *wheaders;
DWORD bytes_written;
request = G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpOpenRequest
request = G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpOpenRequest
(winhttp_stream->connection,
L"PUT",
winhttp_stream->file->url.lpszUrlPath,
@@ -142,7 +142,7 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
wheaders = g_utf8_to_utf16 (headers, -1, NULL, NULL, NULL);
g_free (headers);
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpSendRequest
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpSendRequest
(request,
wheaders, -1,
NULL, 0,
@@ -151,7 +151,7 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
{
_g_winhttp_set_error (error, GetLastError (), "PUT request");
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
g_free (wheaders);
return -1;
@@ -159,12 +159,12 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
g_free (wheaders);
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpWriteData
if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpWriteData
(request, buffer, count, &bytes_written))
{
_g_winhttp_set_error (error, GetLastError (), "PUT request");
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
return -1;
}
@@ -176,12 +176,12 @@ g_winhttp_file_output_stream_write (GOutputStream *stream,
error,
"PUT request"))
{
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
return -1;
}
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
return bytes_written;
}