Exemplo n.º 1
0
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved){
	switch(dwReason){
		case DLL_PROCESS_ATTACH:
		{
#ifdef DEBUG_MODE
			CreateConsole();
#endif
			SetConsoleCtrlHandler( TrapCtrlHandler, TRUE );
			LoadQuestIconScript("3DDATA\\CONTROL\\RES\\DATA1.RP");
			SetCheckSum(NewTitanCheckSum);

			RunList::Instance().RunFunctions();
			HookList::Instance().ApplyHooks();
			WriteList::Instance().ApplyWrites();

			Log(MSG_DEBUG, "TRUE");
			return TRUE;
		}
		case DLL_PROCESS_DETACH:
			return TRUE;
	};

	return TRUE;
}
Exemplo n.º 2
0
int	MakeAuthenticationKeyFile_V1(B2B_AUTH_INFO_T *AuthInfo)
{
    int ret = NO_ERROR;

    char    DeviceInfoBinSizeBuff[B2B_DEVINFOBIN_SIZE+1];
    char    AgencyIDSizeBuff[B2B_DEVINFOBIN_SIZE+1];
    char    SolutionIDSizeBuff[B2B_DEVINFOBIN_SIZE+1];

    //	Begin Setting AuthInfo buffers... to make security key file
    AuthInfo->RandomNumber = random() % (B2B_RANDOM_FILTER-1) + 1;
    AuthInfo->Version = B2B_AUTHENTICATION_VERSION_V1;

    if((ret = SetAuthTime(AuthInfo->AuthTimeBuff, AuthInfo->AuthTime, AuthInfo->ExpireDate)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    if((ret = SetExpireDate(AuthInfo->ExpireDateBuff, AuthInfo->ExpireDate)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    if((ret = SetRandomNumber(AuthInfo->RandomBuff, AuthInfo->RandomNumber)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    if((ret = SetParity(AuthInfo->ParityBuff, AuthInfo->AuthTimeBuff, AuthInfo->ExpireDateBuff, AuthInfo->ProductID, AuthInfo->RandomNumber)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    if((ret = SetAgencyNSolutionID_V1(AuthInfo->AgencyIDBuff, AuthInfo->AgencyID, AuthInfo->AgencyIDParityBuff, AuthInfo->AgencyIDLength)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    sprintf(AgencyIDSizeBuff, "%02d", AuthInfo->AgencyIDLength);
    if((ret = SetAgencyNSolutionID_V1(AuthInfo->SolutionIDBuff, AuthInfo->SolutionID, AuthInfo->SolutionIDParityBuff, AuthInfo->SolutionIDLength)) != NO_ERROR)	{
        return	ERROR_UNABLE_CREATEKEYFILE;
    }
    sprintf(SolutionIDSizeBuff, "%02d", AuthInfo->SolutionIDLength);
    sprintf(DeviceInfoBinSizeBuff, "%03d", AuthInfo->DeviceInfoSize);

    SetEncriptBufferWithN28(AuthInfo->EncriptKeyBuff, B2B_SECURITY_KEYFILE_SIZE);

//	printf("BUFF(%s)(_%d_)\n", AuthInfo->EncriptKeyBuff, __LINE__);
    //	AgencyID
    memcpy(AuthInfo->EncriptKeyBuff+B2B_AGENCYID_POSITION_V1, AuthInfo->AgencyIDBuff, strlen(AuthInfo->AgencyIDBuff));
//	printf("BUFF(%s)(_%d_)AgencyID(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->AgencyIDBuff);
    //	SolutionID
    memcpy(AuthInfo->EncriptKeyBuff+B2B_SOLUTION_POSITION_V1, AuthInfo->SolutionIDBuff, strlen(AuthInfo->SolutionIDBuff));
//	printf("BUFF(%s)(_%d_)SolutionID(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->SolutionIDBuff);
    //	AgencyIDLength
    memcpy(AuthInfo->EncriptKeyBuff+B2B_AGENCYSIZE_POSITION_V1, AgencyIDSizeBuff, B2B_AGENCYSIZE_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)AgencyIDSize(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AgencyIDSizeBuff);
    //	SolutionIDLength
    memcpy(AuthInfo->EncriptKeyBuff+B2B_SOLUTIONSIZE_POSITION_V1, SolutionIDSizeBuff, B2B_SOLUTIONSIZE_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)SolutionIDSize(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, SolutionIDSizeBuff);
    //	AgencyID Parity
    memcpy(AuthInfo->EncriptKeyBuff+B2B_AGENCYPARITY_POSITION_V1, AuthInfo->AgencyIDParityBuff, B2B_AGENCYSOLUTION_PARITY_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)AgencyIDParity(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->AgencyIDParityBuff);
    //	Solution Parity
    memcpy(AuthInfo->EncriptKeyBuff+B2B_SOLUTIONPARITY_POSITION_V1, AuthInfo->SolutionIDParityBuff, B2B_AGENCYSOLUTION_PARITY_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)SolutionIDParity(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->SolutionIDParityBuff);
    //	Authentication Time
    memcpy(AuthInfo->EncriptKeyBuff+B2B_AUTHTIME_POSITION_V1, AuthInfo->AuthTimeBuff, B2B_AUTHTIME_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)AuthTime(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__,  AuthInfo->AuthTimeBuff);
    //	ExpireDateTime
    memcpy(AuthInfo->EncriptKeyBuff+B2B_EXPIREDATE_POSITION_V1, AuthInfo->ExpireDateBuff, B2B_EXPIREDATE_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)ExpireDate(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->ExpireDateBuff);
    //	ProductID
    memcpy(AuthInfo->EncriptKeyBuff+B2B_PRODUCTID_POSITION_V1, AuthInfo->ProductID, B2B_PRODUCTID_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)ProductID(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->ProductID);
    //	Random
    memcpy(AuthInfo->EncriptKeyBuff+B2B_RANDOM_POSITION_V1, AuthInfo->RandomBuff, B2B_RANDOM_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)Random(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->RandomBuff);
    //	Parity
    memcpy(AuthInfo->EncriptKeyBuff+B2B_DATETIMEPARITY_POSITION_V1, AuthInfo->ParityBuff, B2B_DATETIMEPARITY_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)Parity(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->ParityBuff);
    //	Version
    memcpy(AuthInfo->EncriptKeyBuff+B2B_VERSION_POSITION_V1, &(AuthInfo->Version), B2B_VERSION_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)Version(%c)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->Version);
    //	DeviceInfo.bin
    memcpy(AuthInfo->EncriptKeyBuff+B2B_DEVICEINFO_POSITION_V1, AuthInfo->DeviceInfo, AuthInfo->DeviceInfoSize);
//	printf("BUFF(%s)(_%d_)DeviceInfo(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, AuthInfo->DeviceInfo);
    //	DeviceInfoSize
    memcpy(AuthInfo->EncriptKeyBuff+B2B_DEVICEINFOSIZE_POSITION_V1, DeviceInfoBinSizeBuff, B2B_DEVICEINFOSIZE_ENCSIZE_V1);
//	printf("BUFF(%s)(_%d_)DeviceInfoSize(%s)\n", AuthInfo->EncriptKeyBuff, __LINE__, DeviceInfoBinSizeBuff);

    SetCheckSum(AuthInfo->EncriptKeyBuff);

    return	NO_ERROR;
}