Jacek Caban : wininet: Added default fallback for setting handle options and use it for INTERNET_OPTION_CALLBACK .

Alexandre Julliard julliard at winehq.org
Thu Mar 8 14:26:23 CST 2012


Module: wine
Branch: master
Commit: 4863257e3090404c1feb443ed4418fa8040a1b8e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4863257e3090404c1feb443ed4418fa8040a1b8e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Mar  8 12:19:14 2012 +0100

wininet: Added default fallback for setting handle options and use it for INTERNET_OPTION_CALLBACK.

---

 dlls/wininet/ftp.c      |    6 +++---
 dlls/wininet/http.c     |    4 ++--
 dlls/wininet/internet.c |   27 ++++++++++++---------------
 dlls/wininet/internet.h |    3 ++-
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index dc5bc12..0c7ca12 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -1297,7 +1297,7 @@ static const object_vtbl_t FTPFILEVtbl = {
     FTPFILE_Destroy,
     NULL,
     FTPFILE_QueryOption,
-    NULL,
+    INET_SetOption,
     FTPFILE_ReadFile,
     FTPFILE_ReadFileExA,
     FTPFILE_ReadFileExW,
@@ -2389,7 +2389,7 @@ static const object_vtbl_t FTPSESSIONVtbl = {
     FTPSESSION_Destroy,
     FTPSESSION_CloseConnection,
     FTPSESSION_QueryOption,
-    NULL,
+    INET_SetOption,
     NULL,
     NULL,
     NULL,
@@ -3474,7 +3474,7 @@ static const object_vtbl_t FTPFINDNEXTVtbl = {
     FTPFINDNEXT_Destroy,
     NULL,
     FTPFINDNEXT_QueryOption,
-    NULL,
+    INET_SetOption,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 3c5ed9c..69068bf 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2212,7 +2212,7 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
         return ERROR_SUCCESS;
     }
 
-    return ERROR_INTERNET_INVALID_OPTION;
+    return INET_SetOption(hdr, option, buffer, size);
 }
 
 /* read some more data into the read buffer (the read section must be held) */
@@ -5515,7 +5515,7 @@ static DWORD HTTPSESSION_SetOption(object_header_t *hdr, DWORD option, void *buf
     default: break;
     }
 
-    return ERROR_INTERNET_INVALID_OPTION;
+    return INET_SetOption(hdr, option, buffer, size);
 }
 
 static const object_vtbl_t HTTPSESSIONVtbl = {
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 391a525..bd954a2 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -881,7 +881,7 @@ static const object_vtbl_t APPINFOVtbl = {
     APPINFO_Destroy,
     NULL,
     APPINFO_QueryOption,
-    NULL,
+    INET_SetOption,
     NULL,
     NULL,
     NULL,
@@ -2529,6 +2529,16 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
     return res == ERROR_SUCCESS;
 }
 
+DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
+{
+    switch(option) {
+    case INTERNET_OPTION_CALLBACK:
+        WARN("Not settable option %u\n", option);
+        return ERROR_INTERNET_OPTION_NOT_SETTABLE;
+    }
+
+    return ERROR_INTERNET_INVALID_OPTION;
+}
 
 /***********************************************************************
  *           InternetSetOptionW (WININET.@)
@@ -2549,7 +2559,7 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
     TRACE("(%p %d %p %d)\n", hInternet, dwOption, lpBuffer, dwBufferLength);
 
     lpwhh = (object_header_t*) get_handle_object( hInternet );
-    if(lpwhh && lpwhh->vtbl->SetOption) {
+    if(lpwhh) {
         DWORD res;
 
         res = lpwhh->vtbl->SetOption(lpwhh, dwOption, lpBuffer, dwBufferLength);
@@ -2845,19 +2855,6 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
 
     switch( dwOption )
     {
-    case INTERNET_OPTION_CALLBACK:
-        {
-        object_header_t *lpwh;
-
-        if (!(lpwh = get_handle_object(hInternet)))
-        {
-            INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
-            return FALSE;
-        }
-        WININET_Release(lpwh);
-        INTERNET_SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
-        return FALSE;
-        }
     case INTERNET_OPTION_PROXY:
         {
         LPINTERNET_PROXY_INFOA pi = (LPINTERNET_PROXY_INFOA) lpBuffer;
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index 3af93db..720b330 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -486,7 +486,8 @@ object_header_t *get_handle_object( HINTERNET hinternet ) DECLSPEC_HIDDEN;
 object_header_t *WININET_AddRef( object_header_t *info ) DECLSPEC_HIDDEN;
 BOOL WININET_Release( object_header_t *info ) DECLSPEC_HIDDEN;
 
-DWORD INET_QueryOption( object_header_t *, DWORD, void *, DWORD *, BOOL ) DECLSPEC_HIDDEN;
+DWORD INET_QueryOption(object_header_t*,DWORD,void*,DWORD*,BOOL) DECLSPEC_HIDDEN;
+DWORD INET_SetOption(object_header_t*,DWORD,void*,DWORD) DECLSPEC_HIDDEN;
 
 time_t ConvertTimeString(LPCWSTR asctime) DECLSPEC_HIDDEN;
 




More information about the wine-cvs mailing list