Example #1
0
void
IT_REGSERVERDOC (ENV *envp, LONGPROC f)
{
    LHSERVER lhHandle;
    LPSTR lpString1;
    LPOLESERVERDOC lpdoc;
    LPBYTE lpStr;
    LHSERVERDOC lhdoc;
    DWORD retcode;

    lhHandle = (LHSERVER)GETDWORD(SP+16);
    lpString1 = (LPSTR)GetAddress(GETWORD(SP+14),GETWORD(SP+12));
#ifdef	LATER
    translate the LPOLESERVERDOC and the structures behind it
#endif
    lpdoc = (LPOLESERVERDOC)GETDWORD(SP+8);
    lpStr = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4));
    retcode = OleRegisterServerDoc(lhHandle,
                                   lpString1,
                                   lpdoc,
                                   &lhdoc);
    PUTDWORD(lpStr,lhdoc);
    envp->reg.sp += 2*DWORD_86 + 2*LP_86 + RET_86;
    envp->reg.ax = LOWORD(retcode);
    envp->reg.dx = HIWORD(retcode);
}
Example #2
0
void
IT_LOADACCEL (ENV *envp,LONGPROC f)
{
	LPSTR lpString;
	HGLOBAL	hGlobal;
	WORD wSel = 0;
	MEMORYINFO *lpMemory;
	HINSTANCE hInst;

	lpString = (LPSTR)GetAddress(GETWORD(SP+6),GETWORD(SP+4));
	hInst = GetSelectorHandle(GETWORD(SP+8));
	hGlobal = (f)((HANDLE) hInst,lpString);
	if (hGlobal && (lpMemory = GETHANDLEINFO(hGlobal))) {
	    if (lpMemory->lpData == NULL) 
		lpMemory->lpData = (LPSTR)ConvertResourceToBin
			((LPBYTE)lpMemory->lpCore,lpMemory->wIndex);
	    if (lpMemory->lpData) {
		wSel = AssignSelector((LPBYTE)lpMemory->lpData + 4,0,
			TRANSFER_DATA,lpMemory->dwBinSize);
		SetSelectorHandle(wSel,hGlobal);
	    }
	}
	
	envp->reg.ax = wSel & 0xfffe;
	envp->reg.dx = 0;
	envp->reg.sp += HANDLE_86 + LP_86 + RET_86;
	if (lpMemory)
	  RELEASEHANDLEINFO(lpMemory);
}
Example #3
0
void
IT_WINEXEC (ENV *envp,LONGPROC f)
{
	char buf[0x100];
	LPSTR lpCmdLine,lpTemp;
	LPSTR lpString;
	DWORD retcode;

	lpCmdLine = (LPSTR)GetAddress(GETWORD(SP+8),GETWORD(SP+6));
	if (!lpCmdLine || !strlen(lpCmdLine))
	    retcode = 0;
	else {
	    lpString = (LPSTR)WinStrdup(lpCmdLine);
	    lpTemp = strchr(lpString,' ');
	    if (lpTemp) 
		*lpTemp = '\0';
    	    xdoscall(XDOS_GETALTNAME,0,(void *) buf,(void *) lpString);
	    if (strlen(buf) == 0)
		strcpy(buf,lpString);
	    if (lpTemp) {
		strcat(buf," ");
		strcat(buf,++lpTemp);
	    }
	    retcode = (DWORD)WinExec(buf,(UINT)GETWORD(SP+4));
	    WinFree(lpString);
	}
	if (retcode > 32)
	    retcode = GetDataSelectorFromInstance(retcode);
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
	envp->reg.sp += LP_86 + UINT_86 + RET_86;
}
Example #4
0
void
IT_SIZEOFRESOURCE (ENV *envp,LONGPROC f)
{
	DWORD retcode;
	HINSTANCE hInst;
	HRSRC hrsrc;
	NAMEINFO *lpni = NULL;
	MEMORYINFO *lpMemory;

	hInst = (HINSTANCE)GetSelectorHandle(GETWORD(SP+6));
	hrsrc = (HRSRC)GETWORD(SP+4);
	lpMemory = GETHANDLEINFO(hrsrc);
	if (lpMemory)
	    lpni = (NAMEINFO *)lpMemory->lpCore;
	if (lpni) {
	    if (lpni->hGlobal) {
		lpMemory = GETHANDLEINFO(lpni->hGlobal);
		if (lpMemory && lpMemory->wType)
		    retcode = lpMemory->dwBinSize;
		else
		    retcode = lpni->rcslength;
	    }
	    else
		retcode = lpni->rcslength;
	}
	else
	    retcode = 0L;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
	envp->reg.sp += 2*HANDLE_86 + RET_86;
	if (lpMemory)
	  RELEASEHANDLEINFO(lpMemory);
}
/**
 * \brief This function loads some constants, this normally happens when the game is loaded
 * 		  and the values change depending on what is read for the mods
 */
void CPhysicsSettings::loadGameConstants(int episode, byte* data)
{

	if(episode >= 4 && episode <= 6 )
	{
		// Galaxy Engine
		fallspeed_increase = 7;
		max_fallspeed = 175; // Factor 2.5 to the original assembly it is
		misc.visibility = 7;
	}
	else
	{
		// Vorticon Engine
		misc.visibility = 3;
		fallspeed_increase = 4;
		max_fallspeed = 104;

		if(episode == 1)
		{	// Code for Episode 1.

			// player
			byte pogo = *(data+0x900E);
			player.pogostickonstart = pogo;
			player.start_with_shots = *(data+0x9008);

			// vorticon
			vorticon.default_hp = *(data+0x180D)+1;
			vorticon.commander_hp = *(data+0x1819)+1;

			// tank bot
			tankbot.shot_height_from_top = *(data+0x4900);
			misc.ctspace_ammo = GETWORD(data+0xE03);
			misc.ctspace_keys = GETWORD(data+0xE11);
			misc.one_eyed_tile = GETWORD(data+0x4547);

			misc.joy_tile = GETWORD(data+0x992A);
			misc.bat_tile = GETWORD(data+0x995D);
			misc.vac_tile = GETWORD(data+0x9990);
			misc.wsk_tile = GETWORD(data+0x99C3);

			misc.raygun_tile = GETWORD(data+0x1166);
			misc.pogo_tile = GETWORD(data+0x11A7);
			misc.changestoneblock = GETWORD(data+0x2414);
			// TODO: ... More stuff will come here
		}
		else if(episode == 2)
		{	// Code for Episode 2.
			player.pogostickonstart = true;
			player.start_with_shots = *(data+0x8AA2);
			// TODO: ... More stuff will come here
		}
		else if(episode == 3)
		{	// Code for Episode 3.
			player.pogostickonstart = true;
			player.start_with_shots = 5;
			// TODO: ... More stuff will come here
		}

	}
}
Example #6
0
static const char *config_access(struct access **ls)
{
	struct access *l;

	GETOPEN();
	while (NOTCLOSE()) {
		REQWORD();
		MAKE(l, struct access);
		l->next = *ls;
		*ls = l;
		if (strceq(tokbuf, c_allow))
			l->type = ALLOW;
		else if (strceq(tokbuf, c_deny))
			l->type = DENY;
		else if (strceq(tokbuf, c_apply))
			l->type = APPLY;
		else
			return e_keyword;
		GETWORD();
		if (*tokbuf == '*')
			l->mask = l->addr = 0;
		else {
			if (strceq(tokbuf, c_exact))
				l->mask = (unsigned long) -1;
			else if ((l->mask = inet_addr(tokbuf))
				 == (unsigned long) -1)
				return e_bad_addr;
			GETWORD();
			if ((l->addr = inet_addr(tokbuf))
			    == (unsigned long) -1)
				return e_bad_addr;
		}
	}
	return 0;
}
Example #7
0
void
IT_GLOBALFREE (ENV *envp,LONGPROC f)
{
	DWORD retcode;
	WORD wSel;
	HGLOBAL hGlobal;

	wSel = GETWORD(SP+4) | 1;

	if (wSel == 1)
	{
		envp->reg.sp += HANDLE_86 + RET_86;
		envp->reg.ax = GETWORD(SP+4);
		envp->reg.dx = 0;
		return;
	}

	hGlobal = GetSelectorHandle(wSel);
				
	ZapSegRegs(envp,wSel);

        /* for HUGE objects */
	while ((GetSelectorHandle((UINT)(wSel-8))==hGlobal)) 
	    wSel -= 8;

	while (GetSelectorHandle(wSel) == hGlobal) {
	    FreeSelector(wSel);
	    wSel += 8;
	}
	retcode = (f)(hGlobal);
	envp->reg.sp += HANDLE_86 + RET_86;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
}
Example #8
0
void
IT_COPYMETAFILE(ENV *envp,LONGPROC f)
{
	char buf[0x100];
	WORD wSel;
	HGLOBAL hGlobal;
	LPSTR lpszFile;
	LPBYTE lpData;

	wSel = GETWORD(SP+8);
	hGlobal = GetSelectorHandle(wSel);
	lpszFile = GetAddress(GETWORD(SP+6),GETWORD(SP+4));
	if (lpszFile && strchr(lpszFile,'\\')) {
    	    xdoscall(XDOS_GETALTNAME,0,(void *) buf,(void *) lpszFile); lpszFile = buf;
	}

	hGlobal = CopyMetaFile(hGlobal,lpszFile);
	if (hGlobal) {
	    lpData = (LPBYTE)GlobalLock(hGlobal);
	    wSel = AssignSelector(lpData,0,TRANSFER_DATA,
				GlobalSize(hGlobal));
	    SetSelectorHandle(wSel,hGlobal);
	    GlobalUnlock(hGlobal);
	}
	else
	    wSel = 0;
	envp->reg.sp += HANDLE_86 + LP_86 + RET_86;
	envp->reg.ax = wSel & 0xfffe;
	envp->reg.dx = 0;
}
Example #9
0
int h3600_micro_asset_read( struct h3600_asset *asset )
{
	unsigned char buf[2];
	int retval = -1;   // TODO: fix this to "no such asset" 

	if (0) printk("%s (%d)\n", __FUNCTION__, asset->type);

	switch (asset->type) {
	case ASSET_HM_VERSION:
		retval = h3600_micro_eeprom_read( 0, asset->a.tchar, 10 );
		break;
	case ASSET_SERIAL_NUMBER:
		retval = h3600_micro_eeprom_read( 10, asset->a.tchar, 40 );
		break;
	case ASSET_MODULE_ID:
		retval = h3600_micro_eeprom_read( 50, asset->a.tchar, 20 );
		break;
	case ASSET_PRODUCT_REVISION:
		retval = h3600_micro_eeprom_read( 70, asset->a.tchar, 10 );
		break;
	case ASSET_PRODUCT_ID:
		retval = h3600_micro_eeprom_read( 80, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_FRAME_RATE:
		retval = h3600_micro_eeprom_read( 82, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_PAGE_MODE:
		retval = h3600_micro_eeprom_read( 84, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_COUNTRY_ID:
		retval = h3600_micro_eeprom_read( 86, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_IS_COLOR_DISPLAY:
		retval = h3600_micro_eeprom_read( 88, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_ROM_SIZE:
		retval = h3600_micro_eeprom_read( 90, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_RAM_SIZE:
		retval = h3600_micro_eeprom_read( 92, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_HORIZONTAL_PIXELS:
		retval = h3600_micro_eeprom_read( 94, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	case ASSET_VERTICAL_PIXELS:
		retval = h3600_micro_eeprom_read( 96, buf, 2 );
		asset->a.vshort = GETWORD(buf);
		break;
	}

	return retval;
}
Example #10
0
void
IT_ISBADCODEPTR (ENV *envp,LONGPROC f)
{
        DWORD retcode;
	LPSTR lpString;

	lpString = MAKELP(GETWORD(SP+8),GETWORD(SP+6));
	retcode = (f)(lpString,0);
        envp->reg.sp += LP_86 + RET_86;
        envp->reg.ax = LOWORD(retcode);
        envp->reg.dx = HIWORD(retcode);
}
Example #11
0
void
IT_LOCALREALLOC (ENV *envp,LONGPROC f)	/* TWIN_LocalReAlloc */
{
	DWORD retcode;

	retcode = TWIN_LocalReAlloc((HANDLE)GETWORD(SP+8),
			(UINT)GETWORD(SP+6),
			(UINT)GETWORD(SP+4));
	envp->reg.sp += HANDLE_86 + 2*UINT_86 + RET_86;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
}
Example #12
0
void
IT_ACCESSRESOURCE (ENV *envp,LONGPROC f)
{
	DWORD retcode;

	retcode = (DWORD)AccessResourceBin(
			(HINSTANCE)GetSelectorHandle(GETWORD(SP+6)),
			(HRSRC)GETWORD(SP+4));

	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
	envp->reg.sp += 2*HANDLE_86 + RET_86;
}
Example #13
0
void
IT_OLEENUMOBJ(ENV *envp,LONGPROC f)
{
    DWORD retcode;
    LPBYTE lp1;

    lp1 = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4));
    retcode = OleEnumObjects((LHCLIENTDOC)GETDWORD(SP+8),
                             (LPOLEOBJECT *)lp1);
    envp->reg.sp += LP_86 + LONG_86 + RET_86;
    envp->reg.ax = LOWORD(retcode);
    envp->reg.dx = HIWORD(retcode);
}
Example #14
0
void
IT_LOCALALLOC (ENV *envp,LONGPROC f)	/* TWIN_LocalAlloc */
{
	DWORD retcode;

	if (envp != envp_global)
	    envp_global = envp;
	retcode = TWIN_LocalAlloc((UINT)GETWORD(SP+6),
		(UINT)GETWORD(SP+4));
	envp->reg.sp += 2*UINT_86 + RET_86;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
}
Example #15
0
void
IT_PLAYMETAFILE(ENV *envp,LONGPROC f)
{
	HDC hDC;
	WORD wSel;
	HGLOBAL hGlobal;

	hDC = GETWORD(SP+6);
	wSel = GETWORD(SP+4);
	hGlobal = GetSelectorHandle(wSel);
	envp->reg.ax = PlayMetaFile(hDC, hGlobal);
	envp->reg.sp += 2 * HANDLE_86 + RET_86;
}
Example #16
0
void
IT_LOCALINIT (ENV *envp,LONGPROC f)	/* TWIN_LocalInit */
{
    DWORD retcode;
	UINT seg;

	seg = (UINT)GETWORD(SP+8);
	if (!seg)
	    seg = envp->reg.ds;
	retcode = TWIN_LocalInit(seg, (UINT)GETWORD(SP+6),
			(UINT)GETWORD(SP+4));
	envp->reg.sp += 3*UINT_86 + RET_86;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
}
Example #17
0
void
IT_UNBLOCKSERVER (ENV *envp,LONGPROC f)	/* OleUnblockServer */
{
    DWORD retcode;
    LPBYTE lpData;
    BOOL flag;

    lpData = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4));
    flag = (BOOL)GETWORD(lpData);
    retcode = (f)((LHSERVER)GETDWORD(SP+8),&flag);
    PUTWORD(lpData,(WORD)flag);
    envp->reg.sp += LONG_86 + LP_86 + RET_86;
    envp->reg.ax = LOWORD(retcode);
    envp->reg.dx = HIWORD(retcode);
}
Example #18
0
void
_86_GlobalHandle (ENV *envp,LONGPROC f)
{
	DWORD retcode;
	WORD wSel;
	HGLOBAL hGlobal;
	MEMORYINFO *lpMemory = NULL;

	wSel = GETWORD(SP+4);
	hGlobal = GetSelectorHandle(wSel);
	if (hGlobal && (lpMemory = GETHANDLEINFO(hGlobal))) {
	    if (!(lpMemory->wFlags & GMEM_MOVEABLE))
		wSel |= 1;
	    else
		wSel &= 0xfffe;
	}
	else
	    wSel &= 0xfffe;
	retcode = MAKELONG(wSel,wSel | 1);
	envp->reg.sp += WORD_86 + RET_86;
	envp->reg.ax = LOWORD(retcode);
	envp->reg.dx = HIWORD(retcode);
	if (lpMemory != NULL)
	  RELEASEHANDLEINFO(lpMemory);
}
Example #19
0
// Messenger Chat
bool CCharServer::pakMessengerChat ( CCharClient* thisclient, CPacket* P )
{
    WORD id = GETWORD((*P),0);
    char* message = new char[P->Size-41];
    if(message==NULL)
    {
        Log(MSG_ERROR, "Error allocing memory: pakMessengerChat" );
        return false;
    }
    memcpy( message, &P->Buffer[35], P->Size-41 );
    CCharClient* otherclient = (CCharClient*) GetClientByID(id);
    if(otherclient!=NULL)
    {
        BEGINPACKET( pak, 0x7e2 );
        ADDWORD    ( pak, thisclient->charid );
        ADDWORD    ( pak, 0x0000 );
        ADDSTRING  ( pak, thisclient->charname );
        UINT namesize = strlen(thisclient->charname);
        for (int i=0;i<30-namesize;i++)
            ADDBYTE    ( pak, 0x00 );
        ADDBYTE    ( pak, 0x00 );
        ADDSTRING  ( pak, message );
        ADDBYTE    ( pak, 0x00 );
        otherclient->SendPacket(&pak);
    }
    delete []message;
    return true;
}
Example #20
0
int  xreloc_relocate( xreloc xr ) {
  table *t = (table *) xr;
  int loc;
  int word;
  int mask;
  int err = 0;
  symbol *sym;
  symbol *rel = NULL;
  reloc *r;

  rel = findsym( t, REL_NAME );
  rel->flags = FLAG_RELOCAT | FLAG_GLOBAL;
  rel->loc = 0;

  for( sym = t->syms; sym; sym = sym->next ) {
    if( sym->flags & FLAG_GLOBAL ) { /* symbols to be written to symbol table */
      continue;
    } else if( sym->flags & FLAG_RELOCAT ) { /* symbols need to be relocated */
      sym->flags |= FLAG_WRITTEN;
      for( r = sym->relocs; r; r = r->next ) { 
        add_reloc( t, rel, r->loc, r->size, XRELOC_ABSOLUTE );

        word = GETWORD( t->mem, r->loc );
        mask = ( 1 << r->size ) - 1;
        loc = ( word & mask ) + sym->loc;
        if( loc & ~mask ) {
          fprintf( t->err, "error: relocation out of range for symbol '%s'\n", 
                   sym->name );
          err = 1;
        }
        word = ( word & ~mask ) | ( loc & mask );
        t->mem[r->loc] = word >> 8;
        t->mem[r->loc + 1] = word;
      }
    } else if( sym->loc != INV_ADDR ) { /* symbol is defined */
Example #21
0
uint64_t archive_fetch_data(int fd, int size)
{
	unsigned char data[8] = { 0 };
	uint64_t val = 0;

	if (read(fd, data, size) != size) {
		DPRINTF("Invalid data block\n");
		return (uint64_t)-1;
	}

	switch (size) {
		case 1:	val = GETBYTE(data);
			break;
		case 2:	val = GETWORD(data);
			break;
		case 4:	val = GETUINT32(data);
			break;
		case 8: val = GETUINT64(data);
			break;
		default:val = (uint64_t)-1;
			DPRINTF("Cannot get %d bytes: Not implemented\n", size);
			break;
	}

	return val;
}
/*
** A "local" function of ProcessRequest().  Adds an entry for #object# in the
** registration file indicating that it expires at #expiration#.
*/
static void
DoRegister(const char *object,
           unsigned long expiration) {

  char expirationImage[15 + 1];
  const char *existing;
  const char *registration;

  /*
  ** Overwrite any existing expiration.  This minimizes the size of the
  ** registration file and simplifies searches.
  */
  for(rewind(registrationFile); (registration = ReadRegistration()) != NULL;) {
    (void)GETWORD(expirationImage, registration, &existing);
    existing++; /* Skip space after expiration. */
    if(strcmp(object, existing) == 0) {
      fseek(registrationFile, -strlen(registration) - 1, SEEK_CUR);
      fprintf(registrationFile, EXPIRATION_FORMAT, expiration);
      return;
    }
  }

  fprintf(registrationFile, EXPIRATION_FORMAT, expiration);
  fprintf(registrationFile, " %s\n", object);

}
/*
** A "local" function of ProcessRequest().  Searches through the registration
** file for unexpired objects that match #filter#.  Returns a malloc'ed string
** of the matching objects.
*/
static char *
DoSearch(const char *filter) {

  unsigned long expiration;
  char expirationImage[15 + 1];
  unsigned long now;
  const char *object;
  const char *registration;
  char *returnValue;

  now = (unsigned long)CurrentTime();
  returnValue = strdup("");

  for(rewind(registrationFile); (registration = ReadRegistration()) != NULL;) {
    (void)GETWORD(expirationImage, registration, &object);
    expiration = atol(expirationImage);
    if((expiration == ETERNAL) || (expiration > now)) {
      object++; /* Skip space after expiration. */
      if(MatchFilter(object, filter)) {
        returnValue =
          REALLOC(returnValue, strlen(returnValue) + strlen(object) + 1);
        strcat(returnValue, object);
      }
    }
  }

  return returnValue;

}
/*
** A "local" function of main().  Deletes from the registration file all
** objects that have an expiration time which has already passed.
*/
static void
CompressRegistrations(void) {

  size_t bytesCompressed = 0;
  unsigned long expiration;
  char expirationImage[15 + 1];
  const char *ignored;
  unsigned long now;
  size_t recordLen;
  const char *registration;

  now = (unsigned long)CurrentTime();

  for(rewind(registrationFile); (registration = ReadRegistration()) != NULL;) {
    (void)GETWORD(expirationImage, registration, &ignored);
    expiration = atol(expirationImage);
    recordLen = strlen(registration) + 1;
    if((expiration != ETERNAL) && (expiration <= now)) {
      bytesCompressed += recordLen;
    }
    else if(bytesCompressed > 0) {
      /* Move this record forward to the end of the still-current objects. */
      fseek(registrationFile, -(recordLen + bytesCompressed), SEEK_CUR);
      fprintf(registrationFile, "%s\n", registration);
      fseek(registrationFile, bytesCompressed, SEEK_CUR);
    }
  }

  /* Truncate any records that we've moved. */
  if(bytesCompressed > 0) {
    fseek(registrationFile, -bytesCompressed, SEEK_CUR);
    ftruncate(fileno(registrationFile), ftell(registrationFile));
  }

}
Example #25
0
void
IT_GETCLIPBDATA (ENV *envp,LONGPROC f)
{
	WORD wSel;
	HGLOBAL hGlobal;
	MEMORYINFO *lpMemory;
	UINT uiFormat = GETWORD(SP+4);

	hGlobal = (DWORD)(f)(uiFormat);
	if (uiFormat == CF_BITMAP)
           envp->reg.ax = hGlobal;
        else {   
	     if (hGlobal) {
	        lpMemory = GETHANDLEINFO(hGlobal);
	        if (lpMemory) {
	        	wSel = AssignSelector((LPBYTE)lpMemory->lpCore,0,
			TRANSFER_DATA,lpMemory->dwSize);
	        	SetSelectorHandle(wSel,hGlobal);
	        	envp->reg.ax = wSel & 0xfffe;
	        }
	        else 
	        	envp->reg.ax = 0;
	     }
	     else
	         envp->reg.ax = 0;
        }
	envp->reg.dx = 0;
	envp->reg.sp += UINT_86 + RET_86;
	if (lpMemory)
	  RELEASEHANDLEINFO(lpMemory);
}
Example #26
0
void CJpegParse::ParseExif(unsigned char* ptr, PTThumbNail pthumbinfo)
{
	UINT32 i = 0;
	UINT16 byteOrder;
	UINT32 ifdOffset;
	
	byteOrder = GETWORD(ptr, i);
	i += 2;

	if(byteOrder == 0x4949)
		pthumbinfo->byteOrder = EXIF_BYTE_ORDER_INTEL;
	else if(byteOrder == 0x4D4D)
		pthumbinfo->byteOrder = EXIF_BYTE_ORDER_MOTOROLA;
	else		
		return;		

	i += 2;												//skip '2A00'
	
	ifdOffset = ExifGetDword(ptr+i, pthumbinfo->byteOrder);

	ifdOffset = GetIFD0(ptr, ifdOffset, pthumbinfo);

	if(ifdOffset != 0)
		ifdOffset = GetIFD1(ptr, ifdOffset, pthumbinfo);
}
Example #27
0
unsigned short CJpegParse::GetDQT(PTJpegIndex pinfo, unsigned char* ptr)
{
	unsigned short len, i = 0;
	unsigned char	n;
	
	len = GETWORD(ptr,0);
	
	i += 2;
	while(i < len)
	{
		if(ptr[i] & 0xf0)		//16 bit precision
		{
			n = ptr[i] & 0xf;
			if(n > 3)
				return 0;
			pinfo->QTPrecision[n] = 16;
			pinfo->QT[n] = ptr+i+1;
			i += 1 + (64 << 1);
		}
		else		//8 bit precision
		{
			n = ptr[i] & 0xf;
			if(n > 3)
				return 0;
			pinfo->QTPrecision[n] = 8;
			pinfo->QT[n] = ptr+i+1;
			i += 1 + 64;
		}
		pinfo->QTCount++;
	}
	return len;
}
Example #28
0
bool CCharServer::pakUpdateLevel( CCharClient* thisclient, CPacket* P )
{
    if(!thisclient->isLoggedIn) return false;    
    WORD charid = GETWORD((*P),0);
    WORD level = GETWORD((*P),2);
    for(UINT i=0;i<ClientList.size();i++)
    {
        CCharClient* player = (CCharClient*) ClientList.at(i);
        if(player->charid==charid)
        {
            player->level = level;
            break;
        }
    }
    return true;
}
Example #29
0
unsigned short CJpegParse::GetDHT(PTJpegIndex pinfo, unsigned char* ptr)
{
	unsigned short len, j, n, k, HTLen;
	unsigned char *pd = ptr+2;
//	int tablen[4] = {0x1c, 0xb2, 0x1c, 0xb2};
	
	j = 0;
	len = GETWORD(ptr,0);

	while(j < len-3)
	{
		HTLen = 0;
		n = pd[j] & 0xf;
		k = pd[j] & 0xf0;
		n <<= 1;
		n += k >> 4;
		if(n > 3)
			return 0;
		j++;
		pinfo->HT[n] = pd+j;
		k = j + 16;
		while(j < k)
		{
			HTLen = HTLen + (unsigned short)(pd[j]);
			j++;
		}
		pinfo->HTLen[n] = (unsigned char)(16 + HTLen);
//		if (pinfo->HTLen[n] != tablen[n])
//			return 0;
		j = j+HTLen;
		pinfo->HTCount++;
	}
	return len;
}
Example #30
0
unsigned short CJpegParse::GetSOS(PTJpegIndex pinfo, unsigned char* ptr)
{
	unsigned short len;
	unsigned char i, k, n, ac, dc, count, *pbuf = ptr+3;	
	
	len = GETWORD(ptr,0);
	count = ptr[2];
	if(len != 6 + (count << 1))
		return 0;
	
	for(i = 0; i < count; i++)
	{
		k = i << 1;
		n = pbuf[k]-1;
		if(n > 3)
			return 0;
		ac = pbuf[k+1] & 0xf;
		dc = pbuf[k+1] & 0xf0;
		if(!ac)
			pinfo->Comp[n] |= 0x2;
		if(!dc)
			pinfo->Comp[n] |= 0x1;
	}
	return len;
}