How to get UninstallString from PID

checkingrandom 226 Reputation points
2022-03-23T06:13:19.2+00:00

is there any ways to map registry UninstallString of a application only with the help of PID input.

Basically, a PID will be given as input, how can we map that PID process's corresponding application and retrieve the Uninstllstring of that application from registry.

Example:
PID : 12345
Process Name: Notepad++

Output:
C:\Program Files\Notepad++\uninstall.exe ----> just for example

Windows development Windows API - Win32
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 49,536 Reputation points
    2022-03-23T08:30:57.73+00:00

    Generally speaking you can use a PID to obtain a handle to a process with the OpenProcess functions. Using this handle you can call QueryFullProcessImageName to obtain the process name information. There are other ways to enumerate processes and match a pid to the enumeration.

    In any event, there is no predictable or required correlation between an application name and an uninstallString in the registry. Don't forget that applications can be installed using different installers and they don't all use the same methods to install and uninstall applications.

    Why do you want an Uninstallstring?

    1 person found this answer helpful.

  2. Xiaopo Yang - MSFT 12,731 Reputation points Microsoft External Staff
    2022-03-24T03:04:59.42+00:00

    If you want to uninstalling applications programmatically, have a look at IARPUninstallStringLauncher. For the application key names, I suppose It is ApplicationName value data.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.