ReactOS  0.4.14-dev-297-g23e575c
atomtest.c File Reference
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <ndk/ntndk.h>
Include dependency graph for atomtest.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 
#define BUFFER_SIZE   256
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   256

Definition at line 8 of file atomtest.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 5 of file atomtest.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 3 of file atomtest.c.

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 10 of file atomtest.c.

11 {
12  PRTL_ATOM_TABLE AtomTable = NULL;
13  RTL_ATOM AtomA = -1, AtomB = -1, AtomC = -1;
16  ULONG NameLength, Data1, Data2;
17 
18  printf("Atom table test app\n\n");
19 
20  printf("RtlCreateAtomTable()\n");
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 }
NTSYSAPI NTSTATUS NTAPI RtlLookupAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ PWSTR AtomName, _Out_ PRTL_ATOM Atom)
#define BUFFER_SIZE
Definition: atomtest.c:8
unsigned short RTL_ATOM
Definition: atom.c:42
NTSYSAPI NTSTATUS NTAPI RtlAddAtomToAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ PWSTR AtomName, _Out_ PRTL_ATOM Atom)
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlPinAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom)
NTSYSAPI NTSTATUS NTAPI RtlCreateAtomTable(_In_ ULONG TableSize, _Inout_ PRTL_ATOM_TABLE *AtomTable)
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI NTSTATUS NTAPI RtlQueryAtomInAtomTable(_In_ PRTL_ATOM_TABLE AtomTable, _In_ RTL_ATOM Atom, _Out_opt_ PULONG RefCount, _Out_opt_ PULONG PinCount, _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName, _Inout_opt_ PULONG NameLength)
static const WCHAR L[]
Definition: oid.c:1250
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI NTSTATUS NTAPI RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable)
Definition: atom.c:203
#define printf
Definition: config.h:203