winapi_ui_automation/um/
userenv.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! Definitions for the user environment API
7use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, PHKEY};
8use um::winnt::{
9    HANDLE, HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PSID, PSID_AND_ATTRIBUTES, PWSTR
10};
11use um::winreg::REGSAM;
12extern "system" {
13    // pub fn LoadUserProfileA(
14    //     hToken: HANDLE,
15    //     lpProfileInfo: LPPROFILEINFOA,
16    // ) -> BOOL;
17    // pub fn LoadUserProfileW(
18    //     hToken: HANDLE,
19    //     lpProfileInfo: LPPROFILEINFOW,
20    // ) -> BOOL;
21    pub fn UnloadUserProfile(
22        hToken: HANDLE,
23        hProfile: HANDLE,
24    ) -> BOOL;
25    pub fn GetProfilesDirectoryA(
26        lpProfileDir: LPSTR,
27        lpcchSize: LPDWORD,
28    ) -> BOOL;
29    pub fn GetProfilesDirectoryW(
30        lpProfileDir: LPWSTR,
31        lpcchSize: LPDWORD,
32    ) -> BOOL;
33    pub fn GetProfileType(
34        dwFlags: *mut DWORD,
35    ) -> BOOL;
36    pub fn DeleteProfileA(
37        lpSidString: LPCSTR,
38        lpProfilePath: LPCSTR,
39        lpComputerName: LPCSTR,
40    ) -> BOOL;
41    pub fn DeleteProfileW(
42        lpSidString: LPCWSTR,
43        lpProfilePath: LPCWSTR,
44        lpComputerName: LPCWSTR,
45    ) -> BOOL;
46    pub fn CreateProfile(
47        pszUserSid: LPCWSTR,
48        pszUserName: LPCWSTR,
49        pszProfilePath: LPWSTR,
50        cchProfilePath: DWORD,
51    ) -> HRESULT;
52    pub fn GetDefaultUserProfileDirectoryA(
53        lpProfileDir: LPSTR,
54        lpcchSize: LPDWORD,
55    ) -> BOOL;
56    pub fn GetDefaultUserProfileDirectoryW(
57        lpProfileDir: LPWSTR,
58        lpcchSize: LPDWORD,
59    ) -> BOOL;
60    pub fn GetAllUsersProfileDirectoryA(
61        lpProfileDir: LPSTR,
62        lpcchSize: LPDWORD,
63    ) -> BOOL;
64    pub fn GetAllUsersProfileDirectoryW(
65        lpProfileDir: LPWSTR,
66        lpcchSize: LPDWORD,
67    ) -> BOOL;
68    pub fn GetUserProfileDirectoryA(
69        hToken: HANDLE,
70        lpProfileDir: LPSTR,
71        lpcchSize: LPDWORD,
72    ) -> BOOL;
73    pub fn GetUserProfileDirectoryW(
74        hToken: HANDLE,
75        lpProfileDir: LPWSTR,
76        lpcchSize: LPDWORD,
77    ) -> BOOL;
78    pub fn CreateEnvironmentBlock(
79        lpEnvironment: *mut LPVOID,
80        hToken: HANDLE,
81        bInherit: BOOL,
82    ) -> BOOL;
83    pub fn DestroyEnvironmentBlock(
84        lpEnvironment: LPVOID,
85    ) -> BOOL;
86    pub fn ExpandEnvironmentStringsForUserA(
87        hToken: HANDLE,
88        lpSrc: LPCSTR,
89        lpDest: LPSTR,
90        dwSize: DWORD,
91    ) -> BOOL;
92    pub fn ExpandEnvironmentStringsForUserW(
93        hToken: HANDLE,
94        lpSrc: LPCWSTR,
95        lpDest: LPWSTR,
96        dwSize: DWORD,
97    ) -> BOOL;
98    pub fn RefreshPolicy(
99        bMachine: BOOL,
100    ) -> BOOL;
101    pub fn RefreshPolicyEx(
102        bMachine: BOOL,
103        dwOptions: DWORD,
104    ) -> BOOL;
105    pub fn EnterCriticalPolicySection(
106        bMachine: BOOL,
107    ) -> HANDLE;
108    pub fn LeaveCriticalPolicySection(
109        hSection: HANDLE,
110    ) -> BOOL;
111    pub fn RegisterGPNotification(
112        hEvent: HANDLE,
113        bMachine: BOOL,
114    ) -> BOOL;
115    pub fn UnregisterGPNotification(
116        hEvent: HANDLE,
117    ) -> BOOL;
118    // pub fn GetGPOListA();
119    // pub fn GetGPOListW();
120    // pub fn FreeGPOListA();
121    // pub fn FreeGPOListW();
122    // pub fn GetAppliedGPOListA();
123    // pub fn GetAppliedGPOListW();
124    // pub fn ProcessGroupPolicyCompleted();
125    // pub fn ProcessGroupPolicyCompletedEx();
126    // pub fn RsopAccessCheckByType();
127    // pub fn RsopFileAccessCheck();
128    // pub fn RsopSetPolicySettingStatus();
129    // pub fn RsopResetPolicySettingStatus();
130    // pub fn GenerateGPNotification();
131    pub fn CreateAppContainerProfile(
132        pszAppContainerName: PCWSTR,
133        pszDisplayName: PCWSTR,
134        pszDescription: PCWSTR,
135        pCapabilities: PSID_AND_ATTRIBUTES,
136        dwCapabilityCount: DWORD,
137        ppSidAppContainerSid: *mut PSID,
138    ) -> HRESULT;
139    pub fn DeleteAppContainerProfile(
140        pszAppContainerName: PCWSTR,
141    ) -> HRESULT;
142    pub fn GetAppContainerRegistryLocation(
143        desiredAccess: REGSAM,
144        phAppContainerKey: PHKEY,
145    ) -> HRESULT;
146    pub fn GetAppContainerFolderPath(
147        pszAppContainerSid: PCWSTR,
148        ppszPath: *mut PWSTR,
149    ) -> HRESULT;
150    pub fn DeriveAppContainerSidFromAppContainerName(
151        pszAppContainerName: PCWSTR,
152        ppsidAppContainerSid: *mut PSID,
153    ) -> HRESULT;
154    pub fn DeriveRestrictedAppContainerSidFromAppContainerSidAndRestrictedName(
155        psidAppContainerSid: PSID,
156        pszRestrictedAppContainerName: PCWSTR,
157        ppsidRestrictedAppContainerSid: *mut PSID,
158    ) -> HRESULT;
159}