mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
Move all FTP functions to unicode.
Improve FTP LIST parsing.
This commit is contained in:
parent
94d74b5fed
commit
1d2d2d6bf1
1504
dlls/wininet/ftp.c
1504
dlls/wininet/ftp.c
File diff suppressed because it is too large
Load Diff
@ -72,7 +72,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
#define RESPONSE_TIMEOUT 30
|
||||
|
||||
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
|
||||
(LPWININETAPPINFOW)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
|
||||
(LPWININETAPPINFOW)(((LPWININETFTPSESSIONW)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
|
||||
|
||||
|
||||
typedef struct
|
||||
@ -81,7 +81,7 @@ typedef struct
|
||||
CHAR response[MAX_REPLY_LEN];
|
||||
} WITHREADERROR, *LPWITHREADERROR;
|
||||
|
||||
BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData);
|
||||
BOOL WINAPI INTERNET_FindNextFileW(HINTERNET hFind, LPVOID lpvFindData);
|
||||
HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext);
|
||||
VOID INTERNET_ExecuteWork();
|
||||
@ -745,13 +745,34 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
{
|
||||
BOOL ret;
|
||||
WIN32_FIND_DATAW fd;
|
||||
|
||||
ret = InternetFindNextFileW(hFind, lpvFindData?&fd:NULL);
|
||||
if(lpvFindData)
|
||||
WININET_find_data_WtoA(&fd, (LPWIN32_FIND_DATAA)lpvFindData);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetFindNextFileW (WININET.@)
|
||||
*
|
||||
* Continues a file search from a previous call to FindFirstFile
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE on success
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI InternetFindNextFileW(HINTERNET hFind, LPVOID lpvFindData)
|
||||
{
|
||||
LPWININETAPPINFOW hIC = NULL;
|
||||
LPWININETFINDNEXTA lpwh;
|
||||
LPWININETFINDNEXTW lpwh;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
lpwh = (LPWININETFINDNEXTA) WININET_GetObject( hFind );
|
||||
lpwh = (LPWININETFINDNEXTW) WININET_GetObject( hFind );
|
||||
|
||||
if (NULL == lpwh || lpwh->hdr.htype != WH_HFINDNEXT)
|
||||
{
|
||||
@ -763,23 +784,23 @@ BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_INTERNETFINDNEXTA *req;
|
||||
struct WORKREQ_INTERNETFINDNEXTW *req;
|
||||
|
||||
workRequest.asyncall = INTERNETFINDNEXTA;
|
||||
workRequest.asyncall = INTERNETFINDNEXTW;
|
||||
workRequest.handle = hFind;
|
||||
req = &workRequest.u.InternetFindNextA;
|
||||
req = &workRequest.u.InternetFindNextW;
|
||||
req->lpFindFileData = lpvFindData;
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
else
|
||||
{
|
||||
return INTERNET_FindNextFileA(hFind, lpvFindData);
|
||||
return INTERNET_FindNextFileW(hFind, lpvFindData);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* INTERNET_FindNextFileA (Internal)
|
||||
* INTERNET_FindNextFileW (Internal)
|
||||
*
|
||||
* Continues a file search from a previous call to FindFirstFile
|
||||
*
|
||||
@ -788,16 +809,16 @@ BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
* FALSE on failure
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
BOOL WINAPI INTERNET_FindNextFileW(HINTERNET hFind, LPVOID lpvFindData)
|
||||
{
|
||||
BOOL bSuccess = TRUE;
|
||||
LPWININETAPPINFOW hIC = NULL;
|
||||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
LPWININETFINDNEXTA lpwh;
|
||||
LPWIN32_FIND_DATAW lpFindFileData;
|
||||
LPWININETFINDNEXTW lpwh;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
lpwh = (LPWININETFINDNEXTA) WININET_GetObject( hFind );
|
||||
lpwh = (LPWININETFINDNEXTW) WININET_GetObject( hFind );
|
||||
if (NULL == lpwh || lpwh->hdr.htype != WH_HFINDNEXT)
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
||||
@ -816,7 +837,7 @@ BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
|
||||
TRACE("index(%d) size(%ld)\n", lpwh->index, lpwh->size);
|
||||
|
||||
lpFindFileData = (LPWIN32_FIND_DATAA) lpvFindData;
|
||||
lpFindFileData = (LPWIN32_FIND_DATAW) lpvFindData;
|
||||
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
|
||||
|
||||
if (lpwh->index >= lpwh->size)
|
||||
@ -829,12 +850,12 @@ BOOL WINAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
||||
FTP_ConvertFileProp(&lpwh->lpafp[lpwh->index], lpFindFileData);
|
||||
lpwh->index++;
|
||||
|
||||
TRACE("\nName: %s\nSize: %ld\n", lpFindFileData->cFileName, lpFindFileData->nFileSizeLow);
|
||||
TRACE("\nName: %s\nSize: %ld\n", debugstr_w(lpFindFileData->cFileName), lpFindFileData->nFileSizeLow);
|
||||
|
||||
lend:
|
||||
|
||||
hIC = GET_HWININET_FROM_LPWININETFINDNEXT(lpwh);
|
||||
if (hIC->lpfnStatusCB)
|
||||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
|
||||
{
|
||||
INTERNET_ASYNC_RESULT iar;
|
||||
|
||||
@ -933,11 +954,11 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
|
||||
break;
|
||||
|
||||
case WH_HFTPSESSION:
|
||||
retval = FTP_CloseSessionHandle((LPWININETFTPSESSIONA) lpwh);
|
||||
retval = FTP_CloseSessionHandle((LPWININETFTPSESSIONW) lpwh);
|
||||
break;
|
||||
|
||||
case WH_HFINDNEXT:
|
||||
retval = FTP_CloseFindNextHandle((LPWININETFINDNEXTA) lpwh);
|
||||
retval = FTP_CloseFindNextHandle((LPWININETFINDNEXTW) lpwh);
|
||||
break;
|
||||
|
||||
case WH_HFILE:
|
||||
@ -1460,14 +1481,49 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
|
||||
INTERNET_STATUS_CALLBACK retVal;
|
||||
LPWININETAPPINFOW lpwai;
|
||||
|
||||
TRACE("0x%08lx\n", (ULONG)hInternet);
|
||||
|
||||
lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet);
|
||||
if (!lpwai)
|
||||
return NULL;
|
||||
|
||||
TRACE("0x%08lx\n", (ULONG)hInternet);
|
||||
if (lpwai->hdr.htype != WH_HINIT)
|
||||
return INTERNET_INVALID_STATUS_CALLBACK;
|
||||
|
||||
lpwai->hdr.dwInternalFlags &= ~INET_CALLBACKW;
|
||||
retVal = lpwai->lpfnStatusCB;
|
||||
lpwai->lpfnStatusCB = lpfnIntCB;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InternetSetStatusCallbackW (WININET.@)
|
||||
*
|
||||
* Sets up a callback function which is called as progress is made
|
||||
* during an operation.
|
||||
*
|
||||
* RETURNS
|
||||
* Previous callback or NULL on success
|
||||
* INTERNET_INVALID_STATUS_CALLBACK on failure
|
||||
*
|
||||
*/
|
||||
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(
|
||||
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
|
||||
{
|
||||
INTERNET_STATUS_CALLBACK retVal;
|
||||
LPWININETAPPINFOW lpwai;
|
||||
|
||||
TRACE("0x%08lx\n", (ULONG)hInternet);
|
||||
|
||||
lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet);
|
||||
if (!lpwai)
|
||||
return NULL;
|
||||
|
||||
if (lpwai->hdr.htype != WH_HINIT)
|
||||
return INTERNET_INVALID_STATUS_CALLBACK;
|
||||
|
||||
lpwai->hdr.dwInternalFlags |= INET_CALLBACKW;
|
||||
retVal = lpwai->lpfnStatusCB;
|
||||
lpwai->lpfnStatusCB = lpfnIntCB;
|
||||
|
||||
@ -2071,7 +2127,13 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
urlComponents.nPort = INTERNET_DEFAULT_FTP_PORT;
|
||||
client = FTP_Connect(hInternet, hostName, urlComponents.nPort,
|
||||
userName, password, dwFlags, dwContext, INET_OPENURL);
|
||||
if(client == NULL)
|
||||
break;
|
||||
client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
|
||||
if(client1 == NULL) {
|
||||
InternetCloseHandle(client);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INTERNET_SCHEME_HTTP:
|
||||
@ -2096,7 +2158,6 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
||||
HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
|
||||
if (!HTTP_HttpSendRequestW(client1, NULL, 0, NULL, 0)) {
|
||||
InternetCloseHandle(client1);
|
||||
InternetCloseHandle(client);
|
||||
client1 = NULL;
|
||||
break;
|
||||
}
|
||||
@ -2425,17 +2486,17 @@ VOID INTERNET_ExecuteWork()
|
||||
if (TRACE_ON(wininet)) {
|
||||
static const wininet_flag_info work_request_types[] = {
|
||||
#define FE(x) { x, #x }
|
||||
FE(FTPPUTFILEA),
|
||||
FE(FTPSETCURRENTDIRECTORYA),
|
||||
FE(FTPCREATEDIRECTORYA),
|
||||
FE(FTPFINDFIRSTFILEA),
|
||||
FE(FTPGETCURRENTDIRECTORYA),
|
||||
FE(FTPOPENFILEA),
|
||||
FE(FTPGETFILEA),
|
||||
FE(FTPDELETEFILEA),
|
||||
FE(FTPREMOVEDIRECTORYA),
|
||||
FE(FTPRENAMEFILEA),
|
||||
FE(INTERNETFINDNEXTA),
|
||||
FE(FTPPUTFILEW),
|
||||
FE(FTPSETCURRENTDIRECTORYW),
|
||||
FE(FTPCREATEDIRECTORYW),
|
||||
FE(FTPFINDFIRSTFILEW),
|
||||
FE(FTPGETCURRENTDIRECTORYW),
|
||||
FE(FTPOPENFILEW),
|
||||
FE(FTPGETFILEW),
|
||||
FE(FTPDELETEFILEW),
|
||||
FE(FTPREMOVEDIRECTORYW),
|
||||
FE(FTPRENAMEFILEW),
|
||||
FE(INTERNETFINDNEXTW),
|
||||
FE(HTTPSENDREQUESTW),
|
||||
FE(HTTPOPENREQUESTW),
|
||||
FE(SENDCALLBACK),
|
||||
@ -2456,11 +2517,11 @@ VOID INTERNET_ExecuteWork()
|
||||
}
|
||||
switch (workRequest.asyncall)
|
||||
{
|
||||
case FTPPUTFILEA:
|
||||
case FTPPUTFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPPUTFILEA *req = &workRequest.u.FtpPutFileA;
|
||||
struct WORKREQ_FTPPUTFILEW *req = &workRequest.u.FtpPutFileW;
|
||||
|
||||
FTP_FtpPutFileA(workRequest.handle, req->lpszLocalFile,
|
||||
FTP_FtpPutFileW(workRequest.handle, req->lpszLocalFile,
|
||||
req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszLocalFile);
|
||||
@ -2468,62 +2529,62 @@ VOID INTERNET_ExecuteWork()
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPSETCURRENTDIRECTORYA:
|
||||
case FTPSETCURRENTDIRECTORYW:
|
||||
{
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA *req;
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYW *req;
|
||||
|
||||
req = &workRequest.u.FtpSetCurrentDirectoryA;
|
||||
FTP_FtpSetCurrentDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
req = &workRequest.u.FtpSetCurrentDirectoryW;
|
||||
FTP_FtpSetCurrentDirectoryW(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPCREATEDIRECTORYA:
|
||||
case FTPCREATEDIRECTORYW:
|
||||
{
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA *req;
|
||||
struct WORKREQ_FTPCREATEDIRECTORYW *req;
|
||||
|
||||
req = &workRequest.u.FtpCreateDirectoryA;
|
||||
FTP_FtpCreateDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
req = &workRequest.u.FtpCreateDirectoryW;
|
||||
FTP_FtpCreateDirectoryW(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPFINDFIRSTFILEA:
|
||||
case FTPFINDFIRSTFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA *req;
|
||||
struct WORKREQ_FTPFINDFIRSTFILEW *req;
|
||||
|
||||
req = &workRequest.u.FtpFindFirstFileA;
|
||||
FTP_FtpFindFirstFileA(workRequest.handle, req->lpszSearchFile,
|
||||
req = &workRequest.u.FtpFindFirstFileW;
|
||||
FTP_FtpFindFirstFileW(workRequest.handle, req->lpszSearchFile,
|
||||
req->lpFindFileData, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPGETCURRENTDIRECTORYA:
|
||||
case FTPGETCURRENTDIRECTORYW:
|
||||
{
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA *req;
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYW *req;
|
||||
|
||||
req = &workRequest.u.FtpGetCurrentDirectoryA;
|
||||
FTP_FtpGetCurrentDirectoryA(workRequest.handle,
|
||||
req = &workRequest.u.FtpGetCurrentDirectoryW;
|
||||
FTP_FtpGetCurrentDirectoryW(workRequest.handle,
|
||||
req->lpszDirectory, req->lpdwDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPOPENFILEA:
|
||||
case FTPOPENFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPOPENFILEA *req = &workRequest.u.FtpOpenFileA;
|
||||
struct WORKREQ_FTPOPENFILEW *req = &workRequest.u.FtpOpenFileW;
|
||||
|
||||
FTP_FtpOpenFileA(workRequest.handle, req->lpszFilename,
|
||||
FTP_FtpOpenFileW(workRequest.handle, req->lpszFilename,
|
||||
req->dwAccess, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPGETFILEA:
|
||||
case FTPGETFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPGETFILEA *req = &workRequest.u.FtpGetFileA;
|
||||
struct WORKREQ_FTPGETFILEW *req = &workRequest.u.FtpGetFileW;
|
||||
|
||||
FTP_FtpGetFileA(workRequest.handle, req->lpszRemoteFile,
|
||||
FTP_FtpGetFileW(workRequest.handle, req->lpszRemoteFile,
|
||||
req->lpszNewFile, req->fFailIfExists,
|
||||
req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile);
|
||||
@ -2531,41 +2592,41 @@ VOID INTERNET_ExecuteWork()
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPDELETEFILEA:
|
||||
case FTPDELETEFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPDELETEFILEA *req = &workRequest.u.FtpDeleteFileA;
|
||||
struct WORKREQ_FTPDELETEFILEW *req = &workRequest.u.FtpDeleteFileW;
|
||||
|
||||
FTP_FtpDeleteFileA(workRequest.handle, req->lpszFilename);
|
||||
FTP_FtpDeleteFileW(workRequest.handle, req->lpszFilename);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPREMOVEDIRECTORYA:
|
||||
case FTPREMOVEDIRECTORYW:
|
||||
{
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA *req;
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYW *req;
|
||||
|
||||
req = &workRequest.u.FtpRemoveDirectoryA;
|
||||
FTP_FtpRemoveDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
req = &workRequest.u.FtpRemoveDirectoryW;
|
||||
FTP_FtpRemoveDirectoryW(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPRENAMEFILEA:
|
||||
case FTPRENAMEFILEW:
|
||||
{
|
||||
struct WORKREQ_FTPRENAMEFILEA *req = &workRequest.u.FtpRenameFileA;
|
||||
struct WORKREQ_FTPRENAMEFILEW *req = &workRequest.u.FtpRenameFileW;
|
||||
|
||||
FTP_FtpRenameFileA(workRequest.handle, req->lpszSrcFile, req->lpszDestFile);
|
||||
FTP_FtpRenameFileW(workRequest.handle, req->lpszSrcFile, req->lpszDestFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSrcFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDestFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case INTERNETFINDNEXTA:
|
||||
case INTERNETFINDNEXTW:
|
||||
{
|
||||
struct WORKREQ_INTERNETFINDNEXTA *req;
|
||||
struct WORKREQ_INTERNETFINDNEXTW *req;
|
||||
|
||||
req = &workRequest.u.InternetFindNextA;
|
||||
INTERNET_FindNextFileA(workRequest.handle, req->lpFindFileData);
|
||||
req = &workRequest.u.InternetFindNextW;
|
||||
INTERNET_FindNextFileW(workRequest.handle, req->lpFindFileData);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2643,12 +2704,13 @@ LPSTR INTERNET_GetResponseBuffer()
|
||||
*
|
||||
*/
|
||||
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer)
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set infd;
|
||||
BOOL bSuccess = FALSE;
|
||||
INT nRecv = 0;
|
||||
LPSTR lpszBuffer = INTERNET_GetResponseBuffer();
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
@ -2657,7 +2719,7 @@ LPSTR INTERNET_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer)
|
||||
tv.tv_sec=RESPONSE_TIMEOUT;
|
||||
tv.tv_usec=0;
|
||||
|
||||
while (nRecv < *dwBuffer)
|
||||
while (nRecv < MAX_REPLY_LEN)
|
||||
{
|
||||
if (select(nSocket+1,&infd,NULL,NULL,&tv) > 0)
|
||||
{
|
||||
@ -2686,7 +2748,7 @@ lend:
|
||||
if (bSuccess)
|
||||
{
|
||||
lpszBuffer[nRecv] = '\0';
|
||||
*dwBuffer = nRecv - 1;
|
||||
*dwLen = nRecv - 1;
|
||||
TRACE(":%d %s\n", nRecv, lpszBuffer);
|
||||
return lpszBuffer;
|
||||
}
|
||||
|
@ -70,6 +70,42 @@ inline static LPWSTR WININET_strdupW( LPCWSTR str )
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static LPWSTR WININET_strdup_AtoW( LPCSTR str )
|
||||
{
|
||||
int len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0);
|
||||
LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
||||
if (ret)
|
||||
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static LPSTR WININET_strdup_WtoA( LPCWSTR str )
|
||||
{
|
||||
int len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
|
||||
LPSTR ret = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
if (ret)
|
||||
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
|
||||
{
|
||||
dataA->dwFileAttributes = dataW->dwFileAttributes;
|
||||
dataA->ftCreationTime = dataW->ftCreationTime;
|
||||
dataA->ftLastAccessTime = dataW->ftLastAccessTime;
|
||||
dataA->ftLastWriteTime = dataW->ftLastWriteTime;
|
||||
dataA->nFileSizeHigh = dataW->nFileSizeHigh;
|
||||
dataA->nFileSizeLow = dataW->nFileSizeLow;
|
||||
dataA->dwReserved0 = dataW->dwReserved0;
|
||||
dataA->dwReserved1 = dataW->dwReserved1;
|
||||
WideCharToMultiByte(CP_ACP, 0, dataW->cFileName, -1,
|
||||
dataA->cFileName, sizeof(dataA->cFileName),
|
||||
NULL, NULL);
|
||||
WideCharToMultiByte(CP_ACP, 0, dataW->cAlternateFileName, -1,
|
||||
dataA->cAlternateFileName, sizeof(dataA->cAlternateFileName),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
|
||||
@ -82,6 +118,7 @@ typedef enum
|
||||
} WH_TYPE;
|
||||
|
||||
#define INET_OPENURL 0x0001
|
||||
#define INET_CALLBACKW 0x0002
|
||||
|
||||
typedef struct _WININETHANDLEHEADER
|
||||
{
|
||||
@ -161,19 +198,19 @@ typedef struct
|
||||
struct sockaddr_in socketAddress;
|
||||
struct sockaddr_in lstnSocketAddress;
|
||||
struct hostent *phostent;
|
||||
LPSTR lpszPassword;
|
||||
LPSTR lpszUserName;
|
||||
} WININETFTPSESSIONA, *LPWININETFTPSESSIONA;
|
||||
LPWSTR lpszPassword;
|
||||
LPWSTR lpszUserName;
|
||||
} WININETFTPSESSIONW, *LPWININETFTPSESSIONW;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOL bIsDirectory;
|
||||
LPSTR lpszName;
|
||||
LPWSTR lpszName;
|
||||
DWORD nSize;
|
||||
struct tm tmLastModified;
|
||||
unsigned short permissions;
|
||||
} FILEPROPERTIESA, *LPFILEPROPERTIESA;
|
||||
} FILEPROPERTIESW, *LPFILEPROPERTIESW;
|
||||
|
||||
|
||||
typedef struct
|
||||
@ -181,97 +218,97 @@ typedef struct
|
||||
WININETHANDLEHEADER hdr;
|
||||
int index;
|
||||
DWORD size;
|
||||
LPFILEPROPERTIESA lpafp;
|
||||
} WININETFINDNEXTA, *LPWININETFINDNEXTA;
|
||||
LPFILEPROPERTIESW lpafp;
|
||||
} WININETFINDNEXTW, *LPWININETFINDNEXTW;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FTPPUTFILEA,
|
||||
FTPSETCURRENTDIRECTORYA,
|
||||
FTPCREATEDIRECTORYA,
|
||||
FTPFINDFIRSTFILEA,
|
||||
FTPGETCURRENTDIRECTORYA,
|
||||
FTPOPENFILEA,
|
||||
FTPGETFILEA,
|
||||
FTPDELETEFILEA,
|
||||
FTPREMOVEDIRECTORYA,
|
||||
FTPRENAMEFILEA,
|
||||
INTERNETFINDNEXTA,
|
||||
FTPPUTFILEW,
|
||||
FTPSETCURRENTDIRECTORYW,
|
||||
FTPCREATEDIRECTORYW,
|
||||
FTPFINDFIRSTFILEW,
|
||||
FTPGETCURRENTDIRECTORYW,
|
||||
FTPOPENFILEW,
|
||||
FTPGETFILEW,
|
||||
FTPDELETEFILEW,
|
||||
FTPREMOVEDIRECTORYW,
|
||||
FTPRENAMEFILEW,
|
||||
INTERNETFINDNEXTW,
|
||||
HTTPSENDREQUESTW,
|
||||
HTTPOPENREQUESTW,
|
||||
SENDCALLBACK,
|
||||
INTERNETOPENURLW,
|
||||
} ASYNC_FUNC;
|
||||
|
||||
struct WORKREQ_FTPPUTFILEA
|
||||
struct WORKREQ_FTPPUTFILEW
|
||||
{
|
||||
LPSTR lpszLocalFile;
|
||||
LPSTR lpszNewRemoteFile;
|
||||
LPWSTR lpszLocalFile;
|
||||
LPWSTR lpszNewRemoteFile;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYW
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
LPWSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA
|
||||
struct WORKREQ_FTPCREATEDIRECTORYW
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
LPWSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA
|
||||
struct WORKREQ_FTPFINDFIRSTFILEW
|
||||
{
|
||||
LPSTR lpszSearchFile;
|
||||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
LPWSTR lpszSearchFile;
|
||||
LPWIN32_FIND_DATAW lpFindFileData;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYW
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
LPWSTR lpszDirectory;
|
||||
DWORD *lpdwDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPOPENFILEA
|
||||
struct WORKREQ_FTPOPENFILEW
|
||||
{
|
||||
LPSTR lpszFilename;
|
||||
LPWSTR lpszFilename;
|
||||
DWORD dwAccess;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPGETFILEA
|
||||
struct WORKREQ_FTPGETFILEW
|
||||
{
|
||||
LPSTR lpszRemoteFile;
|
||||
LPSTR lpszNewFile;
|
||||
LPWSTR lpszRemoteFile;
|
||||
LPWSTR lpszNewFile;
|
||||
BOOL fFailIfExists;
|
||||
DWORD dwLocalFlagsAttribute;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPDELETEFILEA
|
||||
struct WORKREQ_FTPDELETEFILEW
|
||||
{
|
||||
LPSTR lpszFilename;
|
||||
LPWSTR lpszFilename;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYW
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
LPWSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPRENAMEFILEA
|
||||
struct WORKREQ_FTPRENAMEFILEW
|
||||
{
|
||||
LPSTR lpszSrcFile;
|
||||
LPSTR lpszDestFile;
|
||||
LPWSTR lpszSrcFile;
|
||||
LPWSTR lpszDestFile;
|
||||
};
|
||||
|
||||
struct WORKREQ_INTERNETFINDNEXTA
|
||||
struct WORKREQ_INTERNETFINDNEXTW
|
||||
{
|
||||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
LPWIN32_FIND_DATAW lpFindFileData;
|
||||
};
|
||||
|
||||
struct WORKREQ_HTTPOPENREQUESTW
|
||||
@ -318,17 +355,17 @@ typedef struct WORKREQ
|
||||
HINTERNET handle;
|
||||
|
||||
union {
|
||||
struct WORKREQ_FTPPUTFILEA FtpPutFileA;
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA FtpSetCurrentDirectoryA;
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA FtpCreateDirectoryA;
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA FtpFindFirstFileA;
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA FtpGetCurrentDirectoryA;
|
||||
struct WORKREQ_FTPOPENFILEA FtpOpenFileA;
|
||||
struct WORKREQ_FTPGETFILEA FtpGetFileA;
|
||||
struct WORKREQ_FTPDELETEFILEA FtpDeleteFileA;
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA FtpRemoveDirectoryA;
|
||||
struct WORKREQ_FTPRENAMEFILEA FtpRenameFileA;
|
||||
struct WORKREQ_INTERNETFINDNEXTA InternetFindNextA;
|
||||
struct WORKREQ_FTPPUTFILEW FtpPutFileW;
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYW FtpSetCurrentDirectoryW;
|
||||
struct WORKREQ_FTPCREATEDIRECTORYW FtpCreateDirectoryW;
|
||||
struct WORKREQ_FTPFINDFIRSTFILEW FtpFindFirstFileW;
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYW FtpGetCurrentDirectoryW;
|
||||
struct WORKREQ_FTPOPENFILEW FtpOpenFileW;
|
||||
struct WORKREQ_FTPGETFILEW FtpGetFileW;
|
||||
struct WORKREQ_FTPDELETEFILEW FtpDeleteFileW;
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYW FtpRemoveDirectoryW;
|
||||
struct WORKREQ_FTPRENAMEFILEW FtpRenameFileW;
|
||||
struct WORKREQ_INTERNETFINDNEXTW InternetFindNextW;
|
||||
struct WORKREQ_HTTPOPENREQUESTW HttpOpenRequestW;
|
||||
struct WORKREQ_HTTPSENDREQUESTW HttpSendRequestW;
|
||||
struct WORKREQ_SENDCALLBACK SendCallback;
|
||||
@ -364,26 +401,26 @@ void INTERNET_SetLastError(DWORD dwError);
|
||||
DWORD INTERNET_GetLastError();
|
||||
BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
|
||||
LPSTR INTERNET_GetResponseBuffer();
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer);
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen);
|
||||
|
||||
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs);
|
||||
BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn);
|
||||
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONW lpwfs);
|
||||
BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTW lpwfn);
|
||||
BOOL FTP_CloseFileTransferHandle(LPWININETFILE lpwfn);
|
||||
BOOLAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
|
||||
LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
|
||||
BOOLAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
|
||||
BOOLAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
|
||||
INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
|
||||
LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext);
|
||||
BOOLAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
|
||||
BOOLAPI FTP_FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile,
|
||||
LPCWSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
|
||||
BOOLAPI FTP_FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory);
|
||||
BOOLAPI FTP_FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory);
|
||||
INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileW(HINTERNET hConnect,
|
||||
LPCWSTR lpszSearchFile, LPWIN32_FIND_DATAW lpFindFileData, DWORD dwFlags, DWORD dwContext);
|
||||
BOOLAPI FTP_FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDirectory,
|
||||
LPDWORD lpdwCurrentDirectory);
|
||||
BOOL FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest);
|
||||
BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory);
|
||||
BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName);
|
||||
HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession, LPCSTR lpszFileName,
|
||||
BOOL FTP_ConvertFileProp(LPFILEPROPERTIESW lpafp, LPWIN32_FIND_DATAW lpFindFileData);
|
||||
BOOL FTP_FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszDest);
|
||||
BOOL FTP_FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory);
|
||||
BOOL FTP_FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName);
|
||||
HINTERNET FTP_FtpOpenFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName,
|
||||
DWORD fdwAccess, DWORD dwFlags, DWORD dwContext);
|
||||
BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
|
||||
BOOLAPI FTP_FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lpszNewFile,
|
||||
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
|
||||
DWORD dwContext);
|
||||
|
||||
|
@ -219,20 +219,27 @@ VOID SendAsyncCallbackInt(LPWININETAPPINFOW hIC, HINTERNET hHttpSession,
|
||||
DWORD dwContext, DWORD dwInternetStatus, LPVOID
|
||||
lpvStatusInfo, DWORD dwStatusInfoLength)
|
||||
{
|
||||
if (! (hIC->lpfnStatusCB))
|
||||
return;
|
||||
LPVOID lpvNewInfo = NULL;
|
||||
if (! (hIC->lpfnStatusCB))
|
||||
return;
|
||||
|
||||
/* the IE5 version of wininet does not
|
||||
send callbacks if dwContext is zero */
|
||||
if( !dwContext )
|
||||
return;
|
||||
/* the IE5 version of wininet does not
|
||||
send callbacks if dwContext is zero */
|
||||
if( !dwContext )
|
||||
return;
|
||||
|
||||
TRACE("--> Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
|
||||
TRACE("--> Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
|
||||
|
||||
hIC->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus,
|
||||
lpvStatusInfo, dwStatusInfoLength);
|
||||
if(!(hIC->hdr.dwInternalFlags & INET_CALLBACKW)) {
|
||||
if(dwInternetStatus == INTERNET_STATUS_RESOLVING_NAME)
|
||||
lpvNewInfo = WININET_strdup_WtoA(lpvStatusInfo);
|
||||
}
|
||||
hIC->lpfnStatusCB(hHttpSession, dwContext, dwInternetStatus,
|
||||
lpvNewInfo?lpvNewInfo:lpvStatusInfo, dwStatusInfoLength);
|
||||
if(lpvNewInfo)
|
||||
HeapFree(GetProcessHeap(), 0, lpvNewInfo);
|
||||
|
||||
TRACE("<-- Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
|
||||
TRACE("<-- Callback %ld (%s)\n",dwInternetStatus, get_callback_name(dwInternetStatus));
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
@ stdcall FtpCreateDirectoryA(ptr str)
|
||||
@ stdcall FtpCreateDirectoryW(ptr wstr)
|
||||
@ stdcall FtpDeleteFileA(ptr str)
|
||||
@ stub FtpDeleteFileW
|
||||
@ stdcall FtpDeleteFileW(ptr wstr)
|
||||
@ stdcall FtpFindFirstFileA(ptr str ptr long long)
|
||||
@ stdcall FtpFindFirstFileW(ptr wstr ptr long long)
|
||||
@ stdcall FtpGetCurrentDirectoryA(ptr str ptr)
|
||||
@ -64,11 +64,11 @@
|
||||
@ stdcall FtpOpenFileA(ptr str long long long)
|
||||
@ stdcall FtpOpenFileW(ptr wstr long long long)
|
||||
@ stdcall FtpPutFileA(ptr str str long long)
|
||||
@ stub FtpPutFileW
|
||||
@ stdcall FtpPutFileW(ptr wstr wstr long long)
|
||||
@ stdcall FtpRemoveDirectoryA(ptr str)
|
||||
@ stub FtpRemoveDirectoryW
|
||||
@ stdcall FtpRemoveDirectoryW(ptr wstr)
|
||||
@ stdcall FtpRenameFileA(ptr str str)
|
||||
@ stub FtpRenameFileW
|
||||
@ stdcall FtpRenameFileW(ptr wstr wstr)
|
||||
@ stdcall FtpSetCurrentDirectoryA(ptr str)
|
||||
@ stdcall FtpSetCurrentDirectoryW(ptr wstr)
|
||||
@ stdcall GetUrlCacheConfigInfoA(ptr ptr long)
|
||||
@ -123,7 +123,7 @@
|
||||
@ stub InternetDial
|
||||
@ stdcall InternetErrorDlg(long long long long ptr)
|
||||
@ stdcall InternetFindNextFileA(ptr ptr)
|
||||
@ stub InternetFindNextFileW
|
||||
@ stdcall InternetFindNextFileW(ptr ptr)
|
||||
@ stub InternetGetCertByURL
|
||||
@ stdcall InternetGetConnectedState(ptr long)
|
||||
@ stdcall InternetGetConnectedStateExW(ptr ptr long long)
|
||||
@ -156,7 +156,7 @@
|
||||
@ stdcall InternetSetOptionExW(ptr long ptr long long)
|
||||
@ stdcall InternetSetStatusCallback(ptr ptr) InternetSetStatusCallbackA
|
||||
@ stdcall InternetSetStatusCallbackA(ptr ptr)
|
||||
@ stub InternetSetStatusCallbackW
|
||||
@ stdcall InternetSetStatusCallbackW(ptr ptr)
|
||||
@ stub InternetShowSecurityInfoByURL
|
||||
@ stub InternetTimeFromSystemTime
|
||||
@ stub InternetTimeToSystemTime
|
||||
|
Loading…
Reference in New Issue
Block a user