Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
QueryFullProcessImageName (kernel32)
 
.
Summary
Retrieves the full name of the executable image for the specified process. (by Process Handle)

C# Signature:

[DllImport("kernel32.dll", SetLastError=true)]
static extern bool QueryFullProcessImageName([In]IntPtr hProcess, [In]int dwFlags, [Out]StringBuilder lpExeName, ref int lpdwSize);

VB Signature:

Declare Function QueryFullProcessImageName Lib "kernel32.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

System.Diagnostics.Process.MainModule.FileName

Notes:

To query the filename for a process that is running elevated from a process that is not, the .NET api crashes.

This is a workaround.

Tips & Tricks:

Please add some!

Sample Code:

int capacity = 1024;
StringBuilder sb = new StringBuilder(capacity);
IntPtr handle = OpenProcess(ProcessAccess.QueryLimitedInformation, false, process.Id);
QueryFullProcessImageName(handle, 0, sb, ref capacity);
string fullPath = sb.ToString(0, capacity);

Documentation

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684919(v=vs.85).aspx

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions