Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Writing to HKLM in Vista (http://forums.winamp.com/showthread.php?t=300379)

xbarns 27th November 2008 14:26

Writing to HKLM in Vista
 
Hello everyone,

i try writing to HKLM\Software\...... with one of my installers, i have defined

code:
RequestExecutionLevel admin


but it does not work, UAC is disabled on my machine.

Anyone know a quick workaround?

Btw. here is what i use to test

code:

; example1.nsi
;
; This script is perhaps one of the simplest NSIs you can make. All of the
; optional settings are left to their default settings. The installer simply
; prompts the user asking them where to install, and drops a copy of example1.nsi
; there.

;--------------------------------

; The name of the installer
Name "Example1"

; The file to write
OutFile "example1.exe"

; The default installation directory
InstallDir $DESKTOP\Example1

; Request application privileges for Windows Vista
RequestExecutionLevel admin

;--------------------------------

; Pages

Page directory
Page instfiles

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File example1.nsi

WriteRegStr HKLM "Software\My Company\My Software" "String Value" "dead beef"


SectionEnd ; end the section



Thanks in advance
xBarns

nsnb 27th November 2008 14:52

Call IsUserAdmin in your .onInit.

xbarns 27th November 2008 15:23

Well just so i can say i have done it, i have done that, it confirmed that the logged on user is an Administrator, but it still cannot write to HKLM\Software.....

Any other ideas?

Anders 27th November 2008 15:24

This is a bug in vista, when UAC is off and you are running as non-admin, elevation does not work. So you can check in oninit and display a message, or you can use the UAC plugin to elevate, it has built in manual elevation to work around this bug

xbarns 27th November 2008 15:34

Quote:

This is a bug in vista, when UAC is off and you are running as non-admin, elevation does not work.
UAC is off but I AM an admin.

nsnb 27th November 2008 15:37

Do you have in your sections the following?
Quote:

SetShellVarContext all

xbarns 27th November 2008 15:47

Quote:

Do you have in your sections the following? quote:SetShellVarContext all
for writing to the registry ?

Anders 27th November 2008 16:15

If you are admin, nothing should be stopping you from writing to HKLM, you could try Process Monitor from sysinternals and see if it gives you any clues (ERROR_ACCESS_DENIED etc)

xbarns 27th November 2008 16:35

Wow, thanks for the tip, i now know where it writes my entries, it seems since i am on a Vista 64-bit Machine that it "reflects" registry entries from 32-bit apps to:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\My Company\My Software

and here MS says why:

http://support.microsoft.com/?scid=k...5097&x=15&y=19

Nice to know, but that redirector seems to work, at least it reads from there also without any manual intervention.

Anders 27th November 2008 17:53

SetRegView might be of help


All times are GMT. The time now is 05:16.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.