Changeset 1333
- Timestamp:
- 07/25/07 16:57:34 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libemu/trunk/src/environment/win32/emu_env_w32_dll_export_kernel32_hooks.c
r1330 r1333 41 41 #include <errno.h> 42 42 43 43 #include "../../../config.h" 44 44 #include "emu/emu.h" 45 45 #include "emu/emu_memory.h" … … 258 258 fflush(NULL); 259 259 260 #ifdef HAVE_INTERACTIVE_HOOKS 260 261 // the code is meant to be an example how one could do it 261 262 pid_t pid; … … 274 275 emu_memory_write_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 275 276 } 277 #endif 276 278 277 279 emu_cpu_eip_set(c, eip_save); … … 835 837 836 838 // the code is meant to be an example how one could do it 839 #ifdef HAVE_INTERACTIVE_HOOKS 837 840 int status; 838 841 while(1) … … 842 845 sleep(1); 843 846 } 847 #endif 844 848 845 849 emu_cpu_reg32_set(c, eax, 32); libemu/trunk/src/environment/win32/emu_env_w32_dll_export_urlmon_hooks.c
r1330 r1333 33 33 #include <unistd.h> 34 34 35 35 #include "../../../config.h" 36 36 #include "emu/emu.h" 37 37 #include "emu/emu_memory.h" libemu/trunk/src/environment/win32/emu_env_w32_dll_export_ws2_32_hooks.c
r1330 r1333 40 40 #include <unistd.h> 41 41 42 42 #include "../../../config.h" 43 43 #include "emu/emu.h" 44 44 #include "emu/emu_memory.h" … … 81 81 printf("accept(s=%i, addr=%x, addrlen=%i);\n", s, addr, addrlen); 82 82 83 int a = 67; 84 85 #ifdef HAVE_INTERACTIVE_HOOKS 83 86 struct sockaddr sa; 84 87 socklen_t sasize = sizeof(struct sockaddr); 85 int a = accept(s, &sa, &sasize); 88 a=accept(s, &sa, &sasize); 89 #endif 90 86 91 printf("accept %i \n", a); 87 92 emu_cpu_reg32_set(c, eax, a); … … 128 133 ntohs(((struct sockaddr_in *)&sa)->sin_port)); 129 134 } 130 int retval = bind(s, &sa, sizeof(struct sockaddr)); 135 136 int retval = 0; 137 138 #ifdef HAVE_INTERACTIVE_HOOKS 139 retval = bind(s, &sa, sizeof(struct sockaddr)); 140 #endif 141 131 142 emu_cpu_reg32_set(c, eax, retval); 132 143 … … 154 165 POP_DWORD(c, &s); 155 166 167 #ifdef HAVE_INTERACTIVE_HOOKS 156 168 close((int)s); 169 #endif 157 170 158 171 emu_cpu_reg32_set(c, eax, 0); … … 196 209 ntohs(((struct sockaddr_in *)&sa)->sin_port)); 197 210 211 212 int retval = 0; 213 214 #ifdef HAVE_INTERACTIVE_HOOKS 198 215 struct sockaddr_in si; 199 216 si.sin_port = htons(4444); 200 217 si.sin_family = AF_INET; 201 218 si.sin_addr.s_addr = inet_addr("127.0.0.1"); 202 203 int retval = connect(s, (struct sockaddr *)&si, sizeof(struct sockaddr_in)); 219 connect(s, (struct sockaddr *)&si, sizeof(struct sockaddr_in)); 220 #endif 221 204 222 emu_cpu_reg32_set(c, eax, retval); 205 223 … … 233 251 printf("listen(s=%i, backlog=%i)\n", s, backlog); 234 252 235 int retval = listen(s, backlog); 253 int retval = 0; 254 255 #ifdef HAVE_INTERACTIVE_HOOKS 256 retval = listen(s, backlog); 257 #endif 258 236 259 emu_cpu_reg32_set(c, eax, retval); 237 260 … … 272 295 uint32_t xlen = len; 273 296 char *buffer = (char *)malloc(len); 297 memset(buffer, 0, len); 298 299 #ifdef HAVE_INTERACTIVE_HOOKS 274 300 len = recv(s, buffer, len, flags); 301 #endif 302 275 303 printf("recv(%i, 0x%08x, %i) == %i \n", s, buf, xlen, (int32_t)len); 276 304 if ((int32_t)len > 0) … … 319 347 printf("send(%i, 0x%08x, %i, %i)\n", s, buf, len, flags); 320 348 emu_memory_read_block(emu_memory_get(env->emu), buf, buffer, len); 321 int retval = send(s, buffer, len, flags); 349 350 int retval = len; 351 352 #ifdef HAVE_INTERACTIVE_HOOKS 353 len = send(s, buffer, len, flags); 322 354 printf("send %i (of %i) bytes\n", retval, len); 355 #endif 356 323 357 emu_cpu_reg32_set(c, eax, retval); 324 358 free(buffer); … … 409 443 POP_DWORD(c, &protocol); 410 444 411 int s = socket(af, type, protocol); 445 int s = 111; 446 447 #ifdef HAVE_INTERACTIVE_HOOKS 448 s=socket(af, type, protocol); 449 #endif 450 412 451 printf("socket %i \n", s); 413 452 emu_cpu_reg32_set(c, eax, s); … … 458 497 printf("SOCKET WSASocket(af=%i, type=%i, protocol=%i, lpProtocolInfo=%x, group=%i, dwFlags=%i);\n", 459 498 af, type, protocol, protocolinfo, group, flags); 460 int s = socket(af, type, protocol); 499 500 int s = 113; 501 502 #ifdef HAVE_INTERACTIVE_HOOKS 503 s=socket(af, type, protocol); 504 #endif 505 461 506 printf("socket %i \n", s); 462 507 emu_cpu_reg32_set(c, eax, s);
