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

Enumerating WPD Devices #6

Open
rjm07270 opened this issue Feb 10, 2023 · 0 comments
Open

Enumerating WPD Devices #6

rjm07270 opened this issue Feb 10, 2023 · 0 comments

Comments

@rjm07270
Copy link

I believe there is an issue with how enumerating WPD Devices are done. I actually have a similar problem with my own program. That I put it on StackOverflow here https://stackoverflow.com/questions/75405142/net-clean-com-dependencie-dll-keeps-resetting-on-clean-in-visual-studio-2022. The problem is that when you get device ids is that you are getting back a string containing all the device ids and when you try and get a count of devices I believe you are getting a maximum of 1 device. If you want to fix it you can do the steps below.

Disassemble the PortableDeviceApi interop using the command -
ildasm Interop.PortableDeviceApiLib.dll /out:pdapi.il

Open the IL in Notepad and search for the following string

instance void GetDevices([in][out] string& marshal( lpwstr) 
pPnPDeviceIDs,

Replace all instances of the string above with the following string

instance void GetDevices([in][out] string[] marshal(lpwstr[]) 
pPnPDeviceIDs,

Save the IL and reassemble the interop using the command -
ilasm pdapi.il /dll /output=Interop.PortableDeviceApiLib.dll

The only problem will be that the Interop.PortableDeviceApiLib.dll will reset after clean. If one of your guys comes up with a solution plz let me know on StackOverflow or even right here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant