Commit b8921a24 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Use unions instead of defines in async work requests.

parent e040b7cd
......@@ -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);
/*
......
......@@ -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
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
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_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);
}
......
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