Module: wine Branch: master Commit: 2b09cfe9288cbd23fe78952e605fdca924a4d19d URL: http://source.winehq.org/git/wine.git/?a=commit;h=2b09cfe9288cbd23fe78952e60...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Nov 30 10:58:57 2016 +0100
winhttp/tests: Properly restore proxy settings on 64-bit.
Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winhttp/tests/winhttp.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 61c4acf..1b9ccc4 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -1217,21 +1217,28 @@ static DWORD get_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD *type ) return ret; }
-static void set_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD type ) +static void set_proxy( REGSAM access, BYTE *buf, DWORD len, DWORD type ) { - LONG l; - HKEY key; + HKEY hkey; + if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, NULL, 0, access, NULL, &hkey, NULL )) + { + if (len) RegSetValueExW( hkey, WinHttpSettings, 0, type, buf, len ); + else RegDeleteValueW( hkey, WinHttpSettings ); + RegCloseKey( hkey ); + } +}
- l = RegCreateKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, NULL, 0, - KEY_WRITE, NULL, &key, NULL ); - if (!l) +static void set_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD type ) +{ + BOOL wow64; + IsWow64Process( GetCurrentProcess(), &wow64 ); + if (sizeof(void *) > sizeof(int) || wow64) { - if (len) - RegSetValueExW( key, WinHttpSettings, 0, type, buf, len ); - else - RegDeleteValueW( key, WinHttpSettings ); - RegCloseKey( key ); + set_proxy( KEY_WRITE|KEY_WOW64_64KEY, buf, len, type ); + set_proxy( KEY_WRITE|KEY_WOW64_32KEY, buf, len, type ); } + else + set_proxy( KEY_WRITE, buf, len, type ); }
static void test_set_default_proxy_config(void)