mirror of
https://github.com/reactos/reactos.git
synced 2024-06-25 23:41:35 +00:00
[FREELDR]
Improve heap allocations by using tags and using the temp heap for all temporary allocations that will not be used by the kernel. This avoids heap fragmentation for the default heap. Increase the temp heap size to 32 MB and limit the size of the cache to the temp heap size minus 128 KB to avoid exhausting the heap with cache data. See CORE-4413. This commit is dedicated to Ronja, my beloved cat who passed away on 5th of December. Rest in peace, little Schnuppel. svn path=/trunk/; revision=61428
This commit is contained in:
parent
56f0833252
commit
eada6279cd
|
@ -276,7 +276,7 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST)
|
||||
+ sizeof(CM_PNP_BIOS_INSTALLATION_CHECK) + (NodeSize * NodeCount);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -376,7 +376,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate a full resource descriptor\n");
|
||||
|
@ -416,7 +416,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
|
|||
else
|
||||
{
|
||||
TRACE("Reading disk geometry failed\n");
|
||||
MmHeapFree(PartialResourceList);
|
||||
FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
|
||||
return NULL;
|
||||
}
|
||||
TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||
|
@ -507,7 +507,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|||
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_FLOPPY_DEVICE_DATA);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -563,7 +563,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -635,7 +635,7 @@ DetectSystem(VOID)
|
|||
/* Allocate resource descriptor */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -1036,7 +1036,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
memset(PartialResourceList, 0, Size);
|
||||
PartialResourceList->Version = 1;
|
||||
PartialResourceList->Revision = 1;
|
||||
|
@ -1099,7 +1099,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
|
||||
sizeof(CM_SERIAL_DEVICE_DATA);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -1203,7 +1203,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
if (Irq[i] != (ULONG) - 1)
|
||||
Size += sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -1342,7 +1342,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_KEYBOARD_DEVICE_DATA);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -1395,7 +1395,7 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -1576,7 +1576,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
{
|
||||
TRACE("Detected PS2 port\n");
|
||||
|
||||
PartialResourceList = MmHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||
PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST), TAG_HW_RESOURCE_LIST);
|
||||
memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
|
||||
|
||||
/* Initialize resource descriptor */
|
||||
|
@ -1612,7 +1612,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
/* Initialize resource descriptor */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
memset(PartialResourceList, 0, Size);
|
||||
PartialResourceList->Version = 1;
|
||||
PartialResourceList->Revision = 1;
|
||||
|
@ -1695,7 +1695,7 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
|
|
@ -73,7 +73,8 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
|
||||
/* Set 'Configuration Data' value */
|
||||
PartialResourceList =
|
||||
MmHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
|
||||
FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize,
|
||||
TAG_HW_RESOURCE_LIST);
|
||||
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
if (FindApmBios())
|
||||
{
|
||||
/* Create 'Configuration Data' value */
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
memset(PartialResourceList, 0, Size);
|
||||
PartialResourceList->Version = 0;
|
||||
PartialResourceList->Revision = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ static LONG DiskClose(ULONG FileId)
|
|||
{
|
||||
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
|
||||
|
||||
MmHeapFree(Context);
|
||||
FrLdrTempFree(Context, TAG_HW_DISK_CONTEXT);
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
}
|
||||
|
||||
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
||||
Context = FrLdrTempAlloc(sizeof(DISKCONTEXT), TAG_HW_DISK_CONTEXT);
|
||||
if (!Context)
|
||||
return ENOMEM;
|
||||
Context->DriveNumber = DriveNumber;
|
||||
|
|
|
@ -120,7 +120,7 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
|
||||
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + Table->TableSize;
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -178,7 +178,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
{
|
||||
/* Set 'Configuration Data' value */
|
||||
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -216,7 +216,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
PartialDescriptors) +
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
|
||||
sizeof(PCI_REGISTRY_INFO);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (!PartialResourceList)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -241,7 +241,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
|
||||
PartialDescriptors);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (!PartialResourceList)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
|
|
@ -48,7 +48,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate a full resource descriptor\n");
|
||||
|
@ -82,7 +82,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
|
|||
else
|
||||
{
|
||||
ERR("Reading disk geometry failed\n");
|
||||
MmHeapFree(PartialResourceList);
|
||||
FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
|
||||
return NULL;
|
||||
}
|
||||
TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
|
||||
|
@ -114,7 +114,7 @@ DiskClose(ULONG FileId)
|
|||
{
|
||||
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
|
||||
|
||||
MmHeapFree(Context);
|
||||
FrLdrTempFree(Context, TAG_HW_DISK_CONTEXT);
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
SectorCount = 0; /* FIXME */
|
||||
}
|
||||
|
||||
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
||||
Context = FrLdrTempAlloc(sizeof(DISKCONTEXT), TAG_HW_DISK_CONTEXT);
|
||||
if (!Context)
|
||||
return ENOMEM;
|
||||
Context->DriveNumber = DriveNumber;
|
||||
|
@ -338,7 +338,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|||
GEOMETRY Geometry;
|
||||
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
|
||||
UCHAR DiskCount;
|
||||
USHORT i;
|
||||
ULONG i;
|
||||
ULONG Size;
|
||||
BOOLEAN Changed;
|
||||
|
||||
|
@ -377,7 +377,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|||
/* Allocate resource descriptor */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
|
||||
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
ERR("Failed to allocate resource descriptor\n");
|
||||
|
@ -463,7 +463,7 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
|||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
PartialResourceList = MmHeapAlloc(Size);
|
||||
PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
|
||||
if (PartialResourceList == NULL)
|
||||
{
|
||||
TRACE(
|
||||
|
|
|
@ -56,6 +56,8 @@ PVOID KernelMemory = 0;
|
|||
#define KernelMemorySize (8 * 1024 * 1024)
|
||||
#define XROUNDUP(x,n) ((((ULONG)x) + ((n) - 1)) & (~((n) - 1)))
|
||||
|
||||
#define TAG_MBOOT 'oobM'
|
||||
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
|
||||
/* Load Address of Next Module */
|
||||
|
@ -462,7 +464,7 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
//phnum = ehdr.e_phnum;
|
||||
shsize = ehdr.e_shentsize;
|
||||
shnum = ehdr.e_shnum;
|
||||
sptr = (PCHAR)MmHeapAlloc(shnum * shsize);
|
||||
sptr = (PCHAR)FrLdrTempAlloc(shnum * shsize, TAG_MBOOT);
|
||||
|
||||
/* Read section headers */
|
||||
FsSetFilePointer(KernelImage, ehdr.e_shoff);
|
||||
|
@ -563,14 +565,14 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
|
||||
if (!ELF_SECTION(targetSection)->sh_addr) continue;
|
||||
|
||||
RelocSection = MmHeapAlloc(shdr->sh_size);
|
||||
RelocSection = FrLdrTempAlloc(shdr->sh_size, TAG_MBOOT);
|
||||
FsSetFilePointer(KernelImage, relstart);
|
||||
FsReadFile(KernelImage, shdr->sh_size, NULL, RelocSection);
|
||||
|
||||
/* Get the symbol section */
|
||||
shdr = ELF_SECTION(shdr->sh_link);
|
||||
|
||||
SymbolSection = MmHeapAlloc(shdr->sh_size);
|
||||
SymbolSection = FrLdrTempAlloc(shdr->sh_size, TAG_MBOOT);
|
||||
FsSetFilePointer(KernelImage, shdr->sh_offset);
|
||||
FsReadFile(KernelImage, shdr->sh_size, NULL, SymbolSection);
|
||||
|
||||
|
@ -645,11 +647,11 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
#endif
|
||||
}
|
||||
|
||||
MmHeapFree(SymbolSection);
|
||||
MmHeapFree(RelocSection);
|
||||
FrLdrTempFree(SymbolSection, TAG_MBOOT);
|
||||
FrLdrTempFree(RelocSection, TAG_MBOOT);
|
||||
}
|
||||
|
||||
MmHeapFree(sptr);
|
||||
FrLdrTempFree(sptr, TAG_MBOOT);
|
||||
|
||||
ModuleData->ModStart = (ULONG)MemLoadAddr;
|
||||
/* Increase the next Load Base */
|
||||
|
|
|
@ -247,7 +247,7 @@ VOID RunLoader(VOID)
|
|||
//
|
||||
// Create list of display names
|
||||
//
|
||||
OperatingSystemDisplayNames = MmHeapAlloc(sizeof(PCSTR) * OperatingSystemCount);
|
||||
OperatingSystemDisplayNames = FrLdrTempAlloc(sizeof(PCSTR) * OperatingSystemCount, 'mNSO');
|
||||
if (!OperatingSystemDisplayNames)
|
||||
{
|
||||
goto reboot;
|
||||
|
|
15
reactos/boot/freeldr/freeldr/cache/blocklist.c
vendored
15
reactos/boot/freeldr/freeldr/cache/blocklist.c
vendored
|
@ -100,7 +100,7 @@ PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNu
|
|||
// We will need to add the block to the
|
||||
// drive's list of cached blocks. So allocate
|
||||
// the block memory.
|
||||
CacheBlock = MmHeapAlloc(sizeof(CACHE_BLOCK));
|
||||
CacheBlock = FrLdrTempAlloc(sizeof(CACHE_BLOCK), TAG_CACHE_BLOCK);
|
||||
if (CacheBlock == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -110,18 +110,19 @@ PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNu
|
|||
// allocate room for the block data
|
||||
RtlZeroMemory(CacheBlock, sizeof(CACHE_BLOCK));
|
||||
CacheBlock->BlockNumber = BlockNumber;
|
||||
CacheBlock->BlockData = MmHeapAlloc(CacheDrive->BlockSize * CacheDrive->BytesPerSector);
|
||||
CacheBlock->BlockData = FrLdrTempAlloc(CacheDrive->BlockSize * CacheDrive->BytesPerSector,
|
||||
TAG_CACHE_DATA);
|
||||
if (CacheBlock->BlockData ==NULL)
|
||||
{
|
||||
MmHeapFree(CacheBlock);
|
||||
FrLdrTempFree(CacheBlock, TAG_CACHE_BLOCK);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Now try to read in the block
|
||||
if (!MachDiskReadLogicalSectors(CacheDrive->DriveNumber, (BlockNumber * CacheDrive->BlockSize), CacheDrive->BlockSize, (PVOID)DISKREADBUFFER))
|
||||
{
|
||||
MmHeapFree(CacheBlock->BlockData);
|
||||
MmHeapFree(CacheBlock);
|
||||
FrLdrTempFree(CacheBlock->BlockData, TAG_CACHE_DATA);
|
||||
FrLdrTempFree(CacheBlock, TAG_CACHE_BLOCK);
|
||||
return NULL;
|
||||
}
|
||||
RtlCopyMemory(CacheBlock->BlockData, (PVOID)DISKREADBUFFER, CacheDrive->BlockSize * CacheDrive->BytesPerSector);
|
||||
|
@ -163,8 +164,8 @@ BOOLEAN CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive)
|
|||
RemoveEntryList(&CacheBlockToFree->ListEntry);
|
||||
|
||||
// Free the block memory and the block structure
|
||||
MmHeapFree(CacheBlockToFree->BlockData);
|
||||
MmHeapFree(CacheBlockToFree);
|
||||
FrLdrTempFree(CacheBlockToFree->BlockData, TAG_CACHE_DATA);
|
||||
FrLdrTempFree(CacheBlockToFree, TAG_CACHE_BLOCK);
|
||||
|
||||
// Update the cache data
|
||||
CacheBlockCount--;
|
||||
|
|
8
reactos/boot/freeldr/freeldr/cache/cache.c
vendored
8
reactos/boot/freeldr/freeldr/cache/cache.c
vendored
|
@ -72,8 +72,8 @@ BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
|
|||
CACHE_BLOCK,
|
||||
ListEntry);
|
||||
|
||||
MmHeapFree(NextCacheBlock->BlockData);
|
||||
MmHeapFree(NextCacheBlock);
|
||||
FrLdrTempFree(NextCacheBlock->BlockData, TAG_CACHE_DATA);
|
||||
FrLdrTempFree(NextCacheBlock, TAG_CACHE_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,9 @@ BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
|
|||
CacheBlockCount = 0;
|
||||
CacheSizeLimit = TotalPagesInLookupTable / 8 * MM_PAGE_SIZE;
|
||||
CacheSizeCurrent = 0;
|
||||
if (CacheSizeLimit < (64 * 1024))
|
||||
if (CacheSizeLimit > TEMP_HEAP_SIZE - (128 * 1024))
|
||||
{
|
||||
CacheSizeLimit = (64 * 1024);
|
||||
CacheSizeLimit = TEMP_HEAP_SIZE - (128 * 1024);
|
||||
}
|
||||
|
||||
CacheManagerInitialized = TRUE;
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
|
||||
#define SCSI_PORT_NEXT_REQUEST_READY 0x0008
|
||||
|
||||
#define TAG_SCSI_DEVEXT 'DscS'
|
||||
#define TAG_SCSI_ACCESS_RANGES 'AscS'
|
||||
|
||||
DBG_DEFAULT_CHANNEL(SCSIPORT);
|
||||
|
||||
typedef struct
|
||||
|
@ -1097,7 +1100,7 @@ ScsiPortInitialize(
|
|||
Again = FALSE;
|
||||
|
||||
DeviceExtensionSize = sizeof(SCSI_PORT_DEVICE_EXTENSION) + HwInitializationData->DeviceExtensionSize;
|
||||
DeviceExtension = MmHeapAlloc(DeviceExtensionSize);
|
||||
DeviceExtension = FrLdrTempAlloc(DeviceExtensionSize, TAG_SCSI_DEVEXT);
|
||||
if (!DeviceExtension)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
|
@ -1116,15 +1119,16 @@ ScsiPortInitialize(
|
|||
FirstConfigCall);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
PortConfig.NumberOfAccessRanges = HwInitializationData->NumberOfAccessRanges;
|
||||
PortConfig.AccessRanges = MmHeapAlloc(sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges);
|
||||
PortConfig.AccessRanges = FrLdrTempAlloc(sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges,
|
||||
TAG_SCSI_ACCESS_RANGES);
|
||||
if (!PortConfig.AccessRanges)
|
||||
{
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
RtlZeroMemory(PortConfig.AccessRanges, sizeof(ACCESS_RANGE) * HwInitializationData->NumberOfAccessRanges);
|
||||
|
@ -1151,14 +1155,14 @@ ScsiPortInitialize(
|
|||
&SlotNumber))
|
||||
{
|
||||
/* Continue to the next bus, nothing here */
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
if (!PortConfig.BusInterruptLevel)
|
||||
{
|
||||
/* Bypass this slot, because no interrupt was assigned */
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -1171,7 +1175,7 @@ ScsiPortInitialize(
|
|||
&PortConfig,
|
||||
&Again) != SP_RETURN_FOUND)
|
||||
{
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1189,7 +1193,7 @@ ScsiPortInitialize(
|
|||
/* Initialize adapter */
|
||||
if (!DeviceExtension->HwInitialize(DeviceExtension->MiniPortDeviceExtension))
|
||||
{
|
||||
MmHeapFree(DeviceExtension);
|
||||
FrLdrTempFree(DeviceExtension, TAG_SCSI_DEVEXT);
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,12 @@ ULONG Ext2GroupCount = 0; // Number of groups
|
|||
ULONG Ext2InodesPerBlock = 0; // Number of inodes in one block
|
||||
ULONG Ext2GroupDescPerBlock = 0; // Number of group descriptors in one block
|
||||
|
||||
#define TAG_EXT_BLOCK_LIST 'LtxE'
|
||||
#define TAG_EXT_FILE 'FtxE'
|
||||
#define TAG_EXT_BUFFER 'BtxE'
|
||||
#define TAG_EXT_SUPER_BLOCK 'StxE'
|
||||
#define TAG_EXT_GROUP_DESC 'GtxE'
|
||||
|
||||
BOOLEAN DiskGetBootVolume(PUCHAR DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
|
||||
{
|
||||
*DriveNumber = 0;
|
||||
|
@ -143,7 +149,7 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
|
|||
{
|
||||
if (TempExt2FileInfo.FileBlockList != NULL)
|
||||
{
|
||||
MmHeapFree(TempExt2FileInfo.FileBlockList);
|
||||
FrLdrTempFree(TempExt2FileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -185,20 +191,20 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
|
|||
|
||||
if (TempExt2FileInfo.FileBlockList != NULL)
|
||||
{
|
||||
MmHeapFree(TempExt2FileInfo.FileBlockList);
|
||||
FrLdrTempFree(TempExt2FileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
}
|
||||
|
||||
return Ext2OpenFile(FullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileHandle = MmHeapAlloc(sizeof(EXT2_FILE_INFO));
|
||||
FileHandle = FrLdrTempAlloc(sizeof(EXT2_FILE_INFO), TAG_EXT_FILE);
|
||||
|
||||
if (FileHandle == NULL)
|
||||
{
|
||||
if (TempExt2FileInfo.FileBlockList != NULL)
|
||||
{
|
||||
MmHeapFree(TempExt2FileInfo.FileBlockList);
|
||||
FrLdrTempFree(TempExt2FileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -267,11 +273,11 @@ BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
|
|||
//
|
||||
if (!Ext2SearchDirectoryBufferForFile(DirectoryBuffer, (ULONG)Ext2GetInodeFileSize(&InodeData), PathPart, &DirectoryEntry))
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_EXT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_EXT_BUFFER);
|
||||
|
||||
DirectoryInode = DirectoryEntry.inode;
|
||||
}
|
||||
|
@ -580,7 +586,7 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
|
|||
//
|
||||
if (Ext2SuperBlock != NULL)
|
||||
{
|
||||
MmHeapFree(Ext2SuperBlock);
|
||||
FrLdrTempFree(Ext2SuperBlock, TAG_EXT_SUPER_BLOCK);
|
||||
|
||||
Ext2SuperBlock = NULL;
|
||||
}
|
||||
|
@ -588,7 +594,7 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
|
|||
//
|
||||
// Now allocate the memory to hold the super block
|
||||
//
|
||||
Ext2SuperBlock = (PEXT2_SUPER_BLOCK)MmHeapAlloc(1024);
|
||||
Ext2SuperBlock = (PEXT2_SUPER_BLOCK)FrLdrTempAlloc(1024, TAG_EXT_SUPER_BLOCK);
|
||||
|
||||
//
|
||||
// Make sure we got the memory
|
||||
|
@ -731,7 +737,7 @@ BOOLEAN Ext2ReadGroupDescriptors(VOID)
|
|||
//
|
||||
if (Ext2GroupDescriptors != NULL)
|
||||
{
|
||||
MmHeapFree(Ext2GroupDescriptors);
|
||||
FrLdrTempFree(Ext2GroupDescriptors, TAG_EXT_GROUP_DESC);
|
||||
|
||||
Ext2GroupDescriptors = NULL;
|
||||
}
|
||||
|
@ -740,7 +746,7 @@ BOOLEAN Ext2ReadGroupDescriptors(VOID)
|
|||
// Now allocate the memory to hold the group descriptors
|
||||
//
|
||||
GroupDescBlockCount = ROUND_UP(Ext2GroupCount, Ext2GroupDescPerBlock) / Ext2GroupDescPerBlock;
|
||||
Ext2GroupDescriptors = (PEXT2_GROUP_DESC)MmHeapAlloc(GroupDescBlockCount * Ext2BlockSizeInBytes);
|
||||
Ext2GroupDescriptors = (PEXT2_GROUP_DESC)FrLdrTempAlloc(GroupDescBlockCount * Ext2BlockSizeInBytes, TAG_EXT_GROUP_DESC);
|
||||
|
||||
//
|
||||
// Make sure we got the memory
|
||||
|
@ -804,14 +810,14 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode
|
|||
// Now allocate the memory to hold the group descriptors
|
||||
//
|
||||
ASSERT(DirectoryFileInfo.FileSize <= 0xFFFFFFFF);
|
||||
*DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc((ULONG)DirectoryFileInfo.FileSize);
|
||||
*DirectoryBuffer = (PEXT2_DIR_ENTRY)FrLdrTempAlloc((ULONG)DirectoryFileInfo.FileSize, TAG_EXT_BUFFER);
|
||||
|
||||
//
|
||||
// Make sure we got the memory
|
||||
//
|
||||
if (*DirectoryBuffer == NULL)
|
||||
{
|
||||
MmHeapFree(DirectoryFileInfo.FileBlockList);
|
||||
FrLdrTempFree(DirectoryFileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
FileSystemError("Out of memory.");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -819,13 +825,13 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode
|
|||
// Now read the root directory data
|
||||
if (!Ext2ReadFileBig(&DirectoryFileInfo, DirectoryFileInfo.FileSize, NULL, *DirectoryBuffer))
|
||||
{
|
||||
MmHeapFree(*DirectoryBuffer);
|
||||
FrLdrTempFree(*DirectoryBuffer, TAG_EXT_BUFFER);
|
||||
*DirectoryBuffer = NULL;
|
||||
MmHeapFree(DirectoryFileInfo.FileBlockList);
|
||||
FrLdrTempFree(DirectoryFileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MmHeapFree(DirectoryFileInfo.FileBlockList);
|
||||
FrLdrTempFree(DirectoryFileInfo.FileBlockList, TAG_EXT_BLOCK_LIST);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -866,9 +872,7 @@ BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Leng
|
|||
|
||||
TRACE("Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer);
|
||||
|
||||
TempBuffer = FrLdrHeapAllocate(FrLdrTempHeap,
|
||||
Ext2BlockSizeInBytes,
|
||||
'2TXE');
|
||||
TempBuffer = FrLdrTempAlloc(Ext2BlockSizeInBytes, TAG_EXT_BUFFER);
|
||||
|
||||
if (!Ext2ReadBlock(BlockNumber, TempBuffer))
|
||||
{
|
||||
|
@ -877,7 +881,7 @@ BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Leng
|
|||
|
||||
memcpy(Buffer, ((PUCHAR)TempBuffer + StartingOffset), Length);
|
||||
|
||||
FrLdrHeapFree(FrLdrTempHeap, TempBuffer, '2TXE');
|
||||
FrLdrTempFree(TempBuffer, TAG_EXT_BUFFER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1029,7 +1033,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
|
|||
BlockCount = (ULONG)(FileSize / Ext2BlockSizeInBytes);
|
||||
|
||||
// Allocate the memory for the block list
|
||||
BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG));
|
||||
BlockList = FrLdrTempAlloc(BlockCount * sizeof(ULONG), TAG_EXT_BLOCK_LIST);
|
||||
if (BlockList == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -1050,7 +1054,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
|
|||
{
|
||||
if (!Ext2CopyIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.indir_block))
|
||||
{
|
||||
MmHeapFree(BlockList);
|
||||
FrLdrTempFree(BlockList, TAG_EXT_BLOCK_LIST);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1060,7 +1064,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
|
|||
{
|
||||
if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.double_indir_block))
|
||||
{
|
||||
MmHeapFree(BlockList);
|
||||
FrLdrTempFree(BlockList, TAG_EXT_BLOCK_LIST);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1070,7 +1074,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
|
|||
{
|
||||
if (!Ext2CopyTripleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.tripple_indir_block))
|
||||
{
|
||||
MmHeapFree(BlockList);
|
||||
FrLdrTempFree(BlockList, TAG_EXT_BLOCK_LIST);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1100,9 +1104,7 @@ BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInLis
|
|||
|
||||
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
|
||||
|
||||
BlockBuffer = FrLdrHeapAllocate(FrLdrTempHeap,
|
||||
Ext2BlockSizeInBytes,
|
||||
'2TXE');
|
||||
BlockBuffer = FrLdrTempAlloc(Ext2BlockSizeInBytes, TAG_EXT_BUFFER);
|
||||
if (!BlockBuffer)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -1119,7 +1121,7 @@ BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInLis
|
|||
(*CurrentBlockInList)++;
|
||||
}
|
||||
|
||||
FrLdrHeapFree(FrLdrTempHeap, BlockBuffer, '2TXE');
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1134,7 +1136,7 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
|
||||
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
|
||||
|
||||
BlockBuffer = (ULONG*)MmHeapAlloc(Ext2BlockSizeInBytes);
|
||||
BlockBuffer = (ULONG*)FrLdrTempAlloc(Ext2BlockSizeInBytes, TAG_EXT_BUFFER);
|
||||
if (BlockBuffer == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -1142,7 +1144,7 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
|
||||
if (!Ext2ReadBlock(DoubleIndirectBlock, BlockBuffer))
|
||||
{
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1150,12 +1152,12 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
{
|
||||
if (!Ext2CopyIndirectBlockPointers(BlockList, CurrentBlockInList, BlockCount, BlockBuffer[CurrentBlock]))
|
||||
{
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1169,7 +1171,7 @@ BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
|
||||
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
|
||||
|
||||
BlockBuffer = (ULONG*)MmHeapAlloc(Ext2BlockSizeInBytes);
|
||||
BlockBuffer = (ULONG*)FrLdrTempAlloc(Ext2BlockSizeInBytes, TAG_EXT_BUFFER);
|
||||
if (BlockBuffer == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -1177,7 +1179,7 @@ BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
|
||||
if (!Ext2ReadBlock(TripleIndirectBlock, BlockBuffer))
|
||||
{
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1185,12 +1187,12 @@ BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
|
|||
{
|
||||
if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, CurrentBlockInList, BlockCount, BlockBuffer[CurrentBlock]))
|
||||
{
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
MmHeapFree(BlockBuffer);
|
||||
FrLdrTempFree(BlockBuffer, TAG_EXT_BUFFER);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1200,7 @@ LONG Ext2Close(ULONG FileId)
|
|||
{
|
||||
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
||||
|
||||
MmHeapFree(FileHandle);
|
||||
FrLdrTempFree(FileHandle, TAG_EXT_FILE);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,11 @@ BOOLEAN FatReadClusterChain(PFAT_VOLUME_INFO Volume, ULONG StartClusterNumber
|
|||
BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer);
|
||||
BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer);
|
||||
|
||||
#define TAG_FAT_CHAIN 'CtaT'
|
||||
#define TAG_FAT_FILE 'FtaF'
|
||||
#define TAG_FAT_VOLUME 'VtaF'
|
||||
#define TAG_FAT_BUFFER 'BtaF'
|
||||
|
||||
typedef struct _FAT_VOLUME_INFO
|
||||
{
|
||||
ULONG BytesPerSector; /* Number of bytes per sector */
|
||||
|
@ -431,7 +436,8 @@ PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, U
|
|||
// Attempt to allocate memory for directory buffer
|
||||
//
|
||||
TRACE("Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize);
|
||||
DirectoryBuffer = MmHeapAlloc(*DirectorySize + sizeof(DIRECTORY_BUFFER));
|
||||
DirectoryBuffer = FrLdrTempAlloc(*DirectorySize + sizeof(DIRECTORY_BUFFER),
|
||||
TAG_FAT_BUFFER);
|
||||
|
||||
if (DirectoryBuffer == NULL)
|
||||
{
|
||||
|
@ -445,7 +451,7 @@ PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, U
|
|||
{
|
||||
if (!FatReadVolumeSectors(Volume, Volume->RootDirSectorStart, Volume->RootDirSectors, DirectoryBuffer->Data))
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_FAT_BUFFER);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +459,7 @@ PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, U
|
|||
{
|
||||
if (!FatReadClusterChain(Volume, DirectoryStartCluster, 0xFFFFFFFF, DirectoryBuffer->Data))
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_FAT_BUFFER);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -831,11 +837,11 @@ LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT
|
|||
//
|
||||
if (!(FatFileInfo.Attributes & ATTR_DIRECTORY))
|
||||
{
|
||||
MmHeapFree(FatFileInfo.FileFatChain);
|
||||
FrLdrTempFree(FatFileInfo.FileFatChain, TAG_FAT_CHAIN);
|
||||
return ENOTDIR;
|
||||
}
|
||||
DirectoryStartCluster = FatFileInfo.FileFatChain[0];
|
||||
MmHeapFree(FatFileInfo.FileFatChain);
|
||||
FrLdrTempFree(FatFileInfo.FileFatChain, TAG_FAT_CHAIN);
|
||||
FatFileInfo.FileFatChain = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -911,9 +917,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
|||
//TRACE("FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
|
||||
|
||||
// We need a buffer for 2 secors
|
||||
ReadBuffer = FrLdrHeapAllocate(FrLdrTempHeap,
|
||||
2 * Volume->BytesPerSector,
|
||||
'xTAF');
|
||||
ReadBuffer = FrLdrTempAlloc(2 * Volume->BytesPerSector, TAG_FAT_BUFFER);
|
||||
if (!ReadBuffer)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -999,7 +1003,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
|||
|
||||
//TRACE("FAT entry is 0x%x.\n", fat);
|
||||
|
||||
FrLdrHeapFree(FrLdrTempHeap, ReadBuffer, 'xTAF');
|
||||
FrLdrTempFree(ReadBuffer, TAG_FAT_BUFFER);
|
||||
|
||||
*ClusterPointer = fat;
|
||||
|
||||
|
@ -1058,7 +1062,7 @@ ULONG* FatGetClusterChainArray(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
|
|||
//
|
||||
// Allocate array memory
|
||||
//
|
||||
ArrayPointer = MmHeapAlloc(ArraySize);
|
||||
ArrayPointer = FrLdrTempAlloc(ArraySize, TAG_FAT_CHAIN);
|
||||
|
||||
if (ArrayPointer == NULL)
|
||||
{
|
||||
|
@ -1091,7 +1095,7 @@ ULONG* FatGetClusterChainArray(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
|
|||
//
|
||||
if (!FatGetFatEntry(Volume, StartCluster, &StartCluster))
|
||||
{
|
||||
MmHeapFree(ArrayPointer);
|
||||
FrLdrTempFree(ArrayPointer, TAG_FAT_CHAIN);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1183,7 +1187,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
|
|||
// Calculate rounded up read size
|
||||
ReadSize = SectorCount * Volume->BytesPerSector;
|
||||
|
||||
ReadBuffer = FrLdrHeapAllocate(FrLdrTempHeap, ReadSize, 'xTAF');
|
||||
ReadBuffer = FrLdrTempAlloc(ReadSize, TAG_FAT_BUFFER);
|
||||
if (!ReadBuffer)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -1195,7 +1199,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
|
|||
status = TRUE;
|
||||
}
|
||||
|
||||
FrLdrHeapFree(FrLdrTempHeap, ReadBuffer, 'xTAF');
|
||||
FrLdrTempFree(ReadBuffer, TAG_FAT_BUFFER);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1397,8 +1401,8 @@ LONG FatClose(ULONG FileId)
|
|||
{
|
||||
PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
||||
|
||||
if (FileHandle->FileFatChain) MmHeapFree(FileHandle->FileFatChain);
|
||||
MmHeapFree(FileHandle);
|
||||
if (FileHandle->FileFatChain) FrLdrTempFree(FileHandle->FileFatChain, TAG_FAT_CHAIN);
|
||||
FrLdrTempFree(FileHandle, TAG_FAT_FILE);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
@ -1450,7 +1454,7 @@ LONG FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
else if (!IsDirectory && OpenMode != OpenReadOnly)
|
||||
return ENOTDIR;
|
||||
|
||||
FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO));
|
||||
FileHandle = FrLdrTempAlloc(sizeof(FAT_FILE_INFO), TAG_FAT_FILE);
|
||||
if (!FileHandle)
|
||||
return ENOMEM;
|
||||
|
||||
|
@ -1523,7 +1527,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
|||
//
|
||||
// Allocate data for volume information
|
||||
//
|
||||
Volume = MmHeapAlloc(sizeof(FAT_VOLUME_INFO));
|
||||
Volume = FrLdrTempAlloc(sizeof(FAT_VOLUME_INFO), TAG_FAT_VOLUME);
|
||||
if (!Volume)
|
||||
return NULL;
|
||||
RtlZeroMemory(Volume, sizeof(FAT_VOLUME_INFO));
|
||||
|
@ -1536,13 +1540,13 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
|||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||
if (ret != ESUCCESS)
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
ret = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
|
||||
if (ret != ESUCCESS || Count != sizeof(Buffer))
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1554,7 +1558,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
|||
!RtlEqualMemory(BootSector32->FileSystemType, "FAT32 ", 8) &&
|
||||
!RtlEqualMemory(BootSectorX->FileSystemType, "FATX", 4))
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1568,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
|||
ret = ArcGetFileInformation(DeviceId, &FileInformation);
|
||||
if (ret != ESUCCESS)
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
SectorCount.HighPart = FileInformation.EndingAddress.HighPart;
|
||||
|
@ -1581,7 +1585,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
|||
//
|
||||
if (!FatOpenVolume(Volume, BootSector, SectorCount.QuadPart))
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
DBG_DEFAULT_CHANNEL(FILESYSTEM);
|
||||
|
||||
#define TAG_DEVICE_NAME 'NDsF'
|
||||
#define TAG_DEVICE 'vDsF'
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -280,7 +283,7 @@ LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
Length = FileName - Path + Count;
|
||||
if (Count != 0)
|
||||
{
|
||||
DeviceName = MmHeapAlloc(FileName - Path + Count);
|
||||
DeviceName = FrLdrTempAlloc(FileName - Path + Count, TAG_DEVICE_NAME);
|
||||
if (!DeviceName)
|
||||
return ENOMEM;
|
||||
for (p = Path, q = DeviceName; p != FileName; p++)
|
||||
|
@ -417,7 +420,7 @@ VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable)
|
|||
TRACE("FsRegisterDevice() Prefix = %s\n", Prefix);
|
||||
|
||||
Length = strlen(Prefix) + 1;
|
||||
pNewEntry = MmHeapAlloc(sizeof(DEVICE) + Length);
|
||||
pNewEntry = FrLdrTempAlloc(sizeof(DEVICE) + Length, TAG_DEVICE);
|
||||
if (!pNewEntry)
|
||||
return;
|
||||
pNewEntry->FuncTable = FuncTable;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <debug.h>
|
||||
|
||||
#define SECTORSIZE 2048
|
||||
#define TAG_ISO_BUFFER 'BosI'
|
||||
#define TAG_ISO_FILE 'FosI'
|
||||
|
||||
DBG_DEFAULT_CHANNEL(FILESYSTEM);
|
||||
|
||||
|
@ -112,7 +114,7 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
|
|||
// Attempt to allocate memory for directory buffer
|
||||
//
|
||||
TRACE("Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength);
|
||||
DirectoryBuffer = MmHeapAlloc(DirectoryLength);
|
||||
DirectoryBuffer = FrLdrTempAlloc(DirectoryLength, TAG_ISO_BUFFER);
|
||||
if (!DirectoryBuffer)
|
||||
return ENOMEM;
|
||||
|
||||
|
@ -124,13 +126,13 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
|
|||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||
if (ret != ESUCCESS)
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
ret = ArcRead(DeviceId, DirectoryBuffer, SectorCount * SECTORSIZE, &Count);
|
||||
if (ret != ESUCCESS || Count != SectorCount * SECTORSIZE)
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||
return EIO;
|
||||
}
|
||||
|
||||
|
@ -215,11 +217,11 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
|
|||
//
|
||||
if (!IsoSearchDirectoryBufferForFile(DirectoryBuffer, DirectoryLength, PathPart, &IsoFileInfo))
|
||||
{
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
MmHeapFree(DirectoryBuffer);
|
||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||
|
||||
//
|
||||
// If we have another sub-directory to go then
|
||||
|
@ -242,7 +244,7 @@ LONG IsoClose(ULONG FileId)
|
|||
{
|
||||
PISO_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
||||
|
||||
MmHeapFree(FileHandle);
|
||||
FrLdrTempFree(FileHandle, TAG_ISO_FILE);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
@ -280,7 +282,7 @@ LONG IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
if (ret != ESUCCESS)
|
||||
return ENOENT;
|
||||
|
||||
FileHandle = MmHeapAlloc(sizeof(ISO_FILE_INFO));
|
||||
FileHandle = FrLdrTempAlloc(sizeof(ISO_FILE_INFO), TAG_ISO_FILE);
|
||||
if (!FileHandle)
|
||||
return ENOMEM;
|
||||
|
||||
|
|
|
@ -28,6 +28,15 @@
|
|||
#include <freeldr.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define TAG_NTFS_CONTEXT 'CftN'
|
||||
#define TAG_NTFS_LIST 'LftN'
|
||||
#define TAG_NTFS_MFT 'MftN'
|
||||
#define TAG_NTFS_INDEX_REC 'IftN'
|
||||
#define TAG_NTFS_BITMAP 'BftN'
|
||||
#define TAG_NTFS_FILE 'FftN'
|
||||
#define TAG_NTFS_VOLUME 'VftN'
|
||||
#define TAG_NTFS_DATA 'DftN'
|
||||
|
||||
DBG_DEFAULT_CHANNEL(FILESYSTEM);
|
||||
|
||||
typedef struct _NTFS_VOLUME_INFO
|
||||
|
@ -98,7 +107,8 @@ static PNTFS_ATTR_CONTEXT NtfsPrepareAttributeContext(PNTFS_ATTR_RECORD AttrReco
|
|||
{
|
||||
PNTFS_ATTR_CONTEXT Context;
|
||||
|
||||
Context = MmHeapAlloc(FIELD_OFFSET(NTFS_ATTR_CONTEXT, Record) + AttrRecord->Length);
|
||||
Context = FrLdrTempAlloc(FIELD_OFFSET(NTFS_ATTR_CONTEXT, Record) + AttrRecord->Length,
|
||||
TAG_NTFS_CONTEXT);
|
||||
RtlCopyMemory(&Context->Record, AttrRecord, AttrRecord->Length);
|
||||
if (AttrRecord->IsNonResident)
|
||||
{
|
||||
|
@ -129,7 +139,7 @@ static PNTFS_ATTR_CONTEXT NtfsPrepareAttributeContext(PNTFS_ATTR_RECORD AttrReco
|
|||
|
||||
static VOID NtfsReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
|
||||
{
|
||||
MmHeapFree(Context);
|
||||
FrLdrTempFree(Context, TAG_NTFS_CONTEXT);
|
||||
}
|
||||
|
||||
static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLONG Length, PCHAR Buffer)
|
||||
|
@ -384,7 +394,7 @@ static PNTFS_ATTR_CONTEXT NtfsFindAttributeHelper(PNTFS_VOLUME_INFO Volume, PNTF
|
|||
|
||||
ListSize = NtfsGetAttributeSize(&ListContext->Record);
|
||||
if(ListSize <= 0xFFFFFFFF)
|
||||
ListBuffer = MmHeapAlloc((ULONG)ListSize);
|
||||
ListBuffer = FrLdrTempAlloc((ULONG)ListSize, TAG_NTFS_LIST);
|
||||
else
|
||||
ListBuffer = NULL;
|
||||
|
||||
|
@ -403,7 +413,7 @@ static PNTFS_ATTR_CONTEXT NtfsFindAttributeHelper(PNTFS_VOLUME_INFO Volume, PNTF
|
|||
Type, Name, NameLength);
|
||||
|
||||
NtfsReleaseAttributeContext(ListContext);
|
||||
MmHeapFree(ListBuffer);
|
||||
FrLdrTempFree(ListBuffer, TAG_NTFS_LIST);
|
||||
|
||||
if (Context != NULL)
|
||||
return Context;
|
||||
|
@ -551,7 +561,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
ULONG RecordOffset;
|
||||
ULONG IndexBlockSize;
|
||||
|
||||
MftRecord = MmHeapAlloc(Volume->MftRecordSize);
|
||||
MftRecord = FrLdrTempAlloc(Volume->MftRecordSize, TAG_NTFS_MFT);
|
||||
if (MftRecord == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -564,14 +574,14 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
IndexRootCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ROOT, L"$I30");
|
||||
if (IndexRootCtx == NULL)
|
||||
{
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
IndexRecord = MmHeapAlloc(Volume->IndexRecordSize);
|
||||
IndexRecord = FrLdrTempAlloc(Volume->IndexRecordSize, TAG_NTFS_INDEX_REC);
|
||||
if (IndexRecord == NULL)
|
||||
{
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -590,8 +600,8 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
if (NtfsCompareFileName(FileName, IndexEntry))
|
||||
{
|
||||
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
|
||||
MmHeapFree(IndexRecord);
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return TRUE;
|
||||
}
|
||||
IndexEntry = (PNTFS_INDEX_ENTRY)((PCHAR)IndexEntry + IndexEntry->Length);
|
||||
|
@ -607,20 +617,20 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
if (IndexBitmapCtx == NULL)
|
||||
{
|
||||
TRACE("Corrupted filesystem!\n");
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return FALSE;
|
||||
}
|
||||
BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record);
|
||||
TRACE("BitmapDataSize: %x\n", (ULONG)BitmapDataSize);
|
||||
if(BitmapDataSize <= 0xFFFFFFFF)
|
||||
BitmapData = MmHeapAlloc((ULONG)BitmapDataSize);
|
||||
BitmapData = FrLdrTempAlloc((ULONG)BitmapDataSize, TAG_NTFS_BITMAP);
|
||||
else
|
||||
BitmapData = NULL;
|
||||
|
||||
if (BitmapData == NULL)
|
||||
{
|
||||
MmHeapFree(IndexRecord);
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return FALSE;
|
||||
}
|
||||
NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize);
|
||||
|
@ -630,9 +640,9 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
if (IndexAllocationCtx == NULL)
|
||||
{
|
||||
TRACE("Corrupted filesystem!\n");
|
||||
MmHeapFree(BitmapData);
|
||||
MmHeapFree(IndexRecord);
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(BitmapData, TAG_NTFS_BITMAP);
|
||||
FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
return FALSE;
|
||||
}
|
||||
IndexAllocationSize = NtfsGetAttributeSize(&IndexAllocationCtx->Record);
|
||||
|
@ -674,9 +684,9 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
{
|
||||
TRACE("File found\n");
|
||||
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
|
||||
MmHeapFree(BitmapData);
|
||||
MmHeapFree(IndexRecord);
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(BitmapData, TAG_NTFS_BITMAP);
|
||||
FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
NtfsReleaseAttributeContext(IndexAllocationCtx);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -687,16 +697,16 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
|
|||
}
|
||||
|
||||
NtfsReleaseAttributeContext(IndexAllocationCtx);
|
||||
MmHeapFree(BitmapData);
|
||||
FrLdrTempFree(BitmapData, TAG_NTFS_BITMAP);
|
||||
}
|
||||
|
||||
MmHeapFree(IndexRecord);
|
||||
FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Can't read MFT record\n");
|
||||
}
|
||||
MmHeapFree(MftRecord);
|
||||
FrLdrTempFree(MftRecord, TAG_NTFS_MFT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -750,7 +760,7 @@ LONG NtfsClose(ULONG FileId)
|
|||
PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
|
||||
|
||||
NtfsReleaseAttributeContext(FileHandle->DataContext);
|
||||
MmHeapFree(FileHandle);
|
||||
FrLdrTempFree(FileHandle, TAG_NTFS_FILE);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
|
@ -795,7 +805,8 @@ LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
//
|
||||
// Allocate file structure
|
||||
//
|
||||
FileHandle = MmHeapAlloc(sizeof(NTFS_FILE_HANDLE) + Volume->MftRecordSize);
|
||||
FileHandle = FrLdrTempAlloc(sizeof(NTFS_FILE_HANDLE) + Volume->MftRecordSize,
|
||||
TAG_NTFS_FILE);
|
||||
if (!FileHandle)
|
||||
{
|
||||
return ENOMEM;
|
||||
|
@ -809,7 +820,7 @@ LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1);
|
||||
if (!NtfsLookupFile(Volume, Path, MftRecord, &FileHandle->DataContext))
|
||||
{
|
||||
MmHeapFree(FileHandle);
|
||||
FrLdrTempFree(FileHandle, TAG_NTFS_FILE);
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
|
@ -874,7 +885,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
//
|
||||
// Allocate data for volume information
|
||||
//
|
||||
Volume = MmHeapAlloc(sizeof(NTFS_VOLUME_INFO));
|
||||
Volume = FrLdrTempAlloc(sizeof(NTFS_VOLUME_INFO), TAG_NTFS_VOLUME);
|
||||
if (!Volume)
|
||||
return NULL;
|
||||
RtlZeroMemory(Volume, sizeof(NTFS_VOLUME_INFO));
|
||||
|
@ -887,13 +898,13 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||
if (ret != ESUCCESS)
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
ret = ArcRead(DeviceId, &Volume->BootSector, sizeof(Volume->BootSector), &Count);
|
||||
if (ret != ESUCCESS || Count != sizeof(Volume->BootSector))
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -902,7 +913,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
//
|
||||
if (!RtlEqualMemory(Volume->BootSector.SystemId, "NTFS", 4))
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -929,10 +940,10 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
// Read MFT index
|
||||
//
|
||||
TRACE("Reading MFT index...\n");
|
||||
Volume->MasterFileTable = MmHeapAlloc(Volume->MftRecordSize);
|
||||
Volume->MasterFileTable = FrLdrTempAlloc(Volume->MftRecordSize, TAG_NTFS_MFT);
|
||||
if (!Volume->MasterFileTable)
|
||||
{
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
|
||||
|
@ -940,28 +951,28 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
if (ret != ESUCCESS)
|
||||
{
|
||||
FileSystemError("Failed to seek to Master File Table record.");
|
||||
MmHeapFree(Volume->MasterFileTable);
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
ret = ArcRead(DeviceId, Volume->MasterFileTable, Volume->MftRecordSize, &Count);
|
||||
if (ret != ESUCCESS || Count != Volume->MftRecordSize)
|
||||
{
|
||||
FileSystemError("Failed to read the Master File Table record.");
|
||||
MmHeapFree(Volume->MasterFileTable);
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Keep room to read partial sectors
|
||||
//
|
||||
Volume->TemporarySector = MmHeapAlloc(Volume->BootSector.BytesPerSector);
|
||||
Volume->TemporarySector = FrLdrTempAlloc(Volume->BootSector.BytesPerSector, TAG_NTFS_DATA);
|
||||
if (!Volume->TemporarySector)
|
||||
{
|
||||
FileSystemError("Failed to allocate memory.");
|
||||
MmHeapFree(Volume->MasterFileTable);
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -978,8 +989,8 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
|||
if (!Volume->MFTContext)
|
||||
{
|
||||
FileSystemError("Can't find data attribute for Master File Table.");
|
||||
MmHeapFree(Volume->MasterFileTable);
|
||||
MmHeapFree(Volume);
|
||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#define TAG_PXE_FILE 'FexP'
|
||||
#define NO_FILE ((ULONG)-1)
|
||||
|
||||
DBG_DEFAULT_CHANNEL(FILESYSTEM);
|
||||
|
@ -129,7 +130,7 @@ static LONG PxeClose(ULONG FileId)
|
|||
_OpenFile = NO_FILE;
|
||||
if (_CachedFile)
|
||||
{
|
||||
MmHeapFree(_CachedFile);
|
||||
FrLdrTempFree(_CachedFile, TAG_PXE_FILE);
|
||||
_CachedFile = NULL;
|
||||
}
|
||||
return ESUCCESS;
|
||||
|
@ -165,7 +166,7 @@ static LONG PxeOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
_FileSize = sizeData.FileSize;
|
||||
if (_FileSize < 1024 * 1024)
|
||||
{
|
||||
_CachedFile = MmHeapAlloc(_FileSize);
|
||||
_CachedFile = FrLdrTempAlloc(_FileSize, TAG_PXE_FILE);
|
||||
// Don't check for allocation failure, we support _CachedFile = NULL
|
||||
}
|
||||
_CachedLength = 0;
|
||||
|
@ -179,7 +180,7 @@ static LONG PxeOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
|||
{
|
||||
if (_CachedFile)
|
||||
{
|
||||
MmHeapFree(_CachedFile);
|
||||
FrLdrTempFree(_CachedFile, TAG_PXE_FILE);
|
||||
_CachedFile = NULL;
|
||||
}
|
||||
return ENOENT;
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define TAG_HW_RESOURCE_LIST 'lRwH'
|
||||
#define TAG_HW_DISK_CONTEXT 'cDwH'
|
||||
|
||||
#define HAS_OPTION_MENU_CUSTOM_BOOT
|
||||
#define HAS_OPTION_MENU_REBOOT
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define TAG_CACHE_DATA 'DcaC'
|
||||
#define TAG_CACHE_BLOCK 'BcaC'
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This structure describes a cached block element. The disk is divided up into
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
|
||||
#define INI_FILE_COMMENT_CHAR ';'
|
||||
|
||||
#define TAG_INI_FILE 'FinI'
|
||||
#define TAG_INI_SECTION 'SinI'
|
||||
#define TAG_INI_SECTION_ITEM 'IinI'
|
||||
#define TAG_INI_NAME 'NinI'
|
||||
#define TAG_INI_VALUE 'VinI'
|
||||
|
||||
// This structure describes a single .ini file item
|
||||
// The item format in the .ini file is:
|
||||
// Name=Value
|
||||
|
@ -75,3 +81,4 @@ BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHA
|
|||
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize);
|
||||
BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId);
|
||||
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue);
|
||||
VOID IniCleanup(VOID);
|
||||
|
|
|
@ -117,10 +117,10 @@ VOID MmFreeMemory(PVOID MemoryPointer);
|
|||
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
|
||||
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
|
||||
|
||||
PVOID MmHeapAlloc(SIZE_T MemorySize);
|
||||
VOID MmHeapFree(PVOID MemoryPointer);
|
||||
|
||||
/* Heap */
|
||||
#define DEFAULT_HEAP_SIZE (1024 * 1024)
|
||||
#define TEMP_HEAP_SIZE (32 * 1024 * 1024)
|
||||
|
||||
extern PVOID FrLdrDefaultHeap;
|
||||
extern PVOID FrLdrTempHeap;
|
||||
|
||||
|
@ -145,13 +145,44 @@ VOID
|
|||
FrLdrHeapCleanupAll(VOID);
|
||||
|
||||
PVOID
|
||||
FrLdrHeapAllocate(
|
||||
FrLdrHeapAllocateEx(
|
||||
PVOID HeapHandle,
|
||||
SIZE_T ByteSize,
|
||||
ULONG Tag);
|
||||
|
||||
VOID
|
||||
FrLdrHeapFree(
|
||||
FrLdrHeapFreeEx(
|
||||
PVOID HeapHandle,
|
||||
PVOID Pointer,
|
||||
ULONG Tag);
|
||||
|
||||
FORCEINLINE
|
||||
PVOID
|
||||
FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
|
||||
{
|
||||
return FrLdrHeapAllocateEx(FrLdrDefaultHeap, MemorySize, Tag);
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
|
||||
{
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, MemoryPointer, Tag);
|
||||
}
|
||||
|
||||
PVOID
|
||||
FORCEINLINE
|
||||
FrLdrTempAlloc(
|
||||
ULONG Size, ULONG Tag)
|
||||
{
|
||||
return FrLdrHeapAllocateEx(FrLdrTempHeap, Size, Tag);
|
||||
}
|
||||
|
||||
VOID
|
||||
FORCEINLINE
|
||||
FrLdrTempFree(
|
||||
PVOID Allocation, ULONG Tag)
|
||||
{
|
||||
FrLdrHeapFreeEx(FrLdrTempHeap, Allocation, Tag);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
#ifndef __REGISTRY_H
|
||||
#define __REGISTRY_H
|
||||
|
||||
#define TAG_REG_NAME 'NgeR'
|
||||
#define TAG_REG_KEY 'KgeR'
|
||||
#define TAG_REG_KEY_DATA 'DgeR'
|
||||
#define TAG_REG_VALUE 'VgeR'
|
||||
|
||||
typedef struct _REG_KEY
|
||||
{
|
||||
LIST_ENTRY KeyList;
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
#include <arc/setupblk.h>
|
||||
|
||||
#define TAG_WLDR_DTE 'eDlW'
|
||||
#define TAG_WLDR_BDE 'dBlW'
|
||||
#define TAG_WLDR_NAME 'mNlW'
|
||||
|
||||
/* Entry-point to kernel */
|
||||
typedef VOID (NTAPI *KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
/* actual string limit is MAX_INF_STRING_LENGTH+1 (plus terminating null) under Windows */
|
||||
#define MAX_STRING_LEN (MAX_INF_STRING_LENGTH+1)
|
||||
|
||||
#define TAG_INF_KEY 'KfnI'
|
||||
#define TAG_INF_FIELD 'ffnI'
|
||||
#define TAG_INF_LINE 'LfnI'
|
||||
#define TAG_INF_SECTION 'SfnI'
|
||||
#define TAG_INF_CACHE 'CfnI'
|
||||
#define TAG_INF_FILE 'FfnI'
|
||||
|
||||
typedef struct _INFCACHEFIELD
|
||||
{
|
||||
|
@ -158,7 +164,7 @@ InfpCacheFreeLine(
|
|||
Next = Line->Next;
|
||||
if (Line->Key != NULL)
|
||||
{
|
||||
MmHeapFree(Line->Key);
|
||||
FrLdrTempFree(Line->Key, TAG_INF_KEY);
|
||||
Line->Key = NULL;
|
||||
}
|
||||
|
||||
|
@ -166,12 +172,12 @@ InfpCacheFreeLine(
|
|||
while (Line->FirstField != NULL)
|
||||
{
|
||||
Field = Line->FirstField->Next;
|
||||
MmHeapFree(Line->FirstField);
|
||||
FrLdrTempFree(Line->FirstField, TAG_INF_FIELD);
|
||||
Line->FirstField = Field;
|
||||
}
|
||||
Line->LastField = NULL;
|
||||
|
||||
MmHeapFree(Line);
|
||||
FrLdrTempFree(Line, TAG_INF_LINE);
|
||||
|
||||
return Next;
|
||||
}
|
||||
|
@ -197,7 +203,7 @@ InfpCacheFreeSection(
|
|||
}
|
||||
Section->LastLine = NULL;
|
||||
|
||||
MmHeapFree(Section);
|
||||
FrLdrTempFree(Section, TAG_INF_SECTION);
|
||||
|
||||
return Next;
|
||||
}
|
||||
|
@ -250,7 +256,7 @@ InfpCacheAddSection(
|
|||
|
||||
/* Allocate and initialize the new section */
|
||||
Size = sizeof(INFCACHESECTION) + strlen(Name);
|
||||
Section = (PINFCACHESECTION)MmHeapAlloc(Size);
|
||||
Section = (PINFCACHESECTION)FrLdrTempAlloc(Size, TAG_INF_SECTION);
|
||||
if (Section == NULL)
|
||||
{
|
||||
// DPRINT("RtlAllocateHeap() failed\n");
|
||||
|
@ -290,7 +296,7 @@ InfpCacheAddLine(PINFCACHESECTION Section)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Line = (PINFCACHELINE)MmHeapAlloc(sizeof(INFCACHELINE));
|
||||
Line = (PINFCACHELINE)FrLdrTempAlloc(sizeof(INFCACHELINE), TAG_INF_LINE);
|
||||
if (Line == NULL)
|
||||
{
|
||||
// DPRINT("RtlAllocateHeap() failed\n");
|
||||
|
@ -328,7 +334,7 @@ InfpAddKeyToLine(
|
|||
if (Line->Key != NULL)
|
||||
return NULL;
|
||||
|
||||
Line->Key = MmHeapAlloc(strlen(Key) + 1);
|
||||
Line->Key = FrLdrTempAlloc(strlen(Key) + 1, TAG_INF_KEY);
|
||||
if (Line->Key == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -348,7 +354,7 @@ InfpAddFieldToLine(
|
|||
SIZE_T Size;
|
||||
|
||||
Size = sizeof(INFCACHEFIELD) + strlen(Data);
|
||||
Field = (PINFCACHEFIELD)MmHeapAlloc(Size);
|
||||
Field = (PINFCACHEFIELD)FrLdrTempAlloc(Size, TAG_INF_FIELD);
|
||||
if (Field == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -966,7 +972,7 @@ InfOpenFile(
|
|||
//
|
||||
// Allocate buffer to cache the file
|
||||
//
|
||||
FileBuffer = MmHeapAlloc(FileSize + 1);
|
||||
FileBuffer = FrLdrTempAlloc(FileSize + 1, TAG_INF_FILE);
|
||||
if (!FileBuffer)
|
||||
{
|
||||
ArcClose(FileId);
|
||||
|
@ -980,7 +986,7 @@ InfOpenFile(
|
|||
if ((ret != ESUCCESS) || (Count != FileSize))
|
||||
{
|
||||
ArcClose(FileId);
|
||||
MmHeapFree(FileBuffer);
|
||||
FrLdrTempFree(FileBuffer, TAG_INF_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -997,10 +1003,10 @@ InfOpenFile(
|
|||
//
|
||||
// Allocate infcache header
|
||||
//
|
||||
Cache = (PINFCACHE)MmHeapAlloc(sizeof(INFCACHE));
|
||||
Cache = (PINFCACHE)FrLdrTempAlloc(sizeof(INFCACHE), TAG_INF_CACHE);
|
||||
if (!Cache)
|
||||
{
|
||||
MmHeapFree(FileBuffer);
|
||||
FrLdrTempFree(FileBuffer, TAG_INF_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1018,14 +1024,14 @@ InfOpenFile(
|
|||
ErrorLine);
|
||||
if (!Success)
|
||||
{
|
||||
MmHeapFree(Cache);
|
||||
FrLdrTempFree(Cache, TAG_INF_CACHE);
|
||||
Cache = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Free file buffer, as it has been parsed
|
||||
//
|
||||
MmHeapFree(FileBuffer);
|
||||
FrLdrTempFree(FileBuffer, TAG_INF_FILE);
|
||||
|
||||
//
|
||||
// Return .inf parsed contents
|
||||
|
@ -1054,7 +1060,7 @@ InfCloseFile(HINF InfHandle)
|
|||
}
|
||||
Cache->LastSection = NULL;
|
||||
|
||||
MmHeapFree(Cache);
|
||||
FrLdrTempFree(Cache, TAG_INF_CACHE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ BOOLEAN IniFileInitialize(VOID)
|
|||
//
|
||||
// Allocate memory to cache the whole freeldr.ini
|
||||
//
|
||||
FreeLoaderIniFileData = MmHeapAlloc(FreeLoaderIniFileSize);
|
||||
FreeLoaderIniFileData = FrLdrTempAlloc(FreeLoaderIniFileSize, TAG_INI_FILE);
|
||||
if (!FreeLoaderIniFileData)
|
||||
{
|
||||
UiMessageBoxCritical("Out of memory while loading freeldr.ini.");
|
||||
|
@ -88,7 +88,7 @@ BOOLEAN IniFileInitialize(VOID)
|
|||
{
|
||||
UiMessageBoxCritical("Error while reading freeldr.ini.");
|
||||
ArcClose(FileId);
|
||||
MmHeapFree(FreeLoaderIniFileData);
|
||||
FrLdrTempFree(FreeLoaderIniFileData, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ BOOLEAN IniFileInitialize(VOID)
|
|||
// Do some cleanup, and return
|
||||
//
|
||||
ArcClose(FileId);
|
||||
MmHeapFree(FreeLoaderIniFileData);
|
||||
FrLdrTempFree(FreeLoaderIniFileData, TAG_INI_FILE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId)
|
|||
PINI_SECTION Section;
|
||||
|
||||
// Allocate a new section structure
|
||||
Section = MmHeapAlloc(sizeof(INI_SECTION));
|
||||
Section = FrLdrTempAlloc(sizeof(INI_SECTION), TAG_INI_SECTION);
|
||||
if (!Section)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -190,10 +190,10 @@ BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId)
|
|||
RtlZeroMemory(Section, sizeof(INI_SECTION));
|
||||
|
||||
// Allocate the section name buffer
|
||||
Section->SectionName = MmHeapAlloc(strlen(SectionName) + sizeof(CHAR));
|
||||
Section->SectionName = FrLdrTempAlloc(strlen(SectionName) + sizeof(CHAR), TAG_INI_NAME);
|
||||
if (!Section->SectionName)
|
||||
{
|
||||
MmHeapFree(Section);
|
||||
FrLdrTempFree(Section, TAG_INI_SECTION);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -209,13 +209,52 @@ BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
VOID IniFreeSection(PINI_SECTION Section)
|
||||
{
|
||||
PLIST_ENTRY ListEntry;
|
||||
PINI_SECTION_ITEM SectionItem;
|
||||
|
||||
// Loop while there are section items
|
||||
while (!IsListEmpty(&Section->SectionItemList))
|
||||
{
|
||||
// Remove the section item
|
||||
ListEntry = RemoveHeadList(&Section->SectionItemList);
|
||||
SectionItem = CONTAINING_RECORD(ListEntry, INI_SECTION_ITEM, ListEntry);
|
||||
|
||||
// Free it
|
||||
FrLdrTempFree(SectionItem->ItemName, TAG_INI_NAME);
|
||||
FrLdrTempFree(SectionItem->ItemValue, TAG_INI_VALUE);
|
||||
FrLdrTempFree(SectionItem, TAG_INI_SECTION_ITEM);
|
||||
}
|
||||
|
||||
FrLdrTempFree(Section->SectionName, TAG_INI_NAME);
|
||||
FrLdrTempFree(Section, TAG_INI_SECTION);
|
||||
}
|
||||
|
||||
VOID IniCleanup(VOID)
|
||||
{
|
||||
PLIST_ENTRY ListEntry;
|
||||
PINI_SECTION Section;
|
||||
|
||||
// Loop while there are sections
|
||||
while (!IsListEmpty(&IniFileSectionListHead))
|
||||
{
|
||||
// Remove the section
|
||||
ListEntry = RemoveHeadList(&IniFileSectionListHead);
|
||||
Section = CONTAINING_RECORD(ListEntry, INI_SECTION, ListEntry);
|
||||
|
||||
// Free it
|
||||
IniFreeSection(Section);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
|
||||
{
|
||||
PINI_SECTION Section = (PINI_SECTION)SectionId;
|
||||
PINI_SECTION_ITEM SectionItem;
|
||||
|
||||
// Allocate a new item structure
|
||||
SectionItem = MmHeapAlloc(sizeof(INI_SECTION_ITEM));
|
||||
SectionItem = FrLdrTempAlloc(sizeof(INI_SECTION_ITEM), TAG_INI_SECTION_ITEM);
|
||||
if (!SectionItem)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -224,19 +263,19 @@ BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCST
|
|||
RtlZeroMemory(SectionItem, sizeof(INI_SECTION_ITEM));
|
||||
|
||||
// Allocate the setting name buffer
|
||||
SectionItem->ItemName = MmHeapAlloc(strlen(SettingName) + 1);
|
||||
SectionItem->ItemName = FrLdrTempAlloc(strlen(SettingName) + 1, TAG_INI_NAME);
|
||||
if (!SectionItem->ItemName)
|
||||
{
|
||||
MmHeapFree(SectionItem);
|
||||
FrLdrTempFree(SectionItem, TAG_INI_SECTION_ITEM);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Allocate the setting value buffer
|
||||
SectionItem->ItemValue = MmHeapAlloc(strlen(SettingValue) + 1);
|
||||
SectionItem->ItemValue = FrLdrTempAlloc(strlen(SettingValue) + 1, TAG_INI_VALUE);
|
||||
if (!SectionItem->ItemValue)
|
||||
{
|
||||
MmHeapFree(SectionItem->ItemName);
|
||||
MmHeapFree(SectionItem);
|
||||
FrLdrTempFree(SectionItem->ItemName, TAG_INI_NAME);
|
||||
FrLdrTempFree(SectionItem, TAG_INI_SECTION_ITEM);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
|||
|
||||
// Start with an 80-byte buffer
|
||||
IniFileLineSize = 80;
|
||||
IniFileLine = MmHeapAlloc(IniFileLineSize);
|
||||
IniFileLine = FrLdrTempAlloc(IniFileLineSize, TAG_INI_FILE);
|
||||
if (!IniFileLine)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -63,8 +63,8 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
|||
if (IniFileLineSize < IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset))
|
||||
{
|
||||
IniFileLineSize = IniGetNextLineSize(IniFileData, IniFileSize, CurrentOffset);
|
||||
MmHeapFree(IniFileLine);
|
||||
IniFileLine = MmHeapAlloc(IniFileLineSize);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
IniFileLine = FrLdrTempAlloc(IniFileLineSize, TAG_INI_FILE);
|
||||
if (!IniFileLine)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -86,21 +86,21 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
|||
if (IniIsSectionName(IniFileLine, LineLength))
|
||||
{
|
||||
// Allocate a new section structure
|
||||
CurrentSection = MmHeapAlloc(sizeof(INI_SECTION));
|
||||
CurrentSection = FrLdrTempAlloc(sizeof(INI_SECTION), TAG_INI_SECTION);
|
||||
if (!CurrentSection)
|
||||
{
|
||||
MmHeapFree(IniFileLine);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RtlZeroMemory(CurrentSection, sizeof(INI_SECTION));
|
||||
|
||||
// Allocate the section name buffer
|
||||
CurrentSection->SectionName = MmHeapAlloc(IniGetSectionNameSize(IniFileLine, LineLength));
|
||||
CurrentSection->SectionName = FrLdrTempAlloc(IniGetSectionNameSize(IniFileLine, LineLength), TAG_INI_NAME);
|
||||
if (!CurrentSection->SectionName)
|
||||
{
|
||||
MmHeapFree(CurrentSection);
|
||||
MmHeapFree(IniFileLine);
|
||||
FrLdrTempFree(CurrentSection, TAG_INI_FILE);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -130,31 +130,31 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
|||
}
|
||||
|
||||
// Allocate a new item structure
|
||||
CurrentItem = MmHeapAlloc(sizeof(INI_SECTION_ITEM));
|
||||
CurrentItem = FrLdrTempAlloc(sizeof(INI_SECTION_ITEM), TAG_INI_SECTION_ITEM);
|
||||
if (!CurrentItem)
|
||||
{
|
||||
MmHeapFree(IniFileLine);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RtlZeroMemory(CurrentItem, sizeof(INI_SECTION_ITEM));
|
||||
|
||||
// Allocate the setting name buffer
|
||||
CurrentItem->ItemName = MmHeapAlloc(IniGetSettingNameSize(IniFileLine, LineLength));
|
||||
CurrentItem->ItemName = FrLdrTempAlloc(IniGetSettingNameSize(IniFileLine, LineLength), TAG_INI_NAME);
|
||||
if (!CurrentItem->ItemName)
|
||||
{
|
||||
MmHeapFree(CurrentItem);
|
||||
MmHeapFree(IniFileLine);
|
||||
FrLdrTempFree(CurrentItem, TAG_INI_SECTION_ITEM);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Allocate the setting value buffer
|
||||
CurrentItem->ItemValue = MmHeapAlloc(IniGetSettingValueSize(IniFileLine, LineLength));
|
||||
CurrentItem->ItemValue = FrLdrTempAlloc(IniGetSettingValueSize(IniFileLine, LineLength), TAG_INI_VALUE);
|
||||
if (!CurrentItem->ItemValue)
|
||||
{
|
||||
MmHeapFree(CurrentItem->ItemName);
|
||||
MmHeapFree(CurrentItem);
|
||||
MmHeapFree(IniFileLine);
|
||||
FrLdrTempFree(CurrentItem->ItemName, TAG_INI_NAME);
|
||||
FrLdrTempFree(CurrentItem, TAG_INI_SECTION_ITEM);
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,8 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
|||
CurrentLineNumber++;
|
||||
}
|
||||
|
||||
FrLdrTempFree(IniFileLine, TAG_INI_FILE);
|
||||
|
||||
TRACE("Parsed %d sections and %d settings.\n", IniFileSectionCount, IniFileSettingCount);
|
||||
TRACE("IniParseFile() done.\n");
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
|
||||
DBG_DEFAULT_CHANNEL(HEAP);
|
||||
|
||||
#define DEFAULT_HEAP_SIZE (1024 * 1024)
|
||||
#define TEMP_HEAP_SIZE (1024 * 1024)
|
||||
|
||||
#define REDZONE_MARK 0xCCCCCCCCCCCCCCCCULL
|
||||
#define REDZONE_ALLOCATION 24
|
||||
#define REDZONE_LOW_OFFSET 16
|
||||
|
@ -147,6 +144,11 @@ FrLdrHeapDestroy(
|
|||
(ULONG_PTR)Heap / MM_PAGE_SIZE,
|
||||
(PFN_COUNT)(Heap->MaximumSize / MM_PAGE_SIZE),
|
||||
LoaderFirmwareTemporary);
|
||||
|
||||
#if DBG
|
||||
/* Make sure everything is dead */
|
||||
RtlFillMemory(Heap, Heap->MaximumSize, 0xCCCCCCCC);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FREELDR_HEAP_VERIFIER
|
||||
|
@ -182,7 +184,7 @@ FrLdrHeapRelease(
|
|||
PHEAP Heap = HeapHandle;
|
||||
PHEAP_BLOCK Block;
|
||||
PUCHAR StartAddress, EndAddress;
|
||||
PFN_COUNT FreePages, AllFreePages = 0;
|
||||
PFN_COUNT FreePages, AllPages, AllFreePages = 0;
|
||||
TRACE("HeapRelease(%p)\n", HeapHandle);
|
||||
|
||||
/* Loop all heap chunks */
|
||||
|
@ -238,7 +240,8 @@ FrLdrHeapRelease(
|
|||
if (Block->Size == 0) break;
|
||||
}
|
||||
|
||||
TRACE("HeapRelease() done, freed %ld pages\n", AllFreePages);
|
||||
AllPages = Heap->MaximumSize / MM_PAGE_SIZE;
|
||||
TRACE("HeapRelease() done, freed %lu of %lu pages\n", AllFreePages, AllPages);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -256,7 +259,7 @@ FrLdrHeapCleanupAll(VOID)
|
|||
Heap->AllocationTime, Heap->FreeTime, Heap->AllocationTime + Heap->FreeTime);
|
||||
|
||||
|
||||
/* Release fre pages */
|
||||
/* Release free pages from the default heap */
|
||||
FrLdrHeapRelease(FrLdrDefaultHeap);
|
||||
|
||||
Heap = FrLdrTempHeap;
|
||||
|
@ -266,7 +269,7 @@ FrLdrHeapCleanupAll(VOID)
|
|||
Heap->CurrentAllocBytes, Heap->MaxAllocBytes, Heap->LargestAllocation,
|
||||
Heap->NumAllocs, Heap->NumFrees);
|
||||
|
||||
/* Destroy the heap */
|
||||
/* Destroy the temp heap */
|
||||
FrLdrHeapDestroy(FrLdrTempHeap);
|
||||
}
|
||||
|
||||
|
@ -311,7 +314,7 @@ FrLdrHeapInsertFreeList(
|
|||
}
|
||||
|
||||
PVOID
|
||||
FrLdrHeapAllocate(
|
||||
FrLdrHeapAllocateEx(
|
||||
PVOID HeapHandle,
|
||||
SIZE_T ByteSize,
|
||||
ULONG Tag)
|
||||
|
@ -426,7 +429,7 @@ FrLdrHeapAllocate(
|
|||
}
|
||||
|
||||
VOID
|
||||
FrLdrHeapFree(
|
||||
FrLdrHeapFreeEx(
|
||||
PVOID HeapHandle,
|
||||
PVOID Pointer,
|
||||
ULONG Tag)
|
||||
|
@ -471,6 +474,11 @@ FrLdrHeapFree(
|
|||
/* Mark as free */
|
||||
Block->Tag = 0;
|
||||
|
||||
#if DBG
|
||||
/* Erase contents */
|
||||
RtlFillMemory(Block->Data, Block->Size * sizeof(HEAP_BLOCK), 0xCCCCCCCC);
|
||||
#endif
|
||||
|
||||
/* Update heap usage */
|
||||
Heap->NumFrees++;
|
||||
Heap->CurrentAllocBytes -= Block->Size * sizeof(HEAP_BLOCK);
|
||||
|
@ -530,18 +538,6 @@ MmInitializeHeap(PVOID PageLookupTable)
|
|||
FrLdrDefaultHeap, FrLdrTempHeap);
|
||||
}
|
||||
|
||||
PVOID
|
||||
MmHeapAlloc(SIZE_T MemorySize)
|
||||
{
|
||||
return FrLdrHeapAllocate(FrLdrDefaultHeap, MemorySize, 'pHmM');
|
||||
}
|
||||
|
||||
VOID
|
||||
MmHeapFree(PVOID MemoryPointer)
|
||||
{
|
||||
FrLdrHeapFree(FrLdrDefaultHeap, MemoryPointer, 'pHmM');
|
||||
}
|
||||
|
||||
PVOID
|
||||
NTAPI
|
||||
ExAllocatePoolWithTag(
|
||||
|
@ -549,7 +545,7 @@ ExAllocatePoolWithTag(
|
|||
IN SIZE_T NumberOfBytes,
|
||||
IN ULONG Tag)
|
||||
{
|
||||
return FrLdrHeapAllocate(FrLdrDefaultHeap, NumberOfBytes, Tag);
|
||||
return FrLdrHeapAllocateEx(FrLdrDefaultHeap, NumberOfBytes, Tag);
|
||||
}
|
||||
|
||||
PVOID
|
||||
|
@ -558,7 +554,7 @@ ExAllocatePool(
|
|||
IN POOL_TYPE PoolType,
|
||||
IN SIZE_T NumberOfBytes)
|
||||
{
|
||||
return FrLdrHeapAllocate(FrLdrDefaultHeap, NumberOfBytes, 0);
|
||||
return FrLdrHeapAllocateEx(FrLdrDefaultHeap, NumberOfBytes, 0);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -566,7 +562,7 @@ NTAPI
|
|||
ExFreePool(
|
||||
IN PVOID P)
|
||||
{
|
||||
FrLdrHeapFree(FrLdrDefaultHeap, P, 0);
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, P, 0);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -575,7 +571,7 @@ ExFreePoolWithTag(
|
|||
IN PVOID P,
|
||||
IN ULONG Tag)
|
||||
{
|
||||
FrLdrHeapFree(FrLdrDefaultHeap, P, Tag);
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, P, Tag);
|
||||
}
|
||||
|
||||
PVOID
|
||||
|
@ -587,7 +583,7 @@ RtlAllocateHeap(
|
|||
{
|
||||
PVOID ptr;
|
||||
|
||||
ptr = FrLdrHeapAllocate(FrLdrDefaultHeap, Size, ' ltR');
|
||||
ptr = FrLdrHeapAllocateEx(FrLdrDefaultHeap, Size, ' ltR');
|
||||
if (ptr && (Flags & HEAP_ZERO_MEMORY))
|
||||
{
|
||||
RtlZeroMemory(ptr, Size);
|
||||
|
@ -603,6 +599,6 @@ RtlFreeHeap(
|
|||
IN ULONG Flags,
|
||||
IN PVOID HeapBase)
|
||||
{
|
||||
FrLdrHeapFree(FrLdrDefaultHeap, HeapBase, ' ltR');
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, HeapBase, ' ltR');
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,6 @@ PFN_NUMBER MmHighestPhysicalPage = 0;
|
|||
PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
|
||||
ULONG BiosMemoryMapEntryCount;
|
||||
|
||||
extern ULONG_PTR MmHeapPointer;
|
||||
extern ULONG_PTR MmHeapStart;
|
||||
|
||||
ULONG
|
||||
AddMemoryDescriptor(
|
||||
IN OUT PFREELDR_MEMORY_DESCRIPTOR List,
|
||||
|
|
|
@ -19,13 +19,16 @@
|
|||
|
||||
#include <freeldr.h>
|
||||
|
||||
#define TAG_STRING ' rtS'
|
||||
#define TAG_OS_ITEM 'tISO'
|
||||
|
||||
static PCSTR CopyString(PCSTR Source)
|
||||
{
|
||||
PSTR Dest;
|
||||
|
||||
if (!Source)
|
||||
return NULL;
|
||||
Dest = MmHeapAlloc(strlen(Source) + 1);
|
||||
Dest = FrLdrHeapAlloc(strlen(Source) + 1, TAG_STRING);
|
||||
if (Dest)
|
||||
{
|
||||
strcpy(Dest, Source);
|
||||
|
@ -61,7 +64,7 @@ OperatingSystemItem* InitOperatingSystemList(ULONG* OperatingSystemCountPointer)
|
|||
//
|
||||
// Allocate memory to hold operating system lists
|
||||
//
|
||||
Items = MmHeapAlloc(Count * sizeof(OperatingSystemItem));
|
||||
Items = FrLdrHeapAlloc(Count * sizeof(OperatingSystemItem), TAG_OS_ITEM);
|
||||
if (!Items)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
@ -18,6 +18,9 @@ PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
#define TAG_HW_COMPONENT_DATA 'DCwH'
|
||||
#define TAG_HW_NAME 'mNwH'
|
||||
|
||||
PVOID
|
||||
NTAPI
|
||||
FldrpHwHeapAlloc(IN SIZE_T Size)
|
||||
|
@ -25,7 +28,7 @@ FldrpHwHeapAlloc(IN SIZE_T Size)
|
|||
PVOID Buffer;
|
||||
|
||||
/* Allocate memory from generic bootloader heap */
|
||||
Buffer = MmHeapAlloc(Size);
|
||||
Buffer = FrLdrHeapAlloc(Size, 'pHwH');
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
|
@ -40,7 +43,7 @@ FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
|
|||
|
||||
/* Allocate memory for the identifier */
|
||||
IdentifierLength = strlen(IdentifierString) + 1;
|
||||
Identifier = MmHeapAlloc(IdentifierLength);
|
||||
Identifier = FrLdrHeapAlloc(IdentifierLength, TAG_HW_NAME);
|
||||
if (!Identifier) return;
|
||||
|
||||
/* Copy the identifier */
|
||||
|
@ -58,7 +61,8 @@ FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
|
|||
PCONFIGURATION_COMPONENT Component;
|
||||
|
||||
/* Allocate the root */
|
||||
FldrArcHwTreeRoot = MmHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
|
||||
FldrArcHwTreeRoot = FrLdrHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA),
|
||||
TAG_HW_COMPONENT_DATA);
|
||||
if (!FldrArcHwTreeRoot) return;
|
||||
|
||||
/* Set it up */
|
||||
|
@ -125,7 +129,8 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
|
|||
PCONFIGURATION_COMPONENT Component;
|
||||
|
||||
/* Allocate the node for this component */
|
||||
ComponentData = MmHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
|
||||
ComponentData = FrLdrHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA),
|
||||
TAG_HW_COMPONENT_DATA);
|
||||
if (!ComponentData) return;
|
||||
|
||||
/* Now save our parent */
|
||||
|
|
|
@ -35,7 +35,7 @@ PVOID
|
|||
NTAPI
|
||||
CmpAllocate (SIZE_T Size, BOOLEAN Paged, ULONG Tag)
|
||||
{
|
||||
return MmHeapAlloc(Size);
|
||||
return FrLdrHeapAllocateEx(FrLdrDefaultHeap, Size, Tag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ VOID
|
|||
NTAPI
|
||||
CmpFree (PVOID Ptr, IN ULONG Quota)
|
||||
{
|
||||
MmHeapFree(Ptr);
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, Ptr, 0);
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -68,7 +68,7 @@ RegImportValue (
|
|||
|
||||
if (ValueCell->Flags & VALUE_COMP_NAME)
|
||||
{
|
||||
wName = MmHeapAlloc ((ValueCell->NameLength + 1) * sizeof(WCHAR));
|
||||
wName = FrLdrTempAlloc((ValueCell->NameLength + 1) * sizeof(WCHAR), TAG_REG_NAME);
|
||||
for (i = 0; i < ValueCell->NameLength; i++)
|
||||
{
|
||||
wName[i] = ((PCHAR)ValueCell->Name)[i];
|
||||
|
@ -77,7 +77,7 @@ RegImportValue (
|
|||
}
|
||||
else
|
||||
{
|
||||
wName = MmHeapAlloc(ValueCell->NameLength + sizeof(WCHAR));
|
||||
wName = FrLdrTempAlloc(ValueCell->NameLength + sizeof(WCHAR), TAG_REG_NAME);
|
||||
memcpy(wName, ValueCell->Name, ValueCell->NameLength);
|
||||
wName[ValueCell->NameLength / sizeof(WCHAR)] = 0;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ RegImportValue (
|
|||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RegSetValue() failed!\n");
|
||||
MmHeapFree(wName);
|
||||
FrLdrTempFree(wName, TAG_REG_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -115,12 +115,12 @@ RegImportValue (
|
|||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RegSetValue() failed!\n");
|
||||
MmHeapFree(wName);
|
||||
FrLdrTempFree(wName, TAG_REG_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
MmHeapFree(wName);
|
||||
FrLdrTempFree(wName, TAG_REG_NAME);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ RegImportSubKey(
|
|||
|
||||
if (KeyCell->Flags & KEY_COMP_NAME)
|
||||
{
|
||||
wName = MmHeapAlloc((KeyCell->NameLength + 1) * sizeof(WCHAR));
|
||||
wName = FrLdrTempAlloc((KeyCell->NameLength + 1) * sizeof(WCHAR), TAG_REG_NAME);
|
||||
for (i = 0; i < KeyCell->NameLength; i++)
|
||||
{
|
||||
wName[i] = ((PCHAR)KeyCell->Name)[i];
|
||||
|
@ -208,7 +208,7 @@ RegImportSubKey(
|
|||
}
|
||||
else
|
||||
{
|
||||
wName = MmHeapAlloc(KeyCell->NameLength + sizeof(WCHAR));
|
||||
wName = FrLdrTempAlloc(KeyCell->NameLength + sizeof(WCHAR), TAG_REG_NAME);
|
||||
memcpy(wName, KeyCell->Name, KeyCell->NameLength);
|
||||
wName[KeyCell->NameLength / sizeof(WCHAR)] = 0;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ RegImportSubKey(
|
|||
|
||||
/* Create new sub key */
|
||||
Error = RegCreateKey(ParentKey, wName, &SubKey);
|
||||
MmHeapFree(wName);
|
||||
FrLdrTempFree(wName, TAG_REG_NAME);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RegCreateKey() failed!\n");
|
||||
|
|
|
@ -29,7 +29,7 @@ VOID
|
|||
RegInitializeRegistry (VOID)
|
||||
{
|
||||
/* Create root key */
|
||||
RootKey = MmHeapAlloc(sizeof(KEY));
|
||||
RootKey = FrLdrHeapAlloc(sizeof(KEY), TAG_REG_KEY);
|
||||
|
||||
InitializeListHead(&RootKey->SubKeyList);
|
||||
InitializeListHead(&RootKey->ValueList);
|
||||
|
@ -39,7 +39,7 @@ RegInitializeRegistry (VOID)
|
|||
RootKey->ValueCount = 0;
|
||||
|
||||
RootKey->NameSize = 4;
|
||||
RootKey->Name = MmHeapAlloc(4);
|
||||
RootKey->Name = FrLdrHeapAlloc(4, TAG_REG_NAME);
|
||||
wcscpy (RootKey->Name, L"\\");
|
||||
|
||||
RootKey->DataType = 0;
|
||||
|
@ -242,7 +242,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
|
|||
if (CmpResult != 0)
|
||||
{
|
||||
/* no key found -> create new subkey */
|
||||
NewKey = MmHeapAlloc(sizeof(KEY));
|
||||
NewKey = FrLdrHeapAlloc(sizeof(KEY), TAG_REG_KEY);
|
||||
if (NewKey == NULL) return ERROR_OUTOFMEMORY;
|
||||
|
||||
InitializeListHead(&NewKey->SubKeyList);
|
||||
|
@ -259,7 +259,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
|
|||
CurrentKey->SubKeyCount++;
|
||||
|
||||
NewKey->NameSize = NameSize;
|
||||
NewKey->Name = (PWCHAR)MmHeapAlloc(NewKey->NameSize);
|
||||
NewKey->Name = (PWCHAR)FrLdrHeapAlloc(NewKey->NameSize, TAG_REG_NAME);
|
||||
if (NewKey->Name == NULL) return ERROR_OUTOFMEMORY;
|
||||
|
||||
memcpy(NewKey->Name, name, NewKey->NameSize - sizeof(WCHAR));
|
||||
|
@ -452,7 +452,7 @@ RegSetValue(FRLDRHKEY Key,
|
|||
/* set default value */
|
||||
if ((Key->Data != NULL) && (Key->DataSize > sizeof(PUCHAR)))
|
||||
{
|
||||
MmHeapFree(Key->Data);
|
||||
FrLdrHeapFree(Key->Data, TAG_REG_KEY_DATA);
|
||||
}
|
||||
|
||||
if (DataSize <= sizeof(PUCHAR))
|
||||
|
@ -463,7 +463,7 @@ RegSetValue(FRLDRHKEY Key,
|
|||
}
|
||||
else
|
||||
{
|
||||
Key->Data = MmHeapAlloc(DataSize);
|
||||
Key->Data = FrLdrHeapAlloc(DataSize, TAG_REG_KEY_DATA);
|
||||
Key->DataSize = DataSize;
|
||||
Key->DataType = Type;
|
||||
memcpy(Key->Data, Data, DataSize);
|
||||
|
@ -489,14 +489,14 @@ RegSetValue(FRLDRHKEY Key,
|
|||
/* add new value */
|
||||
TRACE("No value found - adding new value\n");
|
||||
|
||||
Value = (PVALUE)MmHeapAlloc(sizeof(VALUE));
|
||||
Value = (PVALUE)FrLdrHeapAlloc(sizeof(VALUE), TAG_REG_VALUE);
|
||||
if (Value == NULL) return ERROR_OUTOFMEMORY;
|
||||
|
||||
InsertTailList(&Key->ValueList, &Value->ValueList);
|
||||
Key->ValueCount++;
|
||||
|
||||
Value->NameSize = (ULONG)(wcslen(ValueName)+1) * sizeof(WCHAR);
|
||||
Value->Name = MmHeapAlloc(Value->NameSize);
|
||||
Value->Name = FrLdrHeapAlloc(Value->NameSize, TAG_REG_NAME);
|
||||
if (Value->Name == NULL) return ERROR_OUTOFMEMORY;
|
||||
wcscpy(Value->Name, ValueName);
|
||||
Value->DataType = REG_NONE;
|
||||
|
@ -507,7 +507,7 @@ RegSetValue(FRLDRHKEY Key,
|
|||
/* set new value */
|
||||
if ((Value->Data != NULL) && (Value->DataSize > sizeof(PUCHAR)))
|
||||
{
|
||||
MmHeapFree(Value->Data);
|
||||
FrLdrHeapFree(Value->Data, TAG_REG_KEY_DATA);
|
||||
}
|
||||
|
||||
if (DataSize <= sizeof(PUCHAR))
|
||||
|
@ -518,7 +518,7 @@ RegSetValue(FRLDRHKEY Key,
|
|||
}
|
||||
else
|
||||
{
|
||||
Value->Data = MmHeapAlloc(DataSize);
|
||||
Value->Data = FrLdrHeapAlloc(DataSize, TAG_REG_KEY_DATA);
|
||||
if (Value->Data == NULL) return ERROR_OUTOFMEMORY;
|
||||
Value->DataType = Type;
|
||||
Value->DataSize = DataSize;
|
||||
|
@ -620,7 +620,7 @@ RegDeleteValue(FRLDRHKEY Key,
|
|||
if ((ValueName == NULL) || (*ValueName == 0))
|
||||
{
|
||||
/* delete default value */
|
||||
if (Key->Data != NULL) MmFreeMemory(Key->Data);
|
||||
if (Key->Data != NULL) FrLdrHeapFree(Key->Data, TAG_REG_KEY_DATA);
|
||||
Key->Data = NULL;
|
||||
Key->DataSize = 0;
|
||||
Key->DataType = 0;
|
||||
|
@ -641,20 +641,20 @@ RegDeleteValue(FRLDRHKEY Key,
|
|||
|
||||
/* delete value */
|
||||
Key->ValueCount--;
|
||||
if (Value->Name != NULL) MmFreeMemory(Value->Name);
|
||||
if (Value->Name != NULL) FrLdrHeapFree(Value->Name, TAG_REG_NAME);
|
||||
Value->Name = NULL;
|
||||
Value->NameSize = 0;
|
||||
|
||||
if (Value->DataSize > sizeof(PUCHAR))
|
||||
{
|
||||
if (Value->Data != NULL) MmFreeMemory(Value->Data);
|
||||
if (Value->Data != NULL) FrLdrHeapFree(Value->Data, TAG_REG_KEY_DATA);
|
||||
}
|
||||
Value->Data = NULL;
|
||||
Value->DataSize = 0;
|
||||
Value->DataType = 0;
|
||||
|
||||
RemoveEntryList(&Value->ValueList);
|
||||
MmFreeMemory(Value);
|
||||
FrLdrHeapFree(Value, TAG_REG_VALUE);
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ NTAPI
|
|||
RtlpAllocateMemory(ULONG Bytes,
|
||||
ULONG Tag)
|
||||
{
|
||||
return MmHeapAlloc(Bytes);
|
||||
return FrLdrHeapAllocateEx(FrLdrDefaultHeap, Bytes, Tag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ NTAPI
|
|||
RtlpFreeMemory(PVOID Mem,
|
||||
ULONG Tag)
|
||||
{
|
||||
MmHeapFree(Mem);
|
||||
FrLdrHeapFreeEx(FrLdrDefaultHeap, Mem, Tag);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#ifndef _M_ARM
|
||||
#include <freeldr.h>
|
||||
|
||||
#define TAG_TUI_SCREENBUFFER 'SiuT'
|
||||
#define TAG_TAG_TUI_PALETTE 'PiuT'
|
||||
|
||||
PVOID TextVideoBuffer = NULL;
|
||||
|
||||
/*
|
||||
|
@ -542,7 +545,8 @@ VOID TuiMessageBox(PCSTR MessageText)
|
|||
PVOID ScreenBuffer;
|
||||
|
||||
// Save the screen contents
|
||||
ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
|
||||
ScreenBuffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2,
|
||||
TAG_TUI_SCREENBUFFER);
|
||||
TuiSaveScreen(ScreenBuffer);
|
||||
|
||||
// Display the message box
|
||||
|
@ -550,7 +554,7 @@ VOID TuiMessageBox(PCSTR MessageText)
|
|||
|
||||
// Restore the screen contents
|
||||
TuiRestoreScreen(ScreenBuffer);
|
||||
MmHeapFree(ScreenBuffer);
|
||||
FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER);
|
||||
}
|
||||
|
||||
VOID TuiMessageBoxCritical(PCSTR MessageText)
|
||||
|
@ -758,7 +762,8 @@ VOID TuiFadeInBackdrop(VOID)
|
|||
|
||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
||||
{
|
||||
TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
|
||||
TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
|
||||
TAG_TAG_TUI_PALETTE);
|
||||
|
||||
if (TuiFadePalette != NULL)
|
||||
{
|
||||
|
@ -773,7 +778,7 @@ VOID TuiFadeInBackdrop(VOID)
|
|||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
||||
{
|
||||
VideoFadeIn(TuiFadePalette, 64);
|
||||
MmHeapFree(TuiFadePalette);
|
||||
FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,7 +788,8 @@ VOID TuiFadeOut(VOID)
|
|||
|
||||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
|
||||
{
|
||||
TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
|
||||
TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
|
||||
TAG_TAG_TUI_PALETTE);
|
||||
|
||||
if (TuiFadePalette != NULL)
|
||||
{
|
||||
|
@ -801,7 +807,7 @@ VOID TuiFadeOut(VOID)
|
|||
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
|
||||
{
|
||||
VideoRestorePaletteState(TuiFadePalette, 64);
|
||||
MmHeapFree(TuiFadePalette);
|
||||
FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -826,7 +832,8 @@ BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
|
|||
PVOID ScreenBuffer;
|
||||
|
||||
// Save the screen contents
|
||||
ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
|
||||
ScreenBuffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2,
|
||||
TAG_TUI_SCREENBUFFER);
|
||||
TuiSaveScreen(ScreenBuffer);
|
||||
|
||||
// Find the height
|
||||
|
@ -1029,7 +1036,7 @@ BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
|
|||
|
||||
// Restore the screen contents
|
||||
TuiRestoreScreen(ScreenBuffer);
|
||||
MmHeapFree(ScreenBuffer);
|
||||
FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER);
|
||||
|
||||
return ReturnCode;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <freeldr.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define TAG_UI_TEXT 'xTiU'
|
||||
|
||||
DBG_DEFAULT_CHANNEL(UI);
|
||||
|
||||
ULONG UiScreenWidth; // Screen Width
|
||||
|
@ -401,7 +403,7 @@ VOID UiShowMessageBoxesInSection(PCSTR SectionName)
|
|||
//if (MessageBoxTextSize > 0)
|
||||
{
|
||||
// Allocate enough memory to hold the text
|
||||
MessageBoxText = MmHeapAlloc(MessageBoxTextSize);
|
||||
MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
|
||||
|
||||
if (MessageBoxText)
|
||||
{
|
||||
|
@ -415,7 +417,7 @@ VOID UiShowMessageBoxesInSection(PCSTR SectionName)
|
|||
UiMessageBox(MessageBoxText);
|
||||
|
||||
// Free the memory
|
||||
MmHeapFree(MessageBoxText);
|
||||
FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
#ifndef _M_ARM
|
||||
#include <freeldr.h>
|
||||
|
||||
#define RGB_MAX 64
|
||||
#define RGB_MAX 64
|
||||
#define RGB_MAX_PER_ITERATION 64
|
||||
#define TAG_PALETTE_COLORS 'claP'
|
||||
|
||||
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
|
|||
UCHAR Color;
|
||||
PPALETTE_ENTRY PaletteColors;
|
||||
|
||||
PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount);
|
||||
PaletteColors = FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * ColorCount, TAG_PALETTE_COLORS);
|
||||
if (!PaletteColors) return;
|
||||
|
||||
for (Index=0; Index<RGB_MAX; Index++)
|
||||
|
@ -91,7 +92,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
|
|||
}
|
||||
}
|
||||
|
||||
MmHeapFree(PaletteColors);
|
||||
FrLdrTempFree(PaletteColors, TAG_PALETTE_COLORS);
|
||||
}
|
||||
|
||||
VOID VideoFadeOut(ULONG ColorCount)
|
||||
|
|
|
@ -183,7 +183,8 @@ WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead,
|
|||
BaseDllName, FullDllName, BasePA);
|
||||
|
||||
/* Allocate memory for a data table entry, zero-initialize it */
|
||||
DataTableEntry = (PLDR_DATA_TABLE_ENTRY)MmHeapAlloc(sizeof(LDR_DATA_TABLE_ENTRY));
|
||||
DataTableEntry = (PLDR_DATA_TABLE_ENTRY)FrLdrHeapAlloc(sizeof(LDR_DATA_TABLE_ENTRY),
|
||||
TAG_WLDR_DTE);
|
||||
if (DataTableEntry == NULL)
|
||||
return FALSE;
|
||||
RtlZeroMemory(DataTableEntry, sizeof(LDR_DATA_TABLE_ENTRY));
|
||||
|
@ -201,10 +202,10 @@ WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead,
|
|||
/* Initialize BaseDllName field (UNICODE_STRING) from the Ansi BaseDllName
|
||||
by simple conversion - copying each character */
|
||||
Length = (USHORT)(strlen(BaseDllName) * sizeof(WCHAR));
|
||||
Buffer = (PWSTR)MmHeapAlloc(Length);
|
||||
Buffer = (PWSTR)FrLdrHeapAlloc(Length, TAG_WLDR_NAME);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
MmHeapFree(DataTableEntry);
|
||||
FrLdrHeapFree(DataTableEntry, TAG_WLDR_DTE);
|
||||
return FALSE;
|
||||
}
|
||||
RtlZeroMemory(Buffer, Length);
|
||||
|
@ -220,10 +221,10 @@ WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead,
|
|||
/* Initialize FullDllName field (UNICODE_STRING) from the Ansi FullDllName
|
||||
using the same method */
|
||||
Length = (USHORT)(strlen(FullDllName) * sizeof(WCHAR));
|
||||
Buffer = (PWSTR)MmHeapAlloc(Length);
|
||||
Buffer = (PWSTR)FrLdrHeapAlloc(Length, TAG_WLDR_NAME);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
MmHeapFree(DataTableEntry);
|
||||
FrLdrHeapFree(DataTableEntry, TAG_WLDR_DTE);
|
||||
return FALSE;
|
||||
}
|
||||
RtlZeroMemory(Buffer, Length);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
DBG_DEFAULT_CHANNEL(WINDOWS);
|
||||
#define TAG_BOOT_OPTIONS 'pOtB'
|
||||
|
||||
void
|
||||
WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
|
@ -139,7 +140,8 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
|
|||
{
|
||||
CHAR FileName[512];
|
||||
CHAR BootPath[512];
|
||||
LPCSTR LoadOptions, BootOptions;
|
||||
LPCSTR LoadOptions;
|
||||
LPSTR BootOptions;
|
||||
BOOLEAN BootFromFloppy;
|
||||
ULONG i, ErrorLine;
|
||||
HINF InfHandle;
|
||||
|
@ -199,17 +201,21 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
|
|||
return;
|
||||
}
|
||||
|
||||
BootOptions = LoadOptions;
|
||||
|
||||
#if DBG
|
||||
/* Get debug load options and use them */
|
||||
if (InfFindFirstLine(InfHandle, "SetupData", "DbgOsLoadOptions", &InfContext))
|
||||
{
|
||||
if (InfGetDataField(&InfContext, 1, &LoadOptions))
|
||||
BootOptions = LoadOptions;
|
||||
LPCSTR DbgLoadOptions;
|
||||
|
||||
if (InfGetDataField(&InfContext, 1, &DbgLoadOptions))
|
||||
LoadOptions = DbgLoadOptions;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy loadoptions (original string will be freed) */
|
||||
BootOptions = FrLdrTempAlloc(strlen(LoadOptions) + 1, TAG_BOOT_OPTIONS);
|
||||
strcpy(BootOptions, LoadOptions);
|
||||
|
||||
TRACE("BootOptions: '%s'\n", BootOptions);
|
||||
|
||||
UiDrawStatusText("Setup is loading...");
|
||||
|
@ -232,6 +238,9 @@ LoadReactOSSetup(IN OperatingSystemItem* OperatingSystem,
|
|||
/* Get a list of boot drivers */
|
||||
SetupLdrScanBootDrivers(&LoaderBlock->BootDriverListHead, InfHandle, BootPath);
|
||||
|
||||
/* Close the inf file */
|
||||
InfCloseFile(InfHandle);
|
||||
|
||||
/* Load ReactOS */
|
||||
LoadAndBootWindowsCommon(_WIN32_WINNT_WS03,
|
||||
LoaderBlock,
|
||||
|
|
|
@ -144,9 +144,7 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
PARC_DISK_SIGNATURE_EX ArcDiskSig;
|
||||
|
||||
/* Allocate the ARC structure */
|
||||
ArcDiskSig = FrLdrHeapAllocate(FrLdrDefaultHeap,
|
||||
sizeof(ARC_DISK_SIGNATURE_EX),
|
||||
'giSD');
|
||||
ArcDiskSig = FrLdrHeapAlloc(sizeof(ARC_DISK_SIGNATURE_EX), 'giSD');
|
||||
|
||||
/* Copy the data over */
|
||||
ArcDiskSig->DiskSignature.Signature = reactos_arc_disk_info[i].Signature;
|
||||
|
@ -752,6 +750,9 @@ LoadAndBootWindowsCommon(
|
|||
/* "Stop all motors", change videomode */
|
||||
MachPrepareForReactOS(Setup);
|
||||
|
||||
/* Cleanup ini file */
|
||||
IniCleanup();
|
||||
|
||||
/* Debugging... */
|
||||
//DumpMemoryAllocMap();
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
|
||||
/* Get the Name Group */
|
||||
BufferSize = 4096;
|
||||
GroupNameBuffer = MmHeapAlloc(BufferSize);
|
||||
GroupNameBuffer = FrLdrHeapAlloc(BufferSize, TAG_WLDR_NAME);
|
||||
rc = RegQueryValue(hGroupKey, L"List", NULL, (PUCHAR)GroupNameBuffer, &BufferSize);
|
||||
TRACE_CH(REACTOS, "RegQueryValue(): rc %d\n", (int)rc);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
|
@ -545,7 +545,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
break;
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
MmHeapFree(GroupNameBuffer);
|
||||
FrLdrHeapFree(GroupNameBuffer, TAG_WLDR_NAME);
|
||||
return;
|
||||
}
|
||||
//TRACE_CH(REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
|
||||
|
@ -624,7 +624,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
break;
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
MmHeapFree(GroupNameBuffer);
|
||||
FrLdrHeapFree(GroupNameBuffer, TAG_WLDR_NAME);
|
||||
return;
|
||||
}
|
||||
//TRACE_CH(REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
|
||||
|
@ -694,7 +694,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
}
|
||||
|
||||
/* Free allocated memory */
|
||||
MmHeapFree(GroupNameBuffer);
|
||||
FrLdrHeapFree(GroupNameBuffer, TAG_WLDR_NAME);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
@ -707,7 +707,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
NTSTATUS Status;
|
||||
USHORT PathLength;
|
||||
|
||||
BootDriverEntry = MmHeapAlloc(sizeof(BOOT_DRIVER_LIST_ENTRY));
|
||||
BootDriverEntry = FrLdrHeapAlloc(sizeof(BOOT_DRIVER_LIST_ENTRY), TAG_WLDR_BDE);
|
||||
|
||||
if (!BootDriverEntry)
|
||||
return FALSE;
|
||||
|
@ -724,19 +724,19 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
|
||||
BootDriverEntry->FilePath.Length = 0;
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength;
|
||||
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
|
||||
BootDriverEntry->FilePath.Buffer = FrLdrHeapAlloc(PathLength, TAG_WLDR_NAME);
|
||||
|
||||
if (!BootDriverEntry->FilePath.Buffer)
|
||||
{
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_BDE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(&BootDriverEntry->FilePath, ImagePath);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmHeapFree(BootDriverEntry->FilePath.Buffer);
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry->FilePath.Buffer, TAG_WLDR_NAME);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_BDE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -746,35 +746,35 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
PathLength = (USHORT)wcslen(ServiceName)*sizeof(WCHAR) + sizeof(L"system32\\drivers\\.sys");
|
||||
BootDriverEntry->FilePath.Length = 0;
|
||||
BootDriverEntry->FilePath.MaximumLength = PathLength;
|
||||
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
|
||||
BootDriverEntry->FilePath.Buffer = FrLdrHeapAlloc(PathLength, TAG_WLDR_NAME);
|
||||
|
||||
if (!BootDriverEntry->FilePath.Buffer)
|
||||
{
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(&BootDriverEntry->FilePath, L"system32\\drivers\\");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmHeapFree(BootDriverEntry->FilePath.Buffer);
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry->FilePath.Buffer, TAG_WLDR_NAME);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(&BootDriverEntry->FilePath, ServiceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmHeapFree(BootDriverEntry->FilePath.Buffer);
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry->FilePath.Buffer, TAG_WLDR_NAME);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(&BootDriverEntry->FilePath, L".sys");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MmHeapFree(BootDriverEntry->FilePath.Buffer);
|
||||
MmHeapFree(BootDriverEntry);
|
||||
FrLdrHeapFree(BootDriverEntry->FilePath.Buffer, TAG_WLDR_NAME);
|
||||
FrLdrHeapFree(BootDriverEntry, TAG_WLDR_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|||
PathLength = (USHORT)(wcslen(RegistryPath) + wcslen(ServiceName))*sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||
BootDriverEntry->RegistryPath.Length = 0;
|
||||
BootDriverEntry->RegistryPath.MaximumLength = PathLength;
|
||||
BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength);
|
||||
BootDriverEntry->RegistryPath.Buffer = FrLdrHeapAlloc(PathLength, TAG_WLDR_NAME);
|
||||
if (!BootDriverEntry->RegistryPath.Buffer)
|
||||
return FALSE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue