– gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation

This commit is contained in:
Ethan Lee 2023-08-14 13:32:02 -04:00
parent 6ff48dddcb
commit 24fcb61470
7 changed files with 186 additions and 21 deletions

View file

@ -218,3 +218,24 @@ SDL_GDKSuspendComplete()
SetEvent(plmSuspendComplete);
}
}
extern "C" DECLSPEC int
SDL_GDKGetDefaultUser(XUserHandle *outUserHandle)
{
XAsyncBlock block = { 0 };
HRESULT result;
if (FAILED(result = XUserAddAsync(XUserAddOptions::AddDefaultUserAllowingUI, &block))) {
return WIN_SetErrorFromHRESULT("XUserAddAsync", result);
}
do {
result = XUserAddResult(&block, outUserHandle);
} while (result == E_PENDING);
if (FAILED(result)) {
return WIN_SetErrorFromHRESULT("XUserAddResult", result);
}
return 0;
}