#include <winsock.h>
int global_var = 0; // some global var @ BBEED0
int recv_process()
{
int first_var = global_var;
int stack_crypt = first_var ^ 0xf; // 0xf since we don't know what frame address is.
fd_set readfd;
timeval timeout = 0;
int socket_fd = 0, recv_ret;
SOCKET s;
char buf[800];
socket_fd = select(0, &readfd, NULL, NULL, *timeout));
if (socket_fd <= 0)
return 1;
recv_ret = recv(s, &buf, 800, 0);
if (recv_ret == -1) {
int error_code = WSAGetLastError();
if (error_code == WSAEWOULDBLOCK || error_code == WSAENOTCONN)
return 1; // after integrity
} else if (recv_ret <= 0) {
if (socket_fd == -1) {
return 0
}
closesocket(socket_fd);
somefunc(); //....
}
}