Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Fix parameter propagation in helper method #127

Merged
merged 1 commit into from
Jan 1, 2016
Merged
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
16 changes: 8 additions & 8 deletions src/SetupApi.Desktop/SetupApi.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ public static IEnumerable<DeviceInterfaceData> SetupDiEnumDeviceInterfaces(
}

public static string SetupDiGetDeviceInterfaceDetail(
SafeDeviceInfoSetHandle lpDeviceInfoSet,
DeviceInterfaceData oInterfaceData,
IntPtr lpDeviceInfoData)
SafeDeviceInfoSetHandle deviceInfoSet,
DeviceInterfaceData interfaceData,
DeviceInfoData deviceInfoData)
{
var requiredSize = new NullableUInt32();

// First call to get the size to allocate
SetupDiGetDeviceInterfaceDetail(
lpDeviceInfoSet,
ref oInterfaceData,
deviceInfoSet,
ref interfaceData,
IntPtr.Zero,
0,
requiredSize,
null);
deviceInfoData);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this argument was missing only from the first call (the "how big should the buffer be?" call). So perhaps that's by design?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it seems missing from both calls. So this seems like the right fix.


// As we passed an empty buffer we know that the function will fail, not need to check the result.
var lastError = GetLastError();
Expand All @@ -109,8 +109,8 @@ public static string SetupDiGetDeviceInterfaceDetail(

// Second call to get the value
var success = SetupDiGetDeviceInterfaceDetail(
lpDeviceInfoSet,
ref oInterfaceData,
deviceInfoSet,
ref interfaceData,
buffer,
(int)requiredSize.Value,
null,
Expand Down