Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting BSOD on starting this service please help

179 views
Skip to first unread message

Shankar Shivram

unread,
Nov 8, 2010, 12:17:19 AM11/8/10
to
NTSTATUS DriverEntry(IN PDRIVER_OBJECT edidreg, IN PUNICODE_STRING
edidregpath)
{
PWSTR SymbolicLinkList = NULL;
UNICODE_STRING path1;
PWSTR regkeylocation = L"\\Registry\\Machine\\SYSTEM\
\CurrentControlSet\\Enum\\DISPLAY\\HWP265C\
\4&1b30abf3&0&80861100&00&02\\Device Parameters";
NTSTATUS status;
NTSTATUS returnvalue;
OBJECT_ATTRIBUTES oa;
HANDLE hkey = NULL;
//for ZwQueryvalue.
PKEY_VALUE_PARTIAL_INFORMATION info = NULL;
UNICODE_STRING ValueName;
ULONG KeyInfoSize = 0;
ULONG KeyInfoSizeNeeded = 0;
PULONG value = NULL;
IO_STATUS_BLOCK IoStatusBlock;


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;
}

0 new messages