Guest User

dolphin_xp_patch_20140126.bat

a guest
Jan 25th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 1.51 KB | None | 0 0
  1. @rem = '--*-Perl-*--
  2. @echo off
  3. perl.exe -x -S %0 %*
  4. if %errorlevel% == 9009 echo Perlをインストールしてください.
  5. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  6. goto endofperl
  7. @rem ';
  8. #!perl
  9. #line 10
  10.     eval 'exec C:\Perl\bin\perl.exe -S $0 ${1+"$@"}' if 0;
  11. my $fn=$ARGV[0];
  12. my $_snprintf=pack "L",0x00A76888;
  13. open F,"< $fn";
  14. binmode F;
  15. seek F,0,0;
  16. read F,$b,-s F;
  17. close F;
  18. $e_lfanew=unpack("L",substr $b,0x3C,4);
  19. substr $b,$e_lfanew+0x40,4,pack("L",5);
  20. substr $b,$e_lfanew+0x48,4,pack("L",5);
  21. $b =~ s/if_indextoname\0/GetIfEntry\0\0\0\0\0/s or die "not found \"if_indextoname\"\n";
  22.  
  23. # http://code.google.com/p/dolphin-emu/source/browse/Externals/miniupnpc/src/miniupnpc.c?name=master#736
  24. # IF_NAMESIZEが定義されたコードが生成されているので
  25. #   > if(if_indextoname(scope_id, ifname)) {
  26. #   >     n1 += 3 + strlen(ifname);       /* 3 == strlen(%25) */
  27. #   > }
  28. # を
  29. #   > _snprintf(scope_str, sizeof(scope_str), "%u", scope_id);
  30. # に置き換える
  31.  
  32. $b =~ s/(\x8D\x44\x24\x30)
  33.     \x50\x55\xE8[\0-\xFF]{4}\x85\xC0\x74\x16\x8D\x4C\x24\x30\x8D\x51\x01\x90\x8A\x01\x41\x84
  34.     (\xC0\x75\xF9\x2B\xCA\x83\xC6\x03\x03\xF1)
  35.     /$1
  36.     ."\x68\x25\x75\x00\x00\x8D\x14\x24\x55\x55\x52\x6A\x08\x50\xFF\x15"
  37.     .$_snprintf
  38.     ."\x58\xEB\x0A"
  39.     .$2/exs or die "not found \"call if_indextoname\"\n";
  40. $on = $fn;
  41. $fn =~ s/\.exe$/_bak.exe/;
  42. -e $fn and die "$fn already exists\n";
  43. rename $on,$fn;
  44. open F,">$on";
  45. binmode F;
  46. seek F,0,0;
  47. print F $b;
  48. close F;
  49. __END__
  50. :endofperl
Advertisement
Add Comment
Please, Sign In to add comment