简体   繁体   中英

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 OpenNETCF 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM