https://git.reactos.org/?p=reactos.git;a=commitdiff;h=04b2d35f5b7372578891d…
commit 04b2d35f5b7372578891d1d455ca5e0e669d7644
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Nov 3 02:34:20 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Nov 16 21:55:23 2022 +0100
[SYSDM] Improvements for the Paging File settings dialog. (#4844)
- Implement the architecture-specific pagefile size limits.
In particular, verify that the selected volume on which to create
the page file can accomodate the theoretical maximum limit (e.g.
FAT32 cannot accomodate a 16 TB pagefile on x64, and the limit must
be lowered down to 4 GB).
- Change the IDS_WARNINITIALRANGE and IDS_WARNMAXIMUMRANGE strings
so that the maximum limit mentioned is the dynamic one.
- Review, improve and fix other aspects of the code.
Parts of this PR: addendum to commits 4d2d2dbb2 (#2597), 3bee3b92a (#2706).
---
dll/cpl/sysdm/lang/bg-BG.rc | 6 +-
dll/cpl/sysdm/lang/cs-CZ.rc | 6 +-
dll/cpl/sysdm/lang/da-DK.rc | 10 +-
dll/cpl/sysdm/lang/de-DE.rc | 6 +-
dll/cpl/sysdm/lang/el-GR.rc | 10 +-
dll/cpl/sysdm/lang/en-US.rc | 35 +++-
dll/cpl/sysdm/lang/es-ES.rc | 6 +-
dll/cpl/sysdm/lang/fr-FR.rc | 8 +-
dll/cpl/sysdm/lang/he-IL.rc | 10 +-
dll/cpl/sysdm/lang/hu-HU.rc | 6 +-
dll/cpl/sysdm/lang/id-ID.rc | 6 +-
dll/cpl/sysdm/lang/it-IT.rc | 6 +-
dll/cpl/sysdm/lang/ja-JP.rc | 6 +-
dll/cpl/sysdm/lang/nl-NL.rc | 10 +-
dll/cpl/sysdm/lang/no-NO.rc | 10 +-
dll/cpl/sysdm/lang/pl-PL.rc | 6 +-
dll/cpl/sysdm/lang/pt-PT.rc | 6 +-
dll/cpl/sysdm/lang/ro-RO.rc | 6 +-
dll/cpl/sysdm/lang/ru-RU.rc | 6 +-
dll/cpl/sysdm/lang/sk-SK.rc | 10 +-
dll/cpl/sysdm/lang/sq-AL.rc | 6 +-
dll/cpl/sysdm/lang/sv-SE.rc | 10 +-
dll/cpl/sysdm/lang/tr-TR.rc | 6 +-
dll/cpl/sysdm/lang/uk-UA.rc | 6 +-
dll/cpl/sysdm/lang/zh-CN.rc | 6 +-
dll/cpl/sysdm/lang/zh-HK.rc | 6 +-
dll/cpl/sysdm/lang/zh-TW.rc | 6 +-
dll/cpl/sysdm/virtmem.c | 418 +++++++++++++++++++++++++++-----------------
28 files changed, 384 insertions(+), 255 deletions(-)
diff --git a/dll/cpl/sysdm/lang/bg-BG.rc b/dll/cpl/sysdm/lang/bg-BG.rc
index fe3b465d528..72469e59eb3 100644
--- a/dll/cpl/sysdm/lang/bg-BG.rc
+++ b/dll/cpl/sysdm/lang/bg-BG.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Приложение за таблото за управление на уредбата"
IDS_WARNINITIALSIZE "Въведете числена стойност за началния размер на страниращия файл."
IDS_WARNMAXIMUMSIZE "Въведете числена стойност за върховия размер на страниращия файл."
- IDS_WARNINITIALRANGE "Началният размер на страниращия файл не трябва да е по-малък от 2 МБ и не трябва да надхвърля свободното пространство на избраното устройство."
- IDS_WARNMAXIMUMRANGE "Върховият размер на страниращия файл не трябва да е по-малък от началния и не трябва да надвишава свободното пространство на избраното устройство"
- IDS_PAGEFILE_MB "%u МБ"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu МБ"
IDS_PAGEFILE_NONE "Няма"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/cs-CZ.rc b/dll/cpl/sysdm/lang/cs-CZ.rc
index 2d576382719..a2cfa5ab364 100644
--- a/dll/cpl/sysdm/lang/cs-CZ.rc
+++ b/dll/cpl/sysdm/lang/cs-CZ.rc
@@ -361,9 +361,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Systémový aplet kontrolních panelů"
IDS_WARNINITIALSIZE "Zadejte číselnou hodnotu pro počáteční velikost stránkovacího souboru."
IDS_WARNMAXIMUMSIZE "Zadejte číselnou hodnotu pro maximální velikost stránkovacího souboru."
- IDS_WARNINITIALRANGE "Počáteční velikost stránkovacího souboru nesmí být menší než 2 MB a nesmí překročit množství volného místa na zvolené diskové jednotce."
- IDS_WARNMAXIMUMRANGE "Maximální velikost stránkovacího souboru nesmí být menší než velikost počáteční, nesmí být větší než 4095 MB a nesmí překročit množství volného místa na zvolené diskové jednotce."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Není"
IDS_PAGEFILE_SYSTEM "Spravováno systémem"
IDS_INFOREBOOT "Změny se projeví po restartování počítače."
diff --git a/dll/cpl/sysdm/lang/da-DK.rc b/dll/cpl/sysdm/lang/da-DK.rc
index 88218228efd..4cb16a08931 100644
--- a/dll/cpl/sysdm/lang/da-DK.rc
+++ b/dll/cpl/sysdm/lang/da-DK.rc
@@ -354,11 +354,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "None"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/de-DE.rc b/dll/cpl/sysdm/lang/de-DE.rc
index dc683b139fb..a76aef59525 100644
--- a/dll/cpl/sysdm/lang/de-DE.rc
+++ b/dll/cpl/sysdm/lang/de-DE.rc
@@ -365,9 +365,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Systemsteuerungsoption ""System"""
IDS_WARNINITIALSIZE "Geben Sie einen numerischen Wert für die Anfangsgröße der Auslagerungsdatei an."
IDS_WARNMAXIMUMSIZE "Geben Sie einen numerischen Wert für die Maximalgröße der Auslagerungsdatei an."
- IDS_WARNINITIALRANGE "Die Anfangsgröße der Auslagerungsdatei darf nicht kleiner als 2 MB sein und darf den verfügbaren Speicherplatz auf dem gewählten Laufwerk nicht überschreiten."
- IDS_WARNMAXIMUMRANGE "Die Maximalgröße der Auslagerungsdatei darf nicht kleiner als die Anfangsgröße sein und darf den verfügbaren Speicherplatz auf dem gewählten Laufwerk nicht überschreiten."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "Die Anfangsgröße der Auslagerungsdatei muss zwischen 2 MB und %lu MB auf dem gewählten Laufwerk sein."
+ IDS_WARNMAXIMUMRANGE "Die Maximalgröße der Auslagerungsdatei darf nicht kleiner als die Anfangsgröße sein, und muss kleiner als %lu MB auf dem gewählten Laufwerk sein."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Keine"
IDS_PAGEFILE_SYSTEM "Systemverwaltet"
IDS_INFOREBOOT "Sie müssen den Computer neu starten, damit die Änderung wirksam wird."
diff --git a/dll/cpl/sysdm/lang/el-GR.rc b/dll/cpl/sysdm/lang/el-GR.rc
index 6a2b373b257..04b12dab3cf 100644
--- a/dll/cpl/sysdm/lang/el-GR.rc
+++ b/dll/cpl/sysdm/lang/el-GR.rc
@@ -354,11 +354,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Κανένα"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/en-US.rc b/dll/cpl/sysdm/lang/en-US.rc
index 185b7f773be..68fe830aa2e 100644
--- a/dll/cpl/sysdm/lang/en-US.rc
+++ b/dll/cpl/sysdm/lang/en-US.rc
@@ -354,11 +354,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "None"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
@@ -371,3 +371,28 @@ BEGIN
IDS_ENVIRONMENT_WARNING_TITLE "System Properties"
IDS_FILE_BROWSE_FILTER "All Files (*.*)\0*.*\0"
END
+
+/*
+ * Couple of other strings for PageFile support that may be useful later:
+
+"ReactOS created a temporary paging file on your computer because of a problem that occurred with your paging file configuration when you started your computer. The total paging file size for all disk drives may be somewhat larger than the size you specified."
+
+"You are not logged onto ReactOS as a member of the user group that has the right to view the workstation's Virtual Memory settings."
+
+"There is not enough space on this drive for the paging file size specified. Please enter a smaller number or free some disk space."
+
+"Drive %c: is too small for the maximum paging file size specified. Please enter a smaller number."
+
+"Could not read the current virtual memory settings."
+
+"Drive %c: does not have enough free space for the maximum paging file size specified. If you continue with this setting, the paging file will only grow to the size of the available free space."
+
+"Another file exists with the filename \"%s\". Do you wish to overwrite the existing file with a page file?"
+
+"There is not enough space on this drive to create the page file size specified. At least %d MB of free disk space must be left after the page file is created. Specify a smaller page file size or free some disk space."
+
+"If the pagefile on volume %c: has an initial size of less than %d MB, then the system may not be able to create a debugging information file if a STOP error occurs. Continue anyway?"
+
+"Unable to determine the current paging file size. The value reported as the current paging file size may be incorrect."
+
+ */
diff --git a/dll/cpl/sysdm/lang/es-ES.rc b/dll/cpl/sysdm/lang/es-ES.rc
index 509ec172624..d3551fe5009 100644
--- a/dll/cpl/sysdm/lang/es-ES.rc
+++ b/dll/cpl/sysdm/lang/es-ES.rc
@@ -358,9 +358,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Applet de sistema del Panel de control"
IDS_WARNINITIALSIZE "Introduzca el tamaño inicial del archivo de paginación."
IDS_WARNMAXIMUMSIZE "Introduzca el tamaño máximo del archivo de paginación."
- IDS_WARNINITIALRANGE "El tamaño inicial del archivo de paginación no puede ser inferior a 2 MB y no puede exceder el espacio disponible en la unidad seleccionada."
- IDS_WARNMAXIMUMRANGE "El tamaño máximo del archivo de paginación no puede ser inferior al tamaño inicial y no puede exceder el espacio disponible en la unidad seleccionada."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Ninguno"
IDS_PAGEFILE_SYSTEM "Administrado por el sistema"
IDS_INFOREBOOT "Es necesario reiniciar el equipo para que se apliquen los cambios."
diff --git a/dll/cpl/sysdm/lang/fr-FR.rc b/dll/cpl/sysdm/lang/fr-FR.rc
index cd959c56c09..0f6123c05ba 100644
--- a/dll/cpl/sysdm/lang/fr-FR.rc
+++ b/dll/cpl/sysdm/lang/fr-FR.rc
@@ -356,14 +356,14 @@ BEGIN
IDS_MESSAGEBOXTITLE "Application Système du Panneau de configuration"
IDS_WARNINITIALSIZE "Entrez une valeur numérique pour la taille initiale du fichier d'échange."
IDS_WARNMAXIMUMSIZE "Entrez une valeur numérique pour la taille maximale du fichier d'échange."
- IDS_WARNINITIALRANGE "La taille initiale du fichier d'échange doit être comprise entre 2 Mo et 4096 Mo, et ne peut pas excéder la quantité d'espace libre sur le lecteur que vous avez sélectionné."
- IDS_WARNMAXIMUMRANGE "Entrez une valeur pour la taille maximale du fichier d'échange qui soit supérieure ou égale à la taille initiale du fichier d'échange, et inférieure à 4096 Mo."
- IDS_PAGEFILE_MB "%u Mo"
+ IDS_WARNINITIALRANGE "La taille initiale du fichier d'échange doit être comprise entre 2 Mo et %lu Mo sur le lecteur sélectionné."
+ IDS_WARNMAXIMUMRANGE "La taille maximale du fichier d'échange doit être supérieure ou égale à sa taille initiale, et inférieure à %lu Mo sur le lecteur sélectionné."
+ IDS_PAGEFILE_MB "%lu Mo"
IDS_PAGEFILE_NONE "Aucun"
IDS_PAGEFILE_SYSTEM "Géré par le système"
IDS_INFOREBOOT "Vous devez redémarrer le système pour appliquer les changements."
IDS_HWPROFILE_CONFIRM_DELETE_TITLE "Confirmation de suppression"
- IDS_HWPROFILE_CONFIRM_DELETE "Êtes-vous sûre de vouloir supprimer le profil matériel ""%s"" ?"
+ IDS_HWPROFILE_CONFIRM_DELETE "Êtes-vous sûr de vouloir supprimer le profil matériel ""%s"" ?"
IDS_HWPROFILE_ALREADY_IN_USE "Le nom de profil est déjà utilisé."
IDS_HWPROFILE_PROFILE "Profil"
IDS_HWPROFILE_WARNING "Attention"
diff --git a/dll/cpl/sysdm/lang/he-IL.rc b/dll/cpl/sysdm/lang/he-IL.rc
index 07be45209ec..a846116a434 100644
--- a/dll/cpl/sysdm/lang/he-IL.rc
+++ b/dll/cpl/sysdm/lang/he-IL.rc
@@ -356,11 +356,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "ללא"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/hu-HU.rc b/dll/cpl/sysdm/lang/hu-HU.rc
index 1e679a92e7d..8af6e8d0ed8 100644
--- a/dll/cpl/sysdm/lang/hu-HU.rc
+++ b/dll/cpl/sysdm/lang/hu-HU.rc
@@ -358,9 +358,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Rendszer kezelőpanel"
IDS_WARNINITIALSIZE "Adjon meg egy számértéket a lapozófájl kezdeti méretének."
IDS_WARNMAXIMUMSIZE "Adjon meg egy számértéket a lapozófájl maximális méretének."
- IDS_WARNINITIALRANGE "A lapozófájl kezdeti mérete nem lehet kisebb mint 2 MB, nem lehet nagyobb mint 4095 MB és nem haladhatja meg a kijelölt meghajtón rendelkezésre álló szabad helyet."
- IDS_WARNMAXIMUMRANGE "A lapozófájl maximális mérete nem lehet kisebb mint a kezdeti mérete, nem lehet nagyobb mint 4095 MB és nem haladhatja meg a kijelölt meghajtón rendelkezésre álló szabad helyet."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "nincs"
IDS_PAGEFILE_SYSTEM "Rendszer által kezelt"
IDS_INFOREBOOT "A változtatások életbe lépéséhez újra kell indítania a számítógépet."
diff --git a/dll/cpl/sysdm/lang/id-ID.rc b/dll/cpl/sysdm/lang/id-ID.rc
index bbd73c52329..6387fc065c8 100644
--- a/dll/cpl/sysdm/lang/id-ID.rc
+++ b/dll/cpl/sysdm/lang/id-ID.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Applet panel kontrol sistem"
IDS_WARNINITIALSIZE "Masukkan nilai numerik untuk ukuran awal halaman berkas."
IDS_WARNMAXIMUMSIZE "Masukkan nilai numerik untuk ukuran maksimum halaman berkas."
- IDS_WARNINITIALRANGE "Ukuran awal halaman berkas tidak boleh lebih kecil dari 2 MB dan tidak boleh melebihi ruang yang tersedia pada drive yang dipilih."
- IDS_WARNMAXIMUMRANGE "Ukuran maksimum halaman berkas tidak boleh lebih kecil dari ukuran awal, maupun lebih besar dari 4095 MB dan tidak boleh melebihi ruang yang tersedia pada drive yang dipilih."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "Ukuran awal halaman berkas tidak boleh lebih kecil dari 2 MB dan %lu MB pada drive yang dipilih."
+ IDS_WARNMAXIMUMRANGE "Ukuran maksimum halaman berkas harus lebih besar atau sama persis dari ukuran awal, dan kurang dari %lu MB pada drive yang dipilih."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Tidak ada"
IDS_PAGEFILE_SYSTEM "Diatur Sistem"
IDS_INFOREBOOT "Anda harus memulai ulang komputer untuk menerapkan perubahan."
diff --git a/dll/cpl/sysdm/lang/it-IT.rc b/dll/cpl/sysdm/lang/it-IT.rc
index e4847fce032..5eba295a4f9 100644
--- a/dll/cpl/sysdm/lang/it-IT.rc
+++ b/dll/cpl/sysdm/lang/it-IT.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Applet di sistema del pannello di controllo"
IDS_WARNINITIALSIZE "Immettere la dimensione iniziale del file di paging."
IDS_WARNMAXIMUMSIZE "Immettere la dimensione massima del file di paging."
- IDS_WARNINITIALRANGE "La dimensione iniziale del file di paging non può essere inferiore a 2 MB e non può superare lo spazio disponibile nell'unità selezionata."
- IDS_WARNMAXIMUMRANGE "La dimensione massima del file di paging non può essere inferiore a quella iniziale e non può superare lo spazio disponibile nell'unità selezionata."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "None"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/ja-JP.rc b/dll/cpl/sysdm/lang/ja-JP.rc
index 702b922ea20..a3dbe2818f8 100644
--- a/dll/cpl/sysdm/lang/ja-JP.rc
+++ b/dll/cpl/sysdm/lang/ja-JP.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "システム コントロール パネル アプレット"
IDS_WARNINITIALSIZE "ページングファイルの初期サイズの数値を入力して下さい。"
IDS_WARNMAXIMUMSIZE "ページングファイルの最大サイズの数値を入力して下さい。"
- IDS_WARNINITIALRANGE "ページングファイルの初期サイズは2 MB以上でなければなりません。また、選択中のドライブの利用可能なサイズを超えてはいけません。"
- IDS_WARNMAXIMUMRANGE "ページングファイルの最大サイズは初期サイズ以上でなければなりません。また、4095 MB か選択中のドライブの利用可能なサイズを超えてはいけません。"
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "なし"
IDS_PAGEFILE_SYSTEM "システム管理"
IDS_INFOREBOOT "変更を適用するには、コンピュータを再起動する必要があります。"
diff --git a/dll/cpl/sysdm/lang/nl-NL.rc b/dll/cpl/sysdm/lang/nl-NL.rc
index 97b0b41b050..5ea78163666 100644
--- a/dll/cpl/sysdm/lang/nl-NL.rc
+++ b/dll/cpl/sysdm/lang/nl-NL.rc
@@ -354,11 +354,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "None"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/no-NO.rc b/dll/cpl/sysdm/lang/no-NO.rc
index c34edcab505..1a15da46310 100644
--- a/dll/cpl/sysdm/lang/no-NO.rc
+++ b/dll/cpl/sysdm/lang/no-NO.rc
@@ -354,11 +354,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Ingen"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/pl-PL.rc b/dll/cpl/sysdm/lang/pl-PL.rc
index e796f33f771..e786ca11c45 100644
--- a/dll/cpl/sysdm/lang/pl-PL.rc
+++ b/dll/cpl/sysdm/lang/pl-PL.rc
@@ -365,9 +365,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "System"
IDS_WARNINITIALSIZE "Wprowadź wielkość dla początkowego rozmiaru pliku stronicowania."
IDS_WARNMAXIMUMSIZE "Wprowadź wielkość dla maksymalnego rozmiaru pliku stronicowania."
- IDS_WARNINITIALRANGE "Początkowy rozmiar pliku stronicowania nie może być mniejszy niż 2 MB i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie."
- IDS_WARNMAXIMUMRANGE "Maksymalny rozmiar pliku stronicowania nie może być mniejszy niż jego rozmiar początkowy i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Brak"
IDS_PAGEFILE_SYSTEM "Kontrolowany przez system"
IDS_INFOREBOOT "Musisz ponownie uruchomić komputer, aby zastosować zmiany."
diff --git a/dll/cpl/sysdm/lang/pt-PT.rc b/dll/cpl/sysdm/lang/pt-PT.rc
index 06c448f9c07..eaa654a6b91 100644
--- a/dll/cpl/sysdm/lang/pt-PT.rc
+++ b/dll/cpl/sysdm/lang/pt-PT.rc
@@ -360,9 +360,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Aplicação do painel de controle do sistema"
IDS_WARNINITIALSIZE "Digite um valor numérico para o tamanho inicial do arquivo de paginação."
IDS_WARNMAXIMUMSIZE "Digite um valor numérico para o tamanho máximo do arquivo de paginação."
- IDS_WARNINITIALRANGE "O tamanho inicial do arquivo de paginação não deve ser menor que 2 MB e não deve exceder o espaço disponível na unidade seleccionada."
- IDS_WARNMAXIMUMRANGE "O tamanho máximo do arquivo de paginação não deve ser menor que o tamanho inicial, não deve ser maior que 4095 MB e não deve exceder o espaço disponível na unidade seleccionada."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Nenhum"
IDS_PAGEFILE_SYSTEM "Gerenciado pelo sistema"
IDS_INFOREBOOT "Precisa reiniciar o computador para aplicar as alterações."
diff --git a/dll/cpl/sysdm/lang/ro-RO.rc b/dll/cpl/sysdm/lang/ro-RO.rc
index 7628a16592c..b2ec0483bf0 100644
--- a/dll/cpl/sysdm/lang/ro-RO.rc
+++ b/dll/cpl/sysdm/lang/ro-RO.rc
@@ -365,9 +365,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Specificare valori de sistem"
IDS_WARNINITIALSIZE "Introduceți o valoare numerică pentru dimensiunea inițială a fișierului de paginare."
IDS_WARNMAXIMUMSIZE "Introduceți o valoare numerică pentru dimensiunea maximă a fișierului de paginare."
- IDS_WARNINITIALRANGE "Dimensiunea inițială a fișierului de paginare trebuie să fie încadrată între 2 Mo și spațiul liber disponibil al unității selectate."
- IDS_WARNMAXIMUMRANGE "Dimensiunea maximă a fișierului de paginare trebuie să fie încadrată între dimensiunea inițială și spațiul liber disponibil al unității selectate."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Nespecificat"
IDS_PAGEFILE_SYSTEM "Gestionat de sistem"
IDS_INFOREBOOT "Pentru aplicarea modificărilor este necesară repornirea calculatorului."
diff --git a/dll/cpl/sysdm/lang/ru-RU.rc b/dll/cpl/sysdm/lang/ru-RU.rc
index c6e0e38810c..209b608170a 100644
--- a/dll/cpl/sysdm/lang/ru-RU.rc
+++ b/dll/cpl/sysdm/lang/ru-RU.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Панель управления системы"
IDS_WARNINITIALSIZE "Введите числовое значение исходного размера файла подкачки."
IDS_WARNMAXIMUMSIZE "Введите числовое значение для параметра максимальный размер файла подкачки."
- IDS_WARNINITIALRANGE "Начальный размер файла подкачки должен быть не меньше, чем 2 МБ и не должен превышать свободного места на выбранном диске."
- IDS_WARNMAXIMUMRANGE "Максимальный размер файла подкачки должен быть не меньше, чем начальный размер, который не должен превышать свободного места на выбранном диске."
- IDS_PAGEFILE_MB "%u МБ"
+ IDS_WARNINITIALRANGE "Исходный размер файла подкачки должен быть в диапазоне между 2 МБ и %lu МБ на выбранном диске."
+ IDS_WARNMAXIMUMRANGE "Максимальный размер файла подкачки должен быть больше или равен своему исходному размеру, и при этом меньше %lu МБ на выбранном диске."
+ IDS_PAGEFILE_MB "%lu МБ"
IDS_PAGEFILE_NONE "Нет"
IDS_PAGEFILE_SYSTEM "По выбору системы"
IDS_INFOREBOOT "Необходимо перезагрузить компьютер для применения изменений."
diff --git a/dll/cpl/sysdm/lang/sk-SK.rc b/dll/cpl/sysdm/lang/sk-SK.rc
index 3f62f5fda36..995c5f66c39 100644
--- a/dll/cpl/sysdm/lang/sk-SK.rc
+++ b/dll/cpl/sysdm/lang/sk-SK.rc
@@ -362,11 +362,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Žiadne"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/sq-AL.rc b/dll/cpl/sysdm/lang/sq-AL.rc
index 921188aff24..4a5aa9a3be9 100644
--- a/dll/cpl/sysdm/lang/sq-AL.rc
+++ b/dll/cpl/sysdm/lang/sq-AL.rc
@@ -356,9 +356,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Sistemi i kontrollit panelit programeve"
IDS_WARNINITIALSIZE "Futni një vlerë numerike për madhësinë fillestare e faqeve të dokumentave."
IDS_WARNMAXIMUMSIZE "Futni një vlerë numerike për madhësinë maksimale e faqeve të dokumentave."
- IDS_WARNINITIALRANGE "Madhësia fillestare e faqes së dokumentit nuk duhet të jetë më e vogël se 2 MB dhe nuk duhet të kalojë hapësirën në dispozicion në driver-in e përzgjedhur."
- IDS_WARNMAXIMUMRANGE "Madhësia maksimale e faqes së dokumenit nuk duhet të jetë më e vogël se madhësia e saj fillestare dhe nuk duhet të kalojë hapësirën në dispozicion në driver-in e përzgjedhur."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Asnjë"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/sv-SE.rc b/dll/cpl/sysdm/lang/sv-SE.rc
index f7e80ff397c..9edf9d22373 100644
--- a/dll/cpl/sysdm/lang/sv-SE.rc
+++ b/dll/cpl/sysdm/lang/sv-SE.rc
@@ -356,11 +356,11 @@ BEGIN
IDS_USERPROFILE_ACCOUNT_DELETED "Account Deleted"
IDS_USERPROFILE_TYPE_TEXT "When %s logs onto this computer, should the operating system use the roaming profile or just the locally cached copy of the roaming profile."
IDS_MESSAGEBOXTITLE "System control panel applet"
- IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
- IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
- IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size, must not be larger than 4095 MB and must not exceed the available space on the selected drive."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALSIZE "Enter a numeric value for the paging file initial size."
+ IDS_WARNMAXIMUMSIZE "Enter a numeric value for the paging file maximum size."
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "None"
IDS_PAGEFILE_SYSTEM "System Managed"
IDS_INFOREBOOT "You have to reboot the computer in order to apply the changes."
diff --git a/dll/cpl/sysdm/lang/tr-TR.rc b/dll/cpl/sysdm/lang/tr-TR.rc
index e84c91e8970..694377715c4 100644
--- a/dll/cpl/sysdm/lang/tr-TR.rc
+++ b/dll/cpl/sysdm/lang/tr-TR.rc
@@ -358,9 +358,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Sistem Denetim Masası Uygulaması"
IDS_WARNINITIALSIZE "Sayfalama dosyasının başlangıç büyüklüğü için bir sayısal değer giriniz."
IDS_WARNMAXIMUMSIZE "Sayfalama dosyasının maksimum büyüklüğü için bir sayısal değer giriniz."
- IDS_WARNINITIALRANGE "Sayfalama dosyasının başlangıç büyüklüğü, 2 MB'tan küçük olmamalıdır ve seçili sürücüde var olan boşluğu aşmamalıdır."
- IDS_WARNMAXIMUMRANGE "Sayfalama dosyasının maksimum büyüklüğü, kendisinin başlangıç büyüklüğünden küçük olmamalıdır ve seçili sürücüde var olan boşluğu aşmamalıdır."
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "Yok"
IDS_PAGEFILE_SYSTEM "Sistem Yönetimli"
IDS_INFOREBOOT "Değişiklikleri uygulamak için bilgisayarı yeniden başlatmalısınız."
diff --git a/dll/cpl/sysdm/lang/uk-UA.rc b/dll/cpl/sysdm/lang/uk-UA.rc
index 0082c0d079a..dc06aa27080 100644
--- a/dll/cpl/sysdm/lang/uk-UA.rc
+++ b/dll/cpl/sysdm/lang/uk-UA.rc
@@ -364,9 +364,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "Елемент панелі керування"
IDS_WARNINITIALSIZE "Введіть числове значення для початкового розміру файлу довантаження."
IDS_WARNMAXIMUMSIZE "Введіть числове значення для максимального розміру файлу довантаження."
- IDS_WARNINITIALRANGE "Початковий розмір файлу довантаження не повинен бути меншим 2 Мб і не повинен перевищувати об'єм вільного місця на обраному диску."
- IDS_WARNMAXIMUMRANGE "Максимальний розмір файлу довантаження не повинен бути меншим від початкового та не повинен перевищувати об'єм вільного місця на обраному диску."
- IDS_PAGEFILE_MB "%u МБ"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu МБ"
IDS_PAGEFILE_NONE "Немає"
IDS_PAGEFILE_SYSTEM "За вибором системи"
IDS_INFOREBOOT "Необхідно перезавантажити комп'ютер для застосування нових параметрів."
diff --git a/dll/cpl/sysdm/lang/zh-CN.rc b/dll/cpl/sysdm/lang/zh-CN.rc
index 0c2187ab0c9..65735ffd558 100644
--- a/dll/cpl/sysdm/lang/zh-CN.rc
+++ b/dll/cpl/sysdm/lang/zh-CN.rc
@@ -365,9 +365,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "系统控制面板小程序"
IDS_WARNINITIALSIZE "为分页文件的初始大小输入一个数字值。"
IDS_WARNMAXIMUMSIZE "为分页文件的最大大小输入一个数字值。"
- IDS_WARNINITIALRANGE "分页文件的初始大小不得小于 2 MB,并且不得超过所选磁盘上的可用空间。"
- IDS_WARNMAXIMUMRANGE "分页文件的最大大小不能小于其初始大小和不能超过所选磁盘上的可用空间。"
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "无"
IDS_PAGEFILE_SYSTEM "系统已托管"
IDS_INFOREBOOT "您必须重新启动计算机,才能应用更改。"
diff --git a/dll/cpl/sysdm/lang/zh-HK.rc b/dll/cpl/sysdm/lang/zh-HK.rc
index af01ab8d6ec..d4d3bdbade8 100644
--- a/dll/cpl/sysdm/lang/zh-HK.rc
+++ b/dll/cpl/sysdm/lang/zh-HK.rc
@@ -364,9 +364,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "系統控制台小程序"
IDS_WARNINITIALSIZE "為分頁文件的初始大小輸入一個數值。"
IDS_WARNMAXIMUMSIZE "為分頁文件的最大大小輸入一個數值。"
- IDS_WARNINITIALRANGE "分頁文件的初始大小不得小於 2 MB,並且不得超過所選磁碟上的可用空間。"
- IDS_WARNMAXIMUMRANGE "分頁文件的最大大小不能小於其初始大小及不能超過所選磁碟上的可用空間。"
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "無"
IDS_PAGEFILE_SYSTEM "受管理的系統"
IDS_INFOREBOOT "您必須重新啟動電腦,才能套用更改。"
diff --git a/dll/cpl/sysdm/lang/zh-TW.rc b/dll/cpl/sysdm/lang/zh-TW.rc
index 6d022a4a93c..6575f54ce30 100644
--- a/dll/cpl/sysdm/lang/zh-TW.rc
+++ b/dll/cpl/sysdm/lang/zh-TW.rc
@@ -365,9 +365,9 @@ BEGIN
IDS_MESSAGEBOXTITLE "系統控制臺小程序"
IDS_WARNINITIALSIZE "為分頁文件的初始大小輸入一個數字值。"
IDS_WARNMAXIMUMSIZE "為分頁文件的最大大小輸入一個數字值。"
- IDS_WARNINITIALRANGE "分頁文件的初始大小不得小於 2 MB,並且不得超過所選磁碟上的可用空間。"
- IDS_WARNMAXIMUMRANGE "分頁文件的最大大小不能小於其初始大小和不能超過所選磁碟上的可用空間。"
- IDS_PAGEFILE_MB "%u MB"
+ IDS_WARNINITIALRANGE "The initial paging file size must be between 2 MB and %lu MB on the selected drive."
+ IDS_WARNMAXIMUMRANGE "The maximum paging file size must be larger than or equal to its initial size, and less than %lu MB on the selected drive."
+ IDS_PAGEFILE_MB "%lu MB"
IDS_PAGEFILE_NONE "無"
IDS_PAGEFILE_SYSTEM "受管理的系統"
IDS_INFOREBOOT "您必須重新啟動電腦,才能套用更改。"
diff --git a/dll/cpl/sysdm/virtmem.c b/dll/cpl/sysdm/virtmem.c
index 6c72ca6c4e4..ac78983fa31 100644
--- a/dll/cpl/sysdm/virtmem.c
+++ b/dll/cpl/sysdm/virtmem.c
@@ -9,9 +9,57 @@
#include "precomp.h"
+#ifdef _M_IX86
+/* Used for SharedUserData by GetMaxPageFileSize() in the PAE case */
+#define NTOS_MODE_USER
+#include <ndk/pstypes.h>
+#endif
+
#define NDEBUG
#include <debug.h>
+// #define MAX_PAGING_FILES 16 // See also ntoskrnl/include/internal/mm.h
+#define MEGABYTE (1024 * 1024)
+
+/* Values adapted from smss/pagefile.c, converted in megabytes and rounded-down.
+ * Compare to the more "accurate" values from SMSS (and NTOS) in bytes. */
+
+/* Minimum pagefile size: 2 MB, instead of 256 pages (1 MB) */
+#define MINIMUM_PAGEFILE_SIZE 2
+
+/* Maximum pagefile sizes for different architectures */
+#define MAXIMUM_PAGEFILE_SIZE32 (4UL * 1024 - 1)
+#define MAXIMUM_PAGEFILE_SIZE64 (16UL * 1024 * 1024 - 1)
+
+#if defined(_M_IX86)
+/* 4095 MB */
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+/* PAE uses the same size as x64 */
+ #define MAXIMUM_PAGEFILE_SIZE_PAE MAXIMUM_PAGEFILE_SIZE64
+#elif defined (_M_AMD64) || defined(_M_ARM64)
+/* Around 16 TB */
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE64
+#elif defined (_M_IA64)
+/* Around 32 TB */
+ #define MAXIMUM_PAGEFILE_SIZE (32UL * 1024 * 1024 - 1)
+#elif defined(_M_ARM)
+/* Around 2 GB */
+ #if (NTDDI_VERSION >= NTDDI_WINBLUE) // NTDDI_WIN81
+ #define MAXIMUM_PAGEFILE_SIZE (2UL * 1024 - 1)
+ #else
+/* Around 4 GB */
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+ #endif
+#else
+/* On unknown architectures, default to either one of the 32 or 64 bit sizes */
+#pragma message("Unknown architecture")
+ #ifdef _WIN64
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE64
+ #else
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+ #endif
+#endif
+
typedef struct _PAGEFILE
{
TCHAR szDrive[3];
@@ -21,6 +69,7 @@ typedef struct _PAGEFILE
INT NewMinSize;
INT NewMaxSize;
UINT FreeSize;
+ BOOL bIsNotFAT;
BOOL bUsed;
} PAGEFILE, *PPAGEFILE;
@@ -29,22 +78,36 @@ typedef struct _VIRTMEM
HWND hSelf;
HWND hListBox;
LPTSTR szPagingFiles;
- INT Count;
+ UINT Count;
BOOL bModified;
- PAGEFILE Pagefile[26];
+ PAGEFILE PageFile[26];
} VIRTMEM, *PVIRTMEM;
-static BOOL OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem);
+static __inline
+UINT
+GetMaxPageFileSize(
+ _In_ PPAGEFILE PageFile)
+{
+#ifdef _M_IX86
+ /* For x86 PAE-enabled systems, where the maximum pagefile size is
+ * greater than 4 GB, verify also that the drive's filesystem on which
+ * the pagefile is stored can support it. */
+ if (SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] && PageFile->bIsNotFAT)
+ return min(PageFile->FreeSize, MAXIMUM_PAGEFILE_SIZE_PAE);
+#endif
+ return min(PageFile->FreeSize, MAXIMUM_PAGEFILE_SIZE);
+}
+
static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
static BOOL
ReadPageFileSettings(PVIRTMEM pVirtMem)
{
+ BOOL bRet = FALSE;
HKEY hkey = NULL;
DWORD dwType;
DWORD dwDataSize;
- BOOL bRet = FALSE;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
lpKey,
@@ -64,12 +127,10 @@ ReadPageFileSettings(PVIRTMEM pVirtMem)
&dwDataSize) == ERROR_SUCCESS)
{
pVirtMem->szPagingFiles = (LPTSTR)HeapAlloc(GetProcessHeap(),
- 0,
+ HEAP_ZERO_MEMORY,
dwDataSize);
if (pVirtMem->szPagingFiles != NULL)
{
- ZeroMemory(pVirtMem->szPagingFiles,
- dwDataSize);
if (RegQueryValueEx(hkey,
_T("PagingFiles"),
NULL,
@@ -98,7 +159,7 @@ GetPageFileSizes(LPTSTR lpPageFiles,
LPINT lpInitialSize,
LPINT lpMaximumSize)
{
- INT i = 0;
+ UINT i = 0;
*lpInitialSize = -1;
*lpMaximumSize = -1;
@@ -134,13 +195,15 @@ ParseMemSettings(PVIRTMEM pVirtMem)
LPTSTR DrivePtr = szDrives;
TCHAR szDrive[3]; // Single drive
TCHAR szVolume[MAX_PATH + 1];
+ TCHAR szFSName[MAX_PATH + 1];
INT MinSize;
INT MaxSize;
INT DriveLen;
- INT PgCnt = 0;
INT Len;
+ UINT PgCnt = 0;
+ PPAGEFILE PageFile;
- DriveLen = GetLogicalDriveStrings(1023,
+ DriveLen = GetLogicalDriveStrings(_countof(szDrives) - 1,
szDrives);
while (DriveLen != 0)
@@ -151,7 +214,7 @@ ParseMemSettings(PVIRTMEM pVirtMem)
DrivePtr = _tcsupr(DrivePtr);
/* Copy the 'X:' portion */
- lstrcpyn(szDrive, DrivePtr, sizeof(szDrive) / sizeof(TCHAR));
+ lstrcpyn(szDrive, DrivePtr, _countof(szDrive));
if (GetDriveType(DrivePtr) == DRIVE_FIXED)
{
@@ -159,36 +222,40 @@ ParseMemSettings(PVIRTMEM pVirtMem)
MaxSize = -1;
/* Does drive match the one in the registry ? */
- if (!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2))
+ if (_tcsnicmp(pVirtMem->szPagingFiles, szDrive, 2) == 0)
{
GetPageFileSizes(pVirtMem->szPagingFiles,
&MinSize,
&MaxSize);
}
- pVirtMem->Pagefile[PgCnt].OldMinSize = MinSize;
- pVirtMem->Pagefile[PgCnt].OldMaxSize = MaxSize;
- pVirtMem->Pagefile[PgCnt].NewMinSize = MinSize;
- pVirtMem->Pagefile[PgCnt].NewMaxSize = MaxSize;
- pVirtMem->Pagefile[PgCnt].bUsed = TRUE;
- lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
-
+ PageFile = &pVirtMem->PageFile[PgCnt];
+ PageFile->OldMinSize = MinSize;
+ PageFile->OldMaxSize = MaxSize;
+ PageFile->NewMinSize = MinSize;
+ PageFile->NewMaxSize = MaxSize;
+ PageFile->bIsNotFAT = TRUE; /* Suppose this is not a FAT volume */
+ PageFile->bUsed = TRUE;
+ lstrcpy(PageFile->szDrive, szDrive);
/* Get the volume label if there is one */
if (GetVolumeInformation(DrivePtr,
- szVolume,
- MAX_PATH + 1,
- NULL,
- NULL,
- NULL,
- NULL,
- 0))
+ szVolume, _countof(szVolume),
+ NULL, NULL, NULL,
+ szFSName, _countof(szFSName)))
{
- pVirtMem->Pagefile[PgCnt].pszVolume = HeapAlloc(GetProcessHeap(),
- 0,
- (_tcslen(szVolume) + 1) * sizeof(TCHAR));
- if (pVirtMem->Pagefile[PgCnt].pszVolume != NULL)
- _tcscpy(pVirtMem->Pagefile[PgCnt].pszVolume, szVolume);
+ PageFile->pszVolume = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+ (_tcslen(szVolume) + 1) * sizeof(TCHAR));
+ if (PageFile->pszVolume != NULL)
+ _tcscpy(PageFile->pszVolume, szVolume);
+
+ /*
+ * Check whether the volume is FAT, which cannot support files
+ * larger than 4GB (for FAT32 and FATX, and less for FAT16).
+ * This will limit the maximum size of the pagefile this volume
+ * can contain (see GetMaxPageFileSize()).
+ */
+ PageFile->bIsNotFAT = (_tcsnicmp(szFSName, _T("FAT"), 3) != 0);
}
PgCnt++;
@@ -204,29 +271,32 @@ ParseMemSettings(PVIRTMEM pVirtMem)
static VOID
WritePageFileSettings(PVIRTMEM pVirtMem)
{
+ BOOL bErr = TRUE;
HKEY hk = NULL;
- TCHAR szPagingFiles[2048];
TCHAR szText[256];
- INT i, nPos = 0;
- BOOL bErr = TRUE;
+ TCHAR szPagingFiles[2048];
+ UINT i, nPos = 0;
+ PPAGEFILE PageFile;
for (i = 0; i < pVirtMem->Count; ++i)
{
- if (pVirtMem->Pagefile[i].bUsed &&
- pVirtMem->Pagefile[i].NewMinSize != -1 &&
- pVirtMem->Pagefile[i].NewMaxSize != -1)
+ PageFile = &pVirtMem->PageFile[i];
+
+ if (PageFile->bUsed &&
+ PageFile->NewMinSize != -1 &&
+ PageFile->NewMaxSize != -1)
{
_stprintf(szText,
_T("%s\\pagefile.sys %i %i"),
- pVirtMem->Pagefile[i].szDrive,
- pVirtMem->Pagefile[i].NewMinSize,
- pVirtMem->Pagefile[i].NewMaxSize);
+ PageFile->szDrive,
+ PageFile->NewMinSize,
+ PageFile->NewMaxSize);
/* Add it to our overall registry string */
lstrcpy(szPagingFiles + nPos, szText);
/* Record the position where the next string will start */
- nPos += (INT)lstrlen(szText) + 1;
+ nPos += (UINT)lstrlen(szText) + 1;
/* Add another NULL for REG_MULTI_SZ */
szPagingFiles[nPos] = _T('\0');
@@ -248,8 +318,8 @@ WritePageFileSettings(PVIRTMEM pVirtMem)
_T("PagingFiles"),
0,
REG_MULTI_SZ,
- (LPBYTE) szPagingFiles,
- (DWORD) nPos * sizeof(TCHAR)) == ERROR_SUCCESS)
+ (LPBYTE)szPagingFiles,
+ (DWORD)nPos * sizeof(TCHAR)) == ERROR_SUCCESS)
{
bErr = FALSE;
}
@@ -260,14 +330,14 @@ WritePageFileSettings(PVIRTMEM pVirtMem)
if (bErr == FALSE)
{
/* Delete obsolete paging files on the next boot */
- for (i = 0; i < 26; i++)
+ for (i = 0; i < _countof(pVirtMem->PageFile); i++)
{
- if (pVirtMem->Pagefile[i].OldMinSize != -1 &&
- pVirtMem->Pagefile[i].NewMinSize == -1)
+ if (pVirtMem->PageFile[i].OldMinSize != -1 &&
+ pVirtMem->PageFile[i].NewMinSize == -1)
{
_stprintf(szText,
_T("%s\\pagefile.sys"),
- pVirtMem->Pagefile[i].szDrive);
+ pVirtMem->PageFile[i].szDrive);
MoveFileEx(szText, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
}
@@ -276,7 +346,6 @@ WritePageFileSettings(PVIRTMEM pVirtMem)
if (bErr)
ShowLastWin32Error(pVirtMem->hSelf);
-
}
@@ -317,45 +386,50 @@ OnCustom(PVIRTMEM pVirtMem)
}
+static BOOL OnSelChange(PVIRTMEM pVirtMem);
+
static VOID
InitPagefileList(PVIRTMEM pVirtMem)
{
- TCHAR szDisplayString[256];
- TCHAR szSize[64];
INT Index;
- INT i;
+ UINT i;
+ PPAGEFILE PageFile;
+ TCHAR szSize[64];
+ TCHAR szDisplayString[256];
- for (i = 0; i < 26; i++)
+ for (i = 0; i < _countof(pVirtMem->PageFile); i++)
{
- if (pVirtMem->Pagefile[i].bUsed)
+ PageFile = &pVirtMem->PageFile[i];
+
+ if (PageFile->bUsed)
{
- if ((pVirtMem->Pagefile[i].NewMinSize == -1) &&
- (pVirtMem->Pagefile[i].NewMaxSize == -1))
+ if ((PageFile->NewMinSize == -1) &&
+ (PageFile->NewMaxSize == -1))
{
LoadString(hApplet,
IDS_PAGEFILE_NONE,
szSize,
- sizeof(szSize) / sizeof(szSize[0]));
+ _countof(szSize));
}
- else if ((pVirtMem->Pagefile[i].NewMinSize == 0) &&
- (pVirtMem->Pagefile[i].NewMaxSize == 0))
+ else if ((PageFile->NewMinSize == 0) &&
+ (PageFile->NewMaxSize == 0))
{
LoadString(hApplet,
IDS_PAGEFILE_SYSTEM,
szSize,
- sizeof(szSize) / sizeof(szSize[0]));
+ _countof(szSize));
}
else
{
_stprintf(szSize, _T("%d - %d"),
- pVirtMem->Pagefile[i].NewMinSize,
- pVirtMem->Pagefile[i].NewMaxSize);
+ PageFile->NewMinSize,
+ PageFile->NewMaxSize);
}
_stprintf(szDisplayString,
_T("%s [%s]\t%s"),
- pVirtMem->Pagefile[i].szDrive,
- pVirtMem->Pagefile[i].pszVolume ? pVirtMem->Pagefile[i].pszVolume : _T(""),
+ PageFile->szDrive,
+ PageFile->pszVolume ? PageFile->pszVolume : _T(""),
szSize);
Index = SendMessage(pVirtMem->hListBox, LB_ADDSTRING, (WPARAM)0, (LPARAM)szDisplayString);
@@ -365,7 +439,7 @@ InitPagefileList(PVIRTMEM pVirtMem)
SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
- OnSelChange(pVirtMem->hSelf, pVirtMem);
+ OnSelChange(pVirtMem);
}
@@ -374,37 +448,38 @@ UpdatePagefileEntry(PVIRTMEM pVirtMem,
INT ListIndex,
INT DriveIndex)
{
- TCHAR szDisplayString[256];
+ PPAGEFILE PageFile = &pVirtMem->PageFile[DriveIndex];
TCHAR szSize[64];
+ TCHAR szDisplayString[256];
- if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == -1) &&
- (pVirtMem->Pagefile[DriveIndex].NewMaxSize == -1))
+ if ((PageFile->NewMinSize == -1) &&
+ (PageFile->NewMaxSize == -1))
{
LoadString(hApplet,
IDS_PAGEFILE_NONE,
szSize,
- sizeof(szSize) / sizeof(szSize[0]));
+ _countof(szSize));
}
- else if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == 0) &&
- (pVirtMem->Pagefile[DriveIndex].NewMaxSize == 0))
+ else if ((PageFile->NewMinSize == 0) &&
+ (PageFile->NewMaxSize == 0))
{
LoadString(hApplet,
IDS_PAGEFILE_SYSTEM,
szSize,
- sizeof(szSize) / sizeof(szSize[0]));
+ _countof(szSize));
}
else
{
_stprintf(szSize,
_T("%d - %d"),
- pVirtMem->Pagefile[DriveIndex].NewMinSize,
- pVirtMem->Pagefile[DriveIndex].NewMaxSize);
+ PageFile->NewMinSize,
+ PageFile->NewMaxSize);
}
_stprintf(szDisplayString,
_T("%s [%s]\t%s"),
- pVirtMem->Pagefile[DriveIndex].szDrive,
- pVirtMem->Pagefile[DriveIndex].pszVolume ? pVirtMem->Pagefile[DriveIndex].pszVolume : L"",
+ PageFile->szDrive,
+ PageFile->pszVolume ? PageFile->pszVolume : _T(""),
szSize);
SendMessage(pVirtMem->hListBox, LB_DELETESTRING, (WPARAM)ListIndex, 0);
@@ -420,13 +495,14 @@ OnSet(PVIRTMEM pVirtMem)
UINT MinSize = -1;
UINT MaxSize = -1;
BOOL bTranslated;
- INT DriveIndex = 0;
+ UINT DriveIndex;
+ PPAGEFILE PageFile;
- Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
- IDC_PAGEFILELIST,
- LB_GETCURSEL,
- 0,
- 0);
+ Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_PAGEFILELIST,
+ LB_GETCURSEL,
+ 0,
+ 0);
if (Index >= 0 && Index < pVirtMem->Count)
{
DriveIndex = SendDlgItemMessage(pVirtMem->hSelf,
@@ -435,10 +511,14 @@ OnSet(PVIRTMEM pVirtMem)
(WPARAM)Index,
0);
+ PageFile = &pVirtMem->PageFile[DriveIndex];
+
/* Check if custom settings are checked */
if (IsDlgButtonChecked(pVirtMem->hSelf,
IDC_CUSTOM) == BST_CHECKED)
{
+ UINT maxPageFileSize;
+
MinSize = GetDlgItemInt(pVirtMem->hSelf,
IDC_INITIALSIZE,
&bTranslated,
@@ -467,56 +547,64 @@ OnSet(PVIRTMEM pVirtMem)
return;
}
+ maxPageFileSize = GetMaxPageFileSize(PageFile);
+
/* Check the valid range of the minimum size */
- if (MinSize < 2 ||
- MinSize > pVirtMem->Pagefile[DriveIndex].FreeSize ||
- MinSize > 4096)
+ if ((MinSize < MINIMUM_PAGEFILE_SIZE) ||
+ (MinSize > maxPageFileSize))
{
ResourceMessageBox(hApplet,
NULL,
MB_ICONWARNING | MB_OK,
IDS_MESSAGEBOXTITLE,
- IDS_WARNINITIALRANGE);
+ IDS_WARNINITIALRANGE,
+ maxPageFileSize);
return;
}
/* Check the valid range of the maximum size */
- if (MaxSize < MinSize ||
- MaxSize > pVirtMem->Pagefile[DriveIndex].FreeSize ||
- MaxSize > 4096)
+ if ((MaxSize < MinSize) ||
+ (MaxSize > maxPageFileSize))
{
ResourceMessageBox(hApplet,
NULL,
MB_ICONWARNING | MB_OK,
IDS_MESSAGEBOXTITLE,
- IDS_WARNMAXIMUMRANGE);
+ IDS_WARNMAXIMUMRANGE,
+ maxPageFileSize);
return;
}
- pVirtMem->Pagefile[DriveIndex].NewMinSize = MinSize;
- pVirtMem->Pagefile[DriveIndex].NewMaxSize = MaxSize;
- pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
+ // TODO: Check how much disk space would remain after
+ // storing a pagefile of a certain size. Warn/error out
+ // if less than 5 MB would remain.
+
+ PageFile->NewMinSize = MinSize;
+ PageFile->NewMaxSize = MaxSize;
+ PageFile->bUsed = TRUE;
}
else if (IsDlgButtonChecked(pVirtMem->hSelf,
IDC_NOPAGEFILE) == BST_CHECKED)
{
/* No pagefile */
- pVirtMem->Pagefile[DriveIndex].NewMinSize = -1;
- pVirtMem->Pagefile[DriveIndex].NewMaxSize = -1;
- pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
+ PageFile->NewMinSize = -1;
+ PageFile->NewMaxSize = -1;
+ PageFile->bUsed = TRUE;
}
else
{
/* System managed size*/
- pVirtMem->Pagefile[DriveIndex].NewMinSize = 0;
- pVirtMem->Pagefile[DriveIndex].NewMaxSize = 0;
- pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
+ PageFile->NewMinSize = 0;
+ PageFile->NewMaxSize = 0;
+ PageFile->bUsed = TRUE;
}
/* Set the modified flag if min or max size has changed */
- if ((pVirtMem->Pagefile[DriveIndex].OldMinSize != pVirtMem->Pagefile[DriveIndex].NewMinSize) ||
- (pVirtMem->Pagefile[DriveIndex].OldMaxSize != pVirtMem->Pagefile[DriveIndex].NewMaxSize))
+ if ((PageFile->OldMinSize != PageFile->NewMinSize) ||
+ (PageFile->OldMaxSize != PageFile->NewMaxSize))
+ {
pVirtMem->bModified = TRUE;
+ }
UpdatePagefileEntry(pVirtMem, Index, DriveIndex);
}
@@ -524,61 +612,66 @@ OnSet(PVIRTMEM pVirtMem)
static BOOL
-OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
+OnSelChange(PVIRTMEM pVirtMem)
{
- TCHAR szBuffer[64];
+ INT Index;
+ UINT DriveIndex;
+ PPAGEFILE PageFile;
MEMORYSTATUSEX MemoryStatus;
ULARGE_INTEGER FreeDiskSpace;
- UINT i, FreeMemMb, RecoMemMb, PageFileSizeMb;
- INT Index;
- TCHAR szText[MAX_PATH], szMegabytes[8];
- WIN32_FIND_DATAW fdata = {0};
+ UINT i, PageFileSizeMb;
+ TCHAR szMegabytes[8];
+ TCHAR szBuffer[64];
+ TCHAR szText[MAX_PATH];
+ WIN32_FIND_DATA fdata = {0};
HANDLE hFind;
ULARGE_INTEGER pfSize;
- Index = (INT)SendDlgItemMessage(hwndDlg,
+ Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
IDC_PAGEFILELIST,
LB_GETCURSEL,
0,
0);
if (Index >= 0 && Index < pVirtMem->Count)
{
+ DriveIndex = SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_PAGEFILELIST,
+ LB_GETITEMDATA,
+ (WPARAM)Index,
+ 0);
+
+ PageFile = &pVirtMem->PageFile[DriveIndex];
+
LoadString(hApplet,
IDS_PAGEFILE_MB,
szMegabytes,
- ARRAYSIZE(szMegabytes));
+ _countof(szMegabytes));
/* Set drive letter */
- SetDlgItemText(hwndDlg, IDC_DRIVE,
- pVirtMem->Pagefile[Index].szDrive);
+ SetDlgItemText(pVirtMem->hSelf, IDC_DRIVE,
+ PageFile->szDrive);
/* Set available disk space */
- if (GetDiskFreeSpaceEx(pVirtMem->Pagefile[Index].szDrive,
+ if (GetDiskFreeSpaceEx(PageFile->szDrive,
NULL, NULL, &FreeDiskSpace))
{
- pVirtMem->Pagefile[Index].FreeSize = (UINT)(FreeDiskSpace.QuadPart / (1024 * 1024));
- _stprintf(szBuffer, szMegabytes, pVirtMem->Pagefile[Index].FreeSize);
- SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer);
+ PageFile->FreeSize = (UINT)(FreeDiskSpace.QuadPart / MEGABYTE);
+ _stprintf(szBuffer, szMegabytes, PageFile->FreeSize);
+ SetDlgItemText(pVirtMem->hSelf, IDC_SPACEAVAIL, szBuffer);
}
- if (pVirtMem->Pagefile[Index].NewMinSize == -1 &&
- pVirtMem->Pagefile[Index].NewMaxSize == -1)
+ if (PageFile->NewMinSize == -1 &&
+ PageFile->NewMaxSize == -1)
{
/* No pagefile */
-
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
-
+ OnNoPagingFile(pVirtMem);
CheckDlgButton(pVirtMem->hSelf, IDC_NOPAGEFILE, BST_CHECKED);
}
- else if (pVirtMem->Pagefile[Index].NewMinSize == 0 &&
- pVirtMem->Pagefile[Index].NewMaxSize == 0)
+ else if (PageFile->NewMinSize == 0 &&
+ PageFile->NewMaxSize == 0)
{
- /* System managed size*/
-
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
-
+ /* System managed size */
+ OnSysManSize(pVirtMem);
CheckDlgButton(pVirtMem->hSelf, IDC_SYSMANSIZE, BST_CHECKED);
}
else
@@ -586,17 +679,16 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
/* Custom size */
/* Enable and fill the custom values */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
+ OnCustom(pVirtMem);
SetDlgItemInt(pVirtMem->hSelf,
IDC_INITIALSIZE,
- pVirtMem->Pagefile[Index].NewMinSize,
+ PageFile->NewMinSize,
FALSE);
SetDlgItemInt(pVirtMem->hSelf,
IDC_MAXSIZE,
- pVirtMem->Pagefile[Index].NewMaxSize,
+ PageFile->NewMaxSize,
FALSE);
CheckDlgButton(pVirtMem->hSelf,
@@ -604,20 +696,24 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
BST_CHECKED);
}
- /* Set minimum pagefile size (2 MB) */
- _stprintf(szBuffer, szMegabytes, 2);
- SetDlgItemText(hwndDlg, IDC_MINIMUM, szBuffer);
+ /* Set minimum pagefile size */
+ _stprintf(szBuffer, szMegabytes, MINIMUM_PAGEFILE_SIZE);
+ SetDlgItemText(pVirtMem->hSelf, IDC_MINIMUM, szBuffer);
/* Set recommended pagefile size */
- MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
+ MemoryStatus.dwLength = sizeof(MemoryStatus);
if (GlobalMemoryStatusEx(&MemoryStatus))
{
- FreeMemMb = (UINT)(MemoryStatus.ullTotalPhys / (1024 * 1024));
- RecoMemMb = FreeMemMb + (FreeMemMb / 2); /* The recommended VM size is 150% of free memory. */
- if (RecoMemMb > 4096)
- RecoMemMb = 4096;
+ UINT FreeMemMb, RecoMemMb;
+ UINT maxPageFileSize = GetMaxPageFileSize(PageFile);
+
+ FreeMemMb = (UINT)(MemoryStatus.ullTotalPhys / MEGABYTE);
+ /* The recommended VM size is 150% of free memory */
+ RecoMemMb = FreeMemMb + (FreeMemMb / 2);
+ if (RecoMemMb > maxPageFileSize)
+ RecoMemMb = maxPageFileSize;
_stprintf(szBuffer, szMegabytes, RecoMemMb);
- SetDlgItemText(hwndDlg, IDC_RECOMMENDED, szBuffer);
+ SetDlgItemText(pVirtMem->hSelf, IDC_RECOMMENDED, szBuffer);
}
/* Set current pagefile size */
@@ -627,24 +723,26 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
{
_stprintf(szText,
_T("%c:\\pagefile.sys"),
- pVirtMem->Pagefile[i].szDrive[0]);
+ pVirtMem->PageFile[i].szDrive[0]);
- hFind = FindFirstFileW(szText, &fdata);
+ hFind = FindFirstFile(szText, &fdata);
if (hFind == INVALID_HANDLE_VALUE)
{
- DPRINT1("Unable to read PageFile size : %ls due to error %d\n", szText,GetLastError());
+ // FIXME: MsgBox error?
+ DPRINT1("Unable to read PageFile size: %ls due to error %d\n",
+ szText, GetLastError());
}
else
{
pfSize.LowPart = fdata.nFileSizeLow;
pfSize.HighPart = fdata.nFileSizeHigh;
- PageFileSizeMb += pfSize.QuadPart / (1024*1024);
+ PageFileSizeMb += pfSize.QuadPart / MEGABYTE;
FindClose(hFind);
}
}
_stprintf(szBuffer, szMegabytes, PageFileSizeMb);
- SetDlgItemText(hwndDlg, IDC_CURRENT, szBuffer);
+ SetDlgItemText(pVirtMem->hSelf, IDC_CURRENT, szBuffer);
}
return TRUE;
@@ -670,7 +768,8 @@ OnVirtMemDialogOk(PVIRTMEM pVirtMem)
static VOID
OnInitVirtMemDialog(HWND hwnd, PVIRTMEM pVirtMem)
{
- INT i;
+ UINT i;
+ PPAGEFILE PageFile;
pVirtMem->hSelf = hwnd;
pVirtMem->hListBox = GetDlgItem(hwnd, IDC_PAGEFILELIST);
@@ -678,13 +777,16 @@ OnInitVirtMemDialog(HWND hwnd, PVIRTMEM pVirtMem)
SetListBoxColumns(pVirtMem->hListBox);
- for (i = 0; i < 26; i++)
+ for (i = 0; i < _countof(pVirtMem->PageFile); i++)
{
- pVirtMem->Pagefile[i].bUsed = FALSE;
- pVirtMem->Pagefile[i].OldMinSize = -1;
- pVirtMem->Pagefile[i].OldMaxSize = -1;
- pVirtMem->Pagefile[i].NewMinSize = -1;
- pVirtMem->Pagefile[i].NewMaxSize = -1;
+ PageFile = &pVirtMem->PageFile[i];
+ PageFile->bUsed = FALSE;
+ PageFile->OldMinSize = -1;
+ PageFile->OldMaxSize = -1;
+ PageFile->NewMinSize = -1;
+ PageFile->NewMaxSize = -1;
+ PageFile->FreeSize = 0;
+ PageFile->bIsNotFAT = TRUE; /* Suppose this is not a FAT volume */
}
/* Load the pagefile systems from the reg */
@@ -700,12 +802,12 @@ OnInitVirtMemDialog(HWND hwnd, PVIRTMEM pVirtMem)
static VOID
OnDestroy(PVIRTMEM pVirtMem)
{
- INT i;
+ UINT i;
- for (i = 0; i < 26; i++)
+ for (i = 0; i < _countof(pVirtMem->PageFile); i++)
{
- if (pVirtMem->Pagefile[i].pszVolume != NULL)
- HeapFree(GetProcessHeap(), 0, pVirtMem->Pagefile[i].pszVolume);
+ if (pVirtMem->PageFile[i].pszVolume != NULL)
+ HeapFree(GetProcessHeap(), 0, pVirtMem->PageFile[i].pszVolume);
}
if (pVirtMem->szPagingFiles)
@@ -730,6 +832,7 @@ VirtMemDlgProc(HWND hwndDlg,
switch (uMsg)
{
case WM_INITDIALOG:
+ {
pVirtMem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VIRTMEM));
if (pVirtMem == NULL)
{
@@ -741,6 +844,7 @@ VirtMemDlgProc(HWND hwndDlg,
OnInitVirtMemDialog(hwndDlg, pVirtMem);
break;
+ }
case WM_DESTROY:
OnDestroy(pVirtMem);
@@ -778,7 +882,7 @@ VirtMemDlgProc(HWND hwndDlg,
switch (HIWORD(wParam))
{
case LBN_SELCHANGE:
- OnSelChange(hwndDlg, pVirtMem);
+ OnSelChange(pVirtMem);
return TRUE;
}
break;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a4274ad54837287bca58c…
commit a4274ad54837287bca58ca698b5a0ce237d0fd9d
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Nov 3 00:12:09 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Nov 16 21:54:31 2022 +0100
[SMSS][NTOS:MM] Implement the architecture-specific pagefile size limits + code review. (#4843)
What we have:
- Maximum number of pagefiles: 16
- Minimum pagefile size: 256 pages (1 MB when page size = 4096 bytes)
- Maximum pagefile size:
* 32-bit platforms: (1024 * 1024 - 1) pages (~ 4095 MB)
* x86 with PAE support: same size as for AMD x64
* x64 platform: (4 * 1024 * 1024 * 1024 - 1) pages (~ 16 TB)
* IA64 platform: (8 * 1024 * 1024 * 1024 - 1) pages (~ 32 TB)
Those are the values as supported and verified by the NT kernel.
Now, user-mode programs (including SMSS.EXE) have different opinions
on these, namely, they consider estimates directly in MB, respectively:
4095 MB, (16 * 1024 * 1024) MB, and (32 * 1024 * 1024) MB
(verified on Win2k3 and Win7 32 and 64 bits).
Also here, the minimum pagefile size is set to 2 MB.
Starting Windows 8+ (and 10), those values change slightly, and are
still not fully synchronized between NTOS:MM and SMSS. Finally, while
(x86 PAE and) AMD64 and ARM64 seem to share the maximum pagefile
size limit, 32-bit ARMv7 appears to use different limits than regular
x86 (2 GB instead of 4).
Please keep those values as they are for NT compatibility!
See the following references:
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/mm/modwrite/c…https://techcommunity.microsoft.com/t5/ask-the-performance-team/what-is-the…
+ Manual extraction of the values from different NT 6.2,6.3,10 builds.
[SMSS] Fill out in particular the x86-specific case for PAE.
[NTOS:MM] Some cleanup in the NtCreatePagingFile() code, namely:
- Clarify some comments;
- Validate the lower and upper bounds of the Minimum and Maximum sizes
(based on Windows behaviour as explained by Geoff + manual tests).
- Open the pagefile in case-insensitive;
- Simplify the loop that finds an existing matching pagefile;
- Simplify some failure exit paths;
- Add a "Missing validation steps TODO" comment block explaining the
existing code-hole.
---
base/system/smss/pagefile.c | 106 +++++++++++++++------
ntoskrnl/mm/pagefile.c | 220 ++++++++++++++++++++++----------------------
2 files changed, 191 insertions(+), 135 deletions(-)
diff --git a/base/system/smss/pagefile.c b/base/system/smss/pagefile.c
index 2eed8a7236d..c8115955c4f 100644
--- a/base/system/smss/pagefile.c
+++ b/base/system/smss/pagefile.c
@@ -20,8 +20,63 @@
//
#define STANDARD_PAGING_FILE_NAME L"\\??\\?:\\pagefile.sys"
#define STANDARD_DRIVE_LETTER_OFFSET 4
-#define MEGABYTE 0x100000UL
-#define MAXIMUM_PAGEFILE_SIZE (4095 * MEGABYTE)
+#define MAX_PAGING_FILES 16 // See also ntoskrnl/include/internal/mm.h
+#define MEGABYTE (1024 * 1024)
+
+/* Minimum pagefile size is 256 pages (1 MB) */
+// #define MINIMUM_PAGEFILE_SIZE (256ULL * PAGE_SIZE)
+
+/* Maximum pagefile sizes for different architectures */
+#define GIGABYTE (1024ULL * MEGABYTE)
+#define TERABYTE (1024ULL * GIGABYTE)
+
+// NOTE: No changes for NTDDI_WIN10
+#if (NTDDI_VERSION >= NTDDI_WINBLUE) // NTDDI_WIN81
+#define MAXIMUM_PAGEFILE_SIZE32 ((1ULL * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(4ULL * GIGABYTE - 1)
+#else
+/* 4095 MB */
+#define MAXIMUM_PAGEFILE_SIZE32 (4095ULL * MEGABYTE)
+#endif
+
+// NOTE: No changes for NTDDI_WIN10
+#if (NTDDI_VERSION >= NTDDI_WINBLUE) // NTDDI_WIN81
+#define MAXIMUM_PAGEFILE_SIZE64 ((4ULL * 1024 * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(16ULL * TERABYTE - 1)
+#else
+/* 16 TB */
+#define MAXIMUM_PAGEFILE_SIZE64 (16ULL * TERABYTE)
+#endif
+
+#if defined(_M_IX86)
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+ /* PAE uses the same size as x64 */
+ #define MAXIMUM_PAGEFILE_SIZE_PAE MAXIMUM_PAGEFILE_SIZE64
+#elif defined (_M_AMD64) || defined(_M_ARM64)
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE64
+#elif defined (_M_IA64)
+/* 32 TB */
+ #define MAXIMUM_PAGEFILE_SIZE (32ULL * TERABYTE)
+#elif defined(_M_ARM)
+/* Around 2 GB */
+ // NOTE: No changes for NTDDI_WIN10
+ #if (NTDDI_VERSION >= NTDDI_WINBLUE) // NTDDI_WIN81
+ #define MAXIMUM_PAGEFILE_SIZE ((512ULL * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(2ULL * GIGABYTE - 1)
+ #else
+/* 4095 MB */
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+ #endif
+#else
+/* On unknown architectures, default to either one of the 32 or 64 bit sizes */
+#pragma message("Unknown architecture")
+ #ifdef _WIN64
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE64
+ #else
+ #define MAXIMUM_PAGEFILE_SIZE MAXIMUM_PAGEFILE_SIZE32
+ #endif
+#endif
+
/* This should be 32 MB, but we need more than that for 2nd stage setup */
#define MINIMUM_TO_KEEP_FREE (256 * MEGABYTE)
#define FUZZ_FACTOR (16 * MEGABYTE)
@@ -93,7 +148,7 @@ SmpCreatePagingFileDescriptor(IN PUNICODE_STRING PageFileToken)
UNICODE_STRING PageFileName, Arguments, SecondArgument;
/* Make sure we don't have too many */
- if (SmpNumberOfPagingFiles >= 16)
+ if (SmpNumberOfPagingFiles >= MAX_PAGING_FILES)
{
DPRINT1("SMSS:PFILE: Too many paging files specified - %lu\n",
SmpNumberOfPagingFiles);
@@ -110,7 +165,7 @@ SmpCreatePagingFileDescriptor(IN PUNICODE_STRING PageFileToken)
if (!NT_SUCCESS(Status))
{
/* Fail */
- DPRINT1("SMSS:PFILE: SmpParseCommandLine( %wZ ) failed - Status == %lx\n",
+ DPRINT1("SMSS:PFILE: SmpParseCommandLine(%wZ) failed - Status == %lx\n",
PageFileToken, Status);
return Status;
}
@@ -198,7 +253,8 @@ SmpCreatePagingFileDescriptor(IN PUNICODE_STRING PageFileToken)
Descriptor->Name = PageFileName;
Descriptor->MinSize.QuadPart = MinSize * MEGABYTE;
Descriptor->MaxSize.QuadPart = MaxSize * MEGABYTE;
- if (SystemManaged) Descriptor->Flags |= SMP_PAGEFILE_SYSTEM_MANAGED;
+ if (SystemManaged)
+ Descriptor->Flags |= SMP_PAGEFILE_SYSTEM_MANAGED;
Descriptor->Name.Buffer[STANDARD_DRIVE_LETTER_OFFSET] =
RtlUpcaseUnicodeChar(Descriptor->Name.Buffer[STANDARD_DRIVE_LETTER_OFFSET]);
if (Descriptor->Name.Buffer[STANDARD_DRIVE_LETTER_OFFSET] == '?')
@@ -659,7 +715,7 @@ NTAPI
SmpMakeSystemManagedPagingFileDescriptor(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
{
NTSTATUS Status;
- LONGLONG MinimumSize, MaximumSize, Ram;
+ ULONGLONG MinimumSize, MaximumSize, Ram;
SYSTEM_BASIC_INFORMATION BasicInfo;
/* Query the page size of the system, and the amount of RAM */
@@ -693,8 +749,15 @@ NTAPI
SmpValidatePagingFileSizes(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
{
NTSTATUS Status = STATUS_SUCCESS;
- ULONGLONG MinSize, MaxSize;
BOOLEAN WasTooBig = FALSE;
+ ULONGLONG MinSize, MaxSize;
+#ifdef _M_IX86
+ ULONGLONG MaxPageFileSize =
+ (SharedUserData->ProcessorFeatures[PF_PAE_ENABLED])
+ ? MAXIMUM_PAGEFILE_SIZE_PAE : MAXIMUM_PAGEFILE_SIZE;
+#else
+ static const ULONGLONG MaxPageFileSize = MAXIMUM_PAGEFILE_SIZE;
+#endif
/* Capture the min and max */
MinSize = Descriptor->MinSize.QuadPart;
@@ -704,28 +767,19 @@ SmpValidatePagingFileSizes(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
&Descriptor->Name, MinSize, MaxSize);
/* Don't let minimum be bigger than maximum */
- if (MinSize > MaxSize) MaxSize = MinSize;
+ if (MinSize > MaxSize)
+ MaxSize = MinSize;
- /* On PAE we can have bigger pagefiles... */
- if (SharedUserData->ProcessorFeatures[PF_PAE_ENABLED])
+ /* Validate the minimum and maximum and trim them if they are too large */
+ if (MinSize > MaxPageFileSize)
{
- /* But we don't support that yet */
- DPRINT1("ReactOS does not support PAE yet... assuming sizes OK\n");
+ WasTooBig = TRUE;
+ MinSize = MaxPageFileSize;
}
- else
+ if (MaxSize > MaxPageFileSize)
{
- /* Validate the minimum and maximum and trim them if they are too large */
- if (MinSize > MAXIMUM_PAGEFILE_SIZE)
- {
- WasTooBig = TRUE;
- MinSize = MAXIMUM_PAGEFILE_SIZE;
- }
-
- if (MaxSize > MAXIMUM_PAGEFILE_SIZE)
- {
- WasTooBig = TRUE;
- MaxSize = MAXIMUM_PAGEFILE_SIZE;
- }
+ WasTooBig = TRUE;
+ MaxSize = MaxPageFileSize;
}
/* If we trimmed, write a flag in the descriptor */
@@ -752,7 +806,7 @@ SmpCreateSystemManagedPagingFile(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
/* Make sure there is at least 1 paging file and that we are system-managed */
ASSERT(SmpNumberOfPagingFiles >= 1);
ASSERT(!IsListEmpty(&SmpPagingFileDescriptorList));
- ASSERT(Descriptor->Flags & SMP_PAGEFILE_SYSTEM_MANAGED); // Descriptor->SystemManaged == 1 in ASSERT.
+ ASSERT(Descriptor->Flags & SMP_PAGEFILE_SYSTEM_MANAGED);
/* Keep decreasing the pagefile by this amount if we run out of space */
FuzzFactor.QuadPart = FUZZ_FACTOR;
diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c
index 1387a38527b..a57c4de0304 100644
--- a/ntoskrnl/mm/pagefile.c
+++ b/ntoskrnl/mm/pagefile.c
@@ -1,29 +1,9 @@
/*
- * ReactOS kernel
- * Copyright (C) 1998, 1999, 2000, 2001 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.
- */
-/*
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/mm/pagefile.c
- * PURPOSE: Paging file functions
- * PROGRAMMER: David Welch (welch(a)mcmail.com)
- * Pierre Schweitzer
- * UPDATE HISTORY:
- * Created 22/05/98
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Paging file functions
+ * COPYRIGHT: Copyright 1998-2003 David Welch <welch(a)mcmail.com>
+ * Copyright 2010-2018 Pierre Schweitzer <pierre(a)reactos.org>
*/
/* INCLUDES *****************************************************************/
@@ -34,7 +14,44 @@
/* GLOBALS *******************************************************************/
-#define PAIRS_PER_RUN (1024)
+/* Minimum pagefile size is 256 pages (1 MB) */
+#define MINIMUM_PAGEFILE_SIZE (256ULL * PAGE_SIZE)
+
+/* Maximum pagefile sizes for different architectures */
+#if defined(_M_IX86) && !defined(_X86PAE_)
+/* Around 4 GB */
+ #define MAXIMUM_PAGEFILE_SIZE ((1ULL * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(4ULL * GIGABYTE - 1)
+/* PAE uses the same size as x64 */
+#elif (defined(_M_IX86) && defined(_X86PAE_)) || defined (_M_AMD64) || defined(_M_ARM64)
+/* Around 16 TB */
+ #if (NTDDI_VERSION >= NTDDI_WIN10)
+ #define MAXIMUM_PAGEFILE_SIZE ((4ULL * 1024 * 1024 * 1024 - 2) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(16ULL * TERABYTE - PAGE_SIZE - 1)
+ #else
+ #define MAXIMUM_PAGEFILE_SIZE ((4ULL * 1024 * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(16ULL * TERABYTE - 1)
+ #endif
+#elif defined (_M_IA64)
+/* Around 32 TB */
+ #define MAXIMUM_PAGEFILE_SIZE ((8ULL * 1024 * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(32ULL * TERABYTE - 1)
+#elif defined(_M_ARM)
+/* Around 2 GB */
+ #if (NTDDI_VERSION >= NTDDI_WIN10)
+ #define MAXIMUM_PAGEFILE_SIZE ((512ULL * 1024 - 2) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(2ULL * GIGABYTE - PAGE_SIZE - 1)
+ #elif (NTDDI_VERSION >= NTDDI_WINBLUE) // NTDDI_WIN81
+ #define MAXIMUM_PAGEFILE_SIZE ((512ULL * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(2ULL * GIGABYTE - 1)
+ #else
+/* Around 4 GB */
+ #define MAXIMUM_PAGEFILE_SIZE ((1ULL * 1024 * 1024 - 1) * PAGE_SIZE)
+ // PAGE_ROUND_DOWN(4ULL * GIGABYTE - 1)
+ #endif
+#else
+#error Unknown architecture
+#endif
/* List of paging files, both used and free */
PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES];
@@ -409,33 +426,32 @@ NtCreatePagingFile(
}
/*
- * Pagefiles can't be larger than 4GB and of course
- * the minimum should be smaller than the maximum.
+ * Pagefiles cannot be larger than the platform-specific memory addressable
+ * limits, and of course the minimum should be smaller than the maximum.
*/
- // TODO: Actually validate the lower bound of these sizes!
- if (0 != SafeMinimumSize.u.HighPart)
+ if (SafeMinimumSize.QuadPart < MINIMUM_PAGEFILE_SIZE ||
+ SafeMinimumSize.QuadPart > MAXIMUM_PAGEFILE_SIZE)
{
return STATUS_INVALID_PARAMETER_2;
}
- if (0 != SafeMaximumSize.u.HighPart)
+ if (SafeMaximumSize.QuadPart < SafeMinimumSize.QuadPart ||
+ SafeMaximumSize.QuadPart > MAXIMUM_PAGEFILE_SIZE)
{
return STATUS_INVALID_PARAMETER_3;
}
- if (SafeMaximumSize.u.LowPart < SafeMinimumSize.u.LowPart)
- {
- return STATUS_INVALID_PARAMETER_MIX;
- }
/* Validate the name length */
if ((PageFileName.Length == 0) ||
- (PageFileName.Length > 128 * sizeof(WCHAR)))
+ (PageFileName.Length > MAXIMUM_FILENAME_LENGTH))
{
return STATUS_OBJECT_NAME_INVALID;
}
- /* We don't care about any potential UNICODE_NULL */
+ /* Allocate a buffer to keep the name copy. Note that it is kept only
+ * for information purposes, so it gets allocated in the paged pool,
+ * even if it will be stored in the PagingFile structure, that is
+ * allocated from non-paged pool (see below). */
PageFileName.MaximumLength = PageFileName.Length;
- /* Allocate a buffer to keep the name copy */
Buffer = ExAllocatePoolWithTag(PagedPool, PageFileName.Length, TAG_MM);
if (Buffer == NULL)
{
@@ -488,42 +504,26 @@ NtCreatePagingFile(
/* Initialize the DACL */
Status = RtlCreateAcl(Dacl, Count, ACL_REVISION);
if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
- }
+ goto EarlyQuit;
/* Grant full access to admins */
Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, FILE_ALL_ACCESS, SeAliasAdminsSid);
if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
- }
+ goto EarlyQuit;
/* Grant full access to SYSTEM */
Status = RtlAddAccessAllowedAce(Dacl, ACL_REVISION, FILE_ALL_ACCESS, SeLocalSystemSid);
if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
- }
+ goto EarlyQuit;
/* Attach the DACL to the security descriptor */
Status = RtlSetDaclSecurityDescriptor(&SecurityDescriptor, TRUE, Dacl, FALSE);
if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
- }
+ goto EarlyQuit;
InitializeObjectAttributes(&ObjectAttributes,
&PageFileName,
- OBJ_KERNEL_HANDLE,
+ OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
&SecurityDescriptor);
@@ -549,10 +549,10 @@ NtCreatePagingFile(
0,
CreateFileTypeNone,
NULL,
- SL_OPEN_PAGING_FILE | IO_NO_PARAMETER_CHECKING);
+ IO_OPEN_PAGING_FILE | IO_NO_PARAMETER_CHECKING);
/* If we failed, relax a bit constraints, someone may be already holding the
* the file, so share write, don't attempt to replace and don't delete on close
- * (basically, don't do anything conflicting)
+ * (basically, don't do anything conflicting).
* This can happen if the caller attempts to extend a page file.
*/
if (!NT_SUCCESS(Status))
@@ -572,13 +572,9 @@ NtCreatePagingFile(
0,
CreateFileTypeNone,
NULL,
- SL_OPEN_PAGING_FILE | IO_NO_PARAMETER_CHECKING);
+ IO_OPEN_PAGING_FILE | IO_NO_PARAMETER_CHECKING);
if (!NT_SUCCESS(Status))
- {
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
- }
+ goto EarlyQuit;
/* We opened it! Check we are that "someone" ;-)
* First, get the opened file object.
@@ -592,33 +588,22 @@ NtCreatePagingFile(
if (!NT_SUCCESS(Status))
{
ZwClose(FileHandle);
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return Status;
+ goto EarlyQuit;
}
/* Find if it matches a previous page file */
PagingFile = NULL;
- /* FIXME: should be calling unsafe instead,
- * we should already be in a guarded region
- */
KeAcquireGuardedMutex(&MmPageFileCreationLock);
- if (MmNumberOfPagingFiles > 0)
- {
- i = 0;
- while (MmPagingFile[i]->FileObject->SectionObjectPointer != FileObject->SectionObjectPointer)
+ for (i = 0; i < MmNumberOfPagingFiles; ++i)
+ {
+ if (MmPagingFile[i]->FileObject->SectionObjectPointer == FileObject->SectionObjectPointer)
{
- ++i;
- if (i >= MmNumberOfPagingFiles)
- {
- break;
- }
+ /* Same object pointer: this is the matching page file */
+ PagingFile = MmPagingFile[i];
+ break;
}
-
- /* This is the matching page file */
- PagingFile = MmPagingFile[i];
}
/* If we didn't find the page file, fail */
@@ -627,9 +612,8 @@ NtCreatePagingFile(
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
ZwClose(FileHandle);
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return STATUS_NOT_FOUND;
+ Status = STATUS_NOT_FOUND;
+ goto EarlyQuit;
}
/* Don't allow page file shrinking */
@@ -638,9 +622,8 @@ NtCreatePagingFile(
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
ZwClose(FileHandle);
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return STATUS_INVALID_PARAMETER_2;
+ Status = STATUS_INVALID_PARAMETER_2;
+ goto EarlyQuit;
}
if ((SafeMaximumSize.QuadPart >> PAGE_SHIFT) < PagingFile->MaximumSize)
@@ -648,9 +631,8 @@ NtCreatePagingFile(
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
ZwClose(FileHandle);
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return STATUS_INVALID_PARAMETER_3;
+ Status = STATUS_INVALID_PARAMETER_3;
+ goto EarlyQuit;
}
/* FIXME: implement parameters checking and page file extension */
@@ -659,13 +641,13 @@ NtCreatePagingFile(
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
ZwClose(FileHandle);
- ExFreePoolWithTag(Dacl, TAG_DACL);
- ExFreePoolWithTag(Buffer, TAG_MM);
- return STATUS_NOT_IMPLEMENTED;
+ Status = STATUS_NOT_IMPLEMENTED;
+ goto EarlyQuit;
}
if (!NT_SUCCESS(Status))
{
+EarlyQuit:
DPRINT1("Failed creating page file: %lx\n", Status);
ExFreePoolWithTag(Dacl, TAG_DACL);
ExFreePoolWithTag(Buffer, TAG_MM);
@@ -727,8 +709,10 @@ NtCreatePagingFile(
/* Only allow page file on a few device types */
DeviceType = IoGetRelatedDeviceObject(FileObject)->DeviceType;
- if (DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM && DeviceType != FILE_DEVICE_NETWORK_FILE_SYSTEM &&
- DeviceType != FILE_DEVICE_DFS_VOLUME && DeviceType != FILE_DEVICE_DFS_FILE_SYSTEM)
+ if (DeviceType != FILE_DEVICE_DISK_FILE_SYSTEM &&
+ DeviceType != FILE_DEVICE_NETWORK_FILE_SYSTEM &&
+ DeviceType != FILE_DEVICE_DFS_VOLUME &&
+ DeviceType != FILE_DEVICE_DFS_FILE_SYSTEM)
{
ObDereferenceObject(FileObject);
ZwClose(FileHandle);
@@ -738,7 +722,8 @@ NtCreatePagingFile(
/* Deny page file creation on a floppy disk */
FsDeviceInfo.Characteristics = 0;
- IoQueryVolumeInformation(FileObject, FileFsDeviceInformation, sizeof(FsDeviceInfo), &FsDeviceInfo, &Count);
+ IoQueryVolumeInformation(FileObject, FileFsDeviceInformation,
+ sizeof(FsDeviceInfo), &FsDeviceInfo, &Count);
if (BooleanFlagOn(FsDeviceInfo.Characteristics, FILE_FLOPPY_DISKETTE))
{
ObDereferenceObject(FileObject);
@@ -747,7 +732,27 @@ NtCreatePagingFile(
return STATUS_FLOPPY_VOLUME;
}
- PagingFile = ExAllocatePoolWithTag(NonPagedPool, sizeof(*PagingFile), TAG_MM);
+ /*
+ * Missing validation steps TODO:
+ * (see https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/mm/modwrite/c… )
+ *
+ * - Verify that no file system driver or any filter driver has done file
+ * I/O while opening the file.
+ * Verify that nothing of the paging file is yet in memory. Specifically,
+ * the file object must either have no SectionObjectPointer or the latter
+ * must have neither a DataSectionObject nor an ImageSectionObject.
+ * Otherwise, we should fail, returning STATUS_INCOMPATIBLE_FILE_MAP.
+ *
+ * - Inform all the applicable drivers to prepare for the possibility of
+ * paging I/O. Much of the point to paging I/O is to resolve page faults.
+ * Especially important is that drivers that handle paging I/O do not
+ * cause more page faults. All the code and data that each driver might
+ * ever use for access to the paging file must be locked into physical
+ * memory. This can’t be left until paging I/O actually occurs.
+ * It must be done in advance.
+ */
+
+ PagingFile = ExAllocatePoolZero(NonPagedPool, sizeof(*PagingFile), TAG_MM);
if (PagingFile == NULL)
{
ObDereferenceObject(FileObject);
@@ -756,17 +761,15 @@ NtCreatePagingFile(
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlZeroMemory(PagingFile, sizeof(*PagingFile));
-
PagingFile->FileHandle = FileHandle;
PagingFile->FileObject = FileObject;
- PagingFile->MaximumSize = (SafeMaximumSize.QuadPart >> PAGE_SHIFT);
PagingFile->Size = (SafeMinimumSize.QuadPart >> PAGE_SHIFT);
- PagingFile->MinimumSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT);
+ PagingFile->MinimumSize = PagingFile->Size;
+ PagingFile->MaximumSize = (SafeMaximumSize.QuadPart >> PAGE_SHIFT);
/* First page is never used: it's the header
* TODO: write it
*/
- PagingFile->FreeSpace = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE) - 1;
+ PagingFile->FreeSpace = PagingFile->Size - 1;
PagingFile->CurrentUsage = 0;
PagingFile->PageFileName = PageFileName;
ASSERT(PagingFile->Size == PagingFile->FreeSpace + PagingFile->CurrentUsage + 1);
@@ -789,10 +792,9 @@ NtCreatePagingFile(
(ULONG)(PagingFile->MaximumSize));
RtlClearAllBits(PagingFile->Bitmap);
- /* FIXME: should be calling unsafe instead,
- * we should already be in a guarded region
- */
+ /* Insert the new paging file information into the list */
KeAcquireGuardedMutex(&MmPageFileCreationLock);
+ /* Ensure the corresponding slot is empty yet */
ASSERT(MmPagingFile[MmNumberOfPagingFiles] == NULL);
MmPagingFile[MmNumberOfPagingFiles] = PagingFile;
MmNumberOfPagingFiles++;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5dc43c0f323da21d67e56…
commit 5dc43c0f323da21d67e5604bcf4a44f9b1988d75
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Nov 2 16:41:11 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Nov 16 21:54:21 2022 +0100
[SMSS] Improve some comments.
---
base/system/smss/pagefile.c | 49 +++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 26 deletions(-)
diff --git a/base/system/smss/pagefile.c b/base/system/smss/pagefile.c
index 0e3b6746746..2eed8a7236d 100644
--- a/base/system/smss/pagefile.c
+++ b/base/system/smss/pagefile.c
@@ -395,15 +395,15 @@ SmpGetVolumeFreeSpace(IN PSMP_VOLUME_DESCRIPTOR Volume)
SizeInfo.SectorsPerAllocationUnit;
FinalFreeSpace.QuadPart = FreeSpace.QuadPart * SizeInfo.BytesPerSector;
- /* Check if there's less than 32MB free so we don't starve the disk */
+ /* Check if there is less than 32 MB free so we don't starve the disk */
if (FinalFreeSpace.QuadPart <= MINIMUM_TO_KEEP_FREE)
{
- /* In this case, act as if there's no free space */
+ /* In this case, act as if there is no free space */
Volume->FreeSpace.QuadPart = 0;
}
else
{
- /* Trim off 32MB to give the disk a bit of breathing room */
+ /* Trim off 32 MB to give the disk a bit of breathing room */
Volume->FreeSpace.QuadPart = FinalFreeSpace.QuadPart -
MINIMUM_TO_KEEP_FREE;
}
@@ -456,14 +456,14 @@ SmpCreatePagingFile(IN PUNICODE_STRING Name,
Status = NtCreatePagingFile(Name, MinSize, MaxSize, Priority);
if (NT_SUCCESS(Status))
{
- DPRINT("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) succeeded.\n",
+ DPRINT("SMSS:PFILE: NtCreatePagingFile(%wZ, 0x%I64X, 0x%I64X) succeeded.\n",
Name,
MinSize->QuadPart,
MaxSize->QuadPart);
}
else
{
- DPRINT1("SMSS:PFILE: NtCreatePagingFile (%wZ, %I64X, %I64X) failed with %X\n",
+ DPRINT1("SMSS:PFILE: NtCreatePagingFile(%wZ, 0x%I64X, 0x%I64X) failed with %X\n",
Name,
MinSize->QuadPart,
MaxSize->QuadPart,
@@ -517,7 +517,7 @@ SmpCreatePagingFileOnFixedDrive(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
}
else
{
- DPRINT("Queried free space for boot volume `%wC: %I64x'\n",
+ DPRINT("Queried free space for boot volume `%wC: 0x%I64x'\n",
Volume->DriveLetter, Volume->FreeSpace.QuadPart);
}
@@ -541,10 +541,10 @@ SmpCreatePagingFileOnFixedDrive(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
/* Check how big we can make the pagefile */
Status = SmpGetPagingFileSize(&Descriptor->Name, &PageFileSize);
if (NT_SUCCESS(Status) && PageFileSize.QuadPart > 0) ShouldDelete = TRUE;
- DPRINT("SMSS:PFILE: Detected size %I64X for future paging file `%wZ'\n",
+ DPRINT("SMSS:PFILE: Detected size 0x%I64X for future paging file `%wZ'\n",
PageFileSize,
&Descriptor->Name);
- DPRINT("SMSS:PFILE: Free space on volume `%wC' is %I64X\n",
+ DPRINT("SMSS:PFILE: Free space on volume `%wC' is 0x%I64X\n",
Volume->DriveLetter,
Volume->FreeSpace.QuadPart);
@@ -558,7 +558,7 @@ SmpCreatePagingFileOnFixedDrive(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
{
Descriptor->ActualMaxSize = PageFileSize;
}
- DPRINT("SMSS:PFILE: min %I64X, max %I64X, real min %I64X\n",
+ DPRINT("SMSS:PFILE: min 0x%I64X, max 0x%I64X, real min 0x%I64X\n",
Descriptor->ActualMinSize.QuadPart,
Descriptor->ActualMaxSize.QuadPart,
MinimumSize->QuadPart);
@@ -595,7 +595,7 @@ SmpCreatePagingFileOnFixedDrive(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
/* FIXFIX: Windows Vista does this, and it seems like we should too, so try to see if this fixes KVM */
Volume->FreeSpace.QuadPart = PageFileSize.QuadPart;
}
- DPRINT1("SMSS:PFILE: Failing for min %I64X, max %I64X, real min %I64X\n",
+ DPRINT1("SMSS:PFILE: Failing for min 0x%I64X, max 0x%I64X, real min 0x%I64X\n",
Descriptor->ActualMinSize.QuadPart,
Descriptor->ActualMaxSize.QuadPart,
MinimumSize->QuadPart);
@@ -648,7 +648,7 @@ VOID
NTAPI
SmpMakeDefaultPagingFileDescriptor(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
{
- /* The default descriptor uses 128MB as a pagefile size */
+ /* The default descriptor uses 128 MB as a pagefile size */
Descriptor->Flags |= SMP_PAGEFILE_DEFAULT;
Descriptor->MinSize.QuadPart = 128 * MEGABYTE;
Descriptor->MaxSize.QuadPart = 128 * MEGABYTE;
@@ -675,7 +675,7 @@ SmpMakeSystemManagedPagingFileDescriptor(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
return;
}
- /* Chekc how much RAM we have and set three times this amount as maximum */
+ /* Check how much RAM we have and set three times this amount as maximum */
Ram = BasicInfo.NumberOfPhysicalPages * BasicInfo.PageSize;
MaximumSize = 3 * Ram;
@@ -699,8 +699,9 @@ SmpValidatePagingFileSizes(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
/* Capture the min and max */
MinSize = Descriptor->MinSize.QuadPart;
MaxSize = Descriptor->MaxSize.QuadPart;
- DPRINT("SMSS:PFILE: Validating sizes for `%wZ' %I64X %I64X\n",
- &Descriptor->Name, MinSize, MaxSize);
+
+ DPRINT("SMSS:PFILE: Validating sizes for `%wZ' 0x%I64X 0x%I64X\n",
+ &Descriptor->Name, MinSize, MaxSize);
/* Don't let minimum be bigger than maximum */
if (MinSize > MaxSize) MaxSize = MinSize;
@@ -713,27 +714,23 @@ SmpValidatePagingFileSizes(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor)
}
else
{
- /* Check if the minimum is more then 4095 MB */
+ /* Validate the minimum and maximum and trim them if they are too large */
if (MinSize > MAXIMUM_PAGEFILE_SIZE)
{
- /* Trim it, this isn't allowed */
WasTooBig = TRUE;
MinSize = MAXIMUM_PAGEFILE_SIZE;
}
- /* Check if the maximum is more then 4095 MB */
if (MaxSize > MAXIMUM_PAGEFILE_SIZE)
{
- /* Trim it, this isn't allowed */
WasTooBig = TRUE;
MaxSize = MAXIMUM_PAGEFILE_SIZE;
}
}
- /* Did we trim? */
+ /* If we trimmed, write a flag in the descriptor */
if (WasTooBig)
{
- /* Notify debugger output and write a flag in the descriptor */
DPRINT("SMSS:PFILE: Trimmed size of `%wZ' to maximum allowed\n",
&Descriptor->Name);
Descriptor->Flags |= SMP_PAGEFILE_WAS_TOO_BIG;
@@ -752,7 +749,7 @@ SmpCreateSystemManagedPagingFile(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
{
LARGE_INTEGER FuzzFactor, Size;
- /* Make sure there's at least 1 paging file and that we are system-managed */
+ /* Make sure there is at least 1 paging file and that we are system-managed */
ASSERT(SmpNumberOfPagingFiles >= 1);
ASSERT(!IsListEmpty(&SmpPagingFileDescriptorList));
ASSERT(Descriptor->Flags & SMP_PAGEFILE_SYSTEM_MANAGED); // Descriptor->SystemManaged == 1 in ASSERT.
@@ -764,10 +761,10 @@ SmpCreateSystemManagedPagingFile(IN PSMP_PAGEFILE_DESCRIPTOR Descriptor,
SmpMakeSystemManagedPagingFileDescriptor(Descriptor);
SmpValidatePagingFileSizes(Descriptor);
- /* Use either the minimum size in the descriptor, or 16MB in minimal mode */
+ /* Use either the minimum size in the descriptor, or 16 MB in minimal mode */
Size.QuadPart = DecreaseSize ? 16 * MEGABYTE : Descriptor->MinSize.QuadPart;
- /* Check if this should be a fixed pagefile or an any pagefile*/
+ /* Check if this should be a fixed pagefile or an any pagefile */
if (Descriptor->Name.Buffer[STANDARD_DRIVE_LETTER_OFFSET] == '?')
{
/* Find a disk for it */
@@ -965,15 +962,15 @@ SmpCreateVolumeDescriptors(VOID)
SizeInfo.SectorsPerAllocationUnit;
FinalFreeSpace.QuadPart = FreeSpace.QuadPart * SizeInfo.BytesPerSector;
- /* Check if there's less than 32MB free so we don't starve the disk */
+ /* Check if there is less than 32 MB free so we don't starve the disk */
if (FinalFreeSpace.QuadPart <= MINIMUM_TO_KEEP_FREE)
{
- /* In this case, act as if there's no free space */
+ /* In this case, act as if there is no free space */
Volume->FreeSpace.QuadPart = 0;
}
else
{
- /* Trim off 32MB to give the disk a bit of breathing room */
+ /* Trim off 32 MB to give the disk a bit of breathing room */
Volume->FreeSpace.QuadPart = FinalFreeSpace.QuadPart -
MINIMUM_TO_KEEP_FREE;
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12ef61ba101100b967935…
commit 12ef61ba101100b9679356ccc2567260f859e7d9
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Thu Nov 10 22:20:46 2022 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Tue Nov 15 23:16:10 2022 +0100
[WIN32SS:ENG] Set VGA device as child of primary device
That way, we don't have anymore the VGA device together with primary device in device list.
Change also EngpUnlinkGraphicsDevice() function to add back VGA device to device list
when removing its parent from device list.
CORE-18522
---
win32ss/gdi/eng/device.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index 1e2a46a0a17..ed6c00435e2 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -152,6 +152,10 @@ EngpUnlinkGraphicsDevice(
}
else
{
+ /* At first, link again associated VGA Device */
+ if (pGraphicsDevice->pVgaDevice)
+ EngpLinkGraphicsDevice(pGraphicsDevice->pVgaDevice);
+
/* We need to remove current device */
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice;
@@ -247,7 +251,7 @@ EngpUpdateGraphicsDeviceList(VOID)
bFoundNewDevice = TRUE;
/* Set the first one as primary device */
- if (!gpPrimaryGraphicsDevice)
+ if (!gpPrimaryGraphicsDevice || EngpHasVgaDriver(gpPrimaryGraphicsDevice))
{
gpPrimaryGraphicsDevice = pGraphicsDevice;
TRACE("gpPrimaryGraphicsDevice = %p\n", gpPrimaryGraphicsDevice);
@@ -257,6 +261,18 @@ EngpUpdateGraphicsDeviceList(VOID)
/* Close the device map registry key */
ZwClose(hkey);
+ /* Can we link VGA device to primary device? */
+ if (gpPrimaryGraphicsDevice &&
+ gpVgaGraphicsDevice &&
+ gpPrimaryGraphicsDevice != gpVgaGraphicsDevice &&
+ !gpPrimaryGraphicsDevice->pVgaDevice)
+ {
+ /* Yes. Remove VGA device from global list, and attach it to primary device */
+ TRACE("Linking VGA device %S to primary device %S\n", gpVgaGraphicsDevice->szNtDeviceName, gpPrimaryGraphicsDevice->szNtDeviceName);
+ EngpUnlinkGraphicsDevice(gpVgaGraphicsDevice);
+ gpPrimaryGraphicsDevice->pVgaDevice = gpVgaGraphicsDevice;
+ }
+
if (bFoundNewDevice && gbBaseVideo)
{
PGRAPHICS_DEVICE pToDelete;