mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
Open handle to sfd.sys as asynchromous. This fixes bug 713.
svn path=/trunk/; revision=17899
This commit is contained in:
parent
fdb70af10b
commit
f47052c1a7
1 changed files with 60 additions and 6 deletions
|
@ -65,7 +65,6 @@ WSPSocket(
|
||||||
PHELPER_DATA HelperData;
|
PHELPER_DATA HelperData;
|
||||||
PVOID HelperDLLContext;
|
PVOID HelperDLLContext;
|
||||||
DWORD HelperEvents;
|
DWORD HelperEvents;
|
||||||
DWORD IOOptions = 0;
|
|
||||||
UNICODE_STRING TransportName;
|
UNICODE_STRING TransportName;
|
||||||
UNICODE_STRING DevName;
|
UNICODE_STRING DevName;
|
||||||
LARGE_INTEGER GroupData;
|
LARGE_INTEGER GroupData;
|
||||||
|
@ -204,10 +203,10 @@ WSPSocket(
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Set IO Flag */
|
/* Create the Socket as asynchronous. That means we have to block
|
||||||
if ((dwFlags & WSA_FLAG_OVERLAPPED) == 0) IOOptions = FILE_SYNCHRONOUS_IO_NONALERT;
|
ourselves after every call to NtDeviceIoControlFile. This is
|
||||||
|
because the kernel doesn't support overlapping synchronous I/O
|
||||||
/* Create the Socket */
|
requests (made from multiple threads) at this time (Sep 2005) */
|
||||||
ZwCreateFile(&Sock,
|
ZwCreateFile(&Sock,
|
||||||
GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE,
|
GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE,
|
||||||
&Object,
|
&Object,
|
||||||
|
@ -216,7 +215,7 @@ WSPSocket(
|
||||||
0,
|
0,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
FILE_OPEN_IF,
|
FILE_OPEN_IF,
|
||||||
IOOptions,
|
0,
|
||||||
EABuffer,
|
EABuffer,
|
||||||
SizeOfEA);
|
SizeOfEA);
|
||||||
|
|
||||||
|
@ -511,6 +510,11 @@ WSPBind(
|
||||||
BindData,
|
BindData,
|
||||||
0xA + Socket->SharedData.SizeOfLocalAddress); /* Can't figure out a way to calculate this C */
|
0xA + Socket->SharedData.SizeOfLocalAddress); /* Can't figure out a way to calculate this C */
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set up Socket Data */
|
/* Set up Socket Data */
|
||||||
Socket->SharedData.State = SocketBound;
|
Socket->SharedData.State = SocketBound;
|
||||||
Socket->TdiAddressHandle = (HANDLE)IOSB.Information;
|
Socket->TdiAddressHandle = (HANDLE)IOSB.Information;
|
||||||
|
@ -559,6 +563,11 @@ WSPListen(
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set to Listening */
|
/* Set to Listening */
|
||||||
Socket->SharedData.Listening = TRUE;
|
Socket->SharedData.Listening = TRUE;
|
||||||
|
|
||||||
|
@ -828,6 +837,12 @@ WSPAccept(
|
||||||
&PendingAcceptData,
|
&PendingAcceptData,
|
||||||
sizeof(PendingAcceptData));
|
sizeof(PendingAcceptData));
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
NtClose( SockEvent );
|
NtClose( SockEvent );
|
||||||
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
||||||
|
@ -856,6 +871,12 @@ WSPAccept(
|
||||||
PendingData,
|
PendingData,
|
||||||
PendingDataLength);
|
PendingDataLength);
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
NtClose( SockEvent );
|
NtClose( SockEvent );
|
||||||
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
||||||
|
@ -942,6 +963,12 @@ WSPAccept(
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
|
|
||||||
NtClose( SockEvent );
|
NtClose( SockEvent );
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
|
@ -988,6 +1015,12 @@ WSPAccept(
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
WSPCloseSocket( AcceptSocket, lpErrno );
|
WSPCloseSocket( AcceptSocket, lpErrno );
|
||||||
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
||||||
|
@ -1077,6 +1110,11 @@ WSPConnect(
|
||||||
ConnectDataLength,
|
ConnectDataLength,
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dynamic Structure...ugh */
|
/* Dynamic Structure...ugh */
|
||||||
|
@ -1113,6 +1151,12 @@ WSPConnect(
|
||||||
sizeof(InConnectDataLength),
|
sizeof(InConnectDataLength),
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AFD doesn't seem to care if these are invalid, but let's 0 them anyways */
|
/* AFD doesn't seem to care if these are invalid, but let's 0 them anyways */
|
||||||
|
@ -1136,6 +1180,11 @@ WSPConnect(
|
||||||
0x22,
|
0x22,
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get any pending connect data */
|
/* Get any pending connect data */
|
||||||
if (lpCalleeData != NULL) {
|
if (lpCalleeData != NULL) {
|
||||||
|
@ -1149,6 +1198,11 @@ WSPConnect(
|
||||||
0,
|
0,
|
||||||
lpCalleeData->buf,
|
lpCalleeData->buf,
|
||||||
lpCalleeData->len);
|
lpCalleeData->len);
|
||||||
|
/* Wait for return */
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
WaitForSingleObject(SockEvent, INFINITE);
|
||||||
|
Status = IOSB.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-enable Async Event */
|
/* Re-enable Async Event */
|
||||||
|
|
Loading…
Reference in a new issue