xiaoy 发表于 2011-1-2 23:00:58

VHD还原工具之NTBOOT修改版

修改自NTBOOT的东西,都不好意思拿出来,看大家对VHD有点兴趣,拿出来给大大们看看,希望完善得更好。

使用条件,
1. 在第二分区创建WIN7目录,里面存放父VHD,创建的一个叫win.vhd的子VHD并复制一份改名为win7bak.vhd

2.使用GRUB4DOS引导NTBOOT.IMG
title boot into vhd system
map --mem /ntboot.img (fd0)
map --hook
savedefault
chainloader (fd0)+1



实现功能
1.引导存放于第二分区win7目录里的任意vhd文件,默认启动子VHD文件为win7.vhd
2.实现快速重建或还原第二分区win7目录里的任意VHD子文件,不进入PE
3.一机多用户系统 互不干扰快速实现

注意事项:1使用中所需密码均为wuyou
2.自带华X OEM SLIC
3.启动VHD将自动隐藏HD0,0
4.win7bak.vhd不存在自动选择启动硬盘上其它分区的非vhdwin7或XP系统
欢迎DIY完善


[ 本帖最后由 xiaoy 于 2011-1-2 23:40 编辑 ]

q67512 发表于 2011-1-3 09:21:12

额,对于只有一个分区的咋办呢呵呵。。。

xiaoy 发表于 2011-1-3 18:51:14

这个版本非常易于diy 打开IMG自己想怎么改就怎么改启动哪里分区哪个目录下的都非常好办

sgw888 发表于 2011-3-18 20:11:53

支持楼主。有时间学习一下。

2010forever倩 发表于 2011-3-18 22:41:50

呵呵 给力的工具 收下了

xiaoy 发表于 2011-3-18 23:26:24

现在已经修改为中文版  可引导任意分区WIN7目录下的VHD系统  如果不存在VHD系统则自动引导硬盘上安装的WIN7或XP系统即菜单0项 ,  菜单1.2项则是启动或快速还原公用版WIN7, 按3.4项隐藏菜单可引导或创建还原专用版VHD系统 
确实是个小玩意,也没有几个网友回帖,就没有发出来

现在把新版的menu.lst帖出来,喜欢的朋友可以自己修改  
debug off
command --set-path=(fd0)/grub/
fontfile (fd0)/grub/fonts
find --set-root --devices=h /ntboot.img
default 0
timeout 0
menuset 15 15 15 15 15 21 20 40 5 3 10
write 0x60000 0
insmod (fd0)/grub/WENV
find --devices=h /win7/win7.vhd && wenv set name=win7 && timeout 4

title 启动硬盘版Windows系统\n\t启动以普通方式安装在硬盘上的Windows。
slic (fd0)/asus.bin
errorcheck off
find --set-root --devices=h /ntldr && unhide && chainloader /ntldr
find --set-root --devices=h /bootmgr && unhide && chainloader /bootmgr
errorcheck on
boot

title 启动虚拟磁盘版Win7系统\n\t启动VHD版的Win7系统。
slic (fd0)/asus.bin
wenv get name || wenv set name=$input,请输入您的系统名称: || configfile (fd0)/menu.lst
wenv set tmp=/win7/${name}.vhd
wenv call find --set-root --devices=h ${tmp} || fallback --go 5
write --offset=0x4E74 (fd0)/boot/bcd b
wenv get tmp=0x600000
cat --locate=\\x2F --replace=\\x5C (md)0x3000+3
wenv call write --offset=0x7D72 (fd0)/boot/bcd *0x600000$
wenv call write --offset=0x82EA (fd0)/boot/bcd *0x600000$
WENV calc cur_drv=*0x82A0 & 127
WENV calc cur_pri=*0x829C>>16 & 65535
write 0x60004 0
write 0x60000 0
wenv call dd if=(hd${cur_drv})+1 of=(md) bs=1 count=4 skip=0x1b8 seek=0x60000
cat --length=0 ()-1
dd if=(md) of=(md) bs=1 count=8 skip=0x8290 seek=0x60008
cat --locate=\x2E\xB5\x41\x7D --replace=*0x60000 (fd0)/boot/bcd
cat --locate=\0\x7E\0\0 --replace=*0x60008 (fd0)/boot/bcd
find --set-root --devices=h /ntldr && hide
chainloader (fd0)/boot/bootmgr
boot

title 还原虚拟磁盘Win7系统\n\t快速还原VHD版Win7系统。
WENV call find --set-root --devices=h /win7/${name}.vhd || fallback --go 6
WENV call pause --wait=10 原Win7VHD系统中的资料将丢失! 取消还原请按ESC键。 || configfile (fd0)/menu.lst
diskid && wenv set part=*0x4ff00$
WENV call write --offset=0x19 (fd0)/autoexec.bat ${part}
write --offset=0x1a (fd0)/autoexec.bat .
WENV call write --offset=0x7c (fd0)/autoexec.bat ${name}.vhd
chainloader (fd0)/io.sys

#3
title
wenv set name=$input,请输入您的专用VHDWin7系统名称: || configfile (fd0)/menu.lst
fallback --go 1

#4
title
wenv set name=$input,请输入需要还原或新建的VHD版Win7系统名称: || configfile (fd0)/menu.lst
fallback --go 2

#5
title
pause 输入错误,按任意键返回选择菜单 && configfile (fd0)/menu.lst

#6
title
wenv check "${name}"<>"" || fallback --go 5
WENV call pause --wait=0 输入密码后将创建${name}的专用Win7VHD系统!
password =wuyou || fallback --go 5
WENV call find --set-root --devices=h /win7/win7vhd.bak || WENV call pause win7VHD系统的一键还原已被破坏,请联系XX电脑tel XXXXXX。&& chainloader (hd0)+1
diskid && wenv set part=*0x4ff00$
WENV call write --offset=0x19 (fd0)/autoexec.bat ${part}
write --offset=0x1a (fd0)/autoexec.bat .
WENV call write --offset=0x7c (fd0)/autoexec.bat ${name}.vhd && chainloader (fd0)/io.sys


还有个关键文件 就是autoexec.bat  

[ 本帖最后由 xiaoy 于 2011-3-18 23:30 编辑 ]

xiaoy 发表于 2011-3-18 23:35:50

还帖一个改写得很牵强的CMD 在WIN7PE对刚做好的WIN7。VHD进行差分或是保存用的
@echo off
color 1f
cls
:home
set part=
set /p part=输入win7.vhd所在盘符,默认为c,按q退出:
if "%part%"=="" set part=c
if "%part%"=="q" goto :esc
if not exist %part%:\win7\win7.vhd goto :retry
if not exist %part%:\win7\vhdparent.vhd goto :first
attrib %part%:\win7\vhdparent.vhd -h -s
cls
echo.
echo.
echo.                  【XX电脑win7 VHD系统专用还原/备分工具 】
echo.
echo.
echo.                                             tel:XXX
echo.
echo.                        1——瞬间还原
echo.
echo.                        2——保存修改
echo.
echo.                        3——退出
echo.
echo.
echo.                        默认为 1(瞬间还原)
echo.
SET choice=
SET /P choice=请选择(1/2/3):
if "%choice%"=="" set choice=1

IF /I '%choice:~0,1%'=='1' GOTO :recovery
IF /I '%choice:~0,1%'=='2' GOTO :save
IF /I '%choice:~0,1%'=='3' GOTO :esc

goto :choice

:save

echo.
echo.正在对Win7进行保存修改
echo.
echo select vdisk file="%part%:\win7\win7.vhd"> "%temp%\merge.txt" noerr
echo merge vdisk DEPTH=1 >> "%temp%\merge.txt"noerr
diskpart /s "%temp%\merge.txt"

echo create vdisk file="%part%:\win7\win7.vhd" parent="%part%:\win7\vhdparent.vhd" > "%temp%\create.txt"noerr
del /a /f /q "%part%:\win7\win7.vhd"
diskpart /s "%temp%\create.txt"

color 1f
cls
echo.
attrib %part%:\win7\vhdparent.vhd +h +s
echo.已成功完成对Win7的保存修改
echo.按任意键后回车 可继续执行其它操作
set t=
set /p t=直接按回车键将退出. . .
if not "%t%"=="" goto :choice
exit

:recovery
echo.
echo.正在还原Win7
echo.

echo create vdisk file="%part%:\win7\win7.vhd" parent="%part%:\win7\vhdparent.vhd" > "%temp%\create.txt"
del /a /f /q "%part%:\win7\win7.vhd"
diskpart /s "%temp%\create.txt"
attrib %part%:\win7\vhdparent.vhd +h +s
echo.Win7系统已还原,请重新启动计算机!
echo.按任意键后回车 可继续执行其它操作
echo.
set t=
set /p t=直接按回车键将退出. . .
if not "%t%"=="" goto :choice
exit

:retry
echo.输入的盘符中没有\win7\win7.vhd,请检查后再输入
goto :home

:first
attrib %part%:\win7\win7.vhd -h -s
ren %part%:\win7\win7.vhd vhdparent.vhd
echo create vdisk file="%part%:\win7\win7.vhd" parent="%part%:\win7\vhdparent.vhd" > "%temp%\create.txt"
diskpart /s "%temp%\create.txt"
echo.成功创建win7子vhd,按任意键退出
copy "%part%:\win7\win7.vhd" "%part%:\win7\win7vhd.bak"
attrib %part%:\win7\win7bak.vhd +h +s
attrib %part%:\win7\vhdparent.vhd +h +s
md "%part%:\win7\win7系统请勿删除..\"
pause

:esc
exit

HY 发表于 2011-3-19 18:43:30

先支持一下,学习了。

JacXPS 发表于 2011-3-23 23:17:03

很好用的引导工具!有空研究一下!

xiaoy 发表于 2011-7-3 19:44:31

无聊顶错帖了   
看到VHD有人讨论 本想把这个帖的连接链接过去的,结果发到此帖上了

[ 本帖最后由 xiaoy 于 2011-7-3 19:46 编辑 ]

Plantsoot 发表于 2011-7-3 21:55:07

回复 #10 xiaoy 的帖子

EISA隐藏分区的有办法吗?我没测试上面的代码。

xiaoy 发表于 2011-7-4 13:25:20

完全没有问题 
批处理中是用
echo omnifs copy %part%:\win7\win7vhd.bak %part%:\win7\            >a:\vhd.bat
call a:\vhd.bat
来复制VHD的


完整的发上来了,如下方式引导
title 启动Windows
map --mem /ntboot.img (fd0)
map --hook
configfile (fd0)/menu.lst

希望修改得更好的朋友再发上来,也期望有朋友利用新版的NTBOOT来进行修改,把XPVHD一起弄好,我这个东西有三个月没有用了。

[ 本帖最后由 xiaoy 于 2011-7-4 13:40 编辑 ]

zhrmghg117 发表于 2011-7-4 14:24:55

研究中 感谢 楼主

qj_tzy 发表于 2011-7-10 15:58:19

回复 #12 xiaoy 的帖子

我的VHD系统及其子VHD均取为长文件名,请问以上工具是否支持长文件名。

xiaoy 发表于 2011-7-10 23:13:53

omnifs应该支持长文件名的吧

zhrmghg117 发表于 2011-7-25 19:24:00

多谢收下了 慢慢研究

wanghh 发表于 2011-10-27 20:01:53

☆۩۞۩☆【谢谢提供!】 ☆۩۞۩☆

amei 发表于 2011-10-28 05:42:43

汗 今天才知道 原来还有一个 omnifs copy
以前做使用ntdos 做过先进dos 不重启 再进xp

icons 发表于 2011-10-28 23:14:35

楼主帮忙看看我这样为什么覆盖不成功?
AUTOEXEC.BAT
--------
@ECHO OFF
cls
set part=   
echo Please wait a while...
      
echo omnifs copy %part%:\vhd\win7_child_bak.vhd %part%:\vhd\            >a:\vhd.bat
call a:\vhd.bat

      
GRUB --time-out=0 --config-file=(fd0)/menu.lst

===========================
menu.lst
-----

debug off
default 0
timeout 5
command --set-path=(fd0)/grub/
write 0x60100 7
write 0x60000 0
insmod (fd0)/grub/WENV

title Windows 7 VHD
savedefault
slic (fd0)/asus.bin
wenv get name || wenv set name=win7_child
wenv set tmp=/vhd/${name}.vhd
wenv call find --set-root --devices=h ${tmp}
write --offset=0x4E74 (fd0)/boot/bcd b
wenv get tmp=0x600000
cat --locate=\\x2F --replace=\\x5C (md)0x3000+3
wenv call write --offset=0x7D72 (fd0)/boot/bcd *0x600000$
wenv call write --offset=0x82EA (fd0)/boot/bcd *0x600000$
WENV calc cur_drv=*0x82A0 & 127
WENV calc cur_pri=*0x829C>>16 & 65535
write 0x60004 0
write 0x60000 0
wenv call dd if=(hd${cur_drv})+1 of=(md) bs=1 count=4 skip=0x1b8 seek=0x60000
cat --length=0 ()-1
dd if=(md) of=(md) bs=1 count=8 skip=0x8290 seek=0x60008
cat --locate=\x2E\xB5\x41\x7D --replace=*0x60000 (fd0)/boot/bcd
cat --locate=\0\x7E\0\0 --replace=*0x60008 (fd0)/boot/bcd
find --set-root --devices=h /ntldr && hide
chainloader (fd0)/boot/bootmgr
boot

title Rebuild Windows 7 VHD
wenv set name=win7_child
WENV call find --set-root --devices=h /vhd/${name}.vhd
diskid && wenv set part=*0x4ff00$
WENV call write --offset=0x19 (fd0)/autoexec.bat ${part}
write --offset=0x1a (fd0)/autoexec.bat .
WENV call write --offset=0x7c (fd0)/autoexec.bat ${name}.vhd
chainloader (fd0)/io.sys

wanghh 发表于 2011-11-2 18:05:01

我不知为何无法进入这个画面。

xiaoy 发表于 2011-11-2 21:49:55

那是第一版本,好像后面发的有改变,关键是GRUB的菜单编写太累 ,没有跟进。 希望有写GRUB菜单的高手来接手这个事情,利用NTOOT可以做出很好的VHD工具出来,就是我希望的功能: 1,一个用户一个差分的系统,互不影影响,每个用户的C盘看上去都是独立的,但都源自一个父本。2.每个用户可根据需要快速还原自己的系统,其实就是将备份的差分文件替换一次。
反正所有的方法就是修改NTBOOT引导DOS,OMNIFS复制替换文件   。这两天在忙学校RAMOS的事情,本来就想把学校改为VHD WIN7,给每个学生一个独立的系统,也可以让他们秒秒钟还原。 现在正在着手换成RAMOS XP,哎 就是编写GRUB菜单太累。C大的一个NTBOOT,一个硬盘工具箱,ZXW的一个RUN,P大的一个OPE菜单都看得人头皮发麻。罢了罢了。

wanghh 发表于 2011-11-3 07:15:13

不错!谢谢!现在可以进入画面了。

wanghh 发表于 2011-11-3 19:07:52

启动后不知为何会修改硬盘盘符?

wanghh 发表于 2011-11-3 19:16:36

原帖由 wanghh 于 2011-11-3 19:07 发表 http://bbs.wuyou.net/images/common/back.gif

启动后不知为何会修改硬盘盘符?

启动VHD将自动隐藏HD0,0引起的.
能不能不隐藏HD0,0

xiaoy 发表于 2011-11-3 21:47:04

可以啊,最多加一句 hide(hd0,0)

wanghh 发表于 2011-11-3 22:03:46

原帖由 xiaoy 于 2011-11-3 21:47 发表 http://bbs.wuyou.net/images/common/back.gif
可以啊,最多加一句 hide(hd0,0)


是加在GRUB4DOS的菜单上吗?

改成这样?
title 启动Windows
map --mem /ntboot.img (fd0)
map --hook
hide(hd0,0)
configfile (fd0)/menu.lst

wanghh 发表于 2011-11-4 06:54:02

menu.lst  
debug off
command --set-path=(fd0)/grub/
fontfile (fd0)/grub/fonts
find --set-root --devices=h /ntboot.img
default 0
timeout 0
menuset 15 15 15 15 15 21 20 40 5 3 10
write 0x60000 0
insmod (fd0)/grub/WENV
find --devices=h /win7/win7.vhd && wenv set name=win7 && timeout 4

title 启动硬盘版Windows系统\n\t启动以普通方式安装在硬盘上的Windows。
slic (fd0)/asus.bin
errorcheck off
find --set-root --devices=h /ntldr&& chainloader /ntldr
find --set-root --devices=h /bootmgr&& chainloader /bootmgr
errorcheck on
boot

title 启动虚拟磁盘版Win7系统\n\t启动VHD版的Win7系统。
slic (fd0)/asus.bin
wenv get name || wenv set name=$input,请输入您的系统名称: || configfile (fd0)/menu.lst
wenv set tmp=/win7/${name}.vhd
wenv call find --set-root --devices=h ${tmp} || fallback --go 5
write --offset=0x4E74 (fd0)/boot/bcd b
wenv get tmp=0x600000
cat --locate=\\x2F --replace=\\x5C (md)0x3000+3
wenv call write --offset=0x7D72 (fd0)/boot/bcd *0x600000$
wenv call write --offset=0x82EA (fd0)/boot/bcd *0x600000$
WENV calc cur_drv=*0x82A0 & 127
WENV calc cur_pri=*0x829C>>16 & 65535
write 0x60004 0
write 0x60000 0
wenv call dd if=(hd${cur_drv})+1 of=(md) bs=1 count=4 skip=0x1b8 seek=0x60000
cat --length=0 ()-1
dd if=(md) of=(md) bs=1 count=8 skip=0x8290 seek=0x60008
cat --locate=\x2E\xB5\x41\x7D --replace=*0x60000 (fd0)/boot/bcd
cat --locate=\0\x7E\0\0 --replace=*0x60008 (fd0)/boot/bcd
find --set-root --devices=h /ntldr
chainloader (fd0)/boot/bootmgr
boot

title 还原虚拟磁盘Win7系统\n\t快速还原VHD版Win7系统。
WENV call find --set-root --devices=h /win7/${name}.vhd || fallback --go 6
WENV call pause --wait=10 原Win7VHD系统中的资料将丢失! 取消还原请按ESC键。 || configfile (fd0)/menu.lst
diskid && wenv set part=*0x4ff00$
WENV call write --offset=0x19 (fd0)/autoexec.bat ${part}
write --offset=0x1a (fd0)/autoexec.bat .
WENV call write --offset=0x7c (fd0)/autoexec.bat ${name}.vhd
chainloader (fd0)/io.sys

#3
title
wenv set name=$input,请输入您的专用VHDWin7系统名称: || configfile (fd0)/menu.lst
fallback --go 1

#4
title
wenv set name=$input,请输入需要还原或新建的VHD版Win7系统名称: || configfile (fd0)/menu.lst
fallback --go 2

#5
title
pause 输入错误,按任意键返回选择菜单 && configfile (fd0)/menu.lst

#6
title
wenv check "${name}"<>"" || fallback --go 5
WENV call pause --wait=0 输入密码后将创建${name}的专用Win7VHD系统!
password =wuyou || fallback --go 5
WENV call find --set-root --devices=h /win7/win7vhd.bak || WENV call pause win7VHD系统的一键还原已被破坏,请联系XX电脑tel XXXXXX。&& chainloader (hd0)+1
diskid && wenv set part=*0x4ff00$
WENV call write --offset=0x19 (fd0)/autoexec.bat ${part}
write --offset=0x1a (fd0)/autoexec.bat .
WENV call write --offset=0x7c (fd0)/autoexec.bat ${name}.vhd && chainloader (fd0)/io.sys

[ 本帖最后由 wanghh 于 2011-11-4 11:33 编辑 ]

xiaoy 发表于 2011-11-4 13:29:53

就在以上chainloader 之前加HIDE

wanghh 发表于 2011-11-8 06:56:01

这个还原无法真正还原。

wanghh 发表于 2011-11-9 21:27:47

用了几天,WIN7变成未激活版本了。
页: [1] 2
查看完整版本: VHD还原工具之NTBOOT修改版