News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A question on "run as administrator"

Started by clamicun, August 17, 2016, 08:53:26 PM

Previous topic - Next topic

clamicun

A question on "run as administrator"

My program writes in "C:\Program Files"   and "C:\Windows\System32".
This only works, if it is run as administrator, otherwise it writes into "C:\Users\Mic_User\AppData\Local\VirtualStore\Program Files".

I would like to create a Messagebox giving a warning, if the program isn't run as administrator.
I could try to write "something" and if it fails give out the MessageBox.

Is there a possibility to know directly after start, how it is run ? 

jj2007

http://masm32.com/board/index.php?topic=763.msg6649#msg6649

clamicun

Last question...

INVOKE IsUserAnAdmin
Returns TRUE or FALSE

What's wrong with that function ?
So the whole check on the user is only one line.

jj2007

@Donnewany author: Your bot sucks. Invest a bit more time in parsing the forum messages, and creating more intelligent replies.

hutch--

Donnewany has been promoted to another web site.  :P

sinsi

Quote from: clamicun on August 18, 2016, 11:50:19 PM
Last question...

INVOKE IsUserAnAdmin
Returns TRUE or FALSE

What's wrong with that function ?
So the whole check on the user is only one line.

Quote from: MSDNIsUserAnAdmin is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.
Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
End of client support
Windows Vista

End of server support
Windows Server 2008

You could add a manifest specifying requireAdministrator.
🍺🍺🍺