Old 3rd October 2007, 11:25   #81
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
I'm sorry, but that is horrible, you just use some random window token. Can you get the token for GetDesktopWindow() or is that restricted somehow?

What about Win2000/XP ?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2007, 12:48   #82
RobertStrong
Junior Member
 
Join Date: Jan 2006
Posts: 22
GetDesktopWindow didn't work and I didn't spend any time trying to figure out what was up with this. I'll look into what's going on.

Regarding Win2K/XP the comment:
// CreateProcessWithTokenW is not present on WinXP or earlier
so it returns an error allowing fallback to Exec, ExecShell, etc.
RobertStrong is offline   Reply With Quote
Old 3rd October 2007, 13:25   #83
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
You can't fall back to Exec/ExecShell, you have the same problem on 2k/XP if you use runas

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2007, 14:02   #84
RobertStrong
Junior Member
 
Join Date: Jan 2006
Posts: 22
I understand a solution for the runas on systems without UAC or UAC is turned off would be a wonderful thing but that is highly unlikely from what I have read of other people's struggles with this (e.g. using task scheduler... I mean damn!).

On the other hand being able to launch an app at the end of uninstall (e.g. option to open a web page) which is typically not elevated through runas (e.g. ARP or Programs and Features) though on Vista with UAC turned on is elevated would be a good thing. If a 100% solution were possible I'd certainly go for it but without that I am willing to settle for good vs. perfect since perfect isn't an option from what I have read on this scenario.

I'll probably just provide the option when the progman window is available to avoid using a random window and throw together a simple plugin to provide this when the target is Vista with UAC turned on.
RobertStrong is offline   Reply With Quote
Old 3rd October 2007, 15:41   #85
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
ExecShell should open a http:// style URL without elevation no?

There is another problem, ARP is disabled untill all subprocesses finish, I created a hacky workaround for that @http://nsis.sourceforge.net/Escape_A...th_New_Process (Not tested on vista)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2007, 16:47   #86
RobertStrong
Junior Member
 
Join Date: Jan 2006
Posts: 22
No, it regretfully inherits from the process that calls ShellExecute.

Thanks for the pointer on the workaround using JOB_OBJECT_LIMIT_BREAKAWAY_OK. That has been an annoyance for a long time.
RobertStrong is offline   Reply With Quote
Old 18th October 2007, 16:57   #87
M-Force
Junior Member
 
Join Date: Mar 2006
Posts: 28
Unhappy UAC-Plugin - Multiple security warnings on Vista

Hi,

i have a problem with the UAC-plugin on vista.

After i clicked the button on my web page to download my installer, vista is poping up first a "File Download - Security Warning" with information about Name, Type and From. I think this i normal behavior.

After i confirm with clicking the "Run" button another security warning is poping up. This "Internet Explorer - Security warning" is asking if the software of a certain Name and Publisher is allowed to run. I think this is normal as well.
After i confirm "Run" i get a third security popup "Open File - Security Warning" which is asking if i want to run a file which is described with Name, Publisher, Type and where from. This file has the same name as my Installer except the installer name got a number suffix like Installer[2].exe and moreover it is stored under "c:\user\<account>\AppData\Microsoft\Wind...". Thats all what i can read from that path.
After i confirm the third installer and click on "Run" finally my installer window is coming up.

I dont think the third security warning should come up. It would only confuse the user.
Can you confirm such behavior? Is that normal?

Thank you for your help.

M.
M-Force is offline   Reply With Quote
Old 18th October 2007, 19:04   #88
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
This is probably not related to the UAC plugin

See http://forums.winamp.com/showthread....hreadid=278784

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th October 2007, 20:02   #89
M-Force
Junior Member
 
Join Date: Mar 2006
Posts: 28
UAC-plugin security popups

Hi Anders,

before I included the UAC plugin in my script i only got the popup windows "File Download - Security Warning" for allowing to download and the "User Account Control" for running the installer. The disadvatage was that the installer window was not in focus after I confirmed the "User Account Control" window.

So by using the UAC-plugin my installer window is now in focus when it got started, but i have all the security warnings inbetween. ( "Internet Explorer - Security warning" and "Open File - Security Warning"). Havent had these security warnings without the UAC.

Therefore i was assuming the UAC raises such warnings.

M.
M-Force is offline   Reply With Quote
Old 18th October 2007, 22:54   #90
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
The UAC plugin will start the SAME exe one more time, so you might get another IE warning dialog, I don't know. Make sure you are have "RequestExecutionLevel user" in your script. If you can post a minimal sample script with this problem I might be able to look into it and see if I can come up with a fix

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th October 2007, 18:08   #91
M-Force
Junior Member
 
Join Date: Mar 2006
Posts: 28
Sample script

Hi Anders,

I attached a simple script which is utilizing the UAC plug-in.
I signed the created installer before tested it.

The described problem with the multiple security warnings is not happening on Vista when you execute the installer direct from the hard drive.

It only happens on Vista when you run the installer out of a web page what means it gets downloaded and executed by IE7 and JavaScript without saving it to the hard drive.

I hope this will help you to figure out the problem.


Thank you very much for your help

M.
Attached Files
File Type: nsi vistatestscript.nsi (1.8 KB, 497 views)
M-Force is offline   Reply With Quote
Old 19th October 2007, 19:20   #92
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
It still gets executed from the hard drive, just in the temporary internet files folder. I guess thats why you get the "c:\user\<account>\AppData\Microsoft\Wind..." path in the dialog, and the name installer[2].exe would indicate that this is the 2nd time you "ran it from a website". I'm not sure how any of this is related to UAC, other than the fact that you might get one extra warning from IE. It might be possible to check if $exedir is the temporary internet files folder and to copy your installer to $temp and then execute that.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd October 2007, 20:23   #93
M-Force
Junior Member
 
Join Date: Mar 2006
Posts: 28
Hi Anders,

I really think that the UAC-plugin makes it different in matter of security warnings.

For example if I run my simple test installer out of a web page without UAC-plugin i get the warnings:
- "File Download - Security Warning" download/run permission
- "User Account Control" elevate process

With UAC-plugin and basically the same test installer i get:
- "File Download - Security Warning" download/run permission
- "Internet Explorer - Security warning" run inst. as user
- "Open File - Security Warning" run installer as admin
- "User Account Control" elevate process

There must be a way that you can use the UAC-plugin with only the 2 security warnings as stated above.
Otherwise it could easily scare users away with so many warnings.

M.
M-Force is offline   Reply With Quote
Old 22nd October 2007, 21:19   #94
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
nope, I don't think there is anything I can do. If you copy your installer out of temporary internet files and into $temp AND remove the "mark of the internet" (NTFS stream) you might be able to get rid of two warnings (you must do this before calling the uac plugin in .OnInit). Signing your installer might also help. This is a IE only issue that I don't really care about to be honest (you could also wrap your real installer inside a smaller one that just extracts the real thing to $pluginsdir/$temp and executes it)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th November 2007, 03:40   #95
unroar
Junior Member
 
Join Date: Jul 2005
Posts: 6
plugin problems

When using the plugin the UAC dialog comes up minimized. This is bad because the user might miss it, even though it is flashing in the task bar. Once I click on the UAC icon I get the normal modal dialog with the desktop darkened.

Is this normal or am I doing something wrong?
unroar is offline   Reply With Quote
Old 7th November 2007, 11:14   #96
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
unroar: which version of the UAC plugin are you using?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th November 2007, 23:12   #97
unroar
Junior Member
 
Join Date: Jul 2005
Posts: 6
The comment in uac.cpp say it's version v0.0.6c - 20071014. I got the download from the wiki link.
unroar is offline   Reply With Quote
Old 8th November 2007, 12:05   #98
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
When you say minimized, are you sure its not just BEHIND other open windows? If you drop by the NSIS IRC channel I might be able to provide you with some test builds

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th November 2007, 18:27   #99
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Latest version on the wiki should now fix the behind and/or minimized bugs (Hopefully) It also contains some other fixes, everyone should test the new build (It will probably be the last, the UAC plugin really needs a fresh start, I'm not sure when I'm up for doing that, if ever, you can still report bugs ofcourse and I will try to fix 'em)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th March 2008, 00:22   #100
selectoe
Junior Member
 
Join Date: Feb 2008
Posts: 5
hi i am a complete novice and need to use this plugin. where do i start? i have downloaded the zip file and extracted it, thats as far as i can get haha.
selectoe is offline   Reply With Quote
Old 25th March 2008, 01:35   #101
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
I guess you are better off not using it at all then if thats as far as you got on your own. You are probably better off using:

RequestExecutionLevel admin
SetShellVarContext all
and don't use the run checkbox on the finish page
If you need be admin on other NT versions aswell, you can use the UserInfo plugin that ships with NSIS to check in one of the init functions

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th March 2009, 18:48   #102
jcollake
Junior Member
 
Join Date: Mar 2009
Posts: 3
Nice work on the UAC plug-in Anders . I have been using it for several months, allowing me to perform a post-install launch without propagating the high privileges of the installer to the child process.

Unfortunately, I have encountered a problem with the UNICODE build (built here /w VS2008). I am using it in conjunction with the UNICODE build of NSIS. I do not know which is at fault, but I suspect first the UAC plug-in.

I am getting a general failure in Windows x64 (unable to elevate). It appears to work in x32, though I have did have one user report of a failure to elevate for the x32 build -- leaving me unconfident.

I intend to so some debugging soon, but I figured I would ask here to see if anyone else has seen this, or if anyone is using this combination successfully for installations in Windows Vista+ x64.

Thanks!

Last edited by jcollake; 27th March 2009 at 19:09.
jcollake is offline   Reply With Quote
Old 28th March 2009, 19:56   #103
jcollake
Junior Member
 
Join Date: Mar 2009
Posts: 3
Nevermind all.. My build of the UAC plug-in was bad. VS2008 had pulled in the CRT due to buffer security checks being enabled, and I had accidentally linked to the DLL version of it. This therefore caused a UAC.DLL load error on systems where the CRT DLLs weren't installed. Duh! Problem solved. I should have looked closer before posting here.

After removing the CRT dependency, all was well. My unicode build of the UAC plug-in ended up being 19KB, only 2KB larger than the official multi-byte distribution of it.

I can say now that the UAC plug-in definitely works great with the unicode build of NSIS .

Last edited by jcollake; 28th March 2009 at 20:16.
jcollake is offline   Reply With Quote
Old 28th March 2009, 22:05   #104
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
when the next official release comes out (who know when that will be) it will ship with both versions so you don't have to recompile if you are not changing the source

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th March 2009, 13:36   #105
jcollake
Junior Member
 
Join Date: Mar 2009
Posts: 3
Quote:
Originally posted by Anders
when the next official release comes out (who know when that will be) it will ship with both versions so you don't have to recompile if you are not changing the source
Thanks Anders, I'm sure that will be helpful to many people -- and probably reduce the number of support requests you are bothered with, lol .

I attached a unicode build of Ander's UAC plugin to this post, in case it is helpful to anyone in the interim. This is version 0.0.11c.

I really appreciate your work on this plugin. Without it, I would have had to quit using NSIS.
Attached Files
File Type: zip uac_unicode_0011c_032909.zip (10.1 KB, 348 views)
jcollake is offline   Reply With Quote
Old 20th July 2009, 16:46   #106
Paul_B
Junior Member
 
Join Date: Jul 2009
Posts: 3
Anders

Congratulations on the work you have done on the UAC plugin.

One strange problem I have encountered is as follows:
Windows 7 RC 1
A non-admin user
The install elevates and installs successfully using an admin user as the inner process. If I uninstall via Start Programs it elevates and works correctly. The paths are correctly identified via UAC as the outer user. However if I uninstall via the Control Panel (same nsi code and uninstall.exe) it elevates, but the install fails as the paths for the Data directory, the desktop icon and start menus are the inner (elevated admin) process and not the (outer) user.

If I run on XP both uninstall routes (Start menu and Control panel) elevate and work successfuly for a non-admin user.

I have worked on the problem for some time, but no luck.
Any help would be much appreciated.

It may well be a Windows 7 problem - I am about to submit as a problem to Microsoft. Any thoughts?

Paul
Paul_B is offline   Reply With Quote
Old 20th July 2009, 17:14   #107
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Vista and 7 will force the elevation for you IIRC (I'm sure this only happens when you put the uninstall info in HKLM)

You should stop creating stuff as the user and do a pure all users install (HKLM & SetShellVarContext all) if you don't want to deal with problems like this (Using the UAC plugin to launch a program during install is fine, anything else means your installer is broken and you will have issues like this)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st July 2009, 08:16   #108
Paul_B
Junior Member
 
Join Date: Jul 2009
Posts: 3
Anders, you seem to be saying that NSIS + UAC plugin is broken if you try a user install. Do you really mean this, as it seem to me that the inconsistent behaviour on Windows 7 (uninstall.exe works via the start menu shortcuts, but fails through the Control Panel)is more likley a Windows bug? It's as though the windows 'executation context' of uninstall.exe, when launched via the Control Panel is different from that when done via the start menu. (I don't have a Vista system handy, so have not yet tried this on Vista.)
Paul_B is offline   Reply With Quote
Old 21st July 2009, 10:31   #109
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Well, it depends on what you mean by user install (In a real single user install, you would not call into the UAC plugin to perform operations since you are already running as the correct user and you will only write to HKCU and the users profile, not in HKLM or $programfiles)

I would not call this problem a windows bug even tho starting from a shortcut is not the same as starting from the control panel, since, if the uninstall info is in HKLM, you did a "all users" install and you will require admin rights to uninstall so windows just "helps you along"

So, if you run into this problem, it probably means you did a "mixed install" and this has never been correct (I know the UAC plugin really helps you do this, but it was not the original intent of the plugin, its only "supported" function is to run programs during install, not to create files or do any special action at all during uninstall)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st July 2009, 16:23   #110
Paul_B
Junior Member
 
Join Date: Jul 2009
Posts: 3
Anders - thanks for such quick replies.
I take your point about the mixed install, which is not a good idea and I think I am guilty of doing this inadvertently. Also, the subtlety that the uninstall.exe was created with the correct paths (during the elevated install) had escaped me.
Thanks again, Paul
Paul_B is offline   Reply With Quote
Old 7th October 2009, 16:24   #111
june1212
Junior Member
 
Join Date: Oct 2009
Posts: 9
Hi, I am using the UAC plug-in, it works well for me. Just I have a requirement to suppress UAC if it is on, in order to let the installation process pure automatically, without any user interfere. Is it possiable through this UAC plug-in? If not, what should I do?

Thanks
june1212 is offline   Reply With Quote
Old 7th October 2009, 16:41   #112
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
june1212, please don't post the same question twice, it causes fragmentation of the answers.

--> Answered in http://forums.winamp.com/showthread....hreadid=313496
MSG is offline   Reply With Quote
Old 10th May 2011, 06:31   #113
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Hello over there,

I've a question regarding the UAC plugin and creating a Mutex to find out if the installation program is already running.

As far as I noticed the program is going to be run twice - in normal mode and in admin mode, if you confirm it. So if I create a mutex in onInit, it will be executed twice and then fail.

How do I prevent this?

Thank you for your great plugin!

The topic I posted my question first is:

Thread: CreateMutex Help Topic - Post #32
Post: Post #32 - Single Post View

Edit: Ok - I've a solution for my problem! Because we are going to check if there is an update required first before we execute the uac dialog I had to wrap it into those checks. And I create the mutex only if we have admin rights and the application can be installed. (see attachment)
Attached Files
File Type: txt mutexChecksWithUAC.txt (1.4 KB, 222 views)
klopfdreh is offline   Reply With Quote
Old 7th November 2011, 18:54   #114
trumpetinc
Junior Member
 
Join Date: Oct 2007
Posts: 6
I'm going nuts with the lack of documentation, and I can't find source code anywhere. Would it be possible to get a zip with the source uploaded to the wiki? http://nsis.sourceforge.net/UAC_plug-in

I'd be more than happy to add some documentation if I can get the source.
trumpetinc is offline   Reply With Quote
Old 5th December 2011, 20:22   #115
ivansobaka
Junior Member
 
Join Date: May 2010
Posts: 3
I have a question about using UAC plug-in.

I try to run setup from the non admin user and get "Run as" dialog box.
Then I fill 'user' field and 'password' field leave empty.
Then I get error something like "empty passwords are not allowed".

What could I do?
ivansobaka is offline   Reply With Quote
Old 5th December 2011, 23:54   #116
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Quote:
Originally Posted by ivansobaka View Post
I have a question about using UAC plug-in.

I try to run setup from the non admin user and get "Run as" dialog box.
Then I fill 'user' field and 'password' field leave empty.
Then I get error something like "empty passwords are not allowed".

What could I do?
This is a windows policy, probably Limit local account use of blank passwords to console logon only: http://technet.microsoft.com/en-us/l...8WS.10%29.aspx

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd December 2011, 12:49   #117
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Hello everyone,

thanks a lot for the great plugin! But I have troubles with UAC_AsUser_ExecShell / ExecShell - I want to execute an application as user but with administrative rights, because the launched application is storing some information in %APPDATA%.

- If I use ExecShell the information are stored in the administrators %APPDATA%

- If I user UAC_AsUser_ExecShell the information are stored in the users %APPDATA% BUT the application is not running in admin mode, so I can't changes files within my launched application.

Is there a way to run the application in admin mode but using the users scope variables?

Thank you very much!
klopfdreh is offline   Reply With Quote
Old 22nd December 2011, 15:16   #118
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by klopfdreh View Post
I want to execute an application as user but with administrative rights, because the launched application is storing some information in %APPDATA%.
This is not possible. Either it's running as admin, or it's running as user. It can never be both at the same time.

However, there is an easy solution to your problem: Use the UAC plugin to call a function as user (and make sure to use SYNCREGISTERS), and in that function copy the value of $APPDATA to a register:

Function SyncAppdata
setshellvarcontext current
StrCpy $0 $APPDATA
FunctionEnd

This way, you'll have the user's appdata path stored in $0, in the inner (admin) instance of your installer. Then, you can simply supply that user-appdata path as a commandline parameter to your application.


Edit: Here's two macros I created to do something similar, namely synching the contents of a variable, and synching the flags of sections, from outer to inner: http://pastebin.com/eM9MDUYL (Note that you shouldn't sync the $APPDATA variable using that syncvariable macro, because then the admin's $appdata will point to the wrong path. But you can modify it to suit your needs.)
MSG is offline   Reply With Quote
Old 23rd December 2011, 07:38   #119
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Thanks a lot - Im going to evaluate that solution, soon.
klopfdreh is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump