BOOLEAN VBoxMPQueryRegistryFlags(PVBOXMP_DEVEXT pExt, ULONG *pulFlags, PSTATUS_BLOCK pStatus) { BOOLEAN bRC = TRUE; LOGF_ENTER(); VBOXMPCMNREGISTRY Registry; int rc = VBoxMPCmnRegInit(pExt, &Registry); VBOXMP_WARN_VPS_NOBP(rc); if (rc == NO_ERROR) { uint32_t u32Flags = 0; rc = VBoxMPCmnRegQueryDword(Registry, L"VBoxVideoFlags", &u32Flags); VBOXMP_WARN_VPS_NOBP(rc); if (rc != NO_ERROR) { u32Flags = 0; } LOG(("Registry flags 0x%08X", u32Flags)); *pulFlags = u32Flags; pStatus->Information = sizeof(ULONG); } rc = VBoxMPCmnRegFini(Registry); VBOXMP_WARN_VPS_NOBP(rc); LOGF_LEAVE(); return bRC; }
void VBoxMPCmnInitCustomVideoModes(PVBOXMP_DEVEXT pExt) { VBOXMPCMNREGISTRY Registry; VP_STATUS rc; int iMode; LOGF_ENTER(); rc = VBoxMPCmnRegInit(pExt, &Registry); VBOXMP_WARN_VPS(rc); /* Initialize all custom modes to the 800x600x32 */ VBoxFillVidModeInfo(&g_CustomVideoModes[0], 800, 600, 32, 0, 0); for (iMode=1; iMode<RT_ELEMENTS(g_CustomVideoModes); ++iMode) { g_CustomVideoModes[iMode] = g_CustomVideoModes[0]; } /* Read stored custom resolution info from registry */ for (iMode=0; iMode<VBoxCommonFromDeviceExt(pExt)->cDisplays; ++iMode) { uint32_t CustomXRes = 0, CustomYRes = 0, CustomBPP = 0; if (iMode==0) { /*First name without a suffix*/ rc = VBoxMPCmnRegQueryDword(Registry, L"CustomXRes", &CustomXRes); VBOXMP_WARN_VPS_NOBP(rc); rc = VBoxMPCmnRegQueryDword(Registry, L"CustomYRes", &CustomYRes); VBOXMP_WARN_VPS_NOBP(rc); rc = VBoxMPCmnRegQueryDword(Registry, L"CustomBPP", &CustomBPP); VBOXMP_WARN_VPS_NOBP(rc); } else { wchar_t keyname[32]; swprintf(keyname, L"CustomXRes%d", iMode); rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomXRes); VBOXMP_WARN_VPS_NOBP(rc); swprintf(keyname, L"CustomYRes%d", iMode); rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomYRes); VBOXMP_WARN_VPS_NOBP(rc); swprintf(keyname, L"CustomBPP%d", iMode); rc = VBoxMPCmnRegQueryDword(Registry, keyname, &CustomBPP); VBOXMP_WARN_VPS_NOBP(rc); } LOG(("got stored custom resolution[%d] %dx%dx%d", iMode, CustomXRes, CustomYRes, CustomBPP)); if (CustomXRes || CustomYRes || CustomBPP) { if (CustomXRes == 0) { CustomXRes = g_CustomVideoModes[iMode].VisScreenWidth; } if (CustomYRes == 0) { CustomYRes = g_CustomVideoModes[iMode].VisScreenHeight; } if (CustomBPP == 0) { CustomBPP = g_CustomVideoModes[iMode].BitsPerPlane; } if (VBoxMPValidateVideoModeParamsGuest(pExt, iMode, CustomXRes, CustomYRes, CustomBPP)) { VBoxFillVidModeInfo(&g_CustomVideoModes[iMode], CustomXRes, CustomYRes, CustomBPP, 0, 0); } } } rc = VBoxMPCmnRegFini(Registry); VBOXMP_WARN_VPS(rc); LOGF_LEAVE(); }