ReactOS 0.4.15-dev-8100-g1887773
util2.cpp
Go to the documentation of this file.
1#include "syshdrs.h"
2
3#if defined(WIN32) || defined(_WINDOWS)
4
5extern "C" void
6GetSpecialDir(char *dst, size_t size, int whichDir)
7{
8 LPITEMIDLIST idl;
9 LPMALLOC shl;
10 char path[MAX_PATH + 1];
11 HRESULT hResult;
12
13 memset(dst, 0, size);
14 hResult = SHGetMalloc(&shl);
15 if (SUCCEEDED(hResult)) {
17 NULL,
19 &idl
20 );
21
22 if (SUCCEEDED(hResult)) {
23 if(SHGetPathFromIDList(idl, path)) {
24 (void) strncpy(dst, path, size - 1);
25 dst[size - 1] = '\0';
26 }
27 shl->Free(idl);
28 }
29 shl->Release();
30 }
31} // GetSpecialDir
32
33
34#endif
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:285
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3225
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum dst
Definition: glext.h:6340
#define SUCCEEDED(hr)
Definition: intsafe.h:50
interface IMalloc * LPMALLOC
Definition: objfwd.h:12
#define memset(x, y, z)
Definition: compat.h:39
#define CSIDL_PERSONAL
Definition: shlobj.h:2164
#define SHGetPathFromIDList
Definition: shlobj.h:237
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41