You are here

Administrator / Elevated

10 posts / 0 new
Last post
Screemer
Offline
Last seen: 1 year 5 months ago
Joined: 2011-10-07 07:21
Administrator / Elevated

Hi I am a newbie here,

this question might have been answered already.
I searched but couldn't find the answer tho.

I am trying to make a payed software (registry workshop) from torchsoft.com portable.
It's only for personal use and I will not release it so please don't even ask.:)

Now to my problem,

I have added
RunAsAdmin=force
RunAsAdminXP=none
to my launcher ini file, forcing the application to start with elevated rights on everything after windows xp.
But I have a problem, when just double clicking it, it will start elevated it seems, but I get a error message about a file it can't find.
If I click ok on the error it run just as it is supposed to and works fine.

If I then start the application by right clicking and chose run as administrator I don't get that error message. It start just fine without any errors.

Nothing is written to the registry and all files are in a folder, even the registration information.

The software has to be run with elevation or it will not work.

Do any of you dev gods out there know what could be wrong? And possibly point me in the right direction to solve my problem?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Message?

I get a error message about a file it can't find.

What's the message?

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Screemer
Offline
Last seen: 1 year 5 months ago
Joined: 2011-10-07 07:21
That's my problem really.The

That's my problem really.:)

The message only says..

The system cannot find the file specified.
And an ok button..

I now have also tried to use sudo.exe I've found somewhere on google.
It elevates any program sudo.exe program.exe
Then it also works as I want it without any error messages.

Aluísio A. S. G.
Offline
Last seen: 8 years 4 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
From app?

Can you check if that message is from the program itself, and not from the launcher?
@Chris: I think I've stumbled upon this last month. The UAC plugin adds /UAC:ABCDE (where ABCDE is a random number) to the command line. We need to find a way to get rid of it.

Previously known as kAlug.

david_pi
Offline
Last seen: 1 year 11 months ago
Joined: 2011-03-19 09:44
I found some Apps treat this

I found some Apps treat this (/UAC:ABCDE) as passed parameters and try to open it as a file. In some case the App report "can't open UAC:ABCDE" and exit itself.
By the way, passing parameters and environment variables when UAC elevate is active seems don't work. The UAC plugin create a new process without passing parameters and environment variables to it. Is there any solutions (except COMPILE-FORCE)?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Being fixed

kAlug and I went through this issue this afternoon (well, late last night for him) and we've got it pretty much sorted out; once we've got it verified and committed, I'll release 2.2 Beta 1 and then barring issues 2.2 will be released shortly afterwards.

The compile-force option was an attempt at a workaround which I tried when I didn't understand this issue. We've now worked out why I hadn't observed the /UAC: bit ever; apparently it only occurs in Vista/7, and I haven't had anything beyond XP to test on (I finally got round to installing a Windows 7 VM yesterday, so I'll be able to track down such version-specific things better in future).

Command-line arguments should be being passed, but it's a known issue that the environment isn't passed properly when changing users. I've got a notion of how to deal with it which I'll test out in some future release. It's not very far down the task list.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

david_pi
Offline
Last seen: 1 year 11 months ago
Joined: 2011-03-19 09:44
pass Environment variables

I don't know whether it's a good idea, but it seems works:

Function .onInit
UAC_Elevate:
......
Functionend

Section Main
...Do something...
!insertmacro UAC_AsUser_Call Function Launch ${UAC_SYNCREGISTERS}
...Do something...
Sectionend

Function Launch
...Set Environment variables...
Execwait "$PROGRAM"
Functionend

Environment variables can be passed to the executable file in this way. As you said, environment isn't passed properly when changing users.
Hope to see the new release soon. Biggrin

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Running as user

That makes the base app run as the regular user rather than elevated, which will very rarely be what's desired. UAC_AsUser_Call will come into the solution for synchronising environment variables, but not this way (it'll call in the outer process a function which will return the value the variable has and then it'll be set in the inner process).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

david_pi
Offline
Last seen: 1 year 11 months ago
Joined: 2011-03-19 09:44
Yes, but in most case

Yes, but in most case "install" and "uninstall" need administrator permission, but the base app run need not.
But this is definite not a good way. I'm looking forward to see the real solution.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Apps themselves

With installers, they may need to run the app as the normal user, but for us the most common reason for needing administrative privileges is because the app itself needs them (perhaps it writes to HKLM), though e.g. registering a service could be a situation where you wouldn't need it all admin.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Log in or register to post comments