Fix an issue where it can't get the process name or executable path because of a permission issue

This commit is contained in:
2023-09-24 23:42:58 -06:00
parent bbb0e55ed6
commit ca634f8d3c
2 changed files with 66 additions and 16 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace FocusVolumeControl;
@ -59,4 +60,11 @@ public class Native
[DllImport("ntdll.dll")]
public static extern int NtQueryInformationProcess(IntPtr processHandle, int processInformationClass, ref ParentProcessUtilities processInformation, int processInformationLength, out int returnLength);
[DllImport("Kernel32.dll")]
public static extern bool QueryFullProcessImageName(IntPtr hProcess, uint flags, StringBuilder buffer, ref uint bufferSize);
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(uint processAccess, bool inheritHandle, int processId);
}