what is wrong with this code? :'(
switch(packetid){
case 0x00:
//Keep alive
packetbuf.sendpacket(s, 0x0);
break;
case 0x06:
//Mpq name & hash command
strcpy(mpqname, buffer + 12);
strcpy(hashcmd, buffer + 25);
if(!CheckRevision("star\\starcraft.exe", "star\\storm.dll", "star\\battle.snp", hashcmd, &version, &checksum, exeinfo, mpqname)){
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, RED, "CheckRevision() failed!\n");
Disconnect();
return;
}
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, WHITE, "Checking versions...\n");
packetbuf.insert((int)0);
packetbuf.insert("68XI", 4); //platform
packetbuf.insert("PXES", 4); //product
packetbuf.insert((int)0xc7); //version byte
packetbuf.insert(version);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert("USA"); //country abbreviation
packetbuf.insert("United States"); //country name
packetbuf.insert((int)0);
break;
case 0x50:
packetbuf.insert((int)0);
packetbuf.insert("68XI", 4); //platform
packetbuf.insert("PXES", 4); //product
packetbuf.insert((int)0xc7); //version byte
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert("USA"); //country abbreviation
packetbuf.insert("United States"); //country name
break;
case 0x51:
//Version check result
if(buffer[4] != 0x51){
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, RED, "Version check failed!\n");
Disconnect();
return;
}
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, GREEN, "Passed version check!\n");
//client token
//server token
packetbuf.insert(checksum);
//product
//cdkey value 1
packetbuf.insert((int)0);//unknown (0)
packetbuf.insert((int)0);
packetbuf.insert((int)0);//exe info
packetbuf.insert("Sb",2); //cdkey owner name
packetbuf.insert("tenb", 4);
packetbuf.sendpacket(s, 0x14);
packetbuf.sendpacket(s, 0x2d);
packetbuf.insert((int)0x1b);
packetbuf.insert((int)0);
packetbuf.insert("bnserver.ini");
packetbuf.sendpacket(s, 0x33);
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, WHITE, "Checking CDKey...\n");
//this is where cdkey packet would be ^^
break;
hmm i kinda get what ur sayin but can u put it into code :-\
you're constructing the packets, but not sending them
i dunno how i would get data and then send to 0x51 :(
if(waitresult == WAIT_OBJECT_0){
int buflen = 0;
int recvlen = recv(s, buffer + buflen, sizeof(buffer) - buflen, 0);
if(!recvlen || recvlen == SOCKET_ERROR){
Disconnect();
return;
}
buflen += recvlen;
send(s, "\x1", 1, 0);
packetbuf.insert((int)0);
packetbuf.insert("68XI", 4); //platform
packetbuf.insert("PXES", 4); //product
packetbuf.insert((int)0xc7); //version byte
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert("USA"); //country abbreviation
packetbuf.insert("United States");
packetbuf.sendpacket(s, 0x50);
while((int)buflen >= 4 && connected && (unsigned char)buffer[0] == 0xff){
packetid = buffer[1];
packetlen = *(unsigned short *)(buffer + 2);
memcpy(packetdata, buffer, packetlen);
//HexDump(packetlen, packetdata);
switch(packetid){
case 0x00:
//Keep alive
packetbuf.sendpacket(s, 0x0);
break;
case 0x06:
//Mpq name & hash command
strcpy(mpqname, buffer + 12);
strcpy(hashcmd, buffer + 25);
if(!CheckRevision("star\\starcraft.exe", "star\\storm.dll", "star\\battle.snp", hashcmd, &version, &checksum, exeinfo, mpqname)){
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, RED, "CheckRevision() failed!\n");
Disconnect();
return;
}
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, WHITE, "Checking version & Cdkey...\n");
break;
case 0x50:
packetbuf.insert((int)0);
packetbuf.insert("68XI", 4); //platform
packetbuf.insert("PXES", 4); //product
packetbuf.insert((int)0xc7); //version byte
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert((int)0);
packetbuf.insert("USA"); //country abbreviation
packetbuf.insert("United States"); //country name
break;
case 0x51:
//Version check result
if(buffer[4] != 0x00){
AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
AppendText(IDC_CHATWND, RED, "Version & Cdkey check failed!\n");
Disconnect();
return;
}
/*packetbuf.sendpacket(s, 0x14);
packetbuf.sendpacket(s, 0x2d);
packetbuf.insert((int)0x1b);
packetbuf.insert((int)0);
packetbuf.insert("bnserver.ini");
packetbuf.sendpacket(s, 0x33);*/
packetbuf.sendpacket(s, 0x3a);
break;
Quote from: SubLiminaL_WolF on May 04, 2003, 09:46 PM
switch(packetid){
case 0x00:
//Keep alive
packetbuf.sendpacket(s, 0x0);
break;
Packet zero is keepalive, but does not require any response from the client (and therefore there's no particular value in responding, since your receipt proves that the connection is indeed alive). Packet 25, however, does require a client response.