Rev 164 | Rev 185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 164 | Rev 179 | ||
---|---|---|---|
Line 188... | Line 188... | ||
188 | char *data_start; |
188 | char *data_start; |
189 | int write_index; |
189 | int write_index; |
190 | int read_index; |
190 | int read_index; |
191 | int length; |
191 | int length; |
192 | SOCKET s; |
192 | SOCKET s; |
193 | - | ||
194 | // initialize the network subsystem if required |
- | |
195 | if (!Network_Init ()) |
- | |
196 | { |
- | |
197 | *failure_reason = LOCALIZE (L"Registration_NetworkFailure"); |
- | |
198 | return (0); // couldn't initialize WinSock, return an error condition |
- | |
199 | } |
- | |
200 | 193 | ||
201 | // get our distribution server's IP address from the host name |
194 | // get our distribution server's IP address from the host name |
202 | hostinfo = gethostbyname ("pmbaty.com"); |
195 | hostinfo = gethostbyname ("pmbaty.com"); |
203 | if (hostinfo == NULL) |
196 | if (hostinfo == NULL) |
204 | { |
197 | { |
Line 255... | Line 248... | ||
255 | http_buffer[read_index] = 0; |
248 | http_buffer[read_index] = 0; |
256 | //MessageBoxA (NULL, http_buffer, "HTTP response", MB_OK); |
249 | //MessageBoxA (NULL, http_buffer, "HTTP response", MB_OK); |
257 | if ((data_start = strstr (http_buffer, "Success=")) != NULL) |
250 | if ((data_start = strstr (http_buffer, "Success=")) != NULL) |
258 | { |
251 | { |
259 | *failure_reason = L""; // no error, set an empty string as the failure reason |
252 | *failure_reason = L""; // no error, set an empty string as the failure reason |
260 | return ((unsigned __int32) |
253 | return ((unsigned __int32) _atoi64 (&data_start[strlen ("Success=")])); // and return the candidate code we got |
261 | } |
254 | } |
262 | else if ((data_start = strstr (http_buffer, "Error=")) != NULL) |
255 | else if ((data_start = strstr (http_buffer, "Error=")) != NULL) |
263 | { |
256 | { |
264 | data_start += strlen ("Error="); |
257 | data_start += strlen ("Error="); |
265 | if (strchr (data_start, '\r') != NULL) *strchr (data_start, '\r') = 0; |
258 | if (strchr (data_start, '\r') != NULL) *strchr (data_start, '\r') = 0; |