ReactOS 0.4.15-dev-7953-g1f49173
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}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT INLINE GetFullName(PCIDLIST_ABSOLUTE pidl, DWORD uFlags, PWSTR strName, DWORD cchName)
Definition: util.h:29
#define INLINE
Definition: util.h:4
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
HRESULT INLINE MakeStrRetFromString(LPCWSTR string, DWORD cbLength, STRRET *str)
Definition: util.h:7
UINT uFlags
Definition: api.c:59
@ VT_BSTR
Definition: compat.h:2303
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const WCHAR * str
HRESULT hr
Definition: shlfolder.c:183
@ STRRET_WSTR
Definition: shtypes.idl:85
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185