Make use of access mask MAXIMUM_ALLOWED possible.

This commit is contained in:
Juergen Schmied 2002-05-09 19:39:10 +00:00 committed by Alexandre Julliard
parent 7c68252560
commit a44e0b0fbd
1 changed files with 9 additions and 2 deletions

View File

@ -53,6 +53,9 @@ inline static int is_version_nt(void)
return !(GetVersion() & 0x80000000); return !(GetVersion() & 0x80000000);
} }
/* allowed bits for access mask */
#define KEY_ACCESS_MASK (KEY_ALL_ACCESS | MAXIMUM_ALLOWED)
/****************************************************************************** /******************************************************************************
* RegCreateKeyExW [ADVAPI32.@] * RegCreateKeyExW [ADVAPI32.@]
* *
@ -69,6 +72,8 @@ inline static int is_version_nt(void)
* *
* NOTES * NOTES
* in case of failing retkey remains untouched * in case of failing retkey remains untouched
*
* FIXME MAXIMUM_ALLOWED in access mask not supported by server
*/ */
DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR class, DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa, DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
@ -78,7 +83,7 @@ DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR cl
UNICODE_STRING nameW, classW; UNICODE_STRING nameW, classW;
if (reserved) return ERROR_INVALID_PARAMETER; if (reserved) return ERROR_INVALID_PARAMETER;
if (!(access & KEY_ALL_ACCESS) || (access & ~KEY_ALL_ACCESS)) return ERROR_ACCESS_DENIED; if (!(access & KEY_ACCESS_MASK) || (access & ~KEY_ACCESS_MASK)) return ERROR_ACCESS_DENIED;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = hkey; attr.RootDirectory = hkey;
@ -96,6 +101,8 @@ DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR cl
/****************************************************************************** /******************************************************************************
* RegCreateKeyExA [ADVAPI32.@] * RegCreateKeyExA [ADVAPI32.@]
*
* FIXME MAXIMUM_ALLOWED in access mask not supported by server
*/ */
DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR class, DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa, DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
@ -108,7 +115,7 @@ DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR clas
if (reserved) return ERROR_INVALID_PARAMETER; if (reserved) return ERROR_INVALID_PARAMETER;
if (!is_version_nt()) access = KEY_ALL_ACCESS; /* Win95 ignores the access mask */ if (!is_version_nt()) access = KEY_ALL_ACCESS; /* Win95 ignores the access mask */
else if (!(access & KEY_ALL_ACCESS) || (access & ~KEY_ALL_ACCESS)) return ERROR_ACCESS_DENIED; else if (!(access & KEY_ACCESS_MASK) || (access & ~KEY_ACCESS_MASK)) return ERROR_ACCESS_DENIED;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = hkey; attr.RootDirectory = hkey;