mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
userenv: open handles with least rights neccessary. Patch by w3seek, bug 1458.
svn path=/trunk/; revision=21846
This commit is contained in:
@@ -48,7 +48,7 @@ GetDesktopPath (BOOL bCommonPath,
|
||||
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 @@ GetProgramsPath (BOOL bCommonPath,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ CopyDirectory (LPCWSTR lpDestinationPath,
|
||||
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)
|
||||
{
|
||||
@@ -154,13 +154,6 @@ CopyDirectory (LPCWSTR lpDestinationPath,
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy file attributes */
|
||||
if (FindFileData.dwFileAttributes & ~FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
SetFileAttributesW (szFullDstName,
|
||||
FindFileData.dwFileAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
if (!FindNextFileW (hFind, &FindFileData))
|
||||
|
||||
@@ -181,7 +181,7 @@ GetCurrentUserKey (HANDLE hToken)
|
||||
Error = RegOpenKeyExW (HKEY_USERS,
|
||||
SidString.Buffer,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
MAXIMUM_ALLOWED,
|
||||
&hKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ SetUserEnvironment (LPVOID *lpEnvironment,
|
||||
Error = RegOpenKeyExW (hKey,
|
||||
lpSubKeyName,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
KEY_QUERY_VALUE,
|
||||
&hEnvKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ CreateUserProfileW (PSID Sid,
|
||||
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 @@ CreateUserProfileW (PSID Sid,
|
||||
{
|
||||
DPRINT1("AppendSystemPostfix() failed\n", GetLastError());
|
||||
LocalFree ((HLOCAL)SidString);
|
||||
RegCloseKey (hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -362,7 +361,7 @@ GetAllUsersProfileDirectoryW (LPWSTR lpProfileDir,
|
||||
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 @@ GetDefaultUserProfileDirectoryW (LPWSTR lpProfileDir,
|
||||
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 @@ GetProfilesDirectoryW (LPWSTR lpProfilesDir,
|
||||
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 @@ GetUserProfileDirectoryW (HANDLE hToken,
|
||||
Error = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
|
||||
szKeyName,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
KEY_QUERY_VALUE,
|
||||
&hKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
@@ -798,7 +797,7 @@ CheckForLoadedProfile (HANDLE hToken)
|
||||
if (RegOpenKeyExW (HKEY_USERS,
|
||||
SidString.Buffer,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
MAXIMUM_ALLOWED,
|
||||
&hKey))
|
||||
{
|
||||
DPRINT ("Profile not loaded\n");
|
||||
@@ -896,7 +895,7 @@ LoadUserProfileW (HANDLE hToken,
|
||||
Error = RegOpenKeyExW (HKEY_USERS,
|
||||
SidString.Buffer,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
MAXIMUM_ALLOWED,
|
||||
(PHKEY)&lpProfileInfo->hProfile);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
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 @@ InitializeProfiles (VOID)
|
||||
MAX_PATH))
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
RegCloseKey (hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -597,7 +596,7 @@ InitializeProfiles (VOID)
|
||||
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 @@ UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath,
|
||||
Error = RegOpenKeyExW(hUserKey,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
KEY_SET_VALUE,
|
||||
&hFoldersKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user