geersch / wpd Goto Github PK
View Code? Open in Web Editor NEWA 5-part series tutorial on how to use the Windows Portable Devices (WDP) API in C#. Written between 2011-05-22 and 2012-04-17.
A 5-part series tutorial on how to use the Windows Portable Devices (WDP) API in C#. Written between 2011-05-22 and 2012-04-17.
Hi - firstly thank you for this great tutorial.
I wanted to tell you that the code is not working anymore after a troublesome windows update
http://forum.notebookreview.com/threads/microsoft-released-a-bad-update-that-broke-mtp-in-windows.802593/
even though windows fixed the issue and we are able to see the device and the SD card connected via usb to the laptop - we are not able to access it anymore. In case you are supporting the code.
Kind regards
It seems the program doesn't work when multiple devices are connected.
In part 1, this line this._deviceManager.GetDevices(ref deviceIds[0], ref count);
only gives the first device ID. I'm trying to change it, but it seems the GetDevices method only accepts one string as deviceId and only returns one.
On an Iphone 6, this code fails in wrapobject getting name not found. It appears that my Iphone 6 returns the name only for pid = 12, and not pid = 4. FWIW, a Sony HX-9V camera returns the name for both pids.
For those tinkering, it might be worth noting that pid = 18 returns a string containing the creationdate of the file for image and video files on both of the above
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.