Пример #1
0
        public void GetCurrentProcessIdViaFakeHandle()
        {
            uint id     = ProcessMethods.GetCurrentProcessId();
            var  handle = ProcessMethods.GetCurrentProcess();

            ProcessMethods.GetProcessId(handle).Should().Be(id);
        }
Пример #2
0
        public void GetCurrentProcessIdViaRealHandle()
        {
            uint id = ProcessMethods.GetCurrentProcessId();

            using (var handle = ProcessMethods.OpenProcess(id, ProcessAccessRights.QueryLimitedInfomration))
            {
                ProcessMethods.GetProcessId(handle).Should().Be(id);
            }
        }