Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1"/>
<PackageReference Include="NUnit" Version="4.5.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.1.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.12.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0"/>
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.13.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="8.0.1">
<PackageReference Include="coverlet.collector" Version="10.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions src/Generator/DeviceManagementPropertiesGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.213">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.279">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="65.0.8-preview" />
<PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="70.0.11-preview" />
<PackageReference Include="Microsoft.Windows.WDK.Win32Metadata" Version="0.13.25-experimental" />
Comment thread
nefarius marked this conversation as resolved.
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Nefarius.Utilities.DeviceManagement.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.213">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.279">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="65.0.8-preview">
<PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="70.0.11-preview">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Comment thread
nefarius marked this conversation as resolved.
<PackageReference Include="Microsoft.Windows.WDK.Win32Metadata" Version="0.13.25-experimental">
Expand All @@ -47,7 +47,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.201" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.300" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/PnP/Devcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,13 @@
public static unsafe bool Update(string hardwareId, string fullInfPath,
out bool rebootRequired)
{
BOOL reboot = false;

BOOL ret = PInvoke.UpdateDriverForPlugAndPlayDevices(
HWND.Null,
hardwareId,
fullInfPath,
UPDATEDRIVERFORPLUGANDPLAYDEVICES_FLAGS.INSTALLFLAG_FORCE |
UPDATEDRIVERFORPLUGANDPLAYDEVICES_FLAGS.INSTALLFLAG_NONINTERACTIVE,
&reboot
out BOOL reboot
);

rebootRequired = reboot > 0;
Expand All @@ -543,7 +541,7 @@
/// <param name="oemInfName">The OEM INF name (name and extension only).</param>
/// <param name="fullInfPath">The fully qualified absolute path to the INF to remove from the driver store.</param>
/// <param name="forceDelete">Remove the driver store copy, if true.</param>
public static void DeleteDriver(string oemInfName, string fullInfPath = default, bool forceDelete = false)

Check warning on line 544 in src/PnP/Devcon.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
{
if (string.IsNullOrEmpty(oemInfName))
{
Expand Down
30 changes: 15 additions & 15 deletions src/PnP/DeviceClassFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ private static unsafe void AddFiltersEntry(Guid classGuid, string filter, string
WIN32_ERROR status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
out type,
null,
&sizeRequired
ref sizeRequired
);

// value exists
Expand All @@ -187,9 +187,9 @@ private static unsafe void AddFiltersEntry(Guid classGuid, string filter, string
status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
buffer,
&sizeRequired
out type,
new Span<byte>(buffer, (int)sizeRequired),
ref sizeRequired
);

if (status != WIN32_ERROR.ERROR_SUCCESS)
Expand Down Expand Up @@ -268,9 +268,9 @@ private static unsafe void RemoveFiltersEntry(Guid classGuid, string filter, str
WIN32_ERROR status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
out type,
null,
&sizeRequired
ref sizeRequired
);

// value exists
Expand All @@ -281,9 +281,9 @@ private static unsafe void RemoveFiltersEntry(Guid classGuid, string filter, str
status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
buffer,
&sizeRequired
out type,
new Span<byte>(buffer, (int)sizeRequired),
ref sizeRequired
);

if (status != WIN32_ERROR.ERROR_SUCCESS)
Expand Down Expand Up @@ -341,9 +341,9 @@ private static unsafe void RemoveFiltersEntry(Guid classGuid, string filter, str
WIN32_ERROR status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
out type,
null,
&sizeRequired
ref sizeRequired
);

switch (status)
Expand All @@ -356,9 +356,9 @@ private static unsafe void RemoveFiltersEntry(Guid classGuid, string filter, str
status = PInvoke.RegQueryValueEx(
key,
filter,
&type,
buffer,
&sizeRequired
out type,
new Span<byte>(buffer, (int)sizeRequired),
ref sizeRequired
);

if (status != WIN32_ERROR.ERROR_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion src/PnP/PnPDevice.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ out uint valueBufferSize
_instanceHandle,
propertyKey,
out propertyType,
(byte*)valueBuffer.ToPointer(),
new Span<byte>((byte*)valueBuffer.ToPointer(), (int)valueBufferSize),
ref valueBufferSize,
0
);
Expand Down
2 changes: 1 addition & 1 deletion src/PnP/PnPDevice.Static.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static PnPDevice GetDeviceByInstanceId(string instanceId,
symbolicLink,
property,
out _,
(byte*)buffer,
new Span<byte>((byte*)buffer, (int)sizeRequired),
ref sizeRequired,
0
);
Expand Down
7 changes: 2 additions & 5 deletions src/PnP/UsbPnPDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
internal UsbPnPDevice(string instanceId, DeviceLocationFlags flags) : base(instanceId, flags)
{
string enumerator = GetProperty<string>(DevicePropertyKey.Device_EnumeratorName);

Check warning on line 26 in src/PnP/UsbPnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

if (!Equals(enumerator, "USB"))
{
Expand All @@ -50,8 +50,8 @@
// find root hub
while (hubDevice is not null)
{
string parentId = hubDevice.GetProperty<string>(DevicePropertyKey.Device_Parent);

Check warning on line 53 in src/PnP/UsbPnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
string service = hubDevice.GetProperty<string>(DevicePropertyKey.Device_Service);

Check warning on line 54 in src/PnP/UsbPnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

if (service is not null)
// we have reached the hub object, bail
Expand All @@ -66,7 +66,7 @@
compositeDevice = hubDevice;

// get next parent
hubDevice = GetDeviceByInstanceId(parentId, DeviceLocationFlags.Phantom).ToUsbPnPDevice();

Check warning on line 69 in src/PnP/UsbPnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'instanceId' in 'PnPDevice PnPDevice.GetDeviceByInstanceId(string instanceId, DeviceLocationFlags flags = DeviceLocationFlags.Normal)'.
}

if (hubDevice is null)
Expand Down Expand Up @@ -131,11 +131,8 @@
BOOL success = PInvoke.DeviceIoControl(
hubHandle,
PInvoke.IOCTL_USB_HUB_CYCLE_PORT,
&parameters,
(uint)size,
&parameters,
(uint)size,
null,
new ReadOnlySpan<byte>((byte*)&parameters, size),
new Span<byte>((byte*)&parameters, size),
null
);

Expand Down
Loading