Commit in reactos/lib/userenv on MAIN
En.rc+11.1 -> 1.2
resources.h+2-11.1 -> 1.2
setup.c+57-11.11 -> 1.12
+60-2
3 modified files
Create "Program Files" directory and store its location in the registry.
Not sure if this is the correct place to implement it, feel free to move
around.

reactos/lib/userenv
En.rc 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- En.rc	8 Oct 2004 11:52:30 -0000	1.1
+++ En.rc	13 Oct 2004 18:14:07 -0000	1.2
@@ -43,4 +43,5 @@
     IDS_CACHE          "Local Settings\\Temporary Internet Files"
     IDS_HISTORY        "Local Settings\\History"
     IDS_COOKIES        "Cookies"
+    IDS_PROGRAMFILES   "%SystemDrive%\\Program Files"
 END

reactos/lib/userenv
resources.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- resources.h	8 Oct 2004 11:52:30 -0000	1.1
+++ resources.h	13 Oct 2004 18:14:07 -0000	1.2
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: resources.h,v 1.1 2004/10/08 11:52:30 ekohl Exp $ 
+/* $Id: resources.h,v 1.2 2004/10/13 18:14:07 gvg Exp $ 
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -48,5 +48,6 @@
 #define IDS_CACHE          21
 #define IDS_HISTORY        22
 #define IDS_COOKIES        23
+#define IDS_PROGRAMFILES   24
 
 /* EOF */

reactos/lib/userenv
setup.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- setup.c	10 Oct 2004 18:28:05 -0000	1.11
+++ setup.c	13 Oct 2004 18:14:07 -0000	1.12
@@ -16,7 +16,7 @@
  *  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.11 2004/10/10 18:28:05 ekohl Exp $ 
+/* $Id: setup.c,v 1.12 2004/10/13 18:14:07 gvg Exp $ 
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -540,6 +540,62 @@
 
   RegCloseKey(hKey);
 
+  /* Load 'Program Files' location */
+  if (!LoadString(hInstance,
+		  IDS_PROGRAMFILES,
+		  szBuffer,
+		  MAX_PATH))
+    {
+      DPRINT1("Error: %lu\n", GetLastError());
+      return FALSE;
+    }
+
+  /* Expand it */
+  if (!ExpandEnvironmentStringsW (szBuffer,
+				  szProfilesPath,
+				  MAX_PATH))
+    {
+      DPRINT1("Error: %lu\n", GetLastError());
+      RegCloseKey (hKey);
+      return FALSE;
+    }
+
+  /* Store it */
+  if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
+		     L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
+		     0,
+		     KEY_ALL_ACCESS,
+		     &hKey))
+    {
+      DPRINT1("Error: %lu\n", GetLastError());
+      return FALSE;
+    }
+
+  dwLength = (wcslen (szProfilesPath) + 1) * sizeof(WCHAR);
+  if (RegSetValueExW (hKey,
+		      L"ProgramFilesDir",
+		      0,
+		      REG_SZ,
+		      (LPBYTE)szProfilesPath,
+		      dwLength))
+    {
+      DPRINT1("Error: %lu\n", GetLastError());
+      RegCloseKey (hKey);
+      return FALSE;
+    }
+
+  RegCloseKey (hKey);
+
+  /* Create directory */
+  if (!CreateDirectoryW (szProfilesPath, NULL))
+    {
+      if (GetLastError () != ERROR_ALREADY_EXISTS)
+	{
+	  DPRINT1("Error: %lu\n", GetLastError());
+	  return FALSE;
+	}
+    }
+
 
   DPRINT("Success\n");
 
CVSspam 0.2.8