ReactOS  0.4.15-dev-2522-g9e0a3cd
util2.cpp
Go to the documentation of this file.
1 #include "syshdrs.h"
2 
3 #if defined(WIN32) || defined(_WINDOWS)
4 
5 extern "C" void
6 GetSpecialDir(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
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
interface IMalloc * LPMALLOC
Definition: objfwd.h:12
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:290
if SUCCEEDED(hr)
GLsizeiptr size
Definition: glext.h:5919
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
#define SHGetPathFromIDList
Definition: shlobj.h:209
GLenum GLenum dst
Definition: glext.h:6340
#define NULL
Definition: types.h:112
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41