Added SizeT structure to mimic SIZE_T and updated library strings

pull/10/head
David Hall 2018-05-13 21:39:36 -06:00
parent 6cfe71d378
commit adf84f144e
3 changed files with 39 additions and 1 deletions

View File

@ -25,6 +25,8 @@
public const string Kernel32 = "kernel32.dll";
/// <summary>The net api32</summary>
public const string NetApi32 = "netapi32.dll";
/// <summary>The normaliz</summary>
public const string Normaliz = "normaliz.dll";
/// <summary>The nt DLL</summary>
public const string NTDll= "ntdll.dll";
/// <summary>The NTDS API</summary>
@ -45,6 +47,8 @@
public const string User32 = "user32.dll";
/// <summary>The ux theme</summary>
public const string UxTheme = "uxtheme.dll";
/// <summary>The vertdll</summary>
public const string VertDll = "vertdll.dll";
/// <summary>The virt disk</summary>
public const string VirtDisk = "virtdisk.dll";
/// <summary>The win inet</summary>

34
PInvoke/Shared/SizeT.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
/// <summary>Managed instance of the SIZE_T type.</summary>
[StructLayout(LayoutKind.Sequential)]
public struct SizeT
{
private UIntPtr val;
/// <summary>Initializes a new instance of the <see cref="SizeT"/> struct.</summary>
/// <param name="value">The value.</param>
public SizeT(uint value) { val = (UIntPtr)value; }
/// <summary>Initializes a new instance of the <see cref="SizeT"/> struct.</summary>
/// <param name="value">The value.</param>
public SizeT(ulong value) { val = new UIntPtr(value); }
/// <summary>Gets the value.</summary>
/// <value>The value.</value>
public ulong Value => val.ToUInt64();
/// <summary>Performs an implicit conversion from <see cref="System.UInt32"/> to <see cref="SizeT"/>.</summary>
/// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator SizeT(uint value) => new SizeT(value);
/// <summary>Performs an implicit conversion from <see cref="System.UInt64"/> to <see cref="SizeT"/>.</summary>
/// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator SizeT(ulong value) => new SizeT(value);
}
}

View File

@ -2,7 +2,7 @@
namespace Vanara.PInvoke
{
/// <summary>Processor architecture</summary>
public enum ProcessorArchitecture
public enum ProcessorArchitecture : ushort
{
/// <summary>x86</summary>
PROCESSOR_ARCHITECTURE_INTEL = 0,