Recent

Author Topic: Find installation directory of a program  (Read 4477 times)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #15 on: January 20, 2023, 02:53:14 pm »
Now at 107, 105 still missing somewhere  %)
Later I will contribute my own tool, have to convert it first to FPC from Delphi.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

balazsszekely

  • Guest
Re: Find installation directory of a program
« Reply #16 on: January 20, 2023, 02:58:50 pm »
Later I will contribute my own tool, have to convert it first to FPC from Delphi.
Please do. You also query from the registry or with WMI?

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #17 on: January 20, 2023, 05:54:42 pm »
I found the error.
When I modify your source:

before:
Code: Pascal  [Select][+][-]
  1.   if AInstallType = it64bit then
  2.     KeyAccess := KeyAccess + KEY_WOW64_64KEY;

after:
Code: Pascal  [Select][+][-]
  1.   case AInstallType of
  2.     it64bit: KeyAccess := KeyAccess + KEY_WOW64_64KEY;
  3.     it32bit: KeyAccess := KeyAccess + KEY_WOW64_32KEY;
  4.   end;

It does do like my Delphi app is doing, no WMI.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

balazsszekely

  • Guest
Re: Find installation directory of a program
« Reply #18 on: January 20, 2023, 06:02:46 pm »
I found the error. When I extend your source with this:
Code: Pascal  [Select][+][-]
  1.   case AInstallType of
  2.     it64bit: KeyAccess := KeyAccess + KEY_WOW64_64KEY;
  3.     it32bit: KeyAccess := KeyAccess + KEY_WOW64_32KEY;
  4.   end;
It does do like my Delphi app is doing, no WMI.
Cool! Silly mistake. Thanks for catching that.
Something is still not right though, with your modification I get 376 installed programs, on the other hand  "Add remove programs" shows only 174.
Take a look at the following picture(attachment), those are not separate installations.
The whole install/uninstall process looks dubious to me. Anyways OP has enough information to work with.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #19 on: January 20, 2023, 06:36:24 pm »
@GetMem: Take a look at my modificated version. It shows nearly same as the "Add/Remove Apps"-Screen from Windows.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

balazsszekely

  • Guest
Re: Find installation directory of a program
« Reply #20 on: January 20, 2023, 07:05:54 pm »
@KodeZwerg
With your attached application 174/121

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #21 on: January 20, 2023, 07:18:12 pm »
175/163 here, I'd thought it be nice... but your leap is big... not nice.
When I got more time I might modify again, for OPs (and my) needs it is enough to start with  8)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #22 on: January 21, 2023, 07:46:47 am »
I had a small success for myself, maybe this work also for you better? @GetMem
Whats changed:
 - added Classes Root registry
 - added Installer registry
 - update entries instead of skipping (for duplicates)
 - some GUI additions
 - here and there some smaller code modifications
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

balazsszekely

  • Guest
Re: Find installation directory of a program
« Reply #23 on: January 21, 2023, 09:56:40 am »
@KodeZwerg
Your latest applications is really nice, with a a lot of features. Also the install count is pretty close to what Add remove programs reports.
I also did a last attempt to get the installed programs with WMI. It's excruciatingly slow and gives slightly different results then Add remove programs. As I said in one of my previous post, windows does something sneaky in the background.  :)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #24 on: January 21, 2023, 10:54:47 am »
@KodeZwerg
Your latest applications is really nice, with a a lot of features. Also the install count is pretty close to what Add remove programs reports.
I also did a last attempt to get the installed programs with WMI. It's excruciatingly slow and gives slightly different results then Add remove programs. As I said in one of my previous post, windows does something sneaky in the background.  :)
I am glad you like the update, may I ask how much is the difference when running with my default settings?
Here it is 175 (Windows App Remove) vs 168 from my last above update.
I downloaded your WMI and try it tomorrow.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

balazsszekely

  • Guest
Re: Find installation directory of a program
« Reply #25 on: January 21, 2023, 12:30:12 pm »
@KodeZwerg
Quote
I am glad you like the update, may I ask how much is the difference when running with my default settings?
Here it is 175 (Windows App Remove) vs 168 from my last above update.
174(Windows App Remove)  vs. 164 your application.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #26 on: January 22, 2023, 10:34:03 pm »
Today I run your WMI try and first happen is my first attachment image  :'(
a fix for that is easy:

before:
Code: Pascal  [Select][+][-]
  1.         Inc(Cnt);
  2.         with lwInst.Items.Add do

after:
Code: Pascal  [Select][+][-]
  1.         Inc(Cnt);
  2.         if (not VarIsNull(FWbemObject.Name)) then
  3.         with lwInst.Items.Add do

Results are pretty same as when you select in your original version modified by me when selecting:
[X] Include Install [X] 32bit [X] 64bit

only difference, wmi needs ages  :D
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Find installation directory of a program
« Reply #27 on: January 22, 2023, 10:39:28 pm »
@KodeZwerg
Quote
I am glad you like the update, may I ask how much is the difference when running with my default settings?
Here it is 175 (Windows App Remove) vs 168 from my last above update.
174(Windows App Remove)  vs. 164 your application.
Thanks for telling and yes, way better than 174 to 121

//edit
your application
I do not agree, it is yours, I just played with it and upgraded a little my friend  :-*
« Last Edit: January 22, 2023, 10:42:40 pm by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

 

TinyPortal © 2005-2018