mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
[FORMATTING]
Fix indentation and coding style. No code changes! svn path=/trunk/; revision=63254
This commit is contained in:
parent
e34ff107cd
commit
a4061f41e7
21 changed files with 2043 additions and 1869 deletions
|
@ -87,7 +87,8 @@ extern PPARTLIST PartitionList;
|
|||
|
||||
static
|
||||
VOID
|
||||
CreateCommonFreeLoaderSections(PINICACHE IniCache)
|
||||
CreateCommonFreeLoaderSections(
|
||||
PINICACHE IniCache)
|
||||
{
|
||||
PINICACHESECTION IniSection;
|
||||
|
||||
|
@ -1178,7 +1179,6 @@ InstallMbrBootCodeToDisk(
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate buffer for new bootsector */
|
||||
NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
|
@ -1275,9 +1275,11 @@ InstallMbrBootCodeToDisk(
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
||||
PWSTR RootPath)
|
||||
InstallFat12BootCodeToFloppy(
|
||||
PWSTR SrcPath,
|
||||
PWSTR RootPath)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
|
@ -1286,21 +1288,21 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
NTSTATUS Status;
|
||||
PFAT_BOOTSECTOR OrigBootSector;
|
||||
PFAT_BOOTSECTOR NewBootSector;
|
||||
|
||||
|
||||
/* Allocate buffer for original bootsector */
|
||||
OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE);
|
||||
if (OrigBootSector == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
||||
/* Read current boot sector into buffer */
|
||||
RtlInitUnicodeString(&Name, RootPath);
|
||||
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
Status = NtOpenFile(&FileHandle,
|
||||
GENERIC_READ | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
|
@ -1312,7 +1314,7 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = NtReadFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1328,8 +1330,7 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Allocate buffer for new bootsector */
|
||||
NewBootSector = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
|
@ -1339,16 +1340,16 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/* Read new bootsector from SrcPath */
|
||||
RtlInitUnicodeString(&Name, SrcPath);
|
||||
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
Status = NtOpenFile(&FileHandle,
|
||||
GENERIC_READ | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
|
@ -1361,7 +1362,7 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = NtReadFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -1378,25 +1379,25 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Adjust bootsector (copy a part of the FAT16 BPB) */
|
||||
memcpy(&NewBootSector->OemName,
|
||||
&OrigBootSector->OemName,
|
||||
FIELD_OFFSET(FAT_BOOTSECTOR, BootCodeAndData) -
|
||||
FIELD_OFFSET(FAT_BOOTSECTOR, OemName));
|
||||
|
||||
|
||||
/* Free the original boot sector */
|
||||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
|
||||
|
||||
/* Write new bootsector to RootPath */
|
||||
RtlInitUnicodeString(&Name, RootPath);
|
||||
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
Status = NtOpenFile(&FileHandle,
|
||||
GENERIC_WRITE | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
|
@ -1409,7 +1410,7 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
FilePosition.QuadPart = 0;
|
||||
#endif
|
||||
|
@ -1423,10 +1424,10 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
|
|||
NULL,
|
||||
NULL);
|
||||
NtClose(FileHandle);
|
||||
|
||||
|
||||
/* Free the new boot sector */
|
||||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1487,7 +1488,6 @@ InstallFat16BootCodeToDisk(
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate buffer for new bootsector */
|
||||
NewBootSector = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
|
@ -2001,6 +2001,7 @@ UpdateBootIni(
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CheckInstallFatBootcodeToPartition(
|
||||
PUNICODE_STRING SystemRootPath)
|
||||
|
@ -2339,6 +2340,7 @@ InstallFatBootcodeToPartition(
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
InstallVBRToPartition(
|
||||
PUNICODE_STRING SystemRootPath,
|
||||
|
@ -2373,7 +2375,7 @@ InstallFatBootcodeToFloppy(
|
|||
WCHAR SrcPath[MAX_PATH];
|
||||
WCHAR DstPath[MAX_PATH];
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/* Format the floppy first */
|
||||
Status = VfatFormat(&FloppyDevice,
|
||||
FMIFS_FLOPPY,
|
||||
|
|
|
@ -27,65 +27,79 @@
|
|||
#pragma once
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForDos(PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
CreateFreeLoaderIniForDos(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForReactos(PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
CreateFreeLoaderIniForReactos(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
|
||||
NTSTATUS
|
||||
UpdateFreeLoaderIni(PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
UpdateFreeLoaderIni(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath);
|
||||
|
||||
NTSTATUS
|
||||
SaveCurrentBootSector(PWSTR RootPath,
|
||||
PWSTR DstPath);
|
||||
SaveCurrentBootSector(
|
||||
PWSTR RootPath,
|
||||
PWSTR DstPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFat16BootCodeToFile(PWSTR SrcPath,
|
||||
PWSTR DstPath,
|
||||
PWSTR RootPath);
|
||||
InstallFat16BootCodeToFile(
|
||||
PWSTR SrcPath,
|
||||
PWSTR DstPath,
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFat32BootCodeToFile(PWSTR SrcPath,
|
||||
PWSTR DstPath,
|
||||
PWSTR RootPath);
|
||||
InstallFat32BootCodeToFile(
|
||||
PWSTR SrcPath,
|
||||
PWSTR DstPath,
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallMbrBootCodeToDisk (PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
InstallMbrBootCodeToDisk(
|
||||
PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFat16BootCodeToDisk(PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
InstallFat16BootCodeToDisk(
|
||||
PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFat32BootCodeToDisk(PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
InstallFat32BootCodeToDisk(
|
||||
PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
UpdateBootIni(PWSTR BootIniPath,
|
||||
PWSTR EntryName,
|
||||
PWSTR EntryValue);
|
||||
UpdateBootIni(
|
||||
PWSTR BootIniPath,
|
||||
PWSTR EntryName,
|
||||
PWSTR EntryValue);
|
||||
|
||||
BOOLEAN
|
||||
CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath);
|
||||
CheckInstallFatBootcodeToPartition(
|
||||
PUNICODE_STRING SystemRootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath,
|
||||
UCHAR PartitionType);
|
||||
InstallFatBootcodeToPartition(
|
||||
PUNICODE_STRING SystemRootPath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath,
|
||||
UCHAR PartitionType);
|
||||
|
||||
NTSTATUS
|
||||
InstallVBRToPartition(PUNICODE_STRING SystemRootPath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath,
|
||||
UCHAR PartitionType);
|
||||
InstallVBRToPartition(
|
||||
PUNICODE_STRING SystemRootPath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath,
|
||||
UCHAR PartitionType);
|
||||
|
||||
NTSTATUS
|
||||
InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath);
|
||||
InstallFatBootcodeToFloppy(
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING DestinationArcPath);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -34,7 +34,9 @@ static PPROGRESSBAR ChkdskProgressBar = NULL;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static BOOLEAN NTAPI
|
||||
static
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ChkdskCallback(
|
||||
IN CALLBACKCOMMAND Command,
|
||||
IN ULONG Modifier,
|
||||
|
@ -50,6 +52,7 @@ ChkdskCallback(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
ChkdskPartition(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
|
|
|
@ -34,66 +34,66 @@
|
|||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
GetSourcePaths(PUNICODE_STRING SourcePath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING SourceRootDir)
|
||||
GetSourcePaths(
|
||||
PUNICODE_STRING SourcePath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING SourceRootDir)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING LinkName;
|
||||
UNICODE_STRING SourceName;
|
||||
WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
|
||||
HANDLE Handle;
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
PWCHAR Ptr;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING LinkName;
|
||||
UNICODE_STRING SourceName;
|
||||
WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
|
||||
HANDLE Handle;
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
PWCHAR Ptr;
|
||||
|
||||
RtlInitUnicodeString(&LinkName,
|
||||
L"\\SystemRoot");
|
||||
RtlInitUnicodeString(&LinkName,
|
||||
L"\\SystemRoot");
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&LinkName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&LinkName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenSymbolicLinkObject(&Handle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return(Status);
|
||||
Status = NtOpenSymbolicLinkObject(&Handle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
SourceName.Length = 0;
|
||||
SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
|
||||
SourceName.Buffer = SourceBuffer;
|
||||
SourceName.Length = 0;
|
||||
SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
|
||||
SourceName.Buffer = SourceBuffer;
|
||||
|
||||
Status = NtQuerySymbolicLinkObject(Handle,
|
||||
&SourceName,
|
||||
&Length);
|
||||
NtClose(Handle);
|
||||
Status = NtQuerySymbolicLinkObject(Handle,
|
||||
&SourceName,
|
||||
&Length);
|
||||
NtClose(Handle);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
RtlCreateUnicodeString(SourcePath,
|
||||
SourceName.Buffer);
|
||||
RtlCreateUnicodeString(SourcePath,
|
||||
SourceName.Buffer);
|
||||
|
||||
/* strip trailing directory */
|
||||
Ptr = wcsrchr(SourceName.Buffer, L'\\');
|
||||
if (Ptr)
|
||||
{
|
||||
RtlCreateUnicodeString(SourceRootDir, Ptr);
|
||||
*Ptr = 0;
|
||||
}
|
||||
else
|
||||
RtlCreateUnicodeString(SourceRootDir, L"");
|
||||
/* strip trailing directory */
|
||||
Ptr = wcsrchr(SourceName.Buffer, L'\\');
|
||||
if (Ptr)
|
||||
{
|
||||
RtlCreateUnicodeString(SourceRootDir, Ptr);
|
||||
*Ptr = 0;
|
||||
}
|
||||
else
|
||||
RtlCreateUnicodeString(SourceRootDir, L"");
|
||||
|
||||
RtlCreateUnicodeString(SourceRootPath,
|
||||
SourceName.Buffer);
|
||||
RtlCreateUnicodeString(SourceRootPath,
|
||||
SourceName.Buffer);
|
||||
}
|
||||
|
||||
NtClose(Handle);
|
||||
NtClose(Handle);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
#pragma once
|
||||
|
||||
NTSTATUS
|
||||
GetSourcePaths(PUNICODE_STRING SourcePath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING SourceRootDir);
|
||||
GetSourcePaths(
|
||||
PUNICODE_STRING SourcePath,
|
||||
PUNICODE_STRING SourceRootPath,
|
||||
PUNICODE_STRING SourceRootDir);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -35,407 +35,425 @@
|
|||
|
||||
typedef struct _QUEUEENTRY
|
||||
{
|
||||
struct _QUEUEENTRY *Prev;
|
||||
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;
|
||||
struct _QUEUEENTRY *Prev;
|
||||
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;
|
||||
} QUEUEENTRY, *PQUEUEENTRY;
|
||||
|
||||
|
||||
typedef struct _FILEQUEUEHEADER
|
||||
{
|
||||
PQUEUEENTRY CopyHead;
|
||||
PQUEUEENTRY CopyTail;
|
||||
ULONG CopyCount;
|
||||
PQUEUEENTRY CopyHead;
|
||||
PQUEUEENTRY CopyTail;
|
||||
ULONG CopyCount;
|
||||
} FILEQUEUEHEADER, *PFILEQUEUEHEADER;
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
HSPFILEQ WINAPI
|
||||
HSPFILEQ
|
||||
WINAPI
|
||||
SetupOpenFileQueue(VOID)
|
||||
{
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
|
||||
/* Allocate queue header */
|
||||
QueueHeader = (PFILEQUEUEHEADER)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
sizeof(FILEQUEUEHEADER));
|
||||
if (QueueHeader == NULL)
|
||||
return(NULL);
|
||||
/* Allocate queue header */
|
||||
QueueHeader = (PFILEQUEUEHEADER)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
sizeof(FILEQUEUEHEADER));
|
||||
if (QueueHeader == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Initialize queue header */
|
||||
RtlZeroMemory(QueueHeader,
|
||||
sizeof(FILEQUEUEHEADER));
|
||||
/* Initialize queue header */
|
||||
RtlZeroMemory(QueueHeader,
|
||||
sizeof(FILEQUEUEHEADER));
|
||||
|
||||
|
||||
return((HSPFILEQ)QueueHeader);
|
||||
return (HSPFILEQ)QueueHeader;
|
||||
}
|
||||
|
||||
|
||||
VOID WINAPI
|
||||
SetupCloseFileQueue(HSPFILEQ QueueHandle)
|
||||
VOID
|
||||
WINAPI
|
||||
SetupCloseFileQueue(
|
||||
HSPFILEQ QueueHandle)
|
||||
{
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
|
||||
if (QueueHandle == NULL)
|
||||
return;
|
||||
if (QueueHandle == NULL)
|
||||
return;
|
||||
|
||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||
|
||||
/* Delete copy queue */
|
||||
Entry = QueueHeader->CopyHead;
|
||||
while (Entry != NULL)
|
||||
/* Delete copy queue */
|
||||
Entry = QueueHeader->CopyHead;
|
||||
while (Entry != NULL)
|
||||
{
|
||||
/* Delete all strings */
|
||||
if (Entry->SourceCabinet != NULL)
|
||||
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);
|
||||
/* Delete all strings */
|
||||
if (Entry->SourceCabinet != NULL)
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
|
||||
|
||||
/* Unlink current queue entry */
|
||||
if (Entry->Next != NULL)
|
||||
{
|
||||
QueueHeader->CopyHead = Entry->Next;
|
||||
QueueHeader->CopyHead->Prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
QueueHeader->CopyHead = NULL;
|
||||
QueueHeader->CopyTail = NULL;
|
||||
}
|
||||
if (Entry->SourceRootPath != NULL)
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
|
||||
|
||||
/* Delete queue entry */
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry);
|
||||
if (Entry->SourcePath != NULL)
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
|
||||
|
||||
/* Get next queue entry */
|
||||
Entry = QueueHeader->CopyHead;
|
||||
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->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 */
|
||||
RtlFreeHeap(ProcessHeap,
|
||||
0,
|
||||
QueueHeader);
|
||||
/* Delete queue header */
|
||||
RtlFreeHeap(ProcessHeap, 0, QueueHeader);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
SetupQueueCopy(HSPFILEQ QueueHandle,
|
||||
PCWSTR SourceCabinet,
|
||||
PCWSTR SourceRootPath,
|
||||
PCWSTR SourcePath,
|
||||
PCWSTR SourceFilename,
|
||||
PCWSTR TargetDirectory,
|
||||
PCWSTR TargetFilename)
|
||||
SetupQueueCopy(
|
||||
HSPFILEQ QueueHandle,
|
||||
PCWSTR SourceCabinet,
|
||||
PCWSTR SourceRootPath,
|
||||
PCWSTR SourcePath,
|
||||
PCWSTR SourceFilename,
|
||||
PCWSTR TargetDirectory,
|
||||
PCWSTR TargetFilename)
|
||||
{
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
ULONG Length;
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
ULONG Length;
|
||||
|
||||
/* SourceCabinet may be NULL */
|
||||
if (QueueHandle == NULL ||
|
||||
SourceRootPath == NULL ||
|
||||
SourceFilename == NULL ||
|
||||
TargetDirectory == NULL)
|
||||
return(FALSE);
|
||||
/* SourceCabinet may be NULL */
|
||||
if (QueueHandle == NULL ||
|
||||
SourceRootPath == NULL ||
|
||||
SourceFilename == NULL ||
|
||||
TargetDirectory == NULL)
|
||||
return FALSE;
|
||||
|
||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||
|
||||
/* Allocate new queue entry */
|
||||
Entry = (PQUEUEENTRY)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
sizeof(QUEUEENTRY));
|
||||
if (Entry == NULL)
|
||||
return(FALSE);
|
||||
/* Allocate new queue entry */
|
||||
Entry = (PQUEUEENTRY)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
sizeof(QUEUEENTRY));
|
||||
if (Entry == NULL)
|
||||
return FALSE;
|
||||
|
||||
RtlZeroMemory(Entry,
|
||||
sizeof(QUEUEENTRY));
|
||||
RtlZeroMemory(Entry,
|
||||
sizeof(QUEUEENTRY));
|
||||
|
||||
/* Copy source cabinet if available */
|
||||
if (SourceCabinet != NULL)
|
||||
/* Copy source cabinet if available */
|
||||
if (SourceCabinet != NULL)
|
||||
{
|
||||
Length = wcslen(SourceCabinet);
|
||||
Entry->SourceCabinet = (WCHAR*) RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
if (Entry->SourceCabinet == NULL)
|
||||
{
|
||||
Length = wcslen(SourceCabinet);
|
||||
Entry->SourceCabinet = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
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);
|
||||
return(FALSE);
|
||||
}
|
||||
wcsncpy(Entry->SourceCabinet, SourceCabinet, Length);
|
||||
Entry->SourceCabinet[Length] = (WCHAR)0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Entry->SourceCabinet = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
return(FALSE);
|
||||
}
|
||||
wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
|
||||
Entry->SourceRootPath[Length] = (WCHAR)0;
|
||||
wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
|
||||
Entry->SourceRootPath[Length] = (WCHAR)0;
|
||||
|
||||
/* Copy source path */
|
||||
if (SourcePath != NULL)
|
||||
{
|
||||
Length = wcslen(SourcePath);
|
||||
Entry->SourcePath = (WCHAR*) RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
if (Entry->SourcePath == NULL)
|
||||
/* Copy source path */
|
||||
if (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);
|
||||
return(FALSE);
|
||||
|
||||
wcsncpy(Entry->SourcePath, SourcePath, Length);
|
||||
Entry->SourcePath[Length] = (WCHAR)0;
|
||||
}
|
||||
wcsncpy(Entry->SourcePath, SourcePath, Length);
|
||||
Entry->SourcePath[Length] = (WCHAR)0;
|
||||
}
|
||||
|
||||
/* Copy source file name */
|
||||
Length = wcslen(SourceFilename);
|
||||
Entry->SourceFilename = (WCHAR*) RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
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)
|
||||
/* Copy source file name */
|
||||
Length = wcslen(SourceFilename);
|
||||
Entry->SourceFilename = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(Length + 1) * sizeof(WCHAR));
|
||||
if (Entry->SourceFilename == 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->SourceFilename);
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry);
|
||||
return(FALSE);
|
||||
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
|
||||
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
|
||||
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++;
|
||||
wcsncpy(Entry->SourceFilename, SourceFilename, Length);
|
||||
Entry->SourceFilename[Length] = (WCHAR)0;
|
||||
|
||||
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
|
||||
SetupCommitFileQueueW(HWND Owner,
|
||||
HSPFILEQ QueueHandle,
|
||||
PSP_FILE_CALLBACK_W MsgHandler,
|
||||
PVOID Context)
|
||||
BOOL
|
||||
WINAPI
|
||||
SetupCommitFileQueueW(
|
||||
HWND Owner,
|
||||
HSPFILEQ QueueHandle,
|
||||
PSP_FILE_CALLBACK_W MsgHandler,
|
||||
PVOID Context)
|
||||
{
|
||||
WCHAR CabinetName[MAX_PATH];
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
NTSTATUS Status;
|
||||
PCWSTR TargetRootPath, TargetPath;
|
||||
WCHAR CabinetName[MAX_PATH];
|
||||
PFILEQUEUEHEADER QueueHeader;
|
||||
PQUEUEENTRY Entry;
|
||||
NTSTATUS Status;
|
||||
PCWSTR TargetRootPath, TargetPath;
|
||||
|
||||
WCHAR FileSrcPath[MAX_PATH];
|
||||
WCHAR FileDstPath[MAX_PATH];
|
||||
WCHAR FileSrcPath[MAX_PATH];
|
||||
WCHAR FileDstPath[MAX_PATH];
|
||||
|
||||
TargetRootPath = ((PCOPYCONTEXT)Context)->DestinationRootPath;
|
||||
TargetPath = ((PCOPYCONTEXT)Context)->InstallPath;
|
||||
TargetRootPath = ((PCOPYCONTEXT)Context)->DestinationRootPath;
|
||||
TargetPath = ((PCOPYCONTEXT)Context)->InstallPath;
|
||||
|
||||
if (QueueHandle == NULL)
|
||||
return(FALSE);
|
||||
if (QueueHandle == NULL)
|
||||
return FALSE;
|
||||
|
||||
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);
|
||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||
|
||||
MsgHandler(Context,
|
||||
SPFILENOTIFY_STARTCOPY,
|
||||
(UINT_PTR)Entry->SourceFilename,
|
||||
FILEOP_COPY);
|
||||
SPFILENOTIFY_STARTQUEUE,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (Entry->SourceCabinet != NULL)
|
||||
{
|
||||
/* Extract the file */
|
||||
wcscpy(CabinetName, Entry->SourceRootPath);
|
||||
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(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);
|
||||
wcscat(FileSrcPath, Entry->SourcePath);
|
||||
wcscat(FileSrcPath, L"\\");
|
||||
wcscat(FileSrcPath, Entry->SourceFilename);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgHandler(Context,
|
||||
SPFILENOTIFY_ENDCOPY,
|
||||
(UINT_PTR)Entry->SourceFilename,
|
||||
FILEOP_COPY);
|
||||
/* 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,
|
||||
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,
|
||||
SPFILENOTIFY_ENDSUBQUEUE,
|
||||
FILEOP_COPY,
|
||||
0);
|
||||
MsgHandler(Context,
|
||||
SPFILENOTIFY_ENDQUEUE,
|
||||
0,
|
||||
0);
|
||||
|
||||
MsgHandler(Context,
|
||||
SPFILENOTIFY_ENDQUEUE,
|
||||
0,
|
||||
0);
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -51,55 +51,62 @@
|
|||
|
||||
typedef PVOID HSPFILEQ;
|
||||
|
||||
typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(PVOID Context,
|
||||
UINT Notification,
|
||||
UINT_PTR Param1,
|
||||
UINT_PTR Param2);
|
||||
typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(
|
||||
PVOID Context,
|
||||
UINT Notification,
|
||||
UINT_PTR Param1,
|
||||
UINT_PTR Param2);
|
||||
|
||||
typedef struct _COPYCONTEXT
|
||||
{
|
||||
LPCWSTR DestinationRootPath; /* Not owned by this structure */
|
||||
LPCWSTR InstallPath; /* Not owned by this structure */
|
||||
ULONG TotalOperations;
|
||||
ULONG CompletedOperations;
|
||||
PPROGRESSBAR ProgressBar;
|
||||
PPROGRESSBAR MemoryBars[4];
|
||||
LPCWSTR DestinationRootPath; /* Not owned by this structure */
|
||||
LPCWSTR InstallPath; /* Not owned by this structure */
|
||||
ULONG TotalOperations;
|
||||
ULONG CompletedOperations;
|
||||
PPROGRESSBAR ProgressBar;
|
||||
PPROGRESSBAR MemoryBars[4];
|
||||
} COPYCONTEXT, *PCOPYCONTEXT;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
HSPFILEQ WINAPI
|
||||
HSPFILEQ
|
||||
WINAPI
|
||||
SetupOpenFileQueue(VOID);
|
||||
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
SetupCloseFileQueue(
|
||||
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);
|
||||
IN HSPFILEQ QueueHandle);
|
||||
|
||||
BOOL
|
||||
SetupQueueCopy(HSPFILEQ QueueHandle,
|
||||
PCWSTR SourceCabinet,
|
||||
PCWSTR SourceRootPath,
|
||||
PCWSTR SourcePath,
|
||||
PCWSTR SourceFilename,
|
||||
PCWSTR TargetDirectory,
|
||||
PCWSTR TargetFilename);
|
||||
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 WINAPI
|
||||
SetupCommitFileQueueW(HWND Owner,
|
||||
HSPFILEQ QueueHandle,
|
||||
PSP_FILE_CALLBACK_W MsgHandler,
|
||||
PVOID Context);
|
||||
BOOL
|
||||
SetupQueueCopy(
|
||||
HSPFILEQ QueueHandle,
|
||||
PCWSTR SourceCabinet,
|
||||
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 */
|
||||
|
|
|
@ -38,358 +38,373 @@ static WCHAR CurrentCabinetName[MAX_PATH];
|
|||
static CAB_SEARCH Search;
|
||||
|
||||
NTSTATUS
|
||||
SetupCreateDirectory(PWCHAR DirectoryName)
|
||||
SetupCreateDirectory(
|
||||
PWCHAR DirectoryName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
UNICODE_STRING PathName;
|
||||
HANDLE DirectoryHandle;
|
||||
NTSTATUS Status;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
UNICODE_STRING PathName;
|
||||
HANDLE DirectoryHandle;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlCreateUnicodeString(&PathName,
|
||||
DirectoryName);
|
||||
if (PathName.Length > sizeof(WCHAR) &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 2] == L'\\' &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'.')
|
||||
RtlCreateUnicodeString(&PathName,
|
||||
DirectoryName);
|
||||
if (PathName.Length > sizeof(WCHAR) &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 2] == L'\\' &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'.')
|
||||
{
|
||||
PathName.Length -= sizeof(WCHAR);
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
|
||||
PathName.Length -= sizeof(WCHAR);
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
|
||||
}
|
||||
|
||||
if (PathName.Length > sizeof(WCHAR) &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'\\')
|
||||
if (PathName.Length > sizeof(WCHAR) &&
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR) - 1] == L'\\')
|
||||
{
|
||||
PathName.Length -= sizeof(WCHAR);
|
||||
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);
|
||||
PathName.Length -= sizeof(WCHAR);
|
||||
PathName.Buffer[PathName.Length / sizeof(WCHAR)] = 0;
|
||||
}
|
||||
|
||||
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
|
||||
SetupCopyFile(PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName)
|
||||
SetupCopyFile(
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE FileHandleSource;
|
||||
HANDLE FileHandleDest;
|
||||
static IO_STATUS_BLOCK IoStatusBlock;
|
||||
FILE_STANDARD_INFORMATION FileStandard;
|
||||
FILE_BASIC_INFORMATION FileBasic;
|
||||
ULONG RegionSize;
|
||||
UNICODE_STRING FileName;
|
||||
NTSTATUS Status;
|
||||
PVOID SourceFileMap = 0;
|
||||
HANDLE SourceFileSection;
|
||||
SIZE_T SourceSectionSize = 0;
|
||||
LARGE_INTEGER ByteOffset;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE FileHandleSource;
|
||||
HANDLE FileHandleDest;
|
||||
static IO_STATUS_BLOCK IoStatusBlock;
|
||||
FILE_STANDARD_INFORMATION FileStandard;
|
||||
FILE_BASIC_INFORMATION FileBasic;
|
||||
ULONG RegionSize;
|
||||
UNICODE_STRING FileName;
|
||||
NTSTATUS Status;
|
||||
PVOID SourceFileMap = 0;
|
||||
HANDLE SourceFileSection;
|
||||
SIZE_T SourceSectionSize = 0;
|
||||
LARGE_INTEGER ByteOffset;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
RtlInitUnicodeString(&FileName,
|
||||
SourceFileName);
|
||||
RtlInitUnicodeString(&FileName,
|
||||
SourceFileName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenFile(&FileHandleSource,
|
||||
GENERIC_READ,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
FILE_SHARE_READ,
|
||||
FILE_SEQUENTIAL_ONLY);
|
||||
if(!NT_SUCCESS(Status))
|
||||
Status = NtOpenFile(&FileHandleSource,
|
||||
GENERIC_READ,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
FILE_SHARE_READ,
|
||||
FILE_SEQUENTIAL_ONLY);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName);
|
||||
goto done;
|
||||
DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName);
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
FileHandleSource = CreateFileW(SourceFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (FileHandleSource == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
goto done;
|
||||
}
|
||||
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,
|
||||
&FileStandard,
|
||||
sizeof(FILE_STANDARD_INFORMATION),
|
||||
FileStandardInformation);
|
||||
if(!NT_SUCCESS(Status))
|
||||
Status = NtQueryInformationFile(FileHandleSource,
|
||||
&IoStatusBlock,
|
||||
&FileStandard,
|
||||
sizeof(FILE_STANDARD_INFORMATION),
|
||||
FileStandardInformation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtQueryInformationFile failed: %x\n", Status);
|
||||
goto closesrc;
|
||||
}
|
||||
Status = NtQueryInformationFile(FileHandleSource,
|
||||
&IoStatusBlock,&FileBasic,
|
||||
sizeof(FILE_BASIC_INFORMATION),
|
||||
FileBasicInformation);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtQueryInformationFile failed: %x\n", Status);
|
||||
goto closesrc;
|
||||
DPRINT1("NtQueryInformationFile failed: %x\n", Status);
|
||||
goto closesrc;
|
||||
}
|
||||
|
||||
Status = NtCreateSection( &SourceFileSection,
|
||||
SECTION_MAP_READ,
|
||||
NULL,
|
||||
NULL,
|
||||
PAGE_READONLY,
|
||||
SEC_COMMIT,
|
||||
FileHandleSource);
|
||||
if(!NT_SUCCESS(Status))
|
||||
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,
|
||||
SECTION_MAP_READ,
|
||||
NULL,
|
||||
NULL,
|
||||
PAGE_READONLY,
|
||||
SEC_COMMIT,
|
||||
FileHandleSource);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtCreateSection failed: %x, %S\n", Status, SourceFileName);
|
||||
goto closesrc;
|
||||
}
|
||||
|
||||
Status = NtMapViewOfSection( SourceFileSection,
|
||||
NtCurrentProcess(),
|
||||
&SourceFileMap,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&SourceSectionSize,
|
||||
ViewUnmap,
|
||||
0,
|
||||
PAGE_READONLY );
|
||||
if(!NT_SUCCESS(Status))
|
||||
Status = NtMapViewOfSection(SourceFileSection,
|
||||
NtCurrentProcess(),
|
||||
&SourceFileMap,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&SourceSectionSize,
|
||||
ViewUnmap,
|
||||
0,
|
||||
PAGE_READONLY );
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtMapViewOfSection failed: %x, %S\n", Status, SourceFileName);
|
||||
goto closesrcsec;
|
||||
DPRINT1("NtMapViewOfSection failed: %x, %S\n", Status, SourceFileName);
|
||||
goto closesrcsec;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&FileName,
|
||||
DestinationFileName);
|
||||
RtlInitUnicodeString(&FileName,
|
||||
DestinationFileName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreateFile(&FileHandleDest,
|
||||
GENERIC_WRITE | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
NULL,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0,
|
||||
FILE_OVERWRITE_IF,
|
||||
FILE_NO_INTERMEDIATE_BUFFERING |
|
||||
FILE_SEQUENTIAL_ONLY |
|
||||
FILE_SYNCHRONOUS_IO_NONALERT,
|
||||
NULL,
|
||||
0);
|
||||
if(!NT_SUCCESS(Status))
|
||||
Status = NtCreateFile(&FileHandleDest,
|
||||
GENERIC_WRITE | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
NULL,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0,
|
||||
FILE_OVERWRITE_IF,
|
||||
FILE_NO_INTERMEDIATE_BUFFERING |
|
||||
FILE_SEQUENTIAL_ONLY |
|
||||
FILE_SYNCHRONOUS_IO_NONALERT,
|
||||
NULL,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtCreateFile failed: %x\n", Status);
|
||||
goto unmapsrcsec;
|
||||
DPRINT1("NtCreateFile failed: %x\n", Status);
|
||||
goto unmapsrcsec;
|
||||
}
|
||||
|
||||
RegionSize = (ULONG)PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart);
|
||||
IoStatusBlock.Status = 0;
|
||||
ByteOffset.QuadPart = 0;
|
||||
Status = NtWriteFile(FileHandleDest,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&IoStatusBlock,
|
||||
SourceFileMap,
|
||||
RegionSize,
|
||||
&ByteOffset,
|
||||
NULL);
|
||||
if(!NT_SUCCESS(Status))
|
||||
RegionSize = (ULONG)PAGE_ROUND_UP(FileStandard.EndOfFile.u.LowPart);
|
||||
IoStatusBlock.Status = 0;
|
||||
ByteOffset.QuadPart = 0;
|
||||
Status = NtWriteFile(FileHandleDest,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&IoStatusBlock,
|
||||
SourceFileMap,
|
||||
RegionSize,
|
||||
&ByteOffset,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtWriteFile failed: %x:%x, iosb: %p src: %p, size: %x\n", Status, IoStatusBlock.Status, &IoStatusBlock, SourceFileMap, RegionSize);
|
||||
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;
|
||||
DPRINT1("NtWriteFile failed: %x:%x, iosb: %p src: %p, size: %x\n", Status, IoStatusBlock.Status, &IoStatusBlock, SourceFileMap, RegionSize);
|
||||
goto closedest;
|
||||
}
|
||||
|
||||
/* shorten the file back to it's real size after completing the write */
|
||||
Status = NtSetInformationFile(FileHandleDest,
|
||||
&IoStatusBlock,
|
||||
&FileStandard.EndOfFile,
|
||||
sizeof(FILE_END_OF_FILE_INFORMATION),
|
||||
FileEndOfFileInformation);
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
/* 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);
|
||||
DPRINT1("NtSetInformationFile failed: %x\n", Status);
|
||||
goto closedest;
|
||||
}
|
||||
|
||||
closedest:
|
||||
NtClose(FileHandleDest);
|
||||
unmapsrcsec:
|
||||
NtUnmapViewOfSection( NtCurrentProcess(), SourceFileMap );
|
||||
closesrcsec:
|
||||
NtClose(SourceFileSection);
|
||||
closesrc:
|
||||
NtClose(FileHandleSource);
|
||||
done:
|
||||
return(Status);
|
||||
/* shorten the file back to it's real size after completing the write */
|
||||
Status = NtSetInformationFile(FileHandleDest,
|
||||
&IoStatusBlock,
|
||||
&FileStandard.EndOfFile,
|
||||
sizeof(FILE_END_OF_FILE_INFORMATION),
|
||||
FileEndOfFileInformation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtSetInformationFile failed: %x\n", Status);
|
||||
}
|
||||
|
||||
closedest:
|
||||
NtClose(FileHandleDest);
|
||||
|
||||
unmapsrcsec:
|
||||
NtUnmapViewOfSection(NtCurrentProcess(), SourceFileMap);
|
||||
|
||||
closesrcsec:
|
||||
NtClose(SourceFileSection);
|
||||
|
||||
closesrc:
|
||||
NtClose(FileHandleSource);
|
||||
|
||||
done:
|
||||
return Status;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
NTSTATUS
|
||||
SetupExtractFile(PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationPathName)
|
||||
SetupExtractFile(
|
||||
PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationPathName)
|
||||
{
|
||||
ULONG CabStatus;
|
||||
ULONG CabStatus;
|
||||
|
||||
DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S, DestinationPathName %S)\n",
|
||||
CabinetFileName, SourceFileName, DestinationPathName);
|
||||
DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S, DestinationPathName %S)\n",
|
||||
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 */
|
||||
CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search);
|
||||
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)
|
||||
/* Use our last location because the files should be sequential */
|
||||
CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search);
|
||||
if (CabStatus != CAB_STATUS_SUCCESS)
|
||||
{
|
||||
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();
|
||||
CabinetSetEventHandlers(NULL, NULL, NULL);
|
||||
CabinetSetCabinetName(CabinetFileName);
|
||||
CabinetInitialize();
|
||||
CabinetSetEventHandlers(NULL, NULL, NULL);
|
||||
CabinetSetCabinetName(CabinetFileName);
|
||||
|
||||
CabStatus = CabinetOpen();
|
||||
if (CabStatus == CAB_STATUS_SUCCESS)
|
||||
CabStatus = CabinetOpen();
|
||||
if (CabStatus == CAB_STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT("Opened cabinet %S\n", CabinetGetCabinetName());
|
||||
HasCurrentCabinet = TRUE;
|
||||
DPRINT("Opened cabinet %S\n", CabinetGetCabinetName());
|
||||
HasCurrentCabinet = TRUE;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
DPRINT("Cannot open cabinet (%d)\n", CabStatus);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
DPRINT("Cannot open cabinet (%d)\n", CabStatus);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* We have to start at the beginning here */
|
||||
CabStatus = CabinetFindFirst(SourceFileName, &Search);
|
||||
|
||||
/* We have to start at the beginning here */
|
||||
CabStatus = CabinetFindFirst(SourceFileName, &Search);
|
||||
}
|
||||
|
||||
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)
|
||||
if (CabStatus != CAB_STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT("Cannot extract file %S (%d)\n", SourceFileName, CabStatus);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
DPRINT1("Unable to find '%S' in cabinet '%S'\n", SourceFileName, CabinetGetCabinetName());
|
||||
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
|
||||
|
||||
BOOLEAN
|
||||
DoesFileExist(PWSTR PathName,
|
||||
PWSTR FileName)
|
||||
DoesFileExist(
|
||||
PWSTR PathName,
|
||||
PWSTR FileName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
UNICODE_STRING Name;
|
||||
WCHAR FullName[MAX_PATH];
|
||||
HANDLE FileHandle;
|
||||
NTSTATUS Status;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
UNICODE_STRING Name;
|
||||
WCHAR FullName[MAX_PATH];
|
||||
HANDLE FileHandle;
|
||||
NTSTATUS Status;
|
||||
|
||||
wcscpy(FullName, PathName);
|
||||
if (FileName != NULL)
|
||||
wcscpy(FullName, PathName);
|
||||
if (FileName != NULL)
|
||||
{
|
||||
if (FileName[0] != L'\\')
|
||||
wcscat(FullName, L"\\");
|
||||
wcscat(FullName, FileName);
|
||||
if (FileName[0] != L'\\')
|
||||
wcscat(FullName, L"\\");
|
||||
wcscat(FullName, FileName);
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&Name,
|
||||
FullName);
|
||||
RtlInitUnicodeString(&Name,
|
||||
FullName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenFile(&FileHandle,
|
||||
GENERIC_READ | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
0,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = NtOpenFile(&FileHandle,
|
||||
GENERIC_READ | SYNCHRONIZE,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
0,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NtClose(FileHandle);
|
||||
NtClose(FileHandle);
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -27,19 +27,23 @@
|
|||
#pragma once
|
||||
|
||||
NTSTATUS
|
||||
SetupCreateDirectory(PWCHAR DirectoryName);
|
||||
SetupCreateDirectory(
|
||||
PWCHAR DirectoryName);
|
||||
|
||||
NTSTATUS
|
||||
SetupCopyFile(PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
SetupCopyFile(
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
|
||||
NTSTATUS
|
||||
SetupExtractFile(PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
SetupExtractFile(
|
||||
PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
|
||||
BOOLEAN
|
||||
DoesFileExist(PWSTR PathName,
|
||||
PWSTR FileName);
|
||||
DoesFileExist(
|
||||
PWSTR PathName,
|
||||
PWSTR FileName);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -34,7 +34,9 @@ static PPROGRESSBAR FormatProgressBar = NULL;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static BOOLEAN NTAPI
|
||||
static
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
FormatCallback(
|
||||
IN CALLBACKCOMMAND Command,
|
||||
IN ULONG Modifier,
|
||||
|
@ -82,6 +84,7 @@ FormatCallback(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FormatPartition(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
|
|
|
@ -65,6 +65,7 @@ FS_AddProvider(
|
|||
InsertTailList(&List->ListHead, &Item->ListEntry);
|
||||
}
|
||||
|
||||
|
||||
PFILE_SYSTEM_LIST
|
||||
CreateFileSystemList(
|
||||
IN SHORT Left,
|
||||
|
@ -111,6 +112,7 @@ CreateFileSystemList(
|
|||
return List;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DestroyFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List)
|
||||
|
@ -131,6 +133,7 @@ DestroyFileSystemList(
|
|||
RtlFreeHeap(ProcessHeap, 0, List);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DrawFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List)
|
||||
|
@ -183,6 +186,7 @@ DrawFileSystemList(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ScrollDownFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List)
|
||||
|
@ -194,6 +198,7 @@ ScrollDownFileSystemList(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ScrollUpFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List)
|
||||
|
|
|
@ -30,34 +30,34 @@
|
|||
|
||||
typedef struct _FILE_SYSTEM_ITEM
|
||||
{
|
||||
LIST_ENTRY ListEntry;
|
||||
LPCWSTR 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);
|
||||
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 LPCWSTR ForceFileSystem);
|
||||
IN SHORT Left,
|
||||
IN SHORT Top,
|
||||
IN BOOLEAN ForceFormat,
|
||||
IN LPCWSTR ForceFileSystem);
|
||||
|
||||
VOID
|
||||
DestroyFileSystemList(
|
||||
|
|
|
@ -84,8 +84,9 @@ CreateGenericList(VOID)
|
|||
|
||||
|
||||
VOID
|
||||
DestroyGenericList(PGENERIC_LIST List,
|
||||
BOOLEAN FreeUserData)
|
||||
DestroyGenericList(
|
||||
PGENERIC_LIST List,
|
||||
BOOLEAN FreeUserData)
|
||||
{
|
||||
PGENERIC_LIST_ENTRY ListEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
|
@ -110,10 +111,11 @@ DestroyGenericList(PGENERIC_LIST List,
|
|||
|
||||
|
||||
BOOLEAN
|
||||
AppendGenericListEntry(PGENERIC_LIST List,
|
||||
PCHAR Text,
|
||||
PVOID UserData,
|
||||
BOOLEAN Current)
|
||||
AppendGenericListEntry(
|
||||
PGENERIC_LIST List,
|
||||
PCHAR Text,
|
||||
PVOID UserData,
|
||||
BOOLEAN Current)
|
||||
{
|
||||
PGENERIC_LIST_ENTRY Entry;
|
||||
|
||||
|
@ -139,8 +141,10 @@ AppendGenericListEntry(PGENERIC_LIST List,
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
DrawListFrame(PGENERIC_LIST GenericList)
|
||||
static
|
||||
VOID
|
||||
DrawListFrame(
|
||||
PGENERIC_LIST GenericList)
|
||||
{
|
||||
COORD coPos;
|
||||
DWORD Written;
|
||||
|
@ -221,8 +225,10 @@ DrawListFrame(PGENERIC_LIST GenericList)
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
DrawListEntries(PGENERIC_LIST GenericList)
|
||||
static
|
||||
VOID
|
||||
DrawListEntries(
|
||||
PGENERIC_LIST GenericList)
|
||||
{
|
||||
PGENERIC_LIST_ENTRY ListEntry;
|
||||
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;
|
||||
DWORD Written;
|
||||
|
@ -331,12 +340,14 @@ DrawScrollBarGenericList(PGENERIC_LIST GenericList)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DrawGenericList(PGENERIC_LIST List,
|
||||
SHORT Left,
|
||||
SHORT Top,
|
||||
SHORT Right,
|
||||
SHORT Bottom)
|
||||
DrawGenericList(
|
||||
PGENERIC_LIST List,
|
||||
SHORT Left,
|
||||
SHORT Top,
|
||||
SHORT Right,
|
||||
SHORT Bottom)
|
||||
{
|
||||
List->FirstShown = List->ListHead.Flink;
|
||||
List->Left = Left;
|
||||
|
@ -353,8 +364,10 @@ DrawGenericList(PGENERIC_LIST List,
|
|||
DrawScrollBarGenericList(List);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ScrollPageDownGenericList (PGENERIC_LIST List)
|
||||
ScrollPageDownGenericList(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
SHORT i;
|
||||
|
||||
|
@ -374,8 +387,10 @@ ScrollPageDownGenericList (PGENERIC_LIST List)
|
|||
List->Redraw = TRUE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ScrollPageUpGenericList (PGENERIC_LIST List)
|
||||
ScrollPageUpGenericList(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
SHORT i;
|
||||
|
||||
|
@ -395,8 +410,10 @@ ScrollPageUpGenericList (PGENERIC_LIST List)
|
|||
List->Redraw = TRUE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ScrollDownGenericList (PGENERIC_LIST List)
|
||||
ScrollDownGenericList(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
PLIST_ENTRY Entry;
|
||||
|
||||
|
@ -423,7 +440,9 @@ ScrollDownGenericList (PGENERIC_LIST List)
|
|||
|
||||
|
||||
VOID
|
||||
ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex)
|
||||
ScrollToPositionGenericList(
|
||||
PGENERIC_LIST List,
|
||||
ULONG uIndex)
|
||||
{
|
||||
PLIST_ENTRY Entry;
|
||||
ULONG uCount = 0;
|
||||
|
@ -456,7 +475,8 @@ ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex)
|
|||
|
||||
|
||||
VOID
|
||||
ScrollUpGenericList (PGENERIC_LIST List)
|
||||
ScrollUpGenericList(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
PLIST_ENTRY Entry;
|
||||
|
||||
|
@ -483,7 +503,8 @@ ScrollUpGenericList (PGENERIC_LIST List)
|
|||
|
||||
|
||||
VOID
|
||||
RedrawGenericList(PGENERIC_LIST List)
|
||||
RedrawGenericList(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
if (List->CurrentEntry == NULL)
|
||||
return;
|
||||
|
@ -497,7 +518,9 @@ RedrawGenericList(PGENERIC_LIST List)
|
|||
|
||||
|
||||
VOID
|
||||
SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry)
|
||||
SetCurrentListEntry(
|
||||
PGENERIC_LIST List,
|
||||
PGENERIC_LIST_ENTRY Entry)
|
||||
{
|
||||
if (Entry->List != List)
|
||||
return;
|
||||
|
@ -506,14 +529,16 @@ SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry)
|
|||
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetCurrentListEntry(PGENERIC_LIST List)
|
||||
GetCurrentListEntry(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
return List->CurrentEntry;
|
||||
}
|
||||
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetFirstListEntry(PGENERIC_LIST List)
|
||||
GetFirstListEntry(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
PLIST_ENTRY Entry = List->ListHead.Flink;
|
||||
|
||||
|
@ -524,7 +549,8 @@ GetFirstListEntry(PGENERIC_LIST List)
|
|||
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetNextListEntry(PGENERIC_LIST_ENTRY Entry)
|
||||
GetNextListEntry(
|
||||
PGENERIC_LIST_ENTRY Entry)
|
||||
{
|
||||
PLIST_ENTRY Next = Entry->Entry.Flink;
|
||||
|
||||
|
@ -535,21 +561,25 @@ GetNextListEntry(PGENERIC_LIST_ENTRY Entry)
|
|||
|
||||
|
||||
PVOID
|
||||
GetListEntryUserData(PGENERIC_LIST_ENTRY List)
|
||||
GetListEntryUserData(
|
||||
PGENERIC_LIST_ENTRY List)
|
||||
{
|
||||
return List->UserData;
|
||||
}
|
||||
|
||||
|
||||
LPCSTR
|
||||
GetListEntryText(PGENERIC_LIST_ENTRY List)
|
||||
GetListEntryText(
|
||||
PGENERIC_LIST_ENTRY List)
|
||||
{
|
||||
return List->Text;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar)
|
||||
GenericListKeyPress(
|
||||
PGENERIC_LIST GenericList,
|
||||
CHAR AsciChar)
|
||||
{
|
||||
PGENERIC_LIST_ENTRY ListEntry;
|
||||
PGENERIC_LIST_ENTRY OldListEntry;
|
||||
|
@ -609,14 +639,16 @@ End:
|
|||
|
||||
|
||||
VOID
|
||||
SaveGenericListState(PGENERIC_LIST List)
|
||||
SaveGenericListState(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
List->BackupEntry = List->CurrentEntry;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
RestoreGenericListState(PGENERIC_LIST List)
|
||||
RestoreGenericListState(
|
||||
PGENERIC_LIST List)
|
||||
{
|
||||
List->CurrentEntry = List->BackupEntry;
|
||||
}
|
||||
|
|
|
@ -35,68 +35,90 @@ PGENERIC_LIST
|
|||
CreateGenericList(VOID);
|
||||
|
||||
VOID
|
||||
DestroyGenericList(PGENERIC_LIST List,
|
||||
BOOLEAN FreeUserData);
|
||||
DestroyGenericList(
|
||||
PGENERIC_LIST List,
|
||||
BOOLEAN FreeUserData);
|
||||
|
||||
BOOLEAN
|
||||
AppendGenericListEntry(PGENERIC_LIST List,
|
||||
PCHAR Text,
|
||||
PVOID UserData,
|
||||
BOOLEAN Current);
|
||||
AppendGenericListEntry(
|
||||
PGENERIC_LIST List,
|
||||
PCHAR Text,
|
||||
PVOID UserData,
|
||||
BOOLEAN Current);
|
||||
|
||||
VOID
|
||||
DrawGenericList(PGENERIC_LIST List,
|
||||
SHORT Left,
|
||||
SHORT Top,
|
||||
SHORT Right,
|
||||
SHORT Bottom);
|
||||
DrawGenericList(
|
||||
PGENERIC_LIST List,
|
||||
SHORT Left,
|
||||
SHORT Top,
|
||||
SHORT Right,
|
||||
SHORT Bottom);
|
||||
|
||||
VOID
|
||||
DrawScrollBarGenericLis(PGENERIC_LIST List);
|
||||
DrawScrollBarGenericLis(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
ScrollDownGenericList(PGENERIC_LIST List);
|
||||
ScrollDownGenericList(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
ScrollUpGenericList(PGENERIC_LIST List);
|
||||
ScrollUpGenericList(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
ScrollPageDownGenericList(PGENERIC_LIST List);
|
||||
ScrollPageDownGenericList(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
ScrollPageUpGenericList(PGENERIC_LIST List);
|
||||
ScrollPageUpGenericList(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex);
|
||||
ScrollToPositionGenericList(
|
||||
PGENERIC_LIST List,
|
||||
ULONG uIndex);
|
||||
|
||||
VOID
|
||||
RedrawGenericList(PGENERIC_LIST List);
|
||||
RedrawGenericList(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry);
|
||||
SetCurrentListEntry(
|
||||
PGENERIC_LIST List,
|
||||
PGENERIC_LIST_ENTRY Entry);
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetCurrentListEntry(PGENERIC_LIST List);
|
||||
GetCurrentListEntry(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetFirstListEntry(PGENERIC_LIST List);
|
||||
GetFirstListEntry(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
PGENERIC_LIST_ENTRY
|
||||
GetNextListEntry(PGENERIC_LIST_ENTRY Entry);
|
||||
GetNextListEntry(
|
||||
PGENERIC_LIST_ENTRY Entry);
|
||||
|
||||
PVOID
|
||||
GetListEntryUserData(PGENERIC_LIST_ENTRY List);
|
||||
GetListEntryUserData(
|
||||
PGENERIC_LIST_ENTRY List);
|
||||
|
||||
LPCSTR
|
||||
GetListEntryText(PGENERIC_LIST_ENTRY List);
|
||||
GetListEntryText(
|
||||
PGENERIC_LIST_ENTRY List);
|
||||
|
||||
VOID
|
||||
SaveGenericListState(PGENERIC_LIST List);
|
||||
SaveGenericListState(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
RestoreGenericListState(PGENERIC_LIST List);
|
||||
RestoreGenericListState(
|
||||
PGENERIC_LIST List);
|
||||
|
||||
VOID
|
||||
GenericListKeyPress (PGENERIC_LIST List, CHAR AsciChar);
|
||||
GenericListKeyPress(
|
||||
PGENERIC_LIST List,
|
||||
CHAR AsciChar);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -15,19 +15,17 @@
|
|||
#endif
|
||||
|
||||
BOOLEAN
|
||||
HOST_InitConsole(
|
||||
VOID);
|
||||
HOST_InitConsole(VOID);
|
||||
|
||||
BOOLEAN
|
||||
HOST_InitMemory(
|
||||
VOID);
|
||||
HOST_InitMemory(VOID);
|
||||
|
||||
BOOLEAN
|
||||
HOST_CreateFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List);
|
||||
IN PFILE_SYSTEM_LIST List);
|
||||
|
||||
BOOLEAN
|
||||
HOST_FormatPartition(
|
||||
IN PFILE_SYSTEM_ITEM FileSystem,
|
||||
IN PCUNICODE_STRING DriveRoot,
|
||||
IN PFMIFSCALLBACK Callback);
|
||||
IN PFILE_SYSTEM_ITEM FileSystem,
|
||||
IN PCUNICODE_STRING DriveRoot,
|
||||
IN PFMIFSCALLBACK Callback);
|
||||
|
|
|
@ -35,173 +35,179 @@
|
|||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
InfpFindFirstLineW(
|
||||
IN HINF InfHandle,
|
||||
IN PCWSTR Section,
|
||||
IN PCWSTR Key,
|
||||
IN OUT PINFCONTEXT Context)
|
||||
IN HINF InfHandle,
|
||||
IN PCWSTR Section,
|
||||
IN PCWSTR Key,
|
||||
IN OUT PINFCONTEXT Context)
|
||||
{
|
||||
PINFCONTEXT pContext;
|
||||
BOOL ret;
|
||||
PINFCONTEXT pContext;
|
||||
BOOL ret;
|
||||
|
||||
ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
|
||||
memcpy(Context, pContext, sizeof(INFCONTEXT));
|
||||
InfFreeContext(pContext);
|
||||
return TRUE;
|
||||
memcpy(Context, pContext, sizeof(INFCONTEXT));
|
||||
InfFreeContext(pContext);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HINF WINAPI
|
||||
|
||||
HINF
|
||||
WINAPI
|
||||
InfpOpenInfFileW(
|
||||
IN PCWSTR FileName,
|
||||
IN PCWSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine)
|
||||
IN PCWSTR FileName,
|
||||
IN PCWSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine)
|
||||
{
|
||||
HINF hInf = NULL;
|
||||
UNICODE_STRING FileNameU;
|
||||
ULONG ErrorLineUL;
|
||||
NTSTATUS Status;
|
||||
HINF hInf = NULL;
|
||||
UNICODE_STRING FileNameU;
|
||||
ULONG ErrorLineUL;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlInitUnicodeString(&FileNameU, FileName);
|
||||
Status = InfOpenFile(
|
||||
&hInf,
|
||||
&FileNameU,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return INVALID_HANDLE_VALUE;
|
||||
RtlInitUnicodeString(&FileNameU, FileName);
|
||||
Status = InfOpenFile(&hInf,
|
||||
&FileNameU,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return INVALID_HANDLE_VALUE;
|
||||
|
||||
return hInf;
|
||||
return hInf;
|
||||
}
|
||||
|
||||
#endif /* __REACTOS__ */
|
||||
|
||||
|
||||
BOOLEAN
|
||||
INF_GetData(
|
||||
IN PINFCONTEXT Context,
|
||||
OUT PWCHAR *Key,
|
||||
OUT PWCHAR *Data)
|
||||
IN PINFCONTEXT Context,
|
||||
OUT PWCHAR *Key,
|
||||
OUT PWCHAR *Data)
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
return InfGetData(Context, Key, Data);
|
||||
return InfGetData(Context, Key, Data);
|
||||
#else
|
||||
static PWCHAR pLastCallData[4] = { NULL, NULL, NULL, NULL };
|
||||
static DWORD currentIndex = 0;
|
||||
DWORD dwSize, i;
|
||||
BOOL ret;
|
||||
static PWCHAR pLastCallData[4] = { NULL, NULL, NULL, NULL };
|
||||
static DWORD currentIndex = 0;
|
||||
DWORD dwSize, i;
|
||||
BOOL ret;
|
||||
|
||||
currentIndex ^= 2;
|
||||
currentIndex ^= 2;
|
||||
|
||||
if (Key) *Key = NULL;
|
||||
if (Data) *Data = NULL;
|
||||
if (Key)
|
||||
*Key = NULL;
|
||||
|
||||
if (SetupGetFieldCount(Context) != 1)
|
||||
return FALSE;
|
||||
if (Data)
|
||||
*Data = NULL;
|
||||
|
||||
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 (SetupGetFieldCount(Context) != 1)
|
||||
return FALSE;
|
||||
|
||||
if (Key)
|
||||
*Key = pLastCallData[0 + currentIndex];
|
||||
if (Data)
|
||||
*Data = pLastCallData[1 + currentIndex];
|
||||
return TRUE;
|
||||
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
|
||||
INF_GetDataField(
|
||||
IN PINFCONTEXT Context,
|
||||
IN ULONG FieldIndex,
|
||||
OUT PWCHAR *Data)
|
||||
IN PINFCONTEXT Context,
|
||||
IN ULONG FieldIndex,
|
||||
OUT PWCHAR *Data)
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
return InfGetDataField(Context, FieldIndex, Data);
|
||||
return InfGetDataField(Context, FieldIndex, Data);
|
||||
#else
|
||||
static PWCHAR pLastCallsData[] = { NULL, NULL, NULL };
|
||||
static DWORD NextIndex = 0;
|
||||
DWORD dwSize;
|
||||
BOOL ret;
|
||||
static PWCHAR pLastCallsData[] = { NULL, NULL, NULL };
|
||||
static DWORD NextIndex = 0;
|
||||
DWORD dwSize;
|
||||
BOOL ret;
|
||||
|
||||
*Data = NULL;
|
||||
*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;
|
||||
ret = SetupGetStringFieldW(Context,
|
||||
FieldIndex,
|
||||
NULL,
|
||||
0,
|
||||
&dwSize);
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
|
||||
*Data = pLastCallsData[NextIndex];
|
||||
NextIndex = (NextIndex + 1) % (sizeof(pLastCallsData) / sizeof(pLastCallsData[0]));
|
||||
return TRUE;
|
||||
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
|
||||
INF_OpenBufferedFileA(
|
||||
IN PSTR FileBuffer,
|
||||
IN ULONG FileSize,
|
||||
IN PCSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine)
|
||||
IN PSTR FileBuffer,
|
||||
IN ULONG FileSize,
|
||||
IN PCSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine)
|
||||
{
|
||||
#ifdef __REACTOS__
|
||||
HINF hInf = NULL;
|
||||
ULONG ErrorLineUL;
|
||||
NTSTATUS Status;
|
||||
HINF hInf = NULL;
|
||||
ULONG ErrorLineUL;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = InfOpenBufferedFile(
|
||||
&hInf,
|
||||
FileBuffer,
|
||||
FileSize,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return INVALID_HANDLE_VALUE;
|
||||
Status = InfOpenBufferedFile(&hInf,
|
||||
FileBuffer,
|
||||
FileSize,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return INVALID_HANDLE_VALUE;
|
||||
|
||||
return hInf;
|
||||
return hInf;
|
||||
#else
|
||||
return INVALID_HANDLE_VALUE;
|
||||
return INVALID_HANDLE_VALUE;
|
||||
#endif /* !__REACTOS__ */
|
||||
}
|
||||
|
||||
|
|
|
@ -45,47 +45,49 @@
|
|||
* Delete it once we don't use inflib anymore */
|
||||
typedef struct _INFCONTEXT
|
||||
{
|
||||
PVOID Inf;
|
||||
PVOID Section;
|
||||
PVOID Line;
|
||||
PVOID Inf;
|
||||
PVOID Section;
|
||||
PVOID Line;
|
||||
} INFCONTEXT;
|
||||
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
InfpFindFirstLineW(
|
||||
IN HINF InfHandle,
|
||||
IN PCWSTR Section,
|
||||
IN PCWSTR Key,
|
||||
IN OUT PINFCONTEXT Context);
|
||||
IN HINF InfHandle,
|
||||
IN PCWSTR Section,
|
||||
IN PCWSTR Key,
|
||||
IN OUT PINFCONTEXT Context);
|
||||
|
||||
HINF WINAPI
|
||||
HINF
|
||||
WINAPI
|
||||
InfpOpenInfFileW(
|
||||
IN PCWSTR FileName,
|
||||
IN PCWSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine);
|
||||
IN PCWSTR FileName,
|
||||
IN PCWSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine);
|
||||
|
||||
#endif /* __REACTOS__ */
|
||||
|
||||
BOOLEAN
|
||||
INF_GetData(
|
||||
IN PINFCONTEXT Context,
|
||||
OUT PWCHAR *Key,
|
||||
OUT PWCHAR *Data);
|
||||
IN PINFCONTEXT Context,
|
||||
OUT PWCHAR *Key,
|
||||
OUT PWCHAR *Data);
|
||||
|
||||
BOOLEAN
|
||||
INF_GetDataField(
|
||||
IN PINFCONTEXT Context,
|
||||
IN ULONG FieldIndex,
|
||||
OUT PWCHAR *Data);
|
||||
IN PINFCONTEXT Context,
|
||||
IN ULONG FieldIndex,
|
||||
OUT PWCHAR *Data);
|
||||
|
||||
HINF WINAPI
|
||||
INF_OpenBufferedFileA(
|
||||
IN PSTR FileBuffer,
|
||||
IN ULONG FileSize,
|
||||
IN PCSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine);
|
||||
IN PSTR FileBuffer,
|
||||
IN ULONG FileSize,
|
||||
IN PCSTR InfClass,
|
||||
IN DWORD InfStyle,
|
||||
IN LCID LocaleId,
|
||||
OUT PUINT ErrorLine);
|
||||
|
||||
/* EOF */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,99 +29,107 @@
|
|||
|
||||
typedef struct _INICACHEKEY
|
||||
{
|
||||
PWCHAR Name;
|
||||
PWCHAR Data;
|
||||
PWCHAR Name;
|
||||
PWCHAR Data;
|
||||
|
||||
struct _INICACHEKEY *Next;
|
||||
struct _INICACHEKEY *Prev;
|
||||
struct _INICACHEKEY *Next;
|
||||
struct _INICACHEKEY *Prev;
|
||||
} INICACHEKEY, *PINICACHEKEY;
|
||||
|
||||
|
||||
typedef struct _INICACHESECTION
|
||||
{
|
||||
PWCHAR Name;
|
||||
PWCHAR Name;
|
||||
|
||||
PINICACHEKEY FirstKey;
|
||||
PINICACHEKEY LastKey;
|
||||
PINICACHEKEY FirstKey;
|
||||
PINICACHEKEY LastKey;
|
||||
|
||||
struct _INICACHESECTION *Next;
|
||||
struct _INICACHESECTION *Prev;
|
||||
struct _INICACHESECTION *Next;
|
||||
struct _INICACHESECTION *Prev;
|
||||
} INICACHESECTION, *PINICACHESECTION;
|
||||
|
||||
|
||||
typedef struct _INICACHE
|
||||
{
|
||||
PINICACHESECTION FirstSection;
|
||||
PINICACHESECTION LastSection;
|
||||
PINICACHESECTION FirstSection;
|
||||
PINICACHESECTION LastSection;
|
||||
} INICACHE, *PINICACHE;
|
||||
|
||||
|
||||
typedef struct _PINICACHEITERATOR
|
||||
{
|
||||
PINICACHESECTION Section;
|
||||
PINICACHEKEY Key;
|
||||
PINICACHESECTION Section;
|
||||
PINICACHEKEY Key;
|
||||
} INICACHEITERATOR, *PINICACHEITERATOR;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
INSERT_FIRST,
|
||||
INSERT_BEFORE,
|
||||
INSERT_AFTER,
|
||||
INSERT_LAST
|
||||
INSERT_FIRST,
|
||||
INSERT_BEFORE,
|
||||
INSERT_AFTER,
|
||||
INSERT_LAST
|
||||
} INSERTATION_TYPE;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
IniCacheLoad(PINICACHE *Cache,
|
||||
PUNICODE_STRING FileName,
|
||||
BOOLEAN String);
|
||||
IniCacheLoad(
|
||||
PINICACHE *Cache,
|
||||
PUNICODE_STRING FileName,
|
||||
BOOLEAN String);
|
||||
|
||||
VOID
|
||||
IniCacheDestroy(PINICACHE Cache);
|
||||
IniCacheDestroy(
|
||||
PINICACHE Cache);
|
||||
|
||||
PINICACHESECTION
|
||||
IniCacheGetSection(PINICACHE Cache,
|
||||
PWCHAR Name);
|
||||
IniCacheGetSection(
|
||||
PINICACHE Cache,
|
||||
PWCHAR Name);
|
||||
|
||||
NTSTATUS
|
||||
IniCacheGetKey(PINICACHESECTION Section,
|
||||
PWCHAR KeyName,
|
||||
PWCHAR *KeyData);
|
||||
|
||||
|
||||
IniCacheGetKey(
|
||||
PINICACHESECTION Section,
|
||||
PWCHAR KeyName,
|
||||
PWCHAR *KeyData);
|
||||
|
||||
PINICACHEITERATOR
|
||||
IniCacheFindFirstValue(PINICACHESECTION Section,
|
||||
PWCHAR *KeyName,
|
||||
PWCHAR *KeyData);
|
||||
IniCacheFindFirstValue(
|
||||
PINICACHESECTION Section,
|
||||
PWCHAR *KeyName,
|
||||
PWCHAR *KeyData);
|
||||
|
||||
BOOLEAN
|
||||
IniCacheFindNextValue(PINICACHEITERATOR Iterator,
|
||||
PWCHAR *KeyName,
|
||||
PWCHAR *KeyData);
|
||||
IniCacheFindNextValue(
|
||||
PINICACHEITERATOR Iterator,
|
||||
PWCHAR *KeyName,
|
||||
PWCHAR *KeyData);
|
||||
|
||||
VOID
|
||||
IniCacheFindClose(PINICACHEITERATOR Iterator);
|
||||
IniCacheFindClose(
|
||||
PINICACHEITERATOR Iterator);
|
||||
|
||||
|
||||
PINICACHEKEY
|
||||
IniCacheInsertKey(PINICACHESECTION Section,
|
||||
PINICACHEKEY AnchorKey,
|
||||
INSERTATION_TYPE InsertationType,
|
||||
PWCHAR Name,
|
||||
PWCHAR Data);
|
||||
IniCacheInsertKey(
|
||||
PINICACHESECTION Section,
|
||||
PINICACHEKEY AnchorKey,
|
||||
INSERTATION_TYPE InsertationType,
|
||||
PWCHAR Name,
|
||||
PWCHAR Data);
|
||||
|
||||
PINICACHE
|
||||
IniCacheCreate(VOID);
|
||||
|
||||
NTSTATUS
|
||||
IniCacheSave(PINICACHE Cache,
|
||||
PWCHAR FileName);
|
||||
IniCacheSave(
|
||||
PINICACHE Cache,
|
||||
PWCHAR FileName);
|
||||
|
||||
PINICACHESECTION
|
||||
IniCacheAppendSection(PINICACHE Cache,
|
||||
PWCHAR Name);
|
||||
IniCacheAppendSection(
|
||||
PINICACHE Cache,
|
||||
PWCHAR Name);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -63,8 +63,10 @@ FindLanguageIndex(VOID)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsLanguageAvailable(PWCHAR LanguageId)
|
||||
IsLanguageAvailable(
|
||||
PWCHAR LanguageId)
|
||||
{
|
||||
ULONG lngIndex = 0;
|
||||
|
||||
|
@ -82,7 +84,8 @@ IsLanguageAvailable(PWCHAR LanguageId)
|
|||
|
||||
static
|
||||
const MUI_ENTRY *
|
||||
FindMUIEntriesOfPage(IN ULONG PageNumber)
|
||||
FindMUIEntriesOfPage(
|
||||
IN ULONG PageNumber)
|
||||
{
|
||||
ULONG muiIndex = 0;
|
||||
ULONG lngIndex;
|
||||
|
@ -102,6 +105,7 @@ FindMUIEntriesOfPage(IN ULONG PageNumber)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
const MUI_ERROR *
|
||||
FindMUIErrorEntries(VOID)
|
||||
|
@ -110,6 +114,7 @@ FindMUIErrorEntries(VOID)
|
|||
return LanguageList[lngIndex].MuiErrors;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
const MUI_STRING *
|
||||
FindMUIStringEntries(VOID)
|
||||
|
@ -118,6 +123,7 @@ FindMUIStringEntries(VOID)
|
|||
return LanguageList[lngIndex].MuiStrings;
|
||||
}
|
||||
|
||||
|
||||
LPCWSTR
|
||||
MUIDefaultKeyboardLayout(VOID)
|
||||
{
|
||||
|
@ -125,6 +131,7 @@ MUIDefaultKeyboardLayout(VOID)
|
|||
return LanguageList[lngIndex].MuiLayouts[0].LayoutID;
|
||||
}
|
||||
|
||||
|
||||
PWCHAR
|
||||
MUIGetGeoID(VOID)
|
||||
{
|
||||
|
@ -132,6 +139,7 @@ MUIGetGeoID(VOID)
|
|||
return LanguageList[lngIndex].GeoID;
|
||||
}
|
||||
|
||||
|
||||
const MUI_LAYOUTS *
|
||||
MUIGetLayoutsList(VOID)
|
||||
{
|
||||
|
@ -139,8 +147,10 @@ MUIGetLayoutsList(VOID)
|
|||
return LanguageList[lngIndex].MuiLayouts;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
MUIClearPage(IN ULONG page)
|
||||
MUIClearPage(
|
||||
IN ULONG page)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
int index;
|
||||
|
@ -167,8 +177,10 @@ MUIClearPage(IN ULONG page)
|
|||
while (entry[index].Buffer != NULL);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
MUIDisplayPage(IN ULONG page)
|
||||
MUIDisplayPage(
|
||||
IN ULONG page)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
int index;
|
||||
|
@ -196,8 +208,12 @@ MUIDisplayPage(IN ULONG page)
|
|||
while (entry[index].Buffer != NULL);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -227,8 +243,10 @@ MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent)
|
|||
WaitEvent);
|
||||
}
|
||||
|
||||
|
||||
LPSTR
|
||||
MUIGetString(ULONG Number)
|
||||
MUIGetString(
|
||||
ULONG Number)
|
||||
{
|
||||
ULONG i;
|
||||
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());
|
||||
|
||||
PopupError(szErr,
|
||||
NULL,
|
||||
NULL,
|
||||
POPUP_WAIT_NONE);
|
||||
NULL,
|
||||
NULL,
|
||||
POPUP_WAIT_NONE);
|
||||
|
||||
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;
|
||||
UNICODE_STRING KeyName;
|
||||
|
@ -340,8 +363,10 @@ AddHotkeySettings(IN LPCWSTR Hotkey, IN LPCWSTR LangHotkey, IN LPCWSTR LayoutHot
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
|
||||
AddKbLayoutsToRegistry(
|
||||
IN const MUI_LAYOUTS *MuiLayouts)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName;
|
||||
|
@ -509,10 +534,12 @@ AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
AddKeyboardLayouts(VOID)
|
||||
{
|
||||
ULONG lngIndex = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
||||
|
@ -527,8 +554,13 @@ AddKeyboardLayouts(VOID)
|
|||
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;
|
||||
UNICODE_STRING KeyName;
|
||||
|
@ -603,8 +635,11 @@ AddCodepageToRegistry(IN LPCWSTR ACPage, IN LPCWSTR OEMCPage, IN LPCWSTR MACCPag
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
AddFontsSettingsToRegistry(IN const MUI_SUBFONT * MuiSubFonts)
|
||||
|
||||
static
|
||||
BOOLEAN
|
||||
AddFontsSettingsToRegistry(
|
||||
IN const MUI_SUBFONT * MuiSubFonts)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName;
|
||||
|
@ -654,6 +689,7 @@ AddFontsSettingsToRegistry(IN const MUI_SUBFONT * MuiSubFonts)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
AddCodePage(VOID)
|
||||
{
|
||||
|
@ -682,6 +718,7 @@ AddCodePage(VOID)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SetConsoleCodePage(VOID)
|
||||
{
|
||||
|
|
|
@ -54,16 +54,22 @@ typedef struct
|
|||
} MUI_LANGUAGE;
|
||||
|
||||
BOOLEAN
|
||||
IsLanguageAvailable(PWCHAR LanguageId);
|
||||
IsLanguageAvailable(
|
||||
PWCHAR LanguageId);
|
||||
|
||||
VOID
|
||||
MUIDisplayPage (ULONG PageNumber);
|
||||
MUIDisplayPage(
|
||||
ULONG PageNumber);
|
||||
|
||||
VOID
|
||||
MUIClearPage (ULONG PageNumber);
|
||||
MUIClearPage(
|
||||
ULONG PageNumber);
|
||||
|
||||
VOID
|
||||
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
|
||||
MUIDisplayError(
|
||||
ULONG ErrorNum,
|
||||
PINPUT_RECORD Ir,
|
||||
ULONG WaitEvent);
|
||||
|
||||
LPCWSTR
|
||||
MUIDefaultKeyboardLayout(VOID);
|
||||
|
@ -75,7 +81,8 @@ const MUI_LAYOUTS *
|
|||
MUIGetLayoutsList(VOID);
|
||||
|
||||
BOOLEAN
|
||||
AddKbLayoutsToRegistry(IN const MUI_LAYOUTS * MuiLayouts);
|
||||
AddKbLayoutsToRegistry(
|
||||
IN const MUI_LAYOUTS *MuiLayouts);
|
||||
|
||||
BOOLEAN
|
||||
AddCodePage(VOID);
|
||||
|
@ -87,7 +94,8 @@ VOID
|
|||
SetConsoleCodePage(VOID);
|
||||
|
||||
LPSTR
|
||||
MUIGetString(ULONG Number);
|
||||
MUIGetString(
|
||||
ULONG Number);
|
||||
|
||||
#define STRING_PLEASEWAIT 1
|
||||
#define STRING_INSTALLCREATEPARTITION 2
|
||||
|
|
Loading…
Reference in a new issue