- Create common shell folder registry values in InitializeProfiles().
svn path=/trunk/; revision=11134
-/* $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
-/* $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
-/* $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
-/* $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
-/* $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
}
};
-/*
- 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;
- }
-
+ 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)
+ for (fname = Module->Functions; *fname != NULL; fname++)
{
- FreeLibrary(DynFuncs->hModule);
- DynFuncs->hModule = (HMODULE)0;
- return FALSE;
+ *fn = GetProcAddress(DynFuncs->hModule, *fname);
+ if (*fn == NULL)
+ {
+ FreeLibrary(DynFuncs->hModule);
+ DynFuncs->hModule = (HMODULE)0;
+
+ return FALSE;
+ }
+
+ fn++;
}
- 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 */
-/* $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
-/* $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
-/* $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
LPWSTR DirName;
} DIRDATA, *PDIRDATA;
+typedef struct _REGDATA
+{
+ LPWSTR ValueName;
+ LPWSTR ValueData;
+} REGDATA, *PREGDATA;
+
+
static DIRDATA
DefaultUserDirectories[] =
};
+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,...)
{
LPWSTR lpszPtr;
DWORD dwLength;
PDIRDATA lpDirData;
+ PREGDATA lpRegData;
HKEY hKey;
return FALSE;
}
+ RegCloseKey (hKey);
+
+
/* Create 'All Users' profile directory */
wcscpy (szProfilePath, szProfilesPath);
wcscat (szProfilePath, L"\\");
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");
-/* $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