00058 {
00059
NTSTATUS status;
00060 OBJECT_ATTRIBUTES
ObjectAttributes;
00061 HANDLE BaseHandle;
00062 ULONG Sizes[] = {
sizeof(KEY_VALUE_BASIC_INFORMATION),
00063
sizeof(KEY_VALUE_FULL_INFORMATION) };
00064 ULONG ResultLength;
00065 PKEY_VALUE_BASIC_INFORMATION pbasic;
00066 PKEY_VALUE_FULL_INFORMATION pfull;
00067 PKEY_VALUE_PARTIAL_INFORMATION ppartial;
00068
00069
00070
00071
00072
00073
WorkName.MaximumLength =
WORK_SIZE;
00074
WorkName.Length = 0
L;
00075
WorkName.Buffer = &(
workbuffer[0]);
00076
00077
WorkName2.MaximumLength =
WORK_SIZE;
00078
WorkName2.Length = 0
L;
00079
WorkName2.Buffer = &(
workbuffer2[0]);
00080
00081
processargs(argc, argv);
00082
00083
00084
00085
00086
00087
00088 printf(
"rtqkey: starting\n");
00089
00090 InitializeObjectAttributes(
00091 &ObjectAttributes,
00092 &WorkName,
00093 0,
00094 (HANDLE)NULL,
00095 NULL
00096 );
00097
ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE;
00098
00099 status =
NtOpenKey(
00100 &BaseHandle,
00101 KEY_QUERY_VALUE,
00102 &ObjectAttributes
00103 );
00104
if (!
NT_SUCCESS(status)) {
00105 printf(
"rtqkey: t0: %08lx\n", status);
00106
exit(1);
00107 }
00108
00109
00110
00111
00112 RtlFillMemory((PVOID)&(Buffer[0]), 1024*64, 0xaa);
00113
00114
if (
BufferSize == -1) {
00115
BufferSize = Sizes[
InfoType];
00116 }
00117
00118 status =
NtQueryValueKey(
00119 BaseHandle,
00120 &WorkName2,
00121 InfoType,
00122 (PVOID)&(Buffer[0]),
00123 BufferSize,
00124 &ResultLength
00125 );
00126
00127 printf(
"status = %08lx ResultLength = %08lx\n", status, ResultLength);
00128
switch (
InfoType) {
00129
case KeyValueBasicInformation:
00130 pbasic = (PKEY_VALUE_BASIC_INFORMATION)
Buffer;
00131 printf(
"TitleIndex: %08lx\n", pbasic->TitleIndex);
00132 printf(
" Type: %08lx\n", pbasic->Type);
00133 printf(
"NameLength: %08lx\n", pbasic->NameLength);
00134 printf(
" Name: '%.*ws'\n", pbasic->NameLength/2, &(pbasic->Name));
00135
break;
00136
00137
case KeyValueFullInformation:
00138 pfull = (PKEY_VALUE_FULL_INFORMATION)
Buffer;
00139 printf(
"TitleIndex: %08lx\n", pfull->TitleIndex);
00140 printf(
" Type: %08lx\n", pfull->Type);
00141 printf(
"DataOffset: %08lx\n", pfull->DataOffset);
00142 printf(
"DataLength: %08lx\n", pfull->DataLength);
00143 printf(
"NameLength: %08lx\n", pfull->NameLength);
00144 printf(
" Name: '%.*ws'\n", pfull->NameLength/2, &(pfull->Name));
00145 printf(
" Data: '%.*ws'\n", pfull->DataLength/2,
00146 ((PUCHAR)pfull + pfull->DataOffset) );
00147
break;
00148
00149
case KeyValuePartialInformation:
00150 ppartial = (PKEY_VALUE_PARTIAL_INFORMATION)
Buffer;
00151 printf(
"TitleIndex: %08lx\n", ppartial->TitleIndex);
00152 printf(
" Type: %08lx\n", ppartial->Type);
00153 printf(
"DataLength: %08lx\n", ppartial->DataLength);
00154 printf(
" Data: '%.*ws'\n", ppartial->DataLength/2,
00155 ((PUCHAR)&(ppartial->Data)));
00156
break;
00157 }
00158
00159
NtClose(BaseHandle);
00160
exit(0);
00161 }