Skip to content

Commit

Permalink
When selecting to install to all users the shell will now be set in H…
Browse files Browse the repository at this point in the history
…KLM instead of HKCU. [#22 state:resolved]
  • Loading branch information
Tobbe committed Jan 21, 2009
1 parent ac69eb4 commit 35a94e4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 38 deletions.
17 changes: 10 additions & 7 deletions PageFinish.nsh
Expand Up @@ -16,23 +16,26 @@ Function SetupFinishPage
GoTo doneSettingUp
; ELSE IF ($hasStartedLS == TRUE)
StrCmp $hasStartedLS "true" 0 doneSettingUp
; Remove the "Run LiteStep" checkbox. LiteStep is already running.
; The box is not checked, so the "FinishRun" function will not run.
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Settings" "NumFields" "3"
doneSettingUp:
FunctionEnd

Function FinishRun
ReadRegDWORD $R7 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoRestartShell"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoRestartShell" 0

; Always kill LS
Push "$INSTDIR"
Call KillLS

; IF ($currentShell != litestep.exe)
StrCmp $currentShell "litestep.exe" execLS
MessageBox MB_OK $currentShell

${If} $currentShell == "litestep.exe"
Push "$INSTDIR"
Call KillLS
${Else}
KillProcDLL::KillProc $currentShell
Sleep 2000
execLS:
${EndIf}

ExecShell open "$INSTDIR\litestep.exe" ;Launch LiteStep
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoRestartShell" $R7
FunctionEnd
Expand Down
20 changes: 9 additions & 11 deletions SectionCore.nsh
Expand Up @@ -103,7 +103,10 @@
File ".\LS\NLM\*"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL

; Get the current shell
ReadIniStr $0 "system.ini" "boot" "shell"

; Strip the path, so we keep only the .exe name
${ExePath} $0 $0
${RIndexOf} $R0 $0 '\' ; Macro expands to 4 lines
; IF
Expand All @@ -125,22 +128,17 @@
StrCpy $currentShell "explorer.exe"

ReadINIStr $R0 "$PLUGINSDIR\ioHowLS.ini" "Field 4" "State" ;Field 4 is Don't set shell
IntCmp $R0 1 doneSetShell ;If we're not setting LS as the shell, we're jumping down
;to doneSetShell

${If} $R0 != 1
; Check whether we're installing on a 9x or NT based system
Call GetWindowsVersion
Pop $R0

StrCmp $R0 "9x" 0 setNTShell
${If} $R0 == "9x"
Call setShell9x
GoTo doneSetShell

setNTShell:
;If we get to this point we're not installing on a 9x based machine
Call setShellNT

doneSetShell:
${Else}
Call setShellNT
${EndIf}
${EndIf}
Pop $0

CreateShortCut "$DESKTOP\Set Explorer as Shell.lnk" '"$INSTDIR\utilities\wxlua.exe"' '"$INSTDIR\utilities\LOSS.lua" explorer' "$INSTDIR\losi\SetShellExplorer.ico"
Expand Down
43 changes: 23 additions & 20 deletions ShellNT.nsh
Expand Up @@ -2,7 +2,7 @@
# To do all this without rebooting or even logging off, this is what needs to be done:
# Change the Shell value in IniFileMappings, something like this:
# WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" "Shell" "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
# Refresh window's ini files cashe, something like this:
# Refresh Windows' ini files cache, something like this:
# WritePrivateProfileString(NULL, NULL, NULL, "system.ini") [C code]
# WriteINIStr "system.ini" <-- might work
# Change to the new shell, something like this:
Expand Down Expand Up @@ -31,23 +31,26 @@ Function setShellNT
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "DesktopProcess" 1

ReadINIStr $0 "$PLUGINSDIR\ioHowLS.ini" "Field 2" "State" ;Field 2 is All Users
IntCmp $0 1 +3 0 0

ReadINIStr $0 "$PLUGINSDIR\ioHowLS.ini" "Field 3" "State" ;Field 3 is Current User
IntCmp $0 1 +2 end

; Set shell folders to all users - only admins can do this
SetShellVarContext all

; -- Set as shell -- ;

; Tell Windows there might be a shell setting in HKCU
WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" "Shell" "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"

; Refresh window's ini files cashe
WriteINIStr "system.ini" "" "" ""

; Change to the new shell
WriteINIStr "system.ini" "boot" "shell" "$INSTDIR\litestep.exe"
end:
ReadINIStr $1 "$PLUGINSDIR\ioHowLS.ini" "Field 3" "State" ;Field 3 is Current User

${If} $0 == 1
${OrIf} $1 == 1
${If} $0 == 1
; All users

; Set shell folders to all users - only admins can do this
SetShellVarContext all
${Else}
; Current User

; Tell Windows there might be a shell setting in HKCU
WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" "Shell" "USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon"

; Refresh window's ini files cashe
WriteINIStr "system.ini" "" "" ""
${EndIf}

; Change to the new shell
WriteINIStr "system.ini" "boot" "shell" "$INSTDIR\litestep.exe"
${EndIf}
FunctionEnd

0 comments on commit 35a94e4

Please sign in to comment.