Compare commits
61 Commits
AlphaBlend
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
b29c9e77b6 | ||
|
406bab4012 | ||
|
048fd42f18 | ||
|
5cde7752ad | ||
|
1a609600f3 | ||
|
252a82f434 | ||
|
992785856d | ||
|
3d70b834c7 | ||
|
5cb73acf77 | ||
|
a0758e6af2 | ||
|
7f471302fa | ||
|
e2000d687c | ||
|
70ea17266f | ||
|
ad186f071a | ||
|
3a9481e167 | ||
|
2d4fcce6ac | ||
|
db885f7599 | ||
|
5a4a191801 | ||
|
4fc13100c8 | ||
|
8157860973 | ||
|
2b45c71b50 | ||
|
3283ccf304 | ||
|
c9fe6d8ec6 | ||
|
c7de9d4774 | ||
|
d6af3d177f | ||
|
cc4227eabe | ||
|
54a8053846 | ||
|
41b7d7cc64 | ||
|
5cf3adb049 | ||
|
5b1c3ac5d1 | ||
|
3d80c3ab79 | ||
|
c442478f89 | ||
|
6e53d270f1 | ||
|
acb805aa6d | ||
|
e65bfbdf74 | ||
|
3b537a1ef4 | ||
|
0ab5d67525 | ||
|
e2c8edf486 | ||
|
c5a3cc589f | ||
|
67e2ae7446 | ||
|
ebf1904275 | ||
|
24c5b454f9 | ||
|
5f2c9608ab | ||
|
5ecc4d78bb | ||
|
5e0a50ef1a | ||
|
d508cf5a23 | ||
|
dacfdb3f3a | ||
|
d0f7b82948 | ||
|
685051a21b | ||
|
557bc89a2b | ||
|
4d0baaa1c0 | ||
|
92a3d2dfa2 | ||
|
c42e397894 | ||
|
4796a590d0 | ||
|
098f1d0707 | ||
|
fde549f9e8 | ||
|
6605b25ca5 | ||
|
2eac40cac6 | ||
|
18a30e3584 | ||
|
09eac3a2be | ||
|
c26a6d98d7 |
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATOR: 2013, 2014, 2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -327,8 +327,8 @@ IDR_MENU_SCIENTIFIC_1 MENU
|
||||
BEGIN
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Çoğalt\tCtrl+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tCtrl+V", IDM_EDIT_PASTE
|
||||
MENUITEM "&Çoğalt\tDenetim+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tDenetim+V", IDM_EDIT_PASTE
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
@@ -336,14 +336,14 @@ BEGIN
|
||||
MENUITEM "&Bilimlik", IDM_VIEW_SCIENTIFIC
|
||||
MENUITEM "&Dönüştürme", IDM_VIEW_CONVERSION
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Onaltılık\tF5", IDM_VIEW_HEX, CHECKED
|
||||
MENUITEM "O&nluk\tF6", IDM_VIEW_DEC, CHECKED
|
||||
MENUITEM "&Sekizlik\tF7", IDM_VIEW_OCT, CHECKED
|
||||
MENUITEM "&İkilik\tF8", IDM_VIEW_BIN, CHECKED
|
||||
MENUITEM "&Onaltılık\tİ5", IDM_VIEW_HEX, CHECKED
|
||||
MENUITEM "O&nluk\tİ6", IDM_VIEW_DEC, CHECKED
|
||||
MENUITEM "&Sekizlik\tİ7", IDM_VIEW_OCT, CHECKED
|
||||
MENUITEM "&İkilik\tİ8", IDM_VIEW_BIN, CHECKED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "D&erece\tF2", IDM_VIEW_DEG, CHECKED
|
||||
MENUITEM "&Radyan\tF3", IDM_VIEW_RAD, CHECKED
|
||||
MENUITEM "&Gradyan\tF4", IDM_VIEW_GRAD, CHECKED
|
||||
MENUITEM "D&erece\tİ2", IDM_VIEW_DEG, CHECKED
|
||||
MENUITEM "&Radyan\tİ3", IDM_VIEW_RAD, CHECKED
|
||||
MENUITEM "&Gradyan\tİ4", IDM_VIEW_GRAD, CHECKED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "B&asamakları Takımla", IDM_VIEW_GROUP, CHECKED
|
||||
END
|
||||
@@ -359,8 +359,8 @@ IDR_MENU_SCIENTIFIC_2 MENU
|
||||
BEGIN
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Çoğalt\tCtrl+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tCtrl+V", IDM_EDIT_PASTE
|
||||
MENUITEM "&Çoğalt\tDenetim+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tDenetim+V", IDM_EDIT_PASTE
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
@@ -368,15 +368,15 @@ BEGIN
|
||||
MENUITEM "&Bilimlik", IDM_VIEW_SCIENTIFIC
|
||||
MENUITEM "&Dönüştürme", IDM_VIEW_CONVERSION
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Onaltılık\tF5", IDM_VIEW_HEX, CHECKED
|
||||
MENUITEM "O&nluk\tF6", IDM_VIEW_DEC, CHECKED
|
||||
MENUITEM "&Sekizlik\tF7", IDM_VIEW_OCT, CHECKED
|
||||
MENUITEM "&İkilik\tF8", IDM_VIEW_BIN, CHECKED
|
||||
MENUITEM "&Onaltılık\tİ5", IDM_VIEW_HEX, CHECKED
|
||||
MENUITEM "O&nluk\tİ6", IDM_VIEW_DEC, CHECKED
|
||||
MENUITEM "&Sekizlik\tİ7", IDM_VIEW_OCT, CHECKED
|
||||
MENUITEM "&İkilik\tİ8", IDM_VIEW_BIN, CHECKED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Dö&rtlü Sözcük\tF12", IDM_VIEW_QWORD, CHECKED
|
||||
MENUITEM "İ&kili Sözcük\tF2", IDM_VIEW_DWORD, CHECKED
|
||||
MENUITEM "Sö&zcük\tF3", IDM_VIEW_WORD, CHECKED
|
||||
MENUITEM "&Çoklu\tF4", IDM_VIEW_BYTE, CHECKED
|
||||
MENUITEM "Dö&rtlü Sözcük\tİ12", IDM_VIEW_QWORD, CHECKED
|
||||
MENUITEM "İ&kili Sözcük\tİ2", IDM_VIEW_DWORD, CHECKED
|
||||
MENUITEM "Sö&zcük\tİ3", IDM_VIEW_WORD, CHECKED
|
||||
MENUITEM "&Çoklu\tİ4", IDM_VIEW_BYTE, CHECKED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "B&asamakları Takımla", IDM_VIEW_GROUP, CHECKED
|
||||
END
|
||||
@@ -392,8 +392,8 @@ IDR_MENU_STANDARD MENU
|
||||
BEGIN
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Çoğalt\tCtrl+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tCtrl+V", IDM_EDIT_PASTE
|
||||
MENUITEM "&Çoğalt\tDenetim+C", IDM_EDIT_COPY
|
||||
MENUITEM "&Yapıştır\tDenetim+V", IDM_EDIT_PASTE
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* LICENSE: Freeware, permission to use under Public Domain
|
||||
* FILE: base/applications/games/solitaire/lang/tr-TR.rc
|
||||
* PURPOSE: Turkish Resource File for ReactOS Solitaire
|
||||
* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
* TRANSLATOR: 2013, 2014, 2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
@@ -69,7 +69,7 @@ IDR_MENU1 MENU
|
||||
BEGIN
|
||||
POPUP "&Oyun"
|
||||
BEGIN
|
||||
MENUITEM "&Dağıt\tF2", IDM_GAME_NEW
|
||||
MENUITEM "&Dağıt\tİ2", IDM_GAME_NEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "D&esteler...", IDM_GAME_DECK
|
||||
MENUITEM "&Seçenekler...", IDM_GAME_OPTIONS
|
||||
@@ -78,7 +78,7 @@ BEGIN
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&İçindekiler\tF1", IDM_HELP_CONTENTS
|
||||
MENUITEM "&İçindekiler\tİ1", IDM_HELP_CONTENTS
|
||||
MENUITEM "&Üzerine...", IDM_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* LICENSE: See COPYING in top level directory
|
||||
* FILE: base/applications/games/spider/lang/tr-TR.rc
|
||||
* PURPOSE: Turkish Resource File for ReactOS Spider Solitaire
|
||||
* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
* TRANSLATOR: 2013, 2014, 2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
@@ -60,7 +60,7 @@ IDR_MENU1 MENU
|
||||
BEGIN
|
||||
POPUP "&Oyun"
|
||||
BEGIN
|
||||
MENUITEM "&Dağıt\tF2", IDM_GAME_NEW
|
||||
MENUITEM "&Dağıt\tİ2", IDM_GAME_NEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "D&esteler...", IDM_GAME_DECK
|
||||
MENUITEM SEPARATOR
|
||||
@@ -68,7 +68,7 @@ BEGIN
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&İçindekiler\tF1", IDM_HELP_CONTENTS
|
||||
MENUITEM "&İçindekiler\tİ1", IDM_HELP_CONTENTS
|
||||
MENUITEM "&Üzerine...", IDM_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATORS: 2006 Fatih Aşıcı, 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATORS: 2006 Fatih Aşıcı, 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -13,7 +13,7 @@ IDM_WINEMINE MENU
|
||||
BEGIN
|
||||
POPUP "&Seçenekler"
|
||||
BEGIN
|
||||
MENUITEM "&Yeni Oyun\tF2", IDM_NEW
|
||||
MENUITEM "&Yeni Oyun\tİ2", IDM_NEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Soru İmiyle İmleme", IDM_MARKQ
|
||||
MENUITEM SEPARATOR
|
||||
@@ -22,7 +22,7 @@ BEGIN
|
||||
MENUITEM "&Usta", IDM_EXPERT
|
||||
MENUITEM "&Husûsî...", IDM_CUSTOM
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çıkış\tAlt+X", IDM_EXIT
|
||||
MENUITEM "&Çıkış\tSeçenek+X", IDM_EXIT
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 210, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Настройки на увеличителя"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Einstellungen"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Magnifier Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -33,7 +33,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Configurar lupa"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Paramètres de la loupe"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -31,7 +31,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "הגדרות זכוכית מגדלת"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Impostazioni di Magnifier"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "拡大鏡の設定"
|
||||
FONT 9, "MS UI Gothic", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Forstørrelse Innstilling"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -37,7 +37,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Ustawienia"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -31,7 +31,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Configurações da Lupa"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -31,7 +31,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Configurare lupă"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 185, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Параметры"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -34,7 +34,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Nastavenia Lupy"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -33,7 +33,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Konfigurimet e zmadhuesit"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -29,7 +29,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Förstoringsglaset Inställning"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/applications/magnify/lang/tr-TR.rc
|
||||
* PURPOSE: Turkish Resource File for RecatOS Magnifier
|
||||
* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
* TRANSLATOR: 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
@@ -37,11 +37,11 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Seçenekler"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "&Çıkış", IDOK, 96, 161, 50, 14
|
||||
DEFPUSHBUTTON "Tamam", IDOK, 96, 161, 50, 14
|
||||
PUSHBUTTON "&Yardım", IDC_BUTTON_HELP, 38, 161, 50, 14
|
||||
LTEXT "&Büyütme Düzeyi:", IDC_STATIC, 6, 8, 68, 8
|
||||
COMBOBOX IDC_ZOOM, 72, 6, 63, 66, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
|
@@ -37,7 +37,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Параметри екранної лупи"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -37,7 +37,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "放大镜设定"
|
||||
FONT 9, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -37,7 +37,7 @@ BEGIN
|
||||
END
|
||||
|
||||
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "放大鏡設定"
|
||||
FONT 9, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
|
@@ -8,8 +8,7 @@
|
||||
* David Quintana <gigaherz@gmail.com>
|
||||
*/
|
||||
|
||||
/* TODO: Support AppBar types other than ABE_TOP */
|
||||
|
||||
/* TODO: AppBar */
|
||||
#include "magnifier.h"
|
||||
|
||||
#include <winbase.h>
|
||||
@@ -21,16 +20,14 @@
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APPMSG_NOTIFYICON (WM_APP+1)
|
||||
#define APPMSG_APPBAR (WM_APP+2)
|
||||
|
||||
const TCHAR szWindowClass[] = TEXT("MAGNIFIER");
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
/* Global Variables */
|
||||
HINSTANCE hInst;
|
||||
HWND hMainWnd;
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
TCHAR szTitle[MAX_LOADSTRING];
|
||||
|
||||
#define TIMER_SPEED 1
|
||||
@@ -40,19 +37,19 @@ DWORD lastTicks = 0;
|
||||
|
||||
HWND hDesktopWindow = NULL;
|
||||
|
||||
NOTIFYICONDATA nid;
|
||||
#define APPMSG_NOTIFYICON (WM_APP+1)
|
||||
HICON notifyIcon;
|
||||
NOTIFYICONDATA nid;
|
||||
HMENU notifyMenu;
|
||||
HWND hOptionsDialog;
|
||||
BOOL bOptionsDialog = FALSE;
|
||||
BOOL bRecreateOffscreenDC = TRUE;
|
||||
LONG sourceWidth = 0;
|
||||
LONG sourceHeight = 0;
|
||||
HDC hdcOffscreen = NULL;
|
||||
HWND hOptionsDialog;
|
||||
BOOL bOptionsDialog = FALSE;
|
||||
|
||||
BOOL bRecreateOffscreenDC = TRUE;
|
||||
LONG sourceWidth = 0;
|
||||
LONG sourceHeight = 0;
|
||||
HDC hdcOffscreen = NULL;
|
||||
HANDLE hbmpOld;
|
||||
HBITMAP hbmpOffscreen = NULL;
|
||||
HANDLE hbmpOld;
|
||||
POINT ptDragOffset;
|
||||
INT nearEdge;
|
||||
|
||||
/* Current magnified area */
|
||||
POINT cp;
|
||||
@@ -135,158 +132,23 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||
return RegisterClass(&wc);
|
||||
}
|
||||
|
||||
void DoAppBarStuff(DWORD mode)
|
||||
{
|
||||
UINT uState;
|
||||
APPBARDATA data = {0};
|
||||
data.cbSize = sizeof(data);
|
||||
data.hWnd = hMainWnd;
|
||||
data.uCallbackMessage = APPMSG_APPBAR;
|
||||
|
||||
if (mode == ABM_NEW || mode == ABM_SETPOS)
|
||||
{
|
||||
HWND hWndOrder = HWND_BOTTOM;
|
||||
int rcw, rch;
|
||||
RECT rcWorkArea;
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
|
||||
|
||||
if(mode == ABM_NEW)
|
||||
{
|
||||
SHAppBarMessage(ABM_NEW, &data);
|
||||
|
||||
switch(AppBarConfig.uEdge)
|
||||
{
|
||||
case ABE_LEFT:
|
||||
data.rc.top = rcWorkArea.top;
|
||||
data.rc.bottom = rcWorkArea.bottom;
|
||||
data.rc.left = rcWorkArea.left;
|
||||
data.rc.right = data.rc.left + AppBarConfig.appBarSizes.left;
|
||||
break;
|
||||
case ABE_TOP:
|
||||
data.rc.left = rcWorkArea.left;
|
||||
data.rc.right = rcWorkArea.right;
|
||||
data.rc.top = rcWorkArea.top;
|
||||
data.rc.bottom = data.rc.top + AppBarConfig.appBarSizes.top;
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
data.rc.top = rcWorkArea.top;
|
||||
data.rc.bottom = rcWorkArea.bottom;
|
||||
data.rc.right = rcWorkArea.left;
|
||||
data.rc.left = data.rc.right - AppBarConfig.appBarSizes.right;
|
||||
break;
|
||||
case ABE_BOTTOM:
|
||||
data.rc.left = rcWorkArea.left;
|
||||
data.rc.right = rcWorkArea.right;
|
||||
data.rc.bottom = rcWorkArea.bottom;
|
||||
data.rc.top = data.rc.bottom - AppBarConfig.appBarSizes.bottom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetWindowRect(hMainWnd, &data.rc);
|
||||
}
|
||||
|
||||
data.uEdge = AppBarConfig.uEdge;
|
||||
uState = SHAppBarMessage(ABM_QUERYPOS, &data);
|
||||
|
||||
uState = SHAppBarMessage(ABM_SETPOS, &data);
|
||||
|
||||
rcw = data.rc.right-data.rc.left;
|
||||
rch = data.rc.bottom-data.rc.top;
|
||||
|
||||
uState = SHAppBarMessage(ABM_GETSTATE, &data);
|
||||
if(uState & ABS_ALWAYSONTOP)
|
||||
hWndOrder = HWND_TOPMOST;
|
||||
|
||||
SetWindowPos(hMainWnd, hWndOrder, data.rc.left, data.rc.top, rcw, rch, SWP_SHOWWINDOW|SWP_NOCOPYBITS);
|
||||
|
||||
}
|
||||
else if(mode == ABM_GETSTATE)
|
||||
{
|
||||
HWND hWndOrder = HWND_BOTTOM;
|
||||
uState = SHAppBarMessage(ABM_GETSTATE, &data);
|
||||
if(uState & ABS_ALWAYSONTOP)
|
||||
hWndOrder = HWND_TOPMOST;
|
||||
SetWindowPos(hMainWnd, hWndOrder, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
}
|
||||
else if(mode == ABM_ACTIVATE)
|
||||
{
|
||||
SHAppBarMessage(ABM_ACTIVATE, &data);
|
||||
}
|
||||
else if(mode == ABM_WINDOWPOSCHANGED)
|
||||
{
|
||||
SHAppBarMessage(ABM_WINDOWPOSCHANGED, &data);
|
||||
}
|
||||
else if(mode == ABM_REMOVE)
|
||||
{
|
||||
SHAppBarMessage(ABM_REMOVE, &data);
|
||||
}
|
||||
}
|
||||
|
||||
void AttachAppBar(INT uEdge)
|
||||
{
|
||||
if (AppBarConfig.uEdge == uEdge)
|
||||
return;
|
||||
|
||||
if(AppBarConfig.uEdge < 0 && uEdge >= 0)
|
||||
{
|
||||
SetWindowLongPtr(hMainWnd, GWL_STYLE, GetWindowLongPtr(hMainWnd, GWL_STYLE) & (~WS_CAPTION));
|
||||
}
|
||||
else if(uEdge < 0 && AppBarConfig.uEdge>=0)
|
||||
{
|
||||
SetWindowLongPtr(hMainWnd, GWL_STYLE, GetWindowLongPtr(hMainWnd, GWL_STYLE) | WS_CAPTION);
|
||||
SetWindowPos(hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
if(AppBarConfig.uEdge >= 0)
|
||||
{
|
||||
DoAppBarStuff(ABM_REMOVE);
|
||||
}
|
||||
|
||||
if (uEdge >=0)
|
||||
{
|
||||
AppBarConfig.uEdge = uEdge;
|
||||
DoAppBarStuff(ABM_NEW);
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rc = AppBarConfig.rcFloating;
|
||||
SetWindowPos(hMainWnd, HWND_TOPMOST, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 0);
|
||||
}
|
||||
|
||||
AppBarConfig.uEdge = uEdge;
|
||||
}
|
||||
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
RECT rc;
|
||||
DWORD exStyles = WS_EX_TOOLWINDOW | WS_EX_CONTROLPARENT;
|
||||
DWORD dwStyles = WS_SIZEBOX | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
|
||||
|
||||
/* Load settings from registry */
|
||||
LoadSettings();
|
||||
|
||||
rc = AppBarConfig.rcFloating;
|
||||
|
||||
RECT rcWorkArea;
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
|
||||
if (AppBarConfig.uEdge<0)
|
||||
{
|
||||
dwStyles |= WS_CAPTION;
|
||||
exStyles |= WS_EX_TOPMOST;
|
||||
}
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
|
||||
|
||||
/* Create the Window */
|
||||
hMainWnd = CreateWindowEx(
|
||||
exStyles,
|
||||
WS_EX_TOPMOST | WS_EX_PALETTEWINDOW,
|
||||
szWindowClass,
|
||||
szTitle,
|
||||
dwStyles,
|
||||
rc.left,
|
||||
rc.top,
|
||||
rc.right-rc.left,
|
||||
rc.bottom-rc.top,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
(rcWorkArea.right - rcWorkArea.left) * 2 / 3,
|
||||
200,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
@@ -295,16 +157,12 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
if (!hMainWnd)
|
||||
return FALSE;
|
||||
|
||||
if (AppBarConfig.uEdge>=0) DoAppBarStuff(ABM_NEW);
|
||||
else SetWindowPos(hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
|
||||
ShowWindow(hMainWnd, bStartMinimized ? SW_MINIMIZE : nCmdShow);
|
||||
UpdateWindow(hMainWnd);
|
||||
|
||||
// In Windows 2003's Magnifier, the "Start Minimized" setting
|
||||
// refers exclusively to the options dialog, not the main window itself.
|
||||
// Windows 2003's Magnifier always shows this dialog, and exits when the dialog isclosed.
|
||||
// Should we add a custom means to prevent opening it?
|
||||
hOptionsDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOGOPTIONS), hMainWnd, OptionsProc);
|
||||
if (bStartMinimized)
|
||||
ShowWindow(hOptionsDialog, SW_HIDE);
|
||||
else
|
||||
ShowWindow(hOptionsDialog, SW_SHOW);
|
||||
|
||||
if (bShowWarning)
|
||||
DialogBox(hInstance, MAKEINTRESOURCE(IDD_WARNINGDIALOG), hMainWnd, WarningProc);
|
||||
@@ -492,11 +350,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_TIMER:
|
||||
{
|
||||
BOOL hasMoved = FALSE;
|
||||
|
||||
HWND hwndForeground = GetForegroundWindow ();
|
||||
DWORD threadId = GetWindowThreadProcessId(hwndForeground, NULL);
|
||||
GUITHREADINFO guiInfo;
|
||||
guiInfo.cbSize = sizeof(guiInfo);
|
||||
|
||||
GetGUIThreadInfo(0, &guiInfo);
|
||||
GetGUIThreadInfo(threadId, &guiInfo);
|
||||
|
||||
if (bFollowMouse)
|
||||
{
|
||||
@@ -505,10 +364,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
//Get current mouse position
|
||||
GetCursorPos (&pNewMouse);
|
||||
|
||||
#define PointsAreEqual(pt1, pt2) (((pt1).x == (pt2).x) && ((pt1).y == (pt2).y))
|
||||
|
||||
//If mouse has moved ...
|
||||
if (!PointsAreEqual(pMouse, pNewMouse))
|
||||
if (((pMouse.x != pNewMouse.x) || (pMouse.y != pNewMouse.y)))
|
||||
{
|
||||
//Update to new position
|
||||
pMouse = pNewMouse;
|
||||
@@ -516,64 +373,45 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
hasMoved = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(guiInfo.hwndActive != hMainWnd)
|
||||
|
||||
if (bFollowCaret && hwndForeground && guiInfo.hwndCaret)
|
||||
{
|
||||
if (bFollowCaret)
|
||||
{
|
||||
if (guiInfo.hwndCaret)
|
||||
{
|
||||
POINT ptCaret;
|
||||
ptCaret.x = (guiInfo.rcCaret.left + guiInfo.rcCaret.right) / 2;
|
||||
ptCaret.y = (guiInfo.rcCaret.top + guiInfo.rcCaret.bottom) / 2;
|
||||
POINT ptCaret;
|
||||
ptCaret.x = (guiInfo.rcCaret.left + guiInfo.rcCaret.right) / 2;
|
||||
ptCaret.y = (guiInfo.rcCaret.top + guiInfo.rcCaret.bottom) / 2;
|
||||
|
||||
if ((pCaretWnd != guiInfo.hwndCaret) || !PointsAreEqual(pCaret, ptCaret))
|
||||
{
|
||||
//Update to new position
|
||||
pCaret = ptCaret;
|
||||
pCaretWnd = guiInfo.hwndCaret;
|
||||
if(!hasMoved)
|
||||
{
|
||||
ClientToScreen (guiInfo.hwndCaret, (LPPOINT) &ptCaret);
|
||||
cp = ptCaret;
|
||||
hasMoved = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (guiInfo.hwndCaret && ((pCaretWnd != guiInfo.hwndCaret) || (pCaret.x != ptCaret.x) || (pCaret.y != ptCaret.y)))
|
||||
{
|
||||
//Update to new position
|
||||
pCaret = ptCaret;
|
||||
pCaretWnd = guiInfo.hwndCaret;
|
||||
if(!hasMoved)
|
||||
{
|
||||
pCaretWnd = NULL;
|
||||
ClientToScreen (guiInfo.hwndCaret, (LPPOINT) &ptCaret);
|
||||
cp = ptCaret;
|
||||
}
|
||||
hasMoved = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFollowFocus)
|
||||
if (bFollowFocus && hwndForeground && guiInfo.hwndFocus)
|
||||
{
|
||||
POINT ptFocus;
|
||||
RECT activeRect;
|
||||
|
||||
//Get current control focus
|
||||
GetWindowRect (guiInfo.hwndFocus, &activeRect);
|
||||
ptFocus.x = (activeRect.left + activeRect.right) / 2;
|
||||
ptFocus.y = (activeRect.top + activeRect.bottom) / 2;
|
||||
|
||||
if(guiInfo.hwndFocus && ((guiInfo.hwndFocus != pFocusWnd) || (pFocus.x != ptFocus.x) || (pFocus.y != ptFocus.y)))
|
||||
{
|
||||
if(guiInfo.hwndFocus && !guiInfo.hwndCaret)
|
||||
{
|
||||
POINT ptFocus;
|
||||
RECT activeRect;
|
||||
|
||||
//Get current control focus
|
||||
GetWindowRect(guiInfo.hwndFocus, &activeRect);
|
||||
ptFocus.x = (activeRect.left + activeRect.right) / 2;
|
||||
ptFocus.y = (activeRect.top + activeRect.bottom) / 2;
|
||||
|
||||
if((guiInfo.hwndFocus != pFocusWnd) || !PointsAreEqual(pFocus, ptFocus))
|
||||
{
|
||||
//Update to new position
|
||||
pFocus = ptFocus;
|
||||
pFocusWnd = guiInfo.hwndFocus;
|
||||
if(!hasMoved)
|
||||
{
|
||||
cp = ptFocus;
|
||||
hasMoved = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pFocusWnd = NULL;
|
||||
}
|
||||
//Update to new position
|
||||
pFocus = ptFocus;
|
||||
pFocusWnd = guiInfo.hwndFocus;
|
||||
if(!hasMoved)
|
||||
cp = ptFocus;
|
||||
hasMoved = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,9 +430,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
lastTicks = GetTickCount();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
@@ -621,7 +458,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
@@ -631,117 +468,24 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
dc = BeginPaint(hWnd, &PaintStruct);
|
||||
Draw(dc);
|
||||
EndPaint(hWnd, &PaintStruct);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
TrackPopupMenu(notifyMenu, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, hWnd, NULL);
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
RECT rc;
|
||||
POINT pt;
|
||||
SetCapture(hWnd);
|
||||
|
||||
GetCursorPos(&pt);
|
||||
GetWindowRect(hWnd, &rc);
|
||||
ptDragOffset.x = pt.x - rc.left;
|
||||
ptDragOffset.y = pt.y - rc.top;
|
||||
|
||||
nearEdge = AppBarConfig.uEdge;
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
if(GetCapture() == hWnd)
|
||||
{
|
||||
RECT rc;
|
||||
POINT pt;
|
||||
RECT rcWorkArea;
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
|
||||
GetCursorPos(&pt);
|
||||
GetWindowRect(hWnd, &rc);
|
||||
|
||||
if(AppBarConfig.uEdge>=0)
|
||||
{
|
||||
if (pt.x >= rcWorkArea.left && pt.x <= rcWorkArea.right &&
|
||||
pt.y >= rcWorkArea.top && pt.y <= rcWorkArea.bottom)
|
||||
{
|
||||
AttachAppBar(-2);
|
||||
|
||||
// Fixup offset
|
||||
GetWindowRect(hWnd, &rc);
|
||||
ptDragOffset.x = (rc.right-rc.left)/2;
|
||||
ptDragOffset.y = 2;
|
||||
|
||||
rc.left = pt.x - ptDragOffset.x;
|
||||
rc.top = pt.y - ptDragOffset.y;
|
||||
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, rc.left, rc.top, 0, 0, SWP_NOSIZE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pt.x <= rcWorkArea.left+8 && nearEdge != ABE_LEFT)
|
||||
{
|
||||
AttachAppBar(ABE_LEFT);
|
||||
nearEdge = ABE_LEFT;
|
||||
}
|
||||
else if(pt.y <= rcWorkArea.top+8 && nearEdge != ABE_TOP)
|
||||
{
|
||||
AttachAppBar(ABE_TOP);
|
||||
nearEdge = ABE_TOP;
|
||||
}
|
||||
else if(pt.x >= rcWorkArea.right-8 && nearEdge != ABE_RIGHT)
|
||||
{
|
||||
AttachAppBar(ABE_RIGHT);
|
||||
nearEdge = ABE_RIGHT;
|
||||
}
|
||||
else if(pt.y >= rcWorkArea.bottom-8 && nearEdge != ABE_BOTTOM)
|
||||
{
|
||||
AttachAppBar(ABE_BOTTOM);
|
||||
nearEdge = ABE_BOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc.left = pt.x - ptDragOffset.x;
|
||||
rc.top = pt.y - ptDragOffset.y;
|
||||
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, rc.left, rc.top, 0, 0, SWP_NOSIZE);
|
||||
nearEdge = -1;
|
||||
}
|
||||
}
|
||||
|
||||
pMouse = pt;
|
||||
Refresh();
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
if(GetCapture() == hWnd)
|
||||
{
|
||||
if (AppBarConfig.uEdge>=0)
|
||||
DoAppBarStuff(ABM_GETSTATE);
|
||||
else
|
||||
SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
case WM_SIZE:
|
||||
if(AppBarConfig.uEdge>=0) DoAppBarStuff(ABM_SETPOS);
|
||||
/* fallthrough */
|
||||
case WM_DISPLAYCHANGE:
|
||||
bRecreateOffscreenDC = TRUE;
|
||||
Refresh();
|
||||
break;
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
// handle WM_ERASEBKGND by simply returning non-zero because we did all the drawing in WM_PAINT.
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if(AppBarConfig.uEdge>=0) DoAppBarStuff(ABM_REMOVE);
|
||||
|
||||
/* Save settings to registry */
|
||||
SaveSettings();
|
||||
KillTimer(hWnd , 1);
|
||||
@@ -758,12 +502,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
DestroyIcon(notifyIcon);
|
||||
|
||||
DestroyWindow(hOptionsDialog);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
{
|
||||
HMENU tempMenu;
|
||||
|
||||
/* Load settings from registry */
|
||||
LoadSettings();
|
||||
|
||||
/* Get the desktop window */
|
||||
hDesktopWindow = GetDesktopWindow();
|
||||
|
||||
@@ -785,57 +532,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
notifyMenu = GetSubMenu(tempMenu, 0);
|
||||
RemoveMenu(tempMenu, 0, MF_BYPOSITION);
|
||||
DestroyMenu(tempMenu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case APPMSG_APPBAR:
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case ABN_STATECHANGE:
|
||||
DoAppBarStuff(ABM_GETSTATE);
|
||||
break;
|
||||
case ABN_POSCHANGED:
|
||||
DoAppBarStuff(ABM_SETPOS);
|
||||
break;
|
||||
case ABN_FULLSCREENAPP:
|
||||
{
|
||||
if(!lParam)
|
||||
{
|
||||
DoAppBarStuff(ABM_GETSTATE);
|
||||
break;
|
||||
}
|
||||
|
||||
SetWindowPos(hMainWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
break;
|
||||
}
|
||||
case ABN_WINDOWARRANGE:
|
||||
if(lParam)
|
||||
ShowWindow(hMainWnd, SW_HIDE);
|
||||
else
|
||||
ShowWindow(hMainWnd, SW_SHOW);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case APPMSG_NOTIFYICON:
|
||||
HandleNotifyIconMessage(hWnd, wParam, lParam);
|
||||
return 0;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
if(AppBarConfig.uEdge>=0) DoAppBarStuff(ABM_ACTIVATE);
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
if(AppBarConfig.uEdge>=0) DoAppBarStuff(ABM_WINDOWPOSCHANGED);
|
||||
Refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@@ -26,16 +26,6 @@
|
||||
|
||||
extern int iZoom;
|
||||
|
||||
struct _AppBarConfig_t {
|
||||
DWORD cbSize;
|
||||
INT uEdge;
|
||||
DWORD value3;
|
||||
DWORD value4;
|
||||
RECT appBarSizes;
|
||||
RECT rcFloating;
|
||||
};
|
||||
extern struct _AppBarConfig_t AppBarConfig;
|
||||
|
||||
extern BOOL bShowWarning;
|
||||
|
||||
extern BOOL bFollowMouse;
|
||||
|
@@ -24,64 +24,38 @@ BOOL bInvertColors = FALSE;
|
||||
BOOL bStartMinimized = FALSE;
|
||||
BOOL bShowMagnifier = TRUE;
|
||||
|
||||
struct _AppBarConfig_t AppBarConfig = {
|
||||
sizeof(struct _AppBarConfig_t),
|
||||
-2 /* ABE_TOP */,
|
||||
0, 1, /* unknown */
|
||||
{ 101,101,101,101 }, /* edge sizes */
|
||||
{ 20, 20, 600, 200 }, /* floating window rect */
|
||||
};
|
||||
|
||||
void LoadSettings()
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG value;
|
||||
ULONG len;
|
||||
struct _AppBarConfig_t config_temp;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, KEY_READ, &hkey) == ERROR_SUCCESS)
|
||||
{
|
||||
len = sizeof(AppBarConfig);
|
||||
if (RegQueryValueEx(hkey, _T("AppBar"), 0, 0, (BYTE *)&config_temp, &len) == ERROR_SUCCESS)
|
||||
{
|
||||
if(config_temp.cbSize == sizeof(AppBarConfig))
|
||||
{
|
||||
AppBarConfig = config_temp;
|
||||
}
|
||||
}
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
{
|
||||
if (value >= 0 && value <= 9)
|
||||
iZoom = value;
|
||||
}
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bShowWarning = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bInvertColors = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bStartMinimized = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bFollowMouse = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bFollowFocus = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bFollowFocus = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4;
|
||||
if (RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
|
||||
bFollowCaret = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
@@ -96,8 +70,6 @@ void SaveSettings()
|
||||
|
||||
if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, _T(""), 0, KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
RegSetValueEx(hkey, _T("AppBar"), 0, REG_BINARY, (BYTE *)&AppBarConfig, sizeof(AppBarConfig));
|
||||
|
||||
value = iZoom;
|
||||
RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATOR: 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATOR: 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -6,17 +6,17 @@ IDR_MAINMENU MENU
|
||||
BEGIN
|
||||
POPUP "&Kütük"
|
||||
BEGIN
|
||||
MENUITEM "&Aç...\tCtrl+O", IDM_OPEN_FILE
|
||||
MENUITEM "&Kapat\tCtrl+W", IDM_CLOSE_FILE
|
||||
MENUITEM "&Aç...\tDenetim+O", IDM_OPEN_FILE
|
||||
MENUITEM "&Kapat\tDenetim+W", IDM_CLOSE_FILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çıkış", IDM_EXIT
|
||||
END
|
||||
POPUP "&Oynat"
|
||||
BEGIN
|
||||
MENUITEM "&Oynat ya da Duraklat\tCtrl+P", IDC_PLAY
|
||||
MENUITEM "&Durdur\tCtrl+S", IDC_STOP
|
||||
MENUITEM "&Oynat ya da Duraklat\tDenetim+P", IDC_PLAY
|
||||
MENUITEM "&Durdur\tDenetim+S", IDC_STOP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yinele\tCtrl+T", IDM_REPEAT
|
||||
MENUITEM "&Yinele\tDenetim+T", IDM_REPEAT
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
|
@@ -21,9 +21,9 @@ BEGIN
|
||||
MENUITEM "Page Setup...", IDM_FILEPAGESETUP
|
||||
MENUITEM "Print...\tCtrl+P", IDM_FILEPRINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Set as wallpaper (Tiled)", IDM_FILEASWALLPAPERPLANE
|
||||
MENUITEM "Set as wallpaper (Centered)", IDM_FILEASWALLPAPERCENTERED
|
||||
MENUITEM "Set as wallpaper (Stretched)", IDM_FILEASWALLPAPERSTRETCHED
|
||||
MENUITEM "Set as wallpaper (tiled)", IDM_FILEASWALLPAPERPLANE
|
||||
MENUITEM "Set as wallpaper (centered)", IDM_FILEASWALLPAPERCENTERED
|
||||
MENUITEM "Set as wallpaper (stretched)", IDM_FILEASWALLPAPERSTRETCHED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Quit\tAlt+F4", IDM_FILEEXIT
|
||||
END
|
||||
|
@@ -21,9 +21,9 @@ BEGIN
|
||||
MENUITEM "Page Setup...", IDM_FILEPAGESETUP
|
||||
MENUITEM "Print...\tCtrl+P", IDM_FILEPRINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Set as wallpaper (Tiled)", IDM_FILEASWALLPAPERPLANE
|
||||
MENUITEM "Set as wallpaper (Centered)", IDM_FILEASWALLPAPERCENTERED
|
||||
MENUITEM "Set as wallpaper (Stretched)", IDM_FILEASWALLPAPERSTRETCHED
|
||||
MENUITEM "Set as wallpaper (tiled)", IDM_FILEASWALLPAPERPLANE
|
||||
MENUITEM "Set as wallpaper (centered)", IDM_FILEASWALLPAPERCENTERED
|
||||
MENUITEM "Set as wallpaper (stretched)", IDM_FILEASWALLPAPERSTRETCHED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Quit\tAlt+F4", IDM_FILEEXIT
|
||||
END
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint/lang/tr-TR.rc
|
||||
* PURPOSE: Turkish Resource file for ReactOS Paint
|
||||
* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
* TRANSLATOR: 2013, 2014, 2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
@@ -12,40 +12,40 @@ ID_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Kütük"
|
||||
BEGIN
|
||||
MENUITEM "&Yeni\tCtrl+N", IDM_FILENEW
|
||||
MENUITEM "&Aç...\tCtrl+O", IDM_FILEOPEN
|
||||
MENUITEM "&Sakla\tCtrl+S", IDM_FILESAVE
|
||||
MENUITEM "&Yeni\tDenetim+N", IDM_FILENEW
|
||||
MENUITEM "&Aç...\tDenetim+O", IDM_FILEOPEN
|
||||
MENUITEM "&Sakla\tDenetim+S", IDM_FILESAVE
|
||||
MENUITEM "Ay&rı Sakla...", IDM_FILESAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Sayfa Görünümü", IDM_FILEPAGEVIEW
|
||||
MENUITEM "Sayfa Ayarla...", IDM_FILEPAGESETUP
|
||||
MENUITEM "Yazdır...\tCtrl+P", IDM_FILEPRINT
|
||||
MENUITEM "Yazdır...\tDenetim+P", IDM_FILEPRINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Döşeyerek Duvar Kağıdı Yap", IDM_FILEASWALLPAPERPLANE
|
||||
MENUITEM "&Ortalayarak Duvar Kağıdı Yap", IDM_FILEASWALLPAPERCENTERED
|
||||
MENUITEM "&Uzatarak Duvar Kağıdı Yap", IDM_FILEASWALLPAPERSTRETCHED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çıkış\tAlt+F4", IDM_FILEEXIT
|
||||
MENUITEM "&Çıkış\tSeçenek+F4", IDM_FILEEXIT
|
||||
END
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Geri Al\tCtrl+Z", IDM_EDITUNDO
|
||||
MENUITEM "&Yinele\tCtrl+Y", IDM_EDITREDO
|
||||
MENUITEM "&Geri Al\tDenetim+Z", IDM_EDITUNDO
|
||||
MENUITEM "&Yinele\tDenetim+Y", IDM_EDITREDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Kes\tCtrl+X", IDM_EDITCUT
|
||||
MENUITEM "Ç&oğalt\tCtrl+C", IDM_EDITCOPY
|
||||
MENUITEM "Y&apıştır\tCtrl+V", IDM_EDITPASTE
|
||||
MENUITEM "&Seçimi Sil\tDel", IDM_EDITDELETESELECTION
|
||||
MENUITEM "&Kes\tDenetim+X", IDM_EDITCUT
|
||||
MENUITEM "Ç&oğalt\tDenetim+C", IDM_EDITCOPY
|
||||
MENUITEM "Y&apıştır\tDenetim+V", IDM_EDITPASTE
|
||||
MENUITEM "&Seçimi Sil\tSil", IDM_EDITDELETESELECTION
|
||||
MENUITEM "S&eçimi Evir", IDM_EDITINVERTSELECTION
|
||||
MENUITEM "&Tümünü Seç\tCtrl+A", IDM_EDITSELECTALL
|
||||
MENUITEM "&Tümünü Seç\tDenetim+A", IDM_EDITSELECTALL
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Se&çimi Şuraya Çoğalt...", IDM_EDITCOPYTO
|
||||
MENUITEM "&Şuradan Yapıştır...", IDM_EDITPASTEFROM
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
MENUITEM "&Araç Çubuğu\tCtrl+T", IDM_VIEWTOOLBOX, CHECKED
|
||||
MENUITEM "&Renklik\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED
|
||||
MENUITEM "&Araç Çubuğu\tDenetim+T", IDM_VIEWTOOLBOX, CHECKED
|
||||
MENUITEM "&Renklik\tDenetim+L", IDM_VIEWCOLORPALETTE, CHECKED
|
||||
MENUITEM "&Durum Çubuğu", IDM_VIEWSTATUSBAR, CHECKED
|
||||
MENUITEM "&Metin Çubuğu", IDM_FORMATICONBAR, CHECKED, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
@@ -62,19 +62,19 @@ BEGIN
|
||||
MENUITEM "%800", IDM_VIEWZOOM800
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "K&ılavuzu Göster\tCtrl+G", IDM_VIEWSHOWGRID
|
||||
MENUITEM "K&ılavuzu Göster\tDenetim+G", IDM_VIEWSHOWGRID
|
||||
MENUITEM "K&üçüğünü Göster", IDM_VIEWSHOWMINIATURE
|
||||
END
|
||||
MENUITEM "&Tüm Görüntülük\tCtrl+F", IDM_VIEWFULLSCREEN
|
||||
MENUITEM "&Tüm Görüntülük\tDenetim+F", IDM_VIEWFULLSCREEN
|
||||
END
|
||||
POPUP "&Resim"
|
||||
BEGIN
|
||||
MENUITEM "&Döndür ya da Evir...\tCtrl+R", IDM_IMAGEROTATEMIRROR
|
||||
MENUITEM "&Yeniden Boyutlandır veyâ Eğ...\tCtrl+W", IDM_IMAGESTRETCHSKEW
|
||||
MENUITEM "&Döndür ya da Evir...\tDenetim+R", IDM_IMAGEROTATEMIRROR
|
||||
MENUITEM "&Yeniden Boyutlandır veyâ Eğ...\tDenetim+W", IDM_IMAGESTRETCHSKEW
|
||||
MENUITEM "&Kırp", IDM_IMAGECROP
|
||||
MENUITEM "&Renkleri Evir\tCtrl+I", IDM_IMAGEINVERTCOLORS
|
||||
MENUITEM "&Öz Nitelikler...\tCtrl+E", IDM_IMAGEATTRIBUTES
|
||||
MENUITEM "R&esmi Arıt\tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE
|
||||
MENUITEM "&Renkleri Evir\tDenetim+I", IDM_IMAGEINVERTCOLORS
|
||||
MENUITEM "&Öz Nitelikler...\tDenetim+E", IDM_IMAGEATTRIBUTES
|
||||
MENUITEM "R&esmi Arıt\tDenetim+Üst Damga+N", IDM_IMAGEDELETEIMAGE
|
||||
MENUITEM "D&onuk Çiz", IDM_IMAGEDRAWOPAQUE
|
||||
END
|
||||
POPUP "R&enkler"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATORS: 2012 Arda Tanrıkulu (ardatan) (ardatanrikulu@gmail.com), 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATORS: 2012 Arda Tanrıkulu (ardatan) (ardatanrikulu@gmail.com), 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -24,32 +24,32 @@ MAIN_MENU MENU
|
||||
BEGIN
|
||||
POPUP "&Kütük"
|
||||
BEGIN
|
||||
MENUITEM "&Yeni\tCtrl+N", CMD_NEW
|
||||
MENUITEM "&Aç...\tCtrl+O", CMD_OPEN
|
||||
MENUITEM "&Sakla\tCtrl+S", CMD_SAVE
|
||||
MENUITEM "&Yeni\tDenetim+N", CMD_NEW
|
||||
MENUITEM "&Aç...\tDenetim+O", CMD_OPEN
|
||||
MENUITEM "&Sakla\tDenetim+S", CMD_SAVE
|
||||
MENUITEM "Ay&rı Sakla...", CMD_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Say&fa Ayarla...", CMD_PAGE_SETUP
|
||||
MENUITEM "Ya&zdır...\tCtrl+P", CMD_PRINT
|
||||
MENUITEM "Ya&zdır...\tDenetim+P", CMD_PRINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çıkış", CMD_EXIT
|
||||
END
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Geri Al\tCtrl+Z", CMD_UNDO
|
||||
MENUITEM "&Geri Al\tDenetim+Z", CMD_UNDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Kes\tCtrl+X", CMD_CUT
|
||||
MENUITEM "&Çoğalt\tCtrl+C", CMD_COPY
|
||||
MENUITEM "&Yapıştır\tCtrl+V", CMD_PASTE
|
||||
MENUITEM "&Sil\tDel", CMD_DELETE
|
||||
MENUITEM "&Kes\tDenetim+X", CMD_CUT
|
||||
MENUITEM "&Çoğalt\tDenetim+C", CMD_COPY
|
||||
MENUITEM "&Yapıştır\tDenetim+V", CMD_PASTE
|
||||
MENUITEM "&Sil\tSil", CMD_DELETE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Bul...\tCtrl+F", CMD_SEARCH
|
||||
MENUITEM "S&onrakini Bul\tF3", CMD_SEARCH_NEXT
|
||||
MENUITEM "&Değiştir...\tCtrl+H", CMD_REPLACE
|
||||
MENUITEM "G&it...\tCtrl+G", CMD_GOTO
|
||||
MENUITEM "&Bul...\tDenetim+F", CMD_SEARCH
|
||||
MENUITEM "S&onrakini Bul\tİ3", CMD_SEARCH_NEXT
|
||||
MENUITEM "&Değiştir...\tDenetim+H", CMD_REPLACE
|
||||
MENUITEM "G&it...\tDenetim+G", CMD_GOTO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Tümünü Seç\tCtrl+A", CMD_SELECT_ALL
|
||||
MENUITEM "&Şimdiki Zamânı Koy\tF5", CMD_TIME_DATE
|
||||
MENUITEM "&Tümünü Seç\tDenetim+A", CMD_SELECT_ALL
|
||||
MENUITEM "&Şimdiki Zamânı Koy\tİ5", CMD_TIME_DATE
|
||||
END
|
||||
POPUP "&Biçim"
|
||||
BEGIN
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATOR: 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATOR: 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -12,19 +12,19 @@ BEGIN
|
||||
END
|
||||
POPUP "Y&azılım"
|
||||
BEGIN
|
||||
MENUITEM "&Kur\tCtrl+Enter", ID_INSTALL
|
||||
MENUITEM "K&aldır\tCtrl+Del", ID_UNINSTALL
|
||||
MENUITEM "&Kur\tDenetim+Giriş", ID_INSTALL
|
||||
MENUITEM "K&aldır\tDenetim+Sil", ID_UNINSTALL
|
||||
MENUITEM "&Değiştir", ID_MODIFY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Girişi Değer Defteri'nden Kaldır", ID_REGREMOVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yenile\tF5", ID_REFRESH
|
||||
MENUITEM "&Yenile\tİ5", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tCtrl+F5", ID_RESETDB
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tDenetim+İ5", ID_RESETDB
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&Yardım\tF1", ID_HELP, GRAYED
|
||||
MENUITEM "&Yardım\tİ1", ID_HELP, GRAYED
|
||||
MENUITEM "&Üzerine...", ID_ABOUT
|
||||
END
|
||||
END
|
||||
@@ -42,15 +42,15 @@ IDR_APPLICATIONMENU MENU
|
||||
BEGIN
|
||||
POPUP "popup"
|
||||
BEGIN
|
||||
MENUITEM "&Kur\tCtrl+Enter", ID_INSTALL
|
||||
MENUITEM "K&aldır\tCtrl+Del", ID_UNINSTALL
|
||||
MENUITEM "&Kur\tDenetim+Giriş", ID_INSTALL
|
||||
MENUITEM "K&aldır\tDenetim+Sil", ID_UNINSTALL
|
||||
MENUITEM "&Değiştir", ID_MODIFY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Girişi Değer Defteri'nden Kaldır", ID_REGREMOVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yenile\tF5", ID_REFRESH
|
||||
MENUITEM "&Yenile\tİ5", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tCtrl+F5", ID_RESETDB
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tDenetim+İ5", ID_RESETDB
|
||||
END
|
||||
END
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATOR: 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATOR: 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -12,19 +12,19 @@ BEGIN
|
||||
END
|
||||
POPUP "Y&azılım"
|
||||
BEGIN
|
||||
MENUITEM "&Kur\tCtrl+Enter", ID_INSTALL
|
||||
MENUITEM "K&aldır\tCtrl+Del", ID_UNINSTALL
|
||||
MENUITEM "&Kur\tDenetim+Giriş", ID_INSTALL
|
||||
MENUITEM "K&aldır\tDenetim+Sil", ID_UNINSTALL
|
||||
MENUITEM "&Değiştir", ID_MODIFY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Girişi Değer Defteri'nden Kaldır", ID_REGREMOVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yenile\tF5", ID_REFRESH
|
||||
MENUITEM "&Yenile\tİ5", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tCtrl+F5", ID_RESETDB
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tDenetim+İ5", ID_RESETDB
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&Yardım\tF1", ID_HELP, GRAYED
|
||||
MENUITEM "&Yardım\tİ1", ID_HELP, GRAYED
|
||||
MENUITEM "&Üzerine...", ID_ABOUT
|
||||
END
|
||||
END
|
||||
@@ -42,15 +42,15 @@ IDR_APPLICATIONMENU MENU
|
||||
BEGIN
|
||||
POPUP "popup"
|
||||
BEGIN
|
||||
MENUITEM "&Kur\tCtrl+Enter", ID_INSTALL
|
||||
MENUITEM "K&aldır\tCtrl+Del", ID_UNINSTALL
|
||||
MENUITEM "&Kur\tDenetim+Giriş", ID_INSTALL
|
||||
MENUITEM "K&aldır\tDenetim+Sil", ID_UNINSTALL
|
||||
MENUITEM "&Değiştir", ID_MODIFY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Girişi Değer Defteri'nden Kaldır", ID_REGREMOVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yenile\tF5", ID_REFRESH
|
||||
MENUITEM "&Yenile\tİ5", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tCtrl+F5", ID_RESETDB
|
||||
MENUITEM "Ya&zılım Veri Tabanını Yenile\tDenetim+İ5", ID_RESETDB
|
||||
END
|
||||
END
|
||||
|
||||
|
@@ -348,12 +348,6 @@ UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)ListView_DeleteAllItems(g_pChildWnd->hListWnd);
|
||||
SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)NULL);
|
||||
SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0, (LPARAM)NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@@ -39,7 +39,7 @@ BEGIN
|
||||
MENUITEM "A&ğdaki Değer Defteri'ne Bağlan...", ID_REGISTRY_CONNECTNETWORKREGISTRY
|
||||
MENUITEM "Ağ&daki Değer Defteri'ne Bağlantıyı Kes...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zdır...\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
|
||||
MENUITEM "Ya&zdır...\tDenetim+P", ID_REGISTRY_PRINT, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Çıkış", ID_REGISTRY_EXIT
|
||||
END
|
||||
@@ -60,13 +60,13 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&İzinler...", ID_EDIT_PERMISSIONS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Sil\tDel", ID_EDIT_DELETE
|
||||
MENUITEM "&Sil\tSil", ID_EDIT_DELETE
|
||||
MENUITEM "&Adını Değiştir", ID_EDIT_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Di&zin Yolunu Çoğalt", ID_EDIT_COPYKEYNAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Bul...\tCtrl+F", ID_EDIT_FIND
|
||||
MENUITEM "S&onrakini Bul\tF3", ID_EDIT_FINDNEXT
|
||||
MENUITEM "&Bul...\tDenetim+F", ID_EDIT_FIND
|
||||
MENUITEM "S&onrakini Bul\tİ3", ID_EDIT_FINDNEXT
|
||||
END
|
||||
POPUP "&Görünüm"
|
||||
BEGIN
|
||||
@@ -74,7 +74,7 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Böl", ID_VIEW_SPLIT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Yenile\tF5", ID_VIEW_REFRESH
|
||||
MENUITEM "&Yenile\tİ5", ID_VIEW_REFRESH
|
||||
END
|
||||
POPUP "Y&er İmleri"
|
||||
BEGIN
|
||||
@@ -83,7 +83,7 @@ BEGIN
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&Yardım Konuları\tF1", ID_HELP_HELPTOPICS
|
||||
MENUITEM "&Yardım Konuları\tİ1", ID_HELP_HELPTOPICS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Değer Defteri Düzenleyicisi Üzerine...", ID_HELP_ABOUT
|
||||
END
|
||||
@@ -96,7 +96,7 @@ BEGIN
|
||||
MENUITEM "&Değiştir...", ID_EDIT_MODIFY
|
||||
MENUITEM "&İkili Veriyi Değiştir...", ID_EDIT_MODIFY_BIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Sil\tDel", ID_EDIT_DELETE
|
||||
MENUITEM "&Sil\tSil", ID_EDIT_DELETE
|
||||
MENUITEM "&Adını Değiştir", ID_EDIT_RENAME
|
||||
END
|
||||
POPUP ""
|
||||
|
@@ -6,8 +6,6 @@
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
||||
IDI_ICON ICON DISCARDABLE "res/icon_logon.ico"
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Logon ScreenSaver"
|
||||
#define REACTOS_STR_INTERNAL_NAME "logon"
|
||||
|
Before Width: | Height: | Size: 225 KiB After Width: | Height: | Size: 225 KiB |
Before Width: | Height: | Size: 225 KiB After Width: | Height: | Size: 225 KiB |
Before Width: | Height: | Size: 15 KiB |
@@ -342,13 +342,20 @@ int wmain(int argc, WCHAR *argv[])
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initiate the shutdown */
|
||||
if (!InitiateSystemShutdownExW(opts.remote_system,
|
||||
opts.message,
|
||||
opts.shutdown_delay,
|
||||
opts.force,
|
||||
opts.restart,
|
||||
opts.reason))
|
||||
/**
|
||||
** HACK: When InitiateSystemShutdownExW will become really implemented,
|
||||
** activate this line and delete the other...
|
||||
**
|
||||
if(!InitiateSystemShutdownExW(opts.remote_system,
|
||||
opts.message,
|
||||
opts.shutdown_delay,
|
||||
opts.force,
|
||||
opts.restart,
|
||||
opts.reason))
|
||||
***/
|
||||
if (!ExitWindowsEx((opts.shutdown ? EWX_SHUTDOWN : EWX_REBOOT) |
|
||||
(opts.force ? EWX_FORCE : 0),
|
||||
opts.reason))
|
||||
{
|
||||
/*
|
||||
* If there is an error, give the proper output depending
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
/* TRANSLATOR: 2013, 2014, 2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
@@ -55,8 +55,8 @@ BEGIN
|
||||
MENUITEM "&Kapat", ID_SHUTDOWN_POWEROFF
|
||||
MENUITEM "&Yeniden Başlat", ID_SHUTDOWN_REBOOT
|
||||
MENUITEM """%s"" &Oturumunu Kapat", ID_SHUTDOWN_LOGOFF
|
||||
MENUITEM "Ku&llanıcı Değiştir\tWinKey+L", ID_SHUTDOWN_SWITCHUSER, GRAYED
|
||||
MENUITEM "&Bilgisayarı Kilitle\tWinKey+L", ID_SHUTDOWN_LOCKCOMPUTER
|
||||
MENUITEM "Ku&llanıcı Değiştir\tROS+L", ID_SHUTDOWN_SWITCHUSER, GRAYED
|
||||
MENUITEM "&Bilgisayarı Kilitle\tROS+L", ID_SHUTDOWN_LOCKCOMPUTER
|
||||
MENUITEM "Ba&ğlantıyı Kes", ID_SHUTDOWN_DISCONNECT, GRAYED
|
||||
MENUITEM "B&ilgisayarı Çıkar", ID_SHUTDOWN_EJECT_COMPUTER, GRAYED
|
||||
END
|
||||
|
@@ -34,19 +34,16 @@ void TaskManager_OnFileNew(void)
|
||||
LoadStringW(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
|
||||
LoadStringW(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0]));
|
||||
|
||||
|
||||
hShell32 = LoadLibraryW(L"SHELL32.DLL");
|
||||
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)61);
|
||||
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)0x3D);
|
||||
|
||||
/* Show "Run..." dialog */
|
||||
if (RunFileDlg)
|
||||
{
|
||||
HICON hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER));
|
||||
|
||||
/* NOTE - don't check whether running on win 9x or NT, let's just
|
||||
assume that a unicode build only runs on NT */
|
||||
RunFileDlg(hMainWnd, hIcon, NULL, NULL, szText, RFF_CALCDIRECTORY);
|
||||
|
||||
DeleteObject(hIcon);
|
||||
RunFileDlg(hMainWnd, 0, NULL, NULL, szText, RFF_CALCDIRECTORY);
|
||||
}
|
||||
|
||||
FreeLibrary(hShell32);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Turkish Resources for ReactOS Wordpad
|
||||
*
|
||||
* Copyrights: 2006 Fatih Aşıcı (fasici@linux-sevenler.org), 2013-2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
* Copyrights: 2006 Fatih Aşıcı (fasici@linux-sevenler.org), 2013-2016 Erdem Ersoy (eersoy93) (erdemersoy@live.com)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -24,12 +24,12 @@ IDM_MAINMENU MENU
|
||||
BEGIN
|
||||
POPUP "&Kütük"
|
||||
BEGIN
|
||||
MENUITEM "&Yeni...\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM "&Aç...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "&Sakla\tCtrl+S", ID_FILE_SAVE
|
||||
MENUITEM "&Yeni...\tDenetim+N", ID_FILE_NEW
|
||||
MENUITEM "&Aç...\tDenetim+O", ID_FILE_OPEN
|
||||
MENUITEM "&Sakla\tDenetim+S", ID_FILE_SAVE
|
||||
MENUITEM "Ay&rı Sakla...", ID_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&zdır...\tCtrl+P", ID_PRINT
|
||||
MENUITEM "Ya&zdır...\tDenetim+P", ID_PRINT
|
||||
MENUITEM "Yaz&dırma Ön İzlemesi...", ID_PREVIEW
|
||||
MENUITEM "Say&fa Ayarla...", ID_PRINTSETUP
|
||||
MENUITEM SEPARATOR
|
||||
@@ -37,18 +37,18 @@ BEGIN
|
||||
END
|
||||
POPUP "&Düzen"
|
||||
BEGIN
|
||||
MENUITEM "&Geri Al\tCtrl+Z", ID_EDIT_UNDO
|
||||
MENUITEM "&Yinele\tCtrl+Y", ID_EDIT_REDO
|
||||
MENUITEM "&Geri Al\tDenetim+Z", ID_EDIT_UNDO
|
||||
MENUITEM "&Yinele\tDenetim+Y", ID_EDIT_REDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Kes\tCtrl+X", ID_EDIT_CUT
|
||||
MENUITEM "&Çoğalt\tCtrl+C", ID_EDIT_COPY
|
||||
MENUITEM "Y&apıştır\tCtrl+V", ID_EDIT_PASTE
|
||||
MENUITEM "&Sil\tDel", ID_EDIT_CLEAR
|
||||
MENUITEM "&Tümünü Seç\tCtrl+A", ID_EDIT_SELECTALL
|
||||
MENUITEM "&Kes\tDenetim+X", ID_EDIT_CUT
|
||||
MENUITEM "&Çoğalt\tDenetim+C", ID_EDIT_COPY
|
||||
MENUITEM "Y&apıştır\tDenetim+V", ID_EDIT_PASTE
|
||||
MENUITEM "&Sil\tSil", ID_EDIT_CLEAR
|
||||
MENUITEM "&Tümünü Seç\tDenetim+A", ID_EDIT_SELECTALL
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Bul...\tCtrl+F", ID_FIND
|
||||
MENUITEM "S&onrakini Bul\tF3", ID_FIND_NEXT
|
||||
MENUITEM "&Değiştir...\tCtrl+H", ID_REPLACE
|
||||
MENUITEM "&Bul...\tDenetim+F", ID_FIND
|
||||
MENUITEM "S&onrakini Bul\tİ3", ID_FIND_NEXT
|
||||
MENUITEM "&Değiştir...\tDenetim+H", ID_REPLACE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Ya&lnızca Okunur", ID_EDIT_READONLY
|
||||
MENUITEM "D&eğiştirilmiş", ID_EDIT_MODIFIED
|
||||
@@ -83,13 +83,13 @@ BEGIN
|
||||
MENUITEM "&Sekme Durakları...", ID_TABSTOPS
|
||||
POPUP "&Arka Plan"
|
||||
BEGIN
|
||||
MENUITEM "&Dizge Rengi\tCtrl+1", ID_BACK_1
|
||||
MENUITEM "&Sarımtırak\tCtrl+2", ID_BACK_2
|
||||
MENUITEM "&Dizge Rengi\tDenetim+1", ID_BACK_1
|
||||
MENUITEM "&Sarımtırak\tDenetim+2", ID_BACK_2
|
||||
END
|
||||
END
|
||||
POPUP "&Yardım"
|
||||
BEGIN
|
||||
MENUITEM "&ReactOS Wordpad Üzerine...", ID_ABOUT
|
||||
MENUITEM "&ReactOS Wordpad Üzerine...", ID_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -93,7 +93,8 @@ CreateCommonFreeLoaderSections(
|
||||
PINICACHESECTION IniSection;
|
||||
|
||||
/* Create "FREELOADER" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"FREELOADER");
|
||||
IniSection = IniCacheAppendSection(IniCache,
|
||||
L"FREELOADER");
|
||||
|
||||
#if DBG
|
||||
if (IsUnattendedSetup)
|
||||
@@ -287,6 +288,123 @@ CreateCommonFreeLoaderSections(
|
||||
L"Seconds until highlighted choice will be started automatically: ");
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForDos(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath)
|
||||
{
|
||||
PINICACHE IniCache;
|
||||
PINICACHESECTION IniSection;
|
||||
|
||||
IniCache = IniCacheCreate();
|
||||
|
||||
CreateCommonFreeLoaderSections(IniCache);
|
||||
|
||||
/* Create "Operating Systems" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"Operating Systems");
|
||||
|
||||
/* REACTOS=ReactOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"ReactOS",
|
||||
L"\"ReactOS\"");
|
||||
|
||||
/* ReactOS_Debug="ReactOS (Debug)" */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"ReactOS_Debug",
|
||||
L"\"ReactOS (Debug)\"");
|
||||
|
||||
/* DOS=Dos/Windows */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"DOS",
|
||||
L"\"DOS/Windows\"");
|
||||
|
||||
/* Create "ReactOS" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"ReactOS");
|
||||
|
||||
/* BootType=ReactOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootType",
|
||||
L"ReactOS");
|
||||
|
||||
/* SystemPath=<ArcPath> */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"SystemPath",
|
||||
ArcPath);
|
||||
|
||||
/* Create "ReactOS_Debug" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"ReactOS_Debug");
|
||||
|
||||
/* BootType=ReactOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootType",
|
||||
L"ReactOS");
|
||||
|
||||
/* SystemPath=<ArcPath> */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"SystemPath",
|
||||
ArcPath);
|
||||
|
||||
/* Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"Options",
|
||||
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS");
|
||||
|
||||
/* Create "DOS" section */
|
||||
IniSection = IniCacheAppendSection(IniCache,
|
||||
L"DOS");
|
||||
|
||||
/* BootType=BootSector */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootType",
|
||||
L"BootSector");
|
||||
|
||||
/* BootDrive=hd0 */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootDrive",
|
||||
L"hd0");
|
||||
|
||||
/* BootPartition=1 */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootPartition",
|
||||
L"1");
|
||||
|
||||
/* BootSector=BOOTSECT.DOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootSectorFile",
|
||||
L"BOOTSECT.DOS");
|
||||
|
||||
IniCacheSave(IniCache, IniPath);
|
||||
IniCacheDestroy(IniCache);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderEntry(
|
||||
PINICACHE IniCache,
|
||||
@@ -333,14 +451,18 @@ CreateFreeLoaderEntry(
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
CreateFreeLoaderReactOSEntries(
|
||||
PINICACHE IniCache,
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForReactOS(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath)
|
||||
{
|
||||
PINICACHE IniCache;
|
||||
PINICACHESECTION IniSection;
|
||||
|
||||
IniCache = IniCacheCreate();
|
||||
|
||||
CreateCommonFreeLoaderSections(IniCache);
|
||||
|
||||
/* Create "Operating Systems" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"Operating Systems");
|
||||
|
||||
@@ -395,90 +517,8 @@ CreateFreeLoaderReactOSEntries(
|
||||
L"Windows2003", ArcPath,
|
||||
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /redirect=com2 /redirectbaudrate=115200");
|
||||
#endif
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForReactOS(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath)
|
||||
{
|
||||
PINICACHE IniCache;
|
||||
|
||||
/* Initialize the INI file */
|
||||
IniCache = IniCacheCreate();
|
||||
|
||||
/* Create the common FreeLdr sections */
|
||||
CreateCommonFreeLoaderSections(IniCache);
|
||||
|
||||
/* Add the ReactOS entries */
|
||||
CreateFreeLoaderReactOSEntries(IniCache, ArcPath);
|
||||
|
||||
/* Save the INI file */
|
||||
IniCacheSave(IniCache, IniPath);
|
||||
IniCacheDestroy(IniCache);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
CreateFreeLoaderIniForDos(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath)
|
||||
{
|
||||
PINICACHE IniCache;
|
||||
PINICACHESECTION IniSection;
|
||||
|
||||
/* Initialize the INI file */
|
||||
IniCache = IniCacheCreate();
|
||||
|
||||
/* Create the common FreeLdr sections */
|
||||
CreateCommonFreeLoaderSections(IniCache);
|
||||
|
||||
/* Add the ReactOS entries */
|
||||
CreateFreeLoaderReactOSEntries(IniCache, ArcPath);
|
||||
|
||||
/* Get "Operating Systems" section */
|
||||
IniSection = IniCacheGetSection(IniCache, L"Operating Systems");
|
||||
|
||||
/* DOS=DOS/Windows */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"DOS",
|
||||
L"\"DOS/Windows\"");
|
||||
|
||||
/* Create the "DOS" section */
|
||||
IniSection = IniCacheAppendSection(IniCache, L"DOS");
|
||||
|
||||
/* BootType=BootSector */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootType",
|
||||
L"BootSector");
|
||||
|
||||
/* BootDrive=hd0 */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootDrive",
|
||||
L"hd0");
|
||||
|
||||
/* BootPartition=1 */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootPartition",
|
||||
L"1");
|
||||
|
||||
/* BootSector=BOOTSECT.DOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootSectorFile",
|
||||
L"BOOTSECT.DOS");
|
||||
|
||||
/* Save the INI file */
|
||||
/* Save the ini file */
|
||||
IniCacheSave(IniCache, IniPath);
|
||||
IniCacheDestroy(IniCache);
|
||||
|
||||
@@ -491,6 +531,7 @@ UpdateFreeLoaderIni(
|
||||
PWCHAR IniPath,
|
||||
PWCHAR ArcPath)
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
PINICACHE IniCache;
|
||||
PINICACHESECTION IniSection;
|
||||
PINICACHESECTION OsIniSection;
|
||||
@@ -502,7 +543,9 @@ UpdateFreeLoaderIni(
|
||||
ULONG i,j;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = IniCacheLoad(&IniCache, IniPath, FALSE);
|
||||
RtlInitUnicodeString(&Name, IniPath);
|
||||
|
||||
Status = IniCacheLoad(&IniCache, &Name, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
@@ -539,19 +582,18 @@ UpdateFreeLoaderIni(
|
||||
wcscpy(SectionName2, KeyData);
|
||||
}
|
||||
|
||||
/* Search for an existing ReactOS entry */
|
||||
OsIniSection = IniCacheGetSection(IniCache, SectionName2);
|
||||
if (OsIniSection != NULL)
|
||||
{
|
||||
BOOLEAN UseExistingEntry = TRUE;
|
||||
|
||||
/* Check for boot type "Windows2003" */
|
||||
/* Check BootType */
|
||||
Status = IniCacheGetKey(OsIniSection, L"BootType", &KeyData);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if ((KeyData == NULL) ||
|
||||
( (_wcsicmp(KeyData, L"Windows2003") != 0) &&
|
||||
(_wcsicmp(KeyData, L"\"Windows2003\"") != 0) ))
|
||||
( (_wcsicmp(KeyData, L"ReactOS") != 0) &&
|
||||
(_wcsicmp(KeyData, L"\"ReactOS\"") != 0) ))
|
||||
{
|
||||
/* This is not a ReactOS entry */
|
||||
UseExistingEntry = FALSE;
|
||||
@@ -564,17 +606,17 @@ UpdateFreeLoaderIni(
|
||||
|
||||
if (UseExistingEntry)
|
||||
{
|
||||
/* BootType is Windows2003. Now check SystemPath. */
|
||||
/* BootType is ReactOS. Now check SystemPath */
|
||||
Status = IniCacheGetKey(OsIniSection, L"SystemPath", &KeyData);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
swprintf(SystemPath, L"\"%s\"", ArcPath);
|
||||
swprintf(SystemPath, L"\"%S\"", ArcPath);
|
||||
if ((KeyData == NULL) ||
|
||||
( (_wcsicmp(KeyData, ArcPath) != 0) &&
|
||||
(_wcsicmp(KeyData, SystemPath) != 0) ))
|
||||
((_wcsicmp(KeyData, ArcPath) != 0) &&
|
||||
(_wcsicmp(KeyData, SystemPath) != 0) ))
|
||||
{
|
||||
/* This entry is a ReactOS entry, but the SystemRoot
|
||||
does not match the one we are looking for. */
|
||||
/* This entry is a ReactOS entry, but the SystemRoot does not
|
||||
match the one we are looking for */
|
||||
UseExistingEntry = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -596,11 +638,29 @@ UpdateFreeLoaderIni(
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Create a new "ReactOS" entry */
|
||||
CreateFreeLoaderEntry(IniCache, IniSection,
|
||||
SectionName, OsName,
|
||||
L"Windows2003", ArcPath,
|
||||
L"");
|
||||
/* <SectionName>=<OsName> */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
SectionName,
|
||||
OsName);
|
||||
|
||||
/* Create <SectionName> section */
|
||||
IniSection = IniCacheAppendSection(IniCache, SectionName);
|
||||
|
||||
/* BootType=ReactOS */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"BootType",
|
||||
L"ReactOS");
|
||||
|
||||
/* SystemPath=<ArcPath> */
|
||||
IniCacheInsertKey(IniSection,
|
||||
NULL,
|
||||
INSERT_LAST,
|
||||
L"SystemPath",
|
||||
ArcPath);
|
||||
|
||||
IniCacheSave(IniCache, IniPath);
|
||||
IniCacheDestroy(IniCache);
|
||||
@@ -1884,13 +1944,16 @@ UpdateBootIni(
|
||||
PWSTR EntryName,
|
||||
PWSTR EntryValue)
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
PINICACHE Cache = NULL;
|
||||
PINICACHESECTION Section = NULL;
|
||||
NTSTATUS Status;
|
||||
ULONG FileAttribute;
|
||||
PWCHAR OldValue = NULL;
|
||||
|
||||
Status = IniCacheLoad(&Cache, BootIniPath, FALSE);
|
||||
RtlInitUnicodeString(&Name, BootIniPath);
|
||||
|
||||
Status = IniCacheLoad(&Cache, &Name, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
@@ -2015,7 +2078,7 @@ InstallFatBootcodeToPartition(
|
||||
|
||||
/* Install new bootcode */
|
||||
if (PartitionType == PARTITION_FAT32 ||
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
{
|
||||
/* Install FAT32 bootcode */
|
||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||
@@ -2134,7 +2197,7 @@ InstallFatBootcodeToPartition(
|
||||
|
||||
/* Install new bootsector */
|
||||
if (PartitionType == PARTITION_FAT32 ||
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
{
|
||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||
wcscat(SrcPath, L"\\loader\\fat32.bin");
|
||||
|
@@ -142,7 +142,7 @@ IniCacheAddKey(
|
||||
}
|
||||
|
||||
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHEKEY));
|
||||
if (Key == NULL)
|
||||
{
|
||||
@@ -150,9 +150,6 @@ IniCacheAddKey(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Key,
|
||||
sizeof(INICACHEKEY));
|
||||
|
||||
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(NameLength + 1) * sizeof(WCHAR));
|
||||
@@ -222,7 +219,7 @@ IniCacheAddSection(
|
||||
}
|
||||
|
||||
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHESECTION));
|
||||
if (Section == NULL)
|
||||
{
|
||||
@@ -230,8 +227,6 @@ IniCacheAddSection(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Section, sizeof(INICACHESECTION));
|
||||
|
||||
/* Allocate and initialize section name */
|
||||
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
@@ -474,10 +469,9 @@ IniCacheGetKeyValue(
|
||||
NTSTATUS
|
||||
IniCacheLoad(
|
||||
PINICACHE *Cache,
|
||||
PWCHAR FileName,
|
||||
PUNICODE_STRING FileName,
|
||||
BOOLEAN String)
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
FILE_STANDARD_INFORMATION FileInfo;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
@@ -503,10 +497,8 @@ IniCacheLoad(
|
||||
*Cache = NULL;
|
||||
|
||||
/* Open ini file */
|
||||
RtlInitUnicodeString(&Name, FileName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
@@ -542,7 +534,7 @@ IniCacheLoad(
|
||||
|
||||
DPRINT("File size: %lu\n", FileLength);
|
||||
|
||||
/* Allocate file buffer */
|
||||
/* Allocate file buffer with NULL-terminator */
|
||||
FileBuffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
FileLength + 1);
|
||||
@@ -565,7 +557,7 @@ IniCacheLoad(
|
||||
&FileOffset,
|
||||
NULL);
|
||||
|
||||
/* Append string terminator */
|
||||
/* Append NULL-terminator */
|
||||
FileBuffer[FileLength] = 0;
|
||||
|
||||
NtClose(FileHandle);
|
||||
@@ -579,7 +571,7 @@ IniCacheLoad(
|
||||
|
||||
/* Allocate inicache header */
|
||||
*Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHE));
|
||||
if (*Cache == NULL)
|
||||
{
|
||||
@@ -587,9 +579,6 @@ IniCacheLoad(
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Initialize inicache header */
|
||||
RtlZeroMemory(*Cache, sizeof(INICACHE));
|
||||
|
||||
/* Parse ini file */
|
||||
Section = NULL;
|
||||
Ptr = FileBuffer;
|
||||
@@ -842,7 +831,7 @@ IniCacheInsertKey(
|
||||
|
||||
/* Allocate key buffer */
|
||||
Key = (PINICACHEKEY)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHEKEY));
|
||||
if (Key == NULL)
|
||||
{
|
||||
@@ -850,8 +839,6 @@ IniCacheInsertKey(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Key, sizeof(INICACHEKEY));
|
||||
|
||||
/* Allocate name buffer */
|
||||
Key->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
@@ -930,7 +917,7 @@ IniCacheCreate(VOID)
|
||||
|
||||
/* Allocate inicache header */
|
||||
Cache = (PINICACHE)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHE));
|
||||
if (Cache == NULL)
|
||||
{
|
||||
@@ -938,9 +925,6 @@ IniCacheCreate(VOID)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize inicache header */
|
||||
RtlZeroMemory(Cache, sizeof(INICACHE));
|
||||
|
||||
return Cache;
|
||||
}
|
||||
|
||||
@@ -984,24 +968,21 @@ IniCacheSave(
|
||||
|
||||
Section = Section->Next;
|
||||
if (Section != NULL)
|
||||
BufferSize += 2; /* extra "\r\n" at end of each section */
|
||||
BufferSize += 2; /* Extra "\r\n" at end of each section */
|
||||
}
|
||||
BufferSize++; /* Null-terminator */
|
||||
|
||||
DPRINT("BufferSize: %lu\n", BufferSize);
|
||||
|
||||
/* Allocate file buffer */
|
||||
/* Allocate file buffer with NULL-terminator */
|
||||
Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
BufferSize);
|
||||
HEAP_ZERO_MEMORY,
|
||||
BufferSize + 1);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
DPRINT1("RtlAllocateHeap() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Buffer, BufferSize);
|
||||
|
||||
/* Fill file buffer */
|
||||
Ptr = Buffer;
|
||||
Section = Cache->FirstSection;
|
||||
@@ -1027,7 +1008,8 @@ IniCacheSave(
|
||||
}
|
||||
|
||||
/* Create ini file */
|
||||
RtlInitUnicodeString(&Name, FileName);
|
||||
RtlInitUnicodeString(&Name,
|
||||
FileName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
@@ -1093,7 +1075,7 @@ IniCacheAppendSection(
|
||||
}
|
||||
|
||||
Section = (PINICACHESECTION)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(INICACHESECTION));
|
||||
if (Section == NULL)
|
||||
{
|
||||
@@ -1101,8 +1083,6 @@ IniCacheAppendSection(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Section, sizeof(INICACHESECTION));
|
||||
|
||||
/* Allocate and initialize section name */
|
||||
Section->Name = (WCHAR*)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
|
@@ -76,7 +76,7 @@ typedef enum
|
||||
NTSTATUS
|
||||
IniCacheLoad(
|
||||
PINICACHE *Cache,
|
||||
PWCHAR FileName,
|
||||
PUNICODE_STRING FileName,
|
||||
BOOLEAN String);
|
||||
|
||||
VOID
|
||||
|
@@ -1823,6 +1823,8 @@ MUI_STRING itITStrings[] =
|
||||
" %sSpazio non partizionato%s %6lu %s"},
|
||||
{STRING_MAXSIZE,
|
||||
"MB (max. %lu MB)"},
|
||||
{STRING_EXTENDED_PARTITION,
|
||||
"Partizione estesa"},
|
||||
{STRING_UNFORMATTED,
|
||||
"Nuova (Non formattata)"},
|
||||
{STRING_FORMATUNUSED,
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -21,7 +21,7 @@ StartRpcServer(VOID)
|
||||
{
|
||||
RPC_STATUS Status;
|
||||
|
||||
TRACE("StartRpcServer() called\n");
|
||||
TRACE("ScmStartRpcServer() called\n");
|
||||
|
||||
Status = RpcServerUseProtseqEpW(L"ncacn_np",
|
||||
10,
|
||||
@@ -415,12 +415,7 @@ BaseInitiateSystemShutdown(
|
||||
BOOLEAN bRebootAfterShutdown)
|
||||
{
|
||||
TRACE("BaseInitiateSystemShutdown()\n");
|
||||
return BaseInitiateSystemShutdownEx(ServerName,
|
||||
lpMessage,
|
||||
dwTimeout,
|
||||
bForceAppsClosed,
|
||||
bRebootAfterShutdown,
|
||||
0);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,7 +425,7 @@ __stdcall
|
||||
BaseAbortSystemShutdown(
|
||||
PREGISTRY_SERVER_NAME ServerName)
|
||||
{
|
||||
TRACE("BaseAbortSystemShutdown()\n");
|
||||
TRACE("\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -497,19 +492,8 @@ BaseInitiateSystemShutdownEx(
|
||||
BOOLEAN bRebootAfterShutdown,
|
||||
ULONG dwReason)
|
||||
{
|
||||
TRACE("BaseInitiateSystemShutdownEx()\n");
|
||||
TRACE(" Message: %wZ\n", lpMessage);
|
||||
TRACE(" Timeout: %lu\n", dwTimeout);
|
||||
TRACE(" Force: %d\n", bForceAppsClosed);
|
||||
TRACE(" Reboot: %d\n", bRebootAfterShutdown);
|
||||
TRACE(" Reason: %lu\n", dwReason);
|
||||
|
||||
// return ERROR_SUCCESS;
|
||||
|
||||
/* FIXME */
|
||||
return ExitWindowsEx((bRebootAfterShutdown ? EWX_REBOOT : EWX_SHUTDOWN) |
|
||||
(bForceAppsClosed ? EWX_FORCE : 0),
|
||||
dwReason);
|
||||
TRACE("\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
32
reactos/base/system/winlogon/setup.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS winlogon
|
||||
* FILE: base/system/winlogon/setup.h
|
||||
* PURPOSE: Setup support functions
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
DWORD GetSetupType (VOID);
|
||||
BOOL RunSetup (VOID);
|
||||
|
||||
/* EOF */
|
@@ -46,6 +46,7 @@
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
|
||||
|
||||
#include "setup.h"
|
||||
#include "resource.h"
|
||||
|
||||
typedef BOOL (WINAPI * PFWLXNEGOTIATE) (DWORD, DWORD *);
|
||||
@@ -305,14 +306,8 @@ InitializeScreenSaver(IN OUT PWLSESSION Session);
|
||||
VOID
|
||||
StartScreenSaver(IN PWLSESSION Session);
|
||||
|
||||
/* setup.c */
|
||||
DWORD
|
||||
GetSetupType(VOID);
|
||||
|
||||
BOOL
|
||||
RunSetup(VOID);
|
||||
|
||||
/* winlogon.c */
|
||||
|
||||
BOOL
|
||||
PlaySoundRoutine(IN LPCWSTR FileName,
|
||||
IN UINT Logon,
|
||||
|
@@ -58,7 +58,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "")
|
||||
|
||||
#create the empty Desktop, Favorites, and Start Menu folders
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Desktop\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "Profiles/Default User/Favorites\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Favorites\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Start Menu/Programs\n")
|
||||
|
||||
add_custom_target(hybridcd
|
||||
|
@@ -6,11 +6,6 @@ Signature = "$ReactOS$"
|
||||
BCD,"BCD00000000\Description\Control","System",0x00010003,1
|
||||
BCD,"BCD00000000\Description\Control","TreatAtSystem",0x00010003,1
|
||||
BCD,"BCD00000000\Description\Control","KeyName",2,"BCD00000000"
|
||||
|
||||
BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Description","Type",0x00010003,0x10100002
|
||||
|
||||
BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000002","Element",2,"\EFI\BOOT\BOOTIA32.EFI"
|
||||
BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000004","Element",2,"ReactOS Boot Manager"
|
||||
BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000005","Element",2,"en-US"
|
||||
BCD,"BCD00000000\Objects",,0x00000012
|
||||
|
||||
; EOF
|
||||
|
@@ -143,7 +143,7 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","InstallRoot.NET",0x000
|
||||
|
||||
; HACK - Start rosvboxmgmt - ROSAPPS-303
|
||||
;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt autolink"
|
||||
;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt autoassign"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt autoassign"
|
||||
|
||||
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons",,0x00000012
|
||||
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu",,0x00000012
|
||||
@@ -225,7 +225,9 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32","CDAudio",0x00000002,"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32","Sequencer",0x00000002,"mciseq.dll"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32","WaveAudio",0x00000002,"mciwave.dll"
|
||||
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","aif",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","aifc",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","aiff",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","asf",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","asx",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","au",0x00000002,"MPEGVideo"
|
||||
@@ -246,7 +248,6 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","mpeg",0x0000
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","mpg",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","mpv",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","mpv2",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","rmi",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","rmi",0x00000002,"Sequencer"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","snd",0x00000002,"MPEGVideo"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI Extensions","wav",0x00000002,"WaveAudio"
|
||||
|
@@ -1234,31 +1234,8 @@ HKLM,"SYSTEM\CurrentControlSet\Control\ServiceGroupOrder","List",0x00010000, \
|
||||
"Boot Bus Extender", \
|
||||
"System Bus Extender", \
|
||||
"SCSI Miniport", \
|
||||
"Port", \
|
||||
"Primary Disk", \
|
||||
"SCSI Class", \
|
||||
"SCSI CDROM Class", \
|
||||
"FSFilter Infrastructure", \
|
||||
"FSFilter System", \
|
||||
"FSFilter Bottom", \
|
||||
"FSFilter Copy Protection", \
|
||||
"FSFilter Security Enhancer", \
|
||||
"FSFilter Open File", \
|
||||
"FSFilter Physical Quota Management", \
|
||||
"FSFilter Encryption", \
|
||||
"FSFilter Compression", \
|
||||
"FSFilter HSM", \
|
||||
"FSFilter Cluster File System", \
|
||||
"FSFilter System Recovery", \
|
||||
"FSFilter Quota Management", \
|
||||
"FSFilter Content Screener", \
|
||||
"FSFilter Continuous Backup", \
|
||||
"FSFilter Replication", \
|
||||
"FSFilter Anti-Virus", \
|
||||
"FSFilter Undelete", \
|
||||
"FSFilter Activity Monitor", \
|
||||
"FSFilter Top", \
|
||||
"Filter", \
|
||||
"Boot File System", \
|
||||
"Base", \
|
||||
"Pointer Port", \
|
||||
@@ -1270,29 +1247,16 @@ HKLM,"SYSTEM\CurrentControlSet\Control\ServiceGroupOrder","List",0x00010000, \
|
||||
"Video", \
|
||||
"Video Save", \
|
||||
"File System", \
|
||||
"Event Log", \
|
||||
"Streams Drivers", \
|
||||
"NDIS Wrapper", \
|
||||
"Event log", \
|
||||
"COM Infrastructure", \
|
||||
"UIGroup", \
|
||||
"LocalValidation", \
|
||||
"PlugPlay", \
|
||||
"PNP_TDI", \
|
||||
"NDIS", \
|
||||
"PNP_TDI", \
|
||||
"TDI", \
|
||||
"NetBIOSGroup", \
|
||||
"ShellSvcGroup", \
|
||||
"PlugPlay", \
|
||||
"SchedulerGroup", \
|
||||
"SpoolerGroup", \
|
||||
"AudioGroup", \
|
||||
"SmartCardGroup", \
|
||||
"NetworkProvider" \
|
||||
"RemoteValidation", \
|
||||
"NetDDEGroup", \
|
||||
"Parallel arbitrator", \
|
||||
"Extended Base" \
|
||||
"PCI Configuration", \
|
||||
"MS Transactions
|
||||
"UIGroup", \
|
||||
"Extended Base"
|
||||
|
||||
; Set the timeout for directx/ReactX graphic surface lock see _EDD_DIRECTDRAW_GLOBAL struct for more info
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\GraphicsDrivers\DCI","Timeout",0x00010001,0x00000007
|
||||
@@ -1445,7 +1409,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog",,0x00000010
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","DisplayName",0x00000000,"Event Logger"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Description",0x00000000,"Logs events or messages sent by the operating system in a database accessible via the event log viewer"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Group",0x00000000,"Event Log"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Group",0x00000000,"Event log"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%SystemRoot%\system32\eventlog.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ObjectName",0x00000000,"LocalSystem"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002
|
||||
@@ -1979,13 +1943,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs\Parameters","CheckingBitmap",0x00
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs\Parameters","Ext3ForceWriting",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs\Parameters","AutoMount",0x00010001,0x00000001
|
||||
|
||||
; Filesystem Filter Manager driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\rosfltmgr","ErrorControl",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\rosfltmgr","Group",0x00000000,"Boot File System"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\rosfltmgr","ImagePath",0x00020000,"system32\drivers\rosfltmgr.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\rosfltmgr","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\rosfltmgr","Type",0x00010001,0x00000002
|
||||
|
||||
; ControlSet selection settings
|
||||
HKLM,"SYSTEM\Select","Current",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\Select","Default",0x00010001,0x00000001
|
||||
|
@@ -16,7 +16,7 @@ Signature = "$ReactOS$"
|
||||
|
||||
[DiskSpaceRequirements]
|
||||
; Required free system partition disk space in MB
|
||||
FreeSysPartDiskSpace=450
|
||||
FreeSysPartDiskSpace=550
|
||||
|
||||
[SourceDisksFiles]
|
||||
acpi.sys=,,,,,,,,,,,,4
|
||||
|
@@ -12,13 +12,8 @@ list(APPEND BOOTLIB_SOURCE
|
||||
lib/bootlib.c
|
||||
lib/misc/debug.c
|
||||
lib/misc/bcd.c
|
||||
lib/misc/bcdopt.c
|
||||
lib/misc/bootreg.c
|
||||
lib/misc/util.c
|
||||
lib/misc/image.c
|
||||
lib/misc/resource.c
|
||||
lib/misc/font.c
|
||||
lib/firmware/fwutil.c
|
||||
lib/firmware/efi/firmware.c
|
||||
lib/mm/mm.c
|
||||
lib/mm/pagealloc.c
|
||||
@@ -68,7 +63,7 @@ endif()
|
||||
add_asm_files(bootlib_asm ${BOOTLIB_ASM_SOURCE})
|
||||
add_library(bootlib ${BOOTLIB_SOURCE} ${bootlib_asm})
|
||||
add_pch(bootlib app/bootmgr/bootmgr.h BOOTLIB_SOURCE)
|
||||
add_dependencies(bootlib bugcodes bootmsg xdk)
|
||||
add_dependencies(bootlib bugcodes xdk)
|
||||
|
||||
list(APPEND BOOTMGR_BASE_SOURCE
|
||||
app/bootmgr/efiemu.c
|
||||
@@ -76,7 +71,7 @@ list(APPEND BOOTMGR_BASE_SOURCE
|
||||
app/bootmgr/rtlcompat.c
|
||||
)
|
||||
|
||||
add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE} app/bootmgr/bootmgr.rc)
|
||||
add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE})
|
||||
set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
|
||||
|
||||
if(MSVC)
|
||||
@@ -105,3 +100,5 @@ endif()
|
||||
|
||||
add_dependencies(bootmgfw asm bugcodes)
|
||||
|
||||
add_cd_file(TARGET bootmgfw FILE ${_bootmgfw_output_file} DESTINATION efi/boot NO_CAB FOR bootcd regtest NAME_ON_CD boot${EFI_PLATFORM_ID}.efi)
|
||||
|
||||
|
@@ -29,9 +29,6 @@
|
||||
/* BCD Headers */
|
||||
#include <bcd.h>
|
||||
|
||||
/* Message Header */
|
||||
#include <bootmsg.h>
|
||||
|
||||
/* STRUCTURES ****************************************************************/
|
||||
|
||||
typedef struct _BL_BOOT_ERROR
|
||||
@@ -52,9 +49,7 @@ typedef struct _BL_PACKED_BOOT_ERROR
|
||||
ULONG Size;
|
||||
} BL_PACKED_BOOT_ERROR, *PBL_PACKED_BOOT_ERROR;
|
||||
|
||||
#define BL_FATAL_ERROR_BCD_READ 0x01
|
||||
#define BL_FATAL_ERROR_GENERIC 0x04
|
||||
#define BL_FATAL_ERROR_BCD_PARSE 0x07
|
||||
#define BL_FATAL_ERROR_BCD_READ 0x01
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Manager
|
||||
* FILE: boot/environ/app/bootmgr.rc
|
||||
* PURPOSE: Boot Manager Resource File
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
#include <winver.h>
|
||||
#include <ntverp.h>
|
||||
|
||||
/* Version Data */
|
||||
#define VER_FILETYPE VFT_DRV
|
||||
#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
|
||||
#define VER_FILEDESCRIPTION_STR "Boot Manager"
|
||||
#define VER_INTERNALNAME_STR "bootmgr.exe"
|
||||
#define VER_ORIGINALFILENAME_STR "bootmgr.exe"
|
||||
#define VER_LANGNEUTRAL
|
||||
#include "common.ver"
|
||||
|
||||
/* Message Table */
|
||||
#include <bootmsg.rc>
|
||||
|
||||
/* XML GUI Stylesheet */
|
||||
BOOTMGR.XSL HTML "bootmgr.xsl"
|
@@ -319,7 +319,7 @@ EfiInitpGetDeviceNode (
|
||||
|
||||
/* Loop each device path, until we get to the end or to a file path device node */
|
||||
for ((NextPath = NextDevicePathNode(DevicePath));
|
||||
!(IsDevicePathEndType(NextPath)) && ((NextPath->Type != MEDIA_DEVICE_PATH) ||
|
||||
!(IsDevicePathEndType(NextPath)) && ((NextPath->Type != MEDIA_DEVICE_PATH) &&
|
||||
(NextPath->SubType != MEDIA_FILEPATH_DP));
|
||||
(NextPath = NextDevicePathNode(NextPath)))
|
||||
{
|
||||
|
@@ -23,8 +23,6 @@ CHECK_PAGED_CODE_RTL (
|
||||
}
|
||||
#endif
|
||||
|
||||
PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFF;
|
||||
|
||||
PVOID
|
||||
NTAPI
|
||||
RtlpAllocateMemory (
|
||||
@@ -32,8 +30,7 @@ RtlpAllocateMemory (
|
||||
_In_ ULONG Tag
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Tag);
|
||||
return BlMmAllocateHeap(Bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VOID
|
||||
@@ -43,8 +40,7 @@ RtlpFreeMemory (
|
||||
_In_ ULONG Tag
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Tag);
|
||||
BlMmFreeHeap(Mem);
|
||||
return;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@@ -68,11 +64,7 @@ RtlAssert (
|
||||
IN PCHAR Message OPTIONAL
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"*** ASSERTION %s FAILED AT %d in %s (%s) ***\r \n",
|
||||
FailedAssertion,
|
||||
LineNumber,
|
||||
FileName,
|
||||
Message);
|
||||
|
||||
}
|
||||
|
||||
ULONG
|
||||
@@ -81,18 +73,5 @@ DbgPrint (
|
||||
...
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"%s\r\n", Format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KeBugCheckEx(
|
||||
_In_ ULONG BugCheckCode,
|
||||
_In_ ULONG_PTR BugCheckParameter1,
|
||||
_In_ ULONG_PTR BugCheckParameter2,
|
||||
_In_ ULONG_PTR BugCheckParameter3,
|
||||
_In_ ULONG_PTR BugCheckParameter4)
|
||||
{
|
||||
__assume(0);
|
||||
}
|
||||
|
@@ -11,21 +11,6 @@
|
||||
|
||||
/* ENUMERATIONS **************************************************************/
|
||||
|
||||
/* See https://msdn.microsoft.com/en-us/library/windows/desktop/aa964229(v=vs.85).aspx */
|
||||
|
||||
#define BCD_CLASS_LIBRARY 0x01
|
||||
#define BCD_CLASS_APPLICATION 0x02
|
||||
#define BCD_CLASS_DEVICE 0x03
|
||||
#define BCD_CLASS_OEM 0x05
|
||||
|
||||
#define BCD_TYPE_DEVICE 0x01
|
||||
#define BCD_TYPE_STRING 0x02
|
||||
#define BCD_TYPE_OBJECT 0x03
|
||||
#define BCD_TYPE_OBJECT_LIST 0x04
|
||||
#define BCD_TYPE_INTEGER 0x05
|
||||
#define BCD_TYPE_BOOLEAN 0x06
|
||||
#define BCD_TYPE_INTEGER_LIST 0x07
|
||||
|
||||
typedef enum BcdLibraryElementTypes
|
||||
{
|
||||
BcdLibraryDevice_ApplicationDevice = 0x11000001,
|
||||
@@ -63,7 +48,6 @@ typedef enum BcdLibraryElementTypes
|
||||
BcdLibraryBoolean_DisplayOptionsEdit = 0x16000041,
|
||||
BcdLibraryDevice_BsdLogDevice = 0x11000043,
|
||||
BcdLibraryString_BsdLogPath = 0x12000044,
|
||||
BcdLibraryBoolean_PreserveBsdLog = 0x16000045, /* Undocumented */
|
||||
BcdLibraryBoolean_GraphicsModeDisabled = 0x16000046,
|
||||
BcdLibraryInteger_ConfigAccessPolicy = 0x15000047,
|
||||
BcdLibraryBoolean_DisableIntegrityChecks = 0x16000048,
|
||||
@@ -79,8 +63,7 @@ typedef enum BcdLibraryElementTypes
|
||||
BcdLibraryBoolean_BootUxDisable = 0x1600006C,
|
||||
BcdLibraryBoolean_BootShutdownDisabled = 0x16000074,
|
||||
BcdLibraryIntegerList_AllowedInMemorySettings = 0x17000077,
|
||||
BcdLibraryBoolean_ForceFipsCrypto = 0x16000079,
|
||||
BcdLibraryBoolean_MobileGraphics = 0x1600007A /* Undocumented */
|
||||
BcdLibraryBoolean_ForceFipsCrypto = 0x16000079
|
||||
} BcdLibraryElementTypes;
|
||||
|
||||
typedef enum BcdOSLoaderElementTypes
|
||||
@@ -172,43 +155,9 @@ typedef enum BcdBootMgrElementTypes
|
||||
BcdBootMgrBoolean_PersistBootSequence = 0x26000031
|
||||
} BcdBootMgrElementTypes;
|
||||
|
||||
|
||||
/* DATA STRUCTURES ***********************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
ULONG PackedValue;
|
||||
struct
|
||||
{
|
||||
ULONG SubType : 24;
|
||||
ULONG Format : 4;
|
||||
ULONG Class : 4;
|
||||
};
|
||||
};
|
||||
} BcdElementType;
|
||||
|
||||
typedef struct _BCD_ELEMENT_HEADER
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Type;
|
||||
ULONG Size;
|
||||
} BCD_ELEMENT_HEADER, *PBCD_ELEMENT_HEADER;
|
||||
|
||||
typedef struct _BCD_PACKED_ELEMENT
|
||||
{
|
||||
struct _BCD_PACKED_ELEMENT* NextEntry;
|
||||
BcdElementType RootType;
|
||||
BCD_ELEMENT_HEADER;
|
||||
UCHAR Data[ANYSIZE_ARRAY];
|
||||
} BCD_PACKED_ELEMENT, *PBCD_PACKED_ELEMENT;
|
||||
|
||||
typedef struct _BCD_ELEMENT
|
||||
{
|
||||
PBCD_ELEMENT_HEADER Header;
|
||||
PUCHAR Body;
|
||||
} BCD_ELEMENT, *PBCD_ELEMENT;
|
||||
|
||||
typedef struct _BCD_DEVICE_OPTION
|
||||
{
|
||||
GUID AssociatedEntry;
|
||||
@@ -223,35 +172,4 @@ BcdOpenStoreFromFile (
|
||||
_In_ PHANDLE StoreHandle
|
||||
);
|
||||
|
||||
#define BCD_ENUMERATE_FLAG_DEEP 0x04
|
||||
#define BCD_ENUMERATE_FLAG_DEVICES 0x08
|
||||
#define BCD_ENUMERATE_FLAG_IN_ORDER 0x10
|
||||
|
||||
NTSTATUS
|
||||
BiEnumerateElements (
|
||||
_In_ HANDLE BcdHandle,
|
||||
_In_ HANDLE ObjectHandle,
|
||||
_In_ ULONG RootElementType,
|
||||
_In_ ULONG Flags,
|
||||
_Out_opt_ PBCD_PACKED_ELEMENT Elements,
|
||||
_Inout_ PULONG ElementSize,
|
||||
_Out_ PULONG ElementCountNe
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BcdOpenObject (
|
||||
_In_ HANDLE BcdHandle,
|
||||
_In_ PGUID ObjectId,
|
||||
_Out_ PHANDLE ObjectHandle
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BcdEnumerateAndUnpackElements (
|
||||
_In_ HANDLE BcdHandle,
|
||||
_In_ HANDLE ObjectHandle,
|
||||
_Out_opt_ PBCD_ELEMENT Elements,
|
||||
_Inout_ PULONG ElementSize,
|
||||
_Out_ PULONG ElementCount
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
/*b
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/include/bl.h
|
||||
* PURPOSE: Main Boot Library Header
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef _BL_H
|
||||
#define _BL_H
|
||||
@@ -22,15 +22,6 @@
|
||||
/* NDK Headers */
|
||||
#include <ntndk.h>
|
||||
|
||||
/* NT SafeInt Header */
|
||||
#include <ntintsafe.h>
|
||||
|
||||
/* PE Headers */
|
||||
#include <ntimage.h>
|
||||
|
||||
/* ACPI Headers */
|
||||
#include <drivers/acpi/acpi.h>
|
||||
|
||||
/* UEFI Headers */
|
||||
#include <Uefi.h>
|
||||
#include <DevicePath.h>
|
||||
@@ -38,8 +29,6 @@
|
||||
#include <GraphicsOutput.h>
|
||||
#include <UgaDraw.h>
|
||||
#include <BlockIo.h>
|
||||
#include <Acpi.h>
|
||||
#include <GlobalVariable.h>
|
||||
|
||||
/* Registry Headers */
|
||||
#define __FREELDR_H
|
||||
@@ -63,9 +52,7 @@
|
||||
#define BL_FIRMWARE_DESCRIPTOR_VERSION 2
|
||||
|
||||
#define BL_APPLICATION_ENTRY_FLAG_NO_GUID 0x01
|
||||
#define BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL 0x02
|
||||
#define BL_APPLICATION_ENTRY_REBOOT_ON_ERROR 0x20
|
||||
#define BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL 0x80
|
||||
|
||||
#define BL_CONTEXT_PAGING_ON 1
|
||||
#define BL_CONTEXT_INTERRUPTS_ON 2
|
||||
@@ -249,7 +236,6 @@ typedef enum _BL_MEMORY_TYPE
|
||||
//
|
||||
// Application Memory
|
||||
//
|
||||
BlApplicationReserved = 0xE0000001,
|
||||
BlApplicationData = 0xE0000004,
|
||||
|
||||
//
|
||||
@@ -292,11 +278,9 @@ typedef enum _BL_MEMORY_ATTR
|
||||
//
|
||||
// Memory Allocation Attributes
|
||||
//
|
||||
BlMemoryUnknown = 0x00010000,
|
||||
BlMemoryNonFixed = 0x00020000,
|
||||
BlMemoryFixed = 0x00040000,
|
||||
BlMemoryReserved = 0x00080000,
|
||||
BlMemoryValidAllocationAttributes = BlMemoryNonFixed | BlMemoryFixed | BlMemoryReserved | BlMemoryUnknown,
|
||||
BlMemoryValidAllocationAttributes = BlMemoryNonFixed | BlMemoryFixed,
|
||||
BlMemoryValidAllocationAttributeMask = 0x00FF0000,
|
||||
|
||||
//
|
||||
@@ -400,12 +384,8 @@ NTSTATUS
|
||||
|
||||
struct _BL_TEXT_CONSOLE;
|
||||
struct _BL_DISPLAY_STATE;
|
||||
struct _BL_DISPLAY_MODE;
|
||||
struct _BL_INPUT_CONSOLE;
|
||||
struct _BL_REMOTE_CONSOLE;
|
||||
struct _BL_GRAPHICS_CONSOLE;
|
||||
typedef
|
||||
VOID
|
||||
NTSTATUS
|
||||
(*PCONSOLE_DESTRUCT) (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
);
|
||||
@@ -450,36 +430,9 @@ typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_CLEAR_TEXT) (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
_In_ ULONG Attribute
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(*PCONSOLE_IS_ENABLED) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_GET_GRAPHICAL_RESOLUTION) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_Out_ struct _BL_DISPLAY_MODE* DisplayMode
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_SET_GRAPHICAL_RESOLUTION) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ struct _BL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_ENABLE) (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ BOOLEAN Enable
|
||||
);
|
||||
|
||||
typedef
|
||||
NTSTATUS
|
||||
(*PCONSOLE_WRITE_TEXT) (
|
||||
@@ -763,9 +716,9 @@ typedef struct _BL_LOCAL_DEVICE
|
||||
|
||||
typedef struct _BL_DEVICE_DESCRIPTOR
|
||||
{
|
||||
DEVICE_TYPE DeviceType;
|
||||
ULONG Flags;
|
||||
ULONG Size;
|
||||
ULONG Flags;
|
||||
DEVICE_TYPE DeviceType;
|
||||
ULONG Unknown;
|
||||
union
|
||||
{
|
||||
@@ -912,12 +865,6 @@ typedef struct _BL_TEXT_CONSOLE_VTABLE
|
||||
typedef struct _BL_GRAPHICS_CONSOLE_VTABLE
|
||||
{
|
||||
BL_TEXT_CONSOLE_VTABLE Text;
|
||||
PCONSOLE_IS_ENABLED IsEnabled;
|
||||
PCONSOLE_ENABLE Enable;
|
||||
PVOID GetConsoleResolution;
|
||||
PCONSOLE_GET_GRAPHICAL_RESOLUTION GetGraphicalResolution;
|
||||
PCONSOLE_GET_GRAPHICAL_RESOLUTION GetOriginalResolution;
|
||||
PCONSOLE_SET_GRAPHICAL_RESOLUTION SetOriginalResolution;
|
||||
/// more for graphics ///
|
||||
} BL_GRAPHICS_CONSOLE_VTABLE, *PBL_GRAPHICS_CONSOLE_VTABLE;
|
||||
|
||||
@@ -932,25 +879,6 @@ typedef struct _BL_TEXT_CONSOLE
|
||||
EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode;
|
||||
} BL_TEXT_CONSOLE, *PBL_TEXT_CONSOLE;
|
||||
|
||||
typedef struct _BL_INPUT_CONSOLE_VTABLE
|
||||
{
|
||||
PCONSOLE_DESTRUCT Destruct;
|
||||
PCONSOLE_REINITIALIZE Reinitialize;
|
||||
//PCONSOLE_IS_KEY_PENDING IsKeyPending;
|
||||
//PCONSOLE_READ_INPUT ReadInput;
|
||||
//PCONSOLE_ERASE_BUFFER EraseBuffer;
|
||||
//PCONSOLE_FILL_BUFFER FillBuffer;
|
||||
} BL_INPUT_CONSOLE_VTABLE, *PBL_INPUT_CONSOLE_VTABLE;
|
||||
|
||||
typedef struct _BL_INPUT_CONSOLE
|
||||
{
|
||||
PBL_INPUT_CONSOLE_VTABLE Callbacks;
|
||||
PULONG Buffer;
|
||||
PULONG DataStart;
|
||||
PULONG DataEnd;
|
||||
PULONG EndBuffer;
|
||||
} BL_INPUT_CONSOLE, *PBL_INPUT_CONSOLE;
|
||||
|
||||
typedef enum _BL_GRAPHICS_CONSOLE_TYPE
|
||||
{
|
||||
BlGopConsole,
|
||||
@@ -1096,52 +1024,6 @@ typedef struct _BL_IMG_FILE
|
||||
PWCHAR FileName;
|
||||
} BL_IMG_FILE, *PBL_IMG_FILE;
|
||||
|
||||
typedef struct _BL_DEFERRED_FONT_FILE
|
||||
{
|
||||
LIST_ENTRY ListEntry;
|
||||
ULONG Flags;
|
||||
PBL_DEVICE_DESCRIPTOR Device;
|
||||
PWCHAR FontPath;
|
||||
} BL_DEFERRED_FONT_FILE, *PBL_DEFERRED_FONT_FILE;
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct _BMP_HEADER
|
||||
{
|
||||
USHORT Signature;
|
||||
ULONG Size;
|
||||
USHORT Reserved[2];
|
||||
ULONG Offset;
|
||||
} BMP_HEADER, *PBMP_HEADER;
|
||||
|
||||
typedef struct _DIB_HEADER
|
||||
{
|
||||
ULONG Size;
|
||||
ULONG Width;
|
||||
ULONG Height;
|
||||
USHORT Planes;
|
||||
USHORT BitCount;
|
||||
ULONG Compression;
|
||||
ULONG SizeImage;
|
||||
ULONG XPelsPerMeter;
|
||||
ULONG YPelsPerMEter;
|
||||
ULONG ClrUsed;
|
||||
ULONG ClrImportant;
|
||||
} DIB_HEADER, *PDIB_HEADER;
|
||||
|
||||
typedef struct _BITMAP
|
||||
{
|
||||
BMP_HEADER BmpHeader;
|
||||
DIB_HEADER DibHeader;
|
||||
} BITMAP, *PBITMAP;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct _COORD
|
||||
{
|
||||
ULONG X;
|
||||
ULONG Y;
|
||||
} COORD, *PCOORD;
|
||||
|
||||
/* INLINE ROUTINES ***********************************************************/
|
||||
|
||||
FORCEINLINE
|
||||
@@ -1285,22 +1167,6 @@ EfiStall (
|
||||
_In_ ULONG StallTime
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExReset (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConInReset (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutOutputString (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ PWCHAR String
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutQueryMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
@@ -1397,11 +1263,6 @@ EfiIsDevicePathParent (
|
||||
_In_ EFI_DEVICE_PATH *DevicePath2
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
EfipGetRsdt (
|
||||
_Out_ PPHYSICAL_ADDRESS FoundRsdt
|
||||
);
|
||||
|
||||
/* PLATFORM TIMER ROUTINES ***************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -1409,41 +1270,6 @@ BlpTimeCalibratePerformanceCounter (
|
||||
VOID
|
||||
);
|
||||
|
||||
/* RESOURCE LOCALE INTERNATIONALIZATION ROUTINES *****************************/
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayRegisterLocale (
|
||||
_In_ PWCHAR Locale
|
||||
);
|
||||
|
||||
/* FONT ROUTINES *************************************************************/
|
||||
|
||||
VOID
|
||||
BfiFreeDeferredFontFile (
|
||||
_In_ PBL_DEFERRED_FONT_FILE DeferredFontFile
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BfLoadFontFile (
|
||||
_In_ PBL_DEVICE_DESCRIPTOR Device,
|
||||
_In_ PWCHAR FontPath
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BfLoadDeferredFontFiles (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BfClearScreen (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BfClearToEndOfLine (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
);
|
||||
|
||||
/* FILESYSTEM ROUTINES *******************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -1508,12 +1334,6 @@ BlUtlUpdateProgress (
|
||||
_Out_opt_ PBOOLEAN Completed
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlUtlGetAcpiTable (
|
||||
_Out_ PVOID* TableAddress,
|
||||
_In_ ULONG Signature
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EfiGetEfiStatusCode(
|
||||
_In_ NTSTATUS Status
|
||||
@@ -1529,11 +1349,6 @@ BlUtlInitialize (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlUtlRegisterProgressRoutine (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
BlFwReboot (
|
||||
VOID
|
||||
@@ -1544,42 +1359,11 @@ BlGetApplicationIdentifier (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlpSecureBootEFIIsEnabled (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlSecureBootIsEnabled (
|
||||
_Out_ PBOOLEAN SecureBootEnabled
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlSecureBootCheckForFactoryReset (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlGetApplicationBaseAndSize (
|
||||
_Out_ PVOID* ImageBase,
|
||||
_Out_ PULONG ImageSize
|
||||
);
|
||||
|
||||
PWCHAR
|
||||
BlResourceFindMessage (
|
||||
_In_ ULONG MsgId
|
||||
);
|
||||
|
||||
PWCHAR
|
||||
BlResourceFindHtml (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlpResourceInitialize (
|
||||
VOID
|
||||
);
|
||||
|
||||
/* TABLE ROUTINES ************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -1640,18 +1424,7 @@ BlHtCreate (
|
||||
_Out_ PULONG Id
|
||||
);
|
||||
|
||||
/* BCD OPTION ROUTINES *******************************************************/
|
||||
|
||||
PBL_BCD_OPTION
|
||||
MiscGetBootOption (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type
|
||||
);
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionListSize (
|
||||
_In_ PBL_BCD_OPTION BcdOption
|
||||
);
|
||||
/* BCD ROUTINES **************************************************************/
|
||||
|
||||
ULONG
|
||||
BlGetBootOptionSize (
|
||||
@@ -1679,15 +1452,6 @@ BlGetBootOptionBoolean (
|
||||
_Out_ PBOOLEAN Value
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlpGetBootOptionIntegerList (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PULONGLONG* Value,
|
||||
_Out_ PULONGLONG Count,
|
||||
_In_ BOOLEAN NoCopy
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionDevice (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
@@ -1696,68 +1460,6 @@ BlGetBootOptionDevice (
|
||||
_In_opt_ PBL_BCD_OPTION* ExtraOptions
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionGuidList (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PGUID *Value,
|
||||
_In_ PULONG Count
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlCopyBootOptions (
|
||||
_In_ PBL_BCD_OPTION OptionList,
|
||||
_Out_ PBL_BCD_OPTION *CopiedOptions
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlAppendBootOptions (
|
||||
_In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
|
||||
_In_ PBL_BCD_OPTION Options
|
||||
);
|
||||
|
||||
/* BOOT REGISTRY ROUTINES ****************************************************/
|
||||
|
||||
VOID
|
||||
BiCloseKey (
|
||||
_In_ HANDLE KeyHandle
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BiOpenKey(
|
||||
_In_ HANDLE ParentHandle,
|
||||
_In_ PWCHAR KeyName,
|
||||
_Out_ PHANDLE Handle
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BiLoadHive (
|
||||
_In_ PBL_FILE_PATH_DESCRIPTOR FilePath,
|
||||
_Out_ PHANDLE HiveHandle
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BiGetRegistryValue (
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PWCHAR ValueName,
|
||||
_In_ PWCHAR KeyName,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PVOID* Buffer,
|
||||
_Out_ PULONG ValueLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BiEnumerateSubKeys (
|
||||
_In_ HANDLE KeyHandle,
|
||||
_Out_ PWCHAR** SubKeyList,
|
||||
_Out_ PULONG SubKeyCount
|
||||
);
|
||||
|
||||
VOID
|
||||
BiDereferenceHive (
|
||||
_In_ HANDLE KeyHandle
|
||||
);
|
||||
|
||||
/* CONTEXT ROUTINES **********************************************************/
|
||||
|
||||
VOID
|
||||
@@ -1837,18 +1539,6 @@ BlMmAllocatePhysicalPages(
|
||||
_In_ ULONG Alignment
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
MmPapAllocatePhysicalPagesInRange (
|
||||
_Inout_ PPHYSICAL_ADDRESS BaseAddress,
|
||||
_In_ BL_MEMORY_TYPE MemoryType,
|
||||
_In_ ULONGLONG Pages,
|
||||
_In_ ULONG Attributes,
|
||||
_In_ ULONG Alignment,
|
||||
_In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
|
||||
_In_opt_ PBL_ADDRESS_RANGE Range,
|
||||
_In_ ULONG RangeType
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlMmFreePhysicalPages (
|
||||
_In_ PHYSICAL_ADDRESS Address
|
||||
@@ -1871,16 +1561,6 @@ MmFwGetMemoryMap (
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlpMmInitializeConstraints (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlMmRemoveBadMemory (
|
||||
VOID
|
||||
);
|
||||
|
||||
/* VIRTUAL MEMORY ROUTINES ***************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -1924,43 +1604,6 @@ BlDisplayGetTextCellResolution (
|
||||
_Out_ PULONG TextHeight
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlDisplaySetScreenResolution (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlDisplayGetScreenResolution (
|
||||
_Out_ PULONG HRes,
|
||||
_Out_ PULONG Vres
|
||||
);
|
||||
|
||||
VOID
|
||||
BlDisplayInvalidateOemBitmap (
|
||||
VOID
|
||||
);
|
||||
|
||||
PBITMAP
|
||||
BlDisplayGetOemBitmap (
|
||||
_Out_ PCOORD Offset,
|
||||
_Out_opt_ PULONG Flags
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
BlDisplayValidOemBitmap (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlDisplayClearScreen (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
BlDisplaySetCursorType (
|
||||
_In_ ULONG Type
|
||||
);
|
||||
|
||||
/* I/O ROUTINES **************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -2017,12 +1660,6 @@ BlImgLoadImageWithProgress2 (
|
||||
_Out_opt_ PULONG HashSize
|
||||
);
|
||||
|
||||
PIMAGE_SECTION_HEADER
|
||||
BlImgFindSection (
|
||||
_In_ PVOID ImageBase,
|
||||
_In_ ULONG ImageSize
|
||||
);
|
||||
|
||||
/* FILE I/O ROUTINES *********************************************************/
|
||||
|
||||
NTSTATUS
|
||||
@@ -2054,78 +1691,9 @@ BlFileOpen (
|
||||
_Out_ PULONG FileId
|
||||
);
|
||||
|
||||
/* INPUT CONSOLE ROUTINES ****************************************************/
|
||||
|
||||
VOID
|
||||
ConsoleInputLocalDestruct (
|
||||
_In_ struct _BL_INPUT_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseReinitialize (
|
||||
_In_ struct _BL_INPUT_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputCnsole (
|
||||
VOID
|
||||
);
|
||||
|
||||
/* TEXT CONSOLE ROUTINES *****************************************************/
|
||||
|
||||
VOID
|
||||
ConsoleGraphicalDestruct (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalClearText (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalClearPixels (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Color
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalReinitialize (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalSetTextState (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Mask,
|
||||
_In_ PBL_DISPLAY_STATE TextState
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ConsoleGraphicalIsEnabled (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetGraphicalResolution (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetOriginalResolution (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalEnable (
|
||||
_In_ struct _BL_GRAPHICS_CONSOLE* Console,
|
||||
_In_ BOOLEAN Enable
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsoleTextLocalDestruct (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
);
|
||||
@@ -2164,7 +1732,7 @@ ConsoleTextLocalSetTextResolution (
|
||||
NTSTATUS
|
||||
ConsoleTextLocalClearText (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
_In_ ULONG Attribute
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
@@ -2187,12 +1755,6 @@ ConsolepFindResolution (
|
||||
_In_ ULONG MaxIndex
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareTextClear (
|
||||
_In_ PBL_TEXT_CONSOLE Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsoleFirmwareTextClose (
|
||||
_In_ PBL_TEXT_CONSOLE TextConsole
|
||||
@@ -2231,17 +1793,6 @@ ConsoleFirmwareGraphicalClose (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsoleFirmwareGraphicalDisable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareGraphicalClear (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Color
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareGraphicalEnable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
@@ -2279,33 +1830,6 @@ ConsoleEfiUgaSetResolution (
|
||||
_In_ ULONG DisplayModeCount
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputConsole (
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputLocalEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG ValueToFill
|
||||
);
|
||||
|
||||
VOID
|
||||
ConsolepClearBuffer (
|
||||
_In_ PUCHAR FrameBuffer,
|
||||
_In_ ULONG Width,
|
||||
_In_ PUCHAR FillColor,
|
||||
_In_ ULONG Height,
|
||||
_In_ ULONG ScanlineWidth,
|
||||
_In_ ULONG PixelDepth
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ConsolepConvertColorToPixel (
|
||||
_In_ BL_COLOR Color,
|
||||
_Out_ PUCHAR Pixel
|
||||
);
|
||||
|
||||
extern ULONG MmDescriptorCallTreeCount;
|
||||
extern ULONG BlpApplicationFlags;
|
||||
extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
|
||||
@@ -2313,23 +1837,17 @@ extern BL_TRANSLATION_TYPE MmTranslationType;
|
||||
extern PBL_ARCH_CONTEXT CurrentExecutionContext;
|
||||
extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
|
||||
extern BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
|
||||
extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
|
||||
extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
|
||||
extern SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut;
|
||||
extern EFI_GUID EfiGraphicsOutputProtocol;
|
||||
extern EFI_GUID EfiUgaDrawProtocol;
|
||||
extern EFI_GUID EfiLoadedImageProtocol;
|
||||
extern EFI_GUID EfiDevicePathProtocol;
|
||||
extern EFI_GUID EfiBlockIoProtocol;
|
||||
extern EFI_GUID EfiSimpleTextInputExProtocol;
|
||||
extern EFI_GUID EfiRootAcpiTableGuid;
|
||||
extern EFI_GUID EfiRootAcpiTable10Guid;
|
||||
extern EFI_GUID EfiGlobalVariable;
|
||||
extern ULONG ConsoleGraphicalResolutionListFlags;
|
||||
extern BL_DISPLAY_MODE ConsoleGraphicalResolutionList[];
|
||||
extern BL_DISPLAY_MODE ConsoleTextResolutionList[];
|
||||
extern ULONG ConsoleGraphicalResolutionListSize;
|
||||
extern PVOID DspRemoteInputConsole;
|
||||
extern PVOID DspLocalInputConsole;
|
||||
extern WCHAR BlScratchBuffer[8192];
|
||||
extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
|
||||
#endif
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/** @file
|
||||
GUIDs used for ACPI entries in the EFI system table
|
||||
|
||||
These GUIDs point the ACPI tables as defined in the ACPI specifications.
|
||||
ACPI 2.0 specification defines the ACPI 2.0 GUID. UEFI 2.0 defines the
|
||||
ACPI 2.0 Table GUID and ACPI Table GUID.
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUIDs defined in UEFI 2.0 spec.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __ACPI_GUID_H__
|
||||
#define __ACPI_GUID_H__
|
||||
|
||||
#define ACPI_TABLE_GUID \
|
||||
{ \
|
||||
0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define EFI_ACPI_TABLE_GUID \
|
||||
{ \
|
||||
0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
#define ACPI_10_TABLE_GUID ACPI_TABLE_GUID
|
||||
|
||||
//
|
||||
// ACPI 2.0 or newer tables should use EFI_ACPI_TABLE_GUID.
|
||||
//
|
||||
#define EFI_ACPI_20_TABLE_GUID EFI_ACPI_TABLE_GUID
|
||||
|
||||
extern EFI_GUID gEfiAcpiTableGuid;
|
||||
extern EFI_GUID gEfiAcpi10TableGuid;
|
||||
extern EFI_GUID gEfiAcpi20TableGuid;
|
||||
|
||||
#endif
|
@@ -1,192 +0,0 @@
|
||||
/** @file
|
||||
GUID for EFI (NVRAM) Variables.
|
||||
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUID defined in UEFI 2.1
|
||||
**/
|
||||
|
||||
#ifndef __GLOBAL_VARIABLE_GUID_H__
|
||||
#define __GLOBAL_VARIABLE_GUID_H__
|
||||
|
||||
#define EFI_GLOBAL_VARIABLE \
|
||||
{ \
|
||||
0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiGlobalVariableGuid;
|
||||
|
||||
//
|
||||
// Follow UEFI 2.4 spec:
|
||||
// To prevent name collisions with possible future globally defined variables,
|
||||
// other internal firmware data variables that are not defined here must be
|
||||
// saved with a unique VendorGuid other than EFI_GLOBAL_VARIABLE or
|
||||
// any other GUID defined by the UEFI Specification. Implementations must
|
||||
// only permit the creation of variables with a UEFI Specification-defined
|
||||
// VendorGuid when these variables are documented in the UEFI Specification.
|
||||
//
|
||||
// Note: except the globally defined variables defined below, the spec also defines
|
||||
// L"Boot####" - A boot load option.
|
||||
// L"Driver####" - A driver load option.
|
||||
// L"SysPrep####" - A System Prep application load option.
|
||||
// L"Key####" - Describes hot key relationship with a Boot#### load option.
|
||||
// The attribute for them is NV+BS+RT, #### is a printed hex value, and no 0x or h
|
||||
// is included in the hex value. They can not be expressed as a #define like other globally
|
||||
// defined variables, it is because we can not list the Boot0000, Boot0001, etc one by one.
|
||||
//
|
||||
|
||||
///
|
||||
/// The language codes that the firmware supports. This value is deprecated.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_LANG_CODES_VARIABLE_NAME L"LangCodes"
|
||||
///
|
||||
/// The language code that the system is configured for. This value is deprecated.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_LANG_VARIABLE_NAME L"Lang"
|
||||
///
|
||||
/// The firmware's boot managers timeout, in seconds, before initiating the default boot selection.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_TIME_OUT_VARIABLE_NAME L"Timeout"
|
||||
///
|
||||
/// The language codes that the firmware supports.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_PLATFORM_LANG_CODES_VARIABLE_NAME L"PlatformLangCodes"
|
||||
///
|
||||
/// The language code that the system is configured for.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_PLATFORM_LANG_VARIABLE_NAME L"PlatformLang"
|
||||
///
|
||||
/// The device path of the default input/output/error output console.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_CON_IN_VARIABLE_NAME L"ConIn"
|
||||
#define EFI_CON_OUT_VARIABLE_NAME L"ConOut"
|
||||
#define EFI_ERR_OUT_VARIABLE_NAME L"ErrOut"
|
||||
///
|
||||
/// The device path of all possible input/output/error output devices.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_CON_IN_DEV_VARIABLE_NAME L"ConInDev"
|
||||
#define EFI_CON_OUT_DEV_VARIABLE_NAME L"ConOutDev"
|
||||
#define EFI_ERR_OUT_DEV_VARIABLE_NAME L"ErrOutDev"
|
||||
///
|
||||
/// The ordered boot option load list.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_BOOT_ORDER_VARIABLE_NAME L"BootOrder"
|
||||
///
|
||||
/// The boot option for the next boot only.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_BOOT_NEXT_VARIABLE_NAME L"BootNext"
|
||||
///
|
||||
/// The boot option that was selected for the current boot.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_BOOT_CURRENT_VARIABLE_NAME L"BootCurrent"
|
||||
///
|
||||
/// The types of boot options supported by the boot manager. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME L"BootOptionSupport"
|
||||
///
|
||||
/// The ordered driver load option list.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_DRIVER_ORDER_VARIABLE_NAME L"DriverOrder"
|
||||
///
|
||||
/// The ordered System Prep Application load option list.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_SYS_PREP_ORDER_VARIABLE_NAME L"SysPrepOrder"
|
||||
///
|
||||
/// Identifies the level of hardware error record persistence
|
||||
/// support implemented by the platform. This variable is
|
||||
/// only modified by firmware and is read-only to the OS.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME L"HwErrRecSupport"
|
||||
///
|
||||
/// Whether the system is operating in setup mode (1) or not (0).
|
||||
/// All other values are reserved. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_SETUP_MODE_NAME L"SetupMode"
|
||||
///
|
||||
/// The Key Exchange Key Signature Database.
|
||||
/// Its attribute is NV+BS+RT+AT.
|
||||
///
|
||||
#define EFI_KEY_EXCHANGE_KEY_NAME L"KEK"
|
||||
///
|
||||
/// The public Platform Key.
|
||||
/// Its attribute is NV+BS+RT+AT.
|
||||
///
|
||||
#define EFI_PLATFORM_KEY_NAME L"PK"
|
||||
///
|
||||
/// Array of GUIDs representing the type of signatures supported
|
||||
/// by the platform firmware. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_SIGNATURE_SUPPORT_NAME L"SignatureSupport"
|
||||
///
|
||||
/// Whether the platform firmware is operating in Secure boot mode (1) or not (0).
|
||||
/// All other values are reserved. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_SECURE_BOOT_MODE_NAME L"SecureBoot"
|
||||
///
|
||||
/// The OEM's default Key Exchange Key Signature Database. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_KEK_DEFAULT_VARIABLE_NAME L"KEKDefault"
|
||||
///
|
||||
/// The OEM's default public Platform Key. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_PK_DEFAULT_VARIABLE_NAME L"PKDefault"
|
||||
///
|
||||
/// The OEM's default secure boot signature store. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_DB_DEFAULT_VARIABLE_NAME L"dbDefault"
|
||||
///
|
||||
/// The OEM's default secure boot blacklist signature store. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_DBX_DEFAULT_VARIABLE_NAME L"dbxDefault"
|
||||
///
|
||||
/// The OEM's default secure boot timestamp signature store. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_DBT_DEFAULT_VARIABLE_NAME L"dbtDefault"
|
||||
///
|
||||
/// Allows the firmware to indicate supported features and actions to the OS.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME L"OsIndicationsSupported"
|
||||
///
|
||||
/// Allows the OS to request the firmware to enable certain features and to take certain actions.
|
||||
/// Its attribute is NV+BS+RT.
|
||||
///
|
||||
#define EFI_OS_INDICATIONS_VARIABLE_NAME L"OsIndications"
|
||||
///
|
||||
/// Whether the system is configured to use only vendor provided
|
||||
/// keys or not. Should be treated as read-only.
|
||||
/// Its attribute is BS+RT.
|
||||
///
|
||||
#define EFI_VENDOR_KEYS_VARIABLE_NAME L"VendorKeys"
|
||||
|
||||
#endif
|
@@ -86,15 +86,11 @@ InitializeLibrary (
|
||||
BlpApplicationParameters = BootAppParameters;
|
||||
BlpLibraryParameters = *LibraryParameters;
|
||||
|
||||
/* Check if the caller sent us their internal BCD options */
|
||||
if (AppEntry->Flags & BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL)
|
||||
{
|
||||
/* These are external to us now, as far as we are concerned */
|
||||
AppEntry->Flags &= ~BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL;
|
||||
AppEntry->Flags |= BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL;
|
||||
}
|
||||
|
||||
/* Save the application entry flags */
|
||||
if (AppEntry->Flags & 2)
|
||||
{
|
||||
AppEntry->Flags = (AppEntry->Flags & ~0x2) | 0x80;
|
||||
}
|
||||
BlpApplicationEntry.Flags = AppEntry->Flags;
|
||||
|
||||
/* Copy the GUID and point to the options */
|
||||
@@ -290,17 +286,18 @@ InitializeLibrary (
|
||||
BlpSiInitialize(1);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Setup the text, UI and font resources */
|
||||
Status = BlpResourceInitialize();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Tear down everything if this failed */
|
||||
if (!(LibraryParameters->LibraryFlags & BL_LIBRARY_FLAG_NO_DISPLAY))
|
||||
if (!(LibraryParameters->LibraryFlags & BL_LIBRARY_FLAG_TEXT_MODE))
|
||||
{
|
||||
// BlpDisplayDestroy();
|
||||
}
|
||||
//BlpBdDestroy();
|
||||
#ifdef BL_KD_SUPPORT
|
||||
BlpBdDestroy();
|
||||
PltDestroyPciConfiguration();
|
||||
#endif
|
||||
#ifdef BL_NET_SUPPORT
|
||||
@@ -316,6 +313,7 @@ InitializeLibrary (
|
||||
//BlpMmDestroy(1);
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BL_BITLOCKER_SUPPORT
|
||||
/* Setup the boot cryptography library */
|
||||
@@ -365,26 +363,17 @@ BlInitializeLibrary(
|
||||
BlpLibraryParameters = *LibraryParameters;
|
||||
if (LibraryParameters->LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL)
|
||||
{
|
||||
#ifdef BL_TPM_SUPPORT
|
||||
/* Reinitialize the TPM security enclave as BCD hash changed */
|
||||
#if 0
|
||||
/* Initialize all the core modules again */
|
||||
BlpSiInitialize(1);
|
||||
#endif
|
||||
#ifdef BL_KD_SUPPORT
|
||||
/* Reinitialize the boot debugger as BCD debug options changed */
|
||||
BlBdInitialize();
|
||||
#endif
|
||||
|
||||
/* Reparse the bad page list now that the BCD has been reloaded */
|
||||
BlMmRemoveBadMemory();
|
||||
|
||||
/* Reparse the low/high physical address limits as well */
|
||||
BlpMmInitializeConstraints();
|
||||
|
||||
/* Redraw the graphics console as needed */
|
||||
BlpDisplayInitialize(LibraryParameters->LibraryFlags);
|
||||
|
||||
/* Reinitialize resources (language may have changed) */
|
||||
BlpResourceInitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing to do, we're done */
|
||||
@@ -418,21 +407,3 @@ BlGetApplicationIdentifier (
|
||||
return (BlpApplicationEntry.Flags & BL_APPLICATION_ENTRY_FLAG_NO_GUID) ?
|
||||
NULL : &BlpApplicationEntry.Guid;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetApplicationBaseAndSize (
|
||||
_Out_ PVOID* ImageBase,
|
||||
_Out_ PULONG ImageSize
|
||||
)
|
||||
{
|
||||
/* Fail if output parameters are missing */
|
||||
if (!ImageBase || !ImageSize)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the requested data */
|
||||
*ImageBase = (PVOID)(ULONG_PTR)BlpApplicationParameters->ImageBase;
|
||||
*ImageSize = BlpApplicationParameters->ImageSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ EFI_RUNTIME_SERVICES *EfiRT;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *EfiConIn;
|
||||
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
|
||||
PHYSICAL_ADDRESS EfiRsdt;
|
||||
|
||||
EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
|
||||
EFI_GUID EfiUgaDrawProtocol = EFI_UGA_DRAW_PROTOCOL_GUID;
|
||||
@@ -31,16 +30,9 @@ EFI_GUID EfiLoadedImageProtocol = EFI_LOADED_IMAGE_PROTOCOL_GUID;
|
||||
EFI_GUID EfiDevicePathProtocol = EFI_DEVICE_PATH_PROTOCOL_GUID;
|
||||
EFI_GUID EfiSimpleTextInputExProtocol = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
|
||||
EFI_GUID EfiBlockIoProtocol = EFI_BLOCK_IO_PROTOCOL_GUID;
|
||||
EFI_GUID EfiRootAcpiTableGuid = EFI_ACPI_20_TABLE_GUID;
|
||||
EFI_GUID EfiRootAcpiTable10Guid = EFI_ACPI_TABLE_GUID;
|
||||
EFI_GUID EfiGlobalVariable = EFI_GLOBAL_VARIABLE;
|
||||
EFI_GUID BlpEfiSecureBootPrivateNamespace = { 0x77FA9ABD , 0x0359, 0x4D32, { 0xBD, 0x60, 0x28, 0xF4, 0xE7, 0x8F, 0x78, 0x4B } };
|
||||
|
||||
WCHAR BlScratchBuffer[8192];
|
||||
|
||||
BOOLEAN BlpFirmwareChecked;
|
||||
BOOLEAN BlpFirmwareEnabled;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
@@ -49,21 +41,14 @@ EfiIsDevicePathParent (
|
||||
_In_ EFI_DEVICE_PATH *DevicePath2
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH* CurrentPath1;
|
||||
EFI_DEVICE_PATH* CurrentPath2;
|
||||
USHORT Length1, Length2;
|
||||
|
||||
/* Start with the current nodes */
|
||||
CurrentPath1 = DevicePath1;
|
||||
CurrentPath2 = DevicePath2;
|
||||
|
||||
/* Loop each element of the device path */
|
||||
while (!(IsDevicePathEndType(CurrentPath1)) &&
|
||||
!(IsDevicePathEndType(CurrentPath2)))
|
||||
while (!IsDevicePathEndType(DevicePath1) && !IsDevicePathEndType(DevicePath2))
|
||||
{
|
||||
/* Check if the element has a different length */
|
||||
Length1 = DevicePathNodeLength(CurrentPath1);
|
||||
Length2 = DevicePathNodeLength(CurrentPath2);
|
||||
Length1 = DevicePathNodeLength(DevicePath1);
|
||||
Length2 = DevicePathNodeLength(DevicePath2);
|
||||
if (Length1 != Length2)
|
||||
{
|
||||
/* Then they're not related */
|
||||
@@ -71,25 +56,25 @@ EfiIsDevicePathParent (
|
||||
}
|
||||
|
||||
/* Check if the rest of the element data matches */
|
||||
if (RtlCompareMemory(CurrentPath1, CurrentPath2, Length1) != Length1)
|
||||
if (RtlCompareMemory(DevicePath1, DevicePath2, Length1) != Length1)
|
||||
{
|
||||
/* Nope, not related */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Move to the next element */
|
||||
CurrentPath1 = NextDevicePathNode(CurrentPath1);
|
||||
CurrentPath2 = NextDevicePathNode(CurrentPath2);
|
||||
DevicePath1 = NextDevicePathNode(DevicePath1);
|
||||
DevicePath2 = NextDevicePathNode(DevicePath2);
|
||||
}
|
||||
|
||||
/* If the last element in path 1 is empty, then path 2 is the child (deeper) */
|
||||
if (!IsDevicePathEndType(CurrentPath1))
|
||||
if (!IsDevicePathEndType(DevicePath1))
|
||||
{
|
||||
return DevicePath2;
|
||||
}
|
||||
|
||||
/* If the last element in path 2 is empty, then path 1 is the child (deeper) */
|
||||
if (!IsDevicePathEndType(CurrentPath2))
|
||||
if (!IsDevicePathEndType(DevicePath2))
|
||||
{
|
||||
return DevicePath1;
|
||||
}
|
||||
@@ -273,217 +258,6 @@ EfiCloseProtocol (
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiGetVariable (
|
||||
_In_ PWCHAR VariableName,
|
||||
_In_ EFI_GUID* VendorGuid,
|
||||
_Out_opt_ PULONG Attributes,
|
||||
_Inout_ PULONG DataSize,
|
||||
_Out_ PVOID Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS EfiStatus;
|
||||
NTSTATUS Status;
|
||||
BL_ARCH_MODE OldMode;
|
||||
ULONG LocalAttributes;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Call the runtime API */
|
||||
EfiStatus = EfiRT->GetVariable(VariableName,
|
||||
VendorGuid,
|
||||
(UINT32*)&LocalAttributes,
|
||||
(UINTN*)DataSize,
|
||||
Data);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Return attributes back to the caller if asked to */
|
||||
if (Attributes)
|
||||
{
|
||||
*Attributes = LocalAttributes;
|
||||
}
|
||||
|
||||
/* Convert the errot to an NTSTATUS and return it */
|
||||
Status = EfiGetNtStatusCode(EfiStatus);
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpSecureBootEFIIsEnabled (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
BOOLEAN SetupMode, SecureBoot;
|
||||
ULONG DataSize;
|
||||
|
||||
/* Assume setup mode enabled, and no secure boot */
|
||||
SecureBoot = FALSE;
|
||||
SetupMode = TRUE;
|
||||
|
||||
/* Get the SetupMode variable */
|
||||
DataSize = sizeof(SetupMode);
|
||||
Status = EfiGetVariable(L"SetupMode",
|
||||
&EfiGlobalVariable,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&SetupMode);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* If it worked, get the SecureBoot variable */
|
||||
DataSize = sizeof(SecureBoot);
|
||||
Status = EfiGetVariable(L"SecureBoot",
|
||||
&EfiGlobalVariable,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&SecureBoot);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* In setup mode or without secureboot turned on, return failure */
|
||||
if ((SecureBoot != TRUE) || (SetupMode))
|
||||
{
|
||||
Status = STATUS_INVALID_SIGNATURE;
|
||||
}
|
||||
|
||||
// BlpSbdiStateFlags |= 8u;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return secureboot status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlSecureBootIsEnabled (
|
||||
_Out_ PBOOLEAN SecureBootEnabled
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Have we checked before ? */
|
||||
if (!BlpFirmwareChecked)
|
||||
{
|
||||
/* First time checking */
|
||||
Status = BlpSecureBootEFIIsEnabled();
|
||||
if NT_SUCCESS(Status)
|
||||
{
|
||||
/* Yep, it's on */
|
||||
BlpFirmwareEnabled = TRUE;
|
||||
}
|
||||
|
||||
/* Don't check again */
|
||||
BlpFirmwareChecked = TRUE;
|
||||
}
|
||||
|
||||
/* Return the firmware result */
|
||||
*SecureBootEnabled = BlpFirmwareEnabled;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlSecureBootCheckForFactoryReset (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN SecureBootEnabled;
|
||||
NTSTATUS Status;
|
||||
ULONG DataSize;
|
||||
|
||||
/* Initialize locals */
|
||||
DataSize = 0;
|
||||
SecureBootEnabled = FALSE;
|
||||
|
||||
/* Check if secureboot is enabled */
|
||||
Status = BlSecureBootIsEnabled(&SecureBootEnabled);
|
||||
if (!(NT_SUCCESS(Status)) || !(SecureBootEnabled))
|
||||
{
|
||||
/* It's not. Check if there's a revocation list */
|
||||
Status = EfiGetVariable(L"RevocationList",
|
||||
&BlpEfiSecureBootPrivateNamespace,
|
||||
NULL,
|
||||
&DataSize,
|
||||
NULL);
|
||||
if ((NT_SUCCESS(Status)) || (Status == STATUS_BUFFER_TOO_SMALL))
|
||||
{
|
||||
/* We don't support this yet */
|
||||
EfiPrintf(L"Not yet supported\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return back to the caller */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInReset (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = EfiConIn->Reset(EfiConIn, FALSE);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExReset (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = EfiConInEx->Reset(EfiConInEx, FALSE);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConInExSetState (
|
||||
_In_ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *ConInEx,
|
||||
@@ -792,37 +566,6 @@ EfiConOutEnableCursor (
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfiConOutOutputString (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
_In_ PWCHAR String
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Make the EFI call */
|
||||
EfiStatus = TextInterface->OutputString(TextInterface, String);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Convert the error to an NTSTATUS */
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
EfiConOutReadCurrentMode (
|
||||
_In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
|
||||
@@ -1080,129 +823,6 @@ EfiAllocatePages (
|
||||
return EfiGetNtStatusCode(EfiStatus);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfipGetSystemTable (
|
||||
_In_ EFI_GUID *TableGuid,
|
||||
_Out_ PPHYSICAL_ADDRESS TableAddress
|
||||
)
|
||||
{
|
||||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Assume failure */
|
||||
Status = STATUS_NOT_FOUND;
|
||||
|
||||
/* Loop through the configuration tables */
|
||||
for (i = 0; i < EfiST->NumberOfTableEntries; i++)
|
||||
{
|
||||
/* Check if this one matches the one we want */
|
||||
if (RtlEqualMemory(&EfiST->ConfigurationTable[i].VendorGuid,
|
||||
TableGuid,
|
||||
sizeof(*TableGuid)))
|
||||
{
|
||||
/* Return its address */
|
||||
TableAddress->QuadPart = (ULONG_PTR)EfiST->ConfigurationTable[i].VendorTable;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the search result */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
EfipGetRsdt (
|
||||
_Out_ PPHYSICAL_ADDRESS FoundRsdt
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
PHYSICAL_ADDRESS RsdpAddress, Rsdt;
|
||||
PRSDP Rsdp;
|
||||
|
||||
/* Assume failure */
|
||||
Length = 0;
|
||||
Rsdp = NULL;
|
||||
|
||||
/* Check if we already know it */
|
||||
if (EfiRsdt.QuadPart)
|
||||
{
|
||||
/* Return it */
|
||||
*FoundRsdt = EfiRsdt;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Otherwise, look for the ACPI 2.0 RSDP (XSDT really) */
|
||||
Status = EfipGetSystemTable(&EfiRootAcpiTableGuid, &RsdpAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Didn't fint it, look for the ACPI 1.0 RSDP (RSDT really) */
|
||||
Status = EfipGetSystemTable(&EfiRootAcpiTable10Guid, &RsdpAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Map it */
|
||||
Length = sizeof(*Rsdp);
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID*)&Rsdp,
|
||||
0,
|
||||
Length,
|
||||
RsdpAddress);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Check the revision (anything >= 2.0 is XSDT) */
|
||||
if (Rsdp->Revision)
|
||||
{
|
||||
/* Check if the table is bigger than just its header */
|
||||
if (Rsdp->Length > Length)
|
||||
{
|
||||
/* Capture the real length */
|
||||
Length = Rsdp->Length;
|
||||
|
||||
/* Unmap our header mapping */
|
||||
BlMmUnmapVirtualAddressEx(Rsdp, sizeof(*Rsdp));
|
||||
|
||||
/* And map the whole thing now */
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID*)&Rsdp,
|
||||
0,
|
||||
Length,
|
||||
RsdpAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the XSDT address from the table*/
|
||||
Rsdt = Rsdp->XsdtAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ACPI 1.0 so just read the RSDT */
|
||||
Rsdt.QuadPart = Rsdp->RsdtAddress;
|
||||
}
|
||||
|
||||
/* Save it for later */
|
||||
EfiRsdt = Rsdt;
|
||||
|
||||
/* And return it back */
|
||||
*FoundRsdt = Rsdt;
|
||||
}
|
||||
|
||||
/* Check if we had mapped the RSDP */
|
||||
if (Rsdp)
|
||||
{
|
||||
/* Unmap it */
|
||||
BlMmUnmapVirtualAddressEx(Rsdp, Length);
|
||||
}
|
||||
|
||||
/* Return search result back to caller */
|
||||
return Status;
|
||||
}
|
||||
|
||||
BL_MEMORY_ATTR
|
||||
MmFwpGetOsAttributeType (
|
||||
_In_ ULONGLONG Attribute
|
||||
@@ -1590,9 +1210,8 @@ MmFwGetMemoryMap (
|
||||
/* Check if this region is currently free RAM */
|
||||
if (Descriptor->Type == BlConventionalMemory)
|
||||
{
|
||||
/* Set the reserved flag on the descriptor */
|
||||
EfiPrintf(L"Adding magic flag\r\n");
|
||||
Descriptor->Flags |= BlMemoryReserved;
|
||||
/* Set an unknown flag on the descriptor */
|
||||
Descriptor->Flags |= 0x80000;
|
||||
}
|
||||
|
||||
/* Add this descriptor into the list */
|
||||
@@ -1635,9 +1254,8 @@ MmFwGetMemoryMap (
|
||||
/* Check if this region is currently free RAM below 1MB */
|
||||
if ((Descriptor->Type == BlConventionalMemory) && (EndPage <= 0x100))
|
||||
{
|
||||
/* Set the reserved flag on the descriptor */
|
||||
EfiPrintf(L"Adding magic flag\r\n");
|
||||
Descriptor->Flags |= BlMemoryReserved;
|
||||
/* Set an unknown flag on the descriptor */
|
||||
Descriptor->Flags |= 0x80000;
|
||||
}
|
||||
|
||||
/* Add the descriptor to the list, requesting coalescing as asked */
|
||||
@@ -1748,137 +1366,3 @@ BlpFwInitialize (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/*++
|
||||
* @name EfiGetEfiStatusCode
|
||||
*
|
||||
* The EfiGetEfiStatusCode routine converts an NT Status to an EFI status.
|
||||
*
|
||||
* @param Status
|
||||
* NT Status code to be converted.
|
||||
*
|
||||
* @remark Only certain, specific NT status codes are converted to EFI codes.
|
||||
*
|
||||
* @return The corresponding EFI Status code, EFI_NO_MAPPING otherwise.
|
||||
*
|
||||
*--*/
|
||||
EFI_STATUS
|
||||
EfiGetEfiStatusCode(
|
||||
_In_ NTSTATUS Status
|
||||
)
|
||||
{
|
||||
switch (Status)
|
||||
{
|
||||
case STATUS_NOT_SUPPORTED:
|
||||
return EFI_UNSUPPORTED;
|
||||
case STATUS_DISK_FULL:
|
||||
return EFI_VOLUME_FULL;
|
||||
case STATUS_INSUFFICIENT_RESOURCES:
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
case STATUS_MEDIA_WRITE_PROTECTED:
|
||||
return EFI_WRITE_PROTECTED;
|
||||
case STATUS_DEVICE_NOT_READY:
|
||||
return EFI_NOT_STARTED;
|
||||
case STATUS_DEVICE_ALREADY_ATTACHED:
|
||||
return EFI_ALREADY_STARTED;
|
||||
case STATUS_MEDIA_CHANGED:
|
||||
return EFI_MEDIA_CHANGED;
|
||||
case STATUS_INVALID_PARAMETER:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
case STATUS_ACCESS_DENIED:
|
||||
return EFI_ACCESS_DENIED;
|
||||
case STATUS_BUFFER_TOO_SMALL:
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
case STATUS_DISK_CORRUPT_ERROR:
|
||||
return EFI_VOLUME_CORRUPTED;
|
||||
case STATUS_REQUEST_ABORTED:
|
||||
return EFI_ABORTED;
|
||||
case STATUS_NO_MEDIA:
|
||||
return EFI_NO_MEDIA;
|
||||
case STATUS_IO_DEVICE_ERROR:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case STATUS_INVALID_BUFFER_SIZE:
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
case STATUS_NOT_FOUND:
|
||||
return EFI_NOT_FOUND;
|
||||
case STATUS_DRIVER_UNABLE_TO_LOAD:
|
||||
return EFI_LOAD_ERROR;
|
||||
case STATUS_NO_MATCH:
|
||||
return EFI_NO_MAPPING;
|
||||
case STATUS_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
case STATUS_TIMEOUT:
|
||||
return EFI_TIMEOUT;
|
||||
default:
|
||||
return EFI_NO_MAPPING;
|
||||
}
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name EfiGetNtStatusCode
|
||||
*
|
||||
* The EfiGetNtStatusCode routine converts an EFI Status to an NT status.
|
||||
*
|
||||
* @param EfiStatus
|
||||
* EFI Status code to be converted.
|
||||
*
|
||||
* @remark Only certain, specific EFI status codes are converted to NT codes.
|
||||
*
|
||||
* @return The corresponding NT Status code, STATUS_UNSUCCESSFUL otherwise.
|
||||
*
|
||||
*--*/
|
||||
NTSTATUS
|
||||
EfiGetNtStatusCode (
|
||||
_In_ EFI_STATUS EfiStatus
|
||||
)
|
||||
{
|
||||
switch (EfiStatus)
|
||||
{
|
||||
case EFI_NOT_READY:
|
||||
case EFI_NOT_FOUND:
|
||||
return STATUS_NOT_FOUND;
|
||||
case EFI_NO_MEDIA:
|
||||
return STATUS_NO_MEDIA;
|
||||
case EFI_MEDIA_CHANGED:
|
||||
return STATUS_MEDIA_CHANGED;
|
||||
case EFI_ACCESS_DENIED:
|
||||
case EFI_SECURITY_VIOLATION:
|
||||
return STATUS_ACCESS_DENIED;
|
||||
case EFI_TIMEOUT:
|
||||
case EFI_NO_RESPONSE:
|
||||
return STATUS_TIMEOUT;
|
||||
case EFI_NO_MAPPING:
|
||||
return STATUS_NO_MATCH;
|
||||
case EFI_NOT_STARTED:
|
||||
return STATUS_DEVICE_NOT_READY;
|
||||
case EFI_ALREADY_STARTED:
|
||||
return STATUS_DEVICE_ALREADY_ATTACHED;
|
||||
case EFI_ABORTED:
|
||||
return STATUS_REQUEST_ABORTED;
|
||||
case EFI_VOLUME_FULL:
|
||||
return STATUS_DISK_FULL;
|
||||
case EFI_DEVICE_ERROR:
|
||||
return STATUS_IO_DEVICE_ERROR;
|
||||
case EFI_WRITE_PROTECTED:
|
||||
return STATUS_MEDIA_WRITE_PROTECTED;
|
||||
/* @FIXME: ReactOS Headers don't yet have this */
|
||||
//case EFI_OUT_OF_RESOURCES:
|
||||
//return STATUS_INSUFFICIENT_NVRAM_RESOURCES;
|
||||
case EFI_VOLUME_CORRUPTED:
|
||||
return STATUS_DISK_CORRUPT_ERROR;
|
||||
case EFI_BUFFER_TOO_SMALL:
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
case EFI_SUCCESS:
|
||||
return STATUS_SUCCESS;
|
||||
case EFI_LOAD_ERROR:
|
||||
return STATUS_DRIVER_UNABLE_TO_LOAD;
|
||||
case EFI_INVALID_PARAMETER:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
case EFI_UNSUPPORTED:
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
case EFI_BAD_BUFFER_SIZE:
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
default:
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/lib/firmware/fwutil.c
|
||||
* PURPOSE: Boot Library Firmware Utility Functions
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
|
||||
VOID
|
||||
BlFwReboot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#ifdef BL_KD_SUPPORTED
|
||||
/* Stop the boot debugger*/
|
||||
BlBdStop();
|
||||
#endif
|
||||
|
||||
/* Reset the machine */
|
||||
EfiResetSystem(EfiResetCold);
|
||||
}
|
||||
|
@@ -301,7 +301,7 @@ BlockIopOperation (
|
||||
}
|
||||
|
||||
Alignment = BlockDevice->Alignment;
|
||||
if (!(Alignment) || !((Alignment - 1) & (ULONG_PTR)Buffer))
|
||||
if (!Alignment || !((Alignment - 1) & (ULONG_PTR)Buffer))
|
||||
{
|
||||
Status = BlockIopFirmwareOperation(DeviceEntry,
|
||||
Buffer,
|
||||
@@ -317,6 +317,7 @@ BlockIopOperation (
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
EfiPrintf(L"Firmware alignment fixup required\r\n");
|
||||
Status = BlockIopAllocateAlignedBuffer(&BlockIopAlignedBuffer,
|
||||
&BlockIopAlignedBufferSize,
|
||||
BufferSize,
|
||||
@@ -602,32 +603,28 @@ BlDeviceSetInformation (
|
||||
{
|
||||
PBL_DEVICE_ENTRY DeviceEntry;
|
||||
|
||||
/* This parameter is not optional */
|
||||
if (!DeviceInformation)
|
||||
if (!(DeviceInformation))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure the device ID is valid */
|
||||
if (DmTableEntries <= DeviceId)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Get the device entry */
|
||||
DeviceEntry = DmDeviceTable[DeviceId];
|
||||
if (!DeviceEntry)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure the device is open */
|
||||
if (!(DeviceEntry->Flags & BL_DEVICE_ENTRY_OPENED))
|
||||
if (!(DeviceEntry->Flags & 1))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Set the device information */
|
||||
DeviceInformation->DeviceType = DeviceEntry->DeviceDescriptor->DeviceType;
|
||||
return DeviceEntry->Callbacks.SetInformation(DeviceEntry, DeviceInformation);
|
||||
}
|
||||
|
||||
@@ -639,32 +636,27 @@ BlDeviceGetInformation (
|
||||
{
|
||||
PBL_DEVICE_ENTRY DeviceEntry;
|
||||
|
||||
/* This parameter is not optional */
|
||||
if (!DeviceInformation)
|
||||
if (!(DeviceInformation))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure the device ID is valid */
|
||||
if (DmTableEntries <= DeviceId)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Get the device entry */
|
||||
DeviceEntry = DmDeviceTable[DeviceId];
|
||||
if (!DeviceEntry)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure the device is open */
|
||||
if (!(DeviceEntry->Flags & BL_DEVICE_ENTRY_OPENED))
|
||||
if (!(DeviceEntry->Flags & 1))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the device information */
|
||||
DeviceInformation->DeviceType = DeviceEntry->DeviceDescriptor->DeviceType;
|
||||
return DeviceEntry->Callbacks.GetInformation(DeviceEntry, DeviceInformation);
|
||||
}
|
||||
@@ -674,51 +666,40 @@ BlDeviceRead (
|
||||
_In_ ULONG DeviceId,
|
||||
_In_ PVOID Buffer,
|
||||
_In_ ULONG Size,
|
||||
_Out_opt_ PULONG BytesRead
|
||||
_Out_ PULONG BytesRead
|
||||
)
|
||||
{
|
||||
PBL_DEVICE_ENTRY DeviceEntry;
|
||||
NTSTATUS Status;
|
||||
ULONG BytesTransferred;
|
||||
|
||||
/* Make sure we have a buffer, and the device ID is valid */
|
||||
if (!(Buffer) || (DmTableEntries <= DeviceId))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Get the device entry for it */
|
||||
DeviceEntry = DmDeviceTable[DeviceId];
|
||||
if (!DeviceEntry)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure this is a device opened for read access */
|
||||
if (!(DeviceEntry->Flags & BL_DEVICE_ENTRY_OPENED) ||
|
||||
!(DeviceEntry->Flags & BL_DEVICE_ENTRY_READ_ACCESS))
|
||||
if (!(DeviceEntry->Flags & 1) || !(DeviceEntry->Flags & 2))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Issue the read */
|
||||
Status = DeviceEntry->Callbacks.Read(DeviceEntry,
|
||||
Buffer,
|
||||
Size,
|
||||
&BytesTransferred);
|
||||
Status = DeviceEntry->Callbacks.Read(DeviceEntry, Buffer, Size, &BytesTransferred);
|
||||
if (!DeviceEntry->Unknown)
|
||||
{
|
||||
/* Update performance counters */
|
||||
DmDeviceIoInformation.ReadCount += BytesTransferred;
|
||||
}
|
||||
|
||||
/* Return back how many bytes were read, if caller wants to know */
|
||||
if (BytesRead)
|
||||
{
|
||||
*BytesRead = BytesTransferred;
|
||||
}
|
||||
|
||||
/* Return read result */
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -763,7 +744,7 @@ BlpDeviceCompare (
|
||||
/* Assume failure */
|
||||
DeviceMatch = FALSE;
|
||||
|
||||
/* Check if the two devices exist and are identical in type */
|
||||
/* Check if the two devices exist and are identical in typ */
|
||||
if ((Device1) && (Device2) && (Device1->DeviceType == Device2->DeviceType))
|
||||
{
|
||||
/* Take the bigger of the two sizes */
|
||||
@@ -772,8 +753,8 @@ BlpDeviceCompare (
|
||||
{
|
||||
/* Compare the two devices up to their size */
|
||||
if (RtlEqualMemory(&Device1->Local,
|
||||
&Device2->Local,
|
||||
DeviceSize - FIELD_OFFSET(BL_DEVICE_DESCRIPTOR, Local)))
|
||||
&Device2->Local,
|
||||
DeviceSize - FIELD_OFFSET(BL_DEVICE_DESCRIPTOR, Local)))
|
||||
{
|
||||
/* They match! */
|
||||
DeviceMatch = TRUE;
|
||||
@@ -820,6 +801,11 @@ BlockIoEfiGetBlockIoInformation (
|
||||
/* Get information on the block media */
|
||||
Media = BlockDevice->Protocol->Media;
|
||||
|
||||
EfiPrintf(L"Block I/O Info for Device 0x%p, 0x%lX\r\n", BlockDevice, BlockDevice->Handle);
|
||||
EfiPrintf(L"Removable: %d Present: %d Last Block: %I64d BlockSize: %d IoAlign: %d MediaId: %d ReadOnly: %d\r\n",
|
||||
Media->RemovableMedia, Media->MediaPresent, Media->LastBlock, Media->BlockSize, Media->IoAlign,
|
||||
Media->MediaId, Media->ReadOnly);
|
||||
|
||||
/* Set the appropriate device flags */
|
||||
BlockDevice->DeviceFlags = 0;
|
||||
if (Media->RemovableMedia)
|
||||
@@ -920,8 +906,7 @@ BlockIoEfiGetChildHandle (
|
||||
/* Yup, return back to caller */
|
||||
ChildProtocolInterface->Handle = Handle;
|
||||
ChildProtocolInterface->Interface = DevicePath;
|
||||
Status = STATUS_SUCCESS;
|
||||
goto Quickie;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Close the device path */
|
||||
@@ -931,7 +916,6 @@ BlockIoEfiGetChildHandle (
|
||||
/* If we got here, nothing was found */
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
|
||||
Quickie:
|
||||
/* Free the handle array buffer */
|
||||
BlMmFreeHeap(DeviceHandles);
|
||||
return Status;
|
||||
@@ -983,7 +967,6 @@ BlockIoEfiGetDeviceInformation (
|
||||
/* Iteratate twice -- once for the top level, once for the bottom */
|
||||
for (i = 0, Found = FALSE; Found == FALSE && Protocol[i].Handle; i++)
|
||||
{
|
||||
/* Check what kind of leaf node device this is */
|
||||
LeafNode = EfiGetLeafNode(Protocol[i].Interface);
|
||||
EfiPrintf(L"Pass %d, Leaf node: %p Type: %d\r\n", i, LeafNode, LeafNode->Type);
|
||||
if (LeafNode->Type == ACPI_DEVICE_PATH)
|
||||
@@ -1190,7 +1173,7 @@ BlockIoEfiCreateDeviceEntry (
|
||||
Status = BlockIoEfiGetDeviceInformation(IoDeviceEntry);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* We have a fully constructed device, return it */
|
||||
/* We have a fully constructed device, reuturn it */
|
||||
*DeviceEntry = IoDeviceEntry;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1276,7 +1259,7 @@ BlockIoFirmwareOpen (
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"EFI create failed: %lx\n", Status);
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Add the device entry to the device table */
|
||||
@@ -1304,6 +1287,7 @@ BlockIoFirmwareOpen (
|
||||
|
||||
/* Does this device match what we're looking for? */
|
||||
DeviceMatch = BlpDeviceCompare(DeviceEntry->DeviceDescriptor, Device);
|
||||
EfiPrintf(L"Device match: %d\r\n", DeviceMatch);
|
||||
if (DeviceMatch)
|
||||
{
|
||||
/* Yep, return the data back */
|
||||
@@ -1493,8 +1477,8 @@ DeviceTableCompare (
|
||||
)
|
||||
{
|
||||
BOOLEAN Found;
|
||||
PBL_DEVICE_DESCRIPTOR Device = (PBL_DEVICE_DESCRIPTOR)Argument1;
|
||||
PBL_DEVICE_ENTRY DeviceEntry = (PBL_DEVICE_ENTRY)Entry;
|
||||
PBL_DEVICE_DESCRIPTOR Device = (PBL_DEVICE_DESCRIPTOR)Entry;
|
||||
PBL_DEVICE_ENTRY DeviceEntry = (PBL_DEVICE_ENTRY)Argument1;
|
||||
ULONG Flags = *(PULONG)Argument2;
|
||||
ULONG Unknown = *(PULONG)Argument3;
|
||||
|
||||
@@ -1508,8 +1492,8 @@ DeviceTableCompare (
|
||||
if (DeviceEntry->Unknown == Unknown)
|
||||
{
|
||||
/* Compare flags */
|
||||
if ((!(Flags & BL_DEVICE_READ_ACCESS) || (DeviceEntry->Flags & BL_DEVICE_ENTRY_READ_ACCESS)) &&
|
||||
(!(Flags & BL_DEVICE_WRITE_ACCESS) || (DeviceEntry->Flags & BL_DEVICE_ENTRY_WRITE_ACCESS)))
|
||||
if ((!(Flags & 1) || (DeviceEntry->Flags & 2)) &&
|
||||
(!(Flags & 2) || (DeviceEntry->Flags & 4)))
|
||||
{
|
||||
/* And more flags */
|
||||
if (((Flags & 8) || !(DeviceEntry->Flags & 8)) &&
|
||||
@@ -1556,7 +1540,7 @@ DeviceTablePurge (
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Check if the device is opened */
|
||||
if (DeviceEntry->Flags & BL_DEVICE_ENTRY_OPENED)
|
||||
if (DeviceEntry->Flags & 1)
|
||||
{
|
||||
/* It is, so can't purge it */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
@@ -1716,6 +1700,7 @@ BlockIopInitialize (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
BlockIoDeviceTableCompare (
|
||||
_In_ PVOID Entry,
|
||||
@@ -1751,6 +1736,7 @@ BlockIoOpen (
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Failed to initialize block I/O */
|
||||
EfiPrintf(L"Block I/O Init failed\r\n");
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
@@ -1783,7 +1769,7 @@ BlockIoOpen (
|
||||
if (FoundDeviceEntry)
|
||||
{
|
||||
/* We already found a device, so copy its device data and callbacks */
|
||||
//EfiPrintf(L"Block I/O Device entry found: %p\r\n", FoundDeviceEntry);
|
||||
EfiPrintf(L"Device entry found: %p\r\n", FoundDeviceEntry);
|
||||
RtlCopyMemory(BlockDevice, FoundDeviceEntry->DeviceSpecificData, sizeof(*BlockDevice));
|
||||
RtlCopyMemory(&DeviceEntry->Callbacks,
|
||||
&FoundDeviceEntry->Callbacks,
|
||||
@@ -1887,7 +1873,7 @@ BlDeviceClose (
|
||||
}
|
||||
|
||||
/* Make sure the device is active */
|
||||
if (!(DeviceEntry->Flags & BL_DEVICE_ENTRY_OPENED))
|
||||
if (!(DeviceEntry->Flags & 1))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -1897,7 +1883,7 @@ BlDeviceClose (
|
||||
if (!DeviceEntry->ReferenceCount)
|
||||
{
|
||||
/* Mark the device as inactive */
|
||||
DeviceEntry->Flags = ~BL_DEVICE_ENTRY_OPENED;
|
||||
DeviceEntry->Flags = ~1;
|
||||
}
|
||||
|
||||
/* We're good */
|
||||
@@ -1978,9 +1964,10 @@ BlpDeviceOpen (
|
||||
if (DeviceEntry)
|
||||
{
|
||||
/* Return it, taking a reference on it */
|
||||
EfiPrintf(L"Device found: %p\r\n", DeviceEntry);
|
||||
*DeviceId = DeviceEntry->DeviceId;
|
||||
++DeviceEntry->ReferenceCount;
|
||||
DeviceEntry->Flags |= BL_DEVICE_ENTRY_OPENED;
|
||||
DeviceEntry->Flags |= 1;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,6 @@ BL_DISPLAY_MODE ConsoleTextResolutionList[1] =
|
||||
PVOID DspRemoteInputConsole;
|
||||
PVOID DspTextConsole;
|
||||
PVOID DspGraphicalConsole;
|
||||
PVOID DspLocalInputConsole;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
@@ -44,211 +43,8 @@ DsppGraphicsDisabledByBcd (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN Disabled;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Get the boot option, and if present, return the result */
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsModeDisabled,
|
||||
&Disabled);
|
||||
return (NT_SUCCESS(Status) && (Disabled));
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DsppLoadFontFile (
|
||||
_In_ PWCHAR FontFileName
|
||||
)
|
||||
{
|
||||
PBL_DEVICE_DESCRIPTOR FontDevice;
|
||||
NTSTATUS Status;
|
||||
ULONG NameLength, DirectoryLength, TotalLength;
|
||||
PWCHAR FontPath, FontDirectory;
|
||||
BL_LIBRARY_PARAMETERS LibraryParameters;
|
||||
BOOLEAN CustomDirectory, CustomDevice;
|
||||
|
||||
/* Initialize locals */
|
||||
CustomDirectory = TRUE;
|
||||
CustomDevice = TRUE;
|
||||
FontDevice = NULL;
|
||||
FontPath = NULL;
|
||||
FontDirectory = NULL;
|
||||
|
||||
/* Check if a custom font path should be used */
|
||||
Status = BlGetBootOptionString(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryString_FontPath,
|
||||
&FontDirectory);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Nope, use the one configured by the library */
|
||||
CustomDirectory = FALSE;
|
||||
RtlCopyMemory(&LibraryParameters,
|
||||
&BlpLibraryParameters,
|
||||
sizeof(LibraryParameters)),
|
||||
FontDirectory = LibraryParameters.FontBaseDirectory;
|
||||
}
|
||||
|
||||
/* Do we still not have a font directory? */
|
||||
if (!FontDirectory)
|
||||
{
|
||||
/* Use the boot device and boot directory */
|
||||
FontDevice = BlpBootDevice;
|
||||
FontDirectory = L"\\EFI\\Microsoft\\Boot\\Fonts";
|
||||
CustomDevice = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, if we have a font directory, what device is the app on? */
|
||||
Status = BlGetBootOptionDevice(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryDevice_ApplicationDevice,
|
||||
&FontDevice,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* If we don't know the device, we can't open the path */
|
||||
goto Quickie;
|
||||
}
|
||||
}
|
||||
|
||||
/* Figure out the length of the file name, and of the directory */
|
||||
NameLength = wcslen(FontFileName);
|
||||
DirectoryLength = wcslen(FontDirectory);
|
||||
|
||||
/* Safely add them up*/
|
||||
Status = RtlULongAdd(NameLength, DirectoryLength, &TotalLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Convert to bytes */
|
||||
Status = RtlULongLongToULong(TotalLength * sizeof(WCHAR), &TotalLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Add a terminating NUL */
|
||||
Status = RtlULongAdd(TotalLength, sizeof(UNICODE_NULL), &TotalLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Allocate the final buffer for it */
|
||||
FontPath = BlMmAllocateHeap(TotalLength);
|
||||
if (!FontPath)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Concatenate the directory with the file name */
|
||||
wcscpy(FontPath, FontDirectory);
|
||||
wcscat(FontPath, FontFileName);
|
||||
|
||||
/* Try to load this font */
|
||||
Status = BfLoadFontFile(FontDevice, FontPath);
|
||||
|
||||
Quickie:
|
||||
/* Check if we had a custom font device allocated and free it */
|
||||
if ((CustomDevice) && (FontDevice))
|
||||
{
|
||||
BlMmFreeHeap(FontDevice);
|
||||
}
|
||||
|
||||
/* Check if we had a custom font directory allocated and free it */
|
||||
if ((FontDirectory) && (CustomDirectory))
|
||||
{
|
||||
BlMmFreeHeap(FontDirectory);
|
||||
}
|
||||
|
||||
/* Check if we had allocated a font path and free it */
|
||||
if (FontPath)
|
||||
{
|
||||
BlMmFreeHeap(FontPath);
|
||||
}
|
||||
|
||||
/* Return back */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayRegisterLocale (
|
||||
_In_ PWCHAR Locale
|
||||
)
|
||||
{
|
||||
BOOLEAN StandardLocale;
|
||||
NTSTATUS Status;
|
||||
PWCHAR FontFileName;
|
||||
PBL_DEFERRED_FONT_FILE DeferredFont;
|
||||
PLIST_ENTRY NextEntry;
|
||||
WCHAR Prefix[3];
|
||||
|
||||
/* Assume custom locale */
|
||||
StandardLocale = FALSE;
|
||||
|
||||
/* Bail out if the locale string seems invalid */
|
||||
if (wcslen(Locale) < 2)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Check the prefix first, then traditional vs. simplified */
|
||||
Prefix[0] = Locale[0];
|
||||
Prefix[1] = Locale[1];
|
||||
Prefix[2] = UNICODE_NULL;
|
||||
if (!_wcsicmp(Prefix, L"ja"))
|
||||
{
|
||||
FontFileName = L"\\jpn_boot.ttf";
|
||||
}
|
||||
else if (!_wcsicmp(Prefix, L"ko"))
|
||||
{
|
||||
FontFileName = L"\\kor_boot.ttf";
|
||||
}
|
||||
else if (!(_wcsicmp(Locale, L"zh-CN")) ||
|
||||
!(_wcsicmp(Locale, L"zh-CHS")) ||
|
||||
!(_wcsicmp(Locale, L"zh-Hans")))
|
||||
{
|
||||
FontFileName = L"\\chs_boot.ttf";
|
||||
}
|
||||
else if (!(_wcsicmp(Locale, L"zh-TW")) &&
|
||||
!(_wcsicmp(Locale, L"zh-CHT")) &&
|
||||
!(_wcsicmp(Locale, L"zh-HK")) &&
|
||||
!(_wcsicmp(Locale, L"zh-Hant")))
|
||||
{
|
||||
FontFileName = L"\\cht_boot.ttf";
|
||||
}
|
||||
else
|
||||
{
|
||||
StandardLocale = TRUE;
|
||||
FontFileName = L"\\wgl4_boot.ttf";
|
||||
}
|
||||
|
||||
/* Parse all the currently deferred fonts*/
|
||||
NextEntry = BfiDeferredListHead.Flink;
|
||||
while (NextEntry != &BfiDeferredListHead)
|
||||
{
|
||||
/* Grab the font */
|
||||
DeferredFont = CONTAINING_RECORD(NextEntry, BL_DEFERRED_FONT_FILE, ListEntry);
|
||||
|
||||
/* Move to the next entry, and remove this one */
|
||||
NextEntry = NextEntry->Flink;
|
||||
RemoveEntryList(&DeferredFont->ListEntry);
|
||||
|
||||
/* Free the deferred font, we'll be loading a new one */
|
||||
BfiFreeDeferredFontFile(DeferredFont);
|
||||
}
|
||||
|
||||
/* Load the primary font */
|
||||
Status = DsppLoadFontFile(FontFileName);
|
||||
if (NT_SUCCESS(Status) && !(StandardLocale))
|
||||
{
|
||||
/* Also load the standard US one if we loaded a different one */
|
||||
Status = DsppLoadFontFile(L"\\wgl4_boot.ttf");
|
||||
}
|
||||
|
||||
/* Return back to caller */
|
||||
return Status;
|
||||
//EarlyPrint(L"Disabling graphics\r\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@@ -257,10 +53,10 @@ DsppInitialize (
|
||||
)
|
||||
{
|
||||
BL_LIBRARY_PARAMETERS LibraryParameters = BlpLibraryParameters;
|
||||
BOOLEAN NoGraphics, HighestMode;
|
||||
BOOLEAN NoGraphics;// , HighestMode;
|
||||
NTSTATUS Status;
|
||||
PBL_DISPLAY_MODE DisplayMode;
|
||||
ULONGLONG GraphicsResolution;
|
||||
//ULONG GraphicsResolution;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
PBL_TEXT_CONSOLE TextConsole, RemoteConsole;
|
||||
|
||||
@@ -304,9 +100,14 @@ DsppInitialize (
|
||||
DisplayMode = &ConsoleGraphicalResolutionList[0];
|
||||
|
||||
/* Check what resolution to use*/
|
||||
#if 0
|
||||
Status = BlGetBootOptionInteger(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_GraphicsResolution,
|
||||
&GraphicsResolution);
|
||||
#else
|
||||
//GraphicsResolution = 0;
|
||||
Status = STATUS_NOT_FOUND;
|
||||
#endif
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG;
|
||||
@@ -315,9 +116,14 @@ DsppInitialize (
|
||||
}
|
||||
|
||||
/* Check if the highest mode should be forced */
|
||||
#if 0
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsForceHighestMode,
|
||||
&HighestMode);
|
||||
#else
|
||||
//HighestMode = 0;
|
||||
Status = STATUS_NOT_FOUND;
|
||||
#endif
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
|
||||
@@ -415,167 +221,6 @@ DsppInitialize (
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DsppReinitialize (
|
||||
_In_ ULONG Flags
|
||||
)
|
||||
{
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
NTSTATUS Status;
|
||||
ULONGLONG GraphicsResolution;
|
||||
BOOLEAN HighestMode;
|
||||
BL_DISPLAY_MODE CurrentResolution;
|
||||
|
||||
/* Do we have local input yet? */
|
||||
if (!DspLocalInputConsole)
|
||||
{
|
||||
/* Create it now */
|
||||
ConsoleCreateLocalInputConsole();
|
||||
}
|
||||
|
||||
/* If a graphics console is present without a remote console... */
|
||||
TextConsole = NULL;
|
||||
if (!(DspRemoteInputConsole) && (DspGraphicalConsole))
|
||||
{
|
||||
/* Try to create a remote console */
|
||||
ConsoleCreateRemoteConsole(&TextConsole);
|
||||
}
|
||||
|
||||
/* All good for now */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Now check if we were able to create the remote console */
|
||||
if (TextConsole)
|
||||
{
|
||||
EfiPrintf(L"EMS not supported\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Set a local for the right cast */
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
|
||||
/* Nothing to do without a graphics console being reinitialized */
|
||||
if (!(Flags & BL_LIBRARY_FLAG_REINITIALIZE_ALL) ||
|
||||
!(GraphicsConsole) ||
|
||||
!(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
|
||||
{
|
||||
EfiPrintf(L"Nothing to do for re-init\r\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if graphics are disabled in the BCD */
|
||||
if (DsppGraphicsDisabledByBcd())
|
||||
{
|
||||
/* Turn off the graphics console, switching back to text mode */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->Enable(GraphicsConsole, FALSE);
|
||||
}
|
||||
|
||||
/* Check if a custom graphics resolution is set */
|
||||
if (MiscGetBootOption(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_GraphicsResolution))
|
||||
{
|
||||
/* Check what it's set to */
|
||||
Status = BlGetBootOptionInteger(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_GraphicsResolution,
|
||||
&GraphicsResolution);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Now check our current graphical resolution */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole,
|
||||
&CurrentResolution);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Remember that we're forcing a video mode */
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG;
|
||||
|
||||
/* Check which resolution to set */
|
||||
if (!GraphicsResolution)
|
||||
{
|
||||
/* 1024x768 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (GraphicsResolution == 1)
|
||||
{
|
||||
/* 800x600 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (GraphicsResolution == 2)
|
||||
{
|
||||
/* 1024x600 */
|
||||
EfiPrintf(L"Display selection not yet handled\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the force highest mode setting is present */
|
||||
if (MiscGetBootOption(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsForceHighestMode))
|
||||
{
|
||||
/* Check what it's set to */
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_GraphicsForceHighestMode,
|
||||
&HighestMode);
|
||||
if ((NT_SUCCESS(Status)) && (HighestMode))
|
||||
{
|
||||
/* Remember that high rest mode is being forced */
|
||||
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
|
||||
|
||||
/* Turn it on */
|
||||
//((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->SetGraphicalResolution(GraphicsConsole, 0, 0);
|
||||
|
||||
/* All done now */
|
||||
ConsoleGraphicalResolutionListFlags |= ~BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
|
||||
EfiPrintf(L"High res mode not yet handled\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return back to the caller */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayReinitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
PBL_INPUT_CONSOLE InputConsole;
|
||||
|
||||
/* Do we have a local console? */
|
||||
InputConsole = DspLocalInputConsole;
|
||||
if (InputConsole)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
Status = InputConsole->Callbacks->Reinitialize((PBL_TEXT_CONSOLE)InputConsole);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do we have a text console? */
|
||||
TextConsole = DspTextConsole;
|
||||
if (TextConsole)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
Status = TextConsole->Callbacks->Reinitialize(TextConsole);
|
||||
}
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpDisplayInitialize (
|
||||
_In_ ULONG Flags
|
||||
@@ -587,12 +232,14 @@ BlpDisplayInitialize (
|
||||
if (Flags & BL_LIBRARY_FLAG_REINITIALIZE)
|
||||
{
|
||||
/* This is a reset */
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
#if 0
|
||||
Status = DsppReinitialize(Flags);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Re-initialize the class as well */
|
||||
Status = BlpDisplayReinitialize();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -611,7 +258,6 @@ BlDisplayGetTextCellResolution (
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
|
||||
/* If the caller doesn't want anything, bail out */
|
||||
if (!(TextWidth) || !(TextHeight))
|
||||
@@ -624,17 +270,11 @@ BlDisplayGetTextCellResolution (
|
||||
if (DspTextConsole)
|
||||
{
|
||||
/* Do we have a graphics console? */
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
if (GraphicsConsole)
|
||||
if (DspGraphicalConsole)
|
||||
{
|
||||
/* Is it currently active? */
|
||||
if (((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole))
|
||||
{
|
||||
/* Yep -- query it */
|
||||
EfiPrintf(L"GFX active, not supported query\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
//Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetTextCellResolution(GraphicsConsole);
|
||||
}
|
||||
/* Yep -- query it */
|
||||
EfiPrintf(L"Not supported\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,350 +286,3 @@ BlDisplayGetTextCellResolution (
|
||||
*TextHeight = 8;
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlDisplaySetScreenResolution (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBL_GRAPHICS_CONSOLE Console;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Assume success */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Do we have a graphics console? */
|
||||
Console = DspGraphicalConsole;
|
||||
if (Console)
|
||||
{
|
||||
/* Is it currently active? */
|
||||
if (((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->IsEnabled(Console))
|
||||
{
|
||||
/* If so, disable it */
|
||||
return ((PBL_GRAPHICS_CONSOLE_VTABLE)Console->TextConsole.Callbacks)->Enable(Console, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* We should've now fallen back to text mode */
|
||||
if (!DspTextConsole)
|
||||
{
|
||||
/* Then fail, as no display appears active */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return back to the caller */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlDisplayGetScreenResolution (
|
||||
_Out_ PULONG HRes,
|
||||
_Out_ PULONG VRes
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
BL_DISPLAY_MODE Resolution;
|
||||
PBL_GRAPHICS_CONSOLE GraphicsConsole;
|
||||
|
||||
/* Assume failure if no consoles are active */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
/* Do we have a text console? */
|
||||
if (DspTextConsole)
|
||||
{
|
||||
/* Do we have an active graphics console? */
|
||||
GraphicsConsole = DspGraphicalConsole;
|
||||
if ((GraphicsConsole) &&
|
||||
(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole)))
|
||||
{
|
||||
/* Get the resolution */
|
||||
Status = ((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->GetGraphicalResolution(GraphicsConsole, &Resolution);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Return it back to the caller */
|
||||
*HRes = Resolution.HRes;
|
||||
*VRes = Resolution.VRes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Return defaults */
|
||||
*HRes = 640;
|
||||
*VRes = 200;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return if we got a valid resolution back */
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
BlDisplayInvalidateOemBitmap (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBGRT_TABLE BgrtTable;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Search for the BGRT */
|
||||
Status = BlUtlGetAcpiTable((PVOID*)&BgrtTable, BGRT_SIGNATURE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Mark the bitmap as invalid */
|
||||
BgrtTable->Status &= BGRT_STATUS_IMAGE_VALID;
|
||||
|
||||
/* Unmap the table */
|
||||
BlMmUnmapVirtualAddressEx(BgrtTable, BgrtTable->Header.Length);
|
||||
}
|
||||
}
|
||||
|
||||
PBITMAP
|
||||
BlDisplayGetOemBitmap (
|
||||
_In_opt_ PCOORD Offsets,
|
||||
_Out_opt_ PULONG Flags
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Size;
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
PBGRT_TABLE BgrtTable;
|
||||
PBITMAP Bitmap;
|
||||
PBMP_HEADER Header;
|
||||
|
||||
Bitmap = NULL;
|
||||
BgrtTable = NULL;
|
||||
|
||||
/* Search for the BGRT */
|
||||
Status = BlUtlGetAcpiTable((PVOID*)&BgrtTable, BGRT_SIGNATURE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"no BGRT found\r\n");
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure this is really a BGRT */
|
||||
if (BgrtTable->Header.Signature != BGRT_SIGNATURE)
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure the BGRT table length is valid */
|
||||
if (BgrtTable->Header.Length != sizeof(*BgrtTable))
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure its a bitmap */
|
||||
if (BgrtTable->ImageType != BgrtImageTypeBitmap)
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure it's somewhere in RAM */
|
||||
if (!BgrtTable->LogoAddress)
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Map the bitmap header only for now */
|
||||
PhysicalAddress.QuadPart = BgrtTable->LogoAddress;
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID*)&Header,
|
||||
0,
|
||||
sizeof(BMP_HEADER),
|
||||
PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Capture the real size of the header */
|
||||
Size = Header->Size;
|
||||
|
||||
/* Unmap the bitmap header */
|
||||
BlMmUnmapVirtualAddressEx(BgrtTable, sizeof(BMP_HEADER));
|
||||
|
||||
/* If the real size is smaller than at least a V3 bitmap, bail out */
|
||||
if (Size < sizeof(BITMAP))
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Map the real size of the header */
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID*)&Bitmap,
|
||||
0,
|
||||
Size,
|
||||
PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure this is a non-compressed 24-bit or 32-bit V3 bitmap */
|
||||
if ((Bitmap->BmpHeader.Signature != 'MB') ||
|
||||
(Bitmap->DibHeader.Compression) ||
|
||||
((Bitmap->DibHeader.BitCount != 24) &&
|
||||
(Bitmap->DibHeader.BitCount != 32)) ||
|
||||
(Bitmap->DibHeader.Size != sizeof(BITMAP)))
|
||||
{
|
||||
Status = STATUS_ACPI_INVALID_TABLE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Check if caller wants the offsets back */
|
||||
if (Offsets)
|
||||
{
|
||||
/* Give them away */
|
||||
Offsets->X = BgrtTable->OffsetX;
|
||||
Offsets->Y = BgrtTable->OffsetY;
|
||||
}
|
||||
|
||||
/* Check if the caller wants flags */
|
||||
if (Flags)
|
||||
{
|
||||
/* Return if the image is valid */
|
||||
*Flags = BgrtTable->Status & BGRT_STATUS_IMAGE_VALID;
|
||||
}
|
||||
|
||||
Quickie:
|
||||
/* Check if we had mapped the BGRT */
|
||||
if (BgrtTable)
|
||||
{
|
||||
/* Unmap it */
|
||||
BlMmUnmapVirtualAddressEx(BgrtTable, BgrtTable->Header.Length);
|
||||
}
|
||||
|
||||
/* Check if this is the failure path */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Did we have the OEM bitmap mapped? */
|
||||
if (Bitmap)
|
||||
{
|
||||
/* Unmap it */
|
||||
BlMmUnmapVirtualAddressEx(Bitmap, Bitmap->BmpHeader.Size);
|
||||
}
|
||||
|
||||
/* No bitmap to return */
|
||||
Bitmap = NULL;
|
||||
}
|
||||
|
||||
/* Return the bitmap back, if any */
|
||||
return Bitmap;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
BlDisplayValidOemBitmap (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBITMAP Bitmap;
|
||||
ULONG HRes, VRes, Height, Width, Flags;
|
||||
COORD Offsets;
|
||||
BOOLEAN Result;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* First check if mobile graphics are enabled */
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_MobileGraphics,
|
||||
&Result);
|
||||
if ((NT_SUCCESS(Status)) && (Result))
|
||||
{
|
||||
/* Yes, so use the firmware image */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Nope, so we'll check the ACPI OEM bitmap */
|
||||
Result = FALSE;
|
||||
Bitmap = BlDisplayGetOemBitmap(&Offsets, &Flags);
|
||||
|
||||
/* Is there one? */
|
||||
if (Bitmap)
|
||||
{
|
||||
/* Is it valid? */
|
||||
if (Flags & BGRT_STATUS_IMAGE_VALID)
|
||||
{
|
||||
/* Get the current screen resolution */
|
||||
Status = BlDisplayGetScreenResolution(&HRes, &VRes);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Is there a valid width? */
|
||||
Width = Bitmap->DibHeader.Width;
|
||||
if (Width)
|
||||
{
|
||||
/* Is there a valid height? */
|
||||
Height = Bitmap->DibHeader.Height;
|
||||
if (Height)
|
||||
{
|
||||
/* Will if fit on this screen? */
|
||||
if (((Width + Offsets.X) <= HRes) &&
|
||||
((Height + Offsets.Y) <= VRes))
|
||||
{
|
||||
/* Then it's all good! */
|
||||
Result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Unmap the bitmap for now, it will be drawn later */
|
||||
BlMmUnmapVirtualAddressEx(Bitmap, Bitmap->BmpHeader.Size);
|
||||
}
|
||||
|
||||
/* Return that a valid OEM bitmap exists */
|
||||
return Result;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlDisplayClearScreen (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
|
||||
/* Nothing to do if there's no text console */
|
||||
Status = STATUS_SUCCESS;
|
||||
TextConsole = DspTextConsole;
|
||||
if (TextConsole)
|
||||
{
|
||||
/* Otherwise, clear the whole screen */
|
||||
Status = TextConsole->Callbacks->ClearText(TextConsole, FALSE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Invalidate the OEM bitmap at this point */
|
||||
BlDisplayInvalidateOemBitmap();
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
};
|
||||
|
||||
NTSTATUS
|
||||
BlDisplaySetCursorType (
|
||||
_In_ ULONG Type
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_TEXT_CONSOLE TextConsole;
|
||||
BL_DISPLAY_STATE State;
|
||||
|
||||
/* Nothing to do if there's no text console */
|
||||
Status = STATUS_SUCCESS;
|
||||
TextConsole = DspTextConsole;
|
||||
if (TextConsole)
|
||||
{
|
||||
/* Write visibility state and call the function to change it */
|
||||
State.CursorVisible = Type;
|
||||
Status = TextConsole->Callbacks->SetTextState(TextConsole, 8, &State);
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ ConsoleEfiGopEnable (
|
||||
}
|
||||
|
||||
/* Reset the OEM bitmap and get the new more information */
|
||||
BlDisplayInvalidateOemBitmap();
|
||||
// BlDisplayInvalidateOemBitmap();
|
||||
EfiGopGetCurrentMode(Protocol, &Dummy, &ModeInformation);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ ConsoleEfiGopEnable (
|
||||
{
|
||||
/* We failed seomewhere, reset the mode and the OEM bitmap back */
|
||||
EfiGopSetMode(Protocol, CurrentMode);
|
||||
BlDisplayInvalidateOemBitmap();
|
||||
//BlDisplayInvalidateOemBitmap();
|
||||
}
|
||||
|
||||
/* Return back to caller */
|
||||
@@ -186,7 +186,7 @@ ConsoleEfiGopClose (
|
||||
{
|
||||
/* Restore the old mode and reset the OEM bitmap in ACPI */
|
||||
EfiGopSetMode(GraphicsConsole->Protocol, OldMode);
|
||||
BlDisplayInvalidateOemBitmap();
|
||||
//BlDisplayInvalidateOemBitmap();
|
||||
}
|
||||
|
||||
/* Close the GOP protocol */
|
||||
|
@@ -86,44 +86,6 @@ ConsoleEfiGraphicalOpenProtocol (
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareGraphicalClear (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Color
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UCHAR Pixel[4] = { 0 };
|
||||
|
||||
/* Convert the standard color to a firmware pixel color */
|
||||
Status = ConsolepConvertColorToPixel(Color, Pixel);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if this is GOP or UGA */
|
||||
if (Console->Type == BlUgaConsole)
|
||||
{
|
||||
EfiPrintf(L"Uga not supported\r\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For GOP, just fill the screen */
|
||||
ConsolepClearBuffer(Console->FrameBuffer,
|
||||
Console->DisplayMode.HRes,
|
||||
Pixel,
|
||||
Console->DisplayMode.VRes,
|
||||
Console->PixelsPerScanLine,
|
||||
Console->PixelDepth);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* All clear */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareGraphicalEnable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
@@ -149,20 +111,3 @@ ConsoleFirmwareGraphicalEnable (
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConsoleFirmwareGraphicalDisable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
)
|
||||
{
|
||||
/* Is this a GOP console? */
|
||||
if (GraphicsConsole->Type == BlGopConsole)
|
||||
{
|
||||
/* Did we map a framebuffer? */
|
||||
if (GraphicsConsole->FrameBuffer)
|
||||
{
|
||||
/* Unmap it */
|
||||
BlMmUnmapVirtualAddressEx(GraphicsConsole->FrameBuffer,
|
||||
GraphicsConsole->FrameBufferSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -489,137 +489,3 @@ ConsoleFirmwareTextOpen (
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG FillValue
|
||||
)
|
||||
{
|
||||
ULONG ValueToFill;
|
||||
PULONG i;
|
||||
|
||||
/* Check if we should fill with a particular value */
|
||||
if (FillValue)
|
||||
{
|
||||
/* Use it */
|
||||
ValueToFill = *FillValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, use default */
|
||||
ValueToFill = 0x10020;
|
||||
}
|
||||
|
||||
/* Set the input buffer to its last location */
|
||||
Console->DataStart = Console->DataEnd;
|
||||
|
||||
/* Fill the buffer with the value */
|
||||
for (i = Console->Buffer; i < Console->EndBuffer; i++)
|
||||
{
|
||||
*i = ValueToFill;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputLocalEraseBuffer (
|
||||
_In_ PBL_INPUT_CONSOLE Console,
|
||||
_In_opt_ PULONG FillValue
|
||||
)
|
||||
{
|
||||
NTSTATUS Status, EfiStatus;
|
||||
|
||||
/* Erase the software buffer */
|
||||
Status = ConsoleInputBaseEraseBuffer(Console, FillValue);
|
||||
|
||||
/* Reset the hardware console */
|
||||
EfiStatus = EfiConInEx ? EfiConInExReset() : EfiConInReset();
|
||||
if (!NT_SUCCESS(EfiStatus))
|
||||
{
|
||||
/* Normalize the failure code */
|
||||
EfiStatus = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Check if software reset worked */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Then return the firmware code */
|
||||
Status = EfiStatus;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleFirmwareTextClear (
|
||||
_In_ PBL_TEXT_CONSOLE Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
)
|
||||
{
|
||||
BL_ARCH_MODE OldMode;
|
||||
EFI_STATUS EfiStatus;
|
||||
NTSTATUS Status;
|
||||
ULONG i, Column, Row, TextWidth, TextHeight;
|
||||
|
||||
/* Get the text resolution */
|
||||
BlDisplayGetTextCellResolution(&TextWidth, &TextHeight);
|
||||
|
||||
/* Are we just clearing a line? */
|
||||
if (LineOnly)
|
||||
{
|
||||
/* Get the current column and row */
|
||||
Column = Console->State.XPos / TextWidth;
|
||||
Row = Console->State.YPos / TextHeight;
|
||||
|
||||
/* Loop over every remaining character */
|
||||
for (i = 0; i < Console->DisplayMode.HRes - Column - 1; i++)
|
||||
{
|
||||
/* Write a space on top of it */
|
||||
Status = EfiConOutOutputString(Console->Protocol, L" ");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* And reset the cursor back at the initial position */
|
||||
Status = EfiConOutSetCursorPosition(Console->Protocol,
|
||||
Column,
|
||||
Row);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Are we in protected mode? */
|
||||
OldMode = CurrentExecutionContext->Mode;
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
/* FIXME: Not yet implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Clear the scren */
|
||||
EfiStatus = Console->Protocol->ClearScreen(Console->Protocol);
|
||||
|
||||
/* Switch back to protected mode if we came from there */
|
||||
if (OldMode != BlRealMode)
|
||||
{
|
||||
BlpArchSwitchContext(OldMode);
|
||||
}
|
||||
|
||||
/* Conver to NT status -- did that work? */
|
||||
Status = EfiGetNtStatusCode(EfiStatus);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Reset current positions */
|
||||
Console->State.XPos = 0;
|
||||
Console->State.YPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -14,46 +14,11 @@
|
||||
|
||||
BL_GRAPHICS_CONSOLE_VTABLE ConsoleGraphicalVtbl =
|
||||
{
|
||||
{
|
||||
(PCONSOLE_DESTRUCT)ConsoleGraphicalDestruct,
|
||||
(PCONSOLE_REINITIALIZE)ConsoleGraphicalReinitialize,
|
||||
ConsoleTextBaseGetTextState,
|
||||
(PCONSOLE_SET_TEXT_STATE)ConsoleGraphicalSetTextState,
|
||||
NULL, // GetTextResolution
|
||||
NULL, // SetTextResolution
|
||||
(PCONSOLE_CLEAR_TEXT)ConsoleGraphicalClearText
|
||||
},
|
||||
ConsoleGraphicalIsEnabled,
|
||||
ConsoleGraphicalEnable,
|
||||
NULL,
|
||||
ConsoleGraphicalGetGraphicalResolution,
|
||||
ConsoleGraphicalGetOriginalResolution,
|
||||
NULL,
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalSetTextState (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Mask,
|
||||
_In_ PBL_DISPLAY_STATE TextState
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Let it handle that */
|
||||
return ConsoleFirmwareTextSetState(&Console->TextConsole,
|
||||
Mask,
|
||||
TextState);
|
||||
}
|
||||
|
||||
/* Not yet */
|
||||
EfiPrintf(L"FFX set not implemented\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalConstruct (
|
||||
_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
|
||||
@@ -104,359 +69,3 @@ ConsoleGraphicalConstruct (
|
||||
GraphicsConsole->BgColor = GraphicsConsole->TextConsole.State.BgColor;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConsolepClearBuffer (
|
||||
_In_ PUCHAR FrameBuffer,
|
||||
_In_ ULONG Width,
|
||||
_In_ PUCHAR FillColor,
|
||||
_In_ ULONG Height,
|
||||
_In_ ULONG ScanlineWidth,
|
||||
_In_ ULONG PixelDepth
|
||||
)
|
||||
{
|
||||
PUCHAR Scanline, Current, FrameBufferEnd, LineEnd;
|
||||
ULONG LineBytes, WidthBytes, BytesPerPixel;
|
||||
|
||||
/* Get the BPP */
|
||||
BytesPerPixel = PixelDepth / 8;
|
||||
|
||||
/* Using that, calculate the size of a scan line */
|
||||
LineBytes = ScanlineWidth * BytesPerPixel;
|
||||
|
||||
/* And the size of line we'll have to clear */
|
||||
WidthBytes = Width * BytesPerPixel;
|
||||
|
||||
/* Allocat a scanline */
|
||||
Scanline = BlMmAllocateHeap(WidthBytes);
|
||||
if (Scanline)
|
||||
{
|
||||
/* For each remaining pixel on the scanline */
|
||||
Current = Scanline;
|
||||
while (Width--)
|
||||
{
|
||||
/* Copy in the fill color */
|
||||
RtlCopyMemory(Current, FillColor, BytesPerPixel);
|
||||
Current += BytesPerPixel;
|
||||
}
|
||||
|
||||
/* For each scanline in the frame buffer */
|
||||
while (Height--)
|
||||
{
|
||||
/* Copy our constructed scanline */
|
||||
RtlCopyMemory(FrameBuffer, Scanline, WidthBytes);
|
||||
FrameBuffer += LineBytes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FrameBufferEnd = FrameBuffer + Height * LineBytes;
|
||||
ScanlineWidth = BytesPerPixel * (ScanlineWidth - Width);
|
||||
while (FrameBuffer != FrameBufferEnd)
|
||||
{
|
||||
if (FrameBuffer != (FrameBuffer + WidthBytes))
|
||||
{
|
||||
LineEnd = FrameBuffer + WidthBytes;
|
||||
do
|
||||
{
|
||||
RtlCopyMemory(FrameBuffer, FillColor, BytesPerPixel);
|
||||
FrameBuffer += BytesPerPixel;
|
||||
}
|
||||
while (FrameBuffer != LineEnd);
|
||||
}
|
||||
|
||||
FrameBuffer += ScanlineWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsolepConvertColorToPixel (
|
||||
_In_ BL_COLOR Color,
|
||||
_Out_ PUCHAR Pixel
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Assume success */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Convert the color to a pixel value */
|
||||
switch (Color)
|
||||
{
|
||||
case Black:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case Blue:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0x7F;
|
||||
break;
|
||||
case Green:
|
||||
Pixel[1] = 0x7F;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case Cyan:
|
||||
Pixel[1] = 0x7F;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0x7F;
|
||||
break;
|
||||
case Red:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0x7F;
|
||||
Pixel[0] = 0x7F;
|
||||
break;
|
||||
case Magenta:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0x7F;
|
||||
Pixel[0] = 0x7F;
|
||||
break;
|
||||
case Brown:
|
||||
Pixel[1] = 0x3F;
|
||||
Pixel[2] = 0x7F;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case LtGray:
|
||||
Pixel[1] = 0xBFu;
|
||||
Pixel[2] = 0xBFu;
|
||||
*Pixel = 0xBFu;
|
||||
break;
|
||||
case Gray:
|
||||
Pixel[1] = 0x7F;
|
||||
Pixel[2] = 0x7F;
|
||||
Pixel[0] = 0x7F;
|
||||
break;
|
||||
case LtBlue:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0xFF;
|
||||
break;
|
||||
case LtGreen:
|
||||
Pixel[1] = 0xFF;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case LtCyan:
|
||||
Pixel[1] = 0xFF;
|
||||
Pixel[2] = 0;
|
||||
Pixel[0] = 0xFF;
|
||||
break;
|
||||
case LtRed:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0xFF;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case LtMagenta:
|
||||
Pixel[1] = 0;
|
||||
Pixel[2] = 0xFF;
|
||||
Pixel[0] = 0xFF;
|
||||
break;
|
||||
case Yellow:
|
||||
Pixel[1] = 0xFF;
|
||||
Pixel[2] = 0xFF;
|
||||
Pixel[0] = 0;
|
||||
break;
|
||||
case White:
|
||||
Pixel[1] = 0xFF;
|
||||
Pixel[2] = 0xFF;
|
||||
Pixel[0] = 0xFF;
|
||||
break;
|
||||
default:
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalClearPixels (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ ULONG Color
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Check if the text console is active */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* We shouldn't be here */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clear it in graphics mode */
|
||||
Status = ConsoleFirmwareGraphicalClear(Console, Color);
|
||||
}
|
||||
|
||||
/* All good */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalClearText (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Let firmware clear do it */
|
||||
return ConsoleFirmwareTextClear(&Console->TextConsole, LineOnly);
|
||||
}
|
||||
|
||||
/* Are we clearing a line only? */
|
||||
if (LineOnly)
|
||||
{
|
||||
return BfClearToEndOfLine(Console);
|
||||
}
|
||||
|
||||
/* Nope -- the whole screen */
|
||||
return BfClearScreen(Console);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ConsoleGraphicalIsEnabled (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? If so, the graphics console isn't */
|
||||
return !Console->TextConsole.Active;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConsoleGraphicalDestruct (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Disable it */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
}
|
||||
|
||||
/* Close the firmware protocols */
|
||||
ConsoleFirmwareGraphicalClose(Console);
|
||||
|
||||
/* Destroy the console object */
|
||||
ConsoleTextLocalDestruct(&Console->TextConsole);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalReinitialize (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Reinitialize it */
|
||||
ConsoleTextLocalReinitialize(&Console->TextConsole);
|
||||
}
|
||||
|
||||
/* Disable the graphics console */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
|
||||
/* Then bring it back again */
|
||||
return ConsoleFirmwareGraphicalEnable(Console);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalEnable (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ BOOLEAN Enable
|
||||
)
|
||||
{
|
||||
BOOLEAN Active;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* The text mode console state should be the opposite of what we want to do */
|
||||
Active = Console->TextConsole.Active;
|
||||
if (Active == Enable)
|
||||
{
|
||||
/* Are we trying to enable graphics? */
|
||||
if (Enable)
|
||||
{
|
||||
/* Enable the console */
|
||||
Status = ConsoleFirmwareGraphicalEnable(Console);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* Turn it off */
|
||||
ConsoleFirmwareTextClose(&Console->TextConsole);
|
||||
Console->TextConsole.Active = FALSE;
|
||||
}
|
||||
|
||||
/* Preserve the text colors */
|
||||
Console->FgColor = Console->TextConsole.State.FgColor;
|
||||
Console->BgColor = Console->TextConsole.State.BgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We are turning off graphics -- is the text console active? */
|
||||
if (Active != TRUE)
|
||||
{
|
||||
/* It isn't, so let's turn it on */
|
||||
Status = ConsoleFirmwareTextOpen(&Console->TextConsole);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Remember that it's on */
|
||||
Console->TextConsole.Active = TRUE;
|
||||
}
|
||||
|
||||
/* Disable the graphics console */
|
||||
ConsoleFirmwareGraphicalDisable(Console);
|
||||
}
|
||||
}
|
||||
|
||||
/* All good */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetGraphicalResolution (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* There's no graphics resolution then */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the current display mode */
|
||||
*DisplayMode = Console->DisplayMode;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleGraphicalGetOriginalResolution (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ PBL_DISPLAY_MODE DisplayMode
|
||||
)
|
||||
{
|
||||
/* Is the text console active? */
|
||||
if (Console->TextConsole.Active)
|
||||
{
|
||||
/* There's no graphics resolution then */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the current display mode */
|
||||
*DisplayMode = Console->OldDisplayMode;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -26,12 +26,12 @@ BL_TEXT_CONSOLE_VTABLE ConsoleTextLocalVtbl =
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
NTSTATUS
|
||||
ConsoleTextLocalDestruct (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
)
|
||||
{
|
||||
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@@ -39,7 +39,6 @@ ConsoleTextLocalReinitialize (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Not active yet!\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -55,11 +54,11 @@ ConsoleTextBaseGetTextState (
|
||||
NTSTATUS
|
||||
ConsoleTextLocalSetTextState (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console,
|
||||
_In_ ULONG Mask,
|
||||
_In_ ULONG Flags,
|
||||
_In_ PBL_DISPLAY_STATE TextState
|
||||
)
|
||||
{
|
||||
return ConsoleFirmwareTextSetState(Console, Mask, TextState);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@@ -84,10 +83,10 @@ ConsoleTextLocalSetTextResolution (
|
||||
NTSTATUS
|
||||
ConsoleTextLocalClearText (
|
||||
_In_ struct _BL_TEXT_CONSOLE* Console,
|
||||
_In_ BOOLEAN LineOnly
|
||||
_In_ ULONG Attribute
|
||||
)
|
||||
{
|
||||
return ConsoleFirmwareTextClear(Console, LineOnly);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@@ -183,88 +182,3 @@ ConsolepFindResolution (
|
||||
/* No matches were found */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BL_INPUT_CONSOLE_VTABLE ConsoleInputLocalVtbl =
|
||||
{
|
||||
(PCONSOLE_DESTRUCT)ConsoleInputLocalDestruct,
|
||||
(PCONSOLE_REINITIALIZE)ConsoleInputBaseReinitialize,
|
||||
};
|
||||
|
||||
VOID
|
||||
ConsoleInputLocalDestruct (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* Erase the current input buffer, and tear down the console */
|
||||
ConsoleInputLocalEraseBuffer(Console, NULL);
|
||||
BlMmFreeHeap(Console->Buffer);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseConstruct (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
PULONG Buffer;
|
||||
|
||||
/* Allocate a new 512 byte buffer */
|
||||
Buffer = BlMmAllocateHeap(512);
|
||||
Console->Buffer = Buffer;
|
||||
if (!Buffer)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Set the current buffer pointers to it */
|
||||
Console->DataStart = Buffer;
|
||||
Console->DataEnd = Buffer;
|
||||
|
||||
/* Set the end 128 data entries into the buffer */
|
||||
Console->EndBuffer = Buffer + 128;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleInputBaseReinitialize (
|
||||
_In_ PBL_INPUT_CONSOLE Console
|
||||
)
|
||||
{
|
||||
PULONG Buffer;
|
||||
|
||||
/* Reset all the buffer pointers to the current buffer */
|
||||
Buffer = Console->Buffer;
|
||||
Console->DataStart = Buffer;
|
||||
Console->DataEnd = Buffer;
|
||||
Console->EndBuffer = Buffer + 128;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ConsoleCreateLocalInputConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBL_INPUT_CONSOLE InputConsole;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Allocate the input console */
|
||||
InputConsole = BlMmAllocateHeap(sizeof(*InputConsole));
|
||||
if (!InputConsole)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Construct it */
|
||||
Status = ConsoleInputBaseConstruct(InputConsole);
|
||||
if (!NT_SUCCESS(Status));
|
||||
{
|
||||
/* Tear down on failure */
|
||||
BlMmFreeHeap(InputConsole);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Set the callback table, and set us as the local input console */
|
||||
InputConsole->Callbacks = &ConsoleInputLocalVtbl;
|
||||
DspLocalInputConsole = InputConsole;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
@@ -551,6 +551,8 @@ EtfsOpen (
|
||||
PRAW_DIR_REC DirEntry;
|
||||
BOOLEAN IsDirectory;
|
||||
|
||||
EfiPrintf(L"Attempting to open file %s in directory %s\r\n", FileName, Directory->FilePath);
|
||||
|
||||
EtfsFile = Directory->FsSpecificData;
|
||||
DeviceId = EtfsFile->DeviceId;
|
||||
EtfsDevice = EtfsDeviceTable[DeviceId];
|
||||
@@ -563,6 +565,7 @@ EtfsOpen (
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"no dirent found: %lx\r\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -758,6 +761,7 @@ EtfspCheckEtfs (
|
||||
/* Return back to the caller */
|
||||
*VolumeDescriptor = IsoVd;
|
||||
*VolumeIsIso = IsIso;
|
||||
EfiPrintf(L"Recognized!!!\r\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,8 @@ FatMount (
|
||||
PACKED_BOOT_SECTOR FatBootSector;
|
||||
BIOS_PARAMETER_BLOCK BiosBlock;
|
||||
|
||||
EfiPrintf(L"FAT Mount on Device %d\r\n", DeviceId);
|
||||
|
||||
/* Capture thing */
|
||||
BlDeviceGetInformation(DeviceId, &DeviceInformation);
|
||||
UnknownFlag = DeviceInformation.BlockDeviceInfo.Unknown;
|
||||
@@ -65,15 +67,16 @@ FatMount (
|
||||
}
|
||||
|
||||
EfiPrintf(L"Jump: %lx Bytes Per Sector: %d Sectors Per Cluster: %d Reserved: %d Fats: %d Sectors: %d Large Sectors: %d Media: %lx RootEntries: %d\r\n",
|
||||
FatBootSector.Jump[0],
|
||||
BiosBlock.BytesPerSector,
|
||||
BiosBlock.SectorsPerCluster,
|
||||
BiosBlock.ReservedSectors,
|
||||
BiosBlock.Fats,
|
||||
BiosBlock.Sectors,
|
||||
BiosBlock.LargeSectors,
|
||||
BiosBlock.Media,
|
||||
BiosBlock.RootEntries);
|
||||
FatBootSector.Jump[0],
|
||||
BiosBlock.BytesPerSector,
|
||||
BiosBlock.SectorsPerCluster,
|
||||
BiosBlock.ReservedSectors,
|
||||
BiosBlock.Fats,
|
||||
BiosBlock.Sectors,
|
||||
BiosBlock.LargeSectors,
|
||||
BiosBlock.Media,
|
||||
BiosBlock.RootEntries);
|
||||
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@@ -323,6 +323,7 @@ FileIoOpen (
|
||||
&Unknown);
|
||||
if (FileEntry)
|
||||
{
|
||||
EfiPrintf(L"Entry exists: %p\n", FileEntry);
|
||||
goto FileOpened;
|
||||
}
|
||||
|
||||
@@ -426,6 +427,8 @@ FileIoOpen (
|
||||
Status = STATUS_SUCCESS;
|
||||
FileEntry->FileId = FileId;
|
||||
|
||||
EfiPrintf(L"File %s opened with ID: %lx\r\n", FileEntry->FilePath, FileId);
|
||||
|
||||
FileOpened:
|
||||
/* Add a reference to the file entry, and see if this is the first one */
|
||||
if (++FileEntry->ReferenceCount == 1)
|
||||
@@ -522,6 +525,7 @@ BlFileOpen (
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Return the file ID back to the caller */
|
||||
EfiPrintf(L"File opened: %lx\r\n", FileEntry->FileId);
|
||||
*FileId = FileEntry->FileId;
|
||||
}
|
||||
|
||||
|
@@ -1,647 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/lib/misc/bcdopt.c
|
||||
* PURPOSE: Boot Library BCD Option Parsing Routines
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
#include <bcd.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PBL_BCD_OPTION
|
||||
MiscGetBootOption (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type
|
||||
)
|
||||
{
|
||||
ULONG_PTR NextOption = 0, ListOption;
|
||||
PBL_BCD_OPTION Option, FoundOption;
|
||||
|
||||
/* No options, bail out */
|
||||
if (!List)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Loop while we find an option */
|
||||
FoundOption = NULL;
|
||||
do
|
||||
{
|
||||
/* Get the next option and see if it matches the type */
|
||||
Option = (PBL_BCD_OPTION)((ULONG_PTR)List + NextOption);
|
||||
if ((Option->Type == Type) && !(Option->Empty))
|
||||
{
|
||||
FoundOption = Option;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Store the offset of the next option */
|
||||
NextOption = Option->NextEntryOffset;
|
||||
|
||||
/* Failed to match. Check for list options */
|
||||
ListOption = Option->ListOffset;
|
||||
if (ListOption)
|
||||
{
|
||||
/* Try to get a match in the associated option */
|
||||
Option = MiscGetBootOption((PBL_BCD_OPTION)((ULONG_PTR)Option +
|
||||
ListOption),
|
||||
Type);
|
||||
if (Option)
|
||||
{
|
||||
/* Return it */
|
||||
FoundOption = Option;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (NextOption);
|
||||
|
||||
/* Return the option that was found, if any */
|
||||
return FoundOption;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name BlGetBootOptionListSize
|
||||
*
|
||||
* The BlGetBootOptionListSize routine
|
||||
*
|
||||
* @param BcdOption
|
||||
* UEFI Image Handle for the current loaded application.
|
||||
*
|
||||
* @return Size of the BCD option
|
||||
*
|
||||
*--*/
|
||||
ULONG
|
||||
BlGetBootOptionListSize (
|
||||
_In_ PBL_BCD_OPTION BcdOption
|
||||
)
|
||||
{
|
||||
ULONG Size = 0, NextOffset = 0;
|
||||
PBL_BCD_OPTION NextOption;
|
||||
|
||||
/* Loop all the options*/
|
||||
do
|
||||
{
|
||||
/* Move to the next one */
|
||||
NextOption = (PBL_BCD_OPTION)((ULONG_PTR)BcdOption + NextOffset);
|
||||
|
||||
/* Compute the size of the next one */
|
||||
Size += BlGetBootOptionSize(NextOption);
|
||||
|
||||
/* Update the offset */
|
||||
NextOffset = NextOption->NextEntryOffset;
|
||||
} while (NextOffset);
|
||||
|
||||
/* Return final computed size */
|
||||
return Size;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name BlGetBootOptionSize
|
||||
*
|
||||
* The BlGetBootOptionSize routine
|
||||
*
|
||||
* @param BcdOption
|
||||
* UEFI Image Handle for the current loaded application.
|
||||
*
|
||||
* @return Size of the BCD option
|
||||
*
|
||||
*--*/
|
||||
ULONG
|
||||
BlGetBootOptionSize (
|
||||
_In_ PBL_BCD_OPTION BcdOption
|
||||
)
|
||||
{
|
||||
ULONG Size, Offset;
|
||||
|
||||
/* Check if there's any data */
|
||||
if (BcdOption->DataOffset)
|
||||
{
|
||||
/* Add the size of the data */
|
||||
Size = BcdOption->DataOffset + BcdOption->DataSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No data, just the structure itself */
|
||||
Size = sizeof(*BcdOption);
|
||||
}
|
||||
|
||||
/* Any associated options? */
|
||||
Offset = BcdOption->ListOffset;
|
||||
if (Offset)
|
||||
{
|
||||
/* Go get those too */
|
||||
Size += BlGetBootOptionListSize((PVOID)((ULONG_PTR)BcdOption + Offset));
|
||||
}
|
||||
|
||||
/* Return the final size */
|
||||
return Size;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionString (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PWCHAR* Value
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_BCD_OPTION Option;
|
||||
PWCHAR String, StringCopy;
|
||||
ULONG StringLength;
|
||||
BcdElementType ElementType;
|
||||
//PGUID AppIdentifier;
|
||||
|
||||
/* Make sure this is a BCD_STRING */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_STRING)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (Option)
|
||||
{
|
||||
/* Extract the string */
|
||||
String = (PWCHAR)((ULONG_PTR)Option + Option->DataOffset);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No string is present */
|
||||
String = NULL;
|
||||
Status = STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Compute the data size */
|
||||
StringLength = Option->DataSize / sizeof(WCHAR);
|
||||
|
||||
#ifdef _SECURE_BOOT_
|
||||
/* Filter out SecureBoot Options */
|
||||
AppIdentifier = BlGetApplicationIdentifier();
|
||||
Status = BlpBootOptionCallbackString(AppIdentifier, Type, String, StringLength, &String, &StringLength);
|
||||
#else
|
||||
#endif
|
||||
|
||||
/* Make sure we have a valid, non-filtered string */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Check if we have space for one more character */
|
||||
Status = RtlULongAdd(StringLength, 1, &StringLength);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Check if it's safe to multiply by two */
|
||||
Status = RtlULongMult(StringLength, sizeof(WCHAR), &StringLength);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Allocate a copy for the string */
|
||||
StringCopy = BlMmAllocateHeap(StringLength);
|
||||
if (StringCopy)
|
||||
{
|
||||
/* NULL-terminate it */
|
||||
RtlCopyMemory(StringCopy,
|
||||
String,
|
||||
StringLength - sizeof(UNICODE_NULL));
|
||||
StringCopy[StringLength] = UNICODE_NULL;
|
||||
*Value = StringCopy;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No memory, fail */
|
||||
Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionGuidList (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PGUID *Value,
|
||||
_In_ PULONG Count
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_BCD_OPTION Option;
|
||||
PGUID GuidCopy, Guid;
|
||||
ULONG GuidCount;
|
||||
BcdElementType ElementType;
|
||||
|
||||
/* Make sure this is a BCD_TYPE_OBJECT_LIST */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_OBJECT_LIST)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (!Option)
|
||||
{
|
||||
/* Set failure if no data exists */
|
||||
Status = STATUS_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the GUIDs and allocate a copy for them */
|
||||
Guid = (PGUID)((ULONG_PTR)Option + Option->DataOffset);
|
||||
GuidCopy = BlMmAllocateHeap(Option->DataSize);
|
||||
if (GuidCopy)
|
||||
{
|
||||
/* Copy the GUIDs */
|
||||
RtlCopyMemory(GuidCopy, Guid, Option->DataSize);
|
||||
|
||||
/* Return the number of GUIDs and the start of the array */
|
||||
GuidCount = Option->DataSize / sizeof(GUID);
|
||||
*Value = GuidCopy;
|
||||
*Count = GuidCount;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No memory for the copy */
|
||||
Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
/* All good */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionDevice (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PBL_DEVICE_DESCRIPTOR* Value,
|
||||
_In_opt_ PBL_BCD_OPTION* ExtraOptions
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_BCD_OPTION Option, ListData, ListCopy, SecureListData;
|
||||
PBCD_DEVICE_OPTION BcdDevice;
|
||||
ULONG DeviceSize, ListOffset, ListSize;
|
||||
PBL_DEVICE_DESCRIPTOR DeviceDescriptor, SecureDescriptor;
|
||||
//PGUID AppIdentifier;
|
||||
BcdElementType ElementType;
|
||||
|
||||
/* Make sure this is a BCD_TYPE_DEVICE */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_DEVICE)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (!Option)
|
||||
{
|
||||
/* Set failure if no data exists */
|
||||
Status = STATUS_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, read the size of the BCD device encoded */
|
||||
BcdDevice = (PBCD_DEVICE_OPTION)((ULONG_PTR)Option + Option->DataOffset);
|
||||
DeviceSize = BcdDevice->DeviceDescriptor.Size;
|
||||
|
||||
/* Allocate a buffer to copy it into */
|
||||
DeviceDescriptor = BlMmAllocateHeap(DeviceSize);
|
||||
if (!DeviceDescriptor)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Copy it into that buffer */
|
||||
RtlCopyMemory(DeviceDescriptor, &BcdDevice->DeviceDescriptor, DeviceSize);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Check if extra options were requested */
|
||||
if (ExtraOptions)
|
||||
{
|
||||
/* See where they are */
|
||||
ListOffset = Option->ListOffset;
|
||||
if (ListOffset)
|
||||
{
|
||||
/* See how big they are */
|
||||
ListData = (PBL_BCD_OPTION)((ULONG_PTR)Option + ListOffset);
|
||||
ListSize = BlGetBootOptionListSize(ListData);
|
||||
|
||||
/* Allocate a buffer to hold them into */
|
||||
ListCopy = BlMmAllocateHeap(ListSize);
|
||||
if (!ListCopy)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Copy them in there */
|
||||
RtlCopyMemory(ListCopy, ListData, ListSize);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _SECURE_BOOT_
|
||||
/* Filter out SecureBoot Options */
|
||||
AppIdentifier = BlGetApplicationIdentifier();
|
||||
if (BlpBootOptionCallbacks)
|
||||
{
|
||||
DeviceCallback = BlpBootOptionCallbacks->Device;
|
||||
if (DeviceCallback)
|
||||
{
|
||||
Status = DeviceCallback(BlpBootOptionCallbackCookie,
|
||||
Status,
|
||||
0,
|
||||
AppIdentifier,
|
||||
Type,
|
||||
&SecureDescriptor,
|
||||
PtrOptionData);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* No secure boot, so the secure descriptors are the standard ones */
|
||||
SecureDescriptor = DeviceDescriptor;
|
||||
SecureListData = ListCopy;
|
||||
#endif
|
||||
|
||||
/* Check if the data was read correctly */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Check if we had a new descriptor after filtering */
|
||||
if (SecureDescriptor != DeviceDescriptor)
|
||||
{
|
||||
/* Yep -- if we had an old one, free it */
|
||||
if (DeviceDescriptor)
|
||||
{
|
||||
BlMmFreeHeap(DeviceDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we had a new list after filtering */
|
||||
if (SecureListData != ListCopy)
|
||||
{
|
||||
/* Yep -- if we had an old list, free it */
|
||||
if (ListCopy)
|
||||
{
|
||||
BlMmFreeHeap(ListCopy);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, check if the caller wanted extra options */
|
||||
if (ExtraOptions)
|
||||
{
|
||||
/* Yep -- so pass the caller our copy */
|
||||
*ExtraOptions = ListCopy;
|
||||
ListCopy = NULL;
|
||||
}
|
||||
|
||||
/* Caller always wants data back, so pass them our copy */
|
||||
*Value = DeviceDescriptor;
|
||||
DeviceDescriptor = NULL;
|
||||
}
|
||||
|
||||
Quickie:
|
||||
/* On the failure path, if these buffers are active, we should free them */
|
||||
if (ListCopy)
|
||||
{
|
||||
BlMmFreeHeap(ListCopy);
|
||||
}
|
||||
if (DeviceDescriptor)
|
||||
{
|
||||
BlMmFreeHeap(DeviceDescriptor);
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionInteger (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PULONGLONG Value
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_BCD_OPTION Option;
|
||||
//PGUID AppIdentifier;
|
||||
BcdElementType ElementType;
|
||||
|
||||
/* Make sure this is a BCD_TYPE_INTEGER */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_INTEGER)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (Option)
|
||||
{
|
||||
*Value = *(PULONGLONG)((ULONG_PTR)Option + Option->DataOffset);
|
||||
}
|
||||
|
||||
#ifdef _SECURE_BOOT_
|
||||
/* Filter out SecureBoot Options */
|
||||
AppIdentifier = BlGetApplicationIdentifier();
|
||||
Status = BlpBootOptionCallbackULongLong(AppIdentifier, Type, Value);
|
||||
#else
|
||||
/* Option found */
|
||||
Status = Option ? STATUS_SUCCESS : STATUS_NOT_FOUND;
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlGetBootOptionBoolean (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PBOOLEAN Value
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBL_BCD_OPTION Option;
|
||||
//PGUID AppIdentifier;
|
||||
BcdElementType ElementType;
|
||||
|
||||
/* Make sure this is a BCD_TYPE_BOOLEAN */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_BOOLEAN)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (Option)
|
||||
{
|
||||
*Value = *(PBOOLEAN)((ULONG_PTR)Option + Option->DataOffset);
|
||||
}
|
||||
|
||||
#ifdef _SECURE_BOOT_
|
||||
/* Filter out SecureBoot Options */
|
||||
AppIdentifier = BlGetApplicationIdentifier();
|
||||
Status = BlpBootOptionCallbackBoolean(AppIdentifier, Type, Value);
|
||||
#else
|
||||
/* Option found */
|
||||
Status = Option ? STATUS_SUCCESS : STATUS_NOT_FOUND;
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpGetBootOptionIntegerList (
|
||||
_In_ PBL_BCD_OPTION List,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PULONGLONG* Value,
|
||||
_Out_ PULONGLONG Count,
|
||||
_In_ BOOLEAN NoCopy
|
||||
)
|
||||
{
|
||||
PBL_BCD_OPTION Option;
|
||||
BcdElementType ElementType;
|
||||
PULONGLONG ValueCopy;
|
||||
|
||||
/* Make sure this is a BCD_TYPE_INTEGER_LIST */
|
||||
ElementType.PackedValue = Type;
|
||||
if (ElementType.Format != BCD_TYPE_INTEGER_LIST)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return the data */
|
||||
Option = MiscGetBootOption(List, Type);
|
||||
if (!Option)
|
||||
{
|
||||
return STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Check if a copy should be made of it */
|
||||
if (NoCopy)
|
||||
{
|
||||
/* Nope, return the raw value */
|
||||
*Value = (PULONGLONG)((ULONG_PTR)Option + Option->DataOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Allocate a buffer for the copy */
|
||||
ValueCopy = BlMmAllocateHeap(Option->DataSize);
|
||||
if (!ValueCopy)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Copy the data in */
|
||||
RtlCopyMemory(ValueCopy,
|
||||
(PVOID)((ULONG_PTR)Option + Option->DataOffset),
|
||||
Option->DataSize);
|
||||
|
||||
/* Return our copy */
|
||||
*Value = ValueCopy;
|
||||
}
|
||||
|
||||
/* Return count and success */
|
||||
*Count = Option->DataSize / sizeof(ULONGLONG);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlCopyBootOptions (
|
||||
_In_ PBL_BCD_OPTION OptionList,
|
||||
_Out_ PBL_BCD_OPTION *CopiedOptions
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG OptionSize;
|
||||
PBL_BCD_OPTION Options;
|
||||
|
||||
/* Assume no options */
|
||||
Status = STATUS_SUCCESS;
|
||||
*CopiedOptions = NULL;
|
||||
|
||||
/* Get the size of the list and allocate a copy for it */
|
||||
OptionSize = BlGetBootOptionListSize(OptionList);
|
||||
Options = BlMmAllocateHeap(OptionSize);
|
||||
if (!Options)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Make the copy and return it to the caller */
|
||||
RtlCopyMemory(Options, OptionList, OptionSize);
|
||||
*CopiedOptions = Options;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlAppendBootOptions (
|
||||
_In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
|
||||
_In_ PBL_BCD_OPTION Options
|
||||
)
|
||||
{
|
||||
ULONG OptionsSize, CurrentSize;
|
||||
PBL_BCD_OPTION NewOptions, CurrentOptions, NextOption;
|
||||
NTSTATUS Status;
|
||||
ULONG CurrentOffset;
|
||||
|
||||
/* Get the current options */
|
||||
CurrentOptions = AppEntry->BcdData;
|
||||
|
||||
/* Calculate the size of the current, and the appended options */
|
||||
CurrentSize = BlGetBootOptionListSize(CurrentOptions);
|
||||
OptionsSize = BlGetBootOptionListSize(Options);
|
||||
|
||||
/* Allocate a buffer for the concatenated (new) options */
|
||||
NewOptions = BlMmAllocateHeap(CurrentSize + OptionsSize);
|
||||
if (!NewOptions)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Copy the old options, and the ones to be added */
|
||||
RtlCopyMemory(NewOptions, CurrentOptions, CurrentSize);
|
||||
RtlCopyMemory(&NewOptions[OptionsSize], Options, OptionsSize);
|
||||
|
||||
/* We made it! */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Scan through to the last option in the list */
|
||||
CurrentOffset = 0;
|
||||
do
|
||||
{
|
||||
NextOption = (PBL_BCD_OPTION)((ULONG_PTR)NewOptions + CurrentOffset);
|
||||
CurrentOffset = NextOption->NextEntryOffset;
|
||||
} while (CurrentOffset);
|
||||
|
||||
/* Every other option now has to have its offset adjusted */
|
||||
do
|
||||
{
|
||||
NextOption->NextEntryOffset += OptionsSize;
|
||||
NextOption = (PBL_BCD_OPTION)((ULONG_PTR)NewOptions + NextOption->NextEntryOffset);
|
||||
} while (NextOption->NextEntryOffset);
|
||||
|
||||
/* If we already had internal options, free them */
|
||||
if (AppEntry->Flags & BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL)
|
||||
{
|
||||
BlMmFreeHeap(AppEntry->BcdData);
|
||||
}
|
||||
|
||||
/* Write the new pointer */
|
||||
AppEntry->BcdData = NewOptions;
|
||||
|
||||
/* Options are now internal, not external */
|
||||
AppEntry->Flags &= ~BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL;
|
||||
AppEntry->Flags |= BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL;
|
||||
return Status;
|
||||
}
|
||||
|
@@ -1,889 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/lib/misc/bootreg.c
|
||||
* PURPOSE: Boot Library Boot Registry Wrapper for CMLIB
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
#include <bcd.h>
|
||||
|
||||
/* DEFINITIONS ***************************************************************/
|
||||
|
||||
#define BI_FLUSH_HIVE 0x01
|
||||
#define BI_HIVE_WRITEABLE 0x02
|
||||
|
||||
/* DATA STRUCTURES ***********************************************************/
|
||||
|
||||
typedef struct _BI_KEY_HIVE
|
||||
{
|
||||
PHBASE_BLOCK BaseBlock;
|
||||
ULONG HiveSize;
|
||||
PBL_FILE_PATH_DESCRIPTOR FilePath;
|
||||
CMHIVE Hive;
|
||||
LONG ReferenceCount;
|
||||
ULONG Flags;
|
||||
PCM_KEY_NODE RootNode;
|
||||
} BI_KEY_HIVE, *PBI_KEY_HIVE;
|
||||
|
||||
typedef struct _BI_KEY_OBJECT
|
||||
{
|
||||
PBI_KEY_HIVE KeyHive;
|
||||
PCM_KEY_NODE KeyNode;
|
||||
HCELL_INDEX KeyCell;
|
||||
PWCHAR KeyName;
|
||||
} BI_KEY_OBJECT, *PBI_KEY_OBJECT;
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
BOOLEAN BiHiveHashLibraryInitialized;
|
||||
ULONGLONG HvSymcryptSeed;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
HvIsInPlaceBaseBlockValid (
|
||||
_In_ PHBASE_BLOCK BaseBlock
|
||||
)
|
||||
{
|
||||
ULONG HiveLength, HeaderSum;
|
||||
BOOLEAN Valid;
|
||||
|
||||
/* Assume failure */
|
||||
Valid = FALSE;
|
||||
|
||||
/* Check for incorrect signature, type, version, or format */
|
||||
if ((BaseBlock->Signature == 'fger') &&
|
||||
(BaseBlock->Type == 0) &&
|
||||
(BaseBlock->Major <= 1) &&
|
||||
(BaseBlock->Minor <= 5) &&
|
||||
(BaseBlock->Minor >= 3) &&
|
||||
(BaseBlock->Format == 1))
|
||||
{
|
||||
/* Check for invalid hive size */
|
||||
HiveLength = BaseBlock->Length;
|
||||
if (HiveLength)
|
||||
{
|
||||
/* Check for misaligned or too large hive size */
|
||||
if (!(HiveLength & 0xFFF) && HiveLength <= 0x7FFFE000)
|
||||
{
|
||||
/* Check for invalid header checksum */
|
||||
HeaderSum = HvpHiveHeaderChecksum(BaseBlock);
|
||||
if (HeaderSum == BaseBlock->CheckSum)
|
||||
{
|
||||
/* All good */
|
||||
Valid = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return validity */
|
||||
return Valid;
|
||||
}
|
||||
|
||||
PVOID
|
||||
NTAPI
|
||||
CmpAllocate (
|
||||
_In_ SIZE_T Size,
|
||||
_In_ BOOLEAN Paged,
|
||||
_In_ ULONG Tag
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Paged);
|
||||
UNREFERENCED_PARAMETER(Tag);
|
||||
|
||||
/* Call the heap allocator */
|
||||
return BlMmAllocateHeap(Size);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CmpFree (
|
||||
_In_ PVOID Ptr,
|
||||
_In_ ULONG Quota
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Quota);
|
||||
|
||||
/* Call the heap allocator */
|
||||
BlMmFreeHeap(Ptr);
|
||||
}
|
||||
|
||||
VOID
|
||||
BiDereferenceHive (
|
||||
_In_ HANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
PBI_KEY_OBJECT KeyObject;
|
||||
|
||||
/* Get the key object */
|
||||
KeyObject = (PBI_KEY_OBJECT)KeyHandle;
|
||||
|
||||
/* Drop a reference on the parent hive */
|
||||
--KeyObject->KeyHive->ReferenceCount;
|
||||
}
|
||||
|
||||
VOID
|
||||
BiFlushHive (
|
||||
_In_ HANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
/* Not yet implemented */
|
||||
EfiPrintf(L"NO reg flush\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
BiCloseKey (
|
||||
_In_ HANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
PBI_KEY_HIVE KeyHive;
|
||||
PBI_KEY_OBJECT KeyObject;
|
||||
|
||||
/* Get the key object and hive */
|
||||
KeyObject = (PBI_KEY_OBJECT)KeyHandle;
|
||||
KeyHive = KeyObject->KeyHive;
|
||||
|
||||
/* Check if we have a hive, or name, or key node */
|
||||
if ((KeyHive) || (KeyObject->KeyNode) || (KeyObject->KeyName))
|
||||
{
|
||||
/* Drop a reference, see if it's the last one */
|
||||
BiDereferenceHive(KeyHandle);
|
||||
if (!KeyHive->ReferenceCount)
|
||||
{
|
||||
/* Check if we should flush it */
|
||||
if (KeyHive->Flags & BI_FLUSH_HIVE)
|
||||
{
|
||||
BiFlushHive(KeyHandle);
|
||||
}
|
||||
|
||||
/* Unmap the hive */
|
||||
//MmPapFreePages(KeyHive->ImageBase, 1);
|
||||
EfiPrintf(L"Leaking hive memory\r\n");
|
||||
|
||||
/* Free the hive and hive path */
|
||||
BlMmFreeHeap(KeyHive->FilePath);
|
||||
BlMmFreeHeap(KeyHive);
|
||||
}
|
||||
|
||||
/* Check if a key name is present */
|
||||
if (KeyObject->KeyName)
|
||||
{
|
||||
/* Free it */
|
||||
BlMmFreeHeap(KeyObject->KeyName);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the object */
|
||||
BlMmFreeHeap(KeyObject);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BiOpenKey(
|
||||
_In_ HANDLE ParentHandle,
|
||||
_In_ PWCHAR KeyName,
|
||||
_Out_ PHANDLE Handle
|
||||
)
|
||||
{
|
||||
PBI_KEY_OBJECT ParentKey, NewKey;
|
||||
PBI_KEY_HIVE ParentHive;
|
||||
NTSTATUS Status;
|
||||
ULONG NameLength, SubNameLength, NameBytes;
|
||||
PWCHAR NameStart, NameBuffer;
|
||||
UNICODE_STRING KeyString;
|
||||
HCELL_INDEX KeyCell;
|
||||
PHHIVE Hive;
|
||||
PCM_KEY_NODE ParentNode;
|
||||
|
||||
/* Convert from a handle to our key object */
|
||||
ParentKey = (PBI_KEY_OBJECT)ParentHandle;
|
||||
|
||||
/* Extract the hive and node information */
|
||||
ParentHive = ParentKey->KeyHive;
|
||||
ParentNode = ParentKey->KeyNode;
|
||||
Hive = &ParentKey->KeyHive->Hive.Hive;
|
||||
|
||||
/* Initialize variables */
|
||||
KeyCell = HCELL_NIL;
|
||||
Status = STATUS_SUCCESS;
|
||||
NameBuffer = NULL;
|
||||
|
||||
/* Loop as long as there's still portions of the key name in play */
|
||||
NameLength = wcslen(KeyName);
|
||||
while (NameLength)
|
||||
{
|
||||
/* Find the first path separator */
|
||||
NameStart = wcschr(KeyName, OBJ_NAME_PATH_SEPARATOR);
|
||||
if (NameStart)
|
||||
{
|
||||
/* Look only at the key before the separator */
|
||||
SubNameLength = NameStart - KeyName;
|
||||
++NameStart;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No path separator, this is the final leaf key */
|
||||
SubNameLength = NameLength;
|
||||
}
|
||||
|
||||
/* Free the name buffer from the previous pass if needed */
|
||||
if (NameBuffer)
|
||||
{
|
||||
BlMmFreeHeap(NameBuffer);
|
||||
}
|
||||
|
||||
/* Allocate a buffer to hold the name of this specific subkey only */
|
||||
NameBytes = SubNameLength * sizeof(WCHAR);
|
||||
NameBuffer = BlMmAllocateHeap(NameBytes + sizeof(UNICODE_NULL));
|
||||
if (!NameBuffer)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Copy and null-terminate the name of the subkey */
|
||||
RtlCopyMemory(NameBuffer, KeyName, NameBytes);
|
||||
NameBuffer[SubNameLength] = UNICODE_NULL;
|
||||
|
||||
/* Convert it into a UNICODE_STRING and try to find it */
|
||||
RtlInitUnicodeString(&KeyString, NameBuffer);
|
||||
KeyCell = CmpFindSubKeyByName(Hive, ParentNode, &KeyString);
|
||||
if (KeyCell == HCELL_NIL)
|
||||
{
|
||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* We found it -- get the key node out of it */
|
||||
ParentNode = (PCM_KEY_NODE)HvGetCell(Hive, KeyCell);
|
||||
if (!ParentNode)
|
||||
{
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Update the key name to the next remaining path element */
|
||||
KeyName = NameStart;
|
||||
if (NameStart)
|
||||
{
|
||||
/* Update the length to the remainder of the path */
|
||||
NameLength += -1 - SubNameLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There's nothing left, this was the leaf key */
|
||||
NameLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate a key object */
|
||||
NewKey = BlMmAllocateHeap(sizeof(*NewKey));
|
||||
if (!NewKey)
|
||||
{
|
||||
/* Bail out if we had no memory for it */
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Fill out the key object data */
|
||||
NewKey->KeyNode = ParentNode;
|
||||
NewKey->KeyHive = ParentHive;
|
||||
NewKey->KeyName = NameBuffer;
|
||||
NewKey->KeyCell = KeyCell;
|
||||
|
||||
/* Add a reference to the hive */
|
||||
++ParentHive->ReferenceCount;
|
||||
|
||||
/* Return the object back to the caller */
|
||||
*Handle = NewKey;
|
||||
|
||||
Quickie:
|
||||
/* If we had a name buffer, free it */
|
||||
if (NameBuffer)
|
||||
{
|
||||
BlMmFreeHeap(NameBuffer);
|
||||
}
|
||||
|
||||
/* Return status of the open operation */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BiInitializeAndValidateHive (
|
||||
_In_ PBI_KEY_HIVE Hive
|
||||
)
|
||||
{
|
||||
ULONG HiveSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Make sure the hive is at least the size of a base block */
|
||||
if (Hive->HiveSize < sizeof(HBASE_BLOCK))
|
||||
{
|
||||
return STATUS_REGISTRY_CORRUPT;
|
||||
}
|
||||
|
||||
/* Make sure that the base block accurately describes the size of the hive */
|
||||
HiveSize = Hive->BaseBlock->Length + sizeof(HBASE_BLOCK);
|
||||
if ((HiveSize < sizeof(HBASE_BLOCK)) || (HiveSize > Hive->HiveSize))
|
||||
{
|
||||
return STATUS_REGISTRY_CORRUPT;
|
||||
}
|
||||
|
||||
/* Initialize a flat memory hive */
|
||||
RtlZeroMemory(&Hive->Hive, sizeof(Hive->Hive));
|
||||
Status = HvInitialize(&Hive->Hive.Hive,
|
||||
HINIT_FLAT,
|
||||
0,
|
||||
0,
|
||||
Hive->BaseBlock,
|
||||
CmpAllocate,
|
||||
CmpFree,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Cleanup volatile/old data */
|
||||
CmPrepareHive(&Hive->Hive.Hive); // CmCheckRegistry
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Return the final status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BiLoadHive (
|
||||
_In_ PBL_FILE_PATH_DESCRIPTOR FilePath,
|
||||
_Out_ PHANDLE HiveHandle
|
||||
)
|
||||
{
|
||||
ULONG DeviceId;
|
||||
PHBASE_BLOCK BaseBlock, NewBaseBlock;
|
||||
PBI_KEY_OBJECT KeyObject;
|
||||
PBI_KEY_HIVE BcdHive;
|
||||
PBL_DEVICE_DESCRIPTOR BcdDevice;
|
||||
ULONG PathLength, DeviceLength, HiveSize, HiveLength, NewHiveSize;
|
||||
PWCHAR HiveName, LogName;
|
||||
BOOLEAN HaveWriteAccess;
|
||||
NTSTATUS Status;
|
||||
PVOID LogData;
|
||||
PHHIVE Hive;
|
||||
UNICODE_STRING KeyString;
|
||||
PCM_KEY_NODE RootNode;
|
||||
HCELL_INDEX CellIndex;
|
||||
|
||||
/* Initialize variables */
|
||||
DeviceId = -1;
|
||||
BaseBlock = NULL;
|
||||
BcdHive = NULL;
|
||||
KeyObject = NULL;
|
||||
LogData = NULL;
|
||||
LogName = NULL;
|
||||
|
||||
/* Initialize the crypto seed */
|
||||
if (!BiHiveHashLibraryInitialized)
|
||||
{
|
||||
HvSymcryptSeed = 0x82EF4D887A4E55C5;
|
||||
BiHiveHashLibraryInitialized = TRUE;
|
||||
}
|
||||
|
||||
/* Extract and validate the input path */
|
||||
BcdDevice = (PBL_DEVICE_DESCRIPTOR)&FilePath->Path;
|
||||
PathLength = FilePath->Length;
|
||||
DeviceLength = BcdDevice->Size;
|
||||
HiveName = (PWCHAR)((ULONG_PTR)BcdDevice + BcdDevice->Size);
|
||||
if (PathLength <= DeviceLength)
|
||||
{
|
||||
/* Doesn't make sense, bail out */
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Attempt to open the underlying device for RW access */
|
||||
HaveWriteAccess = TRUE;
|
||||
Status = BlpDeviceOpen(BcdDevice,
|
||||
BL_DEVICE_READ_ACCESS | BL_DEVICE_WRITE_ACCESS,
|
||||
0,
|
||||
&DeviceId);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Try for RO access instead */
|
||||
HaveWriteAccess = FALSE;
|
||||
Status = BlpDeviceOpen(BcdDevice, BL_DEVICE_READ_ACCESS, 0, &DeviceId);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* No access at all -- bail out */
|
||||
goto Quickie;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now try to load the hive on disk */
|
||||
Status = BlImgLoadImageWithProgress2(DeviceId,
|
||||
BlLoaderRegistry,
|
||||
HiveName,
|
||||
(PVOID*)&BaseBlock,
|
||||
&HiveSize,
|
||||
0,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"Hive read failure: % lx\r\n", Status);
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Allocate a hive structure */
|
||||
BcdHive = BlMmAllocateHeap(sizeof(*BcdHive));
|
||||
if (!BcdHive)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Initialize it */
|
||||
RtlZeroMemory(BcdHive, sizeof(*BcdHive));
|
||||
BcdHive->BaseBlock = BaseBlock;
|
||||
BcdHive->HiveSize = HiveSize;
|
||||
if (HaveWriteAccess)
|
||||
{
|
||||
BcdHive->Flags |= BI_HIVE_WRITEABLE;
|
||||
}
|
||||
|
||||
/* Make sure the hive was at least one bin long */
|
||||
if (HiveSize < sizeof(*BaseBlock))
|
||||
{
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make sure the hive contents are at least one bin long */
|
||||
HiveLength = BaseBlock->Length;
|
||||
if (BaseBlock->Length < sizeof(*BaseBlock))
|
||||
{
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Validate the initial bin (the base block) */
|
||||
if (!HvIsInPlaceBaseBlockValid(BaseBlock))
|
||||
{
|
||||
EfiPrintf(L"Recovery not implemented\r\n");
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Check if there's log recovery that needs to happen */
|
||||
if (BaseBlock->Sequence1 != BaseBlock->Sequence2)
|
||||
{
|
||||
EfiPrintf(L"Log fix not implemented: %lx %lx\r\n");
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the whole hive doesn't fit in the buffer.
|
||||
* Note: HiveLength does not include the size of the baseblock itself
|
||||
*/
|
||||
if (HiveSize < (HiveLength + sizeof(*BaseBlock)))
|
||||
{
|
||||
EfiPrintf(L"Need bigger hive buffer path\r\n");
|
||||
|
||||
/* Allocate a slightly bigger buffer */
|
||||
NewHiveSize = HiveLength + sizeof(*BaseBlock);
|
||||
Status = MmPapAllocatePagesInRange((PVOID*)&NewBaseBlock,
|
||||
BlLoaderRegistry,
|
||||
NewHiveSize >> PAGE_SHIFT,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Copy the current data in there */
|
||||
RtlCopyMemory(NewBaseBlock, BaseBlock, HiveSize);
|
||||
|
||||
/* Free the old data */
|
||||
EfiPrintf(L"Leaking old hive buffer\r\n");
|
||||
//MmPapFreePages(BaseBlock, 1);
|
||||
|
||||
/* Update our pointers */
|
||||
BaseBlock = NewBaseBlock;
|
||||
HiveSize = NewHiveSize;
|
||||
BcdHive->BaseBlock = BaseBlock;
|
||||
BcdHive->HiveSize = HiveSize;
|
||||
}
|
||||
|
||||
/* Check if any log stuff needs to happen */
|
||||
if (LogData)
|
||||
{
|
||||
EfiPrintf(L"Log fix not implemented: %lx %lx\r\n");
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Call Hv to setup the hive library */
|
||||
Status = BiInitializeAndValidateHive(BcdHive);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Now get the root node */
|
||||
Hive = &BcdHive->Hive.Hive;
|
||||
RootNode = (PCM_KEY_NODE)HvGetCell(Hive, Hive->BaseBlock->RootCell);
|
||||
if (!RootNode)
|
||||
{
|
||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Find the Objects subkey under it to see if it's a real BCD hive */
|
||||
RtlInitUnicodeString(&KeyString, L"Objects");
|
||||
CellIndex = CmpFindSubKeyByName(Hive, RootNode, &KeyString);
|
||||
if (CellIndex == HCELL_NIL)
|
||||
{
|
||||
EfiPrintf(L"No OBJECTS subkey found!\r\n");
|
||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* This is a valid BCD hive, store its root node here */
|
||||
BcdHive->RootNode = RootNode;
|
||||
|
||||
/* Allocate a copy of the file path */
|
||||
BcdHive->FilePath = BlMmAllocateHeap(FilePath->Length);
|
||||
if (!BcdHive->FilePath)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Make a copy of it */
|
||||
RtlCopyMemory(BcdHive->FilePath, FilePath, FilePath->Length);
|
||||
|
||||
/* Create a key object to describe the rot */
|
||||
KeyObject = BlMmAllocateHeap(sizeof(*KeyObject));
|
||||
if (!KeyObject)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Fill out the details */
|
||||
KeyObject->KeyNode = RootNode;
|
||||
KeyObject->KeyHive = BcdHive;
|
||||
KeyObject->KeyName = NULL;
|
||||
KeyObject->KeyCell = Hive->BaseBlock->RootCell;
|
||||
|
||||
/* One reference for the key object, plus one lifetime reference */
|
||||
BcdHive->ReferenceCount = 2;
|
||||
|
||||
/* This is the hive handle */
|
||||
*HiveHandle = KeyObject;
|
||||
|
||||
/* We're all good */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
Quickie:
|
||||
/* If we had a log name, free it */
|
||||
if (LogName)
|
||||
{
|
||||
BlMmFreeHeap(LogName);
|
||||
}
|
||||
|
||||
/* If we had logging data, free it */
|
||||
if (LogData)
|
||||
{
|
||||
EfiPrintf(L"Leaking log buffer\r\n");
|
||||
//MmPapFreePages(LogData, 1);
|
||||
}
|
||||
|
||||
/* Check if this is the failure path */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* If we mapped the hive, free it */
|
||||
if (BaseBlock)
|
||||
{
|
||||
EfiPrintf(L"Leaking base block on failure\r\n");
|
||||
//MmPapFreePages(BaseBlock, 1u);
|
||||
}
|
||||
|
||||
/* If we opened the device, close it */
|
||||
if (DeviceId != -1)
|
||||
{
|
||||
BlDeviceClose(DeviceId);
|
||||
}
|
||||
|
||||
/* Did we create a hive object? */
|
||||
if (BcdHive)
|
||||
{
|
||||
/* Free the file path if we made a copy of it */
|
||||
if (BcdHive->FilePath)
|
||||
{
|
||||
BlMmFreeHeap(BcdHive->FilePath);
|
||||
}
|
||||
|
||||
/* Free the hive itself */
|
||||
BlMmFreeHeap(BcdHive);
|
||||
}
|
||||
|
||||
/* Finally, free the root key object if we created one */
|
||||
if (KeyObject)
|
||||
{
|
||||
BlMmFreeHeap(KeyObject);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the final status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BiGetRegistryValue (
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PWCHAR ValueName,
|
||||
_In_ PWCHAR KeyName,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PVOID* Buffer,
|
||||
_Out_ PULONG ValueLength
|
||||
)
|
||||
{
|
||||
PCM_KEY_NODE KeyNode;
|
||||
PHHIVE KeyHive;
|
||||
UNICODE_STRING ValueString;
|
||||
PBI_KEY_OBJECT KeyObject;
|
||||
PCM_KEY_VALUE KeyValue;
|
||||
PVOID ValueCopy;
|
||||
ULONG Size;
|
||||
HCELL_INDEX CellIndex;
|
||||
PCELL_DATA ValueData;
|
||||
|
||||
/* Get the key object, node,and hive */
|
||||
KeyObject = (PBI_KEY_OBJECT)KeyHandle;
|
||||
KeyNode = KeyObject->KeyNode;
|
||||
KeyHive = &KeyObject->KeyHive->Hive.Hive;
|
||||
|
||||
/* Find the value cell index in the list of values */
|
||||
RtlInitUnicodeString(&ValueString, ValueName);
|
||||
CmpFindNameInList(KeyHive,
|
||||
&KeyNode->ValueList,
|
||||
&ValueString,
|
||||
NULL,
|
||||
&CellIndex);
|
||||
if (CellIndex == HCELL_NIL)
|
||||
{
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* Get the cell data for it */
|
||||
KeyValue = (PCM_KEY_VALUE)HvGetCell(KeyHive, CellIndex);
|
||||
if (!KeyValue)
|
||||
{
|
||||
return STATUS_REGISTRY_CORRUPT;
|
||||
}
|
||||
|
||||
/* Make sure the type matches */
|
||||
if (KeyValue->Type != Type)
|
||||
{
|
||||
return STATUS_OBJECT_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
/* Now get the data cell */
|
||||
ValueData = CmpValueToData(KeyHive, KeyValue, &Size);
|
||||
|
||||
/* Make a copy of it */
|
||||
ValueCopy = BlMmAllocateHeap(Size);
|
||||
if (!ValueCopy)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Copy it in the buffer, and return it and its size */
|
||||
RtlCopyMemory(ValueCopy, ValueData, Size);
|
||||
*Buffer = ValueCopy;
|
||||
*ValueLength = Size;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BiEnumerateSubKeys (
|
||||
_In_ HANDLE KeyHandle,
|
||||
_Out_ PWCHAR** SubKeyList,
|
||||
_Out_ PULONG SubKeyCount
|
||||
)
|
||||
{
|
||||
PCM_KEY_NODE KeyNode, Node;
|
||||
PBI_KEY_OBJECT KeyObject;
|
||||
ULONG KeyCount;
|
||||
ULONG NameLength, NewTotalNameLength, FinalLength, TotalNameLength;
|
||||
PHHIVE Hive;
|
||||
PWCHAR KeyName, NameEnd;
|
||||
HCELL_INDEX CellIndex;
|
||||
PWCHAR* SubKeys;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
||||
/* Get the key object, node, and hive */
|
||||
KeyObject = (PBI_KEY_OBJECT)KeyHandle;
|
||||
KeyNode = KeyObject->KeyNode;
|
||||
Hive = &KeyObject->KeyHive->Hive.Hive;
|
||||
|
||||
/* Assume it's empty */
|
||||
*SubKeyList = 0;
|
||||
*SubKeyCount = 0;
|
||||
|
||||
/* Initialize locals */
|
||||
KeyCount = 0;
|
||||
SubKeys = 0;
|
||||
TotalNameLength = 0;
|
||||
|
||||
/* Find the first subkey cell index */
|
||||
CellIndex = CmpFindSubKeyByNumber(Hive, KeyNode, KeyCount);
|
||||
while (CellIndex != HCELL_NIL)
|
||||
{
|
||||
/* Move to the next one */
|
||||
KeyCount++;
|
||||
|
||||
/* Get the cell data for it */
|
||||
Node = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
|
||||
if (!Node)
|
||||
{
|
||||
return STATUS_REGISTRY_CORRUPT;
|
||||
}
|
||||
|
||||
/* Check if the value is compressed */
|
||||
if (Node->Flags & KEY_COMP_NAME)
|
||||
{
|
||||
/* Get the compressed name size */
|
||||
NameLength = CmpCompressedNameSize(Node->Name, Node->NameLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the real size */
|
||||
NameLength = Node->NameLength;
|
||||
}
|
||||
|
||||
/* Add up the new length, protecting against overflow */
|
||||
NewTotalNameLength = TotalNameLength + NameLength + sizeof(UNICODE_NULL);
|
||||
if (NewTotalNameLength < TotalNameLength)
|
||||
{
|
||||
Status = STATUS_NAME_TOO_LONG;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* We're good, use the new length */
|
||||
TotalNameLength = NewTotalNameLength;
|
||||
|
||||
/* Find the next subkey cell index */
|
||||
CellIndex = CmpFindSubKeyByNumber(Hive, KeyNode, KeyCount);
|
||||
}
|
||||
|
||||
/* Were there no keys? We're done, if so */
|
||||
if (!KeyCount)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Safely compute the size of the array needed */
|
||||
Status = RtlULongLongToULong(sizeof(PWCHAR) * KeyCount, &FinalLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Safely add that to the name length */
|
||||
Status = RtlULongAdd(TotalNameLength, FinalLength, &FinalLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Allocate an array big enough for the names and pointers */
|
||||
SubKeys = BlMmAllocateHeap(FinalLength);
|
||||
if (!SubKeys)
|
||||
{
|
||||
Status = STATUS_NO_MEMORY;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Go over each key again */
|
||||
NameEnd = (PWCHAR)&SubKeys[KeyCount];
|
||||
for (i = 0; i < KeyCount; i++)
|
||||
{
|
||||
/* Get the cell index for this subkey */
|
||||
CellIndex = CmpFindSubKeyByNumber(Hive, KeyNode, i);
|
||||
if (CellIndex == HCELL_NIL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get the cell data for it */
|
||||
Node = HvGetCell(Hive, CellIndex);
|
||||
if (!Node)
|
||||
{
|
||||
Status = STATUS_REGISTRY_CORRUPT;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Check if the value is compressed */
|
||||
KeyName = Node->Name;
|
||||
if (Node->Flags & KEY_COMP_NAME)
|
||||
{
|
||||
/* Get the compressed name size */
|
||||
NameLength = CmpCompressedNameSize(KeyName, Node->NameLength);
|
||||
CmpCopyCompressedName(NameEnd, NameLength, KeyName, Node->NameLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get the real size */
|
||||
NameLength = Node->NameLength;
|
||||
RtlCopyMemory(NameEnd, KeyName, NameLength);
|
||||
}
|
||||
|
||||
/* Move the name buffer to the next spot, and NULL-terminate */
|
||||
SubKeys[i] = NameEnd;
|
||||
NameEnd += (NameLength / sizeof(WCHAR));
|
||||
*NameEnd = UNICODE_NULL;
|
||||
|
||||
/* Keep going */
|
||||
NameEnd++;
|
||||
}
|
||||
|
||||
/* Check if the subkeys were empty */
|
||||
if (i == 0)
|
||||
{
|
||||
/* They disappeared in the middle of enumeration */
|
||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
/* Return the count and the array of names */
|
||||
*SubKeyList = SubKeys;
|
||||
*SubKeyCount = i;
|
||||
SubKeys = NULL;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
Quickie:
|
||||
/* On the failure path, free the subkeys if any exist */
|
||||
if (SubKeys)
|
||||
{
|
||||
BlMmFreeHeap(SubKeys);
|
||||
}
|
||||
|
||||
/* All done, return the result */
|
||||
return Status;
|
||||
}
|
||||
|
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/lib/misc/font.c
|
||||
* PURPOSE: Boot Library Font Functions
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
LIST_ENTRY BfiDeferredListHead;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
BfiLoadFontFile (
|
||||
_In_ PBL_DEVICE_DESCRIPTOR FontDevice,
|
||||
_In_ PWCHAR FontPath
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Cannot load fond %s, no font loader exists\r\n", FontPath);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID
|
||||
BfiFreeDeferredFontFile (
|
||||
_In_ PBL_DEFERRED_FONT_FILE DeferredFontFile
|
||||
)
|
||||
{
|
||||
/* Free the device copy if there was one */
|
||||
if (DeferredFontFile->Device)
|
||||
{
|
||||
BlMmFreeHeap(DeferredFontFile->Device);
|
||||
}
|
||||
|
||||
/* Free the path copy if there was one */
|
||||
if (DeferredFontFile->FontPath)
|
||||
{
|
||||
BlMmFreeHeap(DeferredFontFile->FontPath);
|
||||
}
|
||||
|
||||
/* Free the whole thing */
|
||||
BlMmFreeHeap(DeferredFontFile);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BfLoadFontFile (
|
||||
_In_ PBL_DEVICE_DESCRIPTOR Device,
|
||||
_In_ PWCHAR FontPath
|
||||
)
|
||||
{
|
||||
PBL_DEFERRED_FONT_FILE DeferredFont;
|
||||
ULONG FontPathSize;
|
||||
|
||||
/* Allocate the deferred font structure */
|
||||
DeferredFont = (PBL_DEFERRED_FONT_FILE)BlMmAllocateHeap(sizeof(*DeferredFont));
|
||||
if (!DeferredFont)
|
||||
{
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Zero it out */
|
||||
RtlZeroMemory(DeferredFont, sizeof(*DeferredFont));
|
||||
|
||||
/* Allocate a copy for the file path */
|
||||
FontPathSize = sizeof(WCHAR) * wcslen(FontPath) + sizeof(UNICODE_NULL);
|
||||
DeferredFont->FontPath = (PWCHAR)BlMmAllocateHeap(FontPathSize);
|
||||
if (!DeferredFont->FontPath)
|
||||
{
|
||||
BfiFreeDeferredFontFile(DeferredFont);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Allocate a copy for the device */
|
||||
DeferredFont->Device = BlMmAllocateHeap(Device->Size);
|
||||
if (!DeferredFont->Device)
|
||||
{
|
||||
BfiFreeDeferredFontFile(DeferredFont);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Copy the path and device */
|
||||
RtlCopyMemory(DeferredFont->FontPath, FontPath, FontPathSize);
|
||||
RtlCopyMemory(DeferredFont->Device,Device, Device->Size);
|
||||
|
||||
/* Set pending flag? */
|
||||
DeferredFont->Flags = 1;
|
||||
|
||||
/* Insert it into the list */
|
||||
InsertTailList(&BfiDeferredListHead, &DeferredFont->ListEntry);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BfLoadDeferredFontFiles (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PLIST_ENTRY NextEntry;
|
||||
PBL_DEFERRED_FONT_FILE DeferredFont;
|
||||
NTSTATUS Status, LoadStatus;
|
||||
|
||||
/* Assume empty list */
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Parse the list */
|
||||
NextEntry = BfiDeferredListHead.Flink;
|
||||
while (NextEntry != &BfiDeferredListHead)
|
||||
{
|
||||
/* Get the font */
|
||||
DeferredFont = CONTAINING_RECORD(NextEntry, BL_DEFERRED_FONT_FILE, ListEntry);
|
||||
|
||||
/* Move to the next entry and remove this one */
|
||||
NextEntry = NextEntry->Flink;
|
||||
RemoveEntryList(&DeferredFont->ListEntry);
|
||||
|
||||
/* Load the font */
|
||||
LoadStatus = BfiLoadFontFile(DeferredFont->Device,
|
||||
DeferredFont->FontPath);
|
||||
if (!NT_SUCCESS(LoadStatus))
|
||||
{
|
||||
/* Remember the load failure if there was one */
|
||||
Status = LoadStatus;
|
||||
}
|
||||
|
||||
/* Free the deferred font */
|
||||
BfiFreeDeferredFontFile(DeferredFont);
|
||||
}
|
||||
|
||||
/* Return load status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BfiFlipCursorCharacter (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console,
|
||||
_In_ BOOLEAN Visible
|
||||
)
|
||||
{
|
||||
/* not implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BfClearToEndOfLine (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
/* not implemented */
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BfClearScreen (
|
||||
_In_ PBL_GRAPHICS_CONSOLE Console
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Reset the cursor position */
|
||||
Console->TextConsole.State.XPos = 0;
|
||||
Console->TextConsole.State.YPos = 0;
|
||||
|
||||
/* Fill the screen with the background color */
|
||||
Status = ConsoleGraphicalClearPixels(Console,
|
||||
Console->TextConsole.State.BgColor);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if the cursor should be visible */
|
||||
if (Console->TextConsole.State.CursorVisible)
|
||||
{
|
||||
/* Load any fonts at this time */
|
||||
if (!IsListEmpty(&BfiDeferredListHead))
|
||||
{
|
||||
BfLoadDeferredFontFiles();
|
||||
}
|
||||
|
||||
/* Switch the cursor to visible */
|
||||
Status = BfiFlipCursorCharacter(Console, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing left to do */
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Return cursor flip result, if any */
|
||||
return Status;
|
||||
}
|
@@ -551,43 +551,3 @@ Quickie:
|
||||
return Status;
|
||||
}
|
||||
|
||||
PIMAGE_SECTION_HEADER
|
||||
BlImgFindSection (
|
||||
_In_ PVOID ImageBase,
|
||||
_In_ ULONG ImageSize
|
||||
)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER FoundSection;
|
||||
ULONG i;
|
||||
PIMAGE_SECTION_HEADER SectionHeader;
|
||||
PIMAGE_NT_HEADERS NtHeader;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Assume failure */
|
||||
FoundSection = NULL;
|
||||
|
||||
/* Make sure the image is valid */
|
||||
Status = RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeader);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Get the first section and loop through them all */
|
||||
SectionHeader = IMAGE_FIRST_SECTION(NtHeader);
|
||||
for (i = 0; i < NtHeader->FileHeader.NumberOfSections; i++)
|
||||
{
|
||||
/* Check if this is the resource section */
|
||||
if (!_stricmp((PCCH)SectionHeader->Name, ".rsrc"))
|
||||
{
|
||||
/* Yep, we're done */
|
||||
FoundSection = SectionHeader;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Nope, keep going */
|
||||
SectionHeader++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the matching section */
|
||||
return FoundSection;
|
||||
}
|
||||
|
||||
|
@@ -1,550 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS UEFI Boot Library
|
||||
* FILE: boot/environ/lib/misc/resource.c
|
||||
* PURPOSE: Boot Library Resource Functions
|
||||
* PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
PVOID ResPeImageBase;
|
||||
PVOID ResPeImageEnd;
|
||||
PVOID ResRootDirectory;
|
||||
|
||||
PVOID ResPeImageBasePrimary;
|
||||
PVOID ResPeImageEndPrimary;
|
||||
PVOID ResRootDirectoryPrimary;
|
||||
ULONG_PTR ResRootDirectoryPrimaryOffset;
|
||||
ULONG_PTR ResRootDirectoryOffset;
|
||||
ULONG_PTR ResRootDirectoryFallbackOffset;
|
||||
PVOID ResPeImageBaseFallback;
|
||||
PVOID ResPeImageEndFallback;
|
||||
PVOID ResRootDirectoryFallback;
|
||||
|
||||
BOOLEAN ResLoadedFontFiles;
|
||||
PVOID ResMuiImageBase;
|
||||
ULONG_PTR ResMuiImageSize;
|
||||
|
||||
PWCHAR ResLocale;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
ResSelectLocale (
|
||||
_In_ BOOLEAN Primary
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Check if we're using the primary (MUI) or fallback resources */
|
||||
if (Primary)
|
||||
{
|
||||
/* Use the primary ones */
|
||||
ResRootDirectory = ResRootDirectoryPrimary;
|
||||
ResRootDirectoryOffset = ResRootDirectoryPrimaryOffset;
|
||||
ResPeImageBase = ResPeImageBasePrimary;
|
||||
ResPeImageEnd = ResPeImageEndPrimary;
|
||||
|
||||
/* Register the locale with the display */
|
||||
Status = BlpDisplayRegisterLocale(ResLocale);
|
||||
}
|
||||
|
||||
/* Check if that failed, or if we're using fallback */
|
||||
if (!(Primary) || !(NT_SUCCESS(Status)))
|
||||
{
|
||||
/* Set the fallback pointers */
|
||||
ResRootDirectory = ResRootDirectoryFallback;
|
||||
ResRootDirectoryOffset = ResRootDirectoryFallbackOffset;
|
||||
ResPeImageBase = ResPeImageBaseFallback;
|
||||
ResPeImageEnd = ResPeImageEndFallback;
|
||||
|
||||
/* Register the fallback (America baby!) locale */
|
||||
Status = BlpDisplayRegisterLocale(L"en-US");
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Fallback to text mode (yes, this is the API...) */
|
||||
return BlDisplaySetScreenResolution();
|
||||
}
|
||||
}
|
||||
|
||||
/* No fonts loaded -- return failure code */
|
||||
ResLoadedFontFiles = FALSE;
|
||||
return Status;
|
||||
}
|
||||
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY
|
||||
ResFindDirectoryEntry (
|
||||
_In_ PIMAGE_RESOURCE_DIRECTORY Directory,
|
||||
_In_opt_ PUSHORT Id,
|
||||
_In_opt_ PWCHAR Name,
|
||||
_In_ ULONG_PTR SectionStart
|
||||
)
|
||||
{
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY EntryTable, IdEntryTable;
|
||||
ULONG i;
|
||||
SIZE_T NameLength;
|
||||
PIMAGE_RESOURCE_DIRECTORY_STRING NameString;
|
||||
|
||||
/* Are we looking by ID or name? */
|
||||
if (Id)
|
||||
{
|
||||
/* By ID, so were we passed a name? */
|
||||
if (Name)
|
||||
{
|
||||
/* That doesn't make sense */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (!Name)
|
||||
{
|
||||
/* By name, but we weren't given one. Also bad. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the table of names */
|
||||
EntryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(Directory + 1);
|
||||
|
||||
/* Check if we are doing ID lookup instead */
|
||||
if (Id)
|
||||
{
|
||||
/* The IDs come after the names */
|
||||
IdEntryTable = &EntryTable[Directory->NumberOfNamedEntries];
|
||||
|
||||
/* Parse them */
|
||||
for (i = 0; i < Directory->NumberOfIdEntries; i++)
|
||||
{
|
||||
/* Check if the ID matches, or if the wildcard is being used*/
|
||||
if ((IdEntryTable[i].Id == *Id) || (*Id == 0xFFFF))
|
||||
{
|
||||
/* Return a pointer to the data */
|
||||
return (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(SectionStart + IdEntryTable[i].OffsetToDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
/* ID was not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Searching by name, so parse them */
|
||||
for (i = 0; i < Directory->NumberOfNamedEntries; i++)
|
||||
{
|
||||
/* Get the name itself and count its length */
|
||||
NameString = (PIMAGE_RESOURCE_DIRECTORY_STRING)(SectionStart + EntryTable[i].NameOffset);
|
||||
NameLength = wcslen(Name);
|
||||
|
||||
/* If the length matches, compare the bytes */
|
||||
if ((NameLength == NameString->Length) &&
|
||||
(RtlCompareMemory(NameString->NameString, Name, NameLength) == NameLength))
|
||||
{
|
||||
/* They both match, so this is our entry. Return it */
|
||||
return (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(SectionStart + EntryTable[i].OffsetToDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
/* Name was not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ResFindDataEntryFromImage (
|
||||
_In_opt_ PVOID ImageBase,
|
||||
_In_opt_ ULONG ImageSize,
|
||||
_In_ USHORT DirectoryId,
|
||||
_In_ PUSHORT EntryId,
|
||||
_In_ PWCHAR Name,
|
||||
_Out_ PIMAGE_RESOURCE_DATA_ENTRY *DataEntryOut,
|
||||
_Out_ PVOID* ResourceOut
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PIMAGE_SECTION_HEADER ResourceSection;
|
||||
PIMAGE_RESOURCE_DIRECTORY ResourceDir, RootDir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY DirEntry;
|
||||
PIMAGE_RESOURCE_DATA_ENTRY DataEntry;
|
||||
PVOID Data, DataEnd, ImageEnd;
|
||||
BOOLEAN UseFallbackDirectory;
|
||||
|
||||
/* Assume nothing found */
|
||||
UseFallbackDirectory = TRUE;
|
||||
Status = STATUS_NOT_FOUND;
|
||||
|
||||
/* Are we looking at a particular image? */
|
||||
if (ImageBase)
|
||||
{
|
||||
/* Then make sure we know its size */
|
||||
if (!ImageSize)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Find the resource section for it */
|
||||
ResourceSection = BlImgFindSection(ImageBase, ImageSize);
|
||||
if (!ResourceSection)
|
||||
{
|
||||
return STATUS_INVALID_IMAGE_FORMAT;
|
||||
}
|
||||
|
||||
/* Remember how big the image is, and find the resource directory */
|
||||
ImageEnd = (PVOID)((ULONG_PTR)ImageBase + ImageSize);
|
||||
RootDir = (PIMAGE_RESOURCE_DIRECTORY)((ULONG_PTR)ImageBase +
|
||||
ResourceSection->VirtualAddress);
|
||||
if ((PVOID)RootDir < ImageBase)
|
||||
{
|
||||
/* It's out of bounds, so bail out */
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* We have a valid directory, don't use fallback for now */
|
||||
UseFallbackDirectory = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We are using the current library settings instead */
|
||||
ImageBase = ResPeImageBase;
|
||||
RootDir = ResRootDirectory;
|
||||
ImageEnd = ResPeImageEnd;
|
||||
}
|
||||
|
||||
/* If we don't have a resource directory, there's nothing to find */
|
||||
if (!RootDir)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Try two loops, once for primary, once for fallback */
|
||||
while (1)
|
||||
{
|
||||
/* Find the directory first */
|
||||
ResourceDir = (PIMAGE_RESOURCE_DIRECTORY)ResFindDirectoryEntry(RootDir,
|
||||
&DirectoryId,
|
||||
NULL,
|
||||
(ULONG_PTR)RootDir);
|
||||
if (ResourceDir)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* We didn't find it -- is it time to use the fallback? */
|
||||
if (UseFallbackDirectory)
|
||||
{
|
||||
/* Were were not using the fallback already? */
|
||||
if (RootDir != ResRootDirectoryFallback)
|
||||
{
|
||||
/* Then attempt with the fallback instead*/
|
||||
RootDir = ResRootDirectoryFallback;
|
||||
ImageBase = ResPeImageBaseFallback;
|
||||
ImageEnd = ResPeImageEndFallback;
|
||||
|
||||
/* Making sure we have one... */
|
||||
if (RootDir)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, return failure here */
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Now that we are in the right directory, lookup the resource */
|
||||
ResourceDir = (PIMAGE_RESOURCE_DIRECTORY)ResFindDirectoryEntry(ResourceDir,
|
||||
EntryId,
|
||||
Name,
|
||||
(ULONG_PTR)RootDir);
|
||||
if (!ResourceDir)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* The entry is right after */
|
||||
DirEntry = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(ResourceDir + 1);
|
||||
if ((PVOID)DirEntry < (PVOID)ResourceDir)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Get the data entry for it */
|
||||
DataEntry = (PIMAGE_RESOURCE_DATA_ENTRY)((ULONG_PTR)RootDir +
|
||||
DirEntry->OffsetToData);
|
||||
|
||||
/* Check if the data entry is out of bounds */
|
||||
if (((PVOID)DataEntry < ImageBase) || ((PVOID)DataEntry > ImageEnd))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Finally read the data offset */
|
||||
Data = (PVOID)((ULONG_PTR)ImageBase + DataEntry->OffsetToData);
|
||||
|
||||
/* Check if the data is out of bounds */
|
||||
if (((PVOID)Data < ImageBase) || ((PVOID)Data > ImageEnd))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Make sure the data end isn't out of bounds either */
|
||||
DataEnd = (PVOID)((ULONG_PTR)Data + DataEntry->Size);
|
||||
if (((PVOID)DataEnd < ImageBase) || ((PVOID)DataEnd > ImageEnd))
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* We finally made it. Return the entry and the raw data */
|
||||
*DataEntryOut = DataEntry;
|
||||
*ResourceOut = Data;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PWCHAR
|
||||
BlResourceFindHtml (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PIMAGE_RESOURCE_DATA_ENTRY HtmlDataEntry;
|
||||
PWCHAR Stylesheet;
|
||||
|
||||
/* Assume failure */
|
||||
Stylesheet = NULL;
|
||||
|
||||
/* Look for an RT_HTML resource called BOOTMGR.XSL */
|
||||
Status = ResFindDataEntryFromImage(NULL,
|
||||
0,
|
||||
23,
|
||||
NULL,
|
||||
L"BOOTMGR.XSL",
|
||||
&HtmlDataEntry,
|
||||
(PVOID*)&Stylesheet);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Stylesheet;
|
||||
}
|
||||
|
||||
/* Check for Unicode BOM */
|
||||
if (*Stylesheet == 0xFEFF)
|
||||
{
|
||||
/* Overwrite it, and NULL-terminate */
|
||||
RtlMoveMemory(Stylesheet,
|
||||
Stylesheet + 1,
|
||||
HtmlDataEntry->Size - sizeof(WCHAR));
|
||||
Stylesheet[(HtmlDataEntry->Size / sizeof(WCHAR)) - 1] = UNICODE_NULL;
|
||||
}
|
||||
else if (Stylesheet[(HtmlDataEntry->Size / sizeof(WCHAR)) - 1] != UNICODE_NULL)
|
||||
{
|
||||
/* If it's not NULL-terminated, fail */
|
||||
Stylesheet = NULL;
|
||||
}
|
||||
|
||||
/* Return it back */
|
||||
return Stylesheet;
|
||||
}
|
||||
|
||||
PWCHAR
|
||||
BlResourceFindMessage (
|
||||
_In_ ULONG MsgId
|
||||
)
|
||||
{
|
||||
PWCHAR Message;
|
||||
PIMAGE_RESOURCE_DIRECTORY ResourceDir;
|
||||
PIMAGE_RESOURCE_DATA_ENTRY DataEntry;
|
||||
PMESSAGE_RESOURCE_DATA MsgData;
|
||||
PMESSAGE_RESOURCE_ENTRY MsgEntry;
|
||||
ULONG i, j;
|
||||
USHORT Id;
|
||||
PVOID MsgEnd;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Bail out if there's no resource directory */
|
||||
Message = NULL;
|
||||
if (!ResRootDirectory)
|
||||
{
|
||||
return Message;
|
||||
}
|
||||
|
||||
/* Check if we've loaded fonts already */
|
||||
if (!ResLoadedFontFiles)
|
||||
{
|
||||
/* Nope, load them now */
|
||||
Status = BfLoadDeferredFontFiles();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* We failed to load fonts, fallback to fallback locale */
|
||||
Status = ResSelectLocale(FALSE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Try fonts now */
|
||||
Status = BfLoadDeferredFontFiles();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Still didn't work -- fallback to text mode */
|
||||
EfiPrintf(L"Font loading failed, falling back to text mode\r\n");
|
||||
Status = BlDisplaySetScreenResolution();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* That didn't work either. F*ck it. */
|
||||
return Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we have a resource directory, and fonts are loaded */
|
||||
NT_ASSERT(ResRootDirectory != NULL);
|
||||
ResLoadedFontFiles = TRUE;
|
||||
}
|
||||
|
||||
/* Go look for RT_MESSAGETABLE */
|
||||
Id = 11;
|
||||
ResourceDir = (PIMAGE_RESOURCE_DIRECTORY)ResFindDirectoryEntry(ResRootDirectory,
|
||||
&Id,
|
||||
NULL,
|
||||
(ULONG_PTR)ResRootDirectory);
|
||||
if (!ResourceDir)
|
||||
{
|
||||
return Message;
|
||||
}
|
||||
|
||||
/* Go look for the first directory in the table */
|
||||
Id = 1;
|
||||
ResourceDir = (PIMAGE_RESOURCE_DIRECTORY)ResFindDirectoryEntry(ResourceDir,
|
||||
&Id,
|
||||
NULL,
|
||||
(ULONG_PTR)ResRootDirectory);
|
||||
if (!ResourceDir)
|
||||
{
|
||||
return Message;
|
||||
}
|
||||
|
||||
/* Go look for any language entry in the table */
|
||||
Id = -1;
|
||||
DataEntry = (PIMAGE_RESOURCE_DATA_ENTRY)ResFindDirectoryEntry(ResourceDir,
|
||||
&Id,
|
||||
NULL,
|
||||
(ULONG_PTR)ResRootDirectory);
|
||||
if (!DataEntry)
|
||||
{
|
||||
return Message;
|
||||
}
|
||||
|
||||
/* Get the message data*/
|
||||
MsgData = (PMESSAGE_RESOURCE_DATA)((ULONG_PTR)ResRootDirectory +
|
||||
DataEntry->OffsetToData -
|
||||
ResRootDirectoryOffset);
|
||||
|
||||
/* Loop through the message blocks */
|
||||
for (j = 0; j < MsgData->NumberOfBlocks; j++)
|
||||
{
|
||||
/* Check if the ID is within this range */
|
||||
if ((MsgId >= MsgData->Blocks[j].LowId) &&
|
||||
(MsgId <= MsgData->Blocks[j].HighId))
|
||||
{
|
||||
/* Get the first entry */
|
||||
MsgEntry = (PMESSAGE_RESOURCE_ENTRY)((ULONG_PTR)MsgData +
|
||||
MsgData->Blocks[j].OffsetToEntries);
|
||||
|
||||
/* Loop till we find the right one */
|
||||
for (i = MsgId - MsgData->Blocks[j].LowId; i; --i)
|
||||
{
|
||||
MsgEntry = (PMESSAGE_RESOURCE_ENTRY)((ULONG_PTR)MsgEntry +
|
||||
MsgEntry->Length);
|
||||
}
|
||||
|
||||
/* Find where this message ends */
|
||||
MsgEnd = (PVOID)((ULONG_PTR)MsgEntry + MsgEntry->Length);
|
||||
|
||||
/* Now make sure that the message is within bounds */
|
||||
if ((MsgEnd >= (PVOID)MsgEntry) &&
|
||||
((PVOID)MsgEntry >= ResPeImageBase) &&
|
||||
(MsgEnd <= ResPeImageEnd))
|
||||
{
|
||||
/* If so, read the text associated with it */
|
||||
Message = (PWCHAR)MsgEntry->Text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the text, if one was found */
|
||||
return Message;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlpResourceInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PIMAGE_SECTION_HEADER ResourceSection;
|
||||
PVOID ImageBase;
|
||||
ULONG ImageSize, VRes, HRes;
|
||||
BOOLEAN UsePrimary;
|
||||
|
||||
/* Default to using fallback */
|
||||
UsePrimary = FALSE;
|
||||
|
||||
/* Initialize all globals */
|
||||
ResMuiImageBase = 0;
|
||||
ResMuiImageSize = 0;
|
||||
ResRootDirectoryPrimary = 0;
|
||||
ResRootDirectoryPrimaryOffset = 0;
|
||||
ResPeImageBasePrimary = 0;
|
||||
ResPeImageEndPrimary = 0;
|
||||
ResRootDirectoryFallback = 0;
|
||||
ResRootDirectoryFallbackOffset = 0;
|
||||
ResPeImageBaseFallback = 0;
|
||||
ResPeImageEndFallback = 0;
|
||||
ResRootDirectory = 0;
|
||||
ResRootDirectoryOffset = 0;
|
||||
ResPeImageBase = 0;
|
||||
ResPeImageEnd = 0;
|
||||
ResLoadedFontFiles = 0;
|
||||
|
||||
/* Check if we had allocated a locale already */
|
||||
if (ResLocale)
|
||||
{
|
||||
/* Free it and reset */
|
||||
BlMmFreeHeap(ResLocale);
|
||||
ResLocale = 0;
|
||||
}
|
||||
|
||||
/* Get our base address and size*/
|
||||
Status = BlGetApplicationBaseAndSize(&ImageBase, &ImageSize);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Find our resource section */
|
||||
ResourceSection = BlImgFindSection(ImageBase, ImageSize);
|
||||
if (ResourceSection)
|
||||
{
|
||||
/* The resource section will be our fallback. Save down its details */
|
||||
ResRootDirectoryFallbackOffset = ResourceSection->VirtualAddress;
|
||||
ResPeImageBaseFallback = ImageBase;
|
||||
ResPeImageEndFallback = (PVOID)((ULONG_PTR)ImageBase + ImageSize);
|
||||
ResRootDirectoryFallback = (PIMAGE_RESOURCE_DIRECTORY)((ULONG_PTR)ImageBase +
|
||||
ResRootDirectoryFallbackOffset);
|
||||
}
|
||||
|
||||
/* Get the current screen resolution and check if we're in graphics mode */
|
||||
Status = BlDisplayGetScreenResolution(&HRes, &VRes);
|
||||
if ((NT_SUCCESS(Status)) && ((HRes != 640) || (VRes != 200)))
|
||||
{
|
||||
/* We are... we should load MUI data */
|
||||
Status = STATUS_NOT_IMPLEMENTED;//ResInitializeMuiResources();
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* And not rely on the fallback */
|
||||
UsePrimary = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the locale resources */
|
||||
return ResSelectLocale(UsePrimary);
|
||||
}
|
@@ -12,8 +12,8 @@
|
||||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
PRSDT UtlRsdt;
|
||||
PXSDT UtlXsdt;
|
||||
PVOID UtlRsdt;
|
||||
PVOID UtlXsdt;
|
||||
|
||||
PVOID UtlMcContext;
|
||||
PVOID UtlMcDisplayMessageRoutine;
|
||||
@@ -28,157 +28,10 @@ ULONG UtlNextUpdatePercentage;
|
||||
BOOLEAN UtlProgressNeedsInfoUpdate;
|
||||
PVOID UtlProgressInfo;
|
||||
|
||||
|
||||
PVOID ResRootDirectory;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
BlUtlGetAcpiTable (
|
||||
_Out_ PVOID* TableAddress,
|
||||
_In_ ULONG Signature
|
||||
)
|
||||
{
|
||||
ULONG i, TableCount, HeaderLength;
|
||||
NTSTATUS Status;
|
||||
PRSDT Rsdt;
|
||||
PXSDT Xsdt;
|
||||
PHYSICAL_ADDRESS PhysicalAddress;
|
||||
PDESCRIPTION_HEADER Header;
|
||||
|
||||
Header = 0;
|
||||
|
||||
/* Make sure there's an output parameter */
|
||||
if (!TableAddress)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Get the currently known RSDT and XSDT */
|
||||
Rsdt = (PRSDT)UtlRsdt;
|
||||
Xsdt = (PXSDT)UtlXsdt;
|
||||
|
||||
/* Is there an RSDT? */
|
||||
if (!Rsdt)
|
||||
{
|
||||
/* No -- is there an XSDT? */
|
||||
if (!Xsdt)
|
||||
{
|
||||
/* No. Look up the RSDT */
|
||||
Status = EfipGetRsdt(&PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"no rsdp found\r\n");
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Map the header */
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID)&Header,
|
||||
0,
|
||||
sizeof(*Header),
|
||||
PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Unmap the header */
|
||||
BlMmUnmapVirtualAddressEx(Header, sizeof(*Header));
|
||||
|
||||
/* Map the whole table */
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID)&Header,
|
||||
0,
|
||||
Header->Length,
|
||||
PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if its an XSDT or an RSDT */
|
||||
if (Header->Signature == XSDT_SIGNATURE)
|
||||
{
|
||||
/* It's an XSDT */
|
||||
Xsdt = (PXSDT)Header;
|
||||
UtlXsdt = Xsdt;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It's an RSDT */
|
||||
Rsdt = (PRSDT)Header;
|
||||
UtlRsdt = Rsdt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* OK, so do we have an XSDT after all? */
|
||||
if (Xsdt)
|
||||
{
|
||||
/* Yes... how big is it? */
|
||||
HeaderLength = Xsdt->Header.Length;
|
||||
if (HeaderLength >= sizeof(*Header))
|
||||
{
|
||||
HeaderLength = sizeof(*Header);
|
||||
}
|
||||
|
||||
/* Based on that, how many tables are there? */
|
||||
TableCount = (Xsdt->Header.Length - HeaderLength) / sizeof(PHYSICAL_ADDRESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nope, we have an RSDT. How big is it? */
|
||||
HeaderLength = Rsdt->Header.Length;
|
||||
if (HeaderLength >= sizeof(*Header))
|
||||
{
|
||||
HeaderLength = sizeof(*Header);
|
||||
}
|
||||
|
||||
/* Based on that, how many tables are there? */
|
||||
TableCount = (Rsdt->Header.Length - HeaderLength) / sizeof(ULONG);
|
||||
}
|
||||
|
||||
/* Loop through the ACPI tables */
|
||||
for (i = 0; i < TableCount; i++)
|
||||
{
|
||||
/* For an XSDT, read the 64-bit address directly */
|
||||
if (Xsdt)
|
||||
{
|
||||
PhysicalAddress = Xsdt->Tables[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For RSDT, cast it */
|
||||
PhysicalAddress.QuadPart = Rsdt->Tables[i];
|
||||
}
|
||||
|
||||
/* Map the header */
|
||||
Status = BlMmMapPhysicalAddressEx((PVOID)&Header,
|
||||
0,
|
||||
sizeof(*Header),
|
||||
PhysicalAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Is it the right one? */
|
||||
if (Header->Signature == Signature)
|
||||
{
|
||||
/* Unmap the header */
|
||||
BlMmUnmapVirtualAddressEx(Header, sizeof(*Header));
|
||||
|
||||
/* Map the whole table */
|
||||
return BlMmMapPhysicalAddressEx(TableAddress,
|
||||
0,
|
||||
Header->Length,
|
||||
PhysicalAddress);
|
||||
}
|
||||
}
|
||||
|
||||
/* Requested table does not exist */
|
||||
return STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
BlUtlUpdateProgress (
|
||||
_In_ ULONG Percentage,
|
||||
@@ -195,6 +48,161 @@ BlUtlUpdateProgress (
|
||||
}
|
||||
}
|
||||
|
||||
PWCHAR
|
||||
BlResourceFindMessage (
|
||||
_In_ ULONG MsgId
|
||||
)
|
||||
{
|
||||
PWCHAR Message;
|
||||
|
||||
/* Assume failure */
|
||||
Message = NULL;
|
||||
|
||||
/* Check if we've loaded resources */
|
||||
if (ResRootDirectory)
|
||||
{
|
||||
/* Not yet handled */
|
||||
EfiPrintf(L"Not implemented\r\n");
|
||||
}
|
||||
|
||||
/* Return the message for this ID */
|
||||
return Message;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name EfiGetEfiStatusCode
|
||||
*
|
||||
* The EfiGetEfiStatusCode routine converts an NT Status to an EFI status.
|
||||
*
|
||||
* @param Status
|
||||
* NT Status code to be converted.
|
||||
*
|
||||
* @remark Only certain, specific NT status codes are converted to EFI codes.
|
||||
*
|
||||
* @return The corresponding EFI Status code, EFI_NO_MAPPING otherwise.
|
||||
*
|
||||
*--*/
|
||||
EFI_STATUS
|
||||
EfiGetEfiStatusCode(
|
||||
_In_ NTSTATUS Status
|
||||
)
|
||||
{
|
||||
switch (Status)
|
||||
{
|
||||
case STATUS_NOT_SUPPORTED:
|
||||
return EFI_UNSUPPORTED;
|
||||
case STATUS_DISK_FULL:
|
||||
return EFI_VOLUME_FULL;
|
||||
case STATUS_INSUFFICIENT_RESOURCES:
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
case STATUS_MEDIA_WRITE_PROTECTED:
|
||||
return EFI_WRITE_PROTECTED;
|
||||
case STATUS_DEVICE_NOT_READY:
|
||||
return EFI_NOT_STARTED;
|
||||
case STATUS_DEVICE_ALREADY_ATTACHED:
|
||||
return EFI_ALREADY_STARTED;
|
||||
case STATUS_MEDIA_CHANGED:
|
||||
return EFI_MEDIA_CHANGED;
|
||||
case STATUS_INVALID_PARAMETER:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
case STATUS_ACCESS_DENIED:
|
||||
return EFI_ACCESS_DENIED;
|
||||
case STATUS_BUFFER_TOO_SMALL:
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
case STATUS_DISK_CORRUPT_ERROR:
|
||||
return EFI_VOLUME_CORRUPTED;
|
||||
case STATUS_REQUEST_ABORTED:
|
||||
return EFI_ABORTED;
|
||||
case STATUS_NO_MEDIA:
|
||||
return EFI_NO_MEDIA;
|
||||
case STATUS_IO_DEVICE_ERROR:
|
||||
return EFI_DEVICE_ERROR;
|
||||
case STATUS_INVALID_BUFFER_SIZE:
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
case STATUS_NOT_FOUND:
|
||||
return EFI_NOT_FOUND;
|
||||
case STATUS_DRIVER_UNABLE_TO_LOAD:
|
||||
return EFI_LOAD_ERROR;
|
||||
case STATUS_NO_MATCH:
|
||||
return EFI_NO_MAPPING;
|
||||
case STATUS_SUCCESS:
|
||||
return EFI_SUCCESS;
|
||||
case STATUS_TIMEOUT:
|
||||
return EFI_TIMEOUT;
|
||||
default:
|
||||
return EFI_NO_MAPPING;
|
||||
}
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name EfiGetNtStatusCode
|
||||
*
|
||||
* The EfiGetNtStatusCode routine converts an EFI Status to an NT status.
|
||||
*
|
||||
* @param EfiStatus
|
||||
* EFI Status code to be converted.
|
||||
*
|
||||
* @remark Only certain, specific EFI status codes are converted to NT codes.
|
||||
*
|
||||
* @return The corresponding NT Status code, STATUS_UNSUCCESSFUL otherwise.
|
||||
*
|
||||
*--*/
|
||||
NTSTATUS
|
||||
EfiGetNtStatusCode (
|
||||
_In_ EFI_STATUS EfiStatus
|
||||
)
|
||||
{
|
||||
switch (EfiStatus)
|
||||
{
|
||||
case EFI_NOT_READY:
|
||||
case EFI_NOT_FOUND:
|
||||
return STATUS_NOT_FOUND;
|
||||
case EFI_NO_MEDIA:
|
||||
return STATUS_NO_MEDIA;
|
||||
case EFI_MEDIA_CHANGED:
|
||||
return STATUS_MEDIA_CHANGED;
|
||||
case EFI_ACCESS_DENIED:
|
||||
case EFI_SECURITY_VIOLATION:
|
||||
return STATUS_ACCESS_DENIED;
|
||||
case EFI_TIMEOUT:
|
||||
case EFI_NO_RESPONSE:
|
||||
return STATUS_TIMEOUT;
|
||||
case EFI_NO_MAPPING:
|
||||
return STATUS_NO_MATCH;
|
||||
case EFI_NOT_STARTED:
|
||||
return STATUS_DEVICE_NOT_READY;
|
||||
case EFI_ALREADY_STARTED:
|
||||
return STATUS_DEVICE_ALREADY_ATTACHED;
|
||||
case EFI_ABORTED:
|
||||
return STATUS_REQUEST_ABORTED;
|
||||
case EFI_VOLUME_FULL:
|
||||
return STATUS_DISK_FULL;
|
||||
case EFI_DEVICE_ERROR:
|
||||
return STATUS_IO_DEVICE_ERROR;
|
||||
case EFI_WRITE_PROTECTED:
|
||||
return STATUS_MEDIA_WRITE_PROTECTED;
|
||||
/* @FIXME: ReactOS Headers don't yet have this */
|
||||
//case EFI_OUT_OF_RESOURCES:
|
||||
//return STATUS_INSUFFICIENT_NVRAM_RESOURCES;
|
||||
case EFI_VOLUME_CORRUPTED:
|
||||
return STATUS_DISK_CORRUPT_ERROR;
|
||||
case EFI_BUFFER_TOO_SMALL:
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
case EFI_SUCCESS:
|
||||
return STATUS_SUCCESS;
|
||||
case EFI_LOAD_ERROR:
|
||||
return STATUS_DRIVER_UNABLE_TO_LOAD;
|
||||
case EFI_INVALID_PARAMETER:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
case EFI_UNSUPPORTED:
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
case EFI_BAD_BUFFER_SIZE:
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
default:
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlUtlInitialize (
|
||||
VOID
|
||||
@@ -219,58 +227,6 @@ BlUtlInitialize (
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
BmUpdateProgressInfo (
|
||||
_In_ PVOID Uknown,
|
||||
_In_ PWCHAR ProgressInfo
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Progress Info: %s\r\n", ProgressInfo);
|
||||
}
|
||||
|
||||
VOID
|
||||
BmUpdateProgress (
|
||||
_In_ PVOID Unknown,
|
||||
_In_ ULONG Percent,
|
||||
_Out_ PBOOLEAN Completed
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"Progress: %d\r\n", Percent);
|
||||
if (Completed)
|
||||
{
|
||||
*Completed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BlUtlRegisterProgressRoutine (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
/* One shouldn't already exist */
|
||||
if (UtlProgressRoutine)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Set the routine, and no context */
|
||||
UtlProgressRoutine = BmUpdateProgress;
|
||||
UtlProgressContext = NULL;
|
||||
|
||||
/* Progress increases by one */
|
||||
UtlProgressGranularity = 1;
|
||||
|
||||
/* Set progress to zero for now */
|
||||
UtlCurrentPercentComplete = 0;
|
||||
UtlNextUpdatePercentage = 0;
|
||||
|
||||
/* Set the info routine if there is one */
|
||||
UtlProgressInfoRoutine = BmUpdateProgressInfo;
|
||||
|
||||
/* All good */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PVOID
|
||||
BlTblFindEntry (
|
||||
_In_ PVOID *Table,
|
||||
@@ -720,3 +676,16 @@ Quickie:
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
BlFwReboot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#ifdef BL_KD_SUPPORTED
|
||||
/* Stop the boot debugger*/
|
||||
BlBdStop();
|
||||
#endif
|
||||
|
||||
/* Reset the machine */
|
||||
EfiResetSystem(EfiResetCold);
|
||||
}
|
||||
|
@@ -149,7 +149,7 @@ MmMdpSwitchToDynamicDescriptors (
|
||||
_In_ ULONG Count
|
||||
)
|
||||
{
|
||||
EfiPrintf(L"dynamic switch NOT SUPPORTED!!!\r\n");
|
||||
EfiPrintf(L"NOT SUPPORTED!!!\r\n");
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -742,9 +742,9 @@ MmMdFindSatisfyingRegion (
|
||||
}
|
||||
|
||||
/* Bail out if the allocation flags don't match */
|
||||
if (((Flags ^ Descriptor->Flags) & (BlMemoryRuntime | BlMemoryReserved | BlMemoryUnknown)))
|
||||
if (((Flags ^ Descriptor->Flags) & 0x190000))
|
||||
{
|
||||
//EfiPrintf(L"Incorrect memory allocation flags\r\n");
|
||||
EfiPrintf(L"Incorrect memory allocation flags\r\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
#include "bcd.h"
|
||||
|
||||
/* DATA VARIABLES ************************************************************/
|
||||
|
||||
@@ -39,35 +38,7 @@ BlMmRemoveBadMemory (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN AllowBad;
|
||||
NTSTATUS Status;
|
||||
PULONGLONG BadPages;
|
||||
ULONGLONG BadPageCount;
|
||||
|
||||
/* First check if bad memory access is allowed */
|
||||
AllowBad = FALSE;
|
||||
Status = BlGetBootOptionBoolean(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryBoolean_AllowBadMemoryAccess,
|
||||
&AllowBad);
|
||||
if ((NT_SUCCESS(Status)) && (AllowBad))
|
||||
{
|
||||
/* No point checking the list if it is */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Otherwise, check if there's a persisted bad page list */
|
||||
Status = BlpGetBootOptionIntegerList(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryIntegerList_BadMemoryList,
|
||||
&BadPages,
|
||||
&BadPageCount,
|
||||
TRUE);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"Persistent bad page list not supported\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* All done here */
|
||||
/* FIXME: Read BCD option to see what bad memory to remove */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include "bl.h"
|
||||
#include "bcd.h"
|
||||
|
||||
|
||||
typedef struct _BL_PA_REQUEST
|
||||
{
|
||||
@@ -50,30 +50,7 @@ BlpMmInitializeConstraints (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONGLONG LowestAddressValid, HighestAddressValid;
|
||||
|
||||
/* Check for LOWMEM */
|
||||
Status = BlGetBootOptionInteger(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_AvoidLowPhysicalMemory,
|
||||
&LowestAddressValid);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"/LOWMEM not supported\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Check for MAXMEM */
|
||||
Status = BlGetBootOptionInteger(BlpApplicationEntry.BcdData,
|
||||
BcdLibraryInteger_TruncatePhysicalMemory,
|
||||
&HighestAddressValid);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
EfiPrintf(L"/MAXMEM not supported\r\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* Return back to the caller */
|
||||
/* FIXME: Read BCD option 'avoidlowmemory' and 'truncatememory' */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,6 @@
|
||||
|
||||
; [FREELOADER] Section Commands:
|
||||
;
|
||||
; Debug - FreeLoader debugging port parameters, e.g. /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200
|
||||
; MessageBox - displays the specified text in a message box upon bootup
|
||||
; MessageLine - adds a new line of text to a message box (must come before MessageBox command)
|
||||
; TitleText - text that is displayed in the title box
|
||||
@@ -51,15 +50,15 @@
|
||||
|
||||
; [OS-General] Section Commands:
|
||||
;
|
||||
; BootType - sets the boot type: Windows, WindowsNT40, Windows2003, Linux, BootSector, Partition, Drive, ReactOSSetup
|
||||
; BootPath - ARC path, e.g. multi(0)disk(0)rdisk(x)partition(y)
|
||||
; BootType - sets the boot type: ReactOS, Linux, BootSector, Partition, Drive
|
||||
; BootPath - ARC path e.g. multi(0)disk(0)rdisk(x)partition(y)
|
||||
; DriveMap - maps a BIOS drive number to another (i.e. DriveMap=hd1,hd0 maps harddisk1 to harddisk0 or DriveMap=fd1,fd0)
|
||||
|
||||
; [BootSector OSType] Section Commands:
|
||||
;
|
||||
; BootSector - sets the filename of the bootsector to be loaded
|
||||
|
||||
; [Windows(NT40|2003) OSType] Section Commands:
|
||||
; [ReactOS OSType] Section Commands:
|
||||
;
|
||||
; SystemPath - sets the system root path (must be a valid ARC - Path):
|
||||
; multi(0)disk(0)rdisk(0)partition(1)\reactos
|
||||
@@ -111,7 +110,7 @@ DriveD="Drive D:"
|
||||
|
||||
; Load ReactOS from harddisk (drive C:)
|
||||
[ReactOSHD]
|
||||
BootType=Windows2003
|
||||
BootType=ReactOS
|
||||
SystemPath=multi(0)disk(0)rdisk(0)partition(1)\reactos
|
||||
Options=/DEBUGPORT=SCREEN
|
||||
Kernel=\REACTOS\SYSTEM32\NTOSKRNL.EXE
|
||||
@@ -119,14 +118,14 @@ Hal=\REACTOS\SYSTEM32\HAL.DLL
|
||||
|
||||
; Load ReactOS from floppy (drive A:)
|
||||
[ReactOSFloppy]
|
||||
BootType=Windows2003
|
||||
BootType=ReactOS
|
||||
SystemPath=multi(0)disk(0)fdisk(0)
|
||||
Options=/DEBUGPORT=SCREEN
|
||||
Kernel=\reactos\NTOSKRNL.EXE
|
||||
Hal=\reactos\HAL.DLL
|
||||
|
||||
;[ReactOS (Debug)]
|
||||
;BootType=Windows2003
|
||||
;BootType=ReactOS
|
||||
;SystemPath=multi(0)disk(0)rdisk(0)partition(1)\reactos
|
||||
;Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=19200
|
||||
;Kernel=\NTOSKRNL.EXE
|
||||
|
@@ -3,21 +3,8 @@ if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
|
||||
|
||||
CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00)
|
||||
CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
|
||||
|
||||
CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
|
||||
CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
|
||||
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
|
||||
|
||||
## New versions using FATY.S (experimental)
|
||||
# add_definitions(-DFAT12)
|
||||
# CreateBootSectorTarget(fat_new ${CMAKE_CURRENT_SOURCE_DIR}/faty.S ${CMAKE_CURRENT_BINARY_DIR}/fat_new.bin 7c00)
|
||||
# remove_definitions(-DFAT12)
|
||||
# add_definitions(-DFAT16)
|
||||
# CreateBootSectorTarget(fat16_new ${CMAKE_CURRENT_SOURCE_DIR}/faty.S ${CMAKE_CURRENT_BINARY_DIR}/fat16_new.bin 7c00)
|
||||
# remove_definitions(-DFAT16)
|
||||
# add_definitions(-DFAT32)
|
||||
# CreateBootSectorTarget(fat32_new ${CMAKE_CURRENT_SOURCE_DIR}/faty.S ${CMAKE_CURRENT_BINARY_DIR}/fat32_new.bin 7c00)
|
||||
# remove_definitions(-DFAT32)
|
||||
|
||||
CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000)
|
||||
CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 7000)
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
// of the PutChars function in the boot sector.
|
||||
//
|
||||
// When it locates freeldr.sys on the disk it will
|
||||
// load the first sector of the file to 0000:F800
|
||||
// load the first sector of the file to 0000:8000
|
||||
// With the help of this sector we should be able
|
||||
// to load the entire file off the disk, no matter
|
||||
// how fragmented it is.
|
||||
@@ -43,15 +43,15 @@
|
||||
|
||||
#define BP_REL(x) [bp+x-offset start]
|
||||
|
||||
DataAreaStartHigh = 2
|
||||
DataAreaStartLow = 4
|
||||
BiosCHSDriveSizeHigh = 6
|
||||
BiosCHSDriveSizeLow = 8
|
||||
BiosCHSDriveSize = 8
|
||||
ReadSectorsOffset = 10
|
||||
ReadClusterOffset = 12
|
||||
PutCharsOffset = 14
|
||||
BootSectorStackTop = HEX(7c00) - 16
|
||||
DataAreaStartHigh = 2
|
||||
DataAreaStartLow = 4
|
||||
BiosCHSDriveSizeHigh = 6
|
||||
BiosCHSDriveSizeLow = 8
|
||||
BiosCHSDriveSize = 8
|
||||
ReadSectorsOffset = 10
|
||||
ReadClusterOffset = 12
|
||||
PutCharsOffset = 14
|
||||
BootSectorStackTop = HEX(7c00) - 16
|
||||
|
||||
|
||||
// org 7c00h
|
||||
@@ -105,21 +105,21 @@ main:
|
||||
xor ax, ax
|
||||
mov ss, ax
|
||||
mov bp, HEX(7c00)
|
||||
mov sp, BootSectorStackTop // Setup a stack
|
||||
mov ds, ax // Make DS correct
|
||||
mov es, ax // Make ES correct
|
||||
mov sp, BootSectorStackTop // Setup a stack
|
||||
mov ds, ax // Make DS correct
|
||||
mov es, ax // Make ES correct
|
||||
|
||||
cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it
|
||||
cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it
|
||||
jne GetDriveParameters
|
||||
|
||||
mov byte ptr BP_REL(BootDrive), dl // Save the boot drive
|
||||
mov byte ptr BP_REL(BootDrive), dl // Save the boot drive
|
||||
|
||||
|
||||
GetDriveParameters:
|
||||
mov ah, 8
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl
|
||||
int HEX(13) // Request drive parameters from the bios
|
||||
jnc CalcDriveSize // If the call succeeded then calculate the drive size
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl
|
||||
int HEX(13) // Request drive parameters from the bios
|
||||
jnc CalcDriveSize // If the call succeeded then calculate the drive size
|
||||
|
||||
// If we get here then the call to the BIOS failed
|
||||
// so just set CHS equal to the maximum addressable
|
||||
@@ -151,26 +151,26 @@ CalcDriveSize:
|
||||
// Now we must find our way to the first sector of the root directory
|
||||
xor ax, ax
|
||||
xor cx, cx
|
||||
mov al, byte ptr BP_REL(NumberOfFats) // Number of fats
|
||||
mul word ptr BP_REL(SectorsPerFat) // Times sectors per fat
|
||||
mov al, byte ptr BP_REL(NumberOfFats) // Number of fats
|
||||
mul word ptr BP_REL(SectorsPerFat) // Times sectors per fat
|
||||
add ax, word ptr BP_REL(HiddenSectors)
|
||||
adc dx, word ptr BP_REL(HiddenSectors+2) // Add the number of hidden sectors
|
||||
add ax, word ptr BP_REL(ReservedSectors) // Add the number of reserved sectors
|
||||
adc dx, cx // Add carry bit
|
||||
mov word ptr [bp - DataAreaStartLow], ax // Save the starting sector of the root directory
|
||||
mov word ptr [bp - DataAreaStartHigh], dx // Save it in the first 4 bytes before the boot sector
|
||||
mov si, word ptr BP_REL(MaxRootEntries) // Get number of root dir entries in SI
|
||||
pusha // Save 32-bit logical start sector of root dir
|
||||
add ax, word ptr BP_REL(ReservedSectors) // Add the number of reserved sectors
|
||||
adc dx, cx // Add carry bit
|
||||
mov word ptr [bp - DataAreaStartLow], ax // Save the starting sector of the root directory
|
||||
mov word ptr [bp - DataAreaStartHigh], dx // Save it in the first 4 bytes before the boot sector
|
||||
mov si, word ptr BP_REL(MaxRootEntries) // Get number of root dir entries in SI
|
||||
pusha // Save 32-bit logical start sector of root dir
|
||||
// DX:AX now has the number of the starting sector of the root directory
|
||||
|
||||
// Now calculate the size of the root directory
|
||||
xor dx, dx
|
||||
mov ax, 32 // Size of dir entry
|
||||
mul si // Times the number of entries
|
||||
mov ax, 32 // Size of dir entry
|
||||
mul si // Times the number of entries
|
||||
mov bx, word ptr BP_REL(BytesPerSector)
|
||||
add ax, bx
|
||||
dec ax
|
||||
div bx // Divided by the size of a sector
|
||||
div bx // Divided by the size of a sector
|
||||
// AX now has the number of root directory sectors
|
||||
|
||||
add word ptr [bp - DataAreaStartLow], ax // Add the number of sectors of the root directory to our other value
|
||||
@@ -178,49 +178,49 @@ CalcDriveSize:
|
||||
popa // Restore root dir logical sector start to DX:AX
|
||||
|
||||
LoadRootDirSector:
|
||||
mov bx, HEX(7e0) // We will load the root directory sector
|
||||
mov es, bx // Right after the boot sector in memory
|
||||
xor bx, bx // We will load it to [0000:7e00h]
|
||||
xor cx, cx // Zero out CX
|
||||
inc cx // Now increment it to 1, we are reading one sector
|
||||
xor di, di // Zero out di
|
||||
push es // Save ES because it will get incremented by 20h
|
||||
call ReadSectors // Read the first sector of the root directory
|
||||
pop es // Restore ES (ES:DI = 07E0:0000)
|
||||
mov bx, HEX(7e0) // We will load the root directory sector
|
||||
mov es, bx // Right after the boot sector in memory
|
||||
xor bx, bx // We will load it to [0000:7e00h]
|
||||
xor cx, cx // Zero out CX
|
||||
inc cx // Now increment it to 1, we are reading one sector
|
||||
xor di, di // Zero out di
|
||||
push es // Save ES because it will get incremented by 20h
|
||||
call ReadSectors // Read the first sector of the root directory
|
||||
pop es // Restore ES (ES:DI = 07E0:0000)
|
||||
|
||||
SearchRootDirSector:
|
||||
cmp byte ptr es:[di], ch // If the first byte of the directory entry is zero then we have
|
||||
jz ErrBoot // reached the end of the directory and FREELDR.SYS is not here so reboot
|
||||
pusha // Save all registers
|
||||
mov cl, 11 // Put 11 in cl (length of filename in directory entry)
|
||||
mov si, offset filename // Put offset of filename string in DS:SI
|
||||
repe cmpsb // Compare this directory entry against 'FREELDR SYS'
|
||||
popa // Restore all the registers
|
||||
jz FoundFreeLoader // If we found it then jump
|
||||
dec si // SI holds MaxRootEntries, subtract one
|
||||
jz ErrBoot // If we are out of root dir entries then reboot
|
||||
add di, 32 // Increment DI by the size of a directory entry
|
||||
cmp di, HEX(0200) // Compare DI to 512 (DI has offset to next dir entry, make sure we haven't gone over one sector)
|
||||
jc SearchRootDirSector // If DI is less than 512 loop again
|
||||
jmp short LoadRootDirSector // Didn't find FREELDR.SYS in this directory sector, try again
|
||||
cmp byte ptr es:[di], ch // If the first byte of the directory entry is zero then we have
|
||||
jz ErrBoot // reached the end of the directory and FREELDR.SYS is not here so reboot
|
||||
pusha // Save all registers
|
||||
mov cl, 11 // Put 11 in cl (length of filename in directory entry)
|
||||
mov si, offset filename // Put offset of filename string in DS:SI
|
||||
repe cmpsb // Compare this directory entry against 'FREELDR SYS'
|
||||
popa // Restore all the registers
|
||||
jz FoundFreeLoader // If we found it then jump
|
||||
dec si // SI holds MaxRootEntries, subtract one
|
||||
jz ErrBoot // If we are out of root dir entries then reboot
|
||||
add di, 32 // Increment DI by the size of a directory entry
|
||||
cmp di, HEX(0200) // Compare DI to 512 (DI has offset to next dir entry, make sure we haven't gone over one sector)
|
||||
jc SearchRootDirSector // If DI is less than 512 loop again
|
||||
jmp short LoadRootDirSector // Didn't find FREELDR.SYS in this directory sector, try again
|
||||
|
||||
FoundFreeLoader:
|
||||
// We found freeldr.sys on the disk
|
||||
// so we need to load the first 512
|
||||
// bytes of it to 0000:F800
|
||||
// ES:DI has dir entry (ES:DI == 07E0:XXXX)
|
||||
mov ax, word ptr es:[di + HEX(1a)] // Get start cluster
|
||||
push ax // Save start cluster
|
||||
push FREELDR_BASE / 16 // Put load segment on the stack and load it
|
||||
pop es // Into ES so that we load the cluster at 0000:F800
|
||||
call ReadCluster // Read the cluster
|
||||
pop ax // Restore start cluster of FreeLoader
|
||||
mov ax, word ptr es:[di + HEX(1a)] // Get start cluster
|
||||
push ax // Save start cluster
|
||||
push FREELDR_BASE / 16 // Put load segment on the stack and load it
|
||||
pop es // Into ES so that we load the cluster at 0000:F800
|
||||
call ReadCluster // Read the cluster
|
||||
pop ax // Restore start cluster of FreeLoader
|
||||
|
||||
// Save the addresses of needed functions so
|
||||
// the helper code will know where to call them.
|
||||
mov word ptr [bp-ReadSectorsOffset], offset ReadSectors // Save the address of ReadSectors
|
||||
mov word ptr [bp-ReadClusterOffset], offset ReadCluster // Save the address of ReadCluster
|
||||
mov word ptr [bp-PutCharsOffset], offset PutChars // Save the address of PutChars
|
||||
mov word ptr [bp-ReadSectorsOffset], offset ReadSectors // Save the address of ReadSectors
|
||||
mov word ptr [bp-ReadClusterOffset], offset ReadCluster // Save the address of ReadCluster
|
||||
mov word ptr [bp-PutCharsOffset], offset PutChars // Save the address of PutChars
|
||||
|
||||
// Now AX has start cluster of FreeLoader and we
|
||||
// have loaded the helper code in the first 512 bytes
|
||||
@@ -236,12 +236,12 @@ FoundFreeLoader:
|
||||
// Displays an error message
|
||||
// And reboots
|
||||
ErrBoot:
|
||||
mov si, offset msgFreeLdr // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgFreeLdr // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
|
||||
Reboot:
|
||||
// mov si, offset msgAnyKey // Press any key message
|
||||
// call PutChars // Display it
|
||||
// mov si, offset msgAnyKey // Press any key message
|
||||
// call PutChars // Display it
|
||||
xor ax, ax
|
||||
int HEX(16) // Wait for a keypress
|
||||
int HEX(19) // Reboot
|
||||
@@ -260,8 +260,8 @@ Done:
|
||||
// Displays a bad boot message
|
||||
// And reboots
|
||||
BadBoot:
|
||||
mov si, offset msgDiskError // Bad boot disk message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgDiskError // Bad boot disk message
|
||||
call PutChars // Display it
|
||||
|
||||
jmp short Reboot
|
||||
|
||||
@@ -269,17 +269,17 @@ BadBoot:
|
||||
// Reads cluster number in AX into [ES:0000]
|
||||
ReadCluster:
|
||||
// StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
dec ax // Adjust start cluster by 2
|
||||
dec ax // Because the data area starts on cluster 2
|
||||
dec ax // Adjust start cluster by 2
|
||||
dec ax // Because the data area starts on cluster 2
|
||||
xor ch, ch
|
||||
mov cl, byte ptr BP_REL(SectsPerCluster)
|
||||
mul cx // Times sectors per cluster
|
||||
add ax, [bp-DataAreaStartLow] // Add start of data area
|
||||
adc dx, [bp-DataAreaStartHigh] // Now we have DX:AX with the logical start sector of FREELDR.SYS
|
||||
xor bx, bx // We will load it to [ES:0000], ES loaded before function call
|
||||
// mov cl,BYTE [BYTE bp+SectsPerCluster]// Sectors per cluster still in CX
|
||||
// call ReadSectors
|
||||
// ret
|
||||
mul cx // Times sectors per cluster
|
||||
add ax, [bp-DataAreaStartLow] // Add start of data area
|
||||
adc dx, [bp-DataAreaStartHigh] // Now we have DX:AX with the logical start sector of OSLOADER.SYS
|
||||
xor bx, bx // We will load it to [ES:0000], ES loaded before function call
|
||||
//mov cl,BYTE [BYTE bp+SectsPerCluster]// Sectors per cluster still in CX
|
||||
//call ReadSectors
|
||||
//ret
|
||||
|
||||
|
||||
|
||||
@@ -296,63 +296,63 @@ ReadSectors:
|
||||
add ax, cx
|
||||
adc dx, 0
|
||||
|
||||
cmp dx, word ptr [bp-BiosCHSDriveSizeHigh] // Check if they are reading a sector within CHS range
|
||||
ja ReadSectorsLBA // No - go to the LBA routine
|
||||
jb ReadSectorsCHS // Yes - go to the old CHS routine
|
||||
cmp ax, word ptr [bp-BiosCHSDriveSizeLow] // Check if they are reading a sector within CHS range
|
||||
jbe ReadSectorsCHS // Yes - go to the old CHS routine
|
||||
cmp dx, word ptr [bp-BiosCHSDriveSizeHigh] // Check if they are reading a sector within CHS range
|
||||
ja ReadSectorsLBA // No - go to the LBA routine
|
||||
jb ReadSectorsCHS // Yes - go to the old CHS routine
|
||||
cmp ax, word ptr [bp-BiosCHSDriveSizeLow] // Check if they are reading a sector within CHS range
|
||||
jbe ReadSectorsCHS // Yes - go to the old CHS routine
|
||||
|
||||
ReadSectorsLBA:
|
||||
popa
|
||||
ReadSectorsLBALoop:
|
||||
pusha // Save logical sector number & sector count
|
||||
pusha // Save logical sector number & sector count
|
||||
|
||||
push 0
|
||||
push 0
|
||||
push dx // Put 64-bit logical
|
||||
push ax // block address on stack
|
||||
push es // Put transfer segment on stack
|
||||
push bx // Put transfer offset on stack
|
||||
push 1 // Set transfer count to 1 sector
|
||||
push HEX(10) // Set size of packet to 10h
|
||||
mov si,sp // Setup disk address packet on stack
|
||||
push dx // Put 64-bit logical
|
||||
push ax // block address on stack
|
||||
push es // Put transfer segment on stack
|
||||
push bx // Put transfer offset on stack
|
||||
push 1 // Set transfer count to 1 sector
|
||||
push HEX(10) // Set size of packet to 10h
|
||||
mov si,sp // Setup disk address packet on stack
|
||||
|
||||
// We are so totally out of space here that I am forced to
|
||||
// comment out this very beautifully written piece of code
|
||||
// It would have been nice to have had this check...
|
||||
//CheckInt13hExtensions: // Now make sure this computer supports extended reads
|
||||
// mov ah,0x41 // AH = 41h
|
||||
// mov bx,0x55aa // BX = 55AAh
|
||||
// mov dl,[BYTE bp+BootDrive] // DL = drive (80h-FFh)
|
||||
// int 13h // IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
// jc PrintDiskError // CF set on error (extensions not supported)
|
||||
// cmp bx,0xaa55 // BX = AA55h if installed
|
||||
// jne PrintDiskError
|
||||
// test cl,1 // CX = API subset support bitmap
|
||||
// jz PrintDiskError // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
//CheckInt13hExtensions: // Now make sure this computer supports extended reads
|
||||
// mov ah,0x41 // AH = 41h
|
||||
// mov bx,0x55aa // BX = 55AAh
|
||||
// mov dl,[BYTE bp+BootDrive] // DL = drive (80h-FFh)
|
||||
// int 13h // IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
// jc PrintDiskError // CF set on error (extensions not supported)
|
||||
// cmp bx,0xaa55 // BX = AA55h if installed
|
||||
// jne PrintDiskError
|
||||
// test cl,1 // CX = API subset support bitmap
|
||||
// jz PrintDiskError // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
|
||||
|
||||
// Good, we're here so the computer supports LBA disk access
|
||||
// So finish the extended read
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
||||
int HEX(13) // Call BIOS
|
||||
jc BadBoot // If the read failed then abort
|
||||
// Good, we're here so the computer supports LBA disk access
|
||||
// So finish the extended read
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
||||
int HEX(13) // Call BIOS
|
||||
jc BadBoot // If the read failed then abort
|
||||
|
||||
add sp, 16 // Remove disk address packet from stack
|
||||
add sp, 16 // Remove disk address packet from stack
|
||||
|
||||
popa // Restore sector count & logical sector number
|
||||
popa // Restore sector count & logical sector number
|
||||
|
||||
inc ax // Increment Sector to Read
|
||||
inc ax // Increment Sector to Read
|
||||
adc dx, 0
|
||||
|
||||
push bx
|
||||
mov bx, es
|
||||
add bx, HEX(20) // Increment read buffer for next sector
|
||||
add bx, HEX(20) // Increment read buffer for next sector
|
||||
mov es, bx
|
||||
pop bx
|
||||
|
||||
loop ReadSectorsLBALoop // Read next sector
|
||||
loop ReadSectorsLBALoop // Read next sector
|
||||
|
||||
ret
|
||||
|
||||
@@ -370,26 +370,26 @@ ReadSectorsCHSLoop:
|
||||
xor dx, dx
|
||||
div word ptr BP_REL(SectorsPerTrack)
|
||||
xchg ax, cx
|
||||
div word ptr BP_REL(SectorsPerTrack) // Divide logical by SectorsPerTrack
|
||||
inc dx // Sectors numbering starts at 1 not 0
|
||||
div word ptr BP_REL(SectorsPerTrack) // Divide logical by SectorsPerTrack
|
||||
inc dx // Sectors numbering starts at 1 not 0
|
||||
xchg cx, dx
|
||||
div word ptr BP_REL(NumberOfHeads) // Number of heads
|
||||
mov dh, dl // Head to DH, drive to DL
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ch, al // Cylinder in CX
|
||||
ror ah, 2 // Low 8 bits of cylinder in CH, high 2 bits
|
||||
// in CL shifted to bits 6 & 7
|
||||
or cl, ah // Or with sector number
|
||||
div word ptr BP_REL(NumberOfHeads) // Number of heads
|
||||
mov dh, dl // Head to DH, drive to DL
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ch, al // Cylinder in CX
|
||||
ror ah, 2 // Low 8 bits of cylinder in CH, high 2 bits
|
||||
// in CL shifted to bits 6 & 7
|
||||
or cl, ah // Or with sector number
|
||||
mov ax, HEX(0201)
|
||||
int HEX(13) // DISK - READ SECTORS INTO MEMORY
|
||||
// AL = number of sectors to read, CH = track, CL = sector
|
||||
// DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
// Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
// DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
// Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
|
||||
jc BadBoot
|
||||
|
||||
popa
|
||||
inc ax // Increment Sector to Read
|
||||
inc ax //Increment Sector to Read
|
||||
jnz NoCarryCHS
|
||||
inc dx
|
||||
|
||||
@@ -400,8 +400,8 @@ NoCarryCHS:
|
||||
add bx, HEX(20)
|
||||
mov es, bx
|
||||
pop bx
|
||||
// Increment read buffer for next sector
|
||||
loop ReadSectorsCHSLoop // Read next sector
|
||||
// Increment read buffer for next sector
|
||||
loop ReadSectorsCHSLoop // Read next sector
|
||||
|
||||
ret
|
||||
|
||||
@@ -409,11 +409,10 @@ NoCarryCHS:
|
||||
msgDiskError:
|
||||
.ascii "Disk error", CR, LF, NUL
|
||||
msgFreeLdr:
|
||||
.ascii "Ldr not found", CR, LF, NUL
|
||||
.ascii "ldr not found", CR, LF, NUL
|
||||
// Sorry, need the space...
|
||||
// msgAnyKey:
|
||||
//msgAnyKey:
|
||||
// .ascii "Press any key to restart", CR, LF, NUL
|
||||
// .ascii "Press a key", CR, LF, NUL
|
||||
filename:
|
||||
.ascii "FREELDR SYS"
|
||||
|
||||
@@ -423,7 +422,7 @@ BootPartition:
|
||||
.byte 0
|
||||
|
||||
BootSignature:
|
||||
.word HEX(0aa55) // BootSector signature
|
||||
.word HEX(0aa55) // BootSector signature
|
||||
|
||||
.endcode16
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
; of the PutChars function in the boot sector.
|
||||
;
|
||||
; When it locates freeldr.sys on the disk it will
|
||||
; load the first sector of the file to 0000:F800
|
||||
; load the first sector of the file to 0000:8000
|
||||
; With the help of this sector we should be able
|
||||
; to load the entire file off the disk, no matter
|
||||
; how fragmented it is.
|
||||
@@ -39,15 +39,15 @@
|
||||
; boots dramatically.
|
||||
|
||||
|
||||
BootSectorStackTop equ 0x7bf2
|
||||
DataAreaStartHigh equ 0x2
|
||||
DataAreaStartLow equ 0x4
|
||||
BiosCHSDriveSizeHigh equ 0x6
|
||||
BiosCHSDriveSizeLow equ 0x8
|
||||
BiosCHSDriveSize equ 0x8
|
||||
ReadSectorsOffset equ 0xa
|
||||
ReadClusterOffset equ 0xc
|
||||
PutCharsOffset equ 0xe
|
||||
BootSectorStackTop equ 0x7bf2
|
||||
DataAreaStartHigh equ 0x2
|
||||
DataAreaStartLow equ 0x4
|
||||
BiosCHSDriveSizeHigh equ 0x6
|
||||
BiosCHSDriveSizeLow equ 0x8
|
||||
BiosCHSDriveSize equ 0x8
|
||||
ReadSectorsOffset equ 0xa
|
||||
ReadClusterOffset equ 0xc
|
||||
PutCharsOffset equ 0xe
|
||||
|
||||
|
||||
org 7c00h
|
||||
@@ -84,134 +84,136 @@ main:
|
||||
xor ax,ax
|
||||
mov ss,ax
|
||||
mov bp,7c00h
|
||||
mov sp,BootSectorStackTop ; Setup a stack
|
||||
mov ds,ax ; Make DS correct
|
||||
mov es,ax ; Make ES correct
|
||||
mov sp,BootSectorStackTop ; Setup a stack
|
||||
mov ds,ax ; Make DS correct
|
||||
mov es,ax ; Make ES correct
|
||||
|
||||
|
||||
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||
jne GetDriveParameters
|
||||
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||
jne GetDriveParameters
|
||||
|
||||
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||
|
||||
|
||||
GetDriveParameters:
|
||||
mov ah,08h
|
||||
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
||||
int 13h ; Request drive parameters from the bios
|
||||
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
||||
mov ah,08h
|
||||
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
||||
int 13h ; Request drive parameters from the bios
|
||||
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
||||
|
||||
; If we get here then the call to the BIOS failed
|
||||
; so just set CHS equal to the maximum addressable
|
||||
; size
|
||||
mov cx,0ffffh
|
||||
mov dh,cl
|
||||
; If we get here then the call to the BIOS failed
|
||||
; so just set CHS equal to the maximum addressable
|
||||
; size
|
||||
mov cx,0ffffh
|
||||
mov dh,cl
|
||||
|
||||
CalcDriveSize:
|
||||
; Now that we have the drive geometry
|
||||
; lets calculate the drive size
|
||||
mov bl,ch ; Put the low 8-bits of the cylinder count into BL
|
||||
mov bh,cl ; Put the high 2-bits in BH
|
||||
shr bh,6 ; Shift them into position, now BX contains the cylinder count
|
||||
and cl,3fh ; Mask off cylinder bits from sector count
|
||||
; CL now contains sectors per track and DH contains head count
|
||||
movzx eax,dh ; Move the heads into EAX
|
||||
movzx ebx,bx ; Move the cylinders into EBX
|
||||
movzx ecx,cl ; Move the sectors per track into ECX
|
||||
inc eax ; Make it one based because the bios returns it zero based
|
||||
inc ebx ; Make the cylinder count one based also
|
||||
mul ecx ; Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx ; Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
; Now that we have the drive geometry
|
||||
; lets calculate the drive size
|
||||
mov bl,ch ; Put the low 8-bits of the cylinder count into BL
|
||||
mov bh,cl ; Put the high 2-bits in BH
|
||||
shr bh,6 ; Shift them into position, now BX contains the cylinder count
|
||||
and cl,3fh ; Mask off cylinder bits from sector count
|
||||
; CL now contains sectors per track and DH contains head count
|
||||
movzx eax,dh ; Move the heads into EAX
|
||||
movzx ebx,bx ; Move the cylinders into EBX
|
||||
movzx ecx,cl ; Move the sectors per track into ECX
|
||||
inc eax ; Make it one based because the bios returns it zero based
|
||||
inc ebx ; Make the cylinder count one based also
|
||||
mul ecx ; Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx ; Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
|
||||
; We now have the total number of sectors as reported
|
||||
; by the bios in eax, so store it in our variable
|
||||
mov [BYTE bp-BiosCHSDriveSize],eax
|
||||
; We now have the total number of sectors as reported
|
||||
; by the bios in eax, so store it in our variable
|
||||
mov [BYTE bp-BiosCHSDriveSize],eax
|
||||
|
||||
|
||||
; Now we must find our way to the first sector of the root directory
|
||||
xor ax,ax
|
||||
xor cx,cx
|
||||
mov al,[BYTE bp+NumberOfFats] ; Number of fats
|
||||
mul WORD [BYTE bp+SectorsPerFat] ; Times sectors per fat
|
||||
add ax,WORD [BYTE bp+HiddenSectors]
|
||||
adc dx,WORD [BYTE bp+HiddenSectors+2] ; Add the number of hidden sectors
|
||||
add ax,WORD [BYTE bp+ReservedSectors] ; Add the number of reserved sectors
|
||||
adc dx,cx ; Add carry bit
|
||||
mov WORD [BYTE bp-DataAreaStartLow],ax ; Save the starting sector of the root directory
|
||||
mov WORD [BYTE bp-DataAreaStartHigh],dx ; Save it in the first 4 bytes before the boot sector
|
||||
mov si,WORD [BYTE bp+MaxRootEntries] ; Get number of root dir entries in SI
|
||||
pusha ; Save 32-bit logical start sector of root dir
|
||||
xor cx,cx
|
||||
mov al,[BYTE bp+NumberOfFats] ; Number of fats
|
||||
mul WORD [BYTE bp+SectorsPerFat] ; Times sectors per fat
|
||||
add ax,WORD [BYTE bp+HiddenSectors]
|
||||
adc dx,WORD [BYTE bp+HiddenSectors+2] ; Add the number of hidden sectors
|
||||
add ax,WORD [BYTE bp+ReservedSectors] ; Add the number of reserved sectors
|
||||
adc dx,cx ; Add carry bit
|
||||
mov WORD [BYTE bp-DataAreaStartLow],ax ; Save the starting sector of the root directory
|
||||
mov WORD [BYTE bp-DataAreaStartHigh],dx ; Save it in the first 4 bytes before the boot sector
|
||||
mov si,WORD [BYTE bp+MaxRootEntries] ; Get number of root dir entries in SI
|
||||
pusha ; Save 32-bit logical start sector of root dir
|
||||
; DX:AX now has the number of the starting sector of the root directory
|
||||
|
||||
; Now calculate the size of the root directory
|
||||
xor dx,dx
|
||||
mov ax,0020h ; Size of dir entry
|
||||
mul si ; Times the number of entries
|
||||
xor dx,dx
|
||||
mov ax,0020h ; Size of dir entry
|
||||
mul si ; Times the number of entries
|
||||
mov bx,[BYTE bp+BytesPerSector]
|
||||
add ax,bx
|
||||
dec ax
|
||||
div bx ; Divided by the size of a sector
|
||||
; AX now has the number of root directory sectors
|
||||
div bx ; Divided by the size of a sector
|
||||
; AX now has the number of root directory sectors
|
||||
|
||||
add [BYTE bp-DataAreaStartLow],ax ; Add the number of sectors of the root directory to our other value
|
||||
adc [BYTE bp-DataAreaStartHigh],cx ; Now the first 4 bytes before the boot sector contain the starting sector of the data area
|
||||
popa ; Restore root dir logical sector start to DX:AX
|
||||
add [BYTE bp-DataAreaStartLow],ax ; Add the number of sectors of the root directory to our other value
|
||||
adc [BYTE bp-DataAreaStartHigh],cx ; Now the first 4 bytes before the boot sector contain the starting sector of the data area
|
||||
popa ; Restore root dir logical sector start to DX:AX
|
||||
|
||||
LoadRootDirSector:
|
||||
mov bx,7e0h ; We will load the root directory sector
|
||||
mov es,bx ; Right after the boot sector in memory
|
||||
xor bx,bx ; We will load it to [0000:7e00h]
|
||||
xor cx,cx ; Zero out CX
|
||||
inc cx ; Now increment it to 1, we are reading one sector
|
||||
xor di,di ; Zero out di
|
||||
push es ; Save ES because it will get incremented by 20h
|
||||
call ReadSectors ; Read the first sector of the root directory
|
||||
pop es ; Restore ES (ES:DI = 07E0:0000)
|
||||
mov bx,7e0h ; We will load the root directory sector
|
||||
mov es,bx ; Right after the boot sector in memory
|
||||
xor bx,bx ; We will load it to [0000:7e00h]
|
||||
xor cx,cx ; Zero out CX
|
||||
inc cx ; Now increment it to 1, we are reading one sector
|
||||
xor di,di ; Zero out di
|
||||
push es ; Save ES because it will get incremented by 20h
|
||||
call ReadSectors ; Read the first sector of the root directory
|
||||
pop es ; Restore ES (ES:DI = 07E0:0000)
|
||||
|
||||
SearchRootDirSector:
|
||||
cmp [es:di],ch ; If the first byte of the directory entry is zero then we have
|
||||
jz ErrBoot ; reached the end of the directory and FREELDR.SYS is not here so reboot
|
||||
pusha ; Save all registers
|
||||
mov cl,0xb ; Put 11 in cl (length of filename in directory entry)
|
||||
mov si,filename ; Put offset of filename string in DS:SI
|
||||
repe cmpsb ; Compare this directory entry against 'FREELDR SYS'
|
||||
popa ; Restore all the registers
|
||||
jz FoundFreeLoader ; If we found it then jump
|
||||
dec si ; SI holds MaxRootEntries, subtract one
|
||||
jz ErrBoot ; If we are out of root dir entries then reboot
|
||||
add di,BYTE +0x20 ; Increment DI by the size of a directory entry
|
||||
cmp di,0200h ; Compare DI to 512 (DI has offset to next dir entry, make sure we haven't gone over one sector)
|
||||
jc SearchRootDirSector ; If DI is less than 512 loop again
|
||||
jmp short LoadRootDirSector ; Didn't find FREELDR.SYS in this directory sector, try again
|
||||
cmp [es:di],ch ; If the first byte of the directory entry is zero then we have
|
||||
jz ErrBoot ; reached the end of the directory and FREELDR.SYS is not here so reboot
|
||||
pusha ; Save all registers
|
||||
mov cl,0xb ; Put 11 in cl (length of filename in directory entry)
|
||||
mov si,filename ; Put offset of filename string in DS:SI
|
||||
repe cmpsb ; Compare this directory entry against 'FREELDR SYS'
|
||||
popa ; Restore all the registers
|
||||
jz FoundFreeLoader ; If we found it then jump
|
||||
dec si ; SI holds MaxRootEntries, subtract one
|
||||
jz ErrBoot ; If we are out of root dir entries then reboot
|
||||
add di,BYTE +0x20 ; Increment DI by the size of a directory entry
|
||||
cmp di,0200h ; Compare DI to 512 (DI has offset to next dir entry, make sure we haven't gone over one sector)
|
||||
jc SearchRootDirSector ; If DI is less than 512 loop again
|
||||
jmp short LoadRootDirSector ; Didn't find FREELDR.SYS in this directory sector, try again
|
||||
|
||||
FoundFreeLoader:
|
||||
; We found freeldr.sys on the disk
|
||||
; so we need to load the first 512
|
||||
; bytes of it to 0000:F800
|
||||
; We found freeldr.sys on the disk
|
||||
; so we need to load the first 512
|
||||
; bytes of it to 0000:8000
|
||||
; ES:DI has dir entry (ES:DI == 07E0:XXXX)
|
||||
mov ax,WORD [es:di+1ah] ; Get start cluster
|
||||
push ax ; Save start cluster
|
||||
push WORD 0F80h ; FREELDR_BASE / 16 ; Put load segment on the stack and load it
|
||||
pop es ; Into ES so that we load the cluster at 0000:F800
|
||||
call ReadCluster ; Read the cluster
|
||||
pop ax ; Restore start cluster of FreeLoader
|
||||
mov ax,WORD [es:di+1ah] ; Get start cluster
|
||||
push ax ; Save start cluster
|
||||
push WORD 800h ; Put 800h on the stack and load it
|
||||
pop es ; Into ES so that we load the cluster at 0000:8000
|
||||
call ReadCluster ; Read the cluster
|
||||
pop ax ; Restore start cluster of FreeLoader
|
||||
|
||||
; Save the addresses of needed functions so
|
||||
; the helper code will know where to call them.
|
||||
mov WORD [BYTE bp-ReadSectorsOffset],ReadSectors ; Save the address of ReadSectors
|
||||
mov WORD [BYTE bp-ReadClusterOffset],ReadCluster ; Save the address of ReadCluster
|
||||
mov WORD [BYTE bp-PutCharsOffset],PutChars ; Save the address of PutChars
|
||||
; Save the addresses of needed functions so
|
||||
; the helper code will know where to call them.
|
||||
mov WORD [BYTE bp-ReadSectorsOffset],ReadSectors ; Save the address of ReadSectors
|
||||
mov WORD [BYTE bp-ReadClusterOffset],ReadCluster ; Save the address of ReadCluster
|
||||
mov WORD [BYTE bp-PutCharsOffset],PutChars ; Save the address of PutChars
|
||||
|
||||
; Now AX has start cluster of FreeLoader and we
|
||||
; have loaded the helper code in the first 512 bytes
|
||||
; of FreeLoader to 0000:F800. Now transfer control
|
||||
; to the helper code. Skip the first three bytes
|
||||
; because they contain a jump instruction to skip
|
||||
; over the helper code in the FreeLoader image.
|
||||
;ljmp16 0, FREELDR_BASE + 3
|
||||
db 0EAh
|
||||
dw 0F803h
|
||||
dw 0
|
||||
; Now AX has start cluster of FreeLoader and we
|
||||
; have loaded the helper code in the first 512 bytes
|
||||
; of FreeLoader to 0000:8000. Now transfer control
|
||||
; to the helper code. Skip the first three bytes
|
||||
; because they contain a jump instruction to skip
|
||||
; over the helper code in the FreeLoader image.
|
||||
;jmp 0000:9003h
|
||||
push 0 ; push segment (0x0000)
|
||||
mov bx, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
|
||||
add bx, 0x8003 ; RVA -> VA and skip 3 bytes (jump to fathelper code)
|
||||
push bx ; push offset
|
||||
retf ; Transfer control to FreeLoader
|
||||
|
||||
|
||||
|
||||
@@ -223,9 +225,9 @@ ErrBoot:
|
||||
call PutChars ; Display it
|
||||
|
||||
Reboot:
|
||||
; mov si,msgAnyKey ; Press any key message
|
||||
; call PutChars ; Display it
|
||||
xor ax,ax
|
||||
mov si,msgAnyKey ; Press any key message
|
||||
call PutChars ; Display it
|
||||
xor ax,ax
|
||||
int 16h ; Wait for a keypress
|
||||
int 19h ; Reboot
|
||||
|
||||
@@ -246,23 +248,23 @@ BadBoot:
|
||||
mov si,msgDiskError ; Bad boot disk message
|
||||
call PutChars ; Display it
|
||||
|
||||
jmp short Reboot
|
||||
jmp short Reboot
|
||||
|
||||
|
||||
; Reads cluster number in AX into [ES:0000]
|
||||
ReadCluster:
|
||||
; StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
dec ax ; Adjust start cluster by 2
|
||||
dec ax ; Because the data area starts on cluster 2
|
||||
; StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
dec ax ; Adjust start cluster by 2
|
||||
dec ax ; Because the data area starts on cluster 2
|
||||
xor ch,ch
|
||||
mov cl,BYTE [BYTE bp+SectsPerCluster]
|
||||
mul cx ; Times sectors per cluster
|
||||
add ax,[BYTE bp-DataAreaStartLow] ; Add start of data area
|
||||
adc dx,[BYTE bp-DataAreaStartHigh] ; Now we have DX:AX with the logical start sector of FREELDR.SYS
|
||||
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
||||
;mov cl,BYTE [BYTE bp+SectsPerCluster]; Sectors per cluster still in CX
|
||||
;call ReadSectors
|
||||
;ret
|
||||
mul cx ; Times sectors per cluster
|
||||
add ax,[BYTE bp-DataAreaStartLow] ; Add start of data area
|
||||
adc dx,[BYTE bp-DataAreaStartHigh] ; Now we have DX:AX with the logical start sector of OSLOADER.SYS
|
||||
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
||||
;mov cl,BYTE [BYTE bp+SectsPerCluster]; Sectors per cluster still in CX
|
||||
;call ReadSectors
|
||||
;ret
|
||||
|
||||
|
||||
|
||||
@@ -270,73 +272,73 @@ ReadCluster:
|
||||
; DX:AX has logical sector number to read
|
||||
; CX has number of sectors to read
|
||||
ReadSectors:
|
||||
|
||||
; We can't just check if the start sector is
|
||||
; in the BIOS CHS range. We have to check if
|
||||
; the start sector + length is in that range.
|
||||
pusha
|
||||
dec cx
|
||||
add ax,cx
|
||||
adc dx,byte 0
|
||||
|
||||
; We can't just check if the start sector is
|
||||
; in the BIOS CHS range. We have to check if
|
||||
; the start sector + length is in that range.
|
||||
pusha
|
||||
dec cx
|
||||
add ax,cx
|
||||
adc dx,byte 0
|
||||
|
||||
cmp dx,WORD [BYTE bp-BiosCHSDriveSizeHigh] ; Check if they are reading a sector within CHS range
|
||||
ja ReadSectorsLBA ; No - go to the LBA routine
|
||||
jb ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||
cmp ax,WORD [BYTE bp-BiosCHSDriveSizeLow] ; Check if they are reading a sector within CHS range
|
||||
jbe ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||
cmp dx,WORD [BYTE bp-BiosCHSDriveSizeHigh] ; Check if they are reading a sector within CHS range
|
||||
ja ReadSectorsLBA ; No - go to the LBA routine
|
||||
jb ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||
cmp ax,WORD [BYTE bp-BiosCHSDriveSizeLow] ; Check if they are reading a sector within CHS range
|
||||
jbe ReadSectorsCHS ; Yes - go to the old CHS routine
|
||||
|
||||
ReadSectorsLBA:
|
||||
popa
|
||||
popa
|
||||
ReadSectorsLBALoop:
|
||||
pusha ; Save logical sector number & sector count
|
||||
pusha ; Save logical sector number & sector count
|
||||
|
||||
o32 push byte 0
|
||||
push dx ; Put 64-bit logical
|
||||
push ax ; block address on stack
|
||||
push es ; Put transfer segment on stack
|
||||
push bx ; Put transfer offset on stack
|
||||
push byte 1 ; Set transfer count to 1 sector
|
||||
push byte 0x10 ; Set size of packet to 10h
|
||||
mov si,sp ; Setup disk address packet on stack
|
||||
o32 push byte 0
|
||||
push dx ; Put 64-bit logical
|
||||
push ax ; block address on stack
|
||||
push es ; Put transfer segment on stack
|
||||
push bx ; Put transfer offset on stack
|
||||
push byte 1 ; Set transfer count to 1 sector
|
||||
push byte 0x10 ; Set size of packet to 10h
|
||||
mov si,sp ; Setup disk address packet on stack
|
||||
|
||||
; We are so totally out of space here that I am forced to
|
||||
; comment out this very beautifully written piece of code
|
||||
; It would have been nice to have had this check...
|
||||
;CheckInt13hExtensions: ; Now make sure this computer supports extended reads
|
||||
; mov ah,0x41 ; AH = 41h
|
||||
; mov bx,0x55aa ; BX = 55AAh
|
||||
; mov dl,[BYTE bp+BootDrive] ; DL = drive (80h-FFh)
|
||||
; int 13h ; IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
; jc PrintDiskError ; CF set on error (extensions not supported)
|
||||
; cmp bx,0xaa55 ; BX = AA55h if installed
|
||||
; jne PrintDiskError
|
||||
; test cl,1 ; CX = API subset support bitmap
|
||||
; jz PrintDiskError ; Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
;CheckInt13hExtensions: ; Now make sure this computer supports extended reads
|
||||
; mov ah,0x41 ; AH = 41h
|
||||
; mov bx,0x55aa ; BX = 55AAh
|
||||
; mov dl,[BYTE bp+BootDrive] ; DL = drive (80h-FFh)
|
||||
; int 13h ; IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
; jc PrintDiskError ; CF set on error (extensions not supported)
|
||||
; cmp bx,0xaa55 ; BX = AA55h if installed
|
||||
; jne PrintDiskError
|
||||
; test cl,1 ; CX = API subset support bitmap
|
||||
; jz PrintDiskError ; Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
|
||||
|
||||
; Good, we're here so the computer supports LBA disk access
|
||||
; So finish the extended read
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number
|
||||
mov ah,42h ; Int 13h, AH = 42h - Extended Read
|
||||
int 13h ; Call BIOS
|
||||
jc BadBoot ; If the read failed then abort
|
||||
; Good, we're here so the computer supports LBA disk access
|
||||
; So finish the extended read
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number
|
||||
mov ah,42h ; Int 13h, AH = 42h - Extended Read
|
||||
int 13h ; Call BIOS
|
||||
jc BadBoot ; If the read failed then abort
|
||||
|
||||
add sp,byte 0x10 ; Remove disk address packet from stack
|
||||
add sp,byte 0x10 ; Remove disk address packet from stack
|
||||
|
||||
popa ; Restore sector count & logical sector number
|
||||
popa ; Restore sector count & logical sector number
|
||||
|
||||
inc ax ; Increment Sector to Read
|
||||
adc dx,byte 0
|
||||
inc ax ; Increment Sector to Read
|
||||
adc dx,byte 0
|
||||
|
||||
push bx
|
||||
mov bx,es
|
||||
add bx,byte 20h ; Increment read buffer for next sector
|
||||
add bx,byte 20h ; Increment read buffer for next sector
|
||||
mov es,bx
|
||||
pop bx
|
||||
|
||||
loop ReadSectorsLBALoop ; Read next sector
|
||||
|
||||
loop ReadSectorsLBALoop ; Read next sector
|
||||
|
||||
ret
|
||||
ret
|
||||
|
||||
|
||||
; Reads logical sectors into [ES:BX]
|
||||
@@ -344,14 +346,14 @@ ReadSectorsLBALoop:
|
||||
; CX has number of sectors to read
|
||||
; CarryFlag set on error
|
||||
ReadSectorsCHS:
|
||||
popa
|
||||
popa
|
||||
ReadSectorsCHSLoop:
|
||||
pusha
|
||||
xchg ax,cx
|
||||
xchg ax,dx
|
||||
xor dx,dx
|
||||
div WORD [BYTE bp+SectorsPerTrack]
|
||||
xchg ax,cx
|
||||
xchg ax,cx
|
||||
div WORD [BYTE bp+SectorsPerTrack] ; Divide logical by SectorsPerTrack
|
||||
inc dx ; Sectors numbering starts at 1 not 0
|
||||
xchg cx,dx
|
||||
@@ -365,8 +367,8 @@ ReadSectorsCHSLoop:
|
||||
mov ax,0201h
|
||||
int 13h ; DISK - READ SECTORS INTO MEMORY
|
||||
; AL = number of sectors to read, CH = track, CL = sector
|
||||
; DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
; DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
|
||||
jc BadBoot
|
||||
|
||||
@@ -385,20 +387,20 @@ NoCarryCHS:
|
||||
; Increment read buffer for next sector
|
||||
loop ReadSectorsCHSLoop ; Read next sector
|
||||
|
||||
ret
|
||||
ret
|
||||
|
||||
|
||||
msgDiskError db 'Disk error',0dh,0ah,0
|
||||
msgFreeLdr db 'Ldr not found',0dh,0ah,0
|
||||
msgFreeLdr db 'ldr not found',0dh,0ah,0
|
||||
; Sorry, need the space...
|
||||
;msgAnyKey db 'Press any key to restart',0dh,0ah,0
|
||||
;msgAnyKey db 'Press a key',0dh,0ah,0
|
||||
msgAnyKey db 'Press a key',0dh,0ah,0
|
||||
filename db 'FREELDR SYS'
|
||||
|
||||
times 509-($-$$) db 0 ; Pad to 509 bytes
|
||||
|
||||
BootPartition:
|
||||
db 0
|
||||
db 0
|
||||
|
||||
BootSignature:
|
||||
dw 0aa55h ; BootSector signature
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* PROJECT: ReactOS Bootsector
|
||||
* FILE: boot/freeldr/bootsect/fat32.S
|
||||
* PURPOSE:
|
||||
* PROGRAMMERS: Brian Palmer
|
||||
* PROGRAMMERS: ?
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
@@ -32,13 +32,13 @@ ReservedSectors:
|
||||
NumberOfFats:
|
||||
.byte 2
|
||||
MaxRootEntries:
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
TotalSectors:
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
MediaDescriptor:
|
||||
.byte HEX(0f8)
|
||||
SectorsPerFat:
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
.word 0 // Always zero for FAT32 volumes
|
||||
SectorsPerTrack:
|
||||
.word 0
|
||||
NumberOfHeads:
|
||||
@@ -62,9 +62,9 @@ FSInfoSector:
|
||||
BackupBootSector:
|
||||
.word 6
|
||||
Reserved1:
|
||||
.space 12, 0
|
||||
// End FAT32 Inserted Info
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
// End FAT32 Inserted Info
|
||||
BootDrive:
|
||||
.byte 0
|
||||
Reserved:
|
||||
@@ -82,33 +82,33 @@ main:
|
||||
xor ax,ax // Setup segment registers
|
||||
mov ds,ax // Make DS correct
|
||||
mov es,ax // Make ES correct
|
||||
mov ss,ax // Make SS correct
|
||||
mov ss,ax // Make SS correct
|
||||
mov bp, HEX(7c00)
|
||||
mov sp, HEX(7c00) // Setup a stack
|
||||
|
||||
cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it
|
||||
cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it
|
||||
jne CheckSectorsPerFat
|
||||
|
||||
mov byte ptr BP_REL(BootDrive), dl // Save the boot drive
|
||||
mov byte ptr BP_REL(BootDrive), dl // Save the boot drive
|
||||
|
||||
CheckSectorsPerFat:
|
||||
|
||||
cmp word ptr BP_REL(SectorsPerFat), 0 // Check the old 16-bit value of SectorsPerFat
|
||||
jnz CheckFailed // If it is non-zero then exit with an error
|
||||
CheckTotalSectors: // Check the old 16-bit value of TotalSectors & MaxRootEntries
|
||||
cmp dword ptr BP_REL(MaxRootEntries), 0 // by comparing the DWORD at offset MaxRootEntries to zero
|
||||
jnz CheckFailed // If it is non-zero then exit with an error
|
||||
cmp word ptr BP_REL(SectorsPerFat), 0 // Check the old 16-bit value of SectorsPerFat
|
||||
jnz CheckFailed // If it is non-zero then exit with an error
|
||||
CheckTotalSectors: // Check the old 16-bit value of TotalSectors & MaxRootEntries
|
||||
cmp dword ptr BP_REL(MaxRootEntries), 0// by comparing the DWORD at offset MaxRootEntries to zero
|
||||
jnz CheckFailed // If it is non-zero then exit with an error
|
||||
CheckFileSystemVersion:
|
||||
cmp word ptr BP_REL(FSVersion), 0 // Check the file system version word
|
||||
jna GetDriveParameters // It is zero, so continue
|
||||
cmp word ptr BP_REL(FSVersion), 0 // Check the file system version word
|
||||
jna GetDriveParameters // It is zero, so continue
|
||||
CheckFailed:
|
||||
jmp PrintFileSystemError // If it is not zero then exit with an error
|
||||
jmp PrintFileSystemError // If it is not zero then exit with an error
|
||||
|
||||
GetDriveParameters:
|
||||
mov ax, HEX(0800)
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl
|
||||
int HEX(13) // Request drive parameters from the bios
|
||||
jnc CalcDriveSize // If the call succeeded then calculate the drive size
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl
|
||||
int HEX(13) // Request drive parameters from the bios
|
||||
jnc CalcDriveSize // If the call succeeded then calculate the drive size
|
||||
|
||||
// If we get here then the call to the BIOS failed
|
||||
// so just set CHS equal to the maximum addressable
|
||||
@@ -119,18 +119,18 @@ GetDriveParameters:
|
||||
CalcDriveSize:
|
||||
// Now that we have the drive geometry
|
||||
// lets calculate the drive size
|
||||
mov bl, ch // Put the low 8-bits of the cylinder count into BL
|
||||
mov bh, cl // Put the high 2-bits in BH
|
||||
shr bh, 6 // Shift them into position, now BX contains the cylinder count
|
||||
and cl, HEX(3f) // Mask off cylinder bits from sector count
|
||||
mov bl, ch // Put the low 8-bits of the cylinder count into BL
|
||||
mov bh, cl // Put the high 2-bits in BH
|
||||
shr bh, 6 // Shift them into position, now BX contains the cylinder count
|
||||
and cl, HEX(3f) // Mask off cylinder bits from sector count
|
||||
// CL now contains sectors per track and DH contains head count
|
||||
movzx eax, dh // Move the heads into EAX
|
||||
movzx ebx, bx // Move the cylinders into EBX
|
||||
movzx ecx, cl // Move the sectors per track into ECX
|
||||
inc eax // Make it one based because the bios returns it zero based
|
||||
inc ebx // Make the cylinder count one based also
|
||||
mul ecx // Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx // Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
movzx eax, dh // Move the heads into EAX
|
||||
movzx ebx, bx // Move the cylinders into EBX
|
||||
movzx ecx, cl // Move the sectors per track into ECX
|
||||
inc eax // Make it one based because the bios returns it zero based
|
||||
inc ebx // Make the cylinder count one based also
|
||||
mul ecx // Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx // Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
|
||||
// We now have the total number of sectors as reported
|
||||
// by the bios in eax, so store it in our variable
|
||||
@@ -140,10 +140,10 @@ LoadExtraBootCode:
|
||||
// First we have to load our extra boot code at
|
||||
// sector 14 into memory at [0000:7e00h]
|
||||
mov eax, HEX(0e)
|
||||
add eax, dword ptr BP_REL(HiddenSectors) // Add the number of hidden sectors
|
||||
add eax, dword ptr BP_REL(HiddenSectors) // Add the number of hidden sectors
|
||||
mov cx, 1
|
||||
xor bx, bx
|
||||
mov es, bx // Read sector to [0000:7e00h]
|
||||
mov es, bx // Read sector to [0000:7e00h]
|
||||
mov bx, HEX(7e00)
|
||||
call ReadSectors
|
||||
jmp StartSearch
|
||||
@@ -154,64 +154,64 @@ LoadExtraBootCode:
|
||||
// CX has number of sectors to read
|
||||
ReadSectors:
|
||||
push es
|
||||
cmp eax, dword ptr ds:[BiosCHSDriveSize] // Check if they are reading a sector outside CHS range
|
||||
jae ReadSectorsLBA // Yes - go to the LBA routine
|
||||
cmp eax, dword ptr ds:[BiosCHSDriveSize] // Check if they are reading a sector outside CHS range
|
||||
jae ReadSectorsLBA // Yes - go to the LBA routine
|
||||
// If at all possible we want to use LBA routines because
|
||||
// They are optimized to read more than 1 sector per read
|
||||
|
||||
pushad // Save logical sector number & sector count
|
||||
pushad // Save logical sector number & sector count
|
||||
|
||||
CheckInt13hExtensions: // Now check if this computer supports extended reads
|
||||
CheckInt13hExtensions: // Now check if this computer supports extended reads
|
||||
mov ah, HEX(41) // AH = 41h
|
||||
mov bx, HEX(55aa) // BX = 55AAh
|
||||
mov dl, byte ptr BP_REL(BootDrive) // DL = drive (80h-FFh)
|
||||
mov bx, HEX(55aa) // BX = 55AAh
|
||||
mov dl, byte ptr BP_REL(BootDrive) // DL = drive (80h-FFh)
|
||||
int HEX(13) // IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
jc ReadSectorsCHS // CF set on error (extensions not supported)
|
||||
cmp bx, HEX(0aa55) // BX = AA55h if installed
|
||||
jc ReadSectorsCHS // CF set on error (extensions not supported)
|
||||
cmp bx, HEX(0aa55) // BX = AA55h if installed
|
||||
jne ReadSectorsCHS
|
||||
test cl,1 // CX = API subset support bitmap
|
||||
jz ReadSectorsCHS // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
test cl,1 // CX = API subset support bitmap
|
||||
jz ReadSectorsCHS // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
|
||||
popad // Restore sector count & logical sector number
|
||||
popad // Restore sector count & logical sector number
|
||||
|
||||
ReadSectorsLBA:
|
||||
pushad // Save logical sector number & sector count
|
||||
pushad // Save logical sector number & sector count
|
||||
|
||||
cmp cx, 64 // Since the LBA calls only support 0x7F sectors at a time we will limit ourselves to 64
|
||||
jbe ReadSectorsSetupDiskAddressPacket // If we are reading less than 65 sectors then just do the read
|
||||
mov cx, 64 // Otherwise read only 64 sectors on this loop iteration
|
||||
cmp cx, 64 // Since the LBA calls only support 0x7F sectors at a time we will limit ourselves to 64
|
||||
jbe ReadSectorsSetupDiskAddressPacket // If we are reading less than 65 sectors then just do the read
|
||||
mov cx, 64 // Otherwise read only 64 sectors on this loop iteration
|
||||
|
||||
ReadSectorsSetupDiskAddressPacket:
|
||||
mov word ptr ds:[LBASectorsRead],cx
|
||||
push 0
|
||||
push 0
|
||||
push eax // Put 64-bit logical block address on stack
|
||||
push es // Put transfer segment on stack
|
||||
push bx // Put transfer offset on stack
|
||||
push cx // Set transfer count
|
||||
push 16 // Set size of packet to 10h
|
||||
mov si, sp // Setup disk address packet on stack
|
||||
push es // Put transfer segment on stack
|
||||
push bx // Put transfer offset on stack
|
||||
push cx // Set transfer count
|
||||
push 16 // Set size of packet to 10h
|
||||
mov si, sp // Setup disk address packet on stack
|
||||
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
||||
int HEX(13) // Call BIOS
|
||||
jc PrintDiskError // If the read failed then abort
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number
|
||||
mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read
|
||||
int HEX(13) // Call BIOS
|
||||
jc PrintDiskError // If the read failed then abort
|
||||
|
||||
add sp, 16 // Remove disk address packet from stack
|
||||
add sp, 16 // Remove disk address packet from stack
|
||||
|
||||
popad // Restore sector count & logical sector number
|
||||
popad // Restore sector count & logical sector number
|
||||
|
||||
push bx
|
||||
mov ebx, dword ptr ds:[LBASectorsRead]
|
||||
add eax, ebx // Increment sector to read
|
||||
add eax, ebx // Increment sector to read
|
||||
shl ebx, 5
|
||||
mov dx, es
|
||||
add dx, bx // Setup read buffer for next sector
|
||||
add dx, bx // Setup read buffer for next sector
|
||||
mov es, dx
|
||||
pop bx
|
||||
|
||||
sub cx, word ptr ds:[LBASectorsRead]
|
||||
jnz ReadSectorsLBA // Read next sector
|
||||
jnz ReadSectorsLBA // Read next sector
|
||||
|
||||
pop es
|
||||
ret
|
||||
@@ -231,57 +231,57 @@ ReadSectorsCHSLoop:
|
||||
xor edx, edx
|
||||
movzx ecx, word ptr BP_REL(SectorsPerTrack)
|
||||
div ecx // Divide logical by SectorsPerTrack
|
||||
inc dl // Sectors numbering starts at 1 not 0
|
||||
mov cl, dl // Sector in CL
|
||||
inc dl // Sectors numbering starts at 1 not 0
|
||||
mov cl, dl // Sector in CL
|
||||
mov edx, eax
|
||||
shr edx, 16
|
||||
div word ptr BP_REL(NumberOfHeads) // Divide logical by number of heads
|
||||
mov dh, dl // Head in DH
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number in DL
|
||||
mov ch, al // Cylinder in CX
|
||||
ror ah, 1 // Low 8 bits of cylinder in CH, high 2 bits
|
||||
ror ah, 1 // in CL shifted to bits 6 & 7
|
||||
or cl, ah // Or with sector number
|
||||
div word ptr BP_REL(NumberOfHeads) // Divide logical by number of heads
|
||||
mov dh, dl // Head in DH
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Drive number in DL
|
||||
mov ch, al // Cylinder in CX
|
||||
ror ah, 1 // Low 8 bits of cylinder in CH, high 2 bits
|
||||
ror ah, 1 // in CL shifted to bits 6 & 7
|
||||
or cl, ah // Or with sector number
|
||||
mov ax, HEX(0201)
|
||||
int HEX(13) // DISK - READ SECTORS INTO MEMORY
|
||||
// AL = number of sectors to read, CH = track, CL = sector
|
||||
// DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
// Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
// DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
// Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
|
||||
jc PrintDiskError // If the read failed then abort
|
||||
jc PrintDiskError // If the read failed then abort
|
||||
|
||||
popad
|
||||
|
||||
inc eax // Increment Sector to Read
|
||||
|
||||
mov dx, es
|
||||
add dx, 32 // Increment read buffer for next sector
|
||||
add dx, 32 // Increment read buffer for next sector
|
||||
mov es, dx
|
||||
|
||||
loop ReadSectorsCHSLoop // Read next sector
|
||||
loop ReadSectorsCHSLoop // Read next sector
|
||||
|
||||
ret
|
||||
|
||||
// Displays a disk error message
|
||||
// And reboots
|
||||
PrintDiskError:
|
||||
mov si, offset msgDiskError // Bad boot disk message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgDiskError // Bad boot disk message
|
||||
call PutChars // Display it
|
||||
|
||||
jmp Reboot
|
||||
|
||||
// Displays a file system error message
|
||||
// And reboots
|
||||
PrintFileSystemError:
|
||||
mov si, offset msgFileSystemError // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgFileSystemError // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
|
||||
Reboot:
|
||||
mov si, offset msgAnyKey // Press any key message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgAnyKey // Press any key message
|
||||
call PutChars // Display it
|
||||
xor ax, ax
|
||||
int HEX(16) // Wait for a keypress
|
||||
int HEX(19) // Reboot
|
||||
int HEX(16) // Wait for a keypress
|
||||
int HEX(19) // Reboot
|
||||
|
||||
PutChars:
|
||||
lodsb
|
||||
@@ -311,7 +311,7 @@ BootPartition:
|
||||
.byte 0
|
||||
|
||||
BootSignature:
|
||||
.word HEX(0aa55) // BootSector signature
|
||||
.word HEX(0aa55) // BootSector signature
|
||||
|
||||
// End of bootsector
|
||||
//
|
||||
@@ -330,7 +330,7 @@ StartSearch:
|
||||
// Now we must get the first cluster of the root directory
|
||||
mov eax, dword ptr BP_REL(RootDirStartCluster)
|
||||
cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain
|
||||
jb ContinueSearch // If not continue, if so then we didn't find freeldr.sys
|
||||
jb ContinueSearch // If not continue, if so then we didn't find freeldr.sys
|
||||
jmp PrintFileNotFound
|
||||
|
||||
ContinueSearch:
|
||||
@@ -339,29 +339,29 @@ ContinueSearch:
|
||||
call ReadCluster // Read the cluster
|
||||
|
||||
// Now we have to find our way through the root directory to
|
||||
// The FREELDR.SYS file
|
||||
// The OSLOADER.SYS file
|
||||
xor bx,bx
|
||||
mov bl, byte ptr BP_REL(SectsPerCluster)
|
||||
shl bx, 4 // BX = BX * 512 / 32
|
||||
shl bx, 4 // BX = BX * 512 / 32
|
||||
mov ax, HEX(2000) // We loaded at 2000:0000
|
||||
mov es, ax
|
||||
xor di, di
|
||||
mov si, offset filename
|
||||
mov cx, 11
|
||||
repe cmpsb // Compare filenames
|
||||
repe cmpsb // Compare filenames
|
||||
jz FoundFile // If same we found it
|
||||
dec bx
|
||||
jnz FindFile
|
||||
jmp PrintFileNotFound
|
||||
|
||||
FindFile:
|
||||
mov ax, es // We didn't find it in the previous dir entry
|
||||
add ax, 2 // So lets move to the next one
|
||||
mov es, ax // And search again
|
||||
mov ax, es // We didn't find it in the previous dir entry
|
||||
add ax, 2 // So lets move to the next one
|
||||
mov es, ax // And search again
|
||||
xor di, di
|
||||
mov si, offset filename
|
||||
mov cx, 11
|
||||
repe cmpsb // Compare filenames
|
||||
repe cmpsb // Compare filenames
|
||||
jz FoundFile // If same we found it
|
||||
dec bx // Keep searching till we run out of dir entries
|
||||
jnz FindFile // Last entry?
|
||||
@@ -377,51 +377,51 @@ FoundFile:
|
||||
mov si, offset msgLoading // Loading message
|
||||
call PutChars // Display it
|
||||
|
||||
xor di, di // ES:DI has dir entry
|
||||
xor di, di // ES:DI has dir entry
|
||||
xor dx, dx
|
||||
mov ax, word ptr es:[di+20] // Get start cluster high word
|
||||
mov ax, word ptr es:[di+20] // Get start cluster high word
|
||||
shl eax, 16
|
||||
mov ax, word ptr es:[di+26] // Get start cluster low word
|
||||
mov ax, word ptr es:[di+26] // Get start cluster low word
|
||||
|
||||
CheckStartCluster:
|
||||
cmp eax, 2 // Check and see if the start cluster starts at cluster 2 or above
|
||||
jnb CheckEndCluster // If so then continue
|
||||
jmp PrintFileSystemError // If not exit with error
|
||||
cmp eax, 2 // Check and see if the start cluster starts at cluster 2 or above
|
||||
jnb CheckEndCluster // If so then continue
|
||||
jmp PrintFileSystemError // If not exit with error
|
||||
CheckEndCluster:
|
||||
cmp eax, HEX(0ffffff8) // Check and see if the start cluster is and end of cluster chain indicator
|
||||
jb InitializeLoadSegment // If not then continue
|
||||
jmp PrintFileSystemError // If so exit with error
|
||||
cmp eax, HEX(0ffffff8) // Check and see if the start cluster is and end of cluster chain indicator
|
||||
jb InitializeLoadSegment // If not then continue
|
||||
jmp PrintFileSystemError // If so exit with error
|
||||
|
||||
InitializeLoadSegment:
|
||||
mov bx, FREELDR_BASE / 16
|
||||
mov es, bx
|
||||
|
||||
LoadFile:
|
||||
cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain
|
||||
jae LoadFileDone // If so continue, if not then read the next one
|
||||
cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain
|
||||
jae LoadFileDone // If so continue, if not then read the next one
|
||||
push eax
|
||||
xor bx, bx // Load ROSLDR starting at 0000:F800h
|
||||
xor bx, bx // Load ROSLDR starting at 0000:8000h
|
||||
push es
|
||||
call ReadCluster
|
||||
pop es
|
||||
|
||||
xor bx, bx
|
||||
mov bl, byte ptr BP_REL(SectsPerCluster)
|
||||
shl bx, 5 // BX = BX * 512 / 16
|
||||
mov ax, es // Increment the load address by
|
||||
add ax, bx // The size of a cluster
|
||||
shl bx, 5 // BX = BX * 512 / 16
|
||||
mov ax, es // Increment the load address by
|
||||
add ax, bx // The size of a cluster
|
||||
mov es, ax
|
||||
|
||||
pop eax
|
||||
push es
|
||||
call GetFatEntry // Get the next entry
|
||||
call GetFatEntry // Get the next entry
|
||||
pop es
|
||||
|
||||
jmp LoadFile // Load the next cluster (if any)
|
||||
jmp LoadFile // Load the next cluster (if any)
|
||||
|
||||
LoadFileDone:
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Load boot drive into DL
|
||||
mov dh, byte ptr ds:[BootPartition] // Load boot partition into DH
|
||||
mov dl, byte ptr BP_REL(BootDrive) // Load boot drive into DL
|
||||
mov dh, byte ptr ds:[BootPartition] // Load boot partition into DH
|
||||
|
||||
/* Transfer execution to the bootloader */
|
||||
ljmp16 0, FREELDR_BASE
|
||||
@@ -431,43 +431,43 @@ LoadFileDone:
|
||||
// On return EAX has FAT entry for that cluster
|
||||
GetFatEntry:
|
||||
|
||||
shl eax, 2 // EAX = EAX * 4 (since FAT32 entries are 4 bytes)
|
||||
mov ecx, eax // Save this for later in ECX
|
||||
shl eax, 2 // EAX = EAX * 4 (since FAT32 entries are 4 bytes)
|
||||
mov ecx, eax // Save this for later in ECX
|
||||
xor edx, edx
|
||||
movzx ebx, word ptr BP_REL(BytesPerSector)
|
||||
push ebx
|
||||
div ebx // FAT Sector Number = EAX / BytesPerSector
|
||||
div ebx // FAT Sector Number = EAX / BytesPerSector
|
||||
movzx ebx, word ptr BP_REL(ReservedSectors)
|
||||
add eax, ebx // FAT Sector Number += ReservedSectors
|
||||
add eax, ebx // FAT Sector Number += ReservedSectors
|
||||
mov ebx, dword ptr BP_REL(HiddenSectors)
|
||||
add eax, ebx // FAT Sector Number += HiddenSectors
|
||||
add eax, ebx // FAT Sector Number += HiddenSectors
|
||||
pop ebx
|
||||
dec ebx
|
||||
and ecx,ebx // FAT Offset Within Sector = ECX % BytesPerSector
|
||||
// EAX holds logical FAT sector number
|
||||
// ECX holds FAT entry offset
|
||||
and ecx,ebx // FAT Offset Within Sector = ECX % BytesPerSector
|
||||
// EAX holds logical FAT sector number
|
||||
// ECX holds FAT entry offset
|
||||
|
||||
// Now we have to check the extended flags
|
||||
// to see which FAT is the active one
|
||||
// and use it, or if they are mirrored then
|
||||
// no worries
|
||||
movzx ebx, word ptr BP_REL(ExtendedFlags) // Get extended flags and put into ebx
|
||||
and bx, HEX(0f) // Mask off upper 8 bits, now we have active fat in bl
|
||||
jz LoadFatSector // If fat is mirrored then skip fat calcs
|
||||
cmp bl, byte ptr BP_REL(NumberOfFats) // Compare bl to number of fats
|
||||
// Now we have to check the extended flags
|
||||
// to see which FAT is the active one
|
||||
// and use it, or if they are mirrored then
|
||||
// no worries
|
||||
movzx ebx, word ptr BP_REL(ExtendedFlags) // Get extended flags and put into ebx
|
||||
and bx, HEX(0f) // Mask off upper 8 bits, now we have active fat in bl
|
||||
jz LoadFatSector // If fat is mirrored then skip fat calcs
|
||||
cmp bl, byte ptr BP_REL(NumberOfFats) // Compare bl to number of fats
|
||||
jb GetActiveFatOffset
|
||||
jmp PrintFileSystemError // If bl is bigger than numfats exit with error
|
||||
jmp PrintFileSystemError // If bl is bigger than numfats exit with error
|
||||
GetActiveFatOffset:
|
||||
push eax // Save logical FAT sector number
|
||||
mov eax, dword ptr BP_REL(SectorsPerFatBig) // Get the number of sectors occupied by one fat in eax
|
||||
mul ebx // Multiplied by the active FAT index we have in ebx
|
||||
pop edx // Get logical FAT sector number
|
||||
add eax, edx // Add the current FAT sector offset
|
||||
push eax // Save logical FAT sector number
|
||||
mov eax, dword ptr BP_REL(SectorsPerFatBig) // Get the number of sectors occupied by one fat in eax
|
||||
mul ebx // Multiplied by the active FAT index we have in ebx
|
||||
pop edx // Get logical FAT sector number
|
||||
add eax, edx // Add the current FAT sector offset
|
||||
|
||||
LoadFatSector:
|
||||
push ecx
|
||||
|
||||
mov bx, HEX(9000) // We will load it to [9000:0000h]
|
||||
mov bx, HEX(9000) // We will load it to [9000:0000h]
|
||||
mov es, bx
|
||||
|
||||
// EAX holds logical FAT sector number
|
||||
@@ -482,18 +482,18 @@ LoadFatSector:
|
||||
|
||||
LoadFatSectorAlreadyLoaded:
|
||||
pop ecx
|
||||
mov eax, dword ptr es:[ecx] // Get FAT entry
|
||||
and eax, HEX(0fffffff) // Mask off reserved bits
|
||||
mov eax, dword ptr es:[ecx] // Get FAT entry
|
||||
and eax, HEX(0fffffff) // Mask off reserved bits
|
||||
|
||||
ret
|
||||
|
||||
FatSectorInCache: // This variable tells us which sector we currently have in memory
|
||||
.long HEX(0ffffffff) // There is no need to re-read the same sector if we don't have to
|
||||
FatSectorInCache: // This variable tells us which sector we currently have in memory
|
||||
.long HEX(0ffffffff) // There is no need to re-read the same sector if we don't have to
|
||||
|
||||
|
||||
// Reads cluster number in EAX into [ES:0000]
|
||||
ReadCluster:
|
||||
// StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
// StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors//
|
||||
|
||||
dec eax
|
||||
dec eax
|
||||
@@ -508,7 +508,7 @@ ReadCluster:
|
||||
add eax, ebx
|
||||
add eax, dword ptr BP_REL(HiddenSectors)
|
||||
pop ebx
|
||||
add eax, ebx // EAX now contains the logical sector number of the cluster
|
||||
add eax, ebx // EAX now contains the logical sector number of the cluster
|
||||
xor bx, bx // We will load it to [ES:0000], ES loaded before function call
|
||||
movzx cx, byte ptr BP_REL(SectsPerCluster)
|
||||
call ReadSectors
|
||||
@@ -517,10 +517,10 @@ ReadCluster:
|
||||
// Displays a file not found error message
|
||||
// And reboots
|
||||
PrintFileNotFound:
|
||||
mov si, offset msgFreeLdr // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgAnyKey // Press any key message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgFreeLdr // FreeLdr not found message
|
||||
call PutChars // Display it
|
||||
mov si, offset msgAnyKey // Press any key message
|
||||
call PutChars // Display it
|
||||
|
||||
jmp Reboot
|
||||
|
||||
|
@@ -12,109 +12,109 @@ start:
|
||||
jmp short main
|
||||
nop
|
||||
|
||||
OEMName db 'FrLdr1.0'
|
||||
BytesPerSector dw 512
|
||||
SectsPerCluster db 0
|
||||
ReservedSectors dw 32
|
||||
NumberOfFats db 2
|
||||
MaxRootEntries dw 0 ; Always zero for FAT32 volumes
|
||||
TotalSectors dw 0 ; Always zero for FAT32 volumes
|
||||
MediaDescriptor db 0f8h
|
||||
SectorsPerFat dw 0 ; Always zero for FAT32 volumes
|
||||
SectorsPerTrack dw 0
|
||||
NumberOfHeads dw 0
|
||||
HiddenSectors dd 0
|
||||
TotalSectorsBig dd 0
|
||||
OEMName db 'FrLdr1.0'
|
||||
BytesPerSector dw 512
|
||||
SectsPerCluster db 0
|
||||
ReservedSectors dw 32
|
||||
NumberOfFats db 2
|
||||
MaxRootEntries dw 0 ; Always zero for FAT32 volumes
|
||||
TotalSectors dw 0 ; Always zero for FAT32 volumes
|
||||
MediaDescriptor db 0f8h
|
||||
SectorsPerFat dw 0 ; Always zero for FAT32 volumes
|
||||
SectorsPerTrack dw 0
|
||||
NumberOfHeads dw 0
|
||||
HiddenSectors dd 0
|
||||
TotalSectorsBig dd 0
|
||||
; FAT32 Inserted Info
|
||||
SectorsPerFatBig dd 0
|
||||
ExtendedFlags dw 0
|
||||
FSVersion dw 0
|
||||
RootDirStartCluster dd 0
|
||||
FSInfoSector dw 0
|
||||
BackupBootSector dw 6
|
||||
Reserved1 times 12 db 0
|
||||
SectorsPerFatBig dd 0
|
||||
ExtendedFlags dw 0
|
||||
FSVersion dw 0
|
||||
RootDirStartCluster dd 0
|
||||
FSInfoSector dw 0
|
||||
BackupBootSector dw 6
|
||||
Reserved1 times 12 db 0
|
||||
; End FAT32 Inserted Info
|
||||
BootDrive db 0
|
||||
Reserved db 0
|
||||
ExtendSig db 29h
|
||||
SerialNumber dd 00000000h
|
||||
VolumeLabel db 'NO NAME '
|
||||
FileSystem db 'FAT32 '
|
||||
BootDrive db 0
|
||||
Reserved db 0
|
||||
ExtendSig db 29h
|
||||
SerialNumber dd 00000000h
|
||||
VolumeLabel db 'NO NAME '
|
||||
FileSystem db 'FAT32 '
|
||||
|
||||
main:
|
||||
xor ax,ax ; Setup segment registers
|
||||
mov ds,ax ; Make DS correct
|
||||
mov es,ax ; Make ES correct
|
||||
mov ss,ax ; Make SS correct
|
||||
mov bp,7c00h
|
||||
mov ss,ax ; Make SS correct
|
||||
mov bp,7c00h
|
||||
mov sp,7c00h ; Setup a stack
|
||||
|
||||
|
||||
|
||||
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||
jne CheckSectorsPerFat
|
||||
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||
jne CheckSectorsPerFat
|
||||
|
||||
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||
|
||||
|
||||
|
||||
CheckSectorsPerFat:
|
||||
cmp WORD [BYTE bp+SectorsPerFat],byte 0x00 ; Check the old 16-bit value of SectorsPerFat
|
||||
jnz CheckFailed ; If it is non-zero then exit with an error
|
||||
CheckTotalSectors: ; Check the old 16-bit value of TotalSectors & MaxRootEntries
|
||||
cmp DWORD [BYTE bp+MaxRootEntries],byte 0x00; by comparing the DWORD at offset MaxRootEntries to zero
|
||||
jnz CheckFailed ; If it is non-zero then exit with an error
|
||||
cmp WORD [BYTE bp+SectorsPerFat],byte 0x00 ; Check the old 16-bit value of SectorsPerFat
|
||||
jnz CheckFailed ; If it is non-zero then exit with an error
|
||||
CheckTotalSectors: ; Check the old 16-bit value of TotalSectors & MaxRootEntries
|
||||
cmp DWORD [BYTE bp+MaxRootEntries],byte 0x00; by comparing the DWORD at offset MaxRootEntries to zero
|
||||
jnz CheckFailed ; If it is non-zero then exit with an error
|
||||
CheckFileSystemVersion:
|
||||
cmp WORD [BYTE bp+FSVersion],byte 0x00 ; Check the file system version word
|
||||
jna GetDriveParameters ; It is zero, so continue
|
||||
cmp WORD [BYTE bp+FSVersion],byte 0x00 ; Check the file system version word
|
||||
jna GetDriveParameters ; It is zero, so continue
|
||||
CheckFailed:
|
||||
jmp PrintFileSystemError ; If it is not zero then exit with an error
|
||||
jmp PrintFileSystemError ; If it is not zero then exit with an error
|
||||
|
||||
|
||||
GetDriveParameters:
|
||||
mov ax,0800h
|
||||
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
||||
int 13h ; Request drive parameters from the bios
|
||||
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
||||
mov ax,0800h
|
||||
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
|
||||
int 13h ; Request drive parameters from the bios
|
||||
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
|
||||
|
||||
; If we get here then the call to the BIOS failed
|
||||
; so just set CHS equal to the maximum addressable
|
||||
; size
|
||||
mov cx,0ffffh
|
||||
mov dh,cl
|
||||
; If we get here then the call to the BIOS failed
|
||||
; so just set CHS equal to the maximum addressable
|
||||
; size
|
||||
mov cx,0ffffh
|
||||
mov dh,cl
|
||||
|
||||
CalcDriveSize:
|
||||
; Now that we have the drive geometry
|
||||
; lets calculate the drive size
|
||||
mov bl,ch ; Put the low 8-bits of the cylinder count into BL
|
||||
mov bh,cl ; Put the high 2-bits in BH
|
||||
shr bh,6 ; Shift them into position, now BX contains the cylinder count
|
||||
and cl,3fh ; Mask off cylinder bits from sector count
|
||||
; CL now contains sectors per track and DH contains head count
|
||||
movzx eax,dh ; Move the heads into EAX
|
||||
movzx ebx,bx ; Move the cylinders into EBX
|
||||
movzx ecx,cl ; Move the sectors per track into ECX
|
||||
inc eax ; Make it one based because the bios returns it zero based
|
||||
inc ebx ; Make the cylinder count one based also
|
||||
mul ecx ; Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx ; Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
; Now that we have the drive geometry
|
||||
; lets calculate the drive size
|
||||
mov bl,ch ; Put the low 8-bits of the cylinder count into BL
|
||||
mov bh,cl ; Put the high 2-bits in BH
|
||||
shr bh,6 ; Shift them into position, now BX contains the cylinder count
|
||||
and cl,3fh ; Mask off cylinder bits from sector count
|
||||
; CL now contains sectors per track and DH contains head count
|
||||
movzx eax,dh ; Move the heads into EAX
|
||||
movzx ebx,bx ; Move the cylinders into EBX
|
||||
movzx ecx,cl ; Move the sectors per track into ECX
|
||||
inc eax ; Make it one based because the bios returns it zero based
|
||||
inc ebx ; Make the cylinder count one based also
|
||||
mul ecx ; Multiply heads with the sectors per track, result in edx:eax
|
||||
mul ebx ; Multiply the cylinders with (heads * sectors) [stored in edx:eax already]
|
||||
|
||||
; We now have the total number of sectors as reported
|
||||
; by the bios in eax, so store it in our variable
|
||||
mov [BiosCHSDriveSize],eax
|
||||
; We now have the total number of sectors as reported
|
||||
; by the bios in eax, so store it in our variable
|
||||
mov [BiosCHSDriveSize],eax
|
||||
|
||||
|
||||
LoadExtraBootCode:
|
||||
; First we have to load our extra boot code at
|
||||
; sector 14 into memory at [0000:7e00h]
|
||||
mov eax,0eh
|
||||
add eax,DWORD [BYTE bp+HiddenSectors] ; Add the number of hidden sectors
|
||||
mov cx,1
|
||||
; First we have to load our extra boot code at
|
||||
; sector 14 into memory at [0000:7e00h]
|
||||
mov eax,0eh
|
||||
add eax,DWORD [BYTE bp+HiddenSectors] ; Add the number of hidden sectors
|
||||
mov cx,1
|
||||
xor bx,bx
|
||||
mov es,bx ; Read sector to [0000:7e00h]
|
||||
mov bx,7e00h
|
||||
call ReadSectors
|
||||
jmp StartSearch
|
||||
mov es,bx ; Read sector to [0000:7e00h]
|
||||
mov bx,7e00h
|
||||
call ReadSectors
|
||||
jmp StartSearch
|
||||
|
||||
|
||||
|
||||
@@ -122,114 +122,112 @@ LoadExtraBootCode:
|
||||
; EAX has logical sector number to read
|
||||
; CX has number of sectors to read
|
||||
ReadSectors:
|
||||
push es
|
||||
cmp eax,DWORD [BiosCHSDriveSize] ; Check if they are reading a sector outside CHS range
|
||||
jae ReadSectorsLBA ; Yes - go to the LBA routine
|
||||
; If at all possible we want to use LBA routines because
|
||||
; They are optimized to read more than 1 sector per read
|
||||
cmp eax,DWORD [BiosCHSDriveSize] ; Check if they are reading a sector outside CHS range
|
||||
jae ReadSectorsLBA ; Yes - go to the LBA routine
|
||||
; If at all possible we want to use LBA routines because
|
||||
; They are optimized to read more than 1 sector per read
|
||||
|
||||
pushad ; Save logical sector number & sector count
|
||||
pushad ; Save logical sector number & sector count
|
||||
|
||||
CheckInt13hExtensions: ; Now check if this computer supports extended reads
|
||||
mov ah,0x41 ; AH = 41h
|
||||
mov bx,0x55aa ; BX = 55AAh
|
||||
mov dl,[BYTE bp+BootDrive] ; DL = drive (80h-FFh)
|
||||
int 13h ; IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
jc ReadSectorsCHS ; CF set on error (extensions not supported)
|
||||
cmp bx,0xaa55 ; BX = AA55h if installed
|
||||
jne ReadSectorsCHS
|
||||
test cl,1 ; CX = API subset support bitmap
|
||||
jz ReadSectorsCHS ; Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
CheckInt13hExtensions: ; Now check if this computer supports extended reads
|
||||
mov ah,0x41 ; AH = 41h
|
||||
mov bx,0x55aa ; BX = 55AAh
|
||||
mov dl,[BYTE bp+BootDrive] ; DL = drive (80h-FFh)
|
||||
int 13h ; IBM/MS INT 13 Extensions - INSTALLATION CHECK
|
||||
jc ReadSectorsCHS ; CF set on error (extensions not supported)
|
||||
cmp bx,0xaa55 ; BX = AA55h if installed
|
||||
jne ReadSectorsCHS
|
||||
test cl,1 ; CX = API subset support bitmap
|
||||
jz ReadSectorsCHS ; Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
|
||||
|
||||
popad ; Restore sector count & logical sector number
|
||||
popad ; Restore sector count & logical sector number
|
||||
|
||||
ReadSectorsLBA:
|
||||
pushad ; Save logical sector number & sector count
|
||||
pushad ; Save logical sector number & sector count
|
||||
|
||||
cmp cx,64 ; Since the LBA calls only support 0x7F sectors at a time we will limit ourselves to 64
|
||||
jbe ReadSectorsSetupDiskAddressPacket ; If we are reading less than 65 sectors then just do the read
|
||||
mov cx,64 ; Otherwise read only 64 sectors on this loop iteration
|
||||
cmp cx,64 ; Since the LBA calls only support 0x7F sectors at a time we will limit ourselves to 64
|
||||
jbe ReadSectorsSetupDiskAddressPacket ; If we are reading less than 65 sectors then just do the read
|
||||
mov cx,64 ; Otherwise read only 64 sectors on this loop iteration
|
||||
|
||||
ReadSectorsSetupDiskAddressPacket:
|
||||
mov [LBASectorsRead],cx
|
||||
o32 push byte 0
|
||||
push eax ; Put 64-bit logical block address on stack
|
||||
push es ; Put transfer segment on stack
|
||||
push bx ; Put transfer offset on stack
|
||||
push cx ; Set transfer count
|
||||
push byte 0x10 ; Set size of packet to 10h
|
||||
mov si,sp ; Setup disk address packet on stack
|
||||
mov [LBASectorsRead],cx
|
||||
o32 push byte 0
|
||||
push eax ; Put 64-bit logical block address on stack
|
||||
push es ; Put transfer segment on stack
|
||||
push bx ; Put transfer offset on stack
|
||||
push cx ; Set transfer count
|
||||
push byte 0x10 ; Set size of packet to 10h
|
||||
mov si,sp ; Setup disk address packet on stack
|
||||
|
||||
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number
|
||||
mov ah,42h ; Int 13h, AH = 42h - Extended Read
|
||||
int 13h ; Call BIOS
|
||||
jc PrintDiskError ; If the read failed then abort
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number
|
||||
mov ah,42h ; Int 13h, AH = 42h - Extended Read
|
||||
int 13h ; Call BIOS
|
||||
jc PrintDiskError ; If the read failed then abort
|
||||
|
||||
add sp,byte 0x10 ; Remove disk address packet from stack
|
||||
add sp,byte 0x10 ; Remove disk address packet from stack
|
||||
|
||||
popad ; Restore sector count & logical sector number
|
||||
popad ; Restore sector count & logical sector number
|
||||
|
||||
push bx
|
||||
mov ebx,DWORD [LBASectorsRead]
|
||||
add eax,ebx ; Increment sector to read
|
||||
shl ebx,5
|
||||
push bx
|
||||
mov ebx,DWORD [LBASectorsRead]
|
||||
add eax,ebx ; Increment sector to read
|
||||
shl ebx,5
|
||||
mov dx,es
|
||||
add dx,bx ; Setup read buffer for next sector
|
||||
add dx,bx ; Setup read buffer for next sector
|
||||
mov es,dx
|
||||
pop bx
|
||||
pop bx
|
||||
|
||||
sub cx,[LBASectorsRead]
|
||||
jnz ReadSectorsLBA ; Read next sector
|
||||
sub cx,[LBASectorsRead]
|
||||
jnz ReadSectorsLBA ; Read next sector
|
||||
|
||||
pop es
|
||||
ret
|
||||
|
||||
LBASectorsRead:
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
|
||||
; Reads logical sectors into [ES:BX]
|
||||
; EAX has logical sector number to read
|
||||
; CX has number of sectors to read
|
||||
ReadSectorsCHS:
|
||||
popad ; Get logical sector number & sector count off stack
|
||||
popad ; Get logical sector number & sector count off stack
|
||||
|
||||
ReadSectorsCHSLoop:
|
||||
pushad
|
||||
xor edx,edx
|
||||
movzx ecx,WORD [BYTE bp+SectorsPerTrack]
|
||||
div ecx ; Divide logical by SectorsPerTrack
|
||||
inc dl ; Sectors numbering starts at 1 not 0
|
||||
mov cl,dl ; Sector in CL
|
||||
mov edx,eax
|
||||
shr edx,16
|
||||
div WORD [BYTE bp+NumberOfHeads] ; Divide logical by number of heads
|
||||
mov dh,dl ; Head in DH
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number in DL
|
||||
mov ch,al ; Cylinder in CX
|
||||
ror ah,1 ; Low 8 bits of cylinder in CH, high 2 bits
|
||||
ror ah,1 ; in CL shifted to bits 6 & 7
|
||||
or cl,ah ; Or with sector number
|
||||
movzx ecx,WORD [BYTE bp+SectorsPerTrack]
|
||||
div ecx ; Divide logical by SectorsPerTrack
|
||||
inc dl ; Sectors numbering starts at 1 not 0
|
||||
mov cl,dl ; Sector in CL
|
||||
mov edx,eax
|
||||
shr edx,16
|
||||
div WORD [BYTE bp+NumberOfHeads] ; Divide logical by number of heads
|
||||
mov dh,dl ; Head in DH
|
||||
mov dl,[BYTE bp+BootDrive] ; Drive number in DL
|
||||
mov ch,al ; Cylinder in CX
|
||||
ror ah,1 ; Low 8 bits of cylinder in CH, high 2 bits
|
||||
ror ah,1 ; in CL shifted to bits 6 & 7
|
||||
or cl,ah ; Or with sector number
|
||||
mov ax,0201h
|
||||
int 13h ; DISK - READ SECTORS INTO MEMORY
|
||||
; AL = number of sectors to read, CH = track, CL = sector
|
||||
; DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
; DH = head, DL = drive, ES:BX -> buffer to fill
|
||||
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
|
||||
|
||||
jc PrintDiskError ; If the read failed then abort
|
||||
jc PrintDiskError ; If the read failed then abort
|
||||
|
||||
popad
|
||||
|
||||
inc eax ; Increment Sector to Read
|
||||
inc eax ; Increment Sector to Read
|
||||
|
||||
mov dx,es
|
||||
add dx,byte 20h ; Increment read buffer for next sector
|
||||
add dx,byte 20h ; Increment read buffer for next sector
|
||||
mov es,dx
|
||||
|
||||
loop ReadSectorsCHSLoop ; Read next sector
|
||||
loop ReadSectorsCHSLoop ; Read next sector
|
||||
|
||||
ret
|
||||
ret
|
||||
|
||||
|
||||
|
||||
@@ -237,23 +235,23 @@ ReadSectorsCHSLoop:
|
||||
; Displays a disk error message
|
||||
; And reboots
|
||||
PrintDiskError:
|
||||
mov si,msgDiskError ; Bad boot disk message
|
||||
call PutChars ; Display it
|
||||
mov si,msgDiskError ; Bad boot disk message
|
||||
call PutChars ; Display it
|
||||
|
||||
jmp Reboot
|
||||
jmp Reboot
|
||||
|
||||
; Displays a file system error message
|
||||
; And reboots
|
||||
PrintFileSystemError:
|
||||
mov si,msgFileSystemError ; FreeLdr not found message
|
||||
call PutChars ; Display it
|
||||
mov si,msgFileSystemError ; FreeLdr not found message
|
||||
call PutChars ; Display it
|
||||
|
||||
Reboot:
|
||||
mov si,msgAnyKey ; Press any key message
|
||||
call PutChars ; Display it
|
||||
xor ax,ax
|
||||
int 16h ; Wait for a keypress
|
||||
int 19h ; Reboot
|
||||
mov si,msgAnyKey ; Press any key message
|
||||
call PutChars ; Display it
|
||||
xor ax,ax
|
||||
int 16h ; Wait for a keypress
|
||||
int 19h ; Reboot
|
||||
|
||||
PutChars:
|
||||
lodsb
|
||||
@@ -270,18 +268,18 @@ Done:
|
||||
|
||||
BiosCHSDriveSize dd 0
|
||||
|
||||
msgDiskError db 'Disk error',0dh,0ah,0
|
||||
msgFileSystemError db 'File system error',0dh,0ah,0
|
||||
msgAnyKey db 'Press any key to restart',0dh,0ah,0
|
||||
msgDiskError db 'Disk error',0dh,0ah,0
|
||||
msgFileSystemError db 'File system error',0dh,0ah,0
|
||||
msgAnyKey db 'Press any key to restart',0dh,0ah,0
|
||||
|
||||
times 509-($-$$) db 0 ; Pad to 509 bytes
|
||||
|
||||
BootPartition:
|
||||
db 0
|
||||
db 0
|
||||
|
||||
BootSignature:
|
||||
dw 0aa55h ; BootSector signature
|
||||
|
||||
|
||||
|
||||
; End of bootsector
|
||||
;
|
||||
@@ -297,22 +295,22 @@ BootSignature:
|
||||
|
||||
StartSearch:
|
||||
; Now we must get the first cluster of the root directory
|
||||
mov eax,DWORD [BYTE bp+RootDirStartCluster]
|
||||
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
|
||||
jb ContinueSearch ; If not continue, if so then we didn't find freeldr.sys
|
||||
jmp PrintFileNotFound
|
||||
mov eax,DWORD [BYTE bp+RootDirStartCluster]
|
||||
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
|
||||
jb ContinueSearch ; If not continue, if so then we didn't find freeldr.sys
|
||||
jmp PrintFileNotFound
|
||||
ContinueSearch:
|
||||
mov bx,2000h
|
||||
mov es,bx ; Read cluster to [2000:0000h]
|
||||
mov es,bx ; Read cluster to [2000:0000h]
|
||||
call ReadCluster ; Read the cluster
|
||||
|
||||
|
||||
; Now we have to find our way through the root directory to
|
||||
; The FREELDR.SYS file
|
||||
xor bx,bx
|
||||
; The OSLOADER.SYS file
|
||||
xor bx,bx
|
||||
mov bl,[BYTE bp+SectsPerCluster]
|
||||
shl bx,4 ; BX = BX * 512 / 32
|
||||
mov ax,2000h ; We loaded at 2000:0000
|
||||
shl bx,4 ; BX = BX * 512 / 32
|
||||
mov ax,2000h ; We loaded at 2000:0000
|
||||
mov es,ax
|
||||
xor di,di
|
||||
mov si,filename
|
||||
@@ -328,163 +326,164 @@ FindFile:
|
||||
add ax,2 ; So lets move to the next one
|
||||
mov es,ax ; And search again
|
||||
xor di,di
|
||||
mov si,filename
|
||||
mov si,filename
|
||||
mov cx,11
|
||||
rep cmpsb ; Compare filenames
|
||||
jz FoundFile ; If same we found it
|
||||
dec bx ; Keep searching till we run out of dir entries
|
||||
jnz FindFile ; Last entry?
|
||||
|
||||
; Get the next root dir cluster and try again until we run out of clusters
|
||||
mov eax,DWORD [BYTE bp+RootDirStartCluster]
|
||||
call GetFatEntry
|
||||
mov [BYTE bp+RootDirStartCluster],eax
|
||||
; Get the next root dir cluster and try again until we run out of clusters
|
||||
mov eax,DWORD [BYTE bp+RootDirStartCluster]
|
||||
call GetFatEntry
|
||||
mov [BYTE bp+RootDirStartCluster],eax
|
||||
jmp StartSearch
|
||||
|
||||
FoundFile:
|
||||
; Display "Loading FreeLoader..." message
|
||||
mov si,msgLoading ; Loading message
|
||||
call PutChars ; Display it
|
||||
|
||||
xor di,di ; ES:DI has dir entry
|
||||
; Display "Loading FreeLoader..." message
|
||||
mov si,msgLoading ; Loading message
|
||||
call PutChars ; Display it
|
||||
|
||||
xor di,di ; ES:DI has dir entry
|
||||
xor dx,dx
|
||||
mov ax,WORD [es:di+14h] ; Get start cluster high word
|
||||
shl eax,16
|
||||
shl eax,16
|
||||
mov ax,WORD [es:di+1ah] ; Get start cluster low word
|
||||
|
||||
CheckStartCluster:
|
||||
cmp eax,2 ; Check and see if the start cluster starts at cluster 2 or above
|
||||
jnb CheckEndCluster ; If so then continue
|
||||
jmp PrintFileSystemError ; If not exit with error
|
||||
cmp eax,2 ; Check and see if the start cluster starts at cluster 2 or above
|
||||
jnb CheckEndCluster ; If so then continue
|
||||
jmp PrintFileSystemError ; If not exit with error
|
||||
CheckEndCluster:
|
||||
cmp eax,0ffffff8h ; Check and see if the start cluster is and end of cluster chain indicator
|
||||
jb InitializeLoadSegment ; If not then continue
|
||||
jmp PrintFileSystemError ; If so exit with error
|
||||
cmp eax,0ffffff8h ; Check and see if the start cluster is and end of cluster chain indicator
|
||||
jb InitializeLoadSegment ; If not then continue
|
||||
jmp PrintFileSystemError ; If so exit with error
|
||||
|
||||
InitializeLoadSegment:
|
||||
mov bx,0F80h ; FREELDR_BASE / 16
|
||||
mov bx,800h
|
||||
mov es,bx
|
||||
|
||||
LoadFile:
|
||||
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
|
||||
jae LoadFileDone ; If so continue, if not then read the next one
|
||||
push eax
|
||||
xor bx,bx ; Load ROSLDR starting at 0000:F800h
|
||||
push es
|
||||
call ReadCluster
|
||||
pop es
|
||||
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
|
||||
jae LoadFileDone ; If so continue, if not then read the next one
|
||||
push eax
|
||||
xor bx,bx ; Load ROSLDR starting at 0000:8000h
|
||||
push es
|
||||
call ReadCluster
|
||||
pop es
|
||||
|
||||
xor bx,bx
|
||||
xor bx,bx
|
||||
mov bl,[BYTE bp+SectsPerCluster]
|
||||
shl bx,5 ; BX = BX * 512 / 16
|
||||
mov ax,es ; Increment the load address by
|
||||
add ax,bx ; The size of a cluster
|
||||
mov es,ax
|
||||
shl bx,5 ; BX = BX * 512 / 16
|
||||
mov ax,es ; Increment the load address by
|
||||
add ax,bx ; The size of a cluster
|
||||
mov es,ax
|
||||
|
||||
pop eax
|
||||
push es
|
||||
call GetFatEntry ; Get the next entry
|
||||
pop es
|
||||
pop eax
|
||||
push es
|
||||
call GetFatEntry ; Get the next entry
|
||||
pop es
|
||||
|
||||
jmp LoadFile ; Load the next cluster (if any)
|
||||
jmp LoadFile ; Load the next cluster (if any)
|
||||
|
||||
LoadFileDone:
|
||||
mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL
|
||||
mov dh,[BootPartition] ; Load boot partition into DH
|
||||
mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL
|
||||
mov dh,[BootPartition] ; Load boot partition into DH
|
||||
|
||||
; Transfer execution to the bootloader
|
||||
;ljmp16 0, FREELDR_BASE
|
||||
db 0EAh
|
||||
dw 0F800h
|
||||
dw 0
|
||||
push 0 ; push segment (0x0000)
|
||||
mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
|
||||
add eax, 0x8000 ; RVA -> VA
|
||||
push ax ; push offset
|
||||
retf ; Transfer control to FreeLoader
|
||||
|
||||
; Returns the FAT entry for a given cluster number
|
||||
; On entry EAX has cluster number
|
||||
; On return EAX has FAT entry for that cluster
|
||||
GetFatEntry:
|
||||
|
||||
shl eax,2 ; EAX = EAX * 4 (since FAT32 entries are 4 bytes)
|
||||
mov ecx,eax ; Save this for later in ECX
|
||||
xor edx,edx
|
||||
movzx ebx,WORD [BYTE bp+BytesPerSector]
|
||||
push ebx
|
||||
div ebx ; FAT Sector Number = EAX / BytesPerSector
|
||||
movzx ebx,WORD [BYTE bp+ReservedSectors]
|
||||
add eax,ebx ; FAT Sector Number += ReservedSectors
|
||||
mov ebx,DWORD [BYTE bp+HiddenSectors]
|
||||
add eax,ebx ; FAT Sector Number += HiddenSectors
|
||||
pop ebx
|
||||
dec ebx
|
||||
and ecx,ebx ; FAT Offset Within Sector = ECX % BytesPerSector
|
||||
; EAX holds logical FAT sector number
|
||||
; ECX holds FAT entry offset
|
||||
shl eax,2 ; EAX = EAX * 4 (since FAT32 entries are 4 bytes)
|
||||
mov ecx,eax ; Save this for later in ECX
|
||||
xor edx,edx
|
||||
movzx ebx,WORD [BYTE bp+BytesPerSector]
|
||||
push ebx
|
||||
div ebx ; FAT Sector Number = EAX / BytesPerSector
|
||||
movzx ebx,WORD [BYTE bp+ReservedSectors]
|
||||
add eax,ebx ; FAT Sector Number += ReservedSectors
|
||||
mov ebx,DWORD [BYTE bp+HiddenSectors]
|
||||
add eax,ebx ; FAT Sector Number += HiddenSectors
|
||||
pop ebx
|
||||
dec ebx
|
||||
and ecx,ebx ; FAT Offset Within Sector = ECX % BytesPerSector
|
||||
; EAX holds logical FAT sector number
|
||||
; ECX holds FAT entry offset
|
||||
|
||||
; Now we have to check the extended flags
|
||||
; to see which FAT is the active one
|
||||
; and use it, or if they are mirrored then
|
||||
; no worries
|
||||
movzx ebx,WORD [BYTE bp+ExtendedFlags] ; Get extended flags and put into ebx
|
||||
and bx,0x0f ; Mask off upper 8 bits, now we have active fat in bl
|
||||
jz LoadFatSector ; If fat is mirrored then skip fat calcs
|
||||
cmp bl,[BYTE bp+NumberOfFats] ; Compare bl to number of fats
|
||||
jb GetActiveFatOffset
|
||||
jmp PrintFileSystemError ; If bl is bigger than numfats exit with error
|
||||
; Now we have to check the extended flags
|
||||
; to see which FAT is the active one
|
||||
; and use it, or if they are mirrored then
|
||||
; no worries
|
||||
movzx ebx,WORD [BYTE bp+ExtendedFlags] ; Get extended flags and put into ebx
|
||||
and bx,0x0f ; Mask off upper 8 bits, now we have active fat in bl
|
||||
jz LoadFatSector ; If fat is mirrored then skip fat calcs
|
||||
cmp bl,[BYTE bp+NumberOfFats] ; Compare bl to number of fats
|
||||
jb GetActiveFatOffset
|
||||
jmp PrintFileSystemError ; If bl is bigger than numfats exit with error
|
||||
GetActiveFatOffset:
|
||||
push eax ; Save logical FAT sector number
|
||||
mov eax,[BYTE bp+SectorsPerFatBig] ; Get the number of sectors occupied by one fat in eax
|
||||
mul ebx ; Multiplied by the active FAT index we have in ebx
|
||||
pop edx ; Get logical FAT sector number
|
||||
add eax,edx ; Add the current FAT sector offset
|
||||
push eax ; Save logical FAT sector number
|
||||
mov eax,[BYTE bp+SectorsPerFatBig] ; Get the number of sectors occupied by one fat in eax
|
||||
mul ebx ; Multiplied by the active FAT index we have in ebx
|
||||
pop edx ; Get logical FAT sector number
|
||||
add eax,edx ; Add the current FAT sector offset
|
||||
|
||||
LoadFatSector:
|
||||
push ecx
|
||||
push ecx
|
||||
; EAX holds logical FAT sector number
|
||||
; Check if we have already loaded it
|
||||
cmp eax,DWORD [FatSectorInCache]
|
||||
je LoadFatSectorAlreadyLoaded
|
||||
|
||||
mov bx, 9000h ; We will load it to [9000:0000h]
|
||||
mov es, bx
|
||||
|
||||
; EAX holds logical FAT sector number
|
||||
; Check if we have already loaded it
|
||||
cmp eax,DWORD [FatSectorInCache]
|
||||
je LoadFatSectorAlreadyLoaded
|
||||
|
||||
mov DWORD [FatSectorInCache],eax
|
||||
xor bx,bx
|
||||
mov cx,1
|
||||
call ReadSectors
|
||||
mov DWORD [FatSectorInCache],eax
|
||||
mov bx,9000h
|
||||
mov es,bx
|
||||
xor bx,bx ; We will load it to [9000:0000h]
|
||||
mov cx,1
|
||||
call ReadSectors
|
||||
|
||||
LoadFatSectorAlreadyLoaded:
|
||||
pop ecx
|
||||
mov eax,DWORD [es:ecx] ; Get FAT entry
|
||||
and eax,0fffffffh ; Mask off reserved bits
|
||||
mov bx,9000h
|
||||
mov es,bx
|
||||
pop ecx
|
||||
mov eax,DWORD [es:ecx] ; Get FAT entry
|
||||
and eax,0fffffffh ; Mask off reserved bits
|
||||
|
||||
ret
|
||||
ret
|
||||
|
||||
FatSectorInCache: ; This variable tells us which sector we currently have in memory
|
||||
dd 0ffffffffh ; There is no need to re-read the same sector if we don't have to
|
||||
FatSectorInCache: ; This variable tells us which sector we currently have in memory
|
||||
dd 0ffffffffh ; There is no need to re-read the same sector if we don't have to
|
||||
|
||||
|
||||
; Reads cluster number in EAX into [ES:0000]
|
||||
ReadCluster:
|
||||
; StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
; StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
|
||||
|
||||
dec eax
|
||||
dec eax
|
||||
xor edx,edx
|
||||
movzx ebx,BYTE [BYTE bp+SectsPerCluster]
|
||||
mul ebx
|
||||
push eax
|
||||
xor edx,edx
|
||||
movzx eax,BYTE [BYTE bp+NumberOfFats]
|
||||
mul DWORD [BYTE bp+SectorsPerFatBig]
|
||||
movzx ebx,WORD [BYTE bp+ReservedSectors]
|
||||
add eax,ebx
|
||||
add eax,DWORD [BYTE bp+HiddenSectors]
|
||||
pop ebx
|
||||
add eax,ebx ; EAX now contains the logical sector number of the cluster
|
||||
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
||||
movzx cx,BYTE [BYTE bp+SectsPerCluster]
|
||||
call ReadSectors
|
||||
ret
|
||||
dec eax
|
||||
dec eax
|
||||
xor edx,edx
|
||||
movzx ebx,BYTE [BYTE bp+SectsPerCluster]
|
||||
mul ebx
|
||||
push eax
|
||||
xor edx,edx
|
||||
movzx eax,BYTE [BYTE bp+NumberOfFats]
|
||||
mul DWORD [BYTE bp+SectorsPerFatBig]
|
||||
movzx ebx,WORD [BYTE bp+ReservedSectors]
|
||||
add eax,ebx
|
||||
add eax,DWORD [BYTE bp+HiddenSectors]
|
||||
pop ebx
|
||||
add eax,ebx ; EAX now contains the logical sector number of the cluster
|
||||
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
|
||||
movzx cx,BYTE [BYTE bp+SectsPerCluster]
|
||||
call ReadSectors
|
||||
ret
|
||||
|
||||
|
||||
; Displays a file not found error message
|
||||
@@ -495,7 +494,7 @@ PrintFileNotFound:
|
||||
mov si,msgAnyKey ; Press any key message
|
||||
call PutChars ; Display it
|
||||
|
||||
jmp Reboot
|
||||
jmp Reboot
|
||||
|
||||
msgFreeLdr db 'freeldr.sys not found',0dh,0ah,0
|
||||
filename db 'FREELDR SYS'
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Bootsector
|
||||
* FILE: boot/freeldr/bootsect/faty.S
|
||||
* PURPOSE: Combined FAT12, FAT16 and FAT32 boot sector
|
||||
* FILE: boot/freeldr/bootsect/fatx.S
|
||||
* PURPOSE: Combined FAT16 and FAT32 boot sector
|
||||
* PROGRAMMERS: Brian Palmer
|
||||
* Timo Kreuzer
|
||||
*/
|
||||
@@ -64,8 +64,7 @@ PutCharsOffset = BootSectorStackTop + 20 /* word */
|
||||
******************************************************************************/
|
||||
/* We have 3 bytes at the entry point to jump over the data area */
|
||||
start:
|
||||
jmp short main // FIXME: When compiling FAT32, assembler will complain
|
||||
// that the label is too far... Need investigation!
|
||||
jmp short main
|
||||
nop
|
||||
|
||||
/* Here starts the BIOS Parameter Block (BPB) data.
|
||||
@@ -112,7 +111,7 @@ FSInfoSector:
|
||||
BackupBootSector:
|
||||
.word 6
|
||||
Reserved1:
|
||||
.space 12, 0
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
#endif // FAT32
|
||||
|
||||
BootDrive:
|
||||
@@ -234,8 +233,8 @@ main:
|
||||
add eax, dword ptr BP_REL(HiddenSectors)
|
||||
|
||||
/* Load sector count into ecx */
|
||||
#ifdef FAT32
|
||||
mov ecx, dword ptr BP_REL(SectorsPerFatBig)
|
||||
#if FAT32
|
||||
mov ecx, BP_REL(SectorsPerFatBig)
|
||||
#else
|
||||
movzx ecx, word ptr BP_REL(SectorsPerFat)
|
||||
#endif
|
||||
@@ -351,7 +350,7 @@ main:
|
||||
dec dx
|
||||
jnz .CheckDirEntry
|
||||
|
||||
#ifdef FAT32
|
||||
#if FAT32
|
||||
/* Check to see if this was the last cluster in the chain */
|
||||
cmp eax, HEX(0ffffff8)
|
||||
jnb BootFailure
|
||||
@@ -368,7 +367,7 @@ main:
|
||||
.FoundFreeLoader:
|
||||
|
||||
/* Load the cluster number of freeldr into eax */
|
||||
#ifdef FAT32
|
||||
#if FAT32
|
||||
#error unsupported
|
||||
#else
|
||||
movzx eax, word ptr es:[bx + HEX(1A)]
|
||||
@@ -385,9 +384,9 @@ main:
|
||||
call ReadCluster
|
||||
|
||||
/* Check if this is the last cluster in the chain */
|
||||
#if defined(FAT32)
|
||||
#if FAT32
|
||||
cmp eax, HEX(0ffffff8)
|
||||
#elif defined(FAT12)
|
||||
#elif FAT12
|
||||
cmp ax, HEX(0ff8)
|
||||
#else
|
||||
cmp ax, HEX(0fff8)
|
||||
@@ -454,9 +453,9 @@ ReadCluster:
|
||||
/* Save ES */
|
||||
push es
|
||||
|
||||
#if defined(FAT32)
|
||||
#error FAT32 not implemented
|
||||
#elif defined(FAT12)
|
||||
#if FAT32
|
||||
#error FAT23 not implemented
|
||||
#elif FAT12
|
||||
#error FAT12 not implemented
|
||||
#else
|
||||
/* DX:AX = AX * 2 (since FAT16 entries are 2 bytes) */
|