#include "classes.h" // 00a23ae0 void UserProfile::find_or_create() { int existingProfile; uint8_t emplaceResult [8]; uint32_t keyIdLow; uint32_t keyIdHigh; uint32_t local_10; uint32_t local_c; char isLockHeld; void *profileLock; if (*GHIDRA_CAST(this) == 0 && *GHIDRA_CAST((GHIDRA_CAST(this) + 4)) == 0) { return; } existingProfile = FUN_00a23bb0(); if (existingProfile == 0) { if ((DAT_00c5aa74 & 1) == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("Trying to lock mutex that has not been initialized")); } profileLock = g_userProfileLock; EnterCriticalSection(g_userProfileLock); isLockHeld = *GHIDRA_CAST((GHIDRA_CAST(profileLock) + 0x18)); while (isLockHeld != '\0') { Sleep(1000); isLockHeld = *GHIDRA_CAST((GHIDRA_CAST(profileLock) + 0x18)); } *GHIDRA_CAST((GHIDRA_CAST(profileLock) + 0x18)) = 1; keyIdLow = *GHIDRA_CAST(this); keyIdHigh = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); local_10 = keyIdLow; local_c = keyIdHigh; msvc::map::try_emplace(emplaceResult,&keyIdLow); if ((DAT_00c5aa74 & 1) == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("Trying to unlock mutex that has not been initialized")); } profileLock = g_userProfileLock; *GHIDRA_CAST((GHIDRA_CAST(g_userProfileLock) + 0x18)) = 0; LeaveCriticalSection(profileLock); FUN_00a23bb0(); } return; }