示例#1
0
void AskFileSave() {
#if (TARGET_MSDOS == 16 && TARGET_WINDOWS >= 31) || TARGET_MSDOS == 32
	OPENFILENAME f;
	char filename[129];

# if TARGET_MSDOS == 16
	_fmemset(&f,0,sizeof(f));
# else
	memset(&f,0,sizeof(f));
# endif
	f.lpstrFile = filename;
	f.nMaxFile = sizeof(filename);
	f.lStructSize = sizeof(f);
	f.hwndOwner = hwndMain;
	f.hInstance = myInstance;
	f.lpstrFilter = openSaveFilter;
	f.nFilterIndex = 1;
	f.lpstrTitle = "Save to what?";
	f.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
	filename[0] = 0;
	if (GetSaveFileName(&f)) {
		MessageBox(hwndMain,f.lpstrFile,"You selected",MB_OK);
	}
#else
	MessageBox(hwndMain,"GetSaveFileName didn't appear until Windows 3.1","Oops!",MB_OK);
#endif
}
示例#2
0
word FindShortestPath(void)
{
#define PROCEED(n) if(!path_prev[n] && TilePassable(n)){path_prev[n] = m; QUEUE_PUSH(n)}
	word n = TILE_ENCODE(player->tilex, player->tiley);
	word m;
	byte i;
	_fmemset(path_prev,0,sizeof(path_prev));
	QUEUE_RESET
	QUEUE_PUSH(n)
	path_prev[n] = WORD_MAX;
	while(!QUEUE_EMPTY)
	{
		m = QueuePop();
		if(ObjectOfInterest(m))
		{
			return m;
		}
		// add neighbours. don't worry about bounds checking, maps
		// should be guarded anyway
		n = m + 1;
		PROCEED(n)
		n = m - 1;
		PROCEED(n)
		n = m + MAPSIZE;
		PROCEED(n)
		n = m - MAPSIZE;
		PROCEED(n)
	}
	return 0;
#undef PROCEED
}
示例#3
0
/**@internal _rmCreateAdapter
 *  Create the "adapter" node.  The "adapter" node belongs to this driver's
 *  "driver" node.  Also as part of this operation, the "resource" nodes
 *  associated with this driver will be moved to the "adapter" node.
 * @param None.
 * @notes Changes state of the RM object to 'rmAdapterCreated'.
 * @return APIRET rc - 0 iff good creation.  Returns non-zero and logs a soft
 *  error on failure.
 */
APIRET ResourceManager::_rmCreateAdapter()
{
   APIRET rc;
   ADAPTERSTRUCT AdapterStruct;

   if (_state != rmAdapterCreated) {
      _fmemset( (PVOID) &AdapterStruct, 0, sizeof(AdapterStruct) );
      AdapterStruct.AdaptDescriptName = (PSZ) "SoundBlaster Live!" ;      /* ### IHV */
      AdapterStruct.AdaptFlags        = AS_16MB_ADDRESS_LIMIT;    // AdaptFlags         /* ### IHV */
      AdapterStruct.BaseType          = AS_BASE_MMEDIA;           // BaseType
      AdapterStruct.SubType           = AS_SUB_MM_AUDIO;          // SubType
      AdapterStruct.InterfaceType     = AS_INTF_GENERIC;          // InterfaceType
      AdapterStruct.HostBusType       = AS_HOSTBUS_PCI;           // HostBusType        /* ### IHV */
      AdapterStruct.HostBusWidth      = AS_BUSWIDTH_32BIT;        // HostBusWidth       /* ### IHV */
      AdapterStruct.pAdjunctList      = NULL;                     // pAdjunctList       /* ### IHV */

      //--- Register adapter.  We'll record any error code, but won't fail
      // the driver initialization and won't return resources.
      rc = RMCreateAdapter( _hDriver,          // Handle to driver
                            &_hAdapter,        // (OUT) Handle to adapter
                            &AdapterStruct,    // Adapter structure
                            NULL,              // Parent device (defaults OK)
                            NULL );            // Allocated resources.  We assign ownership
                                               // of the IO, IRQ, etc. resources to the
                                               // device (via RMCreateDevice()), not to the
                                               // adapter (as done in disk DD sample).
      if (rc == RMRC_SUCCESS)
         _state = rmAdapterCreated;
   }
   return rc;
}
示例#4
0
void __fsetbits( unsigned char _WCFAR *vector, const char _WCFAR *charset )
{
    char    c;

    _fmemset( vector, 0, CHARVECTOR_SIZE );
    for( ; c = *charset; ++charset ) {
        SETCHARBIT( vector, c );
    }
}
示例#5
0
文件: bm.cpp 项目: maerson/windbg
BOOL  BMNewBlock ( int iabl ) {
    assert ( iabl < cablMax );
    assert ( *( rgabl + iabl ) == NULL );

    if ( ( *( rgabl + iabl ) = _fmalloc ( clpvMax * sizeof ( LPV ) ) ) == NULL ) {
        return FALSE;
    }
    _fmemset ( *( rgabl + iabl ), 0, clpvMax * sizeof ( LPV ) );

#ifdef DEBUGVER
    if ( ( *( rglckb + iabl ) = _fmalloc ( clpvMax * sizeof ( BYTE ) ) ) == NULL ) {
        return FALSE;
    }
    _fmemset ( *( rglckb + iabl ), 0, clpvMax * sizeof ( BYTE ) );
#endif

    return TRUE;
}
示例#6
0
VOID DeleteVertex(LEVEL_DATA *pLevel, INT nIndex)
{
  INT i, j, n;
  POLYGON huge *p;

  if (nIndex < pLevel->nVertices - 1)
  {
    for(i = nIndex; i < pLevel->nVertices - 1; ++i)
    {
      _fmemcpy( pLevel->pVertexData + i,
                pLevel->pVertexData + i + 1,
                sizeof(VERTEX) );
    }

    //
    //  Adjust the polygon vertex offsets.
    //

    p = pLevel->pPolygonData;

    for(i = 0; i < pLevel->nPolygons; ++i)
    {
      n = (p->flags & 7) + 3;

      for(j = 0; j < n; ++j)
      {
        if (p->vertices[j] == nIndex)
        {
          MsgBox( hwndMDIClient,
                  MB_ICONEXCLAMATION,
                  "Vertex deleted while still in use! (Yes, this means something is really f'd up!)" );
        }
        else if (p->vertices[j] > nIndex)
        {
          --p->vertices[j];
        }
      }

      ++p;
    }
  }

  //
  //  Zero the empty vertex.
  //

  --pLevel->nVertices;

  _fmemset(pLevel->pVertexData + pLevel->nVertices, 0, sizeof(VERTEX));

  pLevel->bRebuildZone = TRUE;

  return;

} // DeleteVertex
示例#7
0
BOOL NewVertex(LEVEL_DATA *pLevel, LONG x, LONG y, LONG z)
{
  INT nIndex;
  VERTEX vertex;
  VERTEX huge *p;

  if (pLevel->nVertices == MAX_NUM_VERTICES)
  {
    MsgBox( hwndMDIClient,
            MB_ICONEXCLAMATION,
            "Out of vertex data space" );

    return FALSE;
  }

  _fmemset(&vertex, 0, sizeof(VERTEX));

  vertex.flags = 0;
  vertex.x = (float)x;
  vertex.y = (float)y;
  vertex.z = (float)z;
  vertex.group_index = -1;
  vertex.sprite_index = -1;
  vertex.noise_index = -1;
  vertex.lifeform_index = -1;
  vertex.item_index = -1;
  vertex.trigger_index = -1;

  //
  //  If we already have that vertex then just make sure it isn't hidden.
  //

  nIndex = FindVertex(pLevel, 0, &vertex);

  if (nIndex != -1)
  {
    p = pLevel->pVertexData + nIndex;
    p->flags &= ~VF_HIDDEN;
    return TRUE;
  }

  //
  //  Record the new vertex.
  //

  _fmemcpy(pLevel->pVertexData + pLevel->nVertices, &vertex, sizeof(VERTEX));

  ++pLevel->nVertices;

  pLevel->bRebuildZone = TRUE;

  return TRUE;

} // NewVertex
示例#8
0
WORD    EffFIRNOp (WORD usLen, float flFrq, WINTYP usWin, BOOL bfFstFlg, 
        LPTDOF lpTDoFtr)

{
    WORD    usi;
    float   flDly;

    /********************************************************************/
    /********************************************************************/
    _fmemset (lpTDoFtr, 0, sizeof (*lpTDoFtr));         /* Initialize   */

    /********************************************************************/
    /********************************************************************/
    if (usLen <= 1) return (1);
    if (usWin < 1 || usWin > 6) return (2);
    if (flFrq <= 0.0 || flFrq >= 0.5) return (3);

    /********************************************************************/
    /* If length is odd, set middle coefficient                         */
    /* Note: all windows equal unity at exact center                    */
    /********************************************************************/
    for (usi = 0; usi < usLen; usi++) lpTDoFtr->tbZer.flCoe[usi] = 0;
    if (usLen % 2) lpTDoFtr->tbZer.flCoe[(usLen-1) / 2] = (float) (2 * flFrq);

    /********************************************************************/
    /********************************************************************/
    flFrq = (float) (2.0 * dbPI * flFrq);       /* Convert to radians   */
    flDly = (float) ((usLen-1) / 2.0);

    /********************************************************************/
    /********************************************************************/
    for (usi = 0; usi < usLen/2; usi++) {
        lpTDoFtr->tbZer.flCoe[usi] = (float) (sin((double) (flFrq * ((float) usi - flDly)))
            / (dbPI * ((float) usi - flDly)) * EffFIRWin (usWin, usLen, usi));
        lpTDoFtr->tbZer.flCoe[usLen - usi - 1] = lpTDoFtr->tbZer.flCoe[usi];
    }

    /********************************************************************/
    /********************************************************************/
    lpTDoFtr->usTyp = EFFFIRXXX;
    lpTDoFtr->usSec = 1;
    lpTDoFtr->bfFst = bfFstFlg;    
    lpTDoFtr->tbZer.usLen = usLen;

    /********************************************************************/
    /* Adjust coefficients for long fraction math (if requested)        */
    /********************************************************************/
    if (lpTDoFtr->bfFst) for (usi = 0; usi < usLen; usi++) 
        lpTDoFtr->tbZer.lfCoe[usi] = (LNGFRA) (LNGFRAONE * lpTDoFtr->tbZer.flCoe[usi]);

    /********************************************************************/
    /********************************************************************/
    return (0);
}
示例#9
0
// constructor
//***********************************************************************
CParser::CParser( LPSTR lpScript, LPSTR lpError, int nErrorBytes )
//***********************************************************************
{
	m_lpScript = lpScript;
	m_lpError  = lpError;
	m_nErrorBytes = nErrorBytes;
	if (m_lpError)
		_fmemset(m_lpError, 0, m_nErrorBytes);		// clear the error buffer
	m_nBytesUsed = 1;	// used 1 for the null character already
	m_LineNum = 1;
}
示例#10
0
文件: WIN.CPP 项目: xfxf123444/japan
int cwindow::gettext(char * szstr, int nrow)
{        
	int		i;
	char __far*	szmem = (char __far*)(0x0b8000000 + m_npage * 1024 * 4);
	
	szmem += ((nrow + m_nrow1 - 1) * g_SysInfo.nmaxcols + m_ncol1 + 1) * 2;
	//i=_fstrlen(szstr);
    _fmemset(szstr, '\0',65);
	for(i = 0; i < m_ncol2 - m_ncol1 - 2; i++)   
		*(szstr + i) = *(szmem + i * 2);
	return _fstrlen(szstr);
}
示例#11
0
VOID DeletePolygon(LEVEL_DATA *pLevel, INT nIndex)
{
  INT i;
  POLYGON huge *p;

  if (nIndex < pLevel->nPolygons - 1)
  {
    for(i = nIndex; i < pLevel->nPolygons - 1; ++i)
    {
      _fmemcpy( pLevel->pPolygonData + i,
                pLevel->pPolygonData + i + 1,
                sizeof(POLYGON) );
    }

    //
    //  Adjust the polygon links.
    //

    p = pLevel->pPolygonData;

    for( i = 0; i < pLevel->nPolygons; ++i )
    {
      if (p->flags & PF_LINKED)
      {
        if (p->polygon_link == nIndex)
        {
          MsgBox( hwndMDIClient,
                  MB_ICONEXCLAMATION,
                  "Polygon deleted while still in use!" );
        }
        else if (p->polygon_link > nIndex)
        {
          --p->polygon_link;
        }
      }

      ++p;
    }
  }

  //
  //  Zero the empty vertex.
  //

  --pLevel->nPolygons;

  _fmemset(pLevel->pPolygonData + pLevel->nPolygons, 0, sizeof(POLYGON));

  pLevel->bRebuildZone = TRUE;

  return;

} // DeletePolygon
示例#12
0
文件: bm.cpp 项目: maerson/windbg
BOOL  BMInit ( VOID ) {

#ifdef BMHANDLES // {

    if ( ( rgabl = (ABL FAR *) _fmalloc ( sizeof ( ABL ) * cablMax ) ) == NULL ) {
        return FALSE;
    }
    _fmemset ( rgabl, 0, sizeof ( ABL ) * cablMax );

#ifdef DEBUGVER
    if ( ( rglckb = (LCKB FAR *) _fmalloc ( sizeof ( LCKB ) * cablMax ) ) == NULL ) {
        return FALSE;
    }
    _fmemset ( rglckb, 0, sizeof ( LCKB ) * cablMax );
#endif

    // CAV 6583 -- must reset hvCur each time we re-init
    // (the IDE calls BMInit() each time it starts a debug session, codeview
    // only calls BMInit() once so hvCur doesn't need to be reset...

    hvCur = (HMEM) 1;

    CVInitCritSection(icsBm);

    return BMNewBlock ( 0 );

#else // } else !BMHANDLES {

    // We're going to return pointers directly, rather than having our own
    // handles.  So we need to make sure that pointers and handles are the
    // same size.
    assert ( sizeof(HMEM) == sizeof(VOID FAR *) );

    return TRUE;

#endif // }

}
示例#13
0
/* private */
static int soundblaster_silence_buffer(soundcard_t sc) {
    struct sndsb_ctx *card = soundblaster_get_sndsb_ctx(sc);

    if (card == NULL) return -1;

    if (card->buffer_lin != NULL) {
#if TARGET_MSDOS == 16
        _fmemset(card->buffer_lin,sc->cur_codec.bits_per_sample == 8 ? 128 : 0,card->buffer_size);
#else
        memset(card->buffer_lin,sc->cur_codec.bits_per_sample == 8 ? 128 : 0,card->buffer_size);
#endif
    }

    return 0;
}
示例#14
0
/*
** Set memory
*/
void Memset(void  *dest,char car, long n)
{ if(n<0) Bug("MStInf"); /*set inf to zero*/
  if(n==0)return;
#if DT_OS == 'd'
#  if DT_CC == 'd'
  memset(dest,car,(size_t)n);
#  else
   if(n>0x10000L) Bug("MStSup"); /*DOS limit: not more than 0x10000*/
  _fmemset(dest,car,(size_t)n);
#  endif
#elif DT_OS == 'o'
  memset(dest,car,(size_t)n);
#else
  memset(dest,car,(size_t)n);
#endif
}
示例#15
0
文件: filelist.c 项目: h16o2u9u/rtoss
static LPITEMIDLIST Create(UINT cbSize)
{
	LPMALLOC pMalloc;
	HRESULT  hr;
	LPITEMIDLIST pIDL = NULL;

	hr=SHGetMalloc(&pMalloc);
	if (FAILED(hr))
		return 0;
	pIDL = (LPITEMIDLIST)pMalloc->lpVtbl->Alloc(pMalloc, cbSize);
	if (pIDL)
		_fmemset(pIDL, 0, cbSize);
	if (pMalloc)
		pMalloc->lpVtbl->Release(pMalloc);
	return pIDL;
}
示例#16
0
unsigned allocSysBlk(const unsigned size, const unsigned mode)
{	unsigned segm;
	struct MCB _seg *mcb;

	if((segm = allocBlk(size, mode)) != 0) {
#ifdef DEBUG
		_fmemset(MK_FP(segm, 0), '-', size);
#endif
		mcb = (struct MCB _seg*)SEG2MCB(segm);
		mcb->mcb_ownerPSP = 8;
		dprintf(("[MEM: allocated system memory block: %04x/%u]\n"
		 , segm, size));
	}

	return segm;
}
示例#17
0
/*** LLHlleCreate
*
* Purpose:
*   Allocate and initialize new node for list
*
* Input:
*   hlli     :  List to create node for.
*
* Output:
*   Returns newly created node (zero filled) if successful, otherwise
*   NULL.
*
* Exceptions:
*
* Notes:
*
*************************************************************************/
HLLE 
LLHlleCreate(
HLLI    hlli ) {
    LPLLE   lplle;
    LPLLI   lplli;
    HLLE    hlle;
    WORD    cbNode;

    assert( hlli );
//
// Ensure that the list is OK
//
#if DEBUG > 1
    LLFCheckHlli( hlli );
#endif
//
// Compute size of node with user data area
//
    lplli = LockHlli( hlli );
    cbNode = (WORD)(sizeof( LLE ) + lplli->cbUserData);
    UnlockHlli( hlli );

#ifdef DEBUGVER
//
// Debug version, we're going to stuff a "sentinel" on to the end of the
// user's data for consistency checks.
//
    cbNode += sizeof( WORD );
#endif // DEBUGVER
//
// Allocate the node
//
    if ( hlle = HlleAllocCb( cbNode ) ) {
        lplle = LockHlle( hlle );
        _fmemset( (LPV)lplle, 0, cbNode );
#ifdef DEBUGVER
//
// Stuff in the consistency check stuff
//
        *(WORD FAR *)((BYTE FAR *)lplle + cbNode - sizeof( WORD )) = WCONSIST;
        lplle->wTest = WCONSIST;
#endif // DEBUGVER
        UnlockHlle( hlle );
    }

    return hlle;
}
示例#18
0
/**@external ResourceManager
 *  Constructor for RM object.
 * @notes Creates a "driver" node for this device driver, but does not
 *  allocate resources.
 */
ResourceManager::ResourceManager(ULONG pciId)
{
   APIRET rc;
   DRIVERSTRUCT DriverStruct;
   PSEL p;
   PGINFOSEG pGIS = 0;

   /* Warp version level, bus type, machine ID, and much other information is
    * readily available.  Reference the RM ADD sample in the DDK for code.
    *
    * Create a "driver" struct for this driver.  This must ALWAYS be the
    * first true RM call executed, as it attaches the Resource Manager
    * library and performs setup for the other RM calls.
    */
   _fmemset( (PVOID) &DriverStruct, 0, sizeof(DriverStruct) );
   DriverStruct.DrvrName     = (PSZ) "SBLIVE16.SYS";                  /* ### IHV */
   DriverStruct.DrvrDescript = (PSZ) "SoundBlaster Live!";    /* ### IHV */
   DriverStruct.VendorName   = (PSZ) "Creative Labs";             /* ### IHV */
   DriverStruct.MajorVer     = CMVERSION_MAJOR;          //rmbase.h /* ### IHV */
   DriverStruct.MinorVer     = CMVERSION_MINOR;          //rmbase.h /* ### IHV */
   DriverStruct.Date.Year    = 2000;                                /* ### IHV */
   DriverStruct.Date.Month   = 2;                                   /* ### IHV */
   DriverStruct.Date.Day     = 1;                                   /* ### IHV */
   DriverStruct.DrvrType     = DRT_AUDIO;
   DriverStruct.DrvrSubType  = 0;
   DriverStruct.DrvrCallback = NULL;
   rc = RMCreateDriver( &DriverStruct, &_hDriver );
   if( rc == RMRC_SUCCESS )
      _state = rmDriverCreated;
   else {
      _state = rmDriverFailed;
      _hDriver = 0;
   }

   // Build a pointer to the Global Information Segment.
   rc = DevHelp_GetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (PPVOID)&p );
   if (rc) {
      _rmDetection = FALSE;
   }
   else {
      SELECTOROF(pGIS) = *p;
      _rmDetection =
         ( (pGIS->uchMajorVersion > 20) ||
           ((pGIS->uchMajorVersion == 20) && (pGIS->uchMinorVersion > 30)) );
   }
}
示例#19
0
/*
	This function loads a resource into memory and then passes it to WaveMixOpenWave
	as a memory file to demonstrate how to open a memory file.  If you had wanted to
	just open the resource you would just call:
		  WaveMixOpenWave(ghMixSession,"WaveResource",ghInst,WMIX_RESOURCE);
*/
LPMIXWAVE OpenMemoryFile(HANDLE hMixSession)
{
	HRSRC	hRsrc = NULL;
	HGLOBAL hMem = NULL;
	HPSTR	lp = NULL;
	LPMIXWAVE lpWav=NULL;
	MMIOINFO mmioInfo;

	// Note:  the memory buffer needs to be read-write for
	//        this operation to succeed.  Since I am just
	//        loading a resource and using  that as my memory
	//        file I need to mark the resource as writeable when
	//        I link the program.  If you use GlobalAlloc and copy
	//        your data into it, you should be fine.
	//        
	hRsrc = FindResource(ghInst,"OneWave","WAVE");
	if (!hRsrc)
		goto cleanup;
	hMem = LoadResource(ghInst, hRsrc);
	if (!hMem)
		goto cleanup;

	lp=LockResource(hMem);
	if (!lp)
		goto cleanup;

	_fmemset((LPSTR)&mmioInfo,0,sizeof(MMIOINFO));
	mmioInfo.pchBuffer=lp;
#if defined(WIN32)
	mmioInfo.cchBuffer=SizeofResource(ghInst,hRsrc);
#else
	mmioInfo.cchBuffer=GlobalSize(hMem);
#endif
	mmioInfo.fccIOProc=FOURCC_MEM;
	mmioInfo.adwInfo[0]=(DWORD)NULL;

	lpWav = WaveMixOpenWave(hMixSession,(LPSTR)&mmioInfo,ghInst,WMIX_MEMORY);

cleanup:
	if (lp)
		UnlockResource(hMem);
	if (hMem)
		FreeResource(hMem);
	return lpWav;
}
示例#20
0
BOOL Getallparmapinfo()
{
    BOOL            bFindFloppy = FALSE,bFloppy;
    int				i, j = 0;
    PARMAPINFO		*pNew = NULL;
    DRIVE_MAP_INFO  drvinfo;

    g_nTotalDrive = 0;
    for(i='A'; i<='Z'; i++)
    {
        if(!_chdrive(i-'A'+1))
        {
            g_nTotalDrive ++;
            g_drives[i-'A'] = i;

            bFloppy = IsFloppyDisk(i-'A'+1);

            if (!bFindFloppy)
            {
                g_chLogDrive = i;
                bFindFloppy = bFloppy;
            }

            if (!bFloppy)
            {
                _fmemset(&drvinfo,0,sizeof(DRIVE_MAP_INFO));
                if (GetDriveMapInfo(i - 'A' + 1, &drvinfo))
                {
                    pNew = (PARMAPINFO*)malloc(sizeof(PARMAPINFO));
                    pNew->cDrv=i;
                    pNew->dmiInt13Unit = drvinfo.dmiInt13Unit;
                    pNew->dmiPartitionStartRBA = drvinfo.dmiPartitionStartRBA[0];

                    pNew->pNext = g_pParMapInfo;
                    g_pParMapInfo = pNew;
                }
            }
        }
        else
        {
            g_drives[i-'A'] = 0;
        }
    }
    return TRUE;
}
示例#21
0
_WCRTLINK void _WCHUGE *halloc( long numb, unsigned size )
{
    unsigned long   amount;
#if defined(__WINDOWS__)
    HANDLE          hmem;
    LPSTR           p;

    amount = (unsigned long)numb * size;
    if( amount == 0 )
        return( HUGE_NULL );
    if( amount > 65536 && ! only_one_bit( size ) )
        return( HUGE_NULL );
    hmem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, amount );
    if( hmem == NULL )
        return( HUGE_NULL );
    p = GlobalLock( hmem );
    return( p );
#else
    long            seg;
    unsigned int    num_of_paras;
    char            _WCHUGE *hp;

    amount = (unsigned long)numb * size;
    if( amount == 0  || amount >= 0x100000 )
        return( HUGE_NULL );
    if( amount > 65536 && ! only_one_bit( size ) )
        return( HUGE_NULL );
    num_of_paras = __ROUND_UP_SIZE_TO_PARA( amount );
    seg = _dosalloc( num_of_paras );
    if( seg < 0 )
        return( HUGE_NULL );  /* allocation failed */
    hp = (char _WCHUGE *)MK_FP( (unsigned short)seg, 0 );
    for( ;; ) {
        size = 0x8000;
        if( num_of_paras < 0x0800 )
            size = num_of_paras << 4;
        _fmemset( hp, 0, size );
        if( num_of_paras < 0x0800 )
            break;
        hp = hp + size;
        num_of_paras -= 0x0800;
    }
    return( (void _WCHUGE *)MK_FP( (unsigned short)seg, 0 ) );
#endif
}
示例#22
0
static void Load_MCGA( short rows, short font, short cursor )
/*===========================================================

   This routines loads an alphanumeric font for the MCGA.   */

{
    VideoInt( _BIOS_VIDEO_PAGE, 0, 0, 0 );         // set active page to 0
    VideoInt( _BIOS_SET_MODE + GetVideoMode(), 0, 0, 0 );
    _fmemset( MK_FP( _EgaSeg, _EgaOff ), 0, 0x2000 );  // must do for MCGA 40 rows
    VideoInt( font & 0xFF0F, 0, 0, 0 );             // load character set
    VideoInt( 0x1103, 0, 0, 0 );
    VideoInt( _BIOS_CURSOR_SIZE, 0, cursor, 0 );    // reset the cursor
    outpw( 0x03D4, ( cursor & 0xFF00 ) + 0x09 );    // # double scan lines
    *(char far *)_BIOS_data( ROWS ) = rows - 1;       // # of rows
    // # of vertical points per character
    *(short far *)_BIOS_data( POINTS ) = 2 * ( cursor & 0xFF + 1 );
    _GrCursor = 1;                                          // cursor is on
}
示例#23
0
VOIDPTR Memset(VOIDPTR pMem, WORD wValue, DWORD dwSize)
{
  VOIDPTR theReturn = pMem;
  BYTEPTR pByte = (BYTEPTR) pMem;
  WORD count = 0;
  size_t theMemSetSize;
  while (dwSize != 0)
  {
   if (dwSize > 0xFFFF)
     theMemSetSize = 0xFFFF;
   else
     theMemSetSize = (size_t)dwSize;
   if (_fmemset(&pByte[count*0x10000], wValue, theMemSetSize) == NULL)
     return NULL;
   dwSize -= theMemSetSize;
   count++;
  }
  return theReturn;
}
示例#24
0
//************************************************************************
CDib::CDib()
//************************************************************************
{
	m_bmiHeader.biSize			= sizeof(BITMAPINFOHEADER);
	m_bmiHeader.biWidth			= 1;
	m_bmiHeader.biHeight		= 1;
	m_bmiHeader.biPlanes		= 1;
	m_bmiHeader.biBitCount		= 8;
	m_bmiHeader.biCompression	= BI_RGB;
	m_bmiHeader.biSizeImage		= 0;
	m_bmiHeader.biXPelsPerMeter = 0;
	m_bmiHeader.biYPelsPerMeter = 0;
	m_bmiHeader.biClrUsed		= 0;
	m_bmiHeader.biClrImportant	= 0;
	_fmemset(m_rgbQuad, 0, sizeof(m_rgbQuad));
	m_lp = NULL;
	m_iRefCount = 0;
	AddRef();
}
示例#25
0
/**@internal _rmCreateDevice
 *  Create Device node in the OS/2 RM allocation tree.  Device nodes belong
 *  to the Adapter node, just like the Resource nodes.
 * @param PSZ pszName - Descriptive name of device.
 * @param PAHRESOURCE pahResource - Handles of allocated resources that are
 *  owned by this device.
 * @return APIRET rc - Value returned by RMCreateDevice() call.
 * @notes Same "soft" error strategy as adapter registration: we'll record
 *  any errors but hold onto the resources and continue to operate the
 *  driver.
 * @notes
 */
APIRET ResourceManager::_rmCreateDevice( PSZ pszName, NPAHRESOURCE pahResource )
{
   DEVICESTRUCT DeviceStruct;
   HDEVICE hDevice;
   APIRET rc;

   _fmemset( (PVOID) &DeviceStruct, 0, sizeof(DeviceStruct) );
   DeviceStruct.DevDescriptName = pszName;
   DeviceStruct.DevFlags        = DS_FIXED_LOGICALNAME;
   DeviceStruct.DevType         = DS_TYPE_AUDIO;
   DeviceStruct.pAdjunctList    = NULL;

   rc = RMCreateDevice( _hDriver,      // Handle to driver
                        &hDevice,      // (OUT) Handle to device, unused.
                        &DeviceStruct, // Device structure
                        _hAdapter,     // Parent adapter
                        pahResource ); // Allocated resources
   return rc;
}
WIOERR WIOAPI wioFileClose
(
    LPWAVEIOCB      pwio,
    DWORD           fdwClose
)
{
    //
    //  validate a couple of things...
    //
    if (NULL == pwio)
        return (WIOERR_BADPARAM);


    //
    //  get rid of stuff...
    //
//  wioStopWave(pwio);
    
    if (NULL != pwio->hmmio)
    {
        mmioClose(pwio->hmmio, 0);
    }
    
//  FreeWaveHeaders(lpwio);

#if 0
    if (pwio->pInfo)
        riffFreeINFO(&(lpwio->pInfo));
    
    if (pwio->pDisp)
        riffFreeDISP(&(lpwio->pDisp));
#endif

    if (NULL != pwio->pwfx)
        GlobalFreePtr(pwio->pwfx);

    _fmemset(pwio, 0, sizeof(*pwio));

    return (WIOERR_NOERROR);
} // wioFileClose()
示例#27
0
void TShopDlg::Okay(RTMessage Msg)
{
	PTListBox pLB = (PTListBox) GetChild(LBID_TRADETYPES);
	int i, n, nIndices[5];
    char sz[20];

	n = pLB->GetSelCount();
	if (n > 5 || n < 1)
	{
		pApplication->MsgBox(this, MB_ICONINFORMATION, "Shop Error",
		 "You must have at least one trade type,\n"
		 "and no more than five.");
        return;
	}

	pLB->GetSelIndices(nIndices, 5);
	_fmemset(pShop->nTradeTypes, 0, sizeof(pShop->nTradeTypes));
	for (i=0; i<n; i++)
	{
		GetBoxSel(pLB, ObjTypeList, sz, 20, nIndices[i]);
		pShop->nTradeTypes[i] = atoi(sz);
	}

	pShop->nBuyMarkup = GetDlgItemInt(hWindow, EID_BUYMARKUP, NULL, FALSE);
	pShop->nSellMarkdown = GetDlgItemInt(hWindow, EID_SELLMARKDOWN, NULL, FALSE);
	pShop->nOpenHour = GetDlgItemInt(hWindow, EID_OPENHR, NULL, FALSE);
	pShop->nCloseHour = GetDlgItemInt(hWindow, EID_CLOSEHR, NULL, FALSE);

	if (pShop->nOpenHour < 0 || pShop->nOpenHour > 23 ||
	 pShop->nCloseHour < 0 || pShop->nCloseHour > 23)
	{
		pApplication->MsgBox(this, MB_ICONINFORMATION, "Shop Error",
		 "Shop hours can range from 0 to 23.");
        return;
	}

	//chain to original
    TDialog::Okay(Msg);
}	//TShopDlg::Okay
示例#28
0
_WCRTLINK void _WCHUGE *halloc( long n, unsigned size )
    {
        unsigned long len;
#if defined(__WINDOWS__)
        HANDLE hmem;
        LPSTR p;

        len = (unsigned long)n * size;
        if( len == 0 ) return( HUGE_NULL );
        if( len > 65536 && ! only_one_bit( size ) ) return( HUGE_NULL );
        hmem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, len );
        if( hmem == NULL ) return( HUGE_NULL );
        p = GlobalLock( hmem );
        return( p );
#else
        long seg;
        unsigned int paras;
        char _WCHUGE *hp;

        len = (unsigned long)n * size;
        if( len == 0  || len >= 0x100000 ) return( HUGE_NULL );
        if( len > 65536 && ! only_one_bit( size ) ) return( HUGE_NULL );
        paras = (len + 15) >> 4;
        seg = _dosalloc( paras );
        if( seg < 0 ) return( HUGE_NULL );  /* allocation failed */
        hp = (char _WCHUGE *)MK_FP( (unsigned short)seg, 0 );
        for( ;; ) {
            size = 0x8000;
            if( paras < 0x0800 )
                size = paras << 4;
            _fmemset( hp, 0, size );
            if( paras < 0x0800 )
                break;
            hp = hp + size;
            paras -= 0x0800;
        }
        return( (void _WCHUGE *)MK_FP( (unsigned short)seg, 0 ) );
#endif
    }
示例#29
0
WORD FAR PASCAL MCICfgLod (VISMEMHDL FAR *pmhCfgMem, LPCSTR lpCfgFil, LPCSTR lpSecNam)
{
    DIGCFG FAR *lpDigCfg;    

    /********************************************************************/
    /********************************************************************/
    if (NULL == (lpDigCfg = GloAloLck (GMEM_MOVEABLE, pmhCfgMem, 
        sizeof (DIGCFG)))) return ((WORD) -1);
    _fmemset (lpDigCfg, 0, sizeof (*lpDigCfg));

    /********************************************************************/
    /* Check for user specified configuration file and set              */
    /* board parameters accordingly.                                    */
    /********************************************************************/
    lpDigCfg->usLvlInp = (WORD) GetPrfLng (lpCfgFil, lpSecNam, PI_LVLINP, 0);
    lpDigCfg->usLvlOut = (WORD) GetPrfLng (lpCfgFil, lpSecNam, PI_LVLOUT, 0);

    /********************************************************************/
    /********************************************************************/
    GloMemUnL (*pmhCfgMem);
    return (0);

}
示例#30
0
/*** LLHlliInit
*
* Purpose:
*   Create a new list with specified options
*
* Input:
*   cbUserData :    Number of bytes for user data per node.  Must be > 0.
*   llf        :    List type flags (llfNull, llfAscending, or llfDescending)
*                   (indicates wether or not list is sorted)
*   lpfnKill   :    callback to application for node deletion notification
*                   (may be NULL)
*   lpfnCmp    :    Node comparison callback.  May be NULL for non-sorted
*                   lists.  Otherwise, required.
*
* Output:
*   Either returns valid HLLI for newly created list or NULL for failure.
*
* Exceptions:
*
* Notes:
*
*************************************************************************/
HLLI 
LLHlliInit(
DWORD           cbUserData,
LLF             llf,
LPFNKILLNODE    lpfnKill,
LPFNFCMPNODE    lpfnCmp ) {
    HLLI    hlli;
    LPLLI   lplli;

    assert( cbUserData );
    assert( llf == llfNull || lpfnCmp );

    if ( hlli = HlliAlloc() ) {
        lplli = LockHlli( hlli );
        _fmemset( lplli, 0, sizeof( LLI ) );
        lplli->pcs = PcsAllocInit();
        lplli->cbUserData = cbUserData;
        lplli->lpfnKill = lpfnKill;
        lplli->lpfnCmp = lpfnCmp;
        lplli->llf = llf;
        UnlockHlli( hlli );
    }
    return hlli;
}