Limit usage of KEY_ALL_ACCESS when opening registry keys

svn path=/trunk/; revision=42874
This commit is contained in:
Hervé Poussineau 2009-08-23 08:29:23 +00:00
parent 413dcab765
commit 9feee2204c
4 changed files with 13 additions and 13 deletions

View file

@ -311,7 +311,7 @@ EventThread(IN LPVOID lpParameter)
hInf = *(HINF *)lpParameter; hInf = *(HINF *)lpParameter;
InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_CASE_INSENSITIVE, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_CASE_INSENSITIVE, NULL, NULL);
Status = NtOpenKey(&hEnum, 0, &ObjectAttributes); Status = NtOpenKey(&hEnum, KEY_QUERY_VALUE, &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtOpenKey('%wZ') failed with status 0x%08lx\n", &EnumU, Status); DPRINT1("NtOpenKey('%wZ') failed with status 0x%08lx\n", &EnumU, Status);

View file

@ -235,7 +235,7 @@ AddHotkeySettings(IN LPCWSTR Hotkey, IN LPCWSTR LangHotkey, IN LPCWSTR LayoutHot
NULL); NULL);
Status = NtCreateKey(&KeyHandle, Status = NtCreateKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
@ -326,7 +326,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
NULL); NULL);
Status = NtCreateKey(&KeyHandle, Status = NtCreateKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_CREATE_SUB_KEY,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
@ -358,7 +358,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
NULL); NULL);
Status = NtCreateKey(&KeyHandle, Status = NtCreateKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
@ -379,7 +379,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
NULL); NULL);
Status = NtCreateKey(&SubKeyHandle, Status = NtCreateKey(&SubKeyHandle,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,

View file

@ -241,7 +241,7 @@ GetDisplayIdentifier(PWSTR Identifier,
NULL); NULL);
Status = NtOpenKey(&BusKey, Status = NtOpenKey(&BusKey,
KEY_ALL_ACCESS, KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -262,7 +262,7 @@ GetDisplayIdentifier(PWSTR Identifier,
NULL); NULL);
Status = NtOpenKey(&BusInstanceKey, Status = NtOpenKey(&BusInstanceKey,
KEY_ALL_ACCESS, KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -281,7 +281,7 @@ GetDisplayIdentifier(PWSTR Identifier,
NULL); NULL);
Status = NtOpenKey(&ControllerKey, Status = NtOpenKey(&ControllerKey,
KEY_ALL_ACCESS, KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes); &ObjectAttributes);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -300,7 +300,7 @@ GetDisplayIdentifier(PWSTR Identifier,
NULL); NULL);
Status = NtOpenKey(&ControllerInstanceKey, Status = NtOpenKey(&ControllerInstanceKey,
KEY_ALL_ACCESS, KEY_QUERY_VALUE,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -648,7 +648,7 @@ ProcessLocaleRegistry(PGENERIC_LIST List)
NULL); NULL);
Status = NtOpenKey(&KeyHandle, Status = NtOpenKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -976,7 +976,7 @@ SetGeoID(PWCHAR Id)
NULL); NULL);
Status = NtOpenKey(&KeyHandle, Status = NtOpenKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_SET_VALUE,
&ObjectAttributes); &ObjectAttributes);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {

View file

@ -947,14 +947,14 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
pShellFolderPath = szSHFolders; pShellFolderPath = szSHFolders;
} }
if (RegCreateKeyExW(rootKey, pShellFolderPath, 0, NULL, 0, KEY_ALL_ACCESS, if (RegCreateKeyExW(rootKey, pShellFolderPath, 0, NULL, 0, KEY_SET_VALUE,
NULL, &shellFolderKey, &dwDisp)) NULL, &shellFolderKey, &dwDisp))
{ {
TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath)); TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath));
return E_FAIL; return E_FAIL;
} }
if (RegCreateKeyExW(rootKey, pUserShellFolderPath, 0, NULL, 0, if (RegCreateKeyExW(rootKey, pUserShellFolderPath, 0, NULL, 0,
KEY_ALL_ACCESS, NULL, &userShellFolderKey, &dwDisp)) KEY_QUERY_VALUE, NULL, &userShellFolderKey, &dwDisp))
{ {
TRACE("Failed to create %s\n", TRACE("Failed to create %s\n",
debugstr_w(pUserShellFolderPath)); debugstr_w(pUserShellFolderPath));