userenv.odin 1.2 KB

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