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?