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