Asked by:
Load Driver DLL from Metro app

Question
-
I have a project that uses a USB to serial converter to communicate with a proprietary device. Obviously I cannot use the virtual COM port to communicate with the device from a Metro style app. I am trying to use the D2XX drivers to communicate with the device, but I cannot get the app to dynamically load ftd2xx.dll.
I use the following to try to load the dll:
if (!LoadPackagedLibrary(L"ftd2xx.dll", 0)) { auto y = GetLastError(); }
y ends up with 126 (ERROR_MOD_NOT_FOUND).
ftd2xx.dll is installed in:
- c:\Windows\System32\ftd2xx.dll
- c:\Windows\SysWOW64\ftd2xx.dll
Is there some way that I can load this dll in my Metro style app? Without the ability to use this adapter it will be impossible for me to write my program as a Metro style app.
Monday, March 26, 2012 11:47 PM
All replies
-
Hi Diltsman
According another discussion thread here: http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/c5636e14-422f-4ab0-b608-2609ad8198e4
You should aware two thing before your using LoadPackagedLibrary
- Make sure it pack with your app
- Make sure dll compiled is not against Metro SDK.
Refer the thread for more detail since MSFT provide more detail about it.
~ Evan Lin
Tuesday, March 27, 2012 3:44 AM -
Hi Diltsman
According another discussion thread here: http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/c5636e14-422f-4ab0-b608-2609ad8198e4
You should aware two thing before your using LoadPackagedLibrary
- Make sure it pack with your app
- Make sure dll compiled is not against Metro SDK.
Refer the thread for more detail since MSFT provide more detail about it.
~ Evan Lin
This was a great start! Now I can load the dll, and get the entry points, but it still doesn't work. The functions work, but they do not actually get the information from the driver. If I call them from inside the Metro app, they give no useful information, basically all that it can do correctly is detect the number of devices attached to the computer.
If I load the dll from a Win32 app (on Windows 8) all the functions work as expected.
Since this is a driver dll, is there any way to load it so that it might work?
Wednesday, March 28, 2012 12:38 AM -
Hi Diltsman,
I would like suggest you to double confirm your driver DLL, if it work well on desktop mode or not at first.
If you find the driver API work well on desktop mode but failed on metro mode, would you double confirm your driver API or check it if you could find any alternative API
http://msdn.microsoft.com/en-us/library/windows/apps/hh464945.aspx
~ Evan Lin
Friday, March 30, 2012 6:19 AM -
Were you able to resolve this? I'm looking to use a device based on the same FTDI.Friday, October 26, 2012 1:49 AM
-
Access to drivers is restricted by the AppContainer security context.
Have you read through http://msdn.microsoft.com/en-us/library/windows/desktop/hh404235.aspx?- Edited by Chuck Walbourn - MSFTMicrosoft employee Wednesday, October 31, 2012 2:23 AM
Wednesday, October 31, 2012 2:11 AM -
Hi,
You can able to use only Metro supported win32 API from your app.
Windows Store apps can use a subset of the Win32 and COM API.
This subset of APIs was chosen to support key scenarios for Windows Store apps that were not already covered by the Windows Runtime, HTML/CSS, or other supported languages or standards.
The Windows App Certification Kit ensures that your app uses only this subset of the Win32 and COM API.Here is the link to reference - http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx
From MSDN.
The Windows Store device app for a specialized device that must communicate with a device's custom driver can't use Microsoft Win32 APIs like DeviceIoControl and CreateFile to send IOCTLs to the device.
The restricted security environment where Windows Store device apps run require that you use the Device Access API to communicate with your custom driver from a Windows Store app.for device communication you can use Device API.
http://msdn.microsoft.com/en-us/library/windows/desktop/hh404243(v=vs.85).aspxthanks,
Bhash
- Edited by BhashTech Tuesday, November 6, 2012 3:29 PM
Tuesday, November 6, 2012 3:28 PM