userenv.odin 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // +build windows
  2. package sys_windows
  3. foreign import userenv "system:Userenv.lib"
  4. @(default_calling_convention="stdcall")
  5. foreign userenv {
  6. GetUserProfileDirectoryW :: proc(hToken: HANDLE,
  7. lpProfileDir: LPWSTR,
  8. lpcchSize: ^DWORD) -> BOOL ---
  9. LoadUserProfileW :: proc(
  10. hToken: HANDLE,
  11. lpProfileInfo: ^PROFILEINFOW,
  12. ) -> BOOL ---
  13. // https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-createprofile
  14. // The caller must have administrator privileges to call this function.
  15. CreateProfile :: proc(
  16. pszUserSid: LPCWSTR,
  17. pszUserName: LPCWSTR,
  18. pszProfilePath: wstring,
  19. cchProfilePath: DWORD,
  20. ) -> u32 ---
  21. // https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-deleteprofilew
  22. // The caller must have administrative privileges to delete a user's profile.
  23. DeleteProfileW :: proc(
  24. lpSidString: LPCWSTR,
  25. lpProfilePath: LPCWSTR,
  26. lpComputerName: LPCWSTR,
  27. ) -> BOOL ---
  28. // https://docs.microsoft.com/en-us/windows/win32/api/sddl/nf-sddl-convertsidtostringsida
  29. // To turn a SID into a string SID to use with CreateProfile & DeleteProfileW.
  30. ConvertSidToStringSidW :: proc(
  31. Sid: ^SID,
  32. StringSid: ^LPCWSTR,
  33. ) -> BOOL ---
  34. }