shell.h (2960B)
1/** 2 * WinPR: Windows Portable Runtime 3 * Shell Functions 4 * 5 * Copyright 2015 Dell Software <Mike.McDonald@software.dell.com> 6 * Copyright 2016 David PHAM-VAN <d.phamvan@inuvika.com> 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21#ifndef WINPR_SHELL_H 22#define WINPR_SHELL_H 23 24#include <stdio.h> 25#include <stdlib.h> 26#include <string.h> 27#include <winpr/winpr.h> 28#include <winpr/wtypes.h> 29 30#ifdef _WIN32 31 32#include <shlobj.h> 33#include <userenv.h> 34 35#else 36 37/* Shell clipboard formats */ 38 39struct _FILEDESCRIPTORW 40{ 41 DWORD dwFlags; 42 CLSID clsid; 43 SIZEL sizel; 44 POINTL pointl; 45 DWORD dwFileAttributes; 46 FILETIME ftCreationTime; 47 FILETIME ftLastAccessTime; 48 FILETIME ftLastWriteTime; 49 DWORD nFileSizeHigh; 50 DWORD nFileSizeLow; 51 WCHAR cFileName[260]; 52}; 53typedef struct _FILEDESCRIPTORW FILEDESCRIPTORW; 54 55#if !defined(DEFINE_NO_DEPRECATED) 56/* Legacy definition, some types do not match the windows equivalent. */ 57struct _FILEDESCRIPTOR 58{ 59 DWORD dwFlags; 60 BYTE clsid[16]; 61 BYTE sizel[8]; 62 BYTE pointl[8]; 63 DWORD dwFileAttributes; 64 FILETIME ftCreationTime; 65 FILETIME ftLastAccessTime; 66 FILETIME ftLastWriteTime; 67 DWORD nFileSizeHigh; 68 DWORD nFileSizeLow; 69 WCHAR cFileName[260]; 70}; 71typedef struct _FILEDESCRIPTOR FILEDESCRIPTOR; 72#endif 73 74/* FILEDESCRIPTOR.dwFlags */ 75typedef enum 76{ 77 FD_CLSID = 0x00000001, 78 FD_SIZEPOINT = 0x00000002, 79 FD_ATTRIBUTES = 0x00000004, 80 FD_CREATETIME = 0x00000008, 81 FD_ACCESSTIME = 0x00000010, 82 FD_WRITETIME = 0x00000020, 83 FD_FILESIZE = 0x00000040, 84 FD_PROGRESSUI = 0x00004000, 85 FD_LINKUI = 0x00008000, 86 FD_UNICODE = 0x80000000 87} FD_FLAGS; 88 89#if !defined(DEFINE_NO_DEPRECATED) 90/* Deprecated, here for compatibility */ 91#define FD_SHOWPROGRESSUI FD_PROGRESSUI 92#define FD_WRITESTIME FD_WRITETIME 93#endif 94 95/* FILEDESCRIPTOR.dwFileAttributes */ 96#define FILE_ATTRIBUTE_READONLY 0x00000001 97#define FILE_ATTRIBUTE_HIDDEN 0x00000002 98#define FILE_ATTRIBUTE_SYSTEM 0x00000004 99#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 100#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 101#define FILE_ATTRIBUTE_NORMAL 0x00000080 102 103#ifdef __cplusplus 104extern "C" 105{ 106#endif 107 108 WINPR_API BOOL GetUserProfileDirectoryA(HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSize); 109 110 WINPR_API BOOL GetUserProfileDirectoryW(HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchSize); 111 112#ifdef __cplusplus 113} 114#endif 115 116#ifdef UNICODE 117#define GetUserProfileDirectory GetUserProfileDirectoryW 118#else 119#define GetUserProfileDirectory GetUserProfileDirectoryA 120#endif 121 122#endif 123 124#endif /* WINPR_SHELL_H */