- Set correct flags when calling Nt* functions during file copy

- Fix reading of disks parameter in registry
- Keep FS name in unicode instead of char
- Don't hardcode more than once ReactOS directory on bootcd ('\reactos')
- Get screen dimensions only once (at startup)
- General cleanup (warnings...)
- Do some actions only if __REACTOS__ if defined. (I'm currently using them to debug usetup)

svn path=/trunk/; revision=24718
This commit is contained in:
Hervé Poussineau 2006-11-10 21:00:24 +00:00
parent 7885d994ff
commit eb77bd4e85
24 changed files with 616 additions and 507 deletions

View file

@ -1787,10 +1787,10 @@ UpdateBootIni(PWSTR BootIniPath,
return(Status); return(Status);
} }
BOOLEAN BOOLEAN
CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath) CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath)
{ {
#ifdef __REACTOS__
if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") || if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") ||
DoesFileExist(SystemRootPath->Buffer, L"boot.ini")) DoesFileExist(SystemRootPath->Buffer, L"boot.ini"))
{ {
@ -1801,6 +1801,7 @@ CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath)
{ {
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
@ -1812,6 +1813,7 @@ InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath,
PUNICODE_STRING DestinationArcPath, PUNICODE_STRING DestinationArcPath,
UCHAR PartitionType) UCHAR PartitionType)
{ {
#ifdef __REACTOS__
WCHAR SrcPath[MAX_PATH]; WCHAR SrcPath[MAX_PATH];
WCHAR DstPath[MAX_PATH]; WCHAR DstPath[MAX_PATH];
NTSTATUS Status; NTSTATUS Status;
@ -2117,6 +2119,9 @@ InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath,
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
#else
return STATUS_NOT_IMPLEMENTED;
#endif
} }
@ -2124,6 +2129,7 @@ NTSTATUS
InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
PUNICODE_STRING DestinationArcPath) PUNICODE_STRING DestinationArcPath)
{ {
#ifdef __REACTOS__
WCHAR SrcPath[MAX_PATH]; WCHAR SrcPath[MAX_PATH];
WCHAR DstPath[MAX_PATH]; WCHAR DstPath[MAX_PATH];
NTSTATUS Status; NTSTATUS Status;
@ -2170,6 +2176,9 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
#else
return STATUS_NOT_IMPLEMENTED;
#endif
} }
/* EOF */ /* EOF */

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filequeue.c * FILE: subsys/system/usetup/filequeue.c
* PURPOSE: File queue functions * PURPOSE: File queue functions
@ -34,7 +33,6 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
typedef struct _QUEUEENTRY typedef struct _QUEUEENTRY
{ {
struct _QUEUEENTRY *Prev; struct _QUEUEENTRY *Prev;

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filesup.c * FILE: subsys/system/usetup/filesup.c
* PURPOSE: File support functions * PURPOSE: File support functions
@ -34,7 +33,6 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static BOOLEAN HasCurrentCabinet = FALSE; static BOOLEAN HasCurrentCabinet = FALSE;
static WCHAR CurrentCabinetName[MAX_PATH]; static WCHAR CurrentCabinetName[MAX_PATH];
@ -76,9 +74,9 @@ SetupCreateDirectory(PWCHAR DirectoryName)
&IoStatusBlock, &IoStatusBlock,
NULL, NULL,
FILE_ATTRIBUTE_DIRECTORY, FILE_ATTRIBUTE_DIRECTORY,
0, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_CREATE, FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE, FILE_DIRECTORY_FILE,
NULL, NULL,
0); 0);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
@ -108,10 +106,12 @@ SetupCopyFile(PWCHAR SourceFileName,
NTSTATUS Status; NTSTATUS Status;
PVOID SourceFileMap = 0; PVOID SourceFileMap = 0;
HANDLE SourceFileSection; HANDLE SourceFileSection;
ULONG SourceSectionSize = 0; SIZE_T SourceSectionSize = 0;
LARGE_INTEGER ByteOffset;
Buffer = NULL; Buffer = NULL;
#ifdef __REACTOS__
RtlInitUnicodeString(&FileName, RtlInitUnicodeString(&FileName,
SourceFileName); SourceFileName);
@ -126,12 +126,20 @@ SetupCopyFile(PWCHAR SourceFileName,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
FILE_SHARE_READ, FILE_SHARE_READ,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); FILE_SEQUENTIAL_ONLY);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
DPRINT1("NtOpenFile failed: %x\n", Status); DPRINT1("NtOpenFile failed: %x\n", Status);
goto done; 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, Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock, &IoStatusBlock,
@ -155,10 +163,10 @@ SetupCopyFile(PWCHAR SourceFileName,
Status = NtCreateSection( &SourceFileSection, Status = NtCreateSection( &SourceFileSection,
SECTION_MAP_READ, SECTION_MAP_READ,
0, NULL,
0, NULL,
PAGE_READONLY, PAGE_READONLY,
0, SEC_COMMIT,
FileHandleSource); FileHandleSource);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -171,10 +179,10 @@ SetupCopyFile(PWCHAR SourceFileName,
&SourceFileMap, &SourceFileMap,
0, 0,
0, 0,
0, NULL,
&SourceSectionSize, &SourceSectionSize,
ViewUnmap,
0, 0,
SEC_COMMIT,
PAGE_READONLY ); PAGE_READONLY );
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
@ -199,7 +207,7 @@ SetupCopyFile(PWCHAR SourceFileName,
FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_NORMAL,
0, 0,
FILE_OVERWRITE_IF, FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, FILE_NO_INTERMEDIATE_BUFFERING | FILE_SEQUENTIAL_ONLY,
NULL, NULL,
0); 0);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
@ -208,17 +216,18 @@ SetupCopyFile(PWCHAR SourceFileName,
goto unmapsrcsec; goto unmapsrcsec;
} }
RegionSize = PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart); RegionSize = (ULONG)PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart);
IoStatusBlock.Status = 0; IoStatusBlock.Status = 0;
ByteOffset.QuadPart = 0;
Status = NtWriteFile(FileHandleDest, Status = NtWriteFile(FileHandleDest,
0, NULL,
0, NULL,
0, NULL,
&IoStatusBlock, &IoStatusBlock,
SourceFileMap, SourceFileMap,
RegionSize, RegionSize,
0, &ByteOffset,
0); NULL);
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
DPRINT1("NtWriteFile failed: %x:%x, iosb: %p src: %p, size: %x\n", Status, IoStatusBlock.Status, &IoStatusBlock, SourceFileMap, RegionSize); DPRINT1("NtWriteFile failed: %x:%x, iosb: %p src: %p, size: %x\n", Status, IoStatusBlock.Status, &IoStatusBlock, SourceFileMap, RegionSize);
@ -254,7 +263,7 @@ SetupCopyFile(PWCHAR SourceFileName,
return(Status); return(Status);
} }
#ifdef __REACTOS__
NTSTATUS NTSTATUS
SetupExtractFile(PWCHAR CabinetFileName, SetupExtractFile(PWCHAR CabinetFileName,
PWCHAR SourceFileName, PWCHAR SourceFileName,
@ -314,7 +323,7 @@ SetupExtractFile(PWCHAR CabinetFileName,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#endif
BOOLEAN BOOLEAN
DoesFileExist(PWSTR PathName, DoesFileExist(PWSTR PathName,

View file

@ -32,10 +32,10 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static VOID VOID
AddProvider( FS_AddProvider(
IN OUT PFILE_SYSTEM_LIST List, IN OUT PFILE_SYSTEM_LIST List,
IN LPCSTR FileSystem, IN LPCWSTR FileSystem,
IN FORMATEX FormatFunc, IN FORMATEX FormatFunc,
IN CHKDSKEX ChkdskFunc) IN CHKDSKEX ChkdskFunc)
{ {
@ -70,7 +70,7 @@ CreateFileSystemList(
IN SHORT Left, IN SHORT Left,
IN SHORT Top, IN SHORT Top,
IN BOOLEAN ForceFormat, IN BOOLEAN ForceFormat,
IN LPCSTR ForceFileSystem) IN LPCWSTR ForceFileSystem)
{ {
PFILE_SYSTEM_LIST List; PFILE_SYSTEM_LIST List;
PFILE_SYSTEM_ITEM Item; PFILE_SYSTEM_ITEM Item;
@ -85,11 +85,12 @@ CreateFileSystemList(
List->Selected = NULL; List->Selected = NULL;
InitializeListHead(&List->ListHead); InitializeListHead(&List->ListHead);
AddProvider(List, "FAT", VfatFormat, VfatChkdsk); HOST_CreateFileSystemList(List);
if (!ForceFormat) if (!ForceFormat)
{ {
/* Add 'Keep' provider */ /* Add 'Keep' provider */
AddProvider(List, NULL, NULL, NULL); FS_AddProvider(List, NULL, NULL, NULL);
} }
/* Search for ForceFileSystem in list */ /* Search for ForceFileSystem in list */
@ -97,7 +98,7 @@ CreateFileSystemList(
while (ListEntry != &List->ListHead) while (ListEntry != &List->ListHead)
{ {
Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry); Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
if (Item->FileSystem && strcmp(ForceFileSystem, Item->FileSystem) == 0) if (Item->FileSystem && wcscmp(ForceFileSystem, Item->FileSystem) == 0)
{ {
List->Selected = Item; List->Selected = Item;
break; break;
@ -147,7 +148,7 @@ DrawFileSystemList(
Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry); Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
coPos.X = List->Left; coPos.X = List->Left;
coPos.Y = List->Top + Index; coPos.Y = List->Top + (SHORT)Index;
FillConsoleOutputAttribute(StdOutput, FillConsoleOutputAttribute(StdOutput,
FOREGROUND_WHITE | BACKGROUND_BLUE, FOREGROUND_WHITE | BACKGROUND_BLUE,
sizeof(Buffer), sizeof(Buffer),
@ -162,9 +163,9 @@ DrawFileSystemList(
if (Item->FileSystem) if (Item->FileSystem)
{ {
if (Item->QuickFormat) if (Item->QuickFormat)
sprintf(Buffer, " Format partition as %s file system (quick format) ", Item->FileSystem); sprintf(Buffer, " Format partition as %S file system (quick format) ", Item->FileSystem);
else else
sprintf(Buffer, " Format partition as %s file system ", Item->FileSystem); sprintf(Buffer, " Format partition as %S file system ", Item->FileSystem);
} }
else else
sprintf(Buffer, " Keep current file system (no changes) "); sprintf(Buffer, " Keep current file system (no changes) ");

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/fslist.h * FILE: subsys/system/usetup/fslist.h
* PURPOSE: Filesystem list functions * PURPOSE: Filesystem list functions
@ -28,30 +27,38 @@
#ifndef __FSLIST_H__ #ifndef __FSLIST_H__
#define __FSLIST_H__ #define __FSLIST_H__
#include <fmifs/fmifs.h>
typedef struct _FILE_SYSTEM_ITEM typedef struct _FILE_SYSTEM_ITEM
{ {
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
LPCSTR FileSystem; /* Not owned by the item */ LPCWSTR FileSystem; /* Not owned by the item */
FORMATEX FormatFunc; FORMATEX FormatFunc;
CHKDSKEX ChkdskFunc; CHKDSKEX ChkdskFunc;
BOOLEAN QuickFormat; BOOLEAN QuickFormat;
} FILE_SYSTEM_ITEM, *PFILE_SYSTEM_ITEM; } FILE_SYSTEM_ITEM, *PFILE_SYSTEM_ITEM;
typedef struct _FILE_SYSTEM_LIST typedef struct _FILE_SYSTEM_LIST
{ {
SHORT Left; SHORT Left;
SHORT Top; SHORT Top;
PFILE_SYSTEM_ITEM Selected; PFILE_SYSTEM_ITEM Selected;
LIST_ENTRY ListHead; /* List of FILE_SYSTEM_ITEM */ LIST_ENTRY ListHead; /* List of FILE_SYSTEM_ITEM */
} FILE_SYSTEM_LIST, *PFILE_SYSTEM_LIST; } FILE_SYSTEM_LIST, *PFILE_SYSTEM_LIST;
VOID
FS_AddProvider(
IN OUT PFILE_SYSTEM_LIST List,
IN LPCWSTR FileSystem,
IN FORMATEX FormatFunc,
IN CHKDSKEX ChkdskFunc);
PFILE_SYSTEM_LIST PFILE_SYSTEM_LIST
CreateFileSystemList( CreateFileSystemList(
IN SHORT Left, IN SHORT Left,
IN SHORT Top, IN SHORT Top,
IN BOOLEAN ForceFormat, IN BOOLEAN ForceFormat,
IN LPCSTR ForceFileSystem); IN LPCWSTR ForceFileSystem);
VOID VOID
DestroyFileSystemList( DestroyFileSystemList(

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/genlist.c * FILE: subsys/system/usetup/genlist.c
* PURPOSE: Generic list functions * PURPOSE: Generic list functions
@ -72,7 +71,7 @@ DestroyGenericList(PGENERIC_LIST List,
/* Release user data */ /* Release user data */
if (FreeUserData && ListEntry->UserData != NULL) if (FreeUserData && ListEntry->UserData != NULL)
RtlFreeHeap (ProcessHeap, 0, &ListEntry->UserData); RtlFreeHeap (ProcessHeap, 0, ListEntry->UserData);
/* Release list entry */ /* Release list entry */
RtlFreeHeap (ProcessHeap, 0, ListEntry); RtlFreeHeap (ProcessHeap, 0, ListEntry);

View file

@ -0,0 +1,33 @@
#ifdef __REACTOS__
#include "native/host_native.h"
#define HOST_InitConsole NATIVE_InitConsole
#define HOST_InitMemory NATIVE_InitMemory
#define HOST_CreateFileSystemList NATIVE_CreateFileSystemList
#else
#include "win32/host_win32.h"
#define HOST_InitConsole WIN32_InitConsole
#define HOST_InitMemory WIN32_InitMemory
#define HOST_CreateFileSystemList WIN32_CreateFileSystemList
#endif
BOOLEAN
HOST_InitConsole(
VOID);
BOOLEAN
HOST_InitMemory(
VOID);
BOOLEAN
HOST_CreateFileSystemList(
IN PFILE_SYSTEM_LIST List);
BOOLEAN
HOST_FormatPartition(
IN PFILE_SYSTEM_ITEM FileSystem,
IN PCUNICODE_STRING DriveRoot,
IN PFMIFSCALLBACK Callback);

View file

@ -27,13 +27,18 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include "usetup.h" #include "usetup.h"
#ifdef __REACTOS__
#include <infros.h> #include <infros.h>
#endif
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#ifdef __REACTOS__
VOID WINAPI VOID WINAPI
InfpCloseInfFile( InfpCloseInfFile(
IN HINF InfHandle) IN HINF InfHandle)
@ -141,18 +146,63 @@ InfpOpenInfFileW(
&ErrorLineUL); &ErrorLineUL);
*ErrorLine = (UINT)ErrorLineUL; *ErrorLine = (UINT)ErrorLineUL;
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return NULL; return INVALID_HANDLE_VALUE;
return hInf; return hInf;
} }
#endif /* __REACTOS__ */
BOOLEAN BOOLEAN
INF_GetData( INF_GetData(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,
OUT PWCHAR *Key, OUT PWCHAR *Key,
OUT PWCHAR *Data) OUT PWCHAR *Data)
{ {
#ifdef __REACTOS__
return InfGetData(Context, Key, Data); 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__ */
} }
BOOLEAN BOOLEAN
@ -161,7 +211,39 @@ INF_GetDataField(
IN ULONG FieldIndex, IN ULONG FieldIndex,
OUT PWCHAR *Data) OUT PWCHAR *Data)
{ {
#ifdef __REACTOS__
return InfGetDataField(Context, FieldIndex, Data); 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__ */
} }
HINF WINAPI HINF WINAPI
@ -172,6 +254,7 @@ INF_OpenBufferedFileA(
IN DWORD InfStyle, IN DWORD InfStyle,
OUT PUINT ErrorLine) OUT PUINT ErrorLine)
{ {
#ifdef __REACTOS__
HINF hInf = NULL; HINF hInf = NULL;
ULONG ErrorLineUL; ULONG ErrorLineUL;
NTSTATUS Status; NTSTATUS Status;
@ -183,15 +266,20 @@ INF_OpenBufferedFileA(
&ErrorLineUL); &ErrorLineUL);
*ErrorLine = (UINT)ErrorLineUL; *ErrorLine = (UINT)ErrorLineUL;
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return NULL; return INVALID_HANDLE_VALUE;
return hInf; return hInf;
#else
return INVALID_HANDLE_VALUE;
#endif /* !__REACTOS__ */
} }
VOID INF_SetHeap( VOID INF_SetHeap(
IN PVOID Heap) IN PVOID Heap)
{ {
#ifdef __REACTOS__
InfSetHeap(Heap); InfSetHeap(Heap);
#endif
} }
/* EOF */ /* EOF */

View file

@ -27,6 +27,12 @@
#ifndef __INFFILE_H__ #ifndef __INFFILE_H__
#define __INFFILE_H__ #define __INFFILE_H__
#ifndef __REACTOS__
#include <setupapi.h>
#else /* __REACTOS__ */
#include <infcommon.h> #include <infcommon.h>
#define SetupCloseInfFile InfpCloseInfFile #define SetupCloseInfFile InfpCloseInfFile
@ -107,6 +113,8 @@ InfpOpenInfFileW(
IN DWORD InfStyle, IN DWORD InfStyle,
OUT PUINT ErrorLine); OUT PUINT ErrorLine);
#endif /* __REACTOS__ */
BOOLEAN BOOLEAN
INF_GetData( INF_GetData(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,

View file

@ -31,8 +31,33 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS ******************************************************************/
HANDLE StdInput = INVALID_HANDLE_VALUE;
HANDLE StdOutput = INVALID_HANDLE_VALUE;
SHORT xScreen = 0;
SHORT yScreen = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
BOOLEAN
CONSOLE_Init(
VOID)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (!HOST_InitConsole())
return FALSE;
StdInput = GetStdHandle(STD_INPUT_HANDLE);
StdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if (!GetConsoleScreenBufferInfo(StdOutput, &csbi))
return FALSE;
xScreen = csbi.dwSize.X;
yScreen = 50;//csbi.dwSize.Y;
return TRUE;
}
VOID VOID
CONSOLE_ConInKey( CONSOLE_ConInKey(
OUT PINPUT_RECORD Buffer) OUT PINPUT_RECORD Buffer)
@ -72,7 +97,7 @@ CONSOLE_ConOutPuts(
WriteConsole( WriteConsole(
StdOutput, StdOutput,
szText, szText,
strlen(szText), (ULONG)strlen(szText),
&Written, &Written,
NULL); NULL);
WriteConsole( WriteConsole(
@ -88,7 +113,7 @@ CONSOLE_ConOutPrintf(
IN LPCSTR szFormat, ...) IN LPCSTR szFormat, ...)
{ {
CHAR szOut[256]; CHAR szOut[256];
DWORD dwWritten; ULONG dwWritten;
va_list arg_ptr; va_list arg_ptr;
va_start(arg_ptr, szFormat); va_start(arg_ptr, szFormat);
@ -98,7 +123,7 @@ CONSOLE_ConOutPrintf(
WriteConsole( WriteConsole(
StdOutput, StdOutput,
szOut, szOut,
strlen(szOut), (ULONG)strlen(szOut),
&dwWritten, &dwWritten,
NULL); NULL);
} }
@ -123,20 +148,6 @@ CONSOLE_GetCursorY(VOID)
return csbi.dwCursorPosition.Y; return csbi.dwCursorPosition.Y;
} }
VOID
CONSOLE_GetScreenSize(
OUT SHORT *maxx,
OUT SHORT *maxy)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(StdOutput, &csbi);
*maxx = csbi.dwSize.X;
*maxy = csbi.dwSize.Y;
}
VOID VOID
CONSOLE_SetCursorType( CONSOLE_SetCursorType(
IN BOOL bInsert, IN BOOL bInsert,
@ -219,7 +230,7 @@ CONSOLE_SetStatusText(
WriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
StdOutput, StdOutput,
Buffer, Buffer,
strlen(Buffer), (ULONG)strlen(Buffer),
coPos, coPos,
&Written); &Written);
} }
@ -285,7 +296,7 @@ CONSOLE_SetTextXY(
WriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
StdOutput, StdOutput,
Text, Text,
strlen(Text), (ULONG)strlen(Text),
coPos, coPos,
&Written); &Written);
} }
@ -298,14 +309,14 @@ CONSOLE_SetInputTextXY(
IN LPCWSTR Text) IN LPCWSTR Text)
{ {
COORD coPos; COORD coPos;
ULONG Length; SHORT Length;
ULONG Written; ULONG Written;
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
Length = wcslen(Text); Length = (SHORT)wcslen(Text);
if (Length > (ULONG)len - 1) if (Length > len - 1)
Length = len - 1; Length = len - 1;
FillConsoleOutputAttribute( FillConsoleOutputAttribute(
@ -318,7 +329,7 @@ CONSOLE_SetInputTextXY(
WriteConsoleOutputCharacterW( WriteConsoleOutputCharacterW(
StdOutput, StdOutput,
Text, Text,
Length, (ULONG)Length,
coPos, coPos,
&Written); &Written);
@ -330,7 +341,7 @@ CONSOLE_SetInputTextXY(
coPos, coPos,
&Written); &Written);
if ((ULONG)len > Length + 1) if (len > Length + 1)
{ {
coPos.X++; coPos.X++;
FillConsoleOutputCharacterA( FillConsoleOutputCharacterA(
@ -355,7 +366,7 @@ CONSOLE_SetUnderlinedTextXY(
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
Length = strlen(Text); Length = (ULONG)strlen(Text);
WriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
StdOutput, StdOutput,
@ -386,7 +397,7 @@ CONSOLE_SetInvertedTextXY(
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
Length = strlen(Text); Length = (ULONG)strlen(Text);
FillConsoleOutputAttribute( FillConsoleOutputAttribute(
StdOutput, StdOutput,
@ -416,7 +427,7 @@ CONSOLE_SetHighlightedTextXY(
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
Length = strlen(Text); Length = (ULONG)strlen(Text);
FillConsoleOutputAttribute( FillConsoleOutputAttribute(
StdOutput, StdOutput,
@ -454,7 +465,7 @@ CONSOLE_PrintTextXY(
WriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
StdOutput, StdOutput,
buffer, buffer,
strlen(buffer), (ULONG)strlen(buffer),
coPos, coPos,
&Written); &Written);
} }
@ -469,7 +480,7 @@ CONSOLE_PrintTextXYN(
CHAR buffer[512]; CHAR buffer[512];
va_list ap; va_list ap;
COORD coPos; COORD coPos;
ULONG Length; SHORT Length;
ULONG Written; ULONG Written;
va_start(ap, fmt); va_start(ap, fmt);
@ -479,8 +490,8 @@ CONSOLE_PrintTextXYN(
coPos.X = x; coPos.X = x;
coPos.Y = y; coPos.Y = y;
Length = strlen(buffer); Length = (SHORT)strlen(buffer);
if (Length > (ULONG)len - 1) if (Length > len - 1)
Length = len - 1; Length = len - 1;
WriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
@ -492,7 +503,7 @@ CONSOLE_PrintTextXYN(
coPos.X += Length; coPos.X += Length;
if ((ULONG)len > Length) if (len > Length)
{ {
FillConsoleOutputCharacterA( FillConsoleOutputCharacterA(
StdOutput, StdOutput,

View file

@ -34,7 +34,9 @@
extern HANDLE StdInput, StdOutput; extern HANDLE StdInput, StdOutput;
extern SHORT xScreen, yScreen; extern SHORT xScreen, yScreen;
#include "../native/utils/console.h" BOOLEAN
CONSOLE_Init(
VOID);
VOID VOID
CONSOLE_ClearScreen(VOID); CONSOLE_ClearScreen(VOID);
@ -61,11 +63,6 @@ CONSOLE_GetCursorX(VOID);
SHORT SHORT
CONSOLE_GetCursorY(VOID); CONSOLE_GetCursorY(VOID);
VOID
CONSOLE_GetScreenSize(
OUT SHORT *maxx,
OUT SHORT *maxy);
VOID VOID
CONSOLE_InvertTextXY( CONSOLE_InvertTextXY(
IN SHORT x, IN SHORT x,

View file

@ -23,6 +23,7 @@
* PURPOSE: Text-mode setup * PURPOSE: Text-mode setup
* PROGRAMMER: Eric Kohl * PROGRAMMER: Eric Kohl
* Casper S. Hornstrup (chorns@users.sourceforge.net) * Casper S. Hornstrup (chorns@users.sourceforge.net)
* Hervé Poussineau (hpoussin@reactos.org)
*/ */
#include "usetup.h" #include "usetup.h"
@ -73,6 +74,7 @@ typedef enum _PAGE_NUMBER
HANDLE ProcessHeap; HANDLE ProcessHeap;
UNICODE_STRING SourceRootPath; UNICODE_STRING SourceRootPath;
UNICODE_STRING SourcePath;
BOOLEAN IsUnattendedSetup = FALSE; BOOLEAN IsUnattendedSetup = FALSE;
LONG UnattendDestinationDiskNumber; LONG UnattendDestinationDiskNumber;
LONG UnattendDestinationPartitionNumber; LONG UnattendDestinationPartitionNumber;
@ -86,9 +88,6 @@ static PPARTLIST PartitionList = NULL;
static PFILE_SYSTEM_LIST FileSystemList = NULL; static PFILE_SYSTEM_LIST FileSystemList = NULL;
static UNICODE_STRING SourcePath;
static UNICODE_STRING InstallPath; static UNICODE_STRING InstallPath;
/* Path to the install directory */ /* Path to the install directory */
@ -138,14 +137,111 @@ PrintString(char* fmt,...)
#define POPUP_WAIT_ANY_KEY 1 #define POPUP_WAIT_ANY_KEY 1
#define POPUP_WAIT_ENTER 2 #define POPUP_WAIT_ENTER 2
static VOID
DrawBox(
IN SHORT xLeft,
IN SHORT yTop,
IN SHORT Width,
IN SHORT Height)
{
COORD coPos;
ULONG Written;
/* draw upper left corner */
coPos.X = xLeft;
coPos.Y = yTop;
FillConsoleOutputCharacterA(
StdOutput,
0xDA, // '+',
1,
coPos,
&Written);
/* draw upper edge */
coPos.X = xLeft + 1;
coPos.Y = yTop;
FillConsoleOutputCharacterA(
StdOutput,
0xC4, // '-',
Width - 2,
coPos,
&Written);
/* draw upper right corner */
coPos.X = xLeft + Width - 1;
coPos.Y = yTop;
FillConsoleOutputCharacterA(
StdOutput,
0xBF, // '+',
1,
coPos,
&Written);
/* Draw right edge, inner space and left edge */
for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
{
coPos.X = xLeft;
FillConsoleOutputCharacterA(
StdOutput,
0xB3, // '|',
1,
coPos,
&Written);
coPos.X = xLeft + 1;
FillConsoleOutputCharacterA(
StdOutput,
' ',
Width - 2,
coPos,
&Written);
coPos.X = xLeft + Width - 1;
FillConsoleOutputCharacterA(
StdOutput,
0xB3, // '|',
1,
coPos,
&Written);
}
/* draw lower left corner */
coPos.X = xLeft;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(
StdOutput,
0xC0, // '+',
1,
coPos,
&Written);
/* draw lower edge */
coPos.X = xLeft + 1;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(
StdOutput,
0xC4, // '-',
Width - 2,
coPos,
&Written);
/* draw lower right corner */
coPos.X = xLeft + Width - 1;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(
StdOutput,
0xD9, // '+',
1,
coPos,
&Written);
}
static VOID static VOID
PopupError(PCHAR Text, PopupError(PCHAR Text,
PCHAR Status, PCHAR Status,
PINPUT_RECORD Ir, PINPUT_RECORD Ir,
ULONG WaitEvent) ULONG WaitEvent)
{ {
SHORT xScreen;
SHORT yScreen;
SHORT yTop; SHORT yTop;
SHORT xLeft; SHORT xLeft;
COORD coPos; COORD coPos;
@ -195,8 +291,6 @@ PopupError(PCHAR Text,
MaxLength = Length; MaxLength = Length;
} }
CONSOLE_GetScreenSize(&xScreen, &yScreen);
Width = MaxLength + 4; Width = MaxLength + 4;
Height = Lines + 2; Height = Lines + 2;
if (Status != NULL) if (Status != NULL)
@ -217,84 +311,7 @@ PopupError(PCHAR Text,
&Written); &Written);
} }
/* draw upper left corner */ DrawBox(xLeft, yTop, Width, Height);
coPos.X = xLeft;
coPos.Y = yTop;
FillConsoleOutputCharacterA(StdOutput,
0xDA, // '+',
1,
coPos,
&Written);
/* draw upper edge */
coPos.X = xLeft + 1;
coPos.Y = yTop;
FillConsoleOutputCharacterA(StdOutput,
0xC4, // '-',
Width - 2,
coPos,
&Written);
/* draw upper right corner */
coPos.X = xLeft + Width - 1;
coPos.Y = yTop;
FillConsoleOutputCharacterA(StdOutput,
0xBF, // '+',
1,
coPos,
&Written);
/* Draw right edge, inner space and left edge */
for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++)
{
coPos.X = xLeft;
FillConsoleOutputCharacterA(StdOutput,
0xB3, // '|',
1,
coPos,
&Written);
coPos.X = xLeft + 1;
FillConsoleOutputCharacterA(StdOutput,
' ',
Width - 2,
coPos,
&Written);
coPos.X = xLeft + Width - 1;
FillConsoleOutputCharacterA(StdOutput,
0xB3, // '|',
1,
coPos,
&Written);
}
/* draw lower left corner */
coPos.X = xLeft;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(StdOutput,
0xC0, // '+',
1,
coPos,
&Written);
/* draw lower edge */
coPos.X = xLeft + 1;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(StdOutput,
0xC4, // '-',
Width - 2,
coPos,
&Written);
/* draw lower right corner */
coPos.X = xLeft + Width - 1;
coPos.Y = yTop + Height - 1;
FillConsoleOutputCharacterA(StdOutput,
0xD9, // '+',
1,
coPos,
&Written);
/* Print message text */ /* Print message text */
coPos.Y = yTop + 1; coPos.Y = yTop + 1;
@ -628,8 +645,8 @@ SetupStartPage(PINPUT_RECORD Ir)
#endif #endif
/* Load txtsetup.sif from install media. */ /* Load txtsetup.sif from install media. */
wcscpy(FileNameBuffer, SourceRootPath.Buffer); wcscpy(FileNameBuffer, SourcePath.Buffer);
wcscat(FileNameBuffer, L"\\reactos\\txtsetup.sif"); wcscat(FileNameBuffer, L"\\txtsetup.sif");
SetupInf = SetupOpenInfFileW(FileNameBuffer, SetupInf = SetupOpenInfFileW(FileNameBuffer,
NULL, NULL,
@ -927,7 +944,10 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
ComputerList = CreateComputerTypeList(SetupInf); ComputerList = CreateComputerTypeList(SetupInf);
if (ComputerList == NULL) if (ComputerList == NULL)
{ {
/* FIXME: report error */ PopupError("Setup failed to load the computer type list.\n",
"ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
} }
} }
@ -937,7 +957,10 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
DisplayList = CreateDisplayDriverList(SetupInf); DisplayList = CreateDisplayDriverList(SetupInf);
if (DisplayList == NULL) if (DisplayList == NULL)
{ {
/* FIXME: report error */ PopupError("Setup failed to load the display settings list.\n",
"ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
} }
} }
@ -947,7 +970,10 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
KeyboardList = CreateKeyboardDriverList(SetupInf); KeyboardList = CreateKeyboardDriverList(SetupInf);
if (KeyboardList == NULL) if (KeyboardList == NULL)
{ {
/* FIXME: report error */ PopupError("Setup failed to load the keyboard type list.\n",
"ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
} }
} }
@ -1049,9 +1075,6 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
ComputerSettingsPage(PINPUT_RECORD Ir) ComputerSettingsPage(PINPUT_RECORD Ir)
{ {
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetTextXY(6, 8, "You want to change the type of computer to be installed."); CONSOLE_SetTextXY(6, 8, "You want to change the type of computer to be installed.");
CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type."); CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
@ -1060,8 +1083,6 @@ ComputerSettingsPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
CONSOLE_SetTextXY(8, 14, " the computer type."); CONSOLE_SetTextXY(8, 14, " the computer type.");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
DrawGenericList(ComputerList, DrawGenericList(ComputerList,
2, 2,
18, 18,
@ -1112,9 +1133,6 @@ ComputerSettingsPage(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
DisplaySettingsPage(PINPUT_RECORD Ir) DisplaySettingsPage(PINPUT_RECORD Ir)
{ {
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetTextXY(6, 8, "You want to change the type of display to be installed."); CONSOLE_SetTextXY(6, 8, "You want to change the type of display to be installed.");
CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type."); CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
@ -1123,8 +1141,6 @@ DisplaySettingsPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
CONSOLE_SetTextXY(8, 14, " the display type."); CONSOLE_SetTextXY(8, 14, " the display type.");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
DrawGenericList(DisplayList, DrawGenericList(DisplayList,
2, 2,
18, 18,
@ -1177,9 +1193,6 @@ DisplaySettingsPage(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
KeyboardSettingsPage(PINPUT_RECORD Ir) KeyboardSettingsPage(PINPUT_RECORD Ir)
{ {
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetTextXY(6, 8, "You want to change the type of keyboard to be installed."); CONSOLE_SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type."); CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
@ -1188,8 +1201,6 @@ KeyboardSettingsPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
CONSOLE_SetTextXY(8, 14, " the keyboard type."); CONSOLE_SetTextXY(8, 14, " the keyboard type.");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
DrawGenericList(KeyboardList, DrawGenericList(KeyboardList,
2, 2,
18, 18,
@ -1240,9 +1251,6 @@ KeyboardSettingsPage(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
LayoutSettingsPage(PINPUT_RECORD Ir) LayoutSettingsPage(PINPUT_RECORD Ir)
{ {
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetTextXY(6, 8, "You want to change the keyboard layout to be installed."); CONSOLE_SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard"); CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
@ -1251,8 +1259,6 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
CONSOLE_SetTextXY(8, 14, " the keyboard layout."); CONSOLE_SetTextXY(8, 14, " the keyboard layout.");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
DrawGenericList(LayoutList, DrawGenericList(LayoutList,
2, 2,
18, 18,
@ -1303,9 +1309,6 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
SelectPartitionPage(PINPUT_RECORD Ir) SelectPartitionPage(PINPUT_RECORD Ir)
{ {
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetTextXY(6, 8, "The list below shows existing partitions and unused disk"); CONSOLE_SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
CONSOLE_SetTextXY(6, 9, "space for new partitions."); CONSOLE_SetTextXY(6, 9, "space for new partitions.");
@ -1316,8 +1319,6 @@ SelectPartitionPage(PINPUT_RECORD Ir)
CONSOLE_SetStatusText(" Please wait..."); CONSOLE_SetStatusText(" Please wait...");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
if (PartitionList == NULL) if (PartitionList == NULL)
{ {
PartitionList = CreatePartitionList (2, PartitionList = CreatePartitionList (2,
@ -1497,7 +1498,6 @@ ShowPartitionSizeInputBox(SHORT Left,
INPUT_RECORD Ir; INPUT_RECORD Ir;
COORD coPos; COORD coPos;
ULONG Written; ULONG Written;
SHORT i;
CHAR Buffer[100]; CHAR Buffer[100];
ULONG Index; ULONG Index;
CHAR ch; CHAR ch;
@ -1510,78 +1510,7 @@ ShowPartitionSizeInputBox(SHORT Left,
if (Cancel != NULL) if (Cancel != NULL)
*Cancel = FALSE; *Cancel = FALSE;
/* draw upper left corner */ DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1);
coPos.X = Left;
coPos.Y = Top;
FillConsoleOutputCharacterA(StdOutput,
0xDA, // '+',
1,
coPos,
&Written);
/* draw upper edge */
coPos.X = Left + 1;
coPos.Y = Top;
FillConsoleOutputCharacterA(StdOutput,
0xC4, // '-',
Right - Left - 1,
coPos,
&Written);
/* draw upper right corner */
coPos.X = Right;
coPos.Y = Top;
FillConsoleOutputCharacterA(StdOutput,
0xBF, // '+',
1,
coPos,
&Written);
/* draw left and right edge */
for (i = Top + 1; i < Bottom; i++)
{
coPos.X = Left;
coPos.Y = i;
FillConsoleOutputCharacterA(StdOutput,
0xB3, // '|',
1,
coPos,
&Written);
coPos.X = Right;
FillConsoleOutputCharacterA(StdOutput,
0xB3, //'|',
1,
coPos,
&Written);
}
/* draw lower left corner */
coPos.X = Left;
coPos.Y = Bottom;
FillConsoleOutputCharacterA(StdOutput,
0xC0, // '+',
1,
coPos,
&Written);
/* draw lower edge */
coPos.X = Left + 1;
coPos.Y = Bottom;
FillConsoleOutputCharacterA(StdOutput,
0xC4, // '-',
Right - Left - 1,
coPos,
&Written);
/* draw lower right corner */
coPos.X = Right;
coPos.Y = Bottom;
FillConsoleOutputCharacterA(StdOutput,
0xD9, // '+',
1,
coPos,
&Written);
/* Print message */ /* Print message */
coPos.X = Left + 2; coPos.X = Left + 2;
@ -1671,8 +1600,6 @@ CreatePartitionPage (PINPUT_RECORD Ir)
{ {
PDISKENTRY DiskEntry; PDISKENTRY DiskEntry;
PPARTENTRY PartEntry; PPARTENTRY PartEntry;
SHORT xScreen;
SHORT yScreen;
BOOLEAN Quit; BOOLEAN Quit;
BOOLEAN Cancel; BOOLEAN Cancel;
CHAR InputBuffer[50]; CHAR InputBuffer[50];
@ -1694,8 +1621,6 @@ CreatePartitionPage (PINPUT_RECORD Ir)
CONSOLE_SetStatusText (" Please wait..."); CONSOLE_SetStatusText (" Please wait...");
CONSOLE_GetScreenSize (&xScreen, &yScreen);
CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on"); CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on");
#if 0 #if 0
@ -2121,7 +2046,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
if (FileSystemList == NULL) if (FileSystemList == NULL)
{ {
FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, "FAT"); FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, L"FAT");
if (FileSystemList == NULL) if (FileSystemList == NULL)
{ {
/* FIXME: show an error dialog */ /* FIXME: show an error dialog */
@ -2243,7 +2168,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED) if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
{ {
if (strcmp(FileSystemList->Selected->FileSystem, "FAT") == 0) if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
{ {
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200LL * 1024LL)) if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200LL * 1024LL))
{ {
@ -2287,7 +2212,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
} }
break; break;
} }
else if (FileSystemList->Selected->FormatFunc) else if (!FileSystemList->Selected->FormatFunc)
return QUIT_PAGE; return QUIT_PAGE;
} }
@ -2382,7 +2307,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
CheckActiveBootPartition(PartitionList); CheckActiveBootPartition(PartitionList);
} }
if (strcmp(FileSystemList->Selected->FileSystem, "FAT") == 0) if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
{ {
/* FIXME: Install boot code. This is a hack! */ /* FIXME: Install boot code. This is a hack! */
if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13)
@ -2482,7 +2407,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
if (!CurrentFileSystem->ChkdskFunc) if (!CurrentFileSystem->ChkdskFunc)
{ {
sprintf(Buffer, sprintf(Buffer,
"Setup is currently unable to check a partition formatted in %s.\n" "Setup is currently unable to check a partition formatted in %S.\n"
"\n" "\n"
" \x07 Press ENTER to continue Setup.\n" " \x07 Press ENTER to continue Setup.\n"
" \x07 Press F3 to quit Setup.", " \x07 Press F3 to quit Setup.",
@ -2664,11 +2589,11 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
return(INSTALL_DIRECTORY_PAGE); return(INSTALL_DIRECTORY_PAGE);
} }
static BOOLEAN static BOOLEAN
AddSectionToCopyQueue(HINF InfFile, AddSectionToCopyQueue(HINF InfFile,
PWCHAR SectionName, PWCHAR SectionName,
PWCHAR SourceCabinet, PWCHAR SourceCabinet,
PCUNICODE_STRING DestinationPath,
PINPUT_RECORD Ir) PINPUT_RECORD Ir)
{ {
INFCONTEXT FilesContext; INFCONTEXT FilesContext;
@ -2752,7 +2677,7 @@ PrepareCopyPageInfFile(HINF InfFile,
NTSTATUS Status; NTSTATUS Status;
/* Add common files */ /* Add common files */
if (!AddSectionToCopyQueue(InfFile, L"SourceFiles", SourceCabinet, Ir)) if (!AddSectionToCopyQueue(InfFile, L"SourceFiles", SourceCabinet, &DestinationPath, Ir))
return FALSE; return FALSE;
/* Add specific files depending of computer type */ /* Add specific files depending of computer type */
@ -2762,7 +2687,7 @@ PrepareCopyPageInfFile(HINF InfFile,
return FALSE; return FALSE;
if (AdditionalSectionName) if (AdditionalSectionName)
{ {
if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, Ir)) if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir))
return FALSE; return FALSE;
} }
} }
@ -2857,7 +2782,6 @@ PrepareCopyPageInfFile(HINF InfFile,
return(TRUE); return(TRUE);
} }
static PAGE_NUMBER static PAGE_NUMBER
PrepareCopyPage(PINPUT_RECORD Ir) PrepareCopyPage(PINPUT_RECORD Ir)
{ {
@ -2882,7 +2806,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
Ir, POPUP_WAIT_ENTER); Ir, POPUP_WAIT_ENTER);
return(QUIT_PAGE); return(QUIT_PAGE);
} }
if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir)) if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir))
{ {
return QUIT_PAGE; return QUIT_PAGE;
@ -2907,6 +2831,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
wcscat(PathBuffer, L"\\"); wcscat(PathBuffer, L"\\");
wcscat(PathBuffer, KeyValue); wcscat(PathBuffer, KeyValue);
#ifdef __REACTOS__
CabinetInitialize(); CabinetInitialize();
CabinetSetEventHandlers(NULL, NULL, NULL); CabinetSetEventHandlers(NULL, NULL, NULL);
CabinetSetCabinetName(PathBuffer); CabinetSetCabinetName(PathBuffer);
@ -2953,6 +2878,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
{ {
return QUIT_PAGE; return QUIT_PAGE;
} }
#endif
} }
while (SetupFindNextLine (&CabinetsContext, &CabinetsContext)); while (SetupFindNextLine (&CabinetsContext, &CabinetsContext));
@ -2997,8 +2923,6 @@ static PAGE_NUMBER
FileCopyPage(PINPUT_RECORD Ir) FileCopyPage(PINPUT_RECORD Ir)
{ {
COPYCONTEXT CopyContext; COPYCONTEXT CopyContext;
SHORT xScreen;
SHORT yScreen;
CONSOLE_SetStatusText(" \xB3 Please wait... "); CONSOLE_SetStatusText(" \xB3 Please wait... ");
@ -3006,7 +2930,6 @@ FileCopyPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(30, 13, "installation folder."); CONSOLE_SetTextXY(30, 13, "installation folder.");
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete."); CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
CONSOLE_GetScreenSize(&xScreen, &yScreen);
CopyContext.DestinationRootPath = DestinationRootPath.Buffer; CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
CopyContext.InstallPath = InstallPath.Buffer; CopyContext.InstallPath = InstallPath.Buffer;
CopyContext.TotalOperations = 0; CopyContext.TotalOperations = 0;
@ -3054,6 +2977,7 @@ RegistryPage(PINPUT_RECORD Ir)
} }
/* Create the default hives */ /* Create the default hives */
#ifdef __REACTOS__
Status = NtInitializeRegistry(TRUE); Status = NtInitializeRegistry(TRUE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -3063,6 +2987,9 @@ RegistryPage(PINPUT_RECORD Ir)
Ir, POPUP_WAIT_ENTER); Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE; return QUIT_PAGE;
} }
#else
RegInitializeRegistry();
#endif
/* Update registry */ /* Update registry */
CONSOLE_SetStatusText(" Updating registry hives..."); CONSOLE_SetStatusText(" Updating registry hives...");
@ -3484,22 +3411,13 @@ FlushPage(PINPUT_RECORD Ir)
} }
static VOID VOID
RunUSetup(VOID) RunUSetup(VOID)
{ {
INPUT_RECORD Ir; INPUT_RECORD Ir;
PAGE_NUMBER Page; PAGE_NUMBER Page;
BOOL ret;
ret = AllocConsole(); if (!CONSOLE_Init())
if (!ret)
ret = AttachConsole(ATTACH_PARENT_PROCESS);
if (!ret
#ifdef WIN32_USETUP
&& GetLastError() != ERROR_ACCESS_DENIED
#endif
)
{ {
PrintString("Unable to open the console\n\n"); PrintString("Unable to open the console\n\n");
PrintString("The most common cause of this is using an USB keyboard\n"); PrintString("The most common cause of this is using an USB keyboard\n");
@ -3509,17 +3427,6 @@ RunUSetup(VOID)
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
0,0,0,0,0); 0,0,0,0,0);
} }
else
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
StdInput = GetStdHandle(STD_INPUT_HANDLE);
StdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(StdOutput, &csbi);
xScreen = csbi.dwSize.X;
yScreen = csbi.dwSize.Y;
}
/* Initialize global unicode strings */ /* Initialize global unicode strings */
RtlInitUnicodeString(&SourcePath, NULL); RtlInitUnicodeString(&SourcePath, NULL);
@ -3680,16 +3587,7 @@ RunUSetup(VOID)
} }
#ifdef WIN32_USETUP #ifdef __REACTOS__
int
main(void)
{
ProcessHeap = GetProcessHeap();
RunUSetup();
return 0;
}
#else
VOID NTAPI VOID NTAPI
NtProcessStartup(PPEB Peb) NtProcessStartup(PPEB Peb)
@ -3700,6 +3598,6 @@ NtProcessStartup(PPEB Peb)
INF_SetHeap(ProcessHeap); INF_SetHeap(ProcessHeap);
RunUSetup(); RunUSetup();
} }
#endif /* !WIN32_USETUP */ #endif /* __REACTOS__ */
/* EOF */ /* EOF */

View file

@ -0,0 +1,8 @@
#include "host_native.h"
BOOLEAN
NATIVE_InitConsole(
VOID)
{
return (BOOLEAN)AllocConsole();
}

View file

@ -0,0 +1,32 @@
#include "usetup.h"
/* Filesystem headers */
#include <fslib/vfatlib.h>
#include <fslib/vfatxlib.h>
BOOLEAN
NATIVE_CreateFileSystemList(
IN PFILE_SYSTEM_LIST List)
{
FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk);
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);
}

View file

@ -0,0 +1,16 @@
#ifndef _HOST_NATIVE_H_
#define _HOST_NATIVE_H_
#include "usetup.h"
typedef struct
{
PWCHAR Source;
PWCHAR Target;
} *PFILEPATHS_W;
#define SetupInitDefaultQueueCallback(a) NULL
#define SetupDefaultQueueCallbackW(a, b, c, d) TRUE
#define SetupTermDefaultQueueCallback(a)
#endif /* _HOST_NATIVE_H_ */

View file

@ -27,24 +27,17 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include "usetup.h" #include "usetup.h"
/* Blue Driver Header */
#include <blue/ntddblue.h>
#include "keytrans.h"
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS ******************************************************************/
HANDLE StdInput = INVALID_HANDLE_VALUE;
HANDLE StdOutput = INVALID_HANDLE_VALUE;
SHORT xScreen = 0;
SHORT yScreen = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#ifndef WIN32_USETUP
BOOL WINAPI BOOL WINAPI
ConAllocConsole(VOID) AllocConsole(VOID)
{ {
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen"); UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0"); UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
@ -90,14 +83,14 @@ ConAllocConsole(VOID)
} }
BOOL WINAPI BOOL WINAPI
ConAttachConsole( AttachConsole(
IN DWORD dwProcessId) IN DWORD dwProcessId)
{ {
return FALSE; return FALSE;
} }
BOOL WINAPI BOOL WINAPI
ConFreeConsole(VOID) FreeConsole(VOID)
{ {
DPRINT("FreeConsole() called\n"); DPRINT("FreeConsole() called\n");
@ -112,7 +105,7 @@ ConFreeConsole(VOID)
} }
BOOL WINAPI BOOL WINAPI
ConWriteConsole( WriteConsole(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN const VOID* lpBuffer, IN const VOID* lpBuffer,
IN DWORD nNumberOfCharsToWrite, IN DWORD nNumberOfCharsToWrite,
@ -140,7 +133,7 @@ ConWriteConsole(
} }
HANDLE WINAPI HANDLE WINAPI
ConGetStdHandle( GetStdHandle(
IN DWORD nStdHandle) IN DWORD nStdHandle)
{ {
switch (nStdHandle) switch (nStdHandle)
@ -155,7 +148,7 @@ ConGetStdHandle(
} }
BOOL WINAPI BOOL WINAPI
ConReadConsoleInput( ReadConsoleInput(
IN HANDLE hConsoleInput, IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer, OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength, IN DWORD nLength,
@ -188,7 +181,7 @@ ConReadConsoleInput(
} }
BOOL WINAPI BOOL WINAPI
ConWriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
HANDLE hConsoleOutput, HANDLE hConsoleOutput,
IN LPCSTR lpCharacter, IN LPCSTR lpCharacter,
IN DWORD nLength, IN DWORD nLength,
@ -235,7 +228,7 @@ ConWriteConsoleOutputCharacterA(
} }
BOOL WINAPI BOOL WINAPI
ConWriteConsoleOutputCharacterW( WriteConsoleOutputCharacterW(
HANDLE hConsoleOutput, HANDLE hConsoleOutput,
IN LPCWSTR lpCharacter, IN LPCWSTR lpCharacter,
IN DWORD nLength, IN DWORD nLength,
@ -287,7 +280,7 @@ ConWriteConsoleOutputCharacterW(
} }
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputAttribute( FillConsoleOutputAttribute(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN WORD wAttribute, IN WORD wAttribute,
IN DWORD nLength, IN DWORD nLength,
@ -322,7 +315,7 @@ ConFillConsoleOutputAttribute(
} }
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputCharacterA( FillConsoleOutputCharacterA(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN CHAR cCharacter, IN CHAR cCharacter,
IN DWORD nLength, IN DWORD nLength,
@ -356,7 +349,7 @@ ConFillConsoleOutputCharacterA(
} }
BOOL WINAPI BOOL WINAPI
ConGetConsoleScreenBufferInfo( GetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
{ {
@ -378,7 +371,7 @@ ConGetConsoleScreenBufferInfo(
} }
BOOL WINAPI BOOL WINAPI
ConSetConsoleCursorInfo( SetConsoleCursorInfo(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo) IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo)
{ {
@ -400,7 +393,7 @@ ConSetConsoleCursorInfo(
} }
BOOL WINAPI BOOL WINAPI
ConSetConsoleCursorPosition( SetConsoleCursorPosition(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition) IN COORD dwCursorPosition)
{ {
@ -431,7 +424,7 @@ ConSetConsoleCursorPosition(
} }
BOOL WINAPI BOOL WINAPI
ConSetConsoleTextAttribute( SetConsoleTextAttribute(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN WORD wAttributes) IN WORD wAttributes)
{ {
@ -452,6 +445,4 @@ ConSetConsoleTextAttribute(
return NT_SUCCESS(Status); return NT_SUCCESS(Status);
} }
#endif /* !WIN32_USETUP */
/* EOF */ /* EOF */

View file

@ -24,51 +24,18 @@
* PROGRAMMER: Eric Kohl * PROGRAMMER: Eric Kohl
*/ */
#ifndef __CONSOLE_H__ #ifndef _UTILS_CONSOLE_H_
#define __CONSOLE_H__ #define _UTILS_CONSOLE_H_
#define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
#define FOREGROUND_YELLOW (FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN)
#define BACKGROUND_WHITE (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
extern HANDLE StdInput, StdOutput;
extern SHORT xScreen, yScreen;
#ifdef WIN32_USETUP
#define NtDisplayString(str) printf("%S", (str)->Buffer)
#define NtRaiseHardError(status, a, b, c, d, e) exit(1)
#else /* WIN32_USETUP */
#undef WriteConsole
#undef ReadConsoleInput
#undef FillConsoleOutputCharacter
#define AllocConsole ConAllocConsole
#define AttachConsole ConAttachConsole
#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute
#define FillConsoleOutputCharacterA ConFillConsoleOutputCharacterA
#define FreeConsole ConFreeConsole
#define GetConsoleScreenBufferInfo ConGetConsoleScreenBufferInfo
#define GetStdHandle ConGetStdHandle
#define ReadConsoleInput ConReadConsoleInput
#define SetConsoleCursorInfo ConSetConsoleCursorInfo
#define SetConsoleCursorPosition ConSetConsoleCursorPosition
#define SetConsoleTextAttribute ConSetConsoleTextAttribute
#define WriteConsole ConWriteConsole
#define WriteConsoleOutputCharacterA ConWriteConsoleOutputCharacterA
#define WriteConsoleOutputCharacterW ConWriteConsoleOutputCharacterW
BOOL WINAPI BOOL WINAPI
ConAllocConsole(VOID); AllocConsole(VOID);
BOOL WINAPI BOOL WINAPI
ConAttachConsole( AttachConsole(
IN DWORD dwProcessId); IN DWORD dwProcessId);
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputAttribute( FillConsoleOutputAttribute(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN WORD wAttribute, IN WORD wAttribute,
IN DWORD nLength, IN DWORD nLength,
@ -76,7 +43,7 @@ ConFillConsoleOutputAttribute(
OUT LPDWORD lpNumberOfAttrsWritten); OUT LPDWORD lpNumberOfAttrsWritten);
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputCharacterA( FillConsoleOutputCharacterA(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN CHAR cCharacter, IN CHAR cCharacter,
IN DWORD nLength, IN DWORD nLength,
@ -84,41 +51,41 @@ ConFillConsoleOutputCharacterA(
OUT LPDWORD lpNumberOfCharsWritten); OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI BOOL WINAPI
ConFreeConsole(VOID); FreeConsole(VOID);
BOOL WINAPI BOOL WINAPI
ConGetConsoleScreenBufferInfo( GetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
HANDLE WINAPI HANDLE WINAPI
ConGetStdHandle( GetStdHandle(
IN DWORD nStdHandle); IN DWORD nStdHandle);
BOOL WINAPI BOOL WINAPI
ConReadConsoleInput( ReadConsoleInput(
IN HANDLE hConsoleInput, IN HANDLE hConsoleInput,
OUT PINPUT_RECORD lpBuffer, OUT PINPUT_RECORD lpBuffer,
IN DWORD nLength, IN DWORD nLength,
OUT LPDWORD lpNumberOfEventsRead); OUT LPDWORD lpNumberOfEventsRead);
BOOL WINAPI BOOL WINAPI
ConSetConsoleCursorInfo( SetConsoleCursorInfo(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo); IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo);
BOOL WINAPI BOOL WINAPI
ConSetConsoleCursorPosition( SetConsoleCursorPosition(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN COORD dwCursorPosition); IN COORD dwCursorPosition);
BOOL WINAPI BOOL WINAPI
ConSetConsoleTextAttribute( SetConsoleTextAttribute(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN WORD wAttributes); IN WORD wAttributes);
BOOL WINAPI BOOL WINAPI
ConWriteConsole( WriteConsole(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
IN const VOID* lpBuffer, IN const VOID* lpBuffer,
IN DWORD nNumberOfCharsToWrite, IN DWORD nNumberOfCharsToWrite,
@ -126,7 +93,7 @@ ConWriteConsole(
IN LPVOID lpReserved); IN LPVOID lpReserved);
BOOL WINAPI BOOL WINAPI
ConWriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
HANDLE hConsoleOutput, HANDLE hConsoleOutput,
IN LPCSTR lpCharacter, IN LPCSTR lpCharacter,
IN DWORD nLength, IN DWORD nLength,
@ -134,23 +101,13 @@ ConWriteConsoleOutputCharacterA(
OUT LPDWORD lpNumberOfCharsWritten); OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI BOOL WINAPI
ConWriteConsoleOutputCharacterA( WriteConsoleOutputCharacterA(
HANDLE hConsoleOutput, HANDLE hConsoleOutput,
IN LPCSTR lpCharacter, IN LPCSTR lpCharacter,
IN DWORD nLength, IN DWORD nLength,
IN COORD dwWriteCoord, IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten); OUT LPDWORD lpNumberOfCharsWritten);
BOOL WINAPI #endif /* _UTILS_CONSOLE_H_ */
ConWriteConsoleOutputCharacterW(
HANDLE hConsoleOutput,
IN LPCWSTR lpCharacter,
IN DWORD nLength,
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
#endif /* !WIN32_USETUP */
#endif /* __CONSOLE_H__*/
/* EOF */ /* EOF */

View file

@ -26,6 +26,7 @@
* NB: Hardcoded to US keyboard * NB: Hardcoded to US keyboard
*/ */
#include "usetup.h" #include "usetup.h"
#include "keytrans.h"
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/keytrans.h * FILE: subsys/system/usetup/keytrans.h
* PURPOSE: Keyboard translation functionality * PURPOSE: Keyboard translation functionality

View file

@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id$ /* COPYRIGHT: See COPYING in the top level directory
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup * PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/partlist.c * FILE: subsys/system/usetup/partlist.c
* PURPOSE: Partition list functions * PURPOSE: Partition list functions
@ -457,31 +456,33 @@ DiskConfigurationDataQueryRoutine(PWSTR ValueName,
PVOID Context, PVOID Context,
PVOID EntryContext) PVOID EntryContext)
{ {
PBIOSDISKENTRY BiosDiskEntry = (PBIOSDISKENTRY)Context; PBIOSDISKENTRY BiosDiskEntry = (PBIOSDISKENTRY)Context;
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
ULONG i;
if (ValueType == REG_FULL_RESOURCE_DESCRIPTOR && if (ValueType != REG_FULL_RESOURCE_DESCRIPTOR ||
ValueLength == sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + sizeof(CM_DISK_GEOMETRY_DEVICE_DATA)) ValueLength < sizeof(CM_FULL_RESOURCE_DESCRIPTOR))
{ return STATUS_UNSUCCESSFUL;
FullResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)ValueData;
/* FIXME:
* Is this 'paranoia' check correct ?
*/
if (FullResourceDescriptor->InterfaceType != InterfaceTypeUndefined ||
FullResourceDescriptor->BusNumber != 0 ||
FullResourceDescriptor->PartialResourceList.Count != 1 ||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type != CmResourceTypeDeviceSpecific ||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize != sizeof(CM_DISK_GEOMETRY_DEVICE_DATA))
{
return STATUS_UNSUCCESSFUL;
}
DiskGeometry = (PCM_DISK_GEOMETRY_DEVICE_DATA)(FullResourceDescriptor + 1);
BiosDiskEntry->DiskGeometry = *DiskGeometry;
return STATUS_SUCCESS; FullResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)ValueData;
} /* Hm. Version and Revision are not set on Microsoft Windows XP... */
return STATUS_UNSUCCESSFUL; /*if (FullResourceDescriptor->PartialResourceList.Version != 1 ||
FullResourceDescriptor->PartialResourceList.Revision != 1)
return STATUS_UNSUCCESSFUL;*/
for (i = 0; i < FullResourceDescriptor->PartialResourceList.Count; i++)
{
if (FullResourceDescriptor->PartialResourceList.PartialDescriptors[i].Type != CmResourceTypeDeviceSpecific ||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[i].u.DeviceSpecificData.DataSize != sizeof(CM_DISK_GEOMETRY_DEVICE_DATA))
continue;
DiskGeometry = (PCM_DISK_GEOMETRY_DEVICE_DATA)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[i + 1];
BiosDiskEntry->DiskGeometry = *DiskGeometry;
return STATUS_SUCCESS;
}
return STATUS_UNSUCCESSFUL;
} }
NTSTATUS NTSTATUS
@ -493,31 +494,36 @@ SystemConfigurationDataQueryRoutine(PWSTR ValueName,
PVOID Context, PVOID Context,
PVOID EntryContext) PVOID EntryContext)
{ {
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_INT13_DRIVE_PARAMETER* Int13Drives = (PCM_INT13_DRIVE_PARAMETER*)Context; PCM_INT13_DRIVE_PARAMETER* Int13Drives = (PCM_INT13_DRIVE_PARAMETER*)Context;
ULONG i;
if (ValueType == REG_FULL_RESOURCE_DESCRIPTOR && if (ValueType != REG_FULL_RESOURCE_DESCRIPTOR ||
ValueLength >= sizeof (CM_FULL_RESOURCE_DESCRIPTOR) && ValueLength < sizeof (CM_FULL_RESOURCE_DESCRIPTOR))
(ValueLength - sizeof(CM_FULL_RESOURCE_DESCRIPTOR)) % sizeof(CM_INT13_DRIVE_PARAMETER) == 0) return STATUS_UNSUCCESSFUL;
{
FullResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)ValueData;
if (FullResourceDescriptor->InterfaceType != InterfaceTypeUndefined ||
FullResourceDescriptor->BusNumber != -1 ||
FullResourceDescriptor->PartialResourceList.Count != 1 ||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type != CmResourceTypeDeviceSpecific)
{
return STATUS_UNSUCCESSFUL;
}
*Int13Drives = RtlAllocateHeap(ProcessHeap, 0, ValueLength - sizeof (CM_FULL_RESOURCE_DESCRIPTOR));
if (*Int13Drives == NULL)
{
return STATUS_NO_MEMORY;
}
memcpy(*Int13Drives, FullResourceDescriptor + 1, ValueLength - sizeof (CM_FULL_RESOURCE_DESCRIPTOR));
return STATUS_SUCCESS;
}
return STATUS_UNSUCCESSFUL;
FullResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)ValueData;
/* Hm. Version and Revision are not set on Microsoft Windows XP... */
/*if (FullResourceDescriptor->PartialResourceList.Version != 1 ||
FullResourceDescriptor->PartialResourceList.Revision != 1)
return STATUS_UNSUCCESSFUL;*/
for (i = 0; i < FullResourceDescriptor->PartialResourceList.Count; i++)
{
if (FullResourceDescriptor->PartialResourceList.PartialDescriptors[i].Type != CmResourceTypeDeviceSpecific ||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[i].u.DeviceSpecificData.DataSize != sizeof(CM_INT13_DRIVE_PARAMETER))
continue;
*Int13Drives = RtlAllocateHeap(ProcessHeap, 0, sizeof(CM_INT13_DRIVE_PARAMETER));
if (*Int13Drives == NULL)
return STATUS_NO_MEMORY;
memcpy(
*Int13Drives,
&FullResourceDescriptor->PartialResourceList.PartialDescriptors[i + 1],
sizeof(CM_INT13_DRIVE_PARAMETER));
return STATUS_SUCCESS;
}
return STATUS_UNSUCCESSFUL;
} }
#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter" #define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"
@ -948,7 +954,7 @@ CreatePartitionList (SHORT Left,
&Iosb, &Iosb,
FILE_SHARE_READ, FILE_SHARE_READ,
FILE_SYNCHRONOUS_IO_NONALERT); FILE_SYNCHRONOUS_IO_NONALERT);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
AddDiskToList (FileHandle, AddDiskToList (FileHandle,
DiskNumber, DiskNumber,

View file

@ -31,6 +31,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#ifdef __REACTOS__
#define FLG_ADDREG_BINVALUETYPE 0x00000001 #define FLG_ADDREG_BINVALUETYPE 0x00000001
#define FLG_ADDREG_NOCLOBBER 0x00000002 #define FLG_ADDREG_NOCLOBBER 0x00000002
#define FLG_ADDREG_DELVAL 0x00000004 #define FLG_ADDREG_DELVAL 0x00000004
@ -44,6 +45,7 @@
#define FLG_ADDREG_TYPE_DWORD (0x00010000 | FLG_ADDREG_BINVALUETYPE) #define FLG_ADDREG_TYPE_DWORD (0x00010000 | FLG_ADDREG_BINVALUETYPE)
#define FLG_ADDREG_TYPE_NONE (0x00020000 | FLG_ADDREG_BINVALUETYPE) #define FLG_ADDREG_TYPE_NONE (0x00020000 | FLG_ADDREG_BINVALUETYPE)
#define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE) #define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
#endif
#include <pshpack1.h> #include <pshpack1.h>
@ -201,11 +203,11 @@ do_reg_operation(HANDLE KeyHandle,
#if 0 #if 0
if (ValueName) if (ValueName)
{ {
RegDeleteValueW( hkey, value ); RegDeleteValueW( KeyHandle, ValueName );
} }
else else
{ {
RegDeleteKeyW( hkey, NULL ); RegDeleteKeyW( KeyHandle, NULL );
} }
#endif #endif
return TRUE; return TRUE;
@ -308,12 +310,16 @@ do_reg_operation(HANDLE KeyHandle,
DPRINT("setting dword %wZ to %lx\n", ValueName, dw); DPRINT("setting dword %wZ to %lx\n", ValueName, dw);
#ifdef __REACTOS__
NtSetValueKey (KeyHandle, NtSetValueKey (KeyHandle,
ValueName, ValueName,
0, 0,
Type, Type,
(PVOID)&dw, (PVOID)&dw,
sizeof(ULONG)); sizeof(ULONG));
#else
RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)&dw, sizeof(ULONG));
#endif
} }
else else
{ {
@ -321,21 +327,29 @@ do_reg_operation(HANDLE KeyHandle,
if (Str) if (Str)
{ {
#ifdef __REACTOS__
NtSetValueKey (KeyHandle, NtSetValueKey (KeyHandle,
ValueName, ValueName,
0, 0,
Type, Type,
(PVOID)Str, (PVOID)Str,
Size * sizeof(WCHAR)); Size * sizeof(WCHAR));
#else
RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)Str, Size * sizeof(WCHAR));
#endif
} }
else else
{ {
#ifdef __REACTOS__
NtSetValueKey (KeyHandle, NtSetValueKey (KeyHandle,
ValueName, ValueName,
0, 0,
Type, Type,
(PVOID)&EmptyStr, (PVOID)&EmptyStr,
sizeof(WCHAR)); sizeof(WCHAR));
#else
RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)&EmptyStr, sizeof(WCHAR));
#endif
} }
} }
RtlFreeHeap (ProcessHeap, 0, Str); RtlFreeHeap (ProcessHeap, 0, Str);
@ -357,12 +371,16 @@ do_reg_operation(HANDLE KeyHandle,
SetupGetBinaryField (Context, 5, Data, Size, NULL); SetupGetBinaryField (Context, 5, Data, Size, NULL);
} }
#ifdef __REACTOS__
NtSetValueKey (KeyHandle, NtSetValueKey (KeyHandle,
ValueName, ValueName,
0, 0,
Type, Type,
(PVOID)Data, (PVOID)Data,
Size); Size);
#else
RegSetValueExW(KeyHandle, ValueName, 0, Type, (const UCHAR*)Data, Size);
#endif
RtlFreeHeap (ProcessHeap, 0, Data); RtlFreeHeap (ProcessHeap, 0, Data);
} }
@ -370,7 +388,7 @@ do_reg_operation(HANDLE KeyHandle,
return TRUE; return TRUE;
} }
#ifdef __REACTOS__
NTSTATUS NTSTATUS
CreateNestedKey (PHANDLE KeyHandle, CreateNestedKey (PHANDLE KeyHandle,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
@ -465,7 +483,7 @@ CreateNestedKey (PHANDLE KeyHandle,
return Status; return Status;
} }
#endif
/*********************************************************************** /***********************************************************************
* registry_callback * registry_callback
@ -514,6 +532,7 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete)
DPRINT("Flags: %lx\n", Flags); DPRINT("Flags: %lx\n", Flags);
#ifdef __REACTOS__
RtlInitUnicodeString (&Name, RtlInitUnicodeString (&Name,
Buffer); Buffer);
@ -545,6 +564,26 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete)
continue; 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 */ /* get value name */
if (SetupGetStringFieldW (&Context, 3, Buffer, MAX_INF_STRING_LENGTH, NULL)) if (SetupGetStringFieldW (&Context, 3, Buffer, MAX_INF_STRING_LENGTH, NULL))
@ -565,7 +604,9 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete)
return FALSE; return FALSE;
} }
#ifdef __REACTOS__
NtClose (KeyHandle); NtClose (KeyHandle);
#endif
} }
} }
@ -583,8 +624,8 @@ ImportRegistryFile(PWSTR Filename,
UINT ErrorLine; UINT ErrorLine;
/* Load inf file from install media. */ /* Load inf file from install media. */
wcscpy(FileNameBuffer, SourceRootPath.Buffer); wcscpy(FileNameBuffer, SourcePath.Buffer);
wcscat(FileNameBuffer, L"\\reactos\\"); wcscat(FileNameBuffer, L"\\");
wcscat(FileNameBuffer, Filename); wcscat(FileNameBuffer, Filename);
hInf = SetupOpenInfFileW( hInf = SetupOpenInfFileW(

View file

@ -45,9 +45,6 @@
/* DDK Disk Headers */ /* DDK Disk Headers */
#include <ntddscsi.h> #include <ntddscsi.h>
/* Blue Driver Header */
#include <blue/ntddblue.h>
/* Helper Header */ /* Helper Header */
#include <reactos/helper.h> #include <reactos/helper.h>
@ -56,13 +53,13 @@
/* Internal Headers */ /* Internal Headers */
#include "interface/consup.h" #include "interface/consup.h"
#include "native/utils/console.h"
#include "native/utils/keytrans.h"
#include "partlist.h" #include "partlist.h"
#include "inffile.h" #include "inffile.h"
#include "inicache.h" #include "inicache.h"
#include "progress.h" #include "progress.h"
#ifdef __REACTOS__
#include "filequeue.h" #include "filequeue.h"
#endif
#include "bootsup.h" #include "bootsup.h"
#include "registry.h" #include "registry.h"
#include "fslist.h" #include "fslist.h"
@ -73,12 +70,13 @@
#include "drivesup.h" #include "drivesup.h"
#include "genlist.h" #include "genlist.h"
#include "settings.h" #include "settings.h"
#include "host.h"
extern HANDLE ProcessHeap; extern HANDLE ProcessHeap;
extern UNICODE_STRING SourceRootPath; extern UNICODE_STRING SourceRootPath;
extern UNICODE_STRING SourcePath;
extern BOOLEAN IsUnattendedSetup; extern BOOLEAN IsUnattendedSetup;
#endif /* __USETUP_H__*/ #endif /* __USETUP_H__*/
/* EOF */ /* EOF */

View file

@ -8,38 +8,38 @@
<define name="_DISABLE_TIDENTS" /> <define name="_DISABLE_TIDENTS" />
<define name="_WIN32_WINNT">0x0502</define> <define name="_WIN32_WINNT">0x0502</define>
<define name="__NO_CTYPE_INLINES" /> <define name="__NO_CTYPE_INLINES" />
<define name="__REACTOS__" />
<linkerflag>-lgcc</linkerflag> <linkerflag>-lgcc</linkerflag>
<library>zlib</library> <library>zlib</library>
<library>inflib</library> <library>inflib</library>
<library>vfatlib</library> <library>vfatlib</library>
<library>ntdll</library> <library>ntdll</library>
<pch>usetup.h</pch> <directory name="interface">
<compilationunit name="unit.c"> <file>consup.c</file>
<directory name="interface"> <file>usetup.c</file>
<file>consup.c</file> </directory>
<file>usetup.c</file> <directory name="native">
<directory name="utils">
<file>console.c</file>
<file>keytrans.c</file>
</directory> </directory>
<directory name="native"> <file>console.c</file>
<directory name="utils">
<file>console.c</file>
<file>keytrans.c</file>
</directory>
</directory>
<file>bootsup.c</file>
<file>cabinet.c</file>
<file>chkdsk.c</file>
<file>drivesup.c</file>
<file>filequeue.c</file>
<file>filesup.c</file>
<file>format.c</file>
<file>fslist.c</file> <file>fslist.c</file>
<file>genlist.c</file> </directory>
<file>inffile.c</file> <file>bootsup.c</file>
<file>inicache.c</file> <file>cabinet.c</file>
<file>partlist.c</file> <file>chkdsk.c</file>
<file>progress.c</file> <file>drivesup.c</file>
<file>registry.c</file> <file>filequeue.c</file>
<file>settings.c</file> <file>filesup.c</file>
</compilationunit> <file>format.c</file>
<file>fslist.c</file>
<file>genlist.c</file>
<file>inffile.c</file>
<file>inicache.c</file>
<file>partlist.c</file>
<file>progress.c</file>
<file>registry.c</file>
<file>settings.c</file>
<file>usetup.rc</file> <file>usetup.rc</file>
</module> </module>

View file

@ -3,4 +3,6 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Setup\0" #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Setup\0"
#define REACTOS_STR_INTERNAL_NAME "usetup\0" #define REACTOS_STR_INTERNAL_NAME "usetup\0"
#define REACTOS_STR_ORIGINAL_FILENAME "usetup.dll\0" #define REACTOS_STR_ORIGINAL_FILENAME "usetup.dll\0"
#ifdef __REACTOS__
#include <reactos/version.rc> #include <reactos/version.rc>
#endif