Don't use the required access rights for the object attributes.
[reactos.git] / reactos / subsys / system / usetup / usetup.c
index 2b168a1..9ee260c 100644 (file)
@@ -25,7 +25,7 @@
  *                  Casper S. Hornstrup (chorns@users.sourceforge.net)
  */
 
-#include "usetup.h"
+#include <usetup.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -45,7 +45,6 @@ typedef enum _PAGE_NUMBER
   DISPLAY_SETTINGS_PAGE,
   KEYBOARD_SETTINGS_PAGE,
   LAYOUT_SETTINGS_PAGE,
-  POINTER_SETTINGS_PAGE,
 
   SELECT_PARTITION_PAGE,
   CREATE_PARTITION_PAGE,
@@ -117,7 +116,6 @@ static PGENERIC_LIST ComputerList = NULL;
 static PGENERIC_LIST DisplayList = NULL;
 static PGENERIC_LIST KeyboardList = NULL;
 static PGENERIC_LIST LayoutList = NULL;
-static PGENERIC_LIST PointerList = NULL;
 
 
 /* FUNCTIONS ****************************************************************/
@@ -346,7 +344,7 @@ PopupError(PCHAR Text,
       coPos.Y++;
       coPos.X = xLeft + 2;
       WriteConsoleOutputCharacters(Status,
-                                  min(strlen(Status), Width - 4),
+                                  min(strlen(Status), (SIZE_T)Width - 4),
                                   coPos);
     }
 }
@@ -938,7 +936,7 @@ ScsiControllerPage(PINPUT_RECORD Ir)
 static PAGE_NUMBER
 DeviceSettingsPage(PINPUT_RECORD Ir)
 {
-  static ULONG Line = 17;
+  static ULONG Line = 16;
 
   /* Initialize the computer settings list */
   if (ComputerList == NULL)
@@ -992,42 +990,30 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
        }
     }
 
-  /* Initialize the pointer settings list */
-  if (PointerList == NULL)
-    {
-      PointerList = CreateMouseDriverList(SetupInf);
-      if (PointerList == NULL)
-       {
-         /* FIXME: report error */
-       }
-    }
-
   SetTextXY(6, 8, "The list below shows the current device settings.");
 
   SetTextXY(8, 11, "       Computer:");
   SetTextXY(8, 12, "        Display:");
   SetTextXY(8, 13, "       Keyboard:");
   SetTextXY(8, 14, "Keyboard layout:");
-  SetTextXY(8, 15, " Pointer device:");
 
-  SetTextXY(8, 17, "         Accept:");
+  SetTextXY(8, 16, "         Accept:");
 
   SetTextXY(25, 11, GetGenericListEntry(ComputerList)->Text);
   SetTextXY(25, 12, GetGenericListEntry(DisplayList)->Text);
   SetTextXY(25, 13, GetGenericListEntry(KeyboardList)->Text);
   SetTextXY(25, 14, GetGenericListEntry(LayoutList)->Text);
-  SetTextXY(25, 15, GetGenericListEntry(PointerList)->Text);
 
-  SetTextXY(25, 17, "Accept these device settings");
+  SetTextXY(25, 16, "Accept these device settings");
   InvertTextXY (24, Line, 48, 1);
 
 
-  SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
-  SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
-  SetTextXY(6, 22, "settings.");
+  SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys");
+  SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative");
+  SetTextXY(6, 21, "settings.");
 
-  SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
-  SetTextXY(6, 25, "and press ENTER.");
+  SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\"");
+  SetTextXY(6, 24, "and press ENTER.");
 
   SetStatusText("   ENTER = Continue   F3 = Quit");
 
@@ -1039,9 +1025,9 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
          (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
        {
          NormalTextXY (24, Line, 48, 1);
-         if (Line == 15)
-           Line = 17;
-         else if (Line == 17)
+         if (Line == 14)
+           Line = 16;
+         else if (Line == 16)
            Line = 11;
          else
            Line++;
@@ -1052,9 +1038,9 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
        {
          NormalTextXY (24, Line, 48, 1);
          if (Line == 11)
-           Line = 17;
-         else if (Line == 17)
-           Line = 15;
+           Line = 16;
+         else if (Line == 16)
+           Line = 14;
          else
            Line--;
          InvertTextXY (24, Line, 48, 1);
@@ -1076,9 +1062,7 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
            return KEYBOARD_SETTINGS_PAGE;
          else if (Line == 14)
            return LAYOUT_SETTINGS_PAGE;
-         else if (Line == 15)
-           return POINTER_SETTINGS_PAGE;
-         else if (Line == 17)
+         else if (Line == 16)
            return SELECT_PARTITION_PAGE;
        }
     }
@@ -1341,69 +1325,6 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
 }
 
 
-static PAGE_NUMBER
-PointerSettingsPage(PINPUT_RECORD Ir)
-{
-  SHORT xScreen;
-  SHORT yScreen;
-
-  SetTextXY(6, 8, "You want to change the pointing device to be installed.");
-
-  SetTextXY(8, 10, "\x07  Press the UP or DOWN key to select the desired pointing");
-  SetTextXY(8, 11, "    device. Then press ENTER.");
-
-  SetTextXY(8, 13, "\x07  Press the ESC key to return to the previous page without changing");
-  SetTextXY(8, 14, "   the pointing device.");
-
-  GetScreenSize(&xScreen, &yScreen);
-
-  DrawGenericList(PointerList,
-                 2,
-                 18,
-                 xScreen - 3,
-                 yScreen - 3);
-
-  SetStatusText("   ENTER = Continue   ESC = Cancel   F3 = Quit");
-
-  SaveGenericListState(PointerList);
-
-  while(TRUE)
-    {
-      ConInKey(Ir);
-
-      if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
-         (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
-       {
-         ScrollDownGenericList(PointerList);
-       }
-      else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
-         (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
-       {
-         ScrollUpGenericList(PointerList);
-       }
-      else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
-              (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
-       {
-         if (ConfirmQuit(Ir) == TRUE)
-           return QUIT_PAGE;
-         break;
-       }
-      else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
-              (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
-       {
-         RestoreGenericListState(PointerList);
-         return DEVICE_SETTINGS_PAGE;
-       }
-      else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
-       {
-         return DEVICE_SETTINGS_PAGE;
-       }
-    }
-
-  return DISPLAY_SETTINGS_PAGE;
-}
-
-
 static PAGE_NUMBER
 SelectPartitionPage(PINPUT_RECORD Ir)
 {
@@ -1524,7 +1445,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
 
          return SELECT_FILE_SYSTEM_PAGE;
        }
-      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'c') /* C */
+      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
        {
          if (PartitionList->CurrentPartition->Unpartitioned == FALSE)
            {
@@ -1540,7 +1461,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
 
          return CREATE_PARTITION_PAGE;
        }
-      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'd') /* D */
+      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
        {
          if (PartitionList->CurrentPartition->Unpartitioned == TRUE)
            {
@@ -1948,14 +1869,14 @@ DeletePartitionPage (PINPUT_RECORD Ir)
     }
 
 #if 0
-  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000ULL) /* 10 GB */
+  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
     {
       PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
       Unit = "GB";
     }
   else
 #endif
-  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000ULL) /* 10 MB */
+  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */
     {
       PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;
       Unit = "MB";
@@ -2050,7 +1971,7 @@ DeletePartitionPage (PINPUT_RECORD Ir)
        {
          return SELECT_PARTITION_PAGE;
        }
-      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'd') /* D */
+      else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
        {
          DeleteCurrentPartition (PartitionList);
 
@@ -2097,7 +2018,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
     }
 
   /* adjust partition size */
-  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000ULL) /* 10 GB */
+  if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
     {
       PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
       PartUnit = "GB";
@@ -2327,21 +2248,21 @@ FormatPartitionPage (PINPUT_RECORD Ir)
              switch (FileSystemList->CurrentFileSystem)
                {
                  case FsFat:
-                   if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200ULL * 1024ULL))
+                   if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200LL * 1024LL))
                      {
                        /* FAT12 CHS partition (disk is smaller than 4.1MB) */
                        PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12;
                      }
-                   else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024ULL * 255ULL * 63ULL * 512ULL))
+                   else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL))
                      {
                        /* Partition starts below the 8.4GB boundary ==> CHS partition */
 
-                       if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
+                       if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32LL * 1024LL * 1024LL))
                          {
                            /* FAT16 CHS partition (partiton size < 32MB) */
                            PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
                          }
-                       else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+                       else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
                          {
                            /* FAT16 CHS partition (partition size < 512MB) */
                            PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
@@ -2356,7 +2277,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
                      {
                        /* Partition starts above the 8.4GB boundary ==> LBA partition */
 
-                       if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+                       if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
                          {
                            /* FAT16 LBA partition (partition size < 512MB) */
                            PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
@@ -3320,24 +3241,6 @@ RegistryPage(PINPUT_RECORD Ir)
        }
     }
 
-  /* Update mouse registry settings */
-  SetStatusText("   Updating mouse registry settings...");
-  if (!ProcessMouseRegistry(SetupInf, PointerList))
-    {
-      PopupError("Setup failed to update mouse registry settings.",
-                "ENTER = Reboot computer");
-
-      while(TRUE)
-       {
-         ConInKey(Ir);
-
-         if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)       /* ENTER */
-           {
-             return QUIT_PAGE;
-           }
-       }
-    }
-
   SetStatusText("   Done...");
 
   return BOOT_LOADER_PAGE;
@@ -3636,13 +3539,6 @@ QuitPage(PINPUT_RECORD Ir)
       LayoutList = NULL;
     }
 
-  /* Destroy pointer device list */
-  if (PointerList != NULL)
-    {
-      DestroyGenericList(PointerList, TRUE);
-      PointerList = NULL;
-    }
-
   SetStatusText("   ENTER = Reboot computer");
 
   while(TRUE)
@@ -3705,13 +3601,12 @@ SignalInitEvent()
 {
   NTSTATUS Status;
   OBJECT_ATTRIBUTES ObjectAttributes;
-  UNICODE_STRING UnicodeString;
+  UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(L"\\ReactOSInitDone");
   HANDLE ReactOSInitEvent;
 
-  RtlRosInitUnicodeStringFromLiteral(&UnicodeString, L"\\ReactOSInitDone");
   InitializeObjectAttributes(&ObjectAttributes,
     &UnicodeString,
-    EVENT_ALL_ACCESS,
+    0,
     0,
     NULL);
   Status = NtOpenEvent(&ReactOSInitEvent,
@@ -3839,10 +3734,6 @@ NtProcessStartup(PPEB Peb)
            Page = LayoutSettingsPage(&Ir);
            break;
 
-         case POINTER_SETTINGS_PAGE:
-           Page = PointerSettingsPage(&Ir);
-           break;
-
          case SELECT_PARTITION_PAGE:
            Page = SelectPartitionPage(&Ir);
            break;