mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 20:50:29 +00:00
- Set ALLUSERSPROFILE environment variable upon logon.
- Implement CreateGroup(). svn path=/trunk/; revision=9266
This commit is contained in:
parent
58fa3560b2
commit
346aa0cca2
5 changed files with 117 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: desktop.c,v 1.1 2004/04/29 14:41:26 ekohl Exp $
|
||||
/* $Id: desktop.c,v 1.2 2004/05/01 11:55:01 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -71,6 +71,60 @@ GetDesktopPath (BOOL bCommonPath,
|
|||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
GetProgramsPath (BOOL bCommonPath,
|
||||
LPWSTR lpProgramsPath)
|
||||
{
|
||||
WCHAR szPath[MAX_PATH];
|
||||
DWORD dwLength;
|
||||
DWORD dwType;
|
||||
HKEY hKey;
|
||||
|
||||
DPRINT ("GetProgramsPath() called\n");
|
||||
|
||||
if (RegOpenKeyExW (HKEY_CURRENT_USER,
|
||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&hKey))
|
||||
{
|
||||
DPRINT1 ("RegOpenKeyExW() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dwLength = MAX_PATH * sizeof(WCHAR);
|
||||
if (RegQueryValueExW (hKey,
|
||||
bCommonPath ? L"Common Programs" : L"Programs",
|
||||
0,
|
||||
&dwType,
|
||||
(LPBYTE)szPath,
|
||||
&dwLength))
|
||||
{
|
||||
DPRINT1 ("RegQueryValueExW() failed\n");
|
||||
RegCloseKey (hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RegCloseKey (hKey);
|
||||
|
||||
if (dwType == REG_EXPAND_SZ)
|
||||
{
|
||||
ExpandEnvironmentStringsW (szPath,
|
||||
lpProgramsPath,
|
||||
MAX_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy (lpProgramsPath,
|
||||
szPath);
|
||||
}
|
||||
|
||||
DPRINT ("GetProgramsPath() done\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
AddDesktopItemA (BOOL bCommonItem,
|
||||
LPCSTR lpItemName,
|
||||
|
@ -243,4 +297,47 @@ DeleteDesktopItemW (BOOL bCommonItem,
|
|||
return DeleteFile (szLinkPath);
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
CreateGroupA (LPCSTR lpGroupName,
|
||||
BOOL bCommonGroup)
|
||||
{
|
||||
DPRINT1 ("CreateGroupA() not implemented!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
CreateGroupW (LPCWSTR lpGroupName,
|
||||
BOOL bCommonGroup)
|
||||
{
|
||||
WCHAR szGroupPath[MAX_PATH];
|
||||
|
||||
DPRINT ("CreateGroupW() called\n");
|
||||
|
||||
if (lpGroupName == NULL || *lpGroupName == 0)
|
||||
return TRUE;
|
||||
|
||||
if (!GetProgramsPath (bCommonGroup, szGroupPath))
|
||||
{
|
||||
DPRINT1 ("GetProgramsPath() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
DPRINT ("Programs path: '%S'\n", szGroupPath);
|
||||
|
||||
wcscat (szGroupPath, L"\\");
|
||||
wcscat (szGroupPath, lpGroupName);
|
||||
DPRINT ("Group path: '%S'\n", szGroupPath);
|
||||
|
||||
/* FIXME: Create nested directories */
|
||||
if (!CreateDirectory (szGroupPath, NULL))
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: Notify the shell */
|
||||
|
||||
DPRINT ("CreateGroupW() done\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: environment.c,v 1.2 2004/03/24 16:00:01 ekohl Exp $
|
||||
/* $Id: environment.c,v 1.3 2004/05/01 11:55:01 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -270,6 +270,16 @@ CreateEnvironmentBlock (LPVOID *lpEnvironment,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set 'ALLUSERSPROFILE' variable */
|
||||
Length = MAX_PATH;
|
||||
if (GetAllUsersProfileDirectoryW (Buffer,
|
||||
&Length))
|
||||
{
|
||||
SetUserEnvironmentVariable (lpEnvironment,
|
||||
L"ALLUSERSPROFILE",
|
||||
Buffer);
|
||||
}
|
||||
|
||||
/* Set 'USERPROFILE' variable */
|
||||
Length = MAX_PATH;
|
||||
if (GetUserProfileDirectoryW (hToken,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
LIBRARY userenv.dll
|
||||
EXPORTS
|
||||
InitializeProfiles@0 @100 NONAME
|
||||
CreateGroupA@8 @101 NONAME
|
||||
CreateGroupW@8 @102 NONAME
|
||||
CreateUserProfileA@8 @109 NONAME
|
||||
CreateUserProfileW@8 @110 NONAME
|
||||
AddDesktopItemA@32 @113 NONAME
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
LIBRARY userenv.dll
|
||||
EXPORTS
|
||||
InitializeProfiles=InitializeProfiles@0 @100 NONAME
|
||||
CreateGroupA=CreateGroupA@8 @101 NONAME
|
||||
CreateGroupW=CreateGroupW@8 @102 NONAME
|
||||
CreateUserProfileA=CreateUserProfileA@8 @109 NONAME
|
||||
CreateUserProfileW=CreateUserProfileW@8 @110 NONAME
|
||||
AddDesktopItemA=AddDesktopItemA@32 @113 NONAME
|
||||
|
|
|
@ -44,6 +44,8 @@ BOOL WINAPI AddDesktopItemA (BOOL, LPCSTR, LPCSTR, LPCSTR, INT, LPCSTR, WORD, IN
|
|||
BOOL WINAPI AddDesktopItemW (BOOL, LPCWSTR, LPCWSTR, LPCWSTR, INT, LPCWSTR, WORD, INT);
|
||||
BOOL WINAPI DeleteDesktopItemA (BOOL, LPCSTR);
|
||||
BOOL WINAPI DeleteDesktopItemW (BOOL, LPCWSTR);
|
||||
BOOL WINAPI CreateGroupA (LPCSTR, BOOL);
|
||||
BOOL WINAPI CreateGroupW (LPCWSTR, BOOL);
|
||||
/* end private */
|
||||
BOOL WINAPI LoadUserProfileA (HANDLE, LPPROFILEINFOA);
|
||||
BOOL WINAPI LoadUserProfileW (HANDLE, LPPROFILEINFOW);
|
||||
|
@ -68,6 +70,7 @@ typedef LPPROFILEINFOW LPPROFILEINFO;
|
|||
#define CreateUserProfile CreateUserProfileW
|
||||
#define AddDesktopItem AddDesktopItemW
|
||||
#define DeleteDesktopItem DeleteDesktopItemW
|
||||
#define CreateGroup CreateGroupW
|
||||
/* end private */
|
||||
#define LoadUserProfile LoadUserProfileW
|
||||
#define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryW
|
||||
|
@ -81,6 +84,7 @@ typedef LPPROFILEINFOA LPPROFILEINFO;
|
|||
#define CreateUserProfile CreateUserProfileA
|
||||
#define AddDesktopItem AddDesktopItemA
|
||||
#define DeleteDesktopItem DeleteDesktopItemA
|
||||
#define CreateGroup CreateGroupA
|
||||
/* end private */
|
||||
#define LoadUserProfile LoadUserProfileA
|
||||
#define GetAllUsersProfileDirectory GetAllUsersProfileDirectoryA
|
||||
|
|
Loading…
Reference in a new issue