Martijn Laan 1 год назад
Родитель
Сommit
ce07930ac6
3 измененных файлов с 32 добавлено и 32 удалено
  1. 21 21
      Projects/Src/Setup/DebugClient.pas
  2. 6 6
      Projects/Src/Setup/Main.pas
  3. 5 5
      Projects/Src/Setup/Uninstall.pas

+ 21 - 21
Projects/Src/Setup/DebugClient.pas

@@ -6,7 +6,7 @@ unit DebugClient;
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
-  Debug info stuff
+  Debug client functions (client=Setup, server=debugger/IDE)
 }
 }
 
 
 interface
 interface
@@ -31,7 +31,7 @@ procedure DebugNotifyLogMessage(const Msg: String);
 procedure DebugNotifyTempDir(const Dir: String);
 procedure DebugNotifyTempDir(const Dir: String);
 procedure DebugNotifyUninstExe(UninstExe: String);
 procedure DebugNotifyUninstExe(UninstExe: String);
 procedure EndDebug;
 procedure EndDebug;
-procedure SetDebugWnd(Wnd: HWND; WantCodeText: Boolean);
+procedure SetDebugServerWnd(Wnd: HWND; WantCodeText: Boolean);
 
 
 implementation
 implementation
 
 
@@ -45,17 +45,17 @@ type
   end;
   end;
 
 
 var
 var
-  DebugWnd: HWND;
+  DebugServerWnd: HWND;
   DebugClientWnd: HWND;
   DebugClientWnd: HWND;
   DebugContinue: Boolean;
   DebugContinue: Boolean;
   DebugContinueStepOver: Boolean;
   DebugContinueStepOver: Boolean;
 
 
-procedure SetDebugWnd(Wnd: HWND; WantCodeText: Boolean);
+procedure SetDebugServerWnd(Wnd: HWND; WantCodeText: Boolean);
 var
 var
   DebuggerVersion: Cardinal;
   DebuggerVersion: Cardinal;
   I: Integer;
   I: Integer;
 begin
 begin
-  { First, verify that the debugger/compiler is the same version as Setup.
+  { First, verify that the debugger/IDE is the same version as Setup.
     A mismatch is possible when debugging an uninstaller if the uninstaller
     A mismatch is possible when debugging an uninstaller if the uninstaller
     EXE was created by an installer built with a later version of IS. We can't
     EXE was created by an installer built with a later version of IS. We can't
     continue in such a case because the debugger would send over updated
     continue in such a case because the debugger would send over updated
@@ -66,7 +66,7 @@ begin
       'not match Setup version ($%.8x)', [DebuggerVersion, SetupBinVersion]);
       'not match Setup version ($%.8x)', [DebuggerVersion, SetupBinVersion]);
 
 
   Debugging := True;
   Debugging := True;
-  DebugWnd := Wnd;
+  DebugServerWnd := Wnd;
   DebugClientWnd := AllocateHWnd(TDummyClass.DebugClientWndProc);
   DebugClientWnd := AllocateHWnd(TDummyClass.DebugClientWndProc);
   if DebugClientWnd = 0 then
   if DebugClientWnd = 0 then
     InternalError('Failed to create DebugClientWnd');
     InternalError('Failed to create DebugClientWnd');
@@ -76,15 +76,15 @@ begin
   for I := Low(DebugClientMessages) to High(DebugClientMessages) do
   for I := Low(DebugClientMessages) to High(DebugClientMessages) do
     AddToWindowMessageFilterEx(DebugClientWnd, DebugClientMessages[I]);
     AddToWindowMessageFilterEx(DebugClientWnd, DebugClientMessages[I]);
 
 
-  SendMessage(DebugWnd, WM_Debugger_Hello, WPARAM(DebugClientWnd), LPARAM(WantCodeText));
+  SendMessage(DebugServerWnd, WM_Debugger_Hello, WPARAM(DebugClientWnd), LPARAM(WantCodeText));
 end;
 end;
 
 
 procedure EndDebug;
 procedure EndDebug;
 begin
 begin
   Debugging := False;
   Debugging := False;
-  if DebugWnd <> 0 then begin
-    SendMessage(DebugWnd, WM_Debugger_Goodbye, 0, 0);
-    DebugWnd := 0;
+  if DebugServerWnd <> 0 then begin
+    SendMessage(DebugServerWnd, WM_Debugger_Goodbye, 0, 0);
+    DebugServerWnd := 0;
   end;
   end;
   if DebugClientWnd <> 0 then begin
   if DebugClientWnd <> 0 then begin
     DeallocateHWnd(DebugClientWnd);
     DeallocateHWnd(DebugClientWnd);
@@ -111,15 +111,15 @@ begin
 
 
   DebugContinue := False;
   DebugContinue := False;
 
 
-  if SendMessage(DebugWnd, DebuggerMsg, Ord(Kind), Index) = 0 then begin
+  if SendMessage(DebugServerWnd, DebuggerMsg, Ord(Kind), Index) = 0 then begin
     { Don't pause }
     { Don't pause }
     Exit;
     Exit;
   end;
   end;
 
 
   if Assigned(GetCallStack) then begin
   if Assigned(GetCallStack) then begin
     CallStack := GetCallStack(CallStackCount);
     CallStack := GetCallStack(CallStackCount);
-    SendMessage(DebugWnd, WM_Debugger_CallStackCount, CallStackCount, 0);
-    SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_CallStackW, CallStack);
+    SendMessage(DebugServerWnd, WM_Debugger_CallStackCount, CallStackCount, 0);
+    SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_CallStackW, CallStack);
   end;
   end;
 
 
   Result := True;
   Result := True;
@@ -154,7 +154,7 @@ begin
       { First ask the debugger to call SetForegroundWindow() on our window. If
       { First ask the debugger to call SetForegroundWindow() on our window. If
         we don't do this then Windows (98/2000+) will prevent our window from
         we don't do this then Windows (98/2000+) will prevent our window from
         becoming activated if the debugger is currently in the foreground. }
         becoming activated if the debugger is currently in the foreground. }
-      SendMessage(DebugWnd, WM_Debugger_SetForegroundWindow, WPARAM(TopWindow), 0);
+      SendMessage(DebugServerWnd, WM_Debugger_SetForegroundWindow, WPARAM(TopWindow), 0);
       { Now call SetForegroundWindow() ourself. Why? When a remote thread
       { Now call SetForegroundWindow() ourself. Why? When a remote thread
         calls SetForegroundWindow(), the request is queued; the window doesn't
         calls SetForegroundWindow(), the request is queued; the window doesn't
         actually become active until the next time the window's thread checks
         actually become active until the next time the window's thread checks
@@ -184,24 +184,24 @@ procedure DebugNotifyException(Exception: String; Kind: TDebugEntryKind; Index:
 var
 var
   B: Boolean;
   B: Boolean;
 begin
 begin
-  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_ExceptionW,
+  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_ExceptionW,
     Exception);
     Exception);
   InternalDebugNotify(WM_Debugger_Exception, Kind, Index, B);
   InternalDebugNotify(WM_Debugger_Exception, Kind, Index, B);
 end;
 end;
 
 
 procedure DebugNotifyTempDir(const Dir: String);
 procedure DebugNotifyTempDir(const Dir: String);
 begin
 begin
-  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_TempDirW, Dir);
+  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_TempDirW, Dir);
 end;
 end;
 
 
 procedure DebugNotifyUninstExe(UninstExe: String);
 procedure DebugNotifyUninstExe(UninstExe: String);
 begin
 begin
-  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_UninstExeW, UninstExe);
+  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_UninstExeW, UninstExe);
 end;
 end;
 
 
 procedure DebugNotifyLogMessage(const Msg: String);
 procedure DebugNotifyLogMessage(const Msg: String);
 begin
 begin
-  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_LogMessageW, Msg);
+  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_LogMessageW, Msg);
 end;
 end;
 
 
 class procedure TDummyClass.DebugClientWndProc(var Message: TMessage);
 class procedure TDummyClass.DebugClientWndProc(var Message: TMessage);
@@ -213,7 +213,7 @@ begin
     case Message.Msg of
     case Message.Msg of
       WM_DebugClient_Detach: begin
       WM_DebugClient_Detach: begin
           Debugging := False;
           Debugging := False;
-          DebugWnd := 0;
+          DebugServerWnd := 0;
           { If it's paused, force it to continue }
           { If it's paused, force it to continue }
           DebugContinue := True;
           DebugContinue := True;
           DebugContinueStepOver := False;
           DebugContinueStepOver := False;
@@ -247,7 +247,7 @@ begin
                     EvaluateResult := GetExceptMessage;
                     EvaluateResult := GetExceptMessage;
                     Message.Result := 2;
                     Message.Result := 2;
                   end;
                   end;
-                  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_ReplyW,
+                  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_ReplyW,
                     EvaluateResult);
                     EvaluateResult);
                 except
                 except
                   { don't propagate exceptions }
                   { don't propagate exceptions }
@@ -266,7 +266,7 @@ begin
                     EvaluateResult := GetExceptMessage;
                     EvaluateResult := GetExceptMessage;
                     Message.Result := 2;
                     Message.Result := 2;
                   end;
                   end;
-                  SendCopyDataMessageStr(DebugWnd, DebugClientWnd, CD_Debugger_ReplyW,
+                  SendCopyDataMessageStr(DebugServerWnd, DebugClientWnd, CD_Debugger_ReplyW,
                     EvaluateResult);
                     EvaluateResult);
                 except
                 except
                   { don't propagate exceptions }
                   { don't propagate exceptions }

+ 6 - 6
Projects/Src/Setup/Main.pas

@@ -2907,7 +2907,7 @@ var
   StartParam: Integer;
   StartParam: Integer;
   I, N: Integer;
   I, N: Integer;
   IsRespawnedProcess, EnableLogging, WantToSuppressMsgBoxes, Res: Boolean;
   IsRespawnedProcess, EnableLogging, WantToSuppressMsgBoxes, Res: Boolean;
-  DebugWndValue: HWND;
+  DebugServerWnd: HWND;
   LogFilename: String;
   LogFilename: String;
   SetupFilename: String;
   SetupFilename: String;
   SetupFile: TFile;
   SetupFile: TFile;
@@ -2949,7 +2949,7 @@ begin
   IsRespawnedProcess := False;
   IsRespawnedProcess := False;
   EnableLogging := False;
   EnableLogging := False;
   WantToSuppressMsgBoxes := False;
   WantToSuppressMsgBoxes := False;
-  DebugWndValue := 0;
+  DebugServerWnd := 0;
   for I := StartParam to NewParamCount do begin
   for I := StartParam to NewParamCount do begin
     SplitNewParamStr(I, ParamName, ParamValue);
     SplitNewParamStr(I, ParamName, ParamValue);
     ParamIsAutomaticInternal := False;
     ParamIsAutomaticInternal := False;
@@ -3025,7 +3025,7 @@ begin
       EnterSpawnServerDebugMode  { does not return }
       EnterSpawnServerDebugMode  { does not return }
     else if CompareText(ParamName, '/DEBUGWND=') = 0 then begin
     else if CompareText(ParamName, '/DEBUGWND=') = 0 then begin
       ParamIsAutomaticInternal := True; { sent by TCompileForm.StartProcess }
       ParamIsAutomaticInternal := True; { sent by TCompileForm.StartProcess }
-      DebugWndValue := StrToInt(ParamValue);
+      DebugServerWnd := StrToInt(ParamValue);
     end else if CompareText(ParamName, '/ALLUSERS') = 0 then begin
     end else if CompareText(ParamName, '/ALLUSERS') = 0 then begin
       InitPrivilegesRequired := prAdmin;
       InitPrivilegesRequired := prAdmin;
       HasInitPrivilegesRequired := True;
       HasInitPrivilegesRequired := True;
@@ -3122,9 +3122,9 @@ begin
         { Application.Handle is now known to be the main window. Set the shutdown block reason. }
         { Application.Handle is now known to be the main window. Set the shutdown block reason. }
         ShutdownBlockReasonCreate(Application.Handle, SetupMessages[msgWizardInstalling]);
         ShutdownBlockReasonCreate(Application.Handle, SetupMessages[msgWizardInstalling]);
 
 
-        { Initialize debug client }
-        if DebugWndValue <> 0 then
-          SetDebugWnd(DebugWndValue, False);
+        { Initialize debug client (client=Setup, server=debugger/IDE) }
+        if DebugServerWnd <> 0 then
+          SetDebugServerWnd(DebugServerWnd, False);
 
 
         { Initialize logging }
         { Initialize logging }
         if EnableLogging or (shSetupLogging in SetupHeader.Options) then begin
         if EnableLogging or (shSetupLogging in SetupHeader.Options) then begin

+ 5 - 5
Projects/Src/Setup/Uninstall.pas

@@ -46,7 +46,7 @@ var
   DidRespawn, SecondPhase: Boolean;
   DidRespawn, SecondPhase: Boolean;
   EnableLogging, Silent, VerySilent, NoRestart: Boolean;
   EnableLogging, Silent, VerySilent, NoRestart: Boolean;
   LogFilename: String;
   LogFilename: String;
-  InitialProcessWnd, FirstPhaseWnd, DebugWnd: HWND;
+  InitialProcessWnd, FirstPhaseWnd, DebugServerWnd: HWND;
   OldWindowProc: Pointer;
   OldWindowProc: Pointer;
 
 
 procedure ShowExceptionMsg;
 procedure ShowExceptionMsg;
@@ -286,7 +286,7 @@ begin
       WantToSuppressMsgBoxes := True
       WantToSuppressMsgBoxes := True
     else if CompareText(ParamName, '/DEBUGWND=') = 0 then begin
     else if CompareText(ParamName, '/DEBUGWND=') = 0 then begin
       ParamIsAutomaticInternal := True;
       ParamIsAutomaticInternal := True;
-      DebugWnd := StrToInt(ParamValue);
+      DebugServerWnd := StrToInt(ParamValue);
     end;
     end;
     if not ParamIsAutomaticInternal then
     if not ParamIsAutomaticInternal then
       NewParamsForCode.Add(NewParamStr(I));
       NewParamsForCode.Add(NewParamStr(I));
@@ -490,8 +490,8 @@ begin
   AllowUninstallerShutdown := True;
   AllowUninstallerShutdown := True;
 
 
   try
   try
-    if DebugWnd <> 0 then
-      SetDebugWnd(DebugWnd, True);
+    if DebugServerWnd <> 0 then
+      SetDebugServerWnd(DebugServerWnd, True);
 
 
     if EnableLogging then begin
     if EnableLogging then begin
       try
       try
@@ -547,7 +547,7 @@ begin
     if not UninstLog.ExtractLatestRecData(utCompiledCode,
     if not UninstLog.ExtractLatestRecData(utCompiledCode,
          SetupBinVersion or Longint($80000000), CompiledCodeData) then
          SetupBinVersion or Longint($80000000), CompiledCodeData) then
       InternalError('Cannot find utCompiledCode record for this version of the uninstaller');
       InternalError('Cannot find utCompiledCode record for this version of the uninstaller');
-    if DebugWnd <> 0 then
+    if DebugServerWnd <> 0 then
       CompiledCodeText := DebugClientCompiledCodeText
       CompiledCodeText := DebugClientCompiledCodeText
     else
     else
       CompiledCodeText := ExtractCompiledCodeText(CompiledCodeData[0]);
       CompiledCodeText := ExtractCompiledCodeText(CompiledCodeData[0]);