Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than setupapi, prefix the name with the module name and a period.
<DllImport("setupapi.dll")> _
Public Shared Function SetupDiGetDeviceInstallParams(ByVal hDevinfo As Integer, _ 'Alternate ByVal hDevInfo as IntPtr
ByRef DeviceInfoData As SP_DEVINFO_DATA, _
ByRef DeviceInstallParams As SP_DEVINSTALL_PARAMS _
) As Boolean
End Function
[StructLayout(LayoutKind.Sequential)]
internal struct SP_DRVINFO_DATA
{
public Int32 cbSize;
public Int32 DriverType;
public UIntPtr Reserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
public String Description;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
public String MfgName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
public String ProviderName;
public System.Runtime.InteropServices.ComTypes.FILETIME DriverDate;
public Int64 DriverVersion;
};
[StructLayout(LayoutKind.Sequential)]
internal struct SP_DEVINSTALL_PARAMS
{
public Int32 cbSize;
public Int32 Flags;
public Int32 FlagsEx;
public IntPtr hwndParent;
public IntPtr InstallMsgHandler;
public IntPtr InstallMsgHandlerContext;
public IntPtr FileQueue;
public IntPtr ClassInstallReserved;
public int Reserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
public string DriverPath;
}
VB Signature:
<DllImport("setupapi.dll")> _
Public Shared Function SetupDiGetDeviceInstallParams(ByVal hDevinfo As Integer, _ 'Alternate ByVal hDevInfo as IntPtr
ByRef DeviceInfoData As SP_DEVINFO_DATA, _
ByRef DeviceInstallParams As SP_DEVINSTALL_PARAMS _
) As Boolean
End Function
User-Defined Types:
<StructLayout(LayoutKind.Sequential)> _
Public Structure SP_DEVINFO_DATA
Public cbSize As Integer
Public ClassGuid As Guid
Public DevInst As Integer
Public Reserved As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Public Structure SP_DEVINSTALL_PARAMS
Public cbSize As Integer
Public Flags As Integer
Public FlagsEx As Integer
Public hwndParent As IntPtr
Public InstallMsgHandler As IntPtr
Public InstallMsgHandlerContext As IntPtr
Public FileQueue As IntPtr
Public ClassInstallReserved As IntPtr
Public Reserved As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAX_PATH)> _
Public DriverPath As String
End Structure
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
' see if device needs reboot
Dim devParams As SP_DEVINSTALL_PARAMS
devParams.cbSize = Marshal.SizeOf(devParams)
If Win32.SetupDiGetDeviceInstallParams(hDevInfo, DeviceInfoData, devParams) Then
If (devParams.Flags And Win32.DI_NEEDRESTART) = Win32.DI_NEEDRESTART OrElse (devParams.Flags And Win32.DI_NEEDREBOOT) = Win32.DI_NEEDREBOOT Then
Return True
End If
Else
Return False
End If
The SetupDiGetDeviceInstallParams function retrieves device install parameters for a device information set or a particular device information element.
10/21/2015 10:10:10 AM - -198.135.207.175
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).