当前位置: 首页>>代码示例>>C++>>正文


C++ ProxyHelper::HasProfile方法代码示例

本文整理汇总了C++中ProxyHelper::HasProfile方法的典型用法代码示例。如果您正苦于以下问题:C++ ProxyHelper::HasProfile方法的具体用法?C++ ProxyHelper::HasProfile怎么用?C++ ProxyHelper::HasProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProxyHelper的用法示例。


在下文中一共展示了ProxyHelper::HasProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DllMain

// CBT Hook-style injection.
BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved )
{
    if (fdwReason == DLL_PROCESS_ATTACH)  // When initializing....
    {
        hDLL = hModule;

        // We don't need thread notifications for what we're doing.  Thus, get
        // rid of them, thereby eliminating some of the overhead of this DLL
        DisableThreadLibraryCalls(hModule);

        // Only hook the APIs if this is the right process.
        GetModuleFileName(GetModuleHandle(NULL), targetExe, sizeof(targetExe));
        PathStripPath(targetExe);

		GetModuleFileName(GetModuleHandle(NULL), targetPath, sizeof(targetPath));
		targetPathString = std::string(targetPath);
		targetPathString = targetPathString.substr(0, targetPathString.find_last_of("\\/"));

        OutputDebugString("HIJACKDLL checking process: ");
        OutputDebugString(targetExe);
        OutputDebugString("\n");

		ParsePaths();
		ProxyHelper helper = ProxyHelper();

        if (helper.HasProfile(targetExe))
		{
			if (HookAPICalls(&D3DHook))
			{
				OutputDebugString("HookAPICalls(D3D): TRUE\n");
			} 
			else if(HookAPICalls(&KernelHook))
			{	
				OutputDebugString("HookAPICalls(Kernel): TRUE\n");
			} 
			else 
			{
				OutputDebugString("HookAPICalls(Both): FALSE\n");
			}

			SetDllDirectory(dllDir);
			SaveExeName(targetExe);
		}
    }

    return TRUE;
}
开发者ID:Enterfrize,项目名称:Perception,代码行数:48,代码来源:dllmain.cpp

示例2: DllMain

// CBT Hook-style injection.
BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved )
{
	if (fdwReason == DLL_PROCESS_ATTACH)  // When initializing....
	{
		hDLL = hModule;

		// We don't need thread notifications for what we're doing.  Thus, get
		// rid of them, thereby eliminating some of the overhead of this DLL
		DisableThreadLibraryCalls(hModule);

		// Only hook the APIs if this is the right process.
		GetModuleFileName(GetModuleHandle(NULL), targetExe, sizeof(targetExe));
		PathStripPath(targetExe);
		/*if(std::string(targetExe) == "GitHub.exe")
		{
			OutputDebugString("Ignoring process: ");
			OutputDebugString(targetExe);
			OutputDebugString("\n");
			return TRUE;
		}*/
		GetModuleFileName(GetModuleHandle(NULL), targetPath, sizeof(targetPath));
		targetPathString = std::string(targetPath);
		targetPathString = targetPathString.substr(0, targetPathString.find_last_of("\\/") + 1);

		OutputDebugString("HIJACKDLL checking process: ");
		OutputDebugString(targetExe);
		OutputDebugString("\n");


#ifndef x64
		ParsePaths();
#endif
		ProxyHelper helper = ProxyHelper();

		if (helper.HasProfile(targetExe, targetPathString.c_str()))
		{
#ifndef x64
			//Need to check that the d3d9.dll is actually in the game folder - If it is, then we don't need to hook API calls
			//using the methods below as d3d9 will just be loaded by the game's executable
			if (!fileExists(targetPathString + "D3D9.dll"))
			{
				if (HookAPICalls(&D3DHook))
				{
					OutputDebugString("HookAPICalls(D3D): TRUE\n");
				} 
				else if(HookAPICalls(&KernelHook))
				{	
					OutputDebugString("HookAPICalls(Kernel): TRUE\n");
				} 
				else 
				{
					OutputDebugString("HookAPICalls(Both): FALSE\n");
				}

				SetDllDirectory(dllDir);
			}
			else
			{
				OutputDebugString(std::string("D3D9.dll found in game directory (" + targetPathString + ") - Bypassing API injection").c_str());
			}
#endif 
		}
		else
		{
			OutputDebugString((std::string("Game profile not found for: ") + targetExe).c_str());
		}
	}

	return TRUE;
}
开发者ID:Innovative-Ideas,项目名称:Perception,代码行数:71,代码来源:dllmain.cpp


注:本文中的ProxyHelper::HasProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。