Chinaunix首页 | 论坛 | 博客
  • 博客访问: 96876
  • 博文数量: 21
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 194
  • 用 户 组: 普通用户
  • 注册时间: 2014-10-26 22:04
个人简介

大家好,我叫王大锤!

文章分类

全部博文(21)

分类: WINDOWS

2015-05-04 22:12:54

    刚刚windows 8开机的时候发现蓝屏了,可吓坏了。。一闪就重新启动了,都没看到提示,又启动了两次都是蓝屏一闪就重启。。
然后F8->9 禁用蓝屏重启,发现错误提示是phase1_initialization_failed 。
然后上MSDN搜了一下结果是这样的:

Error Message:

STOP: 0x00000032 (parameter, parameter, parameter, parameter) PHASE1_INITIALIZATION_FAILED

Explanation:

This is a Windows 2000 Executive character-mode STOP message. Initialization of the Windows 2000 Executive failed during phase 1 (during phase 4 of system startup). There might be a problem with a device driver.

User Action:

If this is the first time you have booted after installing new hardware, remove the hardware and boot again. Check the Microsoft Hardware Compatibility List to verify that the hardware and its drivers are compatible with Windows 2000. For information about the hardware, contact the supplier. If you are installing Windows 2000 for the first time, check the Windows 2000 system requirements, including the amount of RAM and disk space required to load the operating system. Also, check the Hardware Compatibility List to verify that the system can run Windows 2000. If Windows 2000 is loaded and no new hardware has been installed, reboot with recovery options set to create a dump file. If the message continues to appear, select the Last Known Good option when you reboot. If there is no Last Known Good configuration, try using the Emergency Repair Disk. If you do not have an Emergency Repair Disk, contact your technical support group.


看着半毛钱关系没有啊。。网上有人说是驱动问题,可是Phase1Initialization阶段又不是加载驱动。。
    直觉这货和休眠有关系,就进了windows 10 (由于学习原因,我电脑装了3个系统,redhat+win8+win10)把win8系统目录下的休眠文件删掉了(其实为了保险起见应该剪切而不是直接删掉,删错指不定就跪了),删了三个:Pagefile.sys(虚拟内存文件),Hiberfil.sys(休眠时将内存中的数据会保存到这里),Swapfile.sys(与Pagefile.sys相似。重新启动,进windows8,终于看到了亲切的转圈!!

问题解决了,顺便查了查windows的启动过程:
    cpu加电复位 -> post(Power on self test) -> bios -> mbr(main boot record) -> 引 导扇区(由操作系统安装时候写好) -> NTLDR -> NTOSKRNL(此时出现windows启动画面) -> SMSS(第一个进程) -> CSRSS, WinLogon WinLogon -> LSASS, Services, LogonUI Services -> SvcHost LogonUI -> UserInit -> Shell(Explorer), Autorun app,然后启动完毕。

系统根目录最重要文件:NTLDR,boot.ini,NTDETECT.com
Windows Vista 用注册表取代了Boot.ini

NTLDR:
使CPU从16位进入32位保护模式
启用CPU的页机制(可以提供虚拟内存机制)
若是SCSI硬盘,则加载BtBootDD.sys访问硬盘,否则使用Int13 BIOS服务访问硬盘
若发现有效的hiberfil.sys,则恢复上次休眠
读取boot.ini(多启动菜单)
若用户按F8则出现详细启动菜单
加载NTDETECT.com(基本硬件检测),调用BIOS收集系统基本信息(时间,总线类型,磁
盘,输入设备,端口,显卡),保存到注册表HKLM\hardware\description
显示启动进度条(那个文本小箭头)和Splash(XP 滚动条画面)
加载NTOSKRNL.exe和HAL.dll,以及它们依赖的模块(bootvid.dll, kdcom)
加载注册表的System Hive(!),并加载驱动程序(加载那些被定义为boot类型--ser
vice_boot_start(0) 的驱动)
执行NTOSKRNL.exe的入口函数


NTOSKRNL:windows内核,且又是一个提供外部函数的DLL(?)
其入口函数为KeStartAllProcessors()启动所有的CPU
对于每个CPU,设置其GDT(Global Descriptor Table),IDT(Interrupt Descriptor T
able),TSS(Task State Segment)
分配用于处理Double Fault异常(异常处理过程中的异常)的TSS和Stack
分配用于处理不可屏蔽中断NMI的TSS和Stack
分配DPC栈(延迟过程调用)
将ProcessorState的ContextFrame Struct 的EIP字段指针设置为KiSystemStartup函数的
地址
调用KiInitializePcr()初始化PCR(Processor Control Region 用来记录CPU状态)和PR
CB(Processor Control BLOCK)
调用HalStartNextProcessor()


KiSystemStartup()
{
先递增KeNumberProcessors全局变量;
HalInitializeProcessor();  // 初始化CPU
KdInitSystem(); // Kernel Debug 子系统初始化(内核调试引擎,用于双机调试)
KiInitializeKernel() // 初始化内核数据结构,创建IDLE进程,启动初始化执行体的循

{
KiInitSystem();
KeInitializeProcess(); // 初始化Idle进程
// 仅第一个CPU需要执行上两步


KeInitializeThread(); // 初始化Idle线程


ExpInitializeExecutive() // 
{
foreach()
{
各个执行体的Phase0的初始化函数(?);
}
}
}
此时将IRQL(中断优先级?)降到DISPATCH_LEVEL,然后跳转到KiIdleLoop(),退化成I
dle进程;
}


Phase0的初始化:
只有CPU 0 执行,此时为单线程环境
由进程管理器的Phase0初始化时创建系统进程,当Phase0执行完毕,执行Phase1Initiali
zation,也就是系统线程。(Phase1执行时间比较慢,此时是XP 滚动条画面)
Phase1为多线程环境,Phase1结束后,执行SMSS,到此,内核执行基本完毕
全局变量InitializationPhase代表当前所处阶段,启动成功后等于2
ExpInitializeExecutive()函数中初始化的组件有:(名称后面是它们的初始化函数)
内存管理器 - 构建页表和内部数据结构
对象管理器 - ObInitSystem,建立名称空间
安全 - SeInitSystem,初始化token对象类型
进程管理器 - PsInitSystem
定义进程和线程对象类型
建立用于记录活动进程和线程的链表结构(PsActiveProcessHead,)
为初始的进程建立一个进程对象(PsIdleProcess),并命名为Idle
创建系统进程(全局变量PsInitialSystemProcess)和线程,起始地址指向Phase1Initi
alization函数
PnP管理器


Phase1Initialization: 0%-%5
HalInitSystem()
HalpInitReservedPages
HalpInitNonBusHandler
HalpGetFeatureBits
HalpEnableInterruptHandler
InbvEnableBootDriver
InbvEnableDisplayString(0)
DisplayBootBitmap
PoInitSystem
Hal!HalQueryRealTimeClock
KeSetSystemTime
PoNotifySystemTimeSet
nt!InbvUpdateProgressBar(5)


Phase1Initialization: 5%-10%
ObInitSystem
ExInitSystem:创建执行体的内核对象类型(Semaphore,mutex,event,timer)
KeInitSystem:初始化线程调度的数据结构和系统服务分发表
KdInitSystem:初始化内核调试引擎的数据链表,全局变量
SeInitSystem:创建Security目录
nt!InbvUpdateProgressBar(10)


Phase1Initialization: 10%-15%
MmInitSystem:创建Section对象和内存管理的系统工作线程
CcInitlizeCacheManager:初始化文件系统缓存数据结构和工作线程
CmInitSystem1:配置管理器创建Registry对象
CcPInitializePrefecthcer:Prefetch初始化
nt!InbvUpdateProgressBar(15)


Phase1Initialization: 15%-20%
ExpRefreshTimeZoneInformation;设置时区
FsRtlInitSystem:文件系统初始化
KdDebuggerInitialize1
PpInitSystem:PnP管理器初始化
nt!InbvUpdateProgressBar(20)


Phase1Initialization: 20%-25%
LpcInitSystem:Local Procedure Call 子系统
创建日志文件 System32\Ntbtlog.txt
nt!InbvUpdateProgressBar(25)


Phase1Initialization: 25%-75%
IO管理器初始化并枚举设备,加载设备驱动
IOInitSystem
nt!InbvUpdateProgressBar(75)


Phase1Initialization: 75%-80%
MmInitSystem2:释放启动过程中使用的内存,若是以安全模式启动,则此信息写入注册表


nt!InbvUpdateProgressBar(80)


Phase1Initialization: 80%-85%
Kel386VdmInitialize:DOS虚拟机初始化
KiLogMcaErrors:检查和记录Machine Check Architecture
PoInitSystem1:电源管理器阶段1初始化
PsInitSystem1:进程管理器阶段1初始化,调用PspInitializeSystemDll初始化系统DLL(
ntdll.dll),将其映射到用户空间(PspMapSystemDLL)
nt!InbvUpdateProgressBar(85)


Phase1Initialization: 85%-90%
MmFreeLoaderBlock:释放加载参数块(LOADER_PARAMETER_BLOCK struct)
SeRmInitPhase1:Security Reference Monitor Phase1 初始化,创建用于和LSASS进程通
信的Command Server Thread线程
nt!InbvUpdateProgressBar(90)


Phase1Initialization: 90%-100%
RtlCreateUserProcess:创建SMSS进程!
FinalizeBootLogo
ZwResumeThread:挂起当前线程
nt!InbvUpdateProgressBar(100
InbvEnableDisplayString(1)
ZwWaitForSingleObject:等待5分钟,若5秒内SMSS退出,则蓝屏
此后这个线程转变为Zero Page




SMSS:
第一个用户态进程
执行BootExecute表键中定义的程序
执行PendingFileRenameOperation表键中的延迟改名操作(卸载软件用?)
初始化Paging File和未完成的注册表初始化
加载和初始化Win32子系统的内核模块Win32k.sys
创建Win32子系统服务器进程:CSRSS
创建WinLogon进程


WinLogon:
启动LSASS进程
(XP下)启动LogonUI进程
加载GINA模块(缺省为MSGINA.dll),显示登陆对话框(GINA可以自己配置,hiahia)
启动Services.exe


登陆过程:
WinLogon(Gina.dll)将用户名和密码发送给LSASS,LSASS验证,如果通过,创建一个To
ken对象
WinLogon启动HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Wi
nlogon的userInit键值下的程序(缺省为UserInit.exe)
UserInit执行登陆和初始化脚本,然后启动Shell键值中定义的shell程序(默认Explorer
.exe)
Explorer来到桌面


阅读(22745) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~