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: %lx\n",
res);
106 ok(!
res,
"Unable to lookup pinned atom in table, retval: %lx\n",
res);
113 ok(!
res,
"Failed with long enough buffer, retval: %lx\n",
res);
114 ok(RefCount == 1,
"Refcount was not 1 but %lx\n", RefCount);
121 ok(!
res,
"RtlQueryAtomInAtomTable with optional args invalid failed, retval: %lx\n",
res);
125 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
126 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\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: %lx\n",
res);
152 res = pRtlCreateAtomTable(37, &AtomTable);
153 ok(!
res,
"We're unable to create an atom table with a valid table size retval: %lx\n",
res);
156 ok( *(
DWORD *)AtomTable == 0x6d6f7441,
"wrong signature %lx\n", *(
DWORD *)AtomTable );
159 ok(!
res,
"We were unable to add a simple atom to the atom table, retval: %lx\n",
res);
162 ok(!
res,
"We were unable to find capital version of the atom, retval: %lx\n",
res);
163 ok(
Atom1 == testAtom,
"Found wrong atom in table when querying capital atom\n");
166 ok(!
res,
"Unable to find lowercase version of the atom, retval: %lx\n",
res);
167 ok(testAtom ==
Atom1,
"Found wrong atom when querying lowercase atom\n");
169 res = pRtlAddAtomToAtomTable(AtomTable,
EmptyAtom, &testEAtom);
172 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
173 ok(!
res,
"Failed to find totally legitimate atom, retval: %lx\n",
res);
174 ok(testAtom ==
Atom1,
"Found wrong atom!\n");
177 ok(!
res,
"Unable to add other legitimate atom to table, retval: %lx\n",
res);
179 res = pRtlPinAtomInAtomTable(AtomTable,
Atom2);
180 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\n",
res);
188 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
189 ok(RefCount == 1,
"RefCount is not 1 but %lx\n", RefCount);
194 res = pRtlEmptyAtomTable(AtomTable,
FALSE);
195 ok(!
res,
"Unable to empty atom table, retval %lx\n",
res);
199 ok(!
res,
"It seems RtlEmptyAtomTable deleted our pinned atom eaven though we asked it not to, retval: %lx\n",
res);
200 ok(RefCount == 1,
"RefCount is not 1 but %lx\n", RefCount);
209 ok(
Len == 6,
"wrong length %lu\n",
Len);
211 ok(!
Name[3],
"wrong string termination\n");
212 ok(
Name[4] == 0x1337,
"buffer overwrite\n");
223 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom2, &testAtom);
224 ok(!
res,
"We can't find our pinned atom!! retval: %lx\n",
res);
225 ok(testAtom ==
Atom2,
"We found wrong atom!!!\n");
227 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
231 ok(!
res,
"Unable to add atom to table, retval: %lx\n",
res);
233 res = pRtlEmptyAtomTable(AtomTable,
TRUE);
234 ok(!
res,
"Unable to empty atom table, retval: %lx\n",
res);
236 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom2, &testAtom);
239 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom3, &testAtom);
242 res = pRtlDestroyAtomTable(AtomTable);
243 ok(!
res,
"Can't destroy atom table, retval: %lx\n",
res);
247 res = pRtlCreateAtomTable(37, &AtomTable);
248 ok(!
res,
"Unable to create atom table, retval: %lx\n",
res);
252 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
256 ok(!
res,
"Unable to add atom to atom table, retval %lx\n",
res);
258 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
259 ok(!
res,
"Can't find previously added atom in table, retval: %lx\n",
res);
260 ok(testAtom ==
Atom1,
"Found wrong atom! retval: %lx\n",
res);
262 res = pRtlDeleteAtomFromAtomTable(AtomTable,
Atom1);
263 ok(!
res,
"Unable to delete atom from table, retval: %lx\n",
res);
265 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
269 ok(!
res,
"Unable to add atom to atom table, retval: %lx\n",
res);
275 if (!
Len) pNtAddAtomNT4 = (
void *)pNtAddAtom;
277 res = pRtlPinAtomInAtomTable(AtomTable,
Atom1);
278 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\n",
res);
280 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
281 ok(!
res,
"Unable to find atom in atom table, retval: %lx\n",
res);
282 ok(testAtom ==
Atom1,
"Wrong atom found\n");
284 res = pRtlDeleteAtomFromAtomTable(AtomTable,
Atom1);
287 res = pRtlLookupAtomInAtomTable(AtomTable,
testAtom1, &testAtom);
288 ok(!
res,
"Able to find deleted atom in table\n");
290 res = pRtlDestroyAtomTable(AtomTable);
291 ok(!
res,
"Unable to destroy atom table\n");
307 res = pRtlCreateAtomTable(37, &AtomTable);
308 ok(!
res,
"Unable to create atom table, %lx\n",
res);
314 res = pRtlAddAtomToAtomTable(AtomTable,
NULL, &testAtom);
316 for (
i = 1;
i <= 0xbfff;
i++)
318 res = pRtlAddAtomToAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
319 ok(!
res,
"Unable to add valid integer atom %Ii, retval: %lx\n",
i,
res);
322 for (
i = 1;
i <= 0xbfff;
i++)
324 res = pRtlLookupAtomInAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
325 ok(!
res,
"Unable to find int atom %Ii, retval: %lx\n",
i,
res);
328 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
329 ok(!
res,
"Unable to pin int atom %Ii, retval: %lx\n",
i,
res);
333 for (
i = 0xc000;
i <= 0xffff;
i++)
335 res = pRtlAddAtomToAtomTable(AtomTable, (
LPWSTR)
i, &testAtom);
336 ok(
res,
"Able to illeageal integer atom %Ii, retval: %lx\n",
i,
res);
339 res = pRtlDestroyAtomTable(AtomTable);
340 ok(!
res,
"Unable to destroy atom table, retval: %lx\n",
res);
344 res = pRtlCreateAtomTable(37, &AtomTable);
345 ok(!
res,
"Unable to create atom table, %lx\n",
res);
348 res = pRtlLookupAtomInAtomTable(AtomTable, (
PWSTR)123, &testAtom);
349 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
352 ok(!
res,
"Unable to add int atom to table, retval: %lx\n",
res);
355 ok(!
res,
"Unable to add int atom to table, retval: %lx\n",
res);
357 res = pRtlAddAtomToAtomTable(AtomTable, (
PWSTR)123, &testAtom);
358 ok(!
res,
"Unable to add int atom to table, retval: %lx\n",
res);
360 res = pRtlAddAtomToAtomTable(AtomTable, (
PWSTR)123, &testAtom);
361 ok(!
res,
"Unable to re-add int atom to table, retval: %lx\n",
res);
364 res = pRtlQueryAtomInAtomTable(AtomTable, testAtom, &RefCount, &
PinCount,
Name, &
Len);
365 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
367 ok(RefCount == 1,
"Expected refcount 1 but got %lx\n", RefCount);
371 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
372 ok(!
res,
"Unable to pin int atom, retval: %lx\n",
res);
374 res = pRtlPinAtomInAtomTable(AtomTable, testAtom);
375 ok(!
res,
"Unable to pin int atom, retval: %lx\n",
res);
378 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
380 ok(RefCount == 1,
"Expected refcount 1 but got %lx\n", RefCount);
382 res = pRtlDestroyAtomTable(AtomTable);
383 ok(!
res,
"Unable to destroy atom table, retval: %lx\n",
res);
396 res = pRtlCreateAtomTable(37, &AtomTable);
397 ok(!
res,
"Unable to create atom table, %lx\n",
res);
402 ok(!
res,
"Unable to add our atom to the atom table, retval: %lx\n",
res);
405 ok(!
res,
"Unable to add our atom to the atom table, retval: %lx\n",
res);
408 ok(!
res,
"Unable to add our atom to the atom table, retval: %lx\n",
res);
411 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
413 ok(RefCount == 3,
"Expected refcount 3 but got %lx\n", RefCount);
415 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
416 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\n",
res);
418 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
419 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\n",
res);
421 res = pRtlPinAtomInAtomTable(AtomTable,
Atom);
422 ok(!
res,
"Unable to pin atom in atom table, retval: %lx\n",
res);
425 ok(!
res,
"Unable to query atom in atom table, retval: %lx\n",
res);
427 ok(RefCount == 3,
"Expected refcount 3 but got %lx\n", RefCount);
429 res = pRtlDestroyAtomTable(AtomTable);
430 ok(!
res,
"Unable to destroy atom table, retval: %lx\n",
res);
447 ok(!
res,
"Added atom (%lx)\n",
res);
451 ok(!
res,
"atom lookup\n");
475 ok(!
res,
"couldn't find atom\n");
483 if (pRtlCreateAtomTable)
495 win_skip(
"Needed atom functions are not available\n");
#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)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
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)