From 31c9b8241111b50c1a551c2b9c80029afc94e272 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Sun, 11 May 2003 02:59:52 +0000 Subject: [PATCH] Implemented InternetSetOptionExA/W. --- dlls/wininet/internet.c | 77 +++++++++++++++++++++++++++++++++++++-- dlls/wininet/wininet.spec | 6 +-- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index cc5bdabcb4b..744b98e4cbf 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1530,10 +1530,79 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength) { - /* FIXME!!! implement if lpBuffer is a string, dwBufferLength is - in TCHARs */ - return InternetSetOptionW(hInternet,dwOption, lpBuffer, - dwBufferLength); + LPVOID wbuffer; + DWORD wlen; + BOOL r; + + switch( dwOption ) + { + case INTERNET_OPTION_PROXY: + { + LPINTERNET_PROXY_INFOA pi = (LPINTERNET_PROXY_INFOA) lpBuffer; + LPINTERNET_PROXY_INFOW piw; + DWORD proxlen, prbylen; + LPWSTR prox, prby; + + proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0); + prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0); + wlen = sizeof *piw + proxlen + prbylen; + wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen ); + piw = (LPINTERNET_PROXY_INFOW) wbuffer; + piw->dwAccessType = pi->dwAccessType; + prox = (LPWSTR) &piw[1]; + prby = &prox[proxlen+1]; + MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, prox, proxlen); + MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, prby, prbylen); + piw->lpszProxy = prox; + piw->lpszProxyBypass = prby; + } + break; + case INTERNET_OPTION_USER_AGENT: + case INTERNET_OPTION_USERNAME: + case INTERNET_OPTION_PASSWORD: + wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, + NULL, 0 ); + wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen ); + MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, + wbuffer, wlen ); + break; + default: + wbuffer = lpBuffer; + wlen = dwBufferLength; + } + + r = InternetSetOptionW(hInternet,dwOption, wbuffer, wlen); + + if( lpBuffer != wbuffer ) + HeapFree( GetProcessHeap(), 0, wbuffer ); + + return r; +} + + +/*********************************************************************** + * InternetSetOptionExA (WININET.@) + */ +BOOL WINAPI InternetSetOptionExA(HINTERNET hInternet, DWORD dwOption, + LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags) +{ + FIXME("Flags %08lx ignored\n", dwFlags); + return InternetSetOptionA( hInternet, dwOption, lpBuffer, dwBufferLength ); +} + +/*********************************************************************** + * InternetSetOptionExW (WININET.@) + */ +BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption, + LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags) +{ + FIXME("Flags %08lx ignored\n", dwFlags); + if( dwFlags & ~ISO_VALID_FLAGS ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + return InternetSetOptionW( hInternet, dwOption, lpBuffer, dwBufferLength ); } diff --git a/dlls/wininet/wininet.spec b/dlls/wininet/wininet.spec index 7cdfa42e0c8..b965cc5ad2f 100644 --- a/dlls/wininet/wininet.spec +++ b/dlls/wininet/wininet.spec @@ -11,7 +11,7 @@ @ stub DeleteUrlCacheContainerA @ stub DeleteUrlCacheContainerW @ stdcall DeleteUrlCacheEntry(str) -@ stdcall DeleteUrlCacheGroup(double long ptr) DeleteUrlCacheGroup +@ stdcall DeleteUrlCacheGroup(double long ptr) @ stdcall DetectAutoProxyUrl(str long long) @ stdcall DllInstall(long ptr) WININET_DllInstall @ stub FindCloseUrlCache @@ -131,8 +131,8 @@ @ stub InternetSetFilePointer @ stdcall InternetSetOptionA(ptr long ptr long) @ stdcall InternetSetOptionW(ptr long ptr long) -@ stub InternetSetOptionExA -@ stub InternetSetOptionExW +@ stdcall InternetSetOptionExA(ptr long ptr long long) +@ stdcall InternetSetOptionExW(ptr long ptr long long) @ stdcall InternetSetStatusCallback(ptr ptr) InternetSetStatusCallbackA @ stdcall InternetSetStatusCallbackA(ptr ptr) @ stub InternetSetStatusCallbackW