Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 19th June 2009, 16:14   #1
arnaudTLSE
Junior Member
 
Join Date: Jun 2009
Posts: 2
Unhappy How to use the UAC Plugin ?

Hi everyone, first of all I'll ask you to excuse my English (yes, I'm French ).

I've got some troubles to make the UAC Plugin working...

I've read the following page : http://nsis.sourceforge.net/UAC_plug-in

And after having downloaded the zip file and read the examples given in it, I compiled them but none succeeded...

Then I just tried to insert the code given in the page in my .nsi :
First :
PHP Code:
RequestExecutionLevel user 
at the beginning of the script,

Then
PHP Code:
!include 'UAC.nsh' 
And to finish
PHP Code:
Attempt to give the UAC plug-in a user process and an admin process.
Function .
OnInit
 
UAC_Elevate
:
    
UAC::RunElevated 
    StrCmp 1223 
$0 UAC_ElevationAborted UAC dialog aborted by user?
    
StrCmp 0 $0 0 UAC_Err Error?
    
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
    
Quit
 
UAC_Err
:
    
MessageBox mb_iconstop "Unable to elevate, error $0"
    
Abort
 
UAC_ElevationAborted
:
    
# elevation was aborted, run as normal?
    
MessageBox mb_iconstop "This installer requires admin access, aborting!"
    
Abort
 
UAC_Success
:
    
StrCmp 1 $+;Admin?
    
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
    
MessageBox mb_iconstop "This installer requires admin access, try again"
    
goto UAC_Elevate 
 
FunctionEnd 
with my own functions.

But when I try to compile, I've got the following error :

Function: ".OnInit"
Invalid command: UAC::RunElevated
Error in script "C:\Users\Me\MyFolder\MyScript.nsi" on line 156 -- aborting creation process

I think I've missed something, the file UAC.nsh is in the same directory as the script (MyFolder).

Can anybody try to help me please ?
arnaudTLSE is offline   Reply With Quote
Old 19th June 2009, 16:20   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Put UAC.dll in the Plugins folder.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 19th June 2009, 22:28   #3
arnaudTLSE
Junior Member
 
Join Date: Jun 2009
Posts: 2
Thanks for you answer,

I'm going to test and let you know...
arnaudTLSE is offline   Reply With Quote
Old 15th July 2009, 10:17   #4
Gosev
Junior Member
 
Join Date: Jan 2005
Location: Paris, France
Posts: 8
Quote:
Originally posted by Afrow UK
Put UAC.dll in the Plugins folder.

Stu
Hi

In the package there's actually two UAC.dll, one in a A/ directory and one in U/.
I put the A one in Plugins (for no worthwhile reason) and when the installer asks for elevation it does so with a weird (random/temp) name. Should I have used the one in U/ (and does anyone know what the difference is ?)
Gosev is offline   Reply With Quote
Old 15th July 2009, 10:35   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
A=ansi (normal official nsis)
U=unicode (3rd party nsis version)

The installer command should look something like: c:\path\installer.exe /UAC:1234 /NCRC

The uninstaller on the other hand might be in %temp% and have a weird name, but thats how NSIS does it

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp 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