Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer using incorrect service name #47

Closed
dmex opened this issue Jun 30, 2016 · 13 comments
Closed

Installer using incorrect service name #47

dmex opened this issue Jun 30, 2016 · 13 comments
Assignees
Labels

Comments

@dmex
Copy link
Member

dmex commented Jun 30, 2016

The Process Hacker setup is not correctly installing/uninstalling KPH due to using the service name KProcessHacker2 after it was renamed KProcessHacker3 about two releases ago :P

@dmex dmex added the bug label Jun 30, 2016
@dmex dmex added this to the Future milestone Jun 30, 2016
@XhmikosR
Copy link
Contributor

So we assume no KProcessHacker2 service is running anymore?

@dmex
Copy link
Member Author

dmex commented Jul 1, 2016

Yes, although someone might be upgrading from an older version with KPH2 which needs to be stopped/deleted (??) but all newer versions (and the last two releases) are using KPH3

@VictorVG
Copy link

VictorVG commented Jul 1, 2016

Changes for installer, just diff:

--- Process_Hacker_installer.iss
+++ Process_Hacker_installer.iss
@@ -332,7 +332,7 @@
 var
   dwStart: DWORD;
 begin
-  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker2', 'Start', dwStart) then begin
+  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker3', 'Start', dwStart) then begin
     if dwStart = 1 then
       Result := True;
   end else
@@ -386,14 +386,18 @@
   if CurStep = ssInstall then begin
     if IsServiceRunning('KProcessHacker2') then
       StopService('KProcessHacker2');
-    if IsTaskSelected('delete_KPH_service') then
       RemoveService('KProcessHacker2');
+
+    if IsServiceRunning('KProcessHacker3') then
+      StopService('KProcessHacker3');
+    if IsTaskSelected('delete_KPH_service') then
+      RemoveService('KProcessHacker3');
   end;

   if CurStep = ssPostInstall then begin
     if (KPHServiceCheck() and not IsTaskSelected('delete_KPH_service') or (IsTaskSelected('create_KPH_service'))) then begin
-      StopService('KProcessHacker2');
-      RemoveService('KProcessHacker2');
+      StopService('KProcessHacker3');
+      RemoveService('KProcessHacker3');

       if not Exec(ExpandConstant('{app}\ProcessHacker.exe'), '-installkph -s', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
         // handle failure if necessary; iResultCode contains the error code
@@ -420,8 +424,8 @@
 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
 begin
   if CurUninstallStep = usUninstall then begin
-    StopService('KProcessHacker2');
-    RemoveService('KProcessHacker2');
+    StopService('KProcessHacker3');
+    RemoveService('KProcessHacker3');

     // When uninstalling ask user to delete Process Hacker's settings
     // based on whether the settings file exists only

@XhmikosR
Copy link
Contributor

XhmikosR commented Jul 1, 2016

@VictorVG: thanks, I already have made a patch for this locally.

@VictorVG
Copy link

VictorVG commented Jul 1, 2016

Ok!, big thanks!

@VictorVG
Copy link

VictorVG commented Jul 1, 2016

Patch correction:

--- Process_Hacker_installer_Full.iss
+++ Process_Hacker_installer_Full.iss
@@ -332,7 +332,7 @@
 var
   dwStart: DWORD;
 begin
-  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker2', 'Start', dwStart) then begin
+  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker3', 'Start', dwStart) then begin
     if dwStart = 1 then
       Result := True;
   end else
@@ -384,16 +384,16 @@
   iResultCode: Integer;
 begin
   if CurStep = ssInstall then begin
-    if IsServiceRunning('KProcessHacker2') then
-      StopService('KProcessHacker2');
+    if IsServiceRunning('KProcessHacker3') then
+      StopService('KProcessHacker3');
     if IsTaskSelected('delete_KPH_service') then
-      RemoveService('KProcessHacker2');
+      RemoveService('KProcessHacker3');
   end;

   if CurStep = ssPostInstall then begin
     if (KPHServiceCheck() and not IsTaskSelected('delete_KPH_service') or (IsTaskSelected('create_KPH_service'))) then begin
-      StopService('KProcessHacker2');
-      RemoveService('KProcessHacker2');
+      StopService('KProcessHacker3');
+      RemoveService('KProcessHacker3');

       if not Exec(ExpandConstant('{app}\ProcessHacker.exe'), '-installkph -s', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
         // handle failure if necessary; iResultCode contains the error code
@@ -420,8 +420,8 @@
 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
 begin
   if CurUninstallStep = usUninstall then begin
-    StopService('KProcessHacker2');
-    RemoveService('KProcessHacker2');
+    StopService('KProcessHacker3');
+    RemoveService('KProcessHacker3');

     // When uninstalling ask user to delete Process Hacker's settings
     // based on whether the settings file exists only
  • I overdid it. :) If someone has two different versions - eg branches 2.xx and 3.xx and even in different directories? Better to let you manually correct them with a copy of the program are removed.

@VictorVG
Copy link

VictorVG commented Jul 2, 2016

Sorry, more fix - I accidentally mixed up files - my version Process_Hacker_installer_full.iss has more lines, because they would not match. Remade and tested team patch -i Process_Hacker_installer.diff - no error detected.

diff U3i Process_Hacker_installer.iss Process_Hacker_installer.iss
--- Process_Hacker_installer.iss    Sat Apr 02 17:22:51 2016
+++ Process_Hacker_installer.iss    Sat Jul 02 07:30:08 2016
@@ -270,7 +270,7 @@
 var
   dwStart: DWORD;
 begin
-  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker2', 'Start', dwStart) then begin
+  if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker3', 'Start', dwStart) then begin
     if dwStart = 1 then
       Result := True;
   end else
@@ -327,16 +327,16 @@
   iResultCode: Integer;
 begin
   if CurStep = ssInstall then begin
-    if IsServiceRunning('KProcessHacker2') then
-      StopService('KProcessHacker2');
+    if IsServiceRunning('KProcessHacker3') then
+      StopService('KProcessHacker3');
     if IsTaskSelected('delete_KPH_service') then
-      RemoveService('KProcessHacker2');
+      RemoveService('KProcessHacker3');
   end;

   if CurStep = ssPostInstall then begin
     if (KPHServiceCheck() and not IsTaskSelected('delete_KPH_service') or (IsTaskSelected('create_KPH_service'))) then begin
-      StopService('KProcessHacker2');
-      RemoveService('KProcessHacker2');
+      StopService('KProcessHacker3');
+      RemoveService('KProcessHacker3');

       if not Exec(ExpandConstant('{app}\ProcessHacker.exe'), '-installkph -s', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
         // handle failure if necessary; iResultCode contains the error code
@@ -364,8 +364,8 @@
 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
 begin
   if CurUninstallStep = usUninstall then begin
-    StopService('KProcessHacker2');
-    RemoveService('KProcessHacker2');
+    StopService('KProcessHacker3');
+    RemoveService('KProcessHacker3');

     // When uninstalling ask user to delete Process Hacker's settings
     // based on whether the settings file exists only

Diff attached
Process_Hacker_installer.diff.zip

@XhmikosR
Copy link
Contributor

XhmikosR commented Jul 2, 2016

Thanks but don't beat yourself up; let me find some time to merge my local
changes and we can tweak it if needed.
On Jul 2, 2016 07:43, "Виктор" notifications@github.com wrote:

Sorry, more fix - I accidentally mixed up files - my version
Process_Hacker_installer_full.iss has more lines, because they would not
match. Remade and tested team patch -i Process_Hacker_installer.diff - no
error detected.

diff U3i Process_Hacker_installer.iss Process_Hacker_installer.iss
--- Process_Hacker_installer.iss Sat Apr 02 17:22:51 2016
+++ Process_Hacker_installer.iss Sat Jul 02 07:30:08 2016
@@ -270,7 +270,7 @@
var
dwStart: DWORD;
begin

  • if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker2', 'Start', dwStart) then begin

  • if RegQueryDWordValue(HKLM, 'SYSTEM\CurrentControlSet\Services\KProcessHacker3', 'Start', dwStart) then begin
    if dwStart = 1 then
    Result := True;
    end else
    @@ -327,16 +327,16 @@
    iResultCode: Integer;
    begin
    if CurStep = ssInstall then begin

  • if IsServiceRunning('KProcessHacker2') then

  •  StopService('KProcessHacker2');
    
  • if IsServiceRunning('KProcessHacker3') then

  •  StopService('KProcessHacker3');
    

    if IsTaskSelected('delete_KPH_service') then

  •  RemoveService('KProcessHacker2');
    
  •  RemoveService('KProcessHacker3');
    

    end;

    if CurStep = ssPostInstall then begin
    if (KPHServiceCheck() and not IsTaskSelected('delete_KPH_service') or (IsTaskSelected('create_KPH_service'))) then begin

  •  StopService('KProcessHacker2');
    
  •  RemoveService('KProcessHacker2');
    
  •  StopService('KProcessHacker3');
    
  •  RemoveService('KProcessHacker3');
    

    if not Exec(ExpandConstant('{app}\ProcessHacker.exe'), '-installkph -s', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
    // handle failure if necessary; iResultCode contains the error code
    @@ -364,8 +364,8 @@
    procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
    begin
    if CurUninstallStep = usUninstall then begin

  • StopService('KProcessHacker2');

  • RemoveService('KProcessHacker2');

  • StopService('KProcessHacker3');

  • RemoveService('KProcessHacker3');

// When uninstalling ask user to delete Process Hacker's settings
// based on whether the settings file exists only

Diff attached
Process_Hacker_installer.diff.zip
https://github.com/processhacker2/processhacker2/files/344410/Process_Hacker_installer.diff.zip


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAVVtUNsI8C_BwOAu4MzRmZ7kOe7WTF_ks5qRexYgaJpZM4JCI8r
.

@VictorVG
Copy link

VictorVG commented Jul 3, 2016

Ok!, I wait Your. No problem. Big thanks!

@VictorVG
Copy link

Also I found value KProcessHacker2 in to ./trunk/tools/ProcessHackerSetup/ProcessHackerSetup\lib/appsup.c::733 - code string is:

`serviceHandle = OpenService(scmHandle, L"KProcessHacker2", SERVICE_STOP | DELETE); `

do you needed correct this string?

@VictorVG
Copy link

Sorry, but my patch it causes an error in the new versions of Process Hacker due to the recording of incorrect values of the driver KProcessHacker3 Parameters\SecurityLevel=2. Because for the assembly of Process Hacker v3.0.0.144 and later it does not apply.

@dmex
Copy link
Member Author

dmex commented Jan 29, 2017

I patched this some time ago but forgot to update the ticket 😄

@dmex dmex closed this as completed Jan 29, 2017
@VictorVG
Copy link

Ok! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants