Important: Minidumps should be created as soon as the program state is still intact—preferably inside the exception handler—before the process tears down or heap is corrupted further.
bool WriteMiniDump( uint32_t dwProcessId, void* pExceptionInfo );
SteamAPI_WriteMiniDump is not typically called in the main game loop. It is intended to be called within a Structured Exception Handler (SEH) or a custom crash handler hook.
A typical implementation involves setting up an unhandled exception filter:
#include <windows.h> #include <steam_api.h>LONG WINAPI MyCustomCrashHandler(struct _EXCEPTION_POINTERS* ExceptionInfo) // Ensure Steam is initialized before calling API if (SteamAPI_IsSteamRunning()) // Retrieve the Build ID (usually stored or queried via SteamApps()->GetAppBuildId()) uint32 buildId = SteamApps()->GetAppBuildId(); SteamAPI WriteMiniDump
// Generate the dump SteamAPI_WriteMiniDump( ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo, buildId ); return EXCEPTION_EXECUTE_HANDLER;
// Initialization SetUnhandledExceptionFilter(MyCustomCrashHandler);
The WriteMiniDump function is part of the Steam API's ISteamUtils interface. To use this function, you will need to:
Here is an example of how to use WriteMiniDump in C++:
#include <steam/steamutils.h>
// Get an instance of ISteamUtils
ISteamUtils* steamUtils = SteamUtils()->GetISteamUtils();
// Call WriteMiniDump
bool success = steamUtils->WriteMiniDump(
1234, // process ID
5678, // thread ID
"C:\\path\\to\\mini_dump.dmp" // file path
);
if (success)
printf("Mini-dump generated successfully!\n");
else
printf("Failed to generate mini-dump.\n");
If you are a player:
If you are a developer:
If you are reverse engineering:
The inclusion of the uBuildID is the most significant feature of this API. In a typical custom crash handler, the developer must maintain a database mapping executable versions to symbol stores. Important: Minidumps should be created as soon as
With SteamAPI_WriteMiniDump, the Steamworks backend handles this mapping. When a developer views the "Crashes" section in the Steamworks Partner backend, the dashboard uses the Build ID embedded in the dump to locate the corresponding symbols stored in the developer's depot. This allows for automatic resolution of the call stack, transforming raw memory addresses into readable function names and line numbers.