ReactOS  0.4.14-dev-833-g5f692ed
util.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef INLINE
4 #define INLINE inline
5 #endif
6 
8 {
9  str->uType = STRRET_WSTR;
10 
11  DWORD blen = cbLength + sizeof(WCHAR);
12  str->pOleStr = (LPWSTR) CoTaskMemAlloc(blen);
13  return StringCbCopyNW(str->pOleStr, blen, string, cbLength);
14 }
15 
17 {
18  DWORD stringLength = wcslen(string) * sizeof(WCHAR);
19  return MakeStrRetFromString(string, stringLength, str);
20 }
21 
23 {
24  V_VT(pv) = VT_BSTR;
25  V_BSTR(pv) = SysAllocString(string);
26  return S_OK;
27 }
28 
30 {
31  CComPtr<IShellFolder> psfDesktop;
32  STRRET str;
33  HRESULT hr;
34 
35  hr = SHGetDesktopFolder(&psfDesktop);
37  return hr;
38 
39  hr = psfDesktop->GetDisplayNameOf(pidl, uFlags, &str);
41  return hr;
42 
43  return StrRetToBufW(&str, pidl, strName, cchName);
44 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
uint16_t * PWSTR
Definition: typedefs.h:54
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
UINT uFlags
Definition: api.c:59
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2723
const WCHAR * str
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define INLINE
Definition: util.h:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT INLINE GetFullName(PCIDLIST_ABSOLUTE pidl, DWORD uFlags, PWSTR strName, DWORD cchName)
Definition: util.h:29
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HRESULT INLINE MakeStrRetFromString(LPCWSTR string, DWORD cbLength, STRRET *str)
Definition: util.h:7