[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
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,8 +1275,10 @@ InstallMbrBootCodeToDisk(
return Status;
}
NTSTATUS
InstallFat12BootCodeToFloppy(PWSTR SrcPath,
InstallFat12BootCodeToFloppy(
PWSTR SrcPath,
PWSTR RootPath)
{
OBJECT_ATTRIBUTES ObjectAttributes;
@ -1329,7 +1331,6 @@ InstallFat12BootCodeToFloppy(PWSTR SrcPath,
return Status;
}
/* Allocate buffer for new bootsector */
NewBootSector = RtlAllocateHeap(ProcessHeap,
0,
@ -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,

View file

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

View file

@ -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,

View file

@ -34,7 +34,8 @@
/* FUNCTIONS ****************************************************************/
NTSTATUS
GetSourcePaths(PUNICODE_STRING SourcePath,
GetSourcePaths(
PUNICODE_STRING SourcePath,
PUNICODE_STRING SourceRootPath,
PUNICODE_STRING SourceRootDir)
{
@ -60,7 +61,7 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
return(Status);
return Status;
SourceName.Length = 0;
SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
@ -92,8 +93,7 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
NtClose(Handle);
return(STATUS_SUCCESS);
return STATUS_SUCCESS;
}
/* EOF */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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,

View file

@ -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)

View file

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

View file

@ -35,68 +35,90 @@ PGENERIC_LIST
CreateGenericList(VOID);
VOID
DestroyGenericList(PGENERIC_LIST List,
DestroyGenericList(
PGENERIC_LIST List,
BOOLEAN FreeUserData);
BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List,
AppendGenericListEntry(
PGENERIC_LIST List,
PCHAR Text,
PVOID UserData,
BOOLEAN Current);
VOID
DrawGenericList(PGENERIC_LIST List,
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 */

View file

@ -15,12 +15,10 @@
#endif
BOOLEAN
HOST_InitConsole(
VOID);
HOST_InitConsole(VOID);
BOOLEAN
HOST_InitMemory(
VOID);
HOST_InitMemory(VOID);
BOOLEAN
HOST_CreateFileSystemList(

View file

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

View file

@ -50,14 +50,16 @@ typedef struct _INFCONTEXT
PVOID Line;
} INFCONTEXT;
BOOL WINAPI
BOOL
WINAPI
InfpFindFirstLineW(
IN HINF InfHandle,
IN PCWSTR Section,
IN PCWSTR Key,
IN OUT PINFCONTEXT Context);
HINF WINAPI
HINF
WINAPI
InfpOpenInfFileW(
IN PCWSTR FileName,
IN PCWSTR InfClass,

View file

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

View file

@ -74,40 +74,46 @@ typedef enum
/* FUNCTIONS ****************************************************************/
NTSTATUS
IniCacheLoad(PINICACHE *Cache,
IniCacheLoad(
PINICACHE *Cache,
PUNICODE_STRING FileName,
BOOLEAN String);
VOID
IniCacheDestroy(PINICACHE Cache);
IniCacheDestroy(
PINICACHE Cache);
PINICACHESECTION
IniCacheGetSection(PINICACHE Cache,
IniCacheGetSection(
PINICACHE Cache,
PWCHAR Name);
NTSTATUS
IniCacheGetKey(PINICACHESECTION Section,
IniCacheGetKey(
PINICACHESECTION Section,
PWCHAR KeyName,
PWCHAR *KeyData);
PINICACHEITERATOR
IniCacheFindFirstValue(PINICACHESECTION Section,
IniCacheFindFirstValue(
PINICACHESECTION Section,
PWCHAR *KeyName,
PWCHAR *KeyData);
BOOLEAN
IniCacheFindNextValue(PINICACHEITERATOR Iterator,
IniCacheFindNextValue(
PINICACHEITERATOR Iterator,
PWCHAR *KeyName,
PWCHAR *KeyData);
VOID
IniCacheFindClose(PINICACHEITERATOR Iterator);
IniCacheFindClose(
PINICACHEITERATOR Iterator);
PINICACHEKEY
IniCacheInsertKey(PINICACHESECTION Section,
IniCacheInsertKey(
PINICACHESECTION Section,
PINICACHEKEY AnchorKey,
INSERTATION_TYPE InsertationType,
PWCHAR Name,
@ -117,11 +123,13 @@ PINICACHE
IniCacheCreate(VOID);
NTSTATUS
IniCacheSave(PINICACHE Cache,
IniCacheSave(
PINICACHE Cache,
PWCHAR FileName);
PINICACHESECTION
IniCacheAppendSection(PINICACHE Cache,
IniCacheAppendSection(
PINICACHE Cache,
PWCHAR Name);
/* EOF */

View file

@ -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;
@ -256,8 +274,13 @@ MUIGetString(ULONG Number)
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)
{

View file

@ -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