diff --git a/reactos/base/setup/usetup/bootsup.c b/reactos/base/setup/usetup/bootsup.c index 52bca9d4989..2d962a4e1ad 100644 --- a/reactos/base/setup/usetup/bootsup.c +++ b/reactos/base/setup/usetup/bootsup.c @@ -1787,10 +1787,10 @@ UpdateBootIni(PWSTR BootIniPath, return(Status); } - BOOLEAN CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath) { +#ifdef __REACTOS__ if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") || DoesFileExist(SystemRootPath->Buffer, L"boot.ini")) { @@ -1801,6 +1801,7 @@ CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath) { return TRUE; } +#endif return FALSE; } @@ -1812,6 +1813,7 @@ InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath, PUNICODE_STRING DestinationArcPath, UCHAR PartitionType) { +#ifdef __REACTOS__ WCHAR SrcPath[MAX_PATH]; WCHAR DstPath[MAX_PATH]; NTSTATUS Status; @@ -2117,6 +2119,9 @@ InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath, } return STATUS_SUCCESS; +#else + return STATUS_NOT_IMPLEMENTED; +#endif } @@ -2124,6 +2129,7 @@ NTSTATUS InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, PUNICODE_STRING DestinationArcPath) { +#ifdef __REACTOS__ WCHAR SrcPath[MAX_PATH]; WCHAR DstPath[MAX_PATH]; NTSTATUS Status; @@ -2170,6 +2176,9 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, } return STATUS_SUCCESS; +#else + return STATUS_NOT_IMPLEMENTED; +#endif } /* EOF */ diff --git a/reactos/base/setup/usetup/filequeue.c b/reactos/base/setup/usetup/filequeue.c index aac989a78a1..117fee5d09c 100644 --- a/reactos/base/setup/usetup/filequeue.c +++ b/reactos/base/setup/usetup/filequeue.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/filequeue.c * PURPOSE: File queue functions @@ -34,7 +33,6 @@ /* INCLUDES *****************************************************************/ - typedef struct _QUEUEENTRY { struct _QUEUEENTRY *Prev; diff --git a/reactos/base/setup/usetup/filesup.c b/reactos/base/setup/usetup/filesup.c index 88e144fae75..35e13391320 100644 --- a/reactos/base/setup/usetup/filesup.c +++ b/reactos/base/setup/usetup/filesup.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/filesup.c * PURPOSE: File support functions @@ -34,7 +33,6 @@ /* FUNCTIONS ****************************************************************/ - static BOOLEAN HasCurrentCabinet = FALSE; static WCHAR CurrentCabinetName[MAX_PATH]; @@ -76,9 +74,9 @@ SetupCreateDirectory(PWCHAR DirectoryName) &IoStatusBlock, NULL, FILE_ATTRIBUTE_DIRECTORY, - 0, - FILE_CREATE, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_OPEN_IF, + FILE_DIRECTORY_FILE, NULL, 0); if (NT_SUCCESS(Status)) @@ -108,10 +106,12 @@ SetupCopyFile(PWCHAR SourceFileName, NTSTATUS Status; PVOID SourceFileMap = 0; HANDLE SourceFileSection; - ULONG SourceSectionSize = 0; + SIZE_T SourceSectionSize = 0; + LARGE_INTEGER ByteOffset; Buffer = NULL; +#ifdef __REACTOS__ RtlInitUnicodeString(&FileName, SourceFileName); @@ -126,12 +126,20 @@ SetupCopyFile(PWCHAR SourceFileName, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); + FILE_SEQUENTIAL_ONLY); if(!NT_SUCCESS(Status)) { DPRINT1("NtOpenFile failed: %x\n", Status); 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, @@ -155,10 +163,10 @@ SetupCopyFile(PWCHAR SourceFileName, Status = NtCreateSection( &SourceFileSection, SECTION_MAP_READ, - 0, - 0, + NULL, + NULL, PAGE_READONLY, - 0, + SEC_COMMIT, FileHandleSource); if(!NT_SUCCESS(Status)) { @@ -171,10 +179,10 @@ SetupCopyFile(PWCHAR SourceFileName, &SourceFileMap, 0, 0, - 0, + NULL, &SourceSectionSize, + ViewUnmap, 0, - SEC_COMMIT, PAGE_READONLY ); if(!NT_SUCCESS(Status)) { @@ -199,7 +207,7 @@ SetupCopyFile(PWCHAR SourceFileName, FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, + FILE_NO_INTERMEDIATE_BUFFERING | FILE_SEQUENTIAL_ONLY, NULL, 0); if(!NT_SUCCESS(Status)) @@ -208,17 +216,18 @@ SetupCopyFile(PWCHAR SourceFileName, goto unmapsrcsec; } - RegionSize = PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart); + RegionSize = (ULONG)PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart); IoStatusBlock.Status = 0; + ByteOffset.QuadPart = 0; Status = NtWriteFile(FileHandleDest, - 0, - 0, - 0, + NULL, + NULL, + NULL, &IoStatusBlock, SourceFileMap, RegionSize, - 0, - 0); + &ByteOffset, + NULL); if(!NT_SUCCESS(Status)) { 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); } - +#ifdef __REACTOS__ NTSTATUS SetupExtractFile(PWCHAR CabinetFileName, PWCHAR SourceFileName, @@ -314,7 +323,7 @@ SetupExtractFile(PWCHAR CabinetFileName, return STATUS_SUCCESS; } - +#endif BOOLEAN DoesFileExist(PWSTR PathName, diff --git a/reactos/base/setup/usetup/fslist.c b/reactos/base/setup/usetup/fslist.c index e5751a07b33..cf986bfb777 100644 --- a/reactos/base/setup/usetup/fslist.c +++ b/reactos/base/setup/usetup/fslist.c @@ -32,10 +32,10 @@ /* FUNCTIONS ****************************************************************/ -static VOID -AddProvider( +VOID +FS_AddProvider( IN OUT PFILE_SYSTEM_LIST List, - IN LPCSTR FileSystem, + IN LPCWSTR FileSystem, IN FORMATEX FormatFunc, IN CHKDSKEX ChkdskFunc) { @@ -70,7 +70,7 @@ CreateFileSystemList( IN SHORT Left, IN SHORT Top, IN BOOLEAN ForceFormat, - IN LPCSTR ForceFileSystem) + IN LPCWSTR ForceFileSystem) { PFILE_SYSTEM_LIST List; PFILE_SYSTEM_ITEM Item; @@ -85,11 +85,12 @@ CreateFileSystemList( List->Selected = NULL; InitializeListHead(&List->ListHead); - AddProvider(List, "FAT", VfatFormat, VfatChkdsk); + HOST_CreateFileSystemList(List); + if (!ForceFormat) { /* Add 'Keep' provider */ - AddProvider(List, NULL, NULL, NULL); + FS_AddProvider(List, NULL, NULL, NULL); } /* Search for ForceFileSystem in list */ @@ -97,7 +98,7 @@ CreateFileSystemList( while (ListEntry != &List->ListHead) { 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; break; @@ -147,7 +148,7 @@ DrawFileSystemList( Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry); coPos.X = List->Left; - coPos.Y = List->Top + Index; + coPos.Y = List->Top + (SHORT)Index; FillConsoleOutputAttribute(StdOutput, FOREGROUND_WHITE | BACKGROUND_BLUE, sizeof(Buffer), @@ -162,9 +163,9 @@ DrawFileSystemList( if (Item->FileSystem) { 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 - sprintf(Buffer, " Format partition as %s file system ", Item->FileSystem); + sprintf(Buffer, " Format partition as %S file system ", Item->FileSystem); } else sprintf(Buffer, " Keep current file system (no changes) "); diff --git a/reactos/base/setup/usetup/fslist.h b/reactos/base/setup/usetup/fslist.h index 7e114f0371c..8d9f1c48572 100644 --- a/reactos/base/setup/usetup/fslist.h +++ b/reactos/base/setup/usetup/fslist.h @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/fslist.h * PURPOSE: Filesystem list functions @@ -28,30 +27,38 @@ #ifndef __FSLIST_H__ #define __FSLIST_H__ +#include + typedef struct _FILE_SYSTEM_ITEM { - LIST_ENTRY ListEntry; - LPCSTR FileSystem; /* Not owned by the item */ - FORMATEX FormatFunc; - CHKDSKEX ChkdskFunc; - BOOLEAN QuickFormat; + LIST_ENTRY ListEntry; + LPCWSTR FileSystem; /* Not owned by the item */ + FORMATEX FormatFunc; + CHKDSKEX ChkdskFunc; + BOOLEAN QuickFormat; } FILE_SYSTEM_ITEM, *PFILE_SYSTEM_ITEM; typedef struct _FILE_SYSTEM_LIST { - SHORT Left; - SHORT Top; - PFILE_SYSTEM_ITEM Selected; - LIST_ENTRY ListHead; /* List of FILE_SYSTEM_ITEM */ + SHORT Left; + SHORT Top; + PFILE_SYSTEM_ITEM Selected; + LIST_ENTRY ListHead; /* List of FILE_SYSTEM_ITEM */ } 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 CreateFileSystemList( - IN SHORT Left, - IN SHORT Top, - IN BOOLEAN ForceFormat, - IN LPCSTR ForceFileSystem); + IN SHORT Left, + IN SHORT Top, + IN BOOLEAN ForceFormat, + IN LPCWSTR ForceFileSystem); VOID DestroyFileSystemList( diff --git a/reactos/base/setup/usetup/genlist.c b/reactos/base/setup/usetup/genlist.c index a1db0c20503..b65913a832a 100644 --- a/reactos/base/setup/usetup/genlist.c +++ b/reactos/base/setup/usetup/genlist.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/genlist.c * PURPOSE: Generic list functions @@ -72,7 +71,7 @@ DestroyGenericList(PGENERIC_LIST List, /* Release user data */ if (FreeUserData && ListEntry->UserData != NULL) - RtlFreeHeap (ProcessHeap, 0, &ListEntry->UserData); + RtlFreeHeap (ProcessHeap, 0, ListEntry->UserData); /* Release list entry */ RtlFreeHeap (ProcessHeap, 0, ListEntry); diff --git a/reactos/base/setup/usetup/host.h b/reactos/base/setup/usetup/host.h new file mode 100644 index 00000000000..14a3a51fb48 --- /dev/null +++ b/reactos/base/setup/usetup/host.h @@ -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); diff --git a/reactos/base/setup/usetup/inffile.c b/reactos/base/setup/usetup/inffile.c index b3bb5625234..80019cf6b03 100644 --- a/reactos/base/setup/usetup/inffile.c +++ b/reactos/base/setup/usetup/inffile.c @@ -27,13 +27,18 @@ /* INCLUDES ******************************************************************/ #include "usetup.h" + +#ifdef __REACTOS__ #include +#endif #define NDEBUG #include /* FUNCTIONS *****************************************************************/ +#ifdef __REACTOS__ + VOID WINAPI InfpCloseInfFile( IN HINF InfHandle) @@ -141,18 +146,63 @@ InfpOpenInfFileW( &ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status)) - return NULL; + return INVALID_HANDLE_VALUE; return hInf; } +#endif /* __REACTOS__ */ + BOOLEAN INF_GetData( IN PINFCONTEXT Context, 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__ */ } BOOLEAN @@ -161,7 +211,39 @@ 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__ */ } HINF WINAPI @@ -172,6 +254,7 @@ INF_OpenBufferedFileA( IN DWORD InfStyle, OUT PUINT ErrorLine) { +#ifdef __REACTOS__ HINF hInf = NULL; ULONG ErrorLineUL; NTSTATUS Status; @@ -183,15 +266,20 @@ INF_OpenBufferedFileA( &ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status)) - return NULL; + return INVALID_HANDLE_VALUE; return hInf; +#else + return INVALID_HANDLE_VALUE; +#endif /* !__REACTOS__ */ } VOID INF_SetHeap( IN PVOID Heap) { +#ifdef __REACTOS__ InfSetHeap(Heap); +#endif } /* EOF */ diff --git a/reactos/base/setup/usetup/inffile.h b/reactos/base/setup/usetup/inffile.h index 0ef27996375..9de18e196d2 100644 --- a/reactos/base/setup/usetup/inffile.h +++ b/reactos/base/setup/usetup/inffile.h @@ -27,6 +27,12 @@ #ifndef __INFFILE_H__ #define __INFFILE_H__ +#ifndef __REACTOS__ + +#include + +#else /* __REACTOS__ */ + #include #define SetupCloseInfFile InfpCloseInfFile @@ -107,6 +113,8 @@ InfpOpenInfFileW( IN DWORD InfStyle, OUT PUINT ErrorLine); +#endif /* __REACTOS__ */ + BOOLEAN INF_GetData( IN PINFCONTEXT Context, diff --git a/reactos/base/setup/usetup/interface/consup.c b/reactos/base/setup/usetup/interface/consup.c index c33bff388e7..7584996d488 100644 --- a/reactos/base/setup/usetup/interface/consup.c +++ b/reactos/base/setup/usetup/interface/consup.c @@ -31,8 +31,33 @@ #define NDEBUG #include +/* GLOBALS ******************************************************************/ + +HANDLE StdInput = INVALID_HANDLE_VALUE; +HANDLE StdOutput = INVALID_HANDLE_VALUE; + +SHORT xScreen = 0; +SHORT yScreen = 0; + /* 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 CONSOLE_ConInKey( OUT PINPUT_RECORD Buffer) @@ -72,7 +97,7 @@ CONSOLE_ConOutPuts( WriteConsole( StdOutput, szText, - strlen(szText), + (ULONG)strlen(szText), &Written, NULL); WriteConsole( @@ -88,7 +113,7 @@ CONSOLE_ConOutPrintf( IN LPCSTR szFormat, ...) { CHAR szOut[256]; - DWORD dwWritten; + ULONG dwWritten; va_list arg_ptr; va_start(arg_ptr, szFormat); @@ -98,7 +123,7 @@ CONSOLE_ConOutPrintf( WriteConsole( StdOutput, szOut, - strlen(szOut), + (ULONG)strlen(szOut), &dwWritten, NULL); } @@ -123,20 +148,6 @@ CONSOLE_GetCursorY(VOID) 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 CONSOLE_SetCursorType( IN BOOL bInsert, @@ -219,7 +230,7 @@ CONSOLE_SetStatusText( WriteConsoleOutputCharacterA( StdOutput, Buffer, - strlen(Buffer), + (ULONG)strlen(Buffer), coPos, &Written); } @@ -285,7 +296,7 @@ CONSOLE_SetTextXY( WriteConsoleOutputCharacterA( StdOutput, Text, - strlen(Text), + (ULONG)strlen(Text), coPos, &Written); } @@ -298,14 +309,14 @@ CONSOLE_SetInputTextXY( IN LPCWSTR Text) { COORD coPos; - ULONG Length; + SHORT Length; ULONG Written; coPos.X = x; coPos.Y = y; - Length = wcslen(Text); - if (Length > (ULONG)len - 1) + Length = (SHORT)wcslen(Text); + if (Length > len - 1) Length = len - 1; FillConsoleOutputAttribute( @@ -318,7 +329,7 @@ CONSOLE_SetInputTextXY( WriteConsoleOutputCharacterW( StdOutput, Text, - Length, + (ULONG)Length, coPos, &Written); @@ -330,7 +341,7 @@ CONSOLE_SetInputTextXY( coPos, &Written); - if ((ULONG)len > Length + 1) + if (len > Length + 1) { coPos.X++; FillConsoleOutputCharacterA( @@ -355,7 +366,7 @@ CONSOLE_SetUnderlinedTextXY( coPos.X = x; coPos.Y = y; - Length = strlen(Text); + Length = (ULONG)strlen(Text); WriteConsoleOutputCharacterA( StdOutput, @@ -386,7 +397,7 @@ CONSOLE_SetInvertedTextXY( coPos.X = x; coPos.Y = y; - Length = strlen(Text); + Length = (ULONG)strlen(Text); FillConsoleOutputAttribute( StdOutput, @@ -416,7 +427,7 @@ CONSOLE_SetHighlightedTextXY( coPos.X = x; coPos.Y = y; - Length = strlen(Text); + Length = (ULONG)strlen(Text); FillConsoleOutputAttribute( StdOutput, @@ -454,7 +465,7 @@ CONSOLE_PrintTextXY( WriteConsoleOutputCharacterA( StdOutput, buffer, - strlen(buffer), + (ULONG)strlen(buffer), coPos, &Written); } @@ -469,7 +480,7 @@ CONSOLE_PrintTextXYN( CHAR buffer[512]; va_list ap; COORD coPos; - ULONG Length; + SHORT Length; ULONG Written; va_start(ap, fmt); @@ -479,8 +490,8 @@ CONSOLE_PrintTextXYN( coPos.X = x; coPos.Y = y; - Length = strlen(buffer); - if (Length > (ULONG)len - 1) + Length = (SHORT)strlen(buffer); + if (Length > len - 1) Length = len - 1; WriteConsoleOutputCharacterA( @@ -492,7 +503,7 @@ CONSOLE_PrintTextXYN( coPos.X += Length; - if ((ULONG)len > Length) + if (len > Length) { FillConsoleOutputCharacterA( StdOutput, diff --git a/reactos/base/setup/usetup/interface/consup.h b/reactos/base/setup/usetup/interface/consup.h index 6b4a4c849e9..60ca293a679 100644 --- a/reactos/base/setup/usetup/interface/consup.h +++ b/reactos/base/setup/usetup/interface/consup.h @@ -34,7 +34,9 @@ extern HANDLE StdInput, StdOutput; extern SHORT xScreen, yScreen; -#include "../native/utils/console.h" +BOOLEAN +CONSOLE_Init( + VOID); VOID CONSOLE_ClearScreen(VOID); @@ -61,11 +63,6 @@ CONSOLE_GetCursorX(VOID); SHORT CONSOLE_GetCursorY(VOID); -VOID -CONSOLE_GetScreenSize( - OUT SHORT *maxx, - OUT SHORT *maxy); - VOID CONSOLE_InvertTextXY( IN SHORT x, diff --git a/reactos/base/setup/usetup/interface/usetup.c b/reactos/base/setup/usetup/interface/usetup.c index 4c02bfabd0b..db8b3dacc29 100644 --- a/reactos/base/setup/usetup/interface/usetup.c +++ b/reactos/base/setup/usetup/interface/usetup.c @@ -23,6 +23,7 @@ * PURPOSE: Text-mode setup * PROGRAMMER: Eric Kohl * Casper S. Hornstrup (chorns@users.sourceforge.net) + * Hervé Poussineau (hpoussin@reactos.org) */ #include "usetup.h" @@ -73,6 +74,7 @@ typedef enum _PAGE_NUMBER HANDLE ProcessHeap; UNICODE_STRING SourceRootPath; +UNICODE_STRING SourcePath; BOOLEAN IsUnattendedSetup = FALSE; LONG UnattendDestinationDiskNumber; LONG UnattendDestinationPartitionNumber; @@ -86,9 +88,6 @@ static PPARTLIST PartitionList = NULL; static PFILE_SYSTEM_LIST FileSystemList = NULL; - -static UNICODE_STRING SourcePath; - static UNICODE_STRING InstallPath; /* Path to the install directory */ @@ -138,14 +137,111 @@ PrintString(char* fmt,...) #define POPUP_WAIT_ANY_KEY 1 #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 PopupError(PCHAR Text, PCHAR Status, PINPUT_RECORD Ir, ULONG WaitEvent) { - SHORT xScreen; - SHORT yScreen; SHORT yTop; SHORT xLeft; COORD coPos; @@ -195,8 +291,6 @@ PopupError(PCHAR Text, MaxLength = Length; } - CONSOLE_GetScreenSize(&xScreen, &yScreen); - Width = MaxLength + 4; Height = Lines + 2; if (Status != NULL) @@ -217,84 +311,7 @@ PopupError(PCHAR Text, &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); + DrawBox(xLeft, yTop, Width, Height); /* Print message text */ coPos.Y = yTop + 1; @@ -628,8 +645,8 @@ SetupStartPage(PINPUT_RECORD Ir) #endif /* Load txtsetup.sif from install media. */ - wcscpy(FileNameBuffer, SourceRootPath.Buffer); - wcscat(FileNameBuffer, L"\\reactos\\txtsetup.sif"); + wcscpy(FileNameBuffer, SourcePath.Buffer); + wcscat(FileNameBuffer, L"\\txtsetup.sif"); SetupInf = SetupOpenInfFileW(FileNameBuffer, NULL, @@ -927,7 +944,10 @@ DeviceSettingsPage(PINPUT_RECORD Ir) ComputerList = CreateComputerTypeList(SetupInf); 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); 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); 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 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(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, 14, " the computer type."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); - DrawGenericList(ComputerList, 2, 18, @@ -1112,9 +1133,6 @@ ComputerSettingsPage(PINPUT_RECORD Ir) static PAGE_NUMBER 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(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, 14, " the display type."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); - DrawGenericList(DisplayList, 2, 18, @@ -1177,9 +1193,6 @@ DisplaySettingsPage(PINPUT_RECORD Ir) static PAGE_NUMBER 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(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, 14, " the keyboard type."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); - DrawGenericList(KeyboardList, 2, 18, @@ -1240,9 +1251,6 @@ KeyboardSettingsPage(PINPUT_RECORD Ir) static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir) { - SHORT xScreen; - SHORT yScreen; - 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"); @@ -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, 14, " the keyboard layout."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); - DrawGenericList(LayoutList, 2, 18, @@ -1303,9 +1309,6 @@ LayoutSettingsPage(PINPUT_RECORD Ir) static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir) { - SHORT xScreen; - SHORT yScreen; - CONSOLE_SetTextXY(6, 8, "The list below shows existing partitions and unused disk"); CONSOLE_SetTextXY(6, 9, "space for new partitions."); @@ -1316,8 +1319,6 @@ SelectPartitionPage(PINPUT_RECORD Ir) CONSOLE_SetStatusText(" Please wait..."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); - if (PartitionList == NULL) { PartitionList = CreatePartitionList (2, @@ -1497,7 +1498,6 @@ ShowPartitionSizeInputBox(SHORT Left, INPUT_RECORD Ir; COORD coPos; ULONG Written; - SHORT i; CHAR Buffer[100]; ULONG Index; CHAR ch; @@ -1510,78 +1510,7 @@ ShowPartitionSizeInputBox(SHORT Left, if (Cancel != NULL) *Cancel = FALSE; - /* draw upper left corner */ - 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); + DrawBox(Left, Top, Right - Left + 1, Bottom - Top + 1); /* Print message */ coPos.X = Left + 2; @@ -1671,8 +1600,6 @@ CreatePartitionPage (PINPUT_RECORD Ir) { PDISKENTRY DiskEntry; PPARTENTRY PartEntry; - SHORT xScreen; - SHORT yScreen; BOOLEAN Quit; BOOLEAN Cancel; CHAR InputBuffer[50]; @@ -1694,8 +1621,6 @@ CreatePartitionPage (PINPUT_RECORD Ir) CONSOLE_SetStatusText (" Please wait..."); - CONSOLE_GetScreenSize (&xScreen, &yScreen); - CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on"); #if 0 @@ -2121,7 +2046,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if (FileSystemList == NULL) { - FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, "FAT"); + FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, L"FAT"); if (FileSystemList == NULL) { /* FIXME: show an error dialog */ @@ -2243,7 +2168,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) 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)) { @@ -2287,7 +2212,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) } break; } - else if (FileSystemList->Selected->FormatFunc) + else if (!FileSystemList->Selected->FormatFunc) return QUIT_PAGE; } @@ -2382,7 +2307,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) 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! */ if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) @@ -2482,7 +2407,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir) if (!CurrentFileSystem->ChkdskFunc) { 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" " \x07 Press ENTER to continue Setup.\n" " \x07 Press F3 to quit Setup.", @@ -2664,11 +2589,11 @@ InstallDirectoryPage(PINPUT_RECORD Ir) return(INSTALL_DIRECTORY_PAGE); } - static BOOLEAN AddSectionToCopyQueue(HINF InfFile, PWCHAR SectionName, PWCHAR SourceCabinet, + PCUNICODE_STRING DestinationPath, PINPUT_RECORD Ir) { INFCONTEXT FilesContext; @@ -2752,7 +2677,7 @@ PrepareCopyPageInfFile(HINF InfFile, NTSTATUS Status; /* Add common files */ - if (!AddSectionToCopyQueue(InfFile, L"SourceFiles", SourceCabinet, Ir)) + if (!AddSectionToCopyQueue(InfFile, L"SourceFiles", SourceCabinet, &DestinationPath, Ir)) return FALSE; /* Add specific files depending of computer type */ @@ -2762,7 +2687,7 @@ PrepareCopyPageInfFile(HINF InfFile, return FALSE; if (AdditionalSectionName) { - if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, Ir)) + if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir)) return FALSE; } } @@ -2857,7 +2782,6 @@ PrepareCopyPageInfFile(HINF InfFile, return(TRUE); } - static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir) { @@ -2882,7 +2806,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) Ir, POPUP_WAIT_ENTER); return(QUIT_PAGE); } - + if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir)) { return QUIT_PAGE; @@ -2907,6 +2831,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) wcscat(PathBuffer, L"\\"); wcscat(PathBuffer, KeyValue); +#ifdef __REACTOS__ CabinetInitialize(); CabinetSetEventHandlers(NULL, NULL, NULL); CabinetSetCabinetName(PathBuffer); @@ -2953,6 +2878,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) { return QUIT_PAGE; } +#endif } while (SetupFindNextLine (&CabinetsContext, &CabinetsContext)); @@ -2997,8 +2923,6 @@ static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir) { COPYCONTEXT CopyContext; - SHORT xScreen; - SHORT yScreen; CONSOLE_SetStatusText(" \xB3 Please wait... "); @@ -3006,7 +2930,6 @@ FileCopyPage(PINPUT_RECORD Ir) CONSOLE_SetTextXY(30, 13, "installation folder."); CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete."); - CONSOLE_GetScreenSize(&xScreen, &yScreen); CopyContext.DestinationRootPath = DestinationRootPath.Buffer; CopyContext.InstallPath = InstallPath.Buffer; CopyContext.TotalOperations = 0; @@ -3054,6 +2977,7 @@ RegistryPage(PINPUT_RECORD Ir) } /* Create the default hives */ +#ifdef __REACTOS__ Status = NtInitializeRegistry(TRUE); if (!NT_SUCCESS(Status)) { @@ -3063,6 +2987,9 @@ RegistryPage(PINPUT_RECORD Ir) Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } +#else + RegInitializeRegistry(); +#endif /* Update registry */ CONSOLE_SetStatusText(" Updating registry hives..."); @@ -3484,22 +3411,13 @@ FlushPage(PINPUT_RECORD Ir) } -static VOID +VOID RunUSetup(VOID) { INPUT_RECORD Ir; PAGE_NUMBER Page; - BOOL ret; - ret = AllocConsole(); - if (!ret) - ret = AttachConsole(ATTACH_PARENT_PROCESS); - - if (!ret -#ifdef WIN32_USETUP - && GetLastError() != ERROR_ACCESS_DENIED -#endif - ) + if (!CONSOLE_Init()) { PrintString("Unable to open the console\n\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, 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 */ RtlInitUnicodeString(&SourcePath, NULL); @@ -3680,16 +3587,7 @@ RunUSetup(VOID) } -#ifdef WIN32_USETUP -int -main(void) -{ - ProcessHeap = GetProcessHeap(); - RunUSetup(); - return 0; -} - -#else +#ifdef __REACTOS__ VOID NTAPI NtProcessStartup(PPEB Peb) @@ -3700,6 +3598,6 @@ NtProcessStartup(PPEB Peb) INF_SetHeap(ProcessHeap); RunUSetup(); } -#endif /* !WIN32_USETUP */ +#endif /* __REACTOS__ */ /* EOF */ diff --git a/reactos/base/setup/usetup/native/console.c b/reactos/base/setup/usetup/native/console.c new file mode 100644 index 00000000000..608d3e92852 --- /dev/null +++ b/reactos/base/setup/usetup/native/console.c @@ -0,0 +1,8 @@ +#include "host_native.h" + +BOOLEAN +NATIVE_InitConsole( + VOID) +{ + return (BOOLEAN)AllocConsole(); +} diff --git a/reactos/base/setup/usetup/native/fslist.c b/reactos/base/setup/usetup/native/fslist.c new file mode 100644 index 00000000000..8a5db604ac4 --- /dev/null +++ b/reactos/base/setup/usetup/native/fslist.c @@ -0,0 +1,32 @@ +#include "usetup.h" + +/* Filesystem headers */ +#include +#include + +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); +} diff --git a/reactos/base/setup/usetup/native/host_native.h b/reactos/base/setup/usetup/native/host_native.h new file mode 100644 index 00000000000..1ce410db9b2 --- /dev/null +++ b/reactos/base/setup/usetup/native/host_native.h @@ -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_ */ diff --git a/reactos/base/setup/usetup/native/utils/console.c b/reactos/base/setup/usetup/native/utils/console.c index e0a176622bf..ce15d24d201 100644 --- a/reactos/base/setup/usetup/native/utils/console.c +++ b/reactos/base/setup/usetup/native/utils/console.c @@ -27,24 +27,17 @@ /* INCLUDES ******************************************************************/ #include "usetup.h" +/* Blue Driver Header */ +#include +#include "keytrans.h" #define NDEBUG #include -/* GLOBALS ******************************************************************/ - -HANDLE StdInput = INVALID_HANDLE_VALUE; -HANDLE StdOutput = INVALID_HANDLE_VALUE; - -SHORT xScreen = 0; -SHORT yScreen = 0; - /* FUNCTIONS *****************************************************************/ -#ifndef WIN32_USETUP - BOOL WINAPI -ConAllocConsole(VOID) +AllocConsole(VOID) { UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen"); UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0"); @@ -90,14 +83,14 @@ ConAllocConsole(VOID) } BOOL WINAPI -ConAttachConsole( +AttachConsole( IN DWORD dwProcessId) { return FALSE; } BOOL WINAPI -ConFreeConsole(VOID) +FreeConsole(VOID) { DPRINT("FreeConsole() called\n"); @@ -112,7 +105,7 @@ ConFreeConsole(VOID) } BOOL WINAPI -ConWriteConsole( +WriteConsole( IN HANDLE hConsoleOutput, IN const VOID* lpBuffer, IN DWORD nNumberOfCharsToWrite, @@ -140,7 +133,7 @@ ConWriteConsole( } HANDLE WINAPI -ConGetStdHandle( +GetStdHandle( IN DWORD nStdHandle) { switch (nStdHandle) @@ -155,7 +148,7 @@ ConGetStdHandle( } BOOL WINAPI -ConReadConsoleInput( +ReadConsoleInput( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, @@ -188,7 +181,7 @@ ConReadConsoleInput( } BOOL WINAPI -ConWriteConsoleOutputCharacterA( +WriteConsoleOutputCharacterA( HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, @@ -235,7 +228,7 @@ ConWriteConsoleOutputCharacterA( } BOOL WINAPI -ConWriteConsoleOutputCharacterW( +WriteConsoleOutputCharacterW( HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, @@ -287,7 +280,7 @@ ConWriteConsoleOutputCharacterW( } BOOL WINAPI -ConFillConsoleOutputAttribute( +FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, @@ -322,7 +315,7 @@ ConFillConsoleOutputAttribute( } BOOL WINAPI -ConFillConsoleOutputCharacterA( +FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, @@ -356,7 +349,7 @@ ConFillConsoleOutputCharacterA( } BOOL WINAPI -ConGetConsoleScreenBufferInfo( +GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) { @@ -378,7 +371,7 @@ ConGetConsoleScreenBufferInfo( } BOOL WINAPI -ConSetConsoleCursorInfo( +SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo) { @@ -400,7 +393,7 @@ ConSetConsoleCursorInfo( } BOOL WINAPI -ConSetConsoleCursorPosition( +SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition) { @@ -431,7 +424,7 @@ ConSetConsoleCursorPosition( } BOOL WINAPI -ConSetConsoleTextAttribute( +SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes) { @@ -452,6 +445,4 @@ ConSetConsoleTextAttribute( return NT_SUCCESS(Status); } -#endif /* !WIN32_USETUP */ - /* EOF */ diff --git a/reactos/base/setup/usetup/native/utils/console.h b/reactos/base/setup/usetup/native/utils/console.h index 1041dc43a04..8a932e6b621 100644 --- a/reactos/base/setup/usetup/native/utils/console.h +++ b/reactos/base/setup/usetup/native/utils/console.h @@ -24,51 +24,18 @@ * PROGRAMMER: Eric Kohl */ -#ifndef __CONSOLE_H__ -#define __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 +#ifndef _UTILS_CONSOLE_H_ +#define _UTILS_CONSOLE_H_ BOOL WINAPI -ConAllocConsole(VOID); +AllocConsole(VOID); BOOL WINAPI -ConAttachConsole( +AttachConsole( IN DWORD dwProcessId); BOOL WINAPI -ConFillConsoleOutputAttribute( +FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, @@ -76,7 +43,7 @@ ConFillConsoleOutputAttribute( OUT LPDWORD lpNumberOfAttrsWritten); BOOL WINAPI -ConFillConsoleOutputCharacterA( +FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, @@ -84,41 +51,41 @@ ConFillConsoleOutputCharacterA( OUT LPDWORD lpNumberOfCharsWritten); BOOL WINAPI -ConFreeConsole(VOID); +FreeConsole(VOID); BOOL WINAPI -ConGetConsoleScreenBufferInfo( +GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); HANDLE WINAPI -ConGetStdHandle( +GetStdHandle( IN DWORD nStdHandle); BOOL WINAPI -ConReadConsoleInput( +ReadConsoleInput( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead); BOOL WINAPI -ConSetConsoleCursorInfo( +SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo); BOOL WINAPI -ConSetConsoleCursorPosition( +SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition); BOOL WINAPI -ConSetConsoleTextAttribute( +SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes); BOOL WINAPI -ConWriteConsole( +WriteConsole( IN HANDLE hConsoleOutput, IN const VOID* lpBuffer, IN DWORD nNumberOfCharsToWrite, @@ -126,7 +93,7 @@ ConWriteConsole( IN LPVOID lpReserved); BOOL WINAPI -ConWriteConsoleOutputCharacterA( +WriteConsoleOutputCharacterA( HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, @@ -134,23 +101,13 @@ ConWriteConsoleOutputCharacterA( OUT LPDWORD lpNumberOfCharsWritten); BOOL WINAPI -ConWriteConsoleOutputCharacterA( +WriteConsoleOutputCharacterA( HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten); -BOOL WINAPI -ConWriteConsoleOutputCharacterW( - HANDLE hConsoleOutput, - IN LPCWSTR lpCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten); - -#endif /* !WIN32_USETUP */ - -#endif /* __CONSOLE_H__*/ +#endif /* _UTILS_CONSOLE_H_ */ /* EOF */ diff --git a/reactos/base/setup/usetup/native/utils/keytrans.c b/reactos/base/setup/usetup/native/utils/keytrans.c index 1748b232973..0ef8f36f658 100644 --- a/reactos/base/setup/usetup/native/utils/keytrans.c +++ b/reactos/base/setup/usetup/native/utils/keytrans.c @@ -26,6 +26,7 @@ * NB: Hardcoded to US keyboard */ #include "usetup.h" +#include "keytrans.h" #define NDEBUG #include diff --git a/reactos/base/setup/usetup/native/utils/keytrans.h b/reactos/base/setup/usetup/native/utils/keytrans.h index 0e3afb69178..d13fb5c3bdd 100644 --- a/reactos/base/setup/usetup/native/utils/keytrans.h +++ b/reactos/base/setup/usetup/native/utils/keytrans.h @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/keytrans.h * PURPOSE: Keyboard translation functionality diff --git a/reactos/base/setup/usetup/partlist.c b/reactos/base/setup/usetup/partlist.c index 1eae821ec10..de4d0a0b687 100644 --- a/reactos/base/setup/usetup/partlist.c +++ b/reactos/base/setup/usetup/partlist.c @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: subsys/system/usetup/partlist.c * PURPOSE: Partition list functions @@ -457,31 +456,33 @@ DiskConfigurationDataQueryRoutine(PWSTR ValueName, PVOID Context, PVOID EntryContext) { - PBIOSDISKENTRY BiosDiskEntry = (PBIOSDISKENTRY)Context; - PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; - PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; + PBIOSDISKENTRY BiosDiskEntry = (PBIOSDISKENTRY)Context; + PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; + PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; + ULONG i; - if (ValueType == REG_FULL_RESOURCE_DESCRIPTOR && - ValueLength == sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + sizeof(CM_DISK_GEOMETRY_DEVICE_DATA)) - { - 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; + if (ValueType != REG_FULL_RESOURCE_DESCRIPTOR || + ValueLength < sizeof(CM_FULL_RESOURCE_DESCRIPTOR)) + return STATUS_UNSUCCESSFUL; - 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_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 @@ -493,31 +494,36 @@ SystemConfigurationDataQueryRoutine(PWSTR ValueName, PVOID Context, PVOID EntryContext) { - PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; - PCM_INT13_DRIVE_PARAMETER* Int13Drives = (PCM_INT13_DRIVE_PARAMETER*)Context; + PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; + PCM_INT13_DRIVE_PARAMETER* Int13Drives = (PCM_INT13_DRIVE_PARAMETER*)Context; + ULONG i; - if (ValueType == REG_FULL_RESOURCE_DESCRIPTOR && - ValueLength >= sizeof (CM_FULL_RESOURCE_DESCRIPTOR) && - (ValueLength - sizeof(CM_FULL_RESOURCE_DESCRIPTOR)) % sizeof(CM_INT13_DRIVE_PARAMETER) == 0) - { - 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; + if (ValueType != REG_FULL_RESOURCE_DESCRIPTOR || + ValueLength < sizeof (CM_FULL_RESOURCE_DESCRIPTOR)) + 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" @@ -948,7 +954,7 @@ CreatePartitionList (SHORT Left, &Iosb, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT); - if (NT_SUCCESS(Status)) + if (NT_SUCCESS(Status)) { AddDiskToList (FileHandle, DiskNumber, diff --git a/reactos/base/setup/usetup/registry.c b/reactos/base/setup/usetup/registry.c index e4a5d2cdf9a..42a8b972e67 100644 --- a/reactos/base/setup/usetup/registry.c +++ b/reactos/base/setup/usetup/registry.c @@ -31,6 +31,7 @@ #define NDEBUG #include +#ifdef __REACTOS__ #define FLG_ADDREG_BINVALUETYPE 0x00000001 #define FLG_ADDREG_NOCLOBBER 0x00000002 #define FLG_ADDREG_DELVAL 0x00000004 @@ -44,6 +45,7 @@ #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 #include @@ -201,11 +203,11 @@ do_reg_operation(HANDLE KeyHandle, #if 0 if (ValueName) { - RegDeleteValueW( hkey, value ); + RegDeleteValueW( KeyHandle, ValueName ); } else { - RegDeleteKeyW( hkey, NULL ); + RegDeleteKeyW( KeyHandle, NULL ); } #endif return TRUE; @@ -308,12 +310,16 @@ 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 { @@ -321,21 +327,29 @@ 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); @@ -357,12 +371,16 @@ 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); } @@ -370,7 +388,7 @@ do_reg_operation(HANDLE KeyHandle, return TRUE; } - +#ifdef __REACTOS__ NTSTATUS CreateNestedKey (PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, @@ -465,7 +483,7 @@ CreateNestedKey (PHANDLE KeyHandle, return Status; } - +#endif /*********************************************************************** * registry_callback @@ -514,6 +532,7 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete) DPRINT("Flags: %lx\n", Flags); +#ifdef __REACTOS__ RtlInitUnicodeString (&Name, Buffer); @@ -545,6 +564,26 @@ 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)) @@ -565,7 +604,9 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete) return FALSE; } +#ifdef __REACTOS__ NtClose (KeyHandle); +#endif } } @@ -583,8 +624,8 @@ ImportRegistryFile(PWSTR Filename, UINT ErrorLine; /* Load inf file from install media. */ - wcscpy(FileNameBuffer, SourceRootPath.Buffer); - wcscat(FileNameBuffer, L"\\reactos\\"); + wcscpy(FileNameBuffer, SourcePath.Buffer); + wcscat(FileNameBuffer, L"\\"); wcscat(FileNameBuffer, Filename); hInf = SetupOpenInfFileW( diff --git a/reactos/base/setup/usetup/usetup.h b/reactos/base/setup/usetup/usetup.h index ee9b968a809..aed00da6db2 100644 --- a/reactos/base/setup/usetup/usetup.h +++ b/reactos/base/setup/usetup/usetup.h @@ -45,9 +45,6 @@ /* DDK Disk Headers */ #include -/* Blue Driver Header */ -#include - /* Helper Header */ #include @@ -56,13 +53,13 @@ /* Internal Headers */ #include "interface/consup.h" -#include "native/utils/console.h" -#include "native/utils/keytrans.h" #include "partlist.h" #include "inffile.h" #include "inicache.h" #include "progress.h" +#ifdef __REACTOS__ #include "filequeue.h" +#endif #include "bootsup.h" #include "registry.h" #include "fslist.h" @@ -73,12 +70,13 @@ #include "drivesup.h" #include "genlist.h" #include "settings.h" +#include "host.h" extern HANDLE ProcessHeap; extern UNICODE_STRING SourceRootPath; +extern UNICODE_STRING SourcePath; extern BOOLEAN IsUnattendedSetup; - #endif /* __USETUP_H__*/ /* EOF */ diff --git a/reactos/base/setup/usetup/usetup.rbuild b/reactos/base/setup/usetup/usetup.rbuild index 61bc08a6f17..37d16761c74 100644 --- a/reactos/base/setup/usetup/usetup.rbuild +++ b/reactos/base/setup/usetup/usetup.rbuild @@ -8,38 +8,38 @@ 0x0502 + -lgcc zlib inflib vfatlib ntdll - usetup.h - - - consup.c - usetup.c + + consup.c + usetup.c + + + + console.c + keytrans.c - - - console.c - keytrans.c - - - bootsup.c - cabinet.c - chkdsk.c - drivesup.c - filequeue.c - filesup.c - format.c + console.c fslist.c - genlist.c - inffile.c - inicache.c - partlist.c - progress.c - registry.c - settings.c - + + bootsup.c + cabinet.c + chkdsk.c + drivesup.c + filequeue.c + filesup.c + format.c + fslist.c + genlist.c + inffile.c + inicache.c + partlist.c + progress.c + registry.c + settings.c usetup.rc diff --git a/reactos/base/setup/usetup/usetup.rc b/reactos/base/setup/usetup/usetup.rc index 63a37aa16cb..a338bc9690c 100644 --- a/reactos/base/setup/usetup/usetup.rc +++ b/reactos/base/setup/usetup/usetup.rc @@ -3,4 +3,6 @@ #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Setup\0" #define REACTOS_STR_INTERNAL_NAME "usetup\0" #define REACTOS_STR_ORIGINAL_FILENAME "usetup.dll\0" +#ifdef __REACTOS__ #include +#endif