Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @rem = '--*-Perl-*--
- @echo off
- perl.exe -x -S %0 %*
- if %errorlevel% == 9009 echo Perlをインストールしてください.
- if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
- goto endofperl
- @rem ';
- #!perl
- #line 10
- eval 'exec C:\Perl\bin\perl.exe -S $0 ${1+"$@"}' if 0;
- my $fn=$ARGV[0];
- my $_snprintf=pack "L",0x00A76888;
- open F,"< $fn";
- binmode F;
- seek F,0,0;
- read F,$b,-s F;
- close F;
- $e_lfanew=unpack("L",substr $b,0x3C,4);
- substr $b,$e_lfanew+0x40,4,pack("L",5);
- substr $b,$e_lfanew+0x48,4,pack("L",5);
- $b =~ s/if_indextoname\0/GetIfEntry\0\0\0\0\0/s or die "not found \"if_indextoname\"\n";
- # http://code.google.com/p/dolphin-emu/source/browse/Externals/miniupnpc/src/miniupnpc.c?name=master#736
- # IF_NAMESIZEが定義されたコードが生成されているので
- # > if(if_indextoname(scope_id, ifname)) {
- # > n1 += 3 + strlen(ifname); /* 3 == strlen(%25) */
- # > }
- # を
- # > _snprintf(scope_str, sizeof(scope_str), "%u", scope_id);
- # に置き換える
- $b =~ s/(\x8D\x44\x24\x30)
- \x50\x55\xE8[\0-\xFF]{4}\x85\xC0\x74\x16\x8D\x4C\x24\x30\x8D\x51\x01\x90\x8A\x01\x41\x84
- (\xC0\x75\xF9\x2B\xCA\x83\xC6\x03\x03\xF1)
- /$1
- ."\x68\x25\x75\x00\x00\x8D\x14\x24\x55\x55\x52\x6A\x08\x50\xFF\x15"
- .$_snprintf
- ."\x58\xEB\x0A"
- .$2/exs or die "not found \"call if_indextoname\"\n";
- $on = $fn;
- $fn =~ s/\.exe$/_bak.exe/;
- -e $fn and die "$fn already exists\n";
- rename $on,$fn;
- open F,">$on";
- binmode F;
- seek F,0,0;
- print F $b;
- close F;
- __END__
- :endofperl
Advertisement
Add Comment
Please, Sign In to add comment