diff --git a/reactos/lib/userenv/desktop.c b/reactos/lib/userenv/desktop.c index 8d6288413b9..d8c2619c255 100644 --- a/reactos/lib/userenv/desktop.c +++ b/reactos/lib/userenv/desktop.c @@ -1,4 +1,22 @@ -/* $Id: desktop.c,v 1.10 2004/09/06 12:00:40 ekohl Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: desktop.c,v 1.11 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/directory.c b/reactos/lib/userenv/directory.c index c916736e78c..9436974e6d7 100644 --- a/reactos/lib/userenv/directory.c +++ b/reactos/lib/userenv/directory.c @@ -1,4 +1,22 @@ -/* $Id: directory.c,v 1.5 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: directory.c,v 1.6 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/environment.c b/reactos/lib/userenv/environment.c index f4dd3b24c88..4a6f0befb76 100644 --- a/reactos/lib/userenv/environment.c +++ b/reactos/lib/userenv/environment.c @@ -1,4 +1,22 @@ -/* $Id: environment.c,v 1.6 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: environment.c,v 1.7 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/internal.h b/reactos/lib/userenv/internal.h index f540e1922b6..296c213f3df 100644 --- a/reactos/lib/userenv/internal.h +++ b/reactos/lib/userenv/internal.h @@ -1,4 +1,22 @@ -/* $Id: internal.h,v 1.8 2004/07/12 10:33:04 weiden Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: internal.h,v 1.9 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/misc.c b/reactos/lib/userenv/misc.c index e4c6e9da356..89ff363b4cf 100644 --- a/reactos/lib/userenv/misc.c +++ b/reactos/lib/userenv/misc.c @@ -1,4 +1,22 @@ -/* $Id: misc.c,v 1.6 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: misc.c,v 1.7 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -101,53 +119,56 @@ DYN_MODULE DynOle32 = } }; -/* - Use this function to load functions from other modules. We cannot statically - link to e.g. ole32.dll because those dlls would get loaded on startup with - winlogon and they may try to register classes etc when not even a window station - has been created! -*/ +/* + * Use this function to load functions from other modules. We cannot statically + * link to e.g. ole32.dll because those dlls would get loaded on startup with + * winlogon and they may try to register classes etc when not even a window station + * has been created! + */ BOOL LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs) { LPSTR *fname; PVOID *fn; - + ZeroMemory(DynFuncs, sizeof(DYN_FUNCS)); - + DynFuncs->hModule = LoadLibraryW(Module->Library); - if(!DynFuncs->hModule) - { - return FALSE; - } - - fn = &DynFuncs->fn.foo; - - /* load the imports */ - for(fname = Module->Functions; *fname != NULL; fname++) - { - *fn = GetProcAddress(DynFuncs->hModule, *fname); - if(*fn == NULL) + if (!DynFuncs->hModule) { - FreeLibrary(DynFuncs->hModule); - DynFuncs->hModule = (HMODULE)0; return FALSE; } - fn++; - } - + + fn = &DynFuncs->fn.foo; + + /* load the imports */ + for (fname = Module->Functions; *fname != NULL; fname++) + { + *fn = GetProcAddress(DynFuncs->hModule, *fname); + if (*fn == NULL) + { + FreeLibrary(DynFuncs->hModule); + DynFuncs->hModule = (HMODULE)0; + + return FALSE; + } + + fn++; + } + return TRUE; } + VOID UnloadDynamicImports(PDYN_FUNCS DynFuncs) { - if(DynFuncs->hModule) - { - FreeLibrary(DynFuncs->hModule); - DynFuncs->hModule = (HMODULE)0; - } + if (DynFuncs->hModule) + { + FreeLibrary(DynFuncs->hModule); + DynFuncs->hModule = (HMODULE)0; + } } /* EOF */ diff --git a/reactos/lib/userenv/profile.c b/reactos/lib/userenv/profile.c index 4cbc8ff2738..6c82828ef31 100644 --- a/reactos/lib/userenv/profile.c +++ b/reactos/lib/userenv/profile.c @@ -1,4 +1,22 @@ -/* $Id: profile.c,v 1.12 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: profile.c,v 1.13 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/registry.c b/reactos/lib/userenv/registry.c index ca3ee56b192..25f312efeb3 100644 --- a/reactos/lib/userenv/registry.c +++ b/reactos/lib/userenv/registry.c @@ -1,4 +1,22 @@ -/* $Id: registry.c,v 1.5 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: registry.c,v 1.6 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries diff --git a/reactos/lib/userenv/setup.c b/reactos/lib/userenv/setup.c index 605745d93f2..7cb001a4a26 100644 --- a/reactos/lib/userenv/setup.c +++ b/reactos/lib/userenv/setup.c @@ -1,4 +1,22 @@ -/* $Id: setup.c,v 1.6 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: setup.c,v 1.7 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -16,6 +34,13 @@ typedef struct _DIRDATA LPWSTR DirName; } DIRDATA, *PDIRDATA; +typedef struct _REGDATA +{ + LPWSTR ValueName; + LPWSTR ValueData; +} REGDATA, *PREGDATA; + + static DIRDATA DefaultUserDirectories[] = @@ -52,6 +77,27 @@ AllUsersDirectories[] = }; +static REGDATA +CommonShellFolders[] = +{ + {L"Desktop", L"%ALLUSERSPROFILE%\\Desktop"}, + {L"Common AppData", L"%ALLUSERSPROFILE%\\Application Data"}, + {L"Common Programs", L"%ALLUSERSPROFILE%\\Start Menu\\Programs"}, + {L"Common Documents", L"%ALLUSERSPROFILE%\\Documents"}, + {L"Common Desktop", L"%ALLUSERSPROFILE%\\Desktop"}, + {L"Common Start Menu", L"%ALLUSERSPROFILE%\\Start Menu"}, + {L"CommonPictures", L"%ALLUSERSPROFILE%\\Documents\\My Pictures"}, + {L"CommonMusic", L"%ALLUSERSPROFILE%\\Documents\\My Music"}, + {L"CommonVideo", L"%ALLUSERSPROFILE%\\Documents\\My Videos"}, + {L"Common Favorites", L"%ALLUSERSPROFILE%\\Favorites"}, + {L"Common Startup", L"%ALLUSERSPROFILE%\\Start Menu\\Programs\\Startup"}, + {L"Common Administrative Tools", L"%ALLUSERSPROFILE%\\Start Menu\\Programs\\Administrative Tools"}, + {L"Common Templates", L"%ALLUSERSPROFILE%\\Templates"}, + {L"Personal", L"%ALLUSERSPROFILE%\\My Documents"}, + {NULL, NULL} +}; + + void DebugPrint(char* fmt,...) { @@ -75,6 +121,7 @@ InitializeProfiles (VOID) LPWSTR lpszPtr; DWORD dwLength; PDIRDATA lpDirData; + PREGDATA lpRegData; HKEY hKey; @@ -211,6 +258,9 @@ InitializeProfiles (VOID) return FALSE; } + RegCloseKey (hKey); + + /* Create 'All Users' profile directory */ wcscpy (szProfilePath, szProfilesPath); wcscat (szProfilePath, L"\\"); @@ -255,7 +305,46 @@ InitializeProfiles (VOID) lpDirData++; } - RegCloseKey (hKey); + /* Create common shell folder registry values */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", + 0, + KEY_ALL_ACCESS, + &hKey)) + { + DPRINT1("Error: %lu\n", GetLastError()); + return FALSE; + } + + lpRegData = &CommonShellFolders[0]; + while (lpRegData->ValueName != NULL) + { + if (!ExpandEnvironmentStringsW(lpRegData->ValueData, + szBuffer, + MAX_PATH)) + { + DPRINT1("Error: %lu\n", GetLastError()); + RegCloseKey(hKey); + return FALSE; + } + + dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); + if (RegSetValueExW(hKey, + lpRegData->ValueName, + 0, + REG_SZ, + (LPBYTE)szBuffer, + dwLength)) + { + DPRINT1("Error: %lu\n", GetLastError()); + RegCloseKey(hKey); + return FALSE; + } + + lpRegData++; + } + + RegCloseKey(hKey); DPRINT1("Success\n"); diff --git a/reactos/lib/userenv/userenv.c b/reactos/lib/userenv/userenv.c index 229b96e189c..8a74d607e10 100644 --- a/reactos/lib/userenv/userenv.c +++ b/reactos/lib/userenv/userenv.c @@ -1,4 +1,22 @@ -/* $Id: userenv.c,v 1.3 2004/08/15 19:02:40 chorns Exp $ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: userenv.c,v 1.4 2004/09/30 20:23:00 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries