diff --git a/README.md b/README.md index 779bc0d..b81a8cf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # hwid - get hardware profile info with C++ + get hardware profile info and PC name with C++ diff --git a/hwid.sln b/hwid.sln new file mode 100644 index 0000000..3d17b44 --- /dev/null +++ b/hwid.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hwid", "hwid\hwid.vcxproj", "{4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Debug|x64.ActiveCfg = Debug|x64 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Debug|x64.Build.0 = Debug|x64 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Debug|x86.ActiveCfg = Debug|Win32 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Debug|x86.Build.0 = Debug|Win32 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Release|x64.ActiveCfg = Release|x64 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Release|x64.Build.0 = Release|x64 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Release|x86.ActiveCfg = Release|Win32 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {513B7AA8-0A2B-448E-B707-FDED5D3CCFEB} + EndGlobalSection +EndGlobal diff --git a/hwid/hwid.cpp b/hwid/hwid.cpp new file mode 100644 index 0000000..4bc0107 --- /dev/null +++ b/hwid/hwid.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +wchar_t* getPCname() { + wchar_t buffer[256]; + unsigned long size = 256; + GetComputerName(buffer, &size); + return buffer; +} + +int main() { + HW_PROFILE_INFO hwProfileInfo; + if (GetCurrentHwProfile(&hwProfileInfo)) { + std::wstring pcid = getPCname(); + std::wstring hwid = hwProfileInfo.szHwProfileGuid; + std::wcout << "Current PC name: " << pcid << std::endl << "Current hardware profile: " << hwid << std::endl; + } else { + std::cout << "unknown error" << std::endl; + } + std::cin.get(); +} diff --git a/hwid/hwid.vcxproj b/hwid/hwid.vcxproj new file mode 100644 index 0000000..8c76b07 --- /dev/null +++ b/hwid/hwid.vcxproj @@ -0,0 +1,155 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {4E2A66B9-02F6-4BBF-9FBF-5EEBFE28C3E7} + Win32Proj + hwid + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/hwid/hwid.vcxproj.filters b/hwid/hwid.vcxproj.filters new file mode 100644 index 0000000..4eaccea --- /dev/null +++ b/hwid/hwid.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file