-
Notifications
You must be signed in to change notification settings - Fork 4
/
UnInstallLog.nsh
105 lines (89 loc) · 2.93 KB
/
UnInstallLog.nsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Adeel Asghar [[email protected]]
# 2024-06-22 16:10:54
;AddItem macro
!macro AddItem Path
FileWrite $UninstLog "${Path}$\r$\n"
!macroend
;File macro
!macro File LocalFileName InstalledFileName
IfFileExists "$OUTDIR\${InstalledFileName}" +2
FileWrite $UninstLog "$OUTDIR\${InstalledFileName}$\r$\n"
File "${LocalFileName}"
!macroend
;CreateShortCut macro
!macro CreateShortCut FilePath FilePointer Pamameters Icon IconIndex
FileWrite $UninstLog "${FilePath}$\r$\n"
CreateShortCut "${FilePath}" "${FilePointer}" "${Pamameters}" "${Icon}" "${IconIndex}"
!macroend
;Copy files macro
!macro CopyFiles SourcePath DestPath
IfFileExists "${DestPath}" +2
FileWrite $UninstLog "${DestPath}$\r$\n"
CopyFiles "${SourcePath}" "${DestPath}"
!macroend
;Rename macro
!macro Rename SourcePath DestPath
IfFileExists "${DestPath}" +2
FileWrite $UninstLog "${DestPath}$\r$\n"
Rename "${SourcePath}" "${DestPath}"
!macroend
;CreateDirectory macro
!macro CreateDirectory Path
CreateDirectory "${Path}"
FileWrite $UninstLog "${Path}$\r$\n"
!macroend
;SetOutPath macro
!macro SetOutPath Path
SetOutPath "${Path}"
FileWrite $UninstLog "${Path}$\r$\n"
!macroend
;WriteUninstaller macro
!macro WriteUninstaller Path
WriteUninstaller "${Path}"
FileWrite $UninstLog "${Path}$\r$\n"
!macroend
;WriteIniStr macro
!macro WriteIniStr IniFile SectionName EntryName NewValue
IfFileExists "${IniFile}" +2
FileWrite $UninstLog "${IniFile}$\r$\n"
WriteIniStr "${IniFile}" "${SectionName}" "${EntryName}" "${NewValue}"
!macroend
;WriteRegStr macro
!macro WriteRegStr RegRoot UnInstallPath Key Value
FileWrite $UninstLog "${RegRoot} ${UnInstallPath}$\r$\n"
WriteRegStr "${RegRoot}" "${UnInstallPath}" "${Key}" "${Value}"
!macroend
;WriteRegDWORD macro
!macro WriteRegDWORD RegRoot UnInstallPath Key Value
FileWrite $UninstLog "${RegRoot} ${UnInstallPath}$\r$\n"
WriteRegDWORD "${RegRoot}" "${UnInstallPath}" "${Key}" "${Value}"
!macroend
;BackupFile macro
!macro BackupFile FILE_DIR FILE BACKUP_TO
IfFileExists "${BACKUP_TO}\*.*" +2
CreateDirectory "${BACKUP_TO}"
IfFileExists "${FILE_DIR}\${FILE}" 0 +2
Rename "${FILE_DIR}\${FILE}" "${BACKUP_TO}\${FILE}"
!macroend
;RestoreFile macro
!macro RestoreFile BUP_DIR FILE RESTORE_TO
IfFileExists "${BUP_DIR}\${FILE}" 0 +2
Rename "${BUP_DIR}\${FILE}" "${RESTORE_TO}\${FILE}"
!macroend
;BackupFiles macro
!macro BackupFiles FILE_DIR FILE BACKUP_TO
IfFileExists "${BACKUP_TO}\*.*" +2
CreateDirectory "22222"
IfFileExists "${FILE_DIR}\${FILE}" 0 +7
FileWrite $UninstLog "${FILE_DIR}\${FILE}$\r$\n"
FileWrite $UninstLog "${BACKUP_TO}\${FILE}$\r$\n"
FileWrite $UninstLog "FileBackup$\r$\n"
Rename "${FILE_DIR}\${FILE}" "${BACKUP_TO}\${FILE}"
SetOutPath "${FILE_DIR}"
File "${FILE}" #After the Original file is backed up write the new file.
!macroend
;RestoreFiles macro
!macro RestoreFiles BUP_FILE RESTORE_FILE
IfFileExists "${BUP_FILE}" 0 +2
CopyFiles "${BUP_FILE}" "${RESTORE_FILE}"
!macroend