1 #ifndef _USERENV_H 2 #define _USERENV_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #define PI_NOUI (1) 9 #define PI_APPLYPOLICY (2) 10 11 #if (WINVER >= 0x0500) 12 #define RP_FORCE (1) 13 #endif 14 15 /* Values returned by GetProfileType */ 16 #if (WINVER >= 0x0500) 17 #define PT_TEMPORARY 1 18 #define PT_ROAMING 2 19 #define PT_MANDATORY 4 20 #endif 21 22 typedef struct _PROFILEINFOA 23 { 24 DWORD dwSize; 25 DWORD dwFlags; 26 LPSTR lpUserName; 27 LPSTR lpProfilePath; 28 LPSTR lpDefaultPath; 29 LPSTR lpServerName; 30 LPSTR lpPolicyPath; 31 HANDLE hProfile; 32 } PROFILEINFOA, *LPPROFILEINFOA; 33 34 typedef struct _PROFILEINFOW 35 { 36 DWORD dwSize; 37 DWORD dwFlags; 38 LPWSTR lpUserName; 39 LPWSTR lpProfilePath; 40 LPWSTR lpDefaultPath; 41 LPWSTR lpServerName; 42 LPWSTR lpPolicyPath; 43 HANDLE hProfile; 44 } PROFILEINFOW, *LPPROFILEINFOW; 45 46 #if (WINVER >= 0x0502) 47 typedef enum _GPO_LINK { 48 GPLinkUnknown = 0, 49 GPLinkMachine, 50 GPLinkSite, 51 GPLinkDomain, 52 GPLinkOrganizationalUnit 53 } GPO_LINK, *PGPO_LINK; 54 55 typedef struct _GROUP_POLICY_OBJECTA { 56 DWORD dwOptions; 57 DWORD dwVersion; 58 LPSTR lpDSPath; 59 LPSTR lpFileSysPath; 60 LPSTR lpDisplayName; 61 CHAR szGPOName[50]; 62 GPO_LINK GPOLink; 63 LPARAM lParam; 64 struct _GROUP_POLICY_OBJECTA *pNext; 65 struct _GROUP_POLICY_OBJECTA *pPrev; 66 LPSTR lpExtensions; 67 LPARAM lParam2; 68 LPSTR lpLink; 69 } GROUP_POLICY_OBJECTA, *PGROUP_POLICY_OBJECTA; 70 71 typedef struct _GROUP_POLICY_OBJECTW { 72 DWORD dwOptions; 73 DWORD dwVersion; 74 LPWSTR lpDSPath; 75 LPWSTR lpFileSysPath; 76 LPWSTR lpDisplayName; 77 WCHAR szGPOName[50]; 78 GPO_LINK GPOLink; 79 LPARAM lParam; 80 struct _GROUP_POLICY_OBJECTW *pNext; 81 struct _GROUP_POLICY_OBJECTW *pPrev; 82 LPWSTR lpExtensions; 83 LPARAM lParam2; 84 LPWSTR lpLink; 85 } GROUP_POLICY_OBJECTW, *PGROUP_POLICY_OBJECTW; 86 #endif 87 88 /* begin private */ 89 BOOL WINAPI InitializeProfiles (VOID); 90 BOOL WINAPI CreateUserProfileA (PSID, LPCSTR); 91 BOOL WINAPI CreateUserProfileW (PSID, LPCWSTR); 92 BOOL WINAPI CreateUserProfileExA (PSID, LPCSTR, LPCSTR, LPSTR, DWORD, BOOL); 93 BOOL WINAPI CreateUserProfileExW (PSID, LPCWSTR, LPCWSTR, LPWSTR, DWORD, BOOL); 94 BOOL WINAPI AddDesktopItemA (BOOL, LPCSTR, LPCSTR, LPCSTR, INT, LPCSTR, WORD, INT); 95 BOOL WINAPI AddDesktopItemW (BOOL, LPCWSTR, LPCWSTR, LPCWSTR, INT, LPCWSTR, WORD, INT); 96 BOOL WINAPI DeleteDesktopItemA (BOOL, LPCSTR); 97 BOOL WINAPI DeleteDesktopItemW (BOOL, LPCWSTR); 98 BOOL WINAPI CreateGroupA (LPCSTR, BOOL); 99 BOOL WINAPI CreateGroupW (LPCWSTR, BOOL); 100 BOOL WINAPI DeleteGroupA (LPCSTR, BOOL); 101 BOOL WINAPI DeleteGroupW (LPCWSTR, BOOL); 102 BOOL WINAPI AddItemA (LPCSTR, BOOL, LPCSTR, LPCSTR, LPCSTR, INT, LPCSTR, WORD, INT); 103 BOOL WINAPI AddItemW (LPCWSTR, BOOL, LPCWSTR, LPCWSTR, LPCWSTR, INT, LPCWSTR, WORD, INT); 104 BOOL WINAPI DeleteItemA (LPCSTR, BOOL, LPCSTR, BOOL); 105 BOOL WINAPI DeleteItemW (LPCWSTR, BOOL, LPCWSTR, BOOL); 106 BOOL WINAPI CopyProfileDirectoryA(LPCSTR, LPCSTR, DWORD); 107 BOOL WINAPI CopyProfileDirectoryW(LPCWSTR, LPCWSTR, DWORD); 108 PSID WINAPI GetUserSid(HANDLE); 109 BOOL WINAPI CopySystemProfile(ULONG); 110 /* end private */ 111 112 #if(WINVER >= 0x0500) 113 BOOL WINAPI DeleteProfileA(LPCSTR, LPCSTR, LPCSTR); 114 BOOL WINAPI DeleteProfileW(LPCWSTR, LPCWSTR, LPCWSTR); 115 #endif 116 BOOL WINAPI LoadUserProfileA (HANDLE, LPPROFILEINFOA); 117 BOOL WINAPI LoadUserProfileW (HANDLE, LPPROFILEINFOW); 118 BOOL WINAPI UnloadUserProfile (HANDLE, HANDLE); 119 120 BOOL WINAPI GetAllUsersProfileDirectoryA (LPSTR, LPDWORD); 121 BOOL WINAPI GetAllUsersProfileDirectoryW (LPWSTR, LPDWORD); 122 BOOL WINAPI GetDefaultUserProfileDirectoryA (LPSTR, LPDWORD); 123 BOOL WINAPI GetDefaultUserProfileDirectoryW (LPWSTR, LPDWORD); 124 BOOL WINAPI GetProfilesDirectoryA(LPSTR, LPDWORD); 125 BOOL WINAPI GetProfilesDirectoryW(LPWSTR, LPDWORD); 126 BOOL WINAPI GetUserProfileDirectoryA(HANDLE, LPSTR, LPDWORD); 127 BOOL WINAPI GetUserProfileDirectoryW(HANDLE, LPWSTR, LPDWORD); 128 #if (WINVER >= 0x0500) 129 BOOL WINAPI GetProfileType(PDWORD); 130 #endif 131 132 BOOL WINAPI CreateEnvironmentBlock(LPVOID*, HANDLE, BOOL); 133 BOOL WINAPI DestroyEnvironmentBlock(LPVOID); 134 #if (WINVER >= 0x0500) 135 BOOL WINAPI ExpandEnvironmentStringsForUserA (HANDLE, LPCSTR, LPSTR, DWORD); 136 BOOL WINAPI ExpandEnvironmentStringsForUserW (HANDLE, LPCWSTR, LPWSTR, DWORD); 137 #endif 138 139 #if (WINVER >= 0x0502) 140 DWORD 141 WINAPI 142 GetAppliedGPOListA( 143 _In_ DWORD dwFlags, 144 _In_ LPCSTR pMachineName, 145 _In_ PSID pSidUser, 146 _In_ GUID *pGuidExtension, 147 _Out_ PGROUP_POLICY_OBJECTA *ppGPOList 148 ); 149 DWORD 150 WINAPI 151 GetAppliedGPOListW( 152 _In_ DWORD dwFlags, 153 _In_ LPCWSTR pMachineName, 154 _In_ PSID pSidUser, 155 _In_ GUID *pGuidExtension, 156 _Out_ PGROUP_POLICY_OBJECTW *ppGPOList 157 ); 158 #endif 159 160 HANDLE WINAPI EnterCriticalPolicySection (BOOL); 161 BOOL WINAPI LeaveCriticalPolicySection (HANDLE); 162 BOOL WINAPI RefreshPolicy (BOOL); 163 #if (WINVER >= 0x0500) 164 BOOL WINAPI RefreshPolicyEx (BOOL, DWORD); 165 #endif 166 BOOL WINAPI RegisterGPNotification (HANDLE, BOOL); 167 BOOL WINAPI UnregisterGPNotification (HANDLE); 168 169 #ifdef UNICODE 170 typedef PROFILEINFOW PROFILEINFO; 171 typedef LPPROFILEINFOW LPPROFILEINFO; 172 /* begin private */ 173 #define CreateUserProfile CreateUserProfileW 174 #define CreateUserProfileEx CreateUserProfileExW 175 #define AddDesktopItem AddDesktopItemW 176 #define DeleteDesktopItem DeleteDesktopItemW 177 #define CreateGroup CreateGroupW 178 #define DeleteGroup DeleteGroupW 179 #define AddItem AddItemW 180 #define DeleteItem DeleteItemW 181 #define CopyProfileDirectory CopyProfileDirectoryW 182 /* end private */ 183 #if (WINVER >= 0x0500) 184 #define DeleteProfile DeleteProfileW 185 #endif 186 #define LoadUserProfile LoadUserProfileW 187 #define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryW 188 #define GetDefaultUserProfileDirectory GetDefaultUserProfileDirectoryW 189 #define GetProfilesDirectory GetProfilesDirectoryW 190 #define GetUserProfileDirectory GetUserProfileDirectoryW 191 #if (WINVER >= 0x0500) 192 #define ExpandEnvironmentStringsForUser ExpandEnvironmentStringsForUserW 193 #endif 194 #if (WINVER >= 0x0502) 195 typedef GROUP_POLICY_OBJECTW GROUP_POLICY_OBJECT; 196 typedef PGROUP_POLICY_OBJECTW PGROUP_POLICY_OBJECT; 197 #define GetAppliedGPOList GetAppliedGPOListW 198 #endif 199 #else 200 typedef PROFILEINFOA PROFILEINFO; 201 typedef LPPROFILEINFOA LPPROFILEINFO; 202 /* begin private */ 203 #define CreateUserProfile CreateUserProfileA 204 #define CreateUserProfileEx CreateUserProfileExA 205 #define AddDesktopItem AddDesktopItemA 206 #define DeleteDesktopItem DeleteDesktopItemA 207 #define CreateGroup CreateGroupA 208 #define DeleteGroup DeleteGroupA 209 #define AddItem AddItemA 210 #define DeleteItem DeleteItemA 211 #define CopyProfileDirectory CopyProfileDirectoryA 212 /* end private */ 213 #if (WINVER >= 0x0500) 214 #define DeleteProfile DeleteProfileA 215 #endif 216 #define LoadUserProfile LoadUserProfileA 217 #define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryA 218 #define GetDefaultUserProfileDirectory GetDefaultUserProfileDirectoryA 219 #define GetProfilesDirectory GetProfilesDirectoryA 220 #define GetUserProfileDirectory GetUserProfileDirectoryA 221 #if (WINVER >= 0x0500) 222 #define ExpandEnvironmentStringsForUser ExpandEnvironmentStringsForUserA 223 #endif 224 #if (WINVER >= 0x0502) 225 typedef GROUP_POLICY_OBJECTA GROUP_POLICY_OBJECT; 226 typedef PGROUP_POLICY_OBJECTA PGROUP_POLICY_OBJECT; 227 #define GetAppliedGPOList GetAppliedGPOListA 228 #endif 229 #endif 230 231 #ifdef __cplusplus 232 } 233 #endif 234 235 #endif /* _USERENV_H */ 236