Author: amunger
Date: Mon May 8 00:23:16 2006
New Revision: 21846
URL:
http://svn.reactos.ru/svn/reactos?rev=21846&view=rev
Log:
userenv: open handles with least rights neccessary. Patch by w3seek, bug 1458.
Modified:
trunk/reactos/dll/win32/userenv/desktop.c
trunk/reactos/dll/win32/userenv/directory.c
trunk/reactos/dll/win32/userenv/environment.c
trunk/reactos/dll/win32/userenv/profile.c
trunk/reactos/dll/win32/userenv/setup.c
Modified: trunk/reactos/dll/win32/userenv/desktop.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/userenv/desktop.c…
==============================================================================
--- trunk/reactos/dll/win32/userenv/desktop.c (original)
+++ trunk/reactos/dll/win32/userenv/desktop.c Mon May 8 00:23:16 2006
@@ -48,7 +48,7 @@
Error = RegOpenKeyExW (HKEY_CURRENT_USER,
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -106,7 +106,7 @@
Error = RegOpenKeyExW (HKEY_CURRENT_USER,
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
Modified: trunk/reactos/dll/win32/userenv/directory.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/userenv/directory…
==============================================================================
--- trunk/reactos/dll/win32/userenv/directory.c (original)
+++ trunk/reactos/dll/win32/userenv/directory.c Mon May 8 00:23:16 2006
@@ -124,7 +124,7 @@
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
DPRINT ("Create directory: %S\n", szFullDstName);
- if (!CreateDirectoryW (szFullDstName, NULL))
+ if (!CreateDirectoryExW (szFullSrcName, szFullDstName, NULL))
{
if (GetLastError () != ERROR_ALREADY_EXISTS)
{
@@ -153,13 +153,6 @@
FindClose (hFind);
return FALSE;
}
- }
-
- /* Copy file attributes */
- if (FindFileData.dwFileAttributes & ~FILE_ATTRIBUTE_DIRECTORY)
- {
- SetFileAttributesW (szFullDstName,
- FindFileData.dwFileAttributes);
}
}
Modified: trunk/reactos/dll/win32/userenv/environment.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/userenv/environme…
==============================================================================
--- trunk/reactos/dll/win32/userenv/environment.c (original)
+++ trunk/reactos/dll/win32/userenv/environment.c Mon May 8 00:23:16 2006
@@ -181,7 +181,7 @@
Error = RegOpenKeyExW (HKEY_USERS,
SidString.Buffer,
0,
- KEY_ALL_ACCESS,
+ MAXIMUM_ALLOWED,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -217,7 +217,7 @@
Error = RegOpenKeyExW (hKey,
lpSubKeyName,
0,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&hEnvKey);
if (Error != ERROR_SUCCESS)
{
Modified: trunk/reactos/dll/win32/userenv/profile.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/userenv/profile.c…
==============================================================================
--- trunk/reactos/dll/win32/userenv/profile.c (original)
+++ trunk/reactos/dll/win32/userenv/profile.c Mon May 8 00:23:16 2006
@@ -121,7 +121,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -181,7 +181,6 @@
{
DPRINT1("AppendSystemPostfix() failed\n", GetLastError());
LocalFree ((HLOCAL)SidString);
- RegCloseKey (hKey);
return FALSE;
}
@@ -362,7 +361,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_READ,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -482,7 +481,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_READ,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -602,7 +601,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_READ,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -725,7 +724,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
szKeyName,
0,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -798,7 +797,7 @@
if (RegOpenKeyExW (HKEY_USERS,
SidString.Buffer,
0,
- KEY_ALL_ACCESS,
+ MAXIMUM_ALLOWED,
&hKey))
{
DPRINT ("Profile not loaded\n");
@@ -896,7 +895,7 @@
Error = RegOpenKeyExW (HKEY_USERS,
SidString.Buffer,
0,
- KEY_ALL_ACCESS,
+ MAXIMUM_ALLOWED,
(PHKEY)&lpProfileInfo->hProfile);
if (Error != ERROR_SUCCESS)
{
Modified: trunk/reactos/dll/win32/userenv/setup.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/userenv/setup.c?r…
==============================================================================
--- trunk/reactos/dll/win32/userenv/setup.c (original)
+++ trunk/reactos/dll/win32/userenv/setup.c Mon May 8 00:23:16 2006
@@ -127,7 +127,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -256,7 +256,7 @@
Error = RegOpenKeyExW(HKEY_USERS,
L".Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -328,7 +328,7 @@
Error = RegOpenKeyExW(HKEY_USERS,
L".Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User
Shell Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -388,7 +388,7 @@
Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -472,7 +472,7 @@
Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -525,7 +525,7 @@
Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -589,7 +589,6 @@
MAX_PATH))
{
DPRINT1("Error: %lu\n", GetLastError());
- RegCloseKey (hKey);
return FALSE;
}
@@ -597,7 +596,7 @@
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hKey);
if (Error != ERROR_SUCCESS)
{
@@ -657,7 +656,7 @@
Error = RegOpenKeyExW(hUserKey,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell
Folders",
0,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&hFoldersKey);
if (Error != ERROR_SUCCESS)
{