Changeset 9741 in vbox
- Timestamp:
- Jun 16, 2008 10:46:46 PM (16 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r9723 r9741 287 287 r3/win/utf8-win.cpp \ 288 288 r3/win/uuid-win.cpp \ 289 r3/win/RTUuidCreate-win.cpp \ 289 290 win/errmsgwin.cpp \ 290 291 win/RTErrConvertFromWin32.cpp … … 301 302 generic/RTTimeLocalNow-generic.cpp \ 302 303 generic/RTTimerCreate-generic.cpp \ 304 generic/RTUuidCreate-generic.cpp \ 303 305 generic/utf16locale-generic.cpp \ 304 306 generic/uuid-generic.cpp \ … … 348 350 generic/RTTimeLocalNow-generic.cpp \ 349 351 generic/RTTimerCreate-generic.cpp \ 352 generic/RTUuidCreate-generic.cpp \ 350 353 generic/semnoint-generic.cpp \ 351 354 generic/semsrw-generic.cpp \ … … 385 388 generic/RTTimeLocalNow-generic.cpp \ 386 389 generic/RTTimerCreate-generic.cpp \ 390 generic/RTUuidCreate-generic.cpp \ 387 391 generic/sched-generic.cpp \ 388 392 generic/timer-generic.cpp \ … … 420 424 generic/RTTimeLocalNow-generic.cpp \ 421 425 generic/RTTimerCreate-generic.cpp \ 426 generic/RTUuidCreate-generic.cpp \ 422 427 generic/sched-generic.cpp \ 423 428 generic/utf16locale-generic.cpp \ … … 455 460 generic/RTTimeLocalNow-generic.cpp \ 456 461 generic/RTTimerCreate-generic.cpp \ 462 generic/RTUuidCreate-generic.cpp \ 457 463 generic/sched-generic.cpp \ 458 464 generic/utf16locale-generic.cpp \ … … 505 511 generic/RTLogWriteDebugger-generic.cpp \ 506 512 generic/RTTimeLocalNow-generic.cpp \ 513 generic/RTUuidCreate-generic.cpp \ 507 514 generic/sched-generic.cpp \ 508 515 generic/semnoint-generic.cpp \ -
trunk/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp
r9738 r9741 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - UUID, Generic .3 * IPRT - UUID, Generic RTUuidCreate implementation. 4 4 */ 5 5 … … 36 36 #include <iprt/assert.h> 37 37 #include <iprt/err.h> 38 #include <iprt/time.h>39 #include <iprt/asm.h>40 38 #include <iprt/rand.h> 41 39 42 40 43 /* WARNING: This implementation ASSUMES little endian. */41 /* WARNING: This implementation ASSUMES little endian. Needs testing on big endian! */ 44 42 45 43 … … 57 55 } 58 56 59 60 RTDECL(int) RTUuidClear(PRTUUID pUuid)61 {62 AssertPtrReturn(pUuid, VERR_INVALID_PARAMETER);63 pUuid->au64[0] = 0;64 pUuid->au64[1] = 0;65 return VINF_SUCCESS;66 }67 68 69 RTDECL(bool) RTUuidIsNull(PCRTUUID pUuid)70 {71 AssertPtrReturn(pUuid, VERR_INVALID_PARAMETER);72 return !pUuid->au64[0]73 && !pUuid->au64[1];74 }75 76 77 RTDECL(int) RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2)78 {79 /*80 * Special cases.81 */82 /** @todo This differs in the windows implementation... check out which behavior we really want. */83 if (pUuid1 == pUuid2)84 return 0;85 if (!pUuid1)86 return RTUuidIsNull(pUuid2) ? 0 : -1;87 if (!pUuid2)88 return RTUuidIsNull(pUuid1) ? 0 : 1;89 AssertPtr(pUuid1);90 AssertPtr(pUuid2);91 92 /*93 * Standard cases.94 */95 if (pUuid1->Gen.u32TimeLow != pUuid2->Gen.u32TimeLow)96 return pUuid1->Gen.u32TimeLow < pUuid2->Gen.u32TimeLow ? -1 : 1;97 if (pUuid1->Gen.u16TimeMid != pUuid2->Gen.u16TimeMid)98 return pUuid1->Gen.u16TimeMid < pUuid2->Gen.u16TimeMid ? -1 : 1;99 if (pUuid1->Gen.u16TimeHiAndVersion != pUuid2->Gen.u16TimeHiAndVersion)100 return pUuid1->Gen.u16TimeHiAndVersion < pUuid2->Gen.u16TimeHiAndVersion ? -1 : 1;101 if (pUuid1->Gen.u16ClockSeq != pUuid2->Gen.u16ClockSeq)102 return pUuid1->Gen.u16ClockSeq < pUuid2->Gen.u16ClockSeq ? -1 : 1;103 if (pUuid1->Gen.au8Node[0] != pUuid2->Gen.au8Node[0])104 return pUuid1->Gen.au8Node[0] < pUuid2->Gen.au8Node[0] ? -1 : 1;105 if (pUuid1->Gen.au8Node[1] != pUuid2->Gen.au8Node[1])106 return pUuid1->Gen.au8Node[1] < pUuid2->Gen.au8Node[1] ? -1 : 1;107 if (pUuid1->Gen.au8Node[2] != pUuid2->Gen.au8Node[2])108 return pUuid1->Gen.au8Node[2] < pUuid2->Gen.au8Node[2] ? -1 : 1;109 if (pUuid1->Gen.au8Node[3] != pUuid2->Gen.au8Node[3])110 return pUuid1->Gen.au8Node[3] < pUuid2->Gen.au8Node[3] ? -1 : 1;111 if (pUuid1->Gen.au8Node[4] != pUuid2->Gen.au8Node[4])112 return pUuid1->Gen.au8Node[4] < pUuid2->Gen.au8Node[4] ? -1 : 1;113 if (pUuid1->Gen.au8Node[5] != pUuid2->Gen.au8Node[5])114 return pUuid1->Gen.au8Node[5] < pUuid2->Gen.au8Node[5] ? -1 : 1;115 return 0;116 }117 118 119 RTDECL(int) RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString)120 {121 /* check params */122 AssertPtrReturn(pUuid1, -1);123 AssertPtrReturn(pszString, 1);124 125 /*126 * Try convert the string to a UUID and then compare the two.127 */128 RTUUID Uuid2;129 int rc = RTUuidFromStr(&Uuid2, pszString);130 AssertRCReturn(rc, 1);131 132 return RTUuidCompare(pUuid1, &Uuid2);133 }134 135 136 RTDECL(int) RTUuidToStr(PCRTUUID pUuid, char *pszString, size_t cchString)137 {138 /* validate parameters */139 AssertPtrReturn(pUuid, VERR_INVALID_PARAMETER);140 AssertPtrReturn(pszString, VERR_INVALID_PARAMETER);141 AssertReturn(cchString >= RTUUID_STR_LENGTH, VERR_INVALID_PARAMETER);142 143 /*144 * RTStrPrintf(,,"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",145 * pUuid->Gen.u32TimeLow,146 * pUuid->Gen.u16TimeMin,147 * pUuid->Gen.u16TimeHiAndVersion,148 * pUuid->Gen.u16ClockSeq & 0xff,149 * pUuid->Gen.u16ClockSeq >> 8,150 * pUuid->Gen.au8Node[0],151 * pUuid->Gen.au8Node[1],152 * pUuid->Gen.au8Node[2],153 * pUuid->Gen.au8Node[3],154 * pUuid->Gen.au8Node[4],155 * pUuid->Gen.au8Node[5]);156 */157 static const char s_achDigits[17] = "0123456789abcdef";158 uint32_t u32TimeLow = pUuid->Gen.u32TimeLow;159 pszString[ 0] = s_achDigits[(u32TimeLow >> 28)/*& 0xf*/];160 pszString[ 1] = s_achDigits[(u32TimeLow >> 24) & 0xf];161 pszString[ 2] = s_achDigits[(u32TimeLow >> 20) & 0xf];162 pszString[ 3] = s_achDigits[(u32TimeLow >> 16) & 0xf];163 pszString[ 4] = s_achDigits[(u32TimeLow >> 12) & 0xf];164 pszString[ 5] = s_achDigits[(u32TimeLow >> 8) & 0xf];165 pszString[ 6] = s_achDigits[(u32TimeLow >> 4) & 0xf];166 pszString[ 7] = s_achDigits[(u32TimeLow/*>>0*/)& 0xf];167 pszString[ 8] = '-';168 unsigned u = pUuid->Gen.u16TimeMid;169 pszString[ 9] = s_achDigits[(u >> 12)/*& 0xf*/];170 pszString[10] = s_achDigits[(u >> 8) & 0xf];171 pszString[11] = s_achDigits[(u >> 4) & 0xf];172 pszString[12] = s_achDigits[(u/*>>0*/)& 0xf];173 pszString[13] = '-';174 u = pUuid->Gen.u16TimeHiAndVersion;175 pszString[14] = s_achDigits[(u >> 12)/*& 0xf*/];176 pszString[15] = s_achDigits[(u >> 8) & 0xf];177 pszString[16] = s_achDigits[(u >> 4) & 0xf];178 pszString[17] = s_achDigits[(u/*>>0*/)& 0xf];179 pszString[18] = '-';180 u = pUuid->Gen.u16ClockSeq;181 pszString[19] = s_achDigits[(u >> 4) & 0xf];182 pszString[20] = s_achDigits[(u/*>>0*/)& 0xf];183 pszString[21] = s_achDigits[(u >> 12)/*& 0xf*/];184 pszString[22] = s_achDigits[(u >> 8) & 0xf];185 pszString[23] = '-';186 pszString[24] = s_achDigits[pUuid->Gen.au8Node[0] >> 4];187 pszString[25] = s_achDigits[pUuid->Gen.au8Node[0] & 0xf];188 pszString[26] = s_achDigits[pUuid->Gen.au8Node[1] >> 4];189 pszString[27] = s_achDigits[pUuid->Gen.au8Node[1] & 0xf];190 pszString[28] = s_achDigits[pUuid->Gen.au8Node[2] >> 4];191 pszString[29] = s_achDigits[pUuid->Gen.au8Node[2] & 0xf];192 pszString[30] = s_achDigits[pUuid->Gen.au8Node[3] >> 4];193 pszString[31] = s_achDigits[pUuid->Gen.au8Node[3] & 0xf];194 pszString[32] = s_achDigits[pUuid->Gen.au8Node[4] >> 4];195 pszString[33] = s_achDigits[pUuid->Gen.au8Node[4] & 0xf];196 pszString[34] = s_achDigits[pUuid->Gen.au8Node[5] >> 4];197 pszString[35] = s_achDigits[pUuid->Gen.au8Node[5] & 0xf];198 pszString[36] = '\0';199 200 return VINF_SUCCESS;201 }202 203 204 RTDECL(int) RTUuidFromStr(PRTUUID pUuid, const char *pszString)205 {206 /* 0xff if not a hex number, otherwise the value. (Assumes UTF-8 encoded strings.) */207 static const uint8_t s_aDigits[256] =208 {209 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 0..0f */210 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 10..1f */211 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 20..2f */212 0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, 0x08,0x09,0xff,0xff, 0xff,0xff,0xff,0xff, /* 30..3f */213 0xff,0x0a,0x0b,0x0c, 0x0d,0x0e,0x0f,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 40..4f */214 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 50..5f */215 0xff,0x0a,0x0b,0x0c, 0x0d,0x0e,0x0f,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 60..6f */216 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 70..7f */217 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 80..8f */218 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* 90..9f */219 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* a0..af */220 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* b0..bf */221 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* c0..cf */222 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* d0..df */223 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* e0..ef */224 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, /* f0..ff */225 };226 227 /*228 * Validate parameters.229 */230 AssertPtrReturn(pUuid, VERR_INVALID_PARAMETER);231 AssertPtrReturn(pszString, VERR_INVALID_PARAMETER);232 233 #define MY_CHECK(expr) do { if (RT_UNLIKELY(!(expr))) return VERR_INVALID_UUID_FORMAT; } while (0)234 #define MY_ISXDIGIT(ch) (s_aDigits[(ch) & 0xff] != 0xff)235 MY_CHECK(MY_ISXDIGIT(pszString[ 0]));236 MY_CHECK(MY_ISXDIGIT(pszString[ 1]));237 MY_CHECK(MY_ISXDIGIT(pszString[ 2]));238 MY_CHECK(MY_ISXDIGIT(pszString[ 3]));239 MY_CHECK(MY_ISXDIGIT(pszString[ 4]));240 MY_CHECK(MY_ISXDIGIT(pszString[ 5]));241 MY_CHECK(MY_ISXDIGIT(pszString[ 6]));242 MY_CHECK(MY_ISXDIGIT(pszString[ 7]));243 MY_CHECK(pszString[ 8] == '-');244 MY_CHECK(MY_ISXDIGIT(pszString[ 9]));245 MY_CHECK(MY_ISXDIGIT(pszString[10]));246 MY_CHECK(MY_ISXDIGIT(pszString[11]));247 MY_CHECK(MY_ISXDIGIT(pszString[12]));248 MY_CHECK(pszString[13] == '-');249 MY_CHECK(MY_ISXDIGIT(pszString[14]));250 MY_CHECK(MY_ISXDIGIT(pszString[15]));251 MY_CHECK(MY_ISXDIGIT(pszString[16]));252 MY_CHECK(MY_ISXDIGIT(pszString[17]));253 MY_CHECK(pszString[18] == '-');254 MY_CHECK(MY_ISXDIGIT(pszString[19]));255 MY_CHECK(MY_ISXDIGIT(pszString[20]));256 MY_CHECK(MY_ISXDIGIT(pszString[21]));257 MY_CHECK(MY_ISXDIGIT(pszString[22]));258 MY_CHECK(pszString[23] == '-');259 MY_CHECK(MY_ISXDIGIT(pszString[24]));260 MY_CHECK(MY_ISXDIGIT(pszString[25]));261 MY_CHECK(MY_ISXDIGIT(pszString[26]));262 MY_CHECK(MY_ISXDIGIT(pszString[27]));263 MY_CHECK(MY_ISXDIGIT(pszString[28]));264 MY_CHECK(MY_ISXDIGIT(pszString[29]));265 MY_CHECK(MY_ISXDIGIT(pszString[30]));266 MY_CHECK(MY_ISXDIGIT(pszString[31]));267 MY_CHECK(MY_ISXDIGIT(pszString[32]));268 MY_CHECK(MY_ISXDIGIT(pszString[33]));269 MY_CHECK(MY_ISXDIGIT(pszString[34]));270 MY_CHECK(MY_ISXDIGIT(pszString[35]));271 MY_CHECK(!pszString[36]);272 #undef MY_ISXDIGIT273 #undef MY_CHECK274 275 /*276 * Inverse of RTUuidToStr (see above).277 */278 #define MY_TONUM(ch) (s_aDigits[(ch) & 0xff])279 pUuid->Gen.u32TimeLow = (uint32_t)MY_TONUM(pszString[ 0]) << 28280 | (uint32_t)MY_TONUM(pszString[ 1]) << 24281 | (uint32_t)MY_TONUM(pszString[ 2]) << 20282 | (uint32_t)MY_TONUM(pszString[ 3]) << 16283 | (uint32_t)MY_TONUM(pszString[ 4]) << 12284 | (uint32_t)MY_TONUM(pszString[ 5]) << 8285 | (uint32_t)MY_TONUM(pszString[ 6]) << 4286 | (uint32_t)MY_TONUM(pszString[ 7]);287 pUuid->Gen.u16TimeMid = (uint16_t)MY_TONUM(pszString[ 9]) << 12288 | (uint16_t)MY_TONUM(pszString[10]) << 8289 | (uint16_t)MY_TONUM(pszString[11]) << 4290 | (uint16_t)MY_TONUM(pszString[12]);291 pUuid->Gen.u16TimeHiAndVersion =292 (uint16_t)MY_TONUM(pszString[14]) << 12293 | (uint16_t)MY_TONUM(pszString[15]) << 8294 | (uint16_t)MY_TONUM(pszString[16]) << 4295 | (uint16_t)MY_TONUM(pszString[17]);296 pUuid->Gen.u16ClockSeq =(uint16_t)MY_TONUM(pszString[19]) << 4297 | (uint16_t)MY_TONUM(pszString[20])298 | (uint16_t)MY_TONUM(pszString[21]) << 12299 | (uint16_t)MY_TONUM(pszString[22]) << 8;300 pUuid->Gen.au8Node[0] = (uint8_t)MY_TONUM(pszString[24]) << 4301 | (uint8_t)MY_TONUM(pszString[25]);302 pUuid->Gen.au8Node[1] = (uint8_t)MY_TONUM(pszString[26]) << 4303 | (uint8_t)MY_TONUM(pszString[27]);304 pUuid->Gen.au8Node[2] = (uint8_t)MY_TONUM(pszString[28]) << 4305 | (uint8_t)MY_TONUM(pszString[29]);306 pUuid->Gen.au8Node[3] = (uint8_t)MY_TONUM(pszString[30]) << 4307 | (uint8_t)MY_TONUM(pszString[31]);308 pUuid->Gen.au8Node[4] = (uint8_t)MY_TONUM(pszString[32]) << 4309 | (uint8_t)MY_TONUM(pszString[33]);310 pUuid->Gen.au8Node[5] = (uint8_t)MY_TONUM(pszString[34]) << 4311 | (uint8_t)MY_TONUM(pszString[35]);312 #undef MY_TONUM313 return VINF_SUCCESS;314 }315 -
trunk/src/VBox/Runtime/generic/uuid-generic.cpp
r9738 r9741 36 36 #include <iprt/assert.h> 37 37 #include <iprt/err.h> 38 #include <iprt/time.h> 39 #include <iprt/asm.h> 40 #include <iprt/rand.h> 41 42 43 /* WARNING: This implementation ASSUMES little endian. */ 44 45 46 /** @todo move to a different file. */ 47 RTDECL(int) RTUuidCreate(PRTUUID pUuid) 48 { 49 /* validate input. */ 50 AssertPtrReturn(pUuid, VERR_INVALID_PARAMETER); 51 52 RTRandBytes(pUuid, sizeof(*pUuid)); 53 pUuid->Gen.u16ClockSeq = (pUuid->Gen.u16ClockSeq & 0x3fff) | 0x8000; 54 pUuid->Gen.u16TimeHiAndVersion = (pUuid->Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000; 55 56 return VINF_SUCCESS; 57 } 38 39 40 /* WARNING: This implementation ASSUMES little endian. Needs testing on big endian! */ 58 41 59 42 -
trunk/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp
r9740 r9741 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT UUID (unique identifiers) handling (win32 host).3 * IPRT - UUID, Windows RTUuidCreate implementation. 4 4 */ 5 5 … … 38 38 #include <iprt/uuid.h> 39 39 #include <iprt/assert.h> 40 #include <iprt/string.h>41 40 #include <iprt/err.h> 42 41 … … 57 56 } 58 57 59 60 RTDECL(int) RTUuidClear(PRTUUID pUuid)61 {62 /* check params */63 AssertPtrReturn(pUuid, VERR_INVALID_POINTER);64 65 return RTErrConvertFromWin32(UuidCreateNil((UUID *)pUuid));66 }67 68 69 RTDECL(bool) RTUuidIsNull(PCRTUUID pUuid)70 {71 /* check params */72 AssertPtrReturn(pUuid, true);73 74 RPC_STATUS status;75 return !!UuidIsNil((UUID *)pUuid, &status);76 }77 78 79 RTDECL(int) RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2)80 {81 /* check params */82 AssertPtrReturn(pUuid1, -1);83 AssertPtrReturn(pUuid1, 1);84 85 RPC_STATUS status;86 return UuidCompare((UUID *)pUuid1, (UUID *)pUuid2, &status);87 }88 89 90 RTDECL(int) RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString)91 {92 /* check params */93 AssertPtrReturn(pUuid1, -1);94 AssertPtrReturn(pszString, 1);95 96 /*97 * Try convert the string to a UUID and then compare the two.98 */99 RTUUID Uuid2;100 int rc = RTUuidFromStr(&Uuid2, pszString);101 AssertRCReturn(rc, 1);102 103 return RTUuidCompare(pUuid1, &Uuid2);104 }105 106 107 RTDECL(int) RTUuidToStr(PCRTUUID pUuid, char *pszString, size_t cchString)108 {109 /* check params */110 AssertPtrReturn(pUuid, VERR_INVALID_POINTER);111 AssertPtrReturn(pszString, VERR_INVALID_POINTER);112 AssertReturn(cchString >= RTUUID_STR_LENGTH, VERR_INVALID_PARAMETER);113 114 /*115 * Try convert it.116 *117 * The API allocates a new string buffer for us, so we can do our own118 * buffer overflow handling.119 */120 RPC_STATUS Status;121 unsigned char *pszTmpStr = NULL;122 #ifdef RPC_UNICODE_SUPPORTED123 /* always use ASCII version! */124 Status = UuidToStringA((UUID *)pUuid, &pszTmpStr);125 #else126 Status = UuidToString((UUID *)pUuid, &pszTmpStr);127 #endif128 if (Status != RPC_S_OK)129 return RTErrConvertFromWin32(Status);130 131 /* copy it. */132 int rc = VINF_SUCCESS;133 size_t cchTmpStr = strlen((char *)pszTmpStr);134 if (cchTmpStr < cchString)135 memcpy(pszString, pszTmpStr, cchTmpStr + 1);136 else137 {138 AssertFailed();139 rc = ERROR_BUFFER_OVERFLOW;140 }141 142 /* free buffer */143 #ifdef RPC_UNICODE_SUPPORTED144 /* always use ASCII version! */145 RpcStringFreeA(&pszTmpStr);146 #else147 RpcStringFree(&pszTmpStr);148 #endif149 150 /* all done */151 return rc;152 }153 154 155 RTDECL(int) RTUuidFromStr(PRTUUID pUuid, const char *pszString)156 {157 /* check params */158 AssertPtrReturn(pUuid, VERR_INVALID_POINTER);159 AssertPtrReturn(pszString, VERR_INVALID_POINTER);160 161 RPC_STATUS rc;162 #ifdef RPC_UNICODE_SUPPORTED163 /* always use ASCII version! */164 rc = UuidFromStringA((unsigned char *)pszString, (UUID *)pUuid);165 #else166 rc = UuidFromString((unsigned char *)pszString, (UUID *)pUuid);167 #endif168 169 return RTErrConvertFromWin32(rc);170 }171 172 -
trunk/src/VBox/Runtime/r3/win/uuid-win.cpp
r9740 r9741 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT UUID (unique identifiers) handling (win32 host).3 * IPRT - UUID, Windows implementation. 4 4 */ 5 5 … … 40 40 #include <iprt/string.h> 41 41 #include <iprt/err.h> 42 43 44 /** @todo split out this guy */45 RTDECL(int) RTUuidCreate(PRTUUID pUuid)46 {47 /* check params */48 AssertPtrReturn(pUuid, VERR_INVALID_POINTER);49 50 RPC_STATUS rc = UuidCreate((UUID *)pUuid);51 if ( rc == RPC_S_OK52 || rc == RPC_S_UUID_LOCAL_ONLY)53 return VINF_SUCCESS;54 55 /* error exit */56 return RTErrConvertFromWin32(rc);57 }58 42 59 43
Note:
See TracChangeset
for help on using the changeset viewer.