#include <common/iobuff.hpp>

void IOBuffer::destroyBuffer(void)
{
	if(!mhGlobalBuffer)return;
   ::GlobalUnlock(mhGlobalBuffer);
	::GlobalFree(mhGlobalBuffer);
	mhGlobalBuffer=0;
}

WORD IOBuffer::createBuffer(DWORD lengthBuffer)
{
  destroyBuffer();
	mhGlobalBuffer=::GlobalAlloc(GMEM_FIXED,lengthBuffer);
	if(!mhGlobalBuffer)return FALSE;
	mlpBuffer=(BYTE FAR *)::GlobalLock(mhGlobalBuffer);
	return TRUE;
}

