1 /* 2 * Copyright 2005 Juan Lang 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #ifndef __CRYPT32_PRIVATE_H__ 20 #define __CRYPT32_PRIVATE_H__ 21 22 #include "wine/list.h" 23 24 /* a few asn.1 tags we need */ 25 #define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01) 26 #define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03) 27 #define ASN_ENUMERATED (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0a) 28 #define ASN_UTF8STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x0c) 29 #define ASN_SETOF (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x11) 30 #define ASN_NUMERICSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x12) 31 #define ASN_PRINTABLESTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x13) 32 #define ASN_T61STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x14) 33 #define ASN_VIDEOTEXSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x15) 34 #define ASN_IA5STRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x16) 35 #define ASN_UTCTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17) 36 #define ASN_GENERALTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18) 37 #define ASN_GRAPHICSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x19) 38 #define ASN_VISIBLESTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1a) 39 #define ASN_GENERALSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1b) 40 #define ASN_UNIVERSALSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1c) 41 #define ASN_BMPSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e) 42 43 BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 44 45 typedef BOOL (WINAPI *CryptEncodeObjectExFunc)(DWORD, LPCSTR, const void *, 46 DWORD, PCRYPT_ENCODE_PARA, BYTE *, DWORD *); 47 48 struct AsnEncodeSequenceItem 49 { 50 const void *pvStructInfo; 51 CryptEncodeObjectExFunc encodeFunc; 52 DWORD size; /* used during encoding, not for your use */ 53 }; 54 55 BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType, 56 struct AsnEncodeSequenceItem items[], DWORD cItem, DWORD dwFlags, 57 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 58 59 struct AsnConstructedItem 60 { 61 BYTE tag; 62 const void *pvStructInfo; 63 CryptEncodeObjectExFunc encodeFunc; 64 }; 65 66 BOOL WINAPI CRYPT_AsnEncodeConstructed(DWORD dwCertEncodingType, 67 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, 68 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 69 BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, 70 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, 71 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 72 BOOL WINAPI CRYPT_AsnEncodeOctets(DWORD dwCertEncodingType, 73 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, 74 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 75 76 typedef struct _CRYPT_DIGESTED_DATA 77 { 78 DWORD version; 79 CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; 80 CRYPT_CONTENT_INFO ContentInfo; 81 CRYPT_HASH_BLOB hash; 82 } CRYPT_DIGESTED_DATA; 83 84 BOOL CRYPT_AsnEncodePKCSDigestedData(const CRYPT_DIGESTED_DATA *digestedData, 85 void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN; 86 87 typedef struct _CRYPT_ENCRYPTED_CONTENT_INFO 88 { 89 LPSTR contentType; 90 CRYPT_ALGORITHM_IDENTIFIER contentEncryptionAlgorithm; 91 CRYPT_DATA_BLOB encryptedContent; 92 } CRYPT_ENCRYPTED_CONTENT_INFO; 93 94 typedef struct _CRYPT_ENVELOPED_DATA 95 { 96 DWORD version; 97 DWORD cRecipientInfo; 98 PCMSG_KEY_TRANS_RECIPIENT_INFO rgRecipientInfo; 99 CRYPT_ENCRYPTED_CONTENT_INFO encryptedContentInfo; 100 } CRYPT_ENVELOPED_DATA; 101 102 BOOL CRYPT_AsnEncodePKCSEnvelopedData(const CRYPT_ENVELOPED_DATA *envelopedData, 103 void *pvData, DWORD *pcbData) DECLSPEC_HIDDEN; 104 105 BOOL CRYPT_AsnDecodePKCSEnvelopedData(const BYTE *pbEncoded, DWORD cbEncoded, 106 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, 107 CRYPT_ENVELOPED_DATA *envelopedData, DWORD *pcbEnvelopedData) DECLSPEC_HIDDEN; 108 109 typedef struct _CRYPT_SIGNED_INFO 110 { 111 DWORD version; 112 DWORD cCertEncoded; 113 PCERT_BLOB rgCertEncoded; 114 DWORD cCrlEncoded; 115 PCRL_BLOB rgCrlEncoded; 116 CRYPT_CONTENT_INFO content; 117 DWORD cSignerInfo; 118 PCMSG_CMS_SIGNER_INFO rgSignerInfo; 119 PDWORD signerKeySpec; 120 } CRYPT_SIGNED_INFO; 121 122 BOOL CRYPT_AsnEncodeCMSSignedInfo(CRYPT_SIGNED_INFO *, void *pvData, 123 DWORD *pcbData) DECLSPEC_HIDDEN; 124 125 BOOL CRYPT_AsnDecodeCMSSignedInfo(const BYTE *pbEncoded, DWORD cbEncoded, 126 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, 127 CRYPT_SIGNED_INFO *signedInfo, DWORD *pcbSignedInfo) DECLSPEC_HIDDEN; 128 129 /* Helper function to check *pcbEncoded, set it to the required size, and 130 * optionally to allocate memory. Assumes pbEncoded is not NULL. 131 * If CRYPT_ENCODE_ALLOC_FLAG is set in dwFlags, *pbEncoded will be set to a 132 * pointer to the newly allocated memory. 133 */ 134 BOOL CRYPT_EncodeEnsureSpace(DWORD dwFlags, const CRYPT_ENCODE_PARA *pEncodePara, 135 BYTE *pbEncoded, DWORD *pcbEncoded, DWORD bytesNeeded) DECLSPEC_HIDDEN; 136 137 BOOL CRYPT_AsnDecodePKCSDigestedData(const BYTE *pbEncoded, DWORD cbEncoded, 138 DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, 139 CRYPT_DIGESTED_DATA *digestedData, DWORD *pcbDigestedData) DECLSPEC_HIDDEN; 140 141 BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD dwCertEncodingType, 142 LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, 143 PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) DECLSPEC_HIDDEN; 144 145 /* The following aren't defined in wincrypt.h, as they're "reserved" */ 146 #define CERT_CERT_PROP_ID 32 147 #define CERT_CRL_PROP_ID 33 148 #define CERT_CTL_PROP_ID 34 149 150 /* Returns a handle to the default crypto provider; loads it if necessary. 151 * Returns NULL on failure. 152 */ 153 HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(ALG_ID); 154 155 extern HINSTANCE hInstance DECLSPEC_HIDDEN; 156 157 void crypt_oid_init(void) DECLSPEC_HIDDEN; 158 void crypt_oid_free(void) DECLSPEC_HIDDEN; 159 void crypt_sip_free(void) DECLSPEC_HIDDEN; 160 void root_store_free(void) DECLSPEC_HIDDEN; 161 void default_chain_engine_free(void) DECLSPEC_HIDDEN; 162 163 /* (Internal) certificate store types and functions */ 164 struct WINE_CRYPTCERTSTORE; 165 166 typedef struct _CONTEXT_PROPERTY_LIST CONTEXT_PROPERTY_LIST; 167 168 typedef struct _context_t context_t; 169 170 typedef struct { 171 void (*free)(context_t*); 172 struct _context_t *(*clone)(context_t*,struct WINE_CRYPTCERTSTORE*,BOOL); 173 } context_vtbl_t; 174 175 struct _context_t { 176 const context_vtbl_t *vtbl; 177 LONG ref; 178 struct WINE_CRYPTCERTSTORE *store; 179 struct _context_t *linked; 180 CONTEXT_PROPERTY_LIST *properties; 181 union { 182 struct list entry; 183 void *ptr; 184 } u; 185 }; 186 187 static inline context_t *context_from_ptr(const void *ptr) 188 { 189 return (context_t*)ptr-1; 190 } 191 192 static inline void *context_ptr(context_t *context) 193 { 194 return context+1; 195 } 196 197 typedef struct { 198 context_t base; 199 CERT_CONTEXT ctx; 200 } cert_t; 201 202 static inline cert_t *cert_from_ptr(const CERT_CONTEXT *ptr) 203 { 204 return CONTAINING_RECORD(ptr, cert_t, ctx); 205 } 206 207 typedef struct { 208 context_t base; 209 CRL_CONTEXT ctx; 210 } crl_t; 211 212 static inline crl_t *crl_from_ptr(const CRL_CONTEXT *ptr) 213 { 214 return CONTAINING_RECORD(ptr, crl_t, ctx); 215 } 216 217 typedef struct { 218 context_t base; 219 CTL_CONTEXT ctx; 220 } ctl_t; 221 222 static inline ctl_t *ctl_from_ptr(const CTL_CONTEXT *ptr) 223 { 224 return CONTAINING_RECORD(ptr, ctl_t, ctx); 225 } 226 227 /* Some typedefs that make it easier to abstract which type of context we're 228 * working with. 229 */ 230 typedef const void *(WINAPI *CreateContextFunc)(DWORD dwCertEncodingType, 231 const BYTE *pbCertEncoded, DWORD cbCertEncoded); 232 typedef BOOL (WINAPI *AddContextToStoreFunc)(HCERTSTORE hCertStore, 233 const void *context, DWORD dwAddDisposition, const void **ppStoreContext); 234 typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore, 235 DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, 236 DWORD dwAddDisposition, const void **ppContext); 237 typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore, 238 const void *pPrevContext); 239 typedef DWORD (WINAPI *EnumPropertiesFunc)(const void *context, DWORD dwPropId); 240 typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context, 241 DWORD dwPropID, void *pvData, DWORD *pcbData); 242 typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, 243 DWORD dwPropID, DWORD dwFlags, const void *pvData); 244 typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags, 245 BYTE *pbElement, DWORD *pcbElement); 246 typedef BOOL (WINAPI *DeleteContextFunc)(const void *contex); 247 248 /* An abstract context (certificate, CRL, or CTL) interface */ 249 typedef struct _WINE_CONTEXT_INTERFACE 250 { 251 CreateContextFunc create; 252 AddContextToStoreFunc addContextToStore; 253 AddEncodedContextToStoreFunc addEncodedToStore; 254 EnumContextsInStoreFunc enumContextsInStore; 255 EnumPropertiesFunc enumProps; 256 GetContextPropertyFunc getProp; 257 SetContextPropertyFunc setProp; 258 SerializeElementFunc serialize; 259 DeleteContextFunc deleteFromStore; 260 } WINE_CONTEXT_INTERFACE; 261 262 extern const WINE_CONTEXT_INTERFACE *pCertInterface DECLSPEC_HIDDEN; 263 extern const WINE_CONTEXT_INTERFACE *pCRLInterface DECLSPEC_HIDDEN; 264 extern const WINE_CONTEXT_INTERFACE *pCTLInterface DECLSPEC_HIDDEN; 265 266 typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv, 267 DWORD dwFlags, const void *pvPara); 268 269 typedef struct _CONTEXT_FUNCS 270 { 271 /* Called to add a context to a store. If toReplace is not NULL, 272 * context replaces toReplace in the store, and access checks should not be 273 * performed. Otherwise context is a new context, and it should only be 274 * added if the store allows it. If ppStoreContext is not NULL, the added 275 * context should be returned in *ppStoreContext. 276 */ 277 BOOL (*addContext)(struct WINE_CRYPTCERTSTORE*,context_t*,context_t*,context_t**,BOOL); 278 context_t *(*enumContext)(struct WINE_CRYPTCERTSTORE *store, context_t *prev); 279 BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*); 280 } CONTEXT_FUNCS; 281 282 typedef enum _CertStoreType { 283 StoreTypeMem, 284 StoreTypeCollection, 285 StoreTypeProvider, 286 StoreTypeEmpty 287 } CertStoreType; 288 289 #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563 290 291 /* A cert store is polymorphic through the use of function pointers. A type 292 * is still needed to distinguish collection stores from other types. 293 * On the function pointers: 294 * - closeStore is called when the store's ref count becomes 0 295 * - control is optional, but should be implemented by any store that supports 296 * persistence 297 */ 298 299 typedef struct { 300 void (*addref)(struct WINE_CRYPTCERTSTORE*); 301 DWORD (*release)(struct WINE_CRYPTCERTSTORE*,DWORD); 302 void (*releaseContext)(struct WINE_CRYPTCERTSTORE*,context_t*); 303 BOOL (*control)(struct WINE_CRYPTCERTSTORE*,DWORD,DWORD,void const*); 304 CONTEXT_FUNCS certs; 305 CONTEXT_FUNCS crls; 306 CONTEXT_FUNCS ctls; 307 } store_vtbl_t; 308 309 typedef struct WINE_CRYPTCERTSTORE 310 { 311 DWORD dwMagic; 312 LONG ref; 313 DWORD dwOpenFlags; 314 CertStoreType type; 315 const store_vtbl_t *vtbl; 316 CONTEXT_PROPERTY_LIST *properties; 317 } WINECRYPT_CERTSTORE; 318 319 void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, 320 CertStoreType type, const store_vtbl_t*) DECLSPEC_HIDDEN; 321 void CRYPT_FreeStore(WINECRYPT_CERTSTORE *store) DECLSPEC_HIDDEN; 322 BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, 323 DWORD unk1) DECLSPEC_HIDDEN; 324 325 WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, 326 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; 327 WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags, 328 WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN; 329 WINECRYPT_CERTSTORE *CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider, 330 DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, 331 const void *pvPara) DECLSPEC_HIDDEN; 332 WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, 333 const void *pvPara) DECLSPEC_HIDDEN; 334 WINECRYPT_CERTSTORE *CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, 335 const void *pvPara) DECLSPEC_HIDDEN; 336 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv, 337 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; 338 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, 339 DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; 340 341 void CRYPT_ImportSystemRootCertsToReg(void) DECLSPEC_HIDDEN; 342 BOOL CRYPT_SerializeContextsToReg(HKEY key, DWORD flags, const WINE_CONTEXT_INTERFACE *contextInterface, 343 HCERTSTORE memStore) DECLSPEC_HIDDEN; 344 345 DWORD CRYPT_IsCertificateSelfSigned(const CERT_CONTEXT *cert) DECLSPEC_HIDDEN; 346 347 /* Allocates and initializes a certificate chain engine, but without creating 348 * the root store. Instead, it uses root, and assumes the caller has done any 349 * checking necessary. 350 */ 351 HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG*) DECLSPEC_HIDDEN; 352 353 /* Helper function for store reading functions and 354 * CertAddSerializedElementToStore. Returns a context of the appropriate type 355 * if it can, or NULL otherwise. Doesn't validate any of the properties in 356 * the serialized context (for example, bad hashes are retained.) 357 * *pdwContentType is set to the type of the returned context. 358 */ 359 const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, 360 DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType) DECLSPEC_HIDDEN; 361 362 /* Reads contexts serialized in the file into the memory store. Returns FALSE 363 * if the file is not of the expected format. 364 */ 365 BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store) DECLSPEC_HIDDEN; 366 367 /* Reads contexts serialized in the blob into the memory store. Returns FALSE 368 * if the file is not of the expected format. 369 */ 370 BOOL CRYPT_ReadSerializedStoreFromBlob(const CRYPT_DATA_BLOB *blob, 371 HCERTSTORE store) DECLSPEC_HIDDEN; 372 373 /* Fixes up the pointers in info, where info is assumed to be a 374 * CRYPT_KEY_PROV_INFO, followed by its container name, provider name, and any 375 * provider parameters, in a contiguous buffer, but where info's pointers are 376 * assumed to be invalid. Upon return, info's pointers point to the 377 * appropriate memory locations. 378 */ 379 void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info) DECLSPEC_HIDDEN; 380 381 /** 382 * String functions 383 */ 384 385 DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indent, 386 const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz) DECLSPEC_HIDDEN; 387 388 /** 389 * Context functions 390 */ 391 392 /* Allocates a new data context, a context which owns properties directly. 393 * contextSize is the size of the public data type associated with context, 394 * which should be one of CERT_CONTEXT, CRL_CONTEXT, or CTL_CONTEXT. 395 * Free with Context_Release. 396 */ 397 context_t *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN; 398 399 /* Creates a new link context. The context refers to linked 400 * rather than owning its own properties. If addRef is TRUE (which ordinarily 401 * it should be) linked is addref'd. 402 * Free with Context_Release. 403 */ 404 context_t *Context_CreateLinkContext(unsigned contextSize, context_t *linked, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN; 405 406 /* Copies properties from fromContext to toContext. */ 407 void Context_CopyProperties(const void *to, const void *from) DECLSPEC_HIDDEN; 408 409 void Context_AddRef(context_t*) DECLSPEC_HIDDEN; 410 void Context_Release(context_t *context) DECLSPEC_HIDDEN; 411 void Context_Free(context_t*) DECLSPEC_HIDDEN; 412 413 /** 414 * Context property list functions 415 */ 416 417 CONTEXT_PROPERTY_LIST *ContextPropertyList_Create(void) DECLSPEC_HIDDEN; 418 419 /* Searches for the property with ID id in the context. Returns TRUE if found, 420 * and copies the property's length and a pointer to its data to blob. 421 * Otherwise returns FALSE. 422 */ 423 BOOL ContextPropertyList_FindProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, 424 PCRYPT_DATA_BLOB blob) DECLSPEC_HIDDEN; 425 426 BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, 427 const BYTE *pbData, size_t cbData) DECLSPEC_HIDDEN; 428 429 void ContextPropertyList_RemoveProperty(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN; 430 431 DWORD ContextPropertyList_EnumPropIDs(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN; 432 433 void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to, 434 CONTEXT_PROPERTY_LIST *from) DECLSPEC_HIDDEN; 435 436 void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; 437 438 extern WINECRYPT_CERTSTORE empty_store DECLSPEC_HIDDEN; 439 void init_empty_store(void) DECLSPEC_HIDDEN; 440 441 /** 442 * Utilities. 443 */ 444 445 /* Align up to a DWORD_PTR boundary 446 */ 447 #define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1)) 448 #define POINTER_ALIGN_DWORD_PTR(p) ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p))) 449 450 /* Check if the OID is a small int 451 */ 452 #define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0) 453 454 #endif 455