Code cleanup and further nullability fixes

nullableenabled
David Hall 2023-09-20 09:00:33 -06:00
parent 540367b444
commit 34fd355ed2
19 changed files with 43 additions and 55 deletions

View File

@ -3034,7 +3034,7 @@ public static partial class Mpr
/// <para>The string can be MAX_PATH characters in length, and it must follow the network provider's naming conventions.</para> /// <para>The string can be MAX_PATH characters in length, and it must follow the network provider's naming conventions.</para>
/// </summary> /// </summary>
[MarshalAs(UnmanagedType.LPTStr, SizeConst = 260)] [MarshalAs(UnmanagedType.LPTStr, SizeConst = 260)]
public string? lpRemoteName; public string lpRemoteName;
/// <summary>A pointer to a NULL-terminated string that contains a comment supplied by the network provider.</summary> /// <summary>A pointer to a NULL-terminated string that contains a comment supplied by the network provider.</summary>
[MarshalAs(UnmanagedType.LPTStr, SizeConst = 1024)] [MarshalAs(UnmanagedType.LPTStr, SizeConst = 1024)]
@ -3051,7 +3051,7 @@ public static partial class Mpr
public static readonly NETRESOURCE Root = new(); public static readonly NETRESOURCE Root = new();
/// <summary>Initializes a new instance of the <see cref="NETRESOURCE"/> class.</summary> /// <summary>Initializes a new instance of the <see cref="NETRESOURCE"/> class.</summary>
public NETRESOURCE() { } public NETRESOURCE() => lpRemoteName = string.Empty;
/// <summary>Initializes a new instance of the <see cref="NETRESOURCE"/> class.</summary> /// <summary>Initializes a new instance of the <see cref="NETRESOURCE"/> class.</summary>
/// <param name="remoteName"> /// <param name="remoteName">

View File

@ -2636,7 +2636,7 @@ public static partial class NetApi32
public static IEnumerable<T> NetServerEnum<T>(NetServerEnumFilter netServerEnumFilter = NetServerEnumFilter.SV_TYPE_WORKSTATION | NetServerEnumFilter.SV_TYPE_SERVER, string? domain = null, int level = 0) where T : struct, INetServerInfo public static IEnumerable<T> NetServerEnum<T>(NetServerEnumFilter netServerEnumFilter = NetServerEnumFilter.SV_TYPE_WORKSTATION | NetServerEnumFilter.SV_TYPE_SERVER, string? domain = null, int level = 0) where T : struct, INetServerInfo
{ {
if (level == 0) level = GetLevelFromStructure<T>(); if (level == 0) level = GetLevelFromStructure<T>();
if (level != 100 && level != 101) if (level is not 100 and not 101)
throw new ArgumentOutOfRangeException(nameof(level), @"Only SERVER_INFO_100 or SERVER_INFO_101 are supported as valid structures."); throw new ArgumentOutOfRangeException(nameof(level), @"Only SERVER_INFO_100 or SERVER_INFO_101 are supported as valid structures.");
var resumeHandle = IntPtr.Zero; var resumeHandle = IntPtr.Zero;
NetServerEnum(null, (uint)level, out var bufptr, MAX_PREFERRED_LENGTH, out var entriesRead, out _, netServerEnumFilter, domain, resumeHandle).ThrowIfFailed(); NetServerEnum(null, (uint)level, out var bufptr, MAX_PREFERRED_LENGTH, out var entriesRead, out _, netServerEnumFilter, domain, resumeHandle).ThrowIfFailed();
@ -2659,7 +2659,7 @@ public static partial class NetApi32
public static T NetServerGetInfo<T>([Optional] string? serverName, int level = 0) where T : struct, INetServerInfo public static T NetServerGetInfo<T>([Optional] string? serverName, int level = 0) where T : struct, INetServerInfo
{ {
if (level == 0) level = GetLevelFromStructure<T>(); if (level == 0) level = GetLevelFromStructure<T>();
if (level != 100 && level != 101 && level != 102) if (level is not 100 and not 101 and not 102)
throw new ArgumentOutOfRangeException(nameof(level), @"Only SERVER_INFO_100, SERVER_INFO_101, or SERVER_INFO_102 are supported as valid structures."); throw new ArgumentOutOfRangeException(nameof(level), @"Only SERVER_INFO_100, SERVER_INFO_101, or SERVER_INFO_102 are supported as valid structures.");
NetServerGetInfo(serverName, level, out var ptr).ThrowIfFailed(); NetServerGetInfo(serverName, level, out var ptr).ThrowIfFailed();
return ptr.DangerousGetHandle().ToStructure<T>(); return ptr.DangerousGetHandle().ToStructure<T>();

View File

@ -1733,7 +1733,7 @@ public static partial class PowrProf
// PossibleSettingIndex, PUCHAR Buffer, LPDWORD BufferSize ); // PossibleSettingIndex, PUCHAR Buffer, LPDWORD BufferSize );
[DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("powrprof.h", MSDNShortId = "e803dc6b-706a-49fc-8c8d-ba9b0ccf8491")] [PInvokeData("powrprof.h", MSDNShortId = "e803dc6b-706a-49fc-8c8d-ba9b0ccf8491")]
public static extern Win32Error PowerReadPossibleDescription([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, uint PossibleSettingIndex, StringBuilder Buffer, ref uint BufferSize); public static extern Win32Error PowerReadPossibleDescription([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, uint PossibleSettingIndex, StringBuilder? Buffer, ref uint BufferSize);
/// <summary>Retrieves the friendly name for one of the possible choices of a power setting value.</summary> /// <summary>Retrieves the friendly name for one of the possible choices of a power setting value.</summary>
/// <param name="RootPowerKey">This parameter is reserved for future use and must be set to <c>NULL</c>.</param> /// <param name="RootPowerKey">This parameter is reserved for future use and must be set to <c>NULL</c>.</param>
@ -1806,7 +1806,7 @@ public static partial class PowrProf
// PossibleSettingIndex, PUCHAR Buffer, LPDWORD BufferSize ); // PossibleSettingIndex, PUCHAR Buffer, LPDWORD BufferSize );
[DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("powrprof.h", MSDNShortId = "38f3c5f4-ec65-47f0-b15c-36cd2b1e2813")] [PInvokeData("powrprof.h", MSDNShortId = "38f3c5f4-ec65-47f0-b15c-36cd2b1e2813")]
public static extern Win32Error PowerReadPossibleFriendlyName([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, uint PossibleSettingIndex, StringBuilder Buffer, ref uint BufferSize); public static extern Win32Error PowerReadPossibleFriendlyName([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, uint PossibleSettingIndex, StringBuilder? Buffer, ref uint BufferSize);
/// <summary>Retrieves the value for a possible value of a power setting.</summary> /// <summary>Retrieves the value for a possible value of a power setting.</summary>
/// <param name="RootPowerKey">This parameter is reserved for future use and must be set to <c>NULL</c>.</param> /// <param name="RootPowerKey">This parameter is reserved for future use and must be set to <c>NULL</c>.</param>
@ -2200,7 +2200,7 @@ public static partial class PowrProf
// *Buffer, LPDWORD BufferSize ); // *Buffer, LPDWORD BufferSize );
[DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("powrprof.h", MSDNShortId = "48ad80b7-f89a-4dad-a991-056ce41d6975")] [PInvokeData("powrprof.h", MSDNShortId = "48ad80b7-f89a-4dad-a991-056ce41d6975")]
public static extern Win32Error PowerReadValueUnitsSpecifier([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, StringBuilder Buffer, ref uint BufferSize); public static extern Win32Error PowerReadValueUnitsSpecifier([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, StringBuilder? Buffer, ref uint BufferSize);
/// <summary>Deletes the specified power setting.</summary> /// <summary>Deletes the specified power setting.</summary>
/// <param name="PowerSettingSubKeyGuid"> /// <param name="PowerSettingSubKeyGuid">
@ -3366,7 +3366,7 @@ public static partial class PowrProf
// *Buffer, DWORD BufferSize ); // *Buffer, DWORD BufferSize );
[DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [DllImport(Lib.PowrProf, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("powrprof.h", MSDNShortId = "d9a81077-23e8-4bae-8e70-ffaaaf1ecda3")] [PInvokeData("powrprof.h", MSDNShortId = "d9a81077-23e8-4bae-8e70-ffaaaf1ecda3")]
public static extern Win32Error PowerWriteValueUnitsSpecifier([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, string Buffer, uint BufferSize); public static extern Win32Error PowerWriteValueUnitsSpecifier([Optional] HKEY RootPowerKey, in Guid SubGroupOfPowerSettingsGuid, in Guid PowerSettingGuid, string? Buffer, uint BufferSize);
/// <summary> /// <summary>
/// <para> /// <para>

View File

@ -1,4 +1,5 @@
using System.Linq; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.AccessControl; using System.Security.AccessControl;
using static Vanara.PInvoke.Kernel32; using static Vanara.PInvoke.Kernel32;
@ -1386,7 +1387,7 @@ public static partial class AdvApi32
[PInvokeData("winbase.h", MSDNShortId = "dcfdcd5b-0269-4081-b1db-e272171c27a2")] [PInvokeData("winbase.h", MSDNShortId = "dcfdcd5b-0269-4081-b1db-e272171c27a2")]
public static bool CreateProcessWithLogonW(string lpUsername, [Optional] string? lpDomain, string lpPassword, ProcessLogonFlags dwLogonFlags, public static bool CreateProcessWithLogonW(string lpUsername, [Optional] string? lpDomain, string lpPassword, ProcessLogonFlags dwLogonFlags,
[Optional] string? lpApplicationName, [Optional] StringBuilder? lpCommandLine, CREATE_PROCESS dwCreationFlags, [Optional] string? lpApplicationName, [Optional] StringBuilder? lpCommandLine, CREATE_PROCESS dwCreationFlags,
[Optional] string[]? lpEnvironment, [Optional] string? lpCurrentDirectory, in STARTUPINFO lpStartupInfo, out SafePROCESS_INFORMATION? lpProcessInformation) [Optional] string[]? lpEnvironment, [Optional] string? lpCurrentDirectory, in STARTUPINFO lpStartupInfo, [NotNullWhen(true)] out SafePROCESS_INFORMATION? lpProcessInformation)
{ {
var ret = CreateProcessWithLogonW(lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, out PROCESS_INFORMATION pi); var ret = CreateProcessWithLogonW(lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, out PROCESS_INFORMATION pi);
lpProcessInformation = ret ? new SafePROCESS_INFORMATION(pi) : null; lpProcessInformation = ret ? new SafePROCESS_INFORMATION(pi) : null;

View File

@ -3201,6 +3201,10 @@ public static partial class SetupAPI
Value = mem.ToStringEnum(CharSet.Unicode).ToArray(); Value = mem.ToStringEnum(CharSet.Unicode).ToArray();
break; break;
case DEVPROPTYPE.DEVPROP_TYPE_BOOLEAN:
Value = mem.ToStructure<byte>() != 0;
break;
default: default:
(DEVPROPTYPE type, DEVPROPTYPE mod) spt = propType.Split(); (DEVPROPTYPE type, DEVPROPTYPE mod) spt = propType.Split();
var type = convType ?? CorrespondingTypeAttribute.GetCorrespondingTypes(spt.type).FirstOrDefault(); var type = convType ?? CorrespondingTypeAttribute.GetCorrespondingTypes(spt.type).FirstOrDefault();

View File

@ -1427,15 +1427,15 @@ public static partial class SetupAPI
public enum SPDRP public enum SPDRP
{ {
/// <summary>The function retrieves the device's address.</summary> /// <summary>The function retrieves the device's address.</summary>
[CorrespondingType(typeof(uint))] [CorrespondingType(typeof(uint), CorrespondingAction.Get)]
SPDRP_ADDRESS = 0x0000001C, SPDRP_ADDRESS = 0x0000001C,
/// <summary>The function retrieves the device's bus number.</summary> /// <summary>The function retrieves the device's bus number.</summary>
[CorrespondingType(typeof(uint))] [CorrespondingType(typeof(uint), CorrespondingAction.Get)]
SPDRP_BUSNUMBER = 0x00000015, SPDRP_BUSNUMBER = 0x00000015,
/// <summary>The function retrieves the GUID for the device's bus type.</summary> /// <summary>The function retrieves the GUID for the device's bus type.</summary>
[CorrespondingType(typeof(Guid))] [CorrespondingType(typeof(Guid), CorrespondingAction.Get)]
SPDRP_BUSTYPEGUID = 0x00000013, SPDRP_BUSTYPEGUID = 0x00000013,
/// <summary> /// <summary>
@ -1489,7 +1489,7 @@ public static partial class SetupAPI
/// </item> /// </item>
/// </list> /// </list>
/// </summary> /// </summary>
[CorrespondingType(typeof(CM_DEVCAP))] [CorrespondingType(typeof(CM_DEVCAP), CorrespondingAction.Get)]
SPDRP_CAPABILITIES = 0x0000000F, SPDRP_CAPABILITIES = 0x0000000F,
/// <summary> /// <summary>
@ -1500,7 +1500,7 @@ public static partial class SetupAPI
SPDRP_CHARACTERISTICS = 0x0000001B, SPDRP_CHARACTERISTICS = 0x0000001B,
/// <summary>The function retrieves a REG_SZ string that contains the device setup class of a device.</summary> /// <summary>The function retrieves a REG_SZ string that contains the device setup class of a device.</summary>
[CorrespondingType(typeof(string))] [CorrespondingType(typeof(string), CorrespondingAction.Get)]
SPDRP_CLASS = 0x00000007, SPDRP_CLASS = 0x00000007,
/// <summary>The function retrieves a REG_SZ string that contains the GUID that represents the device setup class of a device.</summary> /// <summary>The function retrieves a REG_SZ string that contains the GUID that represents the device setup class of a device.</summary>
@ -1525,7 +1525,7 @@ public static partial class SetupAPI
/// <summary> /// <summary>
/// (Windows XP and later) The function retrieves a CM_POWER_DATA structure that contains the device's power management information. /// (Windows XP and later) The function retrieves a CM_POWER_DATA structure that contains the device's power management information.
/// </summary> /// </summary>
[CorrespondingType(typeof(CM_POWER_DATA))] [CorrespondingType(typeof(CM_POWER_DATA), CorrespondingAction.Get)]
SPDRP_DEVICE_POWER_DATA = 0x0000001E, SPDRP_DEVICE_POWER_DATA = 0x0000001E,
/// <summary>The function retrieves a REG_SZ string that contains the description of a device.</summary> /// <summary>The function retrieves a REG_SZ string that contains the description of a device.</summary>
@ -1546,7 +1546,7 @@ public static partial class SetupAPI
SPDRP_DRIVER = 0x00000009, SPDRP_DRIVER = 0x00000009,
/// <summary>The function retrieves a REG_SZ string that contains the name of the device's enumerator.</summary> /// <summary>The function retrieves a REG_SZ string that contains the name of the device's enumerator.</summary>
[CorrespondingType(typeof(string))] [CorrespondingType(typeof(string), CorrespondingAction.Get)]
SPDRP_ENUMERATOR_NAME = 0x00000016, SPDRP_ENUMERATOR_NAME = 0x00000016,
/// <summary> /// <summary>
@ -1573,11 +1573,11 @@ public static partial class SetupAPI
/// installation state is represented by one of the CM_INSTALL_STATE_Xxx values that are defined in Cfgmgr32.h. The /// installation state is represented by one of the CM_INSTALL_STATE_Xxx values that are defined in Cfgmgr32.h. The
/// CM_INSTALL_STATE_Xxx values correspond to the DEVICE_INSTALL_STATE enumeration values. /// CM_INSTALL_STATE_Xxx values correspond to the DEVICE_INSTALL_STATE enumeration values.
/// </summary> /// </summary>
[CorrespondingType(typeof(CM_INSTALL_STATE))] [CorrespondingType(typeof(CM_INSTALL_STATE), CorrespondingAction.Get)]
SPDRP_INSTALL_STATE = 0x00000022, SPDRP_INSTALL_STATE = 0x00000022,
/// <summary>The function retrieves the device's legacy bus type as an INTERFACE_TYPE value (defined in Wdm.h and Ntddk.h).</summary> /// <summary>The function retrieves the device's legacy bus type as an INTERFACE_TYPE value (defined in Wdm.h and Ntddk.h).</summary>
[CorrespondingType(typeof(INTERFACE_TYPE))] [CorrespondingType(typeof(INTERFACE_TYPE), CorrespondingAction.Get)]
SPDRP_LEGACYBUSTYPE = 0x00000014, SPDRP_LEGACYBUSTYPE = 0x00000014,
/// <summary>The function retrieves a REG_SZ string that contains the hardware location of a device.</summary> /// <summary>The function retrieves a REG_SZ string that contains the hardware location of a device.</summary>
@ -1588,8 +1588,8 @@ public static partial class SetupAPI
/// (Windows Server 2003 and later) The function retrieves a REG_MULTI_SZ string that represents the location of the device in /// (Windows Server 2003 and later) The function retrieves a REG_MULTI_SZ string that represents the location of the device in
/// the device tree. /// the device tree.
/// </summary> /// </summary>
[CorrespondingType(typeof(System.Collections.Generic.IEnumerable<string>))] [CorrespondingType(typeof(System.Collections.Generic.IEnumerable<string>), CorrespondingAction.Get)]
[CorrespondingType(typeof(string[]))] [CorrespondingType(typeof(string[]), CorrespondingAction.Get)]
SPDRP_LOCATION_PATHS = 0x00000023, SPDRP_LOCATION_PATHS = 0x00000023,
/// <summary>The function retrieves a REG_MULTI_SZ string that contains the names of a device's lower-filter drivers.</summary> /// <summary>The function retrieves a REG_MULTI_SZ string that contains the names of a device's lower-filter drivers.</summary>
@ -1605,21 +1605,21 @@ public static partial class SetupAPI
/// The function retrieves a REG_SZ string that contains the name that is associated with the device's PDO. For more /// The function retrieves a REG_SZ string that contains the name that is associated with the device's PDO. For more
/// information, see IoCreateDevice. /// information, see IoCreateDevice.
/// </summary> /// </summary>
[CorrespondingType(typeof(string))] [CorrespondingType(typeof(string), CorrespondingAction.Get)]
SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000E, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000E,
/// <summary> /// <summary>
/// (Windows XP and later) The function retrieves the device's current removal policy as a DWORD that contains one of the /// (Windows XP and later) The function retrieves the device's current removal policy as a DWORD that contains one of the
/// CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h. /// CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.
/// </summary> /// </summary>
[CorrespondingType(typeof(CM_REMOVAL_POLICY))] [CorrespondingType(typeof(CM_REMOVAL_POLICY), CorrespondingAction.Get)]
SPDRP_REMOVAL_POLICY = 0x0000001F, SPDRP_REMOVAL_POLICY = 0x0000001F,
/// <summary> /// <summary>
/// (Windows XP and later) The function retrieves the device's hardware-specified default removal policy as a DWORD that /// (Windows XP and later) The function retrieves the device's hardware-specified default removal policy as a DWORD that
/// contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h. /// contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.
/// </summary> /// </summary>
[CorrespondingType(typeof(CM_REMOVAL_POLICY))] [CorrespondingType(typeof(CM_REMOVAL_POLICY), CorrespondingAction.Get)]
SPDRP_REMOVAL_POLICY_HW_DEFAULT = 0x00000020, SPDRP_REMOVAL_POLICY_HW_DEFAULT = 0x00000020,
/// <summary> /// <summary>
@ -1638,7 +1638,7 @@ public static partial class SetupAPI
/// descriptor strings, see Security Descriptor Definition Language (Windows). For information about the format of security /// descriptor strings, see Security Descriptor Definition Language (Windows). For information about the format of security
/// descriptor strings, see Security Descriptor Definition Language (Windows). /// descriptor strings, see Security Descriptor Definition Language (Windows).
/// </summary> /// </summary>
[CorrespondingType(typeof(string))] [CorrespondingType(typeof(string), CorrespondingAction.Set)]
SPDRP_SECURITY_SDS = 0x00000018, SPDRP_SECURITY_SDS = 0x00000018,
/// <summary>The function retrieves a REG_SZ string that contains the service name for a device.</summary> /// <summary>The function retrieves a REG_SZ string that contains the service name for a device.</summary>
@ -1648,7 +1648,7 @@ public static partial class SetupAPI
/// <summary> /// <summary>
/// The function retrieves a DWORD value set to the value of the <c>UINumber</c> member of the device's DEVICE_CAPABILITIES structure. /// The function retrieves a DWORD value set to the value of the <c>UINumber</c> member of the device's DEVICE_CAPABILITIES structure.
/// </summary> /// </summary>
[CorrespondingType(typeof(uint))] [CorrespondingType(typeof(uint), CorrespondingAction.Get)]
SPDRP_UI_NUMBER = 0x00000010, SPDRP_UI_NUMBER = 0x00000010,
/// <summary>The function retrieves a format string (REG_SZ) used to display the <c>UINumber</c> value.</summary> /// <summary>The function retrieves a format string (REG_SZ) used to display the <c>UINumber</c> value.</summary>
@ -1661,7 +1661,7 @@ public static partial class SetupAPI
SPDRP_UPPERFILTERS = 0x00000011, SPDRP_UPPERFILTERS = 0x00000011,
/// <summary>Base ContainerID (R)</summary> /// <summary>Base ContainerID (R)</summary>
[CorrespondingType(typeof(Guid))] [CorrespondingType(typeof(Guid), CorrespondingAction.Get)]
SPDRP_BASE_CONTAINERID = 0x00000024, SPDRP_BASE_CONTAINERID = 0x00000024,
} }

View File

@ -3,7 +3,7 @@
public static partial class ShlwApi public static partial class ShlwApi
{ {
/// <summary>CLSID_QueryAssociations</summary> /// <summary>CLSID_QueryAssociations</summary>
public static readonly Guid CLSID_QueryAssociations = new Guid("a07034fd-6caa-4954-ac3f-97a27216f98a"); public static readonly Guid CLSID_QueryAssociations = new("a07034fd-6caa-4954-ac3f-97a27216f98a");
/// <summary>Provides information to the <c>IQueryAssociations</c> interface methods.</summary> /// <summary>Provides information to the <c>IQueryAssociations</c> interface methods.</summary>
// typedef enum { ASSOCF_NONE = 0x00000000, ASSOCF_INIT_NOREMAPCLSID = 0x00000001, ASSOCF_INIT_BYEXENAME = 0x00000002, // typedef enum { ASSOCF_NONE = 0x00000000, ASSOCF_INIT_NOREMAPCLSID = 0x00000001, ASSOCF_INIT_BYEXENAME = 0x00000002,

View File

@ -1,8 +1,5 @@
using System; using System.Security.AccessControl;
using System.Security.AccessControl;
using System.Security.Principal; using System.Security.Principal;
using Vanara.Extensions;
using Vanara.InteropServices;
using Vanara.PInvoke; using Vanara.PInvoke;
using static Vanara.PInvoke.AdvApi32; using static Vanara.PInvoke.AdvApi32;

View File

@ -1,6 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using static Vanara.PInvoke.Authz; using static Vanara.PInvoke.Authz;

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;

View File

@ -1,4 +1,3 @@
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;

View File

@ -1,10 +1,8 @@
using System; using System.Collections;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Principal; using System.Security.Principal;
using Vanara.Extensions;
using Vanara.PInvoke; using Vanara.PInvoke;
using static Vanara.PInvoke.AdvApi32; using static Vanara.PInvoke.AdvApi32;

View File

@ -1,7 +1,5 @@
using System; using static Vanara.PInvoke.AdvApi32;
using static Vanara.PInvoke.AdvApi32;
using Vanara.PInvoke; using Vanara.PInvoke;
using System.Runtime.InteropServices;
using System.Security.AccessControl; using System.Security.AccessControl;
namespace Vanara.Extensions; namespace Vanara.Extensions;

View File

@ -1,5 +1,4 @@
using System; using System.Security.Principal;
using System.Security.Principal;
namespace Vanara.Security; namespace Vanara.Security;

View File

@ -1,5 +1,4 @@
using System; using System.Linq;
using System.Linq;
using System.DirectoryServices.ActiveDirectory; using System.DirectoryServices.ActiveDirectory;
using Vanara.Extensions.Reflection; using Vanara.Extensions.Reflection;
using static Vanara.PInvoke.NTDSApi; using static Vanara.PInvoke.NTDSApi;

View File

@ -1,8 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Security.AccessControl; using System.Security.AccessControl;
using System.Security.Principal; using System.Security.Principal;
using Vanara.Extensions;
using Vanara.PInvoke; using Vanara.PInvoke;
using static Vanara.PInvoke.AdvApi32; using static Vanara.PInvoke.AdvApi32;

View File

@ -1,4 +1,3 @@
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Security.Principal; using System.Security.Principal;
using static Vanara.PInvoke.AdvApi32; using static Vanara.PInvoke.AdvApi32;
@ -36,7 +35,7 @@ public class WindowsLoggedInIdentity : IDisposable, IIdentity
/// The logon provider. This parameter can usually be left as the default. For more information, lookup more detail for the /// The logon provider. This parameter can usually be left as the default. For more information, lookup more detail for the
/// dwLogonProvider parameter of the Windows LogonUser function. /// dwLogonProvider parameter of the Windows LogonUser function.
/// </param> /// </param>
public WindowsLoggedInIdentity(string userName, string domainName, string password, LogonUserType logonType = LogonUserType.LOGON32_LOGON_INTERACTIVE, public WindowsLoggedInIdentity(string userName, string? domainName, string password, LogonUserType logonType = LogonUserType.LOGON32_LOGON_INTERACTIVE,
LogonUserProvider provider = LogonUserProvider.LOGON32_PROVIDER_DEFAULT) LogonUserProvider provider = LogonUserProvider.LOGON32_PROVIDER_DEFAULT)
{ {
if (string.IsNullOrEmpty(userName)) throw new ArgumentNullException(nameof(userName)); if (string.IsNullOrEmpty(userName)) throw new ArgumentNullException(nameof(userName));

View File

@ -1,4 +1,3 @@
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Security.Principal; using System.Security.Principal;

View File

@ -74,7 +74,7 @@ public class WinHTTPTests
Assert.That(WinHttpCreateProxyResolver(hSession, out SafeHINTERNET hResolver), ResultIs.Successful); Assert.That(WinHttpCreateProxyResolver(hSession, out SafeHINTERNET hResolver), ResultIs.Successful);
using System.Threading.ManualResetEvent evt = new System.Threading.ManualResetEvent(false); using System.Threading.ManualResetEvent evt = new(false);
Win32Error cbErr = Win32Error.ERROR_SUCCESS; Win32Error cbErr = Win32Error.ERROR_SUCCESS;
IntPtr prevCb = WinHttpSetStatusCallback(hResolver, callback, WINHTTP_CALLBACK_FLAG.WINHTTP_CALLBACK_FLAG_REQUEST_ERROR | WINHTTP_CALLBACK_FLAG.WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE); IntPtr prevCb = WinHttpSetStatusCallback(hResolver, callback, WINHTTP_CALLBACK_FLAG.WINHTTP_CALLBACK_FLAG_REQUEST_ERROR | WINHTTP_CALLBACK_FLAG.WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE);
Assert.That(prevCb, Is.Not.EqualTo(WINHTTP_INVALID_STATUS_CALLBACK)); Assert.That(prevCb, Is.Not.EqualTo(WINHTTP_INVALID_STATUS_CALLBACK));