mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
- implemented RefreshPolicy() and RefreshPolicyEx()
- added missing definitions to userenv.h svn path=/trunk/; revision=20809
This commit is contained in:
parent
ac0d3797dd
commit
c3ac273c24
4 changed files with 82 additions and 0 deletions
|
@ -45,8 +45,12 @@ typedef enum
|
|||
|
||||
static const WCHAR szLocalGPApplied[] = L"userenv: User Group Policy has been applied";
|
||||
static const WCHAR szLocalGPMutex[] = L"userenv: user policy mutex";
|
||||
static const WCHAR szLocalGPRefreshEvent[] = L"userenv: user policy refresh event";
|
||||
static const WCHAR szLocalGPForceRefreshEvent[] = L"userenv: user policy force refresh event";
|
||||
static const WCHAR szMachineGPApplied[] = L"Global\\userenv: Machine Group Policy has been applied";
|
||||
static const WCHAR szMachineGPMutex[] = L"Global\\userenv: machine policy mutex";
|
||||
static const WCHAR szMachineGPRefreshEvent[] = L"Global\\userenv: machine policy refresh event";
|
||||
static const WCHAR szMachineGPForceRefreshEvent[] = L"Global\\userenv: machine policy force refresh event";
|
||||
|
||||
static CRITICAL_SECTION GPNotifyLock;
|
||||
static PGP_NOTIFY NotificationList = NULL;
|
||||
|
@ -412,6 +416,58 @@ UnregisterGPNotification(IN HANDLE hEvent)
|
|||
return Ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
RefreshPolicy(IN BOOL bMachine)
|
||||
{
|
||||
HANDLE hEvent;
|
||||
BOOL Ret = TRUE;
|
||||
|
||||
hEvent = OpenEventW(EVENT_MODIFY_STATE,
|
||||
FALSE,
|
||||
(bMachine ? szMachineGPRefreshEvent : szLocalGPRefreshEvent));
|
||||
if (hEvent != NULL)
|
||||
{
|
||||
Ret = SetEvent(hEvent);
|
||||
CloseHandle(hEvent);
|
||||
}
|
||||
|
||||
/* return TRUE even if the mutex doesn't exist! */
|
||||
return Ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
RefreshPolicyEx(IN BOOL bMachine,
|
||||
IN DWORD dwOptions)
|
||||
{
|
||||
if (dwOptions & ~RP_FORCE)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwOptions & RP_FORCE)
|
||||
{
|
||||
HANDLE hEvent;
|
||||
BOOL Ret = TRUE;
|
||||
|
||||
hEvent = OpenEventW(EVENT_MODIFY_STATE,
|
||||
FALSE,
|
||||
(bMachine ? szMachineGPForceRefreshEvent : szLocalGPForceRefreshEvent));
|
||||
if (hEvent != NULL)
|
||||
{
|
||||
Ret = SetEvent(hEvent);
|
||||
CloseHandle(hEvent);
|
||||
}
|
||||
|
||||
/* return TRUE even if the mutex doesn't exist! */
|
||||
return Ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RefreshPolicy(bMachine);
|
||||
}
|
||||
}
|
||||
|
||||
HANDLE WINAPI
|
||||
EnterCriticalPolicySection(IN BOOL bMachine)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,8 @@ GetUserProfileDirectoryW@12
|
|||
LeaveCriticalPolicySection@4
|
||||
LoadUserProfileA@8
|
||||
LoadUserProfileW@8
|
||||
RefreshPolicy@4
|
||||
RefreshPolicyEx@8
|
||||
RegisterGPNotification@8
|
||||
UnloadUserProfile@8
|
||||
UnregisterGPNotification@4
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x0500</define>
|
||||
<define name="_WIN32_WINNT">0x0600</define>
|
||||
<define name="WINVER">0x0600</define>
|
||||
<library>uuid</library>
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
|
|
|
@ -12,6 +12,10 @@ extern "C" {
|
|||
#define PI_NOUI (1)
|
||||
#define PI_APPLYPOLICY (2)
|
||||
|
||||
#if (WINVER >= 0x0500)
|
||||
#define RP_FORCE (1)
|
||||
#endif
|
||||
|
||||
typedef struct _PROFILEINFOA
|
||||
{
|
||||
DWORD dwSize;
|
||||
|
@ -70,6 +74,19 @@ BOOL WINAPI GetUserProfileDirectoryW(HANDLE, LPWSTR, LPDWORD);
|
|||
|
||||
BOOL WINAPI CreateEnvironmentBlock(LPVOID*, HANDLE, BOOL);
|
||||
BOOL WINAPI DestroyEnvironmentBlock(LPVOID);
|
||||
#if (WINVER >= 0x0500)
|
||||
BOOL WINAPI ExpandEnvironmentStringsForUserA (HANDLE, LPCSTR, LPSTR, DWORD);
|
||||
BOOL WINAPI ExpandEnvironmentStringsForUserW (HANDLE, LPCWSTR, LPWSTR, DWORD);
|
||||
#endif
|
||||
|
||||
HANDLE WINAPI EnterCriticalPolicySection (BOOL);
|
||||
BOOL WINAPI LeaveCriticalPolicySection (HANDLE);
|
||||
BOOL WINAPI RefreshPolicy (BOOL);
|
||||
#if (WINVER >= 0x0500)
|
||||
BOOL WINAPI RefreshPolicyEx (BOOL, DWORD);
|
||||
#endif
|
||||
BOOL WINAPI RegisterGPNotification (HANDLE, BOOL);
|
||||
BOOL WINAPI UnregisterGPNotification (HANDLE);
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef PROFILEINFOW PROFILEINFO;
|
||||
|
@ -89,6 +106,9 @@ typedef LPPROFILEINFOW LPPROFILEINFO;
|
|||
#define GetDefaultUserProfileDirectory GetDefaultUserProfileDirectoryW
|
||||
#define GetProfilesDirectory GetProfilesDirectoryW
|
||||
#define GetUserProfileDirectory GetUserProfileDirectoryW
|
||||
#if (WINVER >= 0x0500)
|
||||
#define ExpandEnvironmentStringsForUser ExpandEnvironmentStringsForUserW
|
||||
#endif
|
||||
#else
|
||||
typedef PROFILEINFOA PROFILEINFO;
|
||||
typedef LPPROFILEINFOA LPPROFILEINFO;
|
||||
|
@ -107,6 +127,9 @@ typedef LPPROFILEINFOA LPPROFILEINFO;
|
|||
#define GetDefaultUserProfileDirectory GetDefaultUserProfileDirectoryA
|
||||
#define GetProfilesDirectory GetProfilesDirectoryA
|
||||
#define GetUserProfileDirectory GetUserProfileDirectoryA
|
||||
#if (WINVER >= 0x0500)
|
||||
#define ExpandEnvironmentStringsForUser ExpandEnvironmentStringsForUserA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in a new issue