Use unions instead of defines in async work requests.

This commit is contained in:
Mike McCormack 2003-09-25 20:25:22 +00:00 committed by Alexandre Julliard
parent e040b7cd62
commit b8921a24ab
5 changed files with 343 additions and 202 deletions

View File

@ -169,13 +169,14 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPPUTFILEA *req = &workRequest.u.FtpPutFileA;
workRequest.asyncall = FTPPUTFILEA; workRequest.asyncall = FTPPUTFILEA;
workRequest.HFTPSESSION = (DWORD)hConnect; workRequest.handle = hConnect;
workRequest.LPSZLOCALFILE = (DWORD)FTP_strdup(lpszLocalFile); req->lpszLocalFile = FTP_strdup(lpszLocalFile);
workRequest.LPSZNEWREMOTEFILE = (DWORD)FTP_strdup(lpszNewRemoteFile); req->lpszNewRemoteFile = FTP_strdup(lpszNewRemoteFile);
workRequest.DWFLAGS = dwFlags; req->dwFlags = dwFlags;
workRequest.DWCONTEXT = dwContext; req->dwContext = dwContext;
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -296,10 +297,12 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPSETCURRENTDIRECTORYA *req;
workRequest.asyncall = FTPSETCURRENTDIRECTORYA; workRequest.asyncall = FTPSETCURRENTDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hConnect; workRequest.handle = hConnect;
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory); req = &workRequest.u.FtpSetCurrentDirectoryA;
req->lpszDirectory = FTP_strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -421,10 +424,12 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPCREATEDIRECTORYA *req;
workRequest.asyncall = FTPCREATEDIRECTORYA; workRequest.asyncall = FTPCREATEDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hConnect; workRequest.handle = hConnect;
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory); req = &workRequest.u.FtpCreateDirectoryA;
req->lpszDirectory = FTP_strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -545,13 +550,15 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPFINDFIRSTFILEA *req;
workRequest.asyncall = FTPFINDFIRSTFILEA; workRequest.asyncall = FTPFINDFIRSTFILEA;
workRequest.HFTPSESSION = (DWORD)hConnect; workRequest.handle = hConnect;
workRequest.LPSZSEARCHFILE = (DWORD)FTP_strdup(lpszSearchFile); req = &workRequest.u.FtpFindFirstFileA;
workRequest.LPFINDFILEDATA = (DWORD)lpFindFileData; req->lpszSearchFile = FTP_strdup(lpszSearchFile);
workRequest.DWFLAGS = dwFlags; req->lpFindFileData = lpFindFileData;
workRequest.DWCONTEXT= dwContext; req->dwFlags = dwFlags;
req->dwContext= dwContext;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
return NULL; return NULL;
@ -704,11 +711,13 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPGETCURRENTDIRECTORYA *req;
workRequest.asyncall = FTPGETCURRENTDIRECTORYA; workRequest.asyncall = FTPGETCURRENTDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hFtpSession; workRequest.handle = hFtpSession;
workRequest.LPSZDIRECTORY = (DWORD)lpszCurrentDirectory; req = &workRequest.u.FtpGetCurrentDirectoryA;
workRequest.LPDWDIRECTORY = (DWORD)lpdwCurrentDirectory; req->lpszDirectory = lpszCurrentDirectory;
req->lpdwDirectory = lpdwCurrentDirectory;
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -850,13 +859,15 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPOPENFILEA *req;
workRequest.asyncall = FTPOPENFILEA; workRequest.asyncall = FTPOPENFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession; workRequest.handle = hFtpSession;
workRequest.LPSZFILENAME = (DWORD)FTP_strdup(lpszFileName); req = &workRequest.u.FtpOpenFileA;
workRequest.FDWACCESS = fdwAccess; req->lpszFilename = FTP_strdup(lpszFileName);
workRequest.DWFLAGS = dwFlags; req->dwAccess = fdwAccess;
workRequest.DWCONTEXT = dwContext; req->dwFlags = dwFlags;
req->dwContext = dwContext;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
return NULL; return NULL;
@ -1002,15 +1013,17 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPGETFILEA *req;
workRequest.asyncall = FTPGETFILEA; workRequest.asyncall = FTPGETFILEA;
workRequest.HFTPSESSION = (DWORD)hInternet; workRequest.handle = hInternet;
workRequest.LPSZREMOTEFILE = (DWORD)FTP_strdup(lpszRemoteFile); req = &workRequest.u.FtpGetFileA;
workRequest.LPSZNEWFILE = (DWORD)FTP_strdup(lpszNewFile); req->lpszRemoteFile = FTP_strdup(lpszRemoteFile);
workRequest.DWLOCALFLAGSATTRIBUTE = dwLocalFlagsAttribute; req->lpszNewFile = FTP_strdup(lpszNewFile);
workRequest.FFAILIFEXISTS = (DWORD)fFailIfExists; req->dwLocalFlagsAttribute = dwLocalFlagsAttribute;
workRequest.DWFLAGS = dwInternetFlags; req->fFailIfExists = fFailIfExists;
workRequest.DWCONTEXT = dwContext; req->dwFlags = dwInternetFlags;
req->dwContext = dwContext;
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -1151,10 +1164,12 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPDELETEFILEA *req;
workRequest.asyncall = FTPRENAMEFILEA; workRequest.asyncall = FTPDELETEFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession; workRequest.handle = hFtpSession;
workRequest.LPSZFILENAME = (DWORD)FTP_strdup(lpszFileName); req = &workRequest.u.FtpDeleteFileA;
req->lpszFilename = FTP_strdup(lpszFileName);
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -1245,10 +1260,12 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPREMOVEDIRECTORYA *req;
workRequest.asyncall = FTPREMOVEDIRECTORYA; workRequest.asyncall = FTPREMOVEDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hFtpSession; workRequest.handle = hFtpSession;
workRequest.LPSZDIRECTORY = (DWORD)FTP_strdup(lpszDirectory); req = &workRequest.u.FtpRemoveDirectoryA;
req->lpszDirectory = FTP_strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -1340,11 +1357,13 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_FTPRENAMEFILEA *req;
workRequest.asyncall = FTPRENAMEFILEA; workRequest.asyncall = FTPRENAMEFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession; workRequest.handle = hFtpSession;
workRequest.LPSZSRCFILE = (DWORD)FTP_strdup(lpszSrc); req = &workRequest.u.FtpRenameFileA;
workRequest.LPSZDESTFILE = (DWORD)FTP_strdup(lpszDest); req->lpszSrcFile = FTP_strdup(lpszSrc);
req->lpszDestFile = FTP_strdup(lpszDest);
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }

View File

@ -243,22 +243,24 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
if (0) if (0)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_HTTPOPENREQUESTA *req;
workRequest.asyncall = HTTPOPENREQUESTA; workRequest.asyncall = HTTPOPENREQUESTA;
workRequest.HFTPSESSION = (DWORD)hHttpSession; workRequest.handle = hHttpSession;
workRequest.LPSZVERB = (DWORD)HTTP_strdup(lpszVerb); req = &workRequest.u.HttpOpenRequestA;
workRequest.LPSZOBJECTNAME = (DWORD)HTTP_strdup(lpszObjectName); req->lpszVerb = HTTP_strdup(lpszVerb);
req->lpszObjectName = HTTP_strdup(lpszObjectName);
if (lpszVersion) if (lpszVersion)
workRequest.LPSZVERSION = (DWORD)HTTP_strdup(lpszVersion); req->lpszVersion = HTTP_strdup(lpszVersion);
else else
workRequest.LPSZVERSION = 0; req->lpszVersion = 0;
if (lpszReferrer) if (lpszReferrer)
workRequest.LPSZREFERRER = (DWORD)HTTP_strdup(lpszReferrer); req->lpszReferrer = HTTP_strdup(lpszReferrer);
else else
workRequest.LPSZREFERRER = 0; req->lpszReferrer = 0;
workRequest.LPSZACCEPTTYPES = (DWORD)lpszAcceptTypes; req->lpszAcceptTypes = lpszAcceptTypes;
workRequest.DWFLAGS = dwFlags; req->dwFlags = dwFlags;
workRequest.DWCONTEXT = dwContext; req->dwContext = dwContext;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
TRACE ("returning NULL\n"); TRACE ("returning NULL\n");
@ -972,16 +974,18 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_HTTPSENDREQUESTA *req;
workRequest.asyncall = HTTPSENDREQUESTA; workRequest.asyncall = HTTPSENDREQUESTA;
workRequest.HFTPSESSION = (DWORD)hHttpRequest; workRequest.handle = hHttpRequest;
req = &workRequest.u.HttpSendRequestA;
if (lpszHeaders) if (lpszHeaders)
workRequest.LPSZHEADER = (DWORD)HTTP_strdup(lpszHeaders); req->lpszHeader = HTTP_strdup(lpszHeaders);
else else
workRequest.LPSZHEADER = 0; req->lpszHeader = 0;
workRequest.DWHEADERLENGTH = dwHeaderLength; req->dwHeaderLength = dwHeaderLength;
workRequest.LPOPTIONAL = (DWORD)lpOptional; req->lpOptional = lpOptional;
workRequest.DWOPTIONALLENGTH = dwOptionalLength; req->dwOptionalLength = dwOptionalLength;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
/* /*

View File

@ -593,10 +593,12 @@ BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_INTERNETFINDNEXTA *req;
workRequest.asyncall = INTERNETFINDNEXTA; workRequest.asyncall = INTERNETFINDNEXTA;
workRequest.HFTPSESSION = (DWORD)hFind; workRequest.handle = hFind;
workRequest.LPFINDFILEDATA = (DWORD)lpvFindData; req = &workRequest.u.InternetFindNextA;
req->lpFindFileData = lpvFindData;
return INTERNET_AsyncCall(&workRequest); return INTERNET_AsyncCall(&workRequest);
} }
@ -2146,120 +2148,159 @@ VOID INTERNET_ExecuteWork()
TRACE("\n"); TRACE("\n");
if (INTERNET_GetWorkRequest(&workRequest)) if (!INTERNET_GetWorkRequest(&workRequest))
return;
TRACE("Got work %d\n", workRequest.asyncall);
switch (workRequest.asyncall)
{ {
TRACE("Got work %d\n", workRequest.asyncall); case FTPPUTFILEA:
switch (workRequest.asyncall) {
{ struct WORKREQ_FTPPUTFILEA *req = &workRequest.u.FtpPutFileA;
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);
break;
case FTPSETCURRENTDIRECTORYA: FTP_FtpPutFileA(workRequest.handle, req->lpszLocalFile,
FTP_FtpSetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION, req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
(LPCSTR)workRequest.LPSZDIRECTORY);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
break;
case FTPCREATEDIRECTORYA: HeapFree(GetProcessHeap(), 0, req->lpszLocalFile);
FTP_FtpCreateDirectoryA((HINTERNET)workRequest.HFTPSESSION, HeapFree(GetProcessHeap(), 0, req->lpszNewRemoteFile);
(LPCSTR)workRequest.LPSZDIRECTORY); }
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY); break;
break;
case FTPFINDFIRSTFILEA: case FTPSETCURRENTDIRECTORYA:
FTP_FtpFindFirstFileA((HINTERNET)workRequest.HFTPSESSION, {
(LPCSTR)workRequest.LPSZSEARCHFILE, struct WORKREQ_FTPSETCURRENTDIRECTORYA *req;
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA, workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSEARCHFILE);
break;
case FTPGETCURRENTDIRECTORYA: req = &workRequest.u.FtpSetCurrentDirectoryA;
FTP_FtpGetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION, FTP_FtpSetCurrentDirectoryA(workRequest.handle, req->lpszDirectory);
(LPSTR)workRequest.LPSZDIRECTORY, (LPDWORD)workRequest.LPDWDIRECTORY); HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
break; }
break;
case FTPOPENFILEA: case FTPCREATEDIRECTORYA:
FTP_FtpOpenFileA((HINTERNET)workRequest.HFTPSESSION, {
(LPCSTR)workRequest.LPSZFILENAME, struct WORKREQ_FTPCREATEDIRECTORYA *req;
workRequest.FDWACCESS,
workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
break;
case FTPGETFILEA: req = &workRequest.u.FtpCreateDirectoryA;
FTP_FtpGetFileA((HINTERNET)workRequest.HFTPSESSION, FTP_FtpCreateDirectoryA(workRequest.handle, req->lpszDirectory);
(LPCSTR)workRequest.LPSZREMOTEFILE, HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
(LPCSTR)workRequest.LPSZNEWFILE, }
(BOOL)workRequest.FFAILIFEXISTS, break;
workRequest.DWLOCALFLAGSATTRIBUTE,
workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZREMOTEFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZNEWFILE);
break;
case FTPDELETEFILEA: case FTPFINDFIRSTFILEA:
FTP_FtpDeleteFileA((HINTERNET)workRequest.HFTPSESSION, {
(LPCSTR)workRequest.LPSZFILENAME); struct WORKREQ_FTPFINDFIRSTFILEA *req;
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
break;
case FTPREMOVEDIRECTORYA: req = &workRequest.u.FtpFindFirstFileA;
FTP_FtpRemoveDirectoryA((HINTERNET)workRequest.HFTPSESSION, FTP_FtpFindFirstFileA(workRequest.handle, req->lpszSearchFile,
(LPCSTR)workRequest.LPSZDIRECTORY); req->lpFindFileData, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY); HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
break; }
break;
case FTPRENAMEFILEA: case FTPGETCURRENTDIRECTORYA:
FTP_FtpRenameFileA((HINTERNET)workRequest.HFTPSESSION, {
(LPCSTR)workRequest.LPSZSRCFILE, struct WORKREQ_FTPGETCURRENTDIRECTORYA *req;
(LPCSTR)workRequest.LPSZDESTFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSRCFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDESTFILE);
break;
case INTERNETFINDNEXTA: req = &workRequest.u.FtpGetCurrentDirectoryA;
INTERNET_FindNextFileA((HINTERNET)workRequest.HFTPSESSION, FTP_FtpGetCurrentDirectoryA(workRequest.handle,
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA); req->lpszDirectory, req->lpdwDirectory);
break; }
break;
case HTTPSENDREQUESTA: case FTPOPENFILEA:
HTTP_HttpSendRequestA((HINTERNET)workRequest.HFTPSESSION, {
(LPCSTR)workRequest.LPSZHEADER, struct WORKREQ_FTPOPENFILEA *req = &workRequest.u.FtpOpenFileA;
workRequest.DWHEADERLENGTH,
(LPVOID)workRequest.LPOPTIONAL,
workRequest.DWOPTIONALLENGTH);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZHEADER);
break;
case HTTPOPENREQUESTA: FTP_FtpOpenFileA(workRequest.handle, req->lpszFilename,
HTTP_HttpOpenRequestA((HINTERNET)workRequest.HFTPSESSION, req->dwAccess, req->dwFlags, req->dwContext);
(LPCSTR)workRequest.LPSZVERB, HeapFree(GetProcessHeap(), 0, req->lpszFilename);
(LPCSTR)workRequest.LPSZOBJECTNAME, }
(LPCSTR)workRequest.LPSZVERSION, break;
(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);
break;
case SENDCALLBACK: case FTPGETFILEA:
SendAsyncCallbackInt((LPWININETAPPINFOA)workRequest.param1, {
(HINTERNET)workRequest.param2, workRequest.param3, struct WORKREQ_FTPGETFILEA *req = &workRequest.u.FtpGetFileA;
workRequest.param4, (LPVOID)workRequest.param5,
workRequest.param6); FTP_FtpGetFileA(workRequest.handle, req->lpszRemoteFile,
break; req->lpszNewFile, req->fFailIfExists,
} req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile);
HeapFree(GetProcessHeap(), 0, req->lpszNewFile);
}
break;
case FTPDELETEFILEA:
{
struct WORKREQ_FTPDELETEFILEA *req = &workRequest.u.FtpDeleteFileA;
FTP_FtpDeleteFileA(workRequest.handle, req->lpszFilename);
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
}
break;
case FTPREMOVEDIRECTORYA:
{
struct WORKREQ_FTPREMOVEDIRECTORYA *req;
req = &workRequest.u.FtpRemoveDirectoryA;
FTP_FtpRemoveDirectoryA(workRequest.handle, req->lpszDirectory);
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
}
break;
case FTPRENAMEFILEA:
{
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:
{
struct WORKREQ_INTERNETFINDNEXTA *req;
req = &workRequest.u.InternetFindNextA;
INTERNET_FindNextFileA(workRequest.handle, req->lpFindFileData);
}
break;
case HTTPSENDREQUESTA:
{
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:
{
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:
{
struct WORKREQ_SENDCALLBACK *req = &workRequest.u.SendCallback;
SendAsyncCallbackInt(workRequest.handle, req->hHttpSession,
req->dwContext, req->dwInternetStatus, req->lpvStatusInfo,
req->dwStatusInfoLength);
}
break;
} }
} }

View File

@ -177,50 +177,126 @@ typedef enum
SENDCALLBACK, SENDCALLBACK,
} ASYNC_FUNC; } 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 typedef struct WORKREQ
{ {
ASYNC_FUNC asyncall; ASYNC_FUNC asyncall;
DWORD param1; HINTERNET handle;
#define HFTPSESSION param1
DWORD param2; union {
#define LPSZLOCALFILE param2 struct WORKREQ_FTPPUTFILEA FtpPutFileA;
#define LPSZREMOTEFILE param2 struct WORKREQ_FTPSETCURRENTDIRECTORYA FtpSetCurrentDirectoryA;
#define LPSZFILENAME param2 struct WORKREQ_FTPCREATEDIRECTORYA FtpCreateDirectoryA;
#define LPSZSRCFILE param2 struct WORKREQ_FTPFINDFIRSTFILEA FtpFindFirstFileA;
#define LPSZDIRECTORY param2 struct WORKREQ_FTPGETCURRENTDIRECTORYA FtpGetCurrentDirectoryA;
#define LPSZSEARCHFILE param2 struct WORKREQ_FTPOPENFILEA FtpOpenFileA;
#define LPSZHEADER param2 struct WORKREQ_FTPGETFILEA FtpGetFileA;
#define LPSZVERB param2 struct WORKREQ_FTPDELETEFILEA FtpDeleteFileA;
struct WORKREQ_FTPREMOVEDIRECTORYA FtpRemoveDirectoryA;
DWORD param3; struct WORKREQ_FTPRENAMEFILEA FtpRenameFileA;
#define LPSZNEWREMOTEFILE param3 struct WORKREQ_INTERNETFINDNEXTA InternetFindNextA;
#define LPSZNEWFILE param3 struct WORKREQ_HTTPOPENREQUESTA HttpOpenRequestA;
#define LPFINDFILEDATA param3 struct WORKREQ_HTTPSENDREQUESTA HttpSendRequestA;
#define LPDWDIRECTORY param3 struct WORKREQ_SENDCALLBACK SendCallback;
#define FDWACCESS param3 } u;
#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
struct WORKREQ *next; struct WORKREQ *next;
struct WORKREQ *prev; struct WORKREQ *prev;

View File

@ -202,15 +202,16 @@ VOID SendAsyncCallback(LPWININETAPPINFOA hIC, HINTERNET hHttpSession,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
struct WORKREQ_SENDCALLBACK *req;
workRequest.asyncall = SENDCALLBACK; workRequest.asyncall = SENDCALLBACK;
workRequest.handle = hIC;
workRequest.param1 = (DWORD)hIC; req = &workRequest.u.SendCallback;
workRequest.param2 = (DWORD)hHttpSession; req->hHttpSession = hHttpSession;
workRequest.param3 = dwContext; req->dwContext = dwContext;
workRequest.param4 = dwInternetStatus; req->dwInternetStatus = dwInternetStatus;
workRequest.param5 = (DWORD)lpvStatusInfo; req->lpvStatusInfo = lpvStatusInfo;
workRequest.param6 = dwStatusInfoLength; req->dwStatusInfoLength = dwStatusInfoLength;
INTERNET_AsyncCall(&workRequest); INTERNET_AsyncCall(&workRequest);
} }