31#define WIN32_NO_STATUS
41#ifndef __WINE_WINTERNL_H
62static const WCHAR testAtom1[] = {
'H',
'e',
'l',
'l',
'o',
' ',
'W',
'o',
'r',
'l',
'd',0};
63static const WCHAR testAtom2[] = {
'H',
'e',
'l',
'l',
'o',
' ',
'W',
'o',
'r',
'l',
'd',
'2',0};
64static const WCHAR testAtom3[] = {
'H',
'e',
'l',
'l',
'o',
' ',
'W',
'o',
'r',
'l',
'd',
'3',0};
66static const WCHAR testAtom1Cap[] = {
'H',
'E',
'L',
'L',
'O',
' ',
'W',
'O',
'R',
'L',
'D',0};
67static const WCHAR testAtom1Low[] = {
'h',
'e',
'l',
'l',
'o',
' ',
'w',
'o',
'r',
'l',
'd',0};
76 ok(
hntdll != 0,
"Unable to load ntdll.dll\n");
103 ok(!
res,
"Unable to find atom from another thread, retval: %x\n",
res);
106 ok(!
res,
"Unable to lookup pinned atom in table, retval: %x\n",
res);
113 ok(!
res,
"Failed with long enough buffer, retval: %x\n",
res);
114 ok(RefCount == 1,
"Refcount was not 1 but %x\n", RefCount);
121 ok(!
res,
"RtlQueryAtomInAtomTable with optional args invalid failed, retval: %x\n",
res);
125 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
126 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
142 res = pRtlCreateAtomTable(0, &AtomTable);
143 ok(!
res,
"RtlCreateAtomTable should succeed with an atom table size of 0\n");
147 res = pRtlDestroyAtomTable(AtomTable);
148 ok(!
res,
"We could create the atom table, but we couldn't destroy it! retval: %x\n",
res);
152 res = pRtlCreateAtomTable(37, &AtomTable);
153 ok(!
res,
"We're unable to create an atom table with a valid table size retval: %x\n",
res);
157 ok(!
res,
"We were unable to add a simple atom to the atom table, retval: %x\n",
res);
160 ok(!
res,
"We were unable to find capital version of the atom, retval: %x\n",
res);
161 ok(
Atom1 == testAtom,
"Found wrong atom in table when querying capital atom\n");
164 ok(!
res,
"Unable to find lowercase version of the atom, retval: %x\n",
res);
165 ok(testAtom ==
Atom1,
"Found wrong atom when querying lowercase atom\n");
167 res = pRtlAddAtomToAtomTable(AtomTable,
EmptyAtom, &testEAtom);
170 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
171 ok(!
res,
"Failed to find totally legitimate atom, retval: %x\n",
res);
172 ok(testAtom ==
Atom1,
"Found wrong atom!\n");
175 ok(!
res,
"Unable to add other legitimate atom to table, retval: %x\n",
res);
177 res = pRtlPinAtomInAtomTable(AtomTable,
Atom2);
178 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
186 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
187 ok(RefCount == 1,
"RefCount is not 1 but %x\n", RefCount);
192 res = pRtlEmptyAtomTable(AtomTable,
FALSE);
193 ok(!
res,
"Unable to empty atom table, retval %x\n",
res);
197 ok(!
res,
"It seems RtlEmptyAtomTable deleted our pinned atom eaven though we asked it not to, retval: %x\n",
res);
198 ok(RefCount == 1,
"RefCount is not 1 but %x\n", RefCount);
207 ok(
Len == 6,
"wrong length %u\n",
Len);
209 ok(!
Name[3],
"wrong string termination\n");
210 ok(
Name[4] == 0x1337,
"buffer overwrite\n");
221 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom2, &testAtom);
222 ok(!
res,
"We can't find our pinned atom!! retval: %x\n",
res);
223 ok(testAtom ==
Atom2,
"We found wrong atom!!!\n");
225 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
229 ok(!
res,
"Unable to add atom to table, retval: %x\n",
res);
231 res = pRtlEmptyAtomTable(AtomTable,
TRUE);
232 ok(!
res,
"Unable to empty atom table, retval: %x\n",
res);
234 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom2, &testAtom);
237 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom3, &testAtom);
240 res = pRtlDestroyAtomTable(AtomTable);
241 ok(!
res,
"Can't destroy atom table, retval: %x\n",
res);
245 res = pRtlCreateAtomTable(37, &AtomTable);
246 ok(!
res,
"Unable to create atom table, retval: %x\n",
res);
250 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
254 ok(!
res,
"Unable to add atom to atom table, retval %x\n",
res);
256 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
257 ok(!
res,
"Can't find previously added atom in table, retval: %x\n",
res);
258 ok(testAtom ==
Atom1,
"Found wrong atom! retval: %x\n",
res);
260 res = pRtlDeleteAtomFromAtomTable(AtomTable,
Atom1);
261 ok(!
res,
"Unable to delete atom from table, retval: %x\n",
res);
263 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
267 ok(!
res,
"Unable to add atom to atom table, retval: %x\n",
res);
273 if (!
Len) pNtAddAtomNT4 = (
void *)pNtAddAtom;
275 res = pRtlPinAtomInAtomTable(AtomTable,
Atom1);
276 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
278 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
279 ok(!
res,
"Unable to find atom in atom table, retval: %x\n",
res);
280 ok(testAtom ==
Atom1,
"Wrong atom found\n");
282 res = pRtlDeleteAtomFromAtomTable(AtomTable,
Atom1);
285 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
286 ok(!
res,
"Able to find deleted atom in table\n");
288 res = pRtlDestroyAtomTable(AtomTable);
289 ok(!
res,
"Unable to destroy atom table\n");
305 res = pRtlCreateAtomTable(37, &AtomTable);
306 ok(!
res,
"Unable to create atom table, %x\n",
res);
312 res = pRtlAddAtomToAtomTable(AtomTable,
NULL, &testAtom);
314 for (
i = 1;
i <= 0xbfff;
i++)
316 res = pRtlAddAtomToAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
317 ok(!
res,
"Unable to add valid integer atom %li, retval: %x\n",
i,
res);
320 for (
i = 1;
i <= 0xbfff;
i++)
322 res = pRtlLookupAtomInAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
323 ok(!
res,
"Unable to find int atom %li, retval: %x\n",
i,
res);
326 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
327 ok(!
res,
"Unable to pin int atom %li, retval: %x\n",
i,
res);
331 for (
i = 0xc000;
i <= 0xffff;
i++)
333 res = pRtlAddAtomToAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
334 ok(
res,
"Able to illeageal integer atom %li, retval: %x\n",
i,
res);
337 res = pRtlDestroyAtomTable(AtomTable);
338 ok(!
res,
"Unable to destroy atom table, retval: %x\n",
res);
342 res = pRtlCreateAtomTable(37, &AtomTable);
343 ok(!
res,
"Unable to create atom table, %x\n",
res);
346 res = pRtlLookupAtomInAtomTable(AtomTable, (
PWSTR)123, &testAtom);
347 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
350 ok(!
res,
"Unable to add int atom to table, retval: %x\n",
res);
353 ok(!
res,
"Unable to add int atom to table, retval: %x\n",
res);
355 res = pRtlAddAtomToAtomTable(AtomTable, (
PWSTR)123, &testAtom);
356 ok(!
res,
"Unable to add int atom to table, retval: %x\n",
res);
358 res = pRtlAddAtomToAtomTable(AtomTable, (
PWSTR)123, &testAtom);
359 ok(!
res,
"Unable to re-add int atom to table, retval: %x\n",
res);
362 res = pRtlQueryAtomInAtomTable(AtomTable, testAtom, &RefCount, &
PinCount,
Name, &
Len);
363 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
365 ok(RefCount == 1,
"Expected refcount 1 but got %x\n", RefCount);
369 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
370 ok(!
res,
"Unable to pin int atom, retval: %x\n",
res);
372 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
373 ok(!
res,
"Unable to pin int atom, retval: %x\n",
res);
376 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
378 ok(RefCount == 1,
"Expected refcount 1 but got %x\n", RefCount);
380 res = pRtlDestroyAtomTable(AtomTable);
381 ok(!
res,
"Unable to destroy atom table, retval: %x\n",
res);
394 res = pRtlCreateAtomTable(37, &AtomTable);
395 ok(!
res,
"Unable to create atom table, %x\n",
res);
400 ok(!
res,
"Unable to add our atom to the atom table, retval: %x\n",
res);
403 ok(!
res,
"Unable to add our atom to the atom table, retval: %x\n",
res);
406 ok(!
res,
"Unable to add our atom to the atom table, retval: %x\n",
res);
409 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
411 ok(RefCount == 3,
"Expected refcount 3 but got %x\n", RefCount);
413 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
414 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
416 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
417 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
419 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
420 ok(!
res,
"Unable to pin atom in atom table, retval: %x\n",
res);
423 ok(!
res,
"Unable to query atom in atom table, retval: %x\n",
res);
425 ok(RefCount == 3,
"Expected refcount 3 but got %x\n", RefCount);
427 res = pRtlDestroyAtomTable(AtomTable);
428 ok(!
res,
"Unable to destroy atom table, retval: %x\n",
res);
449 ok(!
res,
"atom lookup\n");
473 ok(!
res,
"couldn't find atom\n");
481 if (pRtlCreateAtomTable)
493 win_skip(
"Needed atom functions are not available\n");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define GetProcAddress(x, y)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
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
static const DWORD ptr_size
static DWORD WINAPI RtlAtomTestThread(LPVOID Table)
static const WCHAR testAtomOTT[]
static const WCHAR EmptyAtom[]
static void test_NtRefPinAtom(void)
static const WCHAR testAtomIntInv[]
struct atom_table * RTL_ATOM_TABLE
static RTL_ATOM *static RTL_ATOM *static DWORD
static void test_NtAtom(void)
static const WCHAR testAtom2[]
static void test_NtIntAtom(void)
static const WCHAR testAtom3[]
static const WCHAR testAtom1Cap[]
static void test_Global(void)
static void InitFunctionPtr(void)
static const WCHAR testAtomInt[]
static const WCHAR testAtom1[]
unsigned short * PRTL_ATOM
static const WCHAR testAtom1Low[]
struct atom_table ** PRTL_ATOM_TABLE
struct _ATOM_BASIC_INFORMATION ATOM_BASIC_INFORMATION
#define STATUS_WAS_LOCKED
#define STATUS_BUFFER_TOO_SMALL
_In_ const GUID _In_ ULONG PinCount
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define STATUS_INVALID_PARAMETER
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_OBJECT_NAME_NOT_FOUND
HWND WINAPI GetDesktopWindow(void)