Add project files.
This commit is contained in:
34
L2BotDll/Common/Common.cpp
Normal file
34
L2BotDll/Common/Common.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "pch.h"
|
||||
#include "Common.h"
|
||||
#include <Rpc.h>
|
||||
#pragma comment(lib, "Rpcrt4.lib")
|
||||
|
||||
std::string ConvertFromWideChar(const wchar_t* str)
|
||||
{
|
||||
std::wstring ws(str);
|
||||
std::string result(ws.begin(), ws.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string GenerateUUID()
|
||||
{
|
||||
UUID uuid;
|
||||
::ZeroMemory(&uuid, sizeof(UUID));
|
||||
|
||||
::UuidCreate(&uuid);
|
||||
|
||||
WCHAR* wszUuid = NULL;
|
||||
::UuidToStringW(&uuid, (RPC_WSTR*)&wszUuid);
|
||||
|
||||
if (wszUuid == NULL)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::wstring ws = wszUuid;
|
||||
|
||||
::RpcStringFree((RPC_WSTR*)&wszUuid);
|
||||
wszUuid = NULL;
|
||||
|
||||
return std::string(ws.begin(), ws.end());
|
||||
}
|
Reference in New Issue
Block a user