yolobs-studio/UI/win-update/win-update-helpers.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
645 B
C++
Raw Normal View History

2017-04-19 19:54:15 +00:00
#include "win-update-helpers.hpp"
void FreeProvider(HCRYPTPROV prov)
{
CryptReleaseContext(prov, 0);
}
void FreeHash(HCRYPTHASH hash)
{
CryptDestroyHash(hash);
}
void FreeKey(HCRYPTKEY key)
{
CryptDestroyKey(key);
}
std::string vstrprintf(const char *format, va_list args)
{
if (!format)
return std::string();
std::string str;
2019-07-27 12:47:10 +00:00
int size = (int)vsnprintf(nullptr, 0, format, args) + 1;
2017-04-19 19:54:15 +00:00
str.resize(size);
vsnprintf(&str[0], size, format, args);
return str;
}
std::string strprintf(const char *format, ...)
{
std::string str;
va_list args;
va_start(args, format);
str = vstrprintf(format, args);
va_end(args);
return str;
}