├── .gitignore
├── .gitattributes
├── HWID Project
├── Main.cpp
├── Release
│ ├── x64
│ │ ├── HWID Project.exe
│ │ ├── HWID Project.pdb
│ │ ├── HWID Project.iobj
│ │ └── HWID Project.ipdb
│ └── x86
│ │ └── HWID Project.exe
├── HWID Project.vcxproj.user
├── HWID Project.vcxproj.filters
└── HWID Project.vcxproj
├── LICENSE
├── HWID Project.sln
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .vs/HWID Project/v15/.suo
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/HWID Project/Main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Main.cpp
--------------------------------------------------------------------------------
/HWID Project/Release/x64/HWID Project.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Release/x64/HWID Project.exe
--------------------------------------------------------------------------------
/HWID Project/Release/x64/HWID Project.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Release/x64/HWID Project.pdb
--------------------------------------------------------------------------------
/HWID Project/Release/x86/HWID Project.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Release/x86/HWID Project.exe
--------------------------------------------------------------------------------
/HWID Project/Release/x64/HWID Project.iobj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Release/x64/HWID Project.iobj
--------------------------------------------------------------------------------
/HWID Project/Release/x64/HWID Project.ipdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HeathHowren/HWID-Info-Grabber/HEAD/HWID Project/Release/x64/HWID Project.ipdb
--------------------------------------------------------------------------------
/HWID Project/HWID Project.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/HWID Project/HWID Project.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 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Heath Howren
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 |
--------------------------------------------------------------------------------
/HWID Project.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2019
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWID Project", "HWID Project\HWID Project.vcxproj", "{E4AE1BBF-6277-43A5-A234-495A5BF35467}"
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 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Debug|x64.ActiveCfg = Debug|x64
17 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Debug|x64.Build.0 = Debug|x64
18 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Debug|x86.ActiveCfg = Debug|Win32
19 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Debug|x86.Build.0 = Debug|Win32
20 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Release|x64.ActiveCfg = Release|x64
21 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Release|x64.Build.0 = Release|x64
22 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Release|x86.ActiveCfg = Release|Win32
23 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {2BC98B5C-4E2A-4D19-8C65-687ECF08E011}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HWID Info Grabber
2 |
3 | ## Introduction
4 |
5 | This project is an example of how computer components have hardware identifiers that can be used by developers to lock applications to specific computers.
6 | This code is from a [video](https://www.youtube.com/watch?v=78JToBCejdU) where I explain how to control distribution of applications and prevent piracy.
7 |
8 | ## Code Samples
9 |
10 | Retrieving HDD information, the HDD serial is most commonly used for locking applications.
11 | ```cpp
12 | TCHAR volumeName[MAX_PATH + 1] = { 0 };
13 | TCHAR fileSystemName[MAX_PATH + 1] = { 0 };
14 | DWORD serialNumber = 0;
15 | DWORD maxComponentLen = 0;
16 | DWORD fileSystemFlags = 0;
17 | if (GetVolumeInformation(
18 | _T("C:\\"),
19 | volumeName,
20 | ARRAYSIZE(volumeName),
21 | &serialNumber,
22 | &maxComponentLen,
23 | &fileSystemFlags,
24 | fileSystemName,
25 | ARRAYSIZE(fileSystemName)))
26 | {
27 | std::cout << "Volume Name: " << volumeName << std::endl;
28 | std::cout << "HDD Serial: " << serialNumber << std::endl;
29 | std::cout << "File System Type: " << fileSystemName << std::endl;
30 | std::cout << "Max Component Length: " << maxComponentLen << std::endl;
31 | }
32 | ```
33 | Retrieving the computer name, this is easily changeable by the user.
34 | ```cpp
35 | TCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
36 | DWORD size = sizeof(computerName) / sizeof(computerName[0]);
37 | if (GetComputerName(
38 | computerName,
39 | &size))
40 | {
41 | std::cout << "Computer Name: " << computerName << std::endl;
42 | }
43 | ```
44 | Retrieving the CPU hash.
45 | ```cpp
46 | int cpuinfo[4] = { 0, 0, 0, 0 }; //EAX, EBX, ECX, EDX
47 | __cpuid(cpuinfo, 0);
48 | char16_t hash = 0;
49 | char16_t* ptr = (char16_t*)(&cpuinfo[0]);
50 | for (char32_t i = 0; i < 8; i++)
51 | hash += ptr[i];
52 | std::cout << "CPU Hash: " << hash << std::endl;
53 | ```
54 |
--------------------------------------------------------------------------------
/HWID Project/HWID Project.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 | {E4AE1BBF-6277-43A5-A234-495A5BF35467}
24 | HWIDProject
25 | 10.0.18362.0
26 |
27 |
28 |
29 | Application
30 | true
31 | v141
32 | MultiByte
33 |
34 |
35 | Application
36 | false
37 | v141
38 | true
39 | MultiByte
40 |
41 |
42 | Application
43 | true
44 | v141
45 | MultiByte
46 |
47 |
48 | Application
49 | false
50 | v141
51 | true
52 | MultiByte
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Level3
76 | Disabled
77 | true
78 | true
79 |
80 |
81 |
82 |
83 | Level3
84 | Disabled
85 | true
86 | true
87 |
88 |
89 |
90 |
91 | Level3
92 | MaxSpeed
93 | true
94 | true
95 | true
96 | true
97 |
98 |
99 | true
100 | true
101 |
102 |
103 |
104 |
105 | Level3
106 | MaxSpeed
107 | true
108 | true
109 | true
110 | true
111 |
112 |
113 | true
114 | true
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------