Jacek Caban : wininet: Use separate function for setting global options.

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


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

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

wininet: Use separate function for setting global options.

---

 dlls/wininet/internet.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index bd954a2..a360835 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -2540,6 +2540,17 @@ DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
     return ERROR_INTERNET_INVALID_OPTION;
 }
 
+static DWORD set_global_option(DWORD option, void *buf, DWORD size)
+{
+    switch(option) {
+    case INTERNET_OPTION_CALLBACK:
+        WARN("Not global option %u\n", option);
+        return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
+    }
+
+    return ERROR_INTERNET_INVALID_OPTION;
+}
+
 /***********************************************************************
  *           InternetSetOptionW (WININET.@)
  *
@@ -2555,37 +2566,28 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
 {
     object_header_t *lpwhh;
     BOOL ret = TRUE;
+    DWORD res;
 
     TRACE("(%p %d %p %d)\n", hInternet, dwOption, lpBuffer, dwBufferLength);
 
     lpwhh = (object_header_t*) get_handle_object( hInternet );
-    if(lpwhh) {
-        DWORD res;
-
+    if(lpwhh)
         res = lpwhh->vtbl->SetOption(lpwhh, dwOption, lpBuffer, dwBufferLength);
-        if(res != ERROR_INTERNET_INVALID_OPTION) {
-            WININET_Release( lpwhh );
+    else
+        res = set_global_option(dwOption, lpBuffer, dwBufferLength);
 
-            if(res != ERROR_SUCCESS)
-                SetLastError(res);
+    if(res != ERROR_INTERNET_INVALID_OPTION) {
+        if(lpwhh)
+            WININET_Release(lpwhh);
 
-            return res == ERROR_SUCCESS;
-        }
+        if(res != ERROR_SUCCESS)
+            SetLastError(res);
+
+        return res == ERROR_SUCCESS;
     }
 
     switch (dwOption)
     {
-    case INTERNET_OPTION_CALLBACK:
-      {
-        if (!lpwhh)
-        {
-            SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
-            return FALSE;
-        }
-        WININET_Release(lpwhh);
-        SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
-        return FALSE;
-      }
     case INTERNET_OPTION_HTTP_VERSION:
       {
         HTTP_VERSION_INFO* pVersion=(HTTP_VERSION_INFO*)lpBuffer;




More information about the wine-cvs mailing list