Author: aandrejevic Date: Tue Jun 25 16:46:35 2013 New Revision: 59338
URL: http://svn.reactos.org/svn/reactos?rev=59338&view=rev Log: [NTVDM] Fix the VDM DOS memory manager to use the segment of the data portion of the block, rather than the MCB itself.
Modified: branches/ntvdm/subsystems/ntvdm/dos.c branches/ntvdm/subsystems/ntvdm/ntvdm.h
Modified: branches/ntvdm/subsystems/ntvdm/dos.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Jun 25 16:46:35 2013 @@ -148,12 +148,13 @@ /* Take ownership of the block */ CurrentMcb->OwnerPsp = CurrentPsp;
- return Result; -} - -WORD DosResizeMemory(WORD Segment, WORD NewSize) -{ - WORD ReturnSize = 0, NextSegment; + /* Return the segment of the data portion of the block */ + return Result + 1; +} + +WORD DosResizeMemory(WORD BlockData, WORD NewSize) +{ + WORD Segment = BlockData - 1, ReturnSize = 0, NextSegment; PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment), NextMcb;
/* Make sure this is a valid, allocated block */ @@ -222,9 +223,9 @@ return ReturnSize; }
-BOOLEAN DosFreeMemory(WORD Segment) -{ - PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment); +BOOLEAN DosFreeMemory(WORD BlockData) +{ + PDOS_MCB Mcb = SEGMENT_TO_MCB(BlockData - 1);
/* Make sure the MCB is valid */ if (Mcb->BlockType != 'M' && Mcb->BlockType != 'Z') return FALSE;
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Tue Jun 25 16:46:35 2013 @@ -207,8 +207,8 @@ VOID BiosPrintCharacter(CHAR Character, BYTE Attribute); BOOLEAN DosInitialize(); WORD DosAllocateMemory(WORD Size, WORD *MaxAvailable); -BOOLEAN DosFreeMemory(WORD Segment); -WORD DosResizeMemory(WORD Segment, WORD NewSize); +BOOLEAN DosFreeMemory(WORD BlockData); +WORD DosResizeMemory(WORD BlockData, WORD NewSize); BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock); VOID DosInt20h(WORD CodeSegment); VOID DosInt21h(WORD CodeSegment);