> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HCTraceSetPlatformCallbacks

> Sets the thread ID and debugger output hooks that generic platform tracing uses.

Sets the platform callbacks.

## Syntax

```cpp theme={null}
HRESULT HCTraceSetPlatformCallbacks(  
         HCTracePlatformThisThreadIdCallback* threadIdCallback,  
         void* threadIdContext,  
         HCTracePlatformWriteMessageToDebuggerCallback* writeToDebuggerCallback,  
         void* writeToDebuggerContext  
)  
```

### Parameters

*threadIdCallback*   \_In\_\
Type: [HCTracePlatformThisThreadIdCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformthisthreadidcallback.md)\*

The thread ID callback.

*threadIdContext*   \_In\_opt\_\
Type: void\*

The thread ID context.

*writeToDebuggerCallback*   \_In\_\
Type: [HCTracePlatformWriteMessageToDebuggerCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformwritemessagetodebuggercallback.md)\*

The write to debugger callback.

*writeToDebuggerContext*   \_In\_opt\_\
Type: void\*

The write to debugger context.

### Return value

Type: HRESULT

Result code for this API operation. Possible values are S\_OK or E\_HC\_ALREADY\_INITIALISED (0x89235004). The function returns E\_HC\_ALREADY\_INITIALISED if tracing is already initialized. Call HCTraceSetPlatformCallbacks before [HCInitialize](https://docs.xbox.com/reference/live/httpclient/httpclient/functions/hcinitialize.md) or [HCTraceInit](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceinit.md).

## Remarks

Use this function to supply thread ID and debugger output hooks to libHttpClient builds that use the generic platform tracing implementation.

> [!NOTE]
>
> The XBOX Game Development Kit (GDK) builds of libHttpClient for Windows PC and XBOX consoles store these callbacks but don't call them. They use `GetCurrentThreadId` for thread IDs and `OutputDebugStringA` for debugger output. Most GDK games don't need to call this function.

## Requirements

**Header:** trace.h

**Library:** libHttpClient.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[trace](https://docs.xbox.com/reference/live/httpclient/trace/trace_members.md)\
[HCTracePlatformThisThreadIdCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformthisthreadidcallback.md)\
[HCTracePlatformWriteMessageToDebuggerCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformwritemessagetodebuggercallback.md)


## Related topics

- [HCTracePlatformThisThreadIdCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformthisthreadidcallback.md)
- [HCTracePlatformWriteMessageToDebuggerCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctraceplatformwritemessagetodebuggercallback.md)
- [trace (contents)](https://docs.xbox.com/reference/live/httpclient/trace/trace_members.md)
- [HCTraceSetClientCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracesetclientcallback.md)
- [HCTraceCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracecallback.md)
