RTSystemQueryDmiString-solaris.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * IPRT - RTSystemQueryDmiString, solaris ring-3.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2010 Oracle Corporation
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * available from http://www.virtualbox.org. This file is free software;
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * you can redistribute it and/or modify it under the terms of the GNU
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * General Public License (GPL) as published by the Free Software
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * The contents of this file may alternatively be used under the terms
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * of the Common Development and Distribution License Version 1.0
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * VirtualBox OSE distribution, in which case the provisions of the
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * CDDL are applicable instead of those of the GPL.
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * You may elect to license modified versions of this file under the
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync * terms and conditions of either the GPL or the CDDL or both.
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync/*******************************************************************************
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync* Header Files *
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync*******************************************************************************/
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsyncRTDECL(int) RTSystemQueryDmiString(RTSYSDMISTR enmString, char *pszBuf, size_t cbBuf)
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync AssertReturn(enmString > RTSYSDMISTR_INVALID && enmString < RTSYSDMISTR_END, VERR_INVALID_PARAMETER);
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync smbios_hdl_t *pSMB = smbios_open(NULL /* default fd */, SMB_VERSION, 0 /* flags */, &err);
0715ccd2b4b30b8b0097e66639fc4f6bca06de5fvboxsync /* Don't need the common bits for the product UUID. */
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync static char const s_szHex[17] = "0123456789ABCDEF";
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync unsigned cchUuid = RT_MIN(hSMBSys.smbs_uuidlen, sizeof(szData) - 1);
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync for (unsigned i = 0; i < cchUuid; i++)
18ef45ed44013c0259d156b9a9dfe79e1a752dc2vboxsync id_t hSMBInfoId = smbios_info_common(pSMB, hSMBId, &hSMBInfo);
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync case RTSYSDMISTR_PRODUCT_NAME: rc = RTStrCopy(pszBuf, cbBuf, hSMBInfo.smbi_product); break;
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync case RTSYSDMISTR_PRODUCT_VERSION: rc = RTStrCopy(pszBuf, cbBuf, hSMBInfo.smbi_version); break;
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync case RTSYSDMISTR_PRODUCT_SERIAL: rc = RTStrCopy(pszBuf, cbBuf, hSMBInfo.smbi_serial); break;
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync default: /* make gcc happy */
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync /* smbios_* error path. */
5b1f267ae8f75a03e39cde5efc27c5e7d78a218cvboxsync /* Do some error conversion. */