[USETUP] Remove the WIN32 support because usetup is a native-only application
authorEric Kohl <eric.kohl@reactos.org>
Tue, 15 May 2018 21:35:17 +0000 (23:35 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 15 May 2018 21:35:17 +0000 (23:35 +0200)
18 files changed:
base/setup/usetup/CMakeLists.txt
base/setup/usetup/bootsup.c
base/setup/usetup/console.c [moved from base/setup/usetup/native/utils/console.c with 99% similarity]
base/setup/usetup/console.h [moved from base/setup/usetup/native/utils/console.h with 96% similarity]
base/setup/usetup/consup.c
base/setup/usetup/filesup.c
base/setup/usetup/fslist.c
base/setup/usetup/inffile.c
base/setup/usetup/inffile.h
base/setup/usetup/keytrans.c [moved from base/setup/usetup/native/utils/keytrans.c with 99% similarity]
base/setup/usetup/keytrans.h [moved from base/setup/usetup/native/utils/keytrans.h with 94% similarity]
base/setup/usetup/native/console.c [deleted file]
base/setup/usetup/native/fslist.c [deleted file]
base/setup/usetup/native/host_native.h [deleted file]
base/setup/usetup/registry.c
base/setup/usetup/usetup.c
base/setup/usetup/usetup.h
base/setup/usetup/usetup.rc

index 8ca8471..8dff7a5 100644 (file)
@@ -8,14 +8,11 @@ include_directories(
     ${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
 
 list(APPEND SOURCE
-    native/utils/keytrans.c
-    native/utils/console.c
-    native/fslist.c
-    native/console.c
     bootsup.c
     cabinet.c
     chkdsk.c
     cmdcons.c
+    console.c
     consup.c
     devinst.c
     drivesup.c
@@ -26,6 +23,7 @@ list(APPEND SOURCE
     genlist.c
     inffile.c
     inicache.c
+    keytrans.c
     mui.c
     partlist.c
     progress.c
index f681829..75319fb 100644 (file)
@@ -2249,7 +2249,6 @@ InstallFatBootcodeToPartition(
     PUNICODE_STRING DestinationArcPath,
     UCHAR PartitionType)
 {
-#ifdef __REACTOS__
     NTSTATUS Status;
     BOOLEAN DoesFreeLdrExist;
     WCHAR SrcPath[MAX_PATH];
@@ -2494,9 +2493,6 @@ InstallFatBootcodeToPartition(
     }
 
     return STATUS_SUCCESS;
-#else
-    return STATUS_NOT_IMPLEMENTED;
-#endif
 }
 
 static
@@ -2507,7 +2503,6 @@ InstallExt2BootcodeToPartition(
     PUNICODE_STRING DestinationArcPath,
     UCHAR PartitionType)
 {
-#ifdef __REACTOS__
     NTSTATUS Status;
     BOOLEAN DoesFreeLdrExist;
     WCHAR SrcPath[MAX_PATH];
@@ -2613,9 +2608,6 @@ InstallExt2BootcodeToPartition(
     }
 
     return STATUS_SUCCESS;
-#else
-    return STATUS_NOT_IMPLEMENTED;
-#endif
 }
 
 
@@ -2666,7 +2658,6 @@ InstallFatBootcodeToFloppy(
     PUNICODE_STRING SourceRootPath,
     PUNICODE_STRING DestinationArcPath)
 {
-#ifdef __REACTOS__
     NTSTATUS Status;
     UNICODE_STRING FloppyDevice = RTL_CONSTANT_STRING(L"\\Device\\Floppy0");
     WCHAR SrcPath[MAX_PATH];
@@ -2725,9 +2716,6 @@ InstallFatBootcodeToFloppy(
     }
 
     return STATUS_SUCCESS;
-#else
-    return STATUS_NOT_IMPLEMENTED;
-#endif
 }
 
 /* EOF */
similarity index 99%
rename from base/setup/usetup/native/utils/console.c
rename to base/setup/usetup/console.c
index 2ab380a..858e834 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            base/setup/usetup/native/utils/console.c
+ * FILE:            base/setup/usetup/console.c
  * PURPOSE:         Console support functions
  * PROGRAMMER:      Eric Kohl
  */
similarity index 96%
rename from base/setup/usetup/native/utils/console.h
rename to base/setup/usetup/console.h
index 567d657..8578afc 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            base/setup/usetup/native/utils/console.h
+ * FILE:            base/setup/usetup/console.h
  * PURPOSE:         Console support functions
  * PROGRAMMER:      Eric Kohl
  */
@@ -124,7 +124,6 @@ WriteConsoleOutputCharacterW(
 BOOL
 WINAPI
 SetConsoleOutputCP(
-    IN UINT wCodePageID
-);
+    IN UINT wCodePageID);
 
 /* EOF */
index 0fbf4da..cec8c5a 100644 (file)
@@ -46,7 +46,7 @@ CONSOLE_Init(
     VOID)
 {
     CONSOLE_SCREEN_BUFFER_INFO csbi;
-    if (!HOST_InitConsole())
+    if (!AllocConsole())
         return FALSE;
 
     StdInput = GetStdHandle(STD_INPUT_HANDLE);
index 8007756..568525d 100644 (file)
@@ -264,7 +264,6 @@ SetupCopyFile(
     SIZE_T SourceSectionSize = 0;
     LARGE_INTEGER ByteOffset;
 
-#ifdef __REACTOS__
     RtlInitUnicodeString(&FileName,
                          SourceFileName);
 
@@ -285,20 +284,6 @@ SetupCopyFile(
         DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName);
         goto done;
     }
-#else
-    FileHandleSource = CreateFileW(SourceFileName,
-                                   GENERIC_READ,
-                                   FILE_SHARE_READ,
-                                   NULL,
-                                   OPEN_EXISTING,
-                                   0,
-                                   NULL);
-    if (FileHandleSource == INVALID_HANDLE_VALUE)
-    {
-        Status = STATUS_UNSUCCESSFUL;
-        goto done;
-    }
-#endif
 
     Status = NtQueryInformationFile(FileHandleSource,
                                     &IoStatusBlock,
@@ -496,7 +481,7 @@ done:
     return Status;
 }
 
-#ifdef __REACTOS__
+
 NTSTATUS
 SetupExtractFile(
     PWCHAR CabinetFileName,
@@ -574,7 +559,7 @@ SetupExtractFile(
 
     return STATUS_SUCCESS;
 }
-#endif
+
 
 BOOLEAN
 DoesFileExist(
index 99fe2f8..0b190d4 100644 (file)
@@ -33,7 +33,7 @@
 /* FUNCTIONS ****************************************************************/
 
 VOID
-FS_AddProvider(
+AddProvider(
     IN OUT PFILE_SYSTEM_LIST List,
     IN LPCWSTR FileSystemName,
     IN FORMATEX FormatFunc,
@@ -175,12 +175,16 @@ CreateFileSystemList(
     List->Selected = NULL;
     InitializeListHead(&List->ListHead);
 
-    HOST_CreateFileSystemList(List);
+    AddProvider(List, L"FAT", VfatFormat, VfatChkdsk);
+#if 0
+    AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
+    AddProvider(List, L"NTFS", NtfsFormat, NtfsChkdsk);
+#endif
 
     if (!ForceFormat)
     {
         /* Add 'Keep' provider */
-       FS_AddProvider(List, NULL, NULL, NULL);
+        AddProvider(List, NULL, NULL, NULL);
     }
 
     /* Search for ForceFileSystem in list */
index 73ab536..10adbcf 100644 (file)
@@ -33,8 +33,6 @@
 
 /* FUNCTIONS *****************************************************************/
 
-#ifdef __REACTOS__
-
 BOOL
 WINAPI
 InfpFindFirstLineW(
@@ -81,7 +79,6 @@ InfpOpenInfFileW(
 
     return hInf;
 }
-#endif /* __REACTOS__ */
 
 
 BOOLEAN
@@ -90,54 +87,7 @@ INF_GetData(
     OUT PWCHAR *Key,
     OUT PWCHAR *Data)
 {
-#ifdef __REACTOS__
     return InfGetData(Context, Key, Data);
-#else
-    static PWCHAR pLastCallData[4] = { NULL, NULL, NULL, NULL };
-    static DWORD currentIndex = 0;
-    DWORD dwSize, i;
-    BOOL ret;
-
-    currentIndex ^= 2;
-
-    if (Key)
-        *Key = NULL;
-
-    if (Data)
-        *Data = NULL;
-
-    if (SetupGetFieldCount(Context) != 1)
-        return FALSE;
-
-    for (i = 0; i <= 1; i++)
-    {
-        ret = SetupGetStringFieldW(Context,
-                                   i,
-                                   NULL,
-                                   0,
-                                   &dwSize);
-        if (!ret)
-            return FALSE;
-
-        HeapFree(GetProcessHeap(), 0, pLastCallData[i + currentIndex]);
-        pLastCallData[i + currentIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
-        ret = SetupGetStringFieldW(Context,
-                                   i,
-                                   pLastCallData[i + currentIndex],
-                                   dwSize,
-                                   NULL);
-        if (!ret)
-            return FALSE;
-    }
-
-    if (Key)
-        *Key = pLastCallData[0 + currentIndex];
-
-    if (Data)
-        *Data = pLastCallData[1 + currentIndex];
-
-    return TRUE;
-#endif /* !__REACTOS__ */
 }
 
 
@@ -147,38 +97,7 @@ INF_GetDataField(
     IN ULONG FieldIndex,
     OUT PWCHAR *Data)
 {
-#ifdef __REACTOS__
     return InfGetDataField(Context, FieldIndex, Data);
-#else
-    static PWCHAR pLastCallsData[] = { NULL, NULL, NULL };
-    static DWORD NextIndex = 0;
-    DWORD dwSize;
-    BOOL ret;
-
-    *Data = NULL;
-
-    ret = SetupGetStringFieldW(Context,
-                               FieldIndex,
-                               NULL,
-                               0,
-                               &dwSize);
-    if (!ret)
-        return FALSE;
-
-    HeapFree(GetProcessHeap(), 0, pLastCallsData[NextIndex]);
-    pLastCallsData[NextIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
-    ret = SetupGetStringFieldW(Context,
-                               FieldIndex,
-                               pLastCallsData[NextIndex],
-                               dwSize,
-                               NULL);
-    if (!ret)
-        return FALSE;
-
-    *Data = pLastCallsData[NextIndex];
-    NextIndex = (NextIndex + 1) % (sizeof(pLastCallsData) / sizeof(pLastCallsData[0]));
-    return TRUE;
-#endif /* !__REACTOS__ */
 }
 
 
@@ -191,7 +110,6 @@ INF_OpenBufferedFileA(
     IN LCID LocaleId,
     OUT PUINT ErrorLine)
 {
-#ifdef __REACTOS__
     HINF hInf = NULL;
     ULONG ErrorLineUL;
     NTSTATUS Status;
@@ -206,9 +124,6 @@ INF_OpenBufferedFileA(
         return INVALID_HANDLE_VALUE;
 
     return hInf;
-#else
-    return INVALID_HANDLE_VALUE;
-#endif /* !__REACTOS__ */
 }
 
 /* EOF */
index 039fbef..9ce8ce0 100644 (file)
 
 #pragma once
 
-#ifndef __REACTOS__
-
-#include <setupapi.h>
-
-#else /* __REACTOS__ */
-
 #include <infcommon.h>
 
 #define SetupFindFirstLineW InfpFindFirstLineW
@@ -69,8 +63,6 @@ InfpOpenInfFileW(
     IN LCID LocaleId,
     OUT PUINT ErrorLine);
 
-#endif /* __REACTOS__ */
-
 BOOLEAN
 INF_GetData(
     IN PINFCONTEXT Context,
similarity index 99%
rename from base/setup/usetup/native/utils/keytrans.c
rename to base/setup/usetup/keytrans.c
index 6127963..0c85cb7 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            base/setup/usetup/native/utils/keytrans.c
+ * FILE:            base/setup/usetup/keytrans.c
  * PURPOSE:         Console support functions: keyboard translation
  * PROGRAMMER:      Tinus
  *
similarity index 94%
rename from base/setup/usetup/native/utils/keytrans.h
rename to base/setup/usetup/keytrans.h
index 893a699..788d7ed 100644 (file)
@@ -18,7 +18,7 @@
  */
 /* COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            base/setup/usetup/native/utils/keytrans.h
+ * FILE:            base/setup/usetup/keytrans.h
  * PURPOSE:         Keyboard translation functionality
  * PROGRAMMER:      Tinus
  */
diff --git a/base/setup/usetup/native/console.c b/base/setup/usetup/native/console.c
deleted file mode 100644 (file)
index 963caa7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <usetup.h>
-
-BOOLEAN
-NATIVE_InitConsole(VOID)
-{
-    return (BOOLEAN)AllocConsole();
-}
diff --git a/base/setup/usetup/native/fslist.c b/base/setup/usetup/native/fslist.c
deleted file mode 100644 (file)
index 4d9b655..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <usetup.h>
-
-BOOLEAN
-NATIVE_CreateFileSystemList(
-    IN PFILE_SYSTEM_LIST List)
-{
-    FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk);
-#if 0
-    FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk);
-    FS_AddProvider(List, L"NTFS", NtfsFormat, NtfsChkdsk);
-#endif
-    return TRUE;
-}
-
-
-BOOLEAN
-NATIVE_FormatPartition(
-    IN PFILE_SYSTEM_ITEM FileSystem,
-    IN PCUNICODE_STRING DriveRoot,
-    IN PFMIFSCALLBACK Callback)
-{
-    NTSTATUS Status;
-
-    Status = FileSystem->FormatFunc((PUNICODE_STRING)DriveRoot,
-                                    FMIFS_HARDDISK,          /* MediaFlag */
-                                    NULL,                    /* Label */
-                                    FileSystem->QuickFormat, /* QuickFormat */
-                                    0,                       /* ClusterSize */
-                                    Callback);               /* Callback */
-    return NT_SUCCESS(Status);
-}
diff --git a/base/setup/usetup/native/host_native.h b/base/setup/usetup/native/host_native.h
deleted file mode 100644 (file)
index df3ad98..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#define SetupInitDefaultQueueCallback(a) NULL
-#define SetupDefaultQueueCallbackW(a, b, c, d) TRUE
-#define SetupTermDefaultQueueCallback(a)
index 4bbc4f8..2c7ada6 100644 (file)
@@ -31,7 +31,6 @@
 #define NDEBUG
 #include <debug.h>
 
-#ifdef __REACTOS__
 #define FLG_ADDREG_BINVALUETYPE           0x00000001
 #define FLG_ADDREG_NOCLOBBER              0x00000002
 #define FLG_ADDREG_DELVAL                 0x00000004
@@ -45,7 +44,6 @@
 #define FLG_ADDREG_TYPE_DWORD            (0x00010000 | FLG_ADDREG_BINVALUETYPE)
 #define FLG_ADDREG_TYPE_NONE             (0x00020000 | FLG_ADDREG_BINVALUETYPE)
 #define FLG_ADDREG_TYPE_MASK             (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
-#endif
 
 #ifdef _M_IX86
 #define Architecture L"x86"
@@ -324,16 +322,12 @@ do_reg_operation(HANDLE KeyHandle,
 
           DPRINT("setting dword %wZ to %lx\n", ValueName, dw);
 
-#ifdef __REACTOS__
           NtSetValueKey (KeyHandle,
                          ValueName,
                          0,
                          Type,
                          (PVOID)&dw,
                          sizeof(ULONG));
-#else
-          RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)&dw, sizeof(ULONG));
-#endif
         }
       else
         {
@@ -341,29 +335,21 @@ do_reg_operation(HANDLE KeyHandle,
 
           if (Str)
             {
-#ifdef __REACTOS__
               NtSetValueKey (KeyHandle,
                              ValueName,
                              0,
                              Type,
                              (PVOID)Str,
                              Size * sizeof(WCHAR));
-#else
-              RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)Str, Size * sizeof(WCHAR));
-#endif
             }
           else
             {
-#ifdef __REACTOS__
               NtSetValueKey (KeyHandle,
                              ValueName,
                              0,
                              Type,
                              (PVOID)&EmptyStr,
                              sizeof(WCHAR));
-#else
-              RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)&EmptyStr, sizeof(WCHAR));
-#endif
             }
         }
       RtlFreeHeap (ProcessHeap, 0, Str);
@@ -385,16 +371,12 @@ do_reg_operation(HANDLE KeyHandle,
           SetupGetBinaryField (Context, 5, Data, Size, NULL);
         }
 
-#ifdef __REACTOS__
       NtSetValueKey (KeyHandle,
                      ValueName,
                      0,
                      Type,
                      (PVOID)Data,
                      Size);
-#else
-      RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)Data, Size);
-#endif
 
       RtlFreeHeap (ProcessHeap, 0, Data);
     }
@@ -402,7 +384,6 @@ do_reg_operation(HANDLE KeyHandle,
   return TRUE;
 }
 
-#ifdef __REACTOS__
 NTSTATUS
 CreateNestedKey (PHANDLE KeyHandle,
                  ACCESS_MASK DesiredAccess,
@@ -494,7 +475,6 @@ CreateNestedKey (PHANDLE KeyHandle,
 
   return Status;
 }
-#endif
 
 /***********************************************************************
  *            registry_callback
@@ -543,7 +523,6 @@ registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
 
           DPRINT("Flags: %lx\n", Flags);
 
-#ifdef __REACTOS__
           RtlInitUnicodeString (&Name,
                                 Buffer);
 
@@ -575,26 +554,6 @@ registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
                   continue;
                 }
             }
-#else
-          if (Delete || (Flags & FLG_ADDREG_OVERWRITEONLY))
-             {
-                LONG rc = RegOpenKeyW(NULL, Buffer, &KeyHandle);
-                if (rc != ERROR_SUCCESS)
-                  {
-                    DPRINT("RegOpenKeyW(%S) failed (error %lu)\n", Buffer, rc);
-                    continue; /* ignore if it doesn't exist */
-                  }
-              }
-              else
-              {
-                  LONG rc = RegCreateKeyW(NULL, Buffer, &KeyHandle);
-                  if (rc != ERROR_SUCCESS)
-                  {
-                    DPRINT("RegCreateKeyW(%S) failed (error %lu)\n", Buffer, rc);
-                    continue;
-                  }
-              }
-#endif
 
           /* get value name */
           if (SetupGetStringFieldW (&Context, 3, Buffer, MAX_INF_STRING_LENGTH, NULL))
@@ -615,9 +574,7 @@ registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
               return FALSE;
             }
 
-#ifdef __REACTOS__
           NtClose (KeyHandle);
-#endif
         }
     }
 
index 5b5ac58..71dc354 100644 (file)
@@ -3886,7 +3886,6 @@ PrepareCopyPage(PINPUT_RECORD Ir)
         wcscat(PathBuffer, L"\\");
         wcscat(PathBuffer, KeyValue);
 
-#ifdef __REACTOS__
         CabinetInitialize();
         CabinetSetEventHandlers(NULL, NULL, NULL);
         CabinetSetCabinetName(PathBuffer);
@@ -3929,7 +3928,6 @@ PrepareCopyPage(PINPUT_RECORD Ir)
             /* FIXME: show an error dialog */
             return QUIT_PAGE;
         }
-#endif
     } while (SetupFindNextLine(&CabinetsContext, &CabinetsContext));
 
     return FILE_COPY_PAGE;
@@ -4960,8 +4958,6 @@ RunUSetup(VOID)
 }
 
 
-#ifdef __REACTOS__
-
 VOID NTAPI
 NtProcessStartup(PPEB Peb)
 {
@@ -4971,6 +4967,5 @@ NtProcessStartup(PPEB Peb)
     InfSetHeap(ProcessHeap);
     RunUSetup();
 }
-#endif /* __REACTOS__ */
 
 /* EOF */
index 181c1b4..37cae20 100644 (file)
 #include "inffile.h"
 #include "inicache.h"
 #include "progress.h"
-#ifdef __REACTOS__
 #include "infros.h"
 #include "filequeue.h"
-#endif
 #include "registry.h"
 #include "fslist.h"
 #include "partlist.h"
 #include "cabinet.h"
 #include "filesup.h"
 #include "genlist.h"
-#include "host.h"
 #include "mui.h"
 #include "errorcode.h"
 
@@ -84,8 +81,6 @@ extern UNICODE_STRING SourcePath;
 extern BOOLEAN IsUnattendedSetup;
 extern PWCHAR SelectedLanguageId;
 
-#ifdef __REACTOS__
-
 extern VOID InfSetHeap(PVOID Heap);
 extern VOID InfCloseFile(HINF InfHandle);
 extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
@@ -112,8 +107,6 @@ extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
 #define SetupGetMultiSzFieldW InfGetMultiSzField
 #define SetupGetStringFieldW InfGetStringField
 
-#endif /* __REACTOS__ */
-
 #ifndef _PAGE_NUMBER_DEFINED
 #define _PAGE_NUMBER_DEFINED
 typedef enum _PAGE_NUMBER
index 3eb82ae..d7347f3 100644 (file)
@@ -1,6 +1,4 @@
 #define REACTOS_STR_FILE_DESCRIPTION  "ReactOS Setup"
 #define REACTOS_STR_INTERNAL_NAME     "usetup"
-#define REACTOS_STR_ORIGINAL_FILENAME "usetup.dll"
-#ifdef __REACTOS__
+#define REACTOS_STR_ORIGINAL_FILENAME "usetup.exe"
 #include <reactos/version.rc>
-#endif