aboutsummaryrefslogtreecommitdiff
path: root/core/sys/windows/userenv.odin
blob: 1ed7314074ddf0114388788ffc24a90354f4b292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#+build windows
package sys_windows

foreign import userenv "system:Userenv.lib"

@(default_calling_convention="system")
foreign userenv {
	GetUserProfileDirectoryW :: proc(
		hToken:       HANDLE,
		lpProfileDir: LPWSTR,
		lpcchSize:    ^DWORD,
	) -> BOOL ---

	LoadUserProfileW :: proc(
		hToken:        HANDLE,
		lpProfileInfo: ^PROFILEINFOW,
	) -> BOOL ---

	// https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-createprofile
	// The caller must have administrator privileges to call this function.
	CreateProfile :: proc(
		pszUserSid:     LPCWSTR,
		pszUserName:    LPCWSTR,
		pszProfilePath: wstring,
		cchProfilePath: DWORD,
	) -> u32 ---

	// https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-deleteprofilew
	// The caller must have administrative privileges to delete a user's profile.
	DeleteProfileW :: proc(
		lpSidString:    LPCWSTR,
		lpProfilePath:  LPCWSTR,
		lpComputerName: LPCWSTR,
	) -> BOOL ---

	// https://docs.microsoft.com/en-us/windows/win32/api/sddl/nf-sddl-convertsidtostringsida
	// To turn a SID into a string SID to use with CreateProfile & DeleteProfileW.
	ConvertSidToStringSidW :: proc(
		Sid:       ^SID,
	  	StringSid: ^LPCWSTR,
	) -> BOOL ---
}