Use unions instead of defines in async work requests.
This commit is contained in:
parent
e040b7cd62
commit
b8921a24ab
|
@ -169,13 +169,14 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPPUTFILEA *req = &workRequest.u.FtpPutFileA;
|
||||
|
||||
workRequest.asyncall = FTPPUTFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hConnect;
|
||||
workRequest.LPSZLOCALFILE = (DWORD)FTP_strdup(lpszLocalFile);
|
||||
workRequest.LPSZNEWREMOTEFILE = (DWORD)FTP_strdup(lpszNewRemoteFile);
|
||||
workRequest.DWFLAGS = dwFlags;
|
||||
workRequest.DWCONTEXT = dwContext;
|
||||
workRequest.handle = hConnect;
|
||||
req->lpszLocalFile = FTP_strdup(lpszLocalFile);
|
||||
req->lpszNewRemoteFile = FTP_strdup(lpszNewRemoteFile);
|
||||
req->dwFlags = dwFlags;
|
||||
req->dwContext = dwContext;
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -296,10 +297,12 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA *req;
|
||||
|
||||
workRequest.asyncall = FTPSETCURRENTDIRECTORYA;
|
||||
workRequest.HFTPSESSION = (DWORD)hConnect;
|
||||
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory);
|
||||
workRequest.handle = hConnect;
|
||||
req = &workRequest.u.FtpSetCurrentDirectoryA;
|
||||
req->lpszDirectory = FTP_strdup(lpszDirectory);
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -421,10 +424,12 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA *req;
|
||||
|
||||
workRequest.asyncall = FTPCREATEDIRECTORYA;
|
||||
workRequest.HFTPSESSION = (DWORD)hConnect;
|
||||
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory);
|
||||
workRequest.handle = hConnect;
|
||||
req = &workRequest.u.FtpCreateDirectoryA;
|
||||
req->lpszDirectory = FTP_strdup(lpszDirectory);
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -545,13 +550,15 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA *req;
|
||||
|
||||
workRequest.asyncall = FTPFINDFIRSTFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hConnect;
|
||||
workRequest.LPSZSEARCHFILE = (DWORD)FTP_strdup(lpszSearchFile);
|
||||
workRequest.LPFINDFILEDATA = (DWORD)lpFindFileData;
|
||||
workRequest.DWFLAGS = dwFlags;
|
||||
workRequest.DWCONTEXT= dwContext;
|
||||
workRequest.handle = hConnect;
|
||||
req = &workRequest.u.FtpFindFirstFileA;
|
||||
req->lpszSearchFile = FTP_strdup(lpszSearchFile);
|
||||
req->lpFindFileData = lpFindFileData;
|
||||
req->dwFlags = dwFlags;
|
||||
req->dwContext= dwContext;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
return NULL;
|
||||
|
@ -704,11 +711,13 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA *req;
|
||||
|
||||
workRequest.asyncall = FTPGETCURRENTDIRECTORYA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFtpSession;
|
||||
workRequest.LPSZDIRECTORY = (DWORD)lpszCurrentDirectory;
|
||||
workRequest.LPDWDIRECTORY = (DWORD)lpdwCurrentDirectory;
|
||||
workRequest.handle = hFtpSession;
|
||||
req = &workRequest.u.FtpGetCurrentDirectoryA;
|
||||
req->lpszDirectory = lpszCurrentDirectory;
|
||||
req->lpdwDirectory = lpdwCurrentDirectory;
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -850,13 +859,15 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPOPENFILEA *req;
|
||||
|
||||
workRequest.asyncall = FTPOPENFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFtpSession;
|
||||
workRequest.LPSZFILENAME = (DWORD)FTP_strdup(lpszFileName);
|
||||
workRequest.FDWACCESS = fdwAccess;
|
||||
workRequest.DWFLAGS = dwFlags;
|
||||
workRequest.DWCONTEXT = dwContext;
|
||||
workRequest.handle = hFtpSession;
|
||||
req = &workRequest.u.FtpOpenFileA;
|
||||
req->lpszFilename = FTP_strdup(lpszFileName);
|
||||
req->dwAccess = fdwAccess;
|
||||
req->dwFlags = dwFlags;
|
||||
req->dwContext = dwContext;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
return NULL;
|
||||
|
@ -1002,15 +1013,17 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPGETFILEA *req;
|
||||
|
||||
workRequest.asyncall = FTPGETFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hInternet;
|
||||
workRequest.LPSZREMOTEFILE = (DWORD)FTP_strdup(lpszRemoteFile);
|
||||
workRequest.LPSZNEWFILE = (DWORD)FTP_strdup(lpszNewFile);
|
||||
workRequest.DWLOCALFLAGSATTRIBUTE = dwLocalFlagsAttribute;
|
||||
workRequest.FFAILIFEXISTS = (DWORD)fFailIfExists;
|
||||
workRequest.DWFLAGS = dwInternetFlags;
|
||||
workRequest.DWCONTEXT = dwContext;
|
||||
workRequest.handle = hInternet;
|
||||
req = &workRequest.u.FtpGetFileA;
|
||||
req->lpszRemoteFile = FTP_strdup(lpszRemoteFile);
|
||||
req->lpszNewFile = FTP_strdup(lpszNewFile);
|
||||
req->dwLocalFlagsAttribute = dwLocalFlagsAttribute;
|
||||
req->fFailIfExists = fFailIfExists;
|
||||
req->dwFlags = dwInternetFlags;
|
||||
req->dwContext = dwContext;
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -1151,10 +1164,12 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPDELETEFILEA *req;
|
||||
|
||||
workRequest.asyncall = FTPRENAMEFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFtpSession;
|
||||
workRequest.LPSZFILENAME = (DWORD)FTP_strdup(lpszFileName);
|
||||
workRequest.asyncall = FTPDELETEFILEA;
|
||||
workRequest.handle = hFtpSession;
|
||||
req = &workRequest.u.FtpDeleteFileA;
|
||||
req->lpszFilename = FTP_strdup(lpszFileName);
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -1245,10 +1260,12 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA *req;
|
||||
|
||||
workRequest.asyncall = FTPREMOVEDIRECTORYA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFtpSession;
|
||||
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory);
|
||||
workRequest.handle = hFtpSession;
|
||||
req = &workRequest.u.FtpRemoveDirectoryA;
|
||||
req->lpszDirectory = FTP_strdup(lpszDirectory);
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -1340,11 +1357,13 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_FTPRENAMEFILEA *req;
|
||||
|
||||
workRequest.asyncall = FTPRENAMEFILEA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFtpSession;
|
||||
workRequest.LPSZSRCFILE = (DWORD)FTP_strdup(lpszSrc);
|
||||
workRequest.LPSZDESTFILE = (DWORD)FTP_strdup(lpszDest);
|
||||
workRequest.handle = hFtpSession;
|
||||
req = &workRequest.u.FtpRenameFileA;
|
||||
req->lpszSrcFile = FTP_strdup(lpszSrc);
|
||||
req->lpszDestFile = FTP_strdup(lpszDest);
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
|
|
@ -243,22 +243,24 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
|
|||
if (0)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_HTTPOPENREQUESTA *req;
|
||||
|
||||
workRequest.asyncall = HTTPOPENREQUESTA;
|
||||
workRequest.HFTPSESSION = (DWORD)hHttpSession;
|
||||
workRequest.LPSZVERB = (DWORD)HTTP_strdup(lpszVerb);
|
||||
workRequest.LPSZOBJECTNAME = (DWORD)HTTP_strdup(lpszObjectName);
|
||||
workRequest.handle = hHttpSession;
|
||||
req = &workRequest.u.HttpOpenRequestA;
|
||||
req->lpszVerb = HTTP_strdup(lpszVerb);
|
||||
req->lpszObjectName = HTTP_strdup(lpszObjectName);
|
||||
if (lpszVersion)
|
||||
workRequest.LPSZVERSION = (DWORD)HTTP_strdup(lpszVersion);
|
||||
req->lpszVersion = HTTP_strdup(lpszVersion);
|
||||
else
|
||||
workRequest.LPSZVERSION = 0;
|
||||
req->lpszVersion = 0;
|
||||
if (lpszReferrer)
|
||||
workRequest.LPSZREFERRER = (DWORD)HTTP_strdup(lpszReferrer);
|
||||
req->lpszReferrer = HTTP_strdup(lpszReferrer);
|
||||
else
|
||||
workRequest.LPSZREFERRER = 0;
|
||||
workRequest.LPSZACCEPTTYPES = (DWORD)lpszAcceptTypes;
|
||||
workRequest.DWFLAGS = dwFlags;
|
||||
workRequest.DWCONTEXT = dwContext;
|
||||
req->lpszReferrer = 0;
|
||||
req->lpszAcceptTypes = lpszAcceptTypes;
|
||||
req->dwFlags = dwFlags;
|
||||
req->dwContext = dwContext;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
TRACE ("returning NULL\n");
|
||||
|
@ -972,16 +974,18 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_HTTPSENDREQUESTA *req;
|
||||
|
||||
workRequest.asyncall = HTTPSENDREQUESTA;
|
||||
workRequest.HFTPSESSION = (DWORD)hHttpRequest;
|
||||
workRequest.handle = hHttpRequest;
|
||||
req = &workRequest.u.HttpSendRequestA;
|
||||
if (lpszHeaders)
|
||||
workRequest.LPSZHEADER = (DWORD)HTTP_strdup(lpszHeaders);
|
||||
req->lpszHeader = HTTP_strdup(lpszHeaders);
|
||||
else
|
||||
workRequest.LPSZHEADER = 0;
|
||||
workRequest.DWHEADERLENGTH = dwHeaderLength;
|
||||
workRequest.LPOPTIONAL = (DWORD)lpOptional;
|
||||
workRequest.DWOPTIONALLENGTH = dwOptionalLength;
|
||||
req->lpszHeader = 0;
|
||||
req->dwHeaderLength = dwHeaderLength;
|
||||
req->lpOptional = lpOptional;
|
||||
req->dwOptionalLength = dwOptionalLength;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
/*
|
||||
|
|
|
@ -593,10 +593,12 @@ BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_INTERNETFINDNEXTA *req;
|
||||
|
||||
workRequest.asyncall = INTERNETFINDNEXTA;
|
||||
workRequest.HFTPSESSION = (DWORD)hFind;
|
||||
workRequest.LPFINDFILEDATA = (DWORD)lpvFindData;
|
||||
workRequest.handle = hFind;
|
||||
req = &workRequest.u.InternetFindNextA;
|
||||
req->lpFindFileData = lpvFindData;
|
||||
|
||||
return INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
@ -2146,120 +2148,159 @@ VOID INTERNET_ExecuteWork()
|
|||
|
||||
TRACE("\n");
|
||||
|
||||
if (INTERNET_GetWorkRequest(&workRequest))
|
||||
{
|
||||
if (!INTERNET_GetWorkRequest(&workRequest))
|
||||
return;
|
||||
TRACE("Got work %d\n", workRequest.asyncall);
|
||||
switch (workRequest.asyncall)
|
||||
{
|
||||
case FTPPUTFILEA:
|
||||
FTP_FtpPutFileA((HINTERNET)workRequest.HFTPSESSION, (LPCSTR)workRequest.LPSZLOCALFILE,
|
||||
(LPCSTR)workRequest.LPSZNEWREMOTEFILE, workRequest.DWFLAGS, workRequest.DWCONTEXT);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZLOCALFILE);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZNEWREMOTEFILE);
|
||||
{
|
||||
struct WORKREQ_FTPPUTFILEA *req = &workRequest.u.FtpPutFileA;
|
||||
|
||||
FTP_FtpPutFileA(workRequest.handle, req->lpszLocalFile,
|
||||
req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszLocalFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszNewRemoteFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPSETCURRENTDIRECTORYA:
|
||||
FTP_FtpSetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZDIRECTORY);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
|
||||
{
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA *req;
|
||||
|
||||
req = &workRequest.u.FtpSetCurrentDirectoryA;
|
||||
FTP_FtpSetCurrentDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPCREATEDIRECTORYA:
|
||||
FTP_FtpCreateDirectoryA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZDIRECTORY);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
|
||||
{
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA *req;
|
||||
|
||||
req = &workRequest.u.FtpCreateDirectoryA;
|
||||
FTP_FtpCreateDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPFINDFIRSTFILEA:
|
||||
FTP_FtpFindFirstFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZSEARCHFILE,
|
||||
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA, workRequest.DWFLAGS,
|
||||
workRequest.DWCONTEXT);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSEARCHFILE);
|
||||
{
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA *req;
|
||||
|
||||
req = &workRequest.u.FtpFindFirstFileA;
|
||||
FTP_FtpFindFirstFileA(workRequest.handle, req->lpszSearchFile,
|
||||
req->lpFindFileData, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPGETCURRENTDIRECTORYA:
|
||||
FTP_FtpGetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPSTR)workRequest.LPSZDIRECTORY, (LPDWORD)workRequest.LPDWDIRECTORY);
|
||||
{
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA *req;
|
||||
|
||||
req = &workRequest.u.FtpGetCurrentDirectoryA;
|
||||
FTP_FtpGetCurrentDirectoryA(workRequest.handle,
|
||||
req->lpszDirectory, req->lpdwDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPOPENFILEA:
|
||||
FTP_FtpOpenFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZFILENAME,
|
||||
workRequest.FDWACCESS,
|
||||
workRequest.DWFLAGS,
|
||||
workRequest.DWCONTEXT);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
|
||||
{
|
||||
struct WORKREQ_FTPOPENFILEA *req = &workRequest.u.FtpOpenFileA;
|
||||
|
||||
FTP_FtpOpenFileA(workRequest.handle, req->lpszFilename,
|
||||
req->dwAccess, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPGETFILEA:
|
||||
FTP_FtpGetFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZREMOTEFILE,
|
||||
(LPCSTR)workRequest.LPSZNEWFILE,
|
||||
(BOOL)workRequest.FFAILIFEXISTS,
|
||||
workRequest.DWLOCALFLAGSATTRIBUTE,
|
||||
workRequest.DWFLAGS,
|
||||
workRequest.DWCONTEXT);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZREMOTEFILE);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZNEWFILE);
|
||||
{
|
||||
struct WORKREQ_FTPGETFILEA *req = &workRequest.u.FtpGetFileA;
|
||||
|
||||
FTP_FtpGetFileA(workRequest.handle, req->lpszRemoteFile,
|
||||
req->lpszNewFile, req->fFailIfExists,
|
||||
req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszNewFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPDELETEFILEA:
|
||||
FTP_FtpDeleteFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZFILENAME);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
|
||||
{
|
||||
struct WORKREQ_FTPDELETEFILEA *req = &workRequest.u.FtpDeleteFileA;
|
||||
|
||||
FTP_FtpDeleteFileA(workRequest.handle, req->lpszFilename);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPREMOVEDIRECTORYA:
|
||||
FTP_FtpRemoveDirectoryA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZDIRECTORY);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
|
||||
{
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA *req;
|
||||
|
||||
req = &workRequest.u.FtpRemoveDirectoryA;
|
||||
FTP_FtpRemoveDirectoryA(workRequest.handle, req->lpszDirectory);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPRENAMEFILEA:
|
||||
FTP_FtpRenameFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZSRCFILE,
|
||||
(LPCSTR)workRequest.LPSZDESTFILE);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSRCFILE);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDESTFILE);
|
||||
{
|
||||
struct WORKREQ_FTPRENAMEFILEA *req = &workRequest.u.FtpRenameFileA;
|
||||
|
||||
FTP_FtpRenameFileA(workRequest.handle, req->lpszSrcFile, req->lpszDestFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszSrcFile);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszDestFile);
|
||||
}
|
||||
break;
|
||||
|
||||
case INTERNETFINDNEXTA:
|
||||
INTERNET_FindNextFileA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA);
|
||||
{
|
||||
struct WORKREQ_INTERNETFINDNEXTA *req;
|
||||
|
||||
req = &workRequest.u.InternetFindNextA;
|
||||
INTERNET_FindNextFileA(workRequest.handle, req->lpFindFileData);
|
||||
}
|
||||
break;
|
||||
|
||||
case HTTPSENDREQUESTA:
|
||||
HTTP_HttpSendRequestA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZHEADER,
|
||||
workRequest.DWHEADERLENGTH,
|
||||
(LPVOID)workRequest.LPOPTIONAL,
|
||||
workRequest.DWOPTIONALLENGTH);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZHEADER);
|
||||
{
|
||||
struct WORKREQ_HTTPSENDREQUESTA *req = &workRequest.u.HttpSendRequestA;
|
||||
|
||||
HTTP_HttpSendRequestA(workRequest.handle, req->lpszHeader,
|
||||
req->dwHeaderLength, req->lpOptional, req->dwOptionalLength);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszHeader);
|
||||
}
|
||||
break;
|
||||
|
||||
case HTTPOPENREQUESTA:
|
||||
HTTP_HttpOpenRequestA((HINTERNET)workRequest.HFTPSESSION,
|
||||
(LPCSTR)workRequest.LPSZVERB,
|
||||
(LPCSTR)workRequest.LPSZOBJECTNAME,
|
||||
(LPCSTR)workRequest.LPSZVERSION,
|
||||
(LPCSTR)workRequest.LPSZREFERRER,
|
||||
(LPCSTR*)workRequest.LPSZACCEPTTYPES,
|
||||
workRequest.DWFLAGS,
|
||||
workRequest.DWCONTEXT);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZVERB);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZOBJECTNAME);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZVERSION);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZREFERRER);
|
||||
{
|
||||
struct WORKREQ_HTTPOPENREQUESTA *req = &workRequest.u.HttpOpenRequestA;
|
||||
|
||||
HTTP_HttpOpenRequestA(workRequest.handle, req->lpszVerb,
|
||||
req->lpszObjectName, req->lpszVersion, req->lpszReferrer,
|
||||
req->lpszAcceptTypes, req->dwFlags, req->dwContext);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszVerb);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszObjectName);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszVersion);
|
||||
HeapFree(GetProcessHeap(), 0, req->lpszReferrer);
|
||||
}
|
||||
break;
|
||||
|
||||
case SENDCALLBACK:
|
||||
SendAsyncCallbackInt((LPWININETAPPINFOA)workRequest.param1,
|
||||
(HINTERNET)workRequest.param2, workRequest.param3,
|
||||
workRequest.param4, (LPVOID)workRequest.param5,
|
||||
workRequest.param6);
|
||||
break;
|
||||
{
|
||||
struct WORKREQ_SENDCALLBACK *req = &workRequest.u.SendCallback;
|
||||
|
||||
SendAsyncCallbackInt(workRequest.handle, req->hHttpSession,
|
||||
req->dwContext, req->dwInternetStatus, req->lpvStatusInfo,
|
||||
req->dwStatusInfoLength);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,50 +177,126 @@ typedef enum
|
|||
SENDCALLBACK,
|
||||
} ASYNC_FUNC;
|
||||
|
||||
struct WORKREQ_FTPPUTFILEA
|
||||
{
|
||||
LPSTR lpszLocalFile;
|
||||
LPSTR lpszNewRemoteFile;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPSETCURRENTDIRECTORYA
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPCREATEDIRECTORYA
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPFINDFIRSTFILEA
|
||||
{
|
||||
LPSTR lpszSearchFile;
|
||||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPGETCURRENTDIRECTORYA
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
DWORD *lpdwDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPOPENFILEA
|
||||
{
|
||||
LPSTR lpszFilename;
|
||||
DWORD dwAccess;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPGETFILEA
|
||||
{
|
||||
LPSTR lpszRemoteFile;
|
||||
LPSTR lpszNewFile;
|
||||
BOOL fFailIfExists;
|
||||
DWORD dwLocalFlagsAttribute;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPDELETEFILEA
|
||||
{
|
||||
LPSTR lpszFilename;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPREMOVEDIRECTORYA
|
||||
{
|
||||
LPSTR lpszDirectory;
|
||||
};
|
||||
|
||||
struct WORKREQ_FTPRENAMEFILEA
|
||||
{
|
||||
LPSTR lpszSrcFile;
|
||||
LPSTR lpszDestFile;
|
||||
};
|
||||
|
||||
struct WORKREQ_INTERNETFINDNEXTA
|
||||
{
|
||||
LPWIN32_FIND_DATAA lpFindFileData;
|
||||
};
|
||||
|
||||
struct WORKREQ_HTTPOPENREQUESTA
|
||||
{
|
||||
LPSTR lpszVerb;
|
||||
LPSTR lpszObjectName;
|
||||
LPSTR lpszVersion;
|
||||
LPSTR lpszReferrer;
|
||||
LPCSTR *lpszAcceptTypes;
|
||||
DWORD dwFlags;
|
||||
DWORD dwContext;
|
||||
};
|
||||
|
||||
struct WORKREQ_HTTPSENDREQUESTA
|
||||
{
|
||||
LPSTR lpszHeader;
|
||||
DWORD dwHeaderLength;
|
||||
LPVOID lpOptional;
|
||||
DWORD dwOptionalLength;
|
||||
};
|
||||
|
||||
struct WORKREQ_SENDCALLBACK
|
||||
{
|
||||
HINTERNET hHttpSession;
|
||||
DWORD dwContext;
|
||||
DWORD dwInternetStatus;
|
||||
LPVOID lpvStatusInfo;
|
||||
DWORD dwStatusInfoLength;
|
||||
};
|
||||
|
||||
typedef struct WORKREQ
|
||||
{
|
||||
ASYNC_FUNC asyncall;
|
||||
DWORD param1;
|
||||
#define HFTPSESSION param1
|
||||
HINTERNET handle;
|
||||
|
||||
DWORD param2;
|
||||
#define LPSZLOCALFILE param2
|
||||
#define LPSZREMOTEFILE param2
|
||||
#define LPSZFILENAME param2
|
||||
#define LPSZSRCFILE param2
|
||||
#define LPSZDIRECTORY param2
|
||||
#define LPSZSEARCHFILE param2
|
||||
#define LPSZHEADER param2
|
||||
#define LPSZVERB param2
|
||||
|
||||
DWORD param3;
|
||||
#define LPSZNEWREMOTEFILE param3
|
||||
#define LPSZNEWFILE param3
|
||||
#define LPFINDFILEDATA param3
|
||||
#define LPDWDIRECTORY param3
|
||||
#define FDWACCESS param3
|
||||
#define LPSZDESTFILE param3
|
||||
#define DWHEADERLENGTH param3
|
||||
#define LPSZOBJECTNAME param3
|
||||
|
||||
DWORD param4;
|
||||
#define DWFLAGS param4
|
||||
#define LPOPTIONAL param4
|
||||
|
||||
DWORD param5;
|
||||
#define DWCONTEXT param5
|
||||
#define DWOPTIONALLENGTH param5
|
||||
|
||||
DWORD param6;
|
||||
#define FFAILIFEXISTS param6
|
||||
#define LPSZVERSION param6
|
||||
|
||||
DWORD param7;
|
||||
#define DWLOCALFLAGSATTRIBUTE param7
|
||||
#define LPSZREFERRER param7
|
||||
|
||||
DWORD param8;
|
||||
#define LPSZACCEPTTYPES param8
|
||||
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_HTTPOPENREQUESTA HttpOpenRequestA;
|
||||
struct WORKREQ_HTTPSENDREQUESTA HttpSendRequestA;
|
||||
struct WORKREQ_SENDCALLBACK SendCallback;
|
||||
} u;
|
||||
|
||||
struct WORKREQ *next;
|
||||
struct WORKREQ *prev;
|
||||
|
|
|
@ -202,15 +202,16 @@ VOID SendAsyncCallback(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
|
|||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||
{
|
||||
WORKREQUEST workRequest;
|
||||
struct WORKREQ_SENDCALLBACK *req;
|
||||
|
||||
workRequest.asyncall = SENDCALLBACK;
|
||||
|
||||
workRequest.param1 = (DWORD)hIC;
|
||||
workRequest.param2 = (DWORD)hHttpSession;
|
||||
workRequest.param3 = dwContext;
|
||||
workRequest.param4 = dwInternetStatus;
|
||||
workRequest.param5 = (DWORD)lpvStatusInfo;
|
||||
workRequest.param6 = dwStatusInfoLength;
|
||||
workRequest.handle = hIC;
|
||||
req = &workRequest.u.SendCallback;
|
||||
req->hHttpSession = hHttpSession;
|
||||
req->dwContext = dwContext;
|
||||
req->dwInternetStatus = dwInternetStatus;
|
||||
req->lpvStatusInfo = lpvStatusInfo;
|
||||
req->dwStatusInfoLength = dwStatusInfoLength;
|
||||
|
||||
INTERNET_AsyncCall(&workRequest);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue