Author: aandrejevic
Date: Mon Jul 22 16:36:05 2013
New Revision: 59557
URL:
http://svn.reactos.org/svn/reactos?rev=59557&view=rev
Log:
[NTVDM]
Fix bug while initializing and copying the environment strings.
Modified:
branches/ntvdm/subsystems/ntvdm/dos.c
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Mon Jul 22 16:36:05 2013
@@ -83,8 +83,8 @@
strcpy(DestBuffer, Ptr);
/* Advance to the next string */
+ DestBuffer += strlen(Ptr);
Ptr += strlen(Ptr) + 1;
- DestBuffer += strlen(Ptr);
/* Put a zero after the string */
*(DestBuffer++) = 0;
@@ -231,6 +231,8 @@
PDOS_MCB CurrentMcb, NextMcb;
BOOLEAN SearchUmb = FALSE;
+ DPRINT("DosAllocateMemory: Size 0x%04X\n", Size);
+
if (DosUmbLinked && (DosAllocStrategy & (DOS_ALLOC_HIGH |
DOS_ALLOC_HIGH_LOW)))
{
/* Search UMB first */
@@ -246,6 +248,7 @@
/* Make sure it's valid */
if (CurrentMcb->BlockType != 'M' && CurrentMcb->BlockType
!= 'Z')
{
+ DPRINT("The DOS memory arena is corrupted!\n");
DosLastError = ERROR_ARENA_TRASHED;
return 0;
}
@@ -1750,13 +1753,13 @@
/* Copy the string into DOS memory */
strcpy(DestPtr, AsciiString);
- /* Free the memory */
- HeapFree(GetProcessHeap(), 0, AsciiString);
-
/* Move to the next string */
SourcePtr += wcslen(SourcePtr) + 1;
DestPtr += strlen(AsciiString);
*(DestPtr++) = 0;
+
+ /* Free the memory */
+ HeapFree(GetProcessHeap(), 0, AsciiString);
}
*DestPtr = 0;