예제 #1
0
파일: shreg.c 프로젝트: Kelimion/wine
static void test_SHGetValue(void)
{
	DWORD dwSize;
	DWORD dwType;
        DWORD dwRet;
	char buf[MAX_PATH];

	strcpy(buf, sEmptyBuffer);
	dwSize = MAX_PATH;
	dwType = -1;
        dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &dwType, buf, &dwSize);
	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
        ok( 0 == strcmp(sExpTestpath1, buf) ||
            broken(0 == strcmp(sTestpath1, buf)), /* IE4.x */
            "Comparing of (%s) with (%s) failed\n", buf, sExpTestpath1);
        ok( REG_SZ == dwType ||
            broken(REG_EXPAND_SZ == dwType), /* IE4.x */
            "Expected REG_SZ, got (%u)\n", dwType);

	strcpy(buf, sEmptyBuffer);
	dwSize = MAX_PATH;
	dwType = -1;
        dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &dwType, buf, &dwSize);
	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
	ok( 0 == strcmp(sTestpath1, buf) , "Comparing of (%s) with (%s) failed\n", buf, sTestpath1);
	ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
}
예제 #2
0
void BE_Cross_PrepareGameInstallations(void)
{
	/*** Some misc. preparation ***/
#ifdef REFKEEN_PLATFORM_UNIX
#if (defined REFKEEN_VER_KDREAMS_CGA_ALL)
	const char *homedir = getenv("HOME");
	char path[BE_CROSS_PATH_LEN_BOUND];
	char *pathEnd = path + sizeof(path);
#endif
#endif

#ifdef REFKEEN_PLATFORM_WINDOWS
#if (defined REFKEEN_VER_CAT3D) || (defined REFKEEN_VER_CATABYSS) || (defined REFKEEN_VER_CATARM) || (defined REFKEEN_VER_CATAPOC)
	char path[BE_CROSS_PATH_LEN_BOUND];
	char gog_catacombs_path[BE_CROSS_PATH_LEN_BOUND];
	DWORD dwType = 0;
	DWORD dwSize = sizeof(gog_catacombs_path);
	LSTATUS status = SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\GOG.COM\\GOGCATACOMBSPACK", "PATH", &dwType, gog_catacombs_path, &dwSize);
	bool isGogCatacombsPathFound = ((status == ERROR_SUCCESS) && (dwType == REG_SZ));
	char *gog_catacombs_path_end;
	if (isGogCatacombsPathFound)
	{
		path_gog_catacombs_prefix_end = path/*NOT gog_catacombs_path*/ + strlen(gog_catacombs_path);
	}
#endif
#endif

	/*** Now handling each version separately ***/

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamsc105, ".", "Keen Dreams CGA v1.05 (Local)");
#ifdef REFKEEN_PLATFORM_UNIX
	if (homedir)
	{
		BE_Cross_safeandfastcstringcopy_2strs(path, pathEnd, homedir, "/.steam/steam/SteamApps/common/Keen Dreams/cga");
		BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamsc105, path, "Keen Dreams CGA v1.05 (Steam)");
	}
#endif
#endif

#ifdef REFKEEN_VER_KDREAMS_ANYEGA_ALL
    //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse113, ".", "Keen Dreams EGA v1.13 (Local)");
    //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse193, ".", "Keen Dreams EGA v1.93 (Local)");
    //BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_kdreamse120, ".", "Keen Dreams EGA v1.20 (Local)");
#endif

#ifdef REFKEEN_VER_CAT3D
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d100, ".", "Catacomb 3-D v1.00 (Local)");
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d122, ".", "Catacomb 3-D v1.22 (Local)");
#ifdef REFKEEN_PLATFORM_WINDOWS
	if (isGogCatacombsPathFound)
	{
		memcpy(path, gog_catacombs_path, sizeof(path));
		BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Cat3D");
		BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_cat3d122, path, "Catacomb 3-D v1.22 (GOG.com)");
	}
#endif
#endif

#ifdef REFKEEN_VER_CATABYSS
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss113, ".", "Catacomb Abyss v1.13 (Local)");
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss124, ".", "Catacomb Abyss v1.24 (Local)");
#ifdef REFKEEN_PLATFORM_WINDOWS
	if (isGogCatacombsPathFound)
	{
		memcpy(path, gog_catacombs_path, sizeof(path));
		BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Abyss");
		BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catabyss124, path, "Catacomb Abyss v1.24 (GOG.com)");
	}
#endif
#endif

#ifdef REFKEEN_VER_CATARM
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catarm102, ".", "Catacomb Armageddon v1.02 (Local)");
#ifdef REFKEEN_PLATFORM_WINDOWS
	if (isGogCatacombsPathFound)
	{
		memcpy(path, gog_catacombs_path, sizeof(path));
		BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Armageddon");
		BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catarm102, path, "Catacomb Armageddon v1.02 (GOG.com)");
	}
#endif
#endif

#ifdef REFKEEN_VER_CATAPOC
	BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catapoc101, ".", "Catacomb Apocalypse v1.01 (Local)");
#ifdef REFKEEN_PLATFORM_WINDOWS
	if (isGogCatacombsPathFound)
	{
		memcpy(path, gog_catacombs_path, sizeof(path));
		BE_Cross_safeandfastcstringcopy(path_gog_catacombs_prefix_end, ptrEnd, "\\Apocalypse");
		BEL_Cross_ConditionallyAddGameInstallation(&g_be_gamever_catapoc101, path, "Catacomb Apocalypse v1.01 (GOG.com)");
	}
#endif
#endif
}
예제 #3
0
파일: tConfig.cpp 프로젝트: gitrider/wxsj2
BOOL CtConfigApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControls()。否则,将无法创建窗口。
	InitCommonControls();

	CWinApp::InitInstance();

	AfxEnableControlContainer();
    
	//首先检测DirectX版本号
	const wchar_t *szDxNeed = L"4.09.00.0904";
	std::string strDxNeed;

    // 获取dx版本
    const wchar_t* szCurrentDXVersion = gHardwareInfoSystem.getDXVersion();
	if(szCurrentDXVersion[0]==0 || wcscmp(szDxNeed, szCurrentDXVersion) > 0)
	{
		CDirectXErrorDlg dlg;
		dlg.DoModal();
        mExitCode = 0xC0DE;
        return FALSE;
	}

	const char* szCmdLine = GetCommandLineA();

	//从游戏运行
	if(strstr(szCmdLine, "-fg") != 0) g_bRunFromGame = TRUE;

    // 获取其他硬件信息
    gHardwareInfoSystem.initSystem();

    // 判断当前显存是否足够
    const float RequiredVideoMemory = 32.0f;
    const float currentFreeVideoMemory = gHardwareInfoSystem.getHardwareInfo().mFreeLocalVideoMemory;
    if ( currentFreeVideoMemory < RequiredVideoMemory )
    {
		wchar_t errorInfoStr[MAX_PATH]={0};

        _snwprintf(errorInfoStr, MAX_PATH, 
			getInnerString(INNER_LOW_VIDEO_MEMORY),
            currentFreeVideoMemory, RequiredVideoMemory );

        if ( IDNO == TD_MessageBoxW( NULL, errorInfoStr, getInnerString(INNER_TITLE), MB_YESNO|MB_ICONQUESTION ) )
        {
            mExitCode = 0xC0DE;
            return FALSE;
        }        
    }

    // 检测显卡驱动版本号
    //const std::string& validateInfoString = gHardwareInfoSystem.validateVideoDriver();

    //if (false == validateInfoString.empty())
    //{
    //    MessageBox(NULL, validateInfoString.c_str(), "《天龙八部》配置程序", MB_OK | MB_ICONERROR);
    //}

	//第一次运行
	DWORD dwType, dwSize=sizeof(DWORD), dwValue=0;
	SHGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SOHU\\FireFox\\TLBB", "RunConfig", 
		&dwType, &dwValue, &dwSize);

	g_bFirstRun = (dwValue != 1);

	//写运行标志
	dwValue = 1;
	SHSetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SOHU\\FireFox\\TLBB", 
		"RunConfig", REG_DWORD, &dwValue, sizeof(DWORD));

	//从游戏运行而且也不是第一次运行,退出
	if(g_bRunFromGame && !g_bFirstRun) return FALSE;

	//填充推荐配置
	FillCommendCfg();

	//如果是第一次运行, 删除个人配置文件
	if(g_bFirstRun)
	{
		g_theGameConfigs.DeletePrivateFile();
	}

	//加载所有配置文件
	g_theGameConfigs.LoadAllConfigFile();
	if(!g_theGameConfigs.GetLastestConfig())
	{
		TD_MessageBoxW(NULL, getInnerString(INNER_CANT_OPEN), getInnerString(INNER_TITLE), MB_OK|MB_ICONSTOP);
		return FALSE;
	}

	CtConfigDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用“确定”来关闭
		//对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用“取消”来关闭
		//对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	// 而不是启动应用程序的消息泵。
	return FALSE;

}