Delphi 2007 Vista Uac

19.12.2019by admin
Delphi 2007 Vista Uac Rating: 9,5/10 2123 reviews

Hello there,My applications allows users to drop media files onto from Windows Explorerand then converts that file over to WMV. This works perfectly in XP, butapparently the UAC does not like this.I have included a manifest into my exe to request Admin rights, and whilstthis works (it converts the file into the same directory it was droppedfrom), it also has the nasty caveat of disabling drag and drop.Apparently, because my app is running elevated and Windows Explorer is not,the UAC deems this a security threat and thus disallows it.What I want to know, either a way around the drag and drop problem whilst myapp is still running in elevated mode OR is there a way to tell if my app isrunning as an Admin or normal user? This way I can distribute my app withoutthe manifest, detect if not running as Admin and then display a warningdialog when the program starts. Does this sound feasible?Sorry for the question being a bit convoluted, but have been struggling withthe UAC for the past hour and my head is in bits, lol.Any help is greatly appreciated.RegardsAnthoni. Anthoni Gardner schrieb: Hello there, My applications allows users to drop media files onto from Windows Explorer and then converts that file over to WMV. This works perfectly in XP, but apparently the UAC does not like this.In Vista it works perfectly, too!

  1. Delphi 2007 Vista Uac Update

I have included a manifest into my exe to request Admin rights, and whilst this works (it converts the file into the same directory it was dropped from), it also has the nasty caveat of disabling drag and drop.Windows Messages and thus Drag&Drop are not allowed between applicationswith different (and higher) integrity level. A user has a medium leveland Administrator has a high level. You can't send messages from a lowerlevel to a higher level.

This also answers why you can't drop a folderfrom Explorer to a Windows command prompt anymore - in XP it works. Infact the command line is shown by an higher privileged process.The reasons is to avoid so called shatter attacks. A process iscompromised by sending an invalid message that makes the process runningevil code.Apparently, because my app is running elevated and Windows Explorer is not, the UAC deems this a security threat and thus disallows it.Yes. What I want to know, either a way around the drag and drop problem whilst my app is still running in elevated mode OR is there a way to tell if my app is running as an Admin or normal user? This way I can distribute my app without the manifest, detect if not running as Admin and then display a warning dialog when the program starts. Does this sound feasible?The fix is to run your application as a normal user and use a COMelevated server to do only stuff as Administrator that needs it.

Toelevate your whole app isn't necessary at all!Searching for 'delphi com elevation' should give you many suggestionshow to use a COM Moniker. However I created a blog about it on my own atit goes.1.

KeyDelphi 2007 vista uac key

Create your own COM interface with methods you want to call asAdministrator2. Create your own DLL file that implements this interface3. Register this DLL file to Windows VISTA as a COM Moniker4. Run your application and request a COM object of your registered COMinterface5. Vista UAC pops up6. A new COM server process is started that runs your COM method and isdestroyed if the method shuts down.The returned COM object can be used for stuff that needs elevation. Sorry for the question being a bit convoluted, but have been struggling with the UAC for the past hour and my head is in bits, lol.You are not the only one out there!

I can assure you. OK, so the UAC still has yet more surprises in store for me. It seems right clicking and selecting 'Run As Admin' also disables the drag and drop mechanism. So its not going to matter if I detect the user is running Admin or not:(Same problem with the integrity level.RegardsChristian Wimmerblog.delphi-jedi.net. 'Rob Kennedy' wrote in messagenews:15968@forums.codegear.com.

Why in the world do you make it do that? Converting between media formats should not require elevated privileges. You're doing something wrong. Fix that; don't work around it.The reason it seems to require elevated privileges is because it convertsthe file in the same drive:/directory that it was dropped from. So forexample, I drop a file fromE:MyFolderMyMovie.avi then it will convert that and store it asE:MyFolderMyMovie.wmvIt is not my program that is doing the converting, but a DLL that I amusing.RegardsAnthoni. 'Christian Wimmer' wrote in messagenews:15918@forums.codegear.com.

In Vista it works perfectly, too!Lol, yep once I know what I am doing wrong:P Windows Messages and thus Drag&Drop are not allowed between applications with different (and higher) integrity level. A user has a medium level and Administrator has a high level. You can't send messages from a lower level to a higher level. This also answers why you can't drop a folder from Explorer to a Windows command prompt anymore - in XP it works. In fact the command line is shown by an higher privileged process.

The reasons is to avoid so called shatter attacks. A process is compromised by sending an invalid message that makes the process running evil code. never even heard of that attack before. Thanks for the infolink. The fix is to run your application as a normal user and use a COM elevated server to do only stuff as Administrator that needs it. To elevate your whole app isn't necessary at all!Please see my answer to Rob Kennedy.Basically I am using a third-party DLL that converts the media for me.

ThusI capture the dropped file, then pass it into the DLL and that then proceedsto convert, passing relevent info via callbacks. Now the DLL converts thedropped media into the same folder that it was dropped from and I think itthis reason, and only this reason, that I needed the elevated rights.Nothing else in my app requires this and yes I feel that manifest wasoverkill, but wanted to see if it worked.I am not sure if your Com solution will solve this or not?RegardsAnthoni. The reason it seems to require elevated privileges is because it converts the file in the same drive:/directory that it was dropped from.In that case you should only need elevated rights if the source media isin a directory you don't have write access to (Program Files, for example).For that limited use, I'd suggest using SHFileOperation instead ofmessing with a new out-of-process COM server.

If you tellSHFileOperation to copy/move/delete a file it will only show the UACprompt if it needs to, and it doesn't require any extra work on your side.Try creating a junk file in the source directory. If it works, do likeyou're doing already. If it fails, copy the media to a temp directory,perform the conversion there, then do a shell move back to the originaldirectory. If you convert multiple files in one go, just pass them as asingle call to SHFileOperation and it'll only prompt once for the entiregroup.Regards,Craig PetersonScooter Softwarehttp://www.scootersoftware.com/.

A couple of days ago I posted about. I was proposing to read a registry entry. Thanks to the power of blogs, my post drew a comment from Andrei Belogortseff, who that does this properly. His library has functions for detecting whether the current process is elevated, detecting whether UAC is enabled, and running new processes both elevated and non-elevated (the last of these is the hardest to do).I liked the libary but wanted to use it from.NET.

I compiled his code to a DLL and did a C# wrapper; then I considered the hassles of adding a dependency on the Visual C runtime libraries. Hi,are you shure your function IsElevated is working correctly? I implemented the same function in Delphi 5 and “GetTokenInformation” always returned 0 running the prog as a not elevated administrator. Your c# implementation is doing exactly the same. I found this: and changed my Delphi code. Now my code returns TokenElevationTypeLimited for the case mentioned above.

Starting my app as an Administartor I’m getting TokenElevationTypeFull. This seems to be correct.

Delphi 2007 Vista Uac Update

I think your function seems to work correctly because you are doing this:return (te.TokenIsElevated!= 0);cheersThomas.