阅读:1505回复:2
读注册表失败?什么原因?
PRTL_QUERY_REGISTRY_TABLE parameters = NULL;
NTSTATUS status = STATUS_SUCCESS; UNICODE_STRING parametersPath; UNICODE_STRING defaultUnicodeName; BEEP_MODE beep; UNICODE_STRING regPath; //USHORT queriesPlusOne = 5; USHORT queriesPlusOne = 2; RTL_QUERY_REGISTRY_TABLE QueryTable[2]; LONG Type,Typedefault=8; RtlInitUnicodeString( ®Path, TOUCH_REG_PATH ); RtlInitUnicodeString(¶metersPath, NULL); parametersPath.MaximumLength = regPath.Length + sizeof(UNICODE_NULL); parametersPath.Buffer = ExAllocatePool(PagedPool, parametersPath.MaximumLength); if (!parametersPath.Buffer) { status = STATUS_UNSUCCESSFUL; return status; } RtlZeroMemory(parametersPath.Buffer, parametersPath.MaximumLength); RtlAppendUnicodeToString(¶metersPath, regPath.Buffer); RtlZeroMemory(&beep, sizeof(BEEP_MODE)); RtlZeroMemory( QueryTable, sizeof(QueryTable)); QueryTable[0].Name = L"BeepMode"; QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT| RTL_QUERY_REGISTRY_REQUIRED; QueryTable[0].EntryContext = &Type; //QueryTable[0].DefaultType = REG_DWORD;//REG_BINARY; //QueryTable[0].DefaultData = &Typedefault; //QueryTable[0].DefaultLength = sizeof(LONG);//sizeof(BEEP_MODE); DebugPrint("#122: parametersPath is %T", ¶metersPath ); status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE| RTL_REGISTRY_OPTIONAL, L"\\REGISTRY\\MACHINE\\SOFTWARE\\Chilin",//(PWSTR)parametersPath.Buffer, QueryTable, NULL, NULL ); status = STATUS_INVALID_PARAMETER; DebugPrint("RtlQueryRegistryValues: %x ", status); |
|
沙发#
发布于:2004-11-18 09:05
能不能得到错误码,看看什么错误?
|
|
|
板凳#
发布于:2004-11-18 16:00
try
L"\\\\REGISTRY\\\\MACHINE\\\\SOFTWARE\\\\Chilin", [编辑 - 11/18/04 by ananda] [编辑 - 11/18/04 by ananda] |
|