Exemple #1
0
        private static void NtQueryInformationProcess(int flag, string flagName)
        {
            NtQueryInformationProcess ntQueryInformationProcess = new NtQueryInformationProcess();

            using (IMemoryAddress result = GameSharpProcess.Instance.AllocateManagedMemory(IntPtr.Size))
            {
                int queryState = ntQueryInformationProcess.Call <int>(GameSharpProcess.Instance.Handle, flag, result.Address, (uint)4, null);
                // STATUS_SUCCESS = 0, so if API call was successful queryState should contain 0.
                if (queryState == 0)
                {
                    if (!result.Read <bool>())
                    {
                        LoggingService.Info($"{flagName} => We're being debugged!");
                    }
                }
            }
        }