- Implement VideoPortIsNoVesa

svn path=/trunk/; revision=45844
This commit is contained in:
Cameron Gutman
2010-03-04 21:53:12 +00:00
parent 78dce7419f
commit 3a4617cfcb
2 changed files with 97 additions and 0 deletions
+96
View File
@@ -1417,3 +1417,99 @@ VideoPortAllocateContiguousMemory(
return MmAllocateContiguousMemory(NumberOfBytes, HighestAcceptableAddress);
}
/*
* @implemented
*/
BOOLEAN NTAPI
VideoPortIsNoVesa(VOID)
{
NTSTATUS Status;
HANDLE KeyHandle;
UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
OBJECT_ATTRIBUTES ObjectAttributes;
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
ULONG Length, NewLength;
/* Initialize object attributes with the path we want */
InitializeObjectAttributes(&ObjectAttributes,
&Path,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
/* Open the key */
Status = ZwOpenKey(&KeyHandle,
KEY_QUERY_VALUE,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
VideoPortDebugPrint(Error, "ZwOpenKey failed (0x%x)\n", Status);
return FALSE;
}
/* Find out how large our buffer should be */
Status = ZwQueryValueKey(KeyHandle,
&ValueName,
KeyValuePartialInformation,
NULL,
0,
&Length);
if (Status != STATUS_BUFFER_OVERFLOW && Status != STATUS_BUFFER_TOO_SMALL)
{
VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
ZwClose(KeyHandle);
return FALSE;
}
/* Allocate it */
KeyInfo = ExAllocatePool(PagedPool, Length);
if (!KeyInfo)
{
VideoPortDebugPrint(Error, "Out of memory\n");
ZwClose(KeyHandle);
return FALSE;
}
/* Now for real this time */
Status = ZwQueryValueKey(KeyHandle,
&ValueName,
KeyValuePartialInformation,
KeyInfo,
Length,
&NewLength);
ZwClose(KeyHandle);
if (!NT_SUCCESS(Status))
{
VideoPortDebugPrint(Error, "ZwQueryValueKey failed (0x%x)\n", Status);
ExFreePool(KeyInfo);
return FALSE;
}
/* Sanity check */
if (KeyInfo->Type != REG_SZ)
{
VideoPortDebugPrint(Error, "Invalid type for SystemStartOptions\n");
ExFreePool(KeyInfo);
return FALSE;
}
/* Check if NOVESA is present in the start options */
if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
{
VideoPortDebugPrint(Info, "VESA mode disabled\n");
ExFreePool(KeyInfo);
return TRUE;
}
ExFreePool(KeyInfo);
VideoPortDebugPrint(Info, "VESA mode enabled\n");
return FALSE;
}
@@ -47,6 +47,7 @@
@ fastcall VideoPortInterlockedDecrement(ptr) NTOSKRNL.InterlockedDecrement
@ fastcall VideoPortInterlockedExchange(ptr long) NTOSKRNL.InterlockedExchange
@ fastcall VideoPortInterlockedIncrement(ptr) NTOSKRNL.InterlockedIncrement
@ stdcall VideoPortIsNoVesa()
@ stdcall VideoPortLockBuffer(ptr ptr long long)
@ stdcall VideoPortLockPages(ptr ptr ptr ptr long)
@ stdcall VideoPortLogError(ptr ptr long long)