2015-09-23 15:14:25 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS api tests
|
|
|
|
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
|
|
|
|
* PURPOSE: Test for NtOpenProcessToken[Ex]
|
|
|
|
* PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
|
|
|
|
*/
|
|
|
|
|
2017-12-02 20:05:46 +00:00
|
|
|
#include "precomp.h"
|
2015-09-23 15:14:25 +00:00
|
|
|
|
|
|
|
START_TEST(NtOpenProcessToken)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE TokenHandle;
|
|
|
|
|
|
|
|
Status = NtOpenProcessToken(NtCurrentProcess(),
|
|
|
|
TOKEN_READ,
|
|
|
|
&TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ok((LONG_PTR)TokenHandle > 0, "TokenHandle = %p\n", TokenHandle);
|
|
|
|
Status = NtClose(TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = NtOpenProcessTokenEx(NtCurrentProcess(),
|
|
|
|
TOKEN_READ,
|
|
|
|
0,
|
|
|
|
&TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ok((LONG_PTR)TokenHandle > 0, "TokenHandle = %p\n", TokenHandle);
|
|
|
|
Status = NtClose(TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = NtOpenProcessTokenEx(NtCurrentProcess(),
|
|
|
|
TOKEN_READ,
|
|
|
|
OBJ_KERNEL_HANDLE,
|
|
|
|
&TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ok((LONG_PTR)TokenHandle > 0, "TokenHandle = %p\n", TokenHandle);
|
|
|
|
Status = NtClose(TokenHandle);
|
|
|
|
ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
|
|
|
|
}
|
|
|
|
}
|