COD::COD() { /* Check for CoD 1.5 patch if(memcmp((void*)0x5A60D0, "1.5", 3) == 0) }*/ for(int i = 0; i < MAX_ENTITY_SIZE; i++) { this->entities[i].index = i; this->entities[i].base = g_entities + GENTITY_SIZE * i; this->entities[i].ptr = g_entities + GENTITY_SIZE * i; } version(); Cmd_AddCommand("codextended", version); Cmd_AddCommand("codversion", version); Cmd_AddCommand("help", version); Cmd_AddCommand("cracked", setCracked); InitScript(); initializeClient(); cracking_hook_call(0x465629, (int)Sys_LoadDll); if(GetModuleHandle("game_mp_x86.dll") != NULL) DLLInit(); }
int main(int argc, char** argv) { initializeClient(argc, argv); sleep(200); return 0; }
static int32 initializeHandshake(sslConn_t *clnConn, sslConn_t *svrConn, testCipherSpec_t cipherSuite, sslSessionId_t *sid) { int32 rc; rc = initializeServer(svrConn, cipherSuite); rc = initializeClient(clnConn, cipherSuite, sid); return rc; }
int main(int argc, char **argv){ GtkWidget *box; GtkWidget *scroll; sz=MAXCONTACT; int i; conlist=(Contact*)malloc(MAXCONTACT*sizeof(Contact)); //Load contact file if(argc==2) readListFile(argv[1],conlist,&sz); else readListFile("cons.cn",conlist,&sz); closeListFile(); //initializing components gtk_init(&argc,&argv); initializeClient(NULL); wind=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(wind),"Aeos Client"); phnum=gtk_entry_new(); phNumCombo=gtk_combo_box_text_new(); for(i=0;i<sz;i++){ gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(phNumCombo),i,strcat(&conlist[i].name,&conlist[i].num)); //gtk_combo_box_insert_text(GTK_COMBO_BOX(phNumCombo),1,"World"); } gtk_combo_box_set_active(GTK_COMBO_BOX(phNumCombo),0); text=gtk_text_view_new(); textBuffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD); scroll=gtk_scrolled_window_new(NULL,NULL); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll),text); //gtk_text_view_set_ //gtk_text_set_editable(GTK_TEXT(text),1); sendButton=gtk_button_new_with_mnemonic("_Send"); //adding event listeners g_signal_connect(wind,"destroy",G_CALLBACK(destroyWindow),NULL); g_signal_connect(sendButton,"clicked",G_CALLBACK(sendText),NULL); //adding to container and making visible box=gtk_vbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box),phNumCombo,TRUE,TRUE,0); gtk_widget_show(phnum); gtk_box_pack_start(GTK_BOX(box),scroll,TRUE,TRUE,0); gtk_widget_show(scroll); gtk_box_pack_start(GTK_BOX(box),sendButton,TRUE,TRUE,0); gtk_widget_show(sendButton); gtk_widget_show(box); gtk_container_add(GTK_CONTAINER(wind),box); gtk_widget_show_all(wind); //main gtk_main(); return 0; }
void ServerData::listenForNewConnection() { SOCKET * newConnection = new SOCKET; // we create a new socket dynamically *newConnection = accept(communicator->sListen, (SOCKADDR*)&communicator->addr, &communicator->addrLength); // newest connection is stored inside ClientsArray.push_back(initializeClient(newConnection)); // our pointer is now stored inside our vector of all active clients if (newConnection == 0) std::cout << "Failed to accept connection" << std::endl; // connecting was not successful else if (ClientsArray.size() > ConnectionLimit) refuseToConnect(); // IN CASE SOMEONE WOULD LIKE TO JOIN, BUT THERE IS ALREADY MAXIMUM AMOUNT OF PLAYERS else { std::cout << "Client Connected! Nickname: " << ClientsArray.back()->getNickname() << " ID: " << ClientsArray.back()->getId() << std::endl; std::string welcomeMessage = "Welcome on SebaCraft Server!"; for (int i = 0; i < ClientsArray.size(); i++) { if (ClientsArray[i]->getSocket() == ClientsArray.back()->getSocket()) { communicator->sendMessage(ClientsArray.back()->getSocket(), welcomeMessage); // a warm welcome message from the server. It ll be editable in the future // NOW WE NEED TO SEND INFORMATION ABOUT PLAYERS WHICH ARE ALREADY IN THE GAME for (int j = 0; j < ClientsArray.size(); j++) { if (ClientsArray[j]->getSocket() != ClientsArray.back()->getSocket()) { std::string message = std::to_string(ClientsArray[j]->getShipType()) + ClientsArray[j]->getNickname() + "\t" + std::to_string(ClientsArray[j]->getId()); communicator->sendNewPlayerJoinedAlert(ClientsArray.back()->getSocket(), message);// we are sending information to new player about every player already in the game ClientsArray.back()->getClientsArray().push_back(ClientsArray[j]); // we are filling up private array of clients of every client } } } else { std::string message = std::to_string(ClientsArray.back()->getShipType()) + ClientsArray.back()->getNickname() + "\t" + std::to_string(ClientsArray.back()->getId()); communicator->sendNewPlayerJoinedAlert(ClientsArray[i]->getSocket(), message); // we are sending information about new player to every one on the server ClientsArray[i]->getClientsArray().push_back(ClientsArray.back()); } } std::cout << "Uruchamiam watki dla gracza " << ClientsArray.back()->getNickname() << std::endl; std::thread getDataThread(&GetDataFromClient, std::ref(*ClientsArray.back())); getDataThread.detach(); std::thread sendDataThread(&SendDataToClient, std::ref(*ClientsArray.back())); sendDataThread.detach(); } }
InjectedBundle::InjectedBundle(const String& path) : m_path(path) , m_platformBundle(0) { initializeClient(0); }
Poco::Net::Context::Ptr ofSSLManager::getDefaultClientContext() { initializeClient(); // make sure it's initialized with something return Poco::Net::SSLManager::instance().defaultClientContext(); }
int main(int argc, char **argv) { const char *name; int sock = -1; char fin[512], fout[512]; char cmd[512], reply[512]; int params = -1; say ("\n%s (%s): started\n", TITLE, VERSION); if( argc == 1){ say ("No service name passed, using default: %s\n", NAME); sock = initializeClient(NAME); } else{ name = argv[1]; say ("Connecting to: %s\n", name); sock = initializeClient(name); } usage(); int i = 0; while(i<2){ say(">>"); cmd[0] = '\n'; fin[0] = '\n'; fout[0] = '\n'; params = -1; fgets(cmd, 511, stdin); // This is for quick testing with a couple of commands // if(i==0) // strcpy(cmd, "get asd asdsf\n"); // else if(i==1) // strcpy(cmd, "put a.txt ss.txt\n"); // i++; if (strncmp(cmd, "get", 3) == 0){ params = sscanf(cmd,"get %s %s", fin, fout); if(params !=2 ){ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); continue; } if( strcmp(fin, fout) == 0){ warn("Since both applications write to the same folder (local case) the names should be different.\n"); continue; } getFile(sock, s_ad, s_hid, fin, fout); } else if (strncmp(cmd, "put", 3) == 0){ params = sscanf(cmd,"put %s %s", fin, fout); if(params !=2 ){ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); continue; } if(strcmp(fin, fout) == 0){ warn("Since both applications write to the same folder (local case) the names should be different.\n"); continue; } if(!file_exists(fin)){ warn("Source file: %s doesn't exist\n", fin); continue; } putFile(sock, my_ad, my_hid, fin, fout); } else{ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); } } return 1; }
int main(int argc, char **argv) { const char *name; int sock = -1; char fin[512], fout[512]; char cmd[512], reply[512]; int params = -1; say ("\n%s (%s): started\n", TITLE, VERSION); if( argc == 1){ say ("No service name passed, using default: %s\nYou can also pass --quick to execute a couple of default commands for quick testing. Requires s.txt to exist. \n", NAME); sock = initializeClient(NAME); usage(); } else if (argc == 2){ if( strcmp(argv[1], "--quick") == 0){ quick = true; name=NAME; } else{ name = argv[1]; usage(); } say ("Connecting to: %s\n", name); sock = initializeClient(name); } else if (argc == 3){ if( strcmp(argv[1], "--quick") == 0 ){ quick = true; name = argv[2]; say ("Connecting to: %s\n", name); sock = initializeClient(name); usage(); } else{ die(-1, "xftp [--quick] [SID]"); } } else{ die(-1, "xftp [--quick] [SID]"); } int i = 0; // This is for quick testing with a couple of commands while(i < NUM_PROMPTS){ say(">>"); cmd[0] = '\n'; fin[0] = '\n'; fout[0] = '\n'; params = -1; if(quick){ if( i==0 ) strcpy(cmd, "put s.txt r.txt"); else if( i==1 ) strcpy(cmd, "get r.txt sr.txt\n"); i++; }else{ fgets(cmd, 511, stdin); } // enable this if you want to limit how many times this is done // i++; if (strncmp(cmd, "get", 3) == 0){ params = sscanf(cmd,"get %s %s", fin, fout); if(params !=2 ){ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); continue; } if( strcmp(fin, fout) == 0){ warn("Since both applications write to the same folder (local case) the names should be different.\n"); continue; } getFile(sock, s_ad, s_hid, fin, fout); } else if (strncmp(cmd, "put", 3) == 0){ params = sscanf(cmd,"put %s %s", fin, fout); if(params !=2 ){ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); continue; } if(strcmp(fin, fout) == 0){ warn("Since both applications write to the same folder (local case) the names should be different.\n"); continue; } if(!file_exists(fin)){ warn("Source file: %s doesn't exist\n", fin); continue; } putFile(sock, my_ad, my_hid, fin, fout); } else{ sprintf(reply, "FAIL: invalid command (%s)\n", cmd); warn(reply); usage(); } } return 1; }