Example #1
0
//保存配置
void CInitParamter::SaveInitParamter(bool bSaveAll)
{
	//打开注册表
	CRegKey RegParamter;
	TCHAR szRegName[MAX_PATH];
	_snprintf(szRegName,sizeof(szRegName),TEXT("Software\\%s\\CenterServer"),szSystemRegKey);
	if (RegParamter.Create(HKEY_CURRENT_USER,szRegName)!=ERROR_SUCCESS) return;

	//变量定义
	TCHAR szWriteBuffer[1024]=TEXT("");

	//信息数据库
	RegParamter.SetDWORDValue(TEXT("ServerDataBasePort"),m_wServerDataBasePort);
	CXOREncrypt::EncryptData(m_szServerDataBaseAddr,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerDataBaseAddr"));
	CXOREncrypt::EncryptData(m_szServerDataBaseUser,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerDataBaseUser"));
	CXOREncrypt::EncryptData(m_szServerDataBasePass,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerDataBasePass"));

	if (bSaveAll==true)
	{
		//网络配置
		RegParamter.SetDWORDValue(TEXT("MaxConnect"),m_wMaxConnect);
		RegParamter.SetDWORDValue(TEXT("ListenPort"),m_wListenPort);

		//信息数据库
		CXOREncrypt::EncryptData(m_szServerDataBaseName,szWriteBuffer,sizeof(szWriteBuffer));
		RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerDataBaseName"));
	}

	return;
}
bool CIISxpressRegSettings::Save(void)
{
	bool bStatus = false;

	try
	{
		CComCritSecLock<CComAutoCriticalSection> lock(m_csConfig);

		CRegKey Config;
		if (Config.Open(HKEY_LOCAL_MACHINE, m_sRegPath, KEY_WRITE | m_dwOpenFlags) != ERROR_SUCCESS)
		{
			if (Config.Create(HKEY_LOCAL_MACHINE, m_sRegPath) != ERROR_SUCCESS)
			{
				bStatus = false;
				throw bStatus;
			}
		}

		Config.SetDWORDValue(IISXPRESS_REGKEY_ENABLED, m_dwEnabled);		
		Config.SetDWORDValue(IISXPRESS_REGKEY_LOGGINGLEVEL, m_dwLoggingLevel);	

		// don't write the debug value
		//Config.SetDWORDValue(IISXPRESS_REGKEY_DEBUGENABLED, m_dwDebugEnabled);

		m_bDirty = false;
		bStatus = true;
	}
	catch (...)
	{
	}	

	return bStatus;
}
Example #3
0
//保存配置
void CInitParamter::SaveInitParamter(bool bSaveAll)
{
	//打开注册表
	CRegKey RegParamter;
	TCHAR szRegName[MAX_PATH];
	_snprintf(szRegName,sizeof(szRegName),TEXT("Software\\%s\\GameServer"),szSystemRegKey);
	if (RegParamter.Create(HKEY_CURRENT_USER,szRegName)!=ERROR_SUCCESS) return;

	//变量定义
	TCHAR szWriteBuffer[1024]=TEXT("");

	//CenterServer
	CXOREncrypt::EncryptData(m_szCenterServerAddr,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("CenterServerAddr"));

	//授权号码
	CXOREncrypt::EncryptData(m_szAccreditID,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("AccreditID"));

	//登录数据库
	RegParamter.SetDWORDValue(TEXT("GameUserDBPort"),m_wGameUserDBPort);
	CXOREncrypt::EncryptData(m_szGameUserDBAddr,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("GameUserDBAddr"));
	CXOREncrypt::EncryptData(m_szGameUserDBUser,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("GameUserDBUser"));
	CXOREncrypt::EncryptData(m_szGameUserDBPass,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("GameUserDBPass"));

	//房间数据库
	RegParamter.SetDWORDValue(TEXT("ServerInfoDBPort"),m_wServerInfoDBPort);
	CXOREncrypt::EncryptData(m_szServerInfoDBAddr,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerInfoDBAddr"));
	CXOREncrypt::EncryptData(m_szServerInfoDBUser,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerInfoDBUser"));
	CXOREncrypt::EncryptData(m_szServerInfoDBPass,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerInfoDBPass"));

	CXOREncrypt::EncryptData(m_szLoaderServerPass,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("LoaderPasswd"));

	RegParamter.SetDWORDValue(TEXT("ServerID"),m_wServerID);
	//游戏端口
	RegParamter.SetDWORDValue(TEXT("GameNetPort"),m_wGameNetPort);

	//游戏地址
	CXOREncrypt::EncryptData(m_szGameNetAddr,szWriteBuffer,sizeof(szWriteBuffer));
	RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("GameNetAddr"));


	if (bSaveAll==true)
	{
		//登录数据库
		CXOREncrypt::EncryptData(m_szServerInfoDBName,szWriteBuffer,sizeof(szWriteBuffer));
		RegParamter.SetKeyValue(TEXT(""),szWriteBuffer,TEXT("ServerInfoDBName"));
	}

	return;
}
Example #4
0
void CMyAddin::SaveToolbarSettings() {
	CRegKey regKey;
	if (regKey.Create(HKEY_CURRENT_USER, APP_REG_KEY)!=0)
		return;

	regKey.SetDWORDValue("Top", m_pToolBar->Top);	
	regKey.SetDWORDValue("Left", m_pToolBar->Left);
	regKey.SetDWORDValue("Visible", (DWORD)m_pToolBar->Visible);
	regKey.SetDWORDValue("Position", (int)m_pToolBar->Position);
	regKey.SetDWORDValue("RowIndex", m_pToolBar->RowIndex);
	regKey.Close();
}
Example #5
0
HRESULT CDolphinVMModule::RegisterAsEventSource() const
{
	static TCHAR* szKeyStem = _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
	HRESULT hr;

	TCHAR szKey[512];
	_tcscpy(szKey, szKeyStem);
	_tcscat(szKey, _T("Dolphin"));

	CRegKey rkeyEvSrc;
	// Register as an event source with message table in this DLL
	LONG ret = rkeyEvSrc.Create(HKEY_LOCAL_MACHINE, szKey);
	if (ret == ERROR_SUCCESS)
	{
		TCHAR szModule[_MAX_PATH];
		::GetModuleFileName(_AtlBaseModule.GetModuleInstance(), szModule, _MAX_PATH);
		rkeyEvSrc.SetStringValue(_T("EventMessageFile"), szModule);
		rkeyEvSrc.SetDWORDValue(_T("TypesSupported"), 7);
		hr = S_OK;
	}
	else
		hr = AtlHresultFromWin32(ret);

	return hr;
}
Example #6
0
/////////////////////////////////////////////////////////////////////////////
// Set the IE registry settings that control caching
// Never check for new content unless it doesn't exist in the cache
void CSmartCache::SetSyncMode()
{
	CRegKey regkey;
	if (regkey.Open(HKEY_CURRENT_USER, REGKEY_IE) != ERROR_SUCCESS)
		return;	

	DWORD dwOldSyncMode = SYNCMODE_AUTO;
	DWORD dwOldSyncMode5 = SYNCMODE_AUTO;

	DWORD dwLength = sizeof(DWORD);
	regkey.QueryBinaryValue(REGVAL_SYNCMODE, &dwOldSyncMode, &dwLength);
	regkey.QueryDWORDValue(REGVAL_SYNCMODE5, dwOldSyncMode5);

	if (dwOldSyncMode == SYNCMODE_NEVER && dwOldSyncMode5 == SYNCMODE_NEVER)
		return;

	DWORD dwNever = SYNCMODE_NEVER;
	dwLength = sizeof(DWORD);
	regkey.SetBinaryValue(REGVAL_SYNCMODE, &dwNever, dwLength);
	regkey.SetDWORDValue(REGVAL_SYNCMODE5, dwNever);

	if (m_dwOldSyncMode == -1)
		m_dwOldSyncMode = (dwOldSyncMode != SYNCMODE_NEVER ? dwOldSyncMode : SYNCMODE_AUTO);

	if (m_dwOldSyncMode5 == -1)
		m_dwOldSyncMode5 = (dwOldSyncMode5 != SYNCMODE_NEVER ? dwOldSyncMode5 : SYNCMODE_AUTO);
}
Example #7
0
void SaveFilterSettings(const std::vector<Filter>& filters, CRegKey& reg)
{
	int i = 0;
	for (auto it = filters.begin(); it != filters.end(); ++it, ++i)
	{
		CRegKey regFilter;
		regFilter.Create(reg, WStr(wstringbuilder() << L"Filter" << i));
		regFilter.SetStringValue(L"", WStr(it->text.c_str()));
		regFilter.SetDWORDValue(L"MatchType", MatchTypeToInt(it->matchType));
		regFilter.SetDWORDValue(L"FilterType", FilterTypeToInt(it->filterType));
		regFilter.SetDWORDValue(L"Type", FilterTypeToInt(it->filterType));
		regFilter.SetDWORDValue(L"BgColor", it->bgColor);
		regFilter.SetDWORDValue(L"FgColor", it->fgColor);
		regFilter.SetDWORDValue(L"Enable", it->enable);
	}
}
Example #8
0
void CRemoteSrvPort::vSetRTSPPort2Reg()
{
	CString csPort;
	GetDlgItemText(IDC_EDIT_RTSPSRV_PORT, csPort);

	CRegKey regKey;
	TCHAR szRegValue[1024];
	::ZeroMemory(&szRegValue[0], sizeof(szRegValue));
	const DWORD len = 1024;
	DWORD nActualLen(len);
    CString csForder(CProductDefine::m_tzRegistSubFolder);

	LONG nRet = regKey.Open(HKEY_LOCAL_MACHINE, csForder.GetBuffer());
	if(nRet != ERROR_SUCCESS)
	{
		if( regKey.Create(HKEY_LOCAL_MACHINE, csForder.GetBuffer()) != 0)
		{
			TRACE(_T("Create Registry Fail."));
		}
	}

	DWORD dwRTSPProt = _tcstoul(csPort, 0, 10);
	nRet = regKey.SetDWORDValue(_T("RTSPServerPort"), dwRTSPProt);
	//nRet = regKey.SetValue( csPort.GetBuffer(), _T("REMOTESRVPORT") );
	if(nRet != ERROR_SUCCESS)
	{
		TRACE(_T("Registry SetValue Fail!\r\n"));
	}
	regKey.Close();

	m_nRTSPPort = (int)dwRTSPProt;
	//::AfxBeginThread(iRestartRemoteSrv, NULL);
}
Example #9
0
extern "C" HANDLE __stdcall RegisterAsEventSource(const char* szSource)
{
	const char* szSrc = szSource;
	static const char* szEventLogKeyBase = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
	
	char szEventLogKey[256+1];
	szEventLogKey[256] = 0;
	strcpy(szEventLogKey, szEventLogKeyBase);
	strncat_s(szEventLogKey, szSource, 256-strlen(szEventLogKeyBase));

	CRegKey rkeyRegistered;
	if (rkeyRegistered.Open(HKEY_LOCAL_MACHINE, szEventLogKey, KEY_READ) != ERROR_SUCCESS)
	{
		if (rkeyRegistered.Create(HKEY_LOCAL_MACHINE, szEventLogKey, REG_NONE, REG_OPTION_NON_VOLATILE,
									(KEY_READ|KEY_WRITE)) == ERROR_SUCCESS)
		{
			char vmFileName[MAX_PATH+1];
			::GetModuleFileName(_AtlBaseModule.GetModuleInstance(), vmFileName, sizeof(vmFileName) - 1);
			rkeyRegistered.SetStringValue("EventMessageFile", vmFileName);
			rkeyRegistered.SetDWORDValue("TypesSupported", (EVENTLOG_SUCCESS|EVENTLOG_ERROR_TYPE|
												EVENTLOG_WARNING_TYPE|EVENTLOG_INFORMATION_TYPE));
		}
		else
			szSrc = "Dolphin";
	}


	return RegisterEventSource(NULL, szSrc);
}
Example #10
0
void CDataCeneter::SetDDNSInfo(BYTE bOperation, LPVOID VarData)
{
	struDDNS *pDDNSData = (struDDNS*)VarData;

	ULONG ulChars = 0;
	CRegKey regKey;
	if( regKey.Open(HKEY_LOCAL_MACHINE, GetRegFolder()) == ERROR_SUCCESS)
	{
		regKey.SetDWORDValue(_T("EnableDDNS"), pDDNSData->bEnableDDNS);
		regKey.SetDWORDValue(_T("Provider"), pDDNSData->Provider);
		regKey.SetStringValue(_T("ProviderURL"), pDDNSData->szProviderURL, REG_SZ);
		regKey.SetStringValue(_T("DDNSUser"), pDDNSData->szUser,REG_SZ);
		regKey.SetStringValue(_T("DDNSPass"), pDDNSData->szPass,REG_SZ);
		regKey.SetDWORDValue(_T("IntervalTime"), pDDNSData->nIntervalTime);
	}
	regKey.Close();
}
Example #11
0
// === IMpcAudioRendererFilter
STDMETHODIMP CMpcAudioRenderer::Apply()
{
#ifdef REGISTER_FILTER
    CRegKey key;
    if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPC Audio Renderer"))) {
        key.SetDWORDValue(_T("UseWasapi"), m_useWASAPIAfterRestart);
        key.SetDWORDValue(_T("MuteFastForward"), m_bMuteFastForward);
        key.SetStringValue(_T("SoundDevice"), m_csSound_Device);
    }
#else
    AfxGetApp()->WriteProfileInt(_T("Filters\\MPC Audio Renderer"), _T("UseWasapi"), m_useWASAPI);
    AfxGetApp()->WriteProfileInt(_T("Filters\\MPC Audio Renderer"), _T("MuteFastForward"), m_bMuteFastForward);
    AfxGetApp()->WriteProfileString(_T("Filters\\MPC Audio Renderer"), _T("SoundDevice"), m_csSound_Device);
#endif

    return S_OK;
}
Example #12
0
LRESULT CPreviewWindow::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
  CRegKey key;
  
  key.Create(HKEY_CURRENT_USER, lpcstrTG2RegKey);
  key.SetDWORDValue(_T("TextureTiled"), m_tile.GetCheck());
  key.SetDWORDValue(_T("TextureZoom"), m_zoom.GetSelection());
	key.SetDWORDValue(_T("TextureAlpha"), m_alpha.GetSelection());
  key.Close();
  
  CMessageLoop* pLoop = _Module.GetMessageLoop();
  pLoop->RemoveMessageFilter(this);

  m_bgBrush.DeleteObject();
  
  bHandled = FALSE;
  return 0;
}
bool CRegProfile::WriteProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue, BOOL bGlobal)
{
	CRegKey key;
	key.Create(bGlobal?HKEY_LOCAL_MACHINE:HKEY_CURRENT_USER,m_sPath+lpszSection);
	LONG r = key.SetDWORDValue(lpszEntry,nValue);
	key.Close();
	return (r==ERROR_SUCCESS)? true:false;
	
}
Example #14
0
//登录成功处理
bool CDlgLogon::OnLogonSuccess()
{
	//登录配置
	BOOL bRemPassword=(((CButton *)GetDlgItem(IDC_REM_PASSWORD))->GetCheck()==BST_CHECKED);
	AfxGetApp()->WriteProfileInt(REG_OPTION_LOGON,TEXT("LogonMode"),m_LogonMode);
	AfxGetApp()->WriteProfileString(REG_OPTION_LOGON,TEXT("LogonServer"),m_strLogonServer);

	//配置信息
	if (bRemPassword==FALSE)
	{
		if (g_GlobalOption.m_enAcountsRule==enAcountsRule_AccountsAndPass)
		{
			g_GlobalOption.m_enAcountsRule=enAcountsRule_Accounts;
		}
	}
	else g_GlobalOption.m_enAcountsRule=enAcountsRule_AccountsAndPass;

	//用户信息
	tagGlobalUserData & UserData=g_GlobalUnits.GetGolbalUserData();
	AfxGetApp()->WriteProfileInt(REG_OPTION_LOGON,TEXT("LastUserID"),UserData.dwUserID);

	//写入用户记录
	if (g_GlobalOption.m_enAcountsRule!=enAcountsRule_None)
	{
		//构造信息
		TCHAR szBuffer[256];
		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%s\\%ld"),REG_USER_INFO,UserData.dwUserID);

		//写入信息
		CRegKey RegUserInfo;
		if (RegUserInfo.Create(HKEY_CURRENT_USER,szBuffer)==ERROR_SUCCESS)
		{
			TCHAR szPassBuffer[256]=TEXT("");
			if (bRemPassword) CXOREncrypt::EncryptData(m_szPassword,szPassBuffer,CountArray(szPassBuffer));
			RegUserInfo.SetKeyValue(TEXT(""),UserData.szAccounts,TEXT("UserAccount"));
			RegUserInfo.SetKeyValue(TEXT(""),UserData.szPassWord,TEXT("UserPassToken"));
			RegUserInfo.SetKeyValue(TEXT(""),szPassBuffer,TEXT("UserPassword"));
			if (UserData.dwGameID!=0L) RegUserInfo.SetDWORDValue(TEXT("GameID"),UserData.dwGameID);
		}
	}
	else
	{
		//构造信息
		TCHAR szBuffer[256];
		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),UserData.dwUserID);

		//写入信息
		CRegKey RegUserID;
		if (RegUserID.Open(HKEY_CURRENT_USER,REG_USER_INFO)==ERROR_SUCCESS)	RegUserID.RecurseDeleteKey(szBuffer);
	}

	//关闭窗口
	DestroyWindow();

	return true;
}
Example #15
0
// 设置IE属性
BOOL SetInternetAttribute()
{
    CRegKey setval;

    //允许提交非加密表单数据
    if(setval.Open(HKEY_CURRENT_USER,TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3"),KEY_ALL_ACCESS) == ERROR_SUCCESS)//
    {
        setval.SetDWORDValue(TEXT("1601"),0);
        setval.Close();
    }

    if(setval.Open(HKEY_LOCAL_MACHINE,TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3"),KEY_ALL_ACCESS) == ERROR_SUCCESS)//
    {
        setval.SetDWORDValue(TEXT("1601"),0);
        setval.Close();
    }

    return TRUE;
}
HRESULT StoreRegistrationCookie(long cookie) {
  CRegKey key;
  LONG res = key.Create(HKEY_CURRENT_USER, CONSOLE_CONFIG_KEY);
  if (res != ERROR_SUCCESS)
    return AtlHresultFromWin32(res);

  res = key.SetDWORDValue(COOKIE_VALUE, cookie);
  ATLASSERT(res == ERROR_SUCCESS);
  return AtlHresultFromWin32(res);
}
Example #17
0
//
// I need to tell Trident that we are on IE10.
// TODO: right now our web pages only support IE10. It wouldn't be terribly hard to support IE9, and with some degrigation
// on the user experience (no sliding effect) we can also support IE8, and even below.
//
HRESULT CMainModule::setIeEmulation()
{
	LONG result;
	CRegKey key;

	result = key.Open( HKEY_CURRENT_USER, regpathFeatureControl, KEY_ALL_ACCESS );
	if( result == ERROR_SUCCESS ) {
	    result = key.SetDWORDValue( regvalEmulation, 10000 );
	}

	return HRESULT_FROM_WIN32( result );
}
Example #18
0
void AppSettings::Store()
{
   // open root key
   CRegKey regRoot;
   if (ERROR_SUCCESS != regRoot.Open(HKEY_CURRENT_USER, m_pszSettingsRegkey))
   {
      // try to create key
      if (ERROR_SUCCESS != regRoot.Create(HKEY_CURRENT_USER, m_pszSettingsRegkey))
         return;
   }

   regRoot.SetStringValue(g_pszProjectsFolder, m_cszProjectsFolder);
   regRoot.SetDWORDValue(g_pszCurrentDateSubfolder, m_bCurrentDateSubfolder ? 1 : 0);
   regRoot.SetDWORDValue(g_pszImageTypeSubfolder, m_bImageTypeSubfolder ? 1 : 0);
   regRoot.SetStringValue(g_pszPhotomatixPath, m_cszPhotomatixPath);
   regRoot.SetStringValue(g_pszHuginPath, m_cszHuginPath);
   regRoot.SetDWORDValue(g_pszLogging, m_bLogging ? 1 : 0);
   regRoot.SetStringValue(g_pszLogfilePath, m_cszLogfilePath);

   m_windowPlacementMainFrame.Store(regRoot, g_pszWindowPlacementMainFrame);
}
Example #19
0
BOOL RunAsFastMode(CString strExeName,DWORD dwMode)
{
	BOOL bRes = FALSE;
	CRegKey setval;
	if(setval.Open(HKEY_LOCAL_MACHINE,TEXT("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl"),KEY_ALL_ACCESS) == ERROR_SUCCESS)//
	{
		if(setval.Create(setval,TEXT("FEATURE_BROWSER_EMULATION")) == ERROR_SUCCESS)
		{
			bRes = setval.SetDWORDValue(strExeName,dwMode);
		}
		setval.Close();
	}
	return bRes == ERROR_SUCCESS;
}
Example #20
0
BOOL SetBrowserFeature(HKEY hkey,LPCTSTR pszFeatureName,LPCTSTR pszBrowserName,DWORD dwValue,LPCTSTR pszBrowserName2 = NULL,LPCTSTR pszBrowserName3 = NULL)
{
    CRegKey setval;

    if(setval.Open(hkey,TEXT("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl"),KEY_ALL_ACCESS) == ERROR_SUCCESS)
    {
        setval.Close();
    }
    else
    {
        if(setval.Open(hkey,TEXT("Software\\Microsoft\\Internet Explorer\\Main"),KEY_ALL_ACCESS) == ERROR_SUCCESS)
        {
            setval.Create(setval,TEXT("FeatureControl"));
        }
    }
    setval.Close();

    if(setval.Open(hkey,TEXT("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl"),KEY_ALL_ACCESS) == ERROR_SUCCESS)//
    {
        if(setval.Create(setval,pszFeatureName) == ERROR_SUCCESS)
        {
            setval.SetDWORDValue(pszBrowserName,dwValue);
            if(pszBrowserName2!=NULL)
            {
                setval.SetDWORDValue(pszBrowserName2,dwValue);
            }
            if(pszBrowserName3!=NULL)
            {
                setval.SetDWORDValue(pszBrowserName3,dwValue);
            }
        }
        setval.Close();
    }

    return TRUE;
}
Example #21
0
bool CCpDialog::CheckForNewContent(CString& strContentRootFolder, CString& strAppRootFolder, bool bForceCreate)
{
	if (strContentRootFolder.IsEmpty())
		return false;

	CString strLinelistPage = strAppRootFolder + String(IDS_LINELIST_PAGE);
	bool bLinelistExists = FileExists(strLinelistPage);

	// Check the registry for the last saved file count, if the linelist file exists
	DWORD dwOldFileCount = 0;
	CRegKey regkey;
	if (regkey.Open(HKEY_CURRENT_USER, REGKEY_APP) == ERROR_SUCCESS)
	{
		if (bLinelistExists && !bForceCreate)
			regkey.QueryDWORDValue(REGVAL_FILECOUNT, dwOldFileCount);
	}

	CXmlFileSystem xml;
	xml.SetFileSpec("*.*");
	CString strLinelistFolder = strContentRootFolder + String(IDS_LINELIST_FOLDER);
	DWORD dwFileCount = xml.FileSystemCount(strLinelistFolder);
	if (dwFileCount == dwOldFileCount)
		return false;

	if (!xml.CreateXml(strLinelistFolder))
		return false;

	if (bLinelistExists)
	{
		DWORD dwFileAttributes = ::GetFileAttributes(strLinelistPage);
		if (dwFileAttributes && FILE_ATTRIBUTE_READONLY)
			::SetFileAttributes(strLinelistPage, dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
	}

	if (!xml.Save(strLinelistPage))
		return false;

	// Write the file count out to the registry so we can detect changes in the future
	if (regkey.m_hKey != NULL)
		regkey.SetDWORDValue(REGVAL_FILECOUNT, dwFileCount);

	#ifdef _DEBUG
	if (dwOldFileCount)
		MessageBox("New content has been installed on your machine.  It has been imported automatically.", String(GetTitleId()), MB_OK);
	#endif _DEBUG

	return true;
}
Example #22
0
 PluginMng::~PluginMng(){
   for (int i=0;i<(int)plugins_.size();i++){
     uuplugin* uup = plugins_.at(i);
     CRegKey crk;
     long rk=crk.Open(HKEY_LOCAL_MACHINE, _6bees_const::kplugindisabled, KEY_READ|KEY_WRITE);
     if (rk==ERROR_SUCCESS){
       ATL::CString menuid;
       menuid.Format(_T("%d"),uup->menuwID_);
       if(uup->enabled_){
         crk.DeleteValue(menuid);
       }else{
         crk.SetDWORDValue(menuid,1);
       }
     }
   }
 }
Example #23
0
void CSmartCache::SetRestoreSmartCacheSetting(bool bSave, bool& bUseSmartCache)
{
	CRegKey regkey;
	if (regkey.Create(REGKEY_APPROOT, REGKEY_APP) != ERROR_SUCCESS)
		return;

	DWORD dwValue = bUseSmartCache;
	if (bSave)
	{
		if (regkey.SetDWORDValue(REGVAL_SMARTCACHE, dwValue) == ERROR_SUCCESS)
			return;
	}
	else
	{
		if (regkey.QueryDWORDValue(REGVAL_SMARTCACHE, dwValue) == ERROR_SUCCESS)
			bUseSmartCache = (bool)(dwValue != 0);
	}

	m_bUseSmartCache = bUseSmartCache;
}
Example #24
0
void CSmartCache::RestoreSyncMode()
{
	if (m_dwOldSyncMode == -1 && m_dwOldSyncMode5 == -1)
		return;

	CRegKey regkey;
	if (regkey.Open(HKEY_CURRENT_USER, REGKEY_IE) != ERROR_SUCCESS)
		return;

	if (m_dwOldSyncMode != -1)
	{
		DWORD dwLength = sizeof(DWORD);
		regkey.SetBinaryValue(REGVAL_SYNCMODE, &m_dwOldSyncMode, dwLength);
	}

	if (m_dwOldSyncMode5 != -1)
		regkey.SetDWORDValue(REGVAL_SYNCMODE5, m_dwOldSyncMode5);

	m_dwOldSyncMode = -1;
	m_dwOldSyncMode5 = -1;
}
Example #25
0
// This will add the history of data used
LRESULT CToolBarCombo::AddtoHistory(const _bstr_t& bstrURL){
  CRegKey keyAppID;
  if(std::basic_string<TCHAR>(bstrURL).find_first_not_of(_T(" "))!=std::string::npos)  {
    int h = GetCount();
    int pos = FindStringExact(-1,bstrURL);
    if(pos == CB_ERR){
      if(h<50){
        InsertString(0,bstrURL);
      }else{
        DeleteString(h-1);
        InsertString(0,bstrURL);
      }
    }else{
      DeleteString(pos);
      InsertString(0,bstrURL);
    }

    {
      CRegKey keyAppID;
      keyAppID.Attach(Get6BeeAppRegistryKey());
      keyAppID.RecurseDeleteKey(_T("History"));
    }

    {
      CRegKey keyAppID;
      keyAppID.Create(Get6BeeAppRegistryKey(),_T("History"));

      for(int i=0;i < GetCount();i++)
      {
        TCHAR cValue[1024]={};
        GetLBText(i, cValue);
        keyAppID.SetDWORDValue(cValue,1);
      }
    }

    SetCurSel(0);
  }

  return 0;
}
Example #26
0
void CDataCeneter::SetEventType(BYTE bOperation, LPVOID VarData)
{
	vector<strucEventSeverity> *pArray = (vector<strucEventSeverity>*)VarData;

	CRegKey regKey;
	LONG lResult = ERROR_SUCCESS;
	CString str;

	lResult = regKey.Open(HKEY_LOCAL_MACHINE, GetEventRegFolder());
	if( lResult != ERROR_SUCCESS)
		lResult = regKey.Create(HKEY_LOCAL_MACHINE, GetEventRegFolder());

	if (lResult == ERROR_SUCCESS)
	{
		int nIdx = 0, nCount = (int)pArray->size();
		for (nIdx=0 ; nIdx<nCount ; nIdx++)
		{
			str.Format(_T("%d"),(*pArray)[nIdx].event_type);
			regKey.SetDWORDValue(str, (*pArray)[nIdx].event_level);
		}
	}
	regKey.Close();
}
Example #27
0
void HandleFilterCommand(int argc, TCHAR* argv[])
{
	CRegKey FilterRegKey;
	LONG nStatus = FilterRegKey.Open(HKEY_LOCAL_MACHINE, IISXPRESSFILTER_REGKEY, KEY_READ | KEY_WRITE);
	if (nStatus != ERROR_SUCCESS)
	{		
		throw ProcessingException(MAKE_HRESULT(1, FACILITY_WIN32, nStatus), IDS_ERROR_REGISTRYPERMISSIONS);
	}

	if (argc == 2)
	{
		DWORD dwEnabled = 0;
		nStatus = FilterRegKey.QueryDWORDValue(IISXPRESS_REGKEY_ENABLED, dwEnabled);
		if (nStatus != ERROR_SUCCESS)
		{			
			throw ProcessingException(MAKE_HRESULT(1, FACILITY_WIN32, nStatus), IDS_ERROR_MISSINGIISXPRESSREGISTRY);
		}

		CString sMsg;
		if (dwEnabled != 0)
		{
			VERIFY(sMsg.LoadString(IDS_FILTERENABLED));
		}
		else
		{
			VERIFY(sMsg.LoadString(IDS_FILTERDISABLED));
		}
		
		tcout << (LPCTSTR) sMsg << _T("\n");
	}
	else if (argc == 3 && _tcsicmp(_T("enable"), argv[2]) == 0)
	{
		nStatus = FilterRegKey.SetDWORDValue(IISXPRESS_REGKEY_ENABLED, 1);
		if (nStatus != ERROR_SUCCESS)
		{
			throw ProcessingException(MAKE_HRESULT(1, FACILITY_WIN32, nStatus), IDS_ERROR_UNABLETOSETFILTERENABLESTATUS);
		}

		CString sMsg;		
		VERIFY(sMsg.LoadString(IDS_FILTERENABLED));				
		tcout << (LPCTSTR) sMsg << _T("\n");
	}
	else if (argc == 3 && _tcsicmp(_T("disable"), argv[2]) == 0)
	{
		nStatus = FilterRegKey.SetDWORDValue(IISXPRESS_REGKEY_ENABLED, 0);
		if (nStatus != ERROR_SUCCESS)
		{
			throw ProcessingException(MAKE_HRESULT(1, FACILITY_WIN32, nStatus), IDS_ERROR_UNABLETOSETFILTERENABLESTATUS);
		}		

		CString sMsg;	
		VERIFY(sMsg.LoadString(IDS_FILTERDISABLED));
		tcout << (LPCTSTR) sMsg << _T("\n");
	}
	else
	{
		CString sMsg;
		sMsg.Format(IDS_ERROR_BADPARAMETER, argv[2]);
		throw sMsg;
	}	
}
Example #28
0
void CIEMonitor::ApplyChanges( void )
{
	BOOL bNeedReg = FALSE;
	if(m_bFirstRun)
	{
		bNeedReg = CheckForUpdate(thePrefs.GetMuleDirectory(EMULE_MODULEDIR) + _T("IE2EM.dll"));
	}
	if(bNeedReg || !IsRegistered())
		RegisterAll();
	if(m_bFirstRun || m_bIEMenu != thePrefs.GetAddToIEMenu() || m_bMonitor != thePrefs.GetMonitorLinks() || m_bEd2k != thePrefs.GetMonitorEd2k() || m_wLangID != thePrefs.GetLanguageID())
	{
		m_bIEMenu = thePrefs.GetAddToIEMenu();
		m_bMonitor = thePrefs.GetMonitorLinks();
		m_bEd2k = thePrefs.GetMonitorEd2k();
		m_wLangID = thePrefs.GetLanguageID();
		CRegKey regkey;
		CRegKey subkey;
		if( regkey.Create(HKEY_CURRENT_USER, _T("Software\\easyMule")) == ERROR_SUCCESS)
		{
			TCHAR szPath[512];
			DWORD count = 512;
			if(regkey.QueryStringValue(_T("InstallPath"), szPath, &count) != ERROR_SUCCESS)
			{
				_tcscpy(szPath, thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR));
				INT len = _tcslen(szPath);
				if(len > 3 && szPath[len - 1] == '\\')
					szPath[len - 1] = 0;
				regkey.SetStringValue(_T("InstallPath"), szPath);
			}
			regkey.Close();
		}

		CString strPath = thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR) + _T("IE2EM.htm");
		if( regkey.Create(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\MenuExt")) == ERROR_SUCCESS)
		{
			TCHAR szName[1024];
			DWORD dwLen = 1024;
			BOOL bFound = FALSE;
			for(INT i = 0; regkey.EnumKey(i, szName, &dwLen) != ERROR_NO_MORE_ITEMS; i ++)
			{
				subkey.Open(regkey, szName);
				TCHAR szValue[1024];
				ULONG uLen = 1024;
				subkey.QueryStringValue(NULL, szValue, &uLen);
				if(strPath == szValue)
				{
					bFound = TRUE;
					break;
				}
				subkey.Close();
				dwLen = 1024;
			}
			if(bFound)
			{
				subkey.Close();
				regkey.RecurseDeleteKey(szName);
			}
			if(m_bIEMenu)
			{
				subkey.Create(regkey, GetResString(IDS_IEMENUEXT));
				subkey.SetStringValue(NULL, strPath);
				subkey.SetDWORDValue(_T("Contexts"), 0x22);
				subkey.Close();
			}
			regkey.Close();
		}
		if( regkey.Create(HKEY_CURRENT_USER, _T("Software\\easyMule")) == ERROR_SUCCESS)
		{	
			if(m_bMonitor)
				regkey.SetDWORDValue(_T("Monitor"), 1);
			else
				regkey.SetDWORDValue(_T("Monitor"), 0);
			regkey.Close();
		}
	}
	m_bFirstRun = false;
}
Example #29
0
void	InstallRegKey()
{
	if (::GetAsyncKeyState(VK_CONTROL) < 0)
		return;

	{// [-HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags]
		CRegKey rk;
		rk.Open(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell"));
		rk.RecurseDeleteKey(_T("Bags"));
	}

	{
		CRegKey rk;
		rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"));
		rk.SetDWORDValue(_T("FullRowSelect"), 0);
	}

	{
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetStringValue(_T("KnownFolderDerivedFolderType"), _T("{57807898-8C4F-4462-BB63-71042380B109}"));
		rk.SetStringValue(_T("SniffedFolderType"), _T("Generic"));
	}

	{// ;Generic - Folder Template
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell\\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetDWORDValue(_T("Rev")				, 0);
		rk.SetDWORDValue(_T("FFlags")			, 0x43000001);
		rk.SetStringValue(_T("Vid"), _T("{137E7700-3573-11CF-AE69-08002B2E1262}"));
		rk.SetDWORDValue(_T("Mode")				, 4);
		rk.SetDWORDValue(_T("LogicalViewMode")	, 1);
		rk.SetDWORDValue(_T("IconSize")			, 0x10);
		BYTE ColInfo[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfd,0xdf,0xdf,0xfd,0x10,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,
			0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,
			0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,
			0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x04,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,
			0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0c,0x00,0x00,0x00,0x50,0x00,0x00,0x00
		};
		//rk.SetBinaryValue(_T("ColInfo"), ColInfo, sizeof(ColInfo));
		BYTE Sort[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0xf1,
			0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("Sort"), Sort, sizeof(Sort));
		rk.SetDWORDValue(_T("GroupView")		, 0);
		rk.SetStringValue(_T("GroupByKey:FMTID"), _T("{00000000-0000-0000-0000-000000000000}"));
		rk.SetDWORDValue(_T("GroupByKey:PID")	, 0);
		rk.SetDWORDValue(_T("GroupByDirection")	, 1);
	}

	{// ;Documents - Folder Template
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell\\{7d49d726-3c21-4f05-99aa-fdc2c9474656}"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetDWORDValue(_T("Rev")				, 0);
		rk.SetDWORDValue(_T("FFlags")			, 0x43000001);
		rk.SetStringValue(_T("Vid"), _T("{137E7700-3573-11CF-AE69-08002B2E1262}"));
		rk.SetDWORDValue(_T("Mode")				, 4);
		rk.SetDWORDValue(_T("LogicalViewMode")	, 1);
		rk.SetDWORDValue(_T("IconSize")			, 0x10);
		BYTE ColInfo[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfd,0xdf,0xdf,0xfd,0x10,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,
			0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,
			0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,
			0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x04,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,
			0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0c,0x00,0x00,0x00,0x50,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("ColInfo"), ColInfo, sizeof(ColInfo));
		BYTE Sort[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0xf1,
			0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("Sort"), Sort, sizeof(Sort));
		rk.SetDWORDValue(_T("GroupView")		, 0);
		rk.SetStringValue(_T("GroupByKey:FMTID"), _T("{00000000-0000-0000-0000-000000000000}"));
		rk.SetDWORDValue(_T("GroupByKey:PID")	, 0);
		rk.SetDWORDValue(_T("GroupByDirection")	, 1);
	}

	{// ;Music - Folder Template
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell\\{94d6ddcc-4a68-4175-a374-bd584a510b78}"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetDWORDValue(_T("Rev")				, 0);
		rk.SetDWORDValue(_T("FFlags")			, 0x43000001);
		rk.SetStringValue(_T("Vid"), _T("{137E7700-3573-11CF-AE69-08002B2E1262}"));
		rk.SetDWORDValue(_T("Mode")				, 4);
		rk.SetDWORDValue(_T("LogicalViewMode")	, 1);
		rk.SetDWORDValue(_T("IconSize")			, 0x10);
		BYTE ColInfo[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfd,0xdf,0xdf,0xfd,0x10,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,
			0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,
			0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,
			0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x04,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,
			0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0c,0x00,0x00,0x00,0x50,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("ColInfo"), ColInfo, sizeof(ColInfo));
		BYTE Sort[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0xf1,
			0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("Sort"), Sort, sizeof(Sort));
		rk.SetDWORDValue(_T("GroupView")		, 0);
		rk.SetStringValue(_T("GroupByKey:FMTID"), _T("{00000000-0000-0000-0000-000000000000}"));
		rk.SetDWORDValue(_T("GroupByKey:PID")	, 0);
		rk.SetDWORDValue(_T("GroupByDirection")	, 1);
	}

	{// ;Pictures - Folder Template
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell\\{b3690e58-e961-423b-b687-386ebfd83239}"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetDWORDValue(_T("Rev")				, 0);
		rk.SetDWORDValue(_T("FFlags")			, 0x43000001);
		rk.SetStringValue(_T("Vid"), _T("{137E7700-3573-11CF-AE69-08002B2E1262}"));
		rk.SetDWORDValue(_T("Mode")				, 4);
		rk.SetDWORDValue(_T("LogicalViewMode")	, 1);
		rk.SetDWORDValue(_T("IconSize")			, 0x10);
		BYTE ColInfo[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfd,0xdf,0xdf,0xfd,0x10,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,
			0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,
			0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,
			0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x04,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,
			0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0c,0x00,0x00,0x00,0x50,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("ColInfo"), ColInfo, sizeof(ColInfo));
		BYTE Sort[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0xf1,
			0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("Sort"), Sort, sizeof(Sort));
		rk.SetDWORDValue(_T("GroupView")		, 0);
		rk.SetStringValue(_T("GroupByKey:FMTID"), _T("{00000000-0000-0000-0000-000000000000}"));
		rk.SetDWORDValue(_T("GroupByKey:PID")	, 0);
		rk.SetDWORDValue(_T("GroupByDirection")	, 1);
	}

	{// ;Videos - Folder Template
		CRegKey rk;
		rk.Create(HKEY_CURRENT_USER, _T("Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\AllFolders\\Shell\\{5fa96407-7e77-483c-ac93-691d05850de8}"), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
		rk.SetDWORDValue(_T("Rev")				, 0);
		rk.SetDWORDValue(_T("FFlags")			, 0x43000001);
		rk.SetStringValue(_T("Vid"), _T("{137E7700-3573-11CF-AE69-08002B2E1262}"));
		rk.SetDWORDValue(_T("Mode")				, 4);
		rk.SetDWORDValue(_T("LogicalViewMode")	, 1);
		rk.SetDWORDValue(_T("IconSize")			, 0x10);
		BYTE ColInfo[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfd,0xdf,0xdf,0xfd,0x10,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,
			0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,
			0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,
			0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x04,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0xf1,0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,
			0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0c,0x00,0x00,0x00,0x50,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("ColInfo"), ColInfo, sizeof(ColInfo));
		BYTE Sort[] = { 
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0xf1,
			0x25,0xb7,0xef,0x47,0x1a,0x10,0xa5,0xf1,0x02,0x60,0x8c,0x9e,0xeb,0xac,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00
		};
		rk.SetBinaryValue(_T("Sort"), Sort, sizeof(Sort));
		rk.SetDWORDValue(_T("GroupView")		, 0);
		rk.SetStringValue(_T("GroupByKey:FMTID"), _T("{00000000-0000-0000-0000-000000000000}"));
		rk.SetDWORDValue(_T("GroupByKey:PID")	, 0);
		rk.SetDWORDValue(_T("GroupByDirection")	, 1);
	}
}
Example #30
0
BOOL SendCardInfo(HWND hIBAWnd, LPCTSTR lpszNetid, LPCTSTR lpszIDNumber, LPCTSTR lpszName)
{
	// 有刷卡信息,发送信息给收银台

	GXX_LOG_HIT("send card information: name:%s, idnumber:%s, netid:%s", lpszName, lpszIDNumber, lpszNetid);


	int		nIdType = 12;         // 二代证
	CString strPassword = "******";  // 密码
//
//#ifdef DEBUG
//	strNetId = "420114198607072210";
//	strIdNumber = "420114198607072210";
//	strName = "小郭";
//#endif

	CRegKey reg;

	if(0 == reg.Create(HKEY_CURRENT_USER, "SoftWare\\Sunlike\\IBA\\RealName\\GLW\\OpenUser"))/*Base\\NewUser"))*/
	{
		reg.SetStringValue("IDNo", lpszNetid);
		reg.SetStringValue("CertificateID", lpszIDNumber);
		reg.SetDWORDValue("CertificateType", nIdType);
		reg.SetStringValue("Name", lpszName);
		reg.SetStringValue("Password", strPassword);

		/*time_t tm = time(NULL);
		CString strTm;
		strTm.Format("%ld", tm);
		reg.SetStringValue(_T("tValue1"), strTm);
		CString strOrgCode;
		strOrgCode += lpszNetid;
		strOrgCode.AppendFormat("%d", tm);
		INT nLen = strOrgCode.GetLength();
		BYTE *pBuff = new BYTE[nLen+8];
		memcpy(pBuff,strOrgCode.GetString(), nLen);
		BYTE byCheck[8] = {0x03,0xF1,0x00,0x0A,0x0B,0xED,0x02,0xC1};
		memcpy(pBuff+nLen, byCheck, 8);
		char pCode[33] = {0};
		G2XUtility::CG2XMD5::CalculateMD5(pBuff, nLen+8, pCode);
		reg.SetStringValue("tValue2", pCode);
		delete []pBuff;*/

		reg.Close();
	}
	else
	{
		GXX_LOG_HIT("写入失败!");
	}

	if( hIBAWnd )
	{
		::SendMessage(hIBAWnd, WM_REALNAME, 999, 0);
		//::SendMessage(hIBAWnd, WM_REALNAME, 0, 100);
	}
	else
	{
		MessageBox(NULL, "嘟嘟牛收银台没有启动!", "提示", MB_OK);
		GXX_LOG_HIT("嘟嘟牛收银台没有启动!");
		return FALSE;
	}

	return TRUE;
}