Matthew P. Del Buono

Hello everyone,

Bear in mind I'm somewhat new to Vista in its entirety, let alone coding for it, but I'm quickly picking up on the new caveats like UAC and the like.

I'm currently working on updating an existing application which modifies contents of the Program Files (in Vista, "rogram Files (x86)" ) directory. This is unavoidable; the application doesn't modify itself but rather the contents of another application which we have no control over, so while I realize the correct solution would be to not have it in the Program Files directory, that's not really a potential solution for our case.

With Vista's new security constraints, I realized after a while that I'm going to have to get this program play nicely with UAC if it's to work correctly (it did some very amusing stuff at first; then we realized it wasn't accomplishing its task). So the program is going to have to elevate, if it can, to an administrator level. So I did my research and came to this conclusion: I need to use the mt.exe tool to link in the following XML manifest:

Code Snippet

< xml version="1.0" encoding="UTF-8" standalone="yes" >

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

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

<security>

<requestedPrivileges>

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

</requestedPrivileges>

</security>

</trustInfo>

</assembly>

And I use the following command to link it in:

mt -manifest win32_wowiupdater.manifest.xml -outputresource:C:\...\win32_wowimgr.exe

(snipped path to executable)

So I did that. It worked well for a while; I found some other C++ code that needed to change so I did. Somewhere down the road I hit a roadblock. The program works perfectly before I run the mt.exe command (aside from the problems associated with not having administrator access). However, as soon as I run that command, now, I get the following error:

"This application has failed to start because MSVCR90.dll was not found...."

I was rather confused when I saw this message. After some troubleshooting I said "why not" and added that DLL to the setup package to include in the program's folder. Now I get the following message

"This application has failed to start because COREDLL.dll was not found...."

When I saw that message, I initially had never heard of the DLL, so I looked it up, and from what I can tell, that's a Windows CE dll! So at this point I'm entirely confused why that would have anything to do with my program. As I said before, the program works fine before I try to include the manifest, and then starts having these problems after I do it.

The only Windows APIs I actually use in this program are CreateProcess, RegOpenKeyEx, and RegQueryValueEx. The majority of the application's work is actually handled in another process spawned by this one with CreateProcess. (As a side question, am I correct in assuming that since this application requested an elevated status, that status will be forwarded on to the spawned process )

Can anyone shed some light on exactly what's going on here, and why these errors are surfacing I'm completely confused, myself; they seem to be coming from nowhere.

Thanks for any enlightenment,

-- Matt



Re: UI Development for Windows Vista Elevation Required -> Extra DLLs?

AndyCadley

Have you, by any chance, switched to using a VS2008 Beta to compile your C++

MSVCR90.dll is the Visual C++ runtime libraries (version 9), which is the one used for applications compiled by VS2008 (MSVCR80.dll is the version that ships with VS2005). You'd need to ship the appropriate Visual C++ Redistributable with your app in order for it to work correctly. Given that VS2008 is still a beta, that probably isn't possible at the moment (though I seem to recall in does have a Go Live option if you really need that functionality).





Re: UI Development for Windows Vista Elevation Required -> Extra DLLs?

Matthew P. Del Buono

I am indeed using VS2008 to do this, but it seems a bit strange that it doesn't even work on my workstation (and that coredll.dll shouldn't ever be needed, as far as I can tell).

Question, then, is how I can set up my program to request elevation through UAC without 2008. Does 2005 have this functionality I never saw it myself. Or is there some other option

I should point out that this error does not arise during compilation. The program works perfectly fine on its own, until I go into the VS 2008 Command Prompt and run the mt command that I specified above. Only after I do that do I experience these problems.





Re: UI Development for Windows Vista Elevation Required -> Extra DLLs?

AndyCadley

lt does seem odd, but it is a beta and all that. There is a Channel 9 screencast that shows how to embed a manifest in VS2005.