Hi,
I am very new to driver developement.
After looking after the code on the net .I have written the driver code to read the
registry value.the value is read sucessfully .I am able to print the value.
But I want to convert the value to string and return it.Can anybody help me to resolve the issue.
the value in registry is LKE02345867(REG_SZ).
Here is the code I have written.I could be a great help to me if part of the code is added to convert it to string
===========================
__declspec(dllexport) ULONG Readreg_SerialNum()
{
NTSTATUS status;
OBJECT_ATTRIBUTES obj;
HANDLE key;
ULONG size;
UNICODE_STRING value,name,reg1;
WCHAR string[20] = L"Serial Number";
PKEY_VALUE_PARTIAL_INFORMATION vpip;
size=0;
RtlInitUnicodeString(&name,L"\Registry\Machine\Software\bmc\insert\configuration\PROM");
InitializeObjectAttributes(&obj, &name, OBJ_CASE_INSENSITIVE, NULL, NULL);
RtlInitUnicodeString(&value, string);
status = ZwOpenKey(&key, KEY_QUERY_VALUE, &obj);
if (NT_SUCCESS(status))
{
status = ZwQueryValueKey(key, &value, KeyValuePartialInformation, NULL, 0,&size);
if ( size == 0)
{
DbgPrint(“First ZwQueryValueKey failed\n”);
}
vpip = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePool(PagedPool, size);
if (!vpip)
{
DbgPrint(“vpip 1 failed\n”);
}
status = ZwQueryValueKey(key,&value, KeyValuePartialInformation,vpip, size,&size);
if (!NT_SUCCESS(status))
{
DbgPrint(“Second ZWquery failed\n”);
}
DbgPrint(“Second ZWquery failed\n %S”,vpip->Data);
ExFreePool(vpip);
ZwClose(key);
}
Regards
Naveen