#
-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
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
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
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
#endif // defined DEBUG
-#endif // defined __DEBUG_H
\ No newline at end of file
+#endif // defined __DEBUG_H
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
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
{
UCHAR DefaultOSText[80];
ULONG SectionId;
- ULONG DefaultOS;
+ ULONG DefaultOS = 0;
ULONG Idx;
if (!OpenSection("FreeLoader", &SectionId))
}
}
}
- else
- {
- DefaultOS = 0;
- }
return DefaultOS;
}
void BootMain(void);
-#endif // defined __FREELDR_H
\ No newline at end of file
+#endif // defined __FREELDR_H
#define FAT16 2
#define FAT32 3
-#endif // #defined __FS_H
\ No newline at end of file
+#endif // #defined __FS_H
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
#define FAT16 2
#define FAT32 3
-#endif // #defined __FAT_H
\ No newline at end of file
+#endif // #defined __FAT_H
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
void LoadAndBootPartition(int nOSToBoot);
void LoadAndBootDrive(int nOSToBoot);
-#endif // defined __BOOT_H
\ No newline at end of file
+#endif // defined __BOOT_H
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
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
VOID IncrementAllocationCount(VOID);
VOID DecrementAllocationCount(VOID);
VOID MemAllocTest(VOID);
-#endif DEBUG
+#endif // DEBUG
VOID InitMemoryManager(PVOID BaseAddress, ULONG Length)
{
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;
{
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
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
printf("MemPtr5: 0x%x\n", (int)MemPtr5);
getch();
}
-#endif DEBUG
+#endif // DEBUG
#endif /* ! ASM */
-#endif // defined __MULTIBOOT_H
\ No newline at end of file
+#endif // defined __MULTIBOOT_H
}
}*/
}
-#endif
\ No newline at end of file
+#endif
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
void SetSetting(char *setting, char *value);
-#endif // defined __PARSEINI_H
\ No newline at end of file
+#endif // defined __PARSEINI_H
//ULONG ConvertArcNameToBiosDrive(PUCHAR ArcName);
-#endif // defined __REACTOS_H
\ No newline at end of file
+#endif // defined __REACTOS_H
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
printf("DetectHardware() done\n");
#endif
//for(;;);
-}
\ No newline at end of file
+}
#endif
-#endif // defined __STDLIB_H
\ No newline at end of file
+#endif // defined __STDLIB_H
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
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
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
DrawText(left+2+i, top+2, "\xB2", ATTR(cTextColor, cMenuBgColor));
UpdateDateTime();
-}
\ No newline at end of file
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+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.