|
@@ -51,8 +51,6 @@ begin
|
51
|
51
|
sleep(1000);
|
52
|
52
|
GetExitCodeProcess(ProcessInfo.hProcess, Result);
|
53
|
53
|
end;
|
54
|
|
-
|
55
|
|
- MessageBox(0, PChar('Exec: '+sProgramToRun+#13#10+'Res: '+inttostr(Result)), 'DMDirc Uninstaller', MB_OK + MB_ICONEXCLAMATION);
|
56
|
54
|
end;
|
57
|
55
|
|
58
|
56
|
function KillDir(Dir: string): Integer;
|
|
@@ -94,77 +92,75 @@ var
|
94
|
92
|
profileDir: String;
|
95
|
93
|
deleteProtocol: boolean;
|
96
|
94
|
begin
|
97
|
|
- if MessageBox(0, PChar('This will uninstall DMDirc.'+#13#10+#13#10+'Do you want to continue?'), 'DMDirc Uninstaller', MB_YESNO) = IDYES then begin
|
98
|
|
- if (ParamCount > 0) then begin
|
99
|
|
- for i := 1 to ParamCount do begin
|
100
|
|
- InstallDir := InstallDir+' '+paramstr(i);
|
101
|
|
- end;
|
102
|
|
- InstallDir := trim(InstallDir);
|
103
|
|
- KillDir(InstallDir);
|
104
|
|
- hK32 := GetModuleHandle('kernel32');
|
105
|
|
- profileDir := GetEnvironmentVariable('USERPROFILE');
|
106
|
|
-
|
107
|
|
- if GetProcAddress(hK32, 'GetLocaleInfoEx') <> nil then begin
|
108
|
|
- // Vista
|
109
|
|
- KillDir(GetEnvironmentVariable('APPDATA')+'\Microsoft\Windows\Start Menu\Programs\DMDirc');
|
110
|
|
- DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\DMDirc.lnk');
|
111
|
|
- DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Desktop\DMDirc.lnk');
|
112
|
|
- profileDir := profileDir+'\AppData\Roaming\DMDirc';
|
|
95
|
+ if (ParamCount > 0) then begin
|
|
96
|
+ for i := 1 to ParamCount do begin
|
|
97
|
+ InstallDir := InstallDir+' '+paramstr(i);
|
|
98
|
+ end;
|
|
99
|
+ InstallDir := trim(InstallDir);
|
|
100
|
+ KillDir(InstallDir);
|
|
101
|
+ hK32 := GetModuleHandle('kernel32');
|
|
102
|
+ profileDir := GetEnvironmentVariable('USERPROFILE');
|
|
103
|
+
|
|
104
|
+ if GetProcAddress(hK32, 'GetLocaleInfoEx') <> nil then begin
|
|
105
|
+ // Vista
|
|
106
|
+ KillDir(GetEnvironmentVariable('APPDATA')+'\Microsoft\Windows\Start Menu\Programs\DMDirc');
|
|
107
|
+ DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\DMDirc.lnk');
|
|
108
|
+ DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Desktop\DMDirc.lnk');
|
|
109
|
+ profileDir := profileDir+'\AppData\Roaming\DMDirc';
|
|
110
|
+ end
|
|
111
|
+ else begin
|
|
112
|
+ // Not Vista
|
|
113
|
+ KillDir(GetEnvironmentVariable('USERPROFILE')+'\Microsoft\Windows\Start Menu\Programs\DMDirc');
|
|
114
|
+ DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Application Data\Microsoft\Internet Explorer\Quick Launch\DMDirc.lnk');
|
|
115
|
+ DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Desktop\DMDirc.lnk');
|
|
116
|
+ profileDir := profileDir+'\Application Data\DMDirc';
|
|
117
|
+ end;
|
|
118
|
+ // Remove irc:// handler if it is us.
|
|
119
|
+ deleteProtocol := false;
|
|
120
|
+ Reg := TRegistry.Create;
|
|
121
|
+ Reg.RootKey := HKEY_CLASSES_ROOT;
|
|
122
|
+ if Reg.OpenKey('irc\Shell\open\command', false) then begin
|
|
123
|
+ handlerInfo := Reg.ReadString('');
|
|
124
|
+ if (handlerInfo = '"'+InstallDir+'DMDirc.exe" -c %1') then begin
|
|
125
|
+ deleteProtocol := true;
|
113
|
126
|
end
|
114
|
|
- else begin
|
115
|
|
- // Not Vista
|
116
|
|
- KillDir(GetEnvironmentVariable('USERPROFILE')+'\Microsoft\Windows\Start Menu\Programs\DMDirc');
|
117
|
|
- DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Application Data\Microsoft\Internet Explorer\Quick Launch\DMDirc.lnk');
|
118
|
|
- DeleteFile(GetEnvironmentVariable('USERPROFILE')+'\Desktop\DMDirc.lnk');
|
119
|
|
- profileDir := profileDir+'\Application Data\DMDirc';
|
120
|
|
- end;
|
121
|
|
- // Remove irc:// handler if it is us.
|
122
|
|
- deleteProtocol := false;
|
|
127
|
+ end;
|
|
128
|
+ Reg.CloseKey;
|
|
129
|
+ Reg.Free;
|
|
130
|
+
|
|
131
|
+ if deleteProtocol then begin
|
123
|
132
|
Reg := TRegistry.Create;
|
124
|
133
|
Reg.RootKey := HKEY_CLASSES_ROOT;
|
125
|
|
- if Reg.OpenKey('irc\Shell\open\command', false) then begin
|
126
|
|
- handlerInfo := Reg.ReadString('');
|
127
|
|
- if (handlerInfo = '"'+InstallDir+'DMDirc.exe" -c %1') then begin
|
128
|
|
- deleteProtocol := true;
|
129
|
|
- end
|
130
|
|
- end;
|
131
|
|
- Reg.CloseKey;
|
132
|
|
- Reg.Free;
|
133
|
|
-
|
134
|
|
- if deleteProtocol then begin
|
135
|
|
- Reg := TRegistry.Create;
|
136
|
|
- Reg.RootKey := HKEY_CLASSES_ROOT;
|
137
|
|
- Reg.DeleteKey('irc\Shell\open\command');
|
138
|
|
- Reg.DeleteKey('irc\Shell\open');
|
139
|
|
- Reg.DeleteKey('irc\Shell');
|
140
|
|
- Reg.DeleteKey('irc\DefaultIcon');
|
141
|
|
- Reg.DeleteKey('irc');
|
142
|
|
- Reg.CloseKey;
|
143
|
|
- Reg.Free;
|
144
|
|
- end;
|
145
|
|
-
|
146
|
|
- Reg := TRegistry.Create;
|
147
|
|
- Reg.RootKey := HKEY_LOCAL_MACHINE;
|
148
|
|
- Reg.DeleteKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DMDirc');
|
|
134
|
+ Reg.DeleteKey('irc\Shell\open\command');
|
|
135
|
+ Reg.DeleteKey('irc\Shell\open');
|
|
136
|
+ Reg.DeleteKey('irc\Shell');
|
|
137
|
+ Reg.DeleteKey('irc\DefaultIcon');
|
|
138
|
+ Reg.DeleteKey('irc');
|
149
|
139
|
Reg.CloseKey;
|
150
|
140
|
Reg.Free;
|
|
141
|
+ end;
|
151
|
142
|
|
152
|
|
- if (FileExists(profileDir+'\dmdirc.config')) then begin
|
153
|
|
- if MessageBox(0, PChar('A dmdirc profile has been detected ('+profileDir+')'+#13#10+' Do you want to delete it aswell?'), 'DMDirc Uninstaller', MB_YESNO) = IDYES then begin
|
154
|
|
- KillDir(profileDir);
|
155
|
|
- end;
|
156
|
|
- end;
|
157
|
|
-
|
158
|
|
- MessageBox(0, PChar('DMDirc has been uninstalled from "'+InstallDir+'".'), 'DMDirc Uninstaller', MB_OK);
|
159
|
|
- end
|
160
|
|
- else begin
|
161
|
|
- if (ExecAndWait('java -jar ' + ExtractFileDir(paramstr(0)) + '\DMDirc.jar -k', true) <> 0) then begin
|
162
|
|
- TempDir := GetTempDirectory;
|
163
|
|
- CopyFile(pchar(paramstr(0)), pchar(TempDir+'/uninstall.exe'), false);
|
164
|
|
- Launch(TempDir+'/uninstall.exe '+ExtractFileDir(paramstr(0))+'\');
|
165
|
|
- end else begin
|
166
|
|
- MessageBox(0, PChar('Uninstall Aborted - DMDirc is still running.'+#13#10+'Please close DMDirc before continuing'), 'DMDirc Uninstaller', MB_OK + MB_ICONEXCLAMATION);
|
|
143
|
+ Reg := TRegistry.Create;
|
|
144
|
+ Reg.RootKey := HKEY_LOCAL_MACHINE;
|
|
145
|
+ Reg.DeleteKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DMDirc');
|
|
146
|
+ Reg.CloseKey;
|
|
147
|
+ Reg.Free;
|
|
148
|
+
|
|
149
|
+ if (FileExists(profileDir+'\dmdirc.config')) then begin
|
|
150
|
+ if MessageBox(0, PChar('A dmdirc profile has been detected ('+profileDir+')'+#13#10+' Do you want to delete it aswell?'), 'DMDirc Uninstaller', MB_YESNO) = IDYES then begin
|
|
151
|
+ KillDir(profileDir);
|
167
|
152
|
end;
|
168
|
153
|
end;
|
|
154
|
+
|
|
155
|
+ MessageBox(0, PChar('DMDirc has been uninstalled from "'+InstallDir+'".'), 'DMDirc Uninstaller', MB_OK);
|
|
156
|
+ end
|
|
157
|
+ else if MessageBox(0, PChar('This will uninstall DMDirc.'+#13#10+#13#10+'Do you want to continue?'), 'DMDirc Uninstaller', MB_YESNO) = IDYES then begin
|
|
158
|
+ if (ExecAndWait('java -jar ' + ExtractFileDir(paramstr(0)) + '\DMDirc.jar -k', true) <> 0) then begin
|
|
159
|
+ TempDir := GetTempDirectory;
|
|
160
|
+ CopyFile(pchar(paramstr(0)), pchar(TempDir+'/uninstall.exe'), false);
|
|
161
|
+ Launch(TempDir+'/uninstall.exe '+ExtractFileDir(paramstr(0))+'\');
|
|
162
|
+ end else begin
|
|
163
|
+ MessageBox(0, PChar('Uninstall Aborted - DMDirc is still running.'+#13#10+'Please close DMDirc before continuing'), 'DMDirc Uninstaller', MB_OK + MB_ICONEXCLAMATION);
|
|
164
|
+ end;
|
169
|
165
|
end;
|
170
|
166
|
end.
|