{
internal static readonly bool CanGetSetPipeSz = (FcntlCanGetSetPipeSz() != 0);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlGetPipeSz", SetLastError=true)]
- internal static extern int GetPipeSz(SafePipeHandle fd);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlGetPipeSz", SetLastError=true)]
+ internal static partial int GetPipeSz(SafePipeHandle fd);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlSetPipeSz", SetLastError=true)]
- internal static extern int SetPipeSz(SafePipeHandle fd, int size);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlSetPipeSz", SetLastError=true)]
+ internal static partial int SetPipeSz(SafePipeHandle fd, int size);
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlCanGetSetPipeSz")]
[SuppressGCTransition]
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerID", SetLastError = true)]
- internal static extern int GetPeerID(SafeHandle socket, out uint euid);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerID", SetLastError = true)]
+ internal static partial int GetPeerID(SafeHandle socket, out uint euid);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerUserName", SetLastError = true)]
- internal static extern string GetPeerUserName(SafeHandle socket);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerUserName", SetLastError = true, CharSet = CharSet.Ansi)]
+ internal static partial string GetPeerUserName(SafeHandle socket);
}
}
/// Returns the number of bytes read on success; otherwise, -1 is returned
/// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info
/// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
- internal static extern unsafe int Read(SafePipeHandle fd, byte* buffer, int count);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
+ internal static unsafe partial int Read(SafePipeHandle fd, byte* buffer, int count);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FStat", SetLastError = true)]
- internal static extern int FStat(SafePipeHandle fd, out FileStatus output);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FStat", SetLastError = true)]
+ internal static partial int FStat(SafePipeHandle fd, out FileStatus output);
}
}
/// <returns>
/// Returns the number of bytes written on success; otherwise, returns -1 and sets errno
/// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
- internal static extern unsafe int Write(SafePipeHandle fd, byte* buffer, int bufferSize);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
+ internal static unsafe partial int Write(SafePipeHandle fd, byte* buffer, int bufferSize);
}
}
{
internal static partial class Advapi32
{
- [DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool ImpersonateNamedPipeClient(SafePipeHandle hNamedPipe);
+ internal static partial bool ImpersonateNamedPipeClient(SafePipeHandle hNamedPipe);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool ConnectNamedPipe(SafePipeHandle handle, NativeOverlapped* overlapped);
+ internal static unsafe partial bool ConnectNamedPipe(SafePipeHandle handle, NativeOverlapped* overlapped);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool ConnectNamedPipe(SafePipeHandle handle, IntPtr overlapped);
+ internal static partial bool ConnectNamedPipe(SafePipeHandle handle, IntPtr overlapped);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, EntryPoint = "CreateNamedPipeW")]
- internal static extern SafePipeHandle CreateNamedPipe(
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "CreateNamedPipeW")]
+ internal static partial SafePipeHandle CreateNamedPipe(
string pipeName,
int openMode,
int pipeMode,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
- internal static extern SafePipeHandle CreateNamedPipeClient(
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static partial SafePipeHandle CreateNamedPipeClient(
string? lpFileName,
int dwDesiredAccess,
System.IO.FileShare dwShareMode,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool CreatePipe(out SafePipeHandle hReadPipe, out SafePipeHandle hWritePipe, ref SECURITY_ATTRIBUTES lpPipeAttributes, int nSize);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool CreatePipe(out SafePipeHandle hReadPipe, out SafePipeHandle hWritePipe, ref SECURITY_ATTRIBUTES lpPipeAttributes, int nSize);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool DisconnectNamedPipe(SafePipeHandle hNamedPipe);
+ internal static partial bool DisconnectNamedPipe(SafePipeHandle hNamedPipe);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool DuplicateHandle(
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool DuplicateHandle(
IntPtr hSourceProcessHandle,
SafeHandle hSourceHandle,
IntPtr hTargetProcessHandle,
{
internal static partial class Kernel32
{
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static partial bool FlushFileBuffers(SafeHandle hHandle);
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool FlushFileBuffers(SafeHandle hHandle);
+#endif
}
}
{
internal static partial class Kernel32
{
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial int GetFileType(SafeHandle hFile);
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern int GetFileType(SafeHandle hFile);
+#endif
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static extern unsafe bool GetNamedPipeHandleStateW(
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
+ internal static unsafe partial bool GetNamedPipeHandleStateW(
SafePipeHandle hNamedPipe,
uint* lpState,
uint* lpCurInstances,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe bool GetNamedPipeInfo(
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial bool GetNamedPipeInfo(
SafePipeHandle hNamedPipe,
uint* lpFlags,
uint* lpOutBufferSize,
{
internal static partial class Kernel32
{
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int ReadFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern unsafe int ReadFile(
+#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
{
internal static partial class Kernel32
{
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int ReadFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern unsafe int ReadFile(
+#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
IntPtr numBytesRead_mustBeZero,
NativeOverlapped* overlapped);
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int ReadFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
internal static extern unsafe int ReadFile(
+#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool SetNamedPipeHandleState(
+ internal static unsafe partial bool SetNamedPipeHandleState(
SafePipeHandle hNamedPipe,
int* lpMode,
IntPtr lpMaxCollectionCount,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, EntryPoint = "WaitNamedPipeW")]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "WaitNamedPipeW")]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool WaitNamedPipe(string? name, int timeout);
+ internal static partial bool WaitNamedPipe(string? name, int timeout);
}
}
// struct in a callback (or an EndWrite method called by that callback),
// and pass in an address for the numBytesRead parameter.
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int WriteFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero);
+ internal static extern unsafe int WriteFile(
+#endif
+ SafeHandle handle,
+ byte* bytes,
+ int numBytesToWrite,
+ out int numBytesWritten,
+ IntPtr mustBeZero);
}
}
// simultaneously: overlapped IO, free the memory for the overlapped
// struct in a callback (or an EndWrite method called by that callback),
// and pass in an address for the numBytesRead parameter.
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int WriteFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped);
+ internal static extern unsafe int WriteFile(
+#endif
+ SafeHandle handle,
+ byte* bytes,
+ int numBytesToWrite,
+ IntPtr numBytesWritten_mustBeZero,
+ NativeOverlapped* lpOverlapped);
+#if DLLIMPORTGENERATOR_ENABLED
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int WriteFile(
+#else
[DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, NativeOverlapped* lpOverlapped);
+ internal static extern unsafe int WriteFile(
+#endif
+ SafeHandle handle,
+ byte* bytes,
+ int numBytesToWrite,
+ out int numBytesWritten,
+ NativeOverlapped* lpOverlapped);
}
}