mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 04:10:19 +00:00
- Unbreak build
- Fix CallNamedPipeW, the pipe mode should also be set to PIPE_WAIT. svn path=/trunk/; revision=19086
This commit is contained in:
parent
4cafc71bd8
commit
a6e23ab5cf
|
@ -674,12 +674,12 @@ CallNamedPipeA(LPCSTR lpNamedPipeName,
|
|||
LPDWORD lpBytesRead,
|
||||
DWORD nTimeOut)
|
||||
{
|
||||
UNICODE_STRING PipeName = &NtCurrentTeb()->StaticUnicodeString;
|
||||
PUNICODE_STRING PipeName = &NtCurrentTeb()->StaticUnicodeString;
|
||||
ANSI_STRING AnsiPipe;
|
||||
|
||||
/* Initialize the string as ANSI_STRING and convert to Unicode */
|
||||
RtlInitAnsiString(&NameA, (LPSTR)lpName);
|
||||
RtlAnsiStringToUnicodeString(NameU, &NameA, FALSE);
|
||||
RtlInitAnsiString(&AnsiPipe, (LPSTR)lpNamedPipeName);
|
||||
RtlAnsiStringToUnicodeString(PipeName, &AnsiPipe, FALSE);
|
||||
|
||||
/* Call the Unicode function */
|
||||
return CallNamedPipeW(PipeName->Buffer,
|
||||
|
@ -694,7 +694,8 @@ CallNamedPipeA(LPCSTR lpNamedPipeName,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
BOOL
|
||||
WINAPI
|
||||
CallNamedPipeW(LPCWSTR lpNamedPipeName,
|
||||
LPVOID lpInBuffer,
|
||||
DWORD nInBufferSize,
|
||||
|
@ -703,13 +704,14 @@ CallNamedPipeW(LPCWSTR lpNamedPipeName,
|
|||
LPDWORD lpBytesRead,
|
||||
DWORD nTimeOut)
|
||||
{
|
||||
HANDLE hPipe = INVALID_HANDLE_VALUE;
|
||||
HANDLE hPipe;
|
||||
BOOL bRetry = TRUE;
|
||||
BOOL bError = FALSE;
|
||||
BOOL bError;
|
||||
DWORD dwPipeMode;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
/* Try creating it */
|
||||
hPipe = CreateFileW(lpNamedPipeName,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
|
@ -717,29 +719,31 @@ CallNamedPipeW(LPCWSTR lpNamedPipeName,
|
|||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
if (hPipe != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
if (bRetry == FALSE)
|
||||
return(FALSE);
|
||||
/* Success, break out */
|
||||
if (hPipe != INVALID_HANDLE_VALUE) break;
|
||||
|
||||
WaitNamedPipeW(lpNamedPipeName,
|
||||
nTimeOut);
|
||||
/* Already tried twice, give up */
|
||||
if (bRetry == FALSE) return FALSE;
|
||||
|
||||
/* Wait on it */
|
||||
WaitNamedPipeW(lpNamedPipeName, nTimeOut);
|
||||
|
||||
/* Get ready to try again */
|
||||
bRetry = FALSE;
|
||||
}
|
||||
|
||||
dwPipeMode = PIPE_READMODE_MESSAGE;
|
||||
bError = SetNamedPipeHandleState(hPipe,
|
||||
&dwPipeMode,
|
||||
NULL,
|
||||
NULL);
|
||||
/* Set the pipe mode */
|
||||
dwPipeMode = PIPE_READMODE_MESSAGE | PIPE_WAIT;
|
||||
bError = SetNamedPipeHandleState(hPipe, &dwPipeMode, NULL, NULL);
|
||||
if (!bError)
|
||||
{
|
||||
/* Couldn't change state, fail */
|
||||
CloseHandle(hPipe);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Do the transact */
|
||||
bError = TransactNamedPipe(hPipe,
|
||||
lpInBuffer,
|
||||
nInBufferSize,
|
||||
|
@ -747,12 +751,12 @@ CallNamedPipeW(LPCWSTR lpNamedPipeName,
|
|||
nOutBufferSize,
|
||||
lpBytesRead,
|
||||
NULL);
|
||||
|
||||
/* Close the handle and return */
|
||||
CloseHandle(hPipe);
|
||||
|
||||
return(bError);
|
||||
return bError;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue