[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,8 +1275,10 @@ InstallMbrBootCodeToDisk(
return Status; return Status;
} }
NTSTATUS NTSTATUS
InstallFat12BootCodeToFloppy(PWSTR SrcPath, InstallFat12BootCodeToFloppy(
PWSTR SrcPath,
PWSTR RootPath) PWSTR RootPath)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
@ -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 IniPath,
PWCHAR ArcPath); PWCHAR ArcPath);
NTSTATUS NTSTATUS
CreateFreeLoaderIniForReactos(PWCHAR IniPath, CreateFreeLoaderIniForReactos(
PWCHAR IniPath,
PWCHAR ArcPath); PWCHAR ArcPath);
NTSTATUS NTSTATUS
UpdateFreeLoaderIni(PWCHAR IniPath, UpdateFreeLoaderIni(
PWCHAR IniPath,
PWCHAR ArcPath); PWCHAR ArcPath);
NTSTATUS NTSTATUS
SaveCurrentBootSector(PWSTR RootPath, SaveCurrentBootSector(
PWSTR RootPath,
PWSTR DstPath); PWSTR DstPath);
NTSTATUS NTSTATUS
InstallFat16BootCodeToFile(PWSTR SrcPath, InstallFat16BootCodeToFile(
PWSTR SrcPath,
PWSTR DstPath, PWSTR DstPath,
PWSTR RootPath); PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat32BootCodeToFile(PWSTR SrcPath, InstallFat32BootCodeToFile(
PWSTR SrcPath,
PWSTR DstPath, PWSTR DstPath,
PWSTR RootPath); PWSTR RootPath);
NTSTATUS NTSTATUS
InstallMbrBootCodeToDisk (PWSTR SrcPath, InstallMbrBootCodeToDisk(
PWSTR SrcPath,
PWSTR RootPath); PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat16BootCodeToDisk(PWSTR SrcPath, InstallFat16BootCodeToDisk(
PWSTR SrcPath,
PWSTR RootPath); PWSTR RootPath);
NTSTATUS NTSTATUS
InstallFat32BootCodeToDisk(PWSTR SrcPath, InstallFat32BootCodeToDisk(
PWSTR SrcPath,
PWSTR RootPath); PWSTR RootPath);
NTSTATUS NTSTATUS
UpdateBootIni(PWSTR BootIniPath, UpdateBootIni(
PWSTR BootIniPath,
PWSTR EntryName, PWSTR EntryName,
PWSTR EntryValue); PWSTR EntryValue);
BOOLEAN BOOLEAN
CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath); CheckInstallFatBootcodeToPartition(
PUNICODE_STRING SystemRootPath);
NTSTATUS NTSTATUS
InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath, InstallFatBootcodeToPartition(
PUNICODE_STRING SystemRootPath,
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourceRootPath,
PUNICODE_STRING DestinationArcPath, PUNICODE_STRING DestinationArcPath,
UCHAR PartitionType); UCHAR PartitionType);
NTSTATUS NTSTATUS
InstallVBRToPartition(PUNICODE_STRING SystemRootPath, InstallVBRToPartition(
PUNICODE_STRING SystemRootPath,
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourceRootPath,
PUNICODE_STRING DestinationArcPath, PUNICODE_STRING DestinationArcPath,
UCHAR PartitionType); UCHAR PartitionType);
NTSTATUS NTSTATUS
InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, InstallFatBootcodeToFloppy(
PUNICODE_STRING SourceRootPath,
PUNICODE_STRING DestinationArcPath); 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,7 +34,8 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
NTSTATUS NTSTATUS
GetSourcePaths(PUNICODE_STRING SourcePath, GetSourcePaths(
PUNICODE_STRING SourcePath,
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourceRootPath,
PUNICODE_STRING SourceRootDir) PUNICODE_STRING SourceRootDir)
{ {
@ -60,7 +61,7 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
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);
@ -92,8 +93,7 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
NtClose(Handle); NtClose(Handle);
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
/* EOF */ /* EOF */

View file

@ -27,7 +27,8 @@
#pragma once #pragma once
NTSTATUS NTSTATUS
GetSourcePaths(PUNICODE_STRING SourcePath, GetSourcePaths(
PUNICODE_STRING SourcePath,
PUNICODE_STRING SourceRootPath, PUNICODE_STRING SourceRootPath,
PUNICODE_STRING SourceRootDir); PUNICODE_STRING SourceRootDir);

View file

@ -44,7 +44,6 @@ typedef struct _QUEUEENTRY
PWSTR SourceFilename; PWSTR SourceFilename;
PWSTR TargetDirectory; PWSTR TargetDirectory;
PWSTR TargetFilename; PWSTR TargetFilename;
} QUEUEENTRY, *PQUEUEENTRY; } QUEUEENTRY, *PQUEUEENTRY;
@ -58,7 +57,8 @@ typedef struct _FILEQUEUEHEADER
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ WINAPI HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID) SetupOpenFileQueue(VOID)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
@ -68,19 +68,20 @@ SetupOpenFileQueue(VOID)
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;
@ -97,14 +98,19 @@ SetupCloseFileQueue(HSPFILEQ QueueHandle)
/* 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) if (Entry->SourceRootPath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
if (Entry->SourcePath != NULL) if (Entry->SourcePath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
if (Entry->SourceFilename != NULL) if (Entry->SourceFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename); RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
if (Entry->TargetDirectory != NULL) if (Entry->TargetDirectory != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory); RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
if (Entry->TargetFilename != NULL) if (Entry->TargetFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetFilename); RtlFreeHeap(ProcessHeap, 0, Entry->TargetFilename);
@ -128,14 +134,13 @@ SetupCloseFileQueue(HSPFILEQ QueueHandle)
} }
/* Delete queue header */ /* Delete queue header */
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, QueueHeader);
0,
QueueHeader);
} }
BOOL BOOL
SetupQueueCopy(HSPFILEQ QueueHandle, SetupQueueCopy(
HSPFILEQ QueueHandle,
PCWSTR SourceCabinet, PCWSTR SourceCabinet,
PCWSTR SourceRootPath, PCWSTR SourceRootPath,
PCWSTR SourcePath, PCWSTR SourcePath,
@ -152,7 +157,7 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
SourceRootPath == NULL || SourceRootPath == NULL ||
SourceFilename == NULL || SourceFilename == NULL ||
TargetDirectory == NULL) TargetDirectory == NULL)
return(FALSE); return FALSE;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
@ -161,7 +166,7 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
0, 0,
sizeof(QUEUEENTRY)); sizeof(QUEUEENTRY));
if (Entry == NULL) if (Entry == NULL)
return(FALSE); return FALSE;
RtlZeroMemory(Entry, RtlZeroMemory(Entry,
sizeof(QUEUEENTRY)); sizeof(QUEUEENTRY));
@ -176,8 +181,9 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
if (Entry->SourceCabinet == NULL) if (Entry->SourceCabinet == NULL)
{ {
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->SourceCabinet, SourceCabinet, Length); wcsncpy(Entry->SourceCabinet, SourceCabinet, Length);
Entry->SourceCabinet[Length] = (WCHAR)0; Entry->SourceCabinet[Length] = (WCHAR)0;
} }
@ -197,9 +203,11 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->SourceRootPath, SourceRootPath, Length); wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
Entry->SourceRootPath[Length] = (WCHAR)0; Entry->SourceRootPath[Length] = (WCHAR)0;
@ -216,10 +224,12 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->SourcePath, SourcePath, Length); wcsncpy(Entry->SourcePath, SourcePath, Length);
Entry->SourcePath[Length] = (WCHAR)0; Entry->SourcePath[Length] = (WCHAR)0;
} }
@ -235,11 +245,13 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->SourceFilename, SourceFilename, Length); wcsncpy(Entry->SourceFilename, SourceFilename, Length);
Entry->SourceFilename[Length] = (WCHAR)0; Entry->SourceFilename[Length] = (WCHAR)0;
@ -256,12 +268,14 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename); RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->TargetDirectory, TargetDirectory, Length); wcsncpy(Entry->TargetDirectory, TargetDirectory, Length);
Entry->TargetDirectory[Length] = (WCHAR)0; Entry->TargetDirectory[Length] = (WCHAR)0;
@ -278,13 +292,15 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
{ {
RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet); RtlFreeHeap(ProcessHeap, 0, Entry->SourceCabinet);
} }
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath); RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath); RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename); RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory); RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
RtlFreeHeap(ProcessHeap, 0, Entry); RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE); return FALSE;
} }
wcsncpy(Entry->TargetFilename, TargetFilename, Length); wcsncpy(Entry->TargetFilename, TargetFilename, Length);
Entry->TargetFilename[Length] = (WCHAR)0; Entry->TargetFilename[Length] = (WCHAR)0;
} }
@ -304,14 +320,17 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
QueueHeader->CopyTail->Next = Entry; QueueHeader->CopyTail->Next = Entry;
QueueHeader->CopyTail = Entry; QueueHeader->CopyTail = Entry;
} }
QueueHeader->CopyCount++; QueueHeader->CopyCount++;
return(TRUE); return TRUE;
} }
BOOL WINAPI BOOL
SetupCommitFileQueueW(HWND Owner, WINAPI
SetupCommitFileQueueW(
HWND Owner,
HSPFILEQ QueueHandle, HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler, PSP_FILE_CALLBACK_W MsgHandler,
PVOID Context) PVOID Context)
@ -329,7 +348,7 @@ SetupCommitFileQueueW(HWND Owner,
TargetPath = ((PCOPYCONTEXT)Context)->InstallPath; TargetPath = ((PCOPYCONTEXT)Context)->InstallPath;
if (QueueHandle == NULL) if (QueueHandle == NULL)
return(FALSE); return FALSE;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
@ -367,6 +386,7 @@ SetupCommitFileQueueW(HWND Owner,
wcscat(FileDstPath, L"\\"); wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, TargetPath); wcscat(FileDstPath, TargetPath);
} }
wcscat(FileDstPath, L"\\"); wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, Entry->TargetDirectory); wcscat(FileDstPath, Entry->TargetDirectory);
} }
@ -382,9 +402,7 @@ SetupCommitFileQueueW(HWND Owner,
} }
/* FIXME: Do it! */ /* FIXME: Do it! */
DPRINT("'%S' ==> '%S'\n", DPRINT("'%S' ==> '%S'\n", FileSrcPath, FileDstPath);
FileSrcPath,
FileDstPath);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTCOPY, SPFILENOTIFY_STARTCOPY,
@ -406,13 +424,13 @@ SetupCommitFileQueueW(HWND Owner,
/* Copy the file */ /* Copy the file */
Status = SetupCopyFile(FileSrcPath, FileDstPath); Status = SetupCopyFile(FileSrcPath, FileDstPath);
} }
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_COPYERROR, SPFILENOTIFY_COPYERROR,
(UINT_PTR)Entry->SourceFilename, (UINT_PTR)Entry->SourceFilename,
FILEOP_COPY); FILEOP_COPY);
} }
else else
{ {
@ -435,7 +453,7 @@ SetupCommitFileQueueW(HWND Owner,
0, 0,
0); 0);
return(TRUE); return TRUE;
} }
/* EOF */ /* EOF */

View file

@ -51,7 +51,8 @@
typedef PVOID HSPFILEQ; typedef PVOID HSPFILEQ;
typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(PVOID Context, typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(
PVOID Context,
UINT Notification, UINT Notification,
UINT_PTR Param1, UINT_PTR Param1,
UINT_PTR Param2); UINT_PTR Param2);
@ -68,14 +69,17 @@ typedef struct _COPYCONTEXT
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ WINAPI HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID); SetupOpenFileQueue(VOID);
VOID WINAPI VOID
WINAPI
SetupCloseFileQueue( SetupCloseFileQueue(
IN HSPFILEQ QueueHandle); IN HSPFILEQ QueueHandle);
BOOL WINAPI BOOL
WINAPI
SetupQueueCopyWNew( SetupQueueCopyWNew(
IN HSPFILEQ QueueHandle, IN HSPFILEQ QueueHandle,
IN PCWSTR SourceRootPath, IN PCWSTR SourceRootPath,
@ -88,7 +92,8 @@ SetupQueueCopyWNew(
IN DWORD CopyStyle); IN DWORD CopyStyle);
BOOL BOOL
SetupQueueCopy(HSPFILEQ QueueHandle, SetupQueueCopy(
HSPFILEQ QueueHandle,
PCWSTR SourceCabinet, PCWSTR SourceCabinet,
PCWSTR SourceRootPath, PCWSTR SourceRootPath,
PCWSTR SourcePath, PCWSTR SourcePath,
@ -96,8 +101,10 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
PCWSTR TargetDirectory, PCWSTR TargetDirectory,
PCWSTR TargetFilename); PCWSTR TargetFilename);
BOOL WINAPI BOOL
SetupCommitFileQueueW(HWND Owner, WINAPI
SetupCommitFileQueueW(
HWND Owner,
HSPFILEQ QueueHandle, HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler, PSP_FILE_CALLBACK_W MsgHandler,
PVOID Context); PVOID Context);

View file

@ -38,7 +38,8 @@ 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;
@ -87,12 +88,13 @@ SetupCreateDirectory(PWCHAR DirectoryName)
RtlFreeUnicodeString(&PathName); RtlFreeUnicodeString(&PathName);
return(Status); return Status;
} }
NTSTATUS NTSTATUS
SetupCopyFile(PWCHAR SourceFileName, SetupCopyFile(
PWCHAR SourceFileName,
PWCHAR DestinationFileName) PWCHAR DestinationFileName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
@ -131,7 +133,13 @@ SetupCopyFile(PWCHAR SourceFileName,
goto done; goto done;
} }
#else #else
FileHandleSource = CreateFileW(SourceFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); FileHandleSource = CreateFileW(SourceFileName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
0,
NULL);
if (FileHandleSource == INVALID_HANDLE_VALUE) if (FileHandleSource == INVALID_HANDLE_VALUE)
{ {
Status = STATUS_UNSUCCESSFUL; Status = STATUS_UNSUCCESSFUL;
@ -149,6 +157,7 @@ SetupCopyFile(PWCHAR SourceFileName,
DPRINT1("NtQueryInformationFile failed: %x\n", Status); DPRINT1("NtQueryInformationFile failed: %x\n", Status);
goto closesrc; goto closesrc;
} }
Status = NtQueryInformationFile(FileHandleSource, Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock,&FileBasic, &IoStatusBlock,&FileBasic,
sizeof(FILE_BASIC_INFORMATION), sizeof(FILE_BASIC_INFORMATION),
@ -233,6 +242,7 @@ SetupCopyFile(PWCHAR SourceFileName,
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 */ /* Copy file date/time from source file */
Status = NtSetInformationFile(FileHandleDest, Status = NtSetInformationFile(FileHandleDest,
&IoStatusBlock, &IoStatusBlock,
@ -251,7 +261,6 @@ SetupCopyFile(PWCHAR SourceFileName,
&FileStandard.EndOfFile, &FileStandard.EndOfFile,
sizeof(FILE_END_OF_FILE_INFORMATION), sizeof(FILE_END_OF_FILE_INFORMATION),
FileEndOfFileInformation); FileEndOfFileInformation);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetInformationFile failed: %x\n", Status); DPRINT1("NtSetInformationFile failed: %x\n", Status);
@ -259,19 +268,24 @@ SetupCopyFile(PWCHAR SourceFileName,
closedest: closedest:
NtClose(FileHandleDest); NtClose(FileHandleDest);
unmapsrcsec: unmapsrcsec:
NtUnmapViewOfSection(NtCurrentProcess(), SourceFileMap); NtUnmapViewOfSection(NtCurrentProcess(), SourceFileMap);
closesrcsec: closesrcsec:
NtClose(SourceFileSection); NtClose(SourceFileSection);
closesrc: closesrc:
NtClose(FileHandleSource); NtClose(FileHandleSource);
done: done:
return(Status); return Status;
} }
#ifdef __REACTOS__ #ifdef __REACTOS__
NTSTATUS NTSTATUS
SetupExtractFile(PWCHAR CabinetFileName, SetupExtractFile(
PWCHAR CabinetFileName,
PWCHAR SourceFileName, PWCHAR SourceFileName,
PWCHAR DestinationPathName) PWCHAR DestinationPathName)
{ {
@ -349,7 +363,8 @@ SetupExtractFile(PWCHAR CabinetFileName,
#endif #endif
BOOLEAN BOOLEAN
DoesFileExist(PWSTR PathName, DoesFileExist(
PWSTR PathName,
PWSTR FileName) PWSTR FileName)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
@ -384,12 +399,12 @@ DoesFileExist(PWSTR PathName,
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 SourceFileName,
PWCHAR DestinationFileName); PWCHAR DestinationFileName);
NTSTATUS NTSTATUS
SetupExtractFile(PWCHAR CabinetFileName, SetupExtractFile(
PWCHAR CabinetFileName,
PWCHAR SourceFileName, PWCHAR SourceFileName,
PWCHAR DestinationFileName); PWCHAR DestinationFileName);
BOOLEAN BOOLEAN
DoesFileExist(PWSTR PathName, DoesFileExist(
PWSTR PathName,
PWSTR FileName); 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

@ -84,7 +84,8 @@ CreateGenericList(VOID)
VOID VOID
DestroyGenericList(PGENERIC_LIST List, DestroyGenericList(
PGENERIC_LIST List,
BOOLEAN FreeUserData) BOOLEAN FreeUserData)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
@ -110,7 +111,8 @@ DestroyGenericList(PGENERIC_LIST List,
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(
PGENERIC_LIST List,
PCHAR Text, PCHAR Text,
PVOID UserData, PVOID UserData,
BOOLEAN Current) BOOLEAN Current)
@ -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,8 +340,10 @@ DrawScrollBarGenericList(PGENERIC_LIST GenericList)
} }
} }
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(
PGENERIC_LIST List,
SHORT Left, SHORT Left,
SHORT Top, SHORT Top,
SHORT Right, SHORT Right,
@ -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(
PGENERIC_LIST List,
BOOLEAN FreeUserData); BOOLEAN FreeUserData);
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(
PGENERIC_LIST List,
PCHAR Text, PCHAR Text,
PVOID UserData, PVOID UserData,
BOOLEAN Current); BOOLEAN Current);
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(
PGENERIC_LIST List,
SHORT Left, SHORT Left,
SHORT Top, SHORT Top,
SHORT Right, SHORT Right,
SHORT Bottom); 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,12 +15,10 @@
#endif #endif
BOOLEAN BOOLEAN
HOST_InitConsole( HOST_InitConsole(VOID);
VOID);
BOOLEAN BOOLEAN
HOST_InitMemory( HOST_InitMemory(VOID);
VOID);
BOOLEAN BOOLEAN
HOST_CreateFileSystemList( HOST_CreateFileSystemList(

View file

@ -35,7 +35,8 @@
#ifdef __REACTOS__ #ifdef __REACTOS__
BOOL WINAPI BOOL
WINAPI
InfpFindFirstLineW( InfpFindFirstLineW(
IN HINF InfHandle, IN HINF InfHandle,
IN PCWSTR Section, IN PCWSTR Section,
@ -54,7 +55,9 @@ InfpFindFirstLineW(
return TRUE; return TRUE;
} }
HINF WINAPI
HINF
WINAPI
InfpOpenInfFileW( InfpOpenInfFileW(
IN PCWSTR FileName, IN PCWSTR FileName,
IN PCWSTR InfClass, IN PCWSTR InfClass,
@ -68,8 +71,7 @@ InfpOpenInfFileW(
NTSTATUS Status; NTSTATUS Status;
RtlInitUnicodeString(&FileNameU, FileName); RtlInitUnicodeString(&FileNameU, FileName);
Status = InfOpenFile( Status = InfOpenFile(&hInf,
&hInf,
&FileNameU, &FileNameU,
LANGIDFROMLCID(LocaleId), LANGIDFROMLCID(LocaleId),
&ErrorLineUL); &ErrorLineUL);
@ -79,9 +81,9 @@ InfpOpenInfFileW(
return hInf; return hInf;
} }
#endif /* __REACTOS__ */ #endif /* __REACTOS__ */
BOOLEAN BOOLEAN
INF_GetData( INF_GetData(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,
@ -98,26 +100,28 @@ INF_GetData(
currentIndex ^= 2; currentIndex ^= 2;
if (Key) *Key = NULL; if (Key)
if (Data) *Data = NULL; *Key = NULL;
if (Data)
*Data = NULL;
if (SetupGetFieldCount(Context) != 1) if (SetupGetFieldCount(Context) != 1)
return FALSE; return FALSE;
for (i = 0; i <= 1; i++) for (i = 0; i <= 1; i++)
{ {
ret = SetupGetStringFieldW( ret = SetupGetStringFieldW(Context,
Context,
i, i,
NULL, NULL,
0, 0,
&dwSize); &dwSize);
if (!ret) if (!ret)
return FALSE; return FALSE;
HeapFree(GetProcessHeap(), 0, pLastCallData[i + currentIndex]); HeapFree(GetProcessHeap(), 0, pLastCallData[i + currentIndex]);
pLastCallData[i + currentIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); pLastCallData[i + currentIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
ret = SetupGetStringFieldW( ret = SetupGetStringFieldW(Context,
Context,
i, i,
pLastCallData[i + currentIndex], pLastCallData[i + currentIndex],
dwSize, dwSize,
@ -128,12 +132,15 @@ INF_GetData(
if (Key) if (Key)
*Key = pLastCallData[0 + currentIndex]; *Key = pLastCallData[0 + currentIndex];
if (Data) if (Data)
*Data = pLastCallData[1 + currentIndex]; *Data = pLastCallData[1 + currentIndex];
return TRUE; return TRUE;
#endif /* !__REACTOS__ */ #endif /* !__REACTOS__ */
} }
BOOLEAN BOOLEAN
INF_GetDataField( INF_GetDataField(
IN PINFCONTEXT Context, IN PINFCONTEXT Context,
@ -150,18 +157,17 @@ INF_GetDataField(
*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]); HeapFree(GetProcessHeap(), 0, pLastCallsData[NextIndex]);
pLastCallsData[NextIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); pLastCallsData[NextIndex] = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
ret = SetupGetStringFieldW( ret = SetupGetStringFieldW(Context,
Context,
FieldIndex, FieldIndex,
pLastCallsData[NextIndex], pLastCallsData[NextIndex],
dwSize, dwSize,
@ -175,6 +181,7 @@ INF_GetDataField(
#endif /* !__REACTOS__ */ #endif /* !__REACTOS__ */
} }
HINF WINAPI HINF WINAPI
INF_OpenBufferedFileA( INF_OpenBufferedFileA(
IN PSTR FileBuffer, IN PSTR FileBuffer,
@ -189,8 +196,7 @@ INF_OpenBufferedFileA(
ULONG ErrorLineUL; ULONG ErrorLineUL;
NTSTATUS Status; NTSTATUS Status;
Status = InfOpenBufferedFile( Status = InfOpenBufferedFile(&hInf,
&hInf,
FileBuffer, FileBuffer,
FileSize, FileSize,
LANGIDFROMLCID(LocaleId), LANGIDFROMLCID(LocaleId),

View file

@ -50,14 +50,16 @@ typedef struct _INFCONTEXT
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,

View file

@ -34,49 +34,47 @@
/* PRIVATE FUNCTIONS ********************************************************/ /* PRIVATE FUNCTIONS ********************************************************/
static PINICACHEKEY static
IniCacheFreeKey(PINICACHEKEY Key) PINICACHEKEY
IniCacheFreeKey(
PINICACHEKEY Key)
{ {
PINICACHEKEY Next; PINICACHEKEY Next;
if (Key == NULL) if (Key == NULL)
{ {
return(NULL); return NULL;
} }
Next = Key->Next; Next = Key->Next;
if (Key->Name != NULL) if (Key->Name != NULL)
{ {
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key->Name);
0,
Key->Name);
Key->Name = NULL; Key->Name = NULL;
} }
if (Key->Data != NULL) if (Key->Data != NULL)
{ {
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key->Data);
0,
Key->Data);
Key->Data = NULL; Key->Data = NULL;
} }
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key);
0,
Key);
return(Next); return Next;
} }
static PINICACHESECTION static
IniCacheFreeSection(PINICACHESECTION Section) PINICACHESECTION
IniCacheFreeSection(
PINICACHESECTION Section)
{ {
PINICACHESECTION Next; PINICACHESECTION Next;
if (Section == NULL) if (Section == NULL)
{ {
return(NULL); return NULL;
} }
Next = Section->Next; Next = Section->Next;
@ -88,22 +86,20 @@ IniCacheFreeSection(PINICACHESECTION Section)
if (Section->Name != NULL) if (Section->Name != NULL)
{ {
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Section->Name);
0,
Section->Name);
Section->Name = NULL; Section->Name = NULL;
} }
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Section);
0,
Section);
return(Next); return Next;
} }
static PINICACHEKEY static
IniCacheFindKey(PINICACHESECTION Section, PINICACHEKEY
IniCacheFindKey(
PINICACHESECTION Section,
PWCHAR Name, PWCHAR Name,
ULONG NameLength) ULONG NameLength)
{ {
@ -121,12 +117,14 @@ IniCacheFindKey(PINICACHESECTION Section,
Key = Key->Next; Key = Key->Next;
} }
return(Key); return Key;
} }
static PINICACHEKEY static
IniCacheAddKey(PINICACHESECTION Section, PINICACHEKEY
IniCacheAddKey(
PINICACHESECTION Section,
PCHAR Name, PCHAR Name,
ULONG NameLength, ULONG NameLength,
PCHAR Data, PCHAR Data,
@ -144,7 +142,7 @@ IniCacheAddKey(PINICACHESECTION Section,
DataLength == 0) DataLength == 0)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap, Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
@ -153,23 +151,20 @@ IniCacheAddKey(PINICACHESECTION Section,
if (Key == NULL) if (Key == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
RtlZeroMemory(Key, RtlZeroMemory(Key,
sizeof(INICACHEKEY)); sizeof(INICACHEKEY));
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
(NameLength + 1) * sizeof(WCHAR)); (NameLength + 1) * sizeof(WCHAR));
if (Key->Name == NULL) if (Key->Name == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key);
0, return NULL;
Key);
return(NULL);
} }
/* Copy value name */ /* Copy value name */
@ -179,20 +174,15 @@ IniCacheAddKey(PINICACHESECTION Section,
} }
Key->Name[NameLength] = 0; Key->Name[NameLength] = 0;
Key->Data = (WCHAR*)RtlAllocateHeap(ProcessHeap, Key->Data = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
(DataLength + 1) * sizeof(WCHAR)); (DataLength + 1) * sizeof(WCHAR));
if (Key->Data == NULL) if (Key->Data == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key->Name);
0, RtlFreeHeap(ProcessHeap, 0, Key);
Key->Name); return NULL;
RtlFreeHeap(ProcessHeap,
0,
Key);
return(NULL);
} }
/* Copy value data */ /* Copy value data */
@ -215,12 +205,15 @@ IniCacheAddKey(PINICACHESECTION Section,
Section->LastKey = Key; Section->LastKey = Key;
} }
return(Key); return Key;
} }
#if 0 #if 0
static PINICACHESECTION static
IniCacheFindSection(PINICACHE Cache, PINICACHESECTION
IniCacheFindSection(
PINICACHE Cache,
PWCHAR Name, PWCHAR Name,
ULONG NameLength) ULONG NameLength)
{ {
@ -228,7 +221,7 @@ IniCacheFindSection(PINICACHE Cache,
if (Cache == NULL || Name == NULL || NameLength == 0) if (Cache == NULL || Name == NULL || NameLength == 0)
{ {
return(NULL); return NULL;
} }
Section = Cache->FirstSection; Section = Cache->FirstSection;
@ -247,12 +240,15 @@ IniCacheFindSection(PINICACHE Cache,
Section = Section->Next; Section = Section->Next;
} }
return(Section); return Section;
} }
#endif #endif
static PINICACHESECTION
IniCacheAddSection(PINICACHE Cache, static
PINICACHESECTION
IniCacheAddSection(
PINICACHE Cache,
PCHAR Name, PCHAR Name,
ULONG NameLength) ULONG NameLength)
{ {
@ -262,7 +258,7 @@ IniCacheAddSection(PINICACHE Cache,
if (Cache == NULL || Name == NULL || NameLength == 0) if (Cache == NULL || Name == NULL || NameLength == 0)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap, Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
@ -271,10 +267,10 @@ IniCacheAddSection(PINICACHE Cache,
if (Section == NULL) if (Section == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
RtlZeroMemory(Section,
sizeof(INICACHESECTION)); RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */ /* Allocate and initialize section name */
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
@ -283,10 +279,8 @@ IniCacheAddSection(PINICACHE Cache,
if (Section->Name == NULL) if (Section->Name == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Section);
0, return NULL;
Section);
return(NULL);
} }
/* Copy section name */ /* Copy section name */
@ -309,22 +303,26 @@ IniCacheAddSection(PINICACHE Cache,
Cache->LastSection = Section; Cache->LastSection = Section;
} }
return(Section); return Section;
} }
static PCHAR static
IniCacheSkipWhitespace(PCHAR Ptr) PCHAR
IniCacheSkipWhitespace(
PCHAR Ptr)
{ {
while (*Ptr != 0 && isspace(*Ptr)) while (*Ptr != 0 && isspace(*Ptr))
Ptr++; Ptr++;
return((*Ptr == 0) ? NULL : Ptr); return (*Ptr == 0) ? NULL : Ptr;
} }
static PCHAR static
IniCacheSkipToNextSection(PCHAR Ptr) PCHAR
IniCacheSkipToNextSection(
PCHAR Ptr)
{ {
while (*Ptr != 0 && *Ptr != '[') while (*Ptr != 0 && *Ptr != '[')
{ {
@ -332,15 +330,18 @@ IniCacheSkipToNextSection(PCHAR Ptr)
{ {
Ptr++; Ptr++;
} }
Ptr++; Ptr++;
} }
return((*Ptr == 0) ? NULL : Ptr); return (*Ptr == 0) ? NULL : Ptr;
} }
static PCHAR static
IniCacheGetSectionName(PCHAR Ptr, PCHAR
IniCacheGetSectionName(
PCHAR Ptr,
PCHAR *NamePtr, PCHAR *NamePtr,
PULONG NameSize) PULONG NameSize)
{ {
@ -363,7 +364,6 @@ IniCacheGetSectionName(PCHAR Ptr,
Size++; Size++;
Ptr++; Ptr++;
} }
Ptr++; Ptr++;
while (*Ptr != 0 && *Ptr != L'\n') while (*Ptr != 0 && *Ptr != L'\n')
@ -379,12 +379,14 @@ IniCacheGetSectionName(PCHAR Ptr,
DPRINT("SectionName: '%s'\n", Name); DPRINT("SectionName: '%s'\n", Name);
return(Ptr); return Ptr;
} }
static PCHAR static
IniCacheGetKeyName(PCHAR Ptr, PCHAR
IniCacheGetKeyName(
PCHAR Ptr,
PCHAR *NamePtr, PCHAR *NamePtr,
PULONG NameSize) PULONG NameSize)
{ {
@ -430,12 +432,14 @@ IniCacheGetKeyName(PCHAR Ptr,
} }
} }
return(Ptr); return Ptr;
} }
static PCHAR static
IniCacheGetKeyValue(PCHAR Ptr, PCHAR
IniCacheGetKeyValue(
PCHAR Ptr,
PCHAR *DataPtr, PCHAR *DataPtr,
PULONG DataSize, PULONG DataSize,
BOOLEAN String) BOOLEAN String)
@ -454,7 +458,7 @@ IniCacheGetKeyValue(PCHAR Ptr,
/* Check and skip '=' */ /* Check and skip '=' */
if (*Ptr != '=') if (*Ptr != '=')
{ {
return(NULL); return NULL;
} }
Ptr++; Ptr++;
@ -476,6 +480,7 @@ IniCacheGetKeyValue(PCHAR Ptr,
Size++; Size++;
} }
Ptr++; Ptr++;
while (*Ptr && *Ptr != '\r' && *Ptr != '\n') while (*Ptr && *Ptr != '\r' && *Ptr != '\n')
{ {
Ptr++; Ptr++;
@ -500,16 +505,15 @@ IniCacheGetKeyValue(PCHAR Ptr,
*DataSize = Size; *DataSize = Size;
return(Ptr); return Ptr;
} }
/* PUBLIC FUNCTIONS *********************************************************/ /* PUBLIC FUNCTIONS *********************************************************/
NTSTATUS NTSTATUS
IniCacheLoad(PINICACHE *Cache, IniCacheLoad(
PINICACHE *Cache,
PUNICODE_STRING FileName, PUNICODE_STRING FileName,
BOOLEAN String) BOOLEAN String)
{ {
@ -553,7 +557,7 @@ IniCacheLoad(PINICACHE *Cache,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("NtOpenFile() failed (Status %lx)\n", Status); DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
return(Status); return Status;
} }
DPRINT("NtOpenFile() successful\n"); DPRINT("NtOpenFile() successful\n");
@ -568,7 +572,7 @@ IniCacheLoad(PINICACHE *Cache,
{ {
DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status); DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
NtClose(FileHandle); NtClose(FileHandle);
return(Status); return Status;
} }
FileLength = FileInfo.EndOfFile.u.LowPart; FileLength = FileInfo.EndOfFile.u.LowPart;
@ -583,7 +587,7 @@ IniCacheLoad(PINICACHE *Cache,
{ {
DPRINT1("RtlAllocateHeap() failed\n"); DPRINT1("RtlAllocateHeap() failed\n");
NtClose(FileHandle); NtClose(FileHandle);
return(STATUS_INSUFFICIENT_RESOURCES); return STATUS_INSUFFICIENT_RESOURCES;
} }
/* Read file */ /* Read file */
@ -606,13 +610,10 @@ IniCacheLoad(PINICACHE *Cache,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("NtReadFile() failed (Status %lx)\n", Status); DPRINT("NtReadFile() failed (Status %lx)\n", Status);
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, FileBuffer);
0, return Status;
FileBuffer);
return(Status);
} }
/* Allocate inicache header */ /* Allocate inicache header */
*Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap, *Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
0, 0,
@ -620,12 +621,11 @@ IniCacheLoad(PINICACHE *Cache,
if (*Cache == NULL) if (*Cache == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(STATUS_INSUFFICIENT_RESOURCES); return STATUS_INSUFFICIENT_RESOURCES;
} }
/* Initialize inicache header */ /* Initialize inicache header */
RtlZeroMemory(*Cache, RtlZeroMemory(*Cache, sizeof(INICACHE));
sizeof(INICACHE));
/* Parse ini file */ /* Parse ini file */
Section = NULL; Section = NULL;
@ -689,16 +689,15 @@ IniCacheLoad(PINICACHE *Cache,
} }
/* Free file buffer */ /* Free file buffer */
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, FileBuffer);
0,
FileBuffer);
return(Status); return Status;
} }
VOID VOID
IniCacheDestroy(PINICACHE Cache) IniCacheDestroy(
PINICACHE Cache)
{ {
if (Cache == NULL) if (Cache == NULL)
{ {
@ -711,14 +710,13 @@ IniCacheDestroy(PINICACHE Cache)
} }
Cache->LastSection = NULL; Cache->LastSection = NULL;
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Cache);
0,
Cache);
} }
PINICACHESECTION PINICACHESECTION
IniCacheGetSection(PINICACHE Cache, IniCacheGetSection(
PINICACHE Cache,
PWCHAR Name) PWCHAR Name)
{ {
PINICACHESECTION Section = NULL; PINICACHESECTION Section = NULL;
@ -726,7 +724,7 @@ IniCacheGetSection(PINICACHE Cache,
if (Cache == NULL || Name == NULL) if (Cache == NULL || Name == NULL)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
/* Iterate through list of sections */ /* Iterate through list of sections */
@ -737,7 +735,7 @@ IniCacheGetSection(PINICACHE Cache,
/* Are the section names the same? */ /* Are the section names the same? */
if (_wcsicmp(Section->Name, Name) == 0) if (_wcsicmp(Section->Name, Name) == 0)
return(Section); return Section;
/* Get the next section */ /* Get the next section */
Section = Section->Next; Section = Section->Next;
@ -745,12 +743,13 @@ IniCacheGetSection(PINICACHE Cache,
DPRINT("Section not found\n"); DPRINT("Section not found\n");
return(NULL); return NULL;
} }
NTSTATUS NTSTATUS
IniCacheGetKey(PINICACHESECTION Section, IniCacheGetKey(
PINICACHESECTION Section,
PWCHAR KeyName, PWCHAR KeyName,
PWCHAR *KeyData) PWCHAR *KeyData)
{ {
@ -759,7 +758,7 @@ IniCacheGetKey(PINICACHESECTION Section,
if (Section == NULL || KeyName == NULL || KeyData == NULL) if (Section == NULL || KeyName == NULL || KeyData == NULL)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(STATUS_INVALID_PARAMETER); return STATUS_INVALID_PARAMETER;
} }
*KeyData = NULL; *KeyData = NULL;
@ -767,17 +766,18 @@ IniCacheGetKey(PINICACHESECTION Section,
Key = IniCacheFindKey(Section, KeyName, wcslen(KeyName)); Key = IniCacheFindKey(Section, KeyName, wcslen(KeyName));
if (Key == NULL) if (Key == NULL)
{ {
return(STATUS_INVALID_PARAMETER); return STATUS_INVALID_PARAMETER;
} }
*KeyData = Key->Data; *KeyData = Key->Data;
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
PINICACHEITERATOR PINICACHEITERATOR
IniCacheFindFirstValue(PINICACHESECTION Section, IniCacheFindFirstValue(
PINICACHESECTION Section,
PWCHAR *KeyName, PWCHAR *KeyName,
PWCHAR *KeyData) PWCHAR *KeyData)
{ {
@ -787,14 +787,14 @@ IniCacheFindFirstValue(PINICACHESECTION Section,
if (Section == NULL || KeyName == NULL || KeyData == NULL) if (Section == NULL || KeyName == NULL || KeyData == NULL)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
Key = Section->FirstKey; Key = Section->FirstKey;
if (Key == NULL) if (Key == NULL)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
*KeyName = Key->Name; *KeyName = Key->Name;
@ -806,18 +806,19 @@ IniCacheFindFirstValue(PINICACHESECTION Section,
if (Iterator == NULL) if (Iterator == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
Iterator->Section = Section; Iterator->Section = Section;
Iterator->Key = Key; Iterator->Key = Key;
return(Iterator); return Iterator;
} }
BOOLEAN BOOLEAN
IniCacheFindNextValue(PINICACHEITERATOR Iterator, IniCacheFindNextValue(
PINICACHEITERATOR Iterator,
PWCHAR *KeyName, PWCHAR *KeyName,
PWCHAR *KeyData) PWCHAR *KeyData)
{ {
@ -826,14 +827,14 @@ IniCacheFindNextValue(PINICACHEITERATOR Iterator,
if (Iterator == NULL || KeyName == NULL || KeyData == NULL) if (Iterator == NULL || KeyName == NULL || KeyData == NULL)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(FALSE); return FALSE;
} }
Key = Iterator->Key->Next; Key = Iterator->Key->Next;
if (Key == NULL) if (Key == NULL)
{ {
DPRINT("No more entries\n"); DPRINT("No more entries\n");
return(FALSE); return FALSE;
} }
*KeyName = Key->Name; *KeyName = Key->Name;
@ -841,24 +842,24 @@ IniCacheFindNextValue(PINICACHEITERATOR Iterator,
Iterator->Key = Key; Iterator->Key = Key;
return(TRUE); return TRUE;
} }
VOID VOID
IniCacheFindClose(PINICACHEITERATOR Iterator) IniCacheFindClose(
PINICACHEITERATOR Iterator)
{ {
if (Iterator == NULL) if (Iterator == NULL)
return; return;
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Iterator);
0,
Iterator);
} }
PINICACHEKEY PINICACHEKEY
IniCacheInsertKey(PINICACHESECTION Section, IniCacheInsertKey(
PINICACHESECTION Section,
PINICACHEKEY AnchorKey, PINICACHEKEY AnchorKey,
INSERTATION_TYPE InsertationType, INSERTATION_TYPE InsertationType,
PWCHAR Name, PWCHAR Name,
@ -875,7 +876,7 @@ IniCacheInsertKey(PINICACHESECTION Section,
*Data == 0) *Data == 0)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
/* Allocate key buffer */ /* Allocate key buffer */
@ -885,10 +886,10 @@ IniCacheInsertKey(PINICACHESECTION Section,
if (Key == NULL) if (Key == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
RtlZeroMemory(Key,
sizeof(INICACHEKEY)); RtlZeroMemory(Key, sizeof(INICACHEKEY));
/* Allocate name buffer */ /* Allocate name buffer */
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
@ -897,10 +898,8 @@ IniCacheInsertKey(PINICACHESECTION Section,
if (Key->Name == NULL) if (Key->Name == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key);
0, return NULL;
Key);
return(NULL);
} }
/* Copy value name */ /* Copy value name */
@ -913,13 +912,9 @@ IniCacheInsertKey(PINICACHESECTION Section,
if (Key->Data == NULL) if (Key->Data == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Key->Name);
0, RtlFreeHeap(ProcessHeap, 0, Key);
Key->Name); return NULL;
RtlFreeHeap(ProcessHeap,
0,
Key);
return(NULL);
} }
/* Copy value data */ /* Copy value data */
@ -956,14 +951,14 @@ IniCacheInsertKey(PINICACHESECTION Section,
} }
else if ((InsertationType == INSERT_AFTER) && (AnchorKey != NULL)) else if ((InsertationType == INSERT_AFTER) && (AnchorKey != NULL))
{ {
/* Insert before the anchor key */ /* Insert after the anchor key */
Key->Next = AnchorKey->Next; Key->Next = AnchorKey->Next;
Key->Prev = AnchorKey; Key->Prev = AnchorKey;
AnchorKey->Next->Prev = Key; AnchorKey->Next->Prev = Key;
AnchorKey->Next = Key; AnchorKey->Next = Key;
} }
return(Key); return Key;
} }
@ -979,19 +974,19 @@ IniCacheCreate(VOID)
if (Cache == NULL) if (Cache == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
/* Initialize inicache header */ /* Initialize inicache header */
RtlZeroMemory(Cache, RtlZeroMemory(Cache, sizeof(INICACHE));
sizeof(INICACHE));
return(Cache); return Cache;
} }
NTSTATUS NTSTATUS
IniCacheSave(PINICACHE Cache, IniCacheSave(
PINICACHE Cache,
PWCHAR FileName) PWCHAR FileName)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
@ -1041,8 +1036,9 @@ IniCacheSave(PINICACHE Cache,
if (Buffer == NULL) if (Buffer == NULL)
{ {
DPRINT1("RtlAllocateHeap() failed\n"); DPRINT1("RtlAllocateHeap() failed\n");
return(STATUS_INSUFFICIENT_RESOURCES); return STATUS_INSUFFICIENT_RESOURCES;
} }
RtlZeroMemory(Buffer, BufferSize); RtlZeroMemory(Buffer, BufferSize);
/* Fill file buffer */ /* Fill file buffer */
@ -1093,10 +1089,8 @@ IniCacheSave(PINICACHE Cache,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("NtCreateFile() failed (Status %lx)\n", Status); DPRINT("NtCreateFile() failed (Status %lx)\n", Status);
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Buffer);
0, return Status;
Buffer);
return(Status);
} }
Offset.QuadPart = 0LL; Offset.QuadPart = 0LL;
@ -1113,24 +1107,21 @@ IniCacheSave(PINICACHE Cache,
{ {
DPRINT("NtWriteFile() failed (Status %lx)\n", Status); DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
NtClose(FileHandle); NtClose(FileHandle);
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Buffer);
0, return Status;
Buffer);
return(Status);
} }
NtClose(FileHandle); NtClose(FileHandle);
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Buffer);
0,
Buffer);
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
PINICACHESECTION PINICACHESECTION
IniCacheAppendSection(PINICACHE Cache, IniCacheAppendSection(
PINICACHE Cache,
PWCHAR Name) PWCHAR Name)
{ {
PINICACHESECTION Section = NULL; PINICACHESECTION Section = NULL;
@ -1138,7 +1129,7 @@ IniCacheAppendSection(PINICACHE Cache,
if (Cache == NULL || Name == NULL || *Name == 0) if (Cache == NULL || Name == NULL || *Name == 0)
{ {
DPRINT("Invalid parameter\n"); DPRINT("Invalid parameter\n");
return(NULL); return NULL;
} }
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap, Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
@ -1147,10 +1138,10 @@ IniCacheAppendSection(PINICACHE Cache,
if (Section == NULL) if (Section == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
return(NULL); return NULL;
} }
RtlZeroMemory(Section,
sizeof(INICACHESECTION)); RtlZeroMemory(Section, sizeof(INICACHESECTION));
/* Allocate and initialize section name */ /* Allocate and initialize section name */
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap, Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
@ -1159,10 +1150,8 @@ IniCacheAppendSection(PINICACHE Cache,
if (Section->Name == NULL) if (Section->Name == NULL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap, 0, Section);
0, return NULL;
Section);
return(NULL);
} }
/* Copy section name */ /* Copy section name */
@ -1181,7 +1170,7 @@ IniCacheAppendSection(PINICACHE Cache,
Cache->LastSection = Section; Cache->LastSection = Section;
} }
return(Section); return Section;
} }
/* EOF */ /* EOF */

View file

@ -74,40 +74,46 @@ typedef enum
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
NTSTATUS NTSTATUS
IniCacheLoad(PINICACHE *Cache, IniCacheLoad(
PINICACHE *Cache,
PUNICODE_STRING FileName, PUNICODE_STRING FileName,
BOOLEAN String); BOOLEAN String);
VOID VOID
IniCacheDestroy(PINICACHE Cache); IniCacheDestroy(
PINICACHE Cache);
PINICACHESECTION PINICACHESECTION
IniCacheGetSection(PINICACHE Cache, IniCacheGetSection(
PINICACHE Cache,
PWCHAR Name); PWCHAR Name);
NTSTATUS NTSTATUS
IniCacheGetKey(PINICACHESECTION Section, IniCacheGetKey(
PINICACHESECTION Section,
PWCHAR KeyName, PWCHAR KeyName,
PWCHAR *KeyData); PWCHAR *KeyData);
PINICACHEITERATOR PINICACHEITERATOR
IniCacheFindFirstValue(PINICACHESECTION Section, IniCacheFindFirstValue(
PINICACHESECTION Section,
PWCHAR *KeyName, PWCHAR *KeyName,
PWCHAR *KeyData); PWCHAR *KeyData);
BOOLEAN BOOLEAN
IniCacheFindNextValue(PINICACHEITERATOR Iterator, IniCacheFindNextValue(
PINICACHEITERATOR Iterator,
PWCHAR *KeyName, PWCHAR *KeyName,
PWCHAR *KeyData); PWCHAR *KeyData);
VOID VOID
IniCacheFindClose(PINICACHEITERATOR Iterator); IniCacheFindClose(
PINICACHEITERATOR Iterator);
PINICACHEKEY PINICACHEKEY
IniCacheInsertKey(PINICACHESECTION Section, IniCacheInsertKey(
PINICACHESECTION Section,
PINICACHEKEY AnchorKey, PINICACHEKEY AnchorKey,
INSERTATION_TYPE InsertationType, INSERTATION_TYPE InsertationType,
PWCHAR Name, PWCHAR Name,
@ -117,11 +123,13 @@ PINICACHE
IniCacheCreate(VOID); IniCacheCreate(VOID);
NTSTATUS NTSTATUS
IniCacheSave(PINICACHE Cache, IniCacheSave(
PINICACHE Cache,
PWCHAR FileName); PWCHAR FileName);
PINICACHESECTION PINICACHESECTION
IniCacheAppendSection(PINICACHE Cache, IniCacheAppendSection(
PINICACHE Cache,
PWCHAR Name); 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;
@ -256,8 +274,13 @@ MUIGetString(ULONG Number)
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