1 | /**
|
---|
2 | * This file is part of the mingw-w64 runtime package.
|
---|
3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
4 | */
|
---|
5 |
|
---|
6 | #ifndef _INC_USERENV
|
---|
7 | #define _INC_USERENV
|
---|
8 |
|
---|
9 | #include <winapifamily.h>
|
---|
10 |
|
---|
11 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
---|
12 |
|
---|
13 | #include <_mingw_unicode.h>
|
---|
14 | #include <wbemcli.h>
|
---|
15 |
|
---|
16 | #if !defined (_USERENV_)
|
---|
17 | #define USERENVAPI DECLSPEC_IMPORT
|
---|
18 | #else
|
---|
19 | #define USERENVAPI
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | #ifdef __cplusplus
|
---|
23 | extern "C" {
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #include <profinfo.h>
|
---|
27 |
|
---|
28 | #define PI_NOUI 0x00000001
|
---|
29 | #define PI_APPLYPOLICY 0x00000002
|
---|
30 |
|
---|
31 | #define PT_TEMPORARY 0x00000001
|
---|
32 | #define PT_ROAMING 0x00000002
|
---|
33 | #define PT_MANDATORY 0x00000004
|
---|
34 |
|
---|
35 | #define RP_FORCE 1
|
---|
36 | #define RP_SYNC 2
|
---|
37 |
|
---|
38 | #define GPC_BLOCK_POLICY 0x00000001
|
---|
39 |
|
---|
40 | #define GPO_FLAG_DISABLE 0x00000001
|
---|
41 | #define GPO_FLAG_FORCE 0x00000002
|
---|
42 |
|
---|
43 | #define LoadUserProfile __MINGW_NAME_AW(LoadUserProfile)
|
---|
44 | #define GetProfilesDirectory __MINGW_NAME_AW(GetProfilesDirectory)
|
---|
45 | #define DeleteProfile __MINGW_NAME_AW(DeleteProfile)
|
---|
46 | #define GetDefaultUserProfileDirectory __MINGW_NAME_AW(GetDefaultUserProfileDirectory)
|
---|
47 | #define GetAllUsersProfileDirectory __MINGW_NAME_AW(GetAllUsersProfileDirectory)
|
---|
48 | #define GetUserProfileDirectory __MINGW_NAME_AW(GetUserProfileDirectory)
|
---|
49 | #define ExpandEnvironmentStringsForUser __MINGW_NAME_AW(ExpandEnvironmentStringsForUser)
|
---|
50 |
|
---|
51 | USERENVAPI WINBOOL WINAPI LoadUserProfileA (HANDLE hToken, LPPROFILEINFOA lpProfileInfo);
|
---|
52 | USERENVAPI WINBOOL WINAPI LoadUserProfileW (HANDLE hToken, LPPROFILEINFOW lpProfileInfo);
|
---|
53 | USERENVAPI WINBOOL WINAPI UnloadUserProfile (HANDLE hToken, HANDLE hProfile);
|
---|
54 | USERENVAPI WINBOOL WINAPI GetProfilesDirectoryA (LPSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
55 | USERENVAPI WINBOOL WINAPI GetProfilesDirectoryW (LPWSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
56 | USERENVAPI WINBOOL WINAPI GetProfileType (DWORD *dwFlags);
|
---|
57 | USERENVAPI WINBOOL WINAPI DeleteProfileA (LPCSTR lpSidString, LPCSTR lpProfilePath, LPCSTR lpComputerName);
|
---|
58 | USERENVAPI WINBOOL WINAPI DeleteProfileW (LPCWSTR lpSidString, LPCWSTR lpProfilePath, LPCWSTR lpComputerName);
|
---|
59 | USERENVAPI WINBOOL WINAPI GetDefaultUserProfileDirectoryA (LPSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
60 | USERENVAPI WINBOOL WINAPI GetDefaultUserProfileDirectoryW (LPWSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
61 | USERENVAPI WINBOOL WINAPI GetAllUsersProfileDirectoryA (LPSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
62 | USERENVAPI WINBOOL WINAPI GetAllUsersProfileDirectoryW (LPWSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
63 | USERENVAPI WINBOOL WINAPI GetUserProfileDirectoryA (HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
64 | USERENVAPI WINBOOL WINAPI GetUserProfileDirectoryW (HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchSize);
|
---|
65 | WINBOOL WINAPI CreateEnvironmentBlock (LPVOID *lpEnvironment, HANDLE hToken, WINBOOL bInherit);
|
---|
66 | WINBOOL WINAPI DestroyEnvironmentBlock (LPVOID lpEnvironment);
|
---|
67 | USERENVAPI WINBOOL WINAPI ExpandEnvironmentStringsForUserA (HANDLE hToken, LPCSTR lpSrc, LPSTR lpDest, DWORD dwSize);
|
---|
68 | USERENVAPI WINBOOL WINAPI ExpandEnvironmentStringsForUserW (HANDLE hToken, LPCWSTR lpSrc, LPWSTR lpDest, DWORD dwSize);
|
---|
69 | USERENVAPI WINBOOL WINAPI RefreshPolicy (WINBOOL bMachine);
|
---|
70 | USERENVAPI WINBOOL WINAPI RefreshPolicyEx (WINBOOL bMachine, DWORD dwOptions);
|
---|
71 | USERENVAPI HANDLE WINAPI EnterCriticalPolicySection (WINBOOL bMachine);
|
---|
72 | USERENVAPI WINBOOL WINAPI LeaveCriticalPolicySection (HANDLE hSection);
|
---|
73 | USERENVAPI WINBOOL WINAPI RegisterGPNotification (HANDLE hEvent, WINBOOL bMachine);
|
---|
74 | USERENVAPI WINBOOL WINAPI UnregisterGPNotification (HANDLE hEvent);
|
---|
75 | #if WINVER >= 0x0600
|
---|
76 | USERENVAPI HRESULT WINAPI CreateProfile (LPCWSTR pszUserSid, LPCWSTR pszUserName, LPWSTR pszProfilePath, DWORD cchProfilePath);
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | typedef enum _GPO_LINK {
|
---|
80 | GPLinkUnknown = 0,
|
---|
81 | GPLinkMachine,
|
---|
82 | GPLinkSite,
|
---|
83 | GPLinkDomain,
|
---|
84 | GPLinkOrganizationalUnit
|
---|
85 | } GPO_LINK, *PGPO_LINK;
|
---|
86 |
|
---|
87 | typedef struct _GROUP_POLICY_OBJECTA {
|
---|
88 | DWORD dwOptions;
|
---|
89 | DWORD dwVersion;
|
---|
90 | LPSTR lpDSPath;
|
---|
91 | LPSTR lpFileSysPath;
|
---|
92 | LPSTR lpDisplayName;
|
---|
93 | CHAR szGPOName[50];
|
---|
94 | GPO_LINK GPOLink;
|
---|
95 | LPARAM lParam;
|
---|
96 | struct _GROUP_POLICY_OBJECTA *pNext;
|
---|
97 | struct _GROUP_POLICY_OBJECTA *pPrev;
|
---|
98 | LPSTR lpExtensions;
|
---|
99 | LPARAM lParam2;
|
---|
100 | LPSTR lpLink;
|
---|
101 | } GROUP_POLICY_OBJECTA, *PGROUP_POLICY_OBJECTA;
|
---|
102 |
|
---|
103 | typedef struct _GROUP_POLICY_OBJECTW {
|
---|
104 | DWORD dwOptions;
|
---|
105 | DWORD dwVersion;
|
---|
106 | LPWSTR lpDSPath;
|
---|
107 | LPWSTR lpFileSysPath;
|
---|
108 | LPWSTR lpDisplayName;
|
---|
109 | WCHAR szGPOName[50];
|
---|
110 | GPO_LINK GPOLink;
|
---|
111 | LPARAM lParam;
|
---|
112 | struct _GROUP_POLICY_OBJECTW *pNext;
|
---|
113 | struct _GROUP_POLICY_OBJECTW *pPrev;
|
---|
114 | LPWSTR lpExtensions;
|
---|
115 | LPARAM lParam2;
|
---|
116 | LPWSTR lpLink;
|
---|
117 | } GROUP_POLICY_OBJECTW,*PGROUP_POLICY_OBJECTW;
|
---|
118 |
|
---|
119 | __MINGW_TYPEDEF_AW(GROUP_POLICY_OBJECT)
|
---|
120 | __MINGW_TYPEDEF_AW(PGROUP_POLICY_OBJECT)
|
---|
121 |
|
---|
122 | #define GPO_LIST_FLAG_MACHINE 0x00000001
|
---|
123 | #define GPO_LIST_FLAG_SITEONLY 0x00000002
|
---|
124 | #define GPO_LIST_FLAG_NO_WMIFILTERS 0x00000004
|
---|
125 | #define GPO_LIST_FLAG_NO_SECURITYFILTERS 0x00000008
|
---|
126 |
|
---|
127 | #define GetGPOList __MINGW_NAME_AW(GetGPOList)
|
---|
128 | #define FreeGPOList __MINGW_NAME_AW(FreeGPOList)
|
---|
129 | #define GetAppliedGPOList __MINGW_NAME_AW(GetAppliedGPOList)
|
---|
130 |
|
---|
131 | USERENVAPI WINBOOL WINAPI GetGPOListA (HANDLE hToken, LPCSTR lpName, LPCSTR lpHostName, LPCSTR lpComputerName, DWORD dwFlags, PGROUP_POLICY_OBJECTA *pGPOList);
|
---|
132 | USERENVAPI WINBOOL WINAPI GetGPOListW (HANDLE hToken, LPCWSTR lpName, LPCWSTR lpHostName, LPCWSTR lpComputerName, DWORD dwFlags, PGROUP_POLICY_OBJECTW *pGPOList);
|
---|
133 | USERENVAPI WINBOOL WINAPI FreeGPOListA (PGROUP_POLICY_OBJECTA pGPOList);
|
---|
134 | USERENVAPI WINBOOL WINAPI FreeGPOListW (PGROUP_POLICY_OBJECTW pGPOList);
|
---|
135 | USERENVAPI DWORD WINAPI GetAppliedGPOListA (DWORD dwFlags, LPCSTR pMachineName, PSID pSidUser, GUID *pGuidExtension, PGROUP_POLICY_OBJECTA *ppGPOList);
|
---|
136 | USERENVAPI DWORD WINAPI GetAppliedGPOListW (DWORD dwFlags, LPCWSTR pMachineName, PSID pSidUser, GUID *pGuidExtension, PGROUP_POLICY_OBJECTW *ppGPOList);
|
---|
137 |
|
---|
138 | #define GP_DLLNAME TEXT ("DllName")
|
---|
139 | #define GP_ENABLEASYNCHRONOUSPROCESSING TEXT ("EnableAsynchronousProcessing")
|
---|
140 | #define GP_MAXNOGPOLISTCHANGESINTERVAL TEXT ("MaxNoGPOListChangesInterval")
|
---|
141 | #define GP_NOBACKGROUNDPOLICY TEXT ("NoBackgroundPolicy")
|
---|
142 | #define GP_NOGPOLISTCHANGES TEXT ("NoGPOListChanges")
|
---|
143 | #define GP_NOMACHINEPOLICY TEXT ("NoMachinePolicy")
|
---|
144 | #define GP_NOSLOWLINK TEXT ("NoSlowLink")
|
---|
145 | #define GP_NOTIFYLINKTRANSITION TEXT ("NotifyLinkTransition")
|
---|
146 | #define GP_NOUSERPOLICY TEXT ("NoUserPolicy")
|
---|
147 | #define GP_PERUSERLOCALSETTINGS TEXT ("PerUserLocalSettings")
|
---|
148 | #define GP_PROCESSGROUPPOLICY TEXT ("ProcessGroupPolicy")
|
---|
149 | #define GP_REQUIRESSUCCESSFULREGISTRY TEXT ("RequiresSuccessfulRegistry")
|
---|
150 |
|
---|
151 | #define GPO_INFO_FLAG_MACHINE 0x00000001
|
---|
152 | #define GPO_INFO_FLAG_BACKGROUND 0x00000010
|
---|
153 | #define GPO_INFO_FLAG_SLOWLINK 0x00000020
|
---|
154 | #define GPO_INFO_FLAG_VERBOSE 0x00000040
|
---|
155 | #define GPO_INFO_FLAG_NOCHANGES 0x00000080
|
---|
156 | #define GPO_INFO_FLAG_LINKTRANSITION 0x00000100
|
---|
157 | #define GPO_INFO_FLAG_LOGRSOP_TRANSITION 0x00000200
|
---|
158 | #define GPO_INFO_FLAG_FORCED_REFRESH 0x00000400
|
---|
159 | #define GPO_INFO_FLAG_SAFEMODE_BOOT 0x00000800
|
---|
160 | #define GPO_INFO_FLAG_ASYNC_FOREGROUND 0x00001000
|
---|
161 |
|
---|
162 | typedef UINT_PTR ASYNCCOMPLETIONHANDLE;
|
---|
163 | typedef DWORD (*PFNSTATUSMESSAGECALLBACK) (WINBOOL bVerbose, LPWSTR lpMessage);
|
---|
164 | typedef DWORD (*PFNPROCESSGROUPPOLICY) (DWORD dwFlags, HANDLE hToken, HKEY hKeyRoot, PGROUP_POLICY_OBJECT pDeletedGPOList, PGROUP_POLICY_OBJECT pChangedGPOList, ASYNCCOMPLETIONHANDLE pHandle, WINBOOL *pbAbort, PFNSTATUSMESSAGECALLBACK pStatusCallback);
|
---|
165 | typedef DWORD (*PFNPROCESSGROUPPOLICYEX) (DWORD dwFlags, HANDLE hToken, HKEY hKeyRoot, PGROUP_POLICY_OBJECT pDeletedGPOList, PGROUP_POLICY_OBJECT pChangedGPOList, ASYNCCOMPLETIONHANDLE pHandle, WINBOOL *pbAbort, PFNSTATUSMESSAGECALLBACK pStatusCallback, IWbemServices *pWbemServices, HRESULT *pRsopStatus);
|
---|
166 | typedef PVOID PRSOPTOKEN;
|
---|
167 |
|
---|
168 | typedef struct _RSOP_TARGET {
|
---|
169 | WCHAR *pwszAccountName;
|
---|
170 | WCHAR *pwszNewSOM;
|
---|
171 | SAFEARRAY *psaSecurityGroups;
|
---|
172 | PRSOPTOKEN pRsopToken;
|
---|
173 | PGROUP_POLICY_OBJECT pGPOList;
|
---|
174 | IWbemServices *pWbemServices;
|
---|
175 | } RSOP_TARGET, *PRSOP_TARGET;
|
---|
176 |
|
---|
177 | typedef DWORD (*PFNGENERATEGROUPPOLICY) (DWORD dwFlags, WINBOOL *pbAbort, WCHAR *pwszSite, PRSOP_TARGET pComputerTarget, PRSOP_TARGET pUserTarget);
|
---|
178 |
|
---|
179 | #define REGISTRY_EXTENSION_GUID { 0x35378eac, 0x683f, 0x11d2, 0xa8, 0x9a, 0x00, 0xc0, 0x4f, 0xbb, 0xcf, 0xa2 }
|
---|
180 |
|
---|
181 | #define GROUP_POLICY_TRIGGER_EVENT_PROVIDER_GUID { 0xbd2f4252, 0x5e1e, 0x49fc, 0x9a, 0x30, 0xf3, 0x97, 0x8a, 0xd8, 0x9e, 0xe2 }
|
---|
182 | #define MACHINE_POLICY_PRESENT_TRIGGER_GUID { 0x659fcae6, 0x5bdb, 0x4da9, 0xb1, 0xff, 0xca, 0x2a, 0x17, 0x8d, 0x46, 0xe0 }
|
---|
183 | #define USER_POLICY_PRESENT_TRIGGER_GUID { 0x54fb46c8, 0xf089, 0x464c, 0xb1, 0xfd, 0x59, 0xd1, 0xb6, 0x2c, 0x3b, 0x50 }
|
---|
184 |
|
---|
185 | typedef GUID *REFGPEXTENSIONID;
|
---|
186 |
|
---|
187 | USERENVAPI DWORD WINAPI ProcessGroupPolicyCompleted (REFGPEXTENSIONID extensionId, ASYNCCOMPLETIONHANDLE pAsyncHandle, DWORD dwStatus);
|
---|
188 | USERENVAPI DWORD WINAPI ProcessGroupPolicyCompletedEx (REFGPEXTENSIONID extensionId, ASYNCCOMPLETIONHANDLE pAsyncHandle, DWORD dwStatus, HRESULT RsopStatus);
|
---|
189 | USERENVAPI HRESULT WINAPI RsopAccessCheckByType (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pPrincipalSelfSid, PRSOPTOKEN pRsopToken, DWORD dwDesiredAccessMask, POBJECT_TYPE_LIST pObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING pGenericMapping, PPRIVILEGE_SET pPrivilegeSet, LPDWORD pdwPrivilegeSetLength, LPDWORD pdwGrantedAccessMask, LPBOOL pbAccessStatus);
|
---|
190 | USERENVAPI HRESULT WINAPI RsopFileAccessCheck (LPWSTR pszFileName, PRSOPTOKEN pRsopToken, DWORD dwDesiredAccessMask, LPDWORD pdwGrantedAccessMask, LPBOOL pbAccessStatus);
|
---|
191 |
|
---|
192 | typedef enum _SETTINGSTATUS {
|
---|
193 | RSOPUnspecified = 0,
|
---|
194 | RSOPApplied,
|
---|
195 | RSOPIgnored,
|
---|
196 | RSOPFailed,
|
---|
197 | RSOPSubsettingFailed
|
---|
198 | } SETTINGSTATUS;
|
---|
199 |
|
---|
200 | typedef struct _POLICYSETTINGSTATUSINFO {
|
---|
201 | LPWSTR szKey;
|
---|
202 | LPWSTR szEventSource;
|
---|
203 | LPWSTR szEventLogName;
|
---|
204 | DWORD dwEventID;
|
---|
205 | DWORD dwErrorCode;
|
---|
206 | SETTINGSTATUS status;
|
---|
207 | SYSTEMTIME timeLogged;
|
---|
208 | } POLICYSETTINGSTATUSINFO,*LPPOLICYSETTINGSTATUSINFO;
|
---|
209 |
|
---|
210 | USERENVAPI HRESULT WINAPI RsopSetPolicySettingStatus (DWORD dwFlags, IWbemServices *pServices, IWbemClassObject *pSettingInstance, DWORD nInfo, POLICYSETTINGSTATUSINFO *pStatus);
|
---|
211 | USERENVAPI HRESULT WINAPI RsopResetPolicySettingStatus (DWORD dwFlags, IWbemServices *pServices, IWbemClassObject *pSettingInstance);
|
---|
212 |
|
---|
213 | #define FLAG_NO_GPO_FILTER 0x80000000
|
---|
214 | #define FLAG_NO_CSE_INVOKE 0x40000000
|
---|
215 | #define FLAG_ASSUME_SLOW_LINK 0x20000000
|
---|
216 | #define FLAG_LOOPBACK_MERGE 0x10000000
|
---|
217 | #define FLAG_LOOPBACK_REPLACE 0x08000000
|
---|
218 | #define FLAG_ASSUME_USER_WQLFILTER_TRUE 0x04000000
|
---|
219 | #define FLAG_ASSUME_COMP_WQLFILTER_TRUE 0x02000000
|
---|
220 | #define FLAG_PLANNING_MODE 0x01000000
|
---|
221 |
|
---|
222 | #define FLAG_NO_USER 0x00000001
|
---|
223 | #define FLAG_NO_COMPUTER 0x00000002
|
---|
224 | #define FLAG_FORCE_CREATENAMESPACE 0x00000004
|
---|
225 |
|
---|
226 | #define RSOP_USER_ACCESS_DENIED 0x00000001
|
---|
227 | #define RSOP_COMPUTER_ACCESS_DENIED 0x00000002
|
---|
228 | #define RSOP_TEMPNAMESPACE_EXISTS 0x00000004
|
---|
229 |
|
---|
230 | #if WINVER >= 0x0600
|
---|
231 | USERENVAPI DWORD WINAPI GenerateGPNotification (WINBOOL bMachine, LPCWSTR lpwszMgmtProduct, DWORD dwMgmtProductOptions);
|
---|
232 | #endif
|
---|
233 | #if WINVER >= 0x0602
|
---|
234 | USERENVAPI HRESULT WINAPI CreateAppContainerProfile (PCWSTR pszAppContainerName, PCWSTR pszDisplayName, PCWSTR pszDescription, PSID_AND_ATTRIBUTES pCapabilities, DWORD dwCapabilityCount, PSID *ppSidAppContainerSid);
|
---|
235 | USERENVAPI HRESULT WINAPI DeleteAppContainerProfile (PCWSTR pszAppContainerName);
|
---|
236 | USERENVAPI HRESULT WINAPI GetAppContainerRegistryLocation (REGSAM desiredAccess, PHKEY phAppContainerKey);
|
---|
237 | USERENVAPI HRESULT WINAPI GetAppContainerFolderPath (PCWSTR pszAppContainerSid, PWSTR *ppszPath);
|
---|
238 | USERENVAPI HRESULT WINAPI DeriveAppContainerSidFromAppContainerName (PCWSTR pszAppContainerName, PSID *ppsidAppContainerSid);
|
---|
239 | #endif
|
---|
240 |
|
---|
241 | #ifdef __cplusplus
|
---|
242 | }
|
---|
243 | #endif
|
---|
244 |
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | #endif
|
---|