00052 {
00053
NTSTATUS status;
00054 OBJECT_ATTRIBUTES
ObjectAttributes;
00055 HANDLE BaseHandle;
00056 ULONG Sizes[] = {
sizeof(KEY_BASIC_INFORMATION),
00057
sizeof(KEY_NODE_INFORMATION),
00058
sizeof(KEY_FULL_INFORMATION) };
00059 ULONG ResultLength;
00060 PKEY_BASIC_INFORMATION pbasic;
00061 PKEY_NODE_INFORMATION pnode;
00062 PKEY_FULL_INFORMATION pfull;
00063
00064
00065
00066
00067
00068
WorkName.MaximumLength =
WORK_SIZE;
00069
WorkName.Length = 0
L;
00070
WorkName.Buffer = &(
workbuffer[0]);
00071
00072
processargs(argc, argv);
00073
00074
00075
00076
00077
00078
00079 printf(
"rtqkey: starting\n");
00080
00081 InitializeObjectAttributes(
00082 &ObjectAttributes,
00083 &WorkName,
00084 0,
00085 (HANDLE)NULL,
00086 NULL
00087 );
00088
ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE;
00089
00090 status =
NtOpenKey(
00091 &BaseHandle,
00092 KEY_QUERY_VALUE,
00093 &ObjectAttributes
00094 );
00095
if (!
NT_SUCCESS(status)) {
00096 printf(
"rtqkey: t0: %08lx\n", status);
00097
exit(1);
00098 }
00099
00100
00101
00102
00103 RtlFillMemory((PVOID)&(Buffer[0]), 1024*64, 0xaa);
00104
00105
if (
BufferSize == -1) {
00106
BufferSize = Sizes[
InfoType];
00107 }
00108
00109 status =
NtQueryKey(
00110 BaseHandle,
00111 InfoType,
00112 (PVOID)&(Buffer[0]),
00113 BufferSize,
00114 &ResultLength
00115 );
00116
00117 printf(
"status = %08lx ResultLength = %08lx\n", status, ResultLength);
00118
switch (
InfoType) {
00119
case KeyBasicInformation:
00120 pbasic = (PKEY_BASIC_INFORMATION)
Buffer;
00121 printf(
"LastWriteTime: %08lx:%08lx\n", pbasic->LastWriteTime.HighPart,
00122 pbasic->LastWriteTime.LowPart);
00123 printf(
"TitleIndex: %08lx\n", pbasic->TitleIndex);
00124 printf(
"NameLength: %08lx\n", pbasic->NameLength);
00125 printf(
"Name: '%.*ws'\n", pbasic->NameLength/2, &(pbasic->Name));
00126
break;
00127
00128
case KeyNodeInformation:
00129 pnode = (PKEY_NODE_INFORMATION)
Buffer;
00130 printf(
"LastWriteTime: %08lx:%08lx\n", pnode->LastWriteTime.HighPart,
00131 pnode->LastWriteTime.LowPart);
00132 printf(
"TitleIndex: %08lx\n", pnode->TitleIndex);
00133 printf(
"ClassOffset: %08lx\n", pnode->ClassOffset);
00134 printf(
"ClassLength: %08lx\n", pnode->ClassLength);
00135 printf(
"NameLength: %08lx\n", pnode->NameLength);
00136 printf(
"Name: '%.*ws'\n", pnode->NameLength/2, &(pnode->Name));
00137 printf(
"Class: '%.*ws'\n", pnode->ClassLength/2,
00138 (PWSTR)((PUCHAR)pnode + pnode->ClassOffset));
00139
break;
00140
00141
case KeyFullInformation:
00142 pfull = (PKEY_FULL_INFORMATION)
Buffer;
00143 printf(
"LastWriteTime: %08lx:%08lx\n", pfull->LastWriteTime.HighPart,
00144 pfull->LastWriteTime.LowPart);
00145 printf(
"TitleIndex: %08lx\n", pfull->TitleIndex);
00146 printf(
"ClassOffset: %08lx\n", pfull->ClassOffset);
00147 printf(
"ClassLength: %08lx\n", pfull->ClassLength);
00148
00149 printf(
"SubKeys: %08lx MaxNameLen: %08lx MaxClassLen: %08lx\n",
00150 pfull->SubKeys, pfull->MaxNameLen, pfull->MaxClassLen);
00151
00152 printf(
" Values: %08lx MaxValueNameLen: %08lx MaxValueDataLen: %08lx\n",
00153 pfull->Values, pfull->MaxValueNameLen, pfull->MaxValueDataLen);
00154
00155 printf(
"Class: '%.*ws'\n", pfull->ClassLength/2, pfull->Class);
00156
00157
break;
00158 }
00159
00160
NtClose(BaseHandle);
00161
exit(0);
00162 }