Jump to content

SetUpCreateDeviceInfo()API is not working in Windows Vista with UAC Of


wanni

Recommended Posts

Hi ,

I am using SetUpCreateDeviceInfo()API in my application, It works fine on XP as well as on Vista with UAC OFF, but it fails on Vista with UAC ON. The SetUpCreateDeviceInfo() fails but GetLastError() function returns 0. Can anyone please tell the solution?

Note: SetUpCreateDeviceInfo()API definition is in setupapi.h in WINDDK.

Thanks & Regards

Umesh Bansal.

Link to comment
Share on other sites


I think you might mean SetupDiCreateDeviceInfo. Anyway, sounds like it's failing outside your code, likely in the registry. If you run process monitor whilst reproducing the error, do you see any access denied or sharing violation messages in the procmon log that correlate to your repro? That'd be the first thing I would check (especially if GetLastError returns 0).

Link to comment
Share on other sites

The caller of this function must be a member of the Administrators group

How do you start your application? if UAC is on, you're not elevated rights by default. So tell your application it should run with elevated rights (this can be requested by editing your manifest file)

Link to comment
Share on other sites

Hi it also looks to me this is elevated priviliges problem.

I make an manifest file and try again but of no use.

Here is sample of mine manifets file

<?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.0"

processorArchitecture="amd64"

name="iKeyDriver.msi"

type="win64"/>

<description>elevate execution level</description>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">

<security>

<requestedPrivileges>

<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

</requestedPrivileges>

</security>

</trustInfo>

</assembly>

Can you point out where i am wrong.

Regards,

Umesh.

Link to comment
Share on other sites

I uses this code, it works.

But it have one issue: when your exe file run in Windows XP SP2, it may lead to a BSOD.

<?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.0"
processorArchitecture="*"
name="IsUserAdmin"
type="win32"/>
<description>Description of your application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Edited by softice
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...