Ejemplo n.º 1
0
        private void TestCreateRemoteThread_3(IntPtr hProcess)
        {
            var originalCounter = _counter;

            IntPtr hThread = ProcessMemory.CreateRemoteThreadEx(hProcess, IntPtr.Zero, IntPtr.Zero, _remoteFunctionPointer, IntPtr.Zero, ThreadCreationFlags.Immediately, IntPtr.Zero);

            Assert.IsFalse(hThread == IntPtr.Zero);

            Assert.IsTrue(ProcessMemory.WaitForSingleObject(hThread, ProcessMemory.WAIT_TIMEOUT_INFINITE) == WaitObjectResult.Success);

            Assert.IsTrue(ProcessMemory.CloseHandle(hThread));

            Assert.IsTrue(originalCounter + 1 == _counter);
        }