Category : C++ Source Code
Archive   : VMVCPP.ZIP
Filename : VMBM.H

 
Output of file : VMBM.H contained in archive : VMVCPP.ZIP
/***
* vmbm.h -
*
* Copyright (c) 1989-1992, Microsoft Corporation. All rights reserved.
*
*******************************************************************************/

// These are the VMBM internal data structures ONLY, not public to the
// user of the VMBM!

#pragma pack(1)
typedef union {
struct {
unsigned short fAdjacent :1;
unsigned short fVoid :15;
};
unsigned short cbSize;
unsigned short cPage;
} SZBK; //* SiZe of allocated BlocK

typedef struct {
SZBK;
struct {
unsigned short cLock :8;
unsigned short fFree :1;
unsigned short fByPage :1;
};
} HDP; //* HeaDer info for a Page
typedef HDP far * PHDP;

typedef struct {
HDP;
SZBK szbkBack;
} HDB; //* HeaDer info for a Block
typedef HDB far * PHDB;

typedef struct {
HDB;
HBK hbkBackHdf;
HBK hbkNextHdf;
} HDF; //* Free HeaDer, at the start of
typedef HDF far * PHDF;

#pragma pack()

#define bitShift 4 // used to calculate cbClose and cbBig

#define cbClose (cbVmPage >> bitShift) // This says that cbClose bytes is
// close enough to a page boundary
// to go ahead an go to the next page
// this must be greater that
// sizeof(FHD)

#define cbBig (cbVmPage - sizeof(HDB))

#define cbMaxAlloc (0xFFFFFFFF - cbVmPage)
#define cbEndPage(a) (cbVmPage - ((a) % cbVmPage)) // nbr bytes from vp to end
// of the page

#define CbGetSize(a) (((unsigned short) (a)) & 0xFFFE)
#define CbMakeSize(a,b) ((((unsigned short) (a)) & 0xFFFE) | (((unsigned short) (b)) & 0x0001))
#define cbMaxFreeSize 0xFFFE
#define AddHbk(a,b) ((HBK) (((unsigned long) (a)) + (b)))

#define cMaxLock 255U

// the VMBM global variable structure.
typedef struct {
unsigned cbMaxFree; // how many bytes free in last block, must be first item in struct for initialization
unsigned long cFree; // nbr of free blocks known
HBK hbkFreeStart; // the first free block
HBK hbkFreeLast; // the last free block
HBK hbkLastBlock; // the last block in the list
} GVMBM;

extern GVMBM _gvmbm;

extern void VMFUNC __VmFreeLink(HBK, HBK);
extern void VMFUNC __VmFreeLinkIn(HBK, unsigned, HBK, HBK);
extern void VMFUNC __VmFreeLinkEnd(HBK, unsigned);

extern unsigned _near _fVmInit; /* TRUE when VM is initialized */
extern const VPVOID _hbkMin; /* lowest legal handle address */
extern const VPVOID _hbkMax; /* highest legal handle address */


  3 Responses to “Category : C++ Source Code
Archive   : VMVCPP.ZIP
Filename : VMBM.H

  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/