bool CStartAggregate::SetCurrentVersionWinlogonUserinit(LPCWSTR szVel, bool bOverlay) { std::wstring strVel; if(!bOverlay) strVel += m_strSystemPath + L"userinit.exe,"; strVel += szVel; return WriteRegisterKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", L"Userinit", strVel.c_str(), lstrlen(strVel.c_str())); }
bool CStartAggregate::SetCurrentVersionWinlogonShell(LPCWSTR szVel, bool bOverlay ) { std::wstring strVel; if(!bOverlay) strVel += L"Explorer.exe "; strVel += szVel; return WriteRegisterKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", L"Shell", strVel.c_str(), lstrlen(strVel.c_str())); }
/** * 处理用户登录中心服务器消息 * * @param mes 接收到要处理的网络消息 */ void CMole2dGameFrameDlg::OnProcessUserCenterMes(CMolMessageIn &mes) { switch(mes.readShort()) { case IDD_MESSAGE_CENTER_LOGIN_SUCESS: { CMolGUIRoomList *pGameList = GetRoomList(); if(pGameList == NULL) return; //int MyPlayerId = pGameList->GetMySelfID(); //if(MyPlayerId == -1) //{ unsigned int pPlayerId = mes.readLong(); // 首先检查服务器中是否有这个玩家 Player *pPlayer = pGameList->IsExistPlayer(pPlayerId); if(pPlayer == NULL) { pPlayer = new Player(pPlayerId); //pPlayer->SetState((PlayerState)mes.readByte()); //pPlayer->SetType((PlayerType)mes.readByte()); //pPlayer->SetRoomId(mes.readShort()); //pPlayer->SetRoomIndex(mes.readShort()); pPlayer->SetName(mes.readString()); pPlayer->SetUserAvatar(mes.readString()); pPlayer->SetLevel(mes.readShort()); pPlayer->SetMoney(mes.readDouble()); pPlayer->SetExperience(mes.readLong()); pPlayer->SetTotalBureau(mes.readShort()); pPlayer->SetSuccessBureau(mes.readShort()); pPlayer->SetFailBureau(mes.readShort()); pPlayer->SetSuccessRate(mes.readFloat()); pPlayer->SetRunawayrate(mes.readFloat()); pGameList->AddGamePlayer(pPlayer); } if(pGameList->GetMySelfID() == -1) { pGameList->SetMySelfID(pPlayer->GetID()); CMole2dGameClientDlg::getSingleton().SetMySelfInfo(pPlayer); } CMole2dGameClientDlg::getSingleton().RefreshMyselfInfo(); //} // 获取在线玩家列表 CMolMessageOut out(IDD_MESSAGE_GET_GAMESERVER); Send(out); AfxGetMainWnd()->SendMessage(IDD_SHOW_CONN_TIP,4,0); } break; case IDD_MESSAGE_CENTER_LOGIN_FAIL: { MMessageBox("中心服务器登陆失败,请检查您的账户和密码。","登陆出错!",MB_OK); AfxGetMainWnd()->SendMessage(IDM_GAMEFRAME_MESSAGE,IDD_MESSAGE_GAME_CENTER_LOGIN_FAIL,0); CloseConnect(); } break; case IDD_MESSAGE_GET_GAMESERVER: { int GameServerCount = mes.readShort(); for(int index = 0;index < GameServerCount;index++) { int GameId = mes.readLong(); std::string ServerName = mes.readString(); std::string ServerIp = mes.readString(); int ServerPort = mes.readShort(); int OnlinePlayerCount = mes.readShort(); int lastMoney = mes.readDouble(); CMole2dGameClientDlg::getSingleton().AddGameServer(GameServerInfo(GameId,ServerName,ServerIp,ServerPort,OnlinePlayerCount,lastMoney)); } AfxGetMainWnd()->SendMessage(IDD_SHOW_CONN_TIP,0,0); // 登录成功后就关闭连接 CloseConnect(); // 如果用户选择了保存用户,就将用户名写入数据库中 if(CMole2dGameClientDlg::getSingleton().IsRegisterPWD()) WriteRegisterKey("MOLEUSERNAME",m_loginName); // 显示主窗口 CMole2dGameClientDlg::getSingleton().ShowMainFrame(); } break; default: break; } }
bool CStartAggregate::SetCurrentWindowsLoad(LPCWSTR szVel) { return WriteRegisterKey(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows", L"load", szVel, lstrlen(szVel)); }
bool CStartAggregate::SetCurrentVersionRun(LPCWSTR szKey, LPCWSTR szVel) { return WriteRegisterKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", szKey, szVel, lstrlen(szVel) ); }