Featured Posts

Subs Grabber Quick Fix New Subs Grabber quick fix has been released: Fixed: on podnapisi.net server search results are displayed, but download fails New: auto updater will now display what's new information when a new relaease/fix...

Readmore

Subs Grabber Quick Fix New Subs Grabber quick fix has been released: Fixed: on podnapisi.net server search results are displayed, but download fails New: auto updater will now display what's new information when a new relaease/fix...

Readmore

Subs Grabber (subtitle searching tool) v1.0.0 Launched Subs Grabber can be used to search for and download subtitles. It is using the database of the most popular subtitle websites and can find subtitles for movies and television series in various formats...

Readmore

USBPhysic (DLL Component) v1.0.0 Launched USBPhysic is a stand-alone component ( 32/64-bit Windows dynamic-link library - DLL ) that can be used to extract the physical vendor information from almost any USB (Universal Serial Bus) storage device....

Readmore

Hddphysic and Win Vista / 7 UAC (workaround) Issue:  Using Hddphysic to query hard drive physical data may fail sometimes on Vista / Windows 7 if UAC (User Account Control) is enabled and calling application is not launched with sufficient...

Readmore

  • Prev
  • Next

Hddphysic and Win Vista / 7 UAC (workaround)

Posted on : 19-11-2009 | By : rlByte Team | In : HDDPhysic

0

Issue:

 Using Hddphysic to query hard drive physical data may fail sometimes on Vista / Windows 7 if UAC (User Account Control) is enabled and calling application is not launched with sufficient rights.

Workaround

 To work around this issue without forcing the user to disable UAC mark your application with a requestedExecutionLevel. To do that you must create and embed an application manifest with your application that tells the operating system what the application needs ( digital signing of the EXE is also a good idea).
This is the format:

<requestedExecutionLevel
level="asInvoker|highestAvailable|requireAdministrator"
uiAccess="true|false"/>

 To mark your application with a requestedExecutionLevel, first create an application manifest file to use with the target application. This file can be created by using any text editor. The application manifest file should have the same name as the target executable file with a .manifest extension. For example: IsUserAdmin.exe.manifest.
Example:

Executable: MyApp.exe
Manifest: MyApp.exe.manifest

Sample application manifest 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="X86" name="application name" type="win32"/>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="highestAvailable"/>
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly>

Next, you have to attach the application manifest to the executable by adding a line in the resource file of the application (the .rc file) to have Microsoft Visual Studio embed your manifest within the resource section of the PE file. To accomplish this, place the application manifest in the same directory as the source code for the project you are building and edit the resource file to include the following lines:

#define MANIFEST_RESOURCE_ID 1
MANIFEST_RESOURCE_ID RT_MANIFEST "MyApp.exe.manifest"

 After rebuilding the application, the application manifest should be embedded in the resource section of the executable. Check your exe file with a resource viewer, you should see something like this:


Write a comment