Created
November 13, 2018 10:13
-
-
Save Criteo-dotnet-blog/34a7651872572add94608204060c16d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly StringBuilder _baseNameBuilder = new StringBuilder(1024); | |
public static string GetProcessNameNative(Process p) | |
{ | |
_baseNameBuilder.Clear(); | |
if (GetModuleFileNameEx(p.SafeHandle, IntPtr.Zero, _baseNameBuilder, _baseNameBuilder.Capacity) == 0) | |
{ | |
_baseNameBuilder.Append("???"); | |
} | |
return _baseNameBuilder.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment