From 9feee2204c68dc18040e1aaee7fcf4ebd80c8c25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 23 Aug 2009 08:29:23 +0000 Subject: [PATCH] Limit usage of KEY_ALL_ACCESS when opening registry keys svn path=/trunk/; revision=42874 --- reactos/base/setup/usetup/interface/devinst.c | 2 +- reactos/base/setup/usetup/mui.c | 8 ++++---- reactos/base/setup/usetup/settings.c | 12 ++++++------ reactos/dll/win32/shell32/shellpath.c | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/reactos/base/setup/usetup/interface/devinst.c b/reactos/base/setup/usetup/interface/devinst.c index e6014afe329..054cb9a94d9 100644 --- a/reactos/base/setup/usetup/interface/devinst.c +++ b/reactos/base/setup/usetup/interface/devinst.c @@ -311,7 +311,7 @@ EventThread(IN LPVOID lpParameter) hInf = *(HINF *)lpParameter; InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = NtOpenKey(&hEnum, 0, &ObjectAttributes); + Status = NtOpenKey(&hEnum, KEY_QUERY_VALUE, &ObjectAttributes); if (!NT_SUCCESS(Status)) { DPRINT1("NtOpenKey('%wZ') failed with status 0x%08lx\n", &EnumU, Status); diff --git a/reactos/base/setup/usetup/mui.c b/reactos/base/setup/usetup/mui.c index 6b80e5170ad..4071e13dc2d 100644 --- a/reactos/base/setup/usetup/mui.c +++ b/reactos/base/setup/usetup/mui.c @@ -235,7 +235,7 @@ AddHotkeySettings(IN LPCWSTR Hotkey, IN LPCWSTR LangHotkey, IN LPCWSTR LayoutHot NULL); Status = NtCreateKey(&KeyHandle, - KEY_ALL_ACCESS, + KEY_SET_VALUE, &ObjectAttributes, 0, NULL, @@ -326,7 +326,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts) NULL); Status = NtCreateKey(&KeyHandle, - KEY_ALL_ACCESS, + KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, @@ -358,7 +358,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts) NULL); Status = NtCreateKey(&KeyHandle, - KEY_ALL_ACCESS, + KEY_SET_VALUE, &ObjectAttributes, 0, NULL, @@ -379,7 +379,7 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts) NULL); Status = NtCreateKey(&SubKeyHandle, - KEY_ALL_ACCESS, + KEY_SET_VALUE, &ObjectAttributes, 0, NULL, diff --git a/reactos/base/setup/usetup/settings.c b/reactos/base/setup/usetup/settings.c index f51bf04f068..eb74c6b78bd 100644 --- a/reactos/base/setup/usetup/settings.c +++ b/reactos/base/setup/usetup/settings.c @@ -241,7 +241,7 @@ GetDisplayIdentifier(PWSTR Identifier, NULL); Status = NtOpenKey(&BusKey, - KEY_ALL_ACCESS, + KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); if (!NT_SUCCESS(Status)) { @@ -262,7 +262,7 @@ GetDisplayIdentifier(PWSTR Identifier, NULL); Status = NtOpenKey(&BusInstanceKey, - KEY_ALL_ACCESS, + KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); if (!NT_SUCCESS(Status)) { @@ -281,7 +281,7 @@ GetDisplayIdentifier(PWSTR Identifier, NULL); Status = NtOpenKey(&ControllerKey, - KEY_ALL_ACCESS, + KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); if (NT_SUCCESS(Status)) { @@ -300,7 +300,7 @@ GetDisplayIdentifier(PWSTR Identifier, NULL); Status = NtOpenKey(&ControllerInstanceKey, - KEY_ALL_ACCESS, + KEY_QUERY_VALUE, &ObjectAttributes); if (!NT_SUCCESS(Status)) { @@ -648,7 +648,7 @@ ProcessLocaleRegistry(PGENERIC_LIST List) NULL); Status = NtOpenKey(&KeyHandle, - KEY_ALL_ACCESS, + KEY_SET_VALUE, &ObjectAttributes); if (!NT_SUCCESS(Status)) @@ -976,7 +976,7 @@ SetGeoID(PWCHAR Id) NULL); Status = NtOpenKey(&KeyHandle, - KEY_ALL_ACCESS, + KEY_SET_VALUE, &ObjectAttributes); if(!NT_SUCCESS(Status)) { diff --git a/reactos/dll/win32/shell32/shellpath.c b/reactos/dll/win32/shell32/shellpath.c index 68021fba37c..5a39c8390b8 100644 --- a/reactos/dll/win32/shell32/shellpath.c +++ b/reactos/dll/win32/shell32/shellpath.c @@ -947,14 +947,14 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, 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)) { TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath)); return E_FAIL; } 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", debugstr_w(pUserShellFolderPath)); -- 2.17.1