Freigeben über


XSystemGetConsoleId

Returns the console ID of the current device.

Syntax

HRESULT XSystemGetConsoleId(  
         size_t consoleIdSize,  
         char* consoleId,  
         size_t* consoleIdUsed  
)  

Parameters

consoleIdSize   _In_
Type: size_t

The size of the consoleId, in bytes. This value must be equal to or greater than the XSystemConsoleIdBytes constant defined in XSystem.h.

consoleId   _Out_writes_bytes_to_(consoleIdSize,*consoleIdUsed)
Type: char*

The character buffer that will receive the console ID.

consoleIdUsed   _Out_opt_
Type: size_t*

The size, in bytes, of the consoleId buffer returned.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns an error code. For a list of error codes, see Error Codes. If the function fails because consoleIdSize is set to a value less than XSystemConsoleIdBytes, the return value is set to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER).

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

The console ID uniquely identifies an Xbox device for Xbox Live for development scenarios only. The console ID is used to identify the console for logging and management purposes; for example, to capture analytics information, or to determine which development kit to reboot in a development environment. The ID returned by this function is a match to the Console ID viewable in Settings \ System \ Console info.

For Xbox devices, the console ID is stored on the device. If the console ID is not found, or if you don't have permission to access the console ID, then the console ID defaults to 00000000.00000000.00000000.00000000.00. For PC devices, the console ID always defaults to 00000000.00000000.00000000.00000000.00.

In RETAIL, this function will always return 00000000.00000000.00000000.00000000.00. If the game is needing an identifier that can be used in all situations including retail, there are two possibilties:

  • If your application is using Single-Sign-On (SSO), you should the XSTS SSO token's pairwise ID instead of the id returned by this function.
  • Otherwise, use the XSystemGetAppSpecificDeviceId function.

Requirements

Header: XSystem.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

Activating your dev kit (NDA topic)Autorisierung erforderlich
XSystemGetXboxLiveSandbodId
XSystem