網頁

2020年1月1日 星期三

Win 10 PE 創建虛擬磁碟-使用Primo_Ramdisk

PE 的工具程式如採用全內置,WIM檔大小會增加很多。
微型PE的工具程式,選需要的內置,WIM檔大小雖適當,因部分工具程式內置與外置都有,會增加整體檔案大小。
要把PE 的工具程式外置,不同版本PE共用工具程式檔,PE須另建立一個虛擬磁碟機,來掛載外置的工具程式。本文選Primo Ramdisk來為PE建立一個虛擬磁碟機。

將Primo Ramdisk建立一個虛擬磁碟機的註冊檔導入PE的Windows\System32\config\system檔
執行要建立虛擬磁碟機的PE。
開始->登錄編輯程式

->KEY_LOCAL_MACHINE

->檔案->載入登錄區


->選Windows\System32\config\system檔->開啟

機碼名稱輸入 PE_SYS(須與要導入的註冊檔內的路徑一致)

要導入SYSTEM的註冊檔Primo_Ramdisk.reg內容如下:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Services\FancyRd]
"Type"=dword:00000001
"Start"=dword:00000000
"ErrorControl"=dword:00000001
"Tag"=dword:0000000c
"ImagePath"=hex(2):53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,\
  72,00,69,00,76,00,65,00,72,00,73,00,5c,00,66,00,61,00,6e,00,63,00,79,00,72,\
  00,64,00,2e,00,73,00,79,00,73,00,00,00
"Group"="Boot Bus Extender"

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Services\FancyRd\Parameters]
"Scode"=hex:ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,bf,9e,79,a0,79,a0
"Data2"=hex:a9,b2,e4,dc,82,b8,37,52,2c,f8,f3,44,38,5a,b8,1e
"Data3"=hex:b8,00,00,00,a1,31,d1,04,a4,80,f8,44,0c,07,04,05,3d,fe,63,a0,53,0f,\
  30,0d,37,e1,65,af,4e,f0,37,f2,2f,e9,dd,36,fc,5f,95,5d,27,d1,95,9f,7e,e0,27,\
  e2,df,d9,cd,26,cc,4f,e5,4d,d6,a7,b4,05,ac,1b,81,05,13,0b,54,4c,16,8b,07,6e,\
  4c,3f,17,80,c6,f5,7e,27,af,92,18,48,9d,11,c1,4f,8a,24,c0,06,fc,3c,6c,3b,d9,\
  42,0c,73,c4,35,c6,cb,e2,45,15,82,83,64,e6,5b,eb,86,7d,57,77,08,15,25,ca,32,\
  8f,83,b5,00,e0,73,da,ae,36,52,5b,55,69,18,41,25,30,06,ec,bc,44,00,46,28,51,\
  fe,b1,29,e1,55,a0,1c,f7,32,44,73,03,b1,55,5c,6c,26,c7,d6,9a,32,cf,27,a3,e0,\
  fe,1c,1e,ff,4e,44,7c,f0,69,98,83,f7
"Info"=dword:80000000
"ImHibernate"=dword:00000001
"EnableIM"=dword:00000001

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Services\FancyRd\Enum]
"0"="ROOT\\SYSTEM\\0001"
"Count"=dword:00000001
"NextInstance"=dword:00000001

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Control\Class\{4d36e97d-e325-11ce-bfc1-08002be10318}\0188]
"DriverDesc"="Primo Ramdisk Controller"
"ProviderName"="ROMEX SOFTWARE"
"DriverDateData"=hex:00,00,a4,d4,ad,37,cd,01
"DriverDate"="5-22-2012"
"DriverVersion"="5.6.0.6"
"InfSection"="FANCYRD.Device.NT"
"MatchingDeviceId"="root\\Fancy_Ramdisk"

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001]
"ClassGUID"="{4d36e97d-e325-11ce-bfc1-08002be10318}"
"HardwareID"=hex(7):72,00,6f,00,6f,00,74,00,5c,00,46,00,61,00,6e,00,63,00,79,\
  00,5f,00,52,00,61,00,6d,00,64,00,69,00,73,00,6b,00,00,00,00,00
"Service"="FancyRd"
"Driver"="{4d36e97d-e325-11ce-bfc1-08002be10318}\\0188"
"ConfigFlags"=dword:00000000
"Capabilities"=dword:00000000
"ContainerID"="{00000000-0000-0000-FFFF-FFFFFFFFFFFF}"

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Device Parameters]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Device Parameters\Repository]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{540b947e-8b40-45bc-a8a2-6a0b894cbda2}]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{540b947e-8b40-45bc-a8a2-6a0b894cbda2}\0007]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{80497100-8c73-48b9-aad9-ce387e19c56e}]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{80497100-8c73-48b9-aad9-ce387e19c56e}\0006]
@=hex(ffff0007):00,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0003]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0007]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0008]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0009]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\000A]
@=hex(ffff0012):48,00,54,00,52,00,45,00,45,00,5c,00,52,00,4f,00,4f,00,54,00,5c,\
  00,30,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\000B]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0064]
@=hex(ffff0010):50,7d,fe,17,3a,f3,ce,01

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0065]
@=hex(ffff0010):3d,3c,fc,17,3a,f3,ce,01

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{83da6326-97a6-4088-9453-a1923f573b29}\0066]
@=hex(ffff0010):71,9e,fe,17,3a,f3,ce,01

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0002]
@=hex(ffff0010):00,00,a4,d4,ad,37,cd,01

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0003]
@=hex(ffff0012):35,00,2e,00,36,00,2e,00,30,00,2e,00,36,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0004]
@=hex(ffff0012):50,00,72,00,69,00,6d,00,6f,00,20,00,52,00,61,00,6d,00,64,00,69,\
  00,73,00,6b,00,20,00,43,00,6f,00,6e,00,74,00,72,00,6f,00,6c,00,6c,00,65,00,\
  72,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0005]

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0006]
@=hex(ffff0012):46,00,41,00,4e,00,43,00,59,00,52,00,44,00,2e,00,44,00,65,00,76,\
  00,69,00,63,00,65,00,2e,00,4e,00,54,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0008]
@=hex(ffff0012):72,00,6f,00,6f,00,74,00,5c,00,46,00,61,00,6e,00,63,00,79,00,5f,\
  00,52,00,61,00,6d,00,64,00,69,00,73,00,6b,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0009]
@=hex(ffff0012):52,00,4f,00,4d,00,45,00,58,00,20,00,53,00,4f,00,46,00,54,00,57,\
  00,41,00,52,00,45,00,00,00

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\000E]
@=hex(ffff0007):00,00,ff,80

[HKEY_LOCAL_MACHINE\8PE_SYS\ControlSet001\Enum\ROOT\SYSTEM\0001\Properties\{a8b865dd-2e3d-4094-ad97-e593a70c75d6}\0017]
@=hex(ffff0011):ff

滑鼠在Primo_Ramdisk.reg點二下->是

導入成功->確定

點一下8PE_SYS

檔案->解除載入登錄區

->是

將X:\Windows\System32\config\SYSTEM檔複製到隨身碟

SYSTEM檔已複製到隨身碟

掛載要建立虛擬磁碟機PE檔

將隨身碟內的SYSTEM檔複製到PE內Windows\System32\config資料夾取代原有SYSTEM
將Primo Ramdisk建立虛擬磁碟機需要的檔案,複製到PE的Windows資料夾


Primo Ramdisk建立虛擬磁碟機system32的檔案如下:

Primo Ramdisk建立虛擬磁碟機system32\drivers的檔案如下:

微型PE請修改ramdisk.cmd檔虛擬磁碟大小為1024(1024M)
完整PE 虛擬磁碟大小6888(6888M)

RAMDISK.cmd檔內容
@echo off
if exist Y:\TEMP exit
rxprd add -n 6888 -t scsi -d Y -v -dmm=COMPACT -f ntfs -c 4KB -l RAMDisk -X -N -T -s
exit

修改Windows\system32\PECMD.INI檔
加入創建虛擬磁碟:
//TEXT 正在創建虛擬磁碟,請稍候......
EXEC !=%Curdir%\RAMDISK.cmd
IFEX ! Y:\TEMP,WAIT 4000
IFEX ! Y:\TEMP,WAIT 2000
IFEX ! Y:\TEMP,WAIT 2000

加入工具程式掛載至虛擬磁碟機:
load \sources\pe\disc.ini
EXEC !=%Curdir%\sousuo.cmd

Windows\system32\PECMD.INI檔範例如下: 
LOGS *X:\PE1.LOG
//設置分辨率,關閉小鍵盤,下面'TEXT ********'請勿刪除!
//TEAM DISP W1024 H768 B32|DISP W1366 H768 B32|DISP W1208 H960 B32|DISP W1440 H900 B32|DISP W1600 H900 B32|DISP W1920 H1080 B32
NUMK 0
//LOGO %SystemRoot%\system32\winpe.jpg
FONT %SystemRoot%\Fonts,0
SCRN ScrW,ScrH
CALC SeL = (%ScrW%-200)/2
CALC SeT = %ScrH%-150
TEXT 請稍候...... #0xFFFFFF L%SeL% T%SeT% R%ScrW% B%ScrH% $25
hotk F9,kill explorer.exe
EXEC !=FixUSB.exe U
CALL INDRV

//導入相關註冊表
EXEC !=REGEDIT /S %Windir%\System32\0.reg
EXEC !=REGEDIT /S %Windir%\System32\Desktop.reg
EXEC !=REGEDIT /S %Windir%\System32\TaskManager.reg
EXEC !=%ProgramFiles%\REGDOC.CMD

//顯示所有的通知欄圖標
REGI HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\EnableAutoTray=#0

//關聯WIMTOOL
EXEC %SystemDrive%\Program Files\WIMTOOL\WIMTOOL.EXE /Reg /M

WAIT 4000
//TEXT 正在創建虛擬磁碟,請稍候......
EXEC !=%Curdir%\RAMDISK.cmd
IFEX ! Y:\TEMP,WAIT 4000
IFEX ! Y:\TEMP,WAIT 2000
IFEX ! Y:\TEMP,WAIT 2000

//TEXT 正在掛載內置工具,請稍候......
//LOAD X:\10tools64\10tools64.ini
LINK %Desktop%\掛載ESP分區,%WinDir%\SYSTEM32\MOUNTESP.EXE,,SHELL32.DLL#7
//EXEC !=REGEDIT /S "%ProgramFiles%\WINSNAP\tools.reg"
//LINK %Programs%\其它軟體\WINSNAP,%ProgramFiles%\WINSNAP\WINSNAP.exe
LINK %Desktop%\安裝驅動(自定義),%Windir%\System32\PECMD.EXE,LOAD %Windir%\System32\drv.ini,NET.ICO
//TEXT
//LOGO

//固定到開始功能表
EXEC =PESET PINT %Windir%\System32\winver.exe,StartMenu
EXEC =PESET PINT %Windir%\System32\cmd.exe,StartMenu
EXEC =PESET PINT %Windir%\System32\notepad.exe,StartMenu
EXEC =PESET PINT %Windir%\regedit.exe,StartMenu
EXEC =PESET PINT %Windir%\System32\osk.exe,StartMenu
EXEC =PESET PINT %Windir%\System32\Taskmgr.exe,StartMenu

//固定到工作列
EXEC =PESET PINT %ProgramFiles%\WINSNAP\WINSNAP.exe,TaskBand
EXEC =PESET PINT %Windir%\FreeVirtualKeyboardPortable\FreeVirtualKeyboardPortable.exe,TaskBand
EXEC =PESET PINT %SystemDrive%\Program Files\WIMTOOL\WIMTOOL.EXE,TaskBand

EXEC %ProgramFiles%\MultiRes\MultiRes.exe
EXEC %ProgramFiles%\USBDiskEjector\USBDiskEjector.exe
load \sources\pe\disc.ini
EXEC !=%Curdir%\sousuo.cmd
EXEC =PESET PINT y:\mytools1\WINSNAP\WINSNAP.exe,TaskBand
KILL *explorer explorer.exe
WAIT 1000

_SUB INDRV
//TEXT 正在掛載集成內置驅動,請稍候......
EXEC =@!%WinDir%\System32\pnputil.exe /add-driver %WinDir%\inf\oem*.inf /install
WAIT 1888
_END

修改完成,卸載PE檔


卸載完成->close



下圖是微型PE建立虛擬磁碟機Y

虛擬磁碟機建立的資料夾範例

掛載的工具程式
















沒有留言:

張貼留言