- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / rosapps / tests / atomtest / atomtest.c
1 #include <stdio.h>
2 #include <string.h>
3 #define WIN32_NO_STATUS
4 #include <windows.h>
5 #define NTOS_MODE_USER
6 #include <ndk/ntndk.h>
7
8 #define BUFFER_SIZE 256
9
10 int main(int argc, char* argv[])
11 {
12 PRTL_ATOM_TABLE AtomTable = NULL;
13 RTL_ATOM AtomA = -1, AtomB = -1, AtomC = -1;
14 NTSTATUS Status;
15 WCHAR Buffer[BUFFER_SIZE];
16 ULONG NameLength, Data1, Data2;
17
18 printf("Atom table test app\n\n");
19
20 printf("RtlCreateAtomTable()\n");
21 Status = RtlCreateAtomTable(37,
22 &AtomTable);
23 printf(" Status 0x%08lx\n", Status);
24
25 if (NT_SUCCESS(Status))
26 {
27 printf(" AtomTable %p\n", AtomTable);
28
29 printf("RtlAddAtomToAtomTable()\n");
30 Status = RtlAddAtomToAtomTable(AtomTable,
31 L"TestAtomA",
32 &AtomA);
33 printf(" Status 0x%08lx\n", Status);
34 if (NT_SUCCESS(Status))
35 {
36 printf(" AtomA 0x%x\n", AtomA);
37 }
38
39 printf("RtlAddAtomToAtomTable()\n");
40 Status = RtlAddAtomToAtomTable(AtomTable,
41 L"TestAtomB",
42 &AtomB);
43 printf(" Status 0x%08lx\n", Status);
44 if (NT_SUCCESS(Status))
45 {
46 printf(" AtomB 0x%x\n", AtomB);
47 }
48
49
50 printf("RtlLookupAtomInAtomTable()\n");
51 Status = RtlLookupAtomInAtomTable(AtomTable,
52 L"TestAtomA",
53 &AtomC);
54 printf(" Status 0x%08lx\n", Status);
55 if (NT_SUCCESS(Status))
56 {
57 printf(" AtomC 0x%x\n", AtomC);
58 }
59
60
61 printf("RtlPinAtomInAtomTable()\n");
62 Status = RtlPinAtomInAtomTable(AtomTable,
63 AtomC);
64 printf(" Status 0x%08lx\n", Status);
65
66 printf("RtlPinAtomInAtomTable()\n");
67 Status = RtlPinAtomInAtomTable(AtomTable,
68 AtomC);
69 printf(" Status 0x%08lx\n", Status);
70
71
72 // printf("RtlDeleteAtomFromAtomTable()\n");
73 // Status = RtlDeleteAtomFromAtomTable(AtomTable,
74 // AtomC);
75 // printf(" Status 0x%08lx\n", Status);
76
77
78 // printf("RtlEmptyAtomTable()\n");
79 // Status = RtlEmptyAtomTable(AtomTable,
80 // TRUE);
81 // printf(" Status 0x%08lx\n", Status);
82
83
84 // printf("RtlLookupAtomInAtomTable()\n");
85 // Status = RtlLookupAtomInAtomTable(AtomTable,
86 // L"TestAtomA",
87 // &AtomC);
88 // printf(" Status 0x%08lx\n", Status);
89
90
91 printf("RtlQueryAtomInAtomTable()\n");
92 NameLength = sizeof(WCHAR) * BUFFER_SIZE;
93 Status = RtlQueryAtomInAtomTable(AtomTable,
94 AtomC,
95 &Data1,
96 &Data2,
97 Buffer,
98 &NameLength);
99 printf(" Status 0x%08lx\n", Status);
100 if (NT_SUCCESS(Status))
101 {
102 printf(" RefCount %ld\n", Data1);
103 printf(" PinCount %ld\n", Data2);
104 printf(" NameLength %lu\n", NameLength);
105 printf(" AtomName: %S\n", Buffer);
106 }
107
108 printf("RtlDestroyAtomTable()\n");
109 RtlDestroyAtomTable(AtomTable);
110
111
112 printf("Atom table test app finished\n");
113 }
114
115 return(0);
116 }