Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

All users on the computer should now get their own copy of the themes…

… folder and personal files.

[#23 state:resolved]
  • Loading branch information...
commit 943e3d762c0199070f95a495501bb511e16a9288 1 parent 8cb702a
@Tobbe Tobbe authored
View
53 BackupPersonal.nsh
@@ -1,15 +1,42 @@
+!include LogicLib.nsh
+
Function backupPersonal
- IfFileExists "$whereprofiles\personal\personal.rc" 0 end
-
- ; We got here, that means there are old personal files
- ; that we maybe should back up...
-
- MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(BACKUP_PERSONAL) IDNO end
-
- CreateDirectory "$whereprofiles\personal\backup"
- CopyFiles "$whereprofiles\personal\*" "$whereprofiles\personal\backup\"
-
- MessageBox MB_OK $(BACKUP_DONE)
-
-end:
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+
+ StrCpy $3 "not_asked"
+
+ ${whereprofilesarray->SizeOf} $R1 $R2 $R3
+ IntOp $0 $R3 - 1
+
+ ${For} $1 0 $0 ; $1 from 0 to size-1
+ ${whereprofilesarray->Read} $2 $1
+
+ ${If} ${FileExists} "$2\personal\personal.rc"
+
+ ; We got here, that means there are old personal files
+ ; that we maybe should backup...
+
+ ${If} $3 == "not_asked"
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(BACKUP_PERSONAL) IDNO end
+ StrCpy $3 "asked"
+ ${EndIf}
+
+ CreateDirectory "$2\personal\backup"
+ CopyFiles "$2\personal\*" "$2\personal\backup\"
+
+ StrCpy $langWhereProfiles $2
+
+ MessageBox MB_OK $(BACKUP_DONE)
+ ${EndIf}
+ ${Next}
+
+ end:
+
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
FunctionEnd
View
324 EnumLoginUsers.nsh
@@ -0,0 +1,324 @@
+!ifndef ENUM_LOGIN_USERS_NSH
+!define ENUM_LOGIN_USERS_NSH
+
+!include EnumerateUsers.nsh
+!include LogicLib.nsh
+!include IndexOf.nsh
+!include NSISArray.nsh
+
+${Array} EnumLoginUsersArray 5 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} Shift
+${ArrayFunc} SizeOf
+${ArrayFunc} Swap
+${ArrayFunc} Debug
+
+Function EnumLoginUsers
+ Push $0 ; Array name -- not used
+ Push $1 ; General return values
+ Push $2 ; Temp
+ Push $3 ; Temp
+ Push $4 ; Added user
+ Push $5
+ Push $6 ; Array index
+ Push $7 ; Number of users
+ Push $8 ; For loop counter
+ Push $9 ; User name
+
+ ; Done elsewhere ${EnumLoginUsersArray->Init}
+
+ StrCpy $6 0 ; Initialize array index
+ StrCpy $4 "FALSE" ; Initialize Added user value
+
+ ${EnumerateUsers} ""
+
+ ${EnumerateUsersArray->SizeOf} $1 $1 $1
+ IntOp $7 $1 - 1
+ ${For} $8 0 $7 ; $8 from 0 to size-1
+ StrCpy $4 "FALSE" ; Reset Added user value
+
+ ;NSISArray::Read /NOUNLOAD EnumLoginUsersUserArray $8
+ ;Pop $9 ; Store user name in $9
+ ${EnumerateUsersArray->Read} $9 $8
+
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-544" ; Administrators
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Administrators group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ;NSISArray::Write /NOUNLOAD $0 $6 "$9"
+ ${EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+
+ ${If} $4 == "FALSE"
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-545" ; Users
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Users group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ;NSISArray::Write /NOUNLOAD $0 $6 "$9"
+ ${EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $4 == "FALSE"
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-547" ; Power users
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Power users group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ;NSISArray::Write /NOUNLOAD $0 $6 "$9"
+ ${EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+ ${EndIf}
+ ${Next}
+
+
+ ; Move the name of the currently logged in used
+ ; to the start of the array
+
+ UserMgr::GetCurrentUserName
+ Pop $1
+
+ ${EnumLoginUsersArray->SizeOf} $2 $2 $2
+ IntOp $7 $2 - 1
+ StrCpy $3 -1
+ ${For} $8 0 $7 ; $8 from 0 to size-1
+ ${EnumLoginUsersArray->Read} $9 $8
+
+ ${If} $9 == $1
+ StrCpy $3 $8
+ IntOp $8 $7 + 1 ; End loop
+ ${EndIf}
+ ${Next}
+
+ ;NSISArray::Swap /NOUNLOAD $0 0 $3
+ ${EnumLoginUsersArray->Swap} 0 $3
+
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+!macro EnumLoginUsers
+ Call EnumLoginUsers
+!macroend
+
+!define EnumLoginUsers "!insertmacro EnumLoginUsers"
+
+
+
+${Array} un.EnumLoginUsersArray 5 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} Shift
+${ArrayFunc} SizeOf
+${ArrayFunc} Swap
+
+Function un.EnumLoginUsers
+ Push $0 ; Array name -- not used
+ Push $1 ; General return values
+ Push $2 ; Temp
+ Push $3 ; Temp
+ Push $4 ; Added user
+ Push $5
+ Push $6 ; Array index
+ Push $7 ; Number of users
+ Push $8 ; For loop counter
+ Push $9 ; User name
+
+ ${un.EnumLoginUsersArray->Init}
+
+ StrCpy $6 0 ; Initialize array index
+ StrCpy $4 "FALSE" ; Initialize Added user value
+
+ ${un.EnumerateUsers} ""
+
+ ${un.EnumerateUsersArray->SizeOf} $1 $1 $1
+ IntOp $7 $1 - 1
+ ${For} $8 0 $7 ; $8 from 0 to size-1
+ StrCpy $4 "FALSE" ; Reset Added user value
+
+ ;NSISArray::Read /NOUNLOAD EnumLoginUsersUserArray $8
+ ;Pop $9 ; Store user name in $9
+ ${un.EnumerateUsersArray->Read} $9 $8
+
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-544" ; Administrators
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${un.RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Administrators group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ${un.EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+
+ ${If} $4 == "FALSE"
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-545" ; Users
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${un.RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Users group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ${un.EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $4 == "FALSE"
+ UserMgr::GetLocalizedStdAccountName "S-1-5-32-547" ; Power users
+ Pop $1
+
+ ; Save everything to the right of the last backslash
+ ${un.RIndexOf} $2 $1 "\"
+ StrLen $3 $1
+ IntOp $3 $3 - $2
+ IntOp $3 $3 + 1
+ StrCpy $1 $1 "" $3
+
+ UserMgr::IsMemberOfGroup "$9" "$1" ; Is the user in the Power users group?
+ Pop $1
+
+ ${If} $1 == "TRUE"
+ UserMgr::HasPrivilege "$9" "SeDenyInteractiveLogonRight"
+ Pop $1
+
+ ${If} $1 != "TRUE"
+ ${un.EnumLoginUsersArray->Write} $6 "$9"
+ IntOp $6 $6 + 1
+ ${EndIf}
+
+ StrCpy $4 "TRUE"
+ ${EndIf}
+ ${EndIf}
+ ${Next}
+
+
+ ; Move the name of the currently logged in used
+ ; to the start of the array
+
+ UserMgr::GetCurrentUserName
+ Pop $1
+
+ ${un.EnumLoginUsersArray->SizeOf} $2 $2 $2
+ IntOp $7 $2 - 1
+ StrCpy $3 -1
+ ${For} $8 0 $7 ; $8 from 0 to size-1
+ ${un.EnumLoginUsersArray->Read} $9 $8
+
+ ${If} $9 == $1
+ StrCpy $3 $8
+ IntOp $8 $7 + 1 ; End loop
+ ${EndIf}
+ ${Next}
+
+ ${un.EnumLoginUsersArray->Swap} 0 $3
+
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+!macro un.EnumLoginUsers
+ Call un.EnumLoginUsers
+!macroend
+
+!define un.EnumLoginUsers "!insertmacro un.EnumLoginUsers"
+
+!endif
View
137 EnumerateUsers.nsh
@@ -0,0 +1,137 @@
+!ifndef ENUMERATE_USERS_NSH
+!define ENUMERATE_USERS_NSH
+
+# Enumerate the local users
+# http://nsis.sourceforge.net/User_Management_using_API_calls#Enumerate_all_users
+# Small modifications made by me (Tobbe)
+#
+# Usage:
+# !include NSISArray.nsh
+# ${EnumerateUsers} "\\ComputerName" "LocalUsersArray"
+
+${Array} "EnumerateUsersArray" 10 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} Shift
+${ArrayFunc} SizeOf
+${ArrayFunc} Inited
+${ArrayFunc} Clear
+${ArrayFunc} Debug
+
+!macro EnumerateUsers SERVER_NAME
+ Push $R0
+ Push $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ !define IndexEnumUsrs "Line${__LINE__}"
+
+ # NET_API_STATUS NetUserEnum(
+ # __in LPCWSTR servername,
+ # __in DWORD level, // 0 - Return user account names.
+ # __in DWORD filter, // 2 - Enumerates global user account data on a computer.
+ # __out LPBYTE *bufptr,
+ # __in DWORD prefmaxlen,
+ # __out LPDWORD entriesread,
+ # __out LPDWORD totalentries,
+ # __inout LPDWORD resume_handle // If resume_handle is NULL, then no resume handle is stored.
+ # );
+
+ # $R1 holds the number of entries processed
+ System::Call 'netapi32::NetUserEnum(w "${SERVER_NAME}", i 0, i 2, *i .R0, i ${NSIS_MAX_STRLEN}, *i .R1, *i .R2, i n) i .R3'
+ StrCpy $R2 $R0 ; Needed to free the buffer later
+
+ ${EnumerateUsersArray->Init}
+
+ # check for error
+ StrCmp $R3 0 +1 ${IndexEnumUsrs}-end
+
+ StrCpy $R4 0
+ ${IndexEnumUsrs}-loop:
+ StrCmp $R4 $R1 ${IndexEnumUsrs}-stop +1
+ System::Call '*$R0(w.R3)'
+ ${EnumerateUsersArray->Write} $R4 "$R3"
+ IntOp $R0 $R0 + 4 ; Go to next pointer
+ IntOp $R4 $R4 + 1
+ Goto ${IndexEnumUsrs}-loop
+ ${IndexEnumUsrs}-stop:
+
+ # Check that the size of the array is equal to the number of users on the computer
+ ${EnumerateUsersArray->SizeOf} $R7 $R8 $R0
+ StrCmp $R0 $R1 ${IndexEnumUsrs}-end
+ MessageBox MB_OK|MB_ICONEXCLAMATION 'Could not place all the user accounts into an array!'
+
+ ${IndexEnumUsrs}-end:
+
+ # Cleanup
+ StrCmp $R2 0 +2
+ System::Call 'netapi32.dll::NetApiBufferFree(i R2) i .R0'
+
+ !undef IndexEnumUsrs
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+!macroend
+
+!define EnumerateUsers "!insertmacro EnumerateUsers"
+
+
+
+
+
+${Array} "un.EnumerateUsersArray" 10 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} SizeOf
+
+!macro un.EnumerateUsers SERVER_NAME
+ Push $R0
+ Push $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ !define IndexEnumUsrs "Line${__LINE__}"
+
+ # $R1 holds the number of entries processed
+ System::Call 'netapi32::NetUserEnum(w "${SERVER_NAME}", i 0, i 2, *i .R0, i ${NSIS_MAX_STRLEN}, *i .R1, *i .R2, i n) i .R3'
+ StrCpy $R2 $R0 ; Needed to free the buffer later
+
+ ${un.EnumerateUsersArray->Init}
+
+ # check for error
+ StrCmp $R3 0 +1 ${IndexEnumUsrs}-end
+
+ StrCpy $R4 0
+ ${IndexEnumUsrs}-loop:
+ StrCmp $R4 $R1 ${IndexEnumUsrs}-stop +1
+ System::Call '*$R0(w.R3)'
+ ${un.EnumerateUsersArray->Write} $R4 "$R3"
+ IntOp $R0 $R0 + 4 ; Go to next pointer
+ IntOp $R4 $R4 + 1
+ Goto ${IndexEnumUsrs}-loop
+ ${IndexEnumUsrs}-stop:
+
+ # Check that the size of the array is equal to the number of users on the computer
+ ${un.EnumerateUsersArray->SizeOf} $R7 $R8 $R0
+ StrCmp $R0 $R1 ${IndexEnumUsrs}-end
+ MessageBox MB_OK|MB_ICONEXCLAMATION 'Could not place all the user accounts into an array!'
+
+ ${IndexEnumUsrs}-end:
+
+ # Cleanup
+ StrCmp $R2 0 +2
+ System::Call 'netapi32.dll::NetApiBufferFree(i R2) i .R0'
+
+ !undef IndexEnumUsrs
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+!macroend
+
+!define un.EnumerateUsers "!insertmacro un.EnumerateUsers"
+
+!endif
View
3  Evars.nsh
@@ -217,7 +217,8 @@ Function WriteEvars
;-----------------------
;Open the file, write the data, close the file
ClearErrors
- FileOpen $tmp $whereprofiles\personal\evars.rc w
+ ${whereprofilesarray->Read} $tmp 0
+ FileOpen $tmp "$tmp\personal\evars.rc" w
IfErrors error
FileWrite $tmp ';------------------------------------------------------------------------------$\r$\n'
View
31 HiddenSectionTheme.nsh
@@ -1,14 +1,25 @@
!ifndef HIDDEN_SECTION_THEME
!define HIDDEN_SECTION_THEME
- !include LogicLib.nsh
- Section "-HiddenSectionTheme"
+!include LogicLib.nsh
+
+Section "-HiddenSectionTheme"
+ Push $0
+ Push $1
+ Push $2
+
+ ${whereprofilesarray->SizeOf} $1 $1 $0
+ IntOp $0 $0 - 1
+
+ ${For} $1 0 $0 ; $1 from 0 to size-1
+ ${whereprofilesarray->Read} $2 $1
+
; OTS2 Theme files
- IfFileExists "$whereprofiles\themes\themeslist.rc" 0 AddThemeFiles
- IfFileExists "$whereprofiles\themes\themeselect.rc" SkipThemeFiles
-
+ IfFileExists "$2\themes\themeslist.rc" 0 AddThemeFiles
+ IfFileExists "$2\themes\themeselect.rc" SkipThemeFiles
+
AddThemeFiles:
- SetOutPath "$whereprofiles\themes\"
+ SetOutPath "$2\themes\"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
SetOverwrite off
!ifdef SECTION_THEME
@@ -25,5 +36,11 @@
SetOverwrite on
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SkipThemeFiles:
- SectionEnd
+ ${Next}
+
+ Pop $2
+ Pop $1
+ Pop $0
+SectionEnd
+
!endif
View
32 IndexOf.nsh
@@ -78,4 +78,36 @@ FunctionEnd
!macroend
!define RIndexOf "!insertmacro RIndexOf"
+
+Function un.RIndexOf
+ Exch $R0
+ Exch
+ Exch $R1
+ Push $R2
+ Push $R3
+
+ StrCpy $R3 $R0
+ StrCpy $R0 0
+ IntOp $R0 $R0 + 1
+ StrCpy $R2 $R3 1 -$R0
+ StrCmp $R2 "" +2
+ StrCmp $R2 $R1 +2 -3
+
+ StrCpy $R0 -1
+
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Exch $R0
+FunctionEnd
+
+!macro un.RIndexOf Var Str Char
+ Push "${Char}"
+ Push "${Str}"
+ Call un.RIndexOf
+ Pop "${Var}"
+!macroend
+
+!define un.RIndexOf "!insertmacro un.RIndexOf"
+
!endif
View
35 LOSI.nsi
@@ -4,6 +4,7 @@
; KillProcDLL I had no luck with that)
; ShutDown
; NSISArray (And the header that comes with it)
+; UserMgr
; You will also need the include header "Advanced Uninstall Log NSIS Header"
; Make sure you get the modified version that has support for localization
@@ -13,7 +14,7 @@
var currentShell
var hasStartedLS
var username
-var whereprofiles
+var langWhereProfiles
var abortWarning
var advancedInstall
@@ -44,6 +45,27 @@ SetCompressor bzip2
!insertmacro UNATTENDED_UNINSTALL ;Keep all files we didn't install without asking
;--------------------------------
+; NSISArray
+!include NSISArray.nsh
+${Array} whereprofilesarray 5 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} Shift
+${ArrayFunc} SizeOf
+${ArrayFunc} Clear
+${ArrayFunc} Debug
+
+${Array} un.whereprofilesarray 5 ${NSIS_MAX_STRLEN}
+${ArrayFunc} Read
+${ArrayFunc} Write
+${ArrayFunc} Shift
+${ArrayFunc} SizeOf
+${ArrayFunc} Clear
+${ArrayFunc} Debug
+
+
+
+;--------------------------------
;MUI Settings
!define MUI_HEADERIMAGE
@@ -139,9 +161,11 @@ Function .onInit
Pop $username
ClearErrors ; UserInfo might genrate an error, but we don't care
- StrCpy $whereprofiles "$PROGRAMFILES\LiteStep\Profiles\$username"
+ ; Set a default profiles directory
+ ${whereprofilesarray->Init}
+ ${whereprofilesarray->Shift} "$PROGRAMFILES\LiteStep\Profiles\$username"
- !insertmacro MUI_LANGDLL_DISPLAY
+ !insertmacro MUI_LANGDLL_DISPLAY
;Always prepare the log within the .onInit function
!insertmacro UNINSTALL.LOG_PREPARE_INSTALL
@@ -162,11 +186,12 @@ FunctionEnd
Function .onGUIEnd
!ifdef PAGE_CONFIG_EVARS
- ${EvarNames->Inited} 0 dontDeleteArrays
+ ${EvarNames->Inited} 0 dontDeleteEvarArrays
${InputHwnds->Delete}
${EvarNames->Delete}
${EvarPaths->Delete}
- dontDeleteArrays:
+ dontDeleteEvarArrays:
+ ${whereprofilesarray->Delete}
!endif
FunctionEnd
View
8 LanguageStrings.nsh
@@ -69,7 +69,7 @@ LangString UNLOG_EMPTY_DIR ${LANG_ENGLISH} "Previous installation detected at $0
LangString UNLOG_ERROR_LOG ${LANG_ENGLISH} "Error in log ${UNINSTALL_LOG}."
LangString UNLOG_ERROR_CREATE ${LANG_ENGLISH} "Error creating ${UNINSTALL_LOG}."
LangString BACKUP_PERSONAL ${LANG_ENGLISH} "Do you want to backup your old personal files?"
-LangString BACKUP_DONE ${LANG_ENGLISH} "Your old files can be found in the folder $whereprofiles\backup\"
+LangString BACKUP_DONE ${LANG_ENGLISH} "Your old files can be found in the folder $langWhereProfiles\personal\backup\"
LangString MB_FOUND_LS_UNINST ${LANG_ENGLISH} "LiteStep should now be killed so the core files can be deleted. If it is not, please manually kill LS, either by pressing ctrl-alt-F1 then quit, issuing !quit or by using the TaskManager. Then press OK."
LangString FINISH_LOGOFF ${LANG_ENGLISH} "I want to log off"
LangString BAD_INST_PATH ${LANG_ENGLISH} "The specified install path is invalid!"
@@ -140,7 +140,7 @@ LangString UNLOG_EMPTY_DIR ${LANG_SWEDISH} "Tidigare installation hittad i $0.$\
LangString UNLOG_ERROR_LOG ${LANG_SWEDISH} "Fel i loggfil ${UNINSTALL_LOG}."
LangString UNLOG_ERROR_CREATE ${LANG_SWEDISH} "Gick inte att skapa ${UNINSTALL_LOG}."
LangString BACKUP_PERSONAL ${LANG_SWEDISH} "Vill du spara dina gammla personliga filer?"
-LangString BACKUP_DONE ${LANG_SWEDISH} "Du hittar dina gammla filer i mappen $whereprofiles\backup\"
+LangString BACKUP_DONE ${LANG_SWEDISH} "Du hittar dina gammla filer i mappen $langWhereProfiles\personal\backup\"
LangString MB_FOUND_LS_UNINST ${LANG_SWEDISH} "LiteStep ska nu vara avstängt så att kärnfilerna kan tas bort. Om det inte är det, var snäll och stäng av LS genom att antingen trycka ctrl-alt-F1 och välja quit, köra !quit, eller genom att stänga av det genom aktivitetshanteraren. Tryck sedan OK."
LangString FINISH_LOGOFF ${LANG_SWEDISH} "Jag vill logga ut"
LangString BAD_INST_PATH ${LANG_SWEDISH} "Ogiltig installationssökväg!"
@@ -211,7 +211,7 @@ LangString UNLOG_EMPTY_DIR ${LANG_FRENCH} "Une pr
LangString UNLOG_ERROR_LOG ${LANG_FRENCH} "Erreur dans le fichier ${UNINSTALL_LOG}."
LangString UNLOG_ERROR_CREATE ${LANG_FRENCH} "Echec lors de la création du fichier ${UNINSTALL_LOG}."
LangString BACKUP_PERSONAL ${LANG_FRENCH} "Voulez-vous faire une copie de sauvegarde de vos anciens fichiers personnels ?"
-LangString BACKUP_DONE ${LANG_FRENCH} "Vous pourrez retrouver vos anciens fichiers de configuration dans le dossier $whereprofiles\backup\."
+LangString BACKUP_DONE ${LANG_FRENCH} "Vous pourrez retrouver vos anciens fichiers de configuration dans le dossier $langWhereProfiles\personal\backup\."
LangString MB_FOUND_LS_UNINST ${LANG_FRENCH} "Litestep va maintenant être déchargé afin d'effacer les fichiers encore chargé. Si ce n'est pas le cas, merci de le faire manuellement en utilisant le menu popup ou par la commande bang !quit; le cas échéant, avec la combinaison de touche Ctrl-Alt-F1 (Quitter... / Forcer...), ou a l'aide du Gestionnaire de Tâches. Ensuite validez par OK."
LangString FINISH_LOGOFF ${LANG_FRENCH} "Je désire fermer la session."
LangString BAD_INST_PATH ${LANG_FRENCH} "Install path invalid!"
@@ -282,7 +282,7 @@ LangString UNLOG_EMPTY_DIR ${LANG_GERMAN} "Vorhergehende Installation in $0 gefu
LangString UNLOG_ERROR_LOG ${LANG_GERMAN} "Fehler in Protokoll ${UNINSTALL_LOG}."
LangString UNLOG_ERROR_CREATE ${LANG_GERMAN} "Fehler beim erstellen von ${UNINSTALL_LOG}."
LangString BACKUP_PERSONAL ${LANG_GERMAN} "Wollen Sie Ihre alten Persönlichen Einstellungen sichern?"
-LangString BACKUP_DONE ${LANG_GERMAN} "Ihre alten Einstellungen finden Sie unter $whereprofiles\backup\"
+LangString BACKUP_DONE ${LANG_GERMAN} "Ihre alten Einstellungen finden Sie unter $langWhereProfiles\personal\backup\"
LangString MB_FOUND_LS_UNINST ${LANG_GERMAN} "LiteStep sollte nun beendet werden damit die Core-Dateien gelöscht werden können. Falls LiteStep noch läuft beenden Sie es entweder mit Strg+Alt+F1 -> LiteStep beenden, !quit oder mit Hilfe des TaskManagers (Strg+Shift+Esc). Drücken Sie danach OK."
LangString FINISH_LOGOFF ${LANG_GERMAN} "Abmelden"
LangString BAD_INST_PATH ${LANG_GERMAN} "Das gewählte Verzeichnis ist nicht zur Installation geeignet!"
View
98 SectionCore.nsh
@@ -8,6 +8,7 @@
!include ShellNT.nsh
!include GetWindowsVersion.nsh
!include SectionsInclude.nsh
+ !include EnumLoginUsers.nsh
Section "$(NAME_SecCore)" SecCore
${If} ${FileExists} "$INSTDIR\litestep.exe"
@@ -16,6 +17,8 @@
Pop $R9
${EndIf}
+ ${ArrayErrorStyle} MsgBox
+
SetOutPath "$SYSDIR"
SetOverwrite off
@@ -29,23 +32,63 @@
SetOverwrite on
SetOutPath "$INSTDIR"
+ ${EnumLoginUsersArray->Init}
+
+ ReadINIStr $0 "$PLUGINSDIR\ioHowLS.ini" "Field 2" "State" ;Field 2 is All Users
+ ${If} $0 == 1
+ ; Installing for all users
+ ${EnumLoginUsers}
+ ${Else}
+ UserInfo::GetName
+ Pop $username
+ ${EnumLoginUsersArray->Shift} "$username"
+ ${EndIf}
+
Push $0
Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ ${whereprofilesarray->Clear}
+
ReadINIStr $0 "$PLUGINSDIR\ioWhereProfiles.ini" "Field 4" "State" ;Field 4 is Documents and Settings
ReadINIStr $1 "$PLUGINSDIR\ioWhereProfiles.ini" "Field 3" "State" ;Field 3 is LSDir\Profiles
${If} $0 == 1
; Install to Documents and Settings
- StrCpy $whereprofiles "$APPDATA\LiteStep"
+
+ ${RIndexOf} $2 $PROFILE '\'
+ StrCpy $2 $PROFILE -$2
+
+ ${RIndexOf} $3 $APPDATA '\'
+ StrCpy $3 $APPDATA "" -$3
+
+ ${EnumLoginUsersArray->SizeOf} $4 $4 $4 ; Only the last is needed
+ IntOp $4 $4 - 1
+
+ ${For} $5 0 $4 ; $5 from 0 to size-1
+ ${EnumLoginUsersArray->Read} $6 $5
+
+ ; Will append something like
+ ; C:\Documents and Settings\<username>\Application Data\LiteStep
+ ; on to the array
+ ${whereprofilesarray->Shift} "$2\$6$3\LiteStep"
+ ${Next}
+
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-das\step.rc" ;das = Documents and Settings :p
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
${ElseIf} $1 == 1
; Install to LSDir\Profiles
+
UserInfo::GetName
Pop $username
${If} $username == ""
- ; If we get here it means no username was found, probably due to installing on 9x when not logged in
+ ; If we get here it means no username was found, probably due
+ ; to installing on 9x when not logged in
MessageBox MB_OK $(MB_NO_USER)
; Don't install any profiles
@@ -53,7 +96,17 @@
StrCpy $1 0
${EndIf}
- StrCpy $whereprofiles "$INSTDIR\Profiles\$username"
+ ${EnumLoginUsersArray->SizeOf} $2 $2 $2
+ IntOp $2 $2 - 1
+
+ ${For} $3 0 $2 ; $3 from 0 to size-1
+ ${EnumLoginUsersArray->Read} $4 $3
+
+ ; Will append something like
+ ; C:\Program Files\LOSI\Profiles\<username> on to the array
+ ${whereprofilesarray->Shift} "$INSTDIR\Profiles\$4"
+ ${Next}
+
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-lsdir\step.rc"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
@@ -62,28 +115,37 @@
${If} $0 == 0
${AndIf} $1 == 0
; Don't install any profiles
- StrCpy $whereprofiles "$INSTDIR"
+
+ ${whereprofilesarray->Shift} "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\step-none\step.rc"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
${EndIf}
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
Pop $1
Pop $0
;; Store a few paths in the registry
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "LitestepDir" $INSTDIR
- ${If} $whereprofiles == "$INSTDIR\Profiles\$username"
+ ${whereprofilesarray->Read} $0 0
+
+ ${If} $0 == "$INSTDIR\Profiles\$username"
WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "$INSTDIR\Profiles\%USERNAME%"
- ${ElseIf} $whereprofiles == "$APPDATA\LiteStep"
- WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "%APPDATA%\Litestep"
+ WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "PersonalDir" "$INSTDIR\Profiles\%USERNAME%\personal"
+ ${ElseIf} $0 == "$APPDATA\LiteStep"
+ WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "%APPDATA%\LiteStep"
+ WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "PersonalDir" "%APPDATA%\LiteStep\personal"
${Else}
- WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" $whereprofiles
+ WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir" "$0"
+ WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "PersonalDir" "$0\personal"
${EndIf}
- WriteRegStr HKLM "Software\${PRODUCT_NAME}\Installer" "PersonalDir" "$whereprofiles\personal"
-
SetOutPath "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ".\LS\changes.txt"
@@ -156,10 +218,18 @@
call backupPersonal
; Install the personal files
- SetOutPath "$whereprofiles\personal"
- ; Don't log these files, they are removed the traditional way
- ;!insertmacro UNINSTALL.LOG_OPEN_INSTALL
- File /r /x ".svn" ".\Personal\personal\*"
+
+ ${whereprofilesarray->SizeOf} $1 $2 $0
+ IntOp $0 $0 - 1
+
+ ${For} $1 0 $0 ; $1 from 0 to size-1
+ ${whereprofilesarray->Read} $2 $1
+
+ SetOutPath "$2\personal"
+ ; Don't log these files, they are removed the traditional way
+ ;!insertmacro UNINSTALL.LOG_OPEN_INSTALL
+ File /r /x ".svn" ".\Personal\personal\*"
+ ${Next}
${If} $R9 == "LSKilled"
ExecShell open "$INSTDIR\litestep.exe" ;Launch LiteStep
View
50 SectionLOSI.nsh
@@ -1,23 +1,35 @@
!ifndef SECTION_LOSI
!define SECTION_LOSI
- !include SectionsInclude.nsh
+
+!include SectionsInclude.nsh
+
+Section "$(NAME_SecLosi)" SecLosi
+ ; Installer related stuff
+ SetOutPath "$INSTDIR\LOSI"
+ !insertmacro UNINSTALL.LOG_OPEN_INSTALL
+ File ".\LS\losi\*"
+ !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
+
+ ; Install the utilities
+ SetOutPath "$INSTDIR\utilities"
+ !insertmacro UNINSTALL.LOG_OPEN_INSTALL
+ File ".\LS\utilities\*"
+ !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
+
+ ; Write some registry settings that SLI-ThemeManager needs
+ Push $0
+ ${whereprofilesarray->Read} $0 0
+ ${If} $0 == "$INSTDIR\Profiles\$username"
+ WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "ThemesDir" "$INSTDIR\Profiles\%USERNAME%\themes\"
+ ${ElseIf} $0 == "$APPDATA\LiteStep"
+ WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "ThemesDir" "%APPDATA%\LiteStep\themes\"
+ ${Else}
+ WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "ThemesDir" "$0\themes\"
+ ${EndIf}
+ Pop $0
- Section "$(NAME_SecLosi)" SecLosi
- ; Installer related stuff
- SetOutPath "$INSTDIR\LOSI"
- !insertmacro UNINSTALL.LOG_OPEN_INSTALL
- File ".\LS\losi\*"
- !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
-
- ; Install the utilities
- SetOutPath "$INSTDIR\utilities"
- !insertmacro UNINSTALL.LOG_OPEN_INSTALL
- File ".\LS\utilities\*"
- !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
-
- ; Write some registry settings that SLI-ThemeManager needs
- WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "LitestepDir" "$INSTDIR\"
- WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "ThemesDir" "$whereprofiles\themes\"
- WriteRegDword HKCU "Software\Litestep\SLI\ThemeManager" "SecurityTimeout" 2
- SectionEnd
+ WriteRegStr HKCU "Software\Litestep\SLI\ThemeManager" "LitestepDir" "$INSTDIR\"
+ WriteRegDword HKCU "Software\Litestep\SLI\ThemeManager" "SecurityTimeout" 2
+SectionEnd
+
!endif
View
27 SectionTheme.nsh
@@ -1,11 +1,28 @@
!ifndef SECTION_THEME
!define SECTION_THEME
- !include SectionsInclude.nsh
-
- Section "$(NAME_SecTheme)" SecTheme
- SetOutPath "$whereprofiles\themes\InstDef"
+
+!include SectionsInclude.nsh
+
+Section "$(NAME_SecTheme)" SecTheme
+ Push $0
+ Push $1
+ Push $2
+
+ ${whereprofilesarray->SizeOf} $1 $1 $0
+ IntOp $0 $0 - 1
+
+ ${For} $1 0 $0 ; $1 from 0 to size-1
+ ${whereprofilesarray->Read} $2 $1
+
+ SetOutPath "$2\themes\InstDef"
; Don't log these files, they are removed the traditional way
;!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /r /x ".svn" ".\Personal\themes\InstDef\*"
- SectionEnd
+ ${Next}
+
+ Pop $2
+ Pop $1
+ Pop $0
+SectionEnd
+
!endif
View
123 Uninstaller.nsh
@@ -2,11 +2,12 @@
!define WRITE_UNINSTALLER
!include uninstShell9x.nsh
!include GetWindowsVersion.nsh
- !include unStartExplorer.nsh
+ !include unStartExplorer.nsh
+ !include IndexOf.nsh
!ifdef PAGE_FILE_ASSOC
!include RegisterExtension.nsh
- !endif
+ !endif
!insertmacro MUI_UNPAGE_INSTFILES
@@ -111,10 +112,6 @@
call un.DeAssociateFile
!endif
- ;; Get regstrings to know where some of the stuff are
- ReadRegStr $whereprofiles HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir"
- ExpandEnvStrings $whereprofiles $whereprofiles
-
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$DESKTOP\Set Explorer as Shell.lnk"
Delete "$DESKTOP\Set LiteStep as Shell.lnk"
@@ -152,31 +149,99 @@
DetailPrint "Trying to start explorer again"
Call un.StartExplorer
${EndIf}
-
-
+
+
+ ;; Get regstrings to know where some of the stuff are
+ ReadRegStr $0 HKLM "Software\${PRODUCT_NAME}\Installer" "ProfilesDir"
+
+ ${ArrayErrorStyle} MsgBox
+
+ ${un.whereprofilesarray->Init}
+
+ ${un.EnumLoginUsers}
+
+ ${un.RIndexOf} $1 $PROFILE '\'
+ StrCpy $1 $PROFILE -$1
+ StrLen $2 $1
+ StrCpy $2 $0 $2
+ StrLen $3 "$INSTDIR\Profiles\"
+ StrCpy $3 $0 $3
+
+ ${If} $0 == "%APPDATA%\LiteStep"
+ ; Documents and Settings
+
+ ${un.RIndexOf} $3 $APPDATA '\'
+ StrCpy $3 $APPDATA "" -$3
+
+ ${un.EnumLoginUsersArray->SizeOf} $4 $4 $4
+ IntOp $4 $4 - 1
+
+ ${For} $5 0 $4 ; $5 from 0 to size-1
+ ${un.EnumLoginUsersArray->Read} $6 $5
+
+ ; Will append something like
+ ; C:\Documents and Settings\<username>\Application Data\LiteStep
+ ; on to the array
+ ${un.whereprofilesarray->Shift} "$1\$6$3\LiteStep"
+ ${Next}
+ ${ElseIf} $3 == "$INSTDIR\Profiles\"
+ ${un.EnumLoginUsersArray->SizeOf} $2 $2 $2
+ IntOp $2 $2 - 1
+
+ ${For} $3 0 $2 ; $3 from 0 to size-1
+ ${un.EnumLoginUsersArray->Read} $4 $3
+
+ ; Will append something like
+ ; C:\Program Files\LOSI\Profiles\<username> on to the array
+ ${un.whereprofilesarray->Shift} "$INSTDIR\Profiles\$4"
+ ${Next}
+ ${Else}
+ ${un.whereprofilesarray->Shift} "$INSTDIR"
+ ${EndIf}
+
; Clear all old errors so I can use the error checking for
; checking that all files are deleted
ClearErrors
-
+
+ StrCpy $0 "keep_themes"
+ StrCpy $1 "keep_personal"
+
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UNINSTALL_THEMES) IDNO +2
- RMDir /r /REBOOTOK "$whereprofiles\themes"
-
- IfErrors 0 +3
- DetailPrint "$whereprofiles\themes could not be deleted"
- ClearErrors
-
+ StrCpy $0 "delete_themes"
+
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UNINSTALL_PERSONAL) IDNO +2
- RMDir /r /REBOOTOK "$whereprofiles\personal\"
-
- IfErrors 0 +3
- DetailPrint "$whereprofiles\personal could not be deleted"
- ClearErrors
+ StrCpy $1 "delete_personal"
- RMDir /REBOOTOK "$whereprofiles" ; By not specifying '/r' this dir will only be deleted if it's completely empty
+ ${un.whereprofilesarray->SizeOf} $2 $2 $2
+ IntOp $2 $2 - 1
- IfErrors 0 +3
- DetailPrint "$whereprofiles could not be deleted"
- ClearErrors
+ ${For} $3 0 $2 ; $3 from 0 to size-1
+ ${un.whereprofilesarray->Read} $4 $3
+
+ ${If} $0 == "delete_themes"
+ RMDir /r /REBOOTOK "$4\themes"
+
+ ${If} ${Errors}
+ DetailPrint "$4\themes could not be deleted"
+ ClearErrors
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $1 == "delete_personal"
+ RMDir /r /REBOOTOK "$4\personal\"
+
+ ${If} ${Errors}
+ DetailPrint "$4\personal could not be deleted"
+ ClearErrors
+ ${EndIf}
+ ${EndIf}
+
+ RMDir /REBOOTOK "$4" ; By not specifying '/r' this dir will only be deleted if it's completely empty
+
+ IfErrors 0 +3
+ DetailPrint "$4 could not be deleted"
+ ClearErrors
+ ${Next}
IfFileExists "$INSTDIR\Profiles" 0 +2 ; An extra delete is needed if the default profiles dir is used
RMDir /REBOOTOK "$INSTDIR\Profiles"
@@ -192,7 +257,15 @@
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
- !insertmacro UNINSTALL.LOG_UNINSTALL "$whereprofiles\themes"
+ ${un.whereprofilesarray->SizeOf} $1 $1 $0
+ IntOp $0 $0 - 1
+
+ ${For} $1 0 $0 ; $1 from 0 to size-1
+ ${un.whereprofilesarray->Read} $2 $1
+
+ !insertmacro UNINSTALL.LOG_UNINSTALL "$2\themes"
+ ${Next}
+
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\NLM"
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\LOSI"
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\utilities"
Please sign in to comment.
Something went wrong with that request. Please try again.