[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).
This commit is contained in:
Hermès Bélusca-Maïto 2022-11-03 02:34:20 +01:00
parent a8e06d92e8
commit 04b2d35f5b
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
28 changed files with 385 additions and 256 deletions

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."
*/

View file

@ -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."

View file

@ -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"

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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 "変更を適用するには、コンピュータを再起動する必要があります。"

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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 "Необходимо перезагрузить компьютер для применения изменений."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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."

View file

@ -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 "Необхідно перезавантажити комп'ютер для застосування нових параметрів."

View file

@ -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 "您必须重新启动计算机,才能应用更改。"

View file

@ -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 "您必須重新啟動電腦,才能套用更改。"

View file

@ -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 "您必須重新啟動電腦,才能套用更改。"

View file

@ -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)
{
HKEY hk = NULL;
TCHAR szPagingFiles[2048];
TCHAR szText[256];
INT i, nPos = 0;
BOOL bErr = TRUE;
HKEY hk = NULL;
TCHAR szText[256];
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;