does anyone know why i get the error “DirectCast(err, SetupApiError) = InWow64 {-536870347}” when running the code below? i get this error when it calls the SetupDiCallClassInstaller method on the line: Case SetupApiError.NoAssociatedClass To SetupApiError.OnlyValidateViaAuthenticode
Throw New Win32Exception("SetupAPI error: " & DirectCast(err, SetupApiError).ToString)
Dim result As Boolean = SetupDiSetClassInstallParams(handle, diData, params, Marshal.SizeOf(params))
If result = False Then Throw New Win32Exception
result = SetupDiCallClassInstaller(DiFunction.PropertyChange, handle, diData)
If result = False Then
Dim err As Integer = Marshal.GetLastWin32Error
Select Case err
Case Is = SetupApiError.NotDisableable
Throw New ArgumentException("That device can't be disabled! Look in the device manager!")
Case SetupApiError.NoAssociatedClass To SetupApiError.OnlyValidateViaAuthenticode
Throw New Win32Exception("SetupAPI error: " & DirectCast(err, SetupApiError).ToString)
Case Else
Throw New Win32Exception
End Select
End If
It is unhappy that you are calling SetupDiCallClassInstaller() from a 32-bit process running on the 64-bit version of Windows. That’s easy to fix in a managed program. Right-click your EXE project, Properties, Compile tab, scroll down, Advanced Compile Options button. Change the Target CPU setting from x86 to AnyCPU.