|
近来论坛部分Win7PE爱好者讨论PECMD不能完全代替Wpeinit.exe的问题,否则会出现网络不正常的现象。其实以PECMD提供的命令是
可以做到的。以下是WinPeShl,WpeInit程序运行的大致流程,聪明的你很快就会把它改成PECMD的配置文件吧。
------------------------------------------------------------------------------------------------------------
WinPeShl.exe:
wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
if ( QueryRegValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\microsoft\\windows nt\\currentversion\\WinPE", L"ShellLogPath") )
CreateLogFile( );
else
CreateLogFile(L"winpeshl.log");
Message("Windows PE Shell beginning execution");
SetCursors();
InitSys();
LoadExec(L"%SystemRoot%\\system32\\winpeshl.ini")
}
InitSys()
{
LoadLocalFonts();
QueryRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\WinPE", L"CustomBackground") )
SystemParametersInfoW();
WpeInstallServicePrivileges();
WpeInstallServicesSecurityTemplate();
hObject = CreateEventW((LPSECURITY_ATTRIBUTES)v9, 1, v9, L"Global\\EVENT_WINPE_REMSTOR");
hHandle = CreateThread((LPSECURITY_ATTRIBUTES)v9, v9, StartAddress, (LPVOID)v9, v9, &ThreadId);
result = (void *)QueryRegValue01(
HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger\\WinPEFileTrace",
L"Start");
if ( result )
{
v30 = v9;
sub_1006847(67108864, L"Profiling is enabled; initializing run-time profiler.", ST18_4_0);
result = CreateThread((LPSECURITY_ATTRIBUTES)v9, v9, SerializeAppProfile, (LPVOID)v9, v9, &v30);
dword_100B040 = (int)result;
}
}
-----------------------------------------------------------------------------------------------------------------------
WpeInit.exe:
int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
if ( lpCmdLine )
UnattendFindFileFromCmdLine();
else
{
wttime = GetTickCount();
WpeWaitForRemovableStorage();
Waitime = GetTickCount() - wttime;
hLogFile = XLOG(L"wpeinit.log");
if (UnattendFindAnswerFile()){
//Checkit;
}
else
WriteLog(hLogFile,"No unattend file was found; WPEINIT is using default settings to initialize WinPE" );
if ( Waitime )
WriteLog(hLogFile, "Spent Waitime%ums initializing removable media before unattend search" );
}
result = WpeActuateUnattendSettings();
//CleanUp
return result;
}
-----------------------------------------------------------------------------------------------------------------------
WpeUtil.Dll:
WpeActuateUnattendSettings()
{
UnattendDisplay();
UnattendCompterName();
UnattendPageFile();
UnattendOC();
UnattendNet();
UnattendFireWall();
UnattendRunSynchronous();
UnattendRunASyncs();
UnattendRestart();
}
UnattendNet()
{
if(NetNotEnable == WpeQueryNetworkStatus()
MyInitNetWork();
}
MyInitNetWork()
{
WpeInitializeNetworkComponents();
WpeInitializeNetworkDrivers();
}
WpeInitializeNetworkComponents()
{
Install MS_MSCLIENT
Install MS_NETBIOS
Install MS_SMB
Install MS_TCPIP6
Install MS_TCPIP
StartService dhcp
StartService lmhosts
StartService ikeext
StartService mpssvc
//lanmanStation...
}
WpeInitializeNetworkDrivers()
{
WpeInitializeDriversOfClass();
}
WpeInitializeDriversOfClass(int a1, int a2)
{
//EnumDevice then DiInstallDevice();
} |
|