Exemple #1
0
void DecryptDB()
{
	char oldKey[255];
	strcpy(oldKey, encryptKey);

	if(!CheckPassword(dbHeader.checkWord, Translate("current database"))){strcpy(encryptKey, oldKey); encryptKeyLength = strlen(oldKey); return;}

	WritePlainHeader();
	
	EnterCriticalSection(&csDbAccess);
	DecodeAll();
	LeaveCriticalSection(&csDbAccess);

	bEncoding = 0;

	zero_fill(encryptKey, sizeof encryptKey);

	if (gl_bUnicodeAwareCore)
		xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0);
	else
		xModifyMenu(hSetPwdMenu, 0, (TCHAR*) LPGEN("Set Password"), 0); //ugly hack

	DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);

	CryptoEngine->FreeKey(key);

	CryptoEngine = NULL;
}
Exemple #2
0
void Linker::initialize( void(*pfM)(aCHAR*) )
{
#ifdef BUG_LINK
 lout = fopen("buglink.txt","w");
// printf("buglink open\n");
 fprintf(lout, "** Buglink open\n");
 fprintf(lout, "%s\n", __TIME__);
 fflush(lout);
// return;
#endif
   aCHAR  outbuf[512];

#ifdef BUG_LINK
   pfMsg = NULL;
#else
   pfMsg = pfM;
#endif
   eMaxAtoms = 1024 * MAX_ATOM_TABLE_SZ;
   GAtomTable = NULL;
   LAtomTable = NULL;
   zero_fill(m_ver, 256);
   Lstrcpy(m_ver, AMZI_VERSION);

   Lstrncpy(outbuf, aS("\nAmzi! Prolog Linker "), 256);
   Lstrncat(outbuf, m_ver, 256);
#ifdef BUG_LINK
   return;
#endif
   output(outbuf);
   //output(aS(""));
}
Exemple #3
0
void ChangePwd()
{
	char newpass[255] = {0};
	
	int action = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHANGEPASS), NULL, (DLGPROC)DlgChangePass, (LPARAM)newpass);	
	
	if(action == IDCANCEL || (action == IDOK && !strlen(newpass)))
		return;

	EnterCriticalSection(&csDbAccess);

	DecodeAll();

	CryptoEngine->FreeKey(key);

	if(action == IDREMOVE){
		WritePlainHeader();

		bEncoding = 0;
		CryptoEngine = NULL;
		DBWriteContactSettingWord(NULL, "SecureMMAP", "CryptoModule", 0);

		zero_fill(encryptKey, sizeof encryptKey);

		if (gl_bUnicodeAwareCore)
			xModifyMenu(hSetPwdMenu, 0, LPGENT("Set Password"), 0);
		else
			xModifyMenu(hSetPwdMenu, 0, (TCHAR*) LPGEN("Set Password"), 0); //ugly hack
	}

	if(action == IDOK){
		strcpy(encryptKey, newpass);
		encryptKeyLength = strlen(newpass);		
		
		bEncoding = 1;

		EncoderInit();	

		EncodeAll();		

		WriteCryptHeader();
	}

	zero_fill(newpass, sizeof newpass);

	LeaveCriticalSection(&csDbAccess);
}
Matrix::Matrix(int width, int height) : width(width), height(height)
{
	zero_fill();
}