[*] 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.
* Copyright 1995 - 1997 Microsoft Corporation. * Module Name:
* All rights reserved. * CreatePipeEx.NT.cpp
* This source code is only intended as a supplement to * Abstract:
* Microsoft Development Tools and/or WinHelp documentation. * CreatePipe-like function that lets one or both handles be overlapped
* See these sources for detailed information regarding the * Author:
* Microsoft samples programs. * 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> #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; static AuUInt32 gPipeSerialNumber;
BOOL BOOL
@ -62,11 +56,6 @@ CreatePipeEx(
return FALSE; return FALSE;
} }
//
// Set the default timeout to 120 seconds
//
// //
// Set the default pipe size // Set the default pipe size
// //
@ -79,19 +68,16 @@ CreatePipeEx(
swprintf(sPipeNameBuffer, swprintf(sPipeNameBuffer,
L"\\\\.\\Pipe\\AuroraProcessCStandardStream.%08x.%08x", L"\\\\.\\Pipe\\AuroraProcessCStandardStream.%08x.%08x",
GetCurrentProcessId(), GetCurrentProcessId(),
AuAtomicAdd(&gPipeSerialNumber, 1u) AuAtomicAdd(&gPipeSerialNumber, 1u));
);
ReadPipeHandle = CreateNamedPipeW( ReadPipeHandle = CreateNamedPipeW(sPipeNameBuffer,
sPipeNameBuffer,
PIPE_ACCESS_INBOUND | dwReadMode, PIPE_ACCESS_INBOUND | dwReadMode,
PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_TYPE_BYTE | PIPE_WAIT,
1, // Number of pipes 1, // Number of pipes
nSize, // Out buffer size nSize, // Out buffer size
nSize, // In buffer size nSize, // In buffer size
120 * 1000, // Timeout in ms 120 * 1000, // Timeout in ms
lpPipeAttributes lpPipeAttributes);
);
if (!ReadPipeHandle) if (!ReadPipeHandle)
{ {
@ -103,9 +89,8 @@ CreatePipeEx(
0, // No sharing 0, // No sharing
lpPipeAttributes, lpPipeAttributes,
OPEN_EXISTING, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | dwWriteMode, dwWriteMode,
NULL // Template file NULL);
);
if (INVALID_HANDLE_VALUE == WritePipeHandle) if (INVALID_HANDLE_VALUE == WritePipeHandle)
{ {