Commit in reactos/lib/syssetup on ros-branch-0_2_3
install.c+60-11.12 -> 1.12.4.1
Create temp directory

reactos/lib/syssetup
install.c 1.12 -> 1.12.4.1
diff -u -r1.12 -r1.12.4.1
--- install.c	19 Apr 2004 10:54:23 -0000	1.12
+++ install.c	23 Jun 2004 16:44:26 -0000	1.12.4.1
@@ -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: install.c,v 1.12 2004/04/19 10:54:23 ekohl Exp $
+/* $Id: install.c,v 1.12.4.1 2004/06/23 16:44:26 gvg Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS system libraries
@@ -192,6 +192,62 @@
    return FALSE;
 }
 
+static VOID
+CreateTempDir(LPCWSTR VarName)
+{
+  WCHAR szTempDir[MAX_PATH];
+  WCHAR szBuffer[MAX_PATH];
+  DWORD dwLength;
+  HKEY hKey;
+
+  if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
+		     L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
+		     0,
+		     KEY_ALL_ACCESS,
+		     &hKey))
+    {
+      DebugPrint("Error: %lu\n", GetLastError());
+      return;
+    }
+
+  /* Get temp dir */
+  dwLength = MAX_PATH * sizeof(WCHAR);
+  if (RegQueryValueExW (hKey,
+			VarName,
+			NULL,
+			NULL,
+			(LPBYTE)szBuffer,
+			&dwLength))
+    {
+      DebugPrint("Error: %lu\n", GetLastError());
+      RegCloseKey (hKey);
+      return;
+    }
+
+  /* Expand it */
+  if (!ExpandEnvironmentStringsW (szBuffer,
+				  szTempDir,
+				  MAX_PATH))
+    {
+      DebugPrint("Error: %lu\n", GetLastError());
+      RegCloseKey (hKey);
+      return;
+    }
+
+  /* Create profiles directory */
+  if (!CreateDirectoryW (szTempDir, NULL))
+    {
+      if (GetLastError () != ERROR_ALREADY_EXISTS)
+	{
+	  DebugPrint("Error: %lu\n", GetLastError());
+	  RegCloseKey (hKey);
+	  return;
+	}
+    }
+
+  RegCloseKey (hKey);
+}
+
 DWORD STDCALL
 InstallReactOS (HINSTANCE hInstance)
 {
@@ -284,6 +340,9 @@
   RtlFreeSid (AdminSid);
   RtlFreeSid (DomainSid);
 
+  CreateTempDir(L"TEMP");
+  CreateTempDir(L"TMP");
+
 #if 1
   InstallWizard ();
 #endif
CVSspam 0.2.8