Changeset 91 for pjproject/branches/pjproject-0.2/pjlib/src/pj/guid.c
- Timestamp:
- Dec 2, 2005 10:28:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/pjproject-0.2/pjlib/src/pj/guid.c
r88 r91 1 /* $Header: / pjproject/pjlib/src/pj/guid.c 9 6/14/05 2:15p Bennylp $ */1 /* $Header: /cvs/pjproject-0.2.9.3/pjlib/src/pj/guid.c,v 1.1 2005/12/02 20:02:29 nn Exp $ */ 2 2 /* 3 3 * PJLIB - PJ Foundation Library … … 40 40 #ifndef PJ_GUID_TYPE 41 41 # define PJ_GUID_TYPE PJ_GUID_SIMPLE 42 #endif 43 44 #if defined(PJ_WIN32_WINCE) && PJ_GUID_TYPE==PJ_GUID_COCREATEGUID 45 #include <windows.h> 46 #include <winsock2.h> 47 #include <wincrypt.h> 42 48 #endif 43 49 … … 272 278 { 273 279 GUID guid; 280 #if !defined(PJ_WIN32_WINCE) 274 281 CoCreateGuid(&guid); 282 #else 283 char bits[16]; 284 HCRYPTPROV hCryptProv = 0; 285 286 if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { 287 return NULL; 288 } 289 290 if (!CryptGenRandom(hCryptProv, 16, bits)) { 291 return NULL; 292 } 293 294 // set the variant 295 bits[8] &= 0x3f; 296 bits[8] |= 2 << 6; 297 298 // set the version 299 bits[7] &= 0x0f; 300 bits[7] |= 4 << 4; 301 302 if (hCryptProv != 0) 303 CryptReleaseContext(hCryptProv, 0); 304 305 pj_memcpy(&guid, bits, 16); 306 #endif // WINCE 307 275 308 pj_guid_to_str( &guid, str ); 276 309 return str;
Note: See TracChangeset
for help on using the changeset viewer.