[USETUP]
[reactos.git] / reactos / base / setup / usetup / registry.c
index 7cd0672..493a17a 100644 (file)
 #define FLG_ADDREG_TYPE_MASK             (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
 #endif
 
+#ifdef _M_IX86
+#define Architecture L"x86"
+#elif defined(_M_AMD64)
+#define Architecture L"amd64"
+#elif defined(_M_IA64)
+#define Architecture L"ia64"
+#elif defined(_M_ARM)
+#define Architecture L"arm"
+#elif defined(_M_PPC)
+#define Architecture L"ppc"
+#endif
+
 #include <pshpack1.h>
 
 typedef struct _REG_DISK_MOUNT_INFO
@@ -306,7 +318,7 @@ do_reg_operation(HANDLE KeyHandle,
 
       if (Type == REG_DWORD)
         {
-          ULONG dw = Str ? wcstol (Str, NULL, 0) : 0;
+          ULONG dw = Str ? wcstoul (Str, NULL, 0) : 0;
 
           DPRINT("setting dword %wZ to %lx\n", ValueName, dw);
 
@@ -643,6 +655,11 @@ ImportRegistryFile(PWSTR Filename,
       DPRINT1("registry_callback() failed\n");
     }
 
+  if (!registry_callback (hInf, L"AddReg.NT" Architecture, FALSE))
+    {
+      DPRINT1("registry_callback() failed\n");
+    }
+
   InfCloseFile (hInf);
 
   return TRUE;
@@ -746,4 +763,38 @@ SetMountedDeviceValue(CHAR Letter, ULONG Signature, LARGE_INTEGER StartingOffset
   return TRUE;
 }
 
+
+VOID
+SetDefaultPagefile(WCHAR Drive)
+{
+    OBJECT_ATTRIBUTES ObjectAttributes;
+    UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
+    UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"PagingFiles");
+    WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
+    HANDLE KeyHandle;
+    NTSTATUS Status;
+
+    InitializeObjectAttributes(&ObjectAttributes,
+                               &KeyName,
+                               OBJ_CASE_INSENSITIVE,
+                               NULL,
+                               NULL);
+    Status = NtOpenKey(&KeyHandle,
+                       KEY_ALL_ACCESS,
+                       &ObjectAttributes);
+    if (!NT_SUCCESS(Status))
+        return;
+
+    ValueBuffer[0] = Drive;
+
+    NtSetValueKey(KeyHandle,
+                  &ValueName,
+                  0,
+                  REG_MULTI_SZ,
+                  (PVOID)&ValueBuffer,
+                  sizeof(ValueBuffer));
+
+    NtClose(KeyHandle);
+}
+
 /* EOF */