#include #include #include #include #include HANDLE OutputHandle; HANDLE InputHandle; void dprintf(char* fmt, ...) { va_list args; char buffer[255]; va_start(args,fmt); vsprintf(buffer,fmt,args); WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL); va_end(args); } void do_enumeratekey(PWSTR Name) { ULONG Index,Length,i; KEY_BASIC_INFORMATION KeyInformation[5]; NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE hKey1; UNICODE_STRING KeyName; RtlInitUnicodeString(&KeyName, Name); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE , NULL, NULL); Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes); dprintf("NtEnumerateKey : \n"); Index=0; while(Status == STATUS_SUCCESS) { Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation ,&KeyInformation[0], sizeof(KeyInformation) ,&Length); if(Status== STATUS_SUCCESS) { dprintf("\tSubKey Name = "); for (i=0;i