Windows Mobile - Disable USB (Compact Framework - C#)
I need to disable USB on Windows Mobile. How to disable USB on Windows Mobile using Compact Framework 2.0 (C#)? I am using Open开发者_开发知识库NETCF too. If it has some class to disable USB, I can use it too.
A bit of advice, you have to implement both operations to lock / unlock the usb device. Because if you can't unlock it you must perform a clean boot.
You should provision the device with this specific policies
<!-- DenyRAPI.xml !-->
<wap-provisioningdoc>
<characteristic type="SecurityPolicy">
<parm name="4097" value="0"/>
</characteristic>
</wap-provisioningdoc>
<!-- AllowRAPI.xml !-->
<wap-provisioningdoc>
<characteristic type="SecurityPolicy">
<parm name="4097" value="2"/>
</characteristic>
</wap-provisioningdoc>
I provide a link to the original post in which is suggested that you create the cabs. Original Post
I have used another approach to read the XML configuration and then using the following method I execute the provisioning
Microsoft.WindowsMobile.Configuration.ConfigurationManager.ProcessConfiguration(XmlDocument,boolean);
Another option is to use builds the cabs and install them by using wceload.exe
If your application is code-signed and running in full trust, then you have access to protected registry keys. You could then try to edit or remove the various USB device driver configuration registry values. Then you might have disabled USB.
Edit: Possibly involved registry keys:
HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers
精彩评论