mirror of
https://github.com/reactos/reactos.git
synced 2024-07-03 03:04:22 +00:00
[USERENV]
Fix coding style and indentation. No code changes! svn path=/trunk/; revision=60744
This commit is contained in:
parent
5bb77216c8
commit
480ce3de05
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/desktop.c
|
* FILE: dll/win32/userenv/desktop.c
|
||||||
* PURPOSE: Desktop and start menu support functions.
|
* PURPOSE: Desktop and start menu support functions.
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -32,8 +32,9 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
GetDesktopPath (BOOL bCommonPath,
|
BOOL
|
||||||
|
GetDesktopPath(BOOL bCommonPath,
|
||||||
LPWSTR lpDesktopPath)
|
LPWSTR lpDesktopPath)
|
||||||
{
|
{
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
|
@ -42,22 +43,22 @@ GetDesktopPath (BOOL bCommonPath,
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
LONG Error;
|
LONG Error;
|
||||||
|
|
||||||
DPRINT ("GetDesktopPath() called\n");
|
DPRINT("GetDesktopPath() called\n");
|
||||||
|
|
||||||
Error = RegOpenKeyExW (HKEY_CURRENT_USER,
|
Error = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey);
|
&hKey);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("RegOpenKeyExW() failed\n");
|
DPRINT1("RegOpenKeyExW() failed\n");
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = MAX_PATH * sizeof(WCHAR);
|
dwLength = MAX_PATH * sizeof(WCHAR);
|
||||||
Error = RegQueryValueExW (hKey,
|
Error = RegQueryValueExW(hKey,
|
||||||
bCommonPath ? L"Common Desktop" : L"Desktop",
|
bCommonPath ? L"Common Desktop" : L"Desktop",
|
||||||
0,
|
0,
|
||||||
&dwType,
|
&dwType,
|
||||||
|
@ -65,33 +66,34 @@ GetDesktopPath (BOOL bCommonPath,
|
||||||
&dwLength);
|
&dwLength);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("RegQueryValueExW() failed\n");
|
DPRINT1("RegQueryValueExW() failed\n");
|
||||||
RegCloseKey (hKey);
|
RegCloseKey(hKey);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey (hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
{
|
{
|
||||||
ExpandEnvironmentStringsW (szPath,
|
ExpandEnvironmentStringsW(szPath,
|
||||||
lpDesktopPath,
|
lpDesktopPath,
|
||||||
MAX_PATH);
|
MAX_PATH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscpy (lpDesktopPath, szPath);
|
wcscpy(lpDesktopPath, szPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("GetDesktopPath() done\n");
|
DPRINT("GetDesktopPath() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
GetProgramsPath (BOOL bCommonPath,
|
BOOL
|
||||||
|
GetProgramsPath(BOOL bCommonPath,
|
||||||
LPWSTR lpProgramsPath)
|
LPWSTR lpProgramsPath)
|
||||||
{
|
{
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
|
@ -100,22 +102,22 @@ GetProgramsPath (BOOL bCommonPath,
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
LONG Error;
|
LONG Error;
|
||||||
|
|
||||||
DPRINT ("GetProgramsPath() called\n");
|
DPRINT("GetProgramsPath() called\n");
|
||||||
|
|
||||||
Error = RegOpenKeyExW (HKEY_CURRENT_USER,
|
Error = RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey);
|
&hKey);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("RegOpenKeyExW() failed\n");
|
DPRINT1("RegOpenKeyExW() failed\n");
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = MAX_PATH * sizeof(WCHAR);
|
dwLength = MAX_PATH * sizeof(WCHAR);
|
||||||
Error = RegQueryValueExW (hKey,
|
Error = RegQueryValueExW(hKey,
|
||||||
bCommonPath ? L"Common Programs" : L"Programs",
|
bCommonPath ? L"Common Programs" : L"Programs",
|
||||||
0,
|
0,
|
||||||
&dwType,
|
&dwType,
|
||||||
|
@ -123,34 +125,35 @@ GetProgramsPath (BOOL bCommonPath,
|
||||||
&dwLength);
|
&dwLength);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("RegQueryValueExW() failed\n");
|
DPRINT1("RegQueryValueExW() failed\n");
|
||||||
RegCloseKey (hKey);
|
RegCloseKey(hKey);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey (hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
{
|
{
|
||||||
ExpandEnvironmentStringsW (szPath,
|
ExpandEnvironmentStringsW(szPath,
|
||||||
lpProgramsPath,
|
lpProgramsPath,
|
||||||
MAX_PATH);
|
MAX_PATH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscpy (lpProgramsPath,
|
wcscpy(lpProgramsPath,
|
||||||
szPath);
|
szPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("GetProgramsPath() done\n");
|
DPRINT("GetProgramsPath() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
AddDesktopItemA (BOOL bCommonItem,
|
WINAPI
|
||||||
|
AddDesktopItemA(BOOL bCommonItem,
|
||||||
LPCSTR lpItemName,
|
LPCSTR lpItemName,
|
||||||
LPCSTR lpArguments,
|
LPCSTR lpArguments,
|
||||||
LPCSTR lpIconLocation,
|
LPCSTR lpIconLocation,
|
||||||
|
@ -224,8 +227,9 @@ AddDesktopItemA (BOOL bCommonItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
AddDesktopItemW (BOOL bCommonDesktop,
|
WINAPI
|
||||||
|
AddDesktopItemW(BOOL bCommonDesktop,
|
||||||
LPCWSTR lpItemName,
|
LPCWSTR lpItemName,
|
||||||
LPCWSTR lpArguments,
|
LPCWSTR lpArguments,
|
||||||
LPCWSTR lpIconLocation,
|
LPCWSTR lpIconLocation,
|
||||||
|
@ -247,59 +251,59 @@ AddDesktopItemW (BOOL bCommonDesktop,
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
DPRINT ("AddDesktopItemW() called\n");
|
DPRINT("AddDesktopItemW() called\n");
|
||||||
|
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
|
|
||||||
if (!GetDesktopPath (bCommonDesktop, szLinkPath))
|
if (!GetDesktopPath(bCommonDesktop, szLinkPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetDesktopPath() failed\n");
|
DPRINT1("GetDesktopPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DPRINT ("Desktop path: '%S'\n", szLinkPath);
|
DPRINT("Desktop path: '%S'\n", szLinkPath);
|
||||||
|
|
||||||
/* Make sure the path exists */
|
/* Make sure the path exists */
|
||||||
hFind = FindFirstFileW (szLinkPath,
|
hFind = FindFirstFileW(szLinkPath,
|
||||||
&FindData);
|
&FindData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT ("'%S' does not exist\n", szLinkPath);
|
DPRINT("'%S' does not exist\n", szLinkPath);
|
||||||
|
|
||||||
/* Create directory path */
|
/* Create directory path */
|
||||||
if (!CreateDirectoryPath (szLinkPath, NULL))
|
if (!CreateDirectoryPath(szLinkPath, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT ("'%S' exists\n", szLinkPath);
|
DPRINT("'%S' exists\n", szLinkPath);
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append backslash, item name and ".lnk" extension */
|
/* Append backslash, item name and ".lnk" extension */
|
||||||
wcscat (szLinkPath, L"\\");
|
wcscat(szLinkPath, L"\\");
|
||||||
wcscat (szLinkPath, lpItemName);
|
wcscat(szLinkPath, lpItemName);
|
||||||
wcscat (szLinkPath, L".lnk");
|
wcscat(szLinkPath, L".lnk");
|
||||||
DPRINT ("Link path: '%S'\n", szLinkPath);
|
DPRINT("Link path: '%S'\n", szLinkPath);
|
||||||
|
|
||||||
/* Split 'lpArguments' string into command and arguments */
|
/* Split 'lpArguments' string into command and arguments */
|
||||||
Ptr = wcschr (lpArguments, L' ');
|
Ptr = wcschr(lpArguments, L' ');
|
||||||
DPRINT ("Ptr %p lpArguments %p\n", Ptr, lpArguments);
|
DPRINT("Ptr %p lpArguments %p\n", Ptr, lpArguments);
|
||||||
if (Ptr != NULL)
|
if (Ptr != NULL)
|
||||||
{
|
{
|
||||||
dwLength = (DWORD)(Ptr - lpArguments);
|
dwLength = (DWORD)(Ptr - lpArguments);
|
||||||
DPRINT ("dwLength %lu\n", dwLength);
|
DPRINT("dwLength %lu\n", dwLength);
|
||||||
memcpy (szCommand, lpArguments, dwLength * sizeof(WCHAR));
|
memcpy(szCommand, lpArguments, dwLength * sizeof(WCHAR));
|
||||||
szCommand[dwLength] = 0;
|
szCommand[dwLength] = 0;
|
||||||
Ptr++;
|
Ptr++;
|
||||||
wcscpy (szArguments, Ptr);
|
wcscpy(szArguments, Ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscpy (szCommand, lpArguments);
|
wcscpy(szCommand, lpArguments);
|
||||||
szArguments[0] = 0;
|
szArguments[0] = 0;
|
||||||
}
|
}
|
||||||
DPRINT ("szCommand: '%S'\n", szCommand);
|
DPRINT("szCommand: '%S'\n", szCommand);
|
||||||
DPRINT ("szArguments: '%S'\n", szArguments);
|
DPRINT("szArguments: '%S'\n", szArguments);
|
||||||
|
|
||||||
/* Dynamically load ole32.dll */
|
/* Dynamically load ole32.dll */
|
||||||
if (!LoadDynamicImports(&DynOle32, &Ole32))
|
if (!LoadDynamicImports(&DynOle32, &Ole32))
|
||||||
|
@ -372,14 +376,15 @@ AddDesktopItemW (BOOL bCommonDesktop,
|
||||||
|
|
||||||
UnloadDynamicImports(&Ole32);
|
UnloadDynamicImports(&Ole32);
|
||||||
|
|
||||||
DPRINT ("AddDesktopItemW() done\n");
|
DPRINT("AddDesktopItemW() done\n");
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteDesktopItemA (BOOL bCommonItem,
|
WINAPI
|
||||||
|
DeleteDesktopItemA(BOOL bCommonItem,
|
||||||
LPCSTR lpItemName)
|
LPCSTR lpItemName)
|
||||||
{
|
{
|
||||||
UNICODE_STRING ItemName;
|
UNICODE_STRING ItemName;
|
||||||
|
@ -401,31 +406,33 @@ DeleteDesktopItemA (BOOL bCommonItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteDesktopItemW (BOOL bCommonItem,
|
WINAPI
|
||||||
|
DeleteDesktopItemW(BOOL bCommonItem,
|
||||||
LPCWSTR lpItemName)
|
LPCWSTR lpItemName)
|
||||||
{
|
{
|
||||||
WCHAR szLinkPath[MAX_PATH];
|
WCHAR szLinkPath[MAX_PATH];
|
||||||
|
|
||||||
DPRINT ("DeleteDesktopItemW() called\n");
|
DPRINT("DeleteDesktopItemW() called\n");
|
||||||
|
|
||||||
if (!GetDesktopPath (bCommonItem, szLinkPath))
|
if (!GetDesktopPath(bCommonItem, szLinkPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetDesktopPath() failed\n");
|
DPRINT1("GetDesktopPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscat (szLinkPath, L"\\");
|
wcscat(szLinkPath, L"\\");
|
||||||
wcscat (szLinkPath, lpItemName);
|
wcscat(szLinkPath, lpItemName);
|
||||||
wcscat (szLinkPath, L".lnk");
|
wcscat(szLinkPath, L".lnk");
|
||||||
DPRINT ("Link path: '%S'\n", szLinkPath);
|
DPRINT("Link path: '%S'\n", szLinkPath);
|
||||||
|
|
||||||
return DeleteFileW (szLinkPath);
|
return DeleteFileW (szLinkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
CreateGroupA (LPCSTR lpGroupName,
|
WINAPI
|
||||||
|
CreateGroupA(LPCSTR lpGroupName,
|
||||||
BOOL bCommonGroup)
|
BOOL bCommonGroup)
|
||||||
{
|
{
|
||||||
UNICODE_STRING GroupName;
|
UNICODE_STRING GroupName;
|
||||||
|
@ -446,27 +453,28 @@ CreateGroupA (LPCSTR lpGroupName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
CreateGroupW (LPCWSTR lpGroupName,
|
WINAPI
|
||||||
|
CreateGroupW(LPCWSTR lpGroupName,
|
||||||
BOOL bCommonGroup)
|
BOOL bCommonGroup)
|
||||||
{
|
{
|
||||||
WCHAR szGroupPath[MAX_PATH];
|
WCHAR szGroupPath[MAX_PATH];
|
||||||
|
|
||||||
DPRINT1 ("CreateGroupW() called\n");
|
DPRINT1("CreateGroupW() called\n");
|
||||||
|
|
||||||
if (lpGroupName == NULL || *lpGroupName == 0)
|
if (lpGroupName == NULL || *lpGroupName == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!GetProgramsPath (bCommonGroup, szGroupPath))
|
if (!GetProgramsPath(bCommonGroup, szGroupPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetProgramsPath() failed\n");
|
DPRINT1("GetProgramsPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DPRINT1 ("Programs path: '%S'\n", szGroupPath);
|
DPRINT1("Programs path: '%S'\n", szGroupPath);
|
||||||
|
|
||||||
wcscat (szGroupPath, L"\\");
|
wcscat(szGroupPath, L"\\");
|
||||||
wcscat (szGroupPath, lpGroupName);
|
wcscat(szGroupPath, lpGroupName);
|
||||||
DPRINT1 ("Group path: '%S'\n", szGroupPath);
|
DPRINT1("Group path: '%S'\n", szGroupPath);
|
||||||
|
|
||||||
/* Create directory path */
|
/* Create directory path */
|
||||||
if (!CreateDirectoryPath (szGroupPath, NULL))
|
if (!CreateDirectoryPath (szGroupPath, NULL))
|
||||||
|
@ -474,14 +482,15 @@ CreateGroupW (LPCWSTR lpGroupName,
|
||||||
|
|
||||||
/* FIXME: Notify the shell */
|
/* FIXME: Notify the shell */
|
||||||
|
|
||||||
DPRINT1 ("CreateGroupW() done\n");
|
DPRINT1("CreateGroupW() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteGroupA (LPCSTR lpGroupName,
|
WINAPI
|
||||||
|
DeleteGroupA(LPCSTR lpGroupName,
|
||||||
BOOL bCommonGroup)
|
BOOL bCommonGroup)
|
||||||
{
|
{
|
||||||
UNICODE_STRING GroupName;
|
UNICODE_STRING GroupName;
|
||||||
|
@ -502,27 +511,28 @@ DeleteGroupA (LPCSTR lpGroupName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteGroupW (LPCWSTR lpGroupName,
|
WINAPI
|
||||||
|
DeleteGroupW(LPCWSTR lpGroupName,
|
||||||
BOOL bCommonGroup)
|
BOOL bCommonGroup)
|
||||||
{
|
{
|
||||||
WCHAR szGroupPath[MAX_PATH];
|
WCHAR szGroupPath[MAX_PATH];
|
||||||
|
|
||||||
DPRINT ("DeleteGroupW() called\n");
|
DPRINT("DeleteGroupW() called\n");
|
||||||
|
|
||||||
if (lpGroupName == NULL || *lpGroupName == 0)
|
if (lpGroupName == NULL || *lpGroupName == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!GetProgramsPath (bCommonGroup, szGroupPath))
|
if (!GetProgramsPath(bCommonGroup, szGroupPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetProgramsPath() failed\n");
|
DPRINT1("GetProgramsPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DPRINT ("Programs path: '%S'\n", szGroupPath);
|
DPRINT("Programs path: '%S'\n", szGroupPath);
|
||||||
|
|
||||||
wcscat (szGroupPath, L"\\");
|
wcscat(szGroupPath, L"\\");
|
||||||
wcscat (szGroupPath, lpGroupName);
|
wcscat(szGroupPath, lpGroupName);
|
||||||
DPRINT ("Group path: '%S'\n", szGroupPath);
|
DPRINT("Group path: '%S'\n", szGroupPath);
|
||||||
|
|
||||||
/* Remove directory path */
|
/* Remove directory path */
|
||||||
if (!RemoveDirectoryPath (szGroupPath))
|
if (!RemoveDirectoryPath (szGroupPath))
|
||||||
|
@ -530,14 +540,15 @@ DeleteGroupW (LPCWSTR lpGroupName,
|
||||||
|
|
||||||
/* FIXME: Notify the shell */
|
/* FIXME: Notify the shell */
|
||||||
|
|
||||||
DPRINT ("DeleteGroupW() done\n");
|
DPRINT("DeleteGroupW() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
AddItemA (LPCSTR lpGroupName, /* Optional */
|
WINAPI
|
||||||
|
AddItemA(LPCSTR lpGroupName, /* Optional */
|
||||||
BOOL bCommonGroup,
|
BOOL bCommonGroup,
|
||||||
LPCSTR lpItemName,
|
LPCSTR lpItemName,
|
||||||
LPCSTR lpArguments,
|
LPCSTR lpArguments,
|
||||||
|
@ -636,8 +647,9 @@ AddItemA (LPCSTR lpGroupName, /* Optional */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
AddItemW (LPCWSTR lpGroupName, /* Optional */
|
WINAPI
|
||||||
|
AddItemW(LPCWSTR lpGroupName, /* Optional */
|
||||||
BOOL bCommonGroup,
|
BOOL bCommonGroup,
|
||||||
LPCWSTR lpItemName,
|
LPCWSTR lpItemName,
|
||||||
LPCWSTR lpArguments,
|
LPCWSTR lpArguments,
|
||||||
|
@ -660,64 +672,64 @@ AddItemW (LPCWSTR lpGroupName, /* Optional */
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
DPRINT ("AddItemW() called\n");
|
DPRINT("AddItemW() called\n");
|
||||||
|
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
|
|
||||||
if (!GetProgramsPath (bCommonGroup, szLinkPath))
|
if (!GetProgramsPath(bCommonGroup, szLinkPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetProgramsPath() failed\n");
|
DPRINT1("GetProgramsPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("Programs path: '%S'\n", szLinkPath);
|
DPRINT("Programs path: '%S'\n", szLinkPath);
|
||||||
|
|
||||||
if (lpGroupName != NULL && *lpGroupName != 0)
|
if (lpGroupName != NULL && *lpGroupName != 0)
|
||||||
{
|
{
|
||||||
wcscat (szLinkPath, L"\\");
|
wcscat(szLinkPath, L"\\");
|
||||||
wcscat (szLinkPath, lpGroupName);
|
wcscat(szLinkPath, lpGroupName);
|
||||||
|
|
||||||
/* Make sure the path exists */
|
/* Make sure the path exists */
|
||||||
hFind = FindFirstFileW (szLinkPath,
|
hFind = FindFirstFileW(szLinkPath,
|
||||||
&FindData);
|
&FindData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT ("'%S' does not exist\n", szLinkPath);
|
DPRINT("'%S' does not exist\n", szLinkPath);
|
||||||
if (!CreateGroupW (lpGroupName,
|
if (!CreateGroupW(lpGroupName,
|
||||||
bCommonGroup))
|
bCommonGroup))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT ("'%S' exists\n", szLinkPath);
|
DPRINT("'%S' exists\n", szLinkPath);
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscat (szLinkPath, L"\\");
|
wcscat(szLinkPath, L"\\");
|
||||||
wcscat (szLinkPath, lpItemName);
|
wcscat(szLinkPath, lpItemName);
|
||||||
wcscat (szLinkPath, L".lnk");
|
wcscat(szLinkPath, L".lnk");
|
||||||
DPRINT ("Link path: '%S'\n", szLinkPath);
|
DPRINT("Link path: '%S'\n", szLinkPath);
|
||||||
|
|
||||||
/* Split 'lpArguments' string into command and arguments */
|
/* Split 'lpArguments' string into command and arguments */
|
||||||
Ptr = wcschr (lpArguments, L' ');
|
Ptr = wcschr(lpArguments, L' ');
|
||||||
DPRINT ("Ptr %p lpArguments %p\n", Ptr, lpArguments);
|
DPRINT("Ptr %p lpArguments %p\n", Ptr, lpArguments);
|
||||||
if (Ptr != NULL)
|
if (Ptr != NULL)
|
||||||
{
|
{
|
||||||
dwLength = (DWORD)(Ptr - lpArguments);
|
dwLength = (DWORD)(Ptr - lpArguments);
|
||||||
DPRINT ("dwLength %lu\n", dwLength);
|
DPRINT("dwLength %lu\n", dwLength);
|
||||||
memcpy (szCommand, lpArguments, dwLength * sizeof(WCHAR));
|
memcpy(szCommand, lpArguments, dwLength * sizeof(WCHAR));
|
||||||
szCommand[dwLength] = 0;
|
szCommand[dwLength] = 0;
|
||||||
Ptr++;
|
Ptr++;
|
||||||
wcscpy (szArguments, Ptr);
|
wcscpy(szArguments, Ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscpy (szCommand, lpArguments);
|
wcscpy(szCommand, lpArguments);
|
||||||
szArguments[0] = 0;
|
szArguments[0] = 0;
|
||||||
}
|
}
|
||||||
DPRINT ("szCommand: '%S'\n", szCommand);
|
DPRINT("szCommand: '%S'\n", szCommand);
|
||||||
DPRINT ("szArguments: '%S'\n", szArguments);
|
DPRINT("szArguments: '%S'\n", szArguments);
|
||||||
|
|
||||||
/* Dynamically load ole32.dll */
|
/* Dynamically load ole32.dll */
|
||||||
if (!LoadDynamicImports(&DynOle32, &Ole32))
|
if (!LoadDynamicImports(&DynOle32, &Ole32))
|
||||||
|
@ -789,14 +801,15 @@ AddItemW (LPCWSTR lpGroupName, /* Optional */
|
||||||
Ole32.fn.CoUninitialize();
|
Ole32.fn.CoUninitialize();
|
||||||
UnloadDynamicImports(&Ole32);
|
UnloadDynamicImports(&Ole32);
|
||||||
|
|
||||||
DPRINT ("AddItemW() done\n");
|
DPRINT("AddItemW() done\n");
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteItemA (LPCSTR lpGroupName, /* Optional */
|
WINAPI
|
||||||
|
DeleteItemA(LPCSTR lpGroupName, /* Optional */
|
||||||
BOOL bCommonGroup,
|
BOOL bCommonGroup,
|
||||||
LPCSTR lpItemName,
|
LPCSTR lpItemName,
|
||||||
BOOL bDeleteGroup)
|
BOOL bDeleteGroup)
|
||||||
|
@ -842,8 +855,9 @@ DeleteItemA (LPCSTR lpGroupName, /* Optional */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DeleteItemW (LPCWSTR lpGroupName, /* Optional */
|
WINAPI
|
||||||
|
DeleteItemW(LPCWSTR lpGroupName, /* Optional */
|
||||||
BOOL bCommonGroup,
|
BOOL bCommonGroup,
|
||||||
LPCWSTR lpItemName,
|
LPCWSTR lpItemName,
|
||||||
BOOL bDeleteGroup)
|
BOOL bDeleteGroup)
|
||||||
|
@ -851,46 +865,46 @@ DeleteItemW (LPCWSTR lpGroupName, /* Optional */
|
||||||
WCHAR szItemPath[MAX_PATH];
|
WCHAR szItemPath[MAX_PATH];
|
||||||
LPWSTR Ptr;
|
LPWSTR Ptr;
|
||||||
|
|
||||||
DPRINT ("DeleteItemW() called\n");
|
DPRINT("DeleteItemW() called\n");
|
||||||
|
|
||||||
if (!GetProgramsPath (bCommonGroup, szItemPath))
|
if (!GetProgramsPath(bCommonGroup, szItemPath))
|
||||||
{
|
{
|
||||||
DPRINT1 ("GetProgramsPath() failed\n");
|
DPRINT1("GetProgramsPath() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DPRINT ("Programs path: '%S'\n", szItemPath);
|
DPRINT("Programs path: '%S'\n", szItemPath);
|
||||||
|
|
||||||
if (lpGroupName != NULL && *lpGroupName != 0)
|
if (lpGroupName != NULL && *lpGroupName != 0)
|
||||||
{
|
{
|
||||||
wcscat (szItemPath, L"\\");
|
wcscat(szItemPath, L"\\");
|
||||||
wcscat (szItemPath, lpGroupName);
|
wcscat(szItemPath, lpGroupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscat (szItemPath, L"\\");
|
wcscat(szItemPath, L"\\");
|
||||||
wcscat (szItemPath, lpItemName);
|
wcscat(szItemPath, lpItemName);
|
||||||
wcscat (szItemPath, L".lnk");
|
wcscat(szItemPath, L".lnk");
|
||||||
DPRINT ("Item path: '%S'\n", szItemPath);
|
DPRINT("Item path: '%S'\n", szItemPath);
|
||||||
|
|
||||||
if (!DeleteFileW (szItemPath))
|
if (!DeleteFileW(szItemPath))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* FIXME: Notify the shell */
|
/* FIXME: Notify the shell */
|
||||||
|
|
||||||
if (bDeleteGroup)
|
if (bDeleteGroup)
|
||||||
{
|
{
|
||||||
Ptr = wcsrchr (szItemPath, L'\\');
|
Ptr = wcsrchr(szItemPath, L'\\');
|
||||||
if (Ptr == NULL)
|
if (Ptr == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
*Ptr = 0;
|
*Ptr = 0;
|
||||||
DPRINT ("Item path: '%S'\n", szItemPath);
|
DPRINT("Item path: '%S'\n", szItemPath);
|
||||||
if (RemoveDirectoryW (szItemPath))
|
if (RemoveDirectoryW(szItemPath))
|
||||||
{
|
{
|
||||||
/* FIXME: Notify the shell */
|
/* FIXME: Notify the shell */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("DeleteItemW() done\n");
|
DPRINT("DeleteItemW() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/directory.c
|
* FILE: dll/win32/userenv/directory.c
|
||||||
* PURPOSE: User profile code
|
* PURPOSE: User profile code
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
CopyProfileDirectoryA(LPCSTR lpSourcePath,
|
CopyProfileDirectoryA(LPCSTR lpSourcePath,
|
||||||
LPCSTR lpDestinationPath,
|
LPCSTR lpDestinationPath,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
|
@ -67,7 +68,8 @@ CopyProfileDirectoryA(LPCSTR lpSourcePath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
CopyProfileDirectoryW(LPCWSTR lpSourcePath,
|
CopyProfileDirectoryW(LPCWSTR lpSourcePath,
|
||||||
LPCWSTR lpDestinationPath,
|
LPCWSTR lpDestinationPath,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
|
@ -78,7 +80,7 @@ CopyProfileDirectoryW(LPCWSTR lpSourcePath,
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CopyDirectory (LPCWSTR lpDestinationPath,
|
CopyDirectory(LPCWSTR lpDestinationPath,
|
||||||
LPCWSTR lpSourcePath)
|
LPCWSTR lpSourcePath)
|
||||||
{
|
{
|
||||||
WCHAR szFileName[MAX_PATH];
|
WCHAR szFileName[MAX_PATH];
|
||||||
|
@ -89,110 +91,110 @@ CopyDirectory (LPCWSTR lpDestinationPath,
|
||||||
LPWSTR lpDstPtr;
|
LPWSTR lpDstPtr;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
|
|
||||||
DPRINT ("CopyDirectory (%S, %S) called\n",
|
DPRINT("CopyDirectory (%S, %S) called\n",
|
||||||
lpDestinationPath, lpSourcePath);
|
lpDestinationPath, lpSourcePath);
|
||||||
|
|
||||||
wcscpy (szFileName, lpSourcePath);
|
wcscpy(szFileName, lpSourcePath);
|
||||||
wcscat (szFileName, L"\\*.*");
|
wcscat(szFileName, L"\\*.*");
|
||||||
|
|
||||||
hFind = FindFirstFileW (szFileName,
|
hFind = FindFirstFileW(szFileName,
|
||||||
&FindFileData);
|
&FindFileData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy (szFullSrcName, lpSourcePath);
|
wcscpy(szFullSrcName, lpSourcePath);
|
||||||
lpSrcPtr = AppendBackslash (szFullSrcName);
|
lpSrcPtr = AppendBackslash(szFullSrcName);
|
||||||
|
|
||||||
wcscpy (szFullDstName, lpDestinationPath);
|
wcscpy(szFullDstName, lpDestinationPath);
|
||||||
lpDstPtr = AppendBackslash (szFullDstName);
|
lpDstPtr = AppendBackslash(szFullDstName);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (wcscmp (FindFileData.cFileName, L".") &&
|
if (wcscmp(FindFileData.cFileName, L".") &&
|
||||||
wcscmp (FindFileData.cFileName, L".."))
|
wcscmp(FindFileData.cFileName, L".."))
|
||||||
{
|
{
|
||||||
wcscpy (lpSrcPtr, FindFileData.cFileName);
|
wcscpy(lpSrcPtr, FindFileData.cFileName);
|
||||||
wcscpy (lpDstPtr, FindFileData.cFileName);
|
wcscpy(lpDstPtr, FindFileData.cFileName);
|
||||||
|
|
||||||
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
{
|
{
|
||||||
DPRINT ("Create directory: %S\n", szFullDstName);
|
DPRINT("Create directory: %S\n", szFullDstName);
|
||||||
if (!CreateDirectoryExW (szFullSrcName, szFullDstName, NULL))
|
if (!CreateDirectoryExW(szFullSrcName, szFullDstName, NULL))
|
||||||
{
|
{
|
||||||
if (GetLastError () != ERROR_ALREADY_EXISTS)
|
if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
|
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CopyDirectory (szFullDstName, szFullSrcName))
|
if (!CopyDirectory(szFullDstName, szFullSrcName))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
|
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT ("Copy file: %S -> %S\n", szFullSrcName, szFullDstName);
|
DPRINT("Copy file: %S -> %S\n", szFullSrcName, szFullDstName);
|
||||||
if (!CopyFileW (szFullSrcName, szFullDstName, FALSE))
|
if (!CopyFileW(szFullSrcName, szFullDstName, FALSE))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
|
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FindNextFileW (hFind, &FindFileData))
|
if (!FindNextFileW(hFind, &FindFileData))
|
||||||
{
|
{
|
||||||
if (GetLastError () != ERROR_NO_MORE_FILES)
|
if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
DPRINT ("CopyDirectory() done\n");
|
DPRINT("CopyDirectory() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CreateDirectoryPath (LPCWSTR lpPathName,
|
CreateDirectoryPath(LPCWSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||||
{
|
{
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
LPWSTR Ptr;
|
LPWSTR Ptr;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
DPRINT ("CreateDirectoryPath() called\n");
|
DPRINT("CreateDirectoryPath() called\n");
|
||||||
|
|
||||||
if (lpPathName == NULL || *lpPathName == 0)
|
if (lpPathName == NULL || *lpPathName == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (CreateDirectoryW (lpPathName,
|
if (CreateDirectoryW(lpPathName,
|
||||||
lpSecurityAttributes))
|
lpSecurityAttributes))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
dwError = GetLastError ();
|
dwError = GetLastError();
|
||||||
if (dwError == ERROR_ALREADY_EXISTS)
|
if (dwError == ERROR_ALREADY_EXISTS)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
wcscpy (szPath, lpPathName);
|
wcscpy(szPath, lpPathName);
|
||||||
|
|
||||||
if (wcslen(szPath) > 3 && szPath[1] == ':' && szPath[2] == '\\')
|
if (wcslen(szPath) > 3 && szPath[1] == ':' && szPath[2] == '\\')
|
||||||
{
|
{
|
||||||
|
@ -205,15 +207,15 @@ CreateDirectoryPath (LPCWSTR lpPathName,
|
||||||
|
|
||||||
while (Ptr != NULL)
|
while (Ptr != NULL)
|
||||||
{
|
{
|
||||||
Ptr = wcschr (Ptr, L'\\');
|
Ptr = wcschr(Ptr, L'\\');
|
||||||
if (Ptr != NULL)
|
if (Ptr != NULL)
|
||||||
*Ptr = 0;
|
*Ptr = 0;
|
||||||
|
|
||||||
DPRINT ("CreateDirectory(%S)\n", szPath);
|
DPRINT("CreateDirectory(%S)\n", szPath);
|
||||||
if (!CreateDirectoryW (szPath,
|
if (!CreateDirectoryW(szPath,
|
||||||
lpSecurityAttributes))
|
lpSecurityAttributes))
|
||||||
{
|
{
|
||||||
dwError = GetLastError ();
|
dwError = GetLastError();
|
||||||
if (dwError != ERROR_ALREADY_EXISTS)
|
if (dwError != ERROR_ALREADY_EXISTS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -225,25 +227,26 @@ CreateDirectoryPath (LPCWSTR lpPathName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("CreateDirectoryPath() done\n");
|
DPRINT("CreateDirectoryPath() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
RecursiveRemoveDir (LPCWSTR lpPath)
|
BOOL
|
||||||
|
RecursiveRemoveDir(LPCWSTR lpPath)
|
||||||
{
|
{
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
WIN32_FIND_DATAW FindData;
|
WIN32_FIND_DATAW FindData;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
wcscpy (szPath, lpPath);
|
wcscpy(szPath, lpPath);
|
||||||
wcscat (szPath, L"\\*.*");
|
wcscat(szPath, L"\\*.*");
|
||||||
DPRINT ("Search path: '%S'\n", szPath);
|
DPRINT("Search path: '%S'\n", szPath);
|
||||||
|
|
||||||
hFind = FindFirstFileW (szPath,
|
hFind = FindFirstFileW(szPath,
|
||||||
&FindData);
|
&FindData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -251,19 +254,19 @@ RecursiveRemoveDir (LPCWSTR lpPath)
|
||||||
bResult = TRUE;
|
bResult = TRUE;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if (wcscmp (FindData.cFileName, L".") &&
|
if (wcscmp(FindData.cFileName, L".") &&
|
||||||
wcscmp (FindData.cFileName, L".."))
|
wcscmp(FindData.cFileName, L".."))
|
||||||
{
|
{
|
||||||
wcscpy (szPath, lpPath);
|
wcscpy(szPath, lpPath);
|
||||||
wcscat (szPath, L"\\");
|
wcscat(szPath, L"\\");
|
||||||
wcscat (szPath, FindData.cFileName);
|
wcscat(szPath, FindData.cFileName);
|
||||||
DPRINT ("File name: '%S'\n", szPath);
|
DPRINT("File name: '%S'\n", szPath);
|
||||||
|
|
||||||
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
{
|
{
|
||||||
DPRINT ("Delete directory: '%S'\n", szPath);
|
DPRINT("Delete directory: '%S'\n", szPath);
|
||||||
|
|
||||||
if (!RecursiveRemoveDir (szPath))
|
if (!RecursiveRemoveDir(szPath))
|
||||||
{
|
{
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -271,11 +274,11 @@ RecursiveRemoveDir (LPCWSTR lpPath)
|
||||||
|
|
||||||
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
|
if (FindData.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
|
||||||
{
|
{
|
||||||
SetFileAttributesW (szPath,
|
SetFileAttributesW(szPath,
|
||||||
FindData.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
|
FindData.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RemoveDirectoryW (szPath))
|
if (!RemoveDirectoryW(szPath))
|
||||||
{
|
{
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -283,15 +286,15 @@ RecursiveRemoveDir (LPCWSTR lpPath)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT ("Delete file: '%S'\n", szPath);
|
DPRINT("Delete file: '%S'\n", szPath);
|
||||||
|
|
||||||
if (FindData.dwFileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
if (FindData.dwFileAttributes & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
||||||
{
|
{
|
||||||
SetFileAttributesW (szPath,
|
SetFileAttributesW(szPath,
|
||||||
FILE_ATTRIBUTE_NORMAL);
|
FILE_ATTRIBUTE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DeleteFileW (szPath))
|
if (!DeleteFileW(szPath))
|
||||||
{
|
{
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -299,11 +302,11 @@ RecursiveRemoveDir (LPCWSTR lpPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FindNextFileW (hFind, &FindData))
|
if (!FindNextFileW(hFind, &FindData))
|
||||||
{
|
{
|
||||||
if (GetLastError () != ERROR_NO_MORE_FILES)
|
if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
bResult = FALSE;
|
bResult = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -312,20 +315,20 @@ RecursiveRemoveDir (LPCWSTR lpPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FindClose (hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RemoveDirectoryPath (LPCWSTR lpPathName)
|
RemoveDirectoryPath(LPCWSTR lpPathName)
|
||||||
{
|
{
|
||||||
if (!RecursiveRemoveDir (lpPathName))
|
if (!RecursiveRemoveDir(lpPathName))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DPRINT ("Delete directory: '%S'\n", lpPathName);
|
DPRINT("Delete directory: '%S'\n", lpPathName);
|
||||||
return RemoveDirectoryW (lpPathName);
|
return RemoveDirectoryW(lpPathName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/environment.c
|
* FILE: dll/win32/userenv/environment.c
|
||||||
* PURPOSE: User environment functions
|
* PURPOSE: User environment functions
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +30,8 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
SetUserEnvironmentVariable(LPVOID *Environment,
|
SetUserEnvironmentVariable(LPVOID *Environment,
|
||||||
LPWSTR lpName,
|
LPWSTR lpName,
|
||||||
LPWSTR lpValue,
|
LPWSTR lpValue,
|
||||||
|
@ -117,7 +118,8 @@ SetUserEnvironmentVariable(LPVOID *Environment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
AppendUserEnvironmentVariable(LPVOID *Environment,
|
AppendUserEnvironmentVariable(LPVOID *Environment,
|
||||||
LPWSTR lpName,
|
LPWSTR lpName,
|
||||||
LPWSTR lpValue)
|
LPWSTR lpValue)
|
||||||
|
@ -165,7 +167,8 @@ AppendUserEnvironmentVariable(LPVOID *Environment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HKEY
|
static
|
||||||
|
HKEY
|
||||||
GetCurrentUserKey(HANDLE hToken)
|
GetCurrentUserKey(HANDLE hToken)
|
||||||
{
|
{
|
||||||
UNICODE_STRING SidString;
|
UNICODE_STRING SidString;
|
||||||
|
@ -198,7 +201,8 @@ GetCurrentUserKey(HANDLE hToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
SetUserEnvironment(LPVOID *lpEnvironment,
|
SetUserEnvironment(LPVOID *lpEnvironment,
|
||||||
HKEY hKey,
|
HKEY hKey,
|
||||||
LPWSTR lpSubKeyName)
|
LPWSTR lpSubKeyName)
|
||||||
|
@ -310,7 +314,8 @@ SetUserEnvironment(LPVOID *lpEnvironment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
CreateEnvironmentBlock(LPVOID *lpEnvironment,
|
CreateEnvironmentBlock(LPVOID *lpEnvironment,
|
||||||
HANDLE hToken,
|
HANDLE hToken,
|
||||||
BOOL bInherit)
|
BOOL bInherit)
|
||||||
|
@ -454,7 +459,8 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
DestroyEnvironmentBlock(LPVOID lpEnvironment)
|
DestroyEnvironmentBlock(LPVOID lpEnvironment)
|
||||||
{
|
{
|
||||||
DPRINT("DestroyEnvironmentBlock() called\n");
|
DPRINT("DestroyEnvironmentBlock() called\n");
|
||||||
|
@ -471,7 +477,8 @@ DestroyEnvironmentBlock(LPVOID lpEnvironment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
ExpandEnvironmentStringsForUserW(IN HANDLE hToken,
|
ExpandEnvironmentStringsForUserW(IN HANDLE hToken,
|
||||||
IN LPCWSTR lpSrc,
|
IN LPCWSTR lpSrc,
|
||||||
OUT LPWSTR lpDest,
|
OUT LPWSTR lpDest,
|
||||||
|
@ -522,7 +529,8 @@ ExpandEnvironmentStringsForUserW(IN HANDLE hToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
ExpandEnvironmentStringsForUserA(IN HANDLE hToken,
|
ExpandEnvironmentStringsForUserA(IN HANDLE hToken,
|
||||||
IN LPCSTR lpSrc,
|
IN LPCSTR lpSrc,
|
||||||
OUT LPSTR lpDest,
|
OUT LPSTR lpDest,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/gpolicy.c
|
* FILE: dll/win32/userenv/gpolicy.c
|
||||||
* PURPOSE: Group policy functions
|
* PURPOSE: Group policy functions
|
||||||
* PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
|
* PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +110,8 @@ UninitializeGPNotifications(VOID)
|
||||||
DeleteCriticalSection(&GPNotifyLock);
|
DeleteCriticalSection(&GPNotifyLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static
|
||||||
|
VOID
|
||||||
NotifyGPEvents(IN BOOL bMachine)
|
NotifyGPEvents(IN BOOL bMachine)
|
||||||
{
|
{
|
||||||
PGP_NOTIFY Notify = NotificationList;
|
PGP_NOTIFY Notify = NotificationList;
|
||||||
|
@ -126,7 +127,9 @@ NotifyGPEvents(IN BOOL bMachine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
static
|
||||||
|
DWORD
|
||||||
|
WINAPI
|
||||||
GPNotificationThreadProc(IN LPVOID lpParameter)
|
GPNotificationThreadProc(IN LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
HMODULE hModule;
|
HMODULE hModule;
|
||||||
|
@ -255,7 +258,8 @@ GPNotificationThreadProc(IN LPVOID lpParameter)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE
|
static
|
||||||
|
HANDLE
|
||||||
CreateGPEvent(IN BOOL bMachine,
|
CreateGPEvent(IN BOOL bMachine,
|
||||||
IN PSECURITY_DESCRIPTOR lpSecurityDescriptor)
|
IN PSECURITY_DESCRIPTOR lpSecurityDescriptor)
|
||||||
{
|
{
|
||||||
|
@ -274,7 +278,8 @@ CreateGPEvent(IN BOOL bMachine,
|
||||||
return hEvent;
|
return hEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
RegisterGPNotification(IN HANDLE hEvent,
|
RegisterGPNotification(IN HANDLE hEvent,
|
||||||
IN BOOL bMachine)
|
IN BOOL bMachine)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +383,8 @@ Cleanup:
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
UnregisterGPNotification(IN HANDLE hEvent)
|
UnregisterGPNotification(IN HANDLE hEvent)
|
||||||
{
|
{
|
||||||
PGP_NOTIFY Notify = NULL, *NotifyLink;
|
PGP_NOTIFY Notify = NULL, *NotifyLink;
|
||||||
|
@ -418,7 +424,8 @@ UnregisterGPNotification(IN HANDLE hEvent)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
RefreshPolicy(IN BOOL bMachine)
|
RefreshPolicy(IN BOOL bMachine)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
@ -437,7 +444,8 @@ RefreshPolicy(IN BOOL bMachine)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
RefreshPolicyEx(IN BOOL bMachine,
|
RefreshPolicyEx(IN BOOL bMachine,
|
||||||
IN DWORD dwOptions)
|
IN DWORD dwOptions)
|
||||||
{
|
{
|
||||||
|
@ -470,7 +478,8 @@ RefreshPolicyEx(IN BOOL bMachine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE WINAPI
|
HANDLE
|
||||||
|
WINAPI
|
||||||
EnterCriticalPolicySection(IN BOOL bMachine)
|
EnterCriticalPolicySection(IN BOOL bMachine)
|
||||||
{
|
{
|
||||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
SECURITY_ATTRIBUTES SecurityAttributes;
|
||||||
|
@ -507,7 +516,8 @@ EnterCriticalPolicySection(IN BOOL bMachine)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
LeaveCriticalPolicySection(IN HANDLE hSection)
|
LeaveCriticalPolicySection(IN HANDLE hSection)
|
||||||
{
|
{
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
|
@ -524,7 +534,8 @@ LeaveCriticalPolicySection(IN HANDLE hSection)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
WaitForUserPolicyForegroundProcessing(VOID)
|
WaitForUserPolicyForegroundProcessing(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
@ -543,7 +554,8 @@ WaitForUserPolicyForegroundProcessing(VOID)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
|
WINAPI
|
||||||
WaitForMachinePolicyForegroundProcessing(VOID)
|
WaitForMachinePolicyForegroundProcessing(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/internal.h
|
* FILE: dll/win32/userenv/internal.h
|
||||||
* PURPOSE: internal stuff
|
* PURPOSE: internal stuff
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -29,15 +29,15 @@
|
||||||
|
|
||||||
/* directory.c */
|
/* directory.c */
|
||||||
BOOL
|
BOOL
|
||||||
CopyDirectory (LPCWSTR lpDestinationPath,
|
CopyDirectory(LPCWSTR lpDestinationPath,
|
||||||
LPCWSTR lpSourcePath);
|
LPCWSTR lpSourcePath);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CreateDirectoryPath (LPCWSTR lpPathName,
|
CreateDirectoryPath(LPCWSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes);
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RemoveDirectoryPath (LPCWSTR lpPathName);
|
RemoveDirectoryPath(LPCWSTR lpPathName);
|
||||||
|
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
typedef struct _DYN_FUNCS
|
typedef struct _DYN_FUNCS
|
||||||
|
@ -64,16 +64,17 @@ typedef struct _DYN_MODULE
|
||||||
extern DYN_MODULE DynOle32;
|
extern DYN_MODULE DynOle32;
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs);
|
LoadDynamicImports(PDYN_MODULE Module,
|
||||||
|
PDYN_FUNCS DynFuncs);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
UnloadDynamicImports(PDYN_FUNCS DynFuncs);
|
UnloadDynamicImports(PDYN_FUNCS DynFuncs);
|
||||||
|
|
||||||
LPWSTR
|
LPWSTR
|
||||||
AppendBackslash (LPWSTR String);
|
AppendBackslash(LPWSTR String);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
GetUserSidFromToken (HANDLE hToken,
|
GetUserSidFromToken(HANDLE hToken,
|
||||||
PUNICODE_STRING SidString);
|
PUNICODE_STRING SidString);
|
||||||
|
|
||||||
PSECURITY_DESCRIPTOR
|
PSECURITY_DESCRIPTOR
|
||||||
|
@ -81,12 +82,12 @@ CreateDefaultSecurityDescriptor(VOID);
|
||||||
|
|
||||||
/* profile.c */
|
/* profile.c */
|
||||||
BOOL
|
BOOL
|
||||||
AppendSystemPostfix (LPWSTR lpName,
|
AppendSystemPostfix(LPWSTR lpName,
|
||||||
DWORD dwMaxLength);
|
DWORD dwMaxLength);
|
||||||
|
|
||||||
/* registry.c */
|
/* registry.c */
|
||||||
BOOL
|
BOOL
|
||||||
CreateUserHive (LPCWSTR lpKeyName,
|
CreateUserHive(LPCWSTR lpKeyName,
|
||||||
LPCWSTR lpProfilePath);
|
LPCWSTR lpProfilePath);
|
||||||
|
|
||||||
/* setup.c */
|
/* setup.c */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/misc.c
|
* FILE: dll/win32/userenv/misc.c
|
||||||
* PURPOSE: User profile code
|
* PURPOSE: User profile code
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -35,11 +35,11 @@ static SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY};
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
LPWSTR
|
LPWSTR
|
||||||
AppendBackslash (LPWSTR String)
|
AppendBackslash(LPWSTR String)
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
|
||||||
Length = lstrlenW (String);
|
Length = lstrlenW(String);
|
||||||
if (String[Length - 1] != L'\\')
|
if (String[Length - 1] != L'\\')
|
||||||
{
|
{
|
||||||
String[Length] = L'\\';
|
String[Length] = L'\\';
|
||||||
|
@ -52,7 +52,7 @@ AppendBackslash (LPWSTR String)
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
GetUserSidFromToken (HANDLE hToken,
|
GetUserSidFromToken(HANDLE hToken,
|
||||||
PUNICODE_STRING SidString)
|
PUNICODE_STRING SidString)
|
||||||
{
|
{
|
||||||
PSID_AND_ATTRIBUTES SidBuffer, nsb;
|
PSID_AND_ATTRIBUTES SidBuffer, nsb;
|
||||||
|
@ -60,19 +60,19 @@ GetUserSidFromToken (HANDLE hToken,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Length = 256;
|
Length = 256;
|
||||||
SidBuffer = LocalAlloc (LMEM_FIXED,
|
SidBuffer = LocalAlloc(LMEM_FIXED,
|
||||||
Length);
|
Length);
|
||||||
if (SidBuffer == NULL)
|
if (SidBuffer == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Status = NtQueryInformationToken (hToken,
|
Status = NtQueryInformationToken(hToken,
|
||||||
TokenUser,
|
TokenUser,
|
||||||
(PVOID)SidBuffer,
|
(PVOID)SidBuffer,
|
||||||
Length,
|
Length,
|
||||||
&Length);
|
&Length);
|
||||||
if (Status == STATUS_BUFFER_TOO_SMALL)
|
if (Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
nsb = LocalReAlloc (SidBuffer,
|
nsb = LocalReAlloc(SidBuffer,
|
||||||
Length,
|
Length,
|
||||||
LMEM_MOVEABLE);
|
LMEM_MOVEABLE);
|
||||||
if (nsb == NULL)
|
if (nsb == NULL)
|
||||||
|
@ -82,7 +82,7 @@ GetUserSidFromToken (HANDLE hToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
SidBuffer = nsb;
|
SidBuffer = nsb;
|
||||||
Status = NtQueryInformationToken (hToken,
|
Status = NtQueryInformationToken(hToken,
|
||||||
TokenUser,
|
TokenUser,
|
||||||
(PVOID)SidBuffer,
|
(PVOID)SidBuffer,
|
||||||
Length,
|
Length,
|
||||||
|
@ -91,28 +91,28 @@ GetUserSidFromToken (HANDLE hToken,
|
||||||
|
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
LocalFree ((HLOCAL)SidBuffer);
|
LocalFree((HLOCAL)SidBuffer);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("SidLength: %lu\n", RtlLengthSid (SidBuffer[0].Sid));
|
DPRINT("SidLength: %lu\n", RtlLengthSid (SidBuffer[0].Sid));
|
||||||
|
|
||||||
Status = RtlConvertSidToUnicodeString (SidString,
|
Status = RtlConvertSidToUnicodeString(SidString,
|
||||||
SidBuffer[0].Sid,
|
SidBuffer[0].Sid,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
LocalFree ((HLOCAL)SidBuffer);
|
LocalFree((HLOCAL)SidBuffer);
|
||||||
|
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("SidString.Length: %lu\n", SidString->Length);
|
DPRINT("SidString.Length: %lu\n", SidString->Length);
|
||||||
DPRINT ("SidString.MaximumLength: %lu\n", SidString->MaximumLength);
|
DPRINT("SidString.MaximumLength: %lu\n", SidString->MaximumLength);
|
||||||
DPRINT ("SidString: '%wZ'\n", SidString);
|
DPRINT("SidString: '%wZ'\n", SidString);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,8 @@ DYN_MODULE DynOle32 =
|
||||||
* has been created!
|
* has been created!
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs)
|
LoadDynamicImports(PDYN_MODULE Module,
|
||||||
|
PDYN_FUNCS DynFuncs)
|
||||||
{
|
{
|
||||||
LPSTR *fname;
|
LPSTR *fname;
|
||||||
PVOID *fn;
|
PVOID *fn;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/profile.c
|
* FILE: dll/win32/userenv/profile.c
|
||||||
* PURPOSE: User profile code
|
* PURPOSE: User profile code
|
||||||
* PROGRAMMERS: Eric Kohl
|
* PROGRAMMERS: Eric Kohl
|
||||||
* Hervé Poussineau
|
* Hervé Poussineau
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/registry.c
|
* FILE: dll/win32/userenv/registry.c
|
||||||
* PURPOSE: User profile code
|
* PURPOSE: User profile code
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -32,8 +32,9 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
CopyKey (HKEY hDstKey,
|
BOOL
|
||||||
|
CopyKey(HKEY hDstKey,
|
||||||
HKEY hSrcKey)
|
HKEY hSrcKey)
|
||||||
{
|
{
|
||||||
LONG Error;
|
LONG Error;
|
||||||
|
@ -70,7 +71,7 @@ CopyKey (HKEY hDstKey,
|
||||||
|
|
||||||
DPRINT ("CopyKey() called \n");
|
DPRINT ("CopyKey() called \n");
|
||||||
|
|
||||||
Error = RegQueryInfoKey (hSrcKey,
|
Error = RegQueryInfoKey(hSrcKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -84,21 +85,21 @@ CopyKey (HKEY hDstKey,
|
||||||
NULL);
|
NULL);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("RegQueryInfoKey() failed (Error %lu)\n", Error);
|
DPRINT1("RegQueryInfoKey() failed (Error %lu)\n", Error);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("dwSubKeys %lu\n", dwSubKeys);
|
DPRINT("dwSubKeys %lu\n", dwSubKeys);
|
||||||
DPRINT ("dwMaxSubKeyNameLength %lu\n", dwMaxSubKeyNameLength);
|
DPRINT("dwMaxSubKeyNameLength %lu\n", dwMaxSubKeyNameLength);
|
||||||
DPRINT ("dwValues %lu\n", dwValues);
|
DPRINT("dwValues %lu\n", dwValues);
|
||||||
DPRINT ("dwMaxValueNameLength %lu\n", dwMaxValueNameLength);
|
DPRINT("dwMaxValueNameLength %lu\n", dwMaxValueNameLength);
|
||||||
DPRINT ("dwMaxValueLength %lu\n", dwMaxValueLength);
|
DPRINT("dwMaxValueLength %lu\n", dwMaxValueLength);
|
||||||
|
|
||||||
/* Copy subkeys */
|
/* Copy subkeys */
|
||||||
if (dwSubKeys != 0)
|
if (dwSubKeys != 0)
|
||||||
{
|
{
|
||||||
lpNameBuffer = HeapAlloc (GetProcessHeap (),
|
lpNameBuffer = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
dwMaxSubKeyNameLength * sizeof(WCHAR));
|
dwMaxSubKeyNameLength * sizeof(WCHAR));
|
||||||
if (lpNameBuffer == NULL)
|
if (lpNameBuffer == NULL)
|
||||||
|
@ -111,7 +112,7 @@ CopyKey (HKEY hDstKey,
|
||||||
for (i = 0; i < dwSubKeys; i++)
|
for (i = 0; i < dwSubKeys; i++)
|
||||||
{
|
{
|
||||||
dwSubKeyNameLength = dwMaxSubKeyNameLength;
|
dwSubKeyNameLength = dwMaxSubKeyNameLength;
|
||||||
Error = RegEnumKeyExW (hSrcKey,
|
Error = RegEnumKeyExW(hSrcKey,
|
||||||
i,
|
i,
|
||||||
lpNameBuffer,
|
lpNameBuffer,
|
||||||
&dwSubKeyNameLength,
|
&dwSubKeyNameLength,
|
||||||
|
@ -121,15 +122,15 @@ CopyKey (HKEY hDstKey,
|
||||||
&LastWrite);
|
&LastWrite);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Subkey enumeration failed (Error %lu)\n", Error);
|
DPRINT1("Subkey enumeration failed (Error %lu)\n", Error);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = RegCreateKeyExW (hDstKey,
|
Error = RegCreateKeyExW(hDstKey,
|
||||||
lpNameBuffer,
|
lpNameBuffer,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -140,47 +141,47 @@ CopyKey (HKEY hDstKey,
|
||||||
&dwDisposition);
|
&dwDisposition);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Subkey creation failed (Error %lu)\n", Error);
|
DPRINT1("Subkey creation failed (Error %lu)\n", Error);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = RegOpenKeyExW (hSrcKey,
|
Error = RegOpenKeyExW(hSrcKey,
|
||||||
lpNameBuffer,
|
lpNameBuffer,
|
||||||
0,
|
0,
|
||||||
KEY_READ,
|
KEY_READ,
|
||||||
&hSrcSubKey);
|
&hSrcSubKey);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", Error);
|
DPRINT1("Error: %lu\n", Error);
|
||||||
RegCloseKey (hDstSubKey);
|
RegCloseKey(hDstSubKey);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CopyKey (hDstSubKey,
|
if (!CopyKey(hDstSubKey,
|
||||||
hSrcSubKey))
|
hSrcSubKey))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Error: %lu\n", GetLastError());
|
DPRINT1("Error: %lu\n", GetLastError());
|
||||||
RegCloseKey (hSrcSubKey);
|
RegCloseKey (hSrcSubKey);
|
||||||
RegCloseKey (hDstSubKey);
|
RegCloseKey (hDstSubKey);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey (hSrcSubKey);
|
RegCloseKey(hSrcSubKey);
|
||||||
RegCloseKey (hDstSubKey);
|
RegCloseKey(hDstSubKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
}
|
}
|
||||||
|
@ -188,23 +189,23 @@ CopyKey (HKEY hDstKey,
|
||||||
/* Copy values */
|
/* Copy values */
|
||||||
if (dwValues != 0)
|
if (dwValues != 0)
|
||||||
{
|
{
|
||||||
lpNameBuffer = HeapAlloc (GetProcessHeap (),
|
lpNameBuffer = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
dwMaxValueNameLength * sizeof(WCHAR));
|
dwMaxValueNameLength * sizeof(WCHAR));
|
||||||
if (lpNameBuffer == NULL)
|
if (lpNameBuffer == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Buffer allocation failed\n");
|
DPRINT1("Buffer allocation failed\n");
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
lpDataBuffer = HeapAlloc (GetProcessHeap (),
|
lpDataBuffer = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
dwMaxValueLength);
|
dwMaxValueLength);
|
||||||
if (lpDataBuffer == NULL)
|
if (lpDataBuffer == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Buffer allocation failed\n");
|
DPRINT1("Buffer allocation failed\n");
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
@ -215,7 +216,7 @@ CopyKey (HKEY hDstKey,
|
||||||
{
|
{
|
||||||
dwValueNameLength = dwMaxValueNameLength;
|
dwValueNameLength = dwMaxValueNameLength;
|
||||||
dwValueLength = dwMaxValueLength;
|
dwValueLength = dwMaxValueLength;
|
||||||
Error = RegEnumValueW (hSrcKey,
|
Error = RegEnumValueW(hSrcKey,
|
||||||
i,
|
i,
|
||||||
lpNameBuffer,
|
lpNameBuffer,
|
||||||
&dwValueNameLength,
|
&dwValueNameLength,
|
||||||
|
@ -226,17 +227,17 @@ CopyKey (HKEY hDstKey,
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("Error: %lu\n", Error);
|
DPRINT1("Error: %lu\n", Error);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpDataBuffer);
|
lpDataBuffer);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = RegSetValueExW (hDstKey,
|
Error = RegSetValueExW(hDstKey,
|
||||||
lpNameBuffer,
|
lpNameBuffer,
|
||||||
0,
|
0,
|
||||||
dwType,
|
dwType,
|
||||||
|
@ -245,10 +246,10 @@ CopyKey (HKEY hDstKey,
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("Error: %lu\n", Error);
|
DPRINT1("Error: %lu\n", Error);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpDataBuffer);
|
lpDataBuffer);
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
SetLastError((DWORD)Error);
|
SetLastError((DWORD)Error);
|
||||||
|
@ -256,16 +257,16 @@ CopyKey (HKEY hDstKey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpDataBuffer);
|
lpDataBuffer);
|
||||||
|
|
||||||
HeapFree (GetProcessHeap (),
|
HeapFree(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
lpNameBuffer);
|
lpNameBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("CopyKey() done \n");
|
DPRINT("CopyKey() done \n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -273,7 +274,7 @@ CopyKey (HKEY hDstKey,
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CreateUserHive (LPCWSTR lpKeyName,
|
CreateUserHive(LPCWSTR lpKeyName,
|
||||||
LPCWSTR lpProfilePath)
|
LPCWSTR lpProfilePath)
|
||||||
{
|
{
|
||||||
HKEY hDefaultKey = NULL;
|
HKEY hDefaultKey = NULL;
|
||||||
|
@ -281,9 +282,9 @@ CreateUserHive (LPCWSTR lpKeyName,
|
||||||
LONG Error;
|
LONG Error;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
DPRINT ("CreateUserHive(%S) called\n", lpKeyName);
|
DPRINT("CreateUserHive(%S) called\n", lpKeyName);
|
||||||
|
|
||||||
Error = RegOpenKeyExW (HKEY_USERS,
|
Error = RegOpenKeyExW(HKEY_USERS,
|
||||||
L".Default",
|
L".Default",
|
||||||
0,
|
0,
|
||||||
KEY_READ,
|
KEY_READ,
|
||||||
|
@ -294,7 +295,7 @@ CreateUserHive (LPCWSTR lpKeyName,
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = RegOpenKeyExW (HKEY_USERS,
|
Error = RegOpenKeyExW(HKEY_USERS,
|
||||||
lpKeyName,
|
lpKeyName,
|
||||||
0,
|
0,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
|
@ -316,7 +317,7 @@ CreateUserHive (LPCWSTR lpKeyName,
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegFlushKey (hUserKey);
|
RegFlushKey(hUserKey);
|
||||||
Ret = TRUE;
|
Ret = TRUE;
|
||||||
|
|
||||||
Cleanup:
|
Cleanup:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/resource.h
|
* FILE: dll/win32/userenv/resource.h
|
||||||
* PURPOSE: Resource IDs
|
* PURPOSE: Resource IDs
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/setup.c
|
* FILE: dll/win32/userenv/setup.c
|
||||||
* PURPOSE: Profile setup functions
|
* PURPOSE: Profile setup functions
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/userenv/userenv.c
|
* FILE: dll/win32/userenv/userenv.c
|
||||||
* PURPOSE: DLL initialization code
|
* PURPOSE: DLL initialization code
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +31,9 @@
|
||||||
|
|
||||||
HINSTANCE hInstance = NULL;
|
HINSTANCE hInstance = NULL;
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL
|
||||||
DllMain (HINSTANCE hinstDLL,
|
WINAPI
|
||||||
|
DllMain(HINSTANCE hinstDLL,
|
||||||
DWORD fdwReason,
|
DWORD fdwReason,
|
||||||
LPVOID lpvReserved)
|
LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue