Minor fixes related to Kernel32 build

pull/10/head
David Hall 2018-05-29 17:49:10 -06:00
parent 7bd7cae7d8
commit 214ca4bb5f
15 changed files with 335 additions and 79 deletions

View File

@ -1,5 +1,5 @@
## Correlation report for kernel32.dll
### Methods (66% complete)
### Methods (67% complete)
Native Method | Native DLL | Header | Managed Method
---- | ---- | ---- | ----
[AcquireSRWLockExclusive](https://www.google.com/search?num=5&q=AcquireSRWLockExclusive+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.AcquireSRWLockExclusive
@ -134,10 +134,10 @@ Native Method | Native DLL | Header | Managed Method
[CreateEventW](https://www.google.com/search?num=5&q=CreateEventW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateEvent
[CreateFiber](https://www.google.com/search?num=5&q=CreateFiber+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFiber
[CreateFiberEx](https://www.google.com/search?num=5&q=CreateFiberEx+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFiberEx
[CreateFile2](https://www.google.com/search?num=5&q=CreateFile2+site%3Amsdn.microsoft.com) | kernel32.dll | |
[CreateFile2](https://www.google.com/search?num=5&q=CreateFile2+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.CreateFile2
[CreateFileA](https://www.google.com/search?num=5&q=CreateFileA+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.CreateFile
[CreateFileMappingA](https://www.google.com/search?num=5&q=CreateFileMappingA+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFileMapping
[CreateFileMappingFromApp](https://www.google.com/search?num=5&q=CreateFileMappingFromApp+site%3Amsdn.microsoft.com) | kernel32.dll | |
[CreateFileMappingFromApp](https://www.google.com/search?num=5&q=CreateFileMappingFromApp+site%3Amsdn.microsoft.com) | kernel32.dll | MemoryApi.h | Vanara.PInvoke.Kernel32.CreateFileMappingFromApp
[CreateFileMappingNumaA](https://www.google.com/search?num=5&q=CreateFileMappingNumaA+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFileMappingNuma
[CreateFileMappingNumaW](https://www.google.com/search?num=5&q=CreateFileMappingNumaW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFileMappingNuma
[CreateFileMappingW](https://www.google.com/search?num=5&q=CreateFileMappingW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.CreateFileMapping
@ -330,12 +330,12 @@ Native Method | Native DLL | Header | Managed Method
[FindFirstFileTransactedW](https://www.google.com/search?num=5&q=FindFirstFileTransactedW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[FindFirstFileW](https://www.google.com/search?num=5&q=FindFirstFileW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindFirstFile
[FindFirstStreamTransactedW](https://www.google.com/search?num=5&q=FindFirstStreamTransactedW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[FindFirstStreamW](https://www.google.com/search?num=5&q=FindFirstStreamW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[FindFirstStreamW](https://www.google.com/search?num=5&q=FindFirstStreamW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.FindFirstStream
[FindFirstVolumeA](https://www.google.com/search?num=5&q=FindFirstVolumeA+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindFirstVolume
[FindFirstVolumeMountPointA](https://www.google.com/search?num=5&q=FindFirstVolumeMountPointA+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.FindFirstVolumeMountPoint
[FindFirstVolumeMountPointW](https://www.google.com/search?num=5&q=FindFirstVolumeMountPointW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.FindFirstVolumeMountPoint
[FindFirstVolumeW](https://www.google.com/search?num=5&q=FindFirstVolumeW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindFirstVolume
[FindNextChangeNotification](https://www.google.com/search?num=5&q=FindNextChangeNotification+site%3Amsdn.microsoft.com) | kernel32.dll | |
[FindNextChangeNotification](https://www.google.com/search?num=5&q=FindNextChangeNotification+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindNextChangeNotification
[FindNextFileA](https://www.google.com/search?num=5&q=FindNextFileA+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindNextFile
[FindNextFileNameW](https://www.google.com/search?num=5&q=FindNextFileNameW+site%3Amsdn.microsoft.com) | kernel32.dll | WinBase.h | Vanara.PInvoke.Kernel32.FindNextFileName
[FindNextFileW](https://www.google.com/search?num=5&q=FindNextFileW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.FindNextFile
@ -667,10 +667,10 @@ Native Method | Native DLL | Header | Managed Method
[GetStateFolder](https://www.google.com/search?num=5&q=GetStateFolder+site%3Amsdn.microsoft.com) | kernel32.dll | |
[GetStdHandle](https://www.google.com/search?num=5&q=GetStdHandle+site%3Amsdn.microsoft.com) | kernel32.dll | Winbase.h | Vanara.PInvoke.Kernel32.GetStdHandle
[GetStringScripts](https://www.google.com/search?num=5&q=GetStringScripts+site%3Amsdn.microsoft.com) | kernel32.dll | Winnls.h | Vanara.PInvoke.Kernel32.GetStringScripts
[GetStringTypeA](https://www.google.com/search?num=5&q=GetStringTypeA+site%3Amsdn.microsoft.com) | kernel32.dll | |
[GetStringTypeA](https://www.google.com/search?num=5&q=GetStringTypeA+site%3Amsdn.microsoft.com) | kernel32.dll | Winnls.h | Vanara.PInvoke.Kernel32.GetStringTypeA
[GetStringTypeExA](https://www.google.com/search?num=5&q=GetStringTypeExA+site%3Amsdn.microsoft.com) | kernel32.dll | Winnls.h | Vanara.PInvoke.Kernel32.GetStringTypeEx
[GetStringTypeExW](https://www.google.com/search?num=5&q=GetStringTypeExW+site%3Amsdn.microsoft.com) | kernel32.dll | Winnls.h | Vanara.PInvoke.Kernel32.GetStringTypeEx
[GetStringTypeW](https://www.google.com/search?num=5&q=GetStringTypeW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[GetStringTypeW](https://www.google.com/search?num=5&q=GetStringTypeW+site%3Amsdn.microsoft.com) | kernel32.dll | Stringapiset.h | Vanara.PInvoke.Kernel32.GetStringTypeW
[GetSystemAppDataKey](https://www.google.com/search?num=5&q=GetSystemAppDataKey+site%3Amsdn.microsoft.com) | kernel32.dll | |
[GetSystemCpuSetInformation](https://www.google.com/search?num=5&q=GetSystemCpuSetInformation+site%3Amsdn.microsoft.com) | kernel32.dll | Processthreadapi.h | Vanara.PInvoke.Kernel32.GetSystemCpuSetInformation
[GetSystemDefaultLangID](https://www.google.com/search?num=5&q=GetSystemDefaultLangID+site%3Amsdn.microsoft.com) | kernel32.dll | Winnls.h | Vanara.PInvoke.Kernel32.GetSystemDefaultLangID
@ -742,7 +742,7 @@ Native Method | Native DLL | Header | Managed Method
[GetVersionExA](https://www.google.com/search?num=5&q=GetVersionExA+site%3Amsdn.microsoft.com) | kernel32.dll | Winbase.h | Vanara.PInvoke.Kernel32.GetVersionEx
[GetVersionExW](https://www.google.com/search?num=5&q=GetVersionExW+site%3Amsdn.microsoft.com) | kernel32.dll | Winbase.h | Vanara.PInvoke.Kernel32.GetVersionEx
[GetVolumeInformationA](https://www.google.com/search?num=5&q=GetVolumeInformationA+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.GetVolumeInformation
[GetVolumeInformationByHandleW](https://www.google.com/search?num=5&q=GetVolumeInformationByHandleW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[GetVolumeInformationByHandleW](https://www.google.com/search?num=5&q=GetVolumeInformationByHandleW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.GetVolumeInformationByHandleW
[GetVolumeInformationW](https://www.google.com/search?num=5&q=GetVolumeInformationW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.GetVolumeInformation
[GetVolumeNameForVolumeMountPointA](https://www.google.com/search?num=5&q=GetVolumeNameForVolumeMountPointA+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.GetVolumeNameForVolumeMountPoint
[GetVolumeNameForVolumeMountPointW](https://www.google.com/search?num=5&q=GetVolumeNameForVolumeMountPointW+site%3Amsdn.microsoft.com) | kernel32.dll | FileAPI.h | Vanara.PInvoke.Kernel32.GetVolumeNameForVolumeMountPoint
@ -883,8 +883,8 @@ Native Method | Native DLL | Header | Managed Method
[lstrcpy](https://www.google.com/search?num=5&q=lstrcpy+site%3Amsdn.microsoft.com) | kernel32.dll | |
[lstrcpyn](https://www.google.com/search?num=5&q=lstrcpyn+site%3Amsdn.microsoft.com) | kernel32.dll | |
[lstrlen](https://www.google.com/search?num=5&q=lstrlen+site%3Amsdn.microsoft.com) | kernel32.dll | |
[lstrlenA](https://www.google.com/search?num=5&q=lstrlenA+site%3Amsdn.microsoft.com) | kernel32.dll | |
[lstrlenW](https://www.google.com/search?num=5&q=lstrlenW+site%3Amsdn.microsoft.com) | kernel32.dll | |
[lstrlenA](https://www.google.com/search?num=5&q=lstrlenA+site%3Amsdn.microsoft.com) | kernel32.dll | Winbase.h | Vanara.PInvoke.Kernel32.lstrlen
[lstrlenW](https://www.google.com/search?num=5&q=lstrlenW+site%3Amsdn.microsoft.com) | kernel32.dll | Winbase.h | Vanara.PInvoke.Kernel32.lstrlen
[LZClose](https://www.google.com/search?num=5&q=LZClose+site%3Amsdn.microsoft.com) | kernel32.dll | |
[LZCloseFile](https://www.google.com/search?num=5&q=LZCloseFile+site%3Amsdn.microsoft.com) | kernel32.dll | |
[LZCopy](https://www.google.com/search?num=5&q=LZCopy+site%3Amsdn.microsoft.com) | kernel32.dll | |

View File

@ -1007,14 +1007,6 @@ namespace Vanara.PInvoke
[PInvokeData("WinBase.h", MSDNShortId = "")]
public static extern void RestoreLastError(uint dwErrCode);
/// <summary>Retrieves a context record in the context of the caller.</summary>
/// <param name="ContextRecord">A pointer to a <c>CONTEXT</c> structure.</param>
/// <returns>This function does not return a value.</returns>
// VOID WINAPI RtlCaptureContext( _Out_ PCONTEXT ContextRecord); https://msdn.microsoft.com/en-us/library/windows/desktop/ms680591(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680591")]
public static extern void RtlCaptureContext(ref CONTEXT ContextRecord);
/// <summary>Controls whether the system will handle the specified types of serious errors or whether the process will handle them.</summary>
/// <param name="uMode">
/// <para>The process error mode. This parameter can be one or more of the following values.</para>

View File

@ -700,7 +700,7 @@ namespace Vanara.PInvoke
/// </returns>
// HANDLE WINAPI CreateFile2( _In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_ DWORD dwCreationDisposition, _In_opt_
// LPCREATEFILE2_EXTENDED_PARAMETERS pCreateExParams);
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("FileAPI.h", MSDNShortId = "hh449422")]
public static extern SafeFileHandle CreateFile2(string lpFileName, FileAccess dwDesiredAccess, FileShare dwShareMode, FileMode dwCreationDisposition, ref CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams);
@ -889,11 +889,14 @@ namespace Vanara.PInvoke
public static extern SafeVolumeSearchHandle FindFirstVolume([In, Out] StringBuilder lpszVolumeName, uint cchBufferLength);
/// <summary>Requests that the operating system signal a change notification handle the next time it detects an appropriate change.</summary>
/// <param name="hChangeHandle">A handle to a change notification handle created by the FindFirstChangeNotification function.</param>
/// <param name="hChangeHandle">A handle to a change notification handle created by the <c>FindFirstChangeNotification</c> function.</param>
/// <returns>
/// If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.To get extended error information, call GetLastError.
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call <c>GetLastError</c>.</para>
/// </returns>
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
// BOOL WINAPI FindNextChangeNotification( _In_ HANDLE hChangeHandle);
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364427(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("FileAPI.h", MSDNShortId = "aa364427")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FindNextChangeNotification([In] SafeFindChangeNotificationHandle hChangeHandle);
@ -1873,7 +1876,7 @@ namespace Vanara.PInvoke
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("FileAPI.h", MSDNShortId = "aa964920")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern uint GetVolumeInformationByHandle([In] SafeFileHandle hFile, [Out] StringBuilder lpVolumeNameBuffer, uint nVolumeNameSize, out uint lpVolumeSerialNumber, out uint lpMaximumComponentLength, out FileSystemFlags lpFileSystemFlags, [Out] StringBuilder lpFileSystemNameBuffer, uint nFileSystemNameSize);
public static extern uint GetVolumeInformationByHandleW([In] SafeFileHandle hFile, [Out] StringBuilder lpVolumeNameBuffer, uint nVolumeNameSize, out uint lpVolumeSerialNumber, out uint lpMaximumComponentLength, out FileSystemFlags lpFileSystemFlags, [Out] StringBuilder lpFileSystemNameBuffer, uint nFileSystemNameSize);
/// <summary>
/// <para>

View File

@ -53,7 +53,7 @@ namespace Vanara.PInvoke
/// <param name="hSecondObjectHandle">The second object handle to compare.</param>
/// <returns>A Boolean value that indicates if the two handles refer to the same underlying kernel object. TRUE if the same, otherwise FALSE.</returns>
// BOOL WINAPI CompareObjectHandles( _In_ HANDLE hFirstObjectHandle, _In_ HANDLE hSecondObjectHandle); https://msdn.microsoft.com/en-us/library/windows/desktop/mt438733(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[DllImport(Lib.KernelBase, SetLastError = false, ExactSpelling = true)]
[PInvokeData("Handleapi.h", MSDNShortId = "mt438733")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CompareObjectHandles(IntPtr hFirstObjectHandle, IntPtr hSecondObjectHandle);

View File

@ -1450,43 +1450,6 @@ namespace Vanara.PInvoke
[SuppressUnmanagedCodeSecurity]
public static extern SafeResourceDataHandle LoadResource(SafeLibraryHandle hModule, SafeResourceHandle hResInfo);
/// <summary>
/// Loads a string resource from the executable file associated with a specified module, copies the string into a buffer, and appends a terminating null character.
/// </summary>
/// <param name="hInstance">
/// <para>Type: <c>HINSTANCE</c></para>
/// <para>
/// A handle to an instance of the module whose executable file contains the string resource. To get the handle to the application itself, call the
/// <c>GetModuleHandle</c> function with <c>NULL</c>.
/// </para>
/// </param>
/// <param name="uID">
/// <para>Type: <c>UINT</c></para>
/// <para>The identifier of the string to be loaded.</para>
/// </param>
/// <param name="lpBuffer">
/// <para>Type: <c>LPTSTR</c></para>
/// <para>The buffer is to receive the string. Must be of sufficient length to hold a pointer (8 bytes).</para>
/// </param>
/// <param name="nBufferMax">
/// <para>Type: <c>int</c></para>
/// <para>
/// The size of the buffer, in characters. The string is truncated and null-terminated if it is longer than the number of characters specified. If this
/// parameter is 0, then lpBuffer receives a read-only pointer to the resource itself.
/// </para>
/// </param>
/// <returns>
/// <para>Type: <c>int</c></para>
/// <para>
/// If the function succeeds, the return value is the number of characters copied into the buffer, not including the terminating null character, or zero
/// if the string resource does not exist. To get extended error information, call <c>GetLastError</c>.
/// </para>
/// </returns>
// int WINAPI LoadString( _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_ LPTSTR lpBuffer, _In_ int nBufferMax); https://msdn.microsoft.com/en-us/library/windows/desktop/ms647486(v=vs.85).aspx
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("Winuser.h", MSDNShortId = "ms647486")]
public static extern int LoadString(SafeLibraryHandle hInstance, uint uID, [Out] StringBuilder lpBuffer, int nBufferMax);
/// <summary>Retrieves a pointer to the specified resource in memory.</summary>
/// <param name="hResData">
/// <para>Type: <c>HGLOBAL</c></para>

View File

@ -3,7 +3,7 @@ using System.Text;
namespace Vanara.PInvoke
{
public static partial class Lz32
public static partial class Kernel32
{
/// <summary>Retrieves the original name of a compressed file, if the file was compressed by the Lempel-Ziv algorithm.</summary>
/// <param name="lpszSource">The name of the compressed file.</param>
@ -13,7 +13,7 @@ namespace Vanara.PInvoke
/// <para>If the function fails, the return value is LZERROR_BADVALUE. There is no extended error information for this function; do not call <c>GetLastError</c>.</para>
/// </returns>
// INT WINAPI GetExpandedName( _In_ LPTSTR lpszSource, _Out_ LPTSTR lpszBuffer); https://msdn.microsoft.com/en-us/library/windows/desktop/aa364941(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, CharSet = CharSet.Auto)]
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa364941")]
public static extern int GetExpandedName(string lpszSource, [Out] StringBuilder lpszBuffer);
@ -21,7 +21,7 @@ namespace Vanara.PInvoke
/// <param name="hFile">A handle to the file to be closed.</param>
/// <returns>This function does not return a value.</returns>
// void APIENTRY LZClose( _In_ INT hFile); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365221(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = false, ExactSpelling = true)]
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365221")]
public static extern void LZClose(int hFile);
@ -69,7 +69,7 @@ namespace Vanara.PInvoke
/// <para>There is no extended error information for this function; do not call <c>GetLastError</c>.</para>
/// </returns>
// LONG WINAPI LZCopy( _In_ INT hfSource, _In_ INT hfDest); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365223(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, ExactSpelling = true)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365223")]
public static extern int LZCopy(int hfSource, int hfDest);
@ -109,7 +109,7 @@ namespace Vanara.PInvoke
/// <para>There is no extended error information for this function; do not call <c>GetLastError</c>.</para>
/// </returns>
// INT WINAPI LZInit( _In_ INT hfSource); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365224(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, ExactSpelling = true)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365224")]
public static extern int LZInit(int hfSource);
@ -232,7 +232,7 @@ namespace Vanara.PInvoke
/// </para>
/// </returns>
// INT WINAPI LZOpenFile( _In_ LPTSTR lpFileName, _Out_ LPOFSTRUCT lpReOpenBuf, _In_ WORD wStyle); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365225(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, CharSet = CharSet.Auto)]
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365225")]
public static extern int LZOpenFile(string lpFileName, out OFSTRUCT lpReOpenBuf, ushort wStyle);
@ -286,7 +286,7 @@ namespace Vanara.PInvoke
/// <para>There is no extended error information for this function; do not call <c>GetLastError</c>.</para>
/// </returns>
// INT WINAPI LZRead( _In_ INT hFile, _Out_ LPSTR lpBuffer, _In_ INT cbRead); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365226(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365226")]
public static extern int LZRead(int hFile, [Out] StringBuilder lpBuffer, int cbRead);
@ -346,7 +346,7 @@ namespace Vanara.PInvoke
/// <para>There is no extended error information for this function; do not call <c>GetLastError</c>.</para>
/// </returns>
// LONG WINAPI LZSeek( _In_ INT hFile, _In_ LONG lOffset, _In_ INT iOrigin); https://msdn.microsoft.com/en-us/library/windows/desktop/aa365227(v=vs.85).aspx
[DllImport(Lib.Lz32, SetLastError = true, ExactSpelling = true)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("LzExpand.h", MSDNShortId = "aa365227")]
public static extern int LZSeek(int hFile, int lOffset, int iOrigin);
}

View File

@ -799,7 +799,7 @@ namespace Vanara.PInvoke
/// </returns>
// HANDLE WINAPI CreateFileMappingFromApp( _In_ HANDLE hFile, _In_opt_ PSECURITY_ATTRIBUTES SecurityAttributes, _In_ ULONG PageProtection, _In_ ULONG64
// MaximumSize, _In_opt_ PCWSTR Name);
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("MemoryApi.h", MSDNShortId = "hh994453")]
public static extern IntPtr CreateFileMappingFromApp([In] SafeFileHandle hFile, [In] ref SECURITY_ATTRIBUTES SecurityAttributes,
MEM_PROTECTION PageProtection, ulong MaximumSize, [In] string Name);
@ -1575,7 +1575,7 @@ namespace Vanara.PInvoke
/// </returns>
// PVOID WINAPI MapViewOfFileNuma2( _In_ HANDLE FileMappingHandle, _In_ HANDLE ProcessHandle, _In_ ULONG64 Offset, _In_opt_ PVOID BaseAddress, _In_
// SIZE_T ViewSize, _In_ ULONG AllocationType, _In_ ULONG PageProtection, _In_ ULONG PreferredNode);
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[DllImport("Api-ms-win-core-memory-l1-1-5.dll", SetLastError = true, ExactSpelling = true)]
[PInvokeData("WinBase.h", MSDNShortId = "mt492558")]
public static extern IntPtr MapViewOfFileNuma2([In] IntPtr FileMappingHandle, [In] IntPtr ProcessHandle, ulong Offset, IntPtr BaseAddress, SizeT ViewSize,
MEM_ALLOCATION_TYPE AllocationType, MEM_PROTECTION PageProtection, uint PreferredNode);
@ -1673,7 +1673,7 @@ namespace Vanara.PInvoke
/// <para>If the function fails, the return value is <c>NULL</c>. To get extended error information, call <c>GetLastError</c>.</para>
/// </returns>
// HANDLE WINAPI OpenFileMappingFromApp( _In_ ULONG DesiredAccess, _In_ BOOL InheritHandle, _In_ PCWSTR Name);
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("MemoryApi.h", MSDNShortId = "mt169844")]
public static extern IntPtr OpenFileMappingFromApp(FILE_MAP DesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool InheritHandle, string Name);

View File

@ -0,0 +1,249 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Vanara.PInvoke
{
public static partial class Kernel32
{
/// <summary>Adds a dynamic function table to the dynamic function table list.</summary>
/// <param name="FunctionTable">
/// A pointer to an array of function entries. For a definition of the <c>PRUNTIME_FUNCTION</c> type, see WinNT.h. For more information on runtime
/// function entries, see the calling convention documentation for the processor.
/// </param>
/// <param name="EntryCount">The number of entries in the FunctionTable array.</param>
/// <param name="BaseAddress">The base address to use when computing full virtual addresses from relative virtual addresses of function table entries.</param>
/// <param name="TargetGp">
/// <para>The target global pointer. This is part of the Intel IPF calling convention. It is a pointer to a data area in an image.</para>
/// <para>This parameter does not exist on x64.</para>
/// </param>
/// <returns>If the function succeeds, the return value is <c>TRUE</c>. Otherwise, the return value is <c>FALSE</c>.</returns>
// BOOLEAN WINAPI RtlAddFunctionTable( _In_ PRUNTIME_FUNCTION FunctionTable, _In_ DWORD EntryCount, _In_ DWORD64 BaseAddress, _In_ ULONGLONG TargetGp);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680588(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680588")]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool RtlAddFunctionTable(IntPtr FunctionTable, uint EntryCount, ulong BaseAddress, ulong TargetGp);
/// <summary>Retrieves a context record in the context of the caller.</summary>
/// <param name="ContextRecord">A pointer to a <c>CONTEXT</c> structure.</param>
/// <returns>This function does not return a value.</returns>
// VOID WINAPI RtlCaptureContext( _Out_ PCONTEXT ContextRecord); https://msdn.microsoft.com/en-us/library/windows/desktop/ms680591(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680591")]
public static extern void RtlCaptureContext(ref CONTEXT ContextRecord);
/// <summary>Removes a dynamic function table from the dynamic function table list.</summary><param name="FunctionTable">A pointer to an array of function entries that were previously passed to <c>RtlAddFunctionTable</c> or an identifier previously passed to <c>RtlInstallFunctionTableCallback</c>. For a definition of the <c>PRUNTIME_FUNCTION</c> type, see WinNT.h.</param><returns>If the function succeeds, the return value is <c>TRUE</c>. Otherwise, the return value is <c>FALSE</c>.</returns>
// BOOLEAN WINAPI RtlDeleteFunctionTable( _In_ PRUNTIME_FUNCTION FunctionTable);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680593(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680593")]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool RtlDeleteFunctionTable(IntPtr FunctionTable);
/// <summary>Adds a dynamic function table to the dynamic function table list.</summary><param name="TableIdentifier">The identifier for the dynamic function table callback. The two low-order bits must be set. For example, BaseAddress|0x3.</param><param name="BaseAddress">The base address of the region of memory managed by the callback function.</param><param name="Length">The size of the region of memory managed by the callback function, in bytes.</param><param name="Callback">A pointer to the callback function that is called to retrieve the function table entries for the functions in the specified region of memory. For a definition of the <c>PGET_RUNTIME_FUNCTION_CALLBACK</c> type, see WinNT.h.</param><param name="Context">A pointer to the user-defined data to be passed to the callback function.</param><param name="OutOfProcessCallbackDll"><para>An optional pointer to a string that specifies the path of a DLL that provides function table entries that are outside the process.</para><para>When a debugger unwinds to a function in the range of addresses managed by the callback function, it loads this DLL and calls the <c>OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME</c> function, whose type is <c>POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK</c>. For more information, see the definitions of these items in WinNT.h.</para></param><returns>If the function succeeds, the return value is <c>TRUE</c>. If the function fails, the return value is <c>FALSE</c>.</returns>
// BOOLEAN WINAPI RtlInstallFunctionTableCallback( _In_ DWORD64 TableIdentifier, _In_ DWORD64 BaseAddress, _In_ DWORD Length, _In_ PGET_RUNTIME_FUNCTION_CALLBACK Callback, _In_ PVOID Context, _In_ PCWSTR OutOfProcessCallbackDll);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680595(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680595")]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool RtlInstallFunctionTableCallback(ulong TableIdentifier, ulong BaseAddress, uint Length, PGET_RUNTIME_FUNCTION_CALLBACK Callback, IntPtr Context, [Optional] string OutOfProcessCallbackDll);
/// <summary>Retrieves the function table entries for the functions in the specified region of memory.</summary>
/// <param name="ControlPc">The control address.</param>
/// <param name="Context">A pointer to the user-defined data to be passed from the function call.</param>
/// <returns></returns>
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
[PInvokeData("WinNT.h")]
public delegate IntPtr PGET_RUNTIME_FUNCTION_CALLBACK(uint ControlPc, IntPtr Context);
/// <summary>Searches the active function tables for an entry that corresponds to the specified PC value.</summary>
/// <param name="ControlPc">The virtual address of an instruction bundle within the function.</param>
/// <param name="ImageBase">The base address of module to which the function belongs.</param>
/// <param name="TargetGp">
/// <para>The global pointer value of the module.</para>
/// <para>This parameter has a different declaration on x64 and ARM systems. For more information, see x64 Definition and ARM Definition.</para>
/// </param>
/// <returns>
/// If there is no entry in the function table for the specified PC, the function returns <c>NULL</c>. Otherwise, the function returns the address of the
/// function table entry that corresponds to the specified PC.
/// </returns>
// PVOID WINAPI RtlLookupFunctionEntry( _In_ ULONGLONG ControlPc, _Out_ PULONGLONG ImageBase, _Out_ PULONGLONG TargetGp);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680597(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680597")]
public static extern IntPtr RtlLookupFunctionEntry(ulong ControlPc, out ulong ImageBase, out ulong TargetGp);
/// <summary>Moves a block of memory from one location to another.</summary>
/// <param name="Destination">A pointer to the starting address of the move destination.</param>
/// <param name="Source">A pointer to the starting address of the block of memory to be moved.</param>
/// <param name="Length">The size of the block of memory to move, in bytes.</param>
/// <returns>This function has no return value.</returns>
// void MoveMemory( _In_ PVOID Destination, _In_ const VOID *Source, _In_ SIZE_T Length);
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366788(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, EntryPoint = "RtlMoveMemory")]
[PInvokeData("WinBase.h", MSDNShortId = "aa366788")]
public static extern void MoveMemory(IntPtr Destination, IntPtr Source, SizeT Length);
/// <summary>Retrieves the base address of the image that contains the specified PC value.</summary>
/// <param name="PcValue">
/// The PC value. The function searches all modules mapped into the address space of the calling process for a module that contains this value.
/// </param>
/// <param name="BaseOfImage">
/// The base address of the image containing the PC value. This value must be added to any relative addresses in the headers to locate the image.
/// </param>
/// <returns>
/// <para>If the PC value is found, the function returns the base address of the image that contains the PC value.</para>
/// <para>If no image contains the PC value, the function returns <c>NULL</c>.</para>
/// </returns>
// PVOID WINAPI RtlPcToFileHeader( _In_ PVOID PcValue, _Out_ PVOID *BaseOfImage);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680603(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680603")]
public static extern IntPtr RtlPcToFileHeader(IntPtr PcValue, out IntPtr BaseOfImage);
/// <summary>Restores the context of the caller to the specified context record.</summary>
/// <param name="ContextRecord">A pointer to a <c>CONTEXT</c> structure.</param>
/// <param name="ExceptionRecord">
/// <para>A pointer to an <c>EXCEPTION_RECORD</c> structure. This parameter is optional and should typically be <c>NULL</c>.</para>
/// <para>
/// An exception record is used primarily with long jump and C++ catch-throw support. If the <c>ExceptionCode</c> member is STATUS_LONGJUMP, the
/// <c>ExceptionInformation</c> member contains a pointer to a jump buffer. <c>RtlRestoreContext</c> will copy the non-volatile state from the jump
/// buffer in to the context record before the context record is restored.
/// </para>
/// <para>
/// If the <c>ExceptionCode</c> member is STATUS_UNWIND_CONSOLIDATE, the <c>ExceptionInformation</c> member contains a pointer to a callback function,
/// such as a catch handler. <c>RtlRestoreContext</c> consolidates the call frames between its frame and the frame specified in the context record before
/// calling the callback function. This hides frames from any exception handling that might occur in the callback function. The difference between this
/// and a typical unwind is that the data on the stack is still present, so frame data such as a throw object is still available. The callback function
/// returns a new program counter to update in the context record, which is then used in a normal restore context.
/// </para>
/// </param>
/// <returns>This function does not return a value.</returns>
// VOID WINAPI RtlRestoreContext( _In_ PCONTEXT ContextRecord, _In_ PEXCEPTION_RECORD ExceptionRecord); https://msdn.microsoft.com/en-us/library/windows/desktop/ms680605(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680605")]
public static extern void RtlRestoreContext(ref CONTEXT ContextRecord, ref EXCEPTION_RECORD ExceptionRecord);
/// <summary>Initiates an unwind of procedure call frames.</summary>
/// <param name="TargetFrame">
/// A pointer to the call frame that is the target of the unwind. If this parameter is <c>NULL</c>, the function performs an exit unwind.
/// </param>
/// <param name="TargetIp">The continuation address of the unwind. This parameter is ignored if TargetFrame is <c>NULL</c>.</param>
/// <param name="ExceptionRecord">A pointer to an <c>EXCEPTION_RECORD</c> structure.</param>
/// <param name="ReturnValue">A value to be placed in the integer function return register before continuing execution.</param>
/// <returns>This function does not return a value.</returns>
// void WINAPI RtlUnwind( _In_opt_ PVOID TargetFrame, _In_opt_ PVOID TargetIp, _In_opt_ PEXCEPTION_RECORD ExceptionRecord, _In_ PVOID ReturnValue); https://msdn.microsoft.com/en-us/library/windows/desktop/ms680609(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680609")]
public static extern void RtlUnwind(IntPtr TargetFrame, IntPtr TargetIp, ref EXCEPTION_RECORD ExceptionRecord, IntPtr ReturnValue);
/// <summary>Initiates an unwind of procedure call frames.</summary>
/// <param name="TargetFrame">
/// A pointer to the call frame that is the target of the unwind. If this parameter is <c>NULL</c>, the function performs an exit unwind.
/// </param>
/// <param name="TargetIp">The continuation address of the unwind. This parameter is ignored if TargetFrame is <c>NULL</c>.</param>
/// <param name="ExceptionRecord">A pointer to an <c>EXCEPTION_RECORD</c> structure.</param>
/// <param name="ReturnValue">A value to be placed in the integer function return register before continuing execution.</param>
/// <param name="OriginalContext">A pointer to a <c>CONTEXT</c> structure that stores context during the unwind operation.</param>
/// <param name="HistoryTable">
/// A pointer to the unwind history table. This structure is processor specific. For definitions of this structure, see Winternl.h.
/// </param>
/// <returns>This function does not return a value.</returns>
// void WINAPI RtlUnwindEx( _In_opt_ PVOID TargetFrame, _In_opt_ PVOID TargetIp, _In_opt_ PEXCEPTION_RECORD ExceptionRecord, _In_ PVOID ReturnValue, _In_
// PCONTEXT OriginalContext, _In_opt_ PUNWIND_HISTORY_TABLE HistoryTable); https://msdn.microsoft.com/en-us/library/windows/desktop/ms680615(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h", MSDNShortId = "ms680615")]
public static extern void RtlUnwindEx(IntPtr TargetFrame, IntPtr TargetIp, ref EXCEPTION_RECORD ExceptionRecord, IntPtr ReturnValue, ref CONTEXT OriginalContext, IntPtr HistoryTable);
/*
public static extern void RtlCaptureStackBackTrace();
public static extern void RtlCompareMemory();
public static extern void RtlCopyMemory();
public static extern void RtlFillMemory();
/// <summary>Retrieves the invocation context of the function that precedes the specified function context.</summary>
/// <param name="HandlerType">
/// <para>The handler type. This parameter can be one of the following values.</para>
/// <para>This parameter is only present on x64.</para>
/// <para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>UNW_FLAG_NHANDLER0x0</term>
/// <term>The function has no handler.</term>
/// </item>
/// <item>
/// <term>UNW_FLAG_EHANDLER0x1</term>
/// <term>The function has an exception handler that should be called.</term>
/// </item>
/// <item>
/// <term>UNW_FLAG_UHANDLER0x2</term>
/// <term>The function has a termination handler that should be called when unwinding an exception.</term>
/// </item>
/// <item>
/// <term>UNW_FLAG_CHAININFO0x4</term>
/// <term>The FunctionEntry member is the contents of a previous function table entry.</term>
/// </item>
/// </list>
/// </para>
/// </param>
/// <param name="ImageBase">The base address of the module to which the function belongs.</param>
/// <param name="ControlPC">The virtual address where control left the specified function.</param>
/// <param name="FunctionEntry">
/// The address of the function table entry for the specified function. To obtain the function table entry, call the <c>RtlLookupFunctionEntry</c> function.
/// </param>
/// <param name="ContextRecord">A pointer to a <c>CONTEXT</c> structure that represents the context of the previous frame.</param>
/// <param name="InFunction">
/// <para>
/// The location of the PC. If this parameter is 0, the PC is in the prologue, epilogue, or a null frame region of the function. If this parameter is 1,
/// the PC is in the body of the function.
/// </para>
/// <para>This parameter is not present on x64.</para>
/// </param>
/// <param name="EstablisherFrame">
/// <para>
/// A pointer to a <c>FRAME_POINTERS</c> structure that receives the establisher frame pointer value. The real frame pointer is defined only if
/// InFunction is 1.
/// </para>
/// <para>This parameter is of type <c>PULONG64</c> on x64.</para>
/// </param>
/// <param name="ContextPointers">An optional pointer to a context pointers structure.</param>
/// <returns>This function returns a pointer to an EXCEPTION_ROUTINE callback function.</returns>
// PEXCEPTION_ROUTINE WINAPI RtlVirtualUnwind( _In_ HandlerType, _In_ ImageBase, _In_ ControlPC, _In_ FunctionEntry, _Inout_ ContextRecord, _Out_ InFunction, _Out_ EstablisherFrame, _Inout_opt_ ContextPointers);
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680617(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = false, EntryPoint = "RtlVirtualUnwind")]
[PInvokeData("WinNT.h", MSDNShortId = "ms680617")]
public static extern EXCEPTION_ROUTINE RtlVirtualUnwindX64(UNW_FLAGS HandlerType, UIntPtr ImageBase, UIntPtr ControlPC, IntPtr FunctionEntry, ref CONTEXT ContextRecord, out IntPtr HandlerData, out ulong EstablisherFrame, IntPtr ContextPointers);
/// <summary>The handler type.</summary>
[Flags]
public enum UNW_FLAGS : uint
{
/// <summary>The function has no handler.</summary>
UNW_FLAG_NHANDLER = 0x0,
/// <summary>The function has an exception handler that should be called.</summary>
UNW_FLAG_EHANDLER = 0x1,
/// <summary>The function has a termination handler that should be called when unwinding an exception.</summary>
UNW_FLAG_UHANDLER = 0x2,
/// <summary>The FunctionEntry member is the contents of a previous function table entry.</summary>
UNW_FLAG_CHAININFO = 0x4,
/// <summary>Undocumented.</summary>
UNW_FLAG_NO_EPILOGUE = 0x80000000,
}
public delegate EXCEPTION_DISPOSITION EXCEPTION_ROUTINE(ref EXCEPTION_RECORD ExceptionRecord, IntPtr EstablisherFrame, ref CONTEXT ContextRecord, IntPtr DispatcherContext);
*/
/// <summary>The RtlZeroMemory routine fills a block of memory with zeros, given a pointer to the block and the length, in bytes, to be filled.</summary>
/// <param name="Destination">A pointer to the memory block to be filled with zeros.</param>
/// <param name="Length">The number of bytes to fill with zeros.</param>
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/wdm/nf-wdm-rtlzeromemory
[DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("WinNT.h")]
public static extern void RtlZeroMemory(IntPtr Destination, SizeT Length);
}
}

View File

@ -399,6 +399,48 @@ namespace Vanara.PInvoke
[PInvokeData("Winnls.h", MSDNShortId = "dd318063")]
public static extern int FoldString(STRING_MAPPING dwMapFlags, [In] string lpSrcStr, int cchSrc, [Out] StringBuilder lpDestStr, int cchDest);
/// <summary>
/// Deprecated. Retrieves character type information for the characters in the specified source string. For each character in the string, the function
/// sets one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, for example, letter,
/// digit, or neither.
/// </summary>
/// <param name="Locale">
/// <para>
/// Locale identifier that specifies the locale. You can use the <c>MAKELCID</c> macro to create a locale identifier or use one of the following
/// predefined values.
/// </para>
/// <para><c>Windows Vista and later:</c> The following custom locale identifiers are also supported.</para>
/// </param>
/// <param name="dwInfoType">
/// Flags specifying the character type information to retrieve. For possible flag values, see the dwInfoType parameter of <c>GetStringTypeW</c>. For
/// detailed information about the character type bits, see Remarks for <c>GetStringTypeW</c>.
/// </param>
/// <param name="lpSrcStr">
/// Pointer to the ANSI string for which to retrieve the character types. The string can be a double-byte character set (DBCS) string if the supplied
/// locale is appropriate for DBCS. The string is assumed to be null-terminated if cchSrc is set to any negative value.
/// </param>
/// <param name="cchSrc">
/// Size, in characters, of the string indicated by lpSrcStr. If the size includes a terminating null character, the function retrieves character type
/// information for that character. If the application sets the size to any negative integer, the source string is assumed to be null-terminated and the
/// function calculates the size automatically with an additional character for the null termination.
/// </param>
/// <param name="lpCharType">
/// Pointer to an array of 16-bit values. The length of this array must be large enough to receive one 16-bit value for each character in the source
/// string. If cchSrc is not a negative number, lpCharType should be an array of words with cchSrc elements. If cchSrc is set to a negative number,
/// lpCharType is an array of words with lpSrcStr + 1 elements. When the function returns, this array contains one word corresponding to each character
/// in the source string.
/// </param>
/// <returns>
/// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call <c>GetLastError</c>, which can
/// return one of the following error codes:
/// </returns>
// BOOL GetStringTypeA( _In_ LCID Locale, _In_ DWORD dwInfoType, _In_ LPCSTR lpSrcStr, _In_ int cchSrc, _Out_ LPWORD lpCharType);
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd318117(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)]
[PInvokeData("Winnls.h", MSDNShortId = "dd318117")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetStringTypeA(uint Locale, uint dwInfoType, string lpSrcStr, int cchSrc, out uint lpCharType);
/// <summary>
/// Retrieves character type information for the characters in the specified Unicode source string. For each character in the string, the function sets
/// one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, for example, letter, digit, or neither.
@ -451,7 +493,7 @@ namespace Vanara.PInvoke
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("Stringapiset.h", MSDNShortId = "dd318119")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetStringType(CHAR_TYPE_INFO dwInfoType, [In] string lpSrcStr, int cchSrc, out ushort lpCharType);
public static extern bool GetStringTypeW(CHAR_TYPE_INFO dwInfoType, [In] string lpSrcStr, int cchSrc, out ushort lpCharType);
/// <summary>
/// Retrieves character type information for the characters in the specified source string. For each character in the string, the function sets one or

File diff suppressed because one or more lines are too long

View File

@ -782,7 +782,7 @@ namespace Vanara.PInvoke
/// <para>If no streams can be found, the function fails and <c>GetLastError</c> returns <c>ERROR_HANDLE_EOF</c> (38).</para>
/// </returns>
// HANDLE WINAPI FindFirstStreamW( _In_ LPCWSTR lpFileName, _In_ STREAM_INFO_LEVELS InfoLevel, _Out_ LPVOID lpFindStreamData, _Reserved_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/aa364424(v=vs.85).aspx
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Unicode)]
[PInvokeData("WinBase.h", MSDNShortId = "aa364424")]
public static extern SafeSearchHandle FindFirstStream(string lpFileName, STREAM_INFO_LEVELS InfoLevel, [Out] IntPtr lpFindStreamData, [Optional] uint dwFlags);

View File

@ -101,7 +101,7 @@ namespace Vanara.InteropServices.Tests
h.Dispose();
Assert.That(h.IsClosed && h.IsInvalid);
h = LocalAlloc(LocalMemoryFlags.LPTR, (UIntPtr)5);
h = LocalAlloc(LMEM.LPTR, (UIntPtr)5);
Assert.That(!h.IsClosed && !h.IsInvalid);
Assert.That(h, Is.Not.EqualTo(SafeHGlobalHandle.Null));
h.Dispose();
@ -113,7 +113,7 @@ namespace Vanara.InteropServices.Tests
[Test()]
public void SafeLocalHandleTest1()
{
var h = new SafeLocalHandle(LocalAlloc(LocalMemoryFlags.LPTR, (UIntPtr)5), 5);
var h = new SafeLocalHandle(LocalAlloc(LMEM.LPTR, (UIntPtr)5), 5);
Assert.That(!h.IsClosed && !h.IsInvalid);
Assert.That(h.Size, Is.EqualTo(5));
h.Dispose();

View File

@ -143,7 +143,7 @@ namespace Vanara.PInvoke.Tests
{
using (var hLib = new SafeLibraryHandle(@"C:\Windows\System32\en-US\aclui.dll.mui", LoadLibraryExFlags.LOAD_LIBRARY_AS_IMAGE_RESOURCE))
{
var l = EnumResourceNames(hLib, ResourceType.RT_STRING);
var l = EnumResourceNamesEx(hLib, ResourceType.RT_STRING);
Assert.That(l.Count, Is.GreaterThan(0));
foreach (var resourceName in l)
{

View File

@ -77,6 +77,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.Windows.Shell", "Win
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.IpHlpApi", "PInvoke\IpHlpApi\Vanara.PInvoke.IpHlpApi.csproj", "{BBD8CE8D-31D2-4DFB-8D96-46825C09C7F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.BITS", "PInvoke\BITS\Vanara.PInvoke.BITS.csproj", "{EF53ED51-C141-4525-A6B7-41109EE5F416}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -200,6 +202,10 @@ Global
{BBD8CE8D-31D2-4DFB-8D96-46825C09C7F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBD8CE8D-31D2-4DFB-8D96-46825C09C7F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBD8CE8D-31D2-4DFB-8D96-46825C09C7F1}.Release|Any CPU.Build.0 = Release|Any CPU
{EF53ED51-C141-4525-A6B7-41109EE5F416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF53ED51-C141-4525-A6B7-41109EE5F416}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF53ED51-C141-4525-A6B7-41109EE5F416}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF53ED51-C141-4525-A6B7-41109EE5F416}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -228,6 +234,7 @@ Global
{BD86FD1B-D52E-4B78-89AC-36D89458EBD8} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{FC7B25B5-3BB9-44F5-93D9-9AB7193B1BE9} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{BBD8CE8D-31D2-4DFB-8D96-46825C09C7F1} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{EF53ED51-C141-4525-A6B7-41109EE5F416} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}

View File

@ -105,7 +105,7 @@ namespace Vanara.Resources
return buf;
}
public IList<SafeResourceId> GetResourceNames(SafeResourceId type) => EnumResourceNames(hLib, type);
public IList<SafeResourceId> GetResourceNames(SafeResourceId type) => EnumResourceNamesEx(hLib, type);
protected virtual Bitmap GetBitmap(SafeResourceId name, Size size)
{