https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58215e5fb77a1c457ce26…
commit 58215e5fb77a1c457ce26274fdf4d720a982b92b
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sat Feb 2 22:48:51 2019 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Feb 2 23:02:53 2019 +0100
[NTDLL_APITEST] Add test for NtDuplicateObject with OBJ_PROTECT_CLOSE.
---
modules/rostests/apitests/ntdll/CMakeLists.txt | 1 +
.../rostests/apitests/ntdll/NtDuplicateObject.c | 30 ++++++++++++++++++++++
modules/rostests/apitests/ntdll/testlist.c | 2 ++
3 files changed, 33 insertions(+)
diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt
b/modules/rostests/apitests/ntdll/CMakeLists.txt
index 4860cd225a..e3a2725d6b 100644
--- a/modules/rostests/apitests/ntdll/CMakeLists.txt
+++ b/modules/rostests/apitests/ntdll/CMakeLists.txt
@@ -15,6 +15,7 @@ list(APPEND SOURCE
NtCreateKey.c
NtCreateThread.c
NtDeleteKey.c
+ NtDuplicateObject.c
NtFreeVirtualMemory.c
NtLoadUnloadKey.c
NtMapViewOfSection.c
diff --git a/modules/rostests/apitests/ntdll/NtDuplicateObject.c
b/modules/rostests/apitests/ntdll/NtDuplicateObject.c
new file mode 100644
index 0000000000..7944c3211e
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/NtDuplicateObject.c
@@ -0,0 +1,30 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: Test for NtDuplicateObject
+ * COPYRIGHT: Copyright 2019 Thomas Faber (thomas.faber(a)reactos.org)
+ */
+
+#include "precomp.h"
+
+#define OBJ_PROTECT_CLOSE 0x01
+
+START_TEST(NtDuplicateObject)
+{
+ NTSTATUS Status;
+ HANDLE Handle;
+
+ Handle = NULL;
+ Status = NtDuplicateObject(NtCurrentProcess(),
+ NtCurrentProcess(),
+ NtCurrentProcess(),
+ &Handle,
+ GENERIC_ALL,
+ OBJ_PROTECT_CLOSE,
+ 0);
+ ok_hex(Status, STATUS_SUCCESS);
+ ok(Handle != NULL && Handle != NtCurrentProcess(),
+ "Handle = %p\n", Handle);
+ Status = NtClose(Handle);
+ ok_hex(Status, STATUS_HANDLE_NOT_CLOSABLE);
+}
diff --git a/modules/rostests/apitests/ntdll/testlist.c
b/modules/rostests/apitests/ntdll/testlist.c
index e627634de8..a828865d8a 100644
--- a/modules/rostests/apitests/ntdll/testlist.c
+++ b/modules/rostests/apitests/ntdll/testlist.c
@@ -13,6 +13,7 @@ extern void func_NtCreateFile(void);
extern void func_NtCreateKey(void);
extern void func_NtCreateThread(void);
extern void func_NtDeleteKey(void);
+extern void func_NtDuplicateObject(void);
extern void func_NtFreeVirtualMemory(void);
extern void func_NtLoadUnloadKey(void);
extern void func_NtMapViewOfSection(void);
@@ -77,6 +78,7 @@ const struct test winetest_testlist[] =
{ "NtCreateKey", func_NtCreateKey },
{ "NtCreateThread", func_NtCreateThread },
{ "NtDeleteKey", func_NtDeleteKey },
+ { "NtDuplicateObject", func_NtDuplicateObject },
{ "NtFreeVirtualMemory", func_NtFreeVirtualMemory },
{ "NtLoadUnloadKey", func_NtLoadUnloadKey },
{ "NtMapViewOfSection", func_NtMapViewOfSection },