mirror of
https://github.com/reactos/reactos.git
synced 2024-08-21 10:53:15 +00:00
- Use new APIs MmHeapAlloc / MmHeapFree for small and discardable memory allocations (not everywhere yet). There is currently no difference, since they all point to the same old memory allocator.
- Include bget.h to freeldr.h. svn path=/trunk/; revision=31762
This commit is contained in:
parent
ea6661ca60
commit
1449fc2b23
|
@ -131,7 +131,7 @@ BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
|
||||||
//
|
//
|
||||||
// Allocate the memory to hold the boot sector
|
// Allocate the memory to hold the boot sector
|
||||||
//
|
//
|
||||||
FatVolumeBootSector = (PFAT_BOOTSECTOR) MmAllocateMemory(512);
|
FatVolumeBootSector = (PFAT_BOOTSECTOR) MmHeapAlloc(512);
|
||||||
Fat32VolumeBootSector = (PFAT32_BOOTSECTOR) FatVolumeBootSector;
|
Fat32VolumeBootSector = (PFAT32_BOOTSECTOR) FatVolumeBootSector;
|
||||||
FatXVolumeBootSector = (PFATX_BOOTSECTOR) FatVolumeBootSector;
|
FatXVolumeBootSector = (PFATX_BOOTSECTOR) FatVolumeBootSector;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
|
||||||
// If this fails then abort
|
// If this fails then abort
|
||||||
if (!MachDiskReadLogicalSectors(DriveNumber, VolumeStartSector, 1, (PVOID)DISKREADBUFFER))
|
if (!MachDiskReadLogicalSectors(DriveNumber, VolumeStartSector, 1, (PVOID)DISKREADBUFFER))
|
||||||
{
|
{
|
||||||
MmFreeMemory(FatVolumeBootSector);
|
MmHeapFree(FatVolumeBootSector);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
RtlCopyMemory(FatVolumeBootSector, (PVOID)DISKREADBUFFER, 512);
|
RtlCopyMemory(FatVolumeBootSector, (PVOID)DISKREADBUFFER, 512);
|
||||||
|
@ -247,7 +247,7 @@ BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
|
||||||
sprintf(ErrMsg, "Invalid boot sector magic on drive 0x%x (expected 0xaa55 found 0x%x)",
|
sprintf(ErrMsg, "Invalid boot sector magic on drive 0x%x (expected 0xaa55 found 0x%x)",
|
||||||
DriveNumber, FatVolumeBootSector->BootSectorMagic);
|
DriveNumber, FatVolumeBootSector->BootSectorMagic);
|
||||||
FileSystemError(ErrMsg);
|
FileSystemError(ErrMsg);
|
||||||
MmFreeMemory(FatVolumeBootSector);
|
MmHeapFree(FatVolumeBootSector);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
|
||||||
(! ISFATX(FatType) && 64 * 1024 < FatVolumeBootSector->SectorsPerCluster * FatVolumeBootSector->BytesPerSector))
|
(! ISFATX(FatType) && 64 * 1024 < FatVolumeBootSector->SectorsPerCluster * FatVolumeBootSector->BytesPerSector))
|
||||||
{
|
{
|
||||||
FileSystemError("This file system has cluster sizes bigger than 64k.\nFreeLoader does not support this.");
|
FileSystemError("This file system has cluster sizes bigger than 64k.\nFreeLoader does not support this.");
|
||||||
MmFreeMemory(FatVolumeBootSector);
|
MmHeapFree(FatVolumeBootSector);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MmFreeMemory(FatVolumeBootSector);
|
MmHeapFree(FatVolumeBootSector);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the disk cache for this drive
|
// Initialize the disk cache for this drive
|
||||||
|
@ -445,7 +445,7 @@ PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL
|
||||||
// Attempt to allocate memory for directory buffer
|
// Attempt to allocate memory for directory buffer
|
||||||
//
|
//
|
||||||
DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize));
|
DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize));
|
||||||
DirectoryBuffer = MmAllocateMemory(*DirectorySize);
|
DirectoryBuffer = MmHeapAlloc(*DirectorySize);
|
||||||
|
|
||||||
if (DirectoryBuffer == NULL)
|
if (DirectoryBuffer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +459,7 @@ PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL
|
||||||
{
|
{
|
||||||
if (!FatReadVolumeSectors(FatDriveNumber, RootDirSectorStart, RootDirSectors, DirectoryBuffer))
|
if (!FatReadVolumeSectors(FatDriveNumber, RootDirSectorStart, RootDirSectors, DirectoryBuffer))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL
|
||||||
{
|
{
|
||||||
if (!FatReadClusterChain(DirectoryStartCluster, 0xFFFFFFFF, DirectoryBuffer))
|
if (!FatReadClusterChain(DirectoryStartCluster, 0xFFFFFFFF, DirectoryBuffer))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer)
|
||||||
{
|
{
|
||||||
if (!FatXSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo))
|
if (!FatXSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,12 +825,12 @@ BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer)
|
||||||
{
|
{
|
||||||
if (!FatSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo))
|
if (!FatSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we have another sub-directory to go then
|
// If we have another sub-directory to go then
|
||||||
|
@ -839,7 +839,7 @@ BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer)
|
||||||
if ((i+1) < NumberOfPathParts)
|
if ((i+1) < NumberOfPathParts)
|
||||||
{
|
{
|
||||||
DirectoryStartCluster = FatFileInfo.FileFatChain[0];
|
DirectoryStartCluster = FatFileInfo.FileFatChain[0];
|
||||||
MmFreeMemory(FatFileInfo.FileFatChain);
|
MmHeapFree(FatFileInfo.FileFatChain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ FILE* FatOpenFile(PCSTR FileName)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHandle = MmAllocateMemory(sizeof(FAT_FILE_INFO));
|
FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO));
|
||||||
|
|
||||||
if (FileHandle == NULL)
|
if (FileHandle == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1071,7 +1071,7 @@ ULONG* FatGetClusterChainArray(ULONG StartCluster)
|
||||||
//
|
//
|
||||||
// Allocate array memory
|
// Allocate array memory
|
||||||
//
|
//
|
||||||
ArrayPointer = MmAllocateMemory(ArraySize);
|
ArrayPointer = MmHeapAlloc(ArraySize);
|
||||||
|
|
||||||
if (ArrayPointer == NULL)
|
if (ArrayPointer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1104,7 +1104,7 @@ ULONG* FatGetClusterChainArray(ULONG StartCluster)
|
||||||
//
|
//
|
||||||
if (!FatGetFatEntry(StartCluster, &StartCluster))
|
if (!FatGetFatEntry(StartCluster, &StartCluster))
|
||||||
{
|
{
|
||||||
MmFreeMemory(ArrayPointer);
|
MmHeapFree(ArrayPointer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLengt
|
||||||
// Attempt to allocate memory for directory buffer
|
// Attempt to allocate memory for directory buffer
|
||||||
//
|
//
|
||||||
DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength));
|
DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength));
|
||||||
DirectoryBuffer = MmAllocateMemory(DirectoryLength);
|
DirectoryBuffer = MmHeapAlloc(DirectoryLength);
|
||||||
|
|
||||||
if (DirectoryBuffer == NULL)
|
if (DirectoryBuffer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ static PVOID IsoBufferDirectory(ULONG DirectoryStartSector, ULONG DirectoryLengt
|
||||||
{
|
{
|
||||||
if (!MachDiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
|
if (!MachDiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, SECTORSIZE);
|
RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, SECTORSIZE);
|
||||||
|
@ -224,11 +224,11 @@ static BOOLEAN IsoLookupFile(PCSTR FileName, PISO_FILE_INFO IsoFileInfoPointer)
|
||||||
//
|
//
|
||||||
if (!IsoSearchDirectoryBufferForFile(DirectoryBuffer, DirectoryLength, PathPart, &IsoFileInfo))
|
if (!IsoSearchDirectoryBufferForFile(DirectoryBuffer, DirectoryLength, PathPart, &IsoFileInfo))
|
||||||
{
|
{
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MmFreeMemory(DirectoryBuffer);
|
MmHeapFree(DirectoryBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we have another sub-directory to go then
|
// If we have another sub-directory to go then
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include <keycodes.h>
|
#include <keycodes.h>
|
||||||
#include <ver.h>
|
#include <ver.h>
|
||||||
#include <cmdline.h>
|
#include <cmdline.h>
|
||||||
|
#include <bget.h>
|
||||||
/* Needed by boot manager */
|
/* Needed by boot manager */
|
||||||
#include <bootmgr.h>
|
#include <bootmgr.h>
|
||||||
#include <oslist.h>
|
#include <oslist.h>
|
||||||
|
|
|
@ -159,7 +159,7 @@ InfpCacheFreeLine (PINFCACHELINE Line)
|
||||||
Next = Line->Next;
|
Next = Line->Next;
|
||||||
if (Line->Key != NULL)
|
if (Line->Key != NULL)
|
||||||
{
|
{
|
||||||
MmFreeMemory (Line->Key);
|
MmHeapFree (Line->Key);
|
||||||
Line->Key = NULL;
|
Line->Key = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,12 +167,12 @@ InfpCacheFreeLine (PINFCACHELINE Line)
|
||||||
while (Line->FirstField != NULL)
|
while (Line->FirstField != NULL)
|
||||||
{
|
{
|
||||||
Field = Line->FirstField->Next;
|
Field = Line->FirstField->Next;
|
||||||
MmFreeMemory (Line->FirstField);
|
MmHeapFree (Line->FirstField);
|
||||||
Line->FirstField = Field;
|
Line->FirstField = Field;
|
||||||
}
|
}
|
||||||
Line->LastField = NULL;
|
Line->LastField = NULL;
|
||||||
|
|
||||||
MmFreeMemory (Line);
|
MmHeapFree (Line);
|
||||||
|
|
||||||
return Next;
|
return Next;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ InfpCacheFreeSection (PINFCACHESECTION Section)
|
||||||
}
|
}
|
||||||
Section->LastLine = NULL;
|
Section->LastLine = NULL;
|
||||||
|
|
||||||
MmFreeMemory (Section);
|
MmHeapFree (Section);
|
||||||
|
|
||||||
return Next;
|
return Next;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ InfpCacheAddSection (PINFCACHE Cache,
|
||||||
|
|
||||||
/* Allocate and initialize the new section */
|
/* Allocate and initialize the new section */
|
||||||
Size = sizeof(INFCACHESECTION) + strlen (Name);
|
Size = sizeof(INFCACHESECTION) + strlen (Name);
|
||||||
Section = (PINFCACHESECTION)MmAllocateMemory (Size);
|
Section = (PINFCACHESECTION)MmHeapAlloc (Size);
|
||||||
if (Section == NULL)
|
if (Section == NULL)
|
||||||
{
|
{
|
||||||
// DPRINT("RtlAllocateHeap() failed\n");
|
// DPRINT("RtlAllocateHeap() failed\n");
|
||||||
|
@ -284,7 +284,7 @@ InfpCacheAddLine (PINFCACHESECTION Section)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Line = (PINFCACHELINE)MmAllocateMemory (sizeof(INFCACHELINE));
|
Line = (PINFCACHELINE)MmHeapAlloc (sizeof(INFCACHELINE));
|
||||||
if (Line == NULL)
|
if (Line == NULL)
|
||||||
{
|
{
|
||||||
// DPRINT("RtlAllocateHeap() failed\n");
|
// DPRINT("RtlAllocateHeap() failed\n");
|
||||||
|
@ -320,7 +320,7 @@ InfpAddKeyToLine (PINFCACHELINE Line,
|
||||||
if (Line->Key != NULL)
|
if (Line->Key != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Line->Key = (PCHAR)MmAllocateMemory (strlen (Key) + 1);
|
Line->Key = (PCHAR)MmHeapAlloc (strlen (Key) + 1);
|
||||||
if (Line->Key == NULL)
|
if (Line->Key == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ InfpAddFieldToLine (PINFCACHELINE Line,
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
|
||||||
Size = sizeof(INFCACHEFIELD) + strlen(Data);
|
Size = sizeof(INFCACHEFIELD) + strlen(Data);
|
||||||
Field = (PINFCACHEFIELD)MmAllocateMemory (Size);
|
Field = (PINFCACHEFIELD)MmHeapAlloc (Size);
|
||||||
if (Field == NULL)
|
if (Field == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -906,7 +906,7 @@ InfOpenFile(PHINF InfHandle,
|
||||||
// DPRINT("File size: %lu\n", FileLength);
|
// DPRINT("File size: %lu\n", FileLength);
|
||||||
|
|
||||||
/* Allocate file buffer */
|
/* Allocate file buffer */
|
||||||
FileBuffer = MmAllocateMemory (FileSize + 1);
|
FileBuffer = MmHeapAlloc (FileSize + 1);
|
||||||
if (FileBuffer == NULL)
|
if (FileBuffer == NULL)
|
||||||
{
|
{
|
||||||
// DPRINT1("RtlAllocateHeap() failed\n");
|
// DPRINT1("RtlAllocateHeap() failed\n");
|
||||||
|
@ -921,7 +921,7 @@ InfOpenFile(PHINF InfHandle,
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
// DPRINT("FsReadFile() failed\n");
|
// DPRINT("FsReadFile() failed\n");
|
||||||
MmFreeMemory (FileBuffer);
|
MmHeapFree (FileBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,11 +929,11 @@ InfOpenFile(PHINF InfHandle,
|
||||||
FileBuffer[FileSize] = 0;
|
FileBuffer[FileSize] = 0;
|
||||||
|
|
||||||
/* Allocate infcache header */
|
/* Allocate infcache header */
|
||||||
Cache = (PINFCACHE)MmAllocateMemory (sizeof(INFCACHE));
|
Cache = (PINFCACHE)MmHeapAlloc (sizeof(INFCACHE));
|
||||||
if (Cache == NULL)
|
if (Cache == NULL)
|
||||||
{
|
{
|
||||||
// DPRINT("RtlAllocateHeap() failed\n");
|
// DPRINT("RtlAllocateHeap() failed\n");
|
||||||
MmFreeMemory (FileBuffer);
|
MmHeapFree (FileBuffer);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,12 +948,12 @@ InfOpenFile(PHINF InfHandle,
|
||||||
ErrorLine);
|
ErrorLine);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
MmFreeMemory (Cache);
|
MmHeapFree (Cache);
|
||||||
Cache = NULL;
|
Cache = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free file buffer */
|
/* Free file buffer */
|
||||||
MmFreeMemory (FileBuffer);
|
MmHeapFree (FileBuffer);
|
||||||
|
|
||||||
*InfHandle = (HINF)Cache;
|
*InfHandle = (HINF)Cache;
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ InfCloseFile(HINF InfHandle)
|
||||||
}
|
}
|
||||||
Cache->LastSection = NULL;
|
Cache->LastSection = NULL;
|
||||||
|
|
||||||
MmFreeMemory(Cache);
|
MmHeapFree(Cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
|
|
||||||
// Get the file size & allocate enough memory for it
|
// Get the file size & allocate enough memory for it
|
||||||
FreeLoaderIniFileSize = FsGetFileSize(Freeldr_Ini);
|
FreeLoaderIniFileSize = FsGetFileSize(Freeldr_Ini);
|
||||||
FreeLoaderIniFileData = MmAllocateMemory(FreeLoaderIniFileSize);
|
FreeLoaderIniFileData = MmHeapAlloc(FreeLoaderIniFileSize);
|
||||||
|
|
||||||
// If we are out of memory then return FALSE
|
// If we are out of memory then return FALSE
|
||||||
if (FreeLoaderIniFileData == NULL)
|
if (FreeLoaderIniFileData == NULL)
|
||||||
|
@ -51,7 +51,7 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
if (!FsReadFile(Freeldr_Ini, FreeLoaderIniFileSize, NULL, FreeLoaderIniFileData))
|
if (!FsReadFile(Freeldr_Ini, FreeLoaderIniFileSize, NULL, FreeLoaderIniFileData))
|
||||||
{
|
{
|
||||||
FsCloseFile(Freeldr_Ini);
|
FsCloseFile(Freeldr_Ini);
|
||||||
MmFreeMemory(FreeLoaderIniFileData);
|
MmHeapFree(FreeLoaderIniFileData);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
// Parse the .ini file data
|
// Parse the .ini file data
|
||||||
Success = IniParseFile(FreeLoaderIniFileData, FreeLoaderIniFileSize);
|
Success = IniParseFile(FreeLoaderIniFileData, FreeLoaderIniFileSize);
|
||||||
|
|
||||||
MmFreeMemory(FreeLoaderIniFileData);
|
MmHeapFree(FreeLoaderIniFileData);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ BOOLEAN IniAddSection(PCSTR SectionName, ULONG* SectionId)
|
||||||
PINI_SECTION Section;
|
PINI_SECTION Section;
|
||||||
|
|
||||||
// Allocate a new section structure
|
// Allocate a new section structure
|
||||||
Section = MmAllocateMemory(sizeof(INI_SECTION));
|
Section = MmHeapAlloc(sizeof(INI_SECTION));
|
||||||
if (!Section)
|
if (!Section)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -187,10 +187,10 @@ BOOLEAN IniAddSection(PCSTR SectionName, ULONG* SectionId)
|
||||||
RtlZeroMemory(Section, sizeof(INI_SECTION));
|
RtlZeroMemory(Section, sizeof(INI_SECTION));
|
||||||
|
|
||||||
// Allocate the section name buffer
|
// Allocate the section name buffer
|
||||||
Section->SectionName = MmAllocateMemory(strlen(SectionName));
|
Section->SectionName = MmHeapAlloc(strlen(SectionName));
|
||||||
if (!Section->SectionName)
|
if (!Section->SectionName)
|
||||||
{
|
{
|
||||||
MmFreeMemory(Section);
|
MmHeapFree(Section);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ BOOLEAN IniAddSettingValueToSection(ULONG SectionId, PCSTR SettingName, PCSTR Se
|
||||||
PINI_SECTION_ITEM SectionItem;
|
PINI_SECTION_ITEM SectionItem;
|
||||||
|
|
||||||
// Allocate a new item structure
|
// Allocate a new item structure
|
||||||
SectionItem = MmAllocateMemory(sizeof(INI_SECTION_ITEM));
|
SectionItem = MmHeapAlloc(sizeof(INI_SECTION_ITEM));
|
||||||
if (!SectionItem)
|
if (!SectionItem)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -221,19 +221,19 @@ BOOLEAN IniAddSettingValueToSection(ULONG SectionId, PCSTR SettingName, PCSTR Se
|
||||||
RtlZeroMemory(SectionItem, sizeof(INI_SECTION_ITEM));
|
RtlZeroMemory(SectionItem, sizeof(INI_SECTION_ITEM));
|
||||||
|
|
||||||
// Allocate the setting name buffer
|
// Allocate the setting name buffer
|
||||||
SectionItem->ItemName = MmAllocateMemory(strlen(SettingName) + 1);
|
SectionItem->ItemName = MmHeapAlloc(strlen(SettingName) + 1);
|
||||||
if (!SectionItem->ItemName)
|
if (!SectionItem->ItemName)
|
||||||
{
|
{
|
||||||
MmFreeMemory(SectionItem);
|
MmHeapFree(SectionItem);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate the setting value buffer
|
// Allocate the setting value buffer
|
||||||
SectionItem->ItemValue = MmAllocateMemory(strlen(SettingValue) + 1);
|
SectionItem->ItemValue = MmHeapAlloc(strlen(SettingValue) + 1);
|
||||||
if (!SectionItem->ItemValue)
|
if (!SectionItem->ItemValue)
|
||||||
{
|
{
|
||||||
MmFreeMemory(SectionItem->ItemName);
|
MmHeapFree(SectionItem->ItemName);
|
||||||
MmFreeMemory(SectionItem);
|
MmHeapFree(SectionItem);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
||||||
|
|
||||||
// Start with an 80-byte buffer
|
// Start with an 80-byte buffer
|
||||||
IniFileLineSize = 80;
|
IniFileLineSize = 80;
|
||||||
IniFileLine = MmAllocateMemory(IniFileLineSize);
|
IniFileLine = MmHeapAlloc(IniFileLineSize);
|
||||||
if (!IniFileLine)
|
if (!IniFileLine)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -61,8 +61,8 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
||||||
if (IniFileLineSize < IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset))
|
if (IniFileLineSize < IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset))
|
||||||
{
|
{
|
||||||
IniFileLineSize = IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset);
|
IniFileLineSize = IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset);
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
IniFileLine = MmAllocateMemory(IniFileLineSize);
|
IniFileLine = MmHeapAlloc(IniFileLineSize);
|
||||||
if (!IniFileLine)
|
if (!IniFileLine)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -84,21 +84,21 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
||||||
if (IniIsSectionName(IniFileLine, LineLength))
|
if (IniIsSectionName(IniFileLine, LineLength))
|
||||||
{
|
{
|
||||||
// Allocate a new section structure
|
// Allocate a new section structure
|
||||||
CurrentSection = MmAllocateMemory(sizeof(INI_SECTION));
|
CurrentSection = MmHeapAlloc(sizeof(INI_SECTION));
|
||||||
if (!CurrentSection)
|
if (!CurrentSection)
|
||||||
{
|
{
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(CurrentSection, sizeof(INI_SECTION));
|
RtlZeroMemory(CurrentSection, sizeof(INI_SECTION));
|
||||||
|
|
||||||
// Allocate the section name buffer
|
// Allocate the section name buffer
|
||||||
CurrentSection->SectionName = MmAllocateMemory(IniGetSectionNameSize(IniFileLine, LineLength));
|
CurrentSection->SectionName = MmHeapAlloc(IniGetSectionNameSize(IniFileLine, LineLength));
|
||||||
if (!CurrentSection->SectionName)
|
if (!CurrentSection->SectionName)
|
||||||
{
|
{
|
||||||
MmFreeMemory(CurrentSection);
|
MmHeapFree(CurrentSection);
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,31 +128,31 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate a new item structure
|
// Allocate a new item structure
|
||||||
CurrentItem = MmAllocateMemory(sizeof(INI_SECTION_ITEM));
|
CurrentItem = MmHeapAlloc(sizeof(INI_SECTION_ITEM));
|
||||||
if (!CurrentItem)
|
if (!CurrentItem)
|
||||||
{
|
{
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(CurrentItem, sizeof(INI_SECTION_ITEM));
|
RtlZeroMemory(CurrentItem, sizeof(INI_SECTION_ITEM));
|
||||||
|
|
||||||
// Allocate the setting name buffer
|
// Allocate the setting name buffer
|
||||||
CurrentItem->ItemName = MmAllocateMemory(IniGetSettingNameSize(IniFileLine, LineLength));
|
CurrentItem->ItemName = MmHeapAlloc(IniGetSettingNameSize(IniFileLine, LineLength));
|
||||||
if (!CurrentItem->ItemName)
|
if (!CurrentItem->ItemName)
|
||||||
{
|
{
|
||||||
MmFreeMemory(CurrentItem);
|
MmHeapFree(CurrentItem);
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate the setting value buffer
|
// Allocate the setting value buffer
|
||||||
CurrentItem->ItemValue = MmAllocateMemory(IniGetSettingValueSize(IniFileLine, LineLength));
|
CurrentItem->ItemValue = MmHeapAlloc(IniGetSettingValueSize(IniFileLine, LineLength));
|
||||||
if (!CurrentItem->ItemValue)
|
if (!CurrentItem->ItemValue)
|
||||||
{
|
{
|
||||||
MmFreeMemory(CurrentItem->ItemName);
|
MmHeapFree(CurrentItem->ItemName);
|
||||||
MmFreeMemory(CurrentItem);
|
MmHeapFree(CurrentItem);
|
||||||
MmFreeMemory(IniFileLine);
|
MmHeapFree(IniFileLine);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,8 +310,8 @@ VOID MmFreeMemory(PVOID MemoryPointer)
|
||||||
|
|
||||||
PVOID MmHeapAlloc(ULONG MemorySize)
|
PVOID MmHeapAlloc(ULONG MemorySize)
|
||||||
{
|
{
|
||||||
// Stub for WinLdr
|
// Temporary forwarder...
|
||||||
return NULL;
|
return MmAllocateMemoryWithType(MemorySize, LoaderOsloaderHeap);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MmHeapFree(PVOID MemoryPointer)
|
VOID MmHeapFree(PVOID MemoryPointer)
|
||||||
|
|
|
@ -119,8 +119,8 @@ BOOLEAN AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPoin
|
||||||
//
|
//
|
||||||
// Allocate memory to hold operating system list arrays
|
// Allocate memory to hold operating system list arrays
|
||||||
//
|
//
|
||||||
OperatingSystemSectionNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
|
OperatingSystemSectionNames = MmHeapAlloc( sizeof(PCHAR) * OperatingSystemCount);
|
||||||
OperatingSystemDisplayNames = MmAllocateMemory( sizeof(PCHAR) * OperatingSystemCount);
|
OperatingSystemDisplayNames = MmHeapAlloc( sizeof(PCHAR) * OperatingSystemCount);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If either allocation failed then return FALSE
|
// If either allocation failed then return FALSE
|
||||||
|
@ -129,12 +129,12 @@ BOOLEAN AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPoin
|
||||||
{
|
{
|
||||||
if (OperatingSystemSectionNames != NULL)
|
if (OperatingSystemSectionNames != NULL)
|
||||||
{
|
{
|
||||||
MmFreeMemory(OperatingSystemSectionNames);
|
MmHeapFree(OperatingSystemSectionNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OperatingSystemDisplayNames != NULL)
|
if (OperatingSystemDisplayNames != NULL)
|
||||||
{
|
{
|
||||||
MmFreeMemory(OperatingSystemDisplayNames);
|
MmHeapFree(OperatingSystemDisplayNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -151,8 +151,8 @@ BOOLEAN AllocateListMemory(PCHAR **SectionNamesPointer, PCHAR **DisplayNamesPoin
|
||||||
//
|
//
|
||||||
for (Idx=0; Idx<OperatingSystemCount; Idx++)
|
for (Idx=0; Idx<OperatingSystemCount; Idx++)
|
||||||
{
|
{
|
||||||
OperatingSystemSectionNames[Idx] = MmAllocateMemory(80);
|
OperatingSystemSectionNames[Idx] = MmHeapAlloc(80);
|
||||||
OperatingSystemDisplayNames[Idx] = MmAllocateMemory(80);
|
OperatingSystemDisplayNames[Idx] = MmHeapAlloc(80);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If it failed then jump to the cleanup code
|
// If it failed then jump to the cleanup code
|
||||||
|
@ -177,20 +177,20 @@ AllocateListMemoryFailed:
|
||||||
{
|
{
|
||||||
if (OperatingSystemSectionNames[Idx] != NULL)
|
if (OperatingSystemSectionNames[Idx] != NULL)
|
||||||
{
|
{
|
||||||
MmFreeMemory(OperatingSystemSectionNames[Idx]);
|
MmHeapFree(OperatingSystemSectionNames[Idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OperatingSystemDisplayNames[Idx] != NULL)
|
if (OperatingSystemDisplayNames[Idx] != NULL)
|
||||||
{
|
{
|
||||||
MmFreeMemory(OperatingSystemDisplayNames[Idx]);
|
MmHeapFree(OperatingSystemDisplayNames[Idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free operating system list arrays
|
// Free operating system list arrays
|
||||||
//
|
//
|
||||||
MmFreeMemory(OperatingSystemSectionNames);
|
MmHeapFree(OperatingSystemSectionNames);
|
||||||
MmFreeMemory(OperatingSystemDisplayNames);
|
MmHeapFree(OperatingSystemDisplayNames);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ static PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpAllocate (SIZE_T Size, BOOLEAN Paged, ULONG Tag)
|
CmpAllocate (SIZE_T Size, BOOLEAN Paged, ULONG Tag)
|
||||||
{
|
{
|
||||||
return MmAllocateMemory(Size);
|
return MmHeapAlloc(Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ static VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpFree (PVOID Ptr, IN ULONG Quota)
|
CmpFree (PVOID Ptr, IN ULONG Quota)
|
||||||
{
|
{
|
||||||
return MmFreeMemory(Ptr);
|
return MmHeapFree(Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
|
@ -62,7 +62,7 @@ RegImportValue (PHHIVE Hive,
|
||||||
|
|
||||||
if (ValueCell->Flags & VALUE_COMP_NAME)
|
if (ValueCell->Flags & VALUE_COMP_NAME)
|
||||||
{
|
{
|
||||||
wName = MmAllocateMemory ((ValueCell->NameLength + 1)*sizeof(WCHAR));
|
wName = MmHeapAlloc ((ValueCell->NameLength + 1)*sizeof(WCHAR));
|
||||||
for (i = 0; i < ValueCell->NameLength; i++)
|
for (i = 0; i < ValueCell->NameLength; i++)
|
||||||
{
|
{
|
||||||
wName[i] = ((PCHAR)ValueCell->Name)[i];
|
wName[i] = ((PCHAR)ValueCell->Name)[i];
|
||||||
|
@ -71,7 +71,7 @@ RegImportValue (PHHIVE Hive,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wName = MmAllocateMemory (ValueCell->NameLength + sizeof(WCHAR));
|
wName = MmHeapAlloc (ValueCell->NameLength + sizeof(WCHAR));
|
||||||
memcpy (wName,
|
memcpy (wName,
|
||||||
ValueCell->Name,
|
ValueCell->Name,
|
||||||
ValueCell->NameLength);
|
ValueCell->NameLength);
|
||||||
|
@ -93,7 +93,7 @@ RegImportValue (PHHIVE Hive,
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DbgPrint((DPRINT_REGISTRY, "RegSetValue() failed!\n"));
|
DbgPrint((DPRINT_REGISTRY, "RegSetValue() failed!\n"));
|
||||||
MmFreeMemory (wName);
|
MmHeapFree (wName);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,12 @@ RegImportValue (PHHIVE Hive,
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DbgPrint((DPRINT_REGISTRY, "RegSetValue() failed!\n"));
|
DbgPrint((DPRINT_REGISTRY, "RegSetValue() failed!\n"));
|
||||||
MmFreeMemory (wName);
|
MmHeapFree (wName);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MmFreeMemory (wName);
|
MmHeapFree (wName);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ RegImportSubKey(PHHIVE Hive,
|
||||||
|
|
||||||
if (KeyCell->Flags & KEY_COMP_NAME)
|
if (KeyCell->Flags & KEY_COMP_NAME)
|
||||||
{
|
{
|
||||||
wName = MmAllocateMemory ((KeyCell->NameLength + 1) * sizeof(WCHAR));
|
wName = MmHeapAlloc ((KeyCell->NameLength + 1) * sizeof(WCHAR));
|
||||||
for (i = 0; i < KeyCell->NameLength; i++)
|
for (i = 0; i < KeyCell->NameLength; i++)
|
||||||
{
|
{
|
||||||
wName[i] = ((PCHAR)KeyCell->Name)[i];
|
wName[i] = ((PCHAR)KeyCell->Name)[i];
|
||||||
|
@ -156,7 +156,7 @@ RegImportSubKey(PHHIVE Hive,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wName = MmAllocateMemory (KeyCell->NameLength + sizeof(WCHAR));
|
wName = MmHeapAlloc (KeyCell->NameLength + sizeof(WCHAR));
|
||||||
memcpy (wName,
|
memcpy (wName,
|
||||||
KeyCell->Name,
|
KeyCell->Name,
|
||||||
KeyCell->NameLength);
|
KeyCell->NameLength);
|
||||||
|
@ -169,7 +169,7 @@ RegImportSubKey(PHHIVE Hive,
|
||||||
Error = RegCreateKey (ParentKey,
|
Error = RegCreateKey (ParentKey,
|
||||||
wName,
|
wName,
|
||||||
&SubKey);
|
&SubKey);
|
||||||
MmFreeMemory (wName);
|
MmHeapFree (wName);
|
||||||
if (Error != ERROR_SUCCESS)
|
if (Error != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DbgPrint((DPRINT_REGISTRY, "RegCreateKey() failed!\n"));
|
DbgPrint((DPRINT_REGISTRY, "RegCreateKey() failed!\n"));
|
||||||
|
|
|
@ -28,7 +28,7 @@ VOID
|
||||||
RegInitializeRegistry (VOID)
|
RegInitializeRegistry (VOID)
|
||||||
{
|
{
|
||||||
/* Create root key */
|
/* Create root key */
|
||||||
RootKey = (FRLDRHKEY) MmAllocateMemory (sizeof(KEY));
|
RootKey = (FRLDRHKEY) MmHeapAlloc (sizeof(KEY));
|
||||||
|
|
||||||
InitializeListHead (&RootKey->SubKeyList);
|
InitializeListHead (&RootKey->SubKeyList);
|
||||||
InitializeListHead (&RootKey->ValueList);
|
InitializeListHead (&RootKey->ValueList);
|
||||||
|
@ -38,7 +38,7 @@ RegInitializeRegistry (VOID)
|
||||||
RootKey->ValueCount = 0;
|
RootKey->ValueCount = 0;
|
||||||
|
|
||||||
RootKey->NameSize = 4;
|
RootKey->NameSize = 4;
|
||||||
RootKey->Name = MmAllocateMemory (4);
|
RootKey->Name = MmHeapAlloc (4);
|
||||||
wcscpy (RootKey->Name, L"\\");
|
wcscpy (RootKey->Name, L"\\");
|
||||||
|
|
||||||
RootKey->DataType = 0;
|
RootKey->DataType = 0;
|
||||||
|
@ -244,7 +244,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
|
||||||
if (CmpResult != 0)
|
if (CmpResult != 0)
|
||||||
{
|
{
|
||||||
/* no key found -> create new subkey */
|
/* no key found -> create new subkey */
|
||||||
NewKey = (FRLDRHKEY)MmAllocateMemory(sizeof(KEY));
|
NewKey = (FRLDRHKEY)MmHeapAlloc(sizeof(KEY));
|
||||||
if (NewKey == NULL)
|
if (NewKey == NULL)
|
||||||
return(ERROR_OUTOFMEMORY);
|
return(ERROR_OUTOFMEMORY);
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
|
||||||
CurrentKey->SubKeyCount++;
|
CurrentKey->SubKeyCount++;
|
||||||
|
|
||||||
NewKey->NameSize = NameSize;
|
NewKey->NameSize = NameSize;
|
||||||
NewKey->Name = (PWCHAR)MmAllocateMemory(NewKey->NameSize);
|
NewKey->Name = (PWCHAR)MmHeapAlloc(NewKey->NameSize);
|
||||||
if (NewKey->Name == NULL)
|
if (NewKey->Name == NULL)
|
||||||
return(ERROR_OUTOFMEMORY);
|
return(ERROR_OUTOFMEMORY);
|
||||||
memcpy(NewKey->Name, name, NewKey->NameSize - sizeof(WCHAR));
|
memcpy(NewKey->Name, name, NewKey->NameSize - sizeof(WCHAR));
|
||||||
|
@ -468,7 +468,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
/* set default value */
|
/* set default value */
|
||||||
if ((Key->Data != NULL) && (Key->DataSize > sizeof(PUCHAR)))
|
if ((Key->Data != NULL) && (Key->DataSize > sizeof(PUCHAR)))
|
||||||
{
|
{
|
||||||
MmFreeMemory(Key->Data);
|
MmHeapFree(Key->Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSize <= sizeof(PUCHAR))
|
if (DataSize <= sizeof(PUCHAR))
|
||||||
|
@ -479,7 +479,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Key->Data = MmAllocateMemory(DataSize);
|
Key->Data = MmHeapAlloc(DataSize);
|
||||||
Key->DataSize = DataSize;
|
Key->DataSize = DataSize;
|
||||||
Key->DataType = Type;
|
Key->DataType = Type;
|
||||||
memcpy(Key->Data, Data, DataSize);
|
memcpy(Key->Data, Data, DataSize);
|
||||||
|
@ -508,7 +508,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
/* add new value */
|
/* add new value */
|
||||||
DbgPrint((DPRINT_REGISTRY, "No value found - adding new value\n"));
|
DbgPrint((DPRINT_REGISTRY, "No value found - adding new value\n"));
|
||||||
|
|
||||||
Value = (PVALUE)MmAllocateMemory(sizeof(VALUE));
|
Value = (PVALUE)MmHeapAlloc(sizeof(VALUE));
|
||||||
if (Value == NULL)
|
if (Value == NULL)
|
||||||
return(ERROR_OUTOFMEMORY);
|
return(ERROR_OUTOFMEMORY);
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
Key->ValueCount++;
|
Key->ValueCount++;
|
||||||
|
|
||||||
Value->NameSize = (wcslen(ValueName)+1)*sizeof(WCHAR);
|
Value->NameSize = (wcslen(ValueName)+1)*sizeof(WCHAR);
|
||||||
Value->Name = (PWCHAR)MmAllocateMemory(Value->NameSize);
|
Value->Name = (PWCHAR)MmHeapAlloc(Value->NameSize);
|
||||||
if (Value->Name == NULL)
|
if (Value->Name == NULL)
|
||||||
return(ERROR_OUTOFMEMORY);
|
return(ERROR_OUTOFMEMORY);
|
||||||
wcscpy(Value->Name, ValueName);
|
wcscpy(Value->Name, ValueName);
|
||||||
|
@ -528,7 +528,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
/* set new value */
|
/* set new value */
|
||||||
if ((Value->Data != NULL) && (Value->DataSize > sizeof(PUCHAR)))
|
if ((Value->Data != NULL) && (Value->DataSize > sizeof(PUCHAR)))
|
||||||
{
|
{
|
||||||
MmFreeMemory(Value->Data);
|
MmHeapFree(Value->Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSize <= sizeof(PUCHAR))
|
if (DataSize <= sizeof(PUCHAR))
|
||||||
|
@ -539,7 +539,7 @@ RegSetValue(FRLDRHKEY Key,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Value->Data = MmAllocateMemory(DataSize);
|
Value->Data = MmHeapAlloc(DataSize);
|
||||||
if (Value->Data == NULL)
|
if (Value->Data == NULL)
|
||||||
return(ERROR_OUTOFMEMORY);
|
return(ERROR_OUTOFMEMORY);
|
||||||
Value->DataType = Type;
|
Value->DataType = Type;
|
||||||
|
|
|
@ -33,7 +33,7 @@ STDCALL
|
||||||
RtlpAllocateMemory(ULONG Bytes,
|
RtlpAllocateMemory(ULONG Bytes,
|
||||||
ULONG Tag)
|
ULONG Tag)
|
||||||
{
|
{
|
||||||
return MmAllocateMemory(Bytes);
|
return MmHeapAlloc(Bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,5 +42,5 @@ STDCALL
|
||||||
RtlpFreeMemory(PVOID Mem,
|
RtlpFreeMemory(PVOID Mem,
|
||||||
ULONG Tag)
|
ULONG Tag)
|
||||||
{
|
{
|
||||||
return MmFreeMemory(Mem);
|
return MmHeapFree(Mem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,7 @@ VOID TuiMessageBox(PCSTR MessageText)
|
||||||
PVOID ScreenBuffer;
|
PVOID ScreenBuffer;
|
||||||
|
|
||||||
// Save the screen contents
|
// Save the screen contents
|
||||||
ScreenBuffer = MmAllocateMemory(UiScreenWidth * UiScreenHeight * 2);
|
ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
|
||||||
TuiSaveScreen(ScreenBuffer);
|
TuiSaveScreen(ScreenBuffer);
|
||||||
|
|
||||||
// Display the message box
|
// Display the message box
|
||||||
|
@ -567,7 +567,7 @@ VOID TuiMessageBox(PCSTR MessageText)
|
||||||
|
|
||||||
// Restore the screen contents
|
// Restore the screen contents
|
||||||
TuiRestoreScreen(ScreenBuffer);
|
TuiRestoreScreen(ScreenBuffer);
|
||||||
MmFreeMemory(ScreenBuffer);
|
MmHeapFree(ScreenBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID TuiMessageBoxCritical(PCSTR MessageText)
|
VOID TuiMessageBoxCritical(PCSTR MessageText)
|
||||||
|
@ -774,7 +774,7 @@ VOID TuiFadeInBackdrop(VOID)
|
||||||
|
|
||||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
||||||
{
|
{
|
||||||
TuiFadePalette = (PPALETTE_ENTRY)MmAllocateMemory(sizeof(PALETTE_ENTRY) * 64);
|
TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
|
||||||
|
|
||||||
if (TuiFadePalette != NULL)
|
if (TuiFadePalette != NULL)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ VOID TuiFadeInBackdrop(VOID)
|
||||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
||||||
{
|
{
|
||||||
VideoFadeIn(TuiFadePalette, 64);
|
VideoFadeIn(TuiFadePalette, 64);
|
||||||
MmFreeMemory(TuiFadePalette);
|
MmHeapFree(TuiFadePalette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ VOID TuiFadeOut(VOID)
|
||||||
|
|
||||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
||||||
{
|
{
|
||||||
TuiFadePalette = (PPALETTE_ENTRY)MmAllocateMemory(sizeof(PALETTE_ENTRY) * 64);
|
TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
|
||||||
|
|
||||||
if (TuiFadePalette != NULL)
|
if (TuiFadePalette != NULL)
|
||||||
{
|
{
|
||||||
|
@ -817,7 +817,7 @@ VOID TuiFadeOut(VOID)
|
||||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
||||||
{
|
{
|
||||||
VideoRestorePaletteState(TuiFadePalette, 64);
|
VideoRestorePaletteState(TuiFadePalette, 64);
|
||||||
MmFreeMemory(TuiFadePalette);
|
MmHeapFree(TuiFadePalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
|
||||||
PVOID ScreenBuffer;
|
PVOID ScreenBuffer;
|
||||||
|
|
||||||
// Save the screen contents
|
// Save the screen contents
|
||||||
ScreenBuffer = MmAllocateMemory(UiScreenWidth * UiScreenHeight * 2);
|
ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
|
||||||
TuiSaveScreen(ScreenBuffer);
|
TuiSaveScreen(ScreenBuffer);
|
||||||
|
|
||||||
// Find the height
|
// Find the height
|
||||||
|
@ -982,7 +982,7 @@ BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
|
||||||
|
|
||||||
// Restore the screen contents
|
// Restore the screen contents
|
||||||
TuiRestoreScreen(ScreenBuffer);
|
TuiRestoreScreen(ScreenBuffer);
|
||||||
MmFreeMemory(ScreenBuffer);
|
MmHeapFree(ScreenBuffer);
|
||||||
|
|
||||||
return ReturnCode;
|
return ReturnCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ VOID UiShowMessageBoxesInSection(PCSTR SectionName)
|
||||||
//if (MessageBoxTextSize > 0)
|
//if (MessageBoxTextSize > 0)
|
||||||
{
|
{
|
||||||
// Allocate enough memory to hold the text
|
// Allocate enough memory to hold the text
|
||||||
MessageBoxText = MmAllocateMemory(MessageBoxTextSize);
|
MessageBoxText = MmHeapAlloc(MessageBoxTextSize);
|
||||||
|
|
||||||
if (MessageBoxText)
|
if (MessageBoxText)
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ VOID UiShowMessageBoxesInSection(PCSTR SectionName)
|
||||||
UiMessageBox(MessageBoxText);
|
UiMessageBox(MessageBoxText);
|
||||||
|
|
||||||
// Free the memory
|
// Free the memory
|
||||||
MmFreeMemory(MessageBoxText);
|
MmHeapFree(MessageBoxText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue