Parental Controls - widberg/fmtk GitHub Wiki

On startup, FUEL will check that parental controls are properly set to allow the game to run. If not then a message is shown and the game exits immediately. It does this check by using CoCreateInstance to obtain an IGameExplorer, an interface for Windows Games Explorer. It then calls VerifyAccess using the command-line string that ran the game to get the executable name with the emebedded GDF resource, more information about VerifyAccess can be found in Adding a Game to Games Explorer. If any of the function calls fail or the parental controls are not set up to allow access then the check fails, a message is shown, and the game closes.

Error Message

Parental Control - This game is restricted according to parental control.

The text in this window is retrieved from the embedded error messages.

GDB

The __GDF_THUMBNAIL resource is the same icon as the executable.

__GDF_THUMBNAIL

The __GDF_XML resource follows

<?xml version="1.0" encoding="utf-16"?>
<GameDefinitionFile xmlns:baseTypes="urn:schemas-microsoft-com:GamesExplorerBaseTypes.v1" xmlns="urn:schemas-microsoft-com:GameDescription.v1">
    <GameDefinition gameID="{7A30902A-A193-4CF9-B4B3-593F95C5E877}">
        <Name>FUEL™</Name>
        <Description>Welcome in a new world!</Description>
        <ReleaseDate>2009-05-28</ReleaseDate>
        <Genres>
            <Genre>Sports/Racing</Genre>
        </Genres>
        <Ratings>
            <Rating ratingSystemID="{768BD93D-63BE-46A9-8994-0B53C4B5248F}" ratingID="{7A53B0BE-B92D-4e8a-A11F-8E6F9F3C575B}" />
            <Rating ratingSystemID="{36798944-B235-48ac-BF21-E25671F597EE}" ratingID="{97D9239C-2BA3-4e1d-A710-B626DC4602A6}" />
            <Rating ratingSystemID="{C705DCF4-6AFE-4f4f-BC51-21807E4E5CFB}" ratingID="{6948F4DF-FD98-41ea-979A-8364043D7FD6}" />
            <Rating ratingSystemID="{EC290BBB-D618-4cb9-9963-1CAAE515443E}" ratingID="{5098B1DF-486F-4e79-A6D6-6E0879A63811}" />
            <Rating ratingSystemID="{9AAFBACD-EAB9-4946-8BE8-C4D997927C81}" ratingID="{F7066480-67CC-4697-9B47-7E534B74089D}" />
            <Rating ratingSystemID="{7F2A4D3A-23A8-4123-90E7-D986BF1D9718}" ratingID="{97D9239C-2BA3-4e1d-A710-B626DC4602A6}" />
        </Ratings>
        <Version>
            <VersionNumber versionNumber="1.0.0.0" />
        </Version>
        <SavedGames baseKnownFolderID="{fdd39ad0-238f-46af-adb4-6c85480369c7}" path="My Games\FUEL" />
        <WindowsSystemPerformanceRating minimum="3.0" recommended="5.0" />
        <Developers>
            <Developer URI="http://www.asobostudio.com">Asobo Studio</Developer>
        </Developers>
        <Publishers>
            <Publisher URI="http://www.codemasters.com">Codemasters</Publisher>
        </Publishers>
        <GameExecutables>
            <GameExecutable path="Fuel.exe" />
            <GameExecutable path="GameSetup.exe" />
            <GameExecutable path="SecuLauncher.exe" />
        </GameExecutables>
    </GameDefinition>
</GameDefinitionFile>

FUEL's VerifyAccess Procedure

A cleaned-up pseudo-code for this procedure follows

bool VerifyAccess() {
    IGameExplorer *pIGameExplorer = NULL;
    if (CoCreateInstance(CLSID_GameExplorer, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pIGameExplorer)) < 0 || !pIGameExplorer)
        return true;
    bool pfHasAccess = false;
    OLECHAR *bstrGDFBinaryPath = SysAllocString(/* command-line */);
    HRESULT result = pIGameExplorer->VerifyAccess(bstrGDFBinaryPath, &pfHasAccess);
    pIGameExplorer->Release();
    if (result < 0 || pfHasAccess)
        return true;
    MessageBoxW(/* parental controls error message */)
    return false
}
Class Name UUID Header File
GameExplorer {9A5EA990-3034-4D6F-9128-01F3C61022BC} gameux.h
IGameExplorer {E7B2FB72-D728-49B3-A5F2-18EBF5F1349E} gameux.h

The command-line is generated during startup using GetCommandLineA and _splitpath to get the executable name, it ends up looking like "\"FUEL.exe\"". The title of the error message box is index 15 in the Embedded Error Messages and the body is index 14. In English this would be "Parental Control" and "This game is restricted according to parental control." respectively.

⚠️ **GitHub.com Fallback** ⚠️