ULONG infosize;
ULONG i;
RtlInitUnicodeString(&path1,L"\\REGISTRY\\MACHINE\\SYSTEM\
\CurrentControlSet\\Enum\\DISPLAY\\HWP2601\\4&e3ea157&0&80861100&00&02\
\Device Parameters");
InitializeObjectAttributes(&oa,&path1,OBJ_KERNEL_HANDLE,NULL,NULL);
DbgPrint("Rtl and iniobj arrtr succesful\n");
if(KeGetCurrentIrql() != PASSIVE_LEVEL)
return STATUS_INVALID_DEVICE_STATE;
status=ZwOpenKey(&hkey,KEY_READ,&oa);
if (status == STATUS_INVALID_HANDLE)
{
DbgPrint("Status Invalid");
}
if (NT_ERROR(status))
{
DbgPrint("Status error");
DbgPrint("0x%x\n",status);
}
if(NT_SUCCESS(status))
{
DbgPrint("Key Opened Successfully \n");
RtlInitUnicodeString(&ValueName,L"EDID");
status = ZwQueryValueKey( hkey,
&ValueName,
KeyValuePartialInformation,
info,
KeyInfoSize,
&KeyInfoSizeNeeded );
if( (status == STATUS_BUFFER_TOO_SMALL) || (status ==
STATUS_BUFFER_OVERFLOW) )
{
DbgPrint("Space Constraint.Allocating space...\n");
// Allocate the memory required for the key.
KeyInfoSize = KeyInfoSizeNeeded;
info = (PKEY_VALUE_PARTIAL_INFORMATION)
ExAllocatePool( NonPagedPool, KeyInfoSizeNeeded);
if(NULL == info)
{
DbgPrint("Error in allocating pool\n");
}
RtlZeroMemory( info, KeyInfoSize );
// Get the key data.
status = ZwQueryValueKey( hkey,
&ValueName,
KeyValuePartialInformation,
info,
KeyInfoSize,
&KeyInfoSizeNeeded );
if(NT_SUCCESS(status))
{
DbgPrint("Successful query and value obtained\n");
}
RtlCopyMemory(value,info->Data,sizeof(info->Data));
DbgPrint("EDID Data is : %x\n",value);
}
ZwClose(hkey);
return STATUS_SUCCESS;
}