SHARE
TWEET

PAE Patch

a guest Sep 3rd, 2015 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. cd /d "%~dp0"
  3.  
  4. bcdedit /enum >nul 2>&1
  5. if %errorlevel% neq 0 echo - ERROR, Command bcdedit missing! & goto end
  6.  
  7. set winver=0
  8. ver | find "6.1." >nul 2>&1
  9. if %errorlevel% equ 0 set winver=7 & set kernel=ntkrnlpa.exe
  10. ver | find "6.2." >nul 2>&1
  11. if %errorlevel% equ 0 set winver=8 & set kernel=ntoskrnl.exe
  12. ver | find "6.3." >nul 2>&1
  13. if %errorlevel% equ 0 set winver=8.1 & set kernel=ntoskrnl.exe
  14. ver | find "10.0." >nul 2>&1
  15. if %errorlevel% equ 0 set winver=10 & set kernel=ntoskrnl.exe
  16.  
  17. if %winver% equ 0 echo - ERROR, Unsupported Windows edition! & goto end
  18. if not exist "%systemroot%\system32\%kernel%" echo - ERROR, Cannot find %kernel%! & goto end
  19.  
  20. set current=0
  21. FOR /F %%a in ('bcdedit /enum ^| find "{current}"') do set current=1
  22. if %current% equ 0 echo - ERROR, Unsupported Boot config! & goto end
  23.  
  24. set winload=0
  25. FOR /F %%a in ('bcdedit /enum {current} ^| find "%systemroot:~2%\system32\winload.exe"') do set winload=1
  26. FOR /F %%a in ('bcdedit /enum {current} ^| find "%systemroot:~2%\system32\winloadx.exe"') do set winload=1
  27. if %winload% equ 0 echo - ERROR, Cannot detect Loader! & goto end
  28.  
  29. :patch-kernel
  30. echo - Executing Kernel patch.
  31. Patchpae -type kernel -o "%systemroot%\system32\ntkrnlpx.exe" "%systemroot%\system32\%kernel%" >nul 2>&1
  32. if %errorlevel% neq 0 echo - ERROR, Cannot patch %kernel%! & goto end
  33. Patchpae -type loader -o "%systemroot%\system32\winloadx.exe" "%systemroot%\system32\winload.exe" >nul 2>&1
  34. if %errorlevel% neq 0 echo - ERROR, Cannot patch winload.exe! & goto end
  35.  
  36. set patched=0
  37. FOR /F %%a in ('bcdedit /enum ^| find "ntkrnlpx.exe"') do set patched=1
  38. if %patched% equ 1 goto finished
  39.  
  40. :boot-manager
  41. echo - Adding Boot entry.
  42. FOR /F "tokens=2 delims={}" %%g in ('bcdedit /copy {current} /d "Windows %winver% (PAE)"') do set newguid=%%g
  43. bcdedit /set {%newguid%} kernel "ntkrnlpx.exe" >nul 2>&1
  44. bcdedit /set {%newguid%} path "%systemroot:~2%\system32\winloadx.exe" >nul 2>&1
  45. bcdedit /set {%newguid%} nointegritychecks yes >nul 2>&1
  46. bcdedit /set {bootmgr} default {%newguid%} >nul 2>&1
  47. bcdedit /set {bootmgr} displaybootmenu yes >nul 2>&1
  48. bcdedit /set {bootmgr} timeout 3 >nul 2>&1
  49.  
  50. :finished
  51. echo - Success, All done!
  52. :end
  53. ping 127.0.0.1 -n 6 >nul 2>&1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top