GetUserName function advapi32

Win32Result<bool> GetUserName(
  1. PWSTR? lpBuffer,
  2. Pointer<Uint32> pcbBuffer
)

Retrieves the name of the user associated with the current thread.

To learn more, see learn.microsoft.com/windows/win32/api/winbase/nf-winbase-getusernamew.

Implementation

Win32Result<bool> GetUserName(PWSTR? lpBuffer, Pointer<Uint32> pcbBuffer) {
  final result_ = GetUserNameW_Wrapper(lpBuffer ?? nullptr, pcbBuffer);
  return Win32Result(value: result_.value.i32 != FALSE, error: result_.error);
}