Module: wine Branch: master Commit: 7426e7e0555f77336408c30a5e9095c4414005bb URL: http://source.winehq.org/git/wine.git/?a=commit;h=7426e7e0555f77336408c30a5e...
Author: Jacek Caban jacek@codeweavers.com Date: Sat Jul 19 12:29:28 2008 +0200
wininet: Moved more InternetQueryOption implementation to vtbl.
---
dlls/wininet/ftp.c | 9 +--- dlls/wininet/http.c | 6 +-- dlls/wininet/internet.c | 112 ++++++++++++++++++++++------------------------- dlls/wininet/internet.h | 2 + 4 files changed, 60 insertions(+), 69 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 36e9005..f35929d 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1227,8 +1227,7 @@ static DWORD FTPFILE_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b return ERROR_SUCCESS; }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INVALID_OPTION; + return INET_QueryOption(option, buffer, size, unicode); }
static DWORD FTPFILE_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size, DWORD *read) @@ -2194,8 +2193,7 @@ static DWORD FTPSESSION_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void return ERROR_SUCCESS; }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INVALID_OPTION; + return INET_QueryOption(option, buffer, size, unicode); }
static const HANDLEHEADERVtbl FTPSESSIONVtbl = { @@ -3275,8 +3273,7 @@ static DWORD FTPFINDNEXT_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, voi return ERROR_SUCCESS; }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INVALID_OPTION; + return INET_QueryOption(option, buffer, size, unicode); }
static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index cefa836..b31996d 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1579,8 +1579,7 @@ static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b } }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INVALID_OPTION; + return INET_QueryOption(option, buffer, size, unicode); }
static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD size) @@ -3472,8 +3471,7 @@ static DWORD HTTPSESSION_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, voi return ERROR_SUCCESS; }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; + return INET_QueryOption(option, buffer, size, unicode); }
static const HANDLEHEADERVtbl HTTPSESSIONVtbl = { diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index cce504f..2e363d5 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -533,8 +533,7 @@ static DWORD APPINFO_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b } }
- FIXME("Not implemented option %d\n", option); - return ERROR_INTERNET_INVALID_OPTION; + return INET_QueryOption(option, buffer, size, unicode); }
static const HANDLEHEADERVtbl APPINFOVtbl = { @@ -1955,6 +1954,49 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, return FALSE; }
+DWORD INET_QueryOption(DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_REQUEST_FLAGS: + TRACE("INTERNET_OPTION_REQUEST_FLAGS\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *(ULONG*)buffer = 4; + *size = sizeof(ULONG); + + return ERROR_SUCCESS; + + case INTERNET_OPTION_HTTP_VERSION: + if (*size < sizeof(HTTP_VERSION_INFO)) + return ERROR_INSUFFICIENT_BUFFER; + + /* + * Presently hardcoded to 1.1 + */ + ((HTTP_VERSION_INFO*)buffer)->dwMajorVersion = 1; + ((HTTP_VERSION_INFO*)buffer)->dwMinorVersion = 1; + *size = sizeof(HTTP_VERSION_INFO); + + return ERROR_SUCCESS; + + case INTERNET_OPTION_CONNECTED_STATE: + FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *(ULONG*)buffer = INTERNET_STATE_CONNECTED; + *size = sizeof(ULONG); + + return ERROR_SUCCESS; + } + + FIXME("Stub for %d\n", option); + return ERROR_INTERNET_INCORRECT_HANDLE_TYPE; +} + /*********************************************************************** * INET_QueryOptionHelper (internal) */ @@ -1970,52 +2012,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
switch (dwOption) { - case INTERNET_OPTION_REQUEST_FLAGS: - { - ULONG flags = 4; - TRACE("INTERNET_OPTION_REQUEST_FLAGS: %d\n", flags); - if (*lpdwBufferLength < sizeof(ULONG)) - INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); - else - { - memcpy(lpBuffer, &flags, sizeof(ULONG)); - bSuccess = TRUE; - } - *lpdwBufferLength = sizeof(ULONG); - break; - } - - case INTERNET_OPTION_HTTP_VERSION: - { - if (*lpdwBufferLength < sizeof(HTTP_VERSION_INFO)) - INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); - else - { - /* - * Presently hardcoded to 1.1 - */ - ((HTTP_VERSION_INFO*)lpBuffer)->dwMajorVersion = 1; - ((HTTP_VERSION_INFO*)lpBuffer)->dwMinorVersion = 1; - bSuccess = TRUE; - } - *lpdwBufferLength = sizeof(HTTP_VERSION_INFO); - break; - } - case INTERNET_OPTION_CONNECTED_STATE: - { - DWORD *pdwConnectedState = (DWORD *)lpBuffer; - FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n"); - - if (*lpdwBufferLength < sizeof(*pdwConnectedState)) - INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); - else - { - *pdwConnectedState = INTERNET_STATE_CONNECTED; - bSuccess = TRUE; - } - *lpdwBufferLength = sizeof(*pdwConnectedState); - break; - } case INTERNET_OPTION_PROXY: { LPWININETAPPINFOW lpwai = (LPWININETAPPINFOW)lpwhh; @@ -2209,19 +2205,17 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d bSuccess = TRUE; break; default: { - if(lpwhh) { - DWORD res; + DWORD res;
+ if(lpwhh) res = lpwhh->vtbl->QueryOption(lpwhh, dwOption, lpBuffer, lpdwBufferLength, bIsUnicode); - if(res == ERROR_SUCCESS) - bSuccess = TRUE; - else - SetLastError(res); - }else { - FIXME("Stub! %d\n", dwOption); - SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - break; - } + else + res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, bIsUnicode); + + if(res == ERROR_SUCCESS) + bSuccess = TRUE; + else + SetLastError(res); } } if (lpwhh) diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 43b8d8e..bb694e9 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -347,6 +347,8 @@ LPWININETHANDLEHEADER WININET_AddRef( LPWININETHANDLEHEADER info ); BOOL WININET_Release( LPWININETHANDLEHEADER info ); BOOL WININET_FreeHandle( HINTERNET hinternet );
+DWORD INET_QueryOption(DWORD,void*,DWORD*,BOOL); + time_t ConvertTimeString(LPCWSTR asctime);
HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,