Commit e2933c20 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Move INTERNET_OPTION_HANDLE_TYPE to vtbl.

parent d4cff191
...@@ -1215,6 +1215,24 @@ static void FTPFILE_Destroy(WININETHANDLEHEADER *hdr) ...@@ -1215,6 +1215,24 @@ static void FTPFILE_Destroy(WININETHANDLEHEADER *hdr)
HeapFree(GetProcessHeap(), 0, lpwh); 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) static DWORD FTPFILE_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size, DWORD *read)
{ {
WININETFTPFILE *file = (WININETFTPFILE*)hdr; WININETFTPFILE *file = (WININETFTPFILE*)hdr;
...@@ -1244,6 +1262,7 @@ static BOOL FTPFILE_WriteFile(WININETHANDLEHEADER *hdr, const void *buffer, DWOR ...@@ -1244,6 +1262,7 @@ static BOOL FTPFILE_WriteFile(WININETHANDLEHEADER *hdr, const void *buffer, DWOR
static const HANDLEHEADERVtbl FTPFILEVtbl = { static const HANDLEHEADERVtbl FTPFILEVtbl = {
FTPFILE_Destroy, FTPFILE_Destroy,
NULL, NULL,
FTPFILE_QueryOption,
NULL, NULL,
FTPFILE_ReadFile, FTPFILE_ReadFile,
NULL, NULL,
...@@ -2163,9 +2182,28 @@ static void FTPSESSION_CloseConnection(WININETHANDLEHEADER *hdr) ...@@ -2163,9 +2182,28 @@ static void FTPSESSION_CloseConnection(WININETHANDLEHEADER *hdr)
INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); 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 = { static const HANDLEHEADERVtbl FTPSESSIONVtbl = {
FTPSESSION_Destroy, FTPSESSION_Destroy,
FTPSESSION_CloseConnection, FTPSESSION_CloseConnection,
FTPSESSION_QueryOption,
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -3229,6 +3267,24 @@ static void FTPFINDNEXT_AsyncFindNextFileProc(WORKREQUEST *workRequest) ...@@ -3229,6 +3267,24 @@ static void FTPFINDNEXT_AsyncFindNextFileProc(WORKREQUEST *workRequest)
FTPFINDNEXT_FindNextFileProc((WININETFTPFINDNEXTW*)workRequest->hdr, req->lpFindFileData); 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) static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data)
{ {
WININETFTPFINDNEXTW *find = (WININETFTPFINDNEXTW*)hdr; WININETFTPFINDNEXTW *find = (WININETFTPFINDNEXTW*)hdr;
...@@ -3254,6 +3310,7 @@ static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data) ...@@ -3254,6 +3310,7 @@ static DWORD FTPFINDNEXT_FindNextFileW(WININETHANDLEHEADER *hdr, void *data)
static const HANDLEHEADERVtbl FTPFINDNEXTVtbl = { static const HANDLEHEADERVtbl FTPFINDNEXTVtbl = {
FTPFINDNEXT_Destroy, FTPFINDNEXT_Destroy,
NULL, NULL,
FTPFINDNEXT_QueryOption,
NULL, NULL,
NULL, NULL,
NULL, NULL,
......
...@@ -1403,6 +1403,24 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr) ...@@ -1403,6 +1403,24 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr)
INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); 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) static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD size)
{ {
WININETHTTPREQW *req = (WININETHTTPREQW*)hdr; WININETHTTPREQW *req = (WININETHTTPREQW*)hdr;
...@@ -1589,6 +1607,7 @@ static DWORD HTTPREQ_QueryDataAvailable(WININETHANDLEHEADER *hdr, DWORD *availab ...@@ -1589,6 +1607,7 @@ static DWORD HTTPREQ_QueryDataAvailable(WININETHANDLEHEADER *hdr, DWORD *availab
static const HANDLEHEADERVtbl HTTPREQVtbl = { static const HANDLEHEADERVtbl HTTPREQVtbl = {
HTTPREQ_Destroy, HTTPREQ_Destroy,
HTTPREQ_CloseConnection, HTTPREQ_CloseConnection,
HTTPREQ_QueryOption,
HTTPREQ_SetOption, HTTPREQ_SetOption,
HTTPREQ_ReadFile, HTTPREQ_ReadFile,
HTTPREQ_ReadFileExA, HTTPREQ_ReadFileExA,
...@@ -3132,10 +3151,28 @@ static void HTTPSESSION_Destroy(WININETHANDLEHEADER *hdr) ...@@ -3132,10 +3151,28 @@ static void HTTPSESSION_Destroy(WININETHANDLEHEADER *hdr)
HeapFree(GetProcessHeap(), 0, lpwhs); 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 = { static const HANDLEHEADERVtbl HTTPSESSIONVtbl = {
HTTPSESSION_Destroy, HTTPSESSION_Destroy,
NULL, NULL,
HTTPSESSION_QueryOption,
NULL, NULL,
NULL, NULL,
NULL, NULL,
......
...@@ -471,9 +471,28 @@ static VOID APPINFO_Destroy(WININETHANDLEHEADER *hdr) ...@@ -471,9 +471,28 @@ static VOID APPINFO_Destroy(WININETHANDLEHEADER *hdr)
HeapFree(GetProcessHeap(), 0, lpwai); 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 = { static const HANDLEHEADERVtbl APPINFOVtbl = {
APPINFO_Destroy, APPINFO_Destroy,
NULL, NULL,
APPINFO_QueryOption,
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -1834,32 +1853,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d ...@@ -1834,32 +1853,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
switch (dwOption) 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: case INTERNET_OPTION_REQUEST_FLAGS:
{ {
ULONG flags = 4; ULONG flags = 4;
...@@ -1923,6 +1916,10 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d ...@@ -1923,6 +1916,10 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
break; break;
} }
case INTERNET_OPTION_USER_AGENT:
FIXME("INTERNET_OPTION_USER_AGENT\n");
break;
case INTERNET_OPTION_DATAFILE_NAME: case INTERNET_OPTION_DATAFILE_NAME:
{ {
TRACE("INTERNET_OPTION_DATAFILE_NAME\n"); TRACE("INTERNET_OPTION_DATAFILE_NAME\n");
...@@ -2272,9 +2269,20 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d ...@@ -2272,9 +2269,20 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
FIXME("66\n"); FIXME("66\n");
bSuccess = TRUE; bSuccess = TRUE;
break; break;
default: default: {
FIXME("Stub! %d\n", dwOption); if(lpwhh) {
break; 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) if (lpwhh)
WININET_Release( lpwhh ); WININET_Release( lpwhh );
......
...@@ -139,6 +139,7 @@ typedef struct _WININETHANDLEHEADER WININETHANDLEHEADER, *LPWININETHANDLEHEADER; ...@@ -139,6 +139,7 @@ typedef struct _WININETHANDLEHEADER WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
typedef struct { typedef struct {
void (*Destroy)(WININETHANDLEHEADER*); void (*Destroy)(WININETHANDLEHEADER*);
void (*CloseConnection)(WININETHANDLEHEADER*); void (*CloseConnection)(WININETHANDLEHEADER*);
DWORD (*QueryOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD*,BOOL);
DWORD (*SetOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD); DWORD (*SetOption)(WININETHANDLEHEADER*,DWORD,void*,DWORD);
DWORD (*ReadFile)(WININETHANDLEHEADER*,void*,DWORD,DWORD*); DWORD (*ReadFile)(WININETHANDLEHEADER*,void*,DWORD,DWORD*);
DWORD (*ReadFileExA)(WININETHANDLEHEADER*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR); DWORD (*ReadFileExA)(WININETHANDLEHEADER*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment