You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
804 B
41 lines
804 B
#include "str.h"
|
|
|
|
#include "sfstr.h"
|
|
|
|
#include "dbg.h"
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
HRESULT _StringFromGUID(const GUID* pguid, LPWSTR psz, DWORD cch)
|
|
{
|
|
LPOLESTR pstr;
|
|
HRESULT hres = StringFromCLSID(*pguid, &pstr);
|
|
|
|
if (SUCCEEDED(hres))
|
|
{
|
|
// check size of string
|
|
hres = SafeStrCpyN(psz, pstr, cch);
|
|
|
|
CoTaskMemFree(pstr);
|
|
}
|
|
|
|
return hres;
|
|
}
|
|
|
|
HRESULT _GUIDFromString(LPCWSTR psz, GUID* pguid)
|
|
{
|
|
return CLSIDFromString((LPOLESTR)psz, pguid);
|
|
}
|
|
|
|
HRESULT _CreateGUID(LPWSTR pszGUID, DWORD cchGUID)
|
|
{
|
|
GUID guid;
|
|
HRESULT hr = CoCreateGuid(&guid);
|
|
|
|
if (SUCCEEDED(hr))
|
|
{
|
|
hr = _StringFromGUID(&guid, pszGUID, cchGUID);
|
|
}
|
|
|
|
return hr;
|
|
}
|