stasys44
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору ! BAT debug off checkrange 20111212: -1 read 0x8278 || call: error Not supported grub4dos version! if not exist NTBOOT && set NTBOOT =% ~ f0 setlocal set ISO_TYPE = set ISO_INST = set NTPATH ​​= echo echo NTBOOT by chenall 2011-12-12, $ [0101] http://chenall.net goto %1 | | goto: NTBOOT_HELP : Menu configfile% NTBOOT% .LST / MENU.LST exit :: Detect the next file. The use of call: Under CHECK_FILE% FILE1%% FILE2% will be used for the kind of situation : CHECK_NEXT_FILE set tmp =% 2 if not exist tmp && goto: input_file shift if "% 0" == "% 1" && goto: CHECK_NEXT_FILE :: Check / Find Files : CHECK_FILE echo Checking file $ [0107]% 1 ... set file =% 1 set tmp =% ~ pnx1 If the path is :: "(" at the beginning, it is a complete path, not to find out. if not "% file: ~ 0,1%" == "(" && goto: _FIND1 cat - length = 0% 1 | | goto: CHECK_NEXT_FILE root% ~ d1 goto: eof : _FIND1 find - set-root % 1 | | goto: CHECK_NEXT_FILE :: Find - set-root - devices = h % 1 | | goto: CHECK_NEXT_FILE goto: eof : Input_file File :: get user input, echo echo File not found or not support: $ [0105]% file% echo echo Please enter a new path to the file: $ [0104]% ~ x1 set file = set / p: 5 file = NTBOOT> if not exist file goto: exit set tmp =% ~ x1 set tmp =% tmp: ~ 0,3% call Fn.11 "% file%" "% tmp%" | | goto: input_file echo call: CHECK_FILE% file% exit : NT5 : NT6 : PE1 Module :: testing needs insmod% NTBOOT% .MOD / NTBOOT.MOD | | call: error Missing module NTBOOT.MOD ... Mapping NTBOOT boot image :: set /u file = NTBOOT.%1 map - mem % NTBOOT% MOD /% file% (rd) | | call:. error Missing module % file% ... : NTBOOT_START WINDOWS :: Set default path if not exist WinDir set WinDir = WINDOWS set boot_cfg = shift set file =%1 set tmp = /% WinDir% :: If no additional parameters or parameter is a disk partition if not exist file && goto% 0.HDD if "% ~ d1" == "% 1" && goto% 0.HDD NT5 :: These are the hard disk or NT6 if /i "%0" == "pe1" && set PDIR = WXPE && goto E1_BOOT call: CHECK_FILE% file% :: Go to start corresponding categories, such NT5.IMG_BOOT, NT6.WIM_BOOT, NT6.VHD_BOOT goto% 0% ~ x1_BOOT : NT5.HDD echo Searching NT5.X on Hard Disk (/% WinDir%) if exist file && root% 1 find -! set-root - devices = h /% WinDir% / system32/ntoskrnl.exe cat - locate = \ 0 \ x35 \ 0 \ x2E /% WinDir% / system32/version . dll goto: NT5_BOOT : NT6.HDD echo Searching NT6.X on Hard Disk (/% WinDir%) if exist file && root% 1 find -! set-root - devices = h /% WinDir% / system32/winload.exe goto: NT6_BOOT : ISO_INST64 set ISO_TYPE = amd64 : ISO_INST shift 1 :: The following command is used to generate a blank floppy disk (fd0) echo> (md) 0x200 +2 write - offset = 0xb (md) 0x200 +3 \ x00 \ x02 \ x01 \ x01 \ x00 \ x01 \ x70 \ x00 \ x10 \ x00 \ xfd \ x01 \ x00 \ x08 \ x00 \ x01 write 0x401FE 0xAA55 write 0x40200 0xfffffe map - mem (md) 0x200 +2 (fd0) Converted to uppercase :: set /u boot =%1.IMG set boot =% NTBOOT%. IMG /% boot% :: Automatically load the driver floppy image corresponding to (fd1) map - mem% boot% (fd1) | | call: Error Missing Module% boot% ... If the user specifies the floppy :: words will be specified by the user instead of the mirror set boot = cdrom set ISO_INST =% 1 goto:% 1 :::: AUTO_CONFIG :: automatic parameter configuration interfaces ::::::::::::::::::::::::::::::::::::::: ::::::::: :: Can automatically configure the startup parameters FIRADISK or VBOOT of the extension can also set other parameters. :: Invoke methods: call: AUTO_CONFIG VBOOT | FIRADISK [options ...] Depending on which options :: configuration types and different, but there is a parameter is the same boot :: Note: In addition to the outer boot and opt parameters other parameters should be type = FILE, such as cdrom = / cd / xp.iso or harddisk = (hd0, 0) / test.img like : AUTO_CONFIG set ISO_INST =% 1 : AUTO_CONFIG_LOOP shift shift :: :: Two after shift.% 0 is before% 2,% 1% 3 is before :: Examples: call: AUTO_CONFIG VBOOT harddisk = / test / test.vhd Prior% 0 :: no shift is: AUTO_CONFIG, twice removed two parameters shift on the front, into a harddisk. :: if "%1" == "" && exit :: If the argument is boot, then set the boot parameters. if /i "% 0" == "boot" && set boot =% 1 && goto: AUTO_CONFIG_LOOP :: If the argument is opt / addons, do not call the file to find detection set file =%~ 1 if "%0" == "opt" || if "% 0" == "addons" || call: CHECK_FILE% 1 if / i "% ~ x1" ==". iso" && call Fn.11 "% ~ n1" "64" && set ISO_TYPE = amd64 && echo% ISO_INST%: ISO_TYPE = amd64 :: Call different functions based on different parameters, such as FIRADISK.HARDDISK echo% ISO_INST%:% 0 =% file% call:.% ISO_INST%% 0% file% The next parameter :: goto :AUTO_CONFIG_LOOP : WINVBLK call: AUTO_CONFIG% * goto: WINVBLK_BOOT : WINVBLK.CDROM map% 1 (0xCD) | | map - mem %1 (0xCD) exit : WINVBLK.FLOPPY map -- mem %1 (fd0) exit : WINVBLK.HARDDISK map% 1 (hd0) | | map - heads = 255 - sectors-per-track = 63% 1 (hd0) map (hd0) (hd) map - harddrives = 1 exit :. FIRADISK @ HARDDISK :. WINVBLK @ HARDDISK map - mem - heads = 0 - sectors-per-track = 0% 1 (hd0) map (hd0) (hd) map - harddrives = 1 exit :. FIRADISK @ CDROM :. WINVBLK @ CDROM map --mem %1 (0xCD) exit : FIRADISK # HARDDISK : WINVBLK # HARDDISK map --mem --top --heads=0 --sectors-per-track=0 % 1 (hd0) map (hd0) (hd) map - harddrives = 1 exit : FIRADISK. # CDROM : WINVBLK. # CDROM map --mem --top % 1 (0xCD) exit : FIRADISK Use memory address 0x40000 :: at the beginning of 10 sectors storage FIRADISK parameters. :: Echo-n> (md) 0x210 +1 set fira.opt = call: AUTO_CONFIG %* If the value of the memory address 0x40020 :: non-zero, then there is written arguments. :: read 0x40020 && map - mem (md) 0x200 +16 (99) :: echo-e \ ">> (md) 0x210 +1 map - hook if not exist fira.opt && goto: FIRADISK_BOOT cat --locate=###### -- number=1 (fd1) /%ISO_TYPE% /TXTSETUP.OEM> nul || call: error firadisk.img file error .. set offset =%?% write - offset =% offset% (fd1) /% ISO_TYPE% / TXTSETUP.OEM value = Parameters, StartOptions, REG_SZ, "% fira.opt%" \ r \ n cat - skip =% offset% - locate = / - replace = \ \ (fd1) /% ISO_TYPE% / TXTSETUP.OEM goto: FIRADISK_BOOT :FIRADISK_BOOT :WINVBLK_BOOT map --hook . :: Back guarantee (fd1) position by the details: http://bbs.wuyou.com/viewthread.php?tid=203313 call: ReFloppy && set n = && set fdn= && set addr1= && set addr0= if exist BOOT &&% BOOT% if /i "% boot%" == "cdrom" && chainloader (0xCD) && boot if /i "% boot%" == "harddisk" && chainloader (hd0) +1 && boot if /i "% boot%" == "floppy" && chainloader (fd0) +1 && boot exit : ReFloppy set n = 3 : SwapFloppy calc% n% | | exit map --status=1 || exit set addr1 =%?% map --status=0 || exit set addr0 =%?% calc% addr0% /% addr1% && set fdn = 0 && if exist (1) / firadisk.inf && exit! set fdn = 1 && if exist (1) / winvblk.inf && exit map (% fdn%) +1 (rd) && map --mem (rd) +1 (% fdn%) && map --rehook set / a n =% n% -1 goto: SwapFloppy :: FIRADISK parameters set automatically, you can set CDROM, FLOPPY, HARDDISK other parameters : FIRADISK.CDROM :: Priority direct mapping, memory mapping failed try again. set fira.opt = cdrom, vmem = find:% ~ pnx1;% fira.opt% map% 1 (0xCD) | | map - mem% 1 (0xCD) exit : FIRADISK.FLOPPY map - mem %1 (fd0) exit : FIRADISK.HARDDISK map %1 (hd0) || map --heads=255 --sectors-per-track=63 %1 (hd0) map (hd0) (hd) set fira.opt = disk, vmem = find:% ~ pnx1;% fira.opt% exit : FIRADISK.OPT set fira.opt =% ~ 1;% fira.opt% exit :: These are FIRADISK parameters are automatically set : VBOOT if not exist (0xfd) / vbootldr && map --mem %NTBOOT%.MOD/VBOOT.ISO (0xfd) || call: Error Missing Module VBOOT ... map --hook && echo VBOOT module loaded successfully. echo-n vboot> (0xfd)/vboot/grub/grub.cfg if exist ISO_INST goto: VBOOT_INST shift :::::::::: Non ISO_INST is the default boot disk for the harddisk :::::::::::::::::::: :::::::::: Call AUTO_CONFIG to configure the startup parameters VBOOT ::::::::::::::::: set boot = harddisk call: AUTO_CONFIG vboot harddisk =% * goto: VBOOT_BOOT :: Use VBOOT to install the system, the first mapping VBOOT.IMG : VBOOT_INST call: AUTO_CONFIG% * goto: VBOOT_BOOT :::: Following startup parameters for the automatic configuration VBOOT ::::::: do not understand, please do not change, otherwise it will fail to start :::::::: : VBOOT.CDROM : VBOOT.HARDDISK : VBOOT.FLOPPY :: VBOOT.TAKE_SNAPSHOT / / uuid () :: VBOOT stupid, must be lowercase. . set / l UUID =%?% set / l tmp =% ~ x0 echo-e-n% tmp: ~ 1% = (UUID =% UUID%)% ~ pnx1 >> (0xfd) / vboot / grub / grub.cfg exit : VBOOT.OPT echo-e-n% ~ 1 >> (0xfd) / vboot / grub / grub.cfg exit :::: Above parameters configured to start automatically VBOOT of ::::::: : VBOOT_BOOT echo-e boot =% boot% \ nboot >> (0xfd) / vboot / grub / grub.cfg if exist BOOT &&% BOOT% kernel (0xfd) / vbootldr boot exit 90 : NT6.VHDX_BOOT : NT6.VHD_BOOT :: Fixed usage, the floppy corresponding BCD file only. Hereinafter set boot_cfg =: BCD_CFG_VHD # WIM b 0x7D72 0x82EA goto: NT6_BOOT : NT6.WIM_BOOT set boot_cfg =: BCD_CFG_VHD # WIM a 0x76A0 0x7A48 goto: NT6_BOOT : NT5.IMG_BOOT set boot_cfg =: NT5_RAM_CFG goto: NT5_BOOT :: GET_ARC_PATH, put a path into ARC format : GET_ARC_PATH checkrange 0:1 read 0x82a0 && goto: FD_ARC :: Checkrange 0x9E: 0xFF read 0x82a0 && goto: CD_ARC : HD_ARC DISKID ret = 0x60000 | | goto: CD_ARC set / a R = * 0x60000 >> 24 & 0xFF set / a P = * 0x60000 >> 16 & 0xFF echo multi (0) disk (0) rdisk (% R%) partition (% P%)% tmp%> (md) 0x3000 +4 : SET_ARC_PATH :: Replace GRUB4DOS path / to WINDOWS path \ cat - locate = / - replace = \ \ (md) 0x3000 +4 :: Set variables ARC_PATH cat (md) 0x3000 +4 | set ARC_PATH = goto: eof : FD_ARC set / a R = * 0x82A0 & 0xFF echo multi (0) disk (0) fdisk (% R%)% tmp%> (md) 0x3000 +4 :: If (fdx, y) in the form of a map (fdx) checkrange 0xFFFFFF00 read 0x829b | | map +1 () goto: SET_ARC_PATH : CD_ARC set / a R = * 0x82A0 & 0xFF echo multi (0) disk (0) cdrom (% R%)% tmp%> (md) 0x3000 +4 goto: SET_ARC_PATH : NATIVE_CFG echo cd% ~ pnx1> (rd) / NATIVE.CFG cat - locate = / - replace = \ \ - length = 256 (rd) / NATIVE.CFG exit : PE1_BOOT # # # # # # The following three lines are to be used NATIVE core PE # # # # # # # # # # # # # # # # # # # # # # echo-e @ echo off \ r \ ncd% ~ p1 \ r \ ncd% ~ pnx1> (rd) / NATIVE.CFG # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # cat - locate = / - replace = \ \ - length = 256 (rd) / NATIVE.CFG if / i "% file%" == "% ~ x1" && set file = / boot / imgs / boot% 1 : PE1.OPTIONS if / i "% 2" == "PDIR" && set PDIR =% 3 if / i "% 2" == "OPTIONS" && set option =% ~ 3 if / i "% 2" == "NTPATH" && set NTPATH ​​=% 3 if / i "% 2" == "Addons" && call: Addons% 3 pe shift 2 shift 2 if not "% 2" == "" goto: PE1.OPTIONS call: CHECK_FILE% file%% file: ~ 0, -1% _ if not exist NTPATH ​​&& set NTPATH ​​=% tmp% call: NATIVE_CFG% NTPATH% If the ISO format :: add a parameter on / rdexportascd if / i "% tmp: ~ -3,2%" == "is" && set option = / rdexportascd% option% if / i "% tmp: ~ -3%" == "wim" && set option =% option% / rdimageoffset = 8192 / rdimagelength = 3161088 call: GET_ARC_PATH echo-e [SetupData] \ r \ nBootDevice = "ramdisk (0)"> (rd) / BOOT.INI echo BootPath = \% PDIR% \ SYSTEM32 \ >> (rd) / BOOT.INI echo OsLoadOptions = "/ minint / fastdetect% option% / rdpath =% ARC_PATH%" >> (rd) / BOOT.INI :: Eliminate excess space characters, otherwise it will fail to start cat - locate = \ 0 - replace =; (rd) / BOOT.INI Modify the Default Path :: if / i not% PDIR% == "I386" && write - offset = 0x2A4FB (rd) / SETUPLDR.BIN% PDIR% WINNT.SIF :: modify the default file name write - offset = 0x2a432 (rd) / SETUPLDR.BIN BOOT.INI \ 0 if / i "% DEBUG%" == "on" && cat (rd) / BOOT.INI && checkrange 0x11b pause - test-key && goto: exit if exist BOOT &&% BOOT% map - mem (rd) +1 (0xfd) map - hook chainloader (0xfd) / SETUPLDR.BIN boot exit : BCD_CFG_VHD # WIM BCD :: particular statement corresponding to the floppy disk, modify the default startup items write - offset = 0x4E74 (rd) / BOOT / BCD% 1 :: Undisclosed function. The value of the ASCII string variables into memory using UNICODE encoding 0x40000 location. Encoding \ xH1 \ 0 \ XH2 \ 0 ..... WENV get tmp = 0x40000 :: Replace characters in the path / to \ cat - locate = \ \ x2F - replace = \ \ x5C (md) 0x200 +3 BCD :: particular statement corresponds to the floppy disk, modify the file path WENV call write - offset =% 2 (rd) / BOOT / BCD * 0x40000 $ WENV call write - offset =% 3 (rd) / BOOT / BCD * 0x40000 $ exit : NT5_RAM_CFG set default = ramdisk (0) /% WinDir% echo% default% = "ramdisk" # fastdetect # noguiboot% opt% # rdpath =% ARC_PATH% >> (rd) / BOOT.INI exit : NT5_HDD_CFG set default =% ARC_PATH% echo% default% = "NT5" # fastdetect% opt% # NoExecute = AlwaysOff # PAE >> (rd) / BOOT.INI exit : NT5_BOOT set / a cur_drv = * 0x82A0 & 0x7F set / a cur_pri = * 0x829C >> 16 & 0xFFFF clear echo echo $ [0105] Will Boot NT5.X From $ [0102] (hd% cur_drv%,% cur_pri%) $ [0106]% tmp% echo echo $ [0101] Press $ [1103] Esc $ [0101] to quit! checkrange 0x11b pause - wait = 3 - test-key && goto: exit call: GET_ARC_PATH shift 1 set opt ​​=% * echo [operating systems]> (rd) / BOOT.INI if exist boot_cfg && call% boot_cfg% call:! NT5_HDD_CFG echo [boot loader] >> (rd) / BOOT.INI echo timeout = 0 >> (rd) / BOOT.INI echo default =% default% >> (rd) / BOOT.INI GRUB4DOS format :: Replace path \ to / cat - locate = / - replace = \ \ (rd) / BOOT.INI :: Replaceable parameters, the parameters of the previous write / are using # substitute. cat - locate = # - replace = / (rd) / BOOT.INI :: Eliminate null character (replaced cat - locate = \ 0 - replace =; (rd) / BOOT.INI if / i "% DEBUG%" == "on" && cat (rd) / BOOT.INI && checkrange 0x11b pause - test-key && goto: exit if exist BOOT &&% BOOT% map - mem (rd) +1 (0xfd) map - hook chainloader (0xfd) / NTLDR boot exit : NT6_BOOT Get the current disk number :: set / a cur_drv = * 0x82A0 & 0x7F set / a cur_pri = * 0x829C >> 16 & 0xFFFF clear echo echo $ [0105] Will Boot NT6.X From $ [0102] (hd% cur_drv%,% cur_pri%) $ [0106]% tmp% echo echo $ [0101] Press $ [1103] Esc $ [0101] to quit! checkrange 0x11b pause - wait = 3 - test-key && goto: exit if exist boot_cfg && call% boot_cfg% Get MBR signature :: dd if = (hd% cur_drv%) +1 of = (md) bs = 1 count = 4 skip = 0x1b8 seek = 0x60000 Get the current partition offset :: cat - length = 0 () -1 dd if = (md) of = (md) bs = 1 count = 8 skip = 0x8290 seek = 0x60004 Modify the MBR signature :: cat - locate = \ x53 \ xB7 \ x53 \ xB7 - replace = * 0x60000 - hex = 4 (rd) / BOOT / BCD cat - locate = \ 0 \ x7E \ 0 \ 0 - replace = * 0x60004 - hex = 8 (rd) / BOOT / BCD if / i not "% WinDir%" == "windows" && call: CHG_NT6_WINDIR if / i "% DEBUG%" == "on" && call: NT6_DEBUG if exist BOOT &&% BOOT% map - mem (rd) (fd0) map - hook if exist () / boot / slic.bin | | find - set-root / boot / slic.bin | | echo-n if exist () / boot / slic.bin &&% NTBOOT% .MOD / SLIC () / boot / slic.bin root (0) chainloader (fd0) / BOOTMGR boot exit : NT6_DEBUG find - set-root - devices = h / ntboot_bcd | | call: error DEBUG: Missing file / ntboot_bcd. dd if = (rd) / BOOT / BCD of = () / ntboot_bcd exit : CHG_NT6_WINDIR The following are the test :: replace BCD inside the WINDOWS directory, I do not know whether he is not used properly. WENV get WinDir = 0x60000 WENV call write - offset = 0x3F76 (rd) / BOOT / BCD * 0x60000 $ set tmp =% WinDir% \ system32 \ winload.exe WENV get tmp = 0x60000 WENV call write - offset = 0x39A6 (rd) / BOOT / BCD * 0x60000 $ exit : Error pause Error:% * : Exit root% NTBOOT% root () exit 1 : FIRADISK.Addons : WINVBLK.Addons : VBOOT.Addons : Addons setlocal set addons =% * call Fn.11 "(/" "% addons:. ~ 0,1%" | | set addons =% NTBOOT% MOD /% addons% % Addons% && echo-n endlocal exit : NTBOOT_HELP echo echo Usage: echo $ [0102] NTBOOT $ [0107] NT5 $ [0105] | $ [0107] NT6 $ [0105] [= $ [0107] root $ [0105] | $ [0107] file $ [0105]] echo echo $ [0102] NTBOOT $ [0105] PE1 = file [PDIR = pdir] [OPTIONS = options] [ADDONS = cmd] echo echo $ [0102] NTBOOT $ [0105] VBOOT = file [options ...] echo echo $ [0102] NTBOOT $ [0107] ISO_INST $ [0105] | $ [0107] ISO_INST64 $ [0105] = [$ [0107] firadisk $ [0105] | $ [0107] vboot $ [0105] | $ [0107 ] winvblk $ [0105]] $ [0106] [options ...] echo $ [0106] options: [[@] CDROM = iso_file] [FLOPPY = srs_img] [[@] HARDDISK = hdd_img] echo $ [0106] [BOOT = cdrom | floppy | harddisk] [ADDONS = cmd] [...] echo $ [0106] "@" will map image to RAM (used for firadisk / winvblk only). echo $ [0106] "#" will map image to top of RAM (firadisk / winvblk only). echo exit 2 | Всего записей: 874 | Зарегистр. 23-08-2008 | Отправлено: 10:00 14-02-2014 | Исправлено: stasys44, 10:02 14-02-2014 |
|