mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 13:03:47 +00:00
[WIN32K]
- Rewrite InitVideo - Move registry functions to the appropriate file - Silence some DPRINTs svn path=/branches/reactos-yarotows/; revision=49266
This commit is contained in:
parent
a2e78394d2
commit
c5880b6a1c
7 changed files with 199 additions and 205 deletions
|
@ -12,6 +12,9 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
|
||||
PGRAPHICS_DEVICE gpVgaGraphicsDevice;
|
||||
|
||||
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst = NULL;
|
||||
static PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL;
|
||||
static HSEMAPHORE ghsemGraphicsDeviceList;
|
||||
|
|
|
@ -54,7 +54,8 @@ InitLDEVImpl()
|
|||
gpldevWin32k->cRefs = 1;
|
||||
gpldevWin32k->ulDriverVersion = GDI_ENGINE_VERSION;
|
||||
gpldevWin32k->pGdiDriverInfo = (PVOID)(gpldevWin32k + 1);
|
||||
gpldevWin32k->pGdiDriverInfo->DriverName.Buffer = NULL; // FIXME
|
||||
RtlInitUnicodeString(&gpldevWin32k->pGdiDriverInfo->DriverName,
|
||||
L"\\SystemRoot\\System32\\win32k.sys");
|
||||
gpldevWin32k->pGdiDriverInfo->ImageAddress = &__ImageBase;
|
||||
gpldevWin32k->pGdiDriverInfo->SectionPointer = NULL;
|
||||
gpldevWin32k->pGdiDriverInfo->EntryPoint = (PVOID)DriverEntry;
|
||||
|
@ -107,7 +108,7 @@ LDEVOBJ_pdmiGetModes(
|
|||
ULONG cbSize, cbFull;
|
||||
PDEVMODEINFO pdminfo;
|
||||
|
||||
DPRINT1("LDEVOBJ_pdmiGetModes(%p, %p)\n", pldev, hDriver);
|
||||
DPRINT("LDEVOBJ_pdmiGetModes(%p, %p)\n", pldev, hDriver);
|
||||
|
||||
/* Call the driver to get the required size */
|
||||
cbSize = pldev->pfn.GetModes(hDriver, 0, NULL);
|
||||
|
@ -167,16 +168,11 @@ LDEVOBJ_bLoadImage(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Initialize the UNICODE_STRING */
|
||||
pDriverInfo->DriverName.Buffer = (PWSTR)(pDriverInfo + 1);
|
||||
pDriverInfo->DriverName.Length = pstrPathName->Length;
|
||||
pDriverInfo->DriverName.MaximumLength = pstrPathName->Length;
|
||||
|
||||
/* Copy the driver name */
|
||||
// RtlCopyUnicodeString(pDriverInfo->DriverName, pstrPathName);
|
||||
RtlCopyMemory(pDriverInfo->DriverName.Buffer,
|
||||
pstrPathName->Buffer,
|
||||
pstrPathName->Length);
|
||||
/* Initialize the UNICODE_STRING and copy the driver name */
|
||||
RtlInitEmptyUnicodeString(&pDriverInfo->DriverName,
|
||||
(PWSTR)(pDriverInfo + 1),
|
||||
pstrPathName->Length);
|
||||
RtlCopyUnicodeString(&pDriverInfo->DriverName, pstrPathName);
|
||||
|
||||
/* Try to load the driver */
|
||||
Status = ZwSetSystemInformation(SystemLoadGdiDriverInformation,
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static PPDEVOBJ gppdevList = NULL;
|
||||
PPDEVOBJ gppdevPrimary = NULL;
|
||||
|
||||
static PPDEVOBJ gppdevList = NULL;
|
||||
static HSEMAPHORE ghsemPDEV;
|
||||
|
||||
BOOL
|
||||
|
@ -225,7 +226,6 @@ PDEVOBJ_pdmMatchDevMode(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
PPDEVOBJ
|
||||
EngpCreatePDEV(
|
||||
|
@ -236,12 +236,19 @@ EngpCreatePDEV(
|
|||
PPDEVOBJ ppdev;
|
||||
|
||||
/* Try to find the GRAPHICS_DEVICE */
|
||||
pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
|
||||
if (!pGraphicsDevice)
|
||||
if (pustrDeviceName)
|
||||
{
|
||||
DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
|
||||
pustrDeviceName ? pustrDeviceName->Buffer : 0);
|
||||
return NULL;
|
||||
pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
|
||||
if (!pGraphicsDevice)
|
||||
{
|
||||
DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
|
||||
pustrDeviceName ? pustrDeviceName->Buffer : 0);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pGraphicsDevice = gpPrimaryGraphicsDevice;
|
||||
}
|
||||
|
||||
/* Allocate a new PDEVOBJ */
|
||||
|
|
|
@ -41,22 +41,6 @@ DC_AllocDcAttr(PDC pdc);
|
|||
//#define KeRosDumpStackFrames(Frames, Count) KdSystemDebugControl(TAG('R', 'o', 's', 'D'), (PVOID)Frames, Count, NULL, 0, NULL, KernelMode)
|
||||
NTSYSAPI ULONG APIENTRY RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags);
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RegOpenKey(
|
||||
LPCWSTR pwszKeyName,
|
||||
PHKEY phkey);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RegQueryValue(
|
||||
IN HKEY hkey,
|
||||
IN PCWSTR pwszValueName,
|
||||
IN ULONG ulType,
|
||||
OUT PVOID pvData,
|
||||
IN OUT PULONG pcbValue);
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
PDEVOBJ_bSwitchMode(
|
||||
|
@ -68,3 +52,6 @@ NTAPI
|
|||
PDEVOBJ_pdmMatchDevMode(
|
||||
PPDEVOBJ ppdev,
|
||||
PDEVMODEW pdm);
|
||||
|
||||
extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
|
||||
extern PGRAPHICS_DEVICE gpVgaGraphicsDevice;
|
||||
|
|
|
@ -29,6 +29,33 @@ VOID FASTCALL IntUserManualGuiCheck(LONG Check);
|
|||
PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
|
||||
VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RegOpenKey(
|
||||
LPCWSTR pwszKeyName,
|
||||
PHKEY phkey);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RegQueryValue(
|
||||
IN HKEY hkey,
|
||||
IN PCWSTR pwszValueName,
|
||||
IN ULONG ulType,
|
||||
OUT PVOID pvData,
|
||||
IN OUT PULONG pcbValue);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
RegWriteSZ(HKEY hkey, PWSTR pwszValue, PWSTR pwszData);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
RegWriteDWORD(HKEY hkey, PWSTR pwszValue, DWORD dwData);
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData);
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
RegReadUserSetting(
|
||||
|
|
|
@ -55,7 +55,7 @@ RegQueryValue(
|
|||
UNICODE_STRING ustrValueName;
|
||||
BYTE ajBuffer[100];
|
||||
PKEY_VALUE_PARTIAL_INFORMATION pInfo;
|
||||
ULONG cbInfoSize;
|
||||
ULONG cbInfoSize, cbDataSize;
|
||||
|
||||
/* Check if the local buffer is sufficient */
|
||||
cbInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + *pcbValue;
|
||||
|
@ -81,20 +81,23 @@ RegQueryValue(
|
|||
(PVOID)pInfo,
|
||||
cbInfoSize,
|
||||
&cbInfoSize);
|
||||
|
||||
cbDataSize = cbInfoSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Did we get the right type */
|
||||
if (pInfo->Type == ulType)
|
||||
{
|
||||
/* Copy the contents to the caller */
|
||||
RtlCopyMemory(pvData, pInfo->Data, *pcbValue);
|
||||
RtlCopyMemory(pvData, pInfo->Data, min(*pcbValue, cbDataSize));
|
||||
}
|
||||
else
|
||||
Status = STATUS_OBJECT_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
/* Return the data size to the caller */
|
||||
*pcbValue = cbInfoSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
|
||||
*pcbValue = cbDataSize;
|
||||
|
||||
/* Cleanup */
|
||||
if (pInfo != (PVOID)ajBuffer)
|
||||
|
@ -104,6 +107,37 @@ RegQueryValue(
|
|||
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
RegWriteSZ(HKEY hkey, PWSTR pwszValue, PWSTR pwszData)
|
||||
{
|
||||
UNICODE_STRING ustrValue;
|
||||
UNICODE_STRING ustrData;
|
||||
|
||||
RtlInitUnicodeString(&ustrValue, pwszValue);
|
||||
RtlInitUnicodeString(&ustrData, pwszData);
|
||||
ZwSetValueKey(hkey, &ustrValue, 0, REG_SZ, &ustrData, ustrData.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
RegWriteDWORD(HKEY hkey, PWSTR pwszValue, DWORD dwData)
|
||||
{
|
||||
UNICODE_STRING ustrValue;
|
||||
|
||||
RtlInitUnicodeString(&ustrValue, pwszValue);
|
||||
ZwSetValueKey(hkey, &ustrValue, 0, REG_DWORD, &dwData, sizeof(DWORD));
|
||||
}
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG cbSize = sizeof(DWORD);
|
||||
Status = RegQueryValue(hkey, pwszValue, REG_DWORD, pdwData, &cbSize);
|
||||
return NT_SUCCESS(Status);
|
||||
}
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
|
|
|
@ -13,48 +13,12 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
PDEVOBJ *gpdevPrimary;
|
||||
BOOL InitSysParams();
|
||||
|
||||
const PWCHAR KEY_ROOT = L"";
|
||||
const PWCHAR KEY_VIDEO = L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO";
|
||||
BOOL gbBaseVideo = 0;
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
UserEnumDisplayDevices(
|
||||
PUNICODE_STRING pustrDevice,
|
||||
DWORD iDevNum,
|
||||
PDISPLAY_DEVICEW pdispdev,
|
||||
DWORD dwFlags);
|
||||
|
||||
VOID
|
||||
RegWriteSZ(HKEY hkey, PWSTR pwszValue, PWSTR pwszData)
|
||||
{
|
||||
UNICODE_STRING ustrValue;
|
||||
UNICODE_STRING ustrData;
|
||||
|
||||
RtlInitUnicodeString(&ustrValue, pwszValue);
|
||||
RtlInitUnicodeString(&ustrData, pwszData);
|
||||
ZwSetValueKey(hkey, &ustrValue, 0, REG_SZ, &ustrData, ustrData.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
VOID
|
||||
RegWriteDWORD(HKEY hkey, PWSTR pwszValue, DWORD dwData)
|
||||
{
|
||||
UNICODE_STRING ustrValue;
|
||||
|
||||
RtlInitUnicodeString(&ustrValue, pwszValue);
|
||||
ZwSetValueKey(hkey, &ustrValue, 0, REG_DWORD, &dwData, sizeof(DWORD));
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG cbSize = sizeof(DWORD);
|
||||
Status = RegQueryValue(hkey, pwszValue, REG_DWORD, pdwData, &cbSize);
|
||||
return NT_SUCCESS(Status);
|
||||
}
|
||||
static const PWCHAR KEY_ROOT = L"";
|
||||
static const PWCHAR KEY_VIDEO = L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP\\VIDEO";
|
||||
|
||||
VOID
|
||||
RegWriteDisplaySettings(HKEY hkey, PDEVMODEW pdm)
|
||||
|
@ -103,96 +67,12 @@ RegReadDisplaySettings(HKEY hkey, PDEVMODEW pdm)
|
|||
READ(dmPosition.y, "Attach.RelativeY", DM_POSITION);
|
||||
}
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
VF_USEVGA = 0x1,
|
||||
};
|
||||
|
||||
BOOL
|
||||
InitDisplayDriver(
|
||||
PUNICODE_STRING pustrRegPath,
|
||||
FLONG flags)
|
||||
{
|
||||
// PWSTR pwszDriverName;
|
||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Setup QueryTable for direct registry query */
|
||||
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
||||
QueryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED|RTL_QUERY_REGISTRY_DIRECT;
|
||||
|
||||
|
||||
/* Check if vga mode is requested */
|
||||
if (flags & VF_USEVGA)
|
||||
{
|
||||
DWORD dwVgaCompatible;
|
||||
|
||||
/* */
|
||||
QueryTable[0].Name = L"VgaCompatible";
|
||||
QueryTable[0].EntryContext = &dwVgaCompatible;
|
||||
|
||||
/* Check if the driver is vga */
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
pustrRegPath->Buffer,
|
||||
QueryTable,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (!dwVgaCompatible)
|
||||
{
|
||||
/* This driver is not a vga driver */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Query the adapter's registry path */
|
||||
swprintf(awcBuffer, L"\\Device\\Video%lu", iDevNum);
|
||||
QueryTable[0].Name = pGraphicsDevice->szNtDeviceName;
|
||||
|
||||
/* Set string for the registry key */
|
||||
ustrRegistryPath.Buffer = pdispdev->DeviceKey;
|
||||
ustrRegistryPath.Length = 128;
|
||||
ustrRegistryPath.MaximumLength = 128;
|
||||
QueryTable[0].EntryContext = &ustrRegistryPath;
|
||||
|
||||
/* Query the registry */
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_DEVICEMAP,
|
||||
L"VIDEO",
|
||||
QueryTable,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
RegQueryValue(KEY_VIDEO, awcBuffer, REG_SZ, pdispdev->DeviceKey, 256);
|
||||
|
||||
{
|
||||
HANDLE hmod;
|
||||
|
||||
hmod = EngLoadImage(pwszDriverName);
|
||||
|
||||
/* Jump to next name */
|
||||
pwszDriverName += wcslen(pwszDriverName) + 1;
|
||||
}
|
||||
while (pwszDriverName < 0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
PGRAPHICS_DEVICE
|
||||
NTAPI
|
||||
DisplayDriverQueryRoutine(
|
||||
IN PWSTR ValueName,
|
||||
IN ULONG ValueType,
|
||||
IN PVOID ValueData,
|
||||
IN ULONG ValueLength,
|
||||
IN PVOID Context,
|
||||
IN PVOID EntryContext)
|
||||
InitDisplayDriver(
|
||||
IN PWSTR pwszDeviceName,
|
||||
IN PWSTR pwszRegKey)
|
||||
{
|
||||
PWSTR pwszRegKey = ValueData;
|
||||
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||
UNICODE_STRING ustrDeviceName, ustrDisplayDrivers, ustrDescription;
|
||||
NTSTATUS Status;
|
||||
|
@ -201,32 +81,17 @@ DisplayDriverQueryRoutine(
|
|||
HKEY hkey;
|
||||
DEVMODEW dmDefault;
|
||||
|
||||
UNREFERENCED_PARAMETER(ValueLength);
|
||||
UNREFERENCED_PARAMETER(Context);
|
||||
UNREFERENCED_PARAMETER(EntryContext);
|
||||
|
||||
DPRINT1("DisplayDriverQueryRoutine(%S, %S);\n",
|
||||
ValueName, pwszRegKey);
|
||||
|
||||
/* Check if we have a correct entry */
|
||||
if (ValueType != REG_SZ || ValueName[0] != '\\')
|
||||
{
|
||||
/* Something else, just skip it */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
DPRINT1("InitDisplayDriver(%S, %S);\n",
|
||||
pwszDeviceName, pwszRegKey);
|
||||
|
||||
/* Open the driver's registry key */
|
||||
Status = RegOpenKey(pwszRegKey, &hkey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to open registry key\n");
|
||||
return STATUS_SUCCESS;
|
||||
DPRINT1("Failed to open registry key: %ls\n", pwszRegKey);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// HACK: only use 1st adapter
|
||||
//if (ValueName[13] != '0')
|
||||
// return STATUS_SUCCESS;
|
||||
|
||||
/* Query the diplay drivers */
|
||||
cbSize = sizeof(awcBuffer) - 10;
|
||||
Status = RegQueryValue(hkey,
|
||||
|
@ -238,7 +103,7 @@ DisplayDriverQueryRoutine(
|
|||
{
|
||||
DPRINT1("Didn't find 'InstalledDisplayDrivers', status = 0x%lx\n", Status);
|
||||
ZwClose(hkey);
|
||||
return STATUS_SUCCESS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize the UNICODE_STRING */
|
||||
|
@ -273,44 +138,119 @@ DisplayDriverQueryRoutine(
|
|||
ZwClose(hkey);
|
||||
|
||||
/* Register the device with GDI */
|
||||
RtlInitUnicodeString(&ustrDeviceName, ValueName);
|
||||
RtlInitUnicodeString(&ustrDeviceName, pwszDeviceName);
|
||||
pGraphicsDevice = EngpRegisterGraphicsDevice(&ustrDeviceName,
|
||||
&ustrDisplayDrivers,
|
||||
&ustrDescription,
|
||||
&dmDefault);
|
||||
|
||||
// FIXME: what to do with pGraphicsDevice?
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return pGraphicsDevice;
|
||||
}
|
||||
|
||||
BOOL InitSysParams();
|
||||
|
||||
BOOL
|
||||
InitVideo(FLONG flags)
|
||||
InitVideo(
|
||||
PUNICODE_STRING pustrRegPath,
|
||||
FLONG flags)
|
||||
{
|
||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||
ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
|
||||
WCHAR awcDeviceName[20];
|
||||
WCHAR awcBuffer[256];
|
||||
NTSTATUS Status;
|
||||
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||
ULONG cbValue;
|
||||
HKEY hkey;
|
||||
|
||||
DPRINT1("----------------------------- InitVideo() -------------------------------\n");
|
||||
|
||||
/* Setup QueryTable for registry query */
|
||||
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
||||
QueryTable[0].QueryRoutine = DisplayDriverQueryRoutine;
|
||||
Status = RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control", &hkey);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
cbValue = 256;
|
||||
Status = RegQueryValue(hkey, L"SystemStartOptions", REG_SZ, awcBuffer, &cbValue);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Check if VGA mode is requested. */
|
||||
if (wcsstr(awcBuffer, L"/BASEVIDEO") != 0)
|
||||
{
|
||||
DPRINT1("VGA mode requested.\n");
|
||||
gbBaseVideo = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Query the registry */
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_DEVICEMAP,
|
||||
L"VIDEO",
|
||||
QueryTable,
|
||||
NULL,
|
||||
NULL);
|
||||
ZwClose(hkey);
|
||||
}
|
||||
|
||||
/* Open the key for the adapters */
|
||||
Status = RegOpenKey(KEY_VIDEO, &hkey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Could not open device registry key!\n");
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
|
||||
/* Read the name of the VGA adapter */
|
||||
cbValue = 20;
|
||||
Status = RegQueryValue(hkey, L"VgaCompatible", REG_SZ, awcDeviceName, &cbValue);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
iVGACompatible = _wtoi(&awcDeviceName[13]);
|
||||
DPRINT1("VGA adapter = %ld\n", iVGACompatible);
|
||||
}
|
||||
|
||||
/* Get the maximum mumber of adapters */
|
||||
if (!RegReadDWORD(hkey, L"MaxObjectNumber", &ulMaxObjectNumber))
|
||||
{
|
||||
DPRINT1("Could not read MaxObjectNumber, defaulting to 0.\n");
|
||||
}
|
||||
|
||||
DPRINT("Found %ld devices\n", ulMaxObjectNumber);
|
||||
|
||||
/* Loop through all adapters */
|
||||
cbValue = 256;
|
||||
for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
|
||||
{
|
||||
/* Create the adapter's key name */
|
||||
swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
|
||||
|
||||
/* Read the reg key name */
|
||||
Status = RegQueryValue(hkey, awcDeviceName, REG_SZ, awcBuffer, &cbValue);
|
||||
|
||||
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
|
||||
|
||||
/* Check if this is the VGA adapter */
|
||||
if (iDevNum == iVGACompatible)
|
||||
{
|
||||
/* Set the VGA device as primary */
|
||||
gpVgaGraphicsDevice = pGraphicsDevice;
|
||||
DPRINT1("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice);
|
||||
}
|
||||
|
||||
/* Set the first one as primary device */
|
||||
if (!gpPrimaryGraphicsDevice)
|
||||
gpPrimaryGraphicsDevice = pGraphicsDevice;
|
||||
}
|
||||
|
||||
ZwClose(hkey);
|
||||
|
||||
if (gbBaseVideo)
|
||||
{
|
||||
if (gpVgaGraphicsDevice)
|
||||
{
|
||||
/* Set the VgaAdapter as primary */
|
||||
gpPrimaryGraphicsDevice = gpVgaGraphicsDevice;
|
||||
// FIXME: DEVMODE
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Could not find VGA compatible driver. Trying normal.\n");
|
||||
}
|
||||
}
|
||||
|
||||
InitSysParams();
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
UserEnumDisplayDevices(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue