Пример #1
0
        public static int GetParentProcessId()
        {
            ProcessBasicInformation ProccessInfo = new ProcessBasicInformation();

            IntPtr ProcHandle = Process.GetCurrentProcess().Handle;

            uint RetLength = 0;

            NtQueryInformationProcess(ProcHandle, PROCESSBASICINFORMATION, ref ProccessInfo, Marshal.SizeOf(ProccessInfo), ref RetLength);

            return ProccessInfo.InheritedFromUniqueProcessId.ToInt32();
        }
Пример #2
0
 private static extern int NtQueryInformationProcess(IntPtr handle, uint processinformationclass, ref ProcessBasicInformation processInformation, int processInformationLength, ref uint returnLength);