ReactOS  0.4.14-dev-50-g13bb5e2
regtest.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <ddk/ntddk.h>
#include <rosrtl/string.h>
Include dependency graph for regtest.c:

Go to the source code of this file.

Functions

void dprintf (char *fmt,...)
 
void do_enumeratekey (PWSTR Name)
 
void test1 (void)
 
void test2 (void)
 
void test3 (void)
 
void test4 (void)
 
void test5 (void)
 
void test6 (void)
 
void test7 (void)
 
void test8 (void)
 
void test9 (void)
 
int main (int argc, char *argv[])
 

Variables

HANDLE OutputHandle
 
HANDLE InputHandle
 

Function Documentation

◆ do_enumeratekey()

void do_enumeratekey ( PWSTR  Name)

Definition at line 22 of file regtest.c.

23 {
25  KEY_BASIC_INFORMATION KeyInformation[5];
28  HANDLE hKey1;
30 
33  , NULL, NULL);
35  dprintf("NtEnumerateKey : \n");
36  Index=0;
37  while(Status == STATUS_SUCCESS)
38  {
40  ,&KeyInformation[0], sizeof(KeyInformation)
41  ,&Length);
43  {
44  dprintf("\tSubKey Name = ");
45  for (i=0;i<KeyInformation[0].NameLength/2;i++)
46  dprintf("%C",KeyInformation[0].Name[i]);
47  dprintf("\n");
48  }
49  }
50  NtClose(hKey1);
51 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
static const UCHAR Index[8]
Definition: usbohci.c:18
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by test2(), and test3().

◆ dprintf()

void dprintf ( char fmt,
  ... 
)

Definition at line 11 of file regtest.c.

12 {
13  va_list args;
14  char buffer[255];
15 
16  va_start(args,fmt);
19  va_end(args);
20 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HANDLE OutputHandle
Definition: regtest.c:8
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
#define va_end(ap)
Definition: acmsvcex.h:90
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1470
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define args
Definition: format.c:66
Definition: dsound.c:943

Referenced by do_enumeratekey(), main(), test1(), test2(), test3(), test4(), test5(), test6(), test7(), test8(), and test9().

◆ 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 937 of file regtest.c.

938 {
939  char Buffer[10];
940  DWORD Result;
941 
942  AllocConsole();
945  while(1)
946  {
947  dprintf("choose test :\n");
948  dprintf(" 0=Exit\n");
949  dprintf(" 1=Ntxxx read functions\n");
950  dprintf(" 2=Ntxxx write functions : volatile keys\n");
951  dprintf(" 3=Ntxxx write functions : non volatile keys\n");
952  dprintf(" 4=Regxxx functions\n");
953  dprintf(" 5=FlushKey \n");
954  dprintf(" 6=Registry link create test\n");
955  dprintf(" 7=Registry link delete test\n");
956  dprintf(" 8=Not available\n");
957  dprintf(" 9=Ntxx read tcp/ip key test\n");
959  switch (Buffer[0])
960  {
961  case '0':
962  return(0);
963  case '1':
964  test1();
965  break;
966  case '2':
967  test2();
968  break;
969  case '3':
970  test3();
971  break;
972  case '4':
973  test4();
974  break;
975  case '5':
976  test5();
977  break;
978  case '6':
979  test6();
980  break;
981  case '7':
982  test7();
983  break;
984 #if 0
985  case '8':
986  test8();
987  break;
988 #endif
989  case '9':
990  test9();
991  break;
992  }
993  }
994  return 0;
995 }
void test4(void)
Definition: regtest.c:424
BOOL WINAPI AllocConsole(VOID)
Definition: console.c:48
void test9(void)
Definition: regtest.c:824
void dprintf(char *fmt,...)
Definition: regtest.c:11
HANDLE OutputHandle
Definition: regtest.c:8
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
void test3(void)
Definition: regtest.c:295
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define STD_INPUT_HANDLE
Definition: winbase.h:264
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleA(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
Definition: readwrite.c:1197
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
HANDLE InputHandle
Definition: regtest.c:9
void test8(void)
Definition: regtest.c:762
void test7(void)
Definition: regtest.c:718
void test2(void)
Definition: regtest.c:173
void test5(void)
Definition: regtest.c:586
void test1(void)
Definition: regtest.c:53
void test6(void)
Definition: regtest.c:609

◆ test1()

void test1 ( void  )

Definition at line 53 of file regtest.c.

54 {
55  HKEY hKey = NULL, hKey1;
58  UNICODE_STRING KeyName = ROS_STRING_INITIALIZER(L"\\Registry");
60  KEY_BASIC_INFORMATION KeyInformation[5];
61  KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
62 
63  dprintf("NtOpenKey \\Registry : ");
65  &KeyName,
67  NULL,
68  NULL);
70  dprintf("\t\t\t\tStatus =%x\n",Status);
71  if(Status==0)
72  {
73  dprintf("NtQueryKey : ");
75  ,&KeyInformation[0], sizeof(KeyInformation)
76  ,&Length);
77  dprintf("\t\t\t\t\tStatus =%x\n",Status);
78  if (Status == STATUS_SUCCESS)
79  {
80  dprintf("\tKey Name = ");
81  for (i=0;i<KeyInformation[0].NameLength/2;i++)
82  dprintf("%C",KeyInformation[0].Name[i]);
83  dprintf("\n");
84  }
85  dprintf("NtEnumerateKey : \n");
86  Index=0;
87  while(Status == STATUS_SUCCESS)
88  {
90  ,&KeyInformation[0], sizeof(KeyInformation)
91  ,&Length);
93  {
94  dprintf("\tSubKey Name = ");
95  for (i=0;i<KeyInformation[0].NameLength/2;i++)
96  dprintf("%C",KeyInformation[0].Name[i]);
97  dprintf("\n");
98  }
99  }
100  dprintf("NtClose : ");
101  Status = NtClose( hKey1 );
102  dprintf("\t\t\t\t\tStatus =%x\n",Status);
103  }
104  NtClose(hKey);
105 
106  dprintf("NtOpenKey \\Registry\\Machine : ");
107  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine");
109  &KeyName,
111  NULL,
112  NULL);
114  dprintf("\t\t\tStatus =%x\n",Status);
115 
116  dprintf("NtOpenKey System\\Setup : ");
117  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"System\\Setup");
119  , hKey1 , NULL);
120  Status = NtOpenKey ( &hKey, KEY_READ , &ObjectAttributes);
121  dprintf("\t\t\tStatus =%x\n",Status);
122  if(Status==0)
123  {
124  dprintf("NtQueryValueKey : ");
127  ,&KeyValueInformation[0], sizeof(KeyValueInformation)
128  ,&Length);
129  dprintf("\t\t\t\tStatus =%x\n",Status);
130  if (Status == STATUS_SUCCESS)
131  {
132  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
133  ,KeyValueInformation[0].DataOffset
134  ,KeyValueInformation[0].DataLength
135  ,KeyValueInformation[0].NameLength);
136  for (i=0;i<10 && i<KeyValueInformation[0].NameLength/2;i++)
137  dprintf("%C",KeyValueInformation[0].Name[i]);
138  dprintf("\n");
139  dprintf("\t\tType = %d\n",KeyValueInformation[0].Type);
140  if (KeyValueInformation[0].Type == REG_SZ)
141  dprintf("\t\tValue = %S\n",
142  (PWCHAR)((PCHAR)&KeyValueInformation[0] + KeyValueInformation[0].DataOffset));
143  }
144  dprintf("NtEnumerateValueKey : \n");
145  Index=0;
146  while(Status == STATUS_SUCCESS)
147  {
149  ,&KeyValueInformation[0], sizeof(KeyValueInformation)
150  ,&Length);
151  if(Status== STATUS_SUCCESS)
152  {
153  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
154  ,KeyValueInformation[0].DataOffset
155  ,KeyValueInformation[0].DataLength
156  ,KeyValueInformation[0].NameLength);
157  for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
158  dprintf("%C",KeyValueInformation[0].Name[i]);
159  dprintf(", Type = %d\n",KeyValueInformation[0].Type);
160  if (KeyValueInformation[0].Type == REG_SZ)
161  dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
162  +KeyValueInformation[0].DataOffset));
163  }
164  }
165  dprintf("NtClose : ");
166  Status = NtClose( hKey );
167  dprintf("\t\t\t\t\tStatus =%x\n",Status);
168  }
169  NtClose( hKey1 );
170 }
signed char * PCHAR
Definition: retypes.h:7
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
Type
Definition: Type.h:6
void dprintf(char *fmt,...)
Definition: regtest.c:11
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:632
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
static const UCHAR Index[8]
Definition: usbohci.c:18
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define REG_SZ
Definition: layer.c:22

Referenced by main().

◆ test2()

void test2 ( void  )

Definition at line 173 of file regtest.c.

174 {
175  HKEY hKey,hKey1;
179  KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
181  char Buffer[10];
182  DWORD Result;
183  dprintf("NtCreateKey volatile: \n");
184  dprintf(" \\Registry\\Machine\\Software\\test2reactos: ");
185  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
187  , NULL, NULL);
190  dprintf("\t\tStatus=%x\n",Status);
191  NtClose(hKey);
192  do_enumeratekey(L"\\Registry\\Machine\\Software");
193  dprintf(" ...\\test2 :");
194  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
196  , NULL, NULL);
199  dprintf("\t\t\t\t\tStatus=%x\n",Status);
200  dprintf(" ...\\TestVolatile :");
203  , hKey1, NULL);
206  dprintf("\t\t\t\tStatus=%x\n",Status);
207  NtClose(hKey1);
209  dprintf("NtSetValueKey reg_sz: ");
210  Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
211  dprintf("\t\t\t\tStatus=%x\n",Status);
213  dprintf("NtSetValueKey reg_dword: ");
214  Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
215  dprintf("\t\t\tStatus=%x\n",Status);
216  NtClose(hKey);
217  dprintf("NtOpenKey \\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile : ");
218  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
220  &KeyName,
222  NULL,
223  NULL);
225  dprintf("\t\t\t\tStatus =%x\n",Status);
226  if(Status==0)
227  {
228  dprintf("NtEnumerateValueKey : \n");
229  Index=0;
230  while(Status == STATUS_SUCCESS)
231  {
233  ,&KeyValueInformation[0], sizeof(KeyValueInformation)
234  ,&Length);
235  if(Status== STATUS_SUCCESS)
236  {
237  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
238  ,KeyValueInformation[0].DataOffset
239  ,KeyValueInformation[0].DataLength
240  ,KeyValueInformation[0].NameLength);
241  for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
242  dprintf("%C",KeyValueInformation[0].Name[i]);
243  dprintf(", Type = %d\n",KeyValueInformation[0].Type);
244  if (KeyValueInformation[0].Type == REG_SZ)
245  dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
246  +KeyValueInformation[0].DataOffset));
247  }
248  }
249  }
250  NtClose(hKey);
251  dprintf("delete \\Registry\\Machine\\software\\test2reactos ?");
253  if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
254  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
256  &KeyName,
258  NULL,
259  NULL);
260  dprintf("NtOpenKey : ");
262  dprintf("\t\t\t\tStatus =%x\n",Status);
263  dprintf("NtDeleteKey : ");
264  Status=NtDeleteKey(hKey);
265  dprintf("\t\t\t\tStatus =%x\n",Status);
266  NtClose(hKey);
267  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
269  &KeyName,
271  NULL,
272  NULL);
273  dprintf("NtOpenKey : ");
275  dprintf("\t\t\t\tStatus =%x\n",Status);
276  dprintf("NtDeleteKey : ");
277  Status=NtDeleteKey(hKey);
278  dprintf("\t\t\t\tStatus =%x\n",Status);
279  NtClose(hKey);
280  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
282  &KeyName,
284  NULL,
285  NULL);
286  dprintf("NtOpenKey : ");
288  dprintf("\t\t\t\tStatus =%x\n",Status);
289  dprintf("NtDeleteKey : ");
290  Status=NtDeleteKey(hKey);
291  dprintf("\t\t\t\tStatus =%x\n",Status);
292  NtClose(hKey);
293 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
void do_enumeratekey(PWSTR Name)
Definition: regtest.c:22
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
Type
Definition: Type.h:6
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleA(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
Definition: readwrite.c:1197
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
HANDLE InputHandle
Definition: regtest.c:9
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
Definition: ntapi.c:408
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by main(), register_classes(), RegisterWindowClasses(), START_TEST(), test_add_string(), test_CompareStringOrdinal(), test_csparentdc(), test_FileMapping(), test_loadres(), test_newlines(), test_ScriptItemize(), test_ScriptShape(), test_ScriptShapeOpenType(), test_SharedMem(), test_stringtable(), test_write_ex(), TestCaps(), and warning().

◆ test3()

void test3 ( void  )

Definition at line 295 of file regtest.c.

296 {
297  HKEY hKey,hKey1;
301  KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
303  char Buffer[10];
304  DWORD Result;
305  dprintf("NtCreateKey non volatile: \n");
306  dprintf(" \\Registry\\Machine\\Software\\test3reactos: ");
307  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
309  , NULL, NULL);
312  dprintf("\t\tStatus=%x\n",Status);
313  NtClose(hKey);
314  do_enumeratekey(L"\\Registry\\Machine\\Software");
315  dprintf("NtOpenKey: ");
317  dprintf("\t\tStatus=%x\n",Status);
318  NtClose(hKey);
319  dprintf(" ...\\test3 :");
320  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
322  , NULL, NULL);
325  dprintf("\t\t\t\t\tStatus=%x\n",Status);
326  dprintf("NtOpenKey: ");
328  dprintf("\t\tStatus=%x\n",Status);
329  NtClose(hKey);
330  dprintf(" ...\\testNonVolatile :");
331  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"TestNonVolatile");
333  , hKey1, NULL);
336  dprintf("\t\t\t\tStatus=%x\n",Status);
337  NtClose(hKey1);
339  dprintf("NtSetValueKey reg_sz: ");
340  Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
341  dprintf("\t\t\t\tStatus=%x\n",Status);
343  dprintf("NtSetValueKey reg_dword: ");
344  Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
345  dprintf("\t\t\tStatus=%x\n",Status);
346  NtClose(hKey);
347  dprintf("NtOpenKey \\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile : ");
348  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile");
350  &KeyName,
352  NULL,
353  NULL);
355  dprintf("\t\t\t\tStatus =%x\n",Status);
356  if(Status==0)
357  {
358  dprintf("NtEnumerateValueKey : \n");
359  Index=0;
360  while(Status == STATUS_SUCCESS)
361  {
363  ,&KeyValueInformation[0], sizeof(KeyValueInformation)
364  ,&Length);
365  if(Status== STATUS_SUCCESS)
366  {
367  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
368  ,KeyValueInformation[0].DataOffset
369  ,KeyValueInformation[0].DataLength
370  ,KeyValueInformation[0].NameLength);
371  for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
372  dprintf("%C",KeyValueInformation[0].Name[i]);
373  dprintf(", Type = %d\n",KeyValueInformation[0].Type);
374  if (KeyValueInformation[0].Type == REG_SZ)
375  dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
376  +KeyValueInformation[0].DataOffset));
377  }
378  }
379  }
380  NtClose(hKey);
381  dprintf("delete \\Registry\\Machine\\software\\test3reactos ?");
383  if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
384  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonvolatile");
386  &KeyName,
388  NULL,
389  NULL);
390  dprintf("NtOpenKey : ");
392  dprintf("\t\t\t\tStatus =%x\n",Status);
393  dprintf("NtDeleteKey : ");
394  Status=NtDeleteKey(hKey);
395  dprintf("\t\t\t\tStatus =%x\n",Status);
396  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
398  &KeyName,
400  NULL,
401  NULL);
402  dprintf("NtOpenKey : ");
404  dprintf("\t\t\t\tStatus =%x\n",Status);
405  dprintf("NtDeleteKey : ");
406  Status=NtDeleteKey(hKey);
407  dprintf("\t\t\t\tStatus =%x\n",Status);
408  NtClose(hKey);
409  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
411  &KeyName,
413  NULL,
414  NULL);
415  dprintf("NtOpenKey : ");
417  dprintf("\t\t\t\tStatus =%x\n",Status);
418  dprintf("NtDeleteKey : ");
419  Status=NtDeleteKey(hKey);
420  dprintf("\t\t\t\tStatus =%x\n",Status);
421  NtClose(hKey);
422 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
void do_enumeratekey(PWSTR Name)
Definition: regtest.c:22
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
Type
Definition: Type.h:6
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleA(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
Definition: readwrite.c:1197
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
HANDLE InputHandle
Definition: regtest.c:9
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
Definition: ntapi.c:408
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by main().

◆ test4()

void test4 ( void  )

Definition at line 424 of file regtest.c.

425 {
426  HKEY hKey = NULL,hKey1;
427  DWORD dwDisposition;
428  DWORD dwError;
429  DWORD RegDataType, RegDataSize;
430  BOOL GlobalFifoEnable;
431  HKEY hPortKey;
432  DWORD RegDisposition;
433  WCHAR szClass[260];
434  DWORD cchClass;
435  DWORD cSubKeys;
436  DWORD cchMaxSubkey;
437  DWORD cchMaxClass;
438  DWORD cValues;
439  DWORD cchMaxValueName;
440  DWORD cbMaxValueData;
441  DWORD cbSecurityDescriptor;
442  FILETIME ftLastWriteTime;
443  SYSTEMTIME LastWriteTime;
444 
445  dprintf ("RegOpenKeyExW HKLM\\System\\Setup: ");
447  L"System\\Setup",
448  0,
450  &hKey1);
451  dprintf("\t\tdwError =%x\n",dwError);
452  if (dwError == ERROR_SUCCESS)
453  {
454  dprintf("RegQueryInfoKeyW: ");
455  cchClass=260;
456  dwError = RegQueryInfoKeyW(hKey1
457  , szClass, &cchClass, NULL, &cSubKeys
458  , &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
459  , &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
460  dprintf ("\t\t\t\tdwError %x\n", dwError);
461  FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
462  dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
463  ,LastWriteTime.wMonth
464  ,LastWriteTime.wDay
465  ,LastWriteTime.wYear
466  ,LastWriteTime.wHour
467  ,LastWriteTime.wMinute
468  ,LastWriteTime.wSecond
469  ,LastWriteTime.wMilliseconds
470  );
471  }
472 
473 
474  dprintf ("RegOpenKeyExW: ");
476  L"System\\ControlSet001\\Services\\Serial",
477  0,
479  &hKey);
480  dprintf ("\t\t\t\t\tdwError %x\n", dwError);
481  RegDataSize = sizeof(GlobalFifoEnable);
482  if (dwError == ERROR_SUCCESS)
483  {
484  dprintf ("RegQueryValueExW: ");
485  dwError = RegQueryValueExW(hKey,
486  L"ForceFifoEnable",
487  NULL,
488  &RegDataType,
489  (PBYTE)&GlobalFifoEnable,
490  &RegDataSize);
491  dprintf("\t\t\t\tdwError =%x\n",dwError);
492  if (dwError == 0)
493  {
494  dprintf("\tValue:DT=%d, DS=%d, Value=%d\n"
495  ,RegDataType
496  ,RegDataSize
497  ,GlobalFifoEnable);
498  }
499  }
500  dprintf ("RegCreateKeyExW: ");
501  dwError = RegCreateKeyExW(hKey,
502  L"Parameters\\Serial001",
503  0,
504  NULL,
505  0,
507  NULL,
508  &hPortKey,
509  &RegDisposition
510  );
511  dprintf ("\t\t\t\tdwError %x\n", dwError);
512 
513  dprintf ("RegCreateKeyExW: ");
515  L"Software\\test4reactos\\test",
516  0,
517  NULL,
520  NULL,
521  &hKey,
522  &dwDisposition);
523 
524  dprintf ("\t\t\t\tdwError %x ", dwError);
525  dprintf ("dwDisposition %x\n", dwDisposition);
526  if (dwError == ERROR_SUCCESS)
527  {
528  dprintf ("RegSetValueExW: ");
529  dwError = RegSetValueExW (hKey,
530  L"TestValue",
531  0,
532  REG_SZ,
533  (BYTE*)L"TestString",
534  20);
535 
536  dprintf ("\t\t\t\tdwError %x\n", dwError);
537  dprintf ("RegCloseKey: ");
538  dwError = RegCloseKey (hKey);
539  dprintf ("\t\t\t\t\tdwError %x\n", dwError);
540  }
541  dprintf ("\n\n");
542 
543  hKey = NULL;
544 
545  dprintf ("RegCreateKeyExW: ");
547  L"software\\Test",
548  0,
549  NULL,
552  NULL,
553  &hKey,
554  &dwDisposition);
555 
556  dprintf ("\t\t\t\tdwError %x ", dwError);
557  dprintf ("dwDisposition %x\n", dwDisposition);
558 
559 
560  if (dwError == ERROR_SUCCESS)
561  {
562  dprintf("RegQueryInfoKeyW: ");
563  cchClass=260;
564  dwError = RegQueryInfoKeyW(hKey
565  , szClass, &cchClass, NULL, &cSubKeys
566  , &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
567  , &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
568  dprintf ("\t\t\t\tdwError %x\n", dwError);
569  FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
570  dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
571  ,LastWriteTime.wMonth
572  ,LastWriteTime.wDay
573  ,LastWriteTime.wYear
574  ,LastWriteTime.wHour
575  ,LastWriteTime.wMinute
576  ,LastWriteTime.wSecond
577  ,LastWriteTime.wMilliseconds
578  );
579  dprintf ("RegCloseKey: ");
580  dwError = RegCloseKey (hKey);
581  dprintf ("\t\t\t\t\tdwError %x\n", dwError);
582  }
583  dprintf ("\nTests done...\n");
584 }
#define ERROR_SUCCESS
Definition: deptool.c:10
void dprintf(char *fmt,...)
Definition: regtest.c:11
WORD wMonth
Definition: winbase.h:871
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
WORD wYear
Definition: winbase.h:870
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
WORD wMinute
Definition: winbase.h:875
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
WORD wSecond
Definition: winbase.h:876
WORD wMilliseconds
Definition: winbase.h:877
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
WORD wDay
Definition: winbase.h:873
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
WORD wHour
Definition: winbase.h:874
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
BYTE * PBYTE
Definition: pedump.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by main().

◆ test5()

void test5 ( void  )

Definition at line 586 of file regtest.c.

587 {
588  HKEY hKey;
592 
593  dprintf("NtOpenKey : \n");
594  dprintf(" \\Registry\\Machine\\Software\\reactos : ");
595  RtlRosInitUnicodeStringFromLiteral(&KeyName,L"\\Registry\\Machine\\Software\\reactos");
597  , NULL, NULL);
599  dprintf("\t\tStatus=%x\n",Status);
600  dprintf("NtFlushKey : \n");
601  Status = NtFlushKey(hKey);
602  dprintf("\t\tStatus=%x\n",Status);
603  dprintf("NtCloseKey : \n");
604  Status=NtClose(hKey);
605  dprintf("\t\tStatus=%x\n",Status);
606 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
Definition: ntapi.c:1065
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106

Referenced by main().

◆ test6()

void test6 ( void  )

Definition at line 609 of file regtest.c.

610 {
611  HKEY hKey;
615  KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
616  ULONG Length,i;
617 
618  dprintf("Create target key\n");
619  dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Reactos\n");
620  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Reactos");
622  , NULL, NULL);
625  dprintf(" NtCreateKey() called (Status %lx)\n",Status);
626  if (!NT_SUCCESS(Status))
627  return;
628 
629  dprintf("Create target value\n");
630  dprintf(" Value: TestValue = 'Test String'\n");
632  Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"TestString",22);
633  dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
634  if (!NT_SUCCESS(Status))
635  return;
636 
637  dprintf("Close target key\n");
638  NtClose(hKey);
639 
640 
641  dprintf("Create link key\n");
642  dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
643  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
645  &KeyName,
647  NULL,
648  NULL);
649  Status = NtCreateKey(&hKey,
652  0,
653  NULL,
655  NULL);
656  dprintf(" NtCreateKey() called (Status %lx)\n",Status);
657  if (!NT_SUCCESS(Status))
658  return;
659 
660  dprintf("Create link value\n");
661  dprintf(" Value: SymbolicLinkValue = '\\Registry\\Machine\\SOFTWARE\\Reactos'\n");
662  RtlRosInitUnicodeStringFromLiteral(&ValueName, L"SymbolicLinkValue");
663  Status=NtSetValueKey(hKey,&ValueName,0,REG_LINK,(PVOID)L"\\Registry\\Machine\\SOFTWARE\\Reactos",68);
664  dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
665  if (!NT_SUCCESS(Status))
666  {
667  dprintf("Creating link value failed! Test failed!\n");
668  NtClose(hKey);
669  return;
670  }
671 
672  dprintf("Close link key\n");
673  NtClose(hKey);
674 
675  dprintf("Open link key\n");
676  dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
677  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
679  , NULL, NULL);
682  dprintf(" NtCreateKey() called (Status %lx)\n",Status);
683  if (!NT_SUCCESS(Status))
684  return;
685 
686  dprintf("Query value\n");
687  dprintf(" Value: TestValue\n");
689  Status=NtQueryValueKey(hKey,
690  &ValueName,
692  &KeyValueInformation[0],
693  sizeof(KeyValueInformation),
694  &Length);
695  dprintf(" NtQueryValueKey() called (Status %lx)\n",Status);
696  if (Status == STATUS_SUCCESS)
697  {
698  dprintf(" Value: Type %d DataLength %d NameLength %d Name '",
699  KeyValueInformation[0].Type,
700  KeyValueInformation[0].DataLength,
701  KeyValueInformation[0].NameLength);
702  for (i=0; i < KeyValueInformation[0].NameLength / sizeof(WCHAR); i++)
703  dprintf("%C",KeyValueInformation[0].Name[i]);
704  dprintf("'\n");
705  if (KeyValueInformation[0].Type == REG_SZ)
706  dprintf(" Value '%S'\n",
707  KeyValueInformation[0].Name+1
708  +KeyValueInformation[0].NameLength/2);
709  }
710 
711  dprintf("Close link key\n");
712  NtClose(hKey);
713 
714  dprintf("Test successful!\n");
715 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
Type
Definition: Type.h:6
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
#define OBJ_OPENLINK
Definition: winternl.h:230
#define REG_OPTION_CREATE_LINK
Definition: nt_native.h:1063
#define OBJ_OPENIF
Definition: winternl.h:229
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define REG_LINK
Definition: nt_native.h:1500
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_CREATE_LINK
Definition: nt_native.h:1021
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
unsigned int ULONG
Definition: retypes.h:1
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define REG_SZ
Definition: layer.c:22

Referenced by main().

◆ test7()

void test7 ( void  )

Definition at line 718 of file regtest.c.

719 {
720  HKEY hKey;
724 
725  dprintf("Open link key\n");
726  dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
727  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
729  &KeyName,
731  NULL,
732  NULL);
733  Status = NtCreateKey(&hKey,
736  0,
737  NULL,
739  NULL);
740  dprintf(" NtCreateKey() called (Status %lx)\n",Status);
741  if (!NT_SUCCESS(Status))
742  {
743  dprintf("Could not open the link key. Please run the link create test first!\n");
744  return;
745  }
746 
747  dprintf("Delete link value\n");
748  RtlRosInitUnicodeStringFromLiteral(&ValueName, L"SymbolicLinkValue");
749  Status = NtDeleteValueKey(hKey,
750  &ValueName);
751  dprintf(" NtDeleteValueKey() called (Status %lx)\n",Status);
752 
753  dprintf("Delete link key\n");
754  Status=NtDeleteKey(hKey);
755  dprintf(" NtDeleteKey() called (Status %lx)\n",Status);
756 
757  dprintf("Close link key\n");
758  NtClose(hKey);
759 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
void dprintf(char *fmt,...)
Definition: regtest.c:11
#define REG_OPTION_OPEN_LINK
Definition: nt_native.h:1070
LONG NTSTATUS
Definition: precomp.h:26
#define OBJ_OPENLINK
Definition: winternl.h:230
#define OBJ_OPENIF
Definition: winternl.h:229
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:994
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
Definition: ntapi.c:408
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060

Referenced by main().

◆ test8()

void test8 ( void  )

Definition at line 762 of file regtest.c.

763 {
767  LONG dwError;
768  TOKEN_PRIVILEGES NewPrivileges;
769  HANDLE Token,hKey;
770  LUID Luid;
771  BOOLEAN bRes;
774 // ,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&Token);
775  dprintf("\t\t\t\tStatus =%x\n",Status);
776 // bRes=LookupPrivilegeValueA(NULL,SE_RESTORE_NAME,&Luid);
777 // dprintf("\t\t\t\tbRes =%x\n",bRes);
778  NewPrivileges.PrivilegeCount = 1;
779  NewPrivileges.Privileges[0].Luid = Luid;
780 // NewPrivileges.Privileges[0].Luid.u.LowPart=18;
781 // NewPrivileges.Privileges[0].Luid.u.HighPart=0;
782  NewPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
783 
784 // Status = NtAdjustPrivilegesToken(
785  bRes = AdjustTokenPrivileges(
786  Token,
787  FALSE,
788  &NewPrivileges,
789  0,
790  NULL,
791  NULL
792  );
793  dprintf("\t\t\t\tbRes =%x\n",bRes);
794 
795 // Status=NtClose(Token);
796 // dprintf("\t\t\t\tStatus =%x\n",Status);
797 
798 
801  , NULL, NULL);
803  dprintf("\t\t\t\tStatus =%x\n",Status);
804  dwError=RegLoadKey(HKEY_LOCAL_MACHINE,"def"
805  ,"test5");
806  dprintf("\t\t\t\tdwError =%x\n",dwError);
807 
808  dprintf("NtOpenKey \\Registry\\Machine : ");
809  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine");
811  &KeyName,
813  NULL,
814  NULL);
816  dprintf("\t\t\tStatus =%x\n",Status);
819  , NULL, NULL);
821  dprintf("\t\t\t\tStatus =%x\n",Status);
822 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
void dprintf(char *fmt,...)
Definition: regtest.c:11
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
$ULONG PrivilegeCount
Definition: setypes.h:969
NTSTATUS NTAPI NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle)
Definition: security.c:350
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtLoadKey(IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN POBJECT_ATTRIBUTES FileObjectAttributes)
Definition: ntapi.c:1109
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
Status
Definition: gdiplustypes.h:24
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:970
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RegLoadKey
Definition: winreg.h:515
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by main().

◆ test9()

void test9 ( void  )

Definition at line 824 of file regtest.c.

825 {
826  HKEY hKey = NULL, hKey1;
829  UNICODE_STRING KeyName = ROS_STRING_INITIALIZER(L"\\Registry");
831  KEY_BASIC_INFORMATION KeyInformation[5];
832  KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
833 
834  dprintf("NtOpenKey \\Registry : ");
836  &KeyName,
838  NULL,
839  NULL);
841  dprintf("\t\t\t\tStatus =%x\n",Status);
842  if (Status == 0) {
843  dprintf("NtQueryKey : ");
844  Status = NtQueryKey(hKey1, KeyBasicInformation, &KeyInformation[0], sizeof(KeyInformation), &Length);
845  dprintf("\t\t\t\t\tStatus =%x\n",Status);
846  if (Status == STATUS_SUCCESS) {
847  dprintf("\tKey Name = ");
848  for (i=0;i<KeyInformation[0].NameLength/2;i++)
849  dprintf("%C",KeyInformation[0].Name[i]);
850  dprintf("\n");
851  }
852  dprintf("NtEnumerateKey : \n");
853  Index = 0;
854  while (Status == STATUS_SUCCESS) {
855  Status = NtEnumerateKey(hKey1,Index++,KeyBasicInformation,&KeyInformation[0], sizeof(KeyInformation),&Length);
856  if (Status == STATUS_SUCCESS) {
857  dprintf("\tSubKey Name = ");
858  for (i = 0; i < KeyInformation[0].NameLength / 2; i++)
859  dprintf("%C",KeyInformation[0].Name[i]);
860  dprintf("\n");
861  }
862  }
863  dprintf("NtClose : ");
864  Status = NtClose( hKey1 );
865  dprintf("\t\t\t\t\tStatus =%x\n",Status);
866  }
867  NtClose(hKey); // RobD - hKey unused so-far, should this have been hKey1 ???
868 
869  dprintf("NtOpenKey \\Registry\\Machine : ");
870  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"\\Registry\\Machine");
872  &KeyName,
874  NULL,
875  NULL);
877  dprintf("\t\t\tStatus =%x\n",Status);
878 
879 //Status of c0000001 opening \Registry\Machine\System\CurrentControlSet\Services\Tcpip\Linkage
880 
881 // dprintf("NtOpenKey System\\CurrentControlSet\\Services\\Tcpip : ");
882 // RtlRosInitUnicodeStringFromLiteral(&KeyName, L"System\\CurrentControlSet\\Services\\Tcpip");
883 #if 1
884  dprintf("NtOpenKey System\\ControlSet001\\Services\\Tcpip\\Parameters : ");
885  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"System\\ControlSet001\\Services\\Tcpip\\Parameters");
886 #else
887  dprintf("NtOpenKey System\\CurrentControlSet\\Services\\Tcpip : ");
888  RtlRosInitUnicodeStringFromLiteral(&KeyName, L"System\\CurrentControlSet\\Services\\Tcpip");
889 #endif
892  dprintf("\t\t\tStatus =%x\n",Status);
893  if (Status == 0) {
894  dprintf("NtQueryValueKey : ");
896  Status = NtQueryValueKey(hKey, &KeyName, KeyValueFullInformation, &KeyValueInformation[0], sizeof(KeyValueInformation), &Length);
897  dprintf("\t\t\t\tStatus =%x\n",Status);
898  if (Status == STATUS_SUCCESS) {
899  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
900  ,KeyValueInformation[0].DataOffset
901  ,KeyValueInformation[0].DataLength
902  ,KeyValueInformation[0].NameLength);
903  for (i = 0; i < 10 && i < KeyValueInformation[0].NameLength / 2; i++)
904  dprintf("%C", KeyValueInformation[0].Name[i]);
905  dprintf("\n");
906  dprintf("\t\tType = %d\n", KeyValueInformation[0].Type);
907  if (KeyValueInformation[0].Type == REG_SZ)
908  //dprintf("\t\tValue = %S\n", KeyValueInformation[0].Name + 1 + KeyValueInformation[0].NameLength / 2);
909  dprintf("\t\tValue = %S\n", KeyValueInformation[0].Name + KeyValueInformation[0].NameLength / 2);
910  }
911  dprintf("NtEnumerateValueKey : \n");
912  Index = 0;
913  while (Status == STATUS_SUCCESS) {
914  Status = NtEnumerateValueKey(hKey, Index++, KeyValueFullInformation, &KeyValueInformation[0], sizeof(KeyValueInformation), &Length);
915  if (Status == STATUS_SUCCESS) {
916  dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
917  ,KeyValueInformation[0].DataOffset
918  ,KeyValueInformation[0].DataLength
919  ,KeyValueInformation[0].NameLength);
920  for (i = 0; i < KeyValueInformation[0].NameLength / 2; i++)
921  dprintf("%C", KeyValueInformation[0].Name[i]);
922  dprintf(", Type = %d\n", KeyValueInformation[0].Type);
923  if (KeyValueInformation[0].Type == REG_SZ)
924  dprintf("\t\tValue = %S\n", ((char*)&KeyValueInformation[0]+KeyValueInformation[0].DataOffset));
925  if (KeyValueInformation[0].Type == REG_DWORD)
926  dprintf("\t\tValue = %X\n", *((DWORD*)((char*)&KeyValueInformation[0]+KeyValueInformation[0].DataOffset)));
927  }
928  }
929  dprintf("NtClose : ");
930  Status = NtClose(hKey);
931  dprintf("\t\t\t\t\tStatus =%x\n", Status);
932  }
933  NtClose(hKey1);
934 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
Type
Definition: Type.h:6
void dprintf(char *fmt,...)
Definition: regtest.c:11
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:632
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
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
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by main().

Variable Documentation

◆ InputHandle

HANDLE InputHandle

Definition at line 9 of file regtest.c.

Referenced by main(), test2(), and test3().

◆ OutputHandle

HANDLE OutputHandle

Definition at line 8 of file regtest.c.

Referenced by dprintf(), and main().