Fix a bug in InitVideo: when looping through the adapters, reinitialize the cbValue before querying the registry.
Also handle failure.

svn path=/trunk/; revision=49360
This commit is contained in:
Timo Kreuzer
2010-10-30 16:34:52 +00:00
parent 951c6f7fa3
commit a4b48e3576
@@ -206,14 +206,19 @@ InitVideo(
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 */
cbValue = sizeof(awcBuffer);
Status = RegQueryValue(hkey, awcDeviceName, REG_SZ, awcBuffer, &cbValue);
if (!NT_SUCCESS(Status))
{
DPRINT1("failed to query the registry path:0x%lx\n", Status);
continue;
}
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);