Skip to content

Commit

Permalink
[MSAFD] WSPConnect: Revert some style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TAN-Gaming committed Jan 14, 2024
1 parent 2e091fd commit 4649922
Showing 1 changed file with 44 additions and 15 deletions.
59 changes: 44 additions & 15 deletions dll/win32/msafd/misc/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1935,9 +1935,16 @@ WSPConnect(SOCKET Handle,
if (lpCallerData != NULL)
{
ConnectDataLength = lpCallerData->len;
Status = NtDeviceIoControlFile(
(HANDLE)Handle, SockEvent, NULL, NULL, IOSB, IOCTL_AFD_SET_CONNECT_DATA, lpCallerData->buf,
ConnectDataLength, NULL, 0);
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
NULL,
NULL,
IOSB,
IOCTL_AFD_SET_CONNECT_DATA,
lpCallerData->buf,
ConnectDataLength,
NULL,
0);
/* Wait for return */
if (Status == STATUS_PENDING)
{
Expand All @@ -1953,8 +1960,9 @@ WSPConnect(SOCKET Handle,
SocketDataLength = SocketAddressLength - FIELD_OFFSET(struct sockaddr, sa_data);

/* Allocate a connection info buffer with SocketDataLength bytes of payload */
ConnectInfo =
HeapAlloc(GlobalHeap, 0, FIELD_OFFSET(AFD_CONNECT_INFO, RemoteAddress.Address[0].Address[SocketDataLength]));
ConnectInfo = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(AFD_CONNECT_INFO,
RemoteAddress.Address[0].Address[SocketDataLength]));
if (!ConnectInfo)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
Expand All @@ -1975,7 +1983,7 @@ WSPConnect(SOCKET Handle,
* at the end of this function right after the Async Thread disables it.
* This should only happen at the *next* WSPConnect
*/
if ((Socket->SharedData->AsyncEvents & FD_CONNECT) != 0)
if (Socket->SharedData->AsyncEvents & FD_CONNECT)
{
Socket->SharedData->AsyncDisabledEvents |= FD_CONNECT | FD_WRITE;
}
Expand All @@ -1984,9 +1992,16 @@ WSPConnect(SOCKET Handle,
if (lpCalleeData != NULL)
{
InConnectDataLength = lpCalleeData->len;
Status = NtDeviceIoControlFile(
(HANDLE)Handle, SockEvent, NULL, NULL, IOSB, IOCTL_AFD_SET_CONNECT_DATA_SIZE, &InConnectDataLength,
sizeof(InConnectDataLength), NULL, 0);
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
NULL,
NULL,
IOSB,
IOCTL_AFD_SET_CONNECT_DATA_SIZE,
&InConnectDataLength,
sizeof(InConnectDataLength),
NULL,
0);

/* Wait for return */
if (Status == STATUS_PENDING)
Expand Down Expand Up @@ -2021,9 +2036,16 @@ WSPConnect(SOCKET Handle,
IOSB->Status = STATUS_PENDING;

/* Send IOCTL */
Status = NtDeviceIoControlFile(
(HANDLE)Handle, APCFunction != NULL ? NULL : SockEvent, APCFunction, APCContext, IOSB, IOCTL_AFD_CONNECT,
ConnectInfo, 0x22, NULL, 0);
Status = NtDeviceIoControlFile((HANDLE)Handle,
APCFunction != NULL ? NULL : SockEvent,
APCFunction,
APCContext,
IOSB,
IOCTL_AFD_CONNECT,
ConnectInfo,
0x22,
NULL,
0);
/* Wait for return */
if (Status == STATUS_PENDING)
{
Expand Down Expand Up @@ -2060,9 +2082,16 @@ WSPConnect(SOCKET Handle,
/* Get any pending connect data */
if (lpCalleeData != NULL)
{
Status = NtDeviceIoControlFile(
(HANDLE)Handle, SockEvent, NULL, NULL, IOSB, IOCTL_AFD_GET_CONNECT_DATA, NULL, 0, lpCalleeData->buf,
lpCalleeData->len);
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
NULL,
NULL,
IOSB,
IOCTL_AFD_GET_CONNECT_DATA,
NULL,
0,
lpCalleeData->buf,
lpCalleeData->len);
/* Wait for return */
if (Status == STATUS_PENDING)
{
Expand Down

0 comments on commit 4649922

Please sign in to comment.