次の方法で共有


IGameExplorer::VerifyAccess Method

Checks whether the user has permission to play the game in the specified GDF.

Syntax

HRESULT VerifyAccess(
         const BSTR bstrGDFBinaryPath,
         BOOL* pfHasAccess
)

Parameters

  • bstrGDFBinaryPath
    [in] A string that contains the fully qualified path of the binary that contains the game definition file (GDF). The GDF must be present in the default resource location.
  • pfHasAccess
    [out] Whether the current game will be allowed to run for the current user, given the current parental controls settings.

Return Value

Returns an HRESULT. Use the SUCCEEDED and FAILED macros to test the return value of this function.

Remarks

This method does not require IGameExplorer::AddGame to be called, previously or at any other time. This method can be used at any time to verify whether the current user can run a binary file associated with a GDF.

Games should call this method every time that they are run. By doing so, parental controls work even for a game that was installed on a FAT32 volume, which does not support ACLs, to lock the user out of the game.

When VerifyAccess fails, the pfHasAccess parameter is undefined. You can use this code so you block a game only when VerifyAccess succeeds:

BOOL hasAccess = FALSE;
HRESULT hr = pGameExplorer->VerifyAccess( gdfBinPath, &bHasAccess; );
if ( SUCCEEDED(hr) && !bHasAccess )
{
     // Game is blocked by Windows Parental Controls (WPC)
}

    

Requirements

Header: Declared in GameUX.h.