1 //+------------------------------------------------------------------------- 2 // 3 // For conditions of distribution and use, see copyright notice 4 // in Flashpix.h 5 // 6 // Copyright (c) 1999 Digital Imaging Group 7 // 8 // Contents: Definitions of Nt property api. 9 // 10 //-------------------------------------------------------------------------- 11 12 #ifndef _PROPAPI_H_ 13 #define _PROPAPI_H_ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /**/ 20 /* typedef the function prototypes necessary*/ 21 /* for the UNICODECALLOUTS structure.*/ 22 /**/ 23 24 typedef UINT (WINAPI FNGETACP)(VOID); 25 26 typedef int (WINAPI FNMULTIBYTETOWIDECHAR)( 27 IN UINT CodePage, 28 IN DWORD dwFlags, 29 IN LPCSTR lpMultiByteStr, 30 IN int cchMultiByte, 31 OUT LPWSTR lpWideCharStr, 32 IN int cchWideChar); 33 34 typedef int (WINAPI FNWIDECHARTOMULTIBYTE)( 35 IN UINT CodePage, 36 IN DWORD dwFlags, 37 IN LPCWSTR lpWideCharStr, 38 IN int cchWideChar, 39 OUT LPSTR lpMultiByteStr, 40 IN int cchMultiByte, 41 IN LPCSTR lpDefaultChar, 42 IN LPBOOL lpUsedDefaultChar); 43 44 typedef STDAPI_(BSTR) FNSYSALLOCSTRING( 45 OLECHAR FAR* pwsz); 46 47 typedef STDAPI_(VOID) FNSYSFREESTRING( 48 BSTR pwsz); 49 50 /**/ 51 /* The UNICODECALLOUTS structure holds function*/ 52 /* pointers for routines needed by the property*/ 53 /* set routines in NTDLL.*/ 54 /**/ 55 56 typedef struct _UNICODECALLOUTS 57 { 58 FNGETACP *pfnGetACP; 59 FNMULTIBYTETOWIDECHAR *pfnMultiByteToWideChar; 60 FNWIDECHARTOMULTIBYTE *pfnWideCharToMultiByte; 61 FNSYSALLOCSTRING *pfnSysAllocString; 62 FNSYSFREESTRING *pfnSysFreeString; 63 } UNICODECALLOUTS; 64 65 66 /**/ 67 /* Define the default UNICODECALLOUTS*/ 68 /* values.*/ 69 /**/ 70 71 #define WIN32_UNICODECALLOUTS \ 72 GetACP, \ 73 MultiByteToWideChar, \ 74 WideCharToMultiByte, \ 75 SysAllocString, \ 76 SysFreeString 77 78 # define PROPSYSAPI 79 # define PROPAPI 80 81 # define PropFreeHeap(h, z, p) CoTaskMemFree(p) 82 83 # define PROPASSERT assert 84 85 #define PROPASSERTMSG(szReason, f) assert( (szReason && FALSE) || (f)) 86 87 # define PropSprintfA wsprintfA 88 # define PropVsprintfA wvsprintfA 89 90 #define WC_PROPSET0 ((WCHAR) 0x0005) 91 #define OC_PROPSET0 ((OLECHAR) 0x0005) 92 93 #define CBIT_BYTE 8 94 #define CBIT_GUID (CBIT_BYTE * sizeof(GUID)) 95 #define CBIT_CHARMASK 5 96 97 /* Allow for OC_PROPSET0 and a GUID mapped to a 32 character alphabet */ 98 #define CCH_PROPSET (1 + (CBIT_GUID + CBIT_CHARMASK-1)/CBIT_CHARMASK) 99 #define CCH_PROPSETSZ (CHC_PROPSET + 1) /* allow null*/ 100 #define CCH_PROPSETCOLONSZ (1 + CHC_PROPSET + 1) /* allow colon and null*/ 101 102 /* Define the max property name in units of characters 103 (and synonomously in wchars). */ 104 #define CCH_MAXPROPNAME 255 /* Matches Shell & 105 Office */ 106 #define CCH_MAXPROPNAMESZ (CWC_MAXPROPNAME + 1) /* allow null */ 107 #define CWC_MAXPROPNAME CCH_MAXPROPNAME 108 #define CWC_MAXPROPNAMESZ CCH_MAXPROPNAMESZ 109 110 111 /*+--------------------------------------------------------------------------*/ 112 /* Property Access APIs: */ 113 /*---------------------------------------------------------------------------*/ 114 115 typedef VOID *NTPROP; 116 typedef VOID *NTMAPPEDSTREAM; 117 typedef VOID *NTMEMORYALLOCATOR; 118 119 120 VOID PROPSYSAPI PROPAPI 121 RtlSetUnicodeCallouts( 122 IN UNICODECALLOUTS *pUnicodeCallouts); 123 124 ULONG PROPSYSAPI PROPAPI 125 RtlGuidToPropertySetName( 126 IN GUID const *pguid, 127 OUT OLECHAR aocname[]); 128 129 NTSTATUS PROPSYSAPI PROPAPI 130 RtlPropertySetNameToGuid( 131 IN ULONG cwcname, 132 IN OLECHAR const aocname[], 133 OUT GUID *pguid); 134 135 136 /* RtlCreatePropertySet Flags:*/ 137 138 #define CREATEPROP_READ 0x0000 /* request read access (must exist)*/ 139 #define CREATEPROP_WRITE 0x0001 /* request write access (must exist)*/ 140 #define CREATEPROP_CREATE 0x0002 /* create (overwrite if exists)*/ 141 #define CREATEPROP_CREATEIF 0x0003 /* create (open existing if exists)*/ 142 #define CREATEPROP_DELETE 0x0004 /* delete*/ 143 #define CREATEPROP_MODEMASK 0x000f /* open mode mask*/ 144 145 #define CREATEPROP_NONSIMPLE 0x0010 /* Is non-simple propset (in a storage)*/ 146 147 148 /* RtlCreateMappedStream Flags:*/ 149 150 #define CMS_READONLY 0x00000000 /* Opened for read-only*/ 151 #define CMS_WRITE 0x00000001 /* Opened for write access*/ 152 #define CMS_TRANSACTED 0x00000002 /* Is transacted*/ 153 154 155 NTSTATUS PROPSYSAPI PROPAPI 156 RtlCreatePropertySet( 157 IN NTMAPPEDSTREAM ms, /* Nt mapped stream*/ 158 IN USHORT Flags, /* NONSIMPLE|*1* of READ/WRITE/CREATE/CREATEIF/DELETE*/ 159 OPTIONAL IN GUID const *pguid, /* property set guid (create only)*/ 160 OPTIONAL IN GUID const *pclsid,/* CLASSID of propset code (create only)*/ 161 IN NTMEMORYALLOCATOR ma, /* memory allocator of caller*/ 162 IN ULONG LocaleId, /* Locale Id (create only)*/ 163 OPTIONAL OUT ULONG *pOSVersion,/* OS Version field in header.*/ 164 IN OUT USHORT *pCodePage, /* IN: CodePage of property set (create only)*/ 165 /* OUT: CodePage of property set (always)*/ 166 OUT NTPROP *pnp); /* Nt property set context*/ 167 168 NTSTATUS PROPSYSAPI PROPAPI 169 RtlClosePropertySet( 170 IN NTPROP np); /* property set context*/ 171 172 #define CBSTM_UNKNOWN ((ULONG) -1) 173 NTSTATUS PROPSYSAPI PROPAPI 174 RtlOnMappedStreamEvent( 175 IN VOID *pv, /* property set context */ 176 IN VOID *pbuf, /* property set buffer */ 177 IN ULONG cbstm ); /* size of underlying stream or CBSTM_UNKNOWN */ 178 179 NTSTATUS PROPSYSAPI PROPAPI 180 RtlFlushPropertySet( 181 IN NTPROP np); /* property set context*/ 182 183 NTSTATUS PROPSYSAPI PROPAPI 184 RtlSetProperties( 185 IN NTPROP np, /* property set context*/ 186 IN ULONG cprop, /* property count*/ 187 IN PROPID pidNameFirst, /* first PROPID for new named properties*/ 188 IN PROPSPEC const aprs[], /* array of property specifiers*/ 189 OPTIONAL OUT PROPID apid[], /* buffer for array of propids*/ 190 OPTIONAL IN PROPVARIANT const avar[]);/* array of properties with values*/ 191 192 NTSTATUS PROPSYSAPI PROPAPI 193 RtlQueryProperties( 194 IN NTPROP np, /* property set context*/ 195 IN ULONG cprop, /* property count*/ 196 IN PROPSPEC const aprs[], /* array of property specifiers*/ 197 OPTIONAL OUT PROPID apid[], /* buffer for array of propids*/ 198 IN OUT PROPVARIANT *avar, /* IN: array of uninitialized PROPVARIANTs,*/ 199 /* OUT: may contain pointers to alloc'd memory*/ 200 OUT ULONG *pcpropFound); /* count of property values retrieved*/ 201 202 203 204 #define ENUMPROP_NONAMES 0x00000001 /* return property IDs only*/ 205 206 NTSTATUS PROPSYSAPI PROPAPI 207 RtlEnumerateProperties( 208 IN NTPROP np, /* property set context*/ 209 IN ULONG Flags, /* flags: No Names (propids only), etc.*/ 210 IN OUT ULONG *pkey, /* bookmark; caller set to 0 before 1st call*/ 211 IN OUT ULONG *pcprop, /* pointer to property count*/ 212 OPTIONAL OUT PROPSPEC aprs[],/* IN: array of uninitialized PROPSPECs*/ 213 /* OUT: may contain pointers to alloc'd strings*/ 214 OPTIONAL OUT STATPROPSTG asps[]); 215 /* IN: array of uninitialized STATPROPSTGs*/ 216 /* OUT: may contain pointers to alloc'd strings*/ 217 218 NTSTATUS PROPSYSAPI PROPAPI 219 RtlQueryPropertyNames( 220 IN NTPROP np, /* property set context*/ 221 IN ULONG cprop, /* property count*/ 222 IN PROPID const *apid, /* PROPID array*/ 223 OUT OLECHAR *apwsz[] /* OUT pointers to allocated strings*/ 224 ); 225 226 NTSTATUS PROPSYSAPI PROPAPI 227 RtlSetPropertyNames( 228 IN NTPROP np, /* property set context*/ 229 IN ULONG cprop, /* property count*/ 230 IN PROPID const *apid, /* PROPID array*/ 231 IN OLECHAR const * const apwsz[] /* pointers to property names*/ 232 ); 233 234 NTSTATUS PROPSYSAPI PROPAPI 235 RtlSetPropertySetClassId( 236 IN NTPROP np, /* property set context*/ 237 IN GUID const *pclsid /* new CLASSID of propset code*/ 238 ); 239 240 NTSTATUS PROPSYSAPI PROPAPI 241 RtlQueryPropertySet( 242 IN NTPROP np, /* property set context*/ 243 OUT STATPROPSETSTG *pspss /* buffer for property set stat information*/ 244 ); 245 246 NTSTATUS PROPSYSAPI PROPAPI 247 RtlEnumeratePropertySets( 248 IN HANDLE hstg, /* structured storage handle*/ 249 IN BOOLEAN fRestart, /* restart scan*/ 250 IN OUT ULONG *pcspss, /* pointer to count of STATPROPSETSTGs*/ 251 IN OUT GUID *pkey, /* bookmark*/ 252 OUT STATPROPSETSTG *pspss /* array of STATPROPSETSTGs*/ 253 ); 254 255 #ifdef __cplusplus 256 } 257 #endif 258 259 #endif /* ifndef _PROPAPI_H_*/ 260