[FORMATTING]

Fix indentation and coding style. No code changes!

svn path=/trunk/; revision=63254
This commit is contained in:
Eric Kohl 2014-05-12 14:17:37 +00:00
parent e34ff107cd
commit a4061f41e7
21 changed files with 2043 additions and 1869 deletions

View file

@ -87,7 +87,8 @@ extern PPARTLIST PartitionList;
static static
VOID VOID
CreateCommonFreeLoaderSections(PINICACHE IniCache) CreateCommonFreeLoaderSections(
PINICACHE IniCache)
{ {
PINICACHESECTION IniSection; PINICACHESECTION IniSection;
@ -1178,7 +1179,6 @@ InstallMbrBootCodeToDisk(
return Status; return Status;
} }
/* Allocate buffer for new bootsector */ /* Allocate buffer for new bootsector */
NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap, NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap,
0, 0,
@ -1275,9 +1275,11 @@ InstallMbrBootCodeToDisk(
return Status; return Status;
} }
NTSTATUS NTSTATUS
InstallFat12BootCodeToFloppy(PWSTR SrcPath, InstallFat12BootCodeToFloppy(
PWSTR RootPath) PWSTR SrcPath,
PWSTR RootPath)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
@ -1329,7 +1331,6 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
return Status; return Status;
} }
/* Allocate buffer for new bootsector */ /* Allocate buffer for new bootsector */
NewBootSector = RtlAllocateHeap(ProcessHeap, NewBootSector = RtlAllocateHeap(ProcessHeap,
0, 0,
@ -1487,7 +1488,6 @@ InstallFat16BootCodeToDisk(
return Status; return Status;
} }
/* Allocate buffer for new bootsector */ /* Allocate buffer for new bootsector */
NewBootSector = RtlAllocateHeap(ProcessHeap, NewBootSector = RtlAllocateHeap(ProcessHeap,
0, 0,
@ -2001,6 +2001,7 @@ UpdateBootIni(
return Status; return Status;
} }
BOOLEAN BOOLEAN
CheckInstallFatBootcodeToPartition( CheckInstallFatBootcodeToPartition(
PUNICODE_STRING SystemRootPath) PUNICODE_STRING SystemRootPath)
@ -2339,6 +2340,7 @@ InstallFatBootcodeToPartition(
#endif #endif
} }
NTSTATUS NTSTATUS
InstallVBRToPartition( InstallVBRToPartition(
PUNICODE_STRING SystemRootPath, PUNICODE_STRING SystemRootPath,

View file

@ -27,65 +27,79 @@
#pragma once #pragma once
NTSTATUS NTSTATUS
CreateFreeLoaderIniForDos(PWCHAR IniPath, CreateFreeLoaderIniForDos(
PWCHAR ArcPath); PWCHAR IniPath,
PWCHAR ArcPath);
NTSTATUS NTSTATUS
CreateFreeLoaderIniForReactos(PWCHAR IniPath, CreateFreeLoaderIniForReactos(
PWCHAR ArcPath); PWCHAR IniPath,
PWCHAR ArcPath);
NTSTATUS NTSTATUS
UpdateFreeLoaderIni(PWCHAR IniPath, UpdateFreeLoaderIni(
PWCHAR ArcPath); PWCHAR IniPath,
PWCHAR ArcPath);
NTSTATUS NTSTATUS
SaveCurrentBootSector(PWSTR RootPath, SaveCurrentBootSector(
PWSTR DstPath); PWSTR RootPath,
PWSTR DstPath);
NTSTATUS NTSTATUS
InstallFat16BootCodeToFile(PWSTR SrcPath, InstallFat16BootCodeToFile(
PWSTR DstPath, PWSTR SrcPath,
PWSTR RootPath); PWSTR DstPath,
PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat32BootCodeToFile(PWSTR SrcPath, InstallFat32BootCodeToFile(
PWSTR DstPath, PWSTR SrcPath,
PWSTR RootPath); PWSTR DstPath,
PWSTR RootPath);
NTSTATUS NTSTATUS
InstallMbrBootCodeToDisk (PWSTR SrcPath, InstallMbrBootCodeToDisk(
PWSTR RootPath); PWSTR SrcPath,
PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat16BootCodeToDisk(PWSTR SrcPath, InstallFat16BootCodeToDisk(
PWSTR RootPath); PWSTR SrcPath,
PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat32BootCodeToDisk(PWSTR SrcPath, InstallFat32BootCodeToDisk(
PWSTR RootPath); PWSTR SrcPath,
PWSTR RootPath);
NTSTATUS NTSTATUS
UpdateBootIni(PWSTR BootIniPath, UpdateBootIni(
PWSTR EntryName, PWSTR BootIniPath,
PWSTR EntryValue); PWSTR EntryName,
PWSTR EntryValue);
BOOLEAN BOOLEAN
CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath); CheckInstallFatBootcodeToPartition(
PUNICODE_STRING SystemRootPath);
NTSTATUS NTSTATUS
InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath, InstallFatBootcodeToPartition(
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SystemRootPath,
PUNICODE_STRING DestinationArcPath, PUNICODE_STRING SourceRootPath,
UCHAR PartitionType); PUNICODE_STRING DestinationArcPath,
UCHAR PartitionType);
NTSTATUS NTSTATUS
InstallVBRToPartition(PUNICODE_STRING SystemRootPath, InstallVBRToPartition(
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SystemRootPath,
PUNICODE_STRING DestinationArcPath, PUNICODE_STRING SourceRootPath,
UCHAR PartitionType); PUNICODE_STRING DestinationArcPath,
UCHAR PartitionType);
NTSTATUS NTSTATUS
InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, InstallFatBootcodeToFloppy(
PUNICODE_STRING DestinationArcPath); PUNICODE_STRING SourceRootPath,
PUNICODE_STRING DestinationArcPath);
/* EOF */ /* EOF */

View file

@ -34,7 +34,9 @@ static PPROGRESSBAR ChkdskProgressBar = NULL;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static BOOLEAN NTAPI static
BOOLEAN
NTAPI
ChkdskCallback( ChkdskCallback(
IN CALLBACKCOMMAND Command, IN CALLBACKCOMMAND Command,
IN ULONG Modifier, IN ULONG Modifier,
@ -50,6 +52,7 @@ ChkdskCallback(
return TRUE; return TRUE;
} }
NTSTATUS NTSTATUS
ChkdskPartition( ChkdskPartition(
IN PUNICODE_STRING DriveRoot, IN PUNICODE_STRING DriveRoot,

View file

@ -34,66 +34,66 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
NTSTATUS NTSTATUS
GetSourcePaths(PUNICODE_STRING SourcePath, GetSourcePaths(
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourcePath,
PUNICODE_STRING SourceRootDir) PUNICODE_STRING SourceRootPath,
PUNICODE_STRING SourceRootDir)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING LinkName; UNICODE_STRING LinkName;
UNICODE_STRING SourceName; UNICODE_STRING SourceName;
WCHAR SourceBuffer[MAX_PATH] = {L'\0'}; WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
HANDLE Handle; HANDLE Handle;
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
PWCHAR Ptr; PWCHAR Ptr;
RtlInitUnicodeString(&LinkName, RtlInitUnicodeString(&LinkName,
L"\\SystemRoot"); L"\\SystemRoot");
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&LinkName, &LinkName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenSymbolicLinkObject(&Handle, Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return Status;
SourceName.Length = 0; SourceName.Length = 0;
SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR); SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
SourceName.Buffer = SourceBuffer; SourceName.Buffer = SourceBuffer;
Status = NtQuerySymbolicLinkObject(Handle, Status = NtQuerySymbolicLinkObject(Handle,
&SourceName, &SourceName,
&Length); &Length);
NtClose(Handle); NtClose(Handle);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
RtlCreateUnicodeString(SourcePath, RtlCreateUnicodeString(SourcePath,
SourceName.Buffer); SourceName.Buffer);
/* strip trailing directory */ /* strip trailing directory */
Ptr = wcsrchr(SourceName.Buffer, L'\\'); Ptr = wcsrchr(SourceName.Buffer, L'\\');
if (Ptr) if (Ptr)
{ {
RtlCreateUnicodeString(SourceRootDir, Ptr); RtlCreateUnicodeString(SourceRootDir, Ptr);
*Ptr = 0; *Ptr = 0;
} }
else else
RtlCreateUnicodeString(SourceRootDir, L""); RtlCreateUnicodeString(SourceRootDir, L"");
RtlCreateUnicodeString(SourceRootPath, RtlCreateUnicodeString(SourceRootPath,
SourceName.Buffer); SourceName.Buffer);
} }
NtClose(Handle); NtClose(Handle);
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
/* EOF */ /* EOF */

View file

@ -27,8 +27,9 @@
#pragma once #pragma once
NTSTATUS NTSTATUS
GetSourcePaths(PUNICODE_STRING SourcePath, GetSourcePaths(
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourcePath,
PUNICODE_STRING SourceRootDir); PUNICODE_STRING SourceRootPath,
PUNICODE_STRING SourceRootDir);
/* EOF */ /* EOF */

View file

@ -35,407 +35,425 @@
typedef struct _QUEUEENTRY typedef struct _QUEUEENTRY
{ {
struct _QUEUEENTRY *Prev; struct _QUEUEENTRY *Prev;
struct _QUEUEENTRY *Next; struct _QUEUEENTRY *Next;
PWSTR SourceCabinet; /* May be NULL if file is not in a cabinet */
PWSTR SourceRootPath;
PWSTR SourcePath;
PWSTR SourceFilename;
PWSTR TargetDirectory;
PWSTR TargetFilename;
PWSTR SourceCabinet; /* May be NULL if file is not in a cabinet */
PWSTR SourceRootPath;
PWSTR SourcePath;
PWSTR SourceFilename;
PWSTR TargetDirectory;
PWSTR TargetFilename;
} QUEUEENTRY, *PQUEUEENTRY; } QUEUEENTRY, *PQUEUEENTRY;
typedef struct _FILEQUEUEHEADER typedef struct _FILEQUEUEHEADER
{ {
PQUEUEENTRY CopyHead; PQUEUEENTRY CopyHead;
PQUEUEENTRY CopyTail; PQUEUEENTRY CopyTail;
ULONG CopyCount; ULONG CopyCount;
} FILEQUEUEHEADER, *PFILEQUEUEHEADER; } FILEQUEUEHEADER, *PFILEQUEUEHEADER;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ WINAPI HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID) SetupOpenFileQueue(VOID)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
/* Allocate queue header */ /* Allocate queue header */
QueueHeader = (PFILEQUEUEHEADER)RtlAllocateHeap(ProcessHeap, QueueHeader = (PFILEQUEUEHEADER)RtlAllocateHeap(ProcessHeap,
0, 0,
sizeof(FILEQUEUEHEADER)); sizeof(FILEQUEUEHEADER));
if (QueueHeader == NULL) if (QueueHeader == NULL)
return(NULL); return NULL;
/* Initialize queue header */ /* Initialize queue header */
RtlZeroMemory(QueueHeader, RtlZeroMemory(QueueHeader,
sizeof(FILEQUEUEHEADER)); sizeof(FILEQUEUEHEADER));
return (HSPFILEQ)QueueHeader;
return((HSPFILEQ)QueueHeader);
} }
VOID WINAPI VOID
SetupCloseFileQueue(HSPFILEQ QueueHandle) WINAPI
SetupCloseFileQueue(
HSPFILEQ QueueHandle)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry; PQUEUEENTRY Entry;
if (QueueHandle == NULL) if (QueueHandle == NULL)
return; return;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
/* Delete copy queue */ /* Delete copy queue */
Entry = QueueHeader->CopyHead; Entry = QueueHeader->CopyHead;
while (Entry != NULL) while (Entry != NULL)
{ {
/* Delete all strings */ /* Delete all strings */
if (Entry->SourceCabinet != NULL) if (Entry->SourceCabinet != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
if (Entry->SourceRootPath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
if (Entry->SourcePath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
if (Entry->SourceFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
if (Entry->TargetDirectory != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
if (Entry->TargetFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetFilename);
/* Unlink current queue entry */ if (Entry->SourceRootPath != NULL)
if (Entry->Next != NULL) RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
{
QueueHeader->CopyHead = Entry->Next;
QueueHeader->CopyHead->Prev = NULL;
}
else
{
QueueHeader->CopyHead = NULL;
QueueHeader->CopyTail = NULL;
}
/* Delete queue entry */ if (Entry->SourcePath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
/* Get next queue entry */ if (Entry->SourceFilename != NULL)
Entry = QueueHeader->CopyHead; RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
if (Entry->TargetDirectory != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
if (Entry->TargetFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetFilename);
/* Unlink current queue entry */
if (Entry->Next != NULL)
{
QueueHeader->CopyHead = Entry->Next;
QueueHeader->CopyHead->Prev = NULL;
}
else
{
QueueHeader->CopyHead = NULL;
QueueHeader->CopyTail = NULL;
}
/* Delete queue entry */
RtlFreeHeap(ProcessHeap, 0, Entry);
/* Get next queue entry */
Entry = QueueHeader->CopyHead;
} }
/* Delete queue header */ /* Delete queue header */
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, QueueHeader);
0,
QueueHeader);
} }
BOOL BOOL
SetupQueueCopy(HSPFILEQ QueueHandle, SetupQueueCopy(
PCWSTR SourceCabinet, HSPFILEQ QueueHandle,
PCWSTR SourceRootPath, PCWSTR SourceCabinet,
PCWSTR SourcePath, PCWSTR SourceRootPath,
PCWSTR SourceFilename, PCWSTR SourcePath,
PCWSTR TargetDirectory, PCWSTR SourceFilename,
PCWSTR TargetFilename) PCWSTR TargetDirectory,
PCWSTR TargetFilename)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry; PQUEUEENTRY Entry;
ULONG Length; ULONG Length;
/* SourceCabinet may be NULL */ /* SourceCabinet may be NULL */
if (QueueHandle == NULL || if (QueueHandle == NULL ||
SourceRootPath == NULL || SourceRootPath == NULL ||
SourceFilename == NULL || SourceFilename == NULL ||
TargetDirectory == NULL) TargetDirectory == NULL)
return(FALSE); return FALSE;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
/* Allocate new queue entry */ /* Allocate new queue entry */
Entry = (PQUEUEENTRY)RtlAllocateHeap(ProcessHeap, Entry = (PQUEUEENTRY)RtlAllocateHeap(ProcessHeap,
0, 0,
sizeof(QUEUEENTRY)); sizeof(QUEUEENTRY));
if (Entry == NULL) if (Entry == NULL)
return(FALSE); return FALSE;
RtlZeroMemory(Entry, RtlZeroMemory(Entry,
sizeof(QUEUEENTRY)); sizeof(QUEUEENTRY));
/* Copy source cabinet if available */ /* Copy source cabinet if available */
if (SourceCabinet != NULL) if (SourceCabinet != NULL)
{ {
Length = wcslen(SourceCabinet); Length = wcslen(SourceCabinet);
Entry->SourceCabinet = (WCHAR*) RtlAllocateHeap(ProcessHeap, Entry->SourceCabinet = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
(Length + 1) * sizeof(WCHAR)); (Length + 1) * sizeof(WCHAR));
if (Entry->SourceCabinet == NULL) if (Entry->SourceCabinet == NULL)
{ {
RtlFreeHeap(ProcessHeap, 0, Entry);
return FALSE;
}
wcsncpy(Entry->SourceCabinet, SourceCabinet, Length);
Entry->SourceCabinet[Length] = (WCHAR)0;
}
else
{
Entry->SourceCabinet = NULL;
}
/* Copy source root path */
Length = wcslen(SourceRootPath);
Entry->SourceRootPath = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourceRootPath == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
}
wcsncpy(Entry->SourceCabinet, SourceCabinet, Length);
Entry->SourceCabinet[Length] = (WCHAR)0;
}
else
{
Entry->SourceCabinet = NULL;
} }
/* Copy source root path */ wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
Length = wcslen(SourceRootPath); Entry->SourceRootPath[Length] = (WCHAR)0;
Entry->SourceRootPath = (WCHAR*) RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourceRootPath == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
Entry->SourceRootPath[Length] = (WCHAR)0;
/* Copy source path */ /* Copy source path */
if (SourcePath != NULL) if (SourcePath != NULL)
{
Length = wcslen(SourcePath);
Entry->SourcePath = (WCHAR*) RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourcePath == NULL)
{ {
if (Entry->SourceCabinet != NULL) Length = wcslen(SourcePath);
Entry->SourcePath = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourcePath == NULL)
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry);
return FALSE;
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry); wcsncpy(Entry->SourcePath, SourcePath, Length);
return(FALSE); Entry->SourcePath[Length] = (WCHAR)0;
} }
wcsncpy(Entry->SourcePath, SourcePath, Length);
Entry->SourcePath[Length] = (WCHAR)0;
}
/* Copy source file name */ /* Copy source file name */
Length = wcslen(SourceFilename); Length = wcslen(SourceFilename);
Entry->SourceFilename = (WCHAR*) RtlAllocateHeap(ProcessHeap, Entry->SourceFilename = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
(Length + 1) * sizeof(WCHAR)); (Length + 1) * sizeof(WCHAR));
if (Entry->SourceFilename == NULL) if (Entry->SourceFilename == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->SourceFilename, SourceFilename, Length);
Entry->SourceFilename[Length] = (WCHAR)0;
/* Copy target directory */
Length = wcslen(TargetDirectory);
if (TargetDirectory[Length] == '\\')
Length--;
Entry->TargetDirectory = (WCHAR*) RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetDirectory == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->TargetDirectory, TargetDirectory, Length);
Entry->TargetDirectory[Length] = (WCHAR)0;
/* Copy optional target filename */
if (TargetFilename != NULL)
{
Length = wcslen(TargetFilename);
Entry->TargetFilename = (WCHAR*) RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetFilename == NULL)
{ {
if (Entry->SourceCabinet != NULL) if (Entry->SourceCabinet != NULL)
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory); RtlFreeHeap(ProcessHeap, 0, Entry);
RtlFreeHeap(ProcessHeap, 0, Entry); return FALSE;
return(FALSE);
} }
wcsncpy(Entry->TargetFilename, TargetFilename, Length);
Entry->TargetFilename[Length] = (WCHAR)0;
}
/* Append queue entry */ wcsncpy(Entry->SourceFilename, SourceFilename, Length);
if (QueueHeader->CopyHead == NULL) // && QueueHeader->CopyTail == NULL) Entry->SourceFilename[Length] = (WCHAR)0;
{
Entry->Prev = NULL;
Entry->Next = NULL;
QueueHeader->CopyHead = Entry;
QueueHeader->CopyTail = Entry;
}
else
{
Entry->Prev = QueueHeader->CopyTail;
Entry->Next = NULL;
QueueHeader->CopyTail->Next = Entry;
QueueHeader->CopyTail = Entry;
}
QueueHeader->CopyCount++;
return(TRUE); /* Copy target directory */
Length = wcslen(TargetDirectory);
if (TargetDirectory[Length] == '\\')
Length--;
Entry->TargetDirectory = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetDirectory == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry);
return FALSE;
}
wcsncpy(Entry->TargetDirectory, TargetDirectory, Length);
Entry->TargetDirectory[Length] = (WCHAR)0;
/* Copy optional target filename */
if (TargetFilename != NULL)
{
Length = wcslen(TargetFilename);
Entry->TargetFilename = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetFilename == NULL)
{
if (Entry->SourceCabinet != NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
}
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
RtlFreeHeap(ProcessHeap, 0, Entry);
return FALSE;
}
wcsncpy(Entry->TargetFilename, TargetFilename, Length);
Entry->TargetFilename[Length] = (WCHAR)0;
}
/* Append queue entry */
if (QueueHeader->CopyHead == NULL) // && QueueHeader->CopyTail == NULL)
{
Entry->Prev = NULL;
Entry->Next = NULL;
QueueHeader->CopyHead = Entry;
QueueHeader->CopyTail = Entry;
}
else
{
Entry->Prev = QueueHeader->CopyTail;
Entry->Next = NULL;
QueueHeader->CopyTail->Next = Entry;
QueueHeader->CopyTail = Entry;
}
QueueHeader->CopyCount++;
return TRUE;
} }
BOOL WINAPI BOOL
SetupCommitFileQueueW(HWND Owner, WINAPI
HSPFILEQ QueueHandle, SetupCommitFileQueueW(
PSP_FILE_CALLBACK_W MsgHandler, HWND Owner,
PVOID Context) HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler,
PVOID Context)
{ {
WCHAR CabinetName[MAX_PATH]; WCHAR CabinetName[MAX_PATH];
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry; PQUEUEENTRY Entry;
NTSTATUS Status; NTSTATUS Status;
PCWSTR TargetRootPath, TargetPath; PCWSTR TargetRootPath, TargetPath;
WCHAR FileSrcPath[MAX_PATH]; WCHAR FileSrcPath[MAX_PATH];
WCHAR FileDstPath[MAX_PATH]; WCHAR FileDstPath[MAX_PATH];
TargetRootPath = ((PCOPYCONTEXT)Context)->DestinationRootPath; TargetRootPath = ((PCOPYCONTEXT)Context)->DestinationRootPath;
TargetPath = ((PCOPYCONTEXT)Context)->InstallPath; TargetPath = ((PCOPYCONTEXT)Context)->InstallPath;
if (QueueHandle == NULL) if (QueueHandle == NULL)
return(FALSE); return FALSE;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
MsgHandler(Context,
SPFILENOTIFY_STARTQUEUE,
0,
0);
MsgHandler(Context,
SPFILENOTIFY_STARTSUBQUEUE,
FILEOP_COPY,
QueueHeader->CopyCount);
/* Commit copy queue */
Entry = QueueHeader->CopyHead;
while (Entry != NULL)
{
wcscpy(FileSrcPath, Entry->SourceRootPath);
if (Entry->SourcePath != NULL)
wcscat(FileSrcPath, Entry->SourcePath);
wcscat(FileSrcPath, L"\\");
wcscat(FileSrcPath, Entry->SourceFilename);
/* Build the full target path */
wcscpy(FileDstPath, TargetRootPath);
if (Entry->TargetDirectory[0] == L'\\')
{
wcscat(FileDstPath, Entry->TargetDirectory);
}
else
{
if (TargetPath != NULL)
{
if (TargetPath[0] != L'\\')
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, TargetPath);
}
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, Entry->TargetDirectory);
}
/* Use only the destination path if the file is in a cabinet */
if (Entry->SourceCabinet == NULL)
{
wcscat(FileDstPath, L"\\");
if (Entry->TargetFilename != NULL)
wcscat(FileDstPath, Entry->TargetFilename);
else
wcscat(FileDstPath, Entry->SourceFilename);
}
/* FIXME: Do it! */
DPRINT("'%S' ==> '%S'\n",
FileSrcPath,
FileDstPath);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTCOPY, SPFILENOTIFY_STARTQUEUE,
(UINT_PTR)Entry->SourceFilename, 0,
FILEOP_COPY); 0);
if (Entry->SourceCabinet != NULL) MsgHandler(Context,
{ SPFILENOTIFY_STARTSUBQUEUE,
/* Extract the file */ FILEOP_COPY,
wcscpy(CabinetName, Entry->SourceRootPath); QueueHeader->CopyCount);
/* Commit copy queue */
Entry = QueueHeader->CopyHead;
while (Entry != NULL)
{
wcscpy(FileSrcPath, Entry->SourceRootPath);
if (Entry->SourcePath != NULL) if (Entry->SourcePath != NULL)
wcscat(CabinetName, Entry->SourcePath); wcscat(FileSrcPath, Entry->SourcePath);
wcscat(CabinetName, L"\\"); wcscat(FileSrcPath, L"\\");
wcscat(CabinetName, Entry->SourceCabinet); wcscat(FileSrcPath, Entry->SourceFilename);
Status = SetupExtractFile(CabinetName, Entry->SourceFilename, FileDstPath);
}
else
{
/* Copy the file */
Status = SetupCopyFile(FileSrcPath, FileDstPath);
}
if (!NT_SUCCESS(Status))
{
MsgHandler(Context,
SPFILENOTIFY_COPYERROR,
(UINT_PTR)Entry->SourceFilename,
FILEOP_COPY);
} /* Build the full target path */
else wcscpy(FileDstPath, TargetRootPath);
{ if (Entry->TargetDirectory[0] == L'\\')
MsgHandler(Context, {
SPFILENOTIFY_ENDCOPY, wcscat(FileDstPath, Entry->TargetDirectory);
(UINT_PTR)Entry->SourceFilename, }
FILEOP_COPY); else
{
if (TargetPath != NULL)
{
if (TargetPath[0] != L'\\')
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, TargetPath);
}
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, Entry->TargetDirectory);
}
/* Use only the destination path if the file is in a cabinet */
if (Entry->SourceCabinet == NULL)
{
wcscat(FileDstPath, L"\\");
if (Entry->TargetFilename != NULL)
wcscat(FileDstPath, Entry->TargetFilename);
else
wcscat(FileDstPath, Entry->SourceFilename);
}
/* FIXME: Do it! */
DPRINT("'%S' ==> '%S'\n", FileSrcPath, FileDstPath);
MsgHandler(Context,
SPFILENOTIFY_STARTCOPY,
(UINT_PTR)Entry->SourceFilename,
FILEOP_COPY);
if (Entry->SourceCabinet != NULL)
{
/* Extract the file */
wcscpy(CabinetName, Entry->SourceRootPath);
if (Entry->SourcePath != NULL)
wcscat(CabinetName, Entry->SourcePath);
wcscat(CabinetName, L"\\");
wcscat(CabinetName, Entry->SourceCabinet);
Status = SetupExtractFile(CabinetName, Entry->SourceFilename, FileDstPath);
}
else
{
/* Copy the file */
Status = SetupCopyFile(FileSrcPath, FileDstPath);
}
if (!NT_SUCCESS(Status))
{
MsgHandler(Context,
SPFILENOTIFY_COPYERROR,
(UINT_PTR)Entry->SourceFilename,
FILEOP_COPY);
}
else
{
MsgHandler(Context,
SPFILENOTIFY_ENDCOPY,
(UINT_PTR)Entry->SourceFilename,
FILEOP_COPY);
}
Entry = Entry->Next;
} }
Entry = Entry->Next; MsgHandler(Context,
} SPFILENOTIFY_ENDSUBQUEUE,
FILEOP_COPY,
0);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_ENDSUBQUEUE, SPFILENOTIFY_ENDQUEUE,
FILEOP_COPY, 0,
0); 0);
MsgHandler(Context, return TRUE;
SPFILENOTIFY_ENDQUEUE,
0,
0);
return(TRUE);
} }
/* EOF */ /* EOF */

View file

@ -51,55 +51,62 @@
typedef PVOID HSPFILEQ; typedef PVOID HSPFILEQ;
typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(PVOID Context, typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(
UINT Notification, PVOID Context,
UINT_PTR Param1, UINT Notification,
UINT_PTR Param2); UINT_PTR Param1,
UINT_PTR Param2);
typedef struct _COPYCONTEXT typedef struct _COPYCONTEXT
{ {
LPCWSTR DestinationRootPath; /* Not owned by this structure */ LPCWSTR DestinationRootPath; /* Not owned by this structure */
LPCWSTR InstallPath; /* Not owned by this structure */ LPCWSTR InstallPath; /* Not owned by this structure */
ULONG TotalOperations; ULONG TotalOperations;
ULONG CompletedOperations; ULONG CompletedOperations;
PPROGRESSBAR ProgressBar; PPROGRESSBAR ProgressBar;
PPROGRESSBAR MemoryBars[4]; PPROGRESSBAR MemoryBars[4];
} COPYCONTEXT, *PCOPYCONTEXT; } COPYCONTEXT, *PCOPYCONTEXT;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ WINAPI HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID); SetupOpenFileQueue(VOID);
VOID WINAPI VOID
WINAPI
SetupCloseFileQueue( SetupCloseFileQueue(
IN HSPFILEQ QueueHandle); IN HSPFILEQ QueueHandle);
BOOL WINAPI
SetupQueueCopyWNew(
IN HSPFILEQ QueueHandle,
IN PCWSTR SourceRootPath,
IN PCWSTR SourcePath,
IN PCWSTR SourceFileName,
IN PCWSTR SourceDescription,
IN PCWSTR SourceTagFile,
IN PCWSTR TargetDirectory,
IN PCWSTR TargetFileName,
IN DWORD CopyStyle);
BOOL BOOL
SetupQueueCopy(HSPFILEQ QueueHandle, WINAPI
PCWSTR SourceCabinet, SetupQueueCopyWNew(
PCWSTR SourceRootPath, IN HSPFILEQ QueueHandle,
PCWSTR SourcePath, IN PCWSTR SourceRootPath,
PCWSTR SourceFilename, IN PCWSTR SourcePath,
PCWSTR TargetDirectory, IN PCWSTR SourceFileName,
PCWSTR TargetFilename); IN PCWSTR SourceDescription,
IN PCWSTR SourceTagFile,
IN PCWSTR TargetDirectory,
IN PCWSTR TargetFileName,
IN DWORD CopyStyle);
BOOL WINAPI BOOL
SetupCommitFileQueueW(HWND Owner, SetupQueueCopy(
HSPFILEQ QueueHandle, HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler, PCWSTR SourceCabinet,
PVOID Context); PCWSTR SourceRootPath,
PCWSTR SourcePath,
PCWSTR SourceFilename,
PCWSTR TargetDirectory,
PCWSTR TargetFilename);
BOOL
WINAPI
SetupCommitFileQueueW(
HWND Owner,
HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler,
PVOID Context);
/* EOF */ /* EOF */

View file

@ -38,358 +38,373 @@ static WCHAR CurrentCabinetName[MAX_PATH];
static CAB_SEARCH Search; static CAB_SEARCH Search;
NTSTATUS NTSTATUS
SetupCreateDirectory(PWCHAR DirectoryName) SetupCreateDirectory(
PWCHAR DirectoryName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING PathName; UNICODE_STRING PathName;
HANDLE DirectoryHandle; HANDLE DirectoryHandle;
NTSTATUS Status; NTSTATUS Status;
RtlCreateUnicodeString(&PathName, RtlCreateUnicodeString(&PathName,
DirectoryName); DirectoryName);
if (PathName.Length > sizeof(WCHAR) && if (PathName.Length > sizeof(WCHAR) &&
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 2] == L'\\' && PathName.Buffer[PathName.Length / sizeof(WCHAR) - 2] == L'\\' &&
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'.') PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'.')
{ {
PathName.Length -= sizeof(WCHAR); PathName.Length -= sizeof(WCHAR);
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0; PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
} }
if (PathName.Length > sizeof(WCHAR) && if (PathName.Length > sizeof(WCHAR) &&
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'\\') PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'\\')
{ {
PathName.Length -= sizeof(WCHAR); PathName.Length -= sizeof(WCHAR);
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0; PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
}
InitializeObjectAttributes(&ObjectAttributes,
&PathName,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL,
NULL);
Status = NtCreateFile(&DirectoryHandle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_DIRECTORY,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_DIRECTORY_FILE,
NULL,
0);
if (NT_SUCCESS(Status))
{
NtClose(DirectoryHandle);
} }
RtlFreeUnicodeString(&PathName); InitializeObjectAttributes(&ObjectAttributes,
&PathName,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL,
NULL);
return(Status); Status = NtCreateFile(&DirectoryHandle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_DIRECTORY,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_DIRECTORY_FILE,
NULL,
0);
if (NT_SUCCESS(Status))
{
NtClose(DirectoryHandle);
}
RtlFreeUnicodeString(&PathName);
return Status;
} }
NTSTATUS NTSTATUS
SetupCopyFile(PWCHAR SourceFileName, SetupCopyFile(
PWCHAR DestinationFileName) PWCHAR SourceFileName,
PWCHAR DestinationFileName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE FileHandleSource; HANDLE FileHandleSource;
HANDLE FileHandleDest; HANDLE FileHandleDest;
static IO_STATUS_BLOCK IoStatusBlock; static IO_STATUS_BLOCK IoStatusBlock;
FILE_STANDARD_INFORMATION FileStandard; FILE_STANDARD_INFORMATION FileStandard;
FILE_BASIC_INFORMATION FileBasic; FILE_BASIC_INFORMATION FileBasic;
ULONG RegionSize; ULONG RegionSize;
UNICODE_STRING FileName; UNICODE_STRING FileName;
NTSTATUS Status; NTSTATUS Status;
PVOID SourceFileMap = 0; PVOID SourceFileMap = 0;
HANDLE SourceFileSection; HANDLE SourceFileSection;
SIZE_T SourceSectionSize = 0; SIZE_T SourceSectionSize = 0;
LARGE_INTEGER ByteOffset; LARGE_INTEGER ByteOffset;
#ifdef __REACTOS__ #ifdef __REACTOS__
RtlInitUnicodeString(&FileName, RtlInitUnicodeString(&FileName,
SourceFileName); SourceFileName);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&FileName, &FileName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&FileHandleSource, Status = NtOpenFile(&FileHandleSource,
GENERIC_READ, GENERIC_READ,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
FILE_SHARE_READ, FILE_SHARE_READ,
FILE_SEQUENTIAL_ONLY); FILE_SEQUENTIAL_ONLY);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName); DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName);
goto done; goto done;
} }
#else #else
FileHandleSource = CreateFileW(SourceFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); FileHandleSource = CreateFileW(SourceFileName,
if (FileHandleSource == INVALID_HANDLE_VALUE) GENERIC_READ,
{ FILE_SHARE_READ,
Status = STATUS_UNSUCCESSFUL; NULL,
goto done; OPEN_EXISTING,
} 0,
NULL);
if (FileHandleSource == INVALID_HANDLE_VALUE)
{
Status = STATUS_UNSUCCESSFUL;
goto done;
}
#endif #endif
Status = NtQueryInformationFile(FileHandleSource, Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock, &IoStatusBlock,
&FileStandard, &FileStandard,
sizeof(FILE_STANDARD_INFORMATION), sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation); FileStandardInformation);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtQueryInformationFile failed: %x\n", Status); DPRINT1("NtQueryInformationFile failed: %x\n", Status);
goto closesrc; goto closesrc;
}
Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock,&FileBasic,
sizeof(FILE_BASIC_INFORMATION),
FileBasicInformation);
if(!NT_SUCCESS(Status))
{
DPRINT1("NtQueryInformationFile failed: %x\n", Status);
goto closesrc;
} }
Status = NtCreateSection( &SourceFileSection, Status = NtQueryInformationFile(FileHandleSource,
SECTION_MAP_READ, &IoStatusBlock,&FileBasic,
NULL, sizeof(FILE_BASIC_INFORMATION),
NULL, FileBasicInformation);
PAGE_READONLY, if (!NT_SUCCESS(Status))
SEC_COMMIT, {
FileHandleSource); DPRINT1("NtQueryInformationFile failed: %x\n", Status);
if(!NT_SUCCESS(Status)) goto closesrc;
}
Status = NtCreateSection(&SourceFileSection,
SECTION_MAP_READ,
NULL,
NULL,
PAGE_READONLY,
SEC_COMMIT,
FileHandleSource);
if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateSection failed: %x, %S\n", Status, SourceFileName); DPRINT1("NtCreateSection failed: %x, %S\n", Status, SourceFileName);
goto closesrc; goto closesrc;
} }
Status = NtMapViewOfSection( SourceFileSection, Status = NtMapViewOfSection(SourceFileSection,
NtCurrentProcess(), NtCurrentProcess(),
&SourceFileMap, &SourceFileMap,
0, 0,
0, 0,
NULL, NULL,
&SourceSectionSize, &SourceSectionSize,
ViewUnmap, ViewUnmap,
0, 0,
PAGE_READONLY ); PAGE_READONLY );
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtMapViewOfSection failed: %x, %S\n", Status, SourceFileName); DPRINT1("NtMapViewOfSection failed: %x, %S\n", Status, SourceFileName);
goto closesrcsec; goto closesrcsec;
} }
RtlInitUnicodeString(&FileName, RtlInitUnicodeString(&FileName,
DestinationFileName); DestinationFileName);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&FileName, &FileName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtCreateFile(&FileHandleDest, Status = NtCreateFile(&FileHandleDest,
GENERIC_WRITE | SYNCHRONIZE, GENERIC_WRITE | SYNCHRONIZE,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
NULL, NULL,
FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_NORMAL,
0, 0,
FILE_OVERWRITE_IF, FILE_OVERWRITE_IF,
FILE_NO_INTERMEDIATE_BUFFERING | FILE_NO_INTERMEDIATE_BUFFERING |
FILE_SEQUENTIAL_ONLY | FILE_SEQUENTIAL_ONLY |
FILE_SYNCHRONOUS_IO_NONALERT, FILE_SYNCHRONOUS_IO_NONALERT,
NULL, NULL,
0); 0);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateFile failed: %x\n", Status); DPRINT1("NtCreateFile failed: %x\n", Status);
goto unmapsrcsec; goto unmapsrcsec;
} }
RegionSize = (ULONG)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; ByteOffset.QuadPart = 0;
Status = NtWriteFile(FileHandleDest, Status = NtWriteFile(FileHandleDest,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&IoStatusBlock, &IoStatusBlock,
SourceFileMap, SourceFileMap,
RegionSize, RegionSize,
&ByteOffset, &ByteOffset,
NULL); 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);
goto closedest; goto closedest;
}
/* Copy file date/time from source file */
Status = NtSetInformationFile(FileHandleDest,
&IoStatusBlock,
&FileBasic,
sizeof(FILE_BASIC_INFORMATION),
FileBasicInformation);
if(!NT_SUCCESS(Status))
{
DPRINT1("NtSetInformationFile failed: %x\n", Status);
goto closedest;
} }
/* shorten the file back to it's real size after completing the write */ /* Copy file date/time from source file */
Status = NtSetInformationFile(FileHandleDest, Status = NtSetInformationFile(FileHandleDest,
&IoStatusBlock, &IoStatusBlock,
&FileStandard.EndOfFile, &FileBasic,
sizeof(FILE_END_OF_FILE_INFORMATION), sizeof(FILE_BASIC_INFORMATION),
FileEndOfFileInformation); FileBasicInformation);
if (!NT_SUCCESS(Status))
if(!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetInformationFile failed: %x\n", Status); DPRINT1("NtSetInformationFile failed: %x\n", Status);
goto closedest;
} }
closedest: /* shorten the file back to it's real size after completing the write */
NtClose(FileHandleDest); Status = NtSetInformationFile(FileHandleDest,
unmapsrcsec: &IoStatusBlock,
NtUnmapViewOfSection( NtCurrentProcess(), SourceFileMap ); &FileStandard.EndOfFile,
closesrcsec: sizeof(FILE_END_OF_FILE_INFORMATION),
NtClose(SourceFileSection); FileEndOfFileInformation);
closesrc: if (!NT_SUCCESS(Status))
NtClose(FileHandleSource); {
done: DPRINT1("NtSetInformationFile failed: %x\n", Status);
return(Status); }
closedest:
NtClose(FileHandleDest);
unmapsrcsec:
NtUnmapViewOfSection(NtCurrentProcess(), SourceFileMap);
closesrcsec:
NtClose(SourceFileSection);
closesrc:
NtClose(FileHandleSource);
done:
return Status;
} }
#ifdef __REACTOS__ #ifdef __REACTOS__
NTSTATUS NTSTATUS
SetupExtractFile(PWCHAR CabinetFileName, SetupExtractFile(
PWCHAR SourceFileName, PWCHAR CabinetFileName,
PWCHAR DestinationPathName) PWCHAR SourceFileName,
PWCHAR DestinationPathName)
{ {
ULONG CabStatus; ULONG CabStatus;
DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S, DestinationPathName %S)\n", DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S, DestinationPathName %S)\n",
CabinetFileName, SourceFileName, DestinationPathName); CabinetFileName, SourceFileName, DestinationPathName);
if (HasCurrentCabinet) if (HasCurrentCabinet)
{ {
DPRINT("CurrentCabinetName: %S\n", CurrentCabinetName); DPRINT("CurrentCabinetName: %S\n", CurrentCabinetName);
} }
if ((HasCurrentCabinet) && (wcscmp(CabinetFileName, CurrentCabinetName) == 0)) if ((HasCurrentCabinet) && (wcscmp(CabinetFileName, CurrentCabinetName) == 0))
{ {
DPRINT("Using same cabinet as last time\n"); DPRINT("Using same cabinet as last time\n");
/* Use our last location because the files should be sequential */ /* Use our last location because the files should be sequential */
CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search); CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search);
if (CabStatus != CAB_STATUS_SUCCESS) if (CabStatus != CAB_STATUS_SUCCESS)
{
DPRINT("Sequential miss on file: %S\n", SourceFileName);
/* Looks like we got unlucky */
CabStatus = CabinetFindFirst(SourceFileName, &Search);
}
}
else
{
DPRINT("Using new cabinet\n");
if (HasCurrentCabinet)
{ {
CabinetCleanup(); DPRINT("Sequential miss on file: %S\n", SourceFileName);
/* Looks like we got unlucky */
CabStatus = CabinetFindFirst(SourceFileName, &Search);
}
}
else
{
DPRINT("Using new cabinet\n");
if (HasCurrentCabinet)
{
CabinetCleanup();
} }
wcscpy(CurrentCabinetName, CabinetFileName); wcscpy(CurrentCabinetName, CabinetFileName);
CabinetInitialize(); CabinetInitialize();
CabinetSetEventHandlers(NULL, NULL, NULL); CabinetSetEventHandlers(NULL, NULL, NULL);
CabinetSetCabinetName(CabinetFileName); CabinetSetCabinetName(CabinetFileName);
CabStatus = CabinetOpen(); CabStatus = CabinetOpen();
if (CabStatus == CAB_STATUS_SUCCESS) if (CabStatus == CAB_STATUS_SUCCESS)
{ {
DPRINT("Opened cabinet %S\n", CabinetGetCabinetName()); DPRINT("Opened cabinet %S\n", CabinetGetCabinetName());
HasCurrentCabinet = TRUE; HasCurrentCabinet = TRUE;
} }
else else
{ {
DPRINT("Cannot open cabinet (%d)\n", CabStatus); DPRINT("Cannot open cabinet (%d)\n", CabStatus);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
/* We have to start at the beginning here */ /* We have to start at the beginning here */
CabStatus = CabinetFindFirst(SourceFileName, &Search); CabStatus = CabinetFindFirst(SourceFileName, &Search);
} }
if (CabStatus != CAB_STATUS_SUCCESS) if (CabStatus != CAB_STATUS_SUCCESS)
{
DPRINT1("Unable to find '%S' in cabinet '%S'\n", SourceFileName, CabinetGetCabinetName());
return STATUS_UNSUCCESSFUL;
}
CabinetSetDestinationPath(DestinationPathName);
CabStatus = CabinetExtractFile(&Search);
if (CabStatus != CAB_STATUS_SUCCESS)
{ {
DPRINT("Cannot extract file %S (%d)\n", SourceFileName, CabStatus); DPRINT1("Unable to find '%S' in cabinet '%S'\n", SourceFileName, CabinetGetCabinetName());
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return STATUS_SUCCESS; CabinetSetDestinationPath(DestinationPathName);
CabStatus = CabinetExtractFile(&Search);
if (CabStatus != CAB_STATUS_SUCCESS)
{
DPRINT("Cannot extract file %S (%d)\n", SourceFileName, CabStatus);
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
} }
#endif #endif
BOOLEAN BOOLEAN
DoesFileExist(PWSTR PathName, DoesFileExist(
PWSTR FileName) PWSTR PathName,
PWSTR FileName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING Name; UNICODE_STRING Name;
WCHAR FullName[MAX_PATH]; WCHAR FullName[MAX_PATH];
HANDLE FileHandle; HANDLE FileHandle;
NTSTATUS Status; NTSTATUS Status;
wcscpy(FullName, PathName); wcscpy(FullName, PathName);
if (FileName != NULL) if (FileName != NULL)
{ {
if (FileName[0] != L'\\') if (FileName[0] != L'\\')
wcscat(FullName, L"\\"); wcscat(FullName, L"\\");
wcscat(FullName, FileName); wcscat(FullName, FileName);
} }
RtlInitUnicodeString(&Name, RtlInitUnicodeString(&Name,
FullName); FullName);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&Name, &Name,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&FileHandle, Status = NtOpenFile(&FileHandle,
GENERIC_READ | SYNCHRONIZE, GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
0, 0,
FILE_SYNCHRONOUS_IO_NONALERT); FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(FALSE); return FALSE;
} }
NtClose(FileHandle); NtClose(FileHandle);
return(TRUE); return TRUE;
} }
/* EOF */ /* EOF */

View file

@ -27,19 +27,23 @@
#pragma once #pragma once
NTSTATUS NTSTATUS
SetupCreateDirectory(PWCHAR DirectoryName); SetupCreateDirectory(
PWCHAR DirectoryName);
NTSTATUS NTSTATUS
SetupCopyFile(PWCHAR SourceFileName, SetupCopyFile(
PWCHAR DestinationFileName); PWCHAR SourceFileName,
PWCHAR DestinationFileName);
NTSTATUS NTSTATUS
SetupExtractFile(PWCHAR CabinetFileName, SetupExtractFile(
PWCHAR SourceFileName, PWCHAR CabinetFileName,
PWCHAR DestinationFileName); PWCHAR SourceFileName,
PWCHAR DestinationFileName);
BOOLEAN BOOLEAN
DoesFileExist(PWSTR PathName, DoesFileExist(
PWSTR FileName); PWSTR PathName,
PWSTR FileName);
/* EOF */ /* EOF */

View file

@ -34,7 +34,9 @@ static PPROGRESSBAR FormatProgressBar = NULL;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static BOOLEAN NTAPI static
BOOLEAN
NTAPI
FormatCallback( FormatCallback(
IN CALLBACKCOMMAND Command, IN CALLBACKCOMMAND Command,
IN ULONG Modifier, IN ULONG Modifier,
@ -82,6 +84,7 @@ FormatCallback(
return TRUE; return TRUE;
} }
NTSTATUS NTSTATUS
FormatPartition( FormatPartition(
IN PUNICODE_STRING DriveRoot, IN PUNICODE_STRING DriveRoot,

View file

@ -65,6 +65,7 @@ FS_AddProvider(
InsertTailList(&List->ListHead, &Item->ListEntry); InsertTailList(&List->ListHead, &Item->ListEntry);
} }
PFILE_SYSTEM_LIST PFILE_SYSTEM_LIST
CreateFileSystemList( CreateFileSystemList(
IN SHORT Left, IN SHORT Left,
@ -111,6 +112,7 @@ CreateFileSystemList(
return List; return List;
} }
VOID VOID
DestroyFileSystemList( DestroyFileSystemList(
IN PFILE_SYSTEM_LIST List) IN PFILE_SYSTEM_LIST List)
@ -131,6 +133,7 @@ DestroyFileSystemList(
RtlFreeHeap(ProcessHeap, 0, List); RtlFreeHeap(ProcessHeap, 0, List);
} }
VOID VOID
DrawFileSystemList( DrawFileSystemList(
IN PFILE_SYSTEM_LIST List) IN PFILE_SYSTEM_LIST List)
@ -183,6 +186,7 @@ DrawFileSystemList(
} }
} }
VOID VOID
ScrollDownFileSystemList( ScrollDownFileSystemList(
IN PFILE_SYSTEM_LIST List) IN PFILE_SYSTEM_LIST List)
@ -194,6 +198,7 @@ ScrollDownFileSystemList(
} }
} }
VOID VOID
ScrollUpFileSystemList( ScrollUpFileSystemList(
IN PFILE_SYSTEM_LIST List) IN PFILE_SYSTEM_LIST List)

View file

@ -30,34 +30,34 @@
typedef struct _FILE_SYSTEM_ITEM typedef struct _FILE_SYSTEM_ITEM
{ {
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
LPCWSTR 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 VOID
FS_AddProvider( FS_AddProvider(
IN OUT PFILE_SYSTEM_LIST List, IN OUT PFILE_SYSTEM_LIST List,
IN LPCWSTR FileSystem, IN LPCWSTR FileSystem,
IN FORMATEX FormatFunc, IN FORMATEX FormatFunc,
IN CHKDSKEX ChkdskFunc); 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 LPCWSTR ForceFileSystem); IN LPCWSTR ForceFileSystem);
VOID VOID
DestroyFileSystemList( DestroyFileSystemList(

View file

@ -84,8 +84,9 @@ CreateGenericList(VOID)
VOID VOID
DestroyGenericList(PGENERIC_LIST List, DestroyGenericList(
BOOLEAN FreeUserData) PGENERIC_LIST List,
BOOLEAN FreeUserData)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
@ -110,10 +111,11 @@ DestroyGenericList(PGENERIC_LIST List,
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(
PCHAR Text, PGENERIC_LIST List,
PVOID UserData, PCHAR Text,
BOOLEAN Current) PVOID UserData,
BOOLEAN Current)
{ {
PGENERIC_LIST_ENTRY Entry; PGENERIC_LIST_ENTRY Entry;
@ -139,8 +141,10 @@ AppendGenericListEntry(PGENERIC_LIST List,
} }
static VOID static
DrawListFrame(PGENERIC_LIST GenericList) VOID
DrawListFrame(
PGENERIC_LIST GenericList)
{ {
COORD coPos; COORD coPos;
DWORD Written; DWORD Written;
@ -221,8 +225,10 @@ DrawListFrame(PGENERIC_LIST GenericList)
} }
static VOID static
DrawListEntries(PGENERIC_LIST GenericList) VOID
DrawListEntries(
PGENERIC_LIST GenericList)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
@ -286,8 +292,11 @@ DrawListEntries(PGENERIC_LIST GenericList)
} }
} }
static VOID
DrawScrollBarGenericList(PGENERIC_LIST GenericList) static
VOID
DrawScrollBarGenericList(
PGENERIC_LIST GenericList)
{ {
COORD coPos; COORD coPos;
DWORD Written; DWORD Written;
@ -331,12 +340,14 @@ DrawScrollBarGenericList(PGENERIC_LIST GenericList)
} }
} }
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(
SHORT Left, PGENERIC_LIST List,
SHORT Top, SHORT Left,
SHORT Right, SHORT Top,
SHORT Bottom) SHORT Right,
SHORT Bottom)
{ {
List->FirstShown = List->ListHead.Flink; List->FirstShown = List->ListHead.Flink;
List->Left = Left; List->Left = Left;
@ -353,8 +364,10 @@ DrawGenericList(PGENERIC_LIST List,
DrawScrollBarGenericList(List); DrawScrollBarGenericList(List);
} }
VOID VOID
ScrollPageDownGenericList (PGENERIC_LIST List) ScrollPageDownGenericList(
PGENERIC_LIST List)
{ {
SHORT i; SHORT i;
@ -374,8 +387,10 @@ ScrollPageDownGenericList (PGENERIC_LIST List)
List->Redraw = TRUE; List->Redraw = TRUE;
} }
VOID VOID
ScrollPageUpGenericList (PGENERIC_LIST List) ScrollPageUpGenericList(
PGENERIC_LIST List)
{ {
SHORT i; SHORT i;
@ -395,8 +410,10 @@ ScrollPageUpGenericList (PGENERIC_LIST List)
List->Redraw = TRUE; List->Redraw = TRUE;
} }
VOID VOID
ScrollDownGenericList (PGENERIC_LIST List) ScrollDownGenericList(
PGENERIC_LIST List)
{ {
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
@ -423,7 +440,9 @@ ScrollDownGenericList (PGENERIC_LIST List)
VOID VOID
ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex) ScrollToPositionGenericList(
PGENERIC_LIST List,
ULONG uIndex)
{ {
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
ULONG uCount = 0; ULONG uCount = 0;
@ -456,7 +475,8 @@ ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex)
VOID VOID
ScrollUpGenericList (PGENERIC_LIST List) ScrollUpGenericList(
PGENERIC_LIST List)
{ {
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
@ -483,7 +503,8 @@ ScrollUpGenericList (PGENERIC_LIST List)
VOID VOID
RedrawGenericList(PGENERIC_LIST List) RedrawGenericList(
PGENERIC_LIST List)
{ {
if (List->CurrentEntry == NULL) if (List->CurrentEntry == NULL)
return; return;
@ -497,7 +518,9 @@ RedrawGenericList(PGENERIC_LIST List)
VOID VOID
SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry) SetCurrentListEntry(
PGENERIC_LIST List,
PGENERIC_LIST_ENTRY Entry)
{ {
if (Entry->List != List) if (Entry->List != List)
return; return;
@ -506,14 +529,16 @@ SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry)
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetCurrentListEntry(PGENERIC_LIST List) GetCurrentListEntry(
PGENERIC_LIST List)
{ {
return List->CurrentEntry; return List->CurrentEntry;
} }
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetFirstListEntry(PGENERIC_LIST List) GetFirstListEntry(
PGENERIC_LIST List)
{ {
PLIST_ENTRY Entry = List->ListHead.Flink; PLIST_ENTRY Entry = List->ListHead.Flink;
@ -524,7 +549,8 @@ GetFirstListEntry(PGENERIC_LIST List)
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetNextListEntry(PGENERIC_LIST_ENTRY Entry) GetNextListEntry(
PGENERIC_LIST_ENTRY Entry)
{ {
PLIST_ENTRY Next = Entry->Entry.Flink; PLIST_ENTRY Next = Entry->Entry.Flink;
@ -535,21 +561,25 @@ GetNextListEntry(PGENERIC_LIST_ENTRY Entry)
PVOID PVOID
GetListEntryUserData(PGENERIC_LIST_ENTRY List) GetListEntryUserData(
PGENERIC_LIST_ENTRY List)
{ {
return List->UserData; return List->UserData;
} }
LPCSTR LPCSTR
GetListEntryText(PGENERIC_LIST_ENTRY List) GetListEntryText(
PGENERIC_LIST_ENTRY List)
{ {
return List->Text; return List->Text;
} }
VOID VOID
GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar) GenericListKeyPress(
PGENERIC_LIST GenericList,
CHAR AsciChar)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PGENERIC_LIST_ENTRY OldListEntry; PGENERIC_LIST_ENTRY OldListEntry;
@ -609,14 +639,16 @@ End:
VOID VOID
SaveGenericListState(PGENERIC_LIST List) SaveGenericListState(
PGENERIC_LIST List)
{ {
List->BackupEntry = List->CurrentEntry; List->BackupEntry = List->CurrentEntry;
} }
VOID VOID
RestoreGenericListState(PGENERIC_LIST List) RestoreGenericListState(
PGENERIC_LIST List)
{ {
List->CurrentEntry = List->BackupEntry; List->CurrentEntry = List->BackupEntry;
} }

View file

@ -35,68 +35,90 @@ PGENERIC_LIST
CreateGenericList(VOID); CreateGenericList(VOID);
VOID VOID
DestroyGenericList(PGENERIC_LIST List, DestroyGenericList(
BOOLEAN FreeUserData); PGENERIC_LIST List,
BOOLEAN FreeUserData);
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(
PCHAR Text, PGENERIC_LIST List,
PVOID UserData, PCHAR Text,
BOOLEAN Current); PVOID UserData,
BOOLEAN Current);
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(
SHORT Left, PGENERIC_LIST List,
SHORT Top, SHORT Left,
SHORT Right, SHORT Top,
SHORT Bottom); SHORT Right,
SHORT Bottom);
VOID VOID
DrawScrollBarGenericLis(PGENERIC_LIST List); DrawScrollBarGenericLis(
PGENERIC_LIST List);
VOID VOID
ScrollDownGenericList(PGENERIC_LIST List); ScrollDownGenericList(
PGENERIC_LIST List);
VOID VOID
ScrollUpGenericList(PGENERIC_LIST List); ScrollUpGenericList(
PGENERIC_LIST List);
VOID VOID
ScrollPageDownGenericList(PGENERIC_LIST List); ScrollPageDownGenericList(
PGENERIC_LIST List);
VOID VOID
ScrollPageUpGenericList(PGENERIC_LIST List); ScrollPageUpGenericList(
PGENERIC_LIST List);
VOID VOID
ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex); ScrollToPositionGenericList(
PGENERIC_LIST List,
ULONG uIndex);
VOID VOID
RedrawGenericList(PGENERIC_LIST List); RedrawGenericList(
PGENERIC_LIST List);
VOID VOID
SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry); SetCurrentListEntry(
PGENERIC_LIST List,
PGENERIC_LIST_ENTRY Entry);
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetCurrentListEntry(PGENERIC_LIST List); GetCurrentListEntry(
PGENERIC_LIST List);
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetFirstListEntry(PGENERIC_LIST List); GetFirstListEntry(
PGENERIC_LIST List);
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetNextListEntry(PGENERIC_LIST_ENTRY Entry); GetNextListEntry(
PGENERIC_LIST_ENTRY Entry);
PVOID PVOID
GetListEntryUserData(PGENERIC_LIST_ENTRY List); GetListEntryUserData(
PGENERIC_LIST_ENTRY List);
LPCSTR LPCSTR
GetListEntryText(PGENERIC_LIST_ENTRY List); GetListEntryText(
PGENERIC_LIST_ENTRY List);
VOID VOID
SaveGenericListState(PGENERIC_LIST List); SaveGenericListState(
PGENERIC_LIST List);
VOID VOID
RestoreGenericListState(PGENERIC_LIST List); RestoreGenericListState(
PGENERIC_LIST List);
VOID VOID
GenericListKeyPress (PGENERIC_LIST List, CHAR AsciChar); GenericListKeyPress(
PGENERIC_LIST List,
CHAR AsciChar);
/* EOF */ /* EOF */

View file

@ -15,19 +15,17 @@
#endif #endif
BOOLEAN BOOLEAN
HOST_InitConsole( HOST_InitConsole(VOID);
VOID);
BOOLEAN BOOLEAN
HOST_InitMemory( HOST_InitMemory(VOID);
VOID);
BOOLEAN BOOLEAN
HOST_CreateFileSystemList( HOST_CreateFileSystemList(
IN PFILE_SYSTEM_LIST List); IN PFILE_SYSTEM_LIST List);
BOOLEAN BOOLEAN
HOST_FormatPartition( HOST_FormatPartition(
IN PFILE_SYSTEM_ITEM FileSystem, IN PFILE_SYSTEM_ITEM FileSystem,
IN PCUNICODE_STRING DriveRoot, IN PCUNICODE_STRING DriveRoot,
IN PFMIFSCALLBACK Callback); IN PFMIFSCALLBACK Callback);

View file

@ -35,173 +35,179 @@
#ifdef __REACTOS__ #ifdef __REACTOS__
BOOL WINAPI BOOL
WINAPI
InfpFindFirstLineW( InfpFindFirstLineW(
IN HINF InfHandle, IN HINF InfHandle,
IN PCWSTR Section, IN PCWSTR Section,
IN PCWSTR Key, IN PCWSTR Key,
IN OUT PINFCONTEXT Context) IN OUT PINFCONTEXT Context)
{ {
PINFCONTEXT pContext; PINFCONTEXT pContext;
BOOL ret; BOOL ret;
ret = InfFindFirstLine(InfHandle, Section, Key, &pContext); ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
if (!ret) if (!ret)
return FALSE; return FALSE;
memcpy(Context, pContext, sizeof(INFCONTEXT)); memcpy(Context, pContext, sizeof(INFCONTEXT));
InfFreeContext(pContext); InfFreeContext(pContext);
return TRUE; return TRUE;
} }
HINF WINAPI
HINF
WINAPI
InfpOpenInfFileW( InfpOpenInfFileW(
IN PCWSTR FileName, IN PCWSTR FileName,
IN PCWSTR InfClass, IN PCWSTR InfClass,
IN DWORD InfStyle, IN DWORD InfStyle,
IN LCID LocaleId, IN LCID LocaleId,
OUT PUINT ErrorLine) OUT PUINT ErrorLine)
{ {
HINF hInf = NULL; HINF hInf = NULL;
UNICODE_STRING FileNameU; UNICODE_STRING FileNameU;
ULONG ErrorLineUL; ULONG ErrorLineUL;
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString(&FileNameU, FileName); RtlInitUnicodeString(&FileNameU, FileName);
Status = InfOpenFile( Status = InfOpenFile(&hInf,
&hInf, &FileNameU,
&FileNameU, LANGIDFROMLCID(LocaleId),
LANGIDFROMLCID(LocaleId), &ErrorLineUL);
&ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL;
*ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status)) return INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
return hInf; return hInf;
} }
#endif /* __REACTOS__ */ #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__ #ifdef __REACTOS__
return InfGetData(Context, Key, Data); return InfGetData(Context, Key, Data);
#else #else
static PWCHAR pLastCallData[4] = { NULL, NULL, NULL, NULL }; static PWCHAR pLastCallData[4] = { NULL, NULL, NULL, NULL };
static DWORD currentIndex = 0; static DWORD currentIndex = 0;
DWORD dwSize, i; DWORD dwSize, i;
BOOL ret; BOOL ret;
currentIndex ^= 2; currentIndex ^= 2;
if (Key) *Key = NULL; if (Key)
if (Data) *Data = NULL; *Key = NULL;
if (SetupGetFieldCount(Context) != 1) if (Data)
return FALSE; *Data = NULL;
for (i = 0; i <= 1; i++) if (SetupGetFieldCount(Context) != 1)
{ return FALSE;
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) for (i = 0; i <= 1; i++)
*Key = pLastCallData[0 + currentIndex]; {
if (Data) ret = SetupGetStringFieldW(Context,
*Data = pLastCallData[1 + currentIndex]; i,
return TRUE; 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__ */ #endif /* !__REACTOS__ */
} }
BOOLEAN BOOLEAN
INF_GetDataField( INF_GetDataField(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,
IN ULONG FieldIndex, IN ULONG FieldIndex,
OUT PWCHAR *Data) OUT PWCHAR *Data)
{ {
#ifdef __REACTOS__ #ifdef __REACTOS__
return InfGetDataField(Context, FieldIndex, Data); return InfGetDataField(Context, FieldIndex, Data);
#else #else
static PWCHAR pLastCallsData[] = { NULL, NULL, NULL }; static PWCHAR pLastCallsData[] = { NULL, NULL, NULL };
static DWORD NextIndex = 0; static DWORD NextIndex = 0;
DWORD dwSize; DWORD dwSize;
BOOL ret; BOOL ret;
*Data = NULL; *Data = NULL;
ret = SetupGetStringFieldW( ret = SetupGetStringFieldW(Context,
Context, FieldIndex,
FieldIndex, NULL,
NULL, 0,
0, &dwSize);
&dwSize); if (!ret)
if (!ret) return FALSE;
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]; HeapFree(GetProcessHeap(), 0, pLastCallsData[NextIndex]);
NextIndex = (NextIndex + 1) % (sizeof(pLastCallsData) / sizeof(pLastCallsData[0])); pLastCallsData[NextIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
return TRUE; 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__ */ #endif /* !__REACTOS__ */
} }
HINF WINAPI HINF WINAPI
INF_OpenBufferedFileA( INF_OpenBufferedFileA(
IN PSTR FileBuffer, IN PSTR FileBuffer,
IN ULONG FileSize, IN ULONG FileSize,
IN PCSTR InfClass, IN PCSTR InfClass,
IN DWORD InfStyle, IN DWORD InfStyle,
IN LCID LocaleId, IN LCID LocaleId,
OUT PUINT ErrorLine) OUT PUINT ErrorLine)
{ {
#ifdef __REACTOS__ #ifdef __REACTOS__
HINF hInf = NULL; HINF hInf = NULL;
ULONG ErrorLineUL; ULONG ErrorLineUL;
NTSTATUS Status; NTSTATUS Status;
Status = InfOpenBufferedFile( Status = InfOpenBufferedFile(&hInf,
&hInf, FileBuffer,
FileBuffer, FileSize,
FileSize, LANGIDFROMLCID(LocaleId),
LANGIDFROMLCID(LocaleId), &ErrorLineUL);
&ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL;
*ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status)) return INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
return hInf; return hInf;
#else #else
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
#endif /* !__REACTOS__ */ #endif /* !__REACTOS__ */
} }

View file

@ -45,47 +45,49 @@
* Delete it once we don't use inflib anymore */ * Delete it once we don't use inflib anymore */
typedef struct _INFCONTEXT typedef struct _INFCONTEXT
{ {
PVOID Inf; PVOID Inf;
PVOID Section; PVOID Section;
PVOID Line; PVOID Line;
} INFCONTEXT; } INFCONTEXT;
BOOL WINAPI BOOL
WINAPI
InfpFindFirstLineW( InfpFindFirstLineW(
IN HINF InfHandle, IN HINF InfHandle,
IN PCWSTR Section, IN PCWSTR Section,
IN PCWSTR Key, IN PCWSTR Key,
IN OUT PINFCONTEXT Context); IN OUT PINFCONTEXT Context);
HINF WINAPI HINF
WINAPI
InfpOpenInfFileW( InfpOpenInfFileW(
IN PCWSTR FileName, IN PCWSTR FileName,
IN PCWSTR InfClass, IN PCWSTR InfClass,
IN DWORD InfStyle, IN DWORD InfStyle,
IN LCID LocaleId, IN LCID LocaleId,
OUT PUINT ErrorLine); OUT PUINT ErrorLine);
#endif /* __REACTOS__ */ #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);
BOOLEAN BOOLEAN
INF_GetDataField( INF_GetDataField(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,
IN ULONG FieldIndex, IN ULONG FieldIndex,
OUT PWCHAR *Data); OUT PWCHAR *Data);
HINF WINAPI HINF WINAPI
INF_OpenBufferedFileA( INF_OpenBufferedFileA(
IN PSTR FileBuffer, IN PSTR FileBuffer,
IN ULONG FileSize, IN ULONG FileSize,
IN PCSTR InfClass, IN PCSTR InfClass,
IN DWORD InfStyle, IN DWORD InfStyle,
IN LCID LocaleId, IN LCID LocaleId,
OUT PUINT ErrorLine); OUT PUINT ErrorLine);
/* EOF */ /* EOF */

File diff suppressed because it is too large Load diff

View file

@ -29,99 +29,107 @@
typedef struct _INICACHEKEY typedef struct _INICACHEKEY
{ {
PWCHAR Name; PWCHAR Name;
PWCHAR Data; PWCHAR Data;
struct _INICACHEKEY *Next; struct _INICACHEKEY *Next;
struct _INICACHEKEY *Prev; struct _INICACHEKEY *Prev;
} INICACHEKEY, *PINICACHEKEY; } INICACHEKEY, *PINICACHEKEY;
typedef struct _INICACHESECTION typedef struct _INICACHESECTION
{ {
PWCHAR Name; PWCHAR Name;
PINICACHEKEY FirstKey; PINICACHEKEY FirstKey;
PINICACHEKEY LastKey; PINICACHEKEY LastKey;
struct _INICACHESECTION *Next; struct _INICACHESECTION *Next;
struct _INICACHESECTION *Prev; struct _INICACHESECTION *Prev;
} INICACHESECTION, *PINICACHESECTION; } INICACHESECTION, *PINICACHESECTION;
typedef struct _INICACHE typedef struct _INICACHE
{ {
PINICACHESECTION FirstSection; PINICACHESECTION FirstSection;
PINICACHESECTION LastSection; PINICACHESECTION LastSection;
} INICACHE, *PINICACHE; } INICACHE, *PINICACHE;
typedef struct _PINICACHEITERATOR typedef struct _PINICACHEITERATOR
{ {
PINICACHESECTION Section; PINICACHESECTION Section;
PINICACHEKEY Key; PINICACHEKEY Key;
} INICACHEITERATOR, *PINICACHEITERATOR; } INICACHEITERATOR, *PINICACHEITERATOR;
typedef enum typedef enum
{ {
INSERT_FIRST, INSERT_FIRST,
INSERT_BEFORE, INSERT_BEFORE,
INSERT_AFTER, INSERT_AFTER,
INSERT_LAST INSERT_LAST
} INSERTATION_TYPE; } INSERTATION_TYPE;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
NTSTATUS NTSTATUS
IniCacheLoad(PINICACHE *Cache, IniCacheLoad(
PUNICODE_STRING FileName, PINICACHE *Cache,
BOOLEAN String); PUNICODE_STRING FileName,
BOOLEAN String);
VOID VOID
IniCacheDestroy(PINICACHE Cache); IniCacheDestroy(
PINICACHE Cache);
PINICACHESECTION PINICACHESECTION
IniCacheGetSection(PINICACHE Cache, IniCacheGetSection(
PWCHAR Name); PINICACHE Cache,
PWCHAR Name);
NTSTATUS NTSTATUS
IniCacheGetKey(PINICACHESECTION Section, IniCacheGetKey(
PWCHAR KeyName, PINICACHESECTION Section,
PWCHAR *KeyData); PWCHAR KeyName,
PWCHAR *KeyData);
PINICACHEITERATOR PINICACHEITERATOR
IniCacheFindFirstValue(PINICACHESECTION Section, IniCacheFindFirstValue(
PWCHAR *KeyName, PINICACHESECTION Section,
PWCHAR *KeyData); PWCHAR *KeyName,
PWCHAR *KeyData);
BOOLEAN BOOLEAN
IniCacheFindNextValue(PINICACHEITERATOR Iterator, IniCacheFindNextValue(
PWCHAR *KeyName, PINICACHEITERATOR Iterator,
PWCHAR *KeyData); PWCHAR *KeyName,
PWCHAR *KeyData);
VOID VOID
IniCacheFindClose(PINICACHEITERATOR Iterator); IniCacheFindClose(
PINICACHEITERATOR Iterator);
PINICACHEKEY PINICACHEKEY
IniCacheInsertKey(PINICACHESECTION Section, IniCacheInsertKey(
PINICACHEKEY AnchorKey, PINICACHESECTION Section,
INSERTATION_TYPE InsertationType, PINICACHEKEY AnchorKey,
PWCHAR Name, INSERTATION_TYPE InsertationType,
PWCHAR Data); PWCHAR Name,
PWCHAR Data);
PINICACHE PINICACHE
IniCacheCreate(VOID); IniCacheCreate(VOID);
NTSTATUS NTSTATUS
IniCacheSave(PINICACHE Cache, IniCacheSave(
PWCHAR FileName); PINICACHE Cache,
PWCHAR FileName);
PINICACHESECTION PINICACHESECTION
IniCacheAppendSection(PINICACHE Cache, IniCacheAppendSection(
PWCHAR Name); PINICACHE Cache,
PWCHAR Name);
/* EOF */ /* EOF */

View file

@ -63,8 +63,10 @@ FindLanguageIndex(VOID)
return 0; return 0;
} }
BOOLEAN BOOLEAN
IsLanguageAvailable(PWCHAR LanguageId) IsLanguageAvailable(
PWCHAR LanguageId)
{ {
ULONG lngIndex = 0; ULONG lngIndex = 0;
@ -82,7 +84,8 @@ IsLanguageAvailable(PWCHAR LanguageId)
static static
const MUI_ENTRY * const MUI_ENTRY *
FindMUIEntriesOfPage(IN ULONG PageNumber) FindMUIEntriesOfPage(
IN ULONG PageNumber)
{ {
ULONG muiIndex = 0; ULONG muiIndex = 0;
ULONG lngIndex; ULONG lngIndex;
@ -102,6 +105,7 @@ FindMUIEntriesOfPage(IN ULONG PageNumber)
return NULL; return NULL;
} }
static static
const MUI_ERROR * const MUI_ERROR *
FindMUIErrorEntries(VOID) FindMUIErrorEntries(VOID)
@ -110,6 +114,7 @@ FindMUIErrorEntries(VOID)
return LanguageList[lngIndex].MuiErrors; return LanguageList[lngIndex].MuiErrors;
} }
static static
const MUI_STRING * const MUI_STRING *
FindMUIStringEntries(VOID) FindMUIStringEntries(VOID)
@ -118,6 +123,7 @@ FindMUIStringEntries(VOID)
return LanguageList[lngIndex].MuiStrings; return LanguageList[lngIndex].MuiStrings;
} }
LPCWSTR LPCWSTR
MUIDefaultKeyboardLayout(VOID) MUIDefaultKeyboardLayout(VOID)
{ {
@ -125,6 +131,7 @@ MUIDefaultKeyboardLayout(VOID)
return LanguageList[lngIndex].MuiLayouts[0].LayoutID; return LanguageList[lngIndex].MuiLayouts[0].LayoutID;
} }
PWCHAR PWCHAR
MUIGetGeoID(VOID) MUIGetGeoID(VOID)
{ {
@ -132,6 +139,7 @@ MUIGetGeoID(VOID)
return LanguageList[lngIndex].GeoID; return LanguageList[lngIndex].GeoID;
} }
const MUI_LAYOUTS * const MUI_LAYOUTS *
MUIGetLayoutsList(VOID) MUIGetLayoutsList(VOID)
{ {
@ -139,8 +147,10 @@ MUIGetLayoutsList(VOID)
return LanguageList[lngIndex].MuiLayouts; return LanguageList[lngIndex].MuiLayouts;
} }
VOID VOID
MUIClearPage(IN ULONG page) MUIClearPage(
IN ULONG page)
{ {
const MUI_ENTRY * entry; const MUI_ENTRY * entry;
int index; int index;
@ -167,8 +177,10 @@ MUIClearPage(IN ULONG page)
while (entry[index].Buffer != NULL); while (entry[index].Buffer != NULL);
} }
VOID VOID
MUIDisplayPage(IN ULONG page) MUIDisplayPage(
IN ULONG page)
{ {
const MUI_ENTRY * entry; const MUI_ENTRY * entry;
int index; int index;
@ -196,8 +208,12 @@ MUIDisplayPage(IN ULONG page)
while (entry[index].Buffer != NULL); while (entry[index].Buffer != NULL);
} }
VOID VOID
MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent) MUIDisplayError(
IN ULONG ErrorNum,
OUT PINPUT_RECORD Ir,
IN ULONG WaitEvent)
{ {
const MUI_ERROR * entry; const MUI_ERROR * entry;
@ -227,8 +243,10 @@ MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent)
WaitEvent); WaitEvent);
} }
LPSTR LPSTR
MUIGetString(ULONG Number) MUIGetString(
ULONG Number)
{ {
ULONG i; ULONG i;
const MUI_STRING * entry; const MUI_STRING * entry;
@ -249,15 +267,20 @@ MUIGetString(ULONG Number)
sprintf(szErr, "Error: failed find string id %lu for language index %lu\n", Number, FindLanguageIndex()); sprintf(szErr, "Error: failed find string id %lu for language index %lu\n", Number, FindLanguageIndex());
PopupError(szErr, PopupError(szErr,
NULL, NULL,
NULL, NULL,
POPUP_WAIT_NONE); POPUP_WAIT_NONE);
return "<nostring>"; return "<nostring>";
} }
static BOOLEAN
AddHotkeySettings(IN LPCWSTR Hotkey, IN LPCWSTR LangHotkey, IN LPCWSTR LayoutHotkey) static
BOOLEAN
AddHotkeySettings(
IN LPCWSTR Hotkey,
IN LPCWSTR LangHotkey,
IN LPCWSTR LayoutHotkey)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName; UNICODE_STRING KeyName;
@ -340,8 +363,10 @@ AddHotkeySettings(IN LPCWSTR Hotkey, IN LPCWSTR LangHotkey, IN LPCWSTR LayoutHot
return TRUE; return TRUE;
} }
BOOLEAN BOOLEAN
AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts) AddKbLayoutsToRegistry(
IN const MUI_LAYOUTS *MuiLayouts)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName; UNICODE_STRING KeyName;
@ -509,10 +534,12 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
return TRUE; return TRUE;
} }
BOOLEAN BOOLEAN
AddKeyboardLayouts(VOID) AddKeyboardLayouts(VOID)
{ {
ULONG lngIndex = 0; ULONG lngIndex = 0;
do do
{ {
if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0) if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
@ -527,8 +554,13 @@ AddKeyboardLayouts(VOID)
return FALSE; return FALSE;
} }
static BOOLEAN
AddCodepageToRegistry(IN LPCWSTR ACPage, IN LPCWSTR OEMCPage, IN LPCWSTR MACCPage) static
BOOLEAN
AddCodepageToRegistry(
IN LPCWSTR ACPage,
IN LPCWSTR OEMCPage,
IN LPCWSTR MACCPage)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName; UNICODE_STRING KeyName;
@ -603,8 +635,11 @@ AddCodepageToRegistry(IN LPCWSTR ACPage, IN LPCWSTR OEMCPage, IN LPCWSTR MACCPag
return TRUE; return TRUE;
} }
static BOOLEAN
AddFontsSettingsToRegistry(IN const MUI_SUBFONT * MuiSubFonts) static
BOOLEAN
AddFontsSettingsToRegistry(
IN const MUI_SUBFONT * MuiSubFonts)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName; UNICODE_STRING KeyName;
@ -654,6 +689,7 @@ AddFontsSettingsToRegistry(IN const MUI_SUBFONT * MuiSubFonts)
return TRUE; return TRUE;
} }
BOOLEAN BOOLEAN
AddCodePage(VOID) AddCodePage(VOID)
{ {
@ -682,6 +718,7 @@ AddCodePage(VOID)
return FALSE; return FALSE;
} }
VOID VOID
SetConsoleCodePage(VOID) SetConsoleCodePage(VOID)
{ {

View file

@ -54,16 +54,22 @@ typedef struct
} MUI_LANGUAGE; } MUI_LANGUAGE;
BOOLEAN BOOLEAN
IsLanguageAvailable(PWCHAR LanguageId); IsLanguageAvailable(
PWCHAR LanguageId);
VOID VOID
MUIDisplayPage (ULONG PageNumber); MUIDisplayPage(
ULONG PageNumber);
VOID VOID
MUIClearPage (ULONG PageNumber); MUIClearPage(
ULONG PageNumber);
VOID VOID
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent); MUIDisplayError(
ULONG ErrorNum,
PINPUT_RECORD Ir,
ULONG WaitEvent);
LPCWSTR LPCWSTR
MUIDefaultKeyboardLayout(VOID); MUIDefaultKeyboardLayout(VOID);
@ -75,7 +81,8 @@ const MUI_LAYOUTS *
MUIGetLayoutsList(VOID); MUIGetLayoutsList(VOID);
BOOLEAN BOOLEAN
AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts); AddKbLayoutsToRegistry(
IN const MUI_LAYOUTS *MuiLayouts);
BOOLEAN BOOLEAN
AddCodePage(VOID); AddCodePage(VOID);
@ -87,7 +94,8 @@ VOID
SetConsoleCodePage(VOID); SetConsoleCodePage(VOID);
LPSTR LPSTR
MUIGetString(ULONG Number); MUIGetString(
ULONG Number);
#define STRING_PLEASEWAIT 1 #define STRING_PLEASEWAIT 1
#define STRING_INSTALLCREATEPARTITION 2 #define STRING_INSTALLCREATEPARTITION 2