Ignore:
Timestamp:
Jul 15, 2002, 4:28:53 PM (23 years ago)
Author:
sandervl
Message:

Rewrote algorithm for 64kb alignment in VirtualAlloc'ed memory; allocation changes for heap (in 64kb chunks) & PE image (align at 64kb)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagepeldr.cpp

    r7811 r8877  
    1 /* $Id: winimagepeldr.cpp,v 1.95 2002-02-06 16:33:39 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.96 2002-07-15 14:28:53 sandervl Exp $ */
    22
    33/*
     
    5353#include <win\virtual.h>
    5454#include "oslibdos.h"
     55#include "oslibmem.h"
    5556#include "mmap.h"
    5657#include <wprocess.h>
     
    159160
    160161    if(realBaseAddress)
    161         DosFreeMem((PVOID)realBaseAddress);
     162        OSLibDosFreeMem((PVOID)realBaseAddress);
    162163
    163164    if(nameexports)
     
    924925        return allocFixedMem(reservedMem);
    925926    }
    926     rc = DosAllocMem((PPVOID)&baseAddress, imageSize, PAG_READ | PAG_WRITE | flAllocMem);
     927    rc = OSLibDosAllocMem((PPVOID)&baseAddress, imageSize, PAG_READ | PAG_WRITE);
    927928    if(rc) {
    928929        dprintf((LOG, "Win32PeLdrImage::allocSections, DosAllocMem returned %d", rc));
     
    10111012    }
    10121013    while(TRUE) {
    1013         rc = DosAllocMem((PPVOID)&address, FALLOC_SIZE, PAG_READ | allocFlags);
     1014        rc = OSLibDosAllocMem((PPVOID)&address, FALLOC_SIZE, PAG_READ | allocFlags);
    10141015        if(rc) break;
    10151016
     
    10171018        if(address + FALLOC_SIZE >= oh.ImageBase) {
    10181019            if(address > oh.ImageBase) {//we've passed it!
    1019                 DosFreeMem((PVOID)address);
     1020                OSLibDosFreeMem((PVOID)address);
    10201021                break;
    10211022            }
    10221023            //found the right address
    1023             DosFreeMem((PVOID)address);
     1024            OSLibDosFreeMem((PVOID)address);
    10241025
    10251026            diff = oh.ImageBase - address;
    10261027            if(diff) {
    1027                 rc = DosAllocMem((PPVOID)&address, diff, PAG_READ | allocFlags);
     1028                rc = OSLibDosAllocMem((PPVOID)&address, diff, PAG_READ | allocFlags);
    10281029                if(rc) break;
    10291030            }
    1030             rc = DosAllocMem((PPVOID)&baseAddress, imageSize, PAG_READ | PAG_WRITE | allocFlags);
     1031            rc = OSLibDosAllocMem((PPVOID)&baseAddress, imageSize, PAG_READ | PAG_WRITE | allocFlags);
    10311032            if(rc) break;
    10321033
    1033             if(diff) DosFreeMem((PVOID)address);
     1034            if(diff) OSLibDosFreeMem((PVOID)address);
    10341035
    10351036            realBaseAddress = baseAddress;
     
    10391040    }
    10401041    for(i=0;i<alloccnt;i++) {
    1041         DosFreeMem((PVOID)memallocs[i]);
     1042        OSLibDosFreeMem((PVOID)memallocs[i]);
    10421043    }
    10431044    free(memallocs);
Note: See TracChangeset for help on using the changeset viewer.