[NTDLL_APITEST] Add test for NtDuplicateObject with OBJ_PROTECT_CLOSE.
[reactos.git] / modules / rostests / apitests / ntdll / NtDuplicateObject.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Test for NtDuplicateObject
5 * COPYRIGHT: Copyright 2019 Thomas Faber (thomas.faber@reactos.org)
6 */
7
8 #include "precomp.h"
9
10 #define OBJ_PROTECT_CLOSE 0x01
11
12 START_TEST(NtDuplicateObject)
13 {
14 NTSTATUS Status;
15 HANDLE Handle;
16
17 Handle = NULL;
18 Status = NtDuplicateObject(NtCurrentProcess(),
19 NtCurrentProcess(),
20 NtCurrentProcess(),
21 &Handle,
22 GENERIC_ALL,
23 OBJ_PROTECT_CLOSE,
24 0);
25 ok_hex(Status, STATUS_SUCCESS);
26 ok(Handle != NULL && Handle != NtCurrentProcess(),
27 "Handle = %p\n", Handle);
28 Status = NtClose(Handle);
29 ok_hex(Status, STATUS_HANDLE_NOT_CLOSABLE);
30 }