diff --git a/src/tun/windows.cc b/src/tun/windows.cc index cde5ca5..949d64d 100644 --- a/src/tun/windows.cc +++ b/src/tun/windows.cc @@ -5,11 +5,11 @@ #include "utility/address.h" #include #include +#include #include #include #include // clang-format off -#include #include #include #include @@ -96,10 +96,10 @@ class WindowsTun { } GUID Guid; - if (CoCreateGuid(&Guid) != S_OK) { - spdlog::critical("create guid failed"); - return -1; - } + std::string data = "CandyGuid" + this->name; + unsigned char hash[SHA256_DIGEST_LENGTH]; + SHA256((unsigned char *)data.c_str(), data.size(), hash); + memcpy(&Guid, hash, sizeof(Guid)); std::wstring_convert> converter; this->adapter = WintunCreateAdapter(converter.from_bytes(this->name).c_str(), L"Candy", &Guid); if (!this->adapter) {