private string QueryProcessImageName(SafeProcessHandle handle, ProcessQueryImageNameMode mode) { StringBuilder moduleBuffer = new StringBuilder(1024); int size = moduleBuffer.Capacity; NativeMethods.QueryFullProcessImageName( handle, mode, moduleBuffer, ref size); if (mode == ProcessQueryImageNameMode.NativeSystemFormat) { moduleBuffer.Insert(0, "\\\\?\\GLOBALROOT"); } return(moduleBuffer.ToString()); }
public static extern uint QueryFullProcessImageName( SafeProcessHandle hProcess, [MarshalAs(UnmanagedType.U4)] ProcessQueryImageNameMode flags, [Out] StringBuilder lpImageName, ref int size);
private string QueryProcessImageName(SafeProcessHandle handle, ProcessQueryImageNameMode mode) { StringBuilder moduleBuffer = new StringBuilder(1024); int size = moduleBuffer.Capacity; NativeMethods.QueryFullProcessImageName( handle, mode, moduleBuffer, ref size); if (mode == ProcessQueryImageNameMode.NativeSystemFormat) moduleBuffer.Insert(0, "\\\\?\\GLOBALROOT"); return moduleBuffer.ToString(); }