├── makefile ├── eram.cpl ├── eramui ├── eramum.rc ├── eramue.bin ├── eramui.ico ├── eramui.def ├── eram.vcxproj.user ├── sources ├── eram.sln ├── eramui.h ├── eramum.mc ├── eramui.rc ├── eramum.cs ├── eram.vcxproj └── eramui.c ├── images ├── benchmark.png ├── ERAM_Options.png ├── benchmark_2.png ├── Empty_ERAM_Drive.png └── ERAM_Drive_Properties.png ├── sources ├── eram.vcxproj.user ├── LICENSE ├── eram.sln ├── readme_jp.txt ├── readme.md ├── eram.rc ├── readme_en.txt ├── .gitignore ├── eramum.h ├── eram.vcxproj └── eram.h /makefile: -------------------------------------------------------------------------------- 1 | !INCLUDE $(NTMAKEENV)\makefile.def -------------------------------------------------------------------------------- /eram.cpl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/eram.cpl -------------------------------------------------------------------------------- /eramui/eramum.rc: -------------------------------------------------------------------------------- 1 | LANGUAGE 0x9,0x1 2 | 1 11 "eramue.bin" 3 | -------------------------------------------------------------------------------- /eramui/eramue.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/eramui/eramue.bin -------------------------------------------------------------------------------- /eramui/eramui.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/eramui/eramui.ico -------------------------------------------------------------------------------- /images/benchmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/images/benchmark.png -------------------------------------------------------------------------------- /images/ERAM_Options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/images/ERAM_Options.png -------------------------------------------------------------------------------- /images/benchmark_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/images/benchmark_2.png -------------------------------------------------------------------------------- /images/Empty_ERAM_Drive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/images/Empty_ERAM_Drive.png -------------------------------------------------------------------------------- /images/ERAM_Drive_Properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zero3K/ERAM/HEAD/images/ERAM_Drive_Properties.png -------------------------------------------------------------------------------- /eramui/eramui.def: -------------------------------------------------------------------------------- 1 | LIBRARY ERAM 2 | EXPORTS 3 | CPlApplet 4 | EramClassInstall 5 | EnumPropPages32 6 | EramUninstall 7 | StartupFastfat 8 | -------------------------------------------------------------------------------- /eramui/eram.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /sources: -------------------------------------------------------------------------------- 1 | # ERAM for Windows NT/2000/XP sources file 2 | TARGETNAME=eram 3 | TARGETPATH=. 4 | TARGETTYPE=DRIVER 5 | INCLUDES=$(BASEDIR)\inc;$(BASEDIR)\src\storagej\inc 6 | 386_WARNING_LEVEL=-W4 7 | SOURCES=eram.c \ 8 | eram.rc 9 | LINKER_FLAGS=-MAP:eram.map 10 | -------------------------------------------------------------------------------- /eramui/sources: -------------------------------------------------------------------------------- 1 | # ERAM for Windows NT/2000/XP sources file 2 | TARGETNAME=eramui 3 | TARGETPATH=. 4 | TARGETTYPE=DYNLINK 5 | UMTYPE=windows 6 | INCLUDES=$(BASEDIR)\inc;$(BASEDIR)\src\storagej\inc 7 | 386_WARNING_LEVEL=-W4 8 | USE_LIBCMT=1 9 | TARGETLIBS= \ 10 | $(DDK_LIB_PATH)\comctl32.lib \ 11 | $(DDK_LIB_PATH)\kernel32.lib \ 12 | $(DDK_LIB_PATH)\user32.lib \ 13 | $(DDK_LIB_PATH)\advapi32.lib 14 | SOURCES = eramui.c \ 15 | eramui.rc 16 | LINKER_FLAGS=-MAP:eram.map 17 | -------------------------------------------------------------------------------- /eram.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Off 5 | 6 | 7 | 8 | 9 | Off 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 ZeroK (Original Author is Hideaki Okubo) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /eram.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30204.135 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eram", "eram.vcxproj", "{1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Debug|x64.ActiveCfg = Debug|x64 17 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Debug|x64.Build.0 = Debug|x64 18 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Debug|x86.ActiveCfg = Debug|Win32 19 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Debug|x86.Build.0 = Debug|Win32 20 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Release|x64.ActiveCfg = Release|x64 21 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Release|x64.Build.0 = Release|x64 22 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Release|x86.ActiveCfg = Release|Win32 23 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {0560D871-61CF-4C6A-B33D-639AED5BA2AE} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /eramui/eram.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.106 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ERAM", "eram.vcxproj", "{67D265DA-FDBD-4D2E-B573-5387E5021492}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Debug|x64.ActiveCfg = Debug|x64 17 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Debug|x64.Build.0 = Debug|x64 18 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Debug|x86.ActiveCfg = Debug|Win32 19 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Debug|x86.Build.0 = Debug|Win32 20 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Release|x64.ActiveCfg = Release|x64 21 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Release|x64.Build.0 = Release|x64 22 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Release|x86.ActiveCfg = Release|Win32 23 | {67D265DA-FDBD-4D2E-B573-5387E5021492}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {166CD6E8-08CE-437A-B985-93B57ADF93B4} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /readme_jp.txt: -------------------------------------------------------------------------------- 1 | 2 |  ERAM for Windows XP / NT/ 2000 / 7 / 10 (32-bit and 64-bit) v2.23 暫定版 3 |                         2004.7.11 えらー15 4 | 5 |  v2.20,21からの一部変更版です。v2.22の修正版です。 6 | 7 |  正式版ではありません。このドキュメントを読んで、 8 | よくわからない方は使用しないでください。 9 | 技術的に詳しくない方のサポートはいたしかねます。 10 | 11 | ・over4GB環境でPAE NOLOWMEM指定時、MAXMEM=nの指定がover4GB領域に 12 |  効くことの考慮漏れを修正 (したつもり) v2.23以降 13 | 14 |  over4GB環境でNOLOWMEM指定すると、MAXMEM=nの制限開始位置もover4GB位置に 15 |  移動します。しかしv2.21以前では、安全対策のためn~4095MBの範囲のRAMしか 16 |  使わないようなチェックを入れており、NOLOWMEM環境では実際に使えるメモリが 17 |  少ないものになっていました。 18 |  そこで、PAE NOLOWMEM指定時にはMAXMEM=17が指定されたかのような流れに 19 |  入るような制御を追加してみました。4GB空間の最上位の数MBはPCIに使われるので 20 |  実質4000MB程度のメモリを利用できる…かもしれません。 21 |  手元にはover4GB環境が無いので、実際に動くかどうかはわかりません。 22 | 23 |  天夢 森流彩さんに細かい情報をいただきました。ありがとうございました。 24 |  1.7GBあたりの壁は少なくとも天夢 森流彩さんの環境ではv2.21時点で突破されました。 25 | 26 |  この新しいドライバは、とりあえず従来のINFファイルでインストールできます。 27 | 28 |  なお、PAE無しのNOLOWMEM指定時の挙動についてはv2.23時点では依然として 29 |  MAXMEM=nを誤認しますが解決策は今のところ不明です。 30 | 31 | ・ACPIのメモリを除外 (したつもり) v2.21以降 32 | 33 |  ACPI NVS, ACPI Reclaim はACPI BIOSによって物理RAMの最上位に置かれます。 34 |  MAXMEM指定の無い場合、これらの領域は Loader Reserved となり、OSから 35 |  使用されることはありませんが、MAXMEM=n指定の際はOS管理外となり、 36 |  自分で管理しなければなりませんでした。 37 |  しかし、ACPIの環境がほぼ標準になるにつれて、ちゃんと動かない旨の情報も 38 |  増えてきています。 39 |  ACPIの情報はリアルモードにていわゆる E820 I/F にて取得する必要がありますが 40 |  NT系のドライバからはBIOSを呼べませんので、メモリ中のテーブルから 41 |  推測する方式にしました。 42 |  テーブル内容はACPI BIOS仕様書2.0c(2003/8/25)に従っているつもりです。 43 | 44 |  しかし手元にACPIなマシンが2つしかありません。 45 |  手元の2台では大丈夫ですが、世間一般に大丈夫どうかは不明です。 46 | 47 |  その場合でも、RAMディスクの容量をACPI領域と重ならない程度に小さくすれば 48 |  問題は発生しません。 49 | 50 |  この新しいドライバは、とりあえず従来のINFファイルでインストールできます。 51 | 52 | ・2個目のドライバインストールに対応 (暫定) v2.21以降 53 | 54 |  試しに2個入れてみたいという要望がありましたので、無理矢理2個目を 55 |  インストールできるようにしてみました。 56 | 57 |  新しいドライバは、1個目と2個目が共通ですが、ファイル名がeram2.sysに 58 |  なります。ドライバ名もEram2になります。Windows2000以降では、1個目のような 59 |  ハードウェアウィザードを用いるのではなく、INFの右クリックになります。 60 |  INFファイルは、2NDディレクトリの下に置いていますが、事故を避けるため 61 |  IN_と拡張子を変えています。 62 |   拡張子を戻す 63 |   右クリックでインストール 64 |   リブート 65 | 66 |  【重要】 67 |   暫定版のため、Eram2 の設定を画面から変更することはできません。 68 |   Eram の設定を変更したものを参考にし、レジストリを触ることになります。 69 | 70 |  【重要】 71 |   暫定版のため、アンインストーラがありません。 72 |   レジストリから Eram2 を検索して消すことになります。 73 |   ファイルは eram2.sys を消すことになります。 74 | 75 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # ERAM 2 | 3 | ERAM v2.30 is an Opensource RAM Disk made by Hideaki Okubo (okubo at msh.biglobe.ne.jp) with the source code comments translated by Katayama Hirofumi MZ (katayama.hirofumi.mz at gmail.com) and some modifications made by me thanks to help from a member of community.osr.com. It has a size limit of 4 GB that uses page/non-paged/external RAM. You can use it for storing temp files, browser cache, etc. in order to speed up the programs that use those files. 4 | 5 | ## Install Instructions 6 | 7 | 0. Download from the Releases section (available at https://github.com/Zero3K/ERAM/releases) 8 | 9 | x86 (32-bit) 10 | ------------ 11 | 1. Run the `ERAM_x86.exe`. 12 | 2. Follow the instructions. 13 | 14 | x64 (64-bit) 15 | ------------ 16 | 1. Run the `ERAM_x64.exe` 17 | (you might have to run the Installer with Driver Signature Enforcement Disabled for it to install without any errors). 18 | 2. Follow the instructions. 19 | 20 | After installing, the RAM Disk will be available as the R: or Z: drive with a size of 1 GB (for 32-bit OSes) and 4 GB (for 64-bit OSes) which can be changed as you see fit by running `eram.cpl` by pressing Win + R. 21 | 22 | ## Build Instructions - 23 | 24 | 1. Download WDK (Windows Driver Kit) 7.1.0 from https://www.microsoft.com/en-us/download/details.aspx?id=11800. 25 | 2. Extract the ISO using 7-Zip, etc. to a directory of your choosing. 26 | 3. Run the KitSetup.exe located in the directory it was extracted to. 27 | 4. Click Full Development Environment. 28 | 5. Click OK. 29 | 6. After the install has completed, you can find the Build Environments in the Start Menu in Windows Driver Kits\WDK 7600.16385.1\Build Environments. 30 | 7. Open the proper Environment depending on what OS and CPU architecture you are building for (Only the Checked Build Environment works for now). 31 | 8. Change the directory to the location of the source code (for example, cd C:\ERAM). 32 | 9. Type build and press Enter. 33 | 34 | ## Benchmarks - 35 | 36 | ![ERAM Benchmark done on Windows 7 64-bit](images/benchmark.png) 37 | ![ERAM Benchmark done on a Windows 7 64-bit Virtual Machine](images/benchmark_2.png) 38 | 39 | ## Screenshots - 40 | 41 | ![ERAM's RAM Disk Contents in a Windows 7 64-bit Virtual Machine](images/Empty_ERAM_Drive.png) 42 | ![ERAM's RAM Disk Properties in a Windows 7 64-bit Virtual Machine](images/ERAM_Drive_Properties.png) 43 | 44 | ![ERAM's Control Panel Applet in a Windows 7 64-bit Virtual Machine](images/ERAM_Options.png) 45 | 46 | ## Original Developer's Site - 47 | 48 | http://www.vector.co.jp/authors/VA000363 49 | -------------------------------------------------------------------------------- /eram.rc: -------------------------------------------------------------------------------- 1 | /* ERAM.RC RAM Disk ERAM for WindowsNT/2000/2003/XP/7 2 | Copyright (c) 1999-2020 by *Error15 & Zero3K 3 | */ 4 | 5 | #include 6 | 7 | #ifdef RC_INVOKED 8 | 9 | ///////////////////////////////////////////////////////////////////////////// 10 | // Japanese resources 11 | 12 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) 13 | #ifdef _WIN32 14 | LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT 15 | #pragma code_page(932) 16 | #endif //_WIN32 17 | 18 | VS_VERSION_INFO VERSIONINFO 19 | FILEVERSION 2,30 20 | PRODUCTVERSION 2,30 21 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 22 | FILEFLAGS 0x0L 23 | FILEOS VOS_NT_WINDOWS32 24 | FILETYPE VFT_DRV 25 | FILESUBTYPE VFT2_DRV_SYSTEM 26 | BEGIN 27 | BLOCK "StringFileInfo" 28 | BEGIN 29 | BLOCK "041104b0" //Japanese 30 | BEGIN 31 | VALUE "Comments", "ERAM" 32 | VALUE "CompanyName", "*Error15 & Zero3K" 33 | VALUE "FileDescription", "ERAM" 34 | VALUE "FileVersion", "2.30" 35 | VALUE "InternalName", "eram.sys" 36 | VALUE "LegalCopyright", "Copyright (C) 1999-2020 *Error15 & Zero3K" 37 | VALUE "OriginalFilename", "eram.sys" 38 | VALUE "ProductName", "ERAM" 39 | VALUE "ProductVersion", "2.30" 40 | END 41 | END 42 | BLOCK "VarFileInfo" 43 | BEGIN 44 | VALUE "Translation", 0x411, 1200 45 | END 46 | END 47 | 48 | #endif // Japanese resources 49 | ///////////////////////////////////////////////////////////////////////////// 50 | 51 | 52 | ///////////////////////////////////////////////////////////////////////////// 53 | // English (America) resources 54 | 55 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 56 | #ifdef _WIN32 57 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 58 | #pragma code_page(1252) 59 | #endif //_WIN32 60 | 61 | VS_VERSION_INFO VERSIONINFO 62 | FILEVERSION 2,30 63 | PRODUCTVERSION 2,30 64 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 65 | FILEFLAGS 0x0L 66 | FILEOS VOS_NT_WINDOWS32 67 | FILETYPE VFT_DRV 68 | FILESUBTYPE VFT2_DRV_SYSTEM 69 | BEGIN 70 | BLOCK "StringFileInfo" 71 | BEGIN 72 | BLOCK "040904b0" //English 73 | BEGIN 74 | VALUE "Comments", "ERAM" 75 | VALUE "CompanyName", "*Error15 & Zero3K" 76 | VALUE "FileDescription", "ERAM" 77 | VALUE "FileVersion", "2.30" 78 | VALUE "InternalName", "eram.sys" 79 | VALUE "LegalCopyright", "Copyright (C) 1999-2020 *Error15 & Zero3K" 80 | VALUE "OriginalFilename", "eram.sys" 81 | VALUE "ProductName", "ERAM" 82 | VALUE "ProductVersion", "2.30" 83 | END 84 | END 85 | BLOCK "VarFileInfo" 86 | BEGIN 87 | VALUE "Translation", 0x409, 1200 88 | END 89 | END 90 | 91 | #endif // English (America) resources 92 | 93 | #endif //RC_INVOKED 94 | -------------------------------------------------------------------------------- /eramui/eramui.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by eramui.rc 4 | // 5 | #define IDS_ERR_OPEN_REG 1 6 | #define IDS_PROMPT_REBOOT 2 7 | #define IDC_UPDATE 3 8 | #define IDS_ERR_REBOOT 3 9 | #define IDS_ERR_REG_MODIFY 4 10 | #define IDS_WARN_DRV_USING 5 11 | #define IDS_WARN_LIMIT_SIZE 6 12 | #define IDS_WARN_LIMIT_SIZE_THIS_UNIT 7 13 | #define IDS_PROMPT_ERAM_REMOVE 8 14 | #define IDS_ERR_DETECT_OS 9 15 | #define IDS_PROMPT_BEFORE_DEVMGR 10 16 | #define IDS_ERR_NEED_REMOVE_PRIV 11 17 | #define IDS_ERR_OPEN_ERAM 12 18 | #define IDS_ERR_ERAM_REMOVE 13 19 | #define IDS_ERR_GET_SYSDIR 14 20 | #define IDS_ERR_REMOVE 15 21 | #define IDS_ERR_LOAD_SETUPAPI 16 22 | #define IDS_ERR_GETPROC_SETUPAPI 17 23 | #define IDS_ERR_DRIVER_ENUM 18 24 | #define IDS_ERR_DRIVER_REMOVE 19 25 | #define IDS_INFO_FASTFAT_USAGE 20 26 | #define IDS_ERR_NEED_CTRL_PRIV 21 27 | #define IDS_ERR_OPEN_SCM 22 28 | #define IDS_ERR_OPEN_FASTFAT 23 29 | #define IDS_INFO_FASTFAT_ALREADY 24 30 | #define IDS_ERR_FASTFAT_MODIFY 25 31 | #define IDS_INFO_FASTFAT_MODIFY 26 32 | #define IDS_INFO_DESC 27 33 | #define IDS_TAB_TITLE 28 34 | #define IDS_START_TYPE_0 29 35 | #define IDS_START_TYPE_1 30 36 | #define IDS_START_TYPE_2 31 37 | #define IDS_START_TYPE_3 32 38 | #define IDS_START_TYPE_4 33 39 | #define IDS_WARN_LIMIT_MAX_SIZE 34 40 | #define IDS_WARN_LIMIT_ROOTDIR 35 41 | #define IDD_SETUP 101 42 | #define IDI_ICON 102 43 | #define IDC_COMBO_DRIVE 103 44 | #define IDC_EDIT_ROOTDIR 104 45 | #define IDC_COMBO_ALLOCUNIT 105 46 | #define IDC_EDIT_MEDIAID 106 47 | #define IDC_EDIT_PAGE 107 48 | #define IDC_EDIT_EXTSTART_MB 108 49 | #define IDC_RADIO_PAGED 1002 50 | #define IDC_RADIO_EXTERNAL 1003 51 | #define IDC_RADIO_NONPAGED 1004 52 | #define IDC_CHECK_LOCAL_DISK 1005 53 | #define IDC_CHECK_EXTSTART 1006 54 | #define IDC_CHECK_MAKE_TEMP 1007 55 | #define IDC_STATIC_EXT 1008 56 | #define IDC_STATIC_EXTSTART_MB 1009 57 | #define IDC_CHECK_NOTSEARCHSKIP 1010 58 | #define IDC_CHECK_REPORTUSAGE 1011 59 | #define IDC_STATIC -1 60 | 61 | // Next default values for new objects 62 | // 63 | #ifdef APSTUDIO_INVOKED 64 | #ifndef APSTUDIO_READONLY_SYMBOLS 65 | #define _APS_NO_MFC 1 66 | #define _APS_3D_CONTROLS 1 67 | #define _APS_NEXT_RESOURCE_VALUE 109 68 | #define _APS_NEXT_COMMAND_VALUE 40001 69 | #define _APS_NEXT_CONTROL_VALUE 1011 70 | #define _APS_NEXT_SYMED_VALUE 101 71 | #endif 72 | #endif 73 | -------------------------------------------------------------------------------- /readme_en.txt: -------------------------------------------------------------------------------- 1 | ERAM for Windows XP / NT / 2000 / 7 / 10 (32 and 64-bit) v2.24 2 | 2004.7.11 error 15 with changes done 2018.11.26 by Zero3K 3 | 4 | Part from v2.20,21 is modified version. v2.22 is a modified version of. 5 | 6 | It is not in the official version. Read this document, 7 | Please do not use those who do not know well. 8 | Who support not technical details, we can not do. 9 | 10 | · Over4GB-time environment in PAE NOLOWMEM specified, specified MAXMEM = n is in over4GB area 11 | Modify the consideration leakage of that work (was going) v2.23 or later 12 | 13 | If you NOLOWMEM specified in over4GB environment, to limit the starting position also over4GB position of MAXMEM = n 14 | Move. However v2.21 and earlier, only the RAM in the range of n ~ 4095MB for safety measures 15 | And put a check that does not use, is the memory actually available in the NOLOWMEM environment 16 | It had become something less. 17 | So, at the time of PAE NOLOWMEM specified in the flow, such as if MAXMEM = 17 is specified 18 | I tried to add a control, such as fall. Since the number MB of the top of the 4GB space is used for PCI 19 | Available about real 4000MB memory ... might. 20 | Since the hand there is no over4GB environment, I do not know whether or not actually move. 21 | 22 | We had a fine information to Ten'yume forest Nagareirodori's. Thank you very much. 23 | Wall per 1.7GB is at least Ten'yume forest Nagareirodori's environment has been surpassed in the v2.21 time. 24 | 25 | This new driver, you can install the time being in a conventional INF file. 26 | 27 | It should be noted that, for the behavior at the time of NOLOWMEM specified without PAE is still in v2.23 time 28 | We misidentified the MAXMEM = n, but solution is unknown for now. 29 | 30 | And exclusion of the ACPI of memory (going to) v2.21 or later 31 | 32 | ACPI NVS, ACPI Reclaim is placed on top of the physical RAM by the ACPI BIOS. 33 | MAXMEM If not specified, these regions Loader Reserved next, from the OS 34 | Will not be used, but, at the time of MAXMEM = n specify becomes the OS unmanaged, 35 | You had to manage on their own. 36 | However, as the ACPI of the environment is almost standard, also information to the effect that it does not work properly 37 | It has increased. 38 | Although ACPI of information must be acquired by the so-called E820 I / F in the realistic mode 39 | Because from the NT-based driver can not call the BIOS, from the table in the memory 40 | It was to guess method. 41 | Table content is going to follow the ACPI BIOS specification 2.0c (2003/8/25). 42 | 43 | But there is no ACPI machines are only two on hand. 44 | Okay at hand two, but whether all right to the general public is unknown. 45 | 46 | Even then, by reducing the capacity of the RAM disk so as not to overlap with ACPI region 47 | The problem does not occur. 48 | 49 | This new driver, you can install the time being in a conventional INF file. 50 | 51 | - Two eyes of the corresponding to the driver installation (provisional) v2.21 or later 52 | 53 | Because there was a desire to try two put on trial, two eyes forced the 54 | I tried to be able to install. 55 | 56 | The new driver is the one first and two second is common, but the file name is in eram2.sys 57 | Become. Also driver name will Eram2. Windows2000 and later, such as the one first 58 | Rather than using the hardware wizard, it will be to the right-click of the INF. 59 | INF file, but it is placed under the 2ND directory, to avoid the hazard 60 | We changed the IN_ and extension. 61 | Return the extension 62 | Install the right-click 63 | Reboot 64 | 65 | [Important] 66 | Because of the preliminary version, you will not be able to change the settings of Eram2 from the screen. 67 | And a modification of the set of Eram in the reference, it will touch the registry. 68 | 69 | [Important] 70 | Because of the preliminary version, there is no uninstaller. 71 | It will be turned off and search for Eram2 from the registry. 72 | Files will be erased the eram2.sys. 73 | -------------------------------------------------------------------------------- /eramui/eramum.mc: -------------------------------------------------------------------------------- 1 | ;// 2 | ;// Message Definitions for ERAM 3 | ;// 4 | 5 | ;// Header 6 | LanguageNames=(English=0x409:eramue) 7 | MessageIdTypedef=NTSTATUS 8 | FacilityNames=(System=0x0FF) 9 | 10 | ;// Message Definitions 11 | MessageId=0x1 12 | Severity=Error 13 | Facility=System 14 | SymbolicName=ERAM_ERROR_FUNCTIONERROR 15 | Language=English 16 | Function %2 returned a failure.%0 17 | . 18 | 19 | MessageId=0x2 20 | Severity=Error 21 | Facility=System 22 | SymbolicName=ERAM_ERROR_MAXMEM_ALREADY_FREE 23 | Language=English 24 | OS-Unmanaged Memory is already released.%0 25 | . 26 | 27 | MessageId=0x3 28 | Severity=Error 29 | Facility=System 30 | SymbolicName=ERAM_ERROR_MAXMEM_MAP_FAILED 31 | Language=English 32 | Failed to map OS-Unmanaged Memory.%0 33 | . 34 | 35 | MessageId=0x4 36 | Severity=Error 37 | Facility=System 38 | SymbolicName=ERAM_ERROR_MAXMEM_REPORT_USAGE_FAILED 39 | Language=English 40 | Failed to notify usage of OS-Unmanaged Memory.%0 41 | . 42 | 43 | MessageId=0x5 44 | Severity=Error 45 | Facility=System 46 | SymbolicName=ERAM_ERROR_MAXMEM_REPORT_USAGE_CONFLICT 47 | Language=English 48 | OS-Unmanaged Memory is being partially used by another device. Please shrink the disk size.%0 49 | . 50 | 51 | MessageId=0x6 52 | Severity=Error 53 | Facility=System 54 | SymbolicName=ERAM_ERROR_CREATE_THREAD 55 | Language=English 56 | Failed to create a system thread.%0 57 | . 58 | 59 | MessageId=0x7 60 | Severity=Error 61 | Facility=System 62 | SymbolicName=ERAM_ERROR_MAXMEM_NO_MEMORY 63 | Language=English 64 | OS-Unmanaged Memory was not detected.%0 65 | . 66 | 67 | MessageId=0x8 68 | Severity=Error 69 | Facility=System 70 | SymbolicName=ERAM_ERROR_MAXMEM_NOT_DETECTED 71 | Language=English 72 | OS-Unmanaged Memory was not found.%0 73 | . 74 | 75 | MessageId=0x9 76 | Severity=Error 77 | Facility=System 78 | SymbolicName=ERAM_ERROR_OPTION_WORK_ALLOC_FAILED 79 | Language=English 80 | Failed to allocate the OS startup option(s).%0 81 | . 82 | 83 | MessageId=0xa 84 | Severity=Error 85 | Facility=System 86 | SymbolicName=ERAM_ERROR_OPTION_GET_FAILED 87 | Language=English 88 | Failed to get the OS startup option(s).%0 89 | . 90 | 91 | MessageId=0xb 92 | Severity=Error 93 | Facility=System 94 | SymbolicName=ERAM_ERROR_MAXMEM_NO_OPTION 95 | Language=English 96 | There was no %bMAXMEM=n%b in startup options.%0 97 | . 98 | 99 | MessageId=0xc 100 | Severity=Error 101 | Facility=System 102 | SymbolicName=ERAM_ERROR_MAXMEM_CAPITAL_FAILED 103 | Language=English 104 | Failed to capitalize the startup option(s).%0 105 | . 106 | 107 | MessageId=0xd 108 | Severity=Error 109 | Facility=System 110 | SymbolicName=ERAM_ERROR_MAXMEM_ATOU 111 | Language=English 112 | Failed to numerize MAXMEM.%0 113 | . 114 | 115 | MessageId=0xe 116 | Severity=Error 117 | Facility=System 118 | SymbolicName=ERAM_ERROR_MAXMEM_TOO_SMALL 119 | Language=English 120 | Please specify 17 MB or more for MAXMEM.%0 121 | . 122 | 123 | MessageId=0xf 124 | Severity=Error 125 | Facility=System 126 | SymbolicName=ERAM_ERROR_MAXMEM_TOO_BIG 127 | Language=English 128 | Please specify a value smaller than 4095 MB for MAXMEM.%0 129 | . 130 | 131 | MessageId=0x10 132 | Severity=Error 133 | Facility=System 134 | SymbolicName=ERAM_ERROR_MAXMEM_INVALID 135 | Language=English 136 | The startup option(s) has no MAXMEM=n or has an invalid MAXMEM value.%0 137 | . 138 | 139 | MessageId=0x11 140 | Severity=Error 141 | Facility=System 142 | SymbolicName=ERAM_ERROR_EXTSTART_TOO_BIG 143 | Language=English 144 | Please specify a value smaller than 4095 MB for ExtStart.%0 145 | . 146 | 147 | MessageId=0x12 148 | Severity=Error 149 | Facility=System 150 | SymbolicName=ERAM_ERROR_WORK_ALLOC_FAILED 151 | Language=English 152 | Failed to allocate the work-area memory.%0 153 | . 154 | 155 | MessageId=0x13 156 | Severity=Error 157 | Facility=System 158 | SymbolicName=ERAM_ERROR_REG_KEY_APPEND_FAILED 159 | Language=English 160 | Failed to combine the registry key strings.%0 161 | . 162 | 163 | MessageId=0x14 164 | Severity=Error 165 | Facility=System 166 | SymbolicName=ERAM_ERROR_CREATE_DEVICE_FAILED 167 | Language=English 168 | Failed to create a device.%0 169 | . 170 | 171 | MessageId=0x15 172 | Severity=Error 173 | Facility=System 174 | SymbolicName=ERAM_ERROR_DISK_SIZE_TOO_SMALL 175 | Language=English 176 | The assigned disk size is too small.%0 177 | . 178 | 179 | MessageId=0x16 180 | Severity=Error 181 | Facility=System 182 | SymbolicName=ERAM_ERROR_DEVICE_NAME_ALLOC_FAILED 183 | Language=English 184 | Failed to allocate the device name area.%0 185 | . 186 | 187 | MessageId=0x17 188 | Severity=Error 189 | Facility=System 190 | SymbolicName=ERAM_ERROR_CREATE_SYMBOLIC_LINK_FAILED 191 | Language=English 192 | Failed to create a symbolic link.%0 193 | . 194 | 195 | MessageId=0x18 196 | Severity=Error 197 | Facility=System 198 | SymbolicName=ERAM_ERROR_DISK_ALLOC_FAILED 199 | Language=English 200 | Failed to allocate the memory to be used for the disk.%0 201 | . 202 | 203 | MessageId=0x19 204 | Severity=Error 205 | Facility=System 206 | SymbolicName=ERAM_ERROR_DISK_SIZE_IS_0 207 | Language=English 208 | The size of the disk cannot be 0.%0 209 | . 210 | 211 | MessageId=0x1a 212 | Severity=Error 213 | Facility=System 214 | SymbolicName=ERAM_ERROR_TRANSLATE_ADDRESS_FAILED 215 | Language=English 216 | Failed to convert to OS-Managed Address.%0 217 | . 218 | 219 | MessageId=0x1b 220 | Severity=Error 221 | Facility=System 222 | SymbolicName=ERAM_ERROR_PORT_MAPPED 223 | Language=English 224 | No support of I/O space mapping.%0 225 | . 226 | 227 | MessageId=0x1c 228 | Severity=Error 229 | Facility=System 230 | SymbolicName=ERAM_ERROR_CREATE_EXT_FILE 231 | Language=English 232 | Failed to create the external file.%0 233 | . 234 | 235 | MessageId=0x1d 236 | Severity=Error 237 | Facility=System 238 | SymbolicName=ERAM_ERROR_SET_INFO_EXT_FILE 239 | Language=English 240 | Failed to adjust the size of the external file.%0 241 | . 242 | 243 | MessageId=0x1e 244 | Severity=Error 245 | Facility=System 246 | SymbolicName=ERAM_ERROR_CREATE_EXT_FILE_SECTION 247 | Language=English 248 | Failed to create a section of the external file.%0 249 | . 250 | 251 | MessageId=0x1f 252 | Severity=Error 253 | Facility=System 254 | SymbolicName=ERAM_ERROR_MAP_EXT_FILE 255 | Language=English 256 | Failed to map the external file.%0 257 | . 258 | 259 | MessageId=0x20 260 | Severity=Error 261 | Facility=System 262 | SymbolicName=ERAM_ERROR_GET_THREAD_OBJECT 263 | Language=English 264 | Failed to get the object of the system thread.%0 265 | . 266 | 267 | 268 | MessageId=0x6 269 | Severity=Warning 270 | Facility=System 271 | SymbolicName=ERAM_WARN_MAXMEM_DISK_SIZE_FIXED 272 | Language=English 273 | The RAM disk was shrinked because OS-Unmanaged Memory was smaller than expected.%0 274 | . 275 | 276 | 277 | MessageId=0x1c 278 | Severity=Informational 279 | Facility=System 280 | SymbolicName=ERAM_INF_MEMORY_SIZE 281 | Language=English 282 | %2KB is able to be allocated.%0 283 | . 284 | 285 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.vspscc 94 | *.vssscc 95 | .builds 96 | *.pidb 97 | *.svclog 98 | *.scc 99 | 100 | # Chutzpah Test files 101 | _Chutzpah* 102 | 103 | # Visual C++ cache files 104 | ipch/ 105 | *.aps 106 | *.ncb 107 | *.opendb 108 | *.opensdf 109 | *.sdf 110 | *.cachefile 111 | *.VC.db 112 | *.VC.VC.opendb 113 | 114 | # Visual Studio profiler 115 | *.psess 116 | *.vsp 117 | *.vspx 118 | *.sap 119 | 120 | # Visual Studio Trace Files 121 | *.e2e 122 | 123 | # TFS 2012 Local Workspace 124 | $tf/ 125 | 126 | # Guidance Automation Toolkit 127 | *.gpState 128 | 129 | # ReSharper is a .NET coding add-in 130 | _ReSharper*/ 131 | *.[Rr]e[Ss]harper 132 | *.DotSettings.user 133 | 134 | # TeamCity is a build add-in 135 | _TeamCity* 136 | 137 | # DotCover is a Code Coverage Tool 138 | *.dotCover 139 | 140 | # AxoCover is a Code Coverage Tool 141 | .axoCover/* 142 | !.axoCover/settings.json 143 | 144 | # Coverlet is a free, cross platform Code Coverage Tool 145 | coverage*.json 146 | coverage*.xml 147 | coverage*.info 148 | 149 | # Visual Studio code coverage results 150 | *.coverage 151 | *.coveragexml 152 | 153 | # NCrunch 154 | _NCrunch_* 155 | .*crunch*.local.xml 156 | nCrunchTemp_* 157 | 158 | # MightyMoose 159 | *.mm.* 160 | AutoTest.Net/ 161 | 162 | # Web workbench (sass) 163 | .sass-cache/ 164 | 165 | # Installshield output folder 166 | [Ee]xpress/ 167 | 168 | # DocProject is a documentation generator add-in 169 | DocProject/buildhelp/ 170 | DocProject/Help/*.HxT 171 | DocProject/Help/*.HxC 172 | DocProject/Help/*.hhc 173 | DocProject/Help/*.hhk 174 | DocProject/Help/*.hhp 175 | DocProject/Help/Html2 176 | DocProject/Help/html 177 | 178 | # Click-Once directory 179 | publish/ 180 | 181 | # Publish Web Output 182 | *.[Pp]ublish.xml 183 | *.azurePubxml 184 | # Note: Comment the next line if you want to checkin your web deploy settings, 185 | # but database connection strings (with potential passwords) will be unencrypted 186 | *.pubxml 187 | *.publishproj 188 | 189 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 190 | # checkin your Azure Web App publish settings, but sensitive information contained 191 | # in these scripts will be unencrypted 192 | PublishScripts/ 193 | 194 | # NuGet Packages 195 | *.nupkg 196 | # NuGet Symbol Packages 197 | *.snupkg 198 | # The packages folder can be ignored because of Package Restore 199 | **/[Pp]ackages/* 200 | # except build/, which is used as an MSBuild target. 201 | !**/[Pp]ackages/build/ 202 | # Uncomment if necessary however generally it will be regenerated when needed 203 | #!**/[Pp]ackages/repositories.config 204 | # NuGet v3's project.json files produces more ignorable files 205 | *.nuget.props 206 | *.nuget.targets 207 | 208 | # Microsoft Azure Build Output 209 | csx/ 210 | *.build.csdef 211 | 212 | # Microsoft Azure Emulator 213 | ecf/ 214 | rcf/ 215 | 216 | # Windows Store app package directories and files 217 | AppPackages/ 218 | BundleArtifacts/ 219 | Package.StoreAssociation.xml 220 | _pkginfo.txt 221 | *.appx 222 | *.appxbundle 223 | *.appxupload 224 | 225 | # Visual Studio cache files 226 | # files ending in .cache can be ignored 227 | *.[Cc]ache 228 | # but keep track of directories ending in .cache 229 | !?*.[Cc]ache/ 230 | 231 | # Others 232 | ClientBin/ 233 | ~$* 234 | *~ 235 | *.dbmdl 236 | *.dbproj.schemaview 237 | *.jfm 238 | *.pfx 239 | *.publishsettings 240 | orleans.codegen.cs 241 | 242 | # Including strong name files can present a security risk 243 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 244 | #*.snk 245 | 246 | # Since there are multiple workflows, uncomment next line to ignore bower_components 247 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 248 | #bower_components/ 249 | 250 | # RIA/Silverlight projects 251 | Generated_Code/ 252 | 253 | # Backup & report files from converting an old project file 254 | # to a newer Visual Studio version. Backup files are not needed, 255 | # because we have git ;-) 256 | _UpgradeReport_Files/ 257 | Backup*/ 258 | UpgradeLog*.XML 259 | UpgradeLog*.htm 260 | ServiceFabricBackup/ 261 | *.rptproj.bak 262 | 263 | # SQL Server files 264 | *.mdf 265 | *.ldf 266 | *.ndf 267 | 268 | # Business Intelligence projects 269 | *.rdl.data 270 | *.bim.layout 271 | *.bim_*.settings 272 | *.rptproj.rsuser 273 | *- [Bb]ackup.rdl 274 | *- [Bb]ackup ([0-9]).rdl 275 | *- [Bb]ackup ([0-9][0-9]).rdl 276 | 277 | # Microsoft Fakes 278 | FakesAssemblies/ 279 | 280 | # GhostDoc plugin setting file 281 | *.GhostDoc.xml 282 | 283 | # Node.js Tools for Visual Studio 284 | .ntvs_analysis.dat 285 | node_modules/ 286 | 287 | # Visual Studio 6 build log 288 | *.plg 289 | 290 | # Visual Studio 6 workspace options file 291 | *.opt 292 | 293 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 294 | *.vbw 295 | 296 | # Visual Studio LightSwitch build output 297 | **/*.HTMLClient/GeneratedArtifacts 298 | **/*.DesktopClient/GeneratedArtifacts 299 | **/*.DesktopClient/ModelManifest.xml 300 | **/*.Server/GeneratedArtifacts 301 | **/*.Server/ModelManifest.xml 302 | _Pvt_Extensions 303 | 304 | # Paket dependency manager 305 | .paket/paket.exe 306 | paket-files/ 307 | 308 | # FAKE - F# Make 309 | .fake/ 310 | 311 | # CodeRush personal settings 312 | .cr/personal 313 | 314 | # Python Tools for Visual Studio (PTVS) 315 | __pycache__/ 316 | *.pyc 317 | 318 | # Cake - Uncomment if you are using it 319 | # tools/** 320 | # !tools/packages.config 321 | 322 | # Tabs Studio 323 | *.tss 324 | 325 | # Telerik's JustMock configuration file 326 | *.jmconfig 327 | 328 | # BizTalk build output 329 | *.btp.cs 330 | *.btm.cs 331 | *.odx.cs 332 | *.xsd.cs 333 | 334 | # OpenCover UI analysis results 335 | OpenCover/ 336 | 337 | # Azure Stream Analytics local run output 338 | ASALocalRun/ 339 | 340 | # MSBuild Binary and Structured Log 341 | *.binlog 342 | 343 | # NVidia Nsight GPU debugger configuration file 344 | *.nvuser 345 | 346 | # MFractors (Xamarin productivity tool) working folder 347 | .mfractor/ 348 | 349 | # Local History for Visual Studio 350 | .localhistory/ 351 | 352 | # BeatPulse healthcheck temp database 353 | healthchecksdb 354 | 355 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 356 | MigrationBackup/ 357 | 358 | # Ionide (cross platform F# VS Code tools) working folder 359 | .ionide/ 360 | 361 | # Fody - auto-generated XML schema 362 | FodyWeavers.xsd 363 | 364 | *.log 365 | *.wrn 366 | *.err 367 | *.map 368 | i386/ 369 | amd64/ 370 | objchk_wnet_amd64/ 371 | objchk_wnet_x86/ 372 | -------------------------------------------------------------------------------- /eramum.h: -------------------------------------------------------------------------------- 1 | // 2 | // Message Definitions for ERAM 3 | // 4 | // Header 5 | // Message Definition 6 | // 7 | // Values are 32 bit values layed out as follows: 8 | // 9 | // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 10 | // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 11 | // +---+-+-+-----------------------+-------------------------------+ 12 | // |Sev|C|R| Facility | Code | 13 | // +---+-+-+-----------------------+-------------------------------+ 14 | // 15 | // where 16 | // 17 | // Sev - is the severity code 18 | // 19 | // 00 - Success 20 | // 01 - Informational 21 | // 10 - Warning 22 | // 11 - Error 23 | // 24 | // C - is the Customer code flag 25 | // 26 | // R - is a reserved bit 27 | // 28 | // Facility - is the facility code 29 | // 30 | // Code - is the facility's status code 31 | // 32 | // 33 | // Define the facility codes 34 | // 35 | 36 | 37 | // 38 | // Define the severity codes 39 | // 40 | 41 | 42 | // 43 | // MessageId: ERAM_ERROR_FUNCTIONERROR 44 | // 45 | // MessageText: 46 | // 47 | // Function %2 returned a failure.%0 48 | // 49 | #define ERAM_ERROR_FUNCTIONERROR ((NTSTATUS)0xE0FF0001L) 50 | 51 | // 52 | // MessageId: ERAM_ERROR_MAXMEM_ALREADY_FREE 53 | // 54 | // MessageText: 55 | // 56 | // OS-Unmanaged Memory is already released.%0 57 | // 58 | #define ERAM_ERROR_MAXMEM_ALREADY_FREE ((NTSTATUS)0xE0FF0002L) 59 | 60 | // 61 | // MessageId: ERAM_ERROR_MAXMEM_MAP_FAILED 62 | // 63 | // MessageText: 64 | // 65 | // Failed to map OS-Unmanaged Memory.%0 66 | // 67 | #define ERAM_ERROR_MAXMEM_MAP_FAILED ((NTSTATUS)0xE0FF0003L) 68 | 69 | // 70 | // MessageId: ERAM_ERROR_MAXMEM_REPORT_USAGE_FAILED 71 | // 72 | // MessageText: 73 | // 74 | // Failed to notify usage of OS-Unmanaged Memory.%0 75 | // 76 | #define ERAM_ERROR_MAXMEM_REPORT_USAGE_FAILED ((NTSTATUS)0xE0FF0004L) 77 | 78 | // 79 | // MessageId: ERAM_ERROR_MAXMEM_REPORT_USAGE_CONFLICT 80 | // 81 | // MessageText: 82 | // 83 | // OS-Unmanaged Memory is being partially used by another device. Please shrink the disk size.%0 84 | // 85 | #define ERAM_ERROR_MAXMEM_REPORT_USAGE_CONFLICT ((NTSTATUS)0xE0FF0005L) 86 | 87 | // 88 | // MessageId: ERAM_ERROR_CREATE_THREAD 89 | // 90 | // MessageText: 91 | // 92 | // Failed to create a system thread.%0 93 | // 94 | #define ERAM_ERROR_CREATE_THREAD ((NTSTATUS)0xE0FF0006L) 95 | 96 | // 97 | // MessageId: ERAM_ERROR_MAXMEM_NO_MEMORY 98 | // 99 | // MessageText: 100 | // 101 | // OS-Unmanaged Memory was not detected.%0 102 | // 103 | #define ERAM_ERROR_MAXMEM_NO_MEMORY ((NTSTATUS)0xE0FF0007L) 104 | 105 | // 106 | // MessageId: ERAM_ERROR_MAXMEM_NOT_DETECTED 107 | // 108 | // MessageText: 109 | // 110 | // OS-Unmanaged Memory was not found.%0 111 | // 112 | #define ERAM_ERROR_MAXMEM_NOT_DETECTED ((NTSTATUS)0xE0FF0008L) 113 | 114 | // 115 | // MessageId: ERAM_ERROR_OPTION_WORK_ALLOC_FAILED 116 | // 117 | // MessageText: 118 | // 119 | // Failed to allocate the OS startup option(s).%0 120 | // 121 | #define ERAM_ERROR_OPTION_WORK_ALLOC_FAILED ((NTSTATUS)0xE0FF0009L) 122 | 123 | // 124 | // MessageId: ERAM_ERROR_OPTION_GET_FAILED 125 | // 126 | // MessageText: 127 | // 128 | // Failed to get the OS startup option(s).%0 129 | // 130 | #define ERAM_ERROR_OPTION_GET_FAILED ((NTSTATUS)0xE0FF000AL) 131 | 132 | // 133 | // MessageId: ERAM_ERROR_MAXMEM_NO_OPTION 134 | // 135 | // MessageText: 136 | // 137 | // There was no %bMAXMEM=n%b in starup options.%0 138 | // 139 | #define ERAM_ERROR_MAXMEM_NO_OPTION ((NTSTATUS)0xE0FF000BL) 140 | 141 | // 142 | // MessageId: ERAM_ERROR_MAXMEM_CAPITAL_FAILED 143 | // 144 | // MessageText: 145 | // 146 | // Failed to capitalize the startup option(s).%0 147 | // 148 | #define ERAM_ERROR_MAXMEM_CAPITAL_FAILED ((NTSTATUS)0xE0FF000CL) 149 | 150 | // 151 | // MessageId: ERAM_ERROR_MAXMEM_ATOU 152 | // 153 | // MessageText: 154 | // 155 | // Failed to numerize MAXMEM.%0 156 | // 157 | #define ERAM_ERROR_MAXMEM_ATOU ((NTSTATUS)0xE0FF000DL) 158 | 159 | // 160 | // MessageId: ERAM_ERROR_MAXMEM_TOO_SMALL 161 | // 162 | // MessageText: 163 | // 164 | // Please specify 17 or more for MAXMEM.%0 165 | // 166 | #define ERAM_ERROR_MAXMEM_TOO_SMALL ((NTSTATUS)0xE0FF000EL) 167 | 168 | // 169 | // MessageId: ERAM_ERROR_MAXMEM_INVALID 170 | // 171 | // MessageText: 172 | // 173 | // The startup option(s) has no MAXMEM=n or invalid MAXMEM value.%0 174 | // 175 | #define ERAM_ERROR_MAXMEM_INVALID ((NTSTATUS)0xE0FF0010L) 176 | 177 | // 178 | // MessageId: ERAM_ERROR_WORK_ALLOC_FAILED 179 | // 180 | // MessageText: 181 | // 182 | // Failed to allocate the workarea memory.%0 183 | // 184 | #define ERAM_ERROR_WORK_ALLOC_FAILED ((NTSTATUS)0xE0FF0012L) 185 | 186 | // 187 | // MessageId: ERAM_ERROR_REG_KEY_APPEND_FAILED 188 | // 189 | // MessageText: 190 | // 191 | // Failed to combine the registry key strings.%0 192 | // 193 | #define ERAM_ERROR_REG_KEY_APPEND_FAILED ((NTSTATUS)0xE0FF0013L) 194 | 195 | // 196 | // MessageId: ERAM_ERROR_CREATE_DEVICE_FAILED 197 | // 198 | // MessageText: 199 | // 200 | // Failed to create an device.%0 201 | // 202 | #define ERAM_ERROR_CREATE_DEVICE_FAILED ((NTSTATUS)0xE0FF0014L) 203 | 204 | // 205 | // MessageId: ERAM_ERROR_DISK_SIZE_TOO_SMALL 206 | // 207 | // MessageText: 208 | // 209 | // Too small allocation memory for disk.%0 210 | // 211 | #define ERAM_ERROR_DISK_SIZE_TOO_SMALL ((NTSTATUS)0xE0FF0015L) 212 | 213 | // 214 | // MessageId: ERAM_ERROR_DEVICE_NAME_ALLOC_FAILED 215 | // 216 | // MessageText: 217 | // 218 | // Failed to allocate the device name area.%0 219 | // 220 | #define ERAM_ERROR_DEVICE_NAME_ALLOC_FAILED ((NTSTATUS)0xE0FF0016L) 221 | 222 | // 223 | // MessageId: ERAM_ERROR_CREATE_SYMBOLIC_LINK_FAILED 224 | // 225 | // MessageText: 226 | // 227 | // Failed to create a symbolic link.%0 228 | // 229 | #define ERAM_ERROR_CREATE_SYMBOLIC_LINK_FAILED ((NTSTATUS)0xE0FF0017L) 230 | 231 | // 232 | // MessageId: ERAM_ERROR_DISK_ALLOC_FAILED 233 | // 234 | // MessageText: 235 | // 236 | // Failed to allocate the memory for disk.%0 237 | // 238 | #define ERAM_ERROR_DISK_ALLOC_FAILED ((NTSTATUS)0xE0FF0018L) 239 | 240 | // 241 | // MessageId: ERAM_ERROR_DISK_SIZE_IS_0 242 | // 243 | // MessageText: 244 | // 245 | // The allocated size was zero.%0 246 | // 247 | #define ERAM_ERROR_DISK_SIZE_IS_0 ((NTSTATUS)0xE0FF0019L) 248 | 249 | // 250 | // MessageId: ERAM_ERROR_TRANSLATE_ADDRESS_FAILED 251 | // 252 | // MessageText: 253 | // 254 | // Failed to convert to OS-Managed Address.%0 255 | // 256 | #define ERAM_ERROR_TRANSLATE_ADDRESS_FAILED ((NTSTATUS)0xE0FF001AL) 257 | 258 | // 259 | // MessageId: ERAM_ERROR_PORT_MAPPED 260 | // 261 | // MessageText: 262 | // 263 | // No support of I/O space mapping.%0 264 | // 265 | #define ERAM_ERROR_PORT_MAPPED ((NTSTATUS)0xE0FF001BL) 266 | 267 | // 268 | // MessageId: ERAM_ERROR_CREATE_EXT_FILE 269 | // 270 | // MessageText: 271 | // 272 | // Failed to create the external file.%0 273 | // 274 | #define ERAM_ERROR_CREATE_EXT_FILE ((NTSTATUS)0xE0FF001CL) 275 | 276 | // 277 | // MessageId: ERAM_ERROR_SET_INFO_EXT_FILE 278 | // 279 | // MessageText: 280 | // 281 | // Failed to adjust the size of the external file.%0 282 | // 283 | #define ERAM_ERROR_SET_INFO_EXT_FILE ((NTSTATUS)0xE0FF001DL) 284 | 285 | // 286 | // MessageId: ERAM_ERROR_CREATE_EXT_FILE_SECTION 287 | // 288 | // MessageText: 289 | // 290 | // Failed to create section of the external file.%0 291 | // 292 | #define ERAM_ERROR_CREATE_EXT_FILE_SECTION ((NTSTATUS)0xE0FF001EL) 293 | 294 | // 295 | // MessageId: ERAM_ERROR_MAP_EXT_FILE 296 | // 297 | // MessageText: 298 | // 299 | // Failed to map the external file.%0 300 | // 301 | #define ERAM_ERROR_MAP_EXT_FILE ((NTSTATUS)0xE0FF001FL) 302 | 303 | // 304 | // MessageId: ERAM_ERROR_GET_THREAD_OBJECT 305 | // 306 | // MessageText: 307 | // 308 | // Failed to get the object of the system thread.%0 309 | // 310 | #define ERAM_ERROR_GET_THREAD_OBJECT ((NTSTATUS)0xE0FF0020L) 311 | 312 | // 313 | // MessageId: ERAM_WARN_MAXMEM_DISK_SIZE_FIXED 314 | // 315 | // MessageText: 316 | // 317 | // The RAM disk was shrinked because OS-Unmanaged Memory was small.%0 318 | // 319 | #define ERAM_WARN_MAXMEM_DISK_SIZE_FIXED ((NTSTATUS)0xA0FF0006L) 320 | 321 | // 322 | // MessageId: ERAM_INF_MEMORY_SIZE 323 | // 324 | // MessageText: 325 | // 326 | // It seems like it is able to allocate about %2KB.%0 327 | // 328 | #define ERAM_INF_MEMORY_SIZE ((NTSTATUS)0x60FF001CL) 329 | 330 | -------------------------------------------------------------------------------- /eramui/eramui.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "eramui.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "windows.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Neutral resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 21 | #pragma code_page(932) 22 | #endif //_WIN32 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Icon 27 | // 28 | 29 | // Icon with lowest ID value placed first to ensure application icon 30 | // remains consistent on all systems. 31 | IDI_ICON ICON DISCARDABLE "eramui.ico" 32 | #endif // Neutral resources 33 | ///////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | ///////////////////////////////////////////////////////////////////////////// 37 | // English (U.S.) resources 38 | 39 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 40 | #ifdef _WIN32 41 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 42 | #pragma code_page(1252) 43 | #endif //_WIN32 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | // 47 | // Dialog 48 | // 49 | 50 | IDD_SETUP DIALOG DISCARDABLE 0, 0, 189, 226 51 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 52 | CAPTION "ERAM Configuration" 53 | FONT 8, "Microsoft Sans Serif" 54 | BEGIN 55 | LTEXT "Drive(&D)",IDC_STATIC,5,10,58,8 56 | COMBOBOX IDC_COMBO_DRIVE,65,10,23,175,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 57 | LTEXT "Root Dir Entries(&L)",IDC_STATIC,95,10,58,8 58 | EDITTEXT IDC_EDIT_ROOTDIR,155,10,25,12,ES_AUTOHSCROLL 59 | LTEXT "Allocation Units(&A)",IDC_STATIC,5,30,58,8 60 | COMBOBOX IDC_COMBO_ALLOCUNIT,65,30,23,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 61 | LTEXT "Media ID(&I)",IDC_STATIC,95,30,58,8 62 | EDITTEXT IDC_EDIT_MEDIAID,155,30,25,12,ES_UPPERCASE | ES_AUTOHSCROLL 63 | LTEXT "Disk Size(&S)",IDC_STATIC,5,50,55,10 64 | EDITTEXT IDC_EDIT_PAGE,65,50,40,12,ES_AUTOHSCROLL 65 | LTEXT "KB",IDC_STATIC,110,50,15,10 66 | GROUPBOX " Memory Source ",IDC_STATIC,5,70,175,65 67 | CONTROL "Nonpaged Pool(&N)",IDC_RADIO_NONPAGED,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,85,160,15 68 | CONTROL "Paged Pool(&P)",IDC_RADIO_PAGED,"Button",BS_AUTORADIOBUTTON,15,100,160,15 69 | CONTROL "External(&E) (need to edit the boot.ini)",IDC_RADIO_EXTERNAL, 70 | "Button",BS_AUTORADIOBUTTON,15,115,160,15 71 | GROUPBOX " External ",IDC_STATIC_EXT,5,140,175,45,WS_GROUP 72 | CONTROL "Start Address",IDC_CHECK_EXTSTART,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,155,70,10 73 | EDITTEXT IDC_EDIT_EXTSTART_MB,95,155,35,12,ES_RIGHT | ES_UPPERCASE | ES_AUTOHSCROLL | ES_NUMBER 74 | LTEXT "MB-",IDC_STATIC_EXTSTART_MB,135,157,35,10 75 | CONTROL "Detect limit",IDC_CHECK_NOTSEARCHSKIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,170,75,10 76 | CONTROL "Report to OS",IDC_CHECK_REPORTUSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,170,75,10 77 | CONTROL "Local device",IDC_CHECK_LOCAL_DISK,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,190,70,10 78 | CONTROL "Make TEMP Directory",IDC_CHECK_MAKE_TEMP,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,95,190,86,10 79 | DEFPUSHBUTTON "Ok",IDOK,75,205,30,15,WS_GROUP 80 | PUSHBUTTON "Cancel",IDCANCEL,110,205,30,15 81 | PUSHBUTTON "Modify",IDC_UPDATE,145,205,30,15 82 | END 83 | 84 | 85 | ///////////////////////////////////////////////////////////////////////////// 86 | // 87 | // DESIGNINFO 88 | // 89 | 90 | #ifdef APSTUDIO_INVOKED 91 | GUIDELINES DESIGNINFO DISCARDABLE 92 | BEGIN 93 | IDD_SETUP, DIALOG 94 | BEGIN 95 | LEFTMARGIN, 7 96 | RIGHTMARGIN, 182 97 | TOPMARGIN, 7 98 | BOTTOMMARGIN, 219 99 | END 100 | END 101 | #endif // APSTUDIO_INVOKED 102 | 103 | 104 | #ifndef _MAC 105 | ///////////////////////////////////////////////////////////////////////////// 106 | // 107 | // Version 108 | // 109 | 110 | VS_VERSION_INFO VERSIONINFO 111 | FILEVERSION 2,20,0,0 112 | PRODUCTVERSION 2,20,0,0 113 | FILEFLAGSMASK 0x3fL 114 | #ifdef _DEBUG 115 | FILEFLAGS 0x1L 116 | #else 117 | FILEFLAGS 0x0L 118 | #endif 119 | FILEOS 0x40004L 120 | FILETYPE 0x2L 121 | FILESUBTYPE 0x0L 122 | BEGIN 123 | BLOCK "StringFileInfo" 124 | BEGIN 125 | BLOCK "040904b0" 126 | BEGIN 127 | VALUE "Comments", "ERAM\0" 128 | VALUE "CompanyName", "*Error15 & Zero3K\0" 129 | VALUE "FileDescription", "ERAM Applet\0" 130 | VALUE "FileVersion", "2.24\0" 131 | VALUE "InternalName", "eram.cpl\0" 132 | VALUE "LegalCopyright", "Copyright (C) 1999-20018 *Error15 & Zero3K\0" 133 | VALUE "OriginalFilename", "eram.cpl\0" 134 | VALUE "ProductName", "ERAM\0" 135 | VALUE "ProductVersion", "2.24\0" 136 | END 137 | END 138 | BLOCK "VarFileInfo" 139 | BEGIN 140 | VALUE "Translation", 0x409, 1200 141 | END 142 | END 143 | 144 | #endif // !_MAC 145 | 146 | 147 | ///////////////////////////////////////////////////////////////////////////// 148 | // 149 | // String Table 150 | // 151 | 152 | STRINGTABLE DISCARDABLE 153 | BEGIN 154 | IDS_ERR_OPEN_REG "Cannot open registry key." 155 | IDS_PROMPT_REBOOT "Reboot now?" 156 | IDS_ERR_REBOOT "Reboot failed." 157 | IDS_ERR_REG_MODIFY "An error occurred while modifying the registry." 158 | IDS_WARN_DRV_USING "The %c drive is already in use." 159 | IDS_WARN_LIMIT_SIZE "Please limit the disk size to %dKB." 160 | IDS_WARN_LIMIT_SIZE_THIS_UNIT 161 | "Please limit the disk size to %dKB at the chosen allocation units." 162 | IDS_PROMPT_ERAM_REMOVE "The uninstall of ERAM has started." 163 | IDS_ERR_DETECT_OS "Detection of OS failed." 164 | IDS_PROMPT_BEFORE_DEVMGR "Please use Device Manager to remove ERAM." 165 | IDS_ERR_NEED_REMOVE_PRIV "Removal failed. Need Administrator privilege." 166 | IDS_ERR_OPEN_ERAM "Opening of ERAM failed(%d)." 167 | IDS_ERR_ERAM_REMOVE "Removal of ERAM failed(%d)." 168 | IDS_ERR_GET_SYSDIR "Cannot obtain system directory(%d)." 169 | IDS_ERR_REMOVE "Deletion of %s failed(%d)." 170 | END 171 | 172 | STRINGTABLE DISCARDABLE 173 | BEGIN 174 | IDS_ERR_LOAD_SETUPAPI "Cannot load SETUPAPI.DLL(%d)." 175 | IDS_ERR_GETPROC_SETUPAPI "GetProcAddress to SETUPAPI.DLL failed(%d)." 176 | IDS_ERR_DRIVER_ENUM "Enum driver failed(%d)." 177 | IDS_ERR_DRIVER_REMOVE "Removal of the driver failed(%d)." 178 | IDS_INFO_FASTFAT_USAGE "usage:\n RUNDLL32 ERAMNT.CPL,StartupFastfat 0-4\n 1:System 4:Default" 179 | IDS_ERR_NEED_CTRL_PRIV "Control failed. Need Administrator privilege." 180 | IDS_ERR_OPEN_SCM "The opening of SCM failed(%d)." 181 | IDS_ERR_OPEN_FASTFAT "The opening of FASTFAT failed(%d)." 182 | IDS_INFO_FASTFAT_ALREADY "FASTFAT is already starting %s." 183 | IDS_ERR_FASTFAT_MODIFY "The modification of FASTFAT failed(%d)." 184 | IDS_INFO_FASTFAT_MODIFY "FASTFAT startup is set to %s." 185 | IDS_INFO_DESC "ERAM Settings." 186 | IDS_TAB_TITLE "Settings" 187 | IDS_START_TYPE_0 "Boot" 188 | IDS_START_TYPE_1 "System" 189 | IDS_START_TYPE_2 "Auto" 190 | END 191 | 192 | STRINGTABLE DISCARDABLE 193 | BEGIN 194 | IDS_START_TYPE_3 "Demand" 195 | IDS_START_TYPE_4 "Disabled" 196 | IDS_WARN_LIMIT_MAX_SIZE "The address space is being overflowed, please limit the disk size to %dKB." 197 | IDS_WARN_LIMIT_ROOTDIR "The configured disk size is too small. The Root Dir Entries option has been reset to its default setting." 198 | END 199 | 200 | #endif // English (U.S.) resources 201 | ///////////////////////////////////////////////////////////////////////////// 202 | 203 | 204 | 205 | #ifndef APSTUDIO_INVOKED 206 | ///////////////////////////////////////////////////////////////////////////// 207 | // 208 | // Generated from the TEXTINCLUDE 3 resource. 209 | // 210 | #include "eramum.rc" 211 | 212 | ///////////////////////////////////////////////////////////////////////////// 213 | #endif // not APSTUDIO_INVOKED -------------------------------------------------------------------------------- /eramui/eramum.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Message Definitions for ERAM 3 | // 4 | // Header 5 | // Message Definitions 6 | // 7 | // Values are 32 bit values laid out as follows: 8 | // 9 | // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 10 | // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 11 | // +---+-+-+-----------------------+-------------------------------+ 12 | // |Sev|C|R| Facility | Code | 13 | // +---+-+-+-----------------------+-------------------------------+ 14 | // 15 | // where 16 | // 17 | // Sev - is the severity code 18 | // 19 | // 00 - Success 20 | // 01 - Informational 21 | // 10 - Warning 22 | // 11 - Error 23 | // 24 | // C - is the Customer code flag 25 | // 26 | // R - is a reserved bit 27 | // 28 | // Facility - is the facility code 29 | // 30 | // Code - is the facility's status code 31 | // 32 | // 33 | // Define the facility codes 34 | // 35 | 36 | 37 | // 38 | // Define the severity codes 39 | // 40 | 41 | 42 | // 43 | // MessageId: ERAM_ERROR_FUNCTIONERROR 44 | // 45 | // MessageText: 46 | // 47 | // Function %2 returned a failure.%0 48 | // 49 | #define ERAM_ERROR_FUNCTIONERROR ((NTSTATUS)0xC0FF0001L) 50 | 51 | // 52 | // MessageId: ERAM_ERROR_MAXMEM_ALREADY_FREE 53 | // 54 | // MessageText: 55 | // 56 | // OS-Unmanaged Memory is already released.%0 57 | // 58 | #define ERAM_ERROR_MAXMEM_ALREADY_FREE ((NTSTATUS)0xC0FF0002L) 59 | 60 | // 61 | // MessageId: ERAM_ERROR_MAXMEM_MAP_FAILED 62 | // 63 | // MessageText: 64 | // 65 | // Failed to map OS-Unmanaged Memory.%0 66 | // 67 | #define ERAM_ERROR_MAXMEM_MAP_FAILED ((NTSTATUS)0xC0FF0003L) 68 | 69 | // 70 | // MessageId: ERAM_ERROR_MAXMEM_REPORT_USAGE_FAILED 71 | // 72 | // MessageText: 73 | // 74 | // Failed to notify usage of OS-Unmanaged Memory.%0 75 | // 76 | #define ERAM_ERROR_MAXMEM_REPORT_USAGE_FAILED ((NTSTATUS)0xC0FF0004L) 77 | 78 | // 79 | // MessageId: ERAM_ERROR_MAXMEM_REPORT_USAGE_CONFLICT 80 | // 81 | // MessageText: 82 | // 83 | // OS-Unmanaged Memory is being partially used by another device. Please shrink the disk size.%0 84 | // 85 | #define ERAM_ERROR_MAXMEM_REPORT_USAGE_CONFLICT ((NTSTATUS)0xC0FF0005L) 86 | 87 | // 88 | // MessageId: ERAM_ERROR_CREATE_THREAD 89 | // 90 | // MessageText: 91 | // 92 | // Failed to create a system thread.%0 93 | // 94 | #define ERAM_ERROR_CREATE_THREAD ((NTSTATUS)0xC0FF0006L) 95 | 96 | // 97 | // MessageId: ERAM_ERROR_MAXMEM_NO_MEMORY 98 | // 99 | // MessageText: 100 | // 101 | // OS-Unmanaged Memory was not detected.%0 102 | // 103 | #define ERAM_ERROR_MAXMEM_NO_MEMORY ((NTSTATUS)0xC0FF0007L) 104 | 105 | // 106 | // MessageId: ERAM_ERROR_MAXMEM_NOT_DETECTED 107 | // 108 | // MessageText: 109 | // 110 | // OS-Unmanaged Memory was not found.%0 111 | // 112 | #define ERAM_ERROR_MAXMEM_NOT_DETECTED ((NTSTATUS)0xC0FF0008L) 113 | 114 | // 115 | // MessageId: ERAM_ERROR_OPTION_WORK_ALLOC_FAILED 116 | // 117 | // MessageText: 118 | // 119 | // Failed to allocate the OS startup option(s).%0 120 | // 121 | #define ERAM_ERROR_OPTION_WORK_ALLOC_FAILED ((NTSTATUS)0xC0FF0009L) 122 | 123 | // 124 | // MessageId: ERAM_ERROR_OPTION_GET_FAILED 125 | // 126 | // MessageText: 127 | // 128 | // Failed to get the OS startup option(s).%0 129 | // 130 | #define ERAM_ERROR_OPTION_GET_FAILED ((NTSTATUS)0xC0FF000AL) 131 | 132 | // 133 | // MessageId: ERAM_ERROR_MAXMEM_NO_OPTION 134 | // 135 | // MessageText: 136 | // 137 | // There was no %bMAXMEM=n%b in startup options.%0 138 | // 139 | #define ERAM_ERROR_MAXMEM_NO_OPTION ((NTSTATUS)0xC0FF000BL) 140 | 141 | // 142 | // MessageId: ERAM_ERROR_MAXMEM_CAPITAL_FAILED 143 | // 144 | // MessageText: 145 | // 146 | // Failed to capitalize the startup option(s).%0 147 | // 148 | #define ERAM_ERROR_MAXMEM_CAPITAL_FAILED ((NTSTATUS)0xC0FF000CL) 149 | 150 | // 151 | // MessageId: ERAM_ERROR_MAXMEM_ATOU 152 | // 153 | // MessageText: 154 | // 155 | // Failed to numerize MAXMEM.%0 156 | // 157 | #define ERAM_ERROR_MAXMEM_ATOU ((NTSTATUS)0xC0FF000DL) 158 | 159 | // 160 | // MessageId: ERAM_ERROR_MAXMEM_TOO_SMALL 161 | // 162 | // MessageText: 163 | // 164 | // Please specify 17 MB or more for MAXMEM.%0 165 | // 166 | #define ERAM_ERROR_MAXMEM_TOO_SMALL ((NTSTATUS)0xC0FF000EL) 167 | 168 | // 169 | // MessageId: ERAM_ERROR_MAXMEM_TOO_BIG 170 | // 171 | // MessageText: 172 | // 173 | // Please specify a value smaller than 4095 MB for MAXMEM.%0 174 | // 175 | #define ERAM_ERROR_MAXMEM_TOO_BIG ((NTSTATUS)0xC0FF000FL) 176 | 177 | // 178 | // MessageId: ERAM_ERROR_MAXMEM_INVALID 179 | // 180 | // MessageText: 181 | // 182 | // The startup option(s) has no MAXMEM=n or has an invalid MAXMEM value.%0 183 | // 184 | #define ERAM_ERROR_MAXMEM_INVALID ((NTSTATUS)0xC0FF0010L) 185 | 186 | // 187 | // MessageId: ERAM_ERROR_EXTSTART_TOO_BIG 188 | // 189 | // MessageText: 190 | // 191 | // Please specify a value smaller than 4095 MB for ExtStart.%0 192 | // 193 | #define ERAM_ERROR_EXTSTART_TOO_BIG ((NTSTATUS)0xC0FF0011L) 194 | 195 | // 196 | // MessageId: ERAM_ERROR_WORK_ALLOC_FAILED 197 | // 198 | // MessageText: 199 | // 200 | // Failed to allocate the work-area memory.%0 201 | // 202 | #define ERAM_ERROR_WORK_ALLOC_FAILED ((NTSTATUS)0xC0FF0012L) 203 | 204 | // 205 | // MessageId: ERAM_ERROR_REG_KEY_APPEND_FAILED 206 | // 207 | // MessageText: 208 | // 209 | // Failed to combine the registry key strings.%0 210 | // 211 | #define ERAM_ERROR_REG_KEY_APPEND_FAILED ((NTSTATUS)0xC0FF0013L) 212 | 213 | // 214 | // MessageId: ERAM_ERROR_CREATE_DEVICE_FAILED 215 | // 216 | // MessageText: 217 | // 218 | // Failed to create a device.%0 219 | // 220 | #define ERAM_ERROR_CREATE_DEVICE_FAILED ((NTSTATUS)0xC0FF0014L) 221 | 222 | // 223 | // MessageId: ERAM_ERROR_DISK_SIZE_TOO_SMALL 224 | // 225 | // MessageText: 226 | // 227 | // The assigned disk size is too small.%0 228 | // 229 | #define ERAM_ERROR_DISK_SIZE_TOO_SMALL ((NTSTATUS)0xC0FF0015L) 230 | 231 | // 232 | // MessageId: ERAM_ERROR_DEVICE_NAME_ALLOC_FAILED 233 | // 234 | // MessageText: 235 | // 236 | // Failed to allocate the device name area.%0 237 | // 238 | #define ERAM_ERROR_DEVICE_NAME_ALLOC_FAILED ((NTSTATUS)0xC0FF0016L) 239 | 240 | // 241 | // MessageId: ERAM_ERROR_CREATE_SYMBOLIC_LINK_FAILED 242 | // 243 | // MessageText: 244 | // 245 | // Failed to create a symbolic link.%0 246 | // 247 | #define ERAM_ERROR_CREATE_SYMBOLIC_LINK_FAILED ((NTSTATUS)0xC0FF0017L) 248 | 249 | // 250 | // MessageId: ERAM_ERROR_DISK_ALLOC_FAILED 251 | // 252 | // MessageText: 253 | // 254 | // Failed to allocate the memory to be used for the disk.%0 255 | // 256 | #define ERAM_ERROR_DISK_ALLOC_FAILED ((NTSTATUS)0xC0FF0018L) 257 | 258 | // 259 | // MessageId: ERAM_ERROR_DISK_SIZE_IS_0 260 | // 261 | // MessageText: 262 | // 263 | // The size of the disk cannot be 0.%0 264 | // 265 | #define ERAM_ERROR_DISK_SIZE_IS_0 ((NTSTATUS)0xC0FF0019L) 266 | 267 | // 268 | // MessageId: ERAM_ERROR_TRANSLATE_ADDRESS_FAILED 269 | // 270 | // MessageText: 271 | // 272 | // Failed to convert to OS-Managed Address.%0 273 | // 274 | #define ERAM_ERROR_TRANSLATE_ADDRESS_FAILED ((NTSTATUS)0xC0FF001AL) 275 | 276 | // 277 | // MessageId: ERAM_ERROR_PORT_MAPPED 278 | // 279 | // MessageText: 280 | // 281 | // No support of I/O space mapping.%0 282 | // 283 | #define ERAM_ERROR_PORT_MAPPED ((NTSTATUS)0xC0FF001BL) 284 | 285 | // 286 | // MessageId: ERAM_ERROR_CREATE_EXT_FILE 287 | // 288 | // MessageText: 289 | // 290 | // Failed to create the external file.%0 291 | // 292 | #define ERAM_ERROR_CREATE_EXT_FILE ((NTSTATUS)0xC0FF001CL) 293 | 294 | // 295 | // MessageId: ERAM_ERROR_SET_INFO_EXT_FILE 296 | // 297 | // MessageText: 298 | // 299 | // Failed to adjust the size of the external file.%0 300 | // 301 | #define ERAM_ERROR_SET_INFO_EXT_FILE ((NTSTATUS)0xC0FF001DL) 302 | 303 | // 304 | // MessageId: ERAM_ERROR_CREATE_EXT_FILE_SECTION 305 | // 306 | // MessageText: 307 | // 308 | // Failed to create a section of the external file.%0 309 | // 310 | #define ERAM_ERROR_CREATE_EXT_FILE_SECTION ((NTSTATUS)0xC0FF001EL) 311 | 312 | // 313 | // MessageId: ERAM_ERROR_MAP_EXT_FILE 314 | // 315 | // MessageText: 316 | // 317 | // Failed to map the external file.%0 318 | // 319 | #define ERAM_ERROR_MAP_EXT_FILE ((NTSTATUS)0xC0FF001FL) 320 | 321 | // 322 | // MessageId: ERAM_ERROR_GET_THREAD_OBJECT 323 | // 324 | // MessageText: 325 | // 326 | // Failed to get the object of the system thread.%0 327 | // 328 | #define ERAM_ERROR_GET_THREAD_OBJECT ((NTSTATUS)0xC0FF0020L) 329 | 330 | // 331 | // MessageId: ERAM_WARN_MAXMEM_DISK_SIZE_FIXED 332 | // 333 | // MessageText: 334 | // 335 | // The RAM disk was shrinked because OS-Unmanaged Memory was smaller than expected.%0 336 | // 337 | #define ERAM_WARN_MAXMEM_DISK_SIZE_FIXED ((NTSTATUS)0x80FF0006L) 338 | 339 | // 340 | // MessageId: ERAM_INF_MEMORY_SIZE 341 | // 342 | // MessageText: 343 | // 344 | // %2KB is able to be allocated.%0 345 | // 346 | #define ERAM_INF_MEMORY_SIZE ((NTSTATUS)0x40FF001CL) 347 | 348 | -------------------------------------------------------------------------------- /eram.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {1CD3D35A-50A8-4CDC-929C-3C026D4AD5D9} 23 | btrfs 24 | Win32Proj 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Application 30 | WindowsKernelModeDriver10.0 31 | Windows7 32 | WDM 33 | Desktop 34 | <_NT_TARGET_VERSION>0x0601 35 | 36 | 37 | DynamicLibrary 38 | WindowsKernelModeDriver10.0 39 | Windows7 40 | WDM 41 | Desktop 42 | <_NT_TARGET_VERSION>0x0601 43 | 44 | 45 | Application 46 | WindowsKernelModeDriver10.0 47 | Windows7 48 | Desktop 49 | <_NT_TARGET_VERSION>0x0601 50 | WDM 51 | 52 | 53 | WindowsKernelModeDriver10.0 54 | Windows7 55 | Desktop 56 | <_NT_TARGET_VERSION>0x0601 57 | WDM 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | <_ProjectFileVersion>14.0.25431.1 77 | 78 | 79 | Debug\x86\ 80 | Debug\x86\temp\ 81 | 82 | false 83 | AllRules.ruleset 84 | false 85 | .sys 86 | $(DDK_INC_PATH);$(IncludePath) 87 | $(DDK_LIB_PATH);$(LibraryPath) 88 | false 89 | 90 | 91 | Debug\x64\ 92 | Debug\x64\temp\ 93 | 94 | false 95 | .sys 96 | AllRules.ruleset 97 | false 98 | $(DDK_INC_PATH);$(IncludePath) 99 | $(DDK_LIB_PATH);$(LibraryPath) 100 | false 101 | 102 | 103 | Release\x86\ 104 | Release\x86\temp\ 105 | 106 | false 107 | .sys 108 | $(DDK_INC_PATH);$(IncludePath) 109 | $(DDK_LIB_PATH);$(LibraryPath) 110 | false 111 | 112 | 113 | Release\x64\ 114 | Release\x64\temp\ 115 | 116 | false 117 | .sys 118 | $(DDK_INC_PATH);$(IncludePath) 119 | $(DDK_LIB_PATH);$(LibraryPath) 120 | false 121 | 122 | 123 | 124 | Disabled 125 | %(AdditionalIncludeDirectories) 126 | WIN32;_DEBUG;_WINDOWS;_X86_;%(PreprocessorDefinitions) 127 | false 128 | MultiThreadedDebugDLL 129 | 130 | 131 | 132 | Level3 133 | ProgramDatabase 134 | StdCall 135 | false 136 | false 137 | 138 | 139 | true 140 | false 141 | 142 | 143 | ntoskrnl.lib;hal.lib;BufferOverflowK.lib;rtlver.lib 144 | $(OutDir)$(ProjectName).sys 145 | %(AdditionalLibraryDirectories) 146 | true 147 | true 148 | Native 149 | Driver 150 | DriverEntry 151 | 152 | 153 | true 154 | 155 | MachineX86 156 | false 157 | 158 | 159 | 160 | 161 | X64 162 | 163 | 164 | Disabled 165 | %(AdditionalIncludeDirectories) 166 | WIN32;_DEBUG;_WINDOWS;_AMD64_;_KERNEL_MODE;%(PreprocessorDefinitions) 167 | false 168 | MultiThreadedDebugDLL 169 | 170 | Level3 171 | ProgramDatabase 172 | StdCall 173 | false 174 | false 175 | true 176 | 4603;4627;4986;4987;4996;%(DisableSpecificWarnings) 177 | false 178 | 179 | 180 | ntoskrnl.lib;hal.lib;BufferOverflowK.lib;rtlver.lib 181 | $(OutDir)$(ProjectName).sys 182 | %(AdditionalLibraryDirectories) 183 | true 184 | true 185 | Native 186 | Driver 187 | DriverEntry 188 | 189 | 190 | true 191 | 192 | MachineX64 193 | false 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | %(AdditionalIncludeDirectories) 203 | WIN32;NDEBUG;_WINDOWS;_X86_;%(PreprocessorDefinitions) 204 | MultiThreadedDLL 205 | false 206 | 207 | Level3 208 | ProgramDatabase 209 | StdCall 210 | true 211 | false 212 | 213 | 214 | ntoskrnl.lib;hal.lib;BufferOverflowK.lib;rtlver.lib 215 | $(OutDir)$(ProjectName).sys 216 | %(AdditionalLibraryDirectories) 217 | true 218 | true 219 | Native 220 | Driver 221 | true 222 | true 223 | DriverEntry 224 | 225 | 226 | true 227 | 228 | MachineX86 229 | false 230 | 231 | 232 | 233 | 234 | X64 235 | 236 | 237 | %(AdditionalIncludeDirectories) 238 | WIN32;NDEBUG;_WINDOWS;_AMD64_;_KERNEL_MODE;%(PreprocessorDefinitions) 239 | MultiThreadedDLL 240 | false 241 | 242 | Level3 243 | ProgramDatabase 244 | StdCall 245 | true 246 | false 247 | 248 | 249 | ntoskrnl.lib;hal.lib;BufferOverflowK.lib;rtlver.lib 250 | $(OutDir)$(ProjectName).sys 251 | %(AdditionalLibraryDirectories) 252 | true 253 | true 254 | Native 255 | Driver 256 | true 257 | true 258 | DriverEntry 259 | 260 | 261 | true 262 | 263 | MachineX64 264 | false 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | -------------------------------------------------------------------------------- /eramui/eram.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | ERAM 23 | 24 | 25 | {67D265DA-FDBD-4D2E-B573-5387E5021492} 26 | 10.0.17763.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | v142 32 | false 33 | 34 | 35 | DynamicLibrary 36 | v142 37 | false 38 | 39 | 40 | DynamicLibrary 41 | v142 42 | false 43 | 44 | 45 | DynamicLibrary 46 | v142 47 | false 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Release\x86\ 71 | Release\x86\temp\ 72 | false 73 | .cpl 74 | 75 | 76 | false 77 | .cpl 78 | Release\x64\ 79 | Release\x64\temp\ 80 | 81 | 82 | Debug\x86\ 83 | Debug\x86\temp\ 84 | true 85 | .cpl 86 | 87 | 88 | true 89 | .cpl 90 | Debug\x64\ 91 | Debug\x64\temp\ 92 | 93 | 94 | 95 | MultiThreadedDLL 96 | Default 97 | true 98 | true 99 | MaxSpeed 100 | true 101 | Level4 102 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 103 | Release\x86\temp\ 104 | .\Release\eram.pch 105 | Release\x86\temp\ 106 | Release\x86\temp\ 107 | 1Byte 108 | 109 | 110 | true 111 | NDEBUG;%(PreprocessorDefinitions) 112 | .\Release\eram.tlb 113 | true 114 | NUL 115 | Win32 116 | 117 | 118 | 0x0411 119 | NDEBUG;%(PreprocessorDefinitions) 120 | 121 | 122 | true 123 | .\Release\eram.bsc 124 | 125 | 126 | true 127 | true 128 | Windows 129 | Release\x86\eram.cpl 130 | .\Release\eram.lib 131 | setupapi.lib;Comctl32.lib;%(AdditionalDependencies) 132 | .\eramui.def 133 | 134 | 135 | 136 | 137 | MultiThreadedDLL 138 | Default 139 | true 140 | true 141 | MaxSpeed 142 | true 143 | Level4 144 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 145 | Release\x64\temp\ 146 | .\Release\eram.pch 147 | Release\x64\temp\ 148 | Release\x64\temp\ 149 | 1Byte 150 | 151 | 152 | true 153 | NDEBUG;%(PreprocessorDefinitions) 154 | .\Release\eram.tlb 155 | true 156 | NUL 157 | 158 | 159 | 0x0411 160 | NDEBUG;%(PreprocessorDefinitions) 161 | 162 | 163 | true 164 | .\Release\eram.bsc 165 | 166 | 167 | true 168 | true 169 | Windows 170 | Release\x64\eram.cpl 171 | .\Release\eram.lib 172 | setupapi.lib;Comctl32.lib;%(AdditionalDependencies) 173 | .\eramui.def 174 | 175 | 176 | 177 | 178 | MultiThreadedDebugDLL 179 | Default 180 | false 181 | Disabled 182 | true 183 | Level3 184 | true 185 | None 186 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 187 | Debug\x86\temp\ 188 | .\Debug\eram.pch 189 | Debug\x86\temp\ 190 | Debug\x86\temp\ 191 | 1Byte 192 | 193 | 194 | true 195 | _DEBUG;%(PreprocessorDefinitions) 196 | .\Debug\eram.tlb 197 | true 198 | NUL 199 | Win32 200 | 201 | 202 | 0x0411 203 | _DEBUG;%(PreprocessorDefinitions) 204 | 205 | 206 | true 207 | .\Debug\eram.bsc 208 | 209 | 210 | true 211 | true 212 | true 213 | Windows 214 | Debug\x86\eram.cpl 215 | .\Debug\eram.lib 216 | setupapi.lib;Comctl32.lib;%(AdditionalDependencies) 217 | .\eramui.def 218 | /VERBOSE %(AdditionalOptions) 219 | 220 | 221 | 222 | 223 | MultiThreadedDebugDLL 224 | Default 225 | false 226 | Disabled 227 | true 228 | Level3 229 | None 230 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 231 | Debug\x64\temp\ 232 | .\Debug\eram.pch 233 | Debug\x64\temp\ 234 | Debug\x64\temp\ 235 | 1Byte 236 | 237 | 238 | true 239 | _DEBUG;%(PreprocessorDefinitions) 240 | .\Debug\eram.tlb 241 | true 242 | NUL 243 | 244 | 245 | 0x0411 246 | _DEBUG;%(PreprocessorDefinitions) 247 | 248 | 249 | true 250 | .\Debug\eram.bsc 251 | 252 | 253 | true 254 | true 255 | true 256 | Windows 257 | Debug\x64\eram.cpl 258 | .\Debug\eram.lib 259 | setupapi.lib;Comctl32.lib;%(AdditionalDependencies) 260 | .\eramui.def 261 | /VERBOSE %(AdditionalOptions) 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | mc -cs -h eramum.mc 271 | mc -cs -h eramum.mc 272 | Compiling messages... 273 | Compiling messages... 274 | eramum.bin;eramum.rc;%(Outputs) 275 | eramum.bin;eramum.rc;%(Outputs) 276 | mc -cs -h eramum.mc 277 | mc -cs -h eramum.mc 278 | Compiling messages... 279 | Compiling messages... 280 | eramum.bin;%(Outputs) 281 | eramum.bin;%(Outputs) 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | -------------------------------------------------------------------------------- /eram.h: -------------------------------------------------------------------------------- 1 | /* ERAM.H RAM disk ERAM for WindowsNT/2000/2003/XP/7 2 | Copyright (c) 1999-2020 by *Error15 & Zero3K 3 | Translated into English by Katayama Hirofumi MZ. 4 | */ 5 | 6 | #pragma pack(1) 7 | 8 | int sprintf(char *s, const char *format, ...); 9 | 10 | typedef SIZE_T ULONGPTR, *PULONGPTR; 11 | 12 | 13 | typedef unsigned int UINT; 14 | typedef UCHAR BYTE, *PBYTE, *LPBYTE; 15 | typedef USHORT WORD, *PWORD, *LPWORD; 16 | typedef ULONG DWORD, *PDWORD, *LPDWORD; 17 | typedef int INT, *PINT, *LPINT; 18 | #define NumberOf(x) ((sizeof(x))/(sizeof((x)[0]))) 19 | #define LOBYTE(w) ((BYTE)(w)) 20 | #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) 21 | #ifndef max 22 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 23 | #endif 24 | 25 | #ifndef PARTITION_FAT32 26 | #define PARTITION_FAT32 0x0B 27 | #endif 28 | #define MAXDWORD (MAXULONG) 29 | 30 | #ifndef IOCTL_DISK_GET_LENGTH_INFO 31 | #define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS) 32 | typedef struct { 33 | LARGE_INTEGER Length; 34 | } GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION; 35 | #endif 36 | 37 | typedef NTSTATUS (*ERAM_READ)(PVOID, PIRP, PIO_STACK_LOCATION, PUCHAR); 38 | typedef NTSTATUS (*ERAM_WRITE)(PVOID, PIRP, PIO_STACK_LOCATION, PUCHAR); 39 | typedef BOOLEAN (*ERAM_NEXT)(PVOID, LPDWORD, LPDWORD); 40 | typedef VOID (*ERAM_UNMAP)(PVOID); 41 | 42 | 43 | #define FATID_MSG "RAMdisk driver ERAM version 2.23 Copyright(C)1999-2004 by *Error15" 44 | #define SUBKEY_WSTRING L"\\Parameters" 45 | #define NT_DEVNAME L"\\Device\\Eram" 46 | #define WIN32_PATH L"\\DosDevices\\" 47 | #define DEFAULT_DRV L"Z:" 48 | #define DISKMAXCLUSTER_12 (4086) /* FAT12 Max Cluster */ 49 | #define DISKMAXCLUSTER_16 (65525) /* FAT16 Max Cluster */ 50 | #define DISKMAXCLUSTER_32 (268435455) /* FAT32 Max Cluster */ 51 | #define RAMDISK_MEDIA_TYPE 0xf8 52 | #define VOLUME_LABEL_RAMDISK "MS-RAMDRIVE" 53 | #define VOLUME_LABEL_LOCALDISK "ERAM-DRIVE " 54 | #define TEMPDIR_NAME "TEMP " 55 | #define OWNDIR_NAME ". " 56 | #define PARENTDIR_NAME ".. " 57 | #define ERAMEXTFILEPATH L"C:\\ERAMSWAP.$$$" 58 | 59 | #define DISKMINPAGE (16) 60 | /* Unable to allocate data area; 2 is minimum at allocation 2 */ 61 | #define SECTOR (512) 62 | #define SECTOR_LOG2 (9) 63 | #define RESV_SECTOR_FAT32 (2) 64 | 65 | #define SIZE_KILOBYTE (1024) /* 1KB */ 66 | #define SIZE_MEGABYTE (SIZE_KILOBYTE * 1024) /* 1MB */ 67 | #define PAGE_SIZE_4K (SIZE_KILOBYTE * 4) /* The size of one page */ 68 | #define PAGE_SIZE_LOG2 (12) 69 | #define PAGE_SECTOR (PAGE_SIZE_4K / SECTOR) /* Sectors per page */ 70 | #define PAGE_SEC_LOG2 (PAGE_SIZE_LOG2 - SECTOR_LOG2) 71 | #define EXT_PAGE_SIZE (SIZE_KILOBYTE * 64) /* 64KB unit switch */ 72 | #define EXT_PAGE_SIZE_LOG2 (16) 73 | #define EXT_PAGE_SECTOR (EXT_PAGE_SIZE / SECTOR) /* sectors per bank */ 74 | #define EXT_PAGE_SEC_LOG2 (EXT_PAGE_SIZE_LOG2 - SECTOR_LOG2) 75 | #define LIMIT_2GBPAGES (0x7ffff) /* 2GB pages */ 76 | #define LIMIT_4GBPAGES (0xfffff) /* 4GB pages */ 77 | #define BIOS_ADDRESS_START ((DWORD)(0xe0000)) /* E0000..FFFFF */ 78 | #define BIOS_ADDRESS_END ((DWORD)(0xfffff)) /* E0000..FFFFF */ 79 | #define BIOS_SIZE ((DWORD)(BIOS_ADDRESS_END - BIOS_ADDRESS_START + 1)) 80 | 81 | /* BPB array (FAT12,16) */ 82 | typedef struct { 83 | WORD wNumSectorByte; // The number of sector bytes (BPB, =SECTOR) 84 | BYTE byAllocUnit; // Allocation unit (alloc) 85 | WORD wNumResvSector; // The number of reserved sectors, FAT12/16=1, FAT32=32 86 | BYTE byNumFat; // The number of FATs (=1) 87 | WORD wNumDirectory; // The number of root directory entries (dir, =128) 88 | WORD wNumAllSector; // The number of all sectors (under 32MB) 89 | BYTE byMediaId; // Media ID(media, =f8) 90 | WORD wNumFatSector; // The number of FAT sectors (FAT) 91 | } bpb_struc1; 92 | 93 | typedef struct { 94 | WORD bsSecPerTrack; // Sectors per bank (=PAGE_SECTOR) 95 | WORD bsHeads; // The number of heads (=1) 96 | ULONG bsHiddenSecs; // The number of hidden sectors (=0) 97 | ULONG bsHugeSectors; // The sectors over 32MB 98 | } bpb_struc2; 99 | 100 | typedef struct { 101 | BYTE bsDriveNumber; // Drive number 102 | BYTE bsReserved1; // Reserved 103 | BYTE bsBootSignature; // Signature 104 | ULONG bsVolumeID; // Volume ID 105 | CHAR bsLabel[11]; // Label 106 | CHAR bsFileSystemType[8];// File system type 107 | } bpb_struc3; 108 | 109 | /* BPB array (FAT32) */ 110 | typedef struct { 111 | DWORD dwNumFatSector32; // The number of FAT sectors (FAT32) 112 | WORD wExtFlags; // Extended flags 113 | WORD wFileSystemVersion; // Filesystem version 114 | DWORD dwRootCluster; // Root cluster number (=2) 115 | WORD wFsInfoSector; // FSINFO sector number (=1) 116 | WORD wBackupBootSector; // Backup boot sector number (=6) 117 | BYTE byResv[12]; // Reserved 118 | } bpb_struc4; 119 | 120 | typedef union { 121 | DWORD dwOptflag; // ERAM control 122 | struct { 123 | BYTE NonPaged:1; // bit 0:NonPagedPool usage 124 | BYTE External:1; // bit 1:External memory usage 125 | BYTE SkipExternalCheck:1; // bit 2:Don't test memory when using external memory 126 | BYTE Swapable:1; // bit 3:Local disk flag 127 | BYTE EnableFat32:1; // bit 4:Allow FAT32 usage 128 | BYTE SkipReportUsage:1; // bit 5:Don't report when using external memory = 2000:Allow stand-by 129 | BYTE MakeTempDir:1; // bit 6:TEMP directory creation 130 | BYTE byResv7:1; // bit 7: 131 | BYTE byResv8:8; // bit 8: 132 | BYTE byResv16:8; // bit16: 133 | BYTE byResv24:7; // bit24: 134 | BYTE UseExtFile:1; // bit31:External file usage 135 | } Bits; 136 | } ERAM_OPTFLAG, *PERAM_OPTFLAG; 137 | 138 | /* ERAM disk device specific info */ 139 | typedef struct { 140 | PDEVICE_OBJECT pDevObj; 141 | ERAM_READ EramRead; 142 | ERAM_WRITE EramWrite; 143 | ERAM_NEXT EramNext; 144 | ERAM_UNMAP EramUnmap; 145 | ULONGPTR uNowMapAdr; // OS-Unmanaged/file, the currently mapping address 146 | LPBYTE pExtPage; // OS-Unmanaged/file, the memory mapping address 147 | LPBYTE pPageBase; // OS-Managed Memory 148 | ULONGPTR uSizeTotal; // Total size (4KB unit) 149 | UNICODE_STRING Win32Name; 150 | ULONG uAllSector; // The number of all sectors 151 | ULONGPTR uExternalStart; // External memory starting position 152 | ULONGPTR uExternalEnd; // External memory ending position (of detected) 153 | FAST_MUTEX FastMutex; // Fast mutex 154 | PHYSICAL_ADDRESS MapAdr; // OS-Unmanaged Memory map position top 155 | ULONG bsHiddenSecs; // The number of hidden sectors (=0) 156 | HANDLE hFile; // External file handle (in system process) 157 | HANDLE hSection; // External file mapping handle (in system process) 158 | LIST_ENTRY IrpList; // Irp list top 159 | KSPIN_LOCK IrpSpin; // Irp list spinlock 160 | KSEMAPHORE IrpSem; // Irp list semaphore 161 | PVOID pThreadObject; // Irp list thred object 162 | ERAM_OPTFLAG uOptflag; // Option 163 | BYTE FAT_size; // PARTITION_... FAT_12,FAT_16,HUGE,FAT32 164 | BYTE bThreadStop; // Thread Stop Request 165 | } ERAM_EXTENSION, *PERAM_EXTENSION; 166 | 167 | /* MBR-inside partitoin table (PC/AT) */ 168 | typedef struct { 169 | BYTE byBootInd; 170 | BYTE byFirstHead; 171 | BYTE byFirstSector; 172 | BYTE byFirstTrack; 173 | BYTE byFileSystem; 174 | BYTE byLastHead; 175 | BYTE byLastSector; 176 | BYTE byLastTrack; 177 | DWORD dwStartSector; 178 | DWORD dwNumSectors; 179 | } MBR_PARTITION, *PMBR_PARTITION; 180 | 181 | /* Info for boot sector */ 182 | typedef struct { 183 | bpb_struc1 BPB; /* BPB array */ 184 | bpb_struc2 BPB_ext; /* DOS5 extended area */ 185 | bpb_struc3 BPB_ext2; /* Extended area */ 186 | bpb_struc4 BPB_fat32; /* FAT32 only */ 187 | TIME_FIELDS TimeInfo; /* date and time */ 188 | CHAR bsLabel[11]; /* label */ 189 | WCHAR wszExtFile[4]; /* \\??\\ */ 190 | WCHAR wszExtFileMain[260]; /* C:\\ERAMSWAP.$$$ */ 191 | } FAT_ID, *PFAT_ID; 192 | 193 | typedef struct { 194 | BYTE bsJump[3]; // jmp $(=eb, fe, 90) 195 | BYTE bsOemName[8]; // Device name (='ERAM ') 196 | bpb_struc1 BPB; // BPB array 197 | bpb_struc2 BPB_ext; // DOS5 extended area 198 | bpb_struc3 BPB_ext2; // Extended area 199 | BYTE byResv1[194]; 200 | BYTE szMsg[128]; // 0x100 201 | BYTE byResv2[126]; // 0x180 202 | BYTE bsSig2[2]; /* 55,AA */ 203 | } BOOTSECTOR_FAT16, *PBOOTSECTOR_FAT16; 204 | 205 | typedef struct { 206 | BYTE bsJump[3]; // jmp $(=eb, fe, 90) 207 | BYTE bsOemName[8]; // Device name (='ERAM ') 208 | bpb_struc1 BPB; // BPB array 209 | bpb_struc2 BPB_ext; // DOS5 extended area 210 | bpb_struc4 BPB_fat32; // FAT32 only 211 | bpb_struc3 BPB_ext2; // Extended area 212 | BYTE byResv1[166]; 213 | BYTE szMsg[128]; // 0x100 214 | BYTE byResv[62]; // 0x180 215 | MBR_PARTITION Parts[4]; // 0x1BE, 1CE, 1DE, 1EE 216 | BYTE bsSig2[2]; /* 55,AA */ 217 | } BOOTSECTOR_FAT32, *PBOOTSECTOR_FAT32; 218 | 219 | /* FSINFO (FAT32) */ 220 | typedef struct { 221 | DWORD bfFSInf_Sig; /* "rrAa" */ 222 | DWORD bfFSInf_free_clus_cnt; /* Free clusters -1:Unknown */ 223 | DWORD bfFSInf_next_free_clus; /* Cluster reserved last time */ 224 | DWORD bfFSInf_resvd[3]; 225 | } BIGFATBOOTFSINFO, *PBIGFATBOOTFSINFO; 226 | 227 | typedef struct { 228 | DWORD FSInfo_Sig; /* "RRaA" */ 229 | BYTE byResv[480]; 230 | BIGFATBOOTFSINFO FsInfo; /* 1E4.. */ 231 | BYTE byResv2[2]; 232 | BYTE bsSig2[2]; /* 55,AA */ 233 | } FSINFO_SECTOR, *PFSINFO_SECTOR; 234 | 235 | /* Directory entry */ 236 | typedef struct { 237 | CHAR sName[11]; /* Filename */ 238 | union { 239 | BYTE byAttr; /* File attributes */ 240 | struct { 241 | BYTE byR:1; 242 | BYTE byH:1; 243 | BYTE byS:1; 244 | BYTE byVol:1; 245 | BYTE byDir:1; 246 | BYTE byA:1; 247 | } Bits; 248 | } uAttr; 249 | BYTE byResv1[10]; 250 | WORD wUpdMinute; /* Update Time */ 251 | WORD wUpdDate; /* Update Date */ 252 | WORD wCluster; /* First cluster */ 253 | DWORD dwFileSize; /* The file size */ 254 | } DIR_ENTRY, *PDIR_ENTRY; 255 | 256 | /* Root Directory Entry */ 257 | typedef struct { 258 | DIR_ENTRY vol; 259 | DIR_ENTRY temp; 260 | } vol_label; 261 | 262 | /* Subdirectory Entry */ 263 | typedef struct { 264 | DIR_ENTRY own; 265 | DIR_ENTRY parent; 266 | } dir_init; 267 | 268 | 269 | /* Prototypes */ 270 | 271 | //------ Oldie hidden API 272 | 273 | extern __declspec(dllimport) ULONG NtBuildNumber; 274 | 275 | #define BUILD_NUMBER_NT40 (1381) 276 | #define BUILD_NUMBER_NT50 (2195) 277 | #define BUILD_NUMBER_NT51 (2600) 278 | 279 | NTSTATUS 280 | NTAPI 281 | ZwCreateSection( 282 | OUT PHANDLE SectionHandle, 283 | IN ACCESS_MASK DesiredAccess, 284 | IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, 285 | IN PLARGE_INTEGER MaximumSize OPTIONAL, 286 | IN ULONG SectionPageProtection, 287 | IN ULONG AllocationAttributes, 288 | IN HANDLE FileHandle OPTIONAL 289 | ); 290 | #ifndef SEC_COMMIT 291 | #define SEC_COMMIT (0x8000000) 292 | #endif 293 | 294 | //------ Functions to be used at all times in normal use 295 | 296 | NTSTATUS EramCreateClose( 297 | IN PDEVICE_OBJECT pDevObj, 298 | IN PIRP pIrp 299 | ); 300 | 301 | NTSTATUS EramDeviceControl( 302 | IN PDEVICE_OBJECT pDevObj, 303 | IN PIRP pIrp 304 | ); 305 | 306 | VOID EramDeviceControlGeometry( 307 | PERAM_EXTENSION pEramExt, 308 | IN PIRP pIrp, 309 | IN ULONG uLen 310 | ); 311 | 312 | VOID EramDeviceControlGetPartInfo( 313 | PERAM_EXTENSION pEramExt, 314 | IN PIRP pIrp, 315 | IN ULONG uLen 316 | ); 317 | 318 | VOID EramDeviceControlSetPartInfo( 319 | PERAM_EXTENSION pEramExt, 320 | IN PIRP pIrp, 321 | IN ULONG uLen 322 | ); 323 | 324 | VOID EramDeviceControlVerify( 325 | PERAM_EXTENSION pEramExt, 326 | IN PIRP pIrp, 327 | IN ULONG uLen 328 | ); 329 | 330 | VOID EramDeviceControlDiskCheckVerify( 331 | PERAM_EXTENSION pEramExt, 332 | IN PIRP pIrp, 333 | IN ULONG uLen 334 | ); 335 | 336 | VOID EramDeviceControlGetLengthInfo( 337 | PERAM_EXTENSION pEramExt, 338 | IN PIRP pIrp, 339 | IN ULONG uLen 340 | ); 341 | 342 | NTSTATUS EramReadWrite( 343 | IN PDEVICE_OBJECT pDevObj, 344 | IN PIRP pIrp 345 | ); 346 | 347 | VOID EramUnloadDriver( 348 | IN PDRIVER_OBJECT pDrvObj 349 | ); 350 | 351 | VOID EramUnloadDevice( 352 | IN PDRIVER_OBJECT pDrvObj, 353 | IN PDEVICE_OBJECT pDevObj, 354 | IN PERAM_EXTENSION pEramExt 355 | ); 356 | 357 | VOID ResourceRelease( 358 | IN PDRIVER_OBJECT pDrvObj, 359 | IN PERAM_EXTENSION pEramExt 360 | ); 361 | 362 | VOID ReleaseMemResource( 363 | IN PDRIVER_OBJECT pDrvObj, 364 | IN PERAM_EXTENSION pEramExt 365 | ); 366 | 367 | BOOLEAN EramReportEvent( 368 | IN PVOID pIoObject, 369 | IN NTSTATUS ntErrorCode, 370 | IN PSTR pszString 371 | ); 372 | 373 | BOOLEAN EramReportEventW( 374 | IN PVOID pIoObject, 375 | IN NTSTATUS ntErrorCode, 376 | IN PWSTR pwStr 377 | ); 378 | 379 | NTSTATUS ReadPool( 380 | IN PERAM_EXTENSION pEramExt, 381 | IN PIRP pIrp, 382 | IN PIO_STACK_LOCATION pIrpSp, 383 | IN PUCHAR lpDest 384 | ); 385 | 386 | NTSTATUS WritePool( 387 | IN PERAM_EXTENSION pEramExt, 388 | IN PIRP pIrp, 389 | IN PIO_STACK_LOCATION pIrpSp, 390 | IN PUCHAR lpSrc 391 | ); 392 | 393 | NTSTATUS ExtRead1( 394 | IN PERAM_EXTENSION pEramExt, 395 | IN PIRP pIrp, 396 | IN PIO_STACK_LOCATION pIrpSp, 397 | IN PUCHAR lpDest 398 | ); 399 | 400 | NTSTATUS ExtWrite1( 401 | IN PERAM_EXTENSION pEramExt, 402 | IN PIRP pIrp, 403 | IN PIO_STACK_LOCATION pIrpSp, 404 | IN PUCHAR lpSrc 405 | ); 406 | 407 | BOOLEAN ExtNext1( 408 | IN PERAM_EXTENSION pEramExt, 409 | IN OUT LPDWORD lpeax, 410 | IN OUT LPDWORD lpebx 411 | ); 412 | 413 | BOOLEAN ExtMap( 414 | IN PERAM_EXTENSION pEramExt, 415 | IN ULONGPTR uMapAdr 416 | ); 417 | 418 | VOID ExtUnmap( 419 | IN PERAM_EXTENSION pEramExt 420 | ); 421 | 422 | NTSTATUS ExtFilePendingRw( 423 | IN PERAM_EXTENSION pEramExt, 424 | IN PIRP pIrp, 425 | IN PIO_STACK_LOCATION pIrpSp, 426 | IN PUCHAR pTransAddr 427 | ); 428 | 429 | VOID EramRwThread( 430 | IN PVOID pContext 431 | ); 432 | 433 | NTSTATUS EramRwThreadIrp( 434 | PERAM_EXTENSION pEramExt, 435 | PLIST_ENTRY pIrpList 436 | ); 437 | 438 | NTSTATUS ExtFileRead1( 439 | IN PERAM_EXTENSION pEramExt, 440 | IN PIRP pIrp, 441 | IN PIO_STACK_LOCATION pIrpSp, 442 | IN PUCHAR lpDest 443 | ); 444 | 445 | NTSTATUS ExtFileWrite1( 446 | IN PERAM_EXTENSION pEramExt, 447 | IN PIRP pIrp, 448 | IN PIO_STACK_LOCATION pIrpSp, 449 | IN PUCHAR lpSrc 450 | ); 451 | 452 | BOOLEAN ExtFileNext1( 453 | IN PERAM_EXTENSION pEramExt, 454 | IN OUT LPDWORD lpeax, 455 | IN OUT LPDWORD lpebx 456 | ); 457 | 458 | BOOLEAN ExtFileMap( 459 | IN PERAM_EXTENSION pEramExt, 460 | IN ULONGPTR uMapAdr 461 | ); 462 | 463 | VOID ExtFileUnmap( 464 | IN PERAM_EXTENSION pEramExt 465 | ); 466 | 467 | NTSTATUS EramShutdown( 468 | IN PDEVICE_OBJECT pDevObj, 469 | IN PIRP pIrp 470 | ); 471 | 472 | /* Definitions for paging */ 473 | #ifdef ALLOC_PRAGMA 474 | //------ Functions to be used at all times in normal use 475 | #pragma alloc_text(PAGE, EramCreateClose) 476 | #pragma alloc_text(PAGE, EramDeviceControl) 477 | #pragma alloc_text(PAGE, EramDeviceControlGeometry) 478 | #pragma alloc_text(PAGE, EramDeviceControlGetPartInfo) 479 | #pragma alloc_text(PAGE, EramDeviceControlSetPartInfo) 480 | #pragma alloc_text(PAGE, EramDeviceControlVerify) 481 | #pragma alloc_text(PAGE, EramDeviceControlGetLengthInfo) 482 | #pragma alloc_text(PAGE, EramDeviceControlDiskCheckVerify) 483 | #pragma alloc_text(PAGE, EramDeviceControlGetLengthInfo) 484 | #pragma alloc_text(PAGE, EramReadWrite) 485 | #pragma alloc_text(PAGE, EramUnloadDriver) 486 | #pragma alloc_text(PAGE, EramUnloadDevice) 487 | #pragma alloc_text(PAGE, ResourceRelease) 488 | #pragma alloc_text(PAGE, ReleaseMemResource) 489 | #pragma alloc_text(PAGE, EramReportEvent) 490 | #pragma alloc_text(PAGE, EramReportEventW) 491 | #pragma alloc_text(PAGE, ReadPool) 492 | #pragma alloc_text(PAGE, WritePool) 493 | #pragma alloc_text(PAGE, ExtRead1) 494 | #pragma alloc_text(PAGE, ExtWrite1) 495 | #pragma alloc_text(PAGE, ExtNext1) 496 | #pragma alloc_text(PAGE, ExtMap) 497 | #pragma alloc_text(PAGE, ExtUnmap) 498 | #pragma alloc_text(PAGE, ExtFilePendingRw) 499 | #pragma alloc_text(PAGE, EramRwThread) 500 | #pragma alloc_text(PAGE, EramRwThreadIrp) 501 | #pragma alloc_text(PAGE, ExtFileRead1) 502 | #pragma alloc_text(PAGE, ExtFileWrite1) 503 | #pragma alloc_text(PAGE, ExtFileNext1) 504 | #pragma alloc_text(PAGE, ExtFileMap) 505 | #pragma alloc_text(PAGE, ExtFileUnmap) 506 | #pragma alloc_text(PAGE, EramShutdown) 507 | #endif // ALLOC_PRAGMA 508 | 509 | //------ Below are the functions used at initialization 510 | 511 | NTSTATUS DriverEntry( 512 | IN OUT PDRIVER_OBJECT pDrvObj, 513 | IN PUNICODE_STRING pRegPath 514 | ); 515 | 516 | VOID InitFatId( 517 | IN PFAT_ID pFatId 518 | ); 519 | 520 | NTSTATUS EramInitDisk( 521 | IN PDRIVER_OBJECT pDrvObj, 522 | IN PFAT_ID pFatId, 523 | IN PUNICODE_STRING pRegParam 524 | ); 525 | 526 | NTSTATUS MemSetup( 527 | IN PDRIVER_OBJECT pDrvObj, 528 | IN PERAM_EXTENSION pEramExt, 529 | IN PFAT_ID pFatId, 530 | IN SIZE_T uMemSize 531 | ); 532 | 533 | BOOLEAN OsAlloc( 534 | IN PDRIVER_OBJECT pDrvObj, 535 | IN PERAM_EXTENSION pEramExt, 536 | IN SIZE_T uMemSize 537 | ); 538 | 539 | VOID CalcAvailSize( 540 | IN PDRIVER_OBJECT pDrvObj, 541 | IN POOL_TYPE fPool, 542 | IN SIZE_T uMemSize 543 | ); 544 | 545 | DEVICE_TYPE CheckSwapable( 546 | IN PUNICODE_STRING pRegParam 547 | ); 548 | 549 | VOID CheckDeviceName( 550 | IN PUNICODE_STRING pRegParam, 551 | IN OUT PUNICODE_STRING pNtDevName 552 | ); 553 | 554 | VOID CheckSwitch( 555 | IN PERAM_EXTENSION pEramExt, 556 | IN PFAT_ID pFatId, 557 | IN PUNICODE_STRING pRegParam, 558 | IN OUT PUNICODE_STRING pDrvStr 559 | ); 560 | 561 | VOID GetMaxAddress( 562 | IN PERAM_EXTENSION pEramExt, 563 | IN PUNICODE_STRING pRegParam 564 | ); 565 | 566 | VOID PrepareVolumeLabel( 567 | IN PERAM_EXTENSION pEramExt, 568 | IN PFAT_ID pFatId, 569 | IN PUNICODE_STRING pRegParam 570 | ); 571 | 572 | BOOLEAN CheckVolumeLabel( 573 | IN PERAM_EXTENSION pEramExt, 574 | IN PFAT_ID pFatId, 575 | IN PUNICODE_STRING pUniVol 576 | ); 577 | 578 | VOID PrepareExtFileName( 579 | IN PERAM_EXTENSION pEramExt, 580 | IN PFAT_ID pFatId, 581 | IN PUNICODE_STRING pRegParam 582 | ); 583 | 584 | BOOLEAN EramFormatFat( 585 | IN PERAM_EXTENSION pEramExt, 586 | IN PFAT_ID pFatId 587 | ); 588 | 589 | VOID EramSetup( 590 | IN PERAM_EXTENSION pEramExt, 591 | IN PFAT_ID pFatId 592 | ); 593 | 594 | VOID EramLocate( 595 | IN PERAM_EXTENSION pEramExt 596 | ); 597 | 598 | BOOLEAN EramFormat( 599 | IN PERAM_EXTENSION pEramExt, 600 | IN PFAT_ID pFatId 601 | ); 602 | 603 | BOOLEAN EramClearInfo( 604 | IN PERAM_EXTENSION pEramExt, 605 | IN PFAT_ID pFatId 606 | ); 607 | 608 | BOOLEAN ExtClear( 609 | IN PERAM_EXTENSION pEramExt, 610 | IN ULONGPTR uSize 611 | ); 612 | 613 | BOOLEAN ExtFileClear( 614 | IN PERAM_EXTENSION pEramExt, 615 | IN ULONGPTR uSize 616 | ); 617 | 618 | ULONGPTR CalcEramInfoPage( 619 | IN PERAM_EXTENSION pEramExt, 620 | IN PFAT_ID pFatId 621 | ); 622 | 623 | BOOLEAN EramMakeFAT( 624 | IN PERAM_EXTENSION pEramExt, 625 | IN PFAT_ID pFatId 626 | ); 627 | 628 | BOOLEAN EramSetLabel( 629 | IN PERAM_EXTENSION pEramExt, 630 | IN PFAT_ID pFatId 631 | ); 632 | 633 | BOOLEAN GetExternalStart( 634 | IN PDRIVER_OBJECT pDrvObj, 635 | IN PERAM_EXTENSION pEramExt 636 | ); 637 | 638 | BOOLEAN GetMaxMem( 639 | IN PDRIVER_OBJECT pDrvObj, 640 | IN PERAM_EXTENSION pEramExt, 641 | IN PWSTR pwStr, 642 | OUT PULONG puSize //TODO: 64bit would be required here? 643 | ); 644 | 645 | BOOLEAN CheckMaxMem( 646 | IN PDRIVER_OBJECT pDrvObj, 647 | IN PERAM_EXTENSION pEramExt, 648 | IN ULONGPTR uSize 649 | ); 650 | 651 | BOOLEAN CheckExternalSize( 652 | IN PDRIVER_OBJECT pDrvObj, 653 | IN PERAM_EXTENSION pEramExt 654 | ); 655 | 656 | VOID ResourceInitTiny( 657 | IN PDRIVER_OBJECT pDrvObj, 658 | IN PCM_RESOURCE_LIST pResList, 659 | IN ULONGPTR uStart, 660 | IN ULONGPTR uSize 661 | ); 662 | 663 | //TODO: what about those not sure if tiny should remain 32bit?? 664 | 665 | BOOLEAN CheckExternalMemoryExist( 666 | IN PDRIVER_OBJECT pDrvObj, 667 | IN ULONGPTR uStart, 668 | IN ULONGPTR uDiskSize, 669 | OUT PULONGPTR puSize, 670 | IN ULONGPTR dwMaxAdr 671 | ); 672 | 673 | BOOLEAN ResourceSetupTiny( 674 | IN PDRIVER_OBJECT pDrvObj, 675 | IN ULONGPTR uStart, 676 | IN PPHYSICAL_ADDRESS pMapAdr 677 | ); 678 | 679 | BOOLEAN ExtReport( 680 | IN PDRIVER_OBJECT pDrvObj, 681 | IN PERAM_EXTENSION pEramExt 682 | ); 683 | 684 | DWORD GetAcpiReservedMemory( 685 | IN PDRIVER_OBJECT pDrvObj 686 | ); 687 | 688 | DWORD CheckAcpiRsdt( 689 | IN PDRIVER_OBJECT pDrvObj, 690 | IN DWORD dwMinValue, 691 | IN DWORD dwRsdt 692 | ); 693 | 694 | DWORD CheckRsdtElements( 695 | IN PDRIVER_OBJECT pDrvObj, 696 | IN DWORD dwMinValue, 697 | IN DWORD dwRsdtElement 698 | ); 699 | 700 | /* Definitions for releasing after initialization */ 701 | #ifdef ALLOC_PRAGMA 702 | #pragma alloc_text(INIT, DriverEntry) 703 | #pragma alloc_text(INIT, InitFatId) 704 | #pragma alloc_text(INIT, EramInitDisk) 705 | #pragma alloc_text(INIT, MemSetup) 706 | #pragma alloc_text(INIT, OsAlloc) 707 | #pragma alloc_text(INIT, CalcAvailSize) 708 | #pragma alloc_text(INIT, CheckSwapable) 709 | #pragma alloc_text(INIT, CheckDeviceName) 710 | #pragma alloc_text(INIT, CheckSwitch) 711 | #pragma alloc_text(INIT, GetMaxAddress) 712 | #pragma alloc_text(INIT, PrepareVolumeLabel) 713 | #pragma alloc_text(INIT, CheckVolumeLabel) 714 | #pragma alloc_text(INIT, PrepareExtFileName) 715 | #pragma alloc_text(INIT, EramFormatFat) 716 | #pragma alloc_text(INIT, EramSetup) 717 | #pragma alloc_text(INIT, EramLocate) 718 | #pragma alloc_text(INIT, EramFormat) 719 | #pragma alloc_text(INIT, EramClearInfo) 720 | #pragma alloc_text(INIT, ExtClear) 721 | #pragma alloc_text(INIT, ExtFileClear) 722 | #pragma alloc_text(INIT, CalcEramInfoPage) 723 | #pragma alloc_text(INIT, EramMakeFAT) 724 | #pragma alloc_text(INIT, EramSetLabel) 725 | #pragma alloc_text(INIT, GetExternalStart) 726 | #pragma alloc_text(INIT, GetMaxMem) 727 | #pragma alloc_text(INIT, CheckMaxMem) 728 | #pragma alloc_text(INIT, CheckExternalSize) 729 | #pragma alloc_text(INIT, ResourceInitTiny) 730 | #pragma alloc_text(INIT, CheckExternalMemoryExist) 731 | #pragma alloc_text(INIT, ResourceSetupTiny) 732 | #pragma alloc_text(INIT, ExtReport) 733 | #pragma alloc_text(INIT, GetAcpiReservedMemory) 734 | #pragma alloc_text(INIT, CheckAcpiRsdt) 735 | #pragma alloc_text(INIT, CheckRsdtElements) 736 | 737 | #endif // ALLOC_PRAGMA 738 | 739 | #pragma pack() 740 | -------------------------------------------------------------------------------- /eramui/eramui.c: -------------------------------------------------------------------------------- 1 | /* ERAMUI.C RAM Disk ERAM for WindowsNT/2000/2003/XP/7 2 | Control Panel Applet / Class Installer 3 | Copyright (c) 1999-2020 by *Error15 & Zero3K 4 | Translated into English by Katayama Hirofumi MZ . 5 | */ 6 | 7 | /* History 8 | v1.00 9 | Newly created. 10 | v1.01 11 | over32MB support (upto 64MB). 12 | v1.10 13 | Windows2000 class installer added. 14 | v1.11 15 | Windows2000 property sheet page added. 16 | Non-page, page pool size modification feature added. 17 | v2.00 18 | Non-page, page pool size modification feature obsoleted. 19 | OS-Unmanaged Memory setting feature added. 20 | Uninstaller feature added. 21 | v2.01 22 | Increased Allocation Unit 32 and enabled 1GB allocation. 23 | NT3.51 support was obsolete for uninstaller feature Windows2000 support enhancement. 24 | v2.02 25 | Add warning if drive character was in use. 26 | Fix that page number was 6 digits only. 27 | Enable to write the starting address of memory after MAXMEM=nn. 28 | Fixed that the reboot dialog won't be shown after delete. 29 | Fixed that the RAM disk was created immediately after deleting in NT. 30 | Enabled to save the info that the memory check was skipped or not. 31 | Resume the NT3.51 support. 32 | Fixed the lacking a colon of the drive character of registry after setting changed. 33 | Supported deletion of event log messages. 34 | v2.10 35 | Automatically set supported bits if Win2000 and later (=FAT32 support). 36 | 64-nized max. allocation unit. 37 | v2.11 38 | WinXP support. 39 | Added startup change feature of Fastfat driver 40 | v2.12 41 | Reversal of UI of Memory upper limit detector. 42 | Add standby countermeasure unit. 43 | v2.20 44 | String resource american support. 45 | Maximum cluster size of 16 bit FAT is limited to 65525. 46 | Resource support of message box. 47 | 32bit-nized option flag(s). 48 | 4GB limitation added. 49 | Made real device setting possible without swapping. 50 | Add edit of the TEMP directory creation. 51 | root directory restriction added. 52 | */ 53 | 54 | 55 | #define STRICT 56 | #pragma warning(disable : 4001 4054 4055 4100 4115 4201 4214 4514) 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include "eramui.h" 67 | 68 | #define RAMDISK_MEDIA_TYPE 0xf8 /* ERAM.H */ 69 | #define SECTOR (512) /* ERAM.H */ 70 | #define PAGE_SIZE_4K (1024 * 4) /* the size of one page */ 71 | #define DISKMAXCLUSTER_16 (65525) /* The max cluster(s) of FAT16 */ 72 | #define DISKMAXCLUSTER_32 (268435455) /* The max cluster(s) of FAT32 */ 73 | #define DISKMINPAGE (16) /* Unable to allocate the data area; 2 is minimal value in Allocation 2 */ 74 | #define MAXALLOCUNIT (64) /* allocation unit */ 75 | #define MAXINSTANCE (9999) /* The max instance(s) */ 76 | #define LIMIT_4GBPAGES (0xfffff) /* 4GB pages */ 77 | 78 | #define EXPORT __declspec(dllexport) 79 | 80 | #define SPPSR_ENUM_ADV_DEVICE_PROPERTIES 3 81 | 82 | /* The structure for referencing the ERAM registry setting values */ 83 | typedef union { 84 | DWORD dwOptflag; // ERAM Control. 85 | struct { 86 | BYTE NonPaged:1; // bit 0:NonPagedPool use. 87 | BYTE External:1; // bit 1:External memory use. 88 | BYTE SkipExternalCheck:1; // bit 2:Do not check memory when using external memory 89 | BYTE Swapable:1; // bit 3:Treat as local disk 90 | BYTE EnableFat32:1; // bit 4:Allow FAT32 use. 91 | BYTE SkipReportUsage:1; // bit 5:When using external memory don't report=2000:stand-by OK 92 | BYTE MakeTempDir:1; // bit 6:TEMP directory creation. 93 | BYTE byResv7:1; // bit 7: 94 | BYTE byResv8:8; // bit 8: 95 | BYTE byResv16:8; // bit16: 96 | BYTE byResv24:7; // bit24: 97 | BYTE UseExtFile:1; // bit31:External file use. 98 | } Bits; 99 | } ERAM_OPTFLAG, *PERAM_OPTFLAG; 100 | 101 | typedef struct { 102 | DWORD dwSizePage; 103 | DWORD dwExtStart; 104 | ERAM_OPTFLAG uOption; 105 | WORD wRootDir; 106 | BYTE byAllocUnit; 107 | BYTE byMediaId; 108 | CHAR szDefDrv[3]; 109 | } ERAMREGOPT, *PERAMREGOPT, FAR *LPERAMREGOPT; 110 | 111 | /* SETUPAPI function type definitions */ 112 | typedef HDEVINFO (WINAPI* LPFNSETUPDIGETCLASSDEVSA)(LPGUID, PCSTR, HWND, DWORD); 113 | typedef BOOL (WINAPI* LPFNSETUPDIENUMDEVICEINFO)(HDEVINFO, DWORD, PSP_DEVINFO_DATA); 114 | typedef BOOL (WINAPI* LPFNSETUPDIREMOVEDEVICE)(HDEVINFO, PSP_DEVINFO_DATA); 115 | typedef BOOL (WINAPI* LPFNSETUPDIDESTROYDEVICEINFOLIST)(HDEVINFO); 116 | typedef HKEY (WINAPI* LPFNSETUPDIOPENDEVREGKEY)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM); 117 | 118 | /* function pointer(s) in ERAM */ 119 | typedef struct { 120 | HMODULE hSetupApi; 121 | LPFNSETUPDIGETCLASSDEVSA lpfnSetupDiGetClassDevs; 122 | LPFNSETUPDIENUMDEVICEINFO lpfnSetupDiEnumDeviceInfo; 123 | LPFNSETUPDIREMOVEDEVICE lpfnSetupDiRemoveDevice; 124 | LPFNSETUPDIDESTROYDEVICEINFOLIST lpfnSetupDiDestroyDeviceInfoList; 125 | LPFNSETUPDIOPENDEVREGKEY lpfnSetupDiOpenDevRegKey; 126 | } SETUPAPIENTRYS, FAR *LPSETUPAPIENTRYS, *PSETUPAPIENTRYS; 127 | 128 | /* global variables */ 129 | HINSTANCE hgInstance = NULL; 130 | BOOL bUpdate = FALSE; 131 | BOOL bReboot = FALSE; 132 | HKEY hgKey = NULL; 133 | BOOL bProp = FALSE; 134 | SETUPAPIENTRYS sSetupApi = { NULL, NULL, NULL, NULL, NULL, NULL }; 135 | 136 | /* string constants */ 137 | CHAR szWinName[] = "ERAM for Windows NT/2000/XP"; 138 | CHAR szRootDir[] = "RootDirEntries"; 139 | CHAR szOption[] = "Option"; 140 | CHAR szAllocUnit[] = "AllocUnit"; 141 | CHAR szMediaId[] = "MediaId"; 142 | CHAR szDefDrv[] = "DriveLetter"; 143 | CHAR szPage[] = "Page"; 144 | CHAR szExtStart[] = "ExtStart"; 145 | 146 | /* prototypes */ 147 | BOOL WINAPI StatusDlgProc(HWND, UINT, WPARAM, LPARAM); 148 | BOOL WINAPI WmInitDialog(HWND, HWND, LPARAM); 149 | VOID WINAPI GetRegOption(LPERAMREGOPT); 150 | VOID WINAPI ReadRegValues(HKEY, LPSTR, UINT, LPVOID, ULONG, WORD); 151 | VOID WINAPI SetPageOption(HWND, LPERAMREGOPT); 152 | VOID WINAPI WmCommand(HWND, INT, HWND, UINT); 153 | VOID WINAPI EnableExtGroup(HWND, BOOL); 154 | VOID WINAPI Reboot(HWND); 155 | BOOL WINAPI SettingUpdate(HWND); 156 | BOOL WINAPI GetPageOption(HWND, LPERAMREGOPT); 157 | BOOL WINAPI SetRegOption(LPERAMREGOPT); 158 | LONG WINAPI CplInit(VOID); 159 | VOID WINAPI CplNewInquire(LPNEWCPLINFO); 160 | BOOL WINAPI SystemShutdown(VOID); 161 | DWORD WINAPI WmNotify(HWND, INT, NMHDR FAR*); 162 | VOID WINAPI WmDestroy(HWND); 163 | BOOL WINAPI Eram2000UnInstall(HWND); 164 | BOOL WINAPI GetInfName(HDEVINFO, PSP_DEVINFO_DATA, LPSTR, DWORD); 165 | BOOL WINAPI DeleteInfFiles(LPCSTR); 166 | LPCSTR WINAPI GetEramClass(GUID*); 167 | LPSTR WINAPI GetResStr(WORD, LPSTR, INT); 168 | 169 | 170 | /* StatusDlgProc 171 | Setting Dialog. 172 | Parameters 173 | hDlg The window handle of dialog. 174 | uMsg The message. 175 | wParam Parameters 176 | lParam Parameters 177 | Return Value 178 | The results. 179 | */ 180 | 181 | BOOL WINAPI StatusDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 182 | { 183 | switch (uMsg) 184 | { 185 | HANDLE_MSG(hDlg, WM_INITDIALOG , WmInitDialog); /* On dialog creation */ 186 | HANDLE_MSG(hDlg, WM_COMMAND , WmCommand); /* On control handling */ 187 | HANDLE_MSG(hDlg, WM_NOTIFY , WmNotify); /* On notification received */ 188 | HANDLE_MSG(hDlg, WM_DESTROY , WmDestroy); /* Close */ 189 | } 190 | return FALSE; 191 | } 192 | 193 | 194 | /* WmInitDialog 195 | Dialog Initialization Processing. 196 | Parameters 197 | hDlg The window handle of dialog. 198 | hwndFocus The control handle to be got focus. 199 | lInitParam Parameters 200 | Return Value 201 | The results. 202 | */ 203 | 204 | BOOL WINAPI WmInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lInitParam) 205 | { 206 | /* Local variable(s) */ 207 | DWORD dwDisp; 208 | ERAMREGOPT EramOpt; 209 | CHAR szPath[MAX_PATH], szText[128]; 210 | /* Initialization of flag(s) */ 211 | bUpdate = FALSE; 212 | bReboot = FALSE; 213 | /* Hide the needless button if property */ 214 | if (bProp != FALSE) 215 | { 216 | ShowWindow(GetDlgItem(hDlg, IDOK), SW_HIDE); 217 | ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_HIDE); 218 | ShowWindow(GetDlgItem(hDlg, IDC_UPDATE), SW_HIDE); 219 | } 220 | /* Open the registry key */ 221 | wsprintf(szPath, "%s\\Eram\\Parameters", REGSTR_PATH_SERVICES); 222 | if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hgKey, &dwDisp) != ERROR_SUCCESS) /* Failure */ 223 | { 224 | MessageBox(hDlg, GetResStr(IDS_ERR_OPEN_REG, szText, sizeof(szText)), szWinName, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); 225 | EndDialog(hDlg, 0); 226 | return FALSE; 227 | } 228 | /* Get the registry value */ 229 | GetRegOption(&EramOpt); 230 | /* Adapt the registry value(s) to the control(s). */ 231 | SetPageOption(hDlg, &EramOpt); 232 | return FALSE; 233 | } 234 | 235 | 236 | /* GetRegOption 237 | Get the registry setting value. 238 | Parameters 239 | lpEramOpt The pointer to ERAM_REGOPT structure. 240 | Return Value 241 | None. 242 | */ 243 | 244 | VOID WINAPI GetRegOption(LPERAMREGOPT lpEramOpt) 245 | { 246 | /* Get the number of root directories */ 247 | ReadRegValues(hgKey, szRootDir, REG_DWORD, &(lpEramOpt->wRootDir), sizeof(lpEramOpt->wRootDir), 128); 248 | /* Get the option(s) */ 249 | ReadRegValues(hgKey, szOption, REG_DWORD, &(lpEramOpt->uOption.dwOptflag), sizeof(lpEramOpt->uOption.dwOptflag), 0); 250 | /* Get the allocation unit */ 251 | ReadRegValues(hgKey, szAllocUnit, REG_DWORD, &(lpEramOpt->byAllocUnit), sizeof(lpEramOpt->byAllocUnit), 1024 / SECTOR); 252 | /* Get the media ID */ 253 | ReadRegValues(hgKey, szMediaId, REG_DWORD, &(lpEramOpt->byMediaId), sizeof(lpEramOpt->byMediaId), RAMDISK_MEDIA_TYPE); 254 | /* Get the drive character */ 255 | ReadRegValues(hgKey, szDefDrv, REG_SZ, lpEramOpt->szDefDrv, sizeof(lpEramOpt->szDefDrv), (WORD)'Z'); 256 | lpEramOpt->szDefDrv[1] = '\0'; 257 | /* Get the number of pages */ 258 | ReadRegValues(hgKey, szPage, REG_DWORD, &(lpEramOpt->dwSizePage), sizeof(lpEramOpt->dwSizePage), DISKMINPAGE); 259 | /* Get the starting position of external memory */ 260 | ReadRegValues(hgKey, szExtStart, REG_DWORD, &(lpEramOpt->dwExtStart), sizeof(lpEramOpt->dwExtStart), 0); 261 | } 262 | 263 | 264 | /* ReadRegValues 265 | Get the registry and set the default values. 266 | Parameters 267 | hKey The key to be accessed. 268 | lpszValueName The pointer to the value name string. 269 | uType The value type of REG_DWORD or REG_SZ 270 | lpVal The pointer to the value to be retrived. 271 | uSizeOrg The size of the value to get. 272 | wDefVal The default value. 273 | Return Value 274 | None. 275 | */ 276 | 277 | VOID WINAPI ReadRegValues(HKEY hKey, LPSTR lpszValueName, UINT uType, LPVOID lpVal, ULONG uSizeOrg, WORD wDefVal) 278 | { 279 | /* Local variable(s) */ 280 | LONG lRet; 281 | ULONG uSize; 282 | DWORD dwVal, dwType; 283 | switch (uType) 284 | { 285 | case REG_DWORD: 286 | uSize = sizeof(dwVal); 287 | /* Get the registry value */ 288 | lRet = RegQueryValueEx(hKey, lpszValueName, NULL, &dwType, (LPBYTE)(&dwVal), &uSize); 289 | if ((lRet == ERROR_SUCCESS)&& 290 | (dwType == uType)) /* Successfully got */ 291 | { 292 | /* Set the retrieved value */ 293 | switch (uSizeOrg) 294 | { 295 | case sizeof(DWORD): 296 | *((LPDWORD)lpVal) = (DWORD)dwVal; 297 | return; 298 | case sizeof(WORD): 299 | *((LPWORD)lpVal) = (WORD)((dwVal > MAXWORD) ? MAXWORD : (WORD)dwVal); 300 | return; 301 | case sizeof(BYTE): 302 | *((LPBYTE)lpVal) = (BYTE)((dwVal > MAXBYTE) ? MAXBYTE : (BYTE)dwVal); 303 | return; 304 | } 305 | } 306 | break; 307 | case REG_SZ: 308 | uSize = uSizeOrg; 309 | /* Get the registry value */ 310 | lRet = RegQueryValueEx(hKey, lpszValueName, NULL, &dwType, lpVal, &uSize); 311 | if ((lRet == ERROR_SUCCESS)&& 312 | (dwType == uType)) /* Successfully got */ 313 | { 314 | return; 315 | } 316 | break; 317 | } 318 | /* Set the default value */ 319 | switch (uSizeOrg) 320 | { 321 | case sizeof(DWORD): 322 | *((LPDWORD)lpVal) = (DWORD)wDefVal; 323 | break; 324 | case sizeof(WORD): 325 | *((LPWORD)lpVal) = wDefVal; 326 | break; 327 | case sizeof(BYTE): 328 | *((LPBYTE)lpVal) = (BYTE)wDefVal; 329 | break; 330 | } 331 | } 332 | 333 | 334 | /* SetPageOption 335 | Adapt the registry values to the controls. 336 | Parameters 337 | hDlg The window handle of dialog. 338 | lpEramOpt The pointer to ERAM_REGOPT structure. 339 | Return Value 340 | None. 341 | */ 342 | 343 | VOID WINAPI SetPageOption(HWND hDlg, LPERAMREGOPT lpEramOpt) 344 | { 345 | /* Local variable(s) */ 346 | CHAR szId[3], szDrv[2], szAlloc[3]; 347 | HWND hCtl; 348 | UINT loopi, uAlloc; 349 | CHAR cDrv; 350 | INT nSelect; 351 | /* Set the number of root directories */ 352 | SetDlgItemInt(hDlg, IDC_EDIT_ROOTDIR, (UINT)(lpEramOpt->wRootDir), FALSE); 353 | Edit_LimitText(GetDlgItem(hDlg, IDC_EDIT_ROOTDIR), 4); /* max 9999 */ 354 | /* Set the option(s) */ 355 | if (lpEramOpt->uOption.Bits.NonPaged != 0) 356 | { 357 | Button_SetCheck(GetDlgItem(hDlg, IDC_RADIO_NONPAGED), 1); 358 | EnableExtGroup(hDlg, FALSE); 359 | } 360 | else if (lpEramOpt->uOption.Bits.External != 0) 361 | { 362 | Button_SetCheck(GetDlgItem(hDlg, IDC_RADIO_EXTERNAL), 1); 363 | EnableExtGroup(hDlg, TRUE); 364 | } 365 | else 366 | { 367 | Button_SetCheck(GetDlgItem(hDlg, IDC_RADIO_PAGED), 1); 368 | EnableExtGroup(hDlg, FALSE); 369 | } 370 | if (lpEramOpt->uOption.Bits.SkipExternalCheck == 0) 371 | { 372 | Button_SetCheck(GetDlgItem(hDlg, IDC_CHECK_NOTSEARCHSKIP), 1); 373 | } 374 | if (lpEramOpt->uOption.Bits.Swapable != 0) 375 | { 376 | Button_SetCheck(GetDlgItem(hDlg, IDC_CHECK_LOCAL_DISK), 1); 377 | } 378 | if (lpEramOpt->uOption.Bits.SkipReportUsage == 0) 379 | { 380 | Button_SetCheck(GetDlgItem(hDlg, IDC_CHECK_REPORTUSAGE), 1); 381 | } 382 | if (lpEramOpt->uOption.Bits.MakeTempDir != 0) 383 | { 384 | Button_SetCheck(GetDlgItem(hDlg, IDC_CHECK_MAKE_TEMP), 1); 385 | } 386 | /* Set the allocation unit */ 387 | hCtl = GetDlgItem(hDlg, IDC_COMBO_ALLOCUNIT); 388 | nSelect = -1; 389 | for (loopi=0, uAlloc=1; uAlloc<=MAXALLOCUNIT; loopi++, uAlloc<<=1) 390 | { 391 | if (lpEramOpt->byAllocUnit == uAlloc) 392 | { 393 | nSelect = loopi; 394 | } 395 | wsprintf((LPSTR)szAlloc, "%d", uAlloc); 396 | ComboBox_AddString(hCtl, (LPSTR)szAlloc); 397 | } 398 | if (nSelect < 0) 399 | { 400 | nSelect = 1; /* 2 */ 401 | } 402 | ComboBox_SetCurSel(hCtl, nSelect); 403 | /* Set the media ID */ 404 | wsprintf((LPSTR)szId, "%X", (UINT)(lpEramOpt->byMediaId)); 405 | hCtl = GetDlgItem(hDlg, IDC_EDIT_MEDIAID); 406 | Edit_SetText(hCtl, (LPSTR)szId); 407 | Edit_LimitText(hCtl, sizeof(szId)-1); 408 | /* Set the drive character */ 409 | hCtl = GetDlgItem(hDlg, IDC_COMBO_DRIVE); 410 | nSelect = -1; 411 | lpEramOpt->szDefDrv[0] &= ~0x20; 412 | szDrv[1] = '\0'; 413 | for (loopi=0, cDrv='A'; cDrv<='Z'; loopi++, cDrv++) 414 | { 415 | if (lpEramOpt->szDefDrv[0] == cDrv) 416 | { 417 | nSelect = loopi; 418 | } 419 | szDrv[0] = cDrv; 420 | ComboBox_AddString(hCtl, (LPSTR)szDrv); 421 | } 422 | if (nSelect < 0) 423 | { 424 | nSelect = loopi - 1; /* Z */ 425 | } 426 | ComboBox_SetCurSel(hCtl, nSelect); 427 | /* Set the page number */ 428 | SetDlgItemInt(hDlg, IDC_EDIT_PAGE, (ULONG)(lpEramOpt->dwSizePage << 2), FALSE); 429 | Edit_LimitText(GetDlgItem(hDlg, IDC_EDIT_PAGE), 7); /* 1024MB=1048576KB */ 430 | /* Set the starting positioin of external memory */ 431 | hCtl = GetDlgItem(hDlg, IDC_EDIT_EXTSTART_MB); 432 | SetDlgItemInt(hDlg, IDC_EDIT_EXTSTART_MB, (ULONG)(lpEramOpt->dwExtStart / 0x100000), FALSE); 433 | Edit_LimitText(hCtl, 4); /* 4095MB */ 434 | if ((lpEramOpt->dwExtStart / 0x100000) != 0) /* With specified */ 435 | { 436 | Button_SetCheck(GetDlgItem(hDlg, IDC_CHECK_EXTSTART), 1); 437 | } 438 | EnableExtGroup(hDlg, (lpEramOpt->uOption.Bits.External != 0) ? TRUE : FALSE); 439 | } 440 | 441 | 442 | /* WmCommand 443 | The control processing. 444 | Parameters 445 | hDlg The window handle of dialog. 446 | wId The item ID. 447 | hWndCtl The control handle. 448 | wNotifyCode The notification code. 449 | Return Value 450 | None. 451 | */ 452 | 453 | VOID WINAPI WmCommand(HWND hDlg, INT wId, HWND hWndCtl, UINT wNotifyCode) 454 | { 455 | /* Record them if there were changes */ 456 | switch (wId) 457 | { 458 | case IDC_COMBO_DRIVE: 459 | case IDC_COMBO_ALLOCUNIT: 460 | if (wNotifyCode == CBN_SELCHANGE) 461 | { 462 | bUpdate = TRUE; 463 | } 464 | break; 465 | case IDC_EDIT_ROOTDIR: 466 | case IDC_EDIT_MEDIAID: 467 | case IDC_EDIT_PAGE: 468 | case IDC_EDIT_EXTSTART_MB: 469 | if (wNotifyCode == EN_CHANGE) 470 | { 471 | bUpdate = TRUE; 472 | } 473 | break; 474 | case IDC_RADIO_PAGED: 475 | if (wNotifyCode == BN_CLICKED) 476 | { 477 | bUpdate = TRUE; 478 | EnableExtGroup(hDlg, FALSE); 479 | } 480 | break; 481 | case IDC_RADIO_NONPAGED: 482 | if (wNotifyCode == BN_CLICKED) 483 | { 484 | bUpdate = TRUE; 485 | EnableExtGroup(hDlg, FALSE); 486 | } 487 | break; 488 | case IDC_RADIO_EXTERNAL: 489 | if (wNotifyCode == BN_CLICKED) 490 | { 491 | bUpdate = TRUE; 492 | EnableExtGroup(hDlg, TRUE); 493 | } 494 | break; 495 | case IDC_CHECK_LOCAL_DISK: 496 | case IDC_CHECK_NOTSEARCHSKIP: 497 | case IDC_CHECK_MAKE_TEMP: 498 | if (wNotifyCode == BN_CLICKED) 499 | { 500 | bUpdate = TRUE; 501 | } 502 | break; 503 | case IDC_UPDATE: 504 | if (bProp != FALSE) 505 | { 506 | break; 507 | } 508 | SettingUpdate(hDlg); 509 | break; 510 | case IDOK: 511 | if (bProp != FALSE) 512 | { 513 | break; 514 | } 515 | if (SettingUpdate(hDlg) == FALSE) 516 | { 517 | break; 518 | } 519 | case IDCANCEL: 520 | if (bProp != FALSE) 521 | { 522 | break; 523 | } 524 | EndDialog(hDlg, 0); 525 | if (hgKey != NULL) 526 | { 527 | RegCloseKey(hgKey); 528 | hgKey = NULL; 529 | } 530 | /* Reboot */ 531 | Reboot(hDlg); 532 | break; 533 | case IDC_CHECK_EXTSTART: 534 | if (wNotifyCode == BN_CLICKED) 535 | { 536 | bUpdate = TRUE; 537 | } 538 | Edit_Enable(GetDlgItem(hDlg, IDC_EDIT_EXTSTART_MB), (Button_GetCheck(hWndCtl) != 0) ? TRUE : FALSE); 539 | break; 540 | } 541 | } 542 | 543 | 544 | /* EnableExtGroup 545 | Enable/Disable OS-Unmanaged Memory. 546 | Parameters 547 | hDlg The window handle of dialog. 548 | bEnable To be enabled or not to be. 549 | Return Value 550 | None. 551 | */ 552 | 553 | VOID WINAPI EnableExtGroup(HWND hDlg, BOOL bEnable) 554 | { 555 | /* Local variable(s) */ 556 | HWND hCtl; 557 | Static_Enable(GetDlgItem(hDlg, IDC_STATIC_EXT), bEnable); 558 | Button_Enable(GetDlgItem(hDlg, IDC_CHECK_NOTSEARCHSKIP), bEnable); 559 | Button_Enable(GetDlgItem(hDlg, IDC_CHECK_REPORTUSAGE), bEnable); 560 | hCtl = GetDlgItem(hDlg, IDC_CHECK_EXTSTART); 561 | Button_Enable(hCtl, bEnable); 562 | if ((bEnable != FALSE)&& /* Enabling now */ 563 | (Button_GetCheck(hCtl) == 0)) /* No specifying */ 564 | { 565 | bEnable = FALSE; 566 | } 567 | Edit_Enable(GetDlgItem(hDlg, IDC_EDIT_EXTSTART_MB), bEnable); 568 | Static_Enable(GetDlgItem(hDlg, IDC_STATIC_EXTSTART_MB), bEnable); 569 | } 570 | 571 | 572 | /* Reboot 573 | The reboot processing. 574 | Parameters 575 | hDlg The window handle of dialog. 576 | Return Value 577 | None. 578 | */ 579 | 580 | VOID WINAPI Reboot(HWND hDlg) 581 | { 582 | /* Local variable(s) */ 583 | CHAR szText[128]; 584 | if (bReboot == FALSE) 585 | { 586 | return; 587 | } 588 | if (MessageBox(hDlg, GetResStr(IDS_PROMPT_REBOOT, szText, sizeof(szText)), szWinName, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) != IDYES) 589 | { 590 | return; 591 | } 592 | if (SystemShutdown() == FALSE) 593 | { 594 | MessageBox(hDlg, GetResStr(IDS_ERR_REBOOT, szText, sizeof(szText)), szWinName, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); 595 | } 596 | bReboot = FALSE; 597 | } 598 | 599 | 600 | /* SettingUpdate 601 | The setting update processing. 602 | Parameters 603 | hDlg The window handle of dialog. 604 | wId The item ID. 605 | hWndCtl The control handle. 606 | wNotifyCode The notification code. 607 | Return Value 608 | The results. 609 | */ 610 | 611 | BOOL WINAPI SettingUpdate(HWND hDlg) 612 | { 613 | /* Local variable(s) */ 614 | ERAMREGOPT EramOpt; 615 | CHAR szText[128]; 616 | if (bUpdate == FALSE) /* No update */ 617 | { 618 | return TRUE; 619 | } 620 | /* Get the page info */ 621 | if (GetPageOption(hDlg, &EramOpt) == FALSE) 622 | { 623 | return FALSE; 624 | } 625 | /* Update the setting info */ 626 | if (SetRegOption(&EramOpt) == FALSE) 627 | { 628 | MessageBox(hDlg, GetResStr(IDS_ERR_REG_MODIFY, szText, sizeof(szText)), szWinName, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); 629 | return FALSE; 630 | } 631 | /* Set them to reboot. */ 632 | bReboot = TRUE; 633 | bUpdate = FALSE; 634 | return TRUE; 635 | } 636 | 637 | 638 | /* GetPageOption 639 | Get the page option. 640 | Parameters 641 | hDlg The window handle of dialog. 642 | lpEramOpt The pointer to ERAM_REGOPT structure. 643 | Return Value 644 | The results. 645 | */ 646 | 647 | BOOL WINAPI GetPageOption(HWND hDlg, LPERAMREGOPT lpEramOpt) 648 | { 649 | /* Local variable(s) */ 650 | CHAR szId[3], szRoot[4], szMsg[128], szVolLabel[16], szText[128]; 651 | PSTR pEnd; 652 | ULONGLONG ulPageT; 653 | OSVERSIONINFO Ver; 654 | /* Get the number of root directories */ 655 | lpEramOpt->wRootDir = (WORD)GetDlgItemInt(hDlg, IDC_EDIT_ROOTDIR, NULL, FALSE); 656 | /* Get the option(s) */ 657 | lpEramOpt->uOption.dwOptflag = 0; 658 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_RADIO_NONPAGED)) != 0) 659 | { 660 | lpEramOpt->uOption.Bits.NonPaged = 1; 661 | } 662 | else if (Button_GetCheck(GetDlgItem(hDlg, IDC_RADIO_EXTERNAL)) != 0) 663 | { 664 | lpEramOpt->uOption.Bits.External = 1; 665 | } 666 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_NOTSEARCHSKIP)) == 0) 667 | { 668 | lpEramOpt->uOption.Bits.SkipExternalCheck = 1; 669 | } 670 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_LOCAL_DISK)) != 0) 671 | { 672 | lpEramOpt->uOption.Bits.Swapable = 1; 673 | } 674 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_REPORTUSAGE)) == 0) 675 | { 676 | lpEramOpt->uOption.Bits.SkipReportUsage = 1; 677 | } 678 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_MAKE_TEMP)) != 0) 679 | { 680 | lpEramOpt->uOption.Bits.MakeTempDir = 1; 681 | } 682 | Ver.dwOSVersionInfoSize = sizeof(Ver); 683 | if ((GetVersionEx(&Ver) != FALSE)&& 684 | (Ver.dwPlatformId == VER_PLATFORM_WIN32_NT)&& 685 | (Ver.dwMajorVersion >= 5)) /* Win2000+ */ 686 | { 687 | lpEramOpt->uOption.Bits.EnableFat32 = 1; 688 | } 689 | /* Get the allocation unit */ 690 | lpEramOpt->byAllocUnit = (BYTE)GetDlgItemInt(hDlg, IDC_COMBO_ALLOCUNIT, NULL, FALSE); 691 | /* Get the media ID */ 692 | Edit_GetText(GetDlgItem(hDlg, IDC_EDIT_MEDIAID), (LPSTR)szId, sizeof(szId)); 693 | lpEramOpt->byMediaId = (BYTE)strtoul(szId, &pEnd, 16); 694 | /* Get the drive character */ 695 | ComboBox_GetText(GetDlgItem(hDlg, IDC_COMBO_DRIVE), (LPSTR)(lpEramOpt->szDefDrv), sizeof(lpEramOpt->szDefDrv)); 696 | if (lpEramOpt->szDefDrv[0] != '\0') 697 | { 698 | if ((GetLogicalDrives() & (1 << (lpEramOpt->szDefDrv[0] - 'A'))) != 0) /* Now using */ 699 | { 700 | wsprintf(szRoot, "%c:\\", lpEramOpt->szDefDrv[0]); 701 | switch (GetDriveType(szRoot)) 702 | { 703 | case DRIVE_REMOTE: /* Remote */ 704 | case DRIVE_RAMDISK: /* Likely it's self */ 705 | break; 706 | default: /* In use by HDD */ 707 | if ((GetVolumeInformation(szRoot, szVolLabel, sizeof(szVolLabel), NULL, NULL, NULL, NULL, 0) == FALSE)|| 708 | (lstrcmpi(szVolLabel, "ERAM-DRIVE") != 0)) 709 | { 710 | wsprintf(szMsg, GetResStr(IDS_WARN_DRV_USING, szText, sizeof(szText)), lpEramOpt->szDefDrv[0]); 711 | if (MessageBox(hDlg, szMsg, szWinName, MB_OKCANCEL | MB_ICONQUESTION | MB_SETFOREGROUND) != IDOK) 712 | { 713 | return FALSE; 714 | } 715 | } 716 | break; 717 | } 718 | } 719 | } 720 | /* Get the page number */ 721 | lpEramOpt->dwSizePage = (GetDlgItemInt(hDlg, IDC_EDIT_PAGE, NULL, FALSE) + 3) >> 2; 722 | if (lpEramOpt->uOption.Bits.EnableFat32 == 0) /* Prohibit FAT32 */ 723 | { 724 | ulPageT = ((ULONGLONG)DISKMAXCLUSTER_16 * SECTOR * lpEramOpt->byAllocUnit) / PAGE_SIZE_4K; 725 | } 726 | else /* FAT32 */ 727 | { 728 | ulPageT = ((ULONGLONG)DISKMAXCLUSTER_32 * SECTOR * lpEramOpt->byAllocUnit) / PAGE_SIZE_4K; 729 | } 730 | if ((ULONGLONG)(lpEramOpt->dwSizePage) > ulPageT) /* exceed allocation unit restriction */ 731 | { 732 | lpEramOpt->dwSizePage = (DWORD)ulPageT; 733 | wsprintf(szMsg, GetResStr((WORD)((lpEramOpt->byAllocUnit == MAXALLOCUNIT) ? IDS_WARN_LIMIT_SIZE : IDS_WARN_LIMIT_SIZE_THIS_UNIT), szText, sizeof(szText)), ((DWORD)ulPageT << 2)); 734 | MessageBox(hDlg, szMsg, szWinName, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); 735 | SetDlgItemInt(hDlg, IDC_EDIT_PAGE, ((DWORD)ulPageT << 2), FALSE); 736 | return FALSE; 737 | } 738 | /* Test the entry number of root directories */ 739 | if (lpEramOpt->dwSizePage <= (DWORD)(((lpEramOpt->wRootDir * 32) + (PAGE_SIZE_4K - 1)) / PAGE_SIZE_4K)) 740 | { 741 | MessageBox(hDlg, GetResStr(IDS_WARN_LIMIT_ROOTDIR, szText, sizeof(szText)), szWinName, MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND); 742 | SetDlgItemInt(hDlg, IDC_EDIT_ROOTDIR, 128, FALSE); 743 | return FALSE; 744 | } 745 | /* Get the starting position of external memory */ 746 | lpEramOpt->dwExtStart = 0; 747 | if (Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_EXTSTART)) != 0) 748 | { 749 | lpEramOpt->dwExtStart = GetDlgItemInt(hDlg, IDC_EDIT_EXTSTART_MB, NULL, FALSE) * 0x100000; 750 | } 751 | return TRUE; 752 | } 753 | 754 | 755 | /* SetRegOption 756 | Update the setting info. 757 | Parameters 758 | lpEramOpt The pointer to ERAM_REGOPT structure. 759 | Return Value 760 | None. 761 | */ 762 | 763 | BOOL WINAPI SetRegOption(LPERAMREGOPT lpEramOpt) 764 | { 765 | /* Local variable(s) */ 766 | DWORD dwVal; 767 | /* Set the number of root directories */ 768 | dwVal = (DWORD)lpEramOpt->wRootDir; 769 | if (RegSetValueEx(hgKey, szRootDir, 0, REG_DWORD, (LPBYTE)(&dwVal), sizeof(dwVal)) != ERROR_SUCCESS) 770 | { 771 | return FALSE; 772 | } 773 | /* Set the option(s) */ 774 | dwVal = (DWORD)lpEramOpt->uOption.dwOptflag; 775 | if (RegSetValueEx(hgKey, szOption, 0, REG_DWORD, (LPBYTE)(&dwVal), sizeof(dwVal)) != ERROR_SUCCESS) 776 | { 777 | return FALSE; 778 | } 779 | /* Set the allocation unit */ 780 | dwVal = (DWORD)lpEramOpt->byAllocUnit; 781 | if (RegSetValueEx(hgKey, szAllocUnit, 0, REG_DWORD, (LPBYTE)(&dwVal), sizeof(dwVal)) != ERROR_SUCCESS) 782 | { 783 | return FALSE; 784 | } 785 | /* Set the media ID */ 786 | dwVal = (DWORD)lpEramOpt->byMediaId; 787 | if (RegSetValueEx(hgKey, szMediaId, 0, REG_DWORD, (LPBYTE)(&dwVal), sizeof(dwVal)) != ERROR_SUCCESS) 788 | { 789 | return FALSE; 790 | } 791 | /* Set the drive character */ 792 | lpEramOpt->szDefDrv[1] = ':'; 793 | lpEramOpt->szDefDrv[2] = '\0'; 794 | if (RegSetValueEx(hgKey, szDefDrv, 0, REG_SZ, (LPBYTE)(lpEramOpt->szDefDrv), sizeof(lpEramOpt->szDefDrv)) != ERROR_SUCCESS) 795 | { 796 | return FALSE; 797 | } 798 | /* Set the page number */ 799 | if (RegSetValueEx(hgKey, szPage, 0, REG_DWORD, (LPBYTE)(&(lpEramOpt->dwSizePage)), sizeof(lpEramOpt->dwSizePage)) != ERROR_SUCCESS) 800 | { 801 | return FALSE; 802 | } 803 | /* Set the starting positioin of external memory */ 804 | if (RegSetValueEx(hgKey, szExtStart, 0, REG_DWORD, (LPBYTE)(&(lpEramOpt->dwExtStart)), sizeof(lpEramOpt->dwExtStart)) != ERROR_SUCCESS) 805 | { 806 | return FALSE; 807 | } 808 | return TRUE; 809 | } 810 | 811 | 812 | /* CPlApplet 813 | Control Panel Applet. 814 | Parameters 815 | hwndCPL The parent window handle of Control Panel. 816 | uMsg The notification message. 817 | lParam1 Parameter 1. 818 | lParam2 Parameter 2. 819 | Return Value 820 | The results. 821 | */ 822 | 823 | LONG CALLBACK CPlApplet(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2) 824 | { 825 | switch (uMsg) 826 | { 827 | case CPL_INIT: /* Initialization message */ 828 | return CplInit(); 829 | case CPL_GETCOUNT: /* Request the number of the dialog boxes */ 830 | return 1; 831 | case CPL_NEWINQUIRE: /* Request the number of dialog boxes infos */ 832 | CplNewInquire((LPNEWCPLINFO)lParam2); 833 | break; 834 | case CPL_SELECT: 835 | break; 836 | case CPL_DBLCLK: /* Double-clicked */ 837 | /* Display the dialog */ 838 | DialogBox(hgInstance, MAKEINTRESOURCE(IDD_SETUP), hwndCPL, (DLGPROC)StatusDlgProc); 839 | break; 840 | case CPL_STOP: 841 | break; 842 | case CPL_EXIT: 843 | break; 844 | default: 845 | break; 846 | } 847 | return 0; 848 | } 849 | 850 | 851 | /* CplInit 852 | Control Panel Applet:Initialization. 853 | Parameters 854 | None. 855 | Return Value 856 | The results. 857 | */ 858 | 859 | LONG WINAPI CplInit(VOID) 860 | { 861 | /* Local variable(s) */ 862 | OSVERSIONINFO Ver; 863 | Ver.dwOSVersionInfoSize = sizeof(Ver); 864 | if (GetVersionEx(&Ver) == FALSE) 865 | { 866 | return FALSE; 867 | } 868 | /* Don't load if not NT */ 869 | if (Ver.dwPlatformId != VER_PLATFORM_WIN32_NT) 870 | { 871 | return FALSE; 872 | } 873 | return TRUE; 874 | } 875 | 876 | 877 | /* Request the info of dialog box(es) */ 878 | /* CplNewInquire 879 | Control Panel Applet: Request the info of dialog box(es). 880 | Parameters 881 | lpNewCPlInfo The pointer to the info structure. 882 | Return Value 883 | None. 884 | */ 885 | 886 | VOID WINAPI CplNewInquire(LPNEWCPLINFO lpNewCPlInfo) 887 | { 888 | /* Return the info */ 889 | ZeroMemory(lpNewCPlInfo, sizeof(*lpNewCPlInfo)); 890 | lpNewCPlInfo->dwSize = sizeof(*lpNewCPlInfo); 891 | lpNewCPlInfo->hIcon = LoadIcon(hgInstance, MAKEINTRESOURCE(IDI_ICON)); 892 | lstrcpy(lpNewCPlInfo->szName, "ERAM"); 893 | GetResStr(IDS_INFO_DESC, lpNewCPlInfo->szInfo, sizeof(lpNewCPlInfo->szInfo)); 894 | } 895 | 896 | 897 | /* SystemShutdown 898 | Reboot Instruction. 899 | Parameters 900 | None. 901 | Return Value 902 | The results. 903 | */ 904 | 905 | BOOL WINAPI SystemShutdown(VOID) 906 | { 907 | /* The definition(s) of local variable(s) */ 908 | HANDLE hToken; 909 | TOKEN_PRIVILEGES tkp; 910 | /* Enable shutdown privilege */ 911 | if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken) == FALSE) 912 | { 913 | return FALSE; 914 | } 915 | /* Get LUID */ 916 | LookupPrivilegeValue("", SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid); 917 | tkp.PrivilegeCount = 1; 918 | tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 919 | /* Enable the shutdown privilege(s) */ 920 | AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); 921 | if (GetLastError() != ERROR_SUCCESS) /* Failed to enable */ 922 | { 923 | CloseHandle(hToken); 924 | return FALSE; 925 | } 926 | /* Shutdown instruction */ 927 | if (ExitWindowsEx(EWX_REBOOT, 0) == FALSE) 928 | { 929 | CloseHandle(hToken); 930 | return FALSE; 931 | } 932 | /* shutdown privilege(s) */ 933 | tkp.Privileges[0].Attributes = 0; 934 | AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0); 935 | CloseHandle(hToken); 936 | return TRUE; 937 | } 938 | 939 | 940 | /* WmNotify 941 | The notification message processing. 942 | Parameters 943 | hDlg The window handle of dialog. 944 | idFrom The item ID. 945 | pnmhdr The notification info. 946 | Return Value 947 | The results. 948 | */ 949 | 950 | DWORD WINAPI WmNotify(HWND hDlg, INT idFrom, NMHDR FAR* pnmhdr) 951 | { 952 | if (pnmhdr->code == PSN_APPLY) /* Apply */ 953 | { 954 | /* Update */ 955 | if (SettingUpdate(hDlg) == FALSE) 956 | { 957 | SetWindowLong(hDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); 958 | return TRUE; 959 | } 960 | /* Reboot if necessary */ 961 | Reboot(hDlg); 962 | SetWindowLong(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR); 963 | return TRUE; 964 | } 965 | return (DWORD)FORWARD_WM_NOTIFY(hDlg, idFrom, pnmhdr, DefWindowProc); 966 | } 967 | 968 | 969 | /* WmDestroy 970 | Destruction Message Processing. 971 | Parameters 972 | hDlg The window handle of dialog. 973 | Return Value 974 | None. 975 | */ 976 | 977 | VOID WINAPI WmDestroy(HWND hDlg) 978 | { 979 | if (hgKey != NULL) 980 | { 981 | RegCloseKey(hgKey); 982 | hgKey = NULL; 983 | } 984 | FORWARD_WM_DESTROY(hDlg, DefWindowProc); 985 | } 986 | 987 | 988 | /* EramClassInstall 989 | The class installer. 990 | Parameters 991 | diFctn The function number. 992 | hDevInfoSet The handle of the device info. 993 | pDevInfoData The pointer to the device info. 994 | Return Value 995 | The results. 996 | */ 997 | 998 | DWORD WINAPI EramClassInstall(DI_FUNCTION diFctn, HDEVINFO hDevInfoSet, PSP_DEVINFO_DATA pDevInfoData) 999 | { 1000 | /* Do default */ 1001 | return ERROR_DI_DO_DEFAULT; 1002 | } 1003 | 1004 | 1005 | /* EnumPropPages32 1006 | Property Page Provider. 1007 | Parameters 1008 | lplDi The pointer to the device info. 1009 | lpfnAddPage The page addition function pointer. 1010 | lParam The parameter. 1011 | Return Value 1012 | The results. 1013 | */ 1014 | 1015 | BOOL WINAPI EnumPropPages32(PSP_PROPSHEETPAGE_REQUEST pInfo, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) 1016 | { 1017 | /* Local variable(s) */ 1018 | PROPSHEETPAGE Setting; 1019 | HPROPSHEETPAGE hSetting; 1020 | CHAR szText[64]; 1021 | if (pInfo->PageRequested == SPPSR_ENUM_ADV_DEVICE_PROPERTIES) 1022 | { 1023 | bProp = TRUE; 1024 | /* Prepare the page */ 1025 | ZeroMemory(&Setting, sizeof(Setting)); 1026 | Setting.dwSize = sizeof(Setting); 1027 | Setting.dwFlags = PSP_USETITLE; 1028 | Setting.hInstance = hgInstance; 1029 | Setting.pszTemplate = MAKEINTRESOURCE(IDD_SETUP); 1030 | Setting.pszTitle = GetResStr(IDS_TAB_TITLE, szText, sizeof(szText)); 1031 | Setting.pfnDlgProc = (DLGPROC)StatusDlgProc; 1032 | /* Create the page */ 1033 | hSetting = CreatePropertySheetPage(&Setting); 1034 | if (hSetting == NULL) /* Failed to create */ 1035 | { 1036 | /* Return success */ 1037 | return TRUE; 1038 | } 1039 | /* Add the page */ 1040 | if ((*lpfnAddPage)(hSetting, lParam) == FALSE) /* Failed to add */ 1041 | { 1042 | DestroyPropertySheetPage(hSetting); 1043 | } 1044 | } 1045 | return TRUE; 1046 | } 1047 | 1048 | 1049 | /* EramUninstall 1050 | Uninstaller 1051 | Parameters 1052 | hWnd The parent window handle. 1053 | hInstance The instance handle. 1054 | lpszCmdLine The parameters 1055 | nCmdShow The display status. 1056 | Return Value 1057 | None. 1058 | */ 1059 | 1060 | VOID CALLBACK EramUninstall(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, INT nCmdShow) 1061 | { 1062 | /* Local variable(s) */ 1063 | SC_HANDLE hScm, hEram; 1064 | CHAR szMsg[256], szSysDir[MAX_PATH], szFile[MAX_PATH], szText[128]; 1065 | DWORD dwError; 1066 | OSVERSIONINFO Ver; 1067 | if (MessageBox(hWnd, GetResStr(IDS_PROMPT_ERAM_REMOVE, szText, sizeof(szText)), szWinName, MB_OKCANCEL) != IDOK) 1068 | { 1069 | return; 1070 | } 1071 | Ver.dwOSVersionInfoSize = sizeof(Ver); 1072 | if ((GetVersionEx(&Ver) == FALSE)|| 1073 | (Ver.dwPlatformId != VER_PLATFORM_WIN32_NT)) /* Not NT */ 1074 | { 1075 | MessageBox(hWnd, GetResStr(IDS_ERR_DETECT_OS, szText, sizeof(szText)), szWinName, MB_OK); 1076 | return; 1077 | } 1078 | if (Ver.dwMajorVersion >= 5) /* Windows2000 */ 1079 | { 1080 | /* Delete from device manager? */ 1081 | if (Eram2000UnInstall(hWnd) == FALSE) 1082 | { 1083 | MessageBox(hWnd, GetResStr(IDS_PROMPT_BEFORE_DEVMGR, szText, sizeof(szText)), szWinName, MB_OK); 1084 | return; 1085 | } 1086 | } 1087 | /* Connect SCM */ 1088 | hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 1089 | if (hScm == NULL) 1090 | { 1091 | dwError = GetLastError(); 1092 | if (dwError == ERROR_ACCESS_DENIED) 1093 | { 1094 | MessageBox(hWnd, GetResStr(IDS_ERR_NEED_REMOVE_PRIV, szText, sizeof(szText)), szWinName, MB_OK); 1095 | return; 1096 | } 1097 | wsprintf(szMsg, GetResStr(IDS_ERR_OPEN_SCM, szText, sizeof(szText)), dwError); 1098 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1099 | return; 1100 | } 1101 | /* ERAM device open */ 1102 | hEram = OpenService(hScm, "Eram", SERVICE_CHANGE_CONFIG | DELETE); 1103 | if (hEram == NULL) 1104 | { 1105 | dwError = GetLastError(); 1106 | if (dwError != ERROR_SERVICE_DOES_NOT_EXIST) /* Not uninstalled */ 1107 | { 1108 | wsprintf(szMsg, GetResStr(IDS_ERR_OPEN_ERAM, szText, sizeof(szText)), dwError); 1109 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1110 | CloseServiceHandle(hScm); 1111 | return; 1112 | } 1113 | } 1114 | else 1115 | { 1116 | /* Make it not to be started by startup */ 1117 | ChangeServiceConfig(hEram, SERVICE_NO_CHANGE, SERVICE_DISABLED, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 1118 | /* Delete the ERAM device */ 1119 | if (DeleteService(hEram) == FALSE) 1120 | { 1121 | wsprintf(szMsg, GetResStr(IDS_ERR_ERAM_REMOVE, szText, sizeof(szText)), GetLastError()); 1122 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1123 | CloseServiceHandle(hEram); 1124 | return; 1125 | } 1126 | CloseServiceHandle(hEram); 1127 | } 1128 | CloseServiceHandle(hScm); 1129 | if (GetSystemDirectory(szSysDir, sizeof(szSysDir)) == 0) 1130 | { 1131 | wsprintf(szMsg, GetResStr(IDS_ERR_GET_SYSDIR, szText, sizeof(szText)), GetLastError()); 1132 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1133 | return; 1134 | } 1135 | /* Delete the ERAM */ 1136 | wsprintf(szFile, "%s\\drivers\\eram.sys", szSysDir); 1137 | if (MoveFileEx(szFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) == FALSE) 1138 | { 1139 | wsprintf(szMsg, GetResStr(IDS_ERR_REMOVE, szText, sizeof(szText)), szFile, GetLastError()); 1140 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1141 | } 1142 | /* Delete Control Panel */ 1143 | wsprintf(szFile, "%s\\eramnt.cpl", szSysDir); 1144 | if (MoveFileEx(szFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) == FALSE) 1145 | { 1146 | wsprintf(szMsg, GetResStr(IDS_ERR_REMOVE, szText, sizeof(szText)), szFile, GetLastError()); 1147 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1148 | } 1149 | /* Delete the uninstall key */ 1150 | RegDeleteKey(HKEY_LOCAL_MACHINE, "SoftWare\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Eram"); 1151 | /* Delete the key for event log */ 1152 | RegDeleteKey(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\EventLog\\System\\Eram"); 1153 | /* Set to be rebooted */ 1154 | bReboot = TRUE; 1155 | /* Reboot instruction */ 1156 | Reboot(hWnd); 1157 | } 1158 | 1159 | 1160 | /* The followings are for Windows2000 and later only */ 1161 | /* Eram2000UnInstall 1162 | Uninstaller(Windows2000:Device Manager) 1163 | Parameters 1164 | hWnd The parent window handle. 1165 | Return Value 1166 | The results. 1167 | */ 1168 | 1169 | BOOL WINAPI Eram2000UnInstall(HWND hWnd) 1170 | { 1171 | /* Local variable(s) */ 1172 | static GUID EramClass = { 0xFB6B01E0, 0x3191, 0x11D4, 0x99, 0x10, 0x00, 0x00, 0x4C, 0x67, 0x20, 0x63 }; 1173 | LPCSTR lpszEramClass; 1174 | HDEVINFO hDevInfoSet; 1175 | SP_DEVINFO_DATA DevInfoData; 1176 | CHAR szBuf[128], szSubKey[MAX_PATH], szInfPath[MAX_PATH], szText[128]; 1177 | HKEY hKey; 1178 | UINT loopi; 1179 | BOOL bStat; 1180 | /* Load SETUPAPI.DLL */ 1181 | sSetupApi.hSetupApi = (HMODULE)LoadLibrary("setupapi"); 1182 | if (sSetupApi.hSetupApi == NULL) /* Failed to load SETUPAPI.DLL */ 1183 | { 1184 | wsprintf(szBuf, GetResStr(IDS_ERR_LOAD_SETUPAPI, szText, sizeof(szText)), GetLastError()); 1185 | MessageBox(hWnd, szBuf, szWinName, MB_OK); 1186 | return FALSE; 1187 | } 1188 | sSetupApi.lpfnSetupDiGetClassDevs = (LPFNSETUPDIGETCLASSDEVSA)GetProcAddress(sSetupApi.hSetupApi, "SetupDiGetClassDevsA"); 1189 | sSetupApi.lpfnSetupDiEnumDeviceInfo = (LPFNSETUPDIENUMDEVICEINFO)GetProcAddress(sSetupApi.hSetupApi, "SetupDiEnumDeviceInfo"); 1190 | sSetupApi.lpfnSetupDiRemoveDevice = (LPFNSETUPDIREMOVEDEVICE)GetProcAddress(sSetupApi.hSetupApi, "SetupDiRemoveDevice"); 1191 | sSetupApi.lpfnSetupDiDestroyDeviceInfoList = (LPFNSETUPDIDESTROYDEVICEINFOLIST)GetProcAddress(sSetupApi.hSetupApi, "SetupDiDestroyDeviceInfoList"); 1192 | sSetupApi.lpfnSetupDiOpenDevRegKey = (LPFNSETUPDIOPENDEVREGKEY)GetProcAddress(sSetupApi.hSetupApi, "SetupDiOpenDevRegKey"); 1193 | if ((sSetupApi.lpfnSetupDiGetClassDevs == NULL)|| 1194 | (sSetupApi.lpfnSetupDiEnumDeviceInfo == NULL)|| 1195 | (sSetupApi.lpfnSetupDiRemoveDevice == NULL)|| 1196 | (sSetupApi.lpfnSetupDiDestroyDeviceInfoList == NULL)|| 1197 | (sSetupApi.lpfnSetupDiOpenDevRegKey == NULL)) 1198 | { 1199 | wsprintf(szBuf, GetResStr(IDS_ERR_GETPROC_SETUPAPI, szText, sizeof(szText)), GetLastError()); 1200 | MessageBox(hWnd, szBuf, szWinName, MB_OK); 1201 | return FALSE; 1202 | } 1203 | /* Prepare for ERAM class device enumeration */ 1204 | hDevInfoSet = (*(sSetupApi.lpfnSetupDiGetClassDevs))(&EramClass, NULL, hWnd, 0); 1205 | if (hDevInfoSet == INVALID_HANDLE_VALUE) /* Without ERAM classes */ 1206 | { 1207 | return TRUE; 1208 | } 1209 | bStat = FALSE; 1210 | __try 1211 | { 1212 | /* Set the ANSI structure */ 1213 | DevInfoData.cbSize = sizeof(DevInfoData); 1214 | for (loopi=0; loopiData1, 1375 | pGuid->Data2, 1376 | pGuid->Data3, 1377 | pGuid->Data4[0], pGuid->Data4[1], 1378 | pGuid->Data4[2], pGuid->Data4[3], pGuid->Data4[4], pGuid->Data4[5], pGuid->Data4[6], pGuid->Data4[7]); 1379 | return (LPCSTR)szEramClass; 1380 | } 1381 | 1382 | 1383 | /* The followings are for WindowsNT4.0 and later only */ 1384 | /* StartupFastfat 1385 | FASTFAT driver StartUp change RUNDLL32 ERAM.CPL,StartupFastfat 0-to-4 1386 | Parameters 1387 | hWnd The parent window handle. 1388 | hInstance The instance handle. 1389 | lpszCmdLine The parameters. 1390 | nCmdShow The display status. 1391 | Return Value 1392 | None. 1393 | */ 1394 | 1395 | VOID CALLBACK StartupFastfat(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, INT nCmdShow) 1396 | { 1397 | /* Local variable(s) */ 1398 | static WORD wTypes[] = { 1399 | IDS_START_TYPE_0, IDS_START_TYPE_1, IDS_START_TYPE_2, IDS_START_TYPE_3, IDS_START_TYPE_4 1400 | }; 1401 | SC_HANDLE hScm, hFat; 1402 | CHAR szMsg[256], szText[128], szType[32]; 1403 | DWORD dwError, dwStartType, dwNeed; 1404 | BOOL bCmdOk; 1405 | LPQUERY_SERVICE_CONFIG lpConf; 1406 | bCmdOk = FALSE; 1407 | if (lpszCmdLine != NULL) 1408 | { 1409 | switch (*lpszCmdLine) 1410 | { 1411 | case '0': /* SERVICE_BOOT_START */ 1412 | case '1': /* SERVICE_SYSTEM_START */ 1413 | case '2': /* SERVICE_AUTO_START */ 1414 | case '3': /* SERVICE_DEMAND_START */ 1415 | case '4': /* SERVICE_DISABLED */ 1416 | if (lpszCmdLine[1] == '\0') 1417 | { 1418 | bCmdOk = TRUE; 1419 | } 1420 | break; 1421 | } 1422 | } 1423 | if (bCmdOk == FALSE) 1424 | { 1425 | MessageBox(hWnd, GetResStr(IDS_INFO_FASTFAT_USAGE, szText, sizeof(szText)), szWinName, MB_OK); 1426 | return; 1427 | } 1428 | dwStartType = *lpszCmdLine - '0'; 1429 | /* Connect SCM */ 1430 | hScm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); 1431 | if (hScm == NULL) 1432 | { 1433 | dwError = GetLastError(); 1434 | if (dwError == ERROR_ACCESS_DENIED) 1435 | { 1436 | MessageBox(hWnd, GetResStr(IDS_ERR_NEED_CTRL_PRIV, szText, sizeof(szText)), szWinName, MB_OK); 1437 | return; 1438 | } 1439 | wsprintf(szMsg, GetResStr(IDS_ERR_OPEN_SCM, szText, sizeof(szText)), dwError); 1440 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1441 | return; 1442 | } 1443 | hFat = NULL; 1444 | __try 1445 | { 1446 | /* FASTFAT driver open */ 1447 | hFat = OpenService(hScm, "Fastfat", SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG); 1448 | if (hFat == NULL) 1449 | { 1450 | wsprintf(szMsg, GetResStr(IDS_ERR_OPEN_FASTFAT, szText, sizeof(szText)), GetLastError()); 1451 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1452 | __leave; 1453 | } 1454 | /* Confirm the startup type */ 1455 | QueryServiceConfig(hFat, NULL, 0, &dwNeed); 1456 | if (dwNeed != 0) 1457 | { 1458 | lpConf = (LPQUERY_SERVICE_CONFIG)_alloca(dwNeed); 1459 | if ((lpConf != NULL)&& 1460 | (QueryServiceConfig(hFat, lpConf, dwNeed, &dwNeed) != FALSE)&& 1461 | (lpConf->dwStartType == dwStartType)) 1462 | { 1463 | wsprintf(szMsg, GetResStr(IDS_INFO_FASTFAT_ALREADY, szText, sizeof(szText)), GetResStr(wTypes[dwStartType], szType, sizeof(szType))); 1464 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1465 | __leave; 1466 | } 1467 | } 1468 | /* Change the startup type */ 1469 | if (ChangeServiceConfig(hFat, SERVICE_NO_CHANGE, dwStartType, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == FALSE) 1470 | { 1471 | wsprintf(szMsg, GetResStr(IDS_ERR_FASTFAT_MODIFY, szText, sizeof(szText)), GetLastError()); 1472 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1473 | __leave; 1474 | } 1475 | wsprintf(szMsg, GetResStr(IDS_INFO_FASTFAT_MODIFY, szText, sizeof(szText)), GetResStr(wTypes[dwStartType], szType, sizeof(szType))); 1476 | MessageBox(hWnd, szMsg, szWinName, MB_OK); 1477 | } 1478 | __finally 1479 | { 1480 | if (hFat != NULL) 1481 | { 1482 | CloseServiceHandle(hFat); 1483 | } 1484 | CloseServiceHandle(hScm); 1485 | } 1486 | } 1487 | 1488 | 1489 | /* The followings are common. */ 1490 | /* GetResStr 1491 | Get Resource String. 1492 | Parameters 1493 | wId String resource ID. 1494 | lpszBuf The pointer of buffer. 1495 | nSize The size of buffer. 1496 | Return Value 1497 | The pointer of buffer. 1498 | */ 1499 | 1500 | LPSTR WINAPI GetResStr(WORD wId, LPSTR lpszBuf, INT nSize) 1501 | { 1502 | /* Local variable(s) */ 1503 | DWORD dwError; 1504 | dwError = GetLastError(); 1505 | if (LoadString(hgInstance, wId, lpszBuf, nSize) == 0) 1506 | { 1507 | *lpszBuf = '\0'; 1508 | } 1509 | SetLastError(dwError); 1510 | return lpszBuf; 1511 | } 1512 | 1513 | 1514 | /* DllMain 1515 | The DLL entry. 1516 | Parameters 1517 | hInstance The instance handle of this DLL. 1518 | fdwReason The reason of calling. 1519 | lpvReserved Reserved. 1520 | Return Value 1521 | The results. 1522 | */ 1523 | 1524 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved) 1525 | { 1526 | switch (fdwReason) 1527 | { 1528 | case DLL_PROCESS_ATTACH: 1529 | hgInstance = hInstance; 1530 | DisableThreadLibraryCalls(hInstance); 1531 | break; 1532 | } 1533 | return TRUE; 1534 | } 1535 | --------------------------------------------------------------------------------