Allow to choose between 800x600x16 and 640x480x8 as default resolution in first stage...
authorMaarten Bosma <maarten@bosma.de>
Fri, 23 Dec 2005 18:03:12 +0000 (18:03 +0000)
committerMaarten Bosma <maarten@bosma.de>
Fri, 23 Dec 2005 18:03:12 +0000 (18:03 +0000)
svn path=/trunk/; revision=20313

reactos/bootdata/txtsetup.sif
reactos/subsys/system/usetup/settings.c

index 5a3169a..38d4edb 100644 (file)
@@ -66,9 +66,10 @@ hal.dll      = 2
 halmp.dll    = 2,hal.dll
 
 [Display]
-;<id> = <user friendly name>,<spare>,<service key name>
-vga = "VGA Display",,Vga
-vbe = "VESA Display",,VBE
+;<id> = <user friendly name>,<spare>,<service key name>,<hight>,<width>,<bpp>
+vga = "VGA Display (640x680x8)",,Vga,640,480,8
+vbe_lowres = "VESA Display (640x680x8)",,VBE,640,480,8
+vbe = "VESA Display (800x600x16)",,VBE,800,600,16
 
 [Map.Display]
 ;<id> = <pnp id string>
index 2832c1b..1cf1f27 100644 (file)
@@ -521,12 +521,14 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
       return FALSE;
     }
 
+  /* Enable the right driver */
   if (!InfGetDataField(Context, 3, &ServiceName))
     {
       DPRINT("InfGetDataField() failed\n");
       return FALSE;
     }
 
+  ASSERT(wcslen(ServiceName) < 10);
   DPRINT("Service name: %S\n", ServiceName);
 
   StartValue = 1;
@@ -536,13 +538,75 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
                                 REG_DWORD,
                                 &StartValue,
                                 sizeof(ULONG));
-  InfFreeContext(Context);
+
   if (!NT_SUCCESS(Status))
     {
       DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
       return FALSE;
     }
 
+  /* Set the resolution */
+  WCHAR RegPath [255];
+  swprintf(RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0", ServiceName);
+
+  PWCHAR Buffer;
+  if (!InfGetDataField(Context, 4, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  ULONG Width = wcstoul(Buffer, NULL, 10);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath, 
+                                L"DefaultSettings.XResolution",
+                                REG_DWORD,
+                                &Width,
+                                sizeof(ULONG));
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  
+  if (!InfGetDataField(Context, 5, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  ULONG Hight = wcstoul(Buffer, 0, 0);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath,
+                                L"DefaultSettings.YResolution",
+                                REG_DWORD,
+                                &Hight,
+                                sizeof(ULONG));
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  if (!InfGetDataField(Context, 6, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  ULONG Bpp = wcstoul(Buffer, 0, 0);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath,
+                                L"DefaultSettings.BitsPerPel",
+                                REG_DWORD,
+                                &Bpp,
+                                sizeof(ULONG));
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  InfFreeContext(Context);
+
   DPRINT("ProcessDisplayRegistry() done\n");
 
   return TRUE;