Browse Source

Small change to prevent showing the UAC info dialog if the user isn't using UAC.


git-svn-id: http://svn.dmdirc.com/trunk@2740 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Shane Mc Cormack 16 years ago
parent
commit
a99924ad5d
1 changed files with 17 additions and 10 deletions
  1. 17
    10
      launcher/windows/DMDirc.dpr

+ 17
- 10
launcher/windows/DMDirc.dpr View File

@@ -67,16 +67,23 @@ begin
67 67
 		// Vista Sucks.
68 68
 		hK32 := GetModuleHandle('kernel32');
69 69
 		if GetProcAddress(hK32, 'GetLocaleInfoEx') <> nil then begin
70
-			errorMessage := 'An update to DMDirc has been previously downloaded.';
71
-			errorMessage := errorMessage+#13#10;
72
-			errorMessage := errorMessage+#13#10+'As you are running Windows Vista, DMDirc requires administer access to';
73
-			errorMessage := errorMessage+#13#10+'complete the update.';
74
-			errorMessage := errorMessage+#13#10;
75
-			errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no';
76
-			errorMessage := errorMessage+#13#10+'here to continue without updating.';
77
-			if MessageBox(0, PChar(errorMessage), 'Windows Vista', MB_YESNO) = IDYES then begin
78
-				ExecAndWait('DMDircUpdater.exe '+directory+'\.DMDirc.jar');
79
-			end;
70
+			// Vista >.<
71
+			// Try and delete the old file, if it fails then the user needs to give
72
+			// us permission to delete the file (UAC), otherwise we can just go ahead
73
+			// and run the updater.
74
+			if not DeleteFile('DMDirc.jar') then begin
75
+				errorMessage := 'An update to DMDirc has been previously downloaded.';
76
+				errorMessage := errorMessage+#13#10;
77
+				errorMessage := errorMessage+#13#10+'As you are running Windows Vista, DMDirc requires administer access to';
78
+				errorMessage := errorMessage+#13#10+'complete the update.';
79
+				errorMessage := errorMessage+#13#10;
80
+				errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no';
81
+				errorMessage := errorMessage+#13#10+'here to continue without updating.';
82
+				if MessageBox(0, PChar(errorMessage), 'Windows Vista', MB_YESNO) = IDYES then begin
83
+					ExecAndWait('DMDircUpdater.exe '+directory+'\.DMDirc.jar');
84
+				end;
85
+			end
86
+			else ExecAndWait('DMDircUpdater.exe '+directory+'\.DMDirc.jar');
80 87
 		end
81 88
 		else ExecAndWait('DMDircUpdater.exe '+directory+'\.DMDirc.jar');
82 89
 	end;

Loading…
Cancel
Save