Jump to content
  • Advertisement

Pixel Clock

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

97 Neutral

About Pixel Clock

  • Rank
    Newbie
  1. Pixel Clock

    VBE Function failed

    Yes, I am trying to access directly the hardware of the video adapter but when I call the INT 0x10(VIDEO BIOS) the VBE function always failed with al != 4f
  2. I am trying to use the int 0x10(VIDEO BIOS) but it always returns al != 0x4f(VBE Function failed). This is the code that I write in a driver: USHORT GetVbeMode() { __asm { cli mov eax,cr0 mov Cr0Reg,eax and eax,0xffffffff mov cr0,eax mov eax,0x4F03 ;VESA VBE Function INT 0x10 ;VIDEO BIOS cmp al,0x4F jnz falhou ;always al != 4f mov Resultado,bx mov eax,Cr0Reg mov cr0,eax sti jmp final falhou mov Resultado,0 mov eax,Cr0Reg mov cr0,eax sti jmp final final: } return Resultado; } What is wrong at this code that I write???
  3. I can get the address of the linear frame buffer with a function that I create but this is a physical address. How can I translate this address to a virtual address or if it is not possible how can I get the virtual address of the LFB?
  4. I can get the address of the linear frame buffer with a function that I create but this is a physical address. How can I translate this address to a virtual address or if it is not possible how can I get the virtual address of the LFB?
  5. Pixel Clock

    VBE Function failed

    WHY NOBODY ANSWER??? WHAT IS YOUR PROBLEM???
  6. I am create a driver to get the Device ID, Vendor ID, LFB and VBE Mode. The driver that I create already get the Device ID, Vendor ID, LFB of the display adapters but don't get the VBE mode because the Int 0x10 is returning AL != 0x4f. This is the code with the VBE function returning an error: #include <wdm.h> #include <windef.h> #include <Ntstrsafe.h> NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath); VOID Example_Unload(PDRIVER_OBJECT DriverObject); BOOL IsIO_MemoryAddress = FALSE; BOOL IsMemoryAddress = FALSE; BOOL IsVRAM_Addr = FALSE; unsigned long BUF[16]; DWORD OFFSET; WORD bus,device; BYTE FUNC; int cont; unsigned long BARRAMENTO; unsigned long DISPOSITIVO; unsigned long BARRAMENTO2; unsigned long DISPOSITIVO2; unsigned long addr; unsigned long DisplayControllerVGACompatible; unsigned long DisplayController; unsigned long ClassCodeOF_theDevice; unsigned long BAR; unsigned long BAR2; unsigned long buf_OF_DEVICES[16]; unsigned long ret_VAL; unsigned long ret_VALUE = 0; int I; #pragma alloc_text(INIT, DriverEntry) #pragma alloc_text(PAGE, Example_Unload) ///////////////////////////////// ///////////////////////////////// /// unsigned long _1046(unsigned short lbus, unsigned short lslot, unsigned short lfunc, unsigned short offset) { unsigned long address = (unsigned long)((lbus << 16) | (lslot << 11) | (lfunc << 8) | (offset & 0xfc) | ((UINT32)0x80000000)); __asm { mov dx,0x0CF8 mov eax,address out dx,eax mov dx,0x0CFC in eax,dx mov ret_VAL,eax } return ret_VAL; } int GetVideoAdapterVendorDeviceAndLFB() { INT ITERATOR = 0; cont=1; for(bus=0;(bus<16)&&cont;bus++) { for(device=0;(device<32)&&cont;device++) { for(FUNC=0;(FUNC<8)&&cont;FUNC++) { ClassCodeOF_theDevice = _1046(bus,device,0,8); if(((ClassCodeOF_theDevice>>16)&0xffff)==0x0300) { BARRAMENTO = bus; DISPOSITIVO = device; goto FINAL; } } } } FINAL: DisplayController = _1046(BARRAMENTO,DISPOSITIVO,0,0); I = 0; cont=1; for(bus=0;(bus<16)&&cont;bus++) { for(device=0;(device<32)&&cont;device++) { for(FUNC=0;(FUNC<8)&&cont;FUNC++) { ClassCodeOF_theDevice = _1046(bus,device,0,8); if((ClassCodeOF_theDevice&0x00ffffff) == 0x00000100) { BARRAMENTO2 = bus; DISPOSITIVO2 = device; goto FINAL2; } } } } FINAL2: DisplayControllerVGACompatible = _1046(BARRAMENTO,DISPOSITIVO,0,0); OFFSET = 16; I = 0; while(OFFSET<37) { BAR = _1046(BARRAMENTO,DISPOSITIVO,0,OFFSET); BUF = BAR2 = BAR; if (((BAR<<3)&0xffff) == 0) IsMemoryAddress = TRUE; OFFSET += 4; I++; } FINAL3: buf_OF_DEVICES[0] = DisplayControllerVGACompatible; buf_OF_DEVICES[1] = DisplayController; BUF[0] = BUF[0] & 0xFFFFFFF0; BUF[1] = BUF[1] & 0xFFFFFFF0; BUF[2] = BUF[2] & 0xFFFFFFF0; buf_OF_DEVICES[2] = BUF[0]; buf_OF_DEVICES[3] = BUF[1]; buf_OF_DEVICES[4] = BUF[2]; return buf_OF_DEVICES; } BOOL GetVbeMode(DWORD ModeNumber) { __asm { MOV BX,00 SMSW BX MOV CX,BX AND BX,0x3fff XOR BX,1 OR CX,BX LMSW CX MOV AX,0x4f03 INT 0x10 ;VERY IMPORTANT THIS IS THE MOST IMPORTANT INTERRUPT FOR ME!!! THE VIDEO BIOS INTERRUPT(INT 0x10) CMP AL,0x4f JNZ FAILED JMP FINAL FAILED: MOV BX,00 SMSW BX MOV CX,BX AND BX,0x3fff OR BX,1 OR CX,BX LMSW CX XOR EDX,EDX MOV ret_VALUE,EDX JMP FINAL2 FINAL: MOV BX,00 SMSW BX MOV CX,BX AND BX,0x3fff OR BX,1 OR CX,BX LMSW CX AND BX,0x3fff MOVZX ECX,BX MOV ModeNumber,ECX XOR EDX,EDX INC EDX MOV ret_VALUE,EDX FINAL2: } return ret_VALUE; } ///////////////////////////////// NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath) { NTSTATUS NtStatus = STATUS_SUCCESS; NTSTATUS status; UINT uiIndex = 0; PDEVICE_OBJECT pDeviceObject = NULL; UNICODE_STRING usDriverName, usDosDeviceName; ULONG Mode = 0; DbgPrint("DriverEntry Called \r\n"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RtlInitUnicodeString(&usDriverName, L"\\Device\\SVGA"); RtlInitUnicodeString(&usDosDeviceName, L"\\DosDevices\\SVGA"); NtStatus = IoCreateDevice(pDriverObject, 0, &usDriverName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &pDeviceObject); if(NtStatus == STATUS_SUCCESS) { DbgPrint("IOCREATEDEVICE CALLED \r\n"); IoCreateSymbolicLink(&usDosDeviceName, &usDriverName); ret_VALUE = GetVbeMode(Mode); if(ret_VALUE==FALSE) { buf_OF_DEVICES[7] = -1; } else { buf_OF_DEVICES[5] = Mode; } ret_VAL = GetVideoAdapterVendorDeviceAndLFB(); if (ret_VAL) { DbgPrint(buf_OF_DEVICES); } } pDriverObject->DriverUnload = Example_Unload; return NtStatus; } VOID Example_Unload(PDRIVER_OBJECT DriverObject) { UNICODE_STRING usDosDeviceName; DbgPrint("Example_Unload Called \r\n"); RtlInitUnicodeString(&usDosDeviceName, L"\\DosDevices\\SVGA"); IoDeleteSymbolicLink(&usDosDeviceName); IoDeleteDevice(DriverObject->DeviceObject); } What is wrong at this code???
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!