crt: Add namedpipe APIs

Based on:
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-namedpipe-l1-1-0dll
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-namedpipe-ansi-l1-1-0dll
and the various associated versions
This also introduces a minimal kernel32-legacy for CreateNamedPipeA in
order to avoid declaring it without an associated definition

Signed-off-by: Liu Hao <lh_mouse@126.com>
This commit is contained in:
Hugo Beauzée-Luyssen 2019-04-09 09:50:45 +02:00 committed by Liu Hao
parent 7dacb2a563
commit ec07cf0fcf
17 changed files with 124 additions and 12 deletions

View File

@ -1681,6 +1681,11 @@ endif
%/libapi-ms-win-core-localization-l2-1-0.a \
%/libapi-ms-win-core-memory-l1-1-2.a \
%/libapi-ms-win-core-memory-l1-1-3.a \
%/libapi-ms-win-core-namedpipe-ansi-l1-1-0.a \
%/libapi-ms-win-core-namedpipe-ansi-l1-1-1.a \
%/libapi-ms-win-core-namedpipe-l1-1-0.a \
%/libapi-ms-win-core-namedpipe-l1-2-1.a \
%/libapi-ms-win-core-namedpipe-l1-2-2.a \
%/libapi-ms-win-core-processenvironment-l1-1-0.a \
%/libapi-ms-win-core-processenvironment-l1-2-0.a \
%/libapi-ms-win-core-processthreads-l1-1-0.a \
@ -1762,6 +1767,7 @@ endif
%/libapi-ms-win-core-heap-l1-2-0.a \
%/libapi-ms-win-core-interlocked-l1-2-0.a \
%/libapi-ms-win-core-io-l1-1-1.a \
%/libapi-ms-win-core-kernel32-legacy-l1-1-0.a \
%/libapi-ms-win-core-kernel32-legacy-l1-1-1.a \
%/libapi-ms-win-core-largeinteger-l1-1-0.a \
%/libapi-ms-win-core-libraryloader-l1-2-0.a \
@ -1772,6 +1778,11 @@ endif
%/libapi-ms-win-core-localization-l2-1-0.a \
%/libapi-ms-win-core-memory-l1-1-2.a \
%/libapi-ms-win-core-memory-l1-1-3.a \
%/libapi-ms-win-core-namedpipe-ansi-l1-1-0.a \
%/libapi-ms-win-core-namedpipe-ansi-l1-1-1.a \
%/libapi-ms-win-core-namedpipe-l1-1-0.a \
%/libapi-ms-win-core-namedpipe-l1-2-1.a \
%/libapi-ms-win-core-namedpipe-l1-2-2.a \
%/libapi-ms-win-core-normalization-l1-1-0.a \
%/libapi-ms-win-core-processenvironment-l1-1-0.a \
%/libapi-ms-win-core-processenvironment-l1-2-0.a \

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-kernel32-legacy-l1-1-0
EXPORTS
CreateNamedPipeA

View File

@ -0,0 +1,7 @@
LIBRARY api-ms-win-core-namedpipe-ansi-l1-1-0
EXPORTS
GetNamedPipeClientComputerNameA
GetNamedPipeHandleStateA
WaitNamedPipeA

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-namedpipe-ansi-l1-1-1
EXPORTS
CallNamedPipeA

View File

@ -0,0 +1,13 @@
LIBRARY api-ms-win-core-namedpipe-l1-1-0
EXPORTS
ConnectNamedPipe
CreateNamedPipeW
CreatePipe
DisconnectNamedPipe
GetNamedPipeClientComputerNameW
PeekNamedPipe
SetNamedPipeHandleState
TransactNamedPipe
WaitNamedPipeW

View File

@ -0,0 +1,6 @@
LIBRARY api-ms-win-core-namedpipe-l1-2-1
EXPORTS
GetNamedPipeHandleStateW
GetNamedPipeInfo

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-namedpipe-l1-2-2
EXPORTS
CallNamedPipeW

View File

@ -52,9 +52,11 @@ ADDLIB libapi-ms-win-core-memory-l1-1-2.a
ADDLIB libapi-ms-win-core-memory-l1-1-3.a
; FIXME libapi-ms-win-core-memory-l1-1-4.a
; FIXME libapi-ms-win-core-memory-l1-1-5.a
; FIXME libapi-ms-win-core-namedpipe-l1-1-0.a
; FIXME libapi-ms-win-core-namedpipe-l1-2-1.a
; FIXME libapi-ms-win-core-namedpipe-l1-2-2.a
ADDLIB libapi-ms-win-core-namedpipe-ansi-l1-1-0.a
ADDLIB libapi-ms-win-core-namedpipe-ansi-l1-1-1.a
ADDLIB libapi-ms-win-core-namedpipe-l1-1-0.a
ADDLIB libapi-ms-win-core-namedpipe-l1-2-1.a
ADDLIB libapi-ms-win-core-namedpipe-l1-2-2.a
; FIXME libapi-ms-win-core-namespace-l1-1-0.a
; FIXME libapi-ms-win-core-path-l1-1-0.a
ADDLIB libapi-ms-win-core-processenvironment-l1-1-0.a

View File

@ -18,6 +18,7 @@ ADDLIB libapi-ms-win-core-handle-l1-1-0.a
ADDLIB libapi-ms-win-core-heap-l1-2-0.a
ADDLIB libapi-ms-win-core-interlocked-l1-2-0.a
ADDLIB libapi-ms-win-core-io-l1-1-1.a
ADDLIB libapi-ms-win-core-kernel32-legacy-l1-1-0.a
ADDLIB libapi-ms-win-core-kernel32-legacy-l1-1-1.a
ADDLIB libapi-ms-win-core-largeinteger-l1-1-0.a
ADDLIB libapi-ms-win-core-libraryloader-l1-2-0.a
@ -28,6 +29,11 @@ ADDLIB libapi-ms-win-core-localization-l1-2-2.a
ADDLIB libapi-ms-win-core-localization-l2-1-0.a
ADDLIB libapi-ms-win-core-memory-l1-1-2.a
ADDLIB libapi-ms-win-core-memory-l1-1-3.a
ADDLIB libapi-ms-win-core-namedpipe-ansi-l1-1-0.a
ADDLIB libapi-ms-win-core-namedpipe-ansi-l1-1-1.a
ADDLIB libapi-ms-win-core-namedpipe-l1-1-0.a
ADDLIB libapi-ms-win-core-namedpipe-l1-2-1.a
ADDLIB libapi-ms-win-core-namedpipe-l1-2-2.a
ADDLIB libapi-ms-win-core-normalization-l1-1-0.a
ADDLIB libapi-ms-win-core-processenvironment-l1-1-0.a
ADDLIB libapi-ms-win-core-processenvironment-l1-2-0.a

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-kernel32-legacy-l1-1-0
EXPORTS
CreateNamedPipeA@32

View File

@ -0,0 +1,7 @@
LIBRARY api-ms-win-core-namedpipe-ansi-l1-1-0
EXPORTS
GetNamedPipeClientComputerNameA@12
GetNamedPipeHandleStateA@28
WaitNamedPipeA@8

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-namedpipe-ansi-l1-1-1
EXPORTS
CallNamedPipeA@28

View File

@ -0,0 +1,13 @@
LIBRARY api-ms-win-core-namedpipe-l1-1-0
EXPORTS
ConnectNamedPipe@8
CreateNamedPipeW@32
CreatePipe@16
DisconnectNamedPipe@4
GetNamedPipeClientComputerNameW@12
PeekNamedPipe@24
SetNamedPipeHandleState@16
TransactNamedPipe@28
WaitNamedPipeW@8

View File

@ -0,0 +1,6 @@
LIBRARY api-ms-win-core-namedpipe-l1-2-1
EXPORTS
GetNamedPipeHandleStateW@28
GetNamedPipeInfo@20

View File

@ -0,0 +1,5 @@
LIBRARY api-ms-win-core-namedpipe-l1-2-2
EXPORTS
CallNamedPipeW@28

View File

@ -16,6 +16,9 @@ extern "C" {
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
WINADVAPI WINBOOL WINAPI ImpersonateNamedPipeClient (HANDLE hNamedPipe);
#endif
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10
WINBASEAPI WINBOOL WINAPI CreatePipe (PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
WINBASEAPI WINBOOL WINAPI ConnectNamedPipe (HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped);
WINBASEAPI WINBOOL WINAPI DisconnectNamedPipe (HANDLE hNamedPipe);

View File

@ -2161,6 +2161,23 @@ extern "C" {
#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x00000020
#endif
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10
WINBASEAPI WINBOOL WINAPI GetNamedPipeClientComputerNameA (HANDLE Pipe, LPSTR ClientComputerName, ULONG ClientComputerNameLength);
WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA (HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize);
WINBASEAPI WINBOOL WINAPI WaitNamedPipeA (LPCSTR lpNamedPipeName, DWORD nTimeOut);
WINBASEAPI WINBOOL WINAPI CallNamedPipeA (LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
WINBASEAPI WINBOOL WINAPI CallNamedPipeW (LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
WINBASEAPI HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
#ifdef UNICODE
#define WaitNamedPipe WaitNamedPipeA
#define CreateNamedPipe CreateNamedPipeA
#endif
#define CallNamedPipe __MINGW_NAME_AW(CallNamedPipe)
#endif
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
WINBASEAPI WINBOOL WINAPI ReplaceFileA (LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
WINBASEAPI WINBOOL WINAPI ReplaceFileW (LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
@ -2194,7 +2211,6 @@ extern "C" {
WINBASEAPI HANDLE WINAPI FindFirstFileNameW (LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName);
WINBASEAPI WINBOOL APIENTRY FindNextFileNameW (HANDLE hFindStream, LPDWORD StringLength, PWSTR LinkName);
WINBASEAPI HANDLE WINAPI FindFirstFileNameTransactedW (LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName, HANDLE hTransaction);
WINBASEAPI WINBOOL WINAPI GetNamedPipeClientComputerNameA (HANDLE Pipe, LPSTR ClientComputerName, ULONG ClientComputerNameLength);
WINBASEAPI WINBOOL WINAPI GetNamedPipeClientProcessId (HANDLE Pipe, PULONG ClientProcessId);
WINBASEAPI WINBOOL WINAPI GetNamedPipeClientSessionId (HANDLE Pipe, PULONG ClientSessionId);
WINBASEAPI WINBOOL WINAPI GetNamedPipeServerProcessId (HANDLE Pipe, PULONG ServerProcessId);
@ -2202,12 +2218,7 @@ extern "C" {
WINBASEAPI WINBOOL WINAPI SetFileBandwidthReservation (HANDLE hFile, DWORD nPeriodMilliseconds, DWORD nBytesPerPeriod, WINBOOL bDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests);
WINBASEAPI WINBOOL WINAPI GetFileBandwidthReservation (HANDLE hFile, LPDWORD lpPeriodMilliseconds, LPDWORD lpBytesPerPeriod, LPBOOL pDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests);
#endif
WINBASEAPI HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA (HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize);
WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateW (HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize);
WINBASEAPI WINBOOL WINAPI CallNamedPipeA (LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
WINBASEAPI WINBOOL WINAPI CallNamedPipeW (LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut);
WINBASEAPI WINBOOL WINAPI WaitNamedPipeA (LPCSTR lpNamedPipeName, DWORD nTimeOut);
WINBASEAPI WINBOOL WINAPI SetVolumeLabelA (LPCSTR lpRootPathName, LPCSTR lpVolumeName);
WINBASEAPI WINBOOL WINAPI SetVolumeLabelW (LPCWSTR lpRootPathName, LPCWSTR lpVolumeName);
WINBASEAPI VOID WINAPI SetFileApisToOEM (VOID);
@ -2235,13 +2246,10 @@ extern "C" {
WINADVAPI WINBOOL WINAPI ReportEventW (HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData);
#ifndef UNICODE
#define CreateNamedPipe CreateNamedPipeA
#define WaitNamedPipe WaitNamedPipeA
#define GetVolumeInformation GetVolumeInformationA
#endif
#define GetNamedPipeHandleState __MINGW_NAME_AW(GetNamedPipeHandleState)
#define CallNamedPipe __MINGW_NAME_AW(CallNamedPipe)
#define SetVolumeLabel __MINGW_NAME_AW(SetVolumeLabel)
#define ClearEventLog __MINGW_NAME_AW(ClearEventLog)
#define BackupEventLog __MINGW_NAME_AW(BackupEventLog)