├── .editorconfig ├── .gitignore ├── LICENSE.txt ├── README.md ├── hwid-checker-mg.sln ├── hwid_checker ├── hwid-checker-mg.vcxproj ├── hwid-checker-mg.vcxproj.filters ├── hwid-checker-mg.vcxproj.user ├── hwid_checker.cpp ├── hwid_checker.vcxproj ├── hwid_checker.vcxproj.user └── includes │ ├── smbios.cpp │ └── smbios.hpp └── img ├── Capture_cmd.PNG └── unknown.png /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cpp,hpp}] 4 | charset = utf-8 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 2 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.obj 3 | *.slo 4 | *.lo 5 | *.o 6 | 7 | # My file 8 | Holder.txt 9 | 10 | # Compiled Dynamic libraries 11 | *.so 12 | *.dylib 13 | 14 | # Compiled Static libraries 15 | *.lai 16 | *.la 17 | *.a 18 | 19 | # Binaries 20 | *.exe 21 | *.dll 22 | *.lib 23 | *.ilk 24 | *.pdb 25 | 26 | # Project files 27 | bin/** 28 | 29 | # Visual Studio files 30 | .vs 31 | obj/** 32 | ipch 33 | *.psess 34 | *.vspx 35 | *.suo 36 | *.sdf 37 | *.opensdf 38 | *.VC.db 39 | *.VC.opendb -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 medievalghoul 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Build status](https://ci.appveyor.com/api/projects/status/hjxm9hfjwljab2am?svg=true) 2 | # hwid-checker-mg 3 | 4 | Before I proceed, I would like to give a huge thanks to nealhow_ ([github](https://github.com/nealhow), [twitter](https://twitter.com/nealhow_)) for being a huge help, by 5 | contributing so much with his knowlegde and skills. Without him and his guidence, this project would've took longer to make. 6 | Fun fact, at the time of making this project I wasn't able to find a single C++ hwid checker 7 | 8 | ### INTRODUCTION 9 | 10 | hwid-checker-mg is simple, proof-of-concept, hardware id checker made in C++ that utilizes the SMBIOS/DMI standards to 11 | output information that's been described by the BIOS. The information ranges from 12 | system manufacturer, model name, serial number (Which is our main focus for this hwid checker) 13 | 14 | C++ has been chosen as the language of this project for two reasons: 15 | - I couldn't, at time of making this, find a straight forward answer documentation for creating extracting data from the smbios. 16 | Most if the answers I've encounter were a bit vague. So, I created this to have a basic foundation on understand how HWID spoofers work 17 | - It was a challenge 18 | 19 | This was a great learning experience and was much a challenge. Here are some of the concepts 20 | I've encountered 21 | - what is smbios and why was it needed? 22 | - The SMBIOS stands for *System Management BIOS*. It provides a set of data structures or tables that describes a computer's BIOS configuration. 23 | The use of SMBIOS elimiated the use of having to directly get the hardware's information. 24 | 25 | - what is DMI? 26 | - Sort for Desktop Management Interface, is a manager that generates a standard for managing and tracking components of a computer. 27 | By standard it's referring to it being applicable to other OSes. 28 | 29 | Evidently, it'll be need to read [System Management BIOS (SMBIOS) Reference Specification Version 3.3.0](https://www.dmtf.org/standards/smbios) to further your understanding on this topic. 30 | 31 | Also, allocating a ``RawSMBIOSData data struct`` in the heap at runtime gave undefine behavior. So I wouldn't recommended it. 32 | 33 | ### DOCUMENTATION 34 | 35 | **Doc 1: Table 3 – Structure header format description** 36 | 37 | ```c 38 | 39 | // windows struct 40 | 41 | typedef struct _dmi_header 42 | { 43 | BYTE type; 44 | BYTE length; 45 | WORD handle; 46 | } dmi_header; 47 | 48 | // and for linux 49 | 50 | struct dmi_header { 51 | u8 type; 52 | u8 length; 53 | u16 handle; 54 | } __packed; 55 | ``` 56 | 57 | - First, The type data member of size ``BYTE`` or ``uint8_t`` holds the SMBIOS specification defines the DMI Types different types of elements a computer. For example, type 2, means that the record contains 58 | "Base Board" Information. To have a better understand of the Types SMBIOS defines, here's a code representation in file [smbios.hpp](https://github.com/medievalghoul/hwid-checker-mg/tree/master/hwid_checker/includes/smbios.hpp): 59 | 60 | ```c++ 61 | enum dmi_entry_type 62 | : BYTE /* 6.1.2 Structure header format */ 63 | { 64 | DMI_ENTRY_BIOS = 0, 65 | DMI_ENTRY_SYSTEM, 66 | DMI_ENTRY_BASEBOARD, 67 | DMI_ENTRY_CHASSIS, 68 | DMI_ENTRY_PROCESSOR, 69 | DMI_ENTRY_MEM_CONTROLLER, 70 | DMI_ENTRY_MEM_MODULE, 71 | DMI_ENTRY_CACHE, 72 | DMI_ENTRY_PORT_CONNECTOR, 73 | DMI_ENTRY_SYSTEM_SLOT, 74 | DMI_ENTRY_ONBOARD_DEVICE, 75 | DMI_ENTRY_OEMSTRINGS, 76 | DMI_ENTRY_SYSCONF, 77 | DMI_ENTRY_BIOS_LANG, 78 | DMI_ENTRY_GROUP_ASSOC, 79 | DMI_ENTRY_SYSTEM_EVENT_LOG, 80 | DMI_ENTRY_PHYS_MEM_ARRAY, 81 | DMI_ENTRY_MEM_DEVICE, 82 | DMI_ENTRY_32_MEM_ERROR, 83 | DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR, 84 | DMI_ENTRY_MEM_DEV_MAPPED_ADDR, 85 | DMI_ENTRY_BUILTIN_POINTING_DEV, 86 | DMI_ENTRY_PORTABLE_BATTERY, 87 | DMI_ENTRY_SYSTEM_RESET, 88 | DMI_ENTRY_HW_SECURITY, 89 | DMI_ENTRY_SYSTEM_POWER_CONTROLS, 90 | DMI_ENTRY_VOLTAGE_PROBE, 91 | DMI_ENTRY_COOLING_DEV, 92 | DMI_ENTRY_TEMP_PROBE, 93 | DMI_ENTRY_ELECTRICAL_CURRENT_PROBE, 94 | DMI_ENTRY_OOB_REMOTE_ACCESS, 95 | DMI_ENTRY_BIS_ENTRY, 96 | DMI_ENTRY_SYSTEM_BOOT, 97 | DMI_ENTRY_MGMT_DEV, 98 | DMI_ENTRY_MGMT_DEV_COMPONENT, 99 | DMI_ENTRY_MGMT_DEV_THRES, 100 | DMI_ENTRY_MEM_CHANNEL, 101 | DMI_ENTRY_IPMI_DEV, 102 | DMI_ENTRY_SYS_POWER_SUPPLY, 103 | DMI_ENTRY_ADDITIONAL, 104 | DMI_ENTRY_ONBOARD_DEV_EXT, 105 | DMI_ENTRY_MGMT_CONTROLLER_HOST, 106 | DMI_ENTRY_INACTIVE = 126, 107 | DMI_ENTRY_END_OF_TABLE = 127, 108 | }; 109 | ``` 110 | - Second, the length data member of size ``BYTE`` or ``uint8_t`` holds the size of the 111 | formatted area starting at type field. Formated area can also be referred to as the area with recorded information. 112 | The length is also used as a relative offset as you'll be seeing in ([smbios.cpp](),[hwid_checker.cpp]()). 113 | 114 | - Third, the handle data member of size ``WORD`` or ``uint16_t`` is a unique identifier, which allows certain records to reference to each other. 115 | An example would be memory device referencing to memory conttroller and vice versa. 116 | 117 | **Doc 2: Raw SMBIOS firmware table provider** 118 | 119 | ```c++ 120 | #include 121 | 122 | typedef struct RawSMBIOSData 123 | { 124 | BYTE Used20CallingMethod; 125 | BYTE SMBIOSMajorVersion; 126 | BYTE SMBIOSMinorVersion; 127 | BYTE DmiRevision; 128 | DWORD Length; 129 | BYTE SMBIOSTableData[]; 130 | } RawSMBIOSData; 131 | 132 | DWORD smbios_data_size {}; 133 | BYTE *b_ {nullptr}; 134 | dmi_header* header {nullptr}; 135 | RawSMBIOSData* smbios_data {nullptr}; 136 | BYTE smbios_data_buffer[0x10000] = { 0 }; 137 | 138 | GetSystemFirmwareTable('RSMB', 0, smbios_data_buffer, smbios_buffersize); 139 | ``` 140 | 141 | The **GetSystemFirmwareTable** function retrieves specified firmware tables from a firmware tables provider. 142 | in our case the Raw SMBIOS Firmware provider tables. 143 | 144 | Also, allocating a ``RawSMBIOSData data_structure`` in the heap at runtime, gave undefined behaviors. So I wouldn't recommended it. 145 | 146 | ### Resource that undeceive my research 147 | Most all of them are bit vague: 148 | https://www.youtube.com/watch?v=yX6caxDOPu0 149 | https://stackoverflow.com/questions/43473262/getting-the-motherboards-serial-number 150 | https://www.experts-exchange.com/videos/7444/What-is-WMI-and-how-it-can-be-used-to-get-hardware-and-software-information-from-remote-computers.html 151 | https://www.codeproject.com/Questions/437379/Cplusplus-source-code-to-get-CPU-number-motherboar 152 | https://docs.microsoft.com/en-us/windows/win32/sysinfo/system-information-functions?redirectedfrom=MSDN 153 | https://stackoverflow.com/questions/56935213/how-to-get-adapter-driver-version-in-directx12/56960922 154 | https://stackoverflow.com/questions/1090261/get-the-graphics-card-model 155 | https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dadapter-identifier9 156 | https://docs.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid 157 | https://stackoverflow.com/questions/1672677/print-a-guid-variable 158 | https://www.windows-commandline.com/get-serial-number-for-ram-motherboard-hard-disk/ 159 | https://stackoverflow.com/questions/43473262/getting-the-motherboards-serial-number 160 | https://www.dmtf.org/standards/smbios 161 | https://gist.github.com/daiakushi/98a004e7cd750803dfe1 162 | https://www.codeproject.com/Tips/5263343/How-to-Get-the-BIOS-UUID 163 | 164 | 165 | by reading source code of dmicode: 166 | - https://github.com/mirror/dmidecode/blob/master/dmidecode.c 167 | - https://elixir.bootlin.com/linux/latest/source/include/linux/dmi.h 168 | 169 | uuid vs guid: 170 | - https://stackoverflow.com/questions/246930/is-there-any-difference-between-a-guid-and-a-uuid?rq=1 171 | 172 | dmicode: 173 | - https://linux.die.net/man/8/dmidecode 174 | 175 | 176 | Thanks for the read 177 | -------------------------------------------------------------------------------- /hwid-checker-mg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hwid_checker", "hwid_checker\hwid_checker.vcxproj", "{0915FF14-6ACB-41E0-8C32-5252FB32D182}" 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 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Debug|x64.ActiveCfg = Debug|x64 17 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Debug|x64.Build.0 = Debug|x64 18 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Debug|x86.ActiveCfg = Debug|Win32 19 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Debug|x86.Build.0 = Debug|Win32 20 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Release|x64.ActiveCfg = Release|x64 21 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Release|x64.Build.0 = Release|x64 22 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Release|x86.ActiveCfg = Release|Win32 23 | {0915FF14-6ACB-41E0-8C32-5252FB32D182}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {D7E91943-4513-48F4-B620-C2638232A531} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /hwid_checker/hwid-checker-mg.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 | 16.0 23 | {0915FF14-6ACB-41E0-8C32-5252FB32D182} 24 | Win32Proj 25 | hwidchecker 26 | 10.0 27 | hwid-checker-mg 28 | 29 | 30 | 31 | Application 32 | true 33 | v142 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v142 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v142 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v142 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 77 | 78 | 79 | true 80 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 81 | 82 | 83 | false 84 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 85 | 86 | 87 | false 88 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 89 | 90 | 91 | 92 | 93 | 94 | Level3 95 | true 96 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 97 | true 98 | stdcpp17 99 | 100 | 101 | Console 102 | true 103 | 104 | 105 | 106 | 107 | 108 | 109 | Level3 110 | true 111 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 112 | true 113 | stdcpp17 114 | 115 | 116 | Console 117 | true 118 | 119 | 120 | 121 | 122 | 123 | 124 | Level3 125 | true 126 | true 127 | true 128 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 129 | true 130 | stdcpp17 131 | 132 | 133 | Console 134 | true 135 | true 136 | true 137 | 138 | 139 | 140 | 141 | 142 | 143 | Level3 144 | true 145 | true 146 | true 147 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 148 | true 149 | stdcpp17 150 | 151 | 152 | Console 153 | true 154 | true 155 | true 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /hwid_checker/hwid-checker-mg.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;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 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /hwid_checker/hwid-checker-mg.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /hwid_checker/hwid_checker.cpp: -------------------------------------------------------------------------------- 1 | // hwid_checker.cpp 2 | 3 | #include "includes/smbios.hpp" 4 | 5 | using std::cout, std::vector; 6 | using namespace smbios; 7 | 8 | // 9 | // streaming the GUID to std::cout 10 | // operatoroverloading will take place 11 | // 12 | 13 | auto operator<<( 14 | std::ostream& os, 15 | GUID adapter 16 | ) 17 | -> std::ostream& 18 | { 19 | os << std::uppercase; 20 | os.width(8); 21 | 22 | // 23 | // first set of 8 characters in the GUID 24 | // for example: F54F83C5 25 | // 26 | 27 | os << std::hex << adapter.Data1 << '-'; 28 | 29 | os.width(4); 30 | 31 | // 32 | // second set of 4 characters in the GUID 33 | // for example: 9724 34 | // 35 | 36 | os << std::hex << adapter.Data2 << '-'; 37 | 38 | os.width(4); 39 | 40 | // 41 | // third set of 4 characters in the GUID 42 | // for example: 6A1C 43 | // 44 | 45 | os << std::hex << adapter.Data3 << '-'; 46 | 47 | os.width(2); 48 | os << std::hex 49 | << static_cast (adapter.Data4[0]) // fourth set of characters 50 | << static_cast (adapter.Data4[1]) // 51 | << '-' 52 | << static_cast (adapter.Data4[2]) // fifth set of characters 53 | << static_cast (adapter.Data4[3]) // 54 | << static_cast (adapter.Data4[4]) 55 | << static_cast (adapter.Data4[5]) 56 | << static_cast (adapter.Data4[6]) 57 | << static_cast (adapter.Data4[7]); 58 | os << std::nouppercase; 59 | return os; 60 | 61 | } 62 | 63 | extern "C" { 64 | IDirect3D9 *Direct3DCreate9( 65 | UINT SDKVersion 66 | ); 67 | } 68 | 69 | auto main() 70 | -> int 71 | { 72 | DWORD hdd_serial {}; 73 | DWORD flag {1}; 74 | DWORD gpu_serial {}; 75 | DWORD smbios_data_size {}; 76 | BYTE *b_ {nullptr}; 77 | dmi_header* header {nullptr}; 78 | RawSMBIOSData* smbios_data {nullptr}; 79 | BYTE* smbios_data_buffer; //[0x10000] = { 0 }; //0.065536 megabytes 80 | smbios_data_buffer = new BYTE[0x10000]; //0.065536 megabytes fails 81 | 82 | // HW_PROFILE_INFO hw_prof_info won't be needed 83 | 84 | std::puts("\tGetting HWID\n"); 85 | 86 | if (GetVolumeInformationA("C://", NULL, NULL, 87 | &hdd_serial, NULL, NULL, NULL, NULL) == 0) { 88 | cout << "Error encounters 'GetVolumeInformation: " 89 | << GetLastError() << "\n"; 90 | _getch(); 91 | } 92 | 93 | // 94 | // SMBIOS (RSMB) firmware tables 95 | // 96 | 97 | smbios_data_size = GetSystemFirmwareTable('RSMB', 0, 0, 0); 98 | 99 | if (!smbios_data_size) { 100 | std::puts("Error: ERROR_OUTOFMEMORY"); 101 | _getch(); 102 | ExitProcess(EXIT_FAILURE); 103 | } 104 | 105 | if (smbios_data_size == 0) { 106 | cout << "Error encounters 'GetSystemFirmwareTable': " 107 | << GetLastError() << "\n"; 108 | _getch(); 109 | ExitProcess(EXIT_FAILURE); 110 | } 111 | int smbios_buffersize = smbios_data_size; 112 | 113 | smbios_data_size = GetSystemFirmwareTable('RSMB', 0, smbios_data_buffer, smbios_buffersize); 114 | 115 | if (!smbios_data_size) { 116 | std::puts("Error: ERROR_OUTOFMEMORY"); 117 | _getch(); 118 | ExitProcess(EXIT_FAILURE); 119 | } 120 | 121 | cout << "\tget buffer size is: " << smbios_buffersize << "\n"; 122 | 123 | smbios_data = 124 | reinterpret_cast ( 125 | smbios_data_buffer 126 | ); 127 | 128 | 129 | if (smbios_data->Length != smbios_buffersize - 8) 130 | { 131 | printf("Smbios length error\n"); 132 | _getch(); 133 | ExitProcess(EXIT_FAILURE); 134 | } 135 | 136 | 137 | IDirect3D9 *d9object = Direct3DCreate9(D3D_SDK_VERSION); 138 | unsigned int adaptercount = d9object->GetAdapterCount(); 139 | D3DADAPTER_IDENTIFIER9* adapters = new D3DADAPTER_IDENTIFIER9[sizeof(adaptercount)]; 140 | 141 | for (unsigned int i = 0; i < adaptercount; i++) { 142 | d9object->GetAdapterIdentifier(i, 0, &(adapters[i])); 143 | } 144 | 145 | cout << "\tGPU desc: " << adapters->Description << "\n"; 146 | cout << "\tGPU vendor: " << adapters->VendorId << "\n"; 147 | cout << "\tGPU guid: " << adapters->DeviceIdentifier << "\n"; 148 | cout << "\tHDD hwid: " << hdd_serial << "\n"; 149 | 150 | // eax, ebx, ecx, edx 151 | int cpuid[4] = { 0,0,0,0 }; 152 | __cpuid(cpuid, 0); 153 | char16_t hold = 0; 154 | char16_t* pointer = reinterpret_cast (cpuid); 155 | for (char32_t i = 0; i < 8; i++) { 156 | hold += pointer[i]; 157 | } 158 | 159 | cout << "\tCPU id: " << std::uppercase << hold << "\n"; 160 | 161 | // Go throught BIOS structures 162 | b_ = smbios_data->SMBIOSTableData; 163 | for (DWORD index{}; index < smbios_data->Length; index++) { 164 | 165 | dmi_header *header = 166 | reinterpret_cast (b_); 167 | 168 | if (header->type == dmi_entry_type::DMI_ENTRY_BIOS && flag) { 169 | std::printf("\n\tType %02d - [Bios Device type]\n", header->type); 170 | cout << "\t\tBIOS Vendor: " << dmi_string(header, b_[0x4]) << "\n"; 171 | cout << "\t\tBIOS Version: " << dmi_string(header, b_[0x5]) << "\n"; 172 | cout << "\t\tRelease data: " << dmi_string(header, b_[0x8]) << "\n"; 173 | 174 | flag = 0; 175 | } 176 | 177 | else if (header->type == dmi_entry_type::DMI_ENTRY_BASEBOARD) { 178 | std::printf("\n\tType %02d - [Baseboard Device type]\n", header->type); 179 | cout << "\t\tManufacturer: " << dmi_string(header, b_[0x4]) << "\n"; 180 | cout << "\t\tProduct Number: " << dmi_string(header, b_[0x5]) << "\n"; 181 | cout << "\t\tVersion: " << dmi_string(header, b_[0x6]) << "\n"; 182 | cout << "\t\tSerial Number: " << dmi_string(header, b_[0x7]) << "\n"; 183 | cout << "\t\tUUID: "; 184 | 185 | dmi_system_uuid(b_ + 0x8, 186 | smbios_data->SMBIOSMajorVersion * 0x100 + smbios_data->SMBIOSMinorVersion); 187 | 188 | 189 | } 190 | 191 | 192 | else if (header->type == dmi_entry_type::DMI_ENTRY_MEM_DEVICE) { 193 | std::printf("\n\tType %02d - [Memory Device type]\n", header->type); 194 | cout << "\t\tMemory Type: " << dmi_memory_device_type(b_[0x12]) << "\n"; 195 | cout << "\t\tSize of RAM: " << dmi_string(header, b_[0xC]) << "\n"; 196 | cout << "\t\tManufacturer: " << dmi_string(header, b_[0x17]) << "\n"; 197 | cout << "\t\tSerial Number: " << dmi_string(header, b_[0x18]) << "\n"; 198 | } 199 | 200 | 201 | b_ += header->length; 202 | while ((*(WORD*)b_) != 0) { b_++; } 203 | b_ += 2; 204 | } 205 | 206 | _getch(); 207 | delete [] smbios_data_buffer; 208 | return {}; 209 | } 210 | -------------------------------------------------------------------------------- /hwid_checker/hwid_checker.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 | 16.0 23 | {0915FF14-6ACB-41E0-8C32-5252FB32D182} 24 | Win32Proj 25 | hwidchecker 26 | 10.0 27 | hwid-checker-mg 28 | 29 | 30 | 31 | Application 32 | true 33 | v142 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v142 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v142 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v142 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 77 | 78 | 79 | true 80 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 81 | 82 | 83 | false 84 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 85 | 86 | 87 | false 88 | $(SolutionDir)bin_left$(Platform)\$(Configuration) 89 | 90 | 91 | 92 | 93 | 94 | Level3 95 | true 96 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 97 | true 98 | stdcpp17 99 | 100 | 101 | Console 102 | true 103 | 104 | 105 | 106 | 107 | 108 | 109 | Level3 110 | true 111 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 112 | true 113 | stdcpp17 114 | 115 | 116 | Console 117 | true 118 | 119 | 120 | 121 | 122 | 123 | 124 | Level3 125 | true 126 | true 127 | true 128 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 129 | true 130 | stdcpp17 131 | 132 | 133 | Console 134 | true 135 | true 136 | true 137 | 138 | 139 | 140 | 141 | 142 | 143 | Level3 144 | true 145 | true 146 | true 147 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 148 | true 149 | stdcpp17 150 | 151 | 152 | Console 153 | true 154 | true 155 | true 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /hwid_checker/hwid_checker.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /hwid_checker/includes/smbios.cpp: -------------------------------------------------------------------------------- 1 | #include "smbios.hpp" 2 | 3 | using smbios::dmi_memory_device_type; 4 | 5 | auto smbios::dmi_system_uuid( 6 | const BYTE* p, short version 7 | ) -> void 8 | { 9 | bool only0xff = true; 10 | bool only0x00 = true; 11 | int i{}; 12 | 13 | // 14 | // 16 because of the byte uuid 15 | // this process also makes so that the uuid isn't all 16 | // 1's and 0's 17 | // 18 | 19 | 20 | for (i = 0; i < 16 && (only0x00 || only0xff); i++) { 21 | if (p[i] != 0x00) { only0x00 = false; } 22 | if (p[i] != 0xFF) { only0xff = false; } 23 | } 24 | 25 | if (only0x00) { std::puts("Not present : 0x00"); return; } 26 | if (only0xff) { std::puts("Not Settable: 0xff"); return; } 27 | 28 | if (version >= 0x0206) { 29 | std::printf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", 30 | p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], 31 | p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 32 | } else { 33 | std::printf("-%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", 34 | p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], 35 | p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); 36 | } 37 | } 38 | 39 | auto smbios::dmi_string( 40 | const smbios::dmi_header* dm, BYTE src 41 | ) -> const char* 42 | { 43 | std::size_t length{}; 44 | std::size_t i{}; 45 | 46 | char* bp = (char*)dm; 47 | //reinterpret_cast (dm); 48 | 49 | if (src == 0) { return "Not specified"; } 50 | bp += dm->length; 51 | 52 | while (src > 1 && *bp) { 53 | bp += std::strlen(bp); 54 | bp++; 55 | src--; 56 | } 57 | 58 | if (!*bp) { return "BAD_INDEXING"; } 59 | 60 | 61 | 62 | // 63 | // filtering ASCII 64 | // removal of junk data 65 | // 66 | 67 | length = std::strlen(bp); 68 | for (int i = 0; i < length; i++) { 69 | if (bp[i] < 32 || bp[i] == 127) { bp[i] = '.'; } 70 | } 71 | return bp; 72 | 73 | } 74 | 75 | auto dmi_memory_device_type( 76 | BYTE code 77 | ) -> const char* 78 | { 79 | std::map memory_device_type; 80 | /* 7.18.2 */ 81 | 82 | memory_device_type[dmi_memory_device_type::DMT_OTHER] = "Other"; /* 0x01 */ 83 | memory_device_type[dmi_memory_device_type::DMT_UNKNOWN] = "Unknown"; 84 | memory_device_type[dmi_memory_device_type::DMT_DRAM] = "DRAM"; 85 | memory_device_type[dmi_memory_device_type::DMT_EDRAM] = "EDRAM"; 86 | memory_device_type[dmi_memory_device_type::DMT_VRAM] = "VRAM"; 87 | memory_device_type[dmi_memory_device_type::DMT_SRAM] = "SRAM"; 88 | memory_device_type[dmi_memory_device_type::DMT_RAM] = "RAM"; 89 | memory_device_type[dmi_memory_device_type::DMT_ROM] = "ROM"; 90 | memory_device_type[dmi_memory_device_type::DMT_FLASH] = "Flash"; 91 | memory_device_type[dmi_memory_device_type::DMT_EEPROM] = "EEPROM"; 92 | memory_device_type[dmi_memory_device_type::DMT_FEPROM] = "FEPROM"; 93 | memory_device_type[dmi_memory_device_type::DMT_EPROM] = "EPROM"; 94 | memory_device_type[dmi_memory_device_type::DMT_CDRAM] = "CDRAM"; 95 | memory_device_type[dmi_memory_device_type::DMT_3DRAM] = "3DRAM"; 96 | memory_device_type[dmi_memory_device_type::DMT_SDRAM] = "SDRAM"; 97 | memory_device_type[dmi_memory_device_type::DMT_SGRAM] = "SGRAM"; 98 | memory_device_type[dmi_memory_device_type::DMT_RDRAM] = "RDRAM"; 99 | memory_device_type[dmi_memory_device_type::DMT_DDR] = "DDR"; 100 | memory_device_type[dmi_memory_device_type::DMT_DDR2] = "DDR2"; 101 | memory_device_type[dmi_memory_device_type::DMT_DDR2_FB_DIMM] = "DDR2 FB-DIMM"; 102 | memory_device_type[dmi_memory_device_type::DMT_RESERVED1] = "Reserved"; 103 | memory_device_type[dmi_memory_device_type::DMT_RESERVED2] = "Reserved"; 104 | memory_device_type[dmi_memory_device_type::DMT_RESERVED3] = "Reserved"; 105 | memory_device_type[dmi_memory_device_type::DMT_DDR3] = "DDR3"; 106 | memory_device_type[dmi_memory_device_type::DMT_FBD2] = "FBD2"; 107 | memory_device_type[dmi_memory_device_type::DMT_DDR4] = "DDR4"; 108 | memory_device_type[dmi_memory_device_type::DMT_LPDDR] = "LPDDR"; 109 | memory_device_type[dmi_memory_device_type::DMT_LPDDR2] = "LPDDR2"; 110 | memory_device_type[dmi_memory_device_type::DMT_LPDDR3] = "LPDDR3"; 111 | memory_device_type[dmi_memory_device_type::DMT_LPDDR4] = "LPDDR4"; 112 | memory_device_type[dmi_memory_device_type::DMT_LOGICAL_NONVOLATILE_DEVICE] = "Logical non-volatile device"; 113 | memory_device_type[dmi_memory_device_type::DMT_HBM] = "HBM"; 114 | memory_device_type[dmi_memory_device_type::DMT_HBM2] = "HBM2"; /* 0x21 */ 115 | 116 | 117 | if (code >= smbios::dmi_memory_device_type::DMT_OTHER 118 | && code <= smbios::dmi_memory_device_type::DMT_HBM2) { 119 | return memory_device_type[code - 0x01]; 120 | } 121 | 122 | return out_of_spec; 123 | } -------------------------------------------------------------------------------- /hwid_checker/includes/smbios.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #pragma comment(lib, "d3d9.lib") 13 | #pragma warning(disable : 4200) 14 | 15 | #define out_of_spec "OUT OF SPEC" 16 | 17 | 18 | 19 | namespace smbios 20 | { 21 | enum dmi_entry_type 22 | : BYTE 23 | { 24 | DMI_ENTRY_BIOS = 0, 25 | DMI_ENTRY_SYSTEM, 26 | DMI_ENTRY_BASEBOARD, 27 | DMI_ENTRY_CHASSIS, 28 | DMI_ENTRY_PROCESSOR, 29 | DMI_ENTRY_MEM_CONTROLLER, 30 | DMI_ENTRY_MEM_MODULE, 31 | DMI_ENTRY_CACHE, 32 | DMI_ENTRY_PORT_CONNECTOR, 33 | DMI_ENTRY_SYSTEM_SLOT, 34 | DMI_ENTRY_ONBOARD_DEVICE, 35 | DMI_ENTRY_OEMSTRINGS, 36 | DMI_ENTRY_SYSCONF, 37 | DMI_ENTRY_BIOS_LANG, 38 | DMI_ENTRY_GROUP_ASSOC, 39 | DMI_ENTRY_SYSTEM_EVENT_LOG, 40 | DMI_ENTRY_PHYS_MEM_ARRAY, 41 | DMI_ENTRY_MEM_DEVICE, 42 | DMI_ENTRY_32_MEM_ERROR, 43 | DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR, 44 | DMI_ENTRY_MEM_DEV_MAPPED_ADDR, 45 | DMI_ENTRY_BUILTIN_POINTING_DEV, 46 | DMI_ENTRY_PORTABLE_BATTERY, 47 | DMI_ENTRY_SYSTEM_RESET, 48 | DMI_ENTRY_HW_SECURITY, 49 | DMI_ENTRY_SYSTEM_POWER_CONTROLS, 50 | DMI_ENTRY_VOLTAGE_PROBE, 51 | DMI_ENTRY_COOLING_DEV, 52 | DMI_ENTRY_TEMP_PROBE, 53 | DMI_ENTRY_ELECTRICAL_CURRENT_PROBE, 54 | DMI_ENTRY_OOB_REMOTE_ACCESS, 55 | DMI_ENTRY_BIS_ENTRY, 56 | DMI_ENTRY_SYSTEM_BOOT, 57 | DMI_ENTRY_MGMT_DEV, 58 | DMI_ENTRY_MGMT_DEV_COMPONENT, 59 | DMI_ENTRY_MGMT_DEV_THRES, 60 | DMI_ENTRY_MEM_CHANNEL, 61 | DMI_ENTRY_IPMI_DEV, 62 | DMI_ENTRY_SYS_POWER_SUPPLY, 63 | DMI_ENTRY_ADDITIONAL, 64 | DMI_ENTRY_ONBOARD_DEV_EXT, 65 | DMI_ENTRY_MGMT_CONTROLLER_HOST, 66 | DMI_ENTRY_INACTIVE = 126, 67 | DMI_ENTRY_END_OF_TABLE = 127, 68 | }; 69 | 70 | enum dmi_memory_device_type // 7.18.2 71 | : BYTE 72 | { 73 | DMT_OTHER = 0x01, /* 0x01 */ 74 | DMT_UNKNOWN, 75 | DMT_DRAM, 76 | DMT_EDRAM, 77 | DMT_VRAM, 78 | DMT_SRAM, 79 | DMT_RAM, 80 | DMT_ROM, 81 | DMT_FLASH, 82 | DMT_EEPROM, 83 | DMT_FEPROM, 84 | DMT_EPROM, 85 | DMT_CDRAM, 86 | DMT_3DRAM, 87 | DMT_SDRAM, 88 | DMT_SGRAM, 89 | DMT_RDRAM, 90 | DMT_DDR, 91 | DMT_DDR2, 92 | DMT_DDR2_FB_DIMM, 93 | DMT_RESERVED1, 94 | DMT_RESERVED2, 95 | DMT_RESERVED3, 96 | DMT_DDR3, 97 | DMT_FBD2, 98 | DMT_DDR4, 99 | DMT_LPDDR, 100 | DMT_LPDDR2, 101 | DMT_LPDDR3, 102 | DMT_LPDDR4, 103 | DMT_LOGICAL_NONVOLATILE_DEVICE, 104 | DMT_HBM, 105 | DMT_HBM2 /* 0x21 */ 106 | }; 107 | 108 | // 109 | // Data structure the consults the hold of extracted data from the the raw 110 | // SMBIOS firmware table 111 | // 112 | 113 | typedef struct RawSMBIOSData 114 | { 115 | BYTE Used20CallingMethod; 116 | BYTE SMBIOSMajorVersion; 117 | BYTE SMBIOSMinorVersion; 118 | BYTE DmiRevision; 119 | DWORD Length; 120 | BYTE SMBIOSTableData[]; 121 | } RawSMBIOSData; 122 | 123 | 124 | 125 | // definition: 126 | // Desktop Management Interface (DMI) generates a standard framework 127 | // for managing and tracking components in a desktop, notebook or server 128 | // computer, by abstracting these components from the software that manages them. 129 | // 130 | 131 | typedef struct _dmi_header 132 | { 133 | BYTE type; 134 | BYTE length; 135 | WORD handle; 136 | } dmi_header; 137 | 138 | 139 | // function protoypes 140 | void dmi_system_uuid(const BYTE* p, short version); 141 | const char* dmi_string(const dmi_header* dm, BYTE src); 142 | const char* dmi_memory_device_type(BYTE code); 143 | }; -------------------------------------------------------------------------------- /img/Capture_cmd.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wizardengineer/hwid-checker-mg/6bb93b36e769510dd6abae45f9f9e83a802319fd/img/Capture_cmd.PNG -------------------------------------------------------------------------------- /img/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wizardengineer/hwid-checker-mg/6bb93b36e769510dd6abae45f9f9e83a802319fd/img/unknown.png --------------------------------------------------------------------------------