Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

propapi.h

Go to the documentation of this file.
00001 //+------------------------------------------------------------------------- 00002 // 00003 // Microsoft Windows 00004 // Copyright (C) Microsoft Corporation, 1992-1998. 00005 // 00006 // File: propapi.h 00007 // 00008 // Contents: Stuff needed to make properties build for Nashville and 00009 // NT... definitions of Nt property api. 00010 // 00011 // 00012 // History: 07-Aug-95 BillMo Created. 00013 // 22-Feb-96 MikeHill Fixed the non-WINNT version of 00014 // PROPASSERTMSG. 00015 // 09-May-96 MikeHill Update define to allow PropSet names 00016 // to be 255 characters (from 127). 00017 // 31-May-96 MikeHill Add OSVersion to RtlCreatePropSet. 00018 // 18-Jun-96 MikeHill Add OleAut32 wrappers to Unicode callouts. 00019 // 15-Jul-96 MikeHill - Remvd Win32 SEH exception-related code. 00020 // - WCHAR=>OLECHAR where applicable. 00021 // - Added RtlOnMappedStreamEvent 00022 // - Added Mac versions of PROPASSERT 00023 // 00024 //-------------------------------------------------------------------------- 00025 00026 00027 #ifndef _PROPAPI_H_ 00028 #define _PROPAPI_H_ 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 // 00035 // typedef the function prototypes necessary 00036 // for the UNICODECALLOUTS structure. 00037 // 00038 00039 typedef UINT (WINAPI FNGETACP)(VOID); 00040 00041 typedef int (WINAPI FNMULTIBYTETOWIDECHAR)( 00042 IN UINT CodePage, 00043 IN DWORD dwFlags, 00044 IN LPCSTR lpMultiByteStr, 00045 IN int cchMultiByte, 00046 OUT LPWSTR lpWideCharStr, 00047 IN int cchWideChar); 00048 00049 typedef int (WINAPI FNWIDECHARTOMULTIBYTE)( 00050 IN UINT CodePage, 00051 IN DWORD dwFlags, 00052 IN LPCWSTR lpWideCharStr, 00053 IN int cchWideChar, 00054 OUT LPSTR lpMultiByteStr, 00055 IN int cchMultiByte, 00056 IN LPCSTR lpDefaultChar, 00057 IN LPBOOL lpUsedDefaultChar); 00058 00059 typedef BSTR FNSYSALLOCSTRING( 00060 OLECHAR FAR* pwsz); 00061 00062 typedef VOID FNSYSFREESTRING( 00063 BSTR pwsz); 00064 00065 // 00066 // The UNICODECALLOUTS structure holds function 00067 // pointers for routines needed by the property 00068 // set routines in NTDLL. 00069 // 00070 00071 typedef struct _UNICODECALLOUTS 00072 { 00073 FNGETACP *pfnGetACP; 00074 FNMULTIBYTETOWIDECHAR *pfnMultiByteToWideChar; 00075 FNWIDECHARTOMULTIBYTE *pfnWideCharToMultiByte; 00076 FNSYSALLOCSTRING *pfnSysAllocString; 00077 FNSYSFREESTRING *pfnSysFreeString; 00078 } UNICODECALLOUTS; 00079 00080 00081 // 00082 // Define the default UNICODECALLOUTS 00083 // values. 00084 // 00085 00086 STDAPI_(BSTR) 00087 PropSysAllocString(OLECHAR FAR* pwsz); 00088 00089 STDAPI_(VOID) 00090 PropSysFreeString(BSTR bstr); 00091 00092 #define WIN32_UNICODECALLOUTS \ 00093 GetACP, \ 00094 MultiByteToWideChar, \ 00095 WideCharToMultiByte, \ 00096 PropSysAllocString, \ 00097 PropSysFreeString 00098 00099 00100 // Is this pure NT (the IProp DLL needs to run on Win95)? 00101 #if defined(WINNT) && !defined(IPROPERTY_DLL) 00102 00103 // Set the function modifiers 00104 # define PROPSYSAPI NTSYSAPI 00105 # define PROPAPI NTAPI 00106 00107 // How do we free mem allocated in the low-level propset routines? 00108 # define PropFreeHeap(h, z, p) RtlFreeHeap(h, z, p) 00109 00110 // Assert implementations 00111 # define PROPASSERT ASSERT 00112 # define PROPASSERTMSG ASSERTMSG 00113 00114 // Generate the default non-simple property stream/storage name 00115 # define PROPGENPROPERTYNAME(s,n) swprintf ((s), L"prop%lu", (n)) 00116 00117 // Ansi sprintf implementations 00118 # define PropSprintfA sprintf 00119 # define PropVsprintfA vsprintf 00120 00121 // Otherwise this is either the IProp DLL (NT, Win95, Mac), 00122 // or it's the Win95 OLE32build. 00123 00124 #else // #if defined(WINNT) && !defined(IPROPERTY_DLL) 00125 00126 // Set the function modifiers 00127 # define PROPSYSAPI 00128 # define PROPAPI 00129 00130 // How do we free mem allocated in low-level propset routines? 00131 # define PropFreeHeap(h, z, p) CoTaskMemFree(p) 00132 00133 // Assert implementations 00134 # if DBG==1 00135 # ifdef _MAC_NODOC 00136 # define PROPASSERT(f) { if (!(f)) FnAssert(#f, NULL, __FILE__, __LINE__); } 00137 # define PROPASSERTMSG(szReason, f) { if (!(f)) FnAssert(#f, szReason, __FILE__, __LINE__); } 00138 # else 00139 # define PROPASSERT(f) Win4Assert((f)) 00140 # define PROPASSERTMSG(szReason, f) Win4Assert( (szReason && FALSE) || (f)) 00141 # endif 00142 # else 00143 # define PROPASSERT(f) 00144 # define PROPASSERTMSG(szReason, f) 00145 # endif // #if DBG==1 00146 00147 // Generate the default non-simple property stream/storage name 00148 # define PROPGENPROPERTYNAME(s,n) \ 00149 { \ 00150 memcpy ((s), OLESTR("prop"), sizeof (OLESTR("prop"))); \ 00151 ULTOO ((n), &(s)[sizeof("prop") - 1], 10); \ 00152 } 00153 00154 // Ansi sprintf implementations 00155 # ifdef IPROPERTY_DLL 00156 # define PropSprintfA sprintf 00157 # define PropVsprintfA vsprintf 00158 # else 00159 # define PropSprintfA wsprintfA 00160 # define PropVsprintfA wvsprintfA 00161 # endif // #ifdef _MAC_NODOC 00162 00163 #endif // #if defined(WINNT) && !defined(IPROPERTY_DLL) ... #else 00164 00165 00166 #ifdef IPROPERTY_DLL 00167 #define MAX_ULONG ((ULONG) -1) 00168 #endif 00169 00170 00171 #define WC_PROPSET0 ((WCHAR) 0x0005) 00172 #define OC_PROPSET0 ((OLECHAR) 0x0005) 00173 00174 #define CBIT_BYTE 8 00175 #define CBIT_GUID (CBIT_BYTE * sizeof(GUID)) 00176 #define CBIT_CHARMASK 5 00177 00178 // Allow for OC_PROPSET0 and a GUID mapped to a 32 character alphabet 00179 #define CCH_PROPSET (1 + (CBIT_GUID + CBIT_CHARMASK-1)/CBIT_CHARMASK) 00180 #define CCH_PROPSETSZ (CCH_PROPSET + 1) // allow null 00181 #define CCH_PROPSETCOLONSZ (1 + CCH_PROPSET + 1) // allow colon and null 00182 00183 // Define the max property name in units of characters 00184 // (and synonomously in wchars). 00185 00186 #define CCH_MAXPROPNAME 255 // Matches Shell & Office 00187 #define CCH_MAXPROPNAMESZ (CCH_MAXPROPNAME + 1) // allow null 00188 #define CWC_MAXPROPNAME CCH_MAXPROPNAME 00189 #define CWC_MAXPROPNAMESZ CCH_MAXPROPNAMESZ 00190 00191 #define MAX_DOCFILE_ENTRY_NAME 31 00192 00193 //+-------------------------------------------------------------------------- 00194 // Property Access APIs: 00195 //--------------------------------------------------------------------------- 00196 00197 typedef VOID *NTPROP; 00198 typedef VOID *NTMAPPEDSTREAM; 00199 typedef VOID *NTMEMORYALLOCATOR; 00200 00201 00202 VOID PROPSYSAPI PROPAPI 00203 RtlSetUnicodeCallouts( 00204 IN UNICODECALLOUTS *pUnicodeCallouts); 00205 00206 ULONG PROPSYSAPI PROPAPI 00207 RtlGuidToPropertySetName( 00208 IN GUID const *pguid, 00209 OUT OLECHAR aocname[]); 00210 00211 NTSTATUS PROPSYSAPI PROPAPI 00212 RtlPropertySetNameToGuid( 00213 IN ULONG cwcname, 00214 IN OLECHAR const aocname[], 00215 OUT GUID *pguid); 00216 00217 VOID 00218 PrSetUnicodeCallouts( 00219 IN UNICODECALLOUTS *pUnicodeCallouts); 00220 00221 ULONG 00222 PrGuidToPropertySetName( 00223 IN GUID const *pguid, 00224 OUT OLECHAR aocname[]); 00225 00226 NTSTATUS 00227 PrPropertySetNameToGuid( 00228 IN ULONG cwcname, 00229 IN OLECHAR const aocname[], 00230 OUT GUID *pguid); 00231 00232 00233 // RtlCreatePropertySet Flags: 00234 00235 #define CREATEPROP_READ 0x0000 // request read access (must exist) 00236 #define CREATEPROP_WRITE 0x0001 // request write access (must exist) 00237 #define CREATEPROP_CREATE 0x0002 // create (overwrite if exists) 00238 #define CREATEPROP_CREATEIF 0x0003 // create (open existing if exists) 00239 #define CREATEPROP_DELETE 0x0004 // delete 00240 #define CREATEPROP_MODEMASK 0x000f // open mode mask 00241 00242 #define CREATEPROP_NONSIMPLE 0x0010 // Is non-simple propset (in a storage) 00243 00244 00245 // RtlCreateMappedStream Flags: 00246 00247 #define CMS_READONLY 0x00000000 // Opened for read-only 00248 #define CMS_WRITE 0x00000001 // Opened for write access 00249 #define CMS_TRANSACTED 0x00000002 // Is transacted 00250 00251 00252 NTSTATUS PROPSYSAPI PROPAPI 00253 RtlCreatePropertySet( 00254 IN NTMAPPEDSTREAM ms, // Nt mapped stream 00255 IN USHORT Flags, // NONSIMPLE|*1* of READ/WRITE/CREATE/CREATEIF/DELETE 00256 OPTIONAL IN GUID const *pguid, // property set guid (create only) 00257 OPTIONAL IN GUID const *pclsid,// CLASSID of propset code (create only) 00258 IN NTMEMORYALLOCATOR ma, // caller's memory allocator 00259 IN ULONG LocaleId, // Locale Id (create only) 00260 OPTIONAL OUT ULONG *pOSVersion,// OS Version field in header. 00261 IN OUT USHORT *pCodePage, // IN: CodePage of property set (create only) 00262 // OUT: CodePage of property set (always) 00263 OUT NTPROP *pnp); // Nt property set context 00264 00265 NTSTATUS PROPSYSAPI PROPAPI 00266 RtlClosePropertySet( 00267 IN NTPROP np); // property set context 00268 00269 NTSTATUS 00270 PrCreatePropertySet( 00271 IN NTMAPPEDSTREAM ms, // Nt mapped stream 00272 IN USHORT Flags, // NONSIMPLE|*1* of READ/WRITE/CREATE/CREATEIF/DELETE 00273 OPTIONAL IN GUID const *pguid, // property set guid (create only) 00274 OPTIONAL IN GUID const *pclsid,// CLASSID of propset code (create only) 00275 IN NTMEMORYALLOCATOR ma, // caller's memory allocator 00276 IN ULONG LocaleId, // Locale Id (create only) 00277 OPTIONAL OUT ULONG *pOSVersion,// OS Version field in header. 00278 IN OUT USHORT *pCodePage, // IN: CodePage of property set (create only) 00279 // OUT: CodePage of property set (always) 00280 OUT NTPROP *pnp); // Nt property set context 00281 00282 NTSTATUS 00283 PrClosePropertySet( 00284 IN NTPROP np); // property set context 00285 00286 // *NOTE* RtlOnMappedStreamEvent assumes that the caller has 00287 // already taken the CPropertySetStream::Lock. 00288 #define CBSTM_UNKNOWN ((ULONG) -1) 00289 NTSTATUS PROPSYSAPI PROPAPI 00290 RtlOnMappedStreamEvent( 00291 IN VOID *pv, // property set context (NTPROP) 00292 IN VOID *pbuf, // property set buffer 00293 IN ULONG cbstm ); // size of underlying stream, or CBSTM_UNKNOWN 00294 NTSTATUS 00295 PrOnMappedStreamEvent( 00296 IN VOID *pv, // property set context (NTPROP) 00297 IN VOID *pbuf, // property set buffer 00298 IN ULONG cbstm ); // size of underlying stream, or CBSTM_UNKNOWN 00299 00300 NTSTATUS PROPSYSAPI PROPAPI 00301 RtlFlushPropertySet( 00302 IN NTPROP np); // property set context 00303 NTSTATUS 00304 PrFlushPropertySet( 00305 IN NTPROP np); // property set context 00306 00307 typedef struct _INDIRECTPROPERTY // ip 00308 { 00309 ULONG Index; // Index into Variant and PropId arrays 00310 LPOLESTR poszName; // Old indirect name, RtlSetProperties() only 00311 } INDIRECTPROPERTY; 00312 00313 NTSTATUS PROPSYSAPI PROPAPI 00314 RtlSetProperties( 00315 IN NTPROP np, // property set context 00316 IN ULONG cprop, // property count 00317 IN PROPID pidNameFirst, // first PROPID for new named properties 00318 IN PROPSPEC const aprs[], // array of property specifiers 00319 OPTIONAL OUT PROPID apid[], // buffer for array of propids 00320 OPTIONAL OUT INDIRECTPROPERTY **ppip, // pointer to returned pointer to 00321 // MAXULONG terminated array of Indirect 00322 // properties w/indexes into aprs & avar 00323 OPTIONAL IN PROPVARIANT const avar[]);// array of properties with values 00324 NTSTATUS 00325 PrSetProperties( 00326 IN NTPROP np, // property set context 00327 IN ULONG cprop, // property count 00328 IN PROPID pidNameFirst, // first PROPID for new named properties 00329 IN PROPSPEC const aprs[], // array of property specifiers 00330 OPTIONAL OUT PROPID apid[], // buffer for array of propids 00331 OPTIONAL OUT INDIRECTPROPERTY **ppip, // pointer to returned pointer to 00332 // MAXULONG terminated array of Indirect 00333 // properties w/indexes into aprs & avar 00334 OPTIONAL IN PROPVARIANT const avar[]);// array of properties with values 00335 00336 NTSTATUS PROPSYSAPI PROPAPI 00337 RtlQueryProperties( 00338 IN NTPROP np, // property set context 00339 IN ULONG cprop, // property count 00340 IN PROPSPEC const aprs[], // array of property specifiers 00341 OPTIONAL OUT PROPID apid[], // buffer for array of propids 00342 OPTIONAL OUT INDIRECTPROPERTY **ppip, // pointer to returned pointer to 00343 // MAXULONG terminated array of Indirect 00344 // properties w/indexes into aprs & avar 00345 IN OUT PROPVARIANT *avar, // IN: array of uninitialized PROPVARIANTs, 00346 // OUT: may contain pointers to alloc'd memory 00347 OUT ULONG *pcpropFound); // count of property values retrieved 00348 NTSTATUS 00349 PrQueryProperties( 00350 IN NTPROP np, // property set context 00351 IN ULONG cprop, // property count 00352 IN PROPSPEC const aprs[], // array of property specifiers 00353 OPTIONAL OUT PROPID apid[], // buffer for array of propids 00354 OPTIONAL OUT INDIRECTPROPERTY **ppip, // pointer to returned pointer to 00355 // MAXULONG terminated array of Indirect 00356 // properties w/indexes into aprs & avar 00357 IN OUT PROPVARIANT *avar, // IN: array of uninitialized PROPVARIANTs, 00358 // OUT: may contain pointers to alloc'd memory 00359 OUT ULONG *pcpropFound); // count of property values retrieved 00360 00361 00362 00363 #define ENUMPROP_NONAMES 0x00000001 // return property IDs only 00364 00365 NTSTATUS PROPSYSAPI PROPAPI 00366 RtlEnumerateProperties( 00367 IN NTPROP np, // property set context 00368 IN ULONG Flags, // flags: No Names (propids only), etc. 00369 IN OUT ULONG *pkey, // bookmark; caller set to 0 before 1st call 00370 IN OUT ULONG *pcprop, // pointer to property count 00371 OPTIONAL OUT PROPSPEC aprs[],// IN: array of uninitialized PROPSPECs 00372 // OUT: may contain pointers to alloc'd strings 00373 OPTIONAL OUT STATPROPSTG asps[]); 00374 // IN: array of uninitialized STATPROPSTGs 00375 // OUT: may contain pointers to alloc'd strings 00376 00377 NTSTATUS PROPSYSAPI PROPAPI 00378 RtlQueryPropertyNames( 00379 IN NTPROP np, // property set context 00380 IN ULONG cprop, // property count 00381 IN PROPID const *apid, // PROPID array 00382 OUT OLECHAR *aposz[] // OUT pointers to allocated strings 00383 ); 00384 00385 NTSTATUS PROPSYSAPI PROPAPI 00386 RtlSetPropertyNames( 00387 IN NTPROP np, // property set context 00388 IN ULONG cprop, // property count 00389 IN PROPID const *apid, // PROPID array 00390 IN OLECHAR const * const aposz[] // pointers to property names 00391 ); 00392 00393 NTSTATUS PROPSYSAPI PROPAPI 00394 RtlSetPropertySetClassId( 00395 IN NTPROP np, // property set context 00396 IN GUID const *pclsid // new CLASSID of propset code 00397 ); 00398 00399 NTSTATUS PROPSYSAPI PROPAPI 00400 RtlQueryPropertySet( 00401 IN NTPROP np, // property set context 00402 OUT STATPROPSETSTG *pspss // buffer for property set stat information 00403 ); 00404 00405 NTSTATUS PROPSYSAPI PROPAPI 00406 RtlEnumeratePropertySets( 00407 IN HANDLE hstg, // structured storage handle 00408 IN BOOLEAN fRestart, // restart scan 00409 IN OUT ULONG *pcspss, // pointer to count of STATPROPSETSTGs 00410 IN OUT GUID *pkey, // bookmark 00411 OUT STATPROPSETSTG *pspss // array of STATPROPSETSTGs 00412 ); 00413 00414 00415 00416 00417 00418 NTSTATUS 00419 PrEnumerateProperties( 00420 IN NTPROP np, // property set context 00421 IN ULONG Flags, // flags: No Names (propids only), etc. 00422 IN OUT ULONG *pkey, // bookmark; caller set to 0 before 1st call 00423 IN OUT ULONG *pcprop, // pointer to property count 00424 OPTIONAL OUT PROPSPEC aprs[],// IN: array of uninitialized PROPSPECs 00425 // OUT: may contain pointers to alloc'd strings 00426 OPTIONAL OUT STATPROPSTG asps[]); 00427 // IN: array of uninitialized STATPROPSTGs 00428 // OUT: may contain pointers to alloc'd strings 00429 00430 NTSTATUS 00431 PrQueryPropertyNames( 00432 IN NTPROP np, // property set context 00433 IN ULONG cprop, // property count 00434 IN PROPID const *apid, // PROPID array 00435 OUT OLECHAR *aposz[] // OUT pointers to allocated strings 00436 ); 00437 00438 NTSTATUS 00439 PrSetPropertyNames( 00440 IN NTPROP np, // property set context 00441 IN ULONG cprop, // property count 00442 IN PROPID const *apid, // PROPID array 00443 IN OLECHAR const * const aposz[] // pointers to property names 00444 ); 00445 00446 NTSTATUS 00447 PrSetPropertySetClassId( 00448 IN NTPROP np, // property set context 00449 IN GUID const *pclsid // new CLASSID of propset code 00450 ); 00451 00452 NTSTATUS 00453 PrQueryPropertySet( 00454 IN NTPROP np, // property set context 00455 OUT STATPROPSETSTG *pspss // buffer for property set stat information 00456 ); 00457 00458 NTSTATUS 00459 PrEnumeratePropertySets( 00460 IN HANDLE hstg, // structured storage handle 00461 IN BOOLEAN fRestart, // restart scan 00462 IN OUT ULONG *pcspss, // pointer to count of STATPROPSETSTGs 00463 IN OUT GUID *pkey, // bookmark 00464 OUT STATPROPSETSTG *pspss // array of STATPROPSETSTGs 00465 ); 00466 00467 00468 00469 #ifdef __cplusplus 00470 } 00471 #endif 00472 00473 #endif // ifndef _PROPAPI_H_

Generated on Sat May 15 19:41:30 2004 for test by doxygen 1.3.7