|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
/// <content>
/// Contains extern methods from "KERNEL32.dll".
/// </content>
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.46-beta+dd815b2b9b")]
internal static partial class PInvoke
{
/// <summary>Closes an open object handle.</summary>
/// <param name="hObject">A valid handle to an open object.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>. If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call <b>CloseHandle</b> on a handle returned by the <a href="https://docs.microsoft.com/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea">FindFirstFile</a> function instead of calling the <a href="https://docs.microsoft.com/windows/desktop/api/fileapi/nf-fileapi-findclose">FindClose</a> function.</para>
/// </returns>
/// <remarks>
/// <para>The <b>CloseHandle</b> function closes handles to the following objects: </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/handleapi/nf-handleapi-closehandle#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern winmdroot.Foundation.BOOL CloseHandle(winmdroot.Foundation.HANDLE hObject);
/// <inheritdoc cref="SetFileCompletionNotificationModes(winmdroot.Foundation.HANDLE, byte)"/>
[SupportedOSPlatform("windows6.0.6000")]
internal static unsafe winmdroot.Foundation.BOOL SetFileCompletionNotificationModes(SafeHandle FileHandle, byte Flags)
{
bool FileHandleAddRef = false;
try
{
winmdroot.Foundation.HANDLE FileHandleLocal;
if (FileHandle is object)
{
FileHandle.DangerousAddRef(ref FileHandleAddRef);
FileHandleLocal = (winmdroot.Foundation.HANDLE)FileHandle.DangerousGetHandle();
}
else
throw new ArgumentNullException(nameof(FileHandle));
winmdroot.Foundation.BOOL __result = PInvoke.SetFileCompletionNotificationModes(FileHandleLocal, Flags);
return __result;
}
finally
{
if (FileHandleAddRef)
FileHandle.DangerousRelease();
}
}
/// <summary>Sets the notification modes for a file handle, allowing you to specify how completion notifications work for the specified file.</summary>
/// <param name="FileHandle">A handle to the file.</param>
/// <param name="Flags">
/// <para>The modes to be set. One or more modes can be set at the same time; however, after a mode has been set for a file handle, it cannot be removed. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-setfilecompletionnotificationmodes#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Returns nonzero if successful or zero otherwise. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.</para>
/// </returns>
/// <remarks>
/// <para>To compile an application that uses this function, define the <b>_WIN32_WINNT</b> macro as 0x0600 or later. For more information, see <a href="https://docs.microsoft.com/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>. In Windows 8 and Windows Server 2012, this function is supported by the following technologies. </para>
/// <para>This doc was truncated.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-setfilecompletionnotificationmodes#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows6.0.6000")]
internal static extern winmdroot.Foundation.BOOL SetFileCompletionNotificationModes(winmdroot.Foundation.HANDLE FileHandle, byte Flags);
/// <inheritdoc cref="LocalFree(winmdroot.Foundation.HLOCAL)"/>
[SupportedOSPlatform("windows5.1.2600")]
internal static unsafe LocalFreeSafeHandle LocalFree_SafeHandle(winmdroot.Foundation.HLOCAL hMem)
{
winmdroot.Foundation.HLOCAL __result = PInvoke.LocalFree(hMem);
return new LocalFreeSafeHandle(__result, ownsHandle: true);
}
/// <summary>Frees the specified local memory object and invalidates its handle.</summary>
/// <param name="hMem">
/// <para>A handle to the local memory object. This handle is returned by either the <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-localalloc">LocalAlloc</a> or <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-localrealloc">LocalReAlloc</a> function. It is not safe to free memory allocated with <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-globalalloc">GlobalAlloc</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-localfree#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is <b>NULL</b>. If the function fails, the return value is equal to a handle to the local memory object. To get extended error information, call <a href="https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.</para>
/// </returns>
/// <remarks>
/// <para>If the process tries to examine or modify the memory after it has been freed, heap corruption may occur or an access violation exception (EXCEPTION_ACCESS_VIOLATION) may be generated. If the <i>hMem</i> parameter is <b>NULL</b>, <b>LocalFree</b> ignores the parameter and returns <b>NULL</b>. The <b>LocalFree</b> function will free a locked memory object. A locked memory object has a lock count greater than zero. The <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-locallock">LocalLock</a> function locks a local memory object and increments the lock count by one. The <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-localunlock">LocalUnlock</a> function unlocks it and decrements the lock count by one. To get the lock count of a local memory object, use the <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-localflags">LocalFlags</a> function. If an application is running under a debug version of the system, <b>LocalFree</b> will issue a message that tells you that a locked object is being freed. If you are debugging the application, <b>LocalFree</b> will enter a breakpoint just before freeing a locked object. This allows you to verify the intended behavior, then continue execution.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-localfree#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.1.2600")]
internal static extern winmdroot.Foundation.HLOCAL LocalFree(winmdroot.Foundation.HLOCAL hMem);
}
}
|