Marcus Meissner : wininet: Split out NULL ptr and function ptr check.
Alexandre Julliard
julliard at winehq.org
Sat Mar 15 05:53:52 CDT 2008
Module: wine
Branch: master
Commit: ed966469a4d2ae1c7d5ddad1b9d74e8d4d0783b9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ed966469a4d2ae1c7d5ddad1b9d74e8d4d0783b9
Author: Marcus Meissner <marcus at jet.franken.de>
Date: Fri Mar 14 22:34:54 2008 +0100
wininet: Split out NULL ptr and function ptr check.
---
dlls/wininet/internet.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index d5fbbc1..be1ee16 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1704,11 +1704,16 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer,
TRACE("(%p %p %d %p)\n", hFile, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
lpwh = WININET_GetObject( hFile );
+ if (!lpwh) {
+ WARN("Invalid handle\n");
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
- if(lpwh && lpwh->vtbl->WriteFile) {
+ if(lpwh->vtbl->WriteFile) {
retval = lpwh->vtbl->WriteFile(lpwh, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
}else {
- WARN("Invalid handle\n");
+ WARN("No Writefile method.\n");
SetLastError(ERROR_INVALID_HANDLE);
retval = FALSE;
}
@@ -1848,7 +1853,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
TRACE("(%p, 0x%08x, %p, %p)\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
- lpwhh = (LPWININETHANDLEHEADER) WININET_GetObject( hInternet );
+ lpwhh = WININET_GetObject( hInternet );
switch (dwOption)
{
More information about the wine-cvs
mailing list