阅读:1293回复:2
很奇怪啊,帮我看看!!!
我在学习别人编的驱动程序example时,看到如下一段源程序:
参数ParameterValue传入该例程后只是在调用RtlQueryRegistryValues函数前后发生了变化,而我没有看出对ParameterValue赋值的痕迹,请问ParameterValue是如何被改变的? NTSTATUS KmdQueryRegSzValue(IN ULONG RelativeTo, IN PWSTR Path, IN PWSTR ParameterName, IN OUT PUNICODE_STRING ParameterValue) { NTSTATUS status; RTL_QUERY_REGISTRY_TABLE paramTable[2]; if((NULL == Path) || (NULL == ParameterName) || (NULL == ParameterValue)) { return STATUS_INVALID_PARAMETER; } if((ParameterValue->Length != 0) || (ParameterValue->MaximumLength !=0) || (ParameterValue->Buffer != NULL)) { return STATUS_INVALID_PARAMETER; } RtlZeroMemory(paramTable, sizeof(paramTable)); paramTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; paramTable[0].Name = ParameterName; paramTable[0].EntryContext = ParameterValue; paramTable[0].DefaultType = REG_SZ; paramTable[0].DefaultData = L""; paramTable[0].DefaultLength = 0; status = RtlQueryRegistryValues(RelativeTo | RTL_REGISTRY_OPTIONAL, Path, ¶mTable[0], NULL, NULL); if(status != STATUS_SUCCESS) { KdPrint(("RtlQueryRegistryValues FAILED w/status=%x\n",status)); } if((STATUS_SUCCESS == status) && (ParameterValue->Buffer != NULL)) { if(ParameterValue->MaximumLength >= (ParameterValue->Length + sizeof(WCHAR))) { (ParameterValue->Buffer)[ParameterValue->Length / sizeof(WCHAR)] = UNICODE_NULL; KdPrint(("%ws\n", ParameterValue->Buffer)); } else { ExFreePool(ParameterValue->Buffer); ParameterValue->Length = 0; ParameterValue->MaximumLength = 0; ParameterValue->Buffer = 0; status = STATUS_UNSUCCESSFUL; } } return status; } 盼望指教!!!!!! |
|
最新喜欢:![]() |
沙发#
发布于:2004-03-04 11:01
[paramTable[0].EntryContext = ParameterValue;
ParameterValue是一个指针 |
|
板凳#
发布于:2004-03-04 16:41
我也是这么认为的,但是不敢确定,所以来问一下,谢谢!
希望能跟大家多学习 |
|