Jacek Caban : wininet: Move InternetQueryOption(INTERNET_OPTION_URL) to vtbl.
Alexandre Julliard
julliard at winehq.org
Wed Mar 12 06:44:17 CDT 2008
Module: wine
Branch: master
Commit: 0e010d83a1e3cef55b1857d7469b62e334d1d519
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e010d83a1e3cef55b1857d7469b62e334d1d519
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 12 02:23:48 2008 +0100
wininet: Move InternetQueryOption(INTERNET_OPTION_URL) to vtbl.
---
dlls/wininet/http.c | 34 +++++++++++++++++++++++++++++++++
dlls/wininet/internet.c | 48 -----------------------------------------------
2 files changed, 34 insertions(+), 48 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 7e4e780..f418293 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1405,6 +1405,8 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr)
static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
{
+ WININETHTTPREQW *req = (WININETHTTPREQW*)hdr;
+
switch(option) {
case INTERNET_OPTION_HANDLE_TYPE:
TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
@@ -1415,6 +1417,38 @@ static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b
*size = sizeof(DWORD);
*(DWORD*)buffer = INTERNET_HANDLE_TYPE_HTTP_REQUEST;
return ERROR_SUCCESS;
+
+ case INTERNET_OPTION_URL: {
+ WCHAR url[INTERNET_MAX_URL_LENGTH];
+ HTTPHEADERW *host;
+ DWORD len;
+
+ static const WCHAR formatW[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
+ static const WCHAR hostW[] = {'H','o','s','t',0};
+
+ TRACE("INTERNET_OPTION_URL\n");
+
+ host = HTTP_GetHeader(req, hostW);
+ sprintfW(url, formatW, host->lpszValue, req->lpszPath);
+ TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
+
+ if(unicode) {
+ len = (strlenW(url)+1) * sizeof(WCHAR);
+ if(*size < len)
+ return ERROR_INSUFFICIENT_BUFFER;
+
+ *size = len;
+ strcpyW(buffer, url);
+ return ERROR_SUCCESS;
+ }else {
+ len = WideCharToMultiByte(CP_ACP, 0, url, -1, buffer, *size, NULL, NULL);
+ if(len > *size)
+ return ERROR_INSUFFICIENT_BUFFER;
+
+ *size = len;
+ return ERROR_SUCCESS;
+ }
+ }
}
FIXME("Not implemented option %d\n", option);
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 0905c93..748c518 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1868,54 +1868,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
break;
}
- case INTERNET_OPTION_URL:
- {
- TRACE("INTERNET_OPTION_URL\n");
-
- if (!lpwhh)
- {
- WARN("Invalid hInternet handle\n");
- INTERNET_SetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
- }
- if (lpwhh->htype == WH_HHTTPREQ)
- {
- LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh;
- WCHAR url[1023];
- static const WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
- static const WCHAR szHost[] = {'H','o','s','t',0};
- DWORD sizeRequired;
- LPHTTPHEADERW Host;
-
- Host = HTTP_GetHeader(lpreq,szHost);
- sprintfW(url,szFmt,Host->lpszValue,lpreq->lpszPath);
- TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
- if(!bIsUnicode)
- {
- sizeRequired = WideCharToMultiByte(CP_ACP,0,url,-1,
- lpBuffer,*lpdwBufferLength,NULL,NULL);
- if (sizeRequired > *lpdwBufferLength)
- INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
- else
- bSuccess = TRUE;
- *lpdwBufferLength = sizeRequired;
- }
- else
- {
- sizeRequired = (lstrlenW(url)+1) * sizeof(WCHAR);
- if (*lpdwBufferLength < sizeRequired)
- INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
- else
- {
- strcpyW(lpBuffer, url);
- bSuccess = TRUE;
- }
- *lpdwBufferLength = sizeRequired;
- }
- }
- break;
- }
-
case INTERNET_OPTION_USER_AGENT:
FIXME("INTERNET_OPTION_USER_AGENT\n");
break;
More information about the wine-cvs
mailing list