details in the top commenting of the code..
Code:
/* the problem is that after i call this function it crashes,
before i used the EmcryptText function it worked fine but
ever since i added that the function crashes, i have made
another program with the encrypt text function and made it
output the result to a file and it seems to work 100% fine,
even in this program i placed a messagebox after the function
and it shows the correct text, i have used GetLastError in this
function yet it seems to return 0 every time, the messagebox
before the return 0; shows but if i place a messagebox after calling
the function, it does not show..here is the code */
int ClientPacket(char SendData[250])
{
/* -------- function the client uses to send data -------*/
unsigned char buffer[252];
unsigned char data[250];
int i;
memset(buffer, 0 , sizeof(buffer));
strcpy(data, SendData);
EncryptText(&data[0]);
sprintf(&buffer[1], "%s" , data);
buffer[0] = strlen(&buffer[1]);
buffer[0] = buffer[0] ^ 3;
if((i = send(ClientSock, buffer, strlen(buffer), 0)) == -1)
{
return -1;
}
MessageBox(0, "test" , "Test", 0);
return 0;
}