[*] Improper Win32Open2 transition

This commit is contained in:
Reece Wilson 2024-04-12 11:36:32 +01:00
parent 225791cf7c
commit 54dedf67cc

View File

@ -1,30 +1,24 @@
/******************************************************************************\
* This is a part of the Microsoft Source Code Samples.
* Copyright 1995 - 1997 Microsoft Corporation.
* All rights reserved.
* This source code is only intended as a supplement to
* Microsoft Development Tools and/or WinHelp documentation.
* See these sources for detailed information regarding the
* Microsoft samples programs.
\******************************************************************************/
/*
* Copyright 1995 - 1997 Microsoft Corporation.
* Module Name:
* CreatePipeEx.NT.cpp
* Abstract:
* CreatePipe-like function that lets one or both handles be overlapped
* Author:
* Dave Hart Summer 1997
* Revision History:
* J Reece Wilson 2022: Updated default size to match Linux's 16 page assumption
* Renamed MyCreatePipeEx to CreatePipeEx
* Now using Au atomics
* Added second parameter check
* J Reece Wilson 202[2/3]: Rewritten in C++
* J Reece Wilson 2024: Widening
*
* License:
* MICROSOFT LIMITED PUBLIC LICENSE version 1.1
*/
#include <Source/RuntimeInternal.hpp>
/*++
Copyright (c) 1997 Microsoft Corporation
Module Name:
CreatePipeEx.NT.cpp
Abstract:
CreatePipe-like function that lets one or both handles be overlapped
Author:
Dave Hart Summer 1997
Revision History:
J Reece Wilson 2022: Updated default size to match Linux's 16 page assumption
Renamed MyCreatePipeEx to CreatePipeEx
Now using Au atomics
Added second parameter check
--*/
static AuUInt32 gPipeSerialNumber;
BOOL
@ -62,11 +56,6 @@ CreatePipeEx(
return FALSE;
}
//
// Set the default timeout to 120 seconds
//
//
// Set the default pipe size
//
@ -79,19 +68,16 @@ CreatePipeEx(
swprintf(sPipeNameBuffer,
L"\\\\.\\Pipe\\AuroraProcessCStandardStream.%08x.%08x",
GetCurrentProcessId(),
AuAtomicAdd(&gPipeSerialNumber, 1u)
);
AuAtomicAdd(&gPipeSerialNumber, 1u));
ReadPipeHandle = CreateNamedPipeW(
sPipeNameBuffer,
ReadPipeHandle = CreateNamedPipeW(sPipeNameBuffer,
PIPE_ACCESS_INBOUND | dwReadMode,
PIPE_TYPE_BYTE | PIPE_WAIT,
1, // Number of pipes
nSize, // Out buffer size
nSize, // In buffer size
120 * 1000, // Timeout in ms
lpPipeAttributes
);
lpPipeAttributes);
if (!ReadPipeHandle)
{
@ -103,9 +89,8 @@ CreatePipeEx(
0, // No sharing
lpPipeAttributes,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | dwWriteMode,
NULL // Template file
);
dwWriteMode,
NULL);
if (INVALID_HANDLE_VALUE == WritePipeHandle)
{