Win7调试模式问题一例

BootMgr的引入,虽然增加了操作及维护的复杂度,但相应带来的好处也不少,就比如我曾做过的一次操作:将Win7系统从第一分区移动至第三分区。这样的操作在XP时代,是不太可能的,因为这就意味着盘符的改变,系统内部配置都是以盘符来确定的,而Win7始终将系统盘加载至C:上。

将Win7移动后,修改BootMgr记录中的device及osdevice项后,Win7系统便能正常启动,相应命令如下:

bcdedit /set {uuid} device=partitioin=X:
bcdedit /set {uuid} osdevice=partitioin=X:

然后将debug模式打开:

bcdedit /debug {uuid} on

然后再设置dbgsettings为1394,而不是默认的com串口:

C:\>bcdedit /dbgsettings
An error occurred while attempting to access the boot configuration data.
The system cannot find the file specified.

系统中竟没有dbgsettings,那就自己创建好了:

C:\>bcdedit /create {dbgsettings}
The entry {dbgsettings} was successfully created.
C:\>bcdedit /dbgsettings
There are no debugger settings present.
The operation completed successfully.
C:\>bcdedit /dbgsettings 1394 channel:11
The operation completed successfully.
C:\>bcdedit /dbgsettings
debugtype               1394
channel                 11
The operation completed successfully.

设置好生重启系统,但wndbg死活就是连不上。但同样的硬件,用XP启动windbg确实能正常,所以排除了线材、硬件问题,还是要从Win7系统着手。

经过详细对比正常系统的BootMgr设置后,发现是dbgsettings虽设好了,但并没有关联到Win7启动项上。那就做一下关联试试:

C:\>bcdedit /create {globalsettings}
The entry {globalsettings} was successfully created.
C:\>bcdedit /set {globalsettings}  inherit {dbgsettings}
The operation completed successfully.
C:\>bcdedit /set {current} inherit {globalsettings}
The operation completed successfully.

重启系统后,windbg便能正常连接了。

挺简单的事,非要搞得这么复杂!难怪简单的苹果产品却赢得了如此多用户的芳心!?

Windows Boot Manager 语言设置

Windows Boot Manager显示中文有些夸张,特别是中英文混合使用的时候,中文菜单项总是显得很长很长。

其实改成英文的很方便:

bcdedit /set {bootmgr} locale “en-US”

当然还要改所有含有中文的菜单项,不妨给它们起个英文名,如将”较早版本的Windows”改成“Windows XP”:

bcdedit /set {ntldr} description “Windows XP”

恼人的bootmgr

我有一台专门运行vmware的host server,差不多所有的开发/调试都在此机器上进行。但上面存储的东西越来越多,原来的80G硬盘容不下了。正好用空闲下来的的200G的盘来替换原来的80G的。共两个分区:第一个分区是xp i386,第二个分区是server 2008 x64。移动数据很简单,不二的选择就是ghost。但ghost后的问题却是意料之外的。

ghost移动数据花了近两个小时。之后用新的硬盘来启动,结果bootmgr提示出错: winload.exe报0xc000000e。试了几种办法,包括用系统盘进行recovery/修复,但都不见效。

无奈之下重新挂上原来的硬盘,枚举所有的boot配置,然后与ghost后的配置进行比对,终于发现问题原由:设备盘符不对。枚举命令如下(可启动PE运行,也可以用VistaBootPro导出): bcdedit /enum all

错误的配置: Windows Boot Loader

identifier {default} device partition=D: path \Windows\system32\winload.exe description Microsoft Windows Server 2008 locale en-US inherit {bootloadersettings} osdevice boot systemroot \Windows resumeobject {48c4f6e7-1e4e-11de-b96b-dfd52951c806} nx OptOut custom:250000f0 0 detecthal Yes

Resume from Hibernate

identifier {48c4f6e7-1e4e-11de-b96b-dfd52951c806} device partition=F: path \Windows\system32\winresume.exe description Windows Resume Application locale en-US inherit {resumeloadersettings} filedevice partition=F: filepath \hiberfil.sys debugoptionenabled No

Windows Legacy OS Loader

identifier {ntldr} device partition=C: path \ntldr description Earlier Version of Windows

原来盘上的配置: Windows Boot Loader

identifier {default} device partition=D: path \Windows\system32\winload.exe description Microsoft Windows Server 2008 locale en-US inherit {bootloadersettings} osdevice partition=D: systemroot \Windows resumeobject {48c4f6e7-1e4e-11de-b96b-dfd52951c806} nx OptOut custom:250000f0 0

Resume from Hibernate

identifier {48c4f6e7-1e4e-11de-b96b-dfd52951c806} device partition=D: path \Windows\system32\winresume.exe description Windows Resume Application locale en-US inherit {resumeloadersettings} filedevice partition=D: filepath \hiberfil.sys debugoptionenabled No

Windows Legacy OS Loader

identifier {ntldr} device partition=C: path \ntldr description Earlier Version of Windows

知道症结所在之后,修复的问题就好办了: bcdedit /set {default} device "partition=D:" bcdedit /set {default} osdevice "partition=D:" bcdedit /set {48c4f6e7-1e4e-11de-b96b-dfd52951c806} device "partition=D:" bcdedit /set {48c4f6e7-1e4e-11de-b96b-dfd52951c806} filedevice "partition=D:"

重启后问题解决!真不知道微软怎么想的,原来的boot.ini既明了又方便,非得再搞个bootmgr出来。并且bootmgr出的问题总是莫名其妙,搞得用户摸不着方向,真是出力不讨好!