Fixed Makefile problem
authorBrian Palmer <brianp@sginet.com>
Thu, 29 Nov 2001 01:56:04 +0000 (01:56 +0000)
committerBrian Palmer <brianp@sginet.com>
Thu, 29 Nov 2001 01:56:04 +0000 (01:56 +0000)
Added tool to fix Win2k/XP NTVDM bug so DJGPP works without crashing

svn path=/trunk/; revision=2407

30 files changed:
freeldr/freeldr/Makefile
freeldr/freeldr/comm/Makefile
freeldr/freeldr/debug.h
freeldr/freeldr/disk.h
freeldr/freeldr/disk/Makefile
freeldr/freeldr/freeldr.c
freeldr/freeldr/freeldr.h
freeldr/freeldr/fs.h
freeldr/freeldr/fs/Makefile
freeldr/freeldr/fs/fat.h
freeldr/freeldr/linux.h
freeldr/freeldr/miscboot.h
freeldr/freeldr/mm.h
freeldr/freeldr/mm/Makefile
freeldr/freeldr/mm/mm.c
freeldr/freeldr/multiboot.h
freeldr/freeldr/options.c
freeldr/freeldr/options.h
freeldr/freeldr/parseini.h
freeldr/freeldr/reactos.h
freeldr/freeldr/reactos/Makefile
freeldr/freeldr/reactos/hwdetect.c
freeldr/freeldr/rtl.h
freeldr/freeldr/rtl/Makefile
freeldr/freeldr/ui.h
freeldr/freeldr/ui/Makefile
freeldr/freeldr/ui/tui.c
freeldr/ntvdmpat.c [new file with mode: 0644]
freeldr/ntvdmpat.exe [new file with mode: 0644]
freeldr/readme [new file with mode: 0644]

index ea246ad..890a09f 100644 (file)
 #
        
 
-export CC = gcc
-export LD = ld
-export AR = ar
-export RM = cmd /C del
-export CP = cmd /C copy
+export CC              = gcc
+export LD              = ld
+export AR              = ar
+export RM              = cmd /C del
+export CP              = cmd /C copy
+export MAKE            = make
 
-#FLAGS = -Wall -nostdinc -fno-builtin
-FLAGS = -Wall -fno-builtin -I./ -DDEBUG -O3
-#FLAGS = -Wall -fno-builtin
+#FLAGS = -Wall -nostdlib -nostdinc -fno-builtin -I./ -DDEBUG -O3
+FLAGS = -Wall -nostdlib -nostdinc -fno-builtin -I./ -DDEBUG -O3
 
 # asmcode.o has to be first in the link line because it contains the startup code
 #OBJS = asmcode.a asmcode.o mb.o boot.o freeldr.o rtl.o fs.a fs.o fat.o \
 #      reactos.o tui.o menu.o miscboot.o options.o linux.o multiboot.o arcname.o \
 #      mem.o memory.o debug.o parseini.o registry.o import.o
 ASM_OBJS = asmcode.o mb.o boot.o mem.o
-C_OBJS = freeldr.o rtl/rtl.a fs/fs.a ui/ui.a miscboot.o options.o linux.o multiboot.o \
-                reactos/reactos.a comm/comm.a disk/disk.a mm/mm.a
-C_OBJS2 = debug.o parseini.o oslist.o
+OBJS = freeldr.o miscboot.o options.o linux.o multiboot.o debug.o parseini.o oslist.o
+LIBS = rtl fs ui reactos comm disk mm
+LIB_FILES = rtl/rtl.a fs/fs.a ui/ui.a reactos/reactos.a comm/comm.a disk/disk.a mm/mm.a
 
 .PHONY : clean
 
@@ -51,63 +51,39 @@ freeldr.exe:        asmcode.a c_code.a
 asmcode.a:     $(ASM_OBJS)
        $(LD) -r -o asmcode.a $(ASM_OBJS)
 
-c_code.a:      c_code1.a c_code2.a
-       $(LD) -r -o c_code.a c_code1.a c_code2.a
+c_code.a:      c_code1.a $(LIBS)
+       $(LD) -r -o c_code.a c_code1.a $(LIB_FILES)
 
-c_code1.a:     $(C_OBJS)
-       $(LD) -r -o c_code1.a $(C_OBJS)
+c_code1.a:     $(OBJS)
+       $(LD) -r -o c_code1.a $(OBJS)
 
-c_code2.a:     $(C_OBJS2)
-       $(LD) -r -o c_code2.a $(C_OBJS2)
-
-asmcode.o:     asmcode.S asmcode.h Makefile
+asmcode.o:     asmcode.S asmcode.h
        $(CC) $(FLAGS) -o asmcode.o -c asmcode.S
 
-mb.o:  mb.S asmcode.h multiboot.h Makefile
+mb.o:  mb.S asmcode.h multiboot.h
        $(CC) $(FLAGS) -o mb.o -c mb.S
 
-boot.o:        boot.S asmcode.h Makefile
+boot.o:        boot.S asmcode.h
        $(CC) $(FLAGS) -o boot.o -c boot.S
 
-mem.o: mem.S asmcode.h Makefile
+mem.o: mem.S asmcode.h
        $(CC) $(FLAGS) -o mem.o -c mem.S
 
-freeldr.o:     freeldr.c freeldr.h rtl.h fs.h reactos.h ui.h asmcode.h miscboot.h Makefile
+freeldr.o:     freeldr.c freeldr.h rtl.h fs.h reactos.h ui.h asmcode.h miscboot.h
        $(CC) $(FLAGS) -o freeldr.o -c freeldr.c
 
-rtl/rtl.a:     rtl/print.o rtl/stdlib.o rtl/string.o rtl/memory.o Makefile
-       $(MAKE) -C rtl
-
-fs/fs.a:       fs/fs.o fs/fat.o Makefile
-       $(MAKE) -C fs
-
-ui/ui.a:       ui/tui.o ui/menu.o Makefile
-       $(MAKE) -C ui
-
-miscboot.o:    miscboot.c freeldr.h asmcode.h rtl.h fs.h ui.h miscboot.h Makefile
+miscboot.o:    miscboot.c freeldr.h asmcode.h rtl.h fs.h ui.h miscboot.h
        $(CC) $(FLAGS) -o miscboot.o -c miscboot.c
 
-options.o:     options.c freeldr.h rtl.h ui.h options.h Makefile
+options.o:     options.c freeldr.h rtl.h ui.h options.h
        $(CC) $(FLAGS) -o options.o -c options.c
 
-linux.o:       linux.c freeldr.h rtl.h ui.h linux.h Makefile
+linux.o:       linux.c freeldr.h rtl.h ui.h linux.h
        $(CC) $(FLAGS) -o linux.o -c linux.c
 
-multiboot.o:   multiboot.c freeldr.h rtl.h fs.h multiboot.h ui.h Makefile
+multiboot.o:   multiboot.c freeldr.h rtl.h fs.h multiboot.h ui.h
        $(CC) $(FLAGS) -o multiboot.o -c multiboot.c
 
-reactos/reactos.a:     reactos/arcname.o reactos/reactos.o reactos/reghive.o reactos/registry.o reactos/hwdetect.o Makefile
-       $(MAKE) -C reactos
-
-comm/comm.a:   comm/rs232.o comm/portio.o Makefile
-       $(MAKE) -C comm
-
-disk/disk.a:   disk/disk.o Makefile
-       $(MAKE) -C disk
-
-mm/mm.a:       mm/mm.o Makefile
-       $(MAKE) -C mm
-
 debug.o:       debug.c debug.h Makefile
        $(CC) $(FLAGS) -o debug.o -c debug.c
 
@@ -117,10 +93,33 @@ parseini.o:        parseini.c parseini.h Makefile
 oslist.o:      oslist.c oslist.h Makefile
        $(CC) $(FLAGS) -o oslist.o -c oslist.c
 
+rtl:
+       $(MAKE) -C rtl
+
+fs:
+       $(MAKE) -C fs
+
+ui:
+       $(MAKE) -C ui
+
+reactos:
+       $(MAKE) -C reactos
+
+comm:
+       $(MAKE) -C comm
+
+disk:
+       $(MAKE) -C disk
+
+mm:
+       $(MAKE) -C mm
+
+.PHONY : $(LIBS)
+
 clean:
-       $(RM) *.o
-       $(RM) *.a
-       $(RM) *.sys
+       $(RM) *.o
+       $(RM) *.a
+       $(RM) *.sys
        $(MAKE) -C reactos clean
        $(MAKE) -C comm clean
        $(MAKE) -C disk clean
index 97ac6f7..436862c 100644 (file)
@@ -35,12 +35,12 @@ all: comm.a
 comm.a:        $(OBJS)
        $(LD) -r -o comm.a $(OBJS)
 
-rs232.o:       rs232.c ../comm.h Makefile
+rs232.o:       rs232.c ../comm.h
        $(CC) $(FLAGS) -o rs232.o -c rs232.c
 
-portio.o:      portio.c ../comm.h Makefile
+portio.o:      portio.c ../comm.h
        $(CC) $(FLAGS) -o portio.o -c portio.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 04c345c..1bbafbf 100644 (file)
@@ -43,4 +43,4 @@
 
 #endif // defined DEBUG
 
-#endif // defined __DEBUG_H
\ No newline at end of file
+#endif // defined __DEBUG_H
index 7132229..9902cae 100644 (file)
@@ -56,4 +56,4 @@ VOID  DiskSetVolumeProperties(ULONG HiddenSectors);
 BOOL   DiskReadMultipleLogicalSectors(ULONG SectorNumber, ULONG SectorCount, PVOID Buffer);
 BOOL   DiskReadLogicalSector(ULONG SectorNumber, PVOID Buffer);
 
-#endif  // defined __DISK_H
\ No newline at end of file
+#endif  // defined __DISK_H
index 41225ab..d3707c1 100644 (file)
@@ -35,9 +35,9 @@ all: disk.a
 disk.a:        $(OBJS)
        $(LD) -r -o disk.a $(OBJS)
 
-disk.o:        disk.c ../disk.h Makefile
+disk.o:        disk.c ../disk.h
        $(CC) $(FLAGS) -o disk.o -c disk.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 55ea31a..70c18d6 100644 (file)
@@ -160,7 +160,7 @@ ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSys
 {
        UCHAR   DefaultOSText[80];
        ULONG   SectionId;
-       ULONG   DefaultOS;
+       ULONG   DefaultOS = 0;
        ULONG   Idx;
 
        if (!OpenSection("FreeLoader", &SectionId))
@@ -179,10 +179,6 @@ ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSys
                        }
                }
        }
-       else
-       {
-               DefaultOS = 0;
-       }
 
        return DefaultOS;
 }
index 77cde42..8834646 100644 (file)
@@ -78,4 +78,4 @@ extern ULONG          CursorYPos;                     // Cursor's Y Position
 
 void   BootMain(void);
 
-#endif  // defined __FREELDR_H
\ No newline at end of file
+#endif  // defined __FREELDR_H
index 4cbfe51..b0b0edc 100644 (file)
@@ -107,4 +107,4 @@ BOOL        IsEndOfFile(PFILE FileHandle);
 #define        FAT16                   2
 #define        FAT32                   3
 
-#endif // #defined __FS_H
\ No newline at end of file
+#endif // #defined __FS_H
index cd2f599..d0af045 100644 (file)
@@ -35,12 +35,12 @@ all: fs.a
 fs.a:  $(OBJS)
        $(LD) -r -o fs.a $(OBJS)
 
-fs.o:  fs.c fat.h ../fs.h Makefile
+fs.o:  fs.c fat.h ../fs.h
        $(CC) $(FLAGS) -o fs.o -c fs.c
 
-fat.o: fat.c fat.h ../fs.h Makefile
+fat.o: fat.c fat.h ../fs.h
        $(CC) $(FLAGS) -o fat.o -c fat.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 4444023..bb8976c 100644 (file)
@@ -176,4 +176,4 @@ ULONG       FatGetFilePointer(FILE *FileHandle);*/
 #define        FAT16                   2
 #define        FAT32                   3
 
-#endif // #defined __FAT_H
\ No newline at end of file
+#endif // #defined __FAT_H
index 3f6eb03..0b319e4 100644 (file)
@@ -24,4 +24,4 @@ void  JumpToLinuxBootCode(void);      // Implemented in boot.S
 
 void   LoadAndBootLinux(int DriveNum, int Partition, char *vmlinuz, char *cmd_line);
 
-#endif // defined __LINUX_H
\ No newline at end of file
+#endif // defined __LINUX_H
index d6b6ef2..0522624 100644 (file)
@@ -26,4 +26,4 @@ void  LoadAndBootBootSector(int nOSToBoot);
 void   LoadAndBootPartition(int nOSToBoot);
 void   LoadAndBootDrive(int nOSToBoot);
 
-#endif // defined __BOOT_H
\ No newline at end of file
+#endif // defined __BOOT_H
index 2bbdf21..778035f 100644 (file)
@@ -35,4 +35,4 @@ int           GetConventionalMemorySize(void);                        // Returns conventional memory size in K
 int            GetBiosMemoryMap(memory_map_t *mem_map);        // Fills mem_map structure with BIOS memory map and returns length of memory map
 
 
-#endif // defined __MEMORY_H
\ No newline at end of file
+#endif // defined __MEMORY_H
index 742d1a2..20399ba 100644 (file)
@@ -35,9 +35,9 @@ all: mm.a
 mm.a:  $(OBJS)
        $(LD) -r -o mm.a $(OBJS)
 
-mm.o:  mm.c ../mm.h Makefile
+mm.o:  mm.c ../mm.h
        $(CC) $(FLAGS) -o mm.o -c mm.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 24babcc..2abd69d 100644 (file)
@@ -52,7 +52,7 @@ VOID          DumpMemoryAllocMap(VOID);
 VOID           IncrementAllocationCount(VOID);
 VOID           DecrementAllocationCount(VOID);
 VOID           MemAllocTest(VOID);
-#endif DEBUG
+#endif // DEBUG
 
 VOID InitMemoryManager(PVOID BaseAddress, ULONG Length)
 {
@@ -151,7 +151,7 @@ PVOID AllocateMemory(ULONG NumberOfBytes)
        IncrementAllocationCount();
        DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d blocks) of memory starting at block %d. AllocCount: %d\n", NumberOfBytes, BlocksNeeded, Idx, AllocationCount));
        VerifyHeap();
-#endif DEBUG
+#endif // DEBUG
 
        // Now return the pointer
        return MemPointer;
@@ -170,7 +170,7 @@ VOID FreeMemory(PVOID MemBlock)
        {
                BugCheck((DPRINT_MEMORY, "Bogus memory pointer (0x%x) passed to FreeMemory()\n", MemBlock));
        }
-#endif DEBUG
+#endif // DEBUG
 
        // Find out the block number if the first
        // block of memory they allocated
@@ -197,7 +197,7 @@ VOID FreeMemory(PVOID MemBlock)
        DecrementAllocationCount();
        DbgPrint((DPRINT_MEMORY, "Freed %d blocks of memory starting at block %d. AllocationCount: %d\n", BlockCount, BlockNumber, AllocationCount));
        VerifyHeap();
-#endif DEBUG
+#endif // DEBUG
 }
 
 #ifdef DEBUG
@@ -330,4 +330,4 @@ VOID MemAllocTest(VOID)
        printf("MemPtr5: 0x%x\n", (int)MemPtr5);
        getch();
 }
-#endif DEBUG
+#endif // DEBUG
index 3757798..270b9fd 100644 (file)
@@ -156,4 +156,4 @@ BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize);
 #endif /* ! ASM */
 
 
-#endif // defined __MULTIBOOT_H
\ No newline at end of file
+#endif // defined __MULTIBOOT_H
index c889f82..cdb488f 100644 (file)
@@ -393,4 +393,4 @@ void DrawOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int
                }
        }*/
 }
-#endif
\ No newline at end of file
+#endif
index 5e1e255..f408dac 100644 (file)
@@ -28,4 +28,4 @@ int           RunOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int n
 void   InitOptionsMenu(int *nOptionsMenuBoxLeft, int *nOptionsMenuBoxTop, int *nOptionsMenuBoxRight, int *nOptionsMenuBoxBottom, int OptionsMenuItemCount);
 void   DrawOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int nOptionSelected, char *OptionsMenuTitle, int nOptionsMenuBoxLeft, int nOptionsMenuBoxTop, int nOptionsMenuBoxRight, int nOptionsMenuBoxBottom);
 
-#endif // #defined __OPTIONS_H
\ No newline at end of file
+#endif // #defined __OPTIONS_H
index 32a29b6..23c690f 100644 (file)
@@ -39,4 +39,4 @@ BOOL  IsValidSetting(char *setting, char *value);
 void   SetSetting(char *setting, char *value);
 
 
-#endif // defined __PARSEINI_H
\ No newline at end of file
+#endif // defined __PARSEINI_H
index 3a5e69f..9063105 100644 (file)
@@ -40,4 +40,4 @@ BOOL  DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG Boot
 //ULONG        ConvertArcNameToBiosDrive(PUCHAR ArcName);
 
 
-#endif // defined __REACTOS_H
\ No newline at end of file
+#endif // defined __REACTOS_H
index 824d5b0..b724fe3 100644 (file)
@@ -35,21 +35,21 @@ all: reactos.a
 reactos.a:     $(OBJS)
        $(LD) -r -o reactos.a $(OBJS)
 
-reactos.o:     reactos.c ../reactos.h Makefile
+reactos.o:     reactos.c ../reactos.h
        $(CC) $(FLAGS) -o reactos.o -c reactos.c
 
-arcname.o:     arcname.c ../reactos.h Makefile
+arcname.o:     arcname.c ../reactos.h
        $(CC) $(FLAGS) -o arcname.o -c arcname.c
 
-hwdetect.o:    hwdetect.c ../reactos.h Makefile
+hwdetect.o:    hwdetect.c ../reactos.h
        $(CC) $(FLAGS) -o hwdetect.o -c hwdetect.c
 
-reghive.o:     reghive.c ../reactos.h Makefile
+reghive.o:     reghive.c ../reactos.h
        $(CC) $(FLAGS) -o reghive.o -c reghive.c
 
-registry.o:    registry.c ../reactos.h Makefile
+registry.o:    registry.c ../reactos.h
        $(CC) $(FLAGS) -o registry.o -c registry.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 8782a5e..7d90b09 100644 (file)
@@ -36,4 +36,4 @@ DetectHardware(VOID)
   printf("DetectHardware() done\n");
 #endif
 //for(;;);
-}
\ No newline at end of file
+}
index 3996325..1fd6bab 100644 (file)
@@ -103,4 +103,4 @@ void        sprintf(char *buffer, char *format, ...);
 #endif
 
 
-#endif  // defined __STDLIB_H
\ No newline at end of file
+#endif  // defined __STDLIB_H
index d1450bc..3a5ab94 100644 (file)
@@ -35,18 +35,18 @@ all: rtl.a
 rtl.a: $(OBJS)
        $(LD) -r -o rtl.a $(OBJS)
 
-memory.o:      memory.c ../rtl.h Makefile
+memory.o:      memory.c ../rtl.h
        $(CC) $(FLAGS) -o memory.o -c memory.c
 
-print.o:       print.c ../rtl.h Makefile
+print.o:       print.c ../rtl.h
        $(CC) $(FLAGS) -o print.o -c print.c
 
-stdlib.o:      stdlib.c ../rtl.h Makefile
+stdlib.o:      stdlib.c ../rtl.h
        $(CC) $(FLAGS) -o stdlib.o -c stdlib.c
 
-string.o:      string.c ../rtl.h Makefile
+string.o:      string.c ../rtl.h
        $(CC) $(FLAGS) -o string.o -c string.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 47178c1..0a92d35 100644 (file)
@@ -152,4 +152,4 @@ void        DrawProgressBar(int nPos);
 BOOL   DisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem);
 
 
-#endif // #defined __TUI_H
\ No newline at end of file
+#endif // #defined __TUI_H
index 6ad9eb1..7a2258c 100644 (file)
@@ -35,12 +35,12 @@ all: ui.a
 ui.a:  $(OBJS)
        $(LD) -r -o ui.a $(OBJS)
 
-tui.o: tui.c ../ui.h Makefile
+tui.o: tui.c ../ui.h
        $(CC) $(FLAGS) -o tui.o -c tui.c
 
-menu.o:        menu.c ../ui.h Makefile
+menu.o:        menu.c ../ui.h
        $(CC) $(FLAGS) -o menu.o -c menu.c
 
 clean:
-       $(RM) *.o
-       $(RM) *.a
+       $(RM) *.o
+       $(RM) *.a
index 778cc24..1d44471 100644 (file)
@@ -715,4 +715,4 @@ void DrawProgressBar(int nPos)
                DrawText(left+2+i, top+2, "\xB2", ATTR(cTextColor, cMenuBgColor));
 
        UpdateDateTime();
-}
\ No newline at end of file
+}
diff --git a/freeldr/ntvdmpat.c b/freeldr/ntvdmpat.c
new file mode 100644 (file)
index 0000000..9e16dac
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copyright (C) 2000 CW Sandmann (sandmann@clio.rice.edu) 1206 Braelinn, Sugar Land, TX 77479 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#ifdef GO32
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+
+char view_only = 0;
+const char *client_patch_code;
+char buffer[20480];
+unsigned long search_base = 0x4c800L;
+int f;
+
+char oldpatch[] = {0x3b, 0x05, 0xac, 0xe6 };
+char newpatch[] = {0x3b, 0x05, 0x58, 0x5e };
+
+void patch_image(char *filename)
+{
+  int i,size;
+  
+  view_only = 0;
+  f = open(filename, O_RDWR | O_BINARY);
+  if (f < 0) {
+    f = open(filename, O_RDONLY | O_BINARY);
+    if (f < 0) {
+      perror(filename);
+      return;
+    }
+    view_only = 1; 
+  }
+
+  lseek(f, search_base, SEEK_SET);
+  size = read(f, buffer, sizeof(buffer));
+
+  client_patch_code = NULL;
+  for(i=0; i<size && !client_patch_code; i++)
+    if(!memcmp(buffer+i,oldpatch,sizeof(oldpatch)))
+      client_patch_code = (buffer+i);
+
+  if(!client_patch_code) {
+    printf("Old patch string not found in %s!\n",filename);
+  } else {
+    lseek(f, search_base+i-1, SEEK_SET);       /* Ready to update */
+    if(!view_only) {
+      write(f, newpatch, sizeof(newpatch));
+      printf("%s patched\n",filename);
+    } else
+      printf("%s patchable (not changed, readonly)\n",filename);
+  }
+  close(f);
+  return;
+}
+
+int main(int argc, char **argv)
+{
+  int i;
+  char filename[256];
+  char buf1[256];
+  char file2[256];
+  
+  if (argc != 1) {             /* If they specify names, patch them, exit */
+    for(i=1; i<argc; i++)
+     patch_image(argv[i]);
+    return 0;
+  }
+
+  fprintf(stderr, "This image patches Windows 2000 NTVDM to fix nesting DPMI bug.\n");
+
+  strcpy(filename,getenv("SYSTEMROOT"));
+  strcpy(file2,filename);
+  strcat(filename,"\\system32\\ntvdm.exe");
+  strcat(file2,"\\system32\\dllcache\\ntvdm.exe");
+  
+  sprintf(buf1,"copy %s %s\\system32\\ntvdm.ori",filename,getenv("SYSTEMROOT"));
+  printf("%s\n",buf1);
+  system(buf1);
+  
+  patch_image(file2);
+  patch_image(filename);
+  return 0;
+}
diff --git a/freeldr/ntvdmpat.exe b/freeldr/ntvdmpat.exe
new file mode 100644 (file)
index 0000000..4a12f57
Binary files /dev/null and b/freeldr/ntvdmpat.exe differ
diff --git a/freeldr/readme b/freeldr/readme
new file mode 100644 (file)
index 0000000..2d7f7ab
--- /dev/null
@@ -0,0 +1,18 @@
+Perform at your own risk.
+
+Directions for patching NTVDM on Windows 2000
+
+1) Start a Command Prompt Window
+2) Start Task Manager.  Sort by Name.  If NTVDM.EXE is a task End Process.
+3) Execute NTVDMPAT.EXE from this ZIP file.
+
+Notes:
+ With no arguments the executable patches both the DLLCACHE (for system file
+ protection) and the version in SYSTEM32.  The image is a Win32 executable
+ (launching a DJGPP image will require NTVDM, locking the DLL so it can't
+ be patched).  It saves the old version into NTVDM.ORI if you want to go
+ back.  If you specify arguments on the command line it will patch the
+ executables you specify instead of automating the process (if you want to
+ do the archives/patches/moves yourself).  Good luck.
+
+ Source included if you want to hack your own version.