LONG WINAPI Mine_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4)
{
	TRACE_SVP( "Mine_RegOpenKeyExA  %s %u ",  a1, a2);
	if( a1 ){
		if( _strcmpi(a1, "Software\\CoreCodec\\CoreAVC Pro") == 0){
			TRACE_SVP( "CoreAVC");
			*a4 = FAKEHKEY+1;
			 return ERROR_SUCCESS;
		}
        if( _strcmpi(a1, "Software\\CoreCodec\\CoreAVC Pro 2.x") == 0){
            TRACE_SVP( "CoreAVC 2");
            *a4 = FAKEHKEY+3;
            return ERROR_SUCCESS;
        }
		
		else if( _strcmpi(a1, "CLSID\\{083863F1-70DE-11D0-BD40-00A0C911CE86}\\Instance\\{09571A4B-F1FE-4C60-9760-DE6D310C7C31}") == 0) {
					*a4 = FAKEHKEY+2;
					 return ERROR_SUCCESS;
		}
		
		
	}
	

	if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {TRACE_SVP("Mine_RegOpenKeyExA %s" , a1);*a4 = FAKEHKEY; return ERROR_SUCCESS;}
	LONG ret = Real_RegOpenKeyExA(a0, a1, a2, a3, a4);

	//TRACE_SVP( "Mine_RegOpenKeyExA %s %u %u",  a1, a2, *a4);
	return ret;
}
Exemple #2
0
/*
* DesktopListCompareFunc
*
* Purpose:
*
* Desktop page listview comparer function.
*
*/
INT CALLBACK DesktopListCompareFunc(
	_In_ LPARAM lParam1,
	_In_ LPARAM lParam2,
	_In_ LPARAM lParamSort
	)
{
	LPWSTR lpItem1, lpItem2;
	INT nResult;

	lpItem1 = supGetItemText(DesktopList, (INT)lParam1, (INT)lParamSort, NULL);
	if (lpItem1 == NULL)
		return 0;

	lpItem2 = supGetItemText(DesktopList, (INT)lParam2, (INT)lParamSort, NULL);
	if (lpItem2 == NULL)
		return 0;

	if (bDesktopListSortInverse)
		nResult = _strcmpi(lpItem2, lpItem1);
	else
		nResult = _strcmpi(lpItem1, lpItem2);

	HeapFree(GetProcessHeap(), 0, lpItem1);
	HeapFree(GetProcessHeap(), 0, lpItem2);
	return nResult;
}
Exemple #3
0
/*
* ucmLoadCallback
*
* Purpose:
*
* Image load notify callback, when kernel32 available - acquire import and run target application.
*
*/
VOID NTAPI ucmLoadCallback(
    PWSTR DllName,
    PVOID DllBase,
    SIZE_T DllSize,
    PVOID Reserved
)
{
    BOOL bReadSuccess, bIsLocalSystem = FALSE;

    PWSTR lpParameter = NULL;
    ULONG cbParameter = 0L;

    UNREFERENCED_PARAMETER(DllSize);
    UNREFERENCED_PARAMETER(Reserved);

    if (DllName == NULL) {
        return;
    }

    if (_strcmpi(DllName, L"kernel32.dll") == 0) {
        g_pvKernel32 = DllBase;
    }

    if (_strcmpi(DllName, L"user32.dll") == 0) {
        if (g_pvKernel32) {
            
            pCreateProcessW = ucmLdrGetProcAddress(
                (PCHAR)g_pvKernel32, 
                "CreateProcessW");

            if (pCreateProcessW != NULL) {

                ucmIsLocalSystem(&bIsLocalSystem);

                bReadSuccess = ucmReadParameters(
                    &lpParameter,
                    &cbParameter,
                    NULL,
                    NULL,
                    bIsLocalSystem);

                ucmLaunchPayloadEx(
                    pCreateProcessW,
                    lpParameter,
                    cbParameter);

                if ((bReadSuccess) && 
                    (lpParameter != NULL)) 
                {
                    RtlFreeHeap(
                        NtCurrentPeb()->ProcessHeap,
                        0,
                        lpParameter);
                }

                NtTerminateProcess(NtCurrentProcess(), STATUS_SUCCESS);
            }
        }
    }
}
Exemple #4
0
CCareerTask::CCareerTask( const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete )
{
    m_eventsSeen     = 0;
    m_name           = taskName;
    m_isComplete     = isComplete;
    m_event          = event;
    m_eventsNeeded   = n;
    m_mustLive       = mustLive;
    m_diedThisRound  = 0;
    m_crossRounds    = crossRounds;
    m_id             = id;
    //m_weaponId       = AliasToWeaponID( weaponName );
    //m_weaponClassId  = AliasToWeaponClass( weaponName );
    m_rescuer        = _strcmpi( taskName, "stoprescue" ) == 0;
    m_defuser        = _strcmpi( taskName, "killdefuser" ) == 0;
    m_vip            = _strcmpi( taskName, "killvip" ) == 0;

    if( event == EVENT_ALL_HOSTAGES_RESCUED )
    {
        m_mustLive    = 1;
        m_crossRounds = false;
    }

    if( m_isComplete )
    {
        MESSAGE_BEGIN( MSG_ALL, gmsgCZCareer );
            WRITE_STRING( "TASKDONE" );
            WRITE_BYTE( m_id );
        MESSAGE_END();
    }
}
Exemple #5
0
STDMETHODIMP CAtlBase::OnWndMsg(PMSG WndMsg, INT* pnRet, BSTR preViewType)
{
	extern BYTE* g_SceneEditorKeyState;

	PMSG pMsg = (PMSG)WndMsg;

	if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
	{
		g_SceneEditorKeyState[pMsg->wParam] = !!(GetAsyncKeyState(INT(pMsg->wParam)) & 0x8000);
	}

	if (pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST && pMsg->message != WM_MOUSEMOVE || pMsg->message == WM_COMMAND)
	{	
		g_SceneEditorKeyState[VK_LBUTTON] = !!(GetAsyncKeyState(VK_LBUTTON) & 0x8000);
		g_SceneEditorKeyState[VK_MBUTTON] = !!(GetAsyncKeyState(VK_MBUTTON) & 0x8000);
		g_SceneEditorKeyState[VK_RBUTTON] = !!(GetAsyncKeyState(VK_RBUTTON) & 0x8000);
	}
	
	if (_strcmpi(BSTR_TO_STRING(preViewType), "NPC") == 0 && g_NpcInputProxy)
	{
		g_NpcInputProxy->CheckInputEvent(pMsg);
	}
	else if (_strcmpi(BSTR_TO_STRING(preViewType), "Doodad") == 0 && g_DoodadInputProxy)
	{
		g_DoodadInputProxy->CheckInputEvent(pMsg);
	}	

	return S_OK;
}
	// This method clears the list and adds contacts again, according to the current filter settings.
	void RebuildList()
	{
		LPSTR pszProto;
		MTime mtNow;
		MAnnivDate ad;
		int i = 0;
		DWORD age = 0;
		WORD wDaysBefore = db_get_w(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
		WORD numMale = 0;
		WORD numFemale = 0;
		WORD numContacts = 0;
		WORD numBirthContacts = 0;

		ShowWindow(_hList, SW_HIDE);
		DeleteAllItems();
		mtNow.GetLocalTime();

		// insert the items into the list
		for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
			// ignore meta subcontacts here, as they are not interesting.
			if (!db_mc_isSub(hContact)) {
				// filter protocol
				pszProto = Proto_GetBaseAccountName(hContact);
				if (pszProto) {
					numContacts++;
					switch (GenderOf(hContact, pszProto)) {
					case 'M':
						numMale++;
						break;
					case 'F':
						numFemale++;
					}

					if (!ad.DBGetBirthDate(hContact, pszProto)) {
						age += ad.Age(&mtNow);
						numBirthContacts++;

						// add birthday
						if ((_filter.bFilterIndex != FILTER_ANNIV) && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto)))
							AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
					}

					// add anniversaries
					if (_filter.bFilterIndex != FILTER_BIRTHDAY && (!_filter.pszProto || !_strcmpi(pszProto, _filter.pszProto))) 
						for (i = 0; !ad.DBGetAnniversaryDate(hContact, i); i++)
							if (!_filter.pszAnniv || !mir_tstrcmpi(_filter.pszAnniv, ad.Description()))
								AddRow(hContact, pszProto, ad, mtNow, wDaysBefore);
				}
			}
		}
		ListView_SortItemsEx(_hList, (CMPPROC)cmpProc, this);
		ShowWindow(_hList, SW_SHOW);

		// display statistics
		SetDlgItemInt(_hDlg, TXT_NUMBIRTH, numBirthContacts, FALSE);
		SetDlgItemInt(_hDlg, TXT_NUMCONTACT, numContacts, FALSE);
		SetDlgItemInt(_hDlg, TXT_FEMALE, numFemale, FALSE);
		SetDlgItemInt(_hDlg, TXT_MALE, numMale, FALSE);
		SetDlgItemInt(_hDlg, TXT_AGE, numBirthContacts > 0 ? (age - (age % numBirthContacts)) / numBirthContacts : 0, FALSE);
	}
Exemple #7
0
GameObject* GameObject::Spawn(_In_ GamePlay* gamePlay, _In_ const GameObjectSpawnInfo* info)
{
    auto& content = gamePlay->GetContent();

    if (_strcmpi(info->Type, "testcube") == 0)
    {
        SimpleObject* object = new SimpleObject(gamePlay, info);
        object->_flags = SimpleObject::Flag::Rotate;
        object->SetGeometry(content.GetGeometry("cube.obj"));
        object->SetTexture(TextureType::Diffuse, content.GetTexture("blueprint.png", true));
        object->_rotationPerSecond = 0.5f;

        return object;
    }
    else if (_strcmpi(info->Type, "testcastle") == 0)
    {
        SimpleObject* object = new SimpleObject(gamePlay, info);
        object->SetGeometry(content.GetGeometry("castle/castle01.obj"));
        object->SetTexture(TextureType::Diffuse, content.GetTexture("blueprint.png", true));
        return object;
    }

    Error("Invalid game object type");
    return nullptr;
}
	//////////////////////////////////////////////////////////////////////////
	//	Utils
	//////////////////////////////////////////////////////////////////////////
	Justification GetJustEnumFromString(const std::string& just)
	{
		if (_strcmpi(just.c_str(), "center") == 0)
		{
			return CL_CENTER;
		}
		else if (_strcmpi(just.c_str(), "left") == 0)
		{
			return CL_LEFT;
		}
		else if (_strcmpi(just.c_str(), "right") == 0)
		{
			return CL_RIGHT;
		}
		else if (_strcmpi(just.c_str(), "top") == 0)
		{
			return CL_TOP;
		}
		else if (_strcmpi(just.c_str(), "bottom") == 0)
		{
			return CL_BOTTOM;
		}

		return CL_CENTER;
	}
Exemple #9
0
bool classPARSESTR::DoFree( char* pStr )
{
	char* pARG;
	
	// ON, OFF
	pARG   = ParseString(pStr,1);

	if( _strcmpi( "WEIGHT", pARG ) == 0 )
	{
		if( CGame::GetInstance().GetRight() )
		{
			g_GameDATA.m_bNoWeight = !g_GameDATA.m_bNoWeight;
			if( g_GameDATA.m_bNoWeight )
				g_pNet->Send_cli_SET_WEIGHT_RATE( 0 );					

			return true;
		}
	}

	if( _strcmpi( "CHAT", pARG ) == 0 )
	{
		CTDialog* pDlg = g_itMGR.FindDlg( DLG_TYPE_CHAT );
		if( CGame::GetInstance().GetRight() && pDlg )
		{
			CChatDLG* pChatDlg = (CChatDLG*)pDlg;
			pChatDlg->SetDisableShoutRestrict();
			return true;
		}
	}
	return false;
}
Exemple #10
0
/*
This function outputs the Question
Message and gets the player's input.

If the player inputs "i", the game has Indra speak and
continue down the Conversation Tree.
If the player inputs "p", the game has Phil speak and
continue down the Conversation Tree.
Else, the game gives the Bad Input message and re-prompts
the player to give an input.

@return Result - INDRA if player inputs "i"
                 PHIL if player inputs "p"
*/
Choose Question::OutputText()
{
	bool chose_valid_choice = false;
	//give the Question message.
	question_msg_->OutputText();
	Choose choice;

	while (!chose_valid_choice)
	{
		//prompt the user for input.
		char player_input[kPlayerInputSize];
		cout << "> ";
		cin >> player_input;

		//if the user inputted "i" or "I"
		if (_strcmpi(player_input, "i") == 0)
		{
			choice = INDRA;
			chose_valid_choice = true;
		}
		//if the user inputted "p" or "P"
		else if (_strcmpi(player_input, "p") == 0)
		{
			choice = PHIL;
			chose_valid_choice = true;
		}
		else
		{
			//give the Bad Input Message.
			bad_input_msg_->OutputText();
		}
	}
	return choice;
}
Exemple #11
0
//----------------------------------------------- ON GAME END ------------------------------------------------
BOOL __stdcall _SNetLeaveGame(int type)
{
  //MessageBox(0, "OnGameEnd", "", 0);
  BWCLBK_OnGameEnd();
  if ( firstStarted )
  {
    // copy our leaks to a new list
    for ( std::list<stormAlloc>::iterator i = allocations.begin(); i != allocations.end(); ++i )
    {
      if ( i->memLeak )
        leaks.push_back(*i);
      else
        i->memLeak = true;
    }
    // Deal with our leaks and remove them from the old list
    for each ( stormAlloc i in leaks )
    {
      if ( !_strcmpi(i.lastFile, "dlgs\\protoss.grp") || 
           !_strcmpi(i.lastFile, "dlgs\\terran.grp")  ||
           !_strcmpi(i.lastFile, "dlgs\\zerg.grp") )
      {
        _SMemFree(i.location, "BW Leak @BWAPI Detours.cpp", __LINE__, 0);
      }
      else
      {
        savedLoc = i.location;
        allocations.remove_if(memtest);
      }
    }
    leaks.clear();
  }
  else
Exemple #12
0
/**
* Pass input arguments, note that argv[0] from the command line should be removed
*/
bool ConfigIO :: parseArgs (int nArgs, const char **argv)
{
	if (nArgs > 0)
		if (_strcmpi(argv [0], "help") == 0 || _strcmpi(argv [0], "?") == 0 || _strcmpi(argv [0], "/h") == 0 || _strcmpi(argv [0], "/?") == 0) {
			std::cout << "------------------------------------------" << std::endl;
			std::cout << "Valid parameters for this application: " << std::endl;
			for (size_t f = 0; f < parameters.size (); f ++)
				std::cout	<< " * " 
				<< getTypeAsString(parameters[f]) 
				<< " "
				<< parameters[f].name 
				<< " ["
				<< getValueAsString(parameters[f]) 
				<< "]" 
				<< std::endl;

			std::cout << "------------------------------------------" << std::endl;
			exit(0);
		}


	for (int i = 0; i < nArgs; i ++)
		loadParam (argv [i]);


	return true;
}
Exemple #13
0
/*
* supGetObjectIndexByTypeName
*
* Purpose:
*
* Returns object index of known type.
*
* Known type names listed in sup.c T_ObjectNames, and known object indexes listed in sup.h as TYPE_*
*
*/
UINT supGetObjectIndexByTypeName(
	_In_ LPCWSTR lpTypeName
	)
{
	UINT nIndex;

	if (lpTypeName == NULL) {
		return TYPE_UNKNOWN;
	}

	for (nIndex = TYPE_DEVICE; nIndex < TYPE_UNKNOWN; nIndex++) {
		if (_strcmpi(lpTypeName, T_ObjectNames[nIndex]) == 0)
			return nIndex;
	}

	//
	// In Win8 the following Win32k object was named 
	// CompositionSurface, in Win8.1 MS renamed it to
	// Composition, handle this.
	//
	if (_strcmpi(lpTypeName, L"CompositionSurface") == 0) {
		return TYPE_COMPOSITION;
	}

	return TYPE_UNKNOWN;
}
    /**
     * \brief Converts compressor ID string to category enum
     *
     * \param[in] strCompressorType Compressor name as string
     * \param[in] iCompressionLevel Compression level (compressor dependent)
     */
    bool setCompressor( const char *strCompressorType, int iCompressionLevel = -1 )
    {
        compressor_type_e eCompressorType = CT_NONE;
        
        m_err.clear();
        
        // if no compressor or compression is specified, use standard compressor
        // which leads to no compression
        if( 0 == iCompressionLevel || !strCompressorType || !*strCompressorType )
        {
            strCompressorType = COMPRESSOR_DEFAULT_ID;
            iCompressionLevel = 0;
        }
        
        // checking compressor names
        if( 0 == _strcmpi( strCompressorType, BLOSC_LZ4_ID ) )
        {
            eCompressorType = CT_BLOSC;
        }
        else if( 0 == _strcmpi( strCompressorType, BLOSC_LZ4HC_ID ) )
        {
            eCompressorType = CT_BLOSC;
        }
        else if( 0 == _strcmpi( strCompressorType, BLOSC_DEFAULT_ID ) )
        {
            eCompressorType = CT_BLOSC;
        }
        else if( 0 == _strcmpi( strCompressorType, QLIN16_ID ) )
        {
            eCompressorType = CT_QLIN16;
        }
        else if( 0 == _strcmpi( strCompressorType, QLOG16_ID ) )
        {
            eCompressorType = CT_QLOG16;
        } 

        // check and acquire valid settings
        if( CT_NONE != eCompressorType )
        {
            m_strCompressorType = strCompressorType;
            m_eCompressorType   = eCompressorType;

            if( iCompressionLevel >= 0 )
            {
                m_iCompressionLevel = iCompressionLevel;
            }

            if( m_eCompressorType == CT_BLOSC )
            {
                blosc_set_compressor( m_strCompressorType );
            }

            return true;
        }
        else return false;
    }
Exemple #15
0
int main(int argc, char *argv[])
{

int xrbin = 0, mrbin = 0, dumpctd = 0, insertctd = 0;

if (argc < 3) ShowARGS();
else{

		if (_strcmpi(argv[1], "-xrbin") == 0) //Handle extraction for RBIN files
			xrbin = 1;

		if (_strcmpi(argv[1], "-mrbin") == 0) //Handle creation of RBIN files
			mrbin = 1;

		if (_strcmpi(argv[1], "-dumpctd") == 0) //Handle dump of CTD files
			dumpctd = 1;

		if (_strcmpi(argv[1], "-insertctd") == 0) //Handle creation of CTD files
			insertctd = 1;


		if (xrbin == 0 && mrbin == 0 && dumpctd == 0 && insertctd == 0)
			{
				ShowARGS();
				return(0);
			}
	

		if (xrbin == 1)
		{
			ExtractRbin(argv[2]);
			return(0);
		}

		if (mrbin == 1)
		{
			MakeRbin(argv[2]);
			return(0);
		}

		if (dumpctd == 1)
		{
			DumpCtd(argv[2]);
			return(0);
		}

		if (insertctd == 1)
		{
			MakeCtd(argv[2]);
			return(0);
		}

	}
}
Exemple #16
0
bool cbDebugGetJIT(int argc, char* argv[])
{
    char get_entry[JIT_ENTRY_MAX_SIZE] = "";
    arch actual_arch;

    if(argc < 2)
    {
        if(!dbggetjit(get_entry, notfound, &actual_arch, NULL))
        {
            dprintf(QT_TRANSLATE_NOOP("DBG", "Error getting JIT %s\n"), (actual_arch == x64) ? "x64" : "x32");
            return false;
        }
    }
    else
    {
        readwritejitkey_error_t rw_error;
        Memory<char*> oldjit(MAX_SETTING_SIZE + 1);
        if(_strcmpi(argv[1], "OLD") == 0)
        {
            if(!BridgeSettingGet("JIT", "Old", oldjit()))
            {
                dputs(QT_TRANSLATE_NOOP("DBG", "Error: there is not an OLD JIT entry stored yet."));
                return false;
            }
            else
            {
                dprintf(QT_TRANSLATE_NOOP("DBG", "OLD JIT entry stored: %s\n"), oldjit());
                return true;
            }
        }
        else if(_strcmpi(argv[1], "x64") == 0)
            actual_arch = x64;
        else if(_strcmpi(argv[1], "x32") == 0)
            actual_arch = x32;
        else
        {
            dputs(QT_TRANSLATE_NOOP("DBG", "Unknown JIT entry type. Use OLD, x64 or x32 as parameter."));
            return false;
        }

        if(!dbggetjit(get_entry, actual_arch, NULL, &rw_error))
        {
            if(rw_error == ERROR_RW_NOTWOW64)
                dputs(QT_TRANSLATE_NOOP("DBG", "Error using x64 arg. The debugger is not a WOW64 process\n"));
            else
                dprintf(QT_TRANSLATE_NOOP("DBG", "Error getting JIT %s\n"), argv[1]);
            return false;
        }
    }

    dprintf(QT_TRANSLATE_NOOP("DBG", "JIT %s: %s\n"), (actual_arch == x64) ? "x64" : "x32", get_entry);

    return true;
}
Exemple #17
0
void CALLBACK cmd_bulletdodge(std::string param)
{
	char *param_str = _strdup(param.c_str());

	if (param.empty() || !_strcmpi(param_str, "help"))
		usage();
	else if (!_strcmpi(param_str, "version"))
		version();
	else
		bulletdodge_do(param_str);

}
Exemple #18
0
bool LoadAttributeFileWAV(FILE_INFO *pFileMP3)
{
	CRiffSIF riff;
	wchar_t ext[_MAX_EXT];
	_tsplitpath(GetFullPath(pFileMP3), NULL, NULL, NULL, ext);
    if(_strcmpi(ext, ".wav") == 0){
        if(riff.Load(GetFullPath(pFileMP3),'W','A','V','E') != ERROR_SUCCESS){
            return false;
        }
    }
    else if(_strcmpi(ext, ".avi") == 0){
        if(riff.Load(GetFullPath(pFileMP3),'A','V','I',' ') != ERROR_SUCCESS){
            return false;
        }
	    //ISBJ songname
	    SetTrackNameSI(pFileMP3, riff.GetField('I','S','B','J'));
    }
    else{
        return false;
    }
    //INAM/ISBJ タイトル
    //ISBJ よりも INAM を優先
    SetTrackNameSI(pFileMP3, riff.GetField('I','N','A','M'));
    if(wcslen(GetTrackNameSI(pFileMP3)) == 0){
        SetTrackNameSI(pFileMP3, riff.GetField('I','S','B','J'));
    }
	//IART アーティスト名
	SetArtistNameSI(pFileMP3, riff.GetField('I','A','R','T'));
	//IPRD アルバム名
	SetAlbumNameSI(pFileMP3, riff.GetField('I','P','R','D'));
	//ICMT コメント
	SetCommentSI(pFileMP3, riff.GetField('I','C','M','T'));
	//ICRD 日付
	SetYearSI(pFileMP3, riff.GetField('I','C','R','D'));
	//IGNR ジャンル
	SetGenreSI(pFileMP3, riff.GetField('I','G','N','R'));
	//ICOP 著作権
	SetCopyrightSI(pFileMP3, riff.GetField('I','C','O','P'));
	//IENG エンジニア	
    SetEngineerSI(pFileMP3, riff.GetField('I','E','N','G'));
	//ISRC ソース	
	SetSourceSI(pFileMP3, riff.GetField('I','S','R','C'));
	//ISFT ソフトウェア
	SetSoftwareSI(pFileMP3, riff.GetField('I','S','F','T'));
	//ITRK トラック番号
	SetTrackNumberSI(pFileMP3, riff.GetField('I','T','R','K'));

	extern bool GetValues_mp3infp(FILE_INFO *pFileMP3);
	GetValues_mp3infp(pFileMP3);
    return true;
}
Exemple #19
0
static bool setup_dxgi(IDXGISwapChain *swap)
{
    const char *process_name = get_process_name();
    bool ignore_d3d10 = false;
    IUnknown *device;
    HRESULT hr;

    /* Call of duty ghosts allows the context to be queried as a d3d10
     * context when it's actually a d3d11 context.  Why this is I don't
     * quite know. */
    if (_strcmpi(process_name, "iw6sp64_ship.exe") == 0 ||
            _strcmpi(process_name, "iw6mp64_ship.exe") == 0 ||
            _strcmpi(process_name, "justcause3.exe") == 0) {
        ignore_d3d10 = true;
    }

    if (!ignore_d3d10) {
        hr = swap->GetDevice(__uuidof(ID3D10Device), (void**)&device);
        if (SUCCEEDED(hr)) {
            data.swap = swap;
            data.capture = d3d10_capture;
            data.free = d3d10_free;
            device->Release();
            return true;
        }
    }

    hr = swap->GetDevice(__uuidof(ID3D11Device), (void**)&device);
    if (SUCCEEDED(hr)) {
        data.swap = swap;
        data.capture = d3d11_capture;
        data.free = d3d11_free;
        device->Release();
        return true;
    }

#if COMPILE_D3D12_HOOK
    hr = swap->GetDevice(__uuidof(ID3D12Device), (void**)&device);
    if (SUCCEEDED(hr)) {
        data.swap = swap;
        data.capture = d3d12_capture;
        data.free = d3d12_free;
        device->Release();
        return true;
    }
#endif

    return false;
}
Configuration::Configuration()
{
	vendor = VENDOR_UNKNOWN;

	char buffer[1000];
	int n = GetModuleFileName(0, buffer, 1000);
	char *exename = buffer;
	for (int i = 0; i < n; i++)
	if (buffer[i] == '\\') exename = buffer + i + 1;

	TiXmlDocument doc("gShaderReplacer.xml");
	bool loadOkay = doc.LoadFile();
	if (loadOkay)
	{
		TiXmlElement *root = doc.RootElement();
		int i = 0;
		_dumpAllShaders = (root->QueryIntAttribute("DumpAllShaders", &i) == TIXML_SUCCESS) ? (i ? true : false) : 0;
		_dumpErrorShaders = (root->QueryIntAttribute("DumpErrorShaders", &i) == TIXML_SUCCESS) ? (i ? true : false) : 0;

		TiXmlElement *child = root->FirstChildElement();
		while (child)
		{
			if (child->ValueStr() == "Application")
			{
				bool match = false;
				const char* name = child->Attribute("Name");
				if (name && _strcmpi(exename, name) == 0) match = true;
				for (int j = 0; j < 10; j++)
				{
					const string *s = child->Attribute(string("Name") + char(j + 0x30));
					if (s && _strcmpi(exename, s->c_str()) == 0) match = true;
				}
				if (match)
				{
					TiXmlElement *child2 = child->FirstChildElement();
					while (child2)
					{
						ReadReplacers(child2);
						child2 = child2->NextSiblingElement();
					}
				}
			}
			ReadReplacers(child);
			child = child->NextSiblingElement();
		}
	}
	_buffer = new char[BUFFERSIZE];
	_bufferpos = 0;
}
	T* findOrAllocate(const std::string& name)
	{
		int ret1 = _strcmpi("", name.c_str());
		int ret2 = _strcmpi("none", name.c_str());
		int ret3 = _strcmpi("<none>", name.c_str());

		if (ret1 == 0 || ret2 == 0 || ret3 == 0)
			return nullptr;

		if (auto ptr = find(name))
			return ptr;

		objectList.push_back(std::make_unique<T>(name));
		return objectList.back().get();
	}
Exemple #22
0
LTRESULT CPickupItemPlugin::PreHook_EditStringList(const char* szRezPath,
												   const char* szPropName,
												   char** aszStrings,
												   uint32* pcStrings,
												   const uint32 cMaxStrings,
												   const uint32 cMaxStringLength)
{

	if (_strcmpi("ModelOverride", szPropName) == 0)
	{
		if (m_PropTypeMgrPlugin.PreHook_EditStringList(szRezPath,
			szPropName, aszStrings, pcStrings, cMaxStrings, cMaxStringLength) == LT_OK)
		{
			qsort( aszStrings, *pcStrings, sizeof( char * ), CaseInsensitiveCompare );

			return LT_OK;
		}
	}
	else if( _strcmpi( "WorldAnimation", szPropName ) == 0 )
	{
		for( int i = 0; i < PICKUP_MAX_WORLD_ANIS; ++i )
		{
			strcpy( aszStrings[(*pcStrings)++], c_aWorldAnimations[i] );
		}

		return LT_OK;
	}
	else if( _stricmp( "Team", szPropName ) == 0 )
	{
		char szTeam[32] = {0};

		_ASSERT(cMaxStrings > (*pcStrings) + 1);
		strcpy( aszStrings[(*pcStrings)++], "NoTeam" );
		
		for( int i = 0; i < MAX_TEAMS; ++i )
		{
			_ASSERT(cMaxStrings > (*pcStrings) + 1);

			sprintf( szTeam, "Team%i", i );
			strcpy( aszStrings[(*pcStrings)++], szTeam );
		}

		return LT_OK;
	}


	return LT_UNSUPPORTED;
}
//*=================================================================================
//*原型: bool CheckPacket(TSmartPacket& Packet)
//*功能: 检测是否为合法的用户包
//*参数: 无
//*返回: 无
//*说明: 简单的验证手段
//*=================================================================================
bool TSmartOutThread::CheckPacket(SOCKADDR_IN *psockAddr, TSmartPacket& Packet)
{
	char *pCmd = Packet.GetCmd();

	if( !_strcmpi(pCmd, PACKET_CMD_LOGIN) ) 
		return true;

	long nSID = Packet.GetSID();

	m_ClientLock.Lock();
	for(int i=0; i< m_ClientList.GetCount(); i++)
	{
		TSOUTUser *pUser = (TSOUTUser*)m_ClientList[i];
		if( pUser != NULL )
		{
			if( pUser->nSID == nSID ) 
			{
				char szHost[32];
				strcpy(szHost, inet_ntoa(psockAddr->sin_addr));

				if( !strcmp(szHost, pUser->szHost) )
				{
					m_ClientLock.Unlock();
					return true;
				}
			}
		}
	}
	m_ClientLock.Unlock();

	return false;
}
Exemple #24
0
void SWTypeExt::ExtData::LoadFromRulesFile(SuperWeaponTypeClass *pThis, CCINIClass *pINI)
{
	const char * section = pThis->get_ID();

	if(!pINI->GetSection(section)) {
		return;
	}

	INI_EX exINI(pINI);

	if(exINI.ReadString(section, "Action") && !_strcmpi(exINI.value(), "Custom")) {
		pThis->Action = SW_YES_CURSOR;
	}

	if(exINI.ReadString(section, "Type")) {
		int customType = NewSWType::FindIndex(exINI.value());
		if(customType > -1) {
			pThis->Type = customType;
		}
	}

	// find a NewSWType that handles this original one.
	if(this->IsOriginalType()) {
		this->HandledByNewSWType = NewSWType::FindHandler(pThis->Type);
	}

	// if this is handled by a NewSWType, initialize it.
	if(auto pNewSWType = this->GetNewSWType()) {
		pThis->Action = SW_YES_CURSOR;
		pNewSWType->Initialize(this, pThis);
	}
	this->LastAction = pThis->Action;
}
Exemple #25
0
/*
 * Get build date
 */
QDate mixp_get_build_date(void)
{
	QDate buildDate(2000, 1, 1);

	static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

	int date[3] = {0, 0, 0}; char temp[12] = {'\0'};
	strncpy_s(temp, 12, mixp_buildDate, _TRUNCATE);

	if(strlen(temp) == 11)
	{
		temp[3] = temp[6] = '\0';
		date[2] = atoi(&temp[4]);
		date[0] = atoi(&temp[7]);
			
		for(int j = 0; j < 12; j++)
		{
			if(!_strcmpi(&temp[0], months[j]))
			{
				date[1] = j+1;
				break;
			}
		}

		buildDate = QDate(date[0], date[1], date[2]);
	}

	return buildDate;
}
//*=================================================================================
//*原型: void Dispatch(TSmartPacket& Packet)
//*功能: 分发客户请求
//*参数: 无
//*返回: 无
//*说明: 无
//*=================================================================================
void TSmartOutThread::Dispatch(SOCKET hSocket, SOCKADDR_IN *psockAddr, TSmartPacket& Packet)
{
	long i=0; 
	while(true)
	{
		if( !strcmp(Function[i].pText, "") || 
			!strcmp(Function[i].pCmd, "") || 
			Function[i].lpFunc == NULL )
		{
			break;
		}

		if( !_strcmpi(Function[i].pCmd, Packet.GetCmd()) ) 
		{ 
			try
			{
				Function[i].lpFunc(hSocket, psockAddr, &Packet, m_pServer, this);
			}
			catch(TException& e)
			{
				WriteLog(e.GetText());
			}
			catch(...)
			{
				WriteLog("执行请求处理包时发生异常,请检查程序!");
			}
			break;
		}
		i++;
	}
}
bool scenario_get_source_desc(const utf8 *name, source_desc *outDesc)
{
	assert(outDesc != NULL);

	sint32 currentIndex = 0;
	for (int i = 0; i < countof(ScenarioTitlesBySource); i++) {
		for (int j = 0; j < ScenarioTitlesBySource[i].count; j++) {
			const scenario_title_desc *desc = &ScenarioTitlesBySource[i].titles[j];
			if (_strcmpi(name, desc->title) == 0) {
				outDesc->title = desc->title;
				outDesc->id = desc->id;
				outDesc->source = i;
				outDesc->index = currentIndex;
				outDesc->category = desc->category;
				return true;
			}
			currentIndex++;
		}
	}

	outDesc->title = NULL;
	outDesc->id = SC_UNIDENTIFIED;
	outDesc->source = SCENARIO_SOURCE_OTHER;
	outDesc->index = -1;
	outDesc->category = SCENARIO_CATEGORY_OTHER;
	return false;
}
Exemple #28
0
int countbyCollegenameofTeachers(char *filename, char *clgname, int teachersoffset)
{
	FILE *bfile;
	errno_t e = fopen_s(&bfile, filename, "rb");
	if (e != 0)
	{
		printf("File not found\n");
		return 0;
	}
	fseek(bfile, teachersoffset, SEEK_SET);
	struct NonLeafPage n;
	struct TeacherLeafPage t;
	struct Teacher teacher;
	fread(&n, sizeof(struct NonLeafPage), 1, bfile);
	int count = 0;
	for (int i = 0; i < 64; i++)
	{
		//printf("n=%d\n", n.offsets[i]);
		int offset = n.offsets[i];
		fseek(bfile, offset, SEEK_SET);
		fread(&t, sizeof(struct TeacherLeafPage), 1, bfile);
		for (int j = 0; j < 7; j++)
		{
			teacher = t.data[j];
			//printf("%d\t%s\t%s\t%s\n", teacher.staffid, teacher.name, teacher.dept, teacher.clgname);
			int k = _strcmpi(teacher.clgname, clgname);
			if (k == 0)
			{
				count++;
			}
		}
	}
	return count;
}
Exemple #29
0
LTRESULT CPlayerVehiclePlugin::PreHook_EditStringList(
	const char* szRezPath,
	const char* szPropName,
	char** aszStrings,
    uint32* pcStrings,
    const uint32 cMaxStrings,
    const uint32 cMaxStringLength)
{

	// Handle vehicle type...

	if (_strcmpi("VehicleType", szPropName) == 0)
	{
		for (int i=PPM_FIRST; i < PPM_NUM_MODELS; i++)
		{
			_ASSERT(cMaxStrings > (*pcStrings) + 1);
			if (cMaxStrings > (*pcStrings) + 1)
			{
				strcpy(aszStrings[(*pcStrings)++], GetPropertyNameFromPlayerPhysicsModel((PlayerPhysicsModel)i));
			}
		}

		return LT_OK;
	}

	return LT_UNSUPPORTED;
}
LTRESULT CDestructibleModelPlugin::PreHook_EditStringList(const char* szRezPath,
	const char* szPropName, char** aszStrings, uint32* pcStrings,
	const uint32 cMaxStrings, const uint32 cMaxStringLength)
{
	// DestructibleModel property lists here...

	if( !sm_bInitted )
	{
		// Make sure fx mgr is initialized...
		m_pFXButeMgrPlugin->PreHook_EditStringList(szRezPath, szPropName,
			aszStrings,	pcStrings, cMaxStrings, cMaxStringLength);

		sm_bInitted = LTTRUE;
	}

	if (m_DebrisPlugin.PreHook_EditStringList(szRezPath, szPropName,
		aszStrings, pcStrings, cMaxStrings, cMaxStringLength) == LT_OK)
	{
		return LT_OK;
	}
	else if (_strcmpi("SurfaceOverride", szPropName) == 0)
	{
		m_SurfaceMgrPlugin.PreHook_EditStringList(szRezPath, szPropName,
			aszStrings, pcStrings, cMaxStrings, cMaxStringLength);

		if (m_SurfaceMgrPlugin.PopulateStringList(aszStrings, pcStrings,
			 cMaxStrings, cMaxStringLength))
		{
			return LT_OK;
		}
	}

	return LT_UNSUPPORTED;
}