ReactOS 0.4.15-dev-7918-g2a2556c
wtsapi.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <wine/winternl.h>
#include <wtsapi32.h>
#include "wine/test.h"
Include dependency graph for wtsapi.c:

Go to the source code of this file.

Functions

static void test_WTSEnumerateProcessesW (void)
 
static void test_WTSQuerySessionInformationW (void)
 
static void test_WTSQueryUserToken (void)
 
 START_TEST (wtsapi)
 

Function Documentation

◆ START_TEST()

START_TEST ( wtsapi  )

Definition at line 117 of file wtsapi.c.

118{
122}
static void test_WTSQueryUserToken(void)
Definition: wtsapi.c:107
static void test_WTSEnumerateProcessesW(void)
Definition: wtsapi.c:28
static void test_WTSQuerySessionInformationW(void)
Definition: wtsapi.c:92

◆ test_WTSEnumerateProcessesW()

static void test_WTSEnumerateProcessesW ( void  )
static

Definition at line 28 of file wtsapi.c.

29{
30 BOOL found = FALSE, ret;
31 DWORD count, i;
34
36 for (pname = nameW + lstrlenW(nameW); pname > nameW; pname--)
37 {
38 if(*pname == '/' || *pname == '\\')
39 {
40 pname++;
41 break;
42 }
43 }
44
45 info = NULL;
46 SetLastError(0xdeadbeef);
48 ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
49 ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
51
52 info = NULL;
53 SetLastError(0xdeadbeef);
55 ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
56 ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
58
59 info = NULL;
60 SetLastError(0xdeadbeef);
62 ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
63 ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
65
66 SetLastError(0xdeadbeef);
68 ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
69 ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
70
71 info = NULL;
72 SetLastError(0xdeadbeef);
74 ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
75 ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
77
78 count = 0;
79 info = NULL;
80 SetLastError(0xdeadbeef);
82 ok(ret || broken(!ret), /* fails on Win2K with error ERROR_APP_WRONG_OS */
83 "expected WTSEnumerateProcessesW to succeed; failed with %d\n", GetLastError());
84 for(i = 0; ret && i < count; i++)
85 {
86 found = found || !lstrcmpW(pname, info[i].pProcessName);
87 }
88 ok(found || broken(!ret), "process name %s not found\n", wine_dbgstr_w(pname));
90}
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR nameW[]
Definition: main.c:46
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum pname
Definition: glext.h:5645
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 wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI WTSFreeMemory(PVOID pMemory)
Definition: wtsapi32.c:283
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW *ppProcessInfo, DWORD *pCount)
Definition: wtsapi32.c:120
#define WTS_CURRENT_SERVER_HANDLE
Definition: wtsapi32.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_WTSQuerySessionInformationW()

static void test_WTSQuerySessionInformationW ( void  )
static

Definition at line 92 of file wtsapi.c.

93{
94 BOOL ret;
95 WCHAR *buf;
97
98 count = 0;
99 buf = NULL;
101 ok(ret, "got %u\n", GetLastError());
102 ok(buf != NULL, "buf not set\n");
103 ok(count == (lstrlenW(buf) + 1) * sizeof(WCHAR), "got %u\n", count);
105}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR *Buffer, DWORD *BytesReturned)
Definition: wtsapi32.c:443
@ WTSUserName
Definition: wtsapi32.h:50
#define WTS_CURRENT_SESSION
Definition: wtsapi32.h:198

Referenced by START_TEST().

◆ test_WTSQueryUserToken()

static void test_WTSQueryUserToken ( void  )
static

Definition at line 107 of file wtsapi.c.

108{
109 BOOL ret;
110
111 SetLastError(0xdeadbeef);
113 ok(!ret, "expected WTSQueryUserToken to fail\n");
114 ok(GetLastError()==ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
115}
BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
Definition: wtsapi32.c:588

Referenced by START_TEST().