1
\$\begingroup\$

Does the Windows 10 Game Bar have an an API that I, as a developer, can hook into and as such make a product that starts alongside all games that support the game bar (say, a parental control interface)?

\$\endgroup\$
2
  • \$\begingroup\$ Note: I couldn't add tags for Windows 10 or Game Bar. If anyone would want to add them, feel free. \$\endgroup\$
    – Nzall
    Nov 9 '17 at 7:46
  • 1
    \$\begingroup\$ The question in its current shape can be answered by "yes" or "no", which is not really a good fit for this site. What are you trying to do? \$\endgroup\$
    – Vaillancourt
    Nov 9 '17 at 16:05
3
\$\begingroup\$

make a product that starts alongside all games that support the game bar

If you try to the open the Game Bar on somehting Windows doesn't recognize as a game, Windows will ask you if it is a game and if you say yes, you get the Game Bar. From that point on, Windows will recognize that process as a Game.

How does Windows know that it is a game? It will match it against a list... Where is the list stored? You can find it at %userprofile%\AppData\Local\Microsoft\GameDVR\KnownGameList.bin. You can read more about how it works from Renaming a Win32 executable to main.exe launch the Xbox DVR popup by lucasg.

In the linked article the following 010 template is provided to parse the file - which hopefully it is useful to write the relevant code in whatever langauge you are using - (note: this is a template for 010 Editor, I have not tested this):

typedef struct  {
   BYTE Reserved[0x300];
}HEADER;

typedef struct  {
    WORD ByteLen;
    BYTE RawString[ByteLen];
    //local string sName=ReadWString(RawString);
} GAME_WSTR <read=ReadGame>;

typedef struct {
    DWORD Reserved;
    DWORD ByteLen;
    BYTE RawString[ByteLen] <fgcolor=cLtRed>;
} OPTION_STR  <read=ReadOption>;

typedef struct  {
   local int StartAddr = FTell();
   DWORD EntrySize;

   // Executable game name
   GAME_WSTR GameName <fgcolor=cLtBlue>;

   // Optional magic
   if (ReadUShort() == 0xca54)
        WORD OptReserved;

   // Optional structs based on switch values
   WORD AdditionalNamesCount;
   WORD SwitchOption2;

   // Additional names (probably like a hint).
   local int i =0;
   for (i = 0; i <  AdditionalNamesCount; i++){
        OPTION_STR Option;
        if (ReadUShort() == 0xca54)
            WORD OptReserved;
   }

   // Look for a magic
   local int Find20h = 0;
   while(!Find20h){
        Find20h = (0x20 == ReadByte());
        BYTE Res;
   }

   GAME_WSTR GameId;
   WORD Reserved;

   // Sometimes there is an additionnal name
   // sometimes not. I check the current entry
   // is less than the EntrySize declared.
   if (FTell()-StartAddr < EntrySize)
   {
       switch (SwitchOption2)
       {
       case 3:
            OPTION_STR Option3;
            break;
       case 2:

            OPTION_STR Option2;
       case 1:
            break;
       }
    }

} ENTRY <read=ReadGameName>;

string ReadOption(OPTION_STR &Game)
{
    local wstring GameName = L"";
    local int i ;
    for (i= 0; 2*i < Game.ByteLen; i++){
        WStrcat(GameName, Game.RawString[2*i]);
    }
    return WStringToString(GameName);
}

string ReadGame(GAME_WSTR &Game)
{
    local wstring GameName = L"";
    local int i ;
    for (i= 0; 2*i < Game.ByteLen; i++){
        WStrcat(GameName, Game.RawString[2*i]);
    }
    return WStringToString(GameName);
}

string ReadGameName(ENTRY &Entry)
{
    local string GameName = ReadGame(Entry.GameName);
    local string OptionGameName = "";
    if (Entry.AdditionalNamesCount)
        OptionGameName = " : "+ReadOption(Entry.Option);

    return GameName + OptionGameName;
}

//------------------------------------------
LittleEndian();
Printf("Parse KnownGameList.bin Begin.\n");
HEADER UnkwownHeader <bgcolor=cLtGray>;
while(1)
{
    ENTRY Entry <bgcolor=cLtPurple>;
    //Printf("Entry : %s -> %d.\n",ReadGameName(Entry) ,Entry.AdditionalNamesCount);
}
Printf("Parse KnownGameList.bin End.\n");

The article was based on lucasg's answer to Windows 10 : naming programs main.exe cause them to show pop up.


Or you can handle your own list. Perhaps keep a database in an online server that clients can download... or simply provide an UI where users can add items.


Ok, that is half the problem. Once you decide how you will define "all games that support the game bar", the next thing is to hook the process start. I suggest to get a notification of process start from Win32_ProcessStartTrace, then see if the started process is in your list and open your UI or whatever it is you want to do next.

\$\endgroup\$
0
\$\begingroup\$

Just to preface, I have no experience with any windows API. However after a little googling I found this:

https://docs.microsoft.com/en-us/uwp/api/windows.gaming.ui.gamebar

Which the website makes out to be part of the API for Universal Windows Platform applications. It is probably worth noting that this is under Windows.gaming.UI and that looking around the API for the whole of Windows.gaming (as opposed to the UI only) may provide you with more exact information.

Hope this helps and good luck.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.