コード例 #1
0
ファイル: ModelPool.cpp プロジェクト: 2asoft/xray
void CModelPool::Prefetch()
{
	Logging					(FALSE);
	// prefetch visuals
	string256 section;
	strconcat				(sizeof(section),section,"prefetch_visuals_",g_pGamePersistent->m_game_params.m_game_type);
	CInifile::Sect& sect	= pSettings->r_section(section);
	for (CInifile::SectCIt I=sect.Data.begin(); I!=sect.Data.end(); I++)	{
		const CInifile::Item& item= *I;
		dxRender_Visual* V	= Create(item.first.c_str());
		Delete				(V,FALSE);
	}
	Logging					(TRUE);
}
コード例 #2
0
ファイル: tracemon.c プロジェクト: 8l/miaow
// adds an instruction to tracked set for a wavefront
void AddInstruction(int cuid, int wf, int pc, int is64, 
	int instr_lo, int instr_hi, int isBarrier, int timestamp)
{
	Logging(cuid, wf, pc, "Add", NULL);

	pthread_mutex_lock(&lock);

	int max = numOfObjs[cuid][wf];

	objects[cuid][wf][max].pc = pc;
	strcpy(objects[cuid][wf][max].buff, "");

	if(is64 == 1) {	
		//objects[cuid][wf][max].instr_p1 = instr_lo;
		//objects[cuid][wf][max].instr_p2 = instr_hi;
		//objects[cuid][wf][max].numOfParts = 2;
		sprintf(objects[cuid][wf][max].buff, 
			" // %08X: %08X %08X\n", pc, instr_lo, instr_hi);
	}
	else {
		//objects[cuid][wf][max].instr_p1 = instr_lo;
		//objects[cuid][wf][max].numOfParts = 1;
		sprintf(objects[cuid][wf][max].buff, 
			" // %08X: %08X\n", pc, instr_lo);
	}

	objects[cuid][wf][max].isBarrier = isBarrier;
	objects[cuid][wf][max].complete = 0;
	numOfObjs[cuid][wf] = numOfObjs[cuid][wf] + 1;

	pthread_mutex_unlock(&lock);
}
コード例 #3
0
ファイル: Main.cpp プロジェクト: HeIIoween/FLHook
void LogCheater(uint client, const wstring &reason)
{
	CAccount *acc = Players.FindAccountFromClientID(client);

	if (!HkIsValidClientID(client) || !acc)
	{
		AddLog("ERROR: invalid parameter in log cheater, clientid=%u acc=%08x reason=%s", client, acc, wstos(reason).c_str());
		return;
	}

	//internal log
	string scText = wstos(reason);
	Logging("%s", scText.c_str());

	// Set the kick timer to kick this player. We do this to break potential
	// stack corruption.
	HkDelayedKick(client, 1);

		// Ban the account.
		flstr *flStr = CreateWString(acc->wszAccID);
		Players.BanAccount(*flStr, true);
		FreeWString(flStr);

		// Overwrite the ban file so that it contains the ban reason
		wstring wscDir;
		HkGetAccountDirName(acc, wscDir);
		string scBanPath = scAcctPath + wstos(wscDir) + "\\banned";
		FILE *file = fopen(scBanPath.c_str(), "wb");
		if (file)
		{
			fprintf(file, "Autobanned by Marketfucker\n");
			fclose(file);
		}
}
コード例 #4
0
ファイル: pa.cpp プロジェクト: mpusz/FreeTTCN
TriStatus freettcn::PA::CPlatformAdaptor::TimerStart(const TriTimerId *timerId, TriTimerDuration timerDuration)
{
  if (!timerId)
    return TRI_ERROR;
  
  freettcn::PA::CTimer *timer = 0;
  
  // check if timer running already
  for(CTimerList::const_iterator it=_timerList.begin(); it!=_timerList.end(); ++it) {
    if (timerId == &(*it)->Id()) {
      timer = *it;
      break;
    }
  }
  
  if (!timer) {
    // create new timer
    timer = TimerCreate(*timerId);
    _timerList.push_back(timer);
  }
  
  timer->Start(timerDuration);
  
  if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_PA_T_START)) {
    TriComponentId comp = { { 0 } };
    tliTStart(0, TimeStampMgr().Get(), 0, 0, comp, *timerId, timerDuration);
  }
  
  return TRI_OK;
}
コード例 #5
0
ファイル: tracemon.c プロジェクト: 8l/miaow
// Called during descheduling of a wavefront
void PrintAndDeleteAll(int cuid, int wf)
{
	Logging(cuid, wf, 0, "DeleteAll", NULL);

	pthread_mutex_lock(&lock);

	int max = numOfObjs[cuid][wf];
	int i;

	if(max > 0) objects[cuid][wf][max-1].complete = 1;
	
	for(i = 0; i < max; i++) {
		if(objects[cuid][wf][i].complete != 1) {
			char buff[100];
			sprintf(buff, "PrintAndDeleteAll: wfid=%d pc=0x%X in CU%d has not retired.\n", 
				wf, objects[cuid][wf][i].pc, cuid);
			WriteString(cuid, wf, buff);
		}

		WriteString(cuid, wf, objects[cuid][wf][i].buff);
	}
	
	numOfObjs[cuid][wf] = 0;
	strcpy(outFileName[cuid][wf], "uninit.out");

	pthread_mutex_unlock(&lock);
}
コード例 #6
0
ファイル: Log.cpp プロジェクト: madhatternc/mangos2
uint Log::Logging (const char *iFlags)
{
    char c;
    uint newmask = 0, newstate = 0;
    while ((c = *iFlags++))
    {
        uint mask;
        switch (tolower (c))
        {
        case 's':   mask = LOG_SCREEN; break;
        case 'f':   mask = LOG_FILE; break;
        case 'd':   mask = LOG_DEBUG; break;
        case 'c':   mask = LOG_COMMON; break;
        case 'i':   mask = LOG_IMPORTANT; break;
        default:
            Out (LOG_COMMON, "Bad logging flag `%c' requested\n", c);
            continue;
        }
        newmask |= mask;
        if (isupper (c))
            newstate |= mask;
        else
            newstate &= ~mask;
    }
    return Logging (newstate, newmask);
}
コード例 #7
0
ファイル: PRE_err.cpp プロジェクト: lixiaoyi1108/SecuruStik
///Get last err informations(log the debug information)
unsigned long PRE_ERR_GetLastError(const char* filePath, const char* function, int line)
{
	PRE_ERR_GetLastError();
	const char* fileName = strrchr(filePath,'\\');
	Logging(filePath,function,line,GetLastErrorString());
	printf("\t@ File     : %s(Line:%d)\n\t@ Function : %s\n",fileName+1,line,function);
	return ErrCode;
}
コード例 #8
0
ファイル: tm.cpp プロジェクト: mpusz/FreeTTCN
void freettcn::TM::CTestManagement::ControlTerminated()
{
    if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_TM_CTRL_TERMINATED))
        tliCtrlTerminated(0, TimeStampMgr().Get(), 0, 0, _ctrlCompId->Id());

    delete _ctrlCompId;
    _ctrlCompId = 0;
    _status = NOT_RUNNING;
}
コード例 #9
0
ファイル: tracemon.c プロジェクト: 8l/miaow
void WriteString(int cuid, int wf, char *buff)
{
	FILE *fp;	
	fp = fopen(outFileName[cuid][wf], "a");
	fprintf(fp, "%s", buff);
	fclose(fp);

	Logging(cuid, wf, 0, "WString", buff);
}
コード例 #10
0
ファイル: sa.cpp プロジェクト: mpusz/FreeTTCN
TriStatus freettcn::SA::CSUTAdaptor::Unmap(const TriPortId &compPortId, const TriPortId &tsiPortId)
{
  if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_SA_P_UNMAP)) {
    TriComponentId comp = { { 0 } };
    // log
    tliPUnmap(0, TimeStampMgr().Get(), 0, 0, comp, compPortId.compInst, compPortId, tsiPortId.compInst, tsiPortId);
  }
  
  /// @todo unmapping on SA
  return TRI_OK;
}
コード例 #11
0
ファイル: tm.cpp プロジェクト: mpusz/FreeTTCN
void freettcn::TM::CTestManagement::TestCaseStarted(const TciTestCaseIdType &testCaseId, const TciParameterListType &parameterList, double timer)
{
    _tc = &TestCaseGet(testCaseId.objectName);
    _tc->Started(parameterList, timer);

    if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_TM_TC_STARTED)) {
        TriComponentId comp = { { 0 } };
        comp.compName = nullptr;
        comp.compType.moduleName = nullptr;
        comp.compType.objectName = nullptr;

        TciParameterListType parList(parameterList);
        tliTcStarted(0, TimeStampMgr().Get(), 0, 0, comp, testCaseId, parList, timer);
    }
}
コード例 #12
0
ファイル: tracemon.c プロジェクト: 8l/miaow
// Called when retiring an instruction
void PrintAndDelete(int cuid, int wf, int pc)
{
	Logging(cuid, wf, pc, "Delete", NULL);

	pthread_mutex_lock(&lock);

	int idx = findInstrIndex(cuid, wf, pc);

	if(objects[cuid][wf][idx].complete == 1) {
		char buff[100];
		sprintf(buff, "PrintAndDelete: wfid=%d pc=0x%X in CU%d has already retired.\n", 
			wf, pc, cuid);
		WriteString(cuid, wf, buff);

		pthread_mutex_unlock(&lock);
		return;
	}

	objects[cuid][wf][idx].complete = 1;

	if(idx == -1) {
		char buff[100];
		sprintf(buff, "PrintAndDelete: wfid=%d pc=0x%X in CU%d not found.\n", 
			wf, pc, cuid);
		WriteString(cuid, wf, buff);
		//return;
	}
	else if(idx == 0) {
		int i;
		int max = numOfObjs[cuid][wf];
		
		for(i = 0; i < max; i++) {
			if(objects[cuid][wf][i].complete == 1) {
				WriteString(cuid, wf, objects[cuid][wf][i].buff);
			}
			else {
				break;
			}
		}

		deleteInstrIndex(cuid, wf, i);
	}

	pthread_mutex_unlock(&lock);
}
コード例 #13
0
ファイル: pa.cpp プロジェクト: mpusz/FreeTTCN
TriStatus freettcn::PA::CPlatformAdaptor::TimerStop(const TriTimerId *timerId)
{
  if (!timerId)
    return TRI_ERROR;
  
  try {
    freettcn::PA::CTimer &timer = TimerGet(*timerId);
    timer.Stop();
    
    if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_PA_T_STOP)) {
      TriComponentId comp = { { 0 } };
      tliTStop(0, TimeStampMgr().Get(), 0, 0, comp, *timerId, timer.Read());
    }

    return TRI_OK;
  }
  catch(freettcn::Exception &) {
    return TRI_ERROR;
  }
}
コード例 #14
0
ファイル: tracemon.c プロジェクト: 8l/miaow
// adds the string to be prepended for a wf
void AddNewWavefront(int cuid, int tag, int wf) {
	char buff[50];
	FILE *fp;

	int ret = checkIfFolderExists(kernel_id);

	if(ret == 1) {
		sprintf(buff, "kernel_%d/tracemon_%d_%d_%d.out", 
			kernel_id, kernel_id, (tag/16), (tag%16));
	}
	else {
		sprintf(buff, "tracemon_%d_%d_%d.out", 
			kernel_id, (tag/16), (tag%16));
	}

	strcpy(outFileName[cuid][wf], buff);
	fp = fopen(outFileName[cuid][wf], "w");
	fclose(fp);
	Logging(cuid, wf, 0, buff, NULL);
}
コード例 #15
0
ファイル: tm.cpp プロジェクト: mpusz/FreeTTCN
void freettcn::TM::CTestManagement::TestCaseTerminated(const VerdictValue &verdict, const TciParameterListType &parameterList)
{
    if (_tc) {
        if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_TM_TC_TERMINATED)) {
            TriComponentId comp = { { 0 } };
            comp.compName = nullptr;
            comp.compType.moduleName = nullptr;
            comp.compType.objectName = nullptr;

            TciParameterListType parList(parameterList);
            tliTcTerminated(0, TimeStampMgr().Get(), 0, 0, comp, _tc->Id(), parList, verdict);
        }

        _tc->Terminated(verdict, parameterList);

        _tc = 0;
    }

    if (_status == RUNNING_TEST_CASE)
        _status = NOT_RUNNING;
}
コード例 #16
0
ファイル: tracemon.c プロジェクト: 8l/miaow
// Called when retiring a barrier instruction
void PrintAndDeleteBarrier(int cuid, int wf)
{
	Logging(cuid, wf, 0, "DeleteOnBar", NULL);

	pthread_mutex_lock(&lock);

	int idx;
	int max = numOfObjs[cuid][wf];

	for(idx = 0; idx < max; idx++) {
		if(objects[cuid][wf][idx].isBarrier == 1) break;
	}

	objects[cuid][wf][idx].complete = 1;

	if(idx == max) {
		char buff[100];
		sprintf(buff, "PrintAndDeleteBarrier: wfid=%d in CU%d not found.\n", 
			wf, cuid);
		WriteString(cuid, wf, buff);
		//return;
	}
	else if(idx == 0) {
		int i;
		
		for(i = 0; i < max; i++) {
			if(objects[cuid][wf][i].complete == 1) {
				WriteString(cuid, wf, objects[cuid][wf][i].buff);
			}
			else {
				break;
			}
		}

		deleteInstrIndex(cuid, wf, i);
	}

	pthread_mutex_unlock(&lock);
}
コード例 #17
0
ファイル: pa.cpp プロジェクト: mpusz/FreeTTCN
TriStatus freettcn::PA::CPlatformAdaptor::TimerRunning(const TriTimerId* timerId, unsigned char* running)
{
  if (!timerId)
    return TRI_ERROR;
  
  if (!running)
    return TRI_ERROR;
  
  try {
    freettcn::PA::CTimer &timer = TimerGet(*timerId);
    *running = timer.Running();

    if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_PA_T_RUNNING)) {
      TriComponentId comp = { { 0 } };
      tliTRunning(0, TimeStampMgr().Get(), 0, 0, comp, *timerId, *running ? runningT : expiredT);
    }
  }
  catch(freettcn::Exception &) {
    return TRI_ERROR;
  }
  
  return TRI_OK;
}
コード例 #18
0
ファイル: pa.cpp プロジェクト: mpusz/FreeTTCN
TriStatus freettcn::PA::CPlatformAdaptor::TimerRead(const TriTimerId* timerId, TriTimerDuration* elapsedTime)
{
  if (!timerId)
    return TRI_ERROR;
  
  if (!elapsedTime)
    return TRI_ERROR;
  
  try {
    freettcn::PA::CTimer &timer = TimerGet(*timerId);
    *elapsedTime = timer.Read();
    
    if (Logging() && LogMask().Get(freettcn::CLogMask::CMD_PA_T_READ)) {
      TriComponentId comp = { { 0 } };
      tliTRead(0, TimeStampMgr().Get(), 0, 0, comp, *timerId, *elapsedTime);
    }
    
    return TRI_OK;
  }
  catch(freettcn::Exception &) {
    return TRI_ERROR;
  }
}
コード例 #19
0
ファイル: Main.cpp プロジェクト: HeIIoween/FLHook
void __stdcall GFGoodBuy(struct SGFGoodBuyInfo const &gbi, unsigned int iClientID)
	{
		returncode = DEFAULT_RETURNCODE;

			const GoodInfo *packageInfo = GoodList::find_by_id(gbi.iGoodID);
			/*
			if (packageInfo->iType == 0)
			{
			PrintUserCmdText(iClientID, L"This should be a commodity (equipment?) purchase");
			}
			*/
			if (packageInfo->iType == 1)
			{
			//PrintUserCmdText(iClientID, L"This should be an equipment (maybe?) purchase");
			uint iBase;
			pub::Player::GetBase(iClientID, iBase);
			bool aminiceitem = true;
			string itemname;
			int wearecool = 0;
			
				//in this case, it's more efficent to check if it's an item under watch first.

				for (map<uint, string>::iterator iter = mapACItems.begin(); iter!=mapACItems.end(); iter++)
				{
					if (iter->first == gbi.iGoodID)
					{
									//PrintUserCmdText(iClientID, L"I have found this commodity");
									//We iterate through the base names to see if it's a non-POB base
									list<uint>::iterator i = mapACBases.begin();
									while (i != mapACBases.end())
									{
										if (*i == iBase)
										{
											
												if (mapACSales[iClientID].items.find(gbi.iGoodID) != mapACSales[iClientID].items.end())
												{
														--mapACSales[iClientID].items.find(gbi.iGoodID)->second;
													
															//PrintUserCmdText(iClientID, L"DEBUG: I have found this sale, letting the purchase go through.");
															aminiceitem = true;
															wearecool = 1;

															wstring wscCharname = (const wchar_t*) Players.GetActiveCharacterName(iClientID);
															wstring wscBaseName = HkGetBaseNickByID(iBase);
															
															//PrintUserCmdText(iClientID, L"DEBUG: %i purchases left.", mapACSales[iClientID].items.find(gbi.iGoodID)->second);
															wstring wscMsgLog = L"<%sender> has bought back <%item> from base <%basename> (%isale purchases left)";
															wscMsgLog = ReplaceStr(wscMsgLog, L"%sender", wscCharname.c_str());
															wscMsgLog = ReplaceStr(wscMsgLog, L"%basename", wscBaseName.c_str());
															wscMsgLog = ReplaceStr(wscMsgLog, L"%item", stows(iter->second).c_str());
															wscMsgLog = ReplaceStr(wscMsgLog, L"%isale", stows(itos(mapACSales[iClientID].items.find(gbi.iGoodID)->second))).c_str();
															string scText = wstos(wscMsgLog);
															Logging("%s", scText.c_str());

															if (mapACSales[iClientID].items.find(gbi.iGoodID)->second == 0)
															{
																mapACSales[iClientID].items.erase(gbi.iGoodID);
																//PrintUserCmdText(iClientID, L"DEBUG: no purchases left");
															}

															break;
													
												}

											if (wearecool == 0)
											{
											//PrintUserCmdText(iClientID, L"DEBUG: I have found this base, not good");
											aminiceitem = false;
											itemname = iter->second;
											}
										}
										i++;
									}
					}

					if (aminiceitem == false)
					{
						returncode = SKIPPLUGINS_NOFUNCTIONCALL;
						wstring wscCharname = (const wchar_t*) Players.GetActiveCharacterName(iClientID);
							wstring wscBaseName = HkGetBaseNickByID(iBase);
							
							pub::Player::SendNNMessage(iClientID, pub::GetNicknameId("nnv_anomaly_detected"));
							wstring wscMsgU = L"MF: %name has been permabanned. (Type 2)";
							wscMsgU = ReplaceStr(wscMsgU, L"%name", wscCharname.c_str());

							HkMsgU(wscMsgU);

							wstring wscMsgLog = L"<%sender> was permabanned for attempting to buy an illegal item <%item> from base <%basename> (see DSAM)";
							wscMsgLog = ReplaceStr(wscMsgLog, L"%sender", wscCharname.c_str());
							wscMsgLog = ReplaceStr(wscMsgLog, L"%basename", wscBaseName.c_str());
							wscMsgLog = ReplaceStr(wscMsgLog, L"%item", stows(itemname).c_str());

							LogCheater(iClientID, wscMsgLog);
					}
				}
			}
			else if (packageInfo->iType == 3)
			{
					uint iBase;
					pub::Player::GetBase(iClientID, iBase);
					//PrintUserCmdText(iClientID, L"This should be a ship purchase");
					bool aminiceship = false;

					for (map<uint, list<uint>>::iterator iter = mapACShips.begin(); iter!=mapACShips.end(); iter++)
					{
						if (iter->first == iBase)
						{
							//PrintUserCmdText(iClientID, L"This should be a base");
							// we check if one of the three packages sold here is the correct one
							list<uint>::iterator i = iter->second.begin();
							while (i != iter->second.end())
							{
								if (*i == gbi.iGoodID)
								{
									//PrintUserCmdText(iClientID, L"I have found this ship");
									aminiceship = true;
									break;
								}
								i++;
							}								
						}
					}

					if (aminiceship == false)
					{
						wstring wscCharname = (const wchar_t*) Players.GetActiveCharacterName(iClientID);
						wstring wscBaseName = HkGetBaseNickByID(iBase);
						
						pub::Player::SendNNMessage(iClientID, pub::GetNicknameId("nnv_anomaly_detected"));
						wstring wscMsgU = L"MF: %name has been permabanned. (Type 1)";
						wscMsgU = ReplaceStr(wscMsgU, L"%name", wscCharname.c_str());

						HkMsgU(wscMsgU);

						wstring wscMsgLog = L"<%sender> was permabanned for attempting to buy an illegal ship from base <%basename> (see DSAM)";
						wscMsgLog = ReplaceStr(wscMsgLog, L"%sender", wscCharname.c_str());
						wscMsgLog = ReplaceStr(wscMsgLog, L"%basename", wscBaseName.c_str());

						LogCheater(iClientID, wscMsgLog);
					}
			}	




	}
コード例 #20
0
ファイル: Main.cpp プロジェクト: HeIIoween/FLHook
void __stdcall GFGoodSell(struct SGFGoodSellInfo const &gsi, unsigned int iClientID)
{
		returncode = DEFAULT_RETURNCODE;

		const GoodInfo *packageInfo = GoodList::find_by_id(gsi.iArchID);
		// check for equipments only
		if (packageInfo->iType == 1)
			{
				uint iBase;
				pub::Player::GetBase(iClientID, iBase);

				//in this case, it's more efficent to check if it's an item under watch first.
				for (map<uint, string>::iterator iter = mapACItems.begin(); iter!=mapACItems.end(); iter++)
				{
					if (iter->first == gsi.iArchID)
					{
						//PrintUserCmdText(iClientID, L"I have found commodity %s.", stows(iter->second).c_str());
						//We iterate through the base names to see if it's a non-POB base
							list<uint>::iterator i = mapACBases.begin();
							while (i != mapACBases.end())
							{
								if (*i == iBase)
								{
									wstring wscCharname = (const wchar_t*) Players.GetActiveCharacterName(iClientID);
									wstring wscBaseName = HkGetBaseNickByID(iBase);
									

									//PrintUserCmdText(iClientID, L"I have found this base, logging the purchase.");
									// check if this item is already under watch, if so increase amount by 1
									if (mapACSales[iClientID].items.find(gsi.iArchID) != mapACSales[iClientID].items.end())
									{
										++mapACSales[iClientID].items.find(gsi.iArchID)->second;
										//PrintUserCmdText(iClientID, L"DEBUG: I have logged %i sales.", mapACSales[iClientID].items.find(gsi.iArchID)->second);
										wstring wscMsgLog = L"<%sender> has sold <%item> to base <%basename> (Already recorded %isale sales of this item)";
										wscMsgLog = ReplaceStr(wscMsgLog, L"%sender", wscCharname.c_str());
										wscMsgLog = ReplaceStr(wscMsgLog, L"%basename", wscBaseName.c_str());
										wscMsgLog = ReplaceStr(wscMsgLog, L"%item", stows(iter->second).c_str());
										wscMsgLog = ReplaceStr(wscMsgLog, L"%isale", stows(itos(mapACSales[iClientID].items.find(gsi.iArchID)->second))).c_str();
										string scText = wstos(wscMsgLog);
										Logging("%s", scText.c_str());
										
									}
									else
									{
										mapACSales[iClientID].items[gsi.iArchID] = 1;
										wstring wscMsgLog = L"<%sender> has sold <%item> to base <%basename> (First sale)";
										wscMsgLog = ReplaceStr(wscMsgLog, L"%sender", wscCharname.c_str());
										wscMsgLog = ReplaceStr(wscMsgLog, L"%basename", wscBaseName.c_str());
										wscMsgLog = ReplaceStr(wscMsgLog, L"%item", stows(iter->second).c_str());
										string scText = wstos(wscMsgLog);
										Logging("%s", scText.c_str());
									}
									break;
								}
								i++;
							}
						break;
					}
				}
			}
}
コード例 #21
0
ファイル: Notifier.cpp プロジェクト: Ryannnnnnn/toys
void Notifier::NotifyLogging(char *log)
{
    emit Logging(log);
}
コード例 #22
0
HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
									 IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv)
{
	if(CFilterMapper2::m_pFilterMapper2)
	{
		CheckPointer(ppv, E_POINTER);

		if(rclsid == CLSID_FilterMapper)
		{
			TRACE_SVP5(_T("Mine_CoCreateInstance Unknown REGDB_E_CLASSNOTREG ") );
			ASSERT(0);
			return REGDB_E_CLASSNOTREG; // sorry...
		}

		if(rclsid == CLSID_FilterMapper2)
		{
			if(pUnkOuter) {
				TRACE_SVP5(_T("Mine_CoCreateInstance Unknown CLASS_E_NOAGGREGATION ") );
				return CLASS_E_NOAGGREGATION;
			}

			if(riid == __uuidof(IUnknown))
			{
				CFilterMapper2::m_pFilterMapper2->AddRef();
				*ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2;
				return S_OK;
			}
			else if(riid == __uuidof(IFilterMapper2))
			{
				CFilterMapper2::m_pFilterMapper2->AddRef();
				*ppv = (IFilterMapper2*)CFilterMapper2::m_pFilterMapper2;
				return S_OK;
			}
			else
			{
				TRACE_SVP5(_T("Mine_CoCreateInstance Unknown riid %s"), CStringFromGUID(riid) );
				return E_NOINTERFACE;
			}

		}

		TRACE_SVP5(_T("Mine_CoCreateInstance Unknown %s"), CStringFromGUID(rclsid));
	}

	if(!pUnkOuter)
		if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9 ||
      rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault ||
      rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
		{
			CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
			CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
			CComPtr<IUnknown> pInner;
			HRESULT hr;
			if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner)))
			{
				pMK->SetInner(pInner);
				return pUnk->QueryInterface(riid, ppv);
			}
		}

    TRACE_SVP5(_T("Mine_CoCreateInstance %s"), CStringFromGUID(rclsid) );

		long ret = E_FAIL;
    CSVPToolBox svpTool;
    // TODO: more effective way to do this
    // maybe set a static array/map of GUID and dll files
    if (GUIDFromCString(_T("{083863F1-70DE-11D0-BD40-00A0C911CE86}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"haalis.ax"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{31345649-0000-0010-8000-00AA00389B71}")) == rclsid ||
             GUIDFromCString(_T("{87CA6F02-49E4-11CF-A3FE-00AA003735BE}")) == rclsid ||
             GUIDFromCString(_T("{BD323430-CE94-11CE-82DD-0800095A5B55}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"ir41_32.ax"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{1F73E9B1-8C3A-11D0-A3BE-00A0C9244436}")) == rclsid ||
             GUIDFromCString(_T("{665A4448-D905-11D0-A30E-444553540000}")) == rclsid ||
             GUIDFromCString(_T("{665A4443-D905-11D0-A30E-444553540000}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"ir50_32.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{DB43B405-43AA-4f01-82D8-D84D47E6019C}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"ogm.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{B841F346-4835-4de8-AA5E-2E7CD2D4C435}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"ts.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{B3DE7EDC-0CD4-4d07-B1C5-92219CD475CC}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"mp4.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{53D9DE0B-FC61-4650-9773-74D13CC7E582}")) == rclsid ||
             GUIDFromCString(_T("{64F2005C-6CF5-4652-B94F-600360B15B27}")) == rclsid ||
             GUIDFromCString(_T("{BD4FB4BE-809D-487b-ADD6-F7D164247E52}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"mkx.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(L"{09571A4B-F1FE-4C60-9760-DE6D310C7C31}") == rclsid ||
             GUIDFromCString(L"{F23B1F18-CB1A-47ED-A1FE-B60494A626D0}") == rclsid ||
             GUIDFromCString(L"{BBA35D2A-A374-4CDF-9C5D-BF31DE970B54}") == rclsid ||
             GUIDFromCString(L"{3FD76A83-DAA1-403B-B388-26EFFF652725}") == rclsid ||
             GUIDFromCString(L"{C9783F9D-7E56-4205-9CA1-225CD9349BD7}") == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"codec\cavc2.ax"), rclsid, riid, ppv);
    else if (GUIDFromCString(L"{ED3110F3-5211-11DF-94AF-0026B977EEAA}") == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"vp8decoder.dll"), rclsid, riid, ppv);
    // csf
    else if (GUIDFromCString(_T("{ACD23F8C-B37E-4B2D-BA08-86CB6E621D6A}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mtcontain.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{164A68B6-3F90-47C2-85A7-1E4D8952EF0A}")) == rclsid ||
             GUIDFromCString(_T("{3BB3828F-9787-48A7-A894-6ADE46C64737}")) == rclsid ||
             GUIDFromCString(_T("{BD4FB4BE-809D-487b-ADD6-F7D164247E52}")) == rclsid ||
             GUIDFromCString(_T("{B4DAEDB7-7F0E-434F-9AA3-B82B549A3680}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mtcontrol.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{5BC26A00-5101-47d7-A5DB-AB6AAC44F51B}")) == rclsid ||
             GUIDFromCString(_T("{E5960BC4-A76B-4211-BEEC-9AEE2AF8AAE6}")) == rclsid ||
             GUIDFromCString(_T("{C6291160-8402-45EF-9923-38BBDED6F05E}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxvideo.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{7E493C9A-2E54-4F25-9B9A-D3C4DEBFCB62}")) == rclsid ||
             GUIDFromCString(_T("{D48D1EB2-BF95-4EE1-BD69-9AD0515F050D}")) == rclsid ||
             GUIDFromCString(_T("{AD92C6E6-997A-4E9E-9D7D-EDED6DE933FB}")) == rclsid)
      ret = LoadExternalObject(svpTool.GetPlayerPath(L"csfcodec\\mpc_mdssockc.dll"), rclsid, riid, ppv, pUnkOuter);
    else if (GUIDFromCString(_T("{86708513-5A2E-424F-AB46-F4BE3F82954F}")) == rclsid ||
             GUIDFromCString(_T("{341873D2-646D-4EE7-ACBE-ECF2E927BEBD}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxaudio.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{87BBB4ED-1767-4B7E-821C-7C4657E439D4}")) == rclsid ||
             GUIDFromCString(_T("{32E2BDD6-8812-42C3-A907-B9587C148EE3}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxscreen.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{2627A1B6-F8FF-4E9C-9422-4908E8D1DFE9}")) == rclsid ||
             GUIDFromCString(_T("{3FD0479E-D6B9-4629-9496-509D3D070918}")) == rclsid ||
             GUIDFromCString(_T("{99AA8908-FC7F-4815-B023-3BC2F5F8D372}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshbasu.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{03D82D06-49E2-4E37-9670-BCAB4DBC642D}")) == rclsid ||
             GUIDFromCString(_T("{7B6F8B69-0925-48F1-AE78-7506D6C3972C}")) == rclsid ||
             GUIDFromCString(_T("{B7BCE5B0-2112-420A-BDFF-178995FBFCA2}")) == rclsid ||
             GUIDFromCString(_T("{BB9CDE7F-AF28-4205-9B3C-789FA7D0F29F}")) == rclsid ||
             GUIDFromCString(_T("{C1630673-8C58-481C-9F15-83F11D8B89F0}")) == rclsid ||
             GUIDFromCString(_T("{C7E094E1-A326-4E33-824D-6598D399DA13}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshmaiu.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{96CE7B0D-06B3-42E2-8DB7-CFC6CF0121F6}")) == rclsid ||
             GUIDFromCString(_T("{E4C3B74F-0C02-4D4E-B932-F7A1889B3ABB}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshsour.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{B5A7D70F-AE96-4F83-B811-572CA3529323}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mcucltu.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{0C56B154-43F7-48A0-87B2-E9ACC8E1E471}")) == rclsid ||
             GUIDFromCString(_T("{46E00789-37CA-4278-8907-02088898B6B0}")) == rclsid ||
             GUIDFromCString(_T("{BAC04407-3588-42AA-93BE-6D3720E9FB28}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_mcufilecu.dll"), rclsid, riid, ppv);
    else if (GUIDFromCString(_T("{212CA6D1-E9BB-41cf-BF77-06E000F403A8}")) == rclsid ||
             GUIDFromCString(_T("{57A5353F-2725-440c-BBBC-DB20A1C8A57D}")) == rclsid ||
             GUIDFromCString(_T("{A94662D1-35FD-43d1-BDA3-172CE4D5C236}")) == rclsid ||
             GUIDFromCString(_T("{D0430FE6-1621-41e4-A109-CA5B0C57FE1D}")) == rclsid ||
             GUIDFromCString(_T("{D2598A88-4035-4556-84A2-B0F76A544E92}")) == rclsid ||
             GUIDFromCString(_T("{D6D61C19-8563-4e8e-B755-0589DA6A3077}")) == rclsid ||
             GUIDFromCString(_T("{E9203D3F-6404-40aa-99CC-5267215B81A7}")) == rclsid ||
             GUIDFromCString(_T("{ECCBA771-92F2-497b-98AA-5FAA0BAA2DF6}")) == rclsid)
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"csfcodec\\mpc_wtlvcl.dll"), rclsid, riid, ppv);
    // csf end */
    else if (GUIDFromCString(_T("{2EEB4ADF-4578-4D10-BCA7-BB955F56320A}")) == rclsid && !AfxGetMyApp()->IsVista()
      && !svpTool.FindSystemFile(L"wmadmod.dll"))
      ret = LoadExternalObject(  svpTool.GetPlayerPath(L"wmadmod.dll"), rclsid, riid, ppv);

    if (pUnkOuter)
      Logging(L"Fake_CoCreateInstance %x %x %x %s %s", ret, pUnkOuter, ppv, 
              CStringFromGUID(rclsid), CStringFromGUID(riid));

    try {
      if (FAILED(ret))
        ret = Real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
    }
    catch (...) {return E_FAIL;};
    
    return ret;
}