ReactOS  0.4.15-dev-3453-gff89651
NtOpenThreadToken.c File Reference
#include "precomp.h"
Include dependency graph for NtOpenThreadToken.c:

Go to the source code of this file.

Functions

 START_TEST (NtOpenThreadToken)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtOpenThreadToken  )

Definition at line 10 of file NtOpenThreadToken.c.

11 {
16  ULONG i;
17 
18  TokenHandle = (HANDLE)0x55555555;
20  TOKEN_READ,
21  TRUE,
22  &TokenHandle);
23  ok(Status == STATUS_NO_TOKEN, "Status = %lx\n", Status);
24  ok(TokenHandle == (HANDLE)0x55555555 /* 2003 */ ||
25  TokenHandle == NULL /* Win7 */, "TokenHandle = %p\n", TokenHandle);
26 
28  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
30  {
32  TOKEN_READ,
33  OpenAsSelf,
34  &TokenHandle);
35  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
36  if (NT_SUCCESS(Status))
37  {
38  ok((LONG_PTR)TokenHandle > 0, "TokenHandle = %p\n", TokenHandle);
40  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
41  }
42 
43  for (i = 0; i < RTL_NUMBER_OF(HandleAttributes); i++)
44  {
46  TOKEN_READ,
47  OpenAsSelf,
49  &TokenHandle);
50  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
51  if (NT_SUCCESS(Status))
52  {
53  ok((LONG_PTR)TokenHandle > 0, "TokenHandle = %p\n", TokenHandle);
55  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
56  }
57  }
58  }
59 
60  TokenHandle = NULL;
63  &TokenHandle,
64  sizeof(TokenHandle));
65  ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
66 }
NTSTATUS NTAPI NtOpenThreadTokenEx(_In_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ BOOLEAN OpenAsSelf, _In_ ULONG HandleAttributes, _Out_ PHANDLE TokenHandle)
Opens a token that is tied to a thread handle.
Definition: token.c:6243
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE _In_ ACCESS_MASK _In_ ULONG HandleAttributes
Definition: obfuncs.h:429
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NtCurrentThread()
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:715
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: query.c:2018
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtOpenThreadToken(_In_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ BOOLEAN OpenAsSelf, _Out_ PHANDLE TokenHandle)
Opens a token that is tied to a thread handle.
Definition: token.c:6445
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PVOID HANDLE
Definition: typedefs.h:73
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
#define TOKEN_READ
Definition: setypes.h:929
NTSYSAPI NTSTATUS NTAPI RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: priv.c:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
_In_ ACCESS_MASK _In_ BOOLEAN OpenAsSelf
Definition: zwfuncs.h:699
#define STATUS_SUCCESS
Definition: shellext.h:65