Changeset 1707
- Timestamp:
- 11/11/08 00:16:55 (2 months ago)
- Files:
-
- libemu/trunk/CHANGES (modified) (1 diff)
- libemu/trunk/configure.ac (modified) (1 diff)
- libemu/trunk/include/emu/emu_cpu_data.h (modified) (1 diff)
- libemu/trunk/src/emu.c (modified) (1 diff)
- libemu/trunk/src/emu_log.c (modified) (1 diff)
- libemu/trunk/src/emu_string.c (modified) (1 diff)
- libemu/trunk/src/environment/emu_profile.c (modified) (2 diffs)
- libemu/trunk/testsuite/instrtest.c (modified) (2 diffs)
- libemu/trunk/tools/sctest/userhooks.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libemu/trunk/CHANGES
r1429 r1707 1 1 Changelog for libemu 2 xx.11.2008 3 4 2 5 3 6 19.09.2007 libemu 0.1.0 4 7 - initial release 5 8 9 libemu/trunk/configure.ac
r1684 r1707 5 5 6 6 AC_PREREQ(2.59) 7 AC_INIT([libemu], [0. 1.0], [nepenthesdev@gmail.com])8 AM_INIT_AUTOMAKE([libemu], [0. 1.0])7 AC_INIT([libemu], [0.2.0], [nepenthesdev@gmail.com]) 8 AM_INIT_AUTOMAKE([libemu], [0.2.0]) 9 9 AC_REVISION([$Id$]) 10 10 libemu/trunk/include/emu/emu_cpu_data.h
r1705 r1707 242 242 #define DWORD_FROM_WORDS(to, upper, lower) \ 243 243 memcpy(&to,&lower,2); \ 244 memcpy( &to+2,&lower,2);244 memcpy(((char *)&to)+2,&lower,2); 245 245 246 246 #define QWORD_FROM_DWORDS(to, upper, lower) \ 247 247 memcpy(&to,&lower,4); \ 248 memcpy( &to+4,&lower,4);248 memcpy(((char *)&to)+4,&lower,4); 249 249 250 250 libemu/trunk/src/emu.c
r1346 r1707 114 114 char *message; 115 115 va_start(ap, format); 116 vasprintf(&message, format, ap);116 int va = vasprintf(&message, format, ap); 117 117 va_end(ap); 118 119 if (va == -1) 120 return; 118 121 119 122 e->errorstr = message; libemu/trunk/src/emu_log.c
r1684 r1707 83 83 84 84 va_start(ap, format); 85 vasprintf(&message, format, ap);85 int va = vasprintf(&message, format, ap); 86 86 va_end(ap); 87 88 if (va == -1) 89 message = strdup("failed to allocate memory in vasprintf\n"); 87 90 88 91 el->logcb(e, level, message); libemu/trunk/src/emu_string.c
r1317 r1707 75 75 76 76 va_start(ap, format); 77 vasprintf(&message, format, ap);77 int va = vasprintf(&message, format, ap); 78 78 va_end(ap); 79 80 if (va == -1) 81 exit(-1); 79 82 80 83 emu_string_append_char(s, message); libemu/trunk/src/environment/emu_profile.c
r1684 r1707 978 978 979 979 uint32_t x = 0; 980 fread(&x, 4, 1, f);981 emu_profile_argument_add_port(profile, argtype, argname, x);980 if ( fread(&x, 4, 1, f) == 4) 981 emu_profile_argument_add_port(profile, argtype, argname, x); 982 982 } 983 983 break; … … 986 986 { 987 987 uint32_t x = -1; 988 fread(&x, 4, 1, f);989 emu_profile_argument_add_ip(profile, argtype, argname, x);988 if ( fread(&x, 4, 1, f) == 4) 989 emu_profile_argument_add_ip(profile, argtype, argname, x); 990 990 } 991 991 break; libemu/trunk/testsuite/instrtest.c
r1639 r1707 794 794 } 795 795 796 fwrite(use,strlen(use),1,f); 797 fwrite(tests[i].instr,1,strlen(tests[i].instr),f); 796 int fr = 0; 797 fr = fwrite(use,strlen(use),1,f); 798 fr = fwrite(tests[i].instr,1,strlen(tests[i].instr),f); 798 799 fclose(f); 799 system("cd /tmp/; nasm foo.S");800 fr = system("cd /tmp/; nasm foo.S"); 800 801 f=fopen("/tmp/foo","r"); 801 802 if (f == NULL) … … 810 811 tests[i].code = malloc(tests[i].codesize); 811 812 fseek(f,0,SEEK_SET); 812 fr ead(tests[i].code,1,tests[i].codesize,f);813 fr = fread(tests[i].code,1,tests[i].codesize,f); 813 814 fclose(f); 814 815 libemu/trunk/tools/sctest/userhooks.c
r1706 r1707 251 251 dup2(err[0], fileno(stderr)); 252 252 253 int sys = -1; 253 254 struct emu_hashtable_item *ehi = emu_hashtable_search(opts.override.commands.commands, "cmd"); 254 255 if ( ehi != NULL ) 255 sys tem((char *)ehi->value);256 sys = system((char *)ehi->value); 256 257 else 257 sys tem("/bin/sh -c \"cd ~/.wine/drive_c/; wine 'c:\\windows\\system32\\cmd_orig.exe' \"");258 sys = system("/bin/sh -c \"cd ~/.wine/drive_c/; wine 'c:\\windows\\system32\\cmd_orig.exe' \""); 258 259 259 260 close(in[1]); … … 261 262 close(err[0]); 262 263 263 printf("process ended !\n");264 printf("process ended (%i)!\n", sys); 264 265 exit(EXIT_SUCCESS); 265 266 } else … … 291 292 int action = select(highsock+1, &socks, NULL, NULL, &timeout); 292 293 // printf("select %i\n",action); 293 294 int written = -1; 294 295 if ( action > 0 ) 295 296 { … … 297 298 { 298 299 int size = read(psiStartInfo->hStdInput, buf, 1024); 300 299 301 // printf("read %i in '%.*s'\n",size,size,buf); 300 302 if ( size > 0 ) 301 writ e(in[0], buf, size);303 written = write(in[0], buf, size); 302 304 else 303 305 goto exit_now; … … 309 311 // printf("read %i out '%.*s'\n",size,size,buf); 310 312 if ( size > 0 ) 311 writ e(psiStartInfo->hStdOutput, buf, size);313 written = write(psiStartInfo->hStdOutput, buf, size); 312 314 else 313 315 goto exit_now; … … 319 321 // printf("read %i err '%.*s'\n",size,size,buf); 320 322 if ( size > 0 ) 321 writ e(psiStartInfo->hStdOutput, buf, size);323 written = write(psiStartInfo->hStdOutput, buf, size); 322 324 else 323 325 goto exit_now; … … 539 541 540 542 char *localfile; 541 asprintf(&localfile, "/tmp/%s-XXXXXX",filename); 543 544 if ( asprintf(&localfile, "/tmp/%s-XXXXXX",filename) == -1) 545 exit(-1); 546 542 547 int fd = mkstemp(localfile); 543 548 close(fd); … … 697 702 698 703 char *localfile; 699 asprintf(&localfile, "/tmp/%s-XXXXXX",lpFileName); 704 705 if ( asprintf(&localfile, "/tmp/%s-XXXXXX",lpFileName) == -1) 706 exit(-1); 707 700 708 int fd = mkstemp(localfile); 701 709 close(fd); … … 723 731 */ 724 732 733 int written = -1; 725 734 va_list vl; 726 735 va_start(vl, hook); … … 735 744 736 745 if (nf != NULL) 737 fwrite(lpBuffer, nNumberOfBytesToWrite, 1, nf->real_file);746 written = fwrite(lpBuffer, nNumberOfBytesToWrite, 1, nf->real_file); 738 747 else 739 748 printf("shellcode tried to write data to not existing handle\n");
