Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Runas ShellExecute UAC Trick in Windows 7
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Runas ShellExecute UAC Trick in Windows 7
Miscellaneous
Thread ID:
01540957
Message ID:
01540957
Views:
936
Have successfully used this code on my own & one of my client's machines to elevate privileges in Window 7. A UAC pops up and the program (a VFP compiled batch file which copies and registers some DLL's) runs.
#define SW_SHOWNORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3

DECLARE INTEGER ShellExecute IN "shell32" INTEGER, STRING, ;
STRING, STRING, STRING, INTEGER

m.lnOwnerHWND = 0
m.lcCommand = "runas" && this does the trick!

m.lcTarget = "Some VFP Exe"
m.lcDirectory = ""

ShellExecute(m.lnOwnerHWND, m.lcCommand, m.lcTarget, m.lcParams, m.lcDirectory, SW_SHOWNORMAL)
However for one of my clients (logged in as Domain Administrator):

1.The UAC pops up
2.The User answers Yes
3.There is a brief screen flash (looks like VFP starts) and then nothing..

Think that there is a problem Copying to the Windows System folder (in this case C:\WINDOWS\sysWOW64 folder).

The program will run correctly if the User has previously attempted a manual Copy to the C:\WINDOWS\sysWOW64 folder and answered another UAC box.

Any experiences/suggestions anyone?
Reply
Map
View

Click here to load this message in the networking platform