mirror of https://github.com/dahall/Vanara.git
Compare commits
4 Commits
831d40e2e5
...
a5d7e2b188
Author | SHA1 | Date |
---|---|---|
David Hall | a5d7e2b188 | |
David Hall | 0fd834c411 | |
David Hall | 4d17d7143e | |
David Hall | a0bf0b3164 |
|
@ -261,6 +261,9 @@ public abstract class MemoryMethodsBase : IMemoryMethods
|
|||
/// <seealso cref="SafeHandle"/>
|
||||
public abstract class SafeAllocatedMemoryHandleBase : SafeHandle, IComparable<SafeAllocatedMemoryHandleBase>, IEquatable<SafeAllocatedMemoryHandleBase>
|
||||
{
|
||||
/// <summary>Occurs when the handle has changed.</summary>
|
||||
public event EventHandler<IntPtr>? HandleChanged;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="SafeAllocatedMemoryHandleBase"/> class.</summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <param name="ownsHandle">if set to <c>true</c> if this class is responsible for freeing the memory on disposal.</param>
|
||||
|
@ -401,6 +404,14 @@ public abstract class SafeAllocatedMemoryHandleBase : SafeHandle, IComparable<Sa
|
|||
finally { Unlock(); }
|
||||
}
|
||||
|
||||
/// <summary>Sets the handle to the specified pre-existing handle.</summary>
|
||||
/// <param name="h">The pre-existing handle to use.</param>
|
||||
/// <remarks>
|
||||
/// Use the SetHandle method only if you need to support a pre-existing handle (for example, if the handle is returned in a structure)
|
||||
/// because the .NET Framework COM interop infrastructure does not support marshaling output handles in a structure.
|
||||
/// </remarks>
|
||||
new protected void SetHandle(IntPtr h) { base.SetHandle(h); HandleChanged?.Invoke(this, h); }
|
||||
|
||||
private class SafeBufferImpl : SafeBuffer
|
||||
{
|
||||
public SafeBufferImpl(SafeAllocatedMemoryHandleBase hMem) : base(false) => Initialize((ulong)hMem.Size);
|
||||
|
|
|
@ -250,7 +250,7 @@ public struct StrPtrAuto : IEquatable<string>, IEquatable<StrPtrAuto>, IEquatabl
|
|||
/// <returns>
|
||||
/// <see langword="true"/> if the value parameter is <see langword="null"/> or an empty string (""); otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
public bool IsNullOrEmpty => ptr == IntPtr.Zero || StringHelper.GetString(ptr, CharSet.Auto, 1) == string.Empty;
|
||||
public bool IsNullOrEmpty => ptr == IntPtr.Zero || Marshal.SystemDefaultCharSize == 2 ? Marshal.ReadInt16(ptr) == 0 : Marshal.ReadByte(ptr) == 0;
|
||||
|
||||
/// <summary>Performs an implicit conversion from <see cref="StrPtrAuto"/> to <see cref="string"/>.</summary>
|
||||
/// <param name="p">The <see cref="StrPtrAuto"/> instance.</param>
|
||||
|
|
|
@ -912,6 +912,24 @@ public static partial class NtDll
|
|||
|
||||
/// <summary>Reserved for internal use by the operating system.</summary>
|
||||
private readonly IntPtr Reserved3;
|
||||
|
||||
/// <summary>
|
||||
/// Contains the same value that GetExitCodeProcess returns. However the use of GetExitCodeProcess is preferable for clarity and
|
||||
/// safety. Cast to <see cref="NTStatus"/>.
|
||||
/// </summary>
|
||||
public readonly NTStatus ExitStatus => (NTStatus)Reserved1.ToInt32();
|
||||
|
||||
/// <summary>Points to a <see cref="PEB"/> structure.</summary>
|
||||
public readonly ref PEB Peb => ref PebBaseAddress.AsRef<PEB>();
|
||||
|
||||
/// <summary>Contains the same value that GetProcessAffinityMask returns for the lpProcessAffinityMask parameter.</summary>
|
||||
public readonly nuint AffinityMask => Reserved2_1.ToUIntPtr();
|
||||
|
||||
/// <summary>Contains the process priority as described in Scheduling Priorities.</summary>
|
||||
public readonly nint BasePriority => Reserved2_2;
|
||||
|
||||
/// <summary>Contains a unique identifier for the parent process.</summary>
|
||||
public readonly nuint InheritedFromUniqueProcessId => Reserved3.ToUIntPtr();
|
||||
}
|
||||
|
||||
/// <summary>Contains information for basic process information.</summary>
|
||||
|
@ -920,22 +938,22 @@ public static partial class NtDll
|
|||
public struct PROCESS_BASIC_INFORMATION_WOW64
|
||||
{
|
||||
/// <summary>Reserved for internal use by the operating system.</summary>
|
||||
private readonly long Reserved1;
|
||||
public long Reserved1;
|
||||
|
||||
/// <summary>Pointer to a PEB structure.</summary>
|
||||
public long PebBaseAddress;
|
||||
|
||||
/// <summary>Reserved for internal use by the operating system.</summary>
|
||||
private readonly long Reserved2_1;
|
||||
public long Reserved2_1;
|
||||
|
||||
/// <summary>Reserved for internal use by the operating system.</summary>
|
||||
private readonly long Reserved2_2;
|
||||
public long Reserved2_2;
|
||||
|
||||
/// <summary>System's unique identifier for this process.</summary>
|
||||
public long UniqueProcessId;
|
||||
|
||||
/// <summary>Reserved for internal use by the operating system.</summary>
|
||||
private readonly long Reserved3;
|
||||
public long Reserved3;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -789,7 +789,7 @@ public static partial class Shell32
|
|||
/// <remarks>If pszVerb is <c>NULL</c>, then the default verb is invoked on the selection.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-invokeverbonselection
|
||||
// HRESULT InvokeVerbOnSelection( LPCSTR pszVerb );
|
||||
void InvokeVerbOnSelection([In, MarshalAs(UnmanagedType.LPWStr)] string? pszVerb);
|
||||
void InvokeVerbOnSelection([In, MarshalAs(UnmanagedType.LPStr)] string? pszVerb);
|
||||
|
||||
/// <summary>Sets and applies the view mode and image size.</summary>
|
||||
/// <param name="uViewMode">
|
||||
|
|
Loading…
Reference in New Issue