Paul525

I am using VC++ to create an application to obtain privilege and remove keys and subkeys in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USBVid_0xxa&Pid_0xxx but I always get access denied message, the same code works fine on XP but not on Vista.

I tried to use the sample code from the msdn library but still doesn't work on Vista....
http://msdn.microsoft.com/library/default.asp url=/library/en-us/secauthz/security/taking_object_ownership_in_c__.asp

http://msdn.microsoft.com/library/default.asp url=/library/en-us/secauthz/security/enabling_and_disabling_privileges_in_c__.asp

It failed when I try to run the SetPrivilege function, and print out I must be logged on as Administrator, but I am log on as Administrator and run the program as an Administrator too. Can anyone help me on this issue



Re: General Windows Vista Development Issues How to remove registry keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\...

Paul525

I tried using Mt.exe to embed the manifest file but still failed.
The content of my manifest file is as below:

< xml version="1.0" encoding="UTF-8" standalone="yes" >
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.1"
processorArchitecture="X86"
name="vusb_cleanup.exe"
type="win32"/>
<description>Ndis protocol Application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>





Re: General Windows Vista Development Issues How to remove registry keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\...

David Tyler Hunt

If this is just compiled example code, do you think you could post a copy of the exe with the embedded manifest somewhere



Re: General Windows Vista Development Issues How to remove registry keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\...

valentino mario

Dear Paul525, I have the same problem either with Vista either with XP;

are you so kind to send me your code for XP I will be very grateful.

Four years ago I build a USB custom driver for a Data Device, and it works OK with the automatic

installation. Now the automatic Driver installation is refused from vista and I should review

the procedures for authorization. With Winusb.sys it will be more and more simple, and the MS

signature is ready.

I made an .inf file for installing Winusb.sys for the same device that works OK with XP through my custom driver. Winusb.sys is loaded and my device replys Ok to the initializations requested

from Winusb.sys. It appears on the sytem hardwar panel, on the registry etc.

If I try to find on the registry his class GUID etc the query fails.

Just for testing I made the request :


// Create a HDEVINFO with all present devices.

    hDevInfo = SetupDiGetClassDevs(NULL,
      0, // Enumerator
      0,
      DIGCF_PRESENT | DIGCF_ALLCLASSES );

I don't have Error but the pointer point to an empty structure and if I make GetLastError I get

NO_MORE_ITEM.... so I am locked; any suggestion

Best regards

valentini mario






Re: General Windows Vista Development Issues How to remove registry keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\...

AndyCadley

Drivers for Vista should follow the Device Installation Rules, including using the correct API calls rather than enumerating/modifying Registry keys directly. This ensures that they work properly for Standard Users and install themselves correctly in the Vista Driver Store so they can be repaired/reinstalled without access to the original media if necessary.

Complete information on driver installation/uninstallation can be found here.