--- /dev/null
+#!/usr/bin/perl
+# Patch a DLL or EXE to change the name of the Cygwin DLL it uses or is, so that we can
+# include our own Cygwin DLL that doesn't interfere with the rest of the system, for great justice
+
+@ARGV = ('-') unless @ARGV;
+@FILES = @ARGV;
+while ($ARGV = shift) {
+ $out = $ARGV . ".new";
+ open(IN, $ARGV) or warn "Can't open $ARGV: $!\n";
+ open(OUT, ">$out") or warn "Can't open $out: $!\n";
+ binmode IN;
+ while (<IN>) {
+ s/cygwin1/aybabtu/g;
+ s/c\000y\000g\000w\000i\000n\0001/a\000y\000b\000a\000b\000t\000u/g;
+ print OUT;
+ }
+ close IN;
+ close OUT;
+ unlink $ARGV;
+ rename $out, $ARGV;
+}
+++ /dev/null
-#!/usr/bin/perl -i.bak
-# Patch the cygwin dll to make a non-clashing version, for great justice
-
-while (<>) {
- s/cygwin1/aybabtu/g;
- s/c\000y\000g\000w\000i\000n\0001/a\000y\000b\000a\000b\000t\000u/g;
- print;
-}
--- /dev/null
+#include <windows.h>
+
+const char *prog = "runexe";
+
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
+{
+ STARTUPINFO sInfo;
+ PROCESS_INFORMATION pInfo;
+
+ sInfo.cb = sizeof(STARTUPINFO);
+ sInfo.lpReserved = NULL;
+ sInfo.lpReserved2 = NULL;
+ sInfo.cbReserved2 = 0;
+ sInfo.lpDesktop = NULL;
+ sInfo.lpTitle = NULL;
+ sInfo.dwFlags = 0;
+
+ if (strlen(lpszCmdParam) == 0) {
+ printf("%s: no parameters given\n", prog);
+ exit(1);
+ }
+ CreateProcess(NULL, lpszCmdParam, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
+ return 0;
+}