VirtualBox

Changeset 70456 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Jan 3, 2018 8:37:19 PM (7 years ago)
Author:
vboxsync
Message:

IPRT/RTUuidCreate: More tweaks for old NT 3.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp

    r70455 r70456  
    3737#include <iprt/rand.h>
    3838
     39#include "internal-r3-win.h"
     40
    3941
    4042RTDECL(int)  RTUuidCreate(PRTUUID pUuid)
    4143{
    42     /* check params */
     44    /*
     45     * Input validation.
     46     */
    4347    AssertPtrReturn(pUuid, VERR_INVALID_POINTER);
    4448
    45     RPC_STATUS rc = UuidCreate((UUID *)pUuid);
    46     if (   rc == RPC_S_OK
    47         || rc == RPC_S_UUID_LOCAL_ONLY)
    48         return VINF_SUCCESS;
     49    /*
     50     * When using the UuidCreate API shortly after boot on NT 3.1 it typcially
     51     * hangs for a long long time while polling for some service to start.
     52     * What then usually happens next is a failure because it couldn't figure
     53     * out the MAC address of the NIC.  So, on NT 3.1 we always use the fallback.
     54     */
     55    if (g_enmWinVer != kRTWinOSType_NT310)
     56    {
     57        RPC_STATUS rc = UuidCreate((UUID *)pUuid);
     58        if (   rc == RPC_S_OK
     59            || rc == RPC_S_UUID_LOCAL_ONLY)
     60            return VINF_SUCCESS;
     61        AssertMsg(rc == RPC_S_UUID_NO_ADDRESS, ("UuidCreate -> %u (%#x)\n", rc, rc));
     62    }
    4963
    50     /* Seen on NT 3.1: */
    51     AssertMsg(rc == RPC_S_UUID_NO_ADDRESS, ("UuidCreate -> %u (%#x)\n", rc, rc));
    52 
    53     /* Use generic implementation as fallback (copy of RTUuidCreate-generic.cpp). */
     64    /*
     65     * Use generic implementation as fallback (copy of RTUuidCreate-generic.cpp).
     66     */
    5467    RTRandBytes(pUuid, sizeof(*pUuid));
    5568    pUuid->Gen.u8ClockSeqHiAndReserved = (pUuid->Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette