diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index b9d305e71ec..76ddbfda199 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1215,6 +1215,24 @@ static void FTPFILE_Destroy(WININETHANDLEHEADER *hdr) HeapFree(GetProcessHeap(), 0, lpwh); } +static DWORD FTPFILE_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_FTP_FILE; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} + static DWORD FTPFILE_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size, DWORD *read) { WININETFTPFILE *file = (WININETFTPFILE*)hdr; @@ -1244,6 +1262,7 @@ static BOOL FTPFILE_WriteFile(WININETHANDLEHEADER *hdr, const void *buffer, DWOR static const HANDLEHEADERVtbl FTPFILEVtbl = { FTPFILE_Destroy, NULL, + FTPFILE_QueryOption, NULL, FTPFILE_ReadFile, NULL, @@ -2163,9 +2182,28 @@ static void FTPSESSION_CloseConnection(WININETHANDLEHEADER *hdr) INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); } +static DWORD FTPSESSION_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_CONNECT_FTP; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} + static const HANDLEHEADERVtbl FTPSESSIONVtbl = { FTPSESSION_Destroy, FTPSESSION_CloseConnection, + FTPSESSION_QueryOption, NULL, NULL, NULL, @@ -3229,6 +3267,24 @@ static void FTPFINDNEXT_AsyncFindNextFileProc(WORKREQUEST *workRequest) FTPFINDNEXT_FindNextFileProc((WININETFTPFINDNEXTW*)workRequest->hdr, req->lpFindFileData); } +static DWORD FTPFINDNEXT_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_FTP_FIND; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} + static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data) { WININETFTPFINDNEXTW *find = (WININETFTPFINDNEXTW*)hdr; @@ -3254,6 +3310,7 @@ static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data) static const HANDLEHEADERVtbl FTPFINDNEXTVtbl = { FTPFINDNEXT_Destroy, NULL, + FTPFINDNEXT_QueryOption, NULL, NULL, NULL, diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 638e520c519..7e4e78073ca 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1403,6 +1403,24 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr) INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); } +static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_HTTP_REQUEST; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} + static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD size) { WININETHTTPREQW *req = (WININETHTTPREQW*)hdr; @@ -1589,6 +1607,7 @@ static DWORD HTTPREQ_QueryDataAvailable(WININETHANDLEHEADER *hdr, DWORD *availab static const HANDLEHEADERVtbl HTTPREQVtbl = { HTTPREQ_Destroy, HTTPREQ_CloseConnection, + HTTPREQ_QueryOption, HTTPREQ_SetOption, HTTPREQ_ReadFile, HTTPREQ_ReadFileExA, @@ -3132,10 +3151,28 @@ static void HTTPSESSION_Destroy(WININETHANDLEHEADER *hdr) HeapFree(GetProcessHeap(), 0, lpwhs); } +static DWORD HTTPSESSION_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_CONNECT_HTTP; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} static const HANDLEHEADERVtbl HTTPSESSIONVtbl = { HTTPSESSION_Destroy, NULL, + HTTPSESSION_QueryOption, NULL, NULL, NULL, diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 5d8d46cff33..0905c934154 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -471,9 +471,28 @@ static VOID APPINFO_Destroy(WININETHANDLEHEADER *hdr) HeapFree(GetProcessHeap(), 0, lpwai); } +static DWORD APPINFO_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +{ + switch(option) { + case INTERNET_OPTION_HANDLE_TYPE: + TRACE("INTERNET_OPTION_HANDLE_TYPE\n"); + + if (*size < sizeof(ULONG)) + return ERROR_INSUFFICIENT_BUFFER; + + *size = sizeof(DWORD); + *(DWORD*)buffer = INTERNET_HANDLE_TYPE_INTERNET; + return ERROR_SUCCESS; + } + + FIXME("Not implemented option %d\n", option); + return ERROR_INTERNET_INVALID_OPTION; +} + static const HANDLEHEADERVtbl APPINFOVtbl = { APPINFO_Destroy, NULL, + APPINFO_QueryOption, NULL, NULL, NULL, @@ -1834,32 +1853,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d switch (dwOption) { - case INTERNET_OPTION_HANDLE_TYPE: - { - ULONG type; - - if (!lpwhh) - { - WARN("Invalid hInternet handle\n"); - INTERNET_SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - - type = lpwhh->htype; - - TRACE("INTERNET_OPTION_HANDLE_TYPE: %d\n", type); - - if (*lpdwBufferLength < sizeof(ULONG)) - INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); - else - { - memcpy(lpBuffer, &type, sizeof(ULONG)); - bSuccess = TRUE; - } - *lpdwBufferLength = sizeof(ULONG); - break; - } - case INTERNET_OPTION_REQUEST_FLAGS: { ULONG flags = 4; @@ -1923,6 +1916,10 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d break; } + case INTERNET_OPTION_USER_AGENT: + FIXME("INTERNET_OPTION_USER_AGENT\n"); + break; + case INTERNET_OPTION_DATAFILE_NAME: { TRACE("INTERNET_OPTION_DATAFILE_NAME\n"); @@ -2272,9 +2269,20 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d FIXME("66\n"); bSuccess = TRUE; break; - default: - FIXME("Stub! %d\n", dwOption); - break; + default: { + if(lpwhh) { + DWORD res; + + res = lpwhh->vtbl->QueryOption(lpwhh, dwOption, lpBuffer, lpdwBufferLength, bIsUnicode); + if(res == ERROR_SUCCESS) + bSuccess = TRUE; + else + SetLastError(res); + }else { + FIXME("Stub! %d\n", dwOption); + break; + } + } } if (lpwhh) WININET_Release( lpwhh ); diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 106b054dbfa..26456861e18 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -139,6 +139,7 @@ typedef struct _WININETHANDLEHEADER WININETHANDLEHEADER, *LPWININETHANDLEHEADER; typedef struct { void (*Destroy)(WININETHANDLEHEADER*); void (*CloseConnection)(WININETHANDLEHEADER*); + DWORD (*QueryOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD*,BOOL); DWORD (*SetOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD); DWORD (*ReadFile)(WININETHANDLEHEADER*,void*,DWORD,DWORD*); DWORD (*ReadFileExA)(WININETHANDLEHEADER*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR);