Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : FHEAPCHK.ASM

 
Output of file : FHEAPCHK.ASM contained in archive : VCCRT1.ZIP
page ,132
title fheapchk -- Check the far heap
;***
;fheapchk.asm - Check the far heap
;
; Copyright (c) 1988-1992, Microsoft Corporation. All rights reserved.
;
;Purpose:
; Check the far heap.
;
;*******************************************************************************


include version.inc
.xlist
include cmacros.inc
include heap.inc
.list


sBegin data
assumes ds,data

externW _fheap ; far heap linked list header

sEnd data

externNP _setlist ; check a linked list of heap segs


sBegin code
assumes ds,data
assumes cs,code

page
;***
;int _fheapchk(void) - Miminal validity check on the far heap
;
;Purpose:
; Perform a minimal consistency check on the far heap.
;
;Entry:
;
;
;Exit:
; Return value is one of the following constants:
;
; _HEAPOK - completed okay
; _HEAPEMPTY - far heap not initialized
; _HEAPBADBEGIN - can't find initial header info
; _HEAPBADNODE - malformed node somewhere
;
;Uses:
;
;Exceptions:
;
;*******************************************************************************

if sizeD
labelP
endif

cProc _fheapchk,,

cBegin

mov cx,_HEAPSET_NOFILL ; cx = don't fill the free blocks
;fall through

;
; Both _fheapchk and _fheapset enter here.
; cx = fill value or _HEAPSET_NOFILL
;

common:


mov di,dataoffset _fheap ; ds:di = far heap header
call _setlist ; check it out


cEnd


page
;***
;int _fheapset(unsigned) - Set contents of free far heap blocks
;
;Purpose:
; Fill all the free blocks in the far heap with the
; supplied value. Also, perform some heap consistency
; checks while we're at it.
;
;Entry:
; unsigned = fill value
;
;Exit:
; Return value is one of the following constants:
;
; _HEAPOK - completed okay
; _HEAPEMPTY - far heap not initialized
; _HEAPBADBEGIN - can't find initial header info
; _HEAPBADNODE - malformed node somewhere
;
;Uses:
;
;Exceptions:
;
;*******************************************************************************

if sizeD
labelP
endif

cProc _fheapset,,

parmW fill ; fill value

cBegin

mov cx,[fill] ; cx = fill value
jmp short common ; join _fheapchk

cEnd

sEnd code

end


  3 Responses to “Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : FHEAPCHK.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/