K
Kerem Gümrükcü
Hi,
i get a "Wrong Parameter" from Marshal.GetLastWin32Error() on using this:
[StructLayout(LayoutKind.Sequential)]
public class SP_DEVINFO_DATA
{
public int cbSize;
public Guid classGuid;
public int devInst;
public ulong reserved;
};
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
internal class SP_DRVINFO_DATA
{
public System.UInt32 cbSize;
public System.UInt32 DriverType;
public System.IntPtr Reserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String Description;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String MfgName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String ProviderName;
public System.Runtime.InteropServices.ComTypes.FILETIME
DriverDate;
public System.UInt64 DriverVersion;
}
[DllImport("setupapi.dll", CharSet = CharSet.Unicode, SetLastError =
true)]
private static extern bool SetupDiGetSelectedDriver
(
System.IntPtr DeviceInfoSet,
[In]ref SP_DEVINFO_DATA DeviceInfoData,
[Out]out SP_DRVINFO_DATA DriverInfoData
);
The "DeviceInfoSet" and "DeviceInfoData" of the Call are valid,
but something goes wrong while marshalling data between the
managed and unmanaged border. Something must be wrong
with my declarations,.....but what? I am certain, that it is some
stuff on the "SP_DRVINFO_DATA",...any ideas?
TIA,...
Regards
Kerem
--
i get a "Wrong Parameter" from Marshal.GetLastWin32Error() on using this:
[StructLayout(LayoutKind.Sequential)]
public class SP_DEVINFO_DATA
{
public int cbSize;
public Guid classGuid;
public int devInst;
public ulong reserved;
};
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
internal class SP_DRVINFO_DATA
{
public System.UInt32 cbSize;
public System.UInt32 DriverType;
public System.IntPtr Reserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String Description;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String MfgName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public System.String ProviderName;
public System.Runtime.InteropServices.ComTypes.FILETIME
DriverDate;
public System.UInt64 DriverVersion;
}
[DllImport("setupapi.dll", CharSet = CharSet.Unicode, SetLastError =
true)]
private static extern bool SetupDiGetSelectedDriver
(
System.IntPtr DeviceInfoSet,
[In]ref SP_DEVINFO_DATA DeviceInfoData,
[Out]out SP_DRVINFO_DATA DriverInfoData
);
The "DeviceInfoSet" and "DeviceInfoData" of the Call are valid,
but something goes wrong while marshalling data between the
managed and unmanaged border. Something must be wrong
with my declarations,.....but what? I am certain, that it is some
stuff on the "SP_DRVINFO_DATA",...any ideas?
TIA,...
Regards
Kerem
--