Government Security
Network Security Resources

Jump to content

Photo

Driver Do Not Work

- - - - -
  • Please log in to reply
3 replies to this topic

#1 VESA

VESA

    Private

  • Members
  • 2 posts

Posted 17 September 2011 - 07:18 AM

I am creating a driver that use some VBE functions but when I load the driver the system restart. Here is a part of the code:


NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath)

{

NTSTATUS status;

UINT uiIndex = 0;

PDEVICE_OBJECT pDeviceObject = NULL;

UNICODE_STRING usDriverName, usDosDeviceName;

IO_STATUS_BLOCK isb;

OBJECT_ATTRIBUTES oa;

LARGE_INTEGER AllocationSize;

UNICODE_STRING Directory;

X86_BIOS_REGISTERS biosregisters;

USHORT Segment;

USHORT Offset;

ULONG BufSize = 4096;

HANDLE manipulador_do_arquivo = 0;

DbgPrint("DriverEntry Called \r\n");



memset((void *)&oa, 0, sizeof(OBJECT_ATTRIBUTES));

 

RtlInitUnicodeString(&Directory, L"\\??\\C:\\Users\\Username\\Desktop\\VIDEO_ADAPTER.TXT");



InitializeObjectAttributes(&oa, &Directory, OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, NULL, NULL);

if (ZwCreateFile(&manipulador_do_arquivo, GENERIC_WRITE, &oa, &isb, NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0)==STATUS_SUCCESS)

{

memset((void *)&biosregisters, 0, sizeof(X86_BIOS_REGISTERS);

x86BiosAllocateBuffer(&BufSize, &Segment, &Offset);

biosregisters.Eax = 0x4F00;

biosregisters.SegEs = Offset;

biosregisters.Offset = Segment;

ret_VAL = x86BiosCall(0x10, &biosregisters);

if (ret_VAL == TRUE)

{

if(biosregisters.Eax == 0000004F)

{

x86BiosReadMemory(biosregisters.SegEs, LOWORD(biosregisters.Edi), &pVbeInfo, sizeof(VbeInfo));

booleano = TRUE;

}

else

{

booleano = FALSE;

}

if(booleano)

ZwWriteFile(manipulador_do_arquivo, NULL, NULL, NULL, &isb, pVbeInfo->VbeSignature, NULL, NULL);

else

ZwWriteFile(manipulador_do_arquivo, NULL, NULL, NULL, &isb,"Não Funcionou", NULL, NULL);

ZwClose(manipulador_do_arquivo);



Where is my error?



#2 OpticHash

OpticHash

    Private

  • Members
  • 5 posts

Posted 19 September 2011 - 02:22 PM

Driver programming is notoriously difficult and rife with problems if not done correctly. Was there any debug info?

This tool might help you out a little bit with debugging drivers. With it you can use virtual machines like VMware or Virtualbox and debug your drivers from within Visual Studio.
http://visualddk.sysprogs.org/
Posted Image

#3 VESA

VESA

    Private

  • Members
  • 2 posts

Posted 19 September 2011 - 02:44 PM

Driver programming is notoriously difficult and rife with problems if not done correctly. Was there any debug info?

This tool might help you out a little bit with debugging drivers. With it you can use virtual machines like VMware or Virtualbox and debug your drivers from within Visual Studio.
http://visualddk.sysprogs.org/



I have this tool but this is for Visual Studio 2005 and I have Visual Studio 2008. How can I debug my driver?

#4 OpticHash

OpticHash

    Private

  • Members
  • 5 posts

Posted 21 September 2011 - 12:46 AM


Driver programming is notoriously difficult and rife with problems if not done correctly. Was there any debug info?

This tool might help you out a little bit with debugging drivers. With it you can use virtual machines like VMware or Virtualbox and debug your drivers from within Visual Studio.
http://visualddk.sysprogs.org/



I have this tool but this is for Visual Studio 2005 and I have Visual Studio 2008. How can I debug my driver?

Compatibility

VisualDDK supports developing & debugging both x86 and x64 drivers on both singleprocessor and multiprocessor systems. The following versions of Visual Studio are supported:

Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
VisualDDK was tested with the following versions of DDK/WDK:

Windows XP DDK build 2600.1106
WDK build 6000
WDK build 7600
Posted Image