Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>You should really try try this using the <code>System.Diagnostics</code> namespace if you want the full path it's possible : </p> <pre><code>process.MainModule.FileName </code></pre></li> <li><p>For it to work on other users processes you need to be Admin (A true admin so either no UAC or UAC elevated) as you will need the right to enable <code>SeDebugPrivilege</code>. From C# :</p> <pre><code>try { Process.EnterDebugMode(); } catch(Win32Exception) { /* Not admin */ } </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.enterdebugmode.aspx" rel="nofollow noreferrer">the documentation</a> on MSDN. But it seem that at least on C#4.0 it's now done automatically as long as you have the right to do it.</p></li> <li><code>EnumProcessModules</code> won't give you 64 bits process from a 32 bit one or 32-bit ones from a 64-bit process. For it you either need to create 2 processes one in each architecture on from a 64-bit process call <a href="http://msdn.microsoft.com/en-us/library/ms682633%28VS.85%29.aspx" rel="nofollow noreferrer"><code>EnumProcessModulesEx</code></a>. (See <a href="https://stackoverflow.com/questions/3801517/how-to-enum-modules-in-a-64bit-process-from-a-32bit-wow-process">How to enum modules in a 64bit process from a 32bit WOW process</a> on SO)<br/><em><code>System.Diagnostics</code> already does that for you</em></li> <li>Anyway <code>GetModuleBaseName</code> won't give you the full path of the program its <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>GetModuleFileName</code></a> (nitpicking)</li> </ol> <p>There is another way using <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684919%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>QueryFullProcessImageName</code></a> (Available since Vista) that may work without the right to OpenProcess and so without being an administrator.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload