本文整理汇总了C++中RTStrCopy函数的典型用法代码示例。如果您正苦于以下问题:C++ RTStrCopy函数的具体用法?C++ RTStrCopy怎么用?C++ RTStrCopy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTStrCopy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DECLCALLBACK
/**
* @interface_method_impl{TXSTRANSPORT,pfnOption}
*/
static DECLCALLBACK(int) txsTcpOption(int ch, PCRTGETOPTUNION pVal)
{
int rc;
switch (ch)
{
case TXSTCPOPT_MODE:
if (!strcmp(pVal->psz, "both"))
g_enmTcpMode = TXSTCPMODE_BOTH;
else if (!strcmp(pVal->psz, "client"))
g_enmTcpMode = TXSTCPMODE_CLIENT;
else if (!strcmp(pVal->psz, "server"))
g_enmTcpMode = TXSTCPMODE_SERVER;
else
return RTMsgErrorRc(VERR_INVALID_PARAMETER, "Invalid TCP mode: '%s'\n", pVal->psz);
break;
case TXSTCPOPT_BIND_ADDRESS:
rc = RTStrCopy(g_szTcpBindAddr, sizeof(g_szTcpBindAddr), pVal->psz);
if (RT_FAILURE(rc))
return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP bind address is too long (%Rrc)", rc);
return VINF_SUCCESS;
case TXSTCPOPT_BIND_PORT:
g_uTcpBindPort = pVal->u16 == 0 ? TXS_TCP_DEF_BIND_PORT : pVal->u16;
break;
case TXSTCPOPT_LEGACY_CONNECT:
g_enmTcpMode = TXSTCPMODE_CLIENT;
/* fall thru */
case TXSTCPOPT_CONNECT_ADDRESS:
rc = RTStrCopy(g_szTcpConnectAddr, sizeof(g_szTcpConnectAddr), pVal->psz);
if (RT_FAILURE(rc))
return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP connect address is too long (%Rrc)", rc);
if (!g_szTcpConnectAddr[0])
strcpy(g_szTcpConnectAddr, TXS_TCP_DEF_CONNECT_ADDRESS);
return VINF_SUCCESS;
case TXSTCPOPT_CONNECT_PORT:
g_uTcpConnectPort = pVal->u16 == 0 ? TXS_TCP_DEF_CONNECT_PORT : pVal->u16;
break;
case TXSTCPOPT_LEGACY_PORT:
if (pVal->u16 == 0)
{
g_uTcpBindPort = TXS_TCP_DEF_BIND_PORT;
g_uTcpConnectPort = TXS_TCP_DEF_CONNECT_PORT;
}
else
{
g_uTcpBindPort = pVal->u16;
g_uTcpConnectPort = pVal->u16;
}
return VINF_SUCCESS;
}
return VERR_TRY_AGAIN;
}
示例2: cpumR3MsrRegStats
/**
* Register statistics for the MSRs.
*
* This must not be called before the MSRs have been finalized and moved to the
* hyper heap.
*
* @returns VBox status code.
* @param pVM The cross context VM structure.
*/
int cpumR3MsrRegStats(PVM pVM)
{
/*
* Global statistics.
*/
PCPUM pCpum = &pVM->cpum.s;
STAM_REL_REG(pVM, &pCpum->cMsrReads, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/Reads",
STAMUNIT_OCCURENCES, "All RDMSRs making it to CPUM.");
STAM_REL_REG(pVM, &pCpum->cMsrReadsRaiseGp, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/ReadsRaisingGP",
STAMUNIT_OCCURENCES, "RDMSR raising #GPs, except unknown MSRs.");
STAM_REL_REG(pVM, &pCpum->cMsrReadsUnknown, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/ReadsUnknown",
STAMUNIT_OCCURENCES, "RDMSR on unknown MSRs (raises #GP).");
STAM_REL_REG(pVM, &pCpum->cMsrWrites, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/Writes",
STAMUNIT_OCCURENCES, "All RDMSRs making it to CPUM.");
STAM_REL_REG(pVM, &pCpum->cMsrWritesRaiseGp, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/WritesRaisingGP",
STAMUNIT_OCCURENCES, "WRMSR raising #GPs, except unknown MSRs.");
STAM_REL_REG(pVM, &pCpum->cMsrWritesToIgnoredBits, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/WritesToIgnoredBits",
STAMUNIT_OCCURENCES, "Writing of ignored bits.");
STAM_REL_REG(pVM, &pCpum->cMsrWritesUnknown, STAMTYPE_COUNTER, "/CPUM/MSR-Totals/WritesUnknown",
STAMUNIT_OCCURENCES, "WRMSR on unknown MSRs (raises #GP).");
# ifdef VBOX_WITH_STATISTICS
/*
* Per range.
*/
PCPUMMSRRANGE paRanges = pVM->cpum.s.GuestInfo.paMsrRangesR3;
uint32_t cRanges = pVM->cpum.s.GuestInfo.cMsrRanges;
for (uint32_t i = 0; i < cRanges; i++)
{
char szName[160];
ssize_t cchName;
if (paRanges[i].uFirst == paRanges[i].uLast)
cchName = RTStrPrintf(szName, sizeof(szName), "/CPUM/MSRs/%#010x-%s",
paRanges[i].uFirst, paRanges[i].szName);
else
cchName = RTStrPrintf(szName, sizeof(szName), "/CPUM/MSRs/%#010x-%#010x-%s",
paRanges[i].uFirst, paRanges[i].uLast, paRanges[i].szName);
RTStrCopy(&szName[cchName], sizeof(szName) - cchName, "-reads");
STAMR3Register(pVM, &paRanges[i].cReads, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, szName, STAMUNIT_OCCURENCES, "RDMSR");
RTStrCopy(&szName[cchName], sizeof(szName) - cchName, "-writes");
STAMR3Register(pVM, &paRanges[i].cWrites, STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, "WRMSR");
RTStrCopy(&szName[cchName], sizeof(szName) - cchName, "-GPs");
STAMR3Register(pVM, &paRanges[i].cGps, STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, "#GPs");
RTStrCopy(&szName[cchName], sizeof(szName) - cchName, "-ign-bits-writes");
STAMR3Register(pVM, &paRanges[i].cIgnoredBits, STAMTYPE_COUNTER, STAMVISIBILITY_USED, szName, STAMUNIT_OCCURENCES, "WRMSR w/ ignored bits");
}
# endif /* VBOX_WITH_STATISTICS */
return VINF_SUCCESS;
}
示例3: VMMDECL
/**
* Query the trace configuration specification string.
*
* @returns VBox status code.
* @retval VINF_SUCCESS
* @retval VERR_INVALID_VM_HANDLE
* @retval VERR_INVALID_POINTER
* @retval VERR_BUFFER_OVERFLOW if the buffer is too small. Buffer will be
* empty.
* @param pVM The cross context VM structure.
* @param pszConfig Pointer to the output buffer.
* @param cbConfig The size of the output buffer.
*/
VMMDECL(int) DBGFR3TraceQueryConfig(PVM pVM, char *pszConfig, size_t cbConfig)
{
VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
AssertPtrReturn(pszConfig, VERR_INVALID_POINTER);
if (cbConfig < 1)
return VERR_BUFFER_OVERFLOW;
*pszConfig = '\0';
if (pVM->hTraceBufR3 == NIL_RTTRACEBUF)
return VERR_DBGF_NO_TRACE_BUFFER;
int rc = VINF_SUCCESS;
uint32_t const fTraceGroups = pVM->aCpus[0].fTraceGroups;
if ( fTraceGroups == UINT32_MAX
&& PDMR3TracingAreAll(pVM, true /*fEnabled*/))
rc = RTStrCopy(pszConfig, cbConfig, "all");
else if ( fTraceGroups == 0
&& PDMR3TracingAreAll(pVM, false /*fEnabled*/))
rc = RTStrCopy(pszConfig, cbConfig, "-all");
else
{
char *pszDst = pszConfig;
size_t cbDst = cbConfig;
uint32_t i = RT_ELEMENTS(g_aVmmTpGroups);
while (i-- > 0)
if (g_aVmmTpGroups[i].fMask & fTraceGroups)
{
size_t cchThis = g_aVmmTpGroups[i].cchName + (pszDst != pszConfig);
if (cchThis >= cbDst)
{
rc = VERR_BUFFER_OVERFLOW;
break;
}
if (pszDst != pszConfig)
{
*pszDst = ' ';
memcpy(pszDst + 1, g_aVmmTpGroups[i].pszName, g_aVmmTpGroups[i].cchName + 1);
}
else
memcpy(pszDst, g_aVmmTpGroups[i].pszName, g_aVmmTpGroups[i].cchName + 1);
pszDst += cchThis;
cbDst -= cchThis;
}
if (RT_SUCCESS(rc))
rc = PDMR3TracingQueryConfig(pVM, pszDst, cbDst);
}
if (RT_FAILURE(rc))
*pszConfig = '\0';
return rc;
}
示例4: RTDECL
RTDECL(int) RTPathAppPrivateArchTop(char *pszPath, size_t cchPath)
{
#if !defined(RT_OS_WINDOWS) && defined(RTPATH_APP_PRIVATE_ARCH_TOP)
return RTStrCopy(pszPath, cchPath, RTPATH_APP_PRIVATE_ARCH_TOP);
#elif !defined(RT_OS_WINDOWS) && defined(RTPATH_APP_PRIVATE_ARCH)
return RTStrCopy(pszPath, cchPath, RTPATH_APP_PRIVATE_ARCH);
#elif defined(RT_OS_SOLARIS)
return rtPathSolarisArchHack(pszPath, cchPath);
#else
int rc = RTPathExecDir(pszPath, cchPath);
return rc;
#endif
}
示例5: VMMR3DECL
/**
* Unregisters a shared module for the VM
*
* @returns VBox status code.
* @param pVM Pointer to the VM.
* @param pszModuleName Module name.
* @param pszVersion Module version.
* @param GCBaseAddr Module base address.
* @param cbModule Module size.
*
* @todo This should be a GMMR3 call. No need to involve GMM here.
*/
VMMR3DECL(int) PGMR3SharedModuleUnregister(PVM pVM, char *pszModuleName, char *pszVersion, RTGCPTR GCBaseAddr, uint32_t cbModule)
{
Log(("PGMR3SharedModuleUnregister name=%s version=%s base=%RGv size=%x\n", pszModuleName, pszVersion, GCBaseAddr, cbModule));
AssertMsgReturn(cbModule > 0 && cbModule < _1G, ("%u\n", cbModule), VERR_OUT_OF_RANGE);
/*
* Forward the request to GMM (ring-0).
*/
PGMMUNREGISTERSHAREDMODULEREQ pReq = (PGMMUNREGISTERSHAREDMODULEREQ)RTMemAlloc(sizeof(*pReq));
AssertReturn(pReq, VERR_NO_MEMORY);
pReq->GCBaseAddr = GCBaseAddr;
pReq->u32Alignment = 0;
pReq->cbModule = cbModule;
int rc = RTStrCopy(pReq->szName, sizeof(pReq->szName), pszModuleName);
if (RT_SUCCESS(rc))
{
rc = RTStrCopy(pReq->szVersion, sizeof(pReq->szVersion), pszVersion);
if (RT_SUCCESS(rc))
{
pgmR3PhysAssertSharedPageChecksums(pVM);
rc = GMMR3UnregisterSharedModule(pVM, pReq);
pgmR3PhysAssertSharedPageChecksums(pVM);
# ifdef VBOX_STRICT
/*
* Update our local tracking.
*/
for (unsigned i = 0; i < g_cSharedModules; i++)
{
if ( g_apSharedModules[i]
&& !strcmp(g_apSharedModules[i]->szName, pszModuleName)
&& !strcmp(g_apSharedModules[i]->szVersion, pszVersion))
{
RTMemFree(g_apSharedModules[i]);
g_apSharedModules[i] = NULL;
g_cSharedModules--;
break;
}
}
# endif /* VBOX_STRICT */
}
}
RTMemFree(pReq);
return rc;
}
示例6: VBGLR3DECL
/**
* Unregisters a shared module for the VM
*
* @returns IPRT status code.
* @param pszModuleName Module name
* @param pszVersion Module version
* @param GCBaseAddr Module base address
* @param cbModule Module size
*/
VBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule)
{
VMMDevSharedModuleUnregistrationRequest Req;
vmmdevInitRequest(&Req.header, VMMDevReq_UnregisterSharedModule);
Req.GCBaseAddr = GCBaseAddr;
Req.cbModule = cbModule;
if ( RTStrCopy(Req.szName, sizeof(Req.szName), pszModuleName) != VINF_SUCCESS
|| RTStrCopy(Req.szVersion, sizeof(Req.szVersion), pszVersion) != VINF_SUCCESS)
{
return VERR_BUFFER_OVERFLOW;
}
return vbglR3GRPerform(&Req.header);
}
示例7: VBGLR3DECL
VBGLR3DECL(int) VbglR3DnDConnect(uint32_t *pu32ClientId)
{
/* Validate input */
AssertPtrReturn(pu32ClientId, VERR_INVALID_POINTER);
/* Initialize header */
VBoxGuestHGCMConnectInfo Info;
RT_ZERO(Info.Loc.u);
Info.result = VERR_WRONG_ORDER;
Info.u32ClientID = UINT32_MAX; /* try make valgrind shut up. */
/* Initialize parameter */
Info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
int rc = RTStrCopy(Info.Loc.u.host.achName, sizeof(Info.Loc.u.host.achName), "VBoxDragAndDropSvc");
if (RT_FAILURE(rc)) return rc;
/* Do request */
rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CONNECT, &Info, sizeof(Info));
if (RT_SUCCESS(rc))
{
rc = Info.result;
if (RT_SUCCESS(rc))
*pu32ClientId = Info.u32ClientID;
}
if (rc == VERR_HGCM_SERVICE_NOT_FOUND)
rc = VINF_PERMISSION_DENIED;
return rc;
}
示例8: rtDbgSymCacheAddDir
/**
* Adds a directory.
*
* @returns IPRT status code (fully bitched).
* @param pszPath The directory path.
* @param pCfg The configuration.
*/
static int rtDbgSymCacheAddDir(const char *pszPath, PCRTDBGSYMCACHEADDCFG pCfg)
{
/*
* Set up the path buffer, stripping any filter.
*/
char szPath[RTPATH_MAX];
int rc = RTStrCopy(szPath, sizeof(szPath) - 2, pszPath);
if (RT_FAILURE(rc))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Path too long: '%s'", pszPath);
size_t cchPath = strlen(pszPath);
if (!cchPath)
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Path empty: '%s'", pszPath);
if (pCfg->pszFilter)
szPath[cchPath - strlen(pCfg->pszFilter)] = '\0';
cchPath = RTPathStripTrailingSlash(szPath);
if (!RTPATH_IS_SEP(pszPath[cchPath - 1]))
{
szPath[cchPath++] = RTPATH_SLASH;
szPath[cchPath] = '\0';
}
/*
* Let the worker do the rest.
*/
RTDIRENTRYEX DirEntry;
return rtDbgSymCacheAddDirWorker(szPath, cchPath, &DirEntry, pCfg);
}
示例9: DumpHtml
int DumpHtml(char* src, size_t cb)
{
size_t lenght = 0;
int rc = RTStrNLenEx(src, cb, &lenght);
if (RT_SUCCESS(rc))
{
char* buf = (char*)RTMemAlloc(cb + 1);
if (buf != NULL)
{
RT_BZERO(buf, cb + 1);
rc = RTStrCopy(buf, cb, (const char*)src);
if (RT_SUCCESS(rc))
{
for (int i = 0; i < cb; ++i)
{
if (buf[i] == '\n' || buf[i] == '\r')
buf[i] = ' ';
}
}
else
{
Log(("Error in copying string.\n"));
}
Log(("Removed \\r\\n: %s\n", buf));
RTMemFree(buf);
}
else
{
rc = VERR_NO_MEMORY;
Log(("Not enough memory to allocate buffer.\n"));
}
}
return rc;
}
示例10: RTDECL
RTDECL(int) RTLocaleQueryLocaleName(char *pszName, size_t cbName)
{
const char *pszLocale = setlocale(LC_ALL, NULL);
if (!pszLocale)
return RTStrCopy(pszName, cbName, pszLocale);
return VERR_NOT_AVAILABLE;
}
示例11: vboxExtPackVerifyXml
/**
* Verifies the manifest and its signature.
*
* @returns VBox status code, failures with message.
* @param hManifestFile The xml from the extension pack.
* @param pszExtPackName The expected extension pack name. This can be
* NULL, in which we don't have any expectations.
* @param pszError Where to store an error message on failure.
* @param cbError The size of the buffer @a pszError points to.
*/
static int vboxExtPackVerifyXml(RTVFSFILE hXmlFile, const char *pszExtPackName, char *pszError, size_t cbError)
{
/*
* Load the XML.
*/
VBOXEXTPACKDESC ExtPackDesc;
RTCString *pstrErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &ExtPackDesc, NULL);
if (pstrErr)
{
RTStrCopy(pszError, cbError, pstrErr->c_str());
delete pstrErr;
return VERR_PARSE_ERROR;
}
/*
* Check the name.
*/
/** @todo drop this restriction after the old install interface is
* dropped. */
int rc = VINF_SUCCESS;
if ( pszExtPackName
&& !ExtPackDesc.strName.equalsIgnoreCase(pszExtPackName))
rc = vboxExtPackReturnError(VERR_NOT_EQUAL, pszError, cbError,
"The name of the downloaded file and the name stored inside the extension pack does not match"
" (xml='%s' file='%s')", ExtPackDesc.strName.c_str(), pszExtPackName);
return rc;
}
示例12: DECLVBGL
DECLVBGL(int) vboxCrCtlConConnect(HVBOXCRCTL hCtl, uint32_t *pu32ClientID)
{
VBoxGuestHGCMConnectInfo info;
int rc;
if (!hCtl || !pu32ClientID)
return VERR_INVALID_PARAMETER;
memset(&info, 0, sizeof (info));
info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
RTStrCopy(info.Loc.u.host.achName, sizeof (info.Loc.u.host.achName), "VBoxSharedCrOpenGL");
rc = vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, sizeof (info));
if (RT_SUCCESS(rc))
{
rc = info.result;
if (RT_SUCCESS(rc))
{
Assert(info.u32ClientID);
*pu32ClientID = info.u32ClientID;
return rc;
}
}
Assert(RT_FAILURE(rc));
*pu32ClientID = 0;
return rc;
}
示例13: DECLHIDDEN
DECLHIDDEN(int) rtProcInitExePath(char *pszPath, size_t cchPath)
{
/*
* Read the /proc/self/exe link, convert to native and return it.
*/
int cchLink = readlink("/proc/self/exe", pszPath, cchPath - 1);
if (cchLink > 0 && (size_t)cchLink <= cchPath - 1)
{
pszPath[cchLink] = '\0';
char const *pszTmp;
int rc = rtPathFromNative(&pszTmp, pszPath, NULL);
AssertMsgRCReturn(rc, ("rc=%Rrc pszLink=\"%s\"\nhex: %.*Rhxs\n", rc, pszPath, cchLink, pszPath), rc);
if (pszTmp != pszPath)
{
rc = RTStrCopy(pszPath, cchPath, pszTmp);
rtPathFreeIprt(pszTmp, pszPath);
}
return rc;
}
int err = errno;
int rc = RTErrConvertFromErrno(err);
AssertMsgFailed(("rc=%Rrc err=%d cchLink=%d\n", rc, err, cchLink));
return rc;
}
示例14: gzipOpenOutput
/**
* Opens the output file.
*
* @returns Command exit, error messages written using RTMsg*.
*
* @param pszFile The input filename.
* @param pOpts The options, szOutput will be filled in by this
* function on success.
* @param phVfsIos Where to return the output stream handle.
*
* @remarks This is actually not quite the way we need to do things.
*
* First of all, we need a GZIP file system stream for a real GZIP
* implementation, since there may be more than one file in the gzipped
* file.
*
* Second, we need to open the output files as we encounter files in the input
* file system stream. The gzip format contains timestamp and usually a
* filename, the default is to use this name (see the --no-name
* option).
*/
static RTEXITCODE gzipOpenOutput(const char *pszFile, PRTGZIPCMDOPTS pOpts, PRTVFSIOSTREAM phVfsIos)
{
int rc;
if (!strcmp(pszFile, "-") || pOpts->fStdOut)
{
strcpy(pOpts->szOutput, "-");
if ( !pOpts->fForce
&& !pOpts->fDecompress
&& gzipIsStdHandleATty(RTHANDLESTD_OUTPUT))
return RTMsgErrorExit(RTEXITCODE_SYNTAX,
"Yeah, right. I'm not writing any compressed data to the terminal without --force.\n");
rc = RTVfsIoStrmFromStdHandle(RTHANDLESTD_OUTPUT,
RTFILE_O_WRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,
true /*fLeaveOpen*/,
phVfsIos);
if (RT_FAILURE(rc))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error opening standard output: %Rrc", rc);
}
else
{
Assert(!RTVfsChainIsSpec(pszFile));
/* Construct an output filename. */
rc = RTStrCopy(pOpts->szOutput, sizeof(pOpts->szOutput), pszFile);
if (RT_FAILURE(rc))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error constructing output filename: %Rrc", rc);
if (pOpts->fDecompress)
{
/** @todo take filename from archive? */
size_t cchSuff = strlen(pOpts->pszSuff); Assert(cchSuff > 0);
size_t cch = strlen(pOpts->szOutput);
if ( cch <= cchSuff
|| strcmp(&pOpts->szOutput[cch - cchSuff], pOpts->pszSuff))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Input file does not end with: '%s'", pOpts->pszSuff);
pOpts->szOutput[cch - cchSuff] = '\0';
if (!RTPathFilename(pOpts->szOutput))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error constructing output filename: Input file name is all suffix.");
}
else
{
rc = RTStrCat(pOpts->szOutput, sizeof(pOpts->szOutput), pOpts->pszSuff);
if (RT_FAILURE(rc))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error constructing output filename: %Rrc", rc);
}
/* Open the output file. */
uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE;
if (pOpts->fForce)
fOpen |= RTFILE_O_CREATE_REPLACE;
else
fOpen |= RTFILE_O_CREATE;
rc = RTVfsIoStrmOpenNormal(pOpts->szOutput, fOpen, phVfsIos);
if (RT_FAILURE(rc))
return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error opening output file '%s': %Rrc", pOpts->szOutput, rc);
}
return RTEXITCODE_SUCCESS;
}
示例15: DECLVBGL
DECLVBGL(int) VbglR0CrCtlConConnect(VBGLCRCTLHANDLE hCtl, HGCMCLIENTID *pidClient)
{
VBoxGuestHGCMConnectInfo info;
int rc;
if (!hCtl || !pidClient)
return VERR_INVALID_PARAMETER;
RT_ZERO(info);
info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
RTStrCopy(info.Loc.u.host.achName, sizeof(info.Loc.u.host.achName), "VBoxSharedCrOpenGL");
rc = vbglDriverIOCtl(&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, sizeof(info));
if (RT_SUCCESS(rc))
{
rc = info.result;
if (RT_SUCCESS(rc))
{
Assert(info.u32ClientID);
*pidClient = info.u32ClientID;
return rc;
}
}
AssertRC(rc);
*pidClient = 0;
return rc;
}