uuid-win32.cpp revision a595bebfc109f595e64e843f8faf9cfb97f35564
/* $Id$ */
/** @file
* innotek Portable Runtime UUID (unique identifiers) handling (win32 host).
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_UUID
#include <Windows.h>
/**
* Generates a new UUID value.
*
* @returns iprt status code.
* @param pUuid Where to store generated uuid.
*/
{
/* check params */
{
AssertMsgFailed(("pUuid=NULL\n"));
return VERR_INVALID_PARAMETER;
}
return VINF_SUCCESS;
/* error exit */
return RTErrConvertFromWin32(rc);
}
/**
* Makes null UUID value.
*
* @returns iprt status code.
* @param pUuid Where to store generated null uuid.
*/
{
/* check params */
{
AssertMsgFailed(("pUuid=NULL\n"));
return VERR_INVALID_PARAMETER;
}
}
/**
* Checks if UUID is null.
*
* @returns true if UUID is null.
* @param pUuid uuid to check.
*/
{
/* check params */
{
AssertMsgFailed(("pUuid=NULL\n"));
return TRUE;
}
}
/**
* Compares two UUID values.
*
* @returns 0 if eq, < 0 or > 0.
* @param pUuid1 First value to compare.
* @param pUuid2 Second value to compare.
*/
{
/* check params */
{
AssertMsgFailed(("Invalid parameters\n"));
return 1;
}
}
/**
* Converts binary UUID to its string representation.
*
* @returns iprt status code.
* @param pUuid Uuid to convert.
* @param pszString Where to store result string.
* @param cchString pszString buffer length, must be >= RTUUID_STR_LENGTH.
*/
{
/* check params */
{
AssertMsgFailed(("Invalid parameters\n"));
return VERR_INVALID_PARAMETER;
}
#ifdef RPC_UNICODE_SUPPORTED
/* always use ASCII version! */
#else
#endif
return RTErrConvertFromWin32(rc);
{
/* out of buffer space */
#ifdef RPC_UNICODE_SUPPORTED
/* always use ASCII version! */
RpcStringFreeA((unsigned char **)&pStr);
#else
RpcStringFree((unsigned char **)&pStr);
#endif
AssertMsgFailed(("Buffer overflow\n"));
return ERROR_BUFFER_OVERFLOW;
}
/* copy str to user buffer */
pszString[0] = '\0';
/* free buffer */
#ifdef RPC_UNICODE_SUPPORTED
/* always use ASCII version! */
RpcStringFreeA((unsigned char **)&pStr);
#else
RpcStringFree((unsigned char **)&pStr);
#endif
/* all done */
return VINF_SUCCESS;
}
/**
* Converts UUID from its string representation to binary format.
*
* @returns iprt status code.
* @param pUuid Where to store result Uuid.
* @param pszString String with UUID text data.
*/
{
/* check params */
{
AssertMsgFailed(("Invalid parameters\n"));
return VERR_INVALID_PARAMETER;
}
#ifdef RPC_UNICODE_SUPPORTED
/* always use ASCII version! */
#else
#endif
return RTErrConvertFromWin32(rc);
}