6#include <rosrtl/string.h>
40 ,&KeyInformation[0],
sizeof(KeyInformation)
63 dprintf(
"NtOpenKey \\Registry : ");
75 ,&KeyInformation[0],
sizeof(KeyInformation)
90 ,&KeyInformation[0],
sizeof(KeyInformation)
106 dprintf(
"NtOpenKey \\Registry\\Machine : ");
116 dprintf(
"NtOpenKey System\\Setup : ");
127 ,&KeyValueInformation[0],
sizeof(KeyValueInformation)
132 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
133 ,KeyValueInformation[0].DataOffset
135 ,KeyValueInformation[0].NameLength);
139 dprintf(
"\t\tType = %d\n",KeyValueInformation[0].
Type);
142 (
PWCHAR)((
PCHAR)&KeyValueInformation[0] + KeyValueInformation[0].DataOffset));
144 dprintf(
"NtEnumerateValueKey : \n");
149 ,&KeyValueInformation[0],
sizeof(KeyValueInformation)
153 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
154 ,KeyValueInformation[0].DataOffset
156 ,KeyValueInformation[0].NameLength);
159 dprintf(
", Type = %d\n",KeyValueInformation[0].
Type);
161 dprintf(
"\t\tValue = %S\n",((
char*)&KeyValueInformation[0]
162 +KeyValueInformation[0].DataOffset));
183 dprintf(
"NtCreateKey volatile: \n");
184 dprintf(
" \\Registry\\Machine\\Software\\test2reactos: ");
200 dprintf(
" ...\\TestVolatile :");
209 dprintf(
"NtSetValueKey reg_sz: ");
213 dprintf(
"NtSetValueKey reg_dword: ");
217 dprintf(
"NtOpenKey \\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile : ");
228 dprintf(
"NtEnumerateValueKey : \n");
233 ,&KeyValueInformation[0],
sizeof(KeyValueInformation)
237 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
238 ,KeyValueInformation[0].DataOffset
240 ,KeyValueInformation[0].NameLength);
243 dprintf(
", Type = %d\n",KeyValueInformation[0].
Type);
245 dprintf(
"\t\tValue = %S\n",((
char*)&KeyValueInformation[0]
246 +KeyValueInformation[0].DataOffset));
251 dprintf(
"delete \\Registry\\Machine\\software\\test2reactos ?");
305 dprintf(
"NtCreateKey non volatile: \n");
306 dprintf(
" \\Registry\\Machine\\Software\\test3reactos: ");
330 dprintf(
" ...\\testNonVolatile :");
339 dprintf(
"NtSetValueKey reg_sz: ");
343 dprintf(
"NtSetValueKey reg_dword: ");
347 dprintf(
"NtOpenKey \\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile : ");
358 dprintf(
"NtEnumerateValueKey : \n");
363 ,&KeyValueInformation[0],
sizeof(KeyValueInformation)
367 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
368 ,KeyValueInformation[0].DataOffset
370 ,KeyValueInformation[0].NameLength);
373 dprintf(
", Type = %d\n",KeyValueInformation[0].
Type);
375 dprintf(
"\t\tValue = %S\n",((
char*)&KeyValueInformation[0]
376 +KeyValueInformation[0].DataOffset));
381 dprintf(
"delete \\Registry\\Machine\\software\\test3reactos ?");
429 DWORD RegDataType, RegDataSize;
430 BOOL GlobalFifoEnable;
432 DWORD RegDisposition;
439 DWORD cchMaxValueName;
440 DWORD cbMaxValueData;
441 DWORD cbSecurityDescriptor;
445 dprintf (
"RegOpenKeyExW HKLM\\System\\Setup: ");
451 dprintf(
"\t\tdwError =%x\n",dwError);
457 , szClass, &cchClass,
NULL, &cSubKeys
458 , &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
459 , &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
460 dprintf (
"\t\t\t\tdwError %x\n", dwError);
462 dprintf (
"\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
476 L"System\\ControlSet001\\Services\\Serial",
480 dprintf (
"\t\t\t\t\tdwError %x\n", dwError);
481 RegDataSize =
sizeof(GlobalFifoEnable);
484 dprintf (
"RegQueryValueExW: ");
489 (
PBYTE)&GlobalFifoEnable,
491 dprintf(
"\t\t\t\tdwError =%x\n",dwError);
494 dprintf(
"\tValue:DT=%d, DS=%d, Value=%d\n"
502 L"Parameters\\Serial001",
511 dprintf (
"\t\t\t\tdwError %x\n", dwError);
515 L"Software\\test4reactos\\test",
524 dprintf (
"\t\t\t\tdwError %x ", dwError);
525 dprintf (
"dwDisposition %x\n", dwDisposition);
533 (
BYTE*)
L"TestString",
536 dprintf (
"\t\t\t\tdwError %x\n", dwError);
539 dprintf (
"\t\t\t\t\tdwError %x\n", dwError);
556 dprintf (
"\t\t\t\tdwError %x ", dwError);
557 dprintf (
"dwDisposition %x\n", dwDisposition);
565 , szClass, &cchClass,
NULL, &cSubKeys
566 , &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
567 , &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
568 dprintf (
"\t\t\t\tdwError %x\n", dwError);
570 dprintf (
"\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
581 dprintf (
"\t\t\t\t\tdwError %x\n", dwError);
594 dprintf(
" \\Registry\\Machine\\Software\\reactos : ");
618 dprintf(
"Create target key\n");
619 dprintf(
" Key: \\Registry\\Machine\\SOFTWARE\\Reactos\n");
629 dprintf(
"Create target value\n");
630 dprintf(
" Value: TestValue = 'Test String'\n");
642 dprintf(
" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
660 dprintf(
"Create link value\n");
661 dprintf(
" Value: SymbolicLinkValue = '\\Registry\\Machine\\SOFTWARE\\Reactos'\n");
667 dprintf(
"Creating link value failed! Test failed!\n");
676 dprintf(
" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
687 dprintf(
" Value: TestValue\n");
692 &KeyValueInformation[0],
693 sizeof(KeyValueInformation),
698 dprintf(
" Value: Type %d DataLength %d NameLength %d Name '",
699 KeyValueInformation[0].
Type,
701 KeyValueInformation[0].NameLength);
707 KeyValueInformation[0].
Name+1
708 +KeyValueInformation[0].NameLength/2);
726 dprintf(
" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
743 dprintf(
"Could not open the link key. Please run the link create test first!\n");
747 dprintf(
"Delete link value\n");
793 dprintf(
"\t\t\t\tbRes =%x\n",bRes);
806 dprintf(
"\t\t\t\tdwError =%x\n",dwError);
808 dprintf(
"NtOpenKey \\Registry\\Machine : ");
834 dprintf(
"NtOpenKey \\Registry : ");
852 dprintf(
"NtEnumerateKey : \n");
869 dprintf(
"NtOpenKey \\Registry\\Machine : ");
884 dprintf(
"NtOpenKey System\\ControlSet001\\Services\\Tcpip\\Parameters : ");
887 dprintf(
"NtOpenKey System\\CurrentControlSet\\Services\\Tcpip : ");
899 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
900 ,KeyValueInformation[0].DataOffset
902 ,KeyValueInformation[0].NameLength);
903 for (
i = 0;
i < 10 &&
i < KeyValueInformation[0].
NameLength / 2;
i++)
906 dprintf(
"\t\tType = %d\n", KeyValueInformation[0].
Type);
909 dprintf(
"\t\tValue = %S\n", KeyValueInformation[0].
Name + KeyValueInformation[0].NameLength / 2);
911 dprintf(
"NtEnumerateValueKey : \n");
916 dprintf(
"\tValue:DO=%d, DL=%d, NL=%d, Name = "
917 ,KeyValueInformation[0].DataOffset
919 ,KeyValueInformation[0].NameLength);
922 dprintf(
", Type = %d\n", KeyValueInformation[0].
Type);
924 dprintf(
"\t\tValue = %S\n", ((
char*)&KeyValueInformation[0]+KeyValueInformation[0].DataOffset));
926 dprintf(
"\t\tValue = %X\n", *((
DWORD*)((
char*)&KeyValueInformation[0]+KeyValueInformation[0].DataOffset)));
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");
954 dprintf(
" 6=Registry link create test\n");
955 dprintf(
" 7=Registry link delete test\n");
957 dprintf(
" 9=Ntxx read tcp/ip key test\n");
ACPI_SIZE strlen(const char *String)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
BOOL WINAPI AllocConsole(VOID)
#define RegCloseKey(hKey)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
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)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
#define GetCurrentProcess()
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleA(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
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
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
#define OBJ_CASE_INSENSITIVE
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
#define REG_OPTION_OPEN_LINK
@ KeyValueFullInformation
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
#define REG_OPTION_CREATE_LINK
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
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_OPTION_NON_VOLATILE
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define REG_OPTION_VOLATILE
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
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)
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
NTSTATUS NTAPI NtLoadKey(IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN POBJECT_ATTRIBUTES FileObjectAttributes)
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle)
void do_enumeratekey(PWSTR Name)
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
#define STD_OUTPUT_HANDLE
#define HKEY_LOCAL_MACHINE
_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
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED