Exemplo n.º 1
0
bool MachineCode::CompareAndPatchByJumpToAttachment(void *address, BYTE *original, int length, BYTE *attachment, int size) {
	if(length >= 5 && size > 0 && CompareCode(address, original, length)) {
		DWORD dwAddress;		// Applying the patch:
		if (VirtualProtect(attachment, size, PAGE_EXECUTE_READWRITE, &dwAddress)) {
			dwAddress = 0xE9;	// Jmp opcode
			bool result = SetCode(address, (LPBYTE)&dwAddress, 1);
			dwAddress = GetLabelOffset(LPVOID(DWORD(address) + 1), attachment);
			result = SetCode(LPVOID(DWORD(address) + 1), (LPBYTE)&dwAddress, sizeof(DWORD)) ? result : false;
			dwAddress = 0x90;	// Nop
			for(int i = 5; i < length; i++) {
				result = SetCode(LPVOID(DWORD(address) + i), (LPBYTE)&dwAddress, 1) ? result : false;
			}
			return result;
		}
	}
	return false;
}
Exemplo n.º 2
0
CharMapEntry::CharMapEntry(wxString family, wxString style, float size, wxUint32 encoding, wxUint32 code)
{
	SetFamily(family);
	SetStyle(style);
	SetSize(size);
	SetEncoding(encoding);
	SetCode(code);
}
Exemplo n.º 3
0
// nPPM - pixels per module, nHeight - bar nHeight in pixels
void CEAN8::Render (Graphics* pGraphics, CRect rect)
{
	if (m_strBars.IsEmpty ())
		SetCode (m_strCode);

	CSize size = GetSize ();
	int nPPM = (int) (((double) size.cy / (double) rect.Height ()) * (double) MODULE);

	int nHeight = (int) (((EAN8_HEIGHT - 1) * 100) / (double) size.cy * rect.Height ());
	int nTop = 1;	// nTop margin
	int nLeft = 7;	// EAN-13 - 11, EAN-8 - 7
	int nRight = 7;	// always 7				

	if (m_nBackgroundMode == OPAQUE)
	{
		Color col;
		col.SetFromCOLORREF (m_colBackgroundColor);
		SolidBrush brush (col);
		pGraphics->FillRectangle (&brush, rect.left, rect.top, rect.Width (), rect.Height ());
	}

	Color col;
	col.SetFromCOLORREF (m_colForegroundColor);
	SolidBrush brush (col);

	for (int i = 0; i < 67; i++)
	{
		int h = nHeight + 5 * nPPM;
		if ((i >= 3) && (i < 31))
			h = nHeight;
		if ((i >= 36) && (i < 64))
			h = nHeight;

		if (m_strBars.GetAt (i) == '0')
			continue;
		
		pGraphics->FillRectangle (&brush, (nLeft + i + 4) * nPPM + rect.left, nTop * nPPM + rect.top, nPPM, h - 1);
	}

	int nLevel = nHeight + (nTop + /*7*/0) * nPPM + rect.left;

	BSTR bstrFont = m_strFont.AllocSysString ();
	Gdiplus::Font font (bstrFont, 10 * nPPM);
	::SysFreeString (bstrFont);

	int nCount = 0;
	for (int i = 0; i < 8; i++)
	{
		if (i == 4)
			nCount = 0;

		BSTR bstrText = m_strCode.Mid (i, 1).AllocSysString ();
		PointF pt (((i < 4 ? 5 : 37 )+ nLeft + 7 * nCount++) * nPPM + rect.left, nLevel);
		pGraphics->DrawString (bstrText, 1, &font, pt, &brush);
		::SysFreeString (bstrText);
	}
}
Exemplo n.º 4
0
int wmain()
{
	HANDLE hThread;
	g_iSlot = TlsAlloc();
	hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, NULL);
	SetCode(8888);
	LoopPrintCode();
	WaitForSingleObject(hThread, INFINITE);
	CloseHandle(hThread);
	TlsFree(g_iSlot);
}
Exemplo n.º 5
0
bool MachineCode::SetPatch(Sequence *patch, Sequence *memoryTree, int hInstanceOffset) {
	bool success = true;
	Sequence *current = patch;
	BYTE *bytes = new BYTE[MAX_LINE];
	while(current) {
		int length = ConvertHEX((LPVOID)((DWORD)current->Address + hInstanceOffset), current->String, memoryTree, bytes, hInstanceOffset);
		if(length > 0) if(!SetCode((LPVOID)((DWORD)current->Address + hInstanceOffset), bytes, length)) success = false;
		current = current->Next;
	}
	delete[] bytes;
	return success;
}
Exemplo n.º 6
0
CGraphItem::CGraphItem(DWORD nCode, DWORD nParam, COLORREF nColour)
{
	m_nCode		= nCode;
	m_nParam	= nParam;
	m_nColour	= nColour;

	m_nData		= 64;
	m_pData		= new DWORD[ m_nData ];
	m_nLength	= 0;
	m_nPosition	= 0;

	if ( m_nCode ) SetCode( m_nCode );
}
Exemplo n.º 7
0
CGraphItem::CGraphItem(DWORD nCode, float nMultiplier, COLORREF nColour)
{
	m_nCode		= nCode;
	m_nMultiplier = nMultiplier;
	m_nColour	= nColour;

	m_nData		= 64;
	m_pData		= new DWORD[ m_nData ];
	m_nLength	= 0;
	m_nPosition	= 0;

	if ( m_nCode ) SetCode( m_nCode );
}
Exemplo n.º 8
0
void AOpenBarrierConsole::SetOpeningCode(int32 code)
{
	/*Different behavior if we are server or client.*/
	if (Role < ROLE_Authority)
	{
		SetCode(code);
		ATGCOPlayerController * PC;
		for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
		{
			PC = Cast<ATGCOPlayerController>(Iterator->Get());
			PC->ServerSetOpeningCode(this, code);
		}
	}
}
Exemplo n.º 9
0
void CGraphItem::Serialize(CArchive& ar)
{
	if ( ar.IsStoring() )
	{
		ar << m_nCode;
		ar << m_nParam;
		ar << m_nColour;
	}
	else
	{
		ar >> m_nCode;
		ar >> m_nParam;
		ar >> m_nColour;

		SetCode( m_nCode );
	}
}
Exemplo n.º 10
0
void CGraphItem::Serialize(CArchive& ar)
{
	if ( ar.IsStoring() )
	{
		ar << m_nCode;
		ar << m_nMultiplier;
		ar << m_nColour;
	}
	else
	{
		ar >> m_nCode;
		ar >> m_nMultiplier;
		if ( m_nMultiplier == 0.0f )
			m_nMultiplier = 1.0f;
		ar >> m_nColour;

		SetCode( m_nCode );
	}
}
Exemplo n.º 11
0
void HPingHeader::FormatSend(TUint aId, TUint aSeqNum)
//
// Format an ICMP packet to send
//
	{
	
	TUint type;
	TUint code;
	TChecksum sum;

	// Configure version
	if(iIPVersion == KAfInet)
		{
		type = KIPv4PingTypeEchoRequest;
		code = KIPv4PingCodeEcho;
		}
	else
		{
		type = KIPv6PingTypeEchoRequest;
		code = KIPv6PingCodeEcho;
		}

	// Fill header
	SetType(static_cast<TUint8>(type));
	SetCode(static_cast<TUint8>(code));
	SetIdentifier(static_cast<TUint16>(aId));
	SetSequence(static_cast<TUint16>(aSeqNum));

	// Compute checksum
	SetChecksum(0);
	sum.Add(reinterpret_cast<TUint16*>(this), HeaderLength());
	SetChecksum(sum.Sum());

	// Fill buffer
	iData->Des().Copy((TUint8*)this, HeaderLength());
	}
Exemplo n.º 12
0
 /**
  * This method initializes the DHCPv6 Option.
  *
  */
 void Init(void) { SetCode(kOptionStatusCode); SetLength(sizeof(*this) - sizeof(Dhcp6Option)); }
Exemplo n.º 13
0
 /**
  * This method initializes the DHCPv6 Option.
  *
  */
 void Init(void) { SetCode(kOptionElapsedTime); SetLength(sizeof(*this) - sizeof(Dhcp6Option)); }
Exemplo n.º 14
0
 /**
  * This method initializes the DHCPv6 Option.
  *
  */
 void Init(void) { SetCode(kOptionIaAddress); SetLength(sizeof(*this) - sizeof(Dhcp6Option)); }
Exemplo n.º 15
0
 /**
  * This method initializes the DHCPv6 Option.
  *
  */
 void Init(void) { SetCode(kOptionServerIdentifier); SetLength(sizeof(*this) - sizeof(Dhcp6Option)); }
Exemplo n.º 16
0
int asCScriptCode::SetCode(const char *name, const char *code, bool makeCopy)
{
    return SetCode(name, code, 0, makeCopy);
}
Exemplo n.º 17
0
CharMapEntry::CharMapEntry()
{
	SetSize(-1.0f);
	SetEncoding(0);
	SetCode(0);
}
Exemplo n.º 18
0
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
	SetCode(4444);
	LoopPrintCode();
	return 0;
}
Exemplo n.º 19
0
/*Set the code sent by the server*/
void AOpenBarrierConsole::SetOpeningCodeFromServer(int32 code)
{
	SetCode(code);
}
Exemplo n.º 20
0
 /**
  * This method initializes the DHCPv6 Option.
  *
  */
 void Init(void) { SetCode(kOptionRapidCommit); SetLength(sizeof(*this) - sizeof(Dhcp6Option)); }
Exemplo n.º 21
0
CEANBase::CEANBase (int nType)
{
	m_nType = nType;

	// set A - normal 
	// set B - reverse
	// set C - negative
	m_strEAN[0] = "3211";
	m_strEAN[1] = "2221";
	m_strEAN[2] = "2122";
	m_strEAN[3] = "1411";
	m_strEAN[4] = "1132";
	m_strEAN[5] = "1231";
	m_strEAN[6] = "1114";
	m_strEAN[7] = "1312";
	m_strEAN[8] = "1213";
	m_strEAN[9] = "3112";

	// select A or B set for EAN-13
	m_strSet[0] = "AAAAAA";
	m_strSet[1] = "AABABB"; //"BBABAA";	// conj.
	m_strSet[2] = "AABBAB"; //"BABBAA"; // conj.
	m_strSet[3] = "AABBBA"; //"ABBBAA";	// conj.
	m_strSet[4] = "ABAABB"; //"BBAABA";
	m_strSet[5] = "ABBAAB"; //"AABAAB"; //"BAABBA";		//test!!
	m_strSet[6] = "ABBBAA"; //"AABBBA";	// conj.
	m_strSet[7] = "ABABAB"; //"BABABA";
	m_strSet[8] = "ABABBA"; //"ABBABA";	// conj.
	m_strSet[9] = "ABBABA"; //"ABABBA";

	m_strSetAddon2[0] = "AA";
	m_strSetAddon2[1] = "AB";
	m_strSetAddon2[2] = "BA";
	m_strSetAddon2[3] = "BB";

	m_strSetAddon5[0] = "BBAAA";
	m_strSetAddon5[1] = "BABAA";
	m_strSetAddon5[2] = "BAABA";
	m_strSetAddon5[3] = "BAAAB";
	m_strSetAddon5[4] = "ABBAA";
	m_strSetAddon5[5] = "AABBA";
	m_strSetAddon5[6] = "AAABB";
	m_strSetAddon5[7] = "ABABA";
	m_strSetAddon5[8] = "ABAAB";
	m_strSetAddon5[9] = "AABAB";

	// standard sizes for EAN barcodes
	m_eansize[0] = new CEANSize (0.80f,  0.0f,  35); // print quality in micrometers
	m_eansize[1] = new CEANSize (0.90f,  0.0f,  68);
	m_eansize[2] = new CEANSize (1.00f,  3.8f, 100);
	m_eansize[3] = new CEANSize (1.10f,  4.6f, 116);
	m_eansize[4] = new CEANSize (1.20f,  5.3f, 131);
	m_eansize[5] = new CEANSize (1.40f,  6.8f, 162);
	m_eansize[6] = new CEANSize (1.50f,  7.6f, 178);
	m_eansize[7] = new CEANSize (1.70f,  9.1f, 209);
	m_eansize[8] = new CEANSize (1.85f, 10.2f, 232);
	m_eansize[9] = new CEANSize (2.00f, 11.4f, 255);

	// default font, foreground, and background
	m_strFont = "Verdana";
	m_colForegroundColor = RGB (0x00, 0x00, 0x00);
	m_nBackgroundMode = OPAQUE;
	m_colBackgroundColor = RGB (0xff, 0xff, 0xff);

	SetCode ("");
}
Exemplo n.º 22
0
KeyboardEvent::KeyboardEvent( unsigned long value )
{
	SetCode( value );
}
Exemplo n.º 23
0
//---------------------------------------------------------------------------
//
//     * @param table Table identifier
//     * @param code Code
//     * @param isValid Boolean indicating whether code is value
//
sgStagingCode::sgStagingCode(std::string table, std::string code, bool isValid) {
    SetTable(table);
    SetCode(code);
    SetIsValid(isValid);
}
Exemplo n.º 24
0
char *inputd(char *form, char *title, char *defstr, int keys, int frame, int mask, int bhelp, int cols, int tmo, int debounce)
{
int exs,eys,wxs,wxw,wys,wyw,i,j,xp,yp;
char trnd[2]={0,0},tch;
int act_key=-1, last_key=-1, b_key=-1, run=1, ipos=0;
time_t t1,t2,tm1;
char knum[12][2]={"1","2","3","4","5","6","7","8","9"," ","0"};
char kalp[12][5]={"+-*/","abcä","def","ghi","jkl","mnoö","pqrs","tuvü","wxyz","","_,.;"};

	epos=-1;
	cpos=0;
	kpos=0;
	first=1;
	time(&tm1);
	if(cols>25)
	{
		cols=25;
	}
	if(cols<1)
	{
		cols=1;
	}
	format=form;
	estr=strdup(form);
	cnt=strlen(form);
	
	RenderString("X", 310, 250, 20, LEFT, BIG, CMC);
	i=GetStringLen(title)+10;
	j=((cnt>cols)?cols:cnt)*exsz;
	if(j>i)
	{
		i=j;
	}
	if(keys)
	{
		j=3*bxsz;
		if(j>i)
		{
			i=j;
		}
	}
	wxw=i+2*xbrd;

	i=(((cnt-1)/cols)+1)*eysz;
	if(keys)
	{
		i+=4*bysz;
	}
	wyw=((keys)?4:2)*ybrd+i;

	wxs=((ex-sx)-wxw)/2;
	wys=(((ey-sy)-wyw)+hsz)/2;
	exs=wxs+(wxw-((cnt>cols)?cols:cnt)*exsz)/2;
	eys=wys+ybrd;

	*estr=0;
	*rstr=0;
		
	j=0;
	for(i=0; i<strlen(format); i++)
	{
		tch=format[i];
		if(IsInput(tch))
		{
			if(epos==-1)
			{
				epos=i;
			}
			if(defstr && j<strlen(defstr))
			{
				estr[i]=defstr[j++];
			}
			else
			{
				estr[i]=' ';
			}
		}
		else
		{
			estr[i]=format[i];
		}
	}
	estr[i]=0;

	RenderBox(wxs-2, wys-hsz-2, wxs+wxw+2, wys+wyw+2, radius, CMH);
	RenderBox(wxs, wys-hsz, wxs+wxw, wys+wyw, radius, CMC);
	RenderBox(wxs, wys-hsz, wxs+wxw, wys, radius, CMH);
	RenderString(title, wxs, wys-15, wxw, CENTER, BIG, CMHT);
	if(keys)
	{
		int bxs=wxs+(wxw-(3*bxsz))/2;
		int bys=((wys+wyw)-2*ybrd)-4*bysz;
		
		for(i=0; i<11; i++)
		{
			if(i!=9)
			{
				RenderBox(bxs+(i%3)*bxsz, bys+(i/3)*bysz, bxs+((i%3)+1)*bxsz, bys+((i/3)+1)*bysz, radius, COL_MENUCONTENT_PLUS_4);
				RenderBox(bxs+(i%3)*bxsz+2, bys+(i/3)*bysz+2, bxs+((i%3)+1)*bxsz-2, bys+((i/3)+1)*bysz-2, radius, CMC);
				RenderString(knum[i], bxs+(i%3)*bxsz, bys+(i/3)*bysz+bysz/2, bxsz, CENTER, MED, CMCIT);
				RenderString(kalp[i], bxs+(i%3)*bxsz, bys+(i/3)*bysz+bysz-8, bxsz, CENTER, SMALL, CMCIT);
				
			}
		}	
		RenderCircle(bxs,wys+wyw-ybrd-8,'R');
		RenderString("Groß/Klein",bxs+15,wys+wyw-ybrd+5,3*bxsz,LEFT,SMALL,CMCIT);
		RenderCircle(bxs+3*bxsz-GetStringLen("löschen")-15,wys+wyw-ybrd-8,'Y');
		RenderString("löschen",bxs,wys+wyw-ybrd+5,3*bxsz,RIGHT,SMALL,CMCIT);
	}
	
	while(run)
	{
		for(i=0; i<cnt; i++)
		{
			xp=i%cols;
			yp=i/cols;
			if(frame && IsInput(format[i]))
			{
				RenderBox(exs+xp*exsz, eys+5+yp*eysz, exs+(xp+1)*exsz, eys+(yp+1)*eysz, radius, COL_MENUCONTENT_PLUS_4);
			}
			RenderBox(exs+xp*exsz+1, eys+5+yp*eysz+1, exs+(xp+1)*exsz-1, eys+(yp+1)*eysz-1, radius, (epos==i)?CMCS:CMC);
			*trnd=(mask && format[i]==NUM && IsNum(estr[i]))?'*':estr[i];
			RenderString(trnd, exs+xp*exsz+2, eys+yp*eysz+tys, exsz-2, CENTER, MED, (epos==i)?CMCST:(IsInput(format[i]))?CMCT:CMCIT);
		}
		memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres);

		time(&t1);
		i=-1;
		while(i==-1)
		{
			i=GetRCCode();
			if(i!=-1)
			{
				tmo=0;
				if(i==b_key)
				{
					usleep(debounce*1000);
					while((i=GetRCCode())!=-1);
				}
				b_key=i;
			}
			time(&t2);
			if(tmo)
			{
				if((t2-tm1)>=tmo)
				{
					i=RC_HOME;
				}
			}
			if((((format[epos]!=NUM) && (format[epos]!=HEX)) || ((format[epos]==HEX)&&(strlen(hcod[cpos])>1))) && ((t2-t1)>ndelay) && last_key>=0)
			{
				act_key=i=-2;
				b_key=-3;
				NextPos();
			}
		}
		act_key=i;
		
		switch(act_key)
		{
			case RC_0:
				SetCode(0);
			break;
			
			case RC_1:
				SetCode(1);
			break;
			
			case RC_2:
				SetCode(2);
			break;
			
			case RC_3:
				SetCode(3);
			break;
			
			case RC_4:
				SetCode(4);
			break;
			
			case RC_5:
				SetCode(5);
			break;
			
			case RC_6:
				SetCode(6);
			break;
			
			case RC_7:
				SetCode(7);
			break;
			
			case RC_8:
				SetCode(8);
			break;
			
			case RC_9:
				SetCode(9);
			break;
			
			case RC_RIGHT:
				NextPos();
				act_key=-2;
			break;
			
			case RC_LEFT:
				PrevPos();
				act_key=-2;
			break;
			
			case RC_PLUS:
				ipos=epos;
				while(IsInput(format[ipos+1]) && ((ipos+1)<cnt))
				{
					++ipos;
				}
				while(ipos>epos)
				{
					estr[ipos]=estr[ipos-1];
					--ipos;
				}
				estr[epos]=' ';
				act_key=-1;
			break;

			case RC_MINUS:
				ipos=epos+1;
				while(IsInput(format[ipos]) && (ipos<cnt))
				{
					estr[ipos-1]=estr[ipos];
					++ipos;
				}
				estr[ipos-1]=' ';
				act_key=-1;
			break;

			case RC_OK:
				run=0;
			break;
			
			case RC_MUTE:	
				memset(lfb, TRANSP, 720*576);
				usleep(500000L);
				while(GetRCCode()!=-1)
				{
					usleep(100000L);
				}
				while(GetRCCode()!=RC_MUTE)
				{
					usleep(500000L);
				}
				while((act_key=GetRCCode())!=-1)
				{
					usleep(100000L);
				}
			break;

			case RC_UP:
				if(epos>=cols)
				{
					epos-=cols;
					if(!IsInput(format[epos]))
					{
						NextPos();
					}
				}
				else
				{
					epos=cnt-1;
					if(!IsInput(format[epos]))
					{
						PrevPos();
					}
				}
				act_key=-2;
			break;
			
			case RC_DOWN:
				if(epos<=(cnt-cols))
				{
					epos+=cols;
					if(!IsInput(format[epos]))
					{
						NextPos();
					}
				}
				else
				{
					epos=0;
					if(!IsInput(format[epos]))
					{
						NextPos();
					}
				}
				act_key=-2;
			break;
			
			case RC_HOME:
				free(estr);
				estr=NULL;
				*rstr=0;
				run=0;
			break;
			
			case RC_RED:
				if(IsAlpha(estr[epos]))
				{
					estr[epos]^=0x20;
				}
				act_key=-2;
			break;
			
			case RC_YELLOW:
				epos=-1;
				for(i=0; i<strlen(format); i++)
				{
					if(IsInput(format[i]))
					{
						if(epos==-1)
						{
							epos=i;
						}
						estr[i]=' ';
					}
				}
				act_key=-2;
			break;
			
			case RC_HELP:
				if(bhelp)
				{
					sprintf(estr,"?");
					run=0;
				}
			break;
			
			default:
				act_key=-2;
			break;
		}
		last_key=act_key;
	}
	
	if(estr)
	{
		j=0;
		for(i=0; i<strlen(format); i++)
		{
			if(IsInput(format[i]))
			{
				rstr[j++]=estr[i];
			}
		}
		rstr[j]=0;
		free(estr);
	}	
	ReTransform_Msg(rstr);
	return tstr;
}
Exemplo n.º 25
0
MouseEvent::MouseEvent( int x, int y, unsigned long value )
	:_x(x), _y(y)
{
	SetCode( value );
}
Exemplo n.º 26
0
	SourceCode::SourceCode(const char *source)
	{
		_lines = 0;

		SetCode(source);
	}