ReactOS 0.4.16-dev-197-g92996da
apisets.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Validate the apiset lookup in ApiSetResolveToHost
5 * COPYRIGHT: Copyright 2024 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8#include <ndk/umtypes.h>
9#include <ndk/rtlfuncs.h>
10#include <apitest.h>
11#include "apisetsp.h"
12
13static void
15{
16 UNICODE_STRING Tmp = {0};
19
20 BOOLEAN Resolved = FALSE;
22
23 Status = ApiSetResolveToHost(~0u, &Tmp, &Resolved, &Result);
25 ok_eq_bool(Resolved, TRUE);
26 ok(Result.Buffer != NULL, "Got NULL\n");
27}
28
29static void
31{
32 UNICODE_STRING Tmp = {0};
35
36 BOOLEAN Resolved = FALSE;
37 UNICODE_STRING Result = {0, 0, (PWSTR)0xbadbeef};
38
39 Status = ApiSetResolveToHost(~0u, &Tmp, &Resolved, &Result);
41 ok_eq_bool(Resolved, FALSE);
42 ok_ptr(Result.Buffer, (PWSTR)0xbadbeef);
43}
44
45static void
47{
48 winetest_push_context("%S", Apiset->Buffer);
49 resolve_single(Apiset);
51}
52
53static void
55{
56 winetest_push_context("%S", Apiset->Buffer);
57 resolve_fail_single(Apiset);
59}
60
61
62START_TEST(apisets)
63{
64 // Ensure we can find some manually selected ones (both with and without extension):
65 UNICODE_STRING Console1 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Console-L1-1-0.dll");
66 UNICODE_STRING Console2 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Console-L1-1-0");
67 UNICODE_STRING Handle1 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Handle-L1-1-0.dll");
68 UNICODE_STRING Handle2 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Handle-L1-1-0");
69 UNICODE_STRING Heap1 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Heap-L1-1-0.dll");
70 UNICODE_STRING Heap2 = RTL_CONSTANT_STRING(L"api-MS-Win-Core-Heap-L1-1-0");
71
72 test_single(&Console1);
73 test_single(&Console2);
74 test_single(&Handle1);
75 test_single(&Handle2);
76 test_single(&Heap1);
77 test_single(&Heap2);
78
79 // Walk the entire table, to ensure we can find each entry
80 for (DWORD n = 0; n < g_ApisetsCount; ++n)
81 {
83 winetest_push_context("%ld: %S", n, Apiset->Buffer);
84 resolve_single(Apiset);
86 }
87
91
92 fail_single(&Fail1);
93 fail_single(&Fail2);
94 fail_single(&Fail3);
95}
unsigned char BOOLEAN
const LONG g_ApisetsCount
const ROS_APISET g_Apisets[]
Definition: apisets.table.c:12
#define ok_eq_bool(value, expected)
Definition: apitest.h:80
#define ok_ntstatus(status, expected)
Definition: atltest.h:135
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_ptr(expression, result)
Definition: atltest.h:108
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLdouble n
Definition: glext.h:7729
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 * u
Definition: glfuncs.h:240
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
static void fail_single(PCUNICODE_STRING Apiset)
Definition: apisets.c:54
static void test_single(PCUNICODE_STRING Apiset)
Definition: apisets.c:46
static void resolve_single(PCUNICODE_STRING Apiset)
Definition: apisets.c:14
static void resolve_fail_single(PCUNICODE_STRING Apiset)
Definition: apisets.c:30
#define L(x)
Definition: ntvdm.h:50
void __winetest_cdecl winetest_push_context(const char *fmt,...)
void winetest_pop_context(void)
NTSTATUS ApiSetResolveToHost(_In_ DWORD ApisetVersion, _In_ PCUNICODE_STRING ApiToResolve, _Out_ PBOOLEAN Resolved, _Out_ PUNICODE_STRING Output)
Definition: apisets.c:32
#define STATUS_SUCCESS
Definition: shellext.h:65
const UNICODE_STRING Name
Definition: apisetsp.h:13
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409