From 35a94e4c8442500aac66a34517803b83e147b26d Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Wed, 21 Jan 2009 16:45:42 -0500 Subject: [PATCH] When selecting to install to all users the shell will now be set in HKLM instead of HKCU. [#22 state:resolved] --- PageFinish.nsh | 17 ++++++++++------- SectionCore.nsh | 20 +++++++++----------- ShellNT.nsh | 43 +++++++++++++++++++++++-------------------- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/PageFinish.nsh b/PageFinish.nsh index 64622aa..1432d81 100644 --- a/PageFinish.nsh +++ b/PageFinish.nsh @@ -16,6 +16,8 @@ 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 @@ -23,16 +25,17 @@ 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 diff --git a/SectionCore.nsh b/SectionCore.nsh index d070d04..2fdd51e 100644 --- a/SectionCore.nsh +++ b/SectionCore.nsh @@ -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 @@ -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" diff --git a/ShellNT.nsh b/ShellNT.nsh index 81e52d0..dd5c202 100644 --- a/ShellNT.nsh +++ b/ShellNT.nsh @@ -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: @@ -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 \ No newline at end of file