├── .gitattributes ├── .gitignore ├── FpHyperVisor ├── AsmVmx.asm ├── AsmVmx.h ├── FpHyperVisor.inf ├── FpHyperVisor.vcxproj ├── FpHyperVisor.vcxproj.filters ├── ept.c ├── ept.h ├── exithandler.c ├── exithandler.h ├── helpers.c ├── helpers.h ├── ia32.h ├── main.c ├── vmx.c └── vmx.h ├── FpVTProject.sln ├── README.md └── cpuid ├── cpuid.cpp ├── cpuid.vcxproj ├── cpuid.vcxproj.filters ├── pch.cpp └── pch.h /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /FpHyperVisor/AsmVmx.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fIappy/FpVTProject/80f5e1c9552ce7c547788bb6df4a2424899f8dae/FpHyperVisor/AsmVmx.asm -------------------------------------------------------------------------------- /FpHyperVisor/AsmVmx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | BOOLEAN __stdcall AsmVmxLaunch(); 5 | void __stdcall AsmVmmEntryPoint(); 6 | void __stdcall AsmInvd(); 7 | 8 | 9 | void __stdcall AsmVmxCall(ULONG no, ULONG unuse); 10 | 11 | 12 | 13 | 14 | 15 | unsigned char __stdcall AsmInvvpid( 16 | _In_ ULONG_PTR invvpid_type, 17 | _In_ ULONG_PTR *invvpid_descriptor); 18 | 19 | unsigned char __stdcall AsmInvept( 20 | _In_ ULONG_PTR invept_type, 21 | _In_ ULONG_PTR *invept_descriptor); 22 | 23 | 24 | 25 | 26 | 27 | void _sgdt(void*); 28 | /// Writes to GDT 29 | /// @param gdtr A value to write 30 | void __stdcall AsmWriteGDT(_In_ const Gdtr *gdtr); 31 | 32 | /// Reads SLDT 33 | /// @return LDT 34 | USHORT __stdcall AsmReadLDTR(); 35 | 36 | /// Writes to TR 37 | /// @param task_register A value to write 38 | void __stdcall AsmWriteTR(_In_ USHORT task_register); 39 | 40 | /// Reads STR 41 | /// @return TR 42 | USHORT __stdcall AsmReadTR(); 43 | 44 | /// Writes to ES 45 | /// @param segment_selector A value to write 46 | void __stdcall AsmWriteES(_In_ USHORT segment_selector); 47 | 48 | /// Reads ES 49 | /// @return ES 50 | USHORT __stdcall AsmReadES(); 51 | 52 | /// Writes to CS 53 | /// @param segment_selector A value to write 54 | void __stdcall AsmWriteCS(_In_ USHORT segment_selector); 55 | 56 | /// Reads CS 57 | /// @return CS 58 | USHORT __stdcall AsmReadCS(); 59 | 60 | /// Writes to SS 61 | /// @param segment_selector A value to write 62 | void __stdcall AsmWriteSS(_In_ USHORT segment_selector); 63 | 64 | /// Reads SS 65 | /// @return SS 66 | USHORT __stdcall AsmReadSS(); 67 | 68 | /// Writes to DS 69 | /// @param segment_selector A value to write 70 | void __stdcall AsmWriteDS(_In_ USHORT segment_selector); 71 | 72 | /// Reads DS 73 | /// @return DS 74 | USHORT __stdcall AsmReadDS(); 75 | 76 | /// Writes to FS 77 | /// @param segment_selector A value to write 78 | void __stdcall AsmWriteFS(_In_ USHORT segment_selector); 79 | 80 | /// Reads FS 81 | /// @return FS 82 | USHORT __stdcall AsmReadFS(); 83 | 84 | /// Writes to GS 85 | /// @param segment_selector A value to write 86 | void __stdcall AsmWriteGS(_In_ USHORT segment_selector); 87 | 88 | /// Reads GS 89 | /// @return GS 90 | USHORT __stdcall AsmReadGS(); 91 | 92 | /// Loads access rights byte 93 | /// @param segment_selector A value to get access rights byte 94 | /// @return An access rights byte 95 | ULONG_PTR __stdcall AsmLoadAccessRightsByte(_In_ ULONG_PTR segment_selector); 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /FpHyperVisor/FpHyperVisor.inf: -------------------------------------------------------------------------------- 1 | ; 2 | ; FpHyperVisor.inf 3 | ; 4 | 5 | [Version] 6 | Signature="$WINDOWS NT$" 7 | Class=System 8 | ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} 9 | Provider=%ManufacturerName% 10 | DriverVer= 11 | CatalogFile=FpHyperVisor.cat 12 | 13 | [DestinationDirs] 14 | DefaultDestDir = 12 15 | 16 | 17 | [SourceDisksNames] 18 | 1 = %DiskName%,,,"" 19 | 20 | [SourceDisksFiles] 21 | 22 | 23 | [Manufacturer] 24 | %ManufacturerName%=Standard,NT$ARCH$ 25 | 26 | [Standard.NT$ARCH$] 27 | 28 | 29 | [Strings] 30 | ManufacturerName="" ;TODO: Replace with your manufacturer name 31 | ClassName="" 32 | DiskName="FpHyperVisor Source Disk" 33 | -------------------------------------------------------------------------------- /FpHyperVisor/FpHyperVisor.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | Debug 22 | ARM 23 | 24 | 25 | Release 26 | ARM 27 | 28 | 29 | Debug 30 | ARM64 31 | 32 | 33 | Release 34 | ARM64 35 | 36 | 37 | 38 | {3B01A6DC-1676-4625-BD5C-4214E4F45443} 39 | {dd38f7fc-d7bd-488b-9242-7d8754cde80d} 40 | v4.5 41 | 12.0 42 | Debug 43 | Win32 44 | FpHyperVisor 45 | 46 | 47 | 48 | Windows10 49 | true 50 | WindowsKernelModeDriver10.0 51 | Driver 52 | WDM 53 | 54 | 55 | Windows10 56 | false 57 | WindowsKernelModeDriver10.0 58 | Driver 59 | WDM 60 | 61 | 62 | Windows10 63 | true 64 | WindowsKernelModeDriver10.0 65 | Driver 66 | WDM 67 | 68 | 69 | Windows10 70 | false 71 | WindowsKernelModeDriver10.0 72 | Driver 73 | WDM 74 | 75 | 76 | Windows10 77 | true 78 | WindowsKernelModeDriver10.0 79 | Driver 80 | WDM 81 | 82 | 83 | Windows10 84 | false 85 | WindowsKernelModeDriver10.0 86 | Driver 87 | WDM 88 | 89 | 90 | Windows10 91 | true 92 | WindowsKernelModeDriver10.0 93 | Driver 94 | WDM 95 | 96 | 97 | Windows10 98 | false 99 | WindowsKernelModeDriver10.0 100 | Driver 101 | WDM 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | DbgengKernelDebugger 113 | 114 | 115 | DbgengKernelDebugger 116 | 117 | 118 | DbgengKernelDebugger 119 | 120 | 121 | DbgengKernelDebugger 122 | 123 | 124 | DbgengKernelDebugger 125 | 126 | 127 | DbgengKernelDebugger 128 | 129 | 130 | DbgengKernelDebugger 131 | 132 | 133 | DbgengKernelDebugger 134 | 135 | 136 | 137 | false 138 | Level1 139 | 140 | 141 | 142 | 143 | false 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /FpHyperVisor/FpHyperVisor.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | {94236bce-dfea-4359-8c5e-8eb6aca34003} 22 | 23 | 24 | {5dc0df05-5787-4be8-93c9-74c2be870970} 25 | 26 | 27 | {15ce69bf-5b9e-46b3-9bde-2806d06d3347} 28 | 29 | 30 | 31 | 32 | Driver Files 33 | 34 | 35 | 36 | 37 | Source Files 38 | 39 | 40 | helper 41 | 42 | 43 | vmx 44 | 45 | 46 | vmx 47 | 48 | 49 | ept 50 | 51 | 52 | 53 | 54 | helper 55 | 56 | 57 | helper 58 | 59 | 60 | vmx 61 | 62 | 63 | vmx 64 | 65 | 66 | vmx 67 | 68 | 69 | ept 70 | 71 | 72 | 73 | 74 | vmx 75 | 76 | 77 | -------------------------------------------------------------------------------- /FpHyperVisor/ept.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fIappy/FpVTProject/80f5e1c9552ce7c547788bb6df4a2424899f8dae/FpHyperVisor/ept.c -------------------------------------------------------------------------------- /FpHyperVisor/ept.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _EPT_H 3 | #define _EPT_H 4 | #include 5 | #include "ia32.h" 6 | 7 | 8 | 9 | #include 10 | typedef struct _MtrrData { 11 | BOOLEAN enabled; //!< Whether this entry is valid 12 | BOOLEAN fixedMtrr; //!< Whether this entry manages a fixed range MTRR 13 | UCHAR type; //!< Memory Type (such as WB, UC) 14 | BOOLEAN reserverd1; //!< Padding 15 | ULONG reserverd2; //!< Padding 16 | ULONG64 range_base; //!< A base address of a range managed by this entry 17 | ULONG64 range_end; //!< An end address of a range managed by this entry 18 | }MtrrData; 19 | #include 20 | 21 | typedef struct _PhysicalMemoryRun { 22 | ULONG_PTR base_page; //!< A base address / PAGE_SIZE (ie, 0x1 for 0x1000) 23 | ULONG_PTR page_count; //!< A number of pages 24 | }PhysicalMemoryRun; 25 | 26 | typedef struct _PhysicalMemoryDescriptor { 27 | PFN_COUNT number_of_runs; //!< A number of PhysicalMemoryDescriptor::run 28 | PFN_NUMBER number_of_pages; //!< A physical memory size in pages 29 | PhysicalMemoryRun run[1]; //!< ranges of addresses 30 | }PhysicalMemoryDescriptor; 31 | 32 | 33 | 34 | PhysicalMemoryDescriptor * 35 | UtilpBuildPhysicalMemoryRanges(); 36 | extern PhysicalMemoryDescriptor* g_utilp_physical_memory_ranges; 37 | 38 | BOOLEAN EptIsEptAvailable(); 39 | EptData *EptInitialization(); 40 | void EptTermination(EptData *ept_data); 41 | void EptInitializeMtrrEntries(); 42 | 43 | EptCommonEntry *EptpConstructTables( 44 | EptCommonEntry *table, ULONG table_level, ULONG64 physical_address, 45 | EptData *ept_data); 46 | void EptpDestructTables(EptCommonEntry *table, 47 | ULONG table_level); 48 | void EptpFreeUnusedPreAllocatedEntries( 49 | EptCommonEntry **preallocated_entries, long used_count); 50 | void EptpInitTableEntry( 51 | EptCommonEntry *entry, ULONG table_level, ULONG64 physical_address); 52 | 53 | EptCommonEntry *EptpGetEptPtEntry( 54 | EptCommonEntry *table, ULONG table_level, ULONG64 physical_address); 55 | EptCommonEntry *EptGetEptPtEntry( 56 | EptCommonEntry *table, ULONG table_level, ULONG64 physical_address); 57 | 58 | EptCommonEntry *EptpAllocateEptEntry( 59 | EptData *ept_data); 60 | 61 | ULONG64 EptpAddressToPxeIndex( 62 | ULONG64 physical_address); 63 | ULONG64 EptpAddressToPteIndex( 64 | ULONG64 physical_address); 65 | ULONG64 EptpAddressToPdeIndex( 66 | ULONG64 physical_address); 67 | ULONG64 EptpAddressToPpeIndex( 68 | ULONG64 physical_address); 69 | 70 | UCHAR EptpGetMemoryType( 71 | ULONG64 physical_address); 72 | BOOLEAN EptpIsDeviceMemory( 73 | ULONG64 physical_address); 74 | 75 | 76 | 77 | 78 | #endif // !_EPT_H 79 | -------------------------------------------------------------------------------- /FpHyperVisor/exithandler.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fIappy/FpVTProject/80f5e1c9552ce7c547788bb6df4a2424899f8dae/FpHyperVisor/exithandler.c -------------------------------------------------------------------------------- /FpHyperVisor/exithandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _EXITHANDLER_H 4 | #define _EXITHANDLER_H 5 | #include "ia32.h" 6 | #include "vmx.h" 7 | #include 8 | 9 | 10 | 11 | BOOLEAN VmxVmexitHandler(GpRegisters* pGuestRegisters); 12 | 13 | void EptExitHandler(GuestContext* pGuestContext); 14 | 15 | void VmmpInjectInterruption( 16 | ULONG interruption_type, ULONG vector, 17 | BOOLEAN deliver_error_code, ULONG32 error_code); 18 | 19 | void VmmAdjustGuestRip(); 20 | 21 | 22 | 23 | 24 | 25 | 26 | #endif // !_EXITHANDLER_H 27 | -------------------------------------------------------------------------------- /FpHyperVisor/helpers.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "helpers.h" 3 | #include "ia32.h" 4 | #include "AsmVmx.h" 5 | 6 | PVOID kmalloc(ULONG_PTR size) 7 | { 8 | PHYSICAL_ADDRESS p = { -1 }; 9 | return MmAllocateContiguousMemory(size,p); 10 | } 11 | 12 | void kfree(ULONG_PTR p) 13 | { 14 | MmFreeContiguousMemory(p); 15 | } 16 | 17 | 18 | void SetPageBits(PVOID buf, ULONG loc, ULONG num) 19 | { 20 | RTL_BITMAP bitmap = { 0 }; 21 | 22 | RtlInitializeBitMap(&bitmap, buf, PAGE_SIZE * 8); 23 | RtlSetBits(&bitmap, loc, num); 24 | } 25 | 26 | void SetLONGBits(PVOID buf, ULONG loc, ULONG num) 27 | { 28 | RTL_BITMAP bitmap = { 0 }; 29 | 30 | RtlInitializeBitMap(&bitmap, buf, sizeof(ULONG) * 8); 31 | RtlSetBits(&bitmap, loc, num); 32 | } 33 | 34 | 35 | void SetLONG64Bits(PVOID buf, ULONG loc, ULONG num) 36 | { 37 | RTL_BITMAP bitmap = { 0 }; 38 | 39 | RtlInitializeBitMap(&bitmap, buf, sizeof(ULONG64) * 8); 40 | RtlSetBits(&bitmap, loc, num); 41 | } 42 | 43 | ULONG64 UtilPaFromVa(void *va) 44 | { 45 | PHYSICAL_ADDRESS pa = MmGetPhysicalAddress(va); 46 | return pa.QuadPart; 47 | } 48 | 49 | ULONG64 UtilVaFromPa(void *addr) 50 | { 51 | PHYSICAL_ADDRESS pa = { addr }; 52 | return MmGetVirtualForPhysical(pa); 53 | 54 | } 55 | 56 | 57 | PFN_NUMBER UtilPfnFromPa(ULONG64 pa) { 58 | return pa >> PAGE_SHIFT; 59 | } 60 | 61 | void *UtilVaFromPfn(PFN_NUMBER pfn) { 62 | return UtilVaFromPa(UtilPaFromPfn(pfn)); 63 | } 64 | 65 | ULONG64 UtilPaFromPfn(PFN_NUMBER pfn) { 66 | return (ULONG64)(pfn) << PAGE_SHIFT; 67 | }; 68 | 69 | 70 | BOOLEAN UtilForEachProcessor(BOOLEAN(*callback_routine)(void *), void *context) 71 | { 72 | PAGED_CODE() 73 | 74 | const ULONG number_of_processors =KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); 75 | BOOLEAN status=TRUE; 76 | 77 | for (ULONG processor_index = 0; processor_index < number_of_processors; 78 | processor_index++) { 79 | PROCESSOR_NUMBER processor_number = {0}; 80 | 81 | if (!NT_SUCCESS(KeGetProcessorNumberFromIndex(processor_index, &processor_number))) 82 | { 83 | return FALSE; 84 | } 85 | 86 | // Switch the current processor 87 | GROUP_AFFINITY affinity = {0}; 88 | affinity.Group = processor_number.Group; 89 | affinity.Mask = 1ull << processor_number.Number; 90 | GROUP_AFFINITY previous_affinity = {0}; 91 | KeSetSystemGroupAffinityThread(&affinity, &previous_affinity); 92 | 93 | // Execute callback 94 | status = callback_routine(context); 95 | 96 | KeRevertToUserGroupAffinityThread(&previous_affinity); 97 | if (!status) 98 | { 99 | return FALSE; 100 | } 101 | } 102 | return TRUE; 103 | } 104 | 105 | 106 | BOOLEAN UtilVmPtrld(ULONG_PTR pPhysicalVmcs) 107 | { 108 | ULONG_PTR p = pPhysicalVmcs; 109 | int status = __vmx_vmptrld(&p); 110 | ULONG errorCode = 0; 111 | if (!status) 112 | { 113 | return TRUE; 114 | } 115 | 116 | else if (status == 1) 117 | { 118 | kprintf("VMfailValid"); 119 | return FALSE; 120 | } 121 | else if(status == 2) 122 | { 123 | __vmx_vmread(VmVMInstructionError, &errorCode); 124 | kprintf("VMfailValid %d",errorCode); 125 | return FALSE; 126 | } 127 | return TRUE; 128 | } 129 | BOOLEAN UtilVmPtrst(ULONG_PTR* pPhysicalBuf) 130 | { 131 | __try 132 | { 133 | __vmx_vmptrst(pPhysicalBuf); 134 | 135 | } 136 | __except (1) 137 | { 138 | return FALSE; 139 | } 140 | return TRUE; 141 | } 142 | BOOLEAN UtilVmClear(ULONG_PTR pPhysicalVmcs) 143 | { 144 | ULONG_PTR p = pPhysicalVmcs; 145 | int status = __vmx_vmclear(&p); 146 | ULONG errorCode = 0; 147 | if (!status) 148 | { 149 | return TRUE; 150 | } 151 | 152 | else if (status == 1) 153 | { 154 | kprintf("VMfailValid"); 155 | return FALSE; 156 | } 157 | else if (status == 2) 158 | { 159 | __vmx_vmread(VmVMInstructionError, &errorCode); 160 | kprintf("VMfailValid %d", errorCode); 161 | return FALSE; 162 | } 163 | return TRUE; 164 | } 165 | BOOLEAN UtilVmxOn(ULONG_PTR pPhysicalVmxon) 166 | { 167 | ULONG_PTR p = pPhysicalVmxon; 168 | int status = __vmx_on(&p); 169 | ULONG errorCode = 0; 170 | if (!status) 171 | { 172 | return TRUE; 173 | } 174 | else if (status == 1) 175 | { 176 | kprintf("VMfailValid"); 177 | return FALSE; 178 | } 179 | else if (status == 2) 180 | { 181 | __vmx_vmread(VmVMInstructionError, &errorCode); 182 | kprintf("VMfailValid %d", errorCode); 183 | return FALSE; 184 | } 185 | return TRUE; 186 | } 187 | 188 | BOOLEAN UtilVmLaunch() 189 | { 190 | int status = __vmx_vmlaunch(); 191 | ULONG errorCode = 0; 192 | if (!status) 193 | { 194 | return TRUE; 195 | } 196 | else if (status == 1) 197 | { 198 | kprintf("VMfailValid"); 199 | return FALSE; 200 | } 201 | else if (status == 2) 202 | { 203 | __vmx_vmread(VmVMInstructionError, &errorCode); 204 | kprintf("VMfailValid %d", errorCode); 205 | return FALSE; 206 | } 207 | return TRUE; 208 | } 209 | BOOLEAN UtilVmResume() 210 | { 211 | int status = __vmx_vmresume(); 212 | ULONG errorCode = 0; 213 | if (!status) 214 | { 215 | return TRUE; 216 | } 217 | else if (status == 1) 218 | { 219 | kprintf("VMfailValid"); 220 | return FALSE; 221 | } 222 | else if (status == 2) 223 | { 224 | __vmx_vmread(VmVMInstructionError, &errorCode); 225 | kprintf("VMfailValid %d", errorCode); 226 | return FALSE; 227 | } 228 | return TRUE; 229 | } 230 | 231 | BOOLEAN UtilVmxWrite(ULONG_PTR field, ULONG_PTR value) 232 | { 233 | int status = __vmx_vmwrite(field, value); 234 | ULONG errorCode = 0; 235 | if (!status) 236 | { 237 | return TRUE; 238 | } 239 | else if (status == 1) 240 | { 241 | kprintf("VMfailValid"); 242 | return FALSE; 243 | } 244 | else if (status == 2) 245 | { 246 | __vmx_vmread(VmVMInstructionError, &errorCode); 247 | kprintf("VMfailValid %d", errorCode); 248 | return FALSE; 249 | } 250 | return TRUE; 251 | } 252 | 253 | BOOLEAN UtilInveptGlobal() { 254 | InvEptDescriptor desc = {0}; 255 | int status = AsmInvept(kGlobalInvalidation, &desc); 256 | ULONG errorCode = 0; 257 | 258 | if (!status) 259 | { 260 | return TRUE; 261 | } 262 | else if (status == 1) 263 | { 264 | kprintf("VMfailValid"); 265 | return FALSE; 266 | } 267 | else if (status == 2) 268 | { 269 | __vmx_vmread(VmVMInstructionError, &errorCode); 270 | kprintf("VMfailValid %d", errorCode); 271 | return FALSE; 272 | } 273 | return TRUE; 274 | } 275 | 276 | BOOLEAN UtilInvvpidAllContext() { 277 | InvVpidDescriptor desc = {0}; 278 | int status = AsmInvvpid(kAllContextInvalidation, &desc); 279 | ULONG errorCode = 0; 280 | 281 | if (!status) 282 | { 283 | return TRUE; 284 | } 285 | else if (status == 1) 286 | { 287 | kprintf("VMfailValid"); 288 | return FALSE; 289 | } 290 | else if (status == 2) 291 | { 292 | __vmx_vmread(VmVMInstructionError, &errorCode); 293 | kprintf("VMfailValid %d", errorCode); 294 | return FALSE; 295 | } 296 | return TRUE; 297 | } 298 | 299 | 300 | 301 | BOOLEAN UtilIsInBounds(_In_ const ULONG_PTR value, _In_ const ULONG_PTR min, 302 | _In_ const ULONG_PTR max) { 303 | return (min <= value) && (value <= max); 304 | } -------------------------------------------------------------------------------- /FpHyperVisor/helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | 6 | #define kprintf(format, ...) DbgPrintEx(DPFLTR_IHVDRIVER_ID,DPFLTR_ERROR_LEVEL,\ 7 | "[VTPlatform][%d][%s][%d]: " format "\n",PsGetCurrentProcessId(),__FUNCTION__,__LINE__, ##__VA_ARGS__) 8 | 9 | 10 | PVOID kmalloc(ULONG_PTR); 11 | void kfree(ULONG_PTR); 12 | 13 | 14 | void SetPageBits(PVOID buf, ULONG loc, ULONG num); 15 | void SetLONGBits(PVOID buf, ULONG loc, ULONG num); 16 | void SetLONG64Bits(PVOID buf, ULONG loc, ULONG num); 17 | ULONG64 UtilVaFromPa(void *addr); 18 | ULONG64 UtilPaFromVa(void *va); 19 | BOOLEAN UtilForEachProcessor(BOOLEAN(*callback_routine)(void *), void *context); 20 | 21 | 22 | 23 | 24 | 25 | BOOLEAN UtilVmPtrld(ULONG_PTR); 26 | BOOLEAN UtilVmPtrst(ULONG_PTR*); 27 | BOOLEAN UtilVmClear(ULONG_PTR); 28 | BOOLEAN UtilVmxOn(ULONG_PTR); 29 | BOOLEAN UtilVmLaunch(); 30 | BOOLEAN UtilVmResume(); 31 | BOOLEAN UtilVmxWrite(ULONG_PTR,ULONG_PTR); 32 | BOOLEAN UtilInveptGlobal(); 33 | BOOLEAN UtilInvvpidAllContext(); 34 | BOOLEAN UtilIsInBounds(_In_ const ULONG_PTR value, _In_ const ULONG_PTR min, 35 | _In_ const ULONG_PTR max); 36 | PFN_NUMBER UtilPfnFromPa(ULONG64 pa); 37 | void *UtilVaFromPfn(PFN_NUMBER pfn); 38 | 39 | ULONG64 UtilPaFromPfn(PFN_NUMBER pfn); 40 | -------------------------------------------------------------------------------- /FpHyperVisor/ia32.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fIappy/FpVTProject/80f5e1c9552ce7c547788bb6df4a2424899f8dae/FpHyperVisor/ia32.h -------------------------------------------------------------------------------- /FpHyperVisor/main.c: -------------------------------------------------------------------------------- 1 | #include "helpers.h" 2 | #include 3 | #include "vmx.h" 4 | 5 | 6 | 7 | VOID UnLoadDriver(PDRIVER_OBJECT pDriverObject) 8 | { 9 | PDEVICE_OBJECT pDevObj; 10 | UNICODE_STRING sysLinkName; 11 | kprintf("unload!"); 12 | VmxTermination(); 13 | 14 | 15 | } 16 | 17 | NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING pPath) 18 | { 19 | PAGED_CODE(); 20 | 21 | kprintf("DriverEntry"); 22 | ExInitializeDriverRuntime(DrvRtPoolNxOptIn); 23 | 24 | 25 | DriverObject->DriverUnload = UnLoadDriver; 26 | if (!VmxInit()) 27 | { 28 | return STATUS_UNSUCCESSFUL; 29 | } 30 | 31 | VmxStart(); 32 | 33 | 34 | 35 | return STATUS_SUCCESS; 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /FpHyperVisor/vmx.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fIappy/FpVTProject/80f5e1c9552ce7c547788bb6df4a2424899f8dae/FpHyperVisor/vmx.c -------------------------------------------------------------------------------- /FpHyperVisor/vmx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _VMX_H 3 | #define _VMX_H 4 | #include "ia32.h" 5 | #include "ept.h" 6 | 7 | typedef struct _VCPU 8 | { 9 | BOOLEAN IsVmx; 10 | EptData* pEptData; 11 | PVOID pVmxonRegion; 12 | PVOID pVmcsRegion; 13 | PVOID pVmmStack; 14 | PVOID pVmmStackBase; 15 | PVOID pMsrBitmap; 16 | PVOID pIoBitmap; 17 | GpRegisters* pGuestGpRegisters; 18 | FlagRegister* pGuestFlagRegister; 19 | }VCPU; 20 | typedef struct _GuestContext 21 | { 22 | GpRegisters* pGuestRegisters; 23 | ULONG_PTR rip; 24 | }GuestContext; 25 | 26 | 27 | extern VCPU *vcpu; 28 | extern ULONG_PTR g_MsrBitmap; 29 | BOOLEAN VmxInit(); 30 | BOOLEAN VmxStart(); 31 | BOOLEAN VmxEnableVmxFeature(PVOID context); 32 | BOOLEAN VmxIsSupported(); 33 | BOOLEAN VmxInitMsrBitmap(); 34 | BOOLEAN VmxAsmVmxLaunch(void *context); 35 | BOOLEAN VmxLaunchVm(PVOID guestStack, PVOID guestResumeRip); 36 | BOOLEAN VmxInitVmmStack(VCPU* vcpu); 37 | BOOLEAN VmxInitVmxon(VCPU* vcpu); 38 | void VmxWriteVmcs(VCPU* vcpu, PVOID guestStack, PVOID guestResumeRip); 39 | BOOLEAN VmxInitVmcs(VCPU* vcpu); 40 | void VmxFreeVmx(); 41 | void VmxPrepareOff(GpRegisters* pGuestRegisters); 42 | ULONG VmxAdjustControlValue(ULONG Msr, ULONG Ctl); 43 | 44 | 45 | ULONG_PTR VmpGetSegmentBaseByDescriptor( 46 | const SegmentDescriptor *segment_descriptor); 47 | SegmentDescriptor *VmpGetSegmentDescriptor( 48 | ULONG_PTR descriptor_table_base, USHORT segment_selector); 49 | 50 | ULONG_PTR VmpGetSegmentBase( 51 | ULONG_PTR gdt_base, USHORT segment_selector); 52 | ULONG VmxGetSegmentAccessRight( 53 | USHORT segment_selector); 54 | 55 | BOOLEAN VmxTermination(); 56 | BOOLEAN VmxStopVmx(); 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | #endif // !_VMX_H 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /FpVTProject.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.757 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FpHyperVisor", "FpHyperVisor\FpHyperVisor.vcxproj", "{3B01A6DC-1676-4625-BD5C-4214E4F45443}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|ARM64 = Debug|ARM64 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|ARM = Release|ARM 15 | Release|ARM64 = Release|ARM64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM.Build.0 = Debug|ARM 22 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM.Deploy.0 = Debug|ARM 23 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM64.ActiveCfg = Debug|ARM64 24 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM64.Build.0 = Debug|ARM64 25 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|ARM64.Deploy.0 = Debug|ARM64 26 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x64.ActiveCfg = Debug|x64 27 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x64.Build.0 = Debug|x64 28 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x64.Deploy.0 = Debug|x64 29 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x86.ActiveCfg = Debug|Win32 30 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x86.Build.0 = Debug|Win32 31 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Debug|x86.Deploy.0 = Debug|Win32 32 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM.ActiveCfg = Release|ARM 33 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM.Build.0 = Release|ARM 34 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM.Deploy.0 = Release|ARM 35 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM64.Build.0 = Release|ARM64 37 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x64.ActiveCfg = Release|x64 39 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x64.Build.0 = Release|x64 40 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x64.Deploy.0 = Release|x64 41 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x86.ActiveCfg = Release|Win32 42 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x86.Build.0 = Release|Win32 43 | {3B01A6DC-1676-4625-BD5C-4214E4F45443}.Release|x86.Deploy.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {4F516B8C-C07C-4205-BC62-76E436E44F80} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FpVTProject 2 | 3 | ## 修改自[HyperPlatform](https://github.com/tandasat/HyperPlatform). 简化成c语言版本 4 | 5 | 6 | ## 在VMware下 Win10 1903测试通过 7 | -------------------------------------------------------------------------------- /cpuid/cpuid.cpp: -------------------------------------------------------------------------------- 1 | // cpuid.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 2 | // 3 | 4 | #include "pch.h" 5 | #include 6 | #include 7 | void _sgdt(void*); 8 | int main() 9 | { 10 | 11 | int info[4] = { 0 }; 12 | __cpuid(info, 1); 13 | info[0] = _mm_crc32_u32(0xffffffff, 0x11223344); 14 | // __cpuid(info, 0x80000008);//0x00003027 15 | // __cpuid(info, 0x80000001);//0x00003027 16 | // 17 | //// uint64_t a= __readmsr(0x176); 18 | // uint64_t b[2] = { 0 }; 19 | // _sgdt(b); 20 | //__asm 21 | //{ 22 | // xor eax,eax 23 | // bt al,1 24 | // jb aaaa 25 | // xor eax,eax 26 | 27 | //aaaa: 28 | // xor ebx,ebx 29 | //} 30 | 31 | std::cout << "Hello World!\n"; 32 | } 33 | 34 | // 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单 35 | // 调试程序: F5 或调试 >“开始调试”菜单 36 | 37 | // 入门提示: 38 | // 1. 使用解决方案资源管理器窗口添加/管理文件 39 | // 2. 使用团队资源管理器窗口连接到源代码管理 40 | // 3. 使用输出窗口查看生成输出和其他消息 41 | // 4. 使用错误列表窗口查看错误 42 | // 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目 43 | // 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件 44 | -------------------------------------------------------------------------------- /cpuid/cpuid.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {190BC353-847E-46F8-A613-0FA76A0CA17C} 24 | Win32Proj 25 | cpuid 26 | 10.0.17763.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v141 33 | Unicode 34 | false 35 | 36 | 37 | Application 38 | false 39 | v141 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v141 47 | Unicode 48 | false 49 | 50 | 51 | Application 52 | false 53 | v141 54 | true 55 | Unicode 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | true 77 | 78 | 79 | true 80 | 81 | 82 | false 83 | 84 | 85 | false 86 | 87 | 88 | 89 | Use 90 | Level3 91 | Disabled 92 | true 93 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 94 | true 95 | pch.h 96 | 97 | 98 | Console 99 | true 100 | 101 | 102 | 103 | 104 | Use 105 | Level3 106 | Disabled 107 | true 108 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 109 | true 110 | pch.h 111 | 112 | 113 | Console 114 | true 115 | 116 | 117 | 118 | 119 | Use 120 | Level3 121 | MaxSpeed 122 | true 123 | true 124 | true 125 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 126 | true 127 | pch.h 128 | 129 | 130 | Console 131 | true 132 | true 133 | true 134 | 135 | 136 | 137 | 138 | Use 139 | Level3 140 | MaxSpeed 141 | true 142 | true 143 | true 144 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 145 | true 146 | pch.h 147 | 148 | 149 | Console 150 | true 151 | true 152 | true 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | Create 162 | Create 163 | Create 164 | Create 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /cpuid/cpuid.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 头文件 20 | 21 | 22 | 23 | 24 | 源文件 25 | 26 | 27 | 源文件 28 | 29 | 30 | -------------------------------------------------------------------------------- /cpuid/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp: 与预编译标头对应的源文件;编译成功所必需的 2 | 3 | #include "pch.h" 4 | 5 | // 一般情况下,忽略此文件,但如果你使用的是预编译标头,请保留它。 6 | -------------------------------------------------------------------------------- /cpuid/pch.h: -------------------------------------------------------------------------------- 1 | // 入门提示: 2 | // 1. 使用解决方案资源管理器窗口添加/管理文件 3 | // 2. 使用团队资源管理器窗口连接到源代码管理 4 | // 3. 使用输出窗口查看生成输出和其他消息 5 | // 4. 使用错误列表窗口查看错误 6 | // 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目 7 | // 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件 8 | 9 | #ifndef PCH_H 10 | #define PCH_H 11 | 12 | // TODO: 添加要在此处预编译的标头 13 | 14 | #endif //PCH_H 15 | --------------------------------------------------------------------------------