рд╣рдо рддреГрддреАрдп-рдкрдХреНрд╖ рд╕реЙрдлрд╝реНрдЯрд╡реЗрдпрд░ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдП рдмрд┐рдирд╛ Windows NT 6.0+ рдХреЗ рдХрдИ рд╕рдВрд╕реНрдХрд░рдгреЛрдВ рдХреЗ рд╕рд╛рде рдЗрдВрд╕реНрдЯреЙрд▓реЗрд╢рди рдореАрдбрд┐рдпрд╛ рдмрдирд╛рддреЗ рд╣реИрдВ

KDPVрдирдорд╕реНрддреЗ рдЖрдЬ рдореИрдВ рдЖрдкрдХреЛ рдмрддрд╛рдКрдВрдЧрд╛ рдХрд┐ рдХреИрд╕реЗ рдЖрдк рддреГрддреАрдп-рдкрдХреНрд╖ рд╕реЙрдлрд╝реНрдЯрд╡реЗрдпрд░ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд┐рдП рдмрд┐рдирд╛ рд╡рд┐рдВрдбреЛрдЬ рдХреЗ рдХрдИ рдЕрд▓рдЧ-рдЕрд▓рдЧ рд╕рдВрд╕реНрдХрд░рдгреЛрдВ рдХреЗ рд╕рд╛рде рдПрдХ рдПрдХрд▓ рд╕реНрдерд╛рдкрдирд╛ рдореАрдбрд┐рдпрд╛ рдмрдирд╛ рд╕рдХрддреЗ рд╣реИрдВред рдЗрд╕ рдкреНрд░рдХрд╛рд░, рдЖрдк рдкреВрд░реА рддрд░рд╣ рд╕реЗ рд╕рдордЭ рдкрд╛рдПрдВрдЧреЗ рдХрд┐ рд╣рдо рдХреНрдпрд╛ рдЬреЛрдбрд╝-рддреЛрдбрд╝ рдХрд░рддреЗ рд╣реИрдВред


рдореИрдВ рдпрд╣ рднреА рдЬреЛрд░ рджреВрдВрдЧрд╛ рдХрд┐ рдЬрд┐рддрдирд╛ рд╕рдВрднрд╡ рд╣реЛ рдЙрддрдирд╛ рдХрдо рд╣реЛ рдПрдиреНрдЯреНрд░рд╛рдкреА рдЗрд╕ рджреБрдирд┐рдпрд╛ рдореЗрдВ рд▓рд╛рддреЗ рд╣реИрдВ .


тАФ .


 



Windows NT 6.0+ USB . , тАФ USB-HDD. ( USB тАФ ).
Windows тАФ . .. :
 


[boot]
[sources]
bootmgr

UEFI (, GPT- ), тАФ [efi].


. ? , Windows ! - Win8, Win7 , - ...


ISO- (, Win 8.1 x64). [sources] [sources_w8x64]. ISO- [sources], . . . :
 


[boot]
[sources]
[sources_w7x86]
[sources_w8x64]
[sources_w8x86]
bootmgr

- , , Windows [sources].


. , . , . тАФ LBA, MBR, .. , : , , .. , Windows 10! ! - : 10-, . Media Creation Tool 10-. . , . Visual Studio . :
 


[boot]
[sources]
[sources_w7x64]
[sources_w7x86]
[sources_w8x64]
[sources_w8x86]
[sources_w10x86]
bootmgr

:


!

, , .
: Grub4Dos , ISO, ISO, WinPE, ISO (.. - ), тАж , ! тАФ USB-HDD, , , тАж тАФ .


, : ISO-, тАж тАж
, .


 




ISO, . ISO ( ), , Windows , (. ).
 
Windows AiO ( sources\install.wim ), , :



    • FAT32, UEFI
  • ( , )
  • , , , Win7 Win10 ( )

рдПрдХ рдмрд╛рдд рдФрд░ , , . , . тАФ !
 
 




- :


  • FAT32
  • exFAT
  • NTFS

FAT32: , UEFI. : тАФ 4 .
exFAT: , UEFI . , (, Grub4Dos) . BOOTMGR . Upd: , Live Linux ISO .
NTFS: , , UEFI .


:
UEFI тАФ FAT32, тАФ NTFS.


.
: , . - ;)
 
 



, (, ...).
USB-HDD .


USB-HDD :
(diskmgmt.msc). USB-HDD " ". тАФ .


. " " . :
(cmd.exe). :
 


DiskPart
list disk
select disk <   (      )>
list part
select part < ,     ( 1)>
active
exit

DiskPart

. . .
 
 




Windows


. :
 


[boot]
[efi] -      UEFI (    FAT32! (      NTFS))
bootmgr
bootmgr.efi -      UEFI (    FAT32! (      NTFS))

тАФ Windows 10 x64 (Threshold 2).


.
тАФ Windows Boot Manager c . тАФ - , [sources]. , bootmgr .
Windows Boot Manager, , BOOTMGR. , bootsect /nt60 <_>:, <_> тАФ .
 
 



[sources]. , [sources] Windows . . . :
 


[WinDists]
 |- [Win_7_ia32]
 |- [Win_7_x64]
 |- [Win_8.1_ia32]
 |- [Win_8.1_x64]
 |- [Win_10_ia32]
 |- [Win_10_x64]

[sources] ISO-. . тАФ .
 
 




, . .. . , Windows.


, ? . :
 


[boot]
 |- bcd
[efi]
 |- [microsoft]
     |- [boot]
         |- bcd -      UEFI (    FAT32! (      NTFS))


BCD


. , ( , ! тЧХтА┐тЧХ).
:
 


bcdedit /store <_>:\boot\bcd /set {bootmgr} DisplayBootMenu True
bcdedit /store <_>:\boot\bcd /deletevalue {bootmgr} Timeout

<_> тАФ .


.
bcdedit /store <_>:\boot\bcd /enum {default}
device osdevice -. :


device      ramdisk=[boot]\sources\boot.wim,{<GUID  ramdisk>}
osdevice    ramdisk=[boot]\sources\boot.wim,{<GUID  ramdisk>}

, .
Windows c WinPE (boot.wim), <GUID ramdisk>. .
 


device , \windows\system32\boot\winload.exe ( path).
osdevice , \windows ( systemroot).


device osdevice WIM- ( WinPE), (ramdisk). GUID , , WinPE ( тАФ ramdisk). :


bcdedit /store <_>:\boot\bcd /enum {<GUID  ramdisk>}

 
-------------------
           {<GUID  ramdisk>}
ramdisksdidevice        boot
ramdisksdipath          \boot\boot.sdi

. .


boot.sdi тАФ - NTFS-. boot.wim.


- ( device osdevice), .
 



  1. -:
    bcdedit /store <_>:\boot\bcd /copy {Default} /d "< >"
    GUID . :
    {<GUID >}
     
  2. :
    bcdedit /store <_>:\boot\bcd /set {<GUID >} device ramdisk=[boot]\< >\boot.wim,{<GUID ramdisk>}
     
    bcdedit /store <_>:\boot\bcd /set {<GUID >} osdevice ramdisk=[boot]\< >\boot.wim,{<GUID ramdisk>}
     
    ().

-.
! GUID-. .


bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 7 (32-bit) Setup"
    {90fff3ef-3b91-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {90fff3ef-3b91-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_7_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {90fff3ef-3b91-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_7_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 7 (64-bit) Setup"
    {e5f9b9b7-3bb1-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {e5f9b9b7-3bb1-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_7_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {e5f9b9b7-3bb1-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_7_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 8.1 (32-bit) Setup"
    {cda5bc88-3bb4-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {cda5bc88-3bb4-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_8.1_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {cda5bc88-3bb4-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_8.1_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 8.1 (64-bit) Setup"
    {330e8636-3bb5-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {330e8636-3bb5-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_8.1_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {330e8636-3bb5-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_8.1_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 10 (32-bit) Setup"
    {87c0826c-3bb5-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {87c0826c-3bb5-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_10_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {87c0826c-3bb5-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_10_ia32\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Windows 10 (64-bit) Setup"
    {dd7288b2-3bb8-11e6-839b-d850e607fea0}.

bcdedit /store <_>:\boot\bcd /set {dd7288b2-3bb8-11e6-839b-d850e607fea0} device ramdisk=[boot]\WinDists\Win_10_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
bcdedit /store <_>:\boot\bcd /set {dd7288b2-3bb8-11e6-839b-d850e607fea0} osdevice ramdisk=[boot]\WinDists\Win_10_x64\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}

bcdedit /store <_>:\boot\bcd /copy {Default} /d "Other Windows Setup (from \sources)"
The entry was successfully copied to {c9ff9b3a-3c53-11e6-839c-d850e607fea0}.

 


BCD

, -:
bcdedit /store <_>:\boot\bcd /delete {default}


 


BCD UEFI


UEFI, (, BootMgFw.efi).


, BCD.
..
bcdedit /store <_>:\boot\bcd

bcdedit /store <_>:\efi\microsoft\boot\bcd.


рдЖрдк рдЗрд╕реЗ рдирд╣реАрдВ рд▓реЗ рд╕рдХрддреЗ. \boot\bcd \efi\microsoft\boot\bcd! path , {memdiag}.


\windows\system32\boot\winload.exe vs \windows\system32\boot\winload.efi
\boot\memtest.exe vs \efi\microsoft\boot\memtest.efi

Update
UEFI 64- Windows NT 6.0+, 32- тАФ Windows 8+.
, , Windows 8, IsolatedContext Yes. , (.. , , Windows 7 x64 UEFI).


 


Windows PE


, , Windows. , Windows PE.


 



. , - , :


рдХреЛрдИ рд╕реНрд░реЛрдд рддреНрд░реБрдЯрд┐


? , install.wim install.esd sources . Windows 10 x64\sources x86\sources . тАФ .
, , , .


 



Windows , . .
 



  • . , .
    Microsoft-Windows-Setup | ImageInstall | OSImage | InstallFrom | Path.
    :
    setup.exe /unattend:< >
    .
    . . , . . тАФ . . тАФ .
     

  • cmd.exe. , :
    X:\sources\setup.exe /installFrom:< install.wim install.esd>
    . ISO.
    .
     

  • X: ( boot.wim), ! install.wim install.esd. ( )!
    , , Win 10 x64 :
    < >:\WinDists\Win_10_x64\setup.exe
    . - X:\sources, . , boot.wim. ! , ( ) ( setup.exe) 6- .

 



, , ? . , .


 



Windows PE, , , .
HKLM\SYSTEM\Setup\CmdLine , WinPE. winpeshl.exe. , :


  1. ( WallpaperHost.exe)
  2. , winpeshl.ini. тАФ .
  3. PNP
  4. winpeshl.ini тАФ ( ):
    • X:$Windows.~BT\sources\setup.exe
    • X:\setup.exe
    • X:\windows\system32\cmd.exe /k startnet.cmd

, . , :


  • winpeshl.ini cmd.exe
  • / X:\setup.exe startnet.cmd

( , ).
 



boot.wim

Windows 10 x64.
, X:, boot.wim. :
 


dism /get-wimInfo /wimFile:<_>:\WinDists\Win_10_x64\boot.wim

C DISM
: 6.3.9600.17031

   : <_>:\WinDists\Win_10_x64\boot.wim

: 1
 : Microsoft Windows PE (x64)
 : Microsoft Windows PE (x64)
 (): 1 357 917 901

: 2
 : Microsoft Windows Setup (x64)
 : Microsoft Windows Setup (x64)
 (): 1 540 370 231

  .

Windows PE, тАФ Windows Setup. .. тАФ 2.
, . C:\mnt.
 


dism /mount-wim /wimFile:<_>:\WinDists\Win_10_x64\boot.wim /index:2 /mountDir:C:\mnt

C DISM
: 6.3.9600.17031

 
[==========================100.0%==========================]
  .

, , C:\mnt\Windows\System32\ winpeshl.ini ( runsetup.cmd).
 


winpeshl.ini
[LaunchApps]
cmd.exe, "/k runsetup.cmd"

runsetup.cmd
@echo off
Title TishSerg Windows Setup Bootstrapper v1.0
color 9f

ver
echo.
echo [%time%] Initializing Windows PE...
Wpeinit

echo.
Wpeutil UpdateBootInfo > nul
for /f "tokens=3" %%a in (
    'reg query "HKLM\System\CurrentControlSet\Control" /v PEBootRamdiskSourceDrive'
) do set RamdiskSourceDrive=%%a
echo [%time%] Detected setup media: %RamdiskSourceDrive%

echo.
:: Windows dist path Affix
set WinDistAfx=WinDists\Win

:: Find Windows arch Affix
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set WinArchAfx=ia32
) else (
    set WinArchAfx=x64
)

:: Find Windows version Affix
for /f "tokens=3" %%b in (
    'reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber'
) do set /a CurrentBuildNumber=%%b
if %CurrentBuildNumber% lss 6100 (
    :: Build < 6100 is Vista
    set WinVerAfx=Vista
    echo [%time%] Determined version of Windows: Vista (build %CurrentBuildNumber%^) %PROCESSOR_ARCHITECTURE%
) else if %CurrentBuildNumber% lss 7700 (
    :: Build < 7700 is 7
    set WinVerAfx=7
    echo [%time%] Determined version of Windows: 7 (build %CurrentBuildNumber%^) %PROCESSOR_ARCHITECTURE%
) else if %CurrentBuildNumber% lss 9300 (
    :: Build < 9300 is 8
    set WinVerAfx=8
    echo [%time%] Determined version of Windows: 8 (build %CurrentBuildNumber%^) %PROCESSOR_ARCHITECTURE%
) else if %CurrentBuildNumber% lss 9700 (
    :: Build < 9700 is 8.1
    set WinVerAfx=8.1
    echo [%time%] Determined version of Windows: 8.1 (build %CurrentBuildNumber%^) %PROCESSOR_ARCHITECTURE%
) else (
    :: Build > 9700 is 10
    set WinVerAfx=10
    echo [%time%] Determined version of Windows: 10 (build %CurrentBuildNumber%^) %PROCESSOR_ARCHITECTURE%
)

echo.
echo [%time%] Launching Windows Setup (%RamdiskSourceDrive%\%WinDistAfx%_%WinVerAfx%_%WinArchAfx%\setup.exe^)
%RamdiskSourceDrive%\%WinDistAfx%_%WinVerAfx%_%WinArchAfx%\setup.exe

:: When closed Windows Setup
color 2e
echo.
echo [%time%] Windows Setup closed
echo WScript.Quit MsgBox("You have closed Windows Setup."+vbCrlf+"Run 'System restore' instead? Or reboot?"+vbCrlf+vbCrlf+"Yes - Run 'System restore'"+vbCrlf+"No - Reboot"+vbCrlf+"Cancel - 'Just give me a Command line!'", vbQuestion+vbYesNoCancel, "Setup cancelled") > msgdlg.vbs
cscript msgdlg.vbs > nul
if %errorLevel% == 6 (
    echo [%time%] Here is Task Manager for you :^)
    start taskmgr
    echo [%time%] Run 'System restore' (%SystemDrive%\Sources\recovery\RecEnv.exe^)
    %SystemDrive%\Sources\recovery\RecEnv.exe
) else if %errorLevel% == 7 (
    echo [%time%] Will reboot now...
    Wpeutil Reboot
)

`runsetup.cmd`?

, winpeshl.ini runsetup.cmd Windows NT 6.0+. .. Win7, Win8 .. .


, .. - \sources\setup.exe X:\setup.exe :
image


, Windows . ISO X:\setup.exe .


! runsetup.cmd <_>:\\<_____>_<>_<>\setup.exe
( %RamdiskSourceDrive%\%WinDistAfx%_%WinVerAfx%_%WinArchAfx%\setup.exe). .. ( , ) :


  • D:\WinDists\Win_7_ia32\setup.exe
  • D:\WinDists\Win_10_x64\setup.exe

тАФ .


:
 


dism /unmount-wim /mountDir:C:\mnt /commit

C DISM
: 6.3.9600.17031

 : <_>:\WinDists\Win_10_x64\boot.wim
 : 2
 
[==========================100.0%==========================]
 
[==========================100.0%==========================]
  .

! boot.wim. , Windows!


 


?


.


 


Windows


ei.cfg


`ei.cfg`

[Channel]
Retail


setup.exe. , ramdisk- (boot.wim), ei.cfg . (+1 , ramdisk- /installFrom).


 


Windows


`Grub4Dos`
bcdedit /store <_>:\boot\bcd /create /d "Grub4Dos Menu" /application BootSector
 {b3923807-3ebb-11e6-83a0-d850e607fea0}  .

bcdedit /store <_>:\boot\bcd /set {b3923807-3ebb-11e6-83a0-d850e607fea0} device boot
bcdedit /store <_>:\boot\bcd /set {b3923807-3ebb-11e6-83a0-d850e607fea0} path \grldr

bcdedit /store <_>:\boot\bcd /DisplayOrder {b3923807-3ebb-11e6-83a0-d850e607fea0} /AddFirst

. : BOOTMGR GRLDR.


 


boot.wim ramdisk


BootMgr boot.wim ramdisk . .. Windows , . , . WinPE .
 


bcdedit /store <_>:\boot\bcd /set {<GUID   Windows>} BootMenuPolicy Legacy

, ( , ), (^╠о^)


 



. Windows 7 . Windows 8+ - ( ).
 


bcdedit /store <_>:\boot\bcd /set {<GUID   Windows>} Sos True

Windows 7. тАФ .


 



, :


  1. Windows ( ISO-)
  2. Windows рд╡рд┐рддрд░рдг рдлрд╝рд╛рдЗрд▓реЛрдВ ( [sources]рдЖрдИрдПрд╕рдУ рдЫрд╡рд┐рдпреЛрдВ рдореЗрдВ рд╕реЗ рдкреНрд░рддреНрдпреЗрдХ рдХреА рд╕рд╛рдордЧреНрд░реА) рдХреЗ рд╕рд╛рде рдПрдХ рдлрд╝реЛрд▓реНрдбрд░ рд╕рдВрд░рдЪрдирд╛ рдмрдирд╛рдИ рдЧрдИ
  3. Windows рдмреВрдЯ рдкреНрд░рдмрдВрдзрдХ рдореЗрдиреВ рд╕реЗрдЯ рдХрд░реЗрдВ
  4. рд╣рдордиреЗ boot.wimрдкреНрд░рддреНрдпреЗрдХ рд╡рд┐рддрд░рдг рдореЗрдВ рдЕрдкрдиреА рджреЛ рдлрд╛рдЗрд▓реЗрдВ рдЬреЛрдбрд╝реАрдВред

рд╡рд╣ рд╕рдм рд╣реИред рдкреНрд░рд╢реНрди, рдЯрд┐рдкреНрдкрдгрд┐рдпрд╛рдБ рдФрд░ рд╕реБрдЭрд╛рд╡ рдХрд╛ рд╕реНрд╡рд╛рдЧрдд рд╣реИ (are)

Source: https://habr.com/ru/post/hi395629/


All Articles