|
|
1.1 ! root 1: Build & Run Instructions: ! 2: ------------------------- ! 3: ! 4: The MAPMEM sample demonstrates how a kernel-mode device driver ! 5: can utilize the Zw*MapViewOfSection APIs to (un)map a physical ! 6: address into a user-mode process's address space. ! 7: ! 8: ! 9: NOTE: Microsoft does not recommend architecting Win32 applications ! 10: such that they read/write directly on physical memory. ! 11: User-mode applications are not considered "trusted" parts ! 12: of the system, and giving hardware access to untrusted ! 13: modules seriously impairs system security. ! 14: ! 15: We encourage developers who need hardware access to locate ! 16: their hardware I/O code in a device driver, and have their ! 17: Win32 app communicate it's requests to the driver via the ! 18: DeviceIoControl() API. ! 19: ! 20: ! 21: This sample is composed of two parts, a Windows NT kernel-mode ! 22: device driver (MAPMEM) and a Win32 test application (MAPTEST). ! 23: ! 24: ! 25: The Win32 portion contains a file, MAPTEST.C, which attempts to ! 26: obtain a handle to MAPMEM & send it IOCTLs. The executable is built ! 27: using the Windows NT SDK. First update the environment and path by ! 28: running <mstools>\setenv.bat. Then change to the directory where ! 29: you have the C source code and the makefile. Type "nmake /f maptest.mak" ! 30: to compile the Win32 program, MAPTEST.EXE. ! 31: ! 32: ! 33: The kernel driver portion contains the driver source code, MAPMEM.C ! 34: and a text file used to configure your registry so that the driver ! 35: can be loaded. The driver is built using the Windows NT DDK. ! 36: ! 37: To build the driver: ! 38: ! 39: ! 40: 1. Assuming you have run <sdk_root>\setenv.bat and ! 41: <ddk_root>\setenv.bat, build the driver by typing: ! 42: ! 43: build -cef ! 44: ! 45: (If there are any errors have a look at the build.log, build.err, ! 46: and build.wrn files to get an idea of what went wrong.) ! 47: ! 48: ! 49: 2. Copy the newly built driver, <ddk_root>\lib\*\MAPMEM.SYS to the ! 50: <nt_root>\system32\drivers\ directory, i.e.: ! 51: ! 52: copy \ntddk\lib\i386\free\mapmem.sys c:\winnt\system32\drivers\ ! 53: ! 54: ! 55: 3. Update the registry by running regini.exe on the mapmem.ini ! 56: file, i.e.: ! 57: ! 58: regini mapmem.ini ! 59: ! 60: This adds a MAPMEM driver key under the HKEY_LOCAL_MACHINE\ ! 61: SYSTEM\CurrentControlSet\Services tree in the registry. You ! 62: can verify this by starting REGEDIT.EXE and looking in the ! 63: appropriate place. ! 64: ! 65: ! 66: 4. Reboot. ! 67: ! 68: ! 69: 5. Type: ! 70: ! 71: net start mapmem ! 72: ! 73: ...and then execute MAPTEST.EXE.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.