a27567873aa392eab8243497a5674ee0336f61c9vboxsync/* $Id$ */
a27567873aa392eab8243497a5674ee0336f61c9vboxsync/** @file
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * IPRT - UUID, Windows RTUuidCreate implementation.
a27567873aa392eab8243497a5674ee0336f61c9vboxsync */
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2010 Oracle Corporation
a27567873aa392eab8243497a5674ee0336f61c9vboxsync *
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * available from http://www.virtualbox.org. This file is free software;
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * General Public License (GPL) as published by the Free Software
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a27567873aa392eab8243497a5674ee0336f61c9vboxsync *
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * The contents of this file may alternatively be used under the terms
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * of the Common Development and Distribution License Version 1.0
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * CDDL are applicable instead of those of the GPL.
a27567873aa392eab8243497a5674ee0336f61c9vboxsync *
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * You may elect to license modified versions of this file under the
a27567873aa392eab8243497a5674ee0336f61c9vboxsync * terms and conditions of either the GPL or the CDDL or both.
a27567873aa392eab8243497a5674ee0336f61c9vboxsync */
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync/*******************************************************************************
a27567873aa392eab8243497a5674ee0336f61c9vboxsync* Header Files *
a27567873aa392eab8243497a5674ee0336f61c9vboxsync*******************************************************************************/
a27567873aa392eab8243497a5674ee0336f61c9vboxsync#define LOG_GROUP RTLOGGROUP_UUID
a27567873aa392eab8243497a5674ee0336f61c9vboxsync#include <Windows.h>
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync#include <iprt/uuid.h>
a27567873aa392eab8243497a5674ee0336f61c9vboxsync#include <iprt/assert.h>
a27567873aa392eab8243497a5674ee0336f61c9vboxsync#include <iprt/err.h>
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsyncRTDECL(int) RTUuidCreate(PRTUUID pUuid)
a27567873aa392eab8243497a5674ee0336f61c9vboxsync{
a27567873aa392eab8243497a5674ee0336f61c9vboxsync /* check params */
a27567873aa392eab8243497a5674ee0336f61c9vboxsync AssertPtrReturn(pUuid, VERR_INVALID_POINTER);
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync RPC_STATUS rc = UuidCreate((UUID *)pUuid);
6d0eeefcec33dbf4115f4fdced57eb4dd4f1f16bvboxsync if ( rc == RPC_S_OK
a27567873aa392eab8243497a5674ee0336f61c9vboxsync || rc == RPC_S_UUID_LOCAL_ONLY)
a27567873aa392eab8243497a5674ee0336f61c9vboxsync return VINF_SUCCESS;
a27567873aa392eab8243497a5674ee0336f61c9vboxsync
a27567873aa392eab8243497a5674ee0336f61c9vboxsync /* error exit */
a27567873aa392eab8243497a5674ee0336f61c9vboxsync return RTErrConvertFromWin32(rc);
a27567873aa392eab8243497a5674ee0336f61c9vboxsync}
a27567873aa392eab8243497a5674ee0336f61c9vboxsync