Without Manifest, without changing compatibility settings, without right clicking and select Run as Administrator or similar ways, how to run my program as Administrator?
Anyone?
my_setup.exe my_install.exe ;)
this challenge sounds a little against some of the forum rules :shock:
Only teasing...
OpenSCManager in combo with ShellExecute ?
include \masm32\include\masm32rt.inc
.code
start:
.if rv(ShellExecute, 0, chr$("runas"), rv(GetCommandLine), 0, 0, 0)>32
inkey "hi admin"
.endif
exit
end start
Very good JJ!
Only the guy that says "hi admin" is not the administrator. :(
Hello,
Maybe this one :
CreateProcessWithLogonW :
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-createprocesswithlogonw
Quote from: AW on March 14, 2019, 05:13:09 AM
Only the guy that says "hi admin" is not the administrator. :(
Yep, you are right :P
include \masm32\include\masm32rt.inc
.code
start:
invoke GetCommandLine
xchg eax, ebx
.if sdword ptr find$(1, ebx, "-A")>0
MsgBox 0, "I am the admin, really", "Hi", MB_OK
.else
invoke ShellExecute, 0, chr$("runas"), ebx, chr$("-A"), 0, 0
.endif
exit
end start