User talk:JoraFreedman
Jump to navigation
Jump to search
variable value display wrong
In function SSQ_GetInfoReply variable value display wrong (max_players, num_of_bots, num_players). As it to correct?
- include <iostream>
- include "windows.h"
- include "SSQ.h"
using namespace std;
int main() {
char namelib[20]="SSQ.dll";
char host[30]="78.137.1.182:27017";
//killserver78.46.73.19:27014
//I receive a library descriptor
HINSTANCE hModule=NULL;
hModule=LoadLibrary(namelib);
if (hModule!=NULL)
{
cout<<"- The descriptor of "<<namelib<<" is received\n";
}
else
{
cout<<"- The descriptor of "<<namelib<<" is not received\n";
cin.get();
return 0;
}
// I receive the address of function SSQ_Initialize() and I cause it.
BOOL WINAPI (*SSQ_Initialize) (BOOL ) ;
(FARPROC &)SSQ_Initialize = GetProcAddress(hModule,"SSQ_Initialize");
if (SSQ_Initialize(false))
cout<<"- Function SSQ_Initialize() has returned true\n";
else
{
cout<<"- Function SSQ_Initialize() has returned false\n";
FreeLibrary(hModule);
cin.get();
return 0;
}
// I receive the address of function SSQ_SetGameServer() and I cause it.
BOOL WINAPI (*SSQ_SetGameServer) (char* ) ;
(FARPROC &)SSQ_SetGameServer = GetProcAddress(hModule,"SSQ_SetGameServer");
if(SSQ_SetGameServer(host))
cout<<"= Function SSQ_SetGameServer() has returned true\n";
else
{
cout<<"- Function SSQ_SetGameServer() has returned false\n";
FreeLibrary(hModule);
cin.get();
return 0;
}
// I receive the address of function SSQ_GetInfoReply() and I cause it.
PSSQ_INFO_REPLY ptr_inforeply; BOOL WINAPI (*SSQ_GetInfoReply) (PSSQ_INFO_REPLY) ;
(FARPROC &)SSQ_GetInfoReply = GetProcAddress(hModule,"SSQ_GetInfoReply");
if (SSQ_GetInfoReply(ptr_inforeply))
{
cout<<"app_id: "<<ptr_inforeply->app_id<<"\n";
cout<<"description: "<<ptr_inforeply->game_description<<"\n";
cout<<"directory: "<<ptr_inforeply->game_directory<<"\n";
cout<<"hostname: "<<ptr_inforeply->hostname<<"\n";
cout<<"map: "<<ptr_inforeply->map<<"\n";
cout<<"max players: "<<ptr_inforeply->max_players<<"\n";//Wrong display
cout<<"num of bots: "<<ptr_inforeply->num_of_bots<<"\n";//Wrong display
cout<<"num players: "<<ptr_inforeply->num_players<<"\n";//Wrong display
cout<<"os: "<<ptr_inforeply->os<<"\n";
cout<<"password: "<<ptr_inforeply->password<<"\n";
cout<<"secure: "<<ptr_inforeply->secure<<"\n";//Wrong display
cout<<"version: "<<ptr_inforeply->game_version<<"\n";
}
FreeLibrary(hModule); cin.get(); return 0;
}
//JoraFreedman mnemonicoid@ukr.net