Changeset 62850 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Aug 1, 2016 10:00:52 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109446
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r61893 r62850 362 362 uint32_t fPollEvt, PRTPIPE phPipeR, uint32_t idPollHnd) 363 363 { 364 RT_NOREF1(fPollEvt); 364 365 AssertPtrReturn(pProcess, VERR_INVALID_POINTER); 365 366 … … 1362 1363 VGSvcVerbose(3, "Starting process '%s' ...\n", szExecExp); 1363 1364 1364 const char *pszUser ;1365 const char *pszUser = pszAsUser; 1365 1366 #ifdef RT_OS_WINDOWS 1366 1367 /* If a domain name is given, construct an UPN (User Principle Name) with … … 1377 1378 } 1378 1379 } 1379 1380 if (!pszUserUPN) /* Fallback */ 1381 #endif 1382 pszUser = pszAsUser; 1380 #endif 1383 1381 1384 1382 /* Do normal execution. */ … … 1532 1530 * Create the environment. 1533 1531 */ 1534 RTENV hEnv;1535 1532 if (RT_SUCCESS(rc)) 1533 { 1534 RTENV hEnv; 1536 1535 rc = RTEnvClone(&hEnv, RTENV_DEFAULT); 1537 if (RT_SUCCESS(rc))1538 {1539 size_t i;1540 for (i = 0; i < uNumEnvVars && papszEnv; i++)1541 {1542 rc = RTEnvPutEx(hEnv, papszEnv[i]);1543 if (RT_FAILURE(rc))1544 break;1545 }1546 1536 if (RT_SUCCESS(rc)) 1547 1537 { 1548 /* 1549 * Setup the redirection of the standard stuff. 1550 */ 1551 /** @todo consider supporting: gcc stuff.c >file 2>&1. */ 1552 RTHANDLE hStdIn; 1553 PRTHANDLE phStdIn; 1554 rc = vgsvcGstCtrlProcessSetupPipe("|", 0 /*STDIN_FILENO*/, 1555 &hStdIn, &phStdIn, &pProcess->hPipeStdInW); 1538 size_t i; 1539 for (i = 0; i < uNumEnvVars && papszEnv; i++) 1540 { 1541 rc = RTEnvPutEx(hEnv, papszEnv[i]); 1542 if (RT_FAILURE(rc)) 1543 break; 1544 } 1556 1545 if (RT_SUCCESS(rc)) 1557 1546 { 1558 RTHANDLE hStdOut; 1559 PRTHANDLE phStdOut; 1560 rc = vgsvcGstCtrlProcessSetupPipe( (pProcess->StartupInfo.uFlags & EXECUTEPROCESSFLAG_WAIT_STDOUT) 1561 ? "|" : "/dev/null", 1562 1 /*STDOUT_FILENO*/, 1563 &hStdOut, &phStdOut, &pProcess->hPipeStdOutR); 1547 /* 1548 * Setup the redirection of the standard stuff. 1549 */ 1550 /** @todo consider supporting: gcc stuff.c >file 2>&1. */ 1551 RTHANDLE hStdIn; 1552 PRTHANDLE phStdIn; 1553 rc = vgsvcGstCtrlProcessSetupPipe("|", 0 /*STDIN_FILENO*/, 1554 &hStdIn, &phStdIn, &pProcess->hPipeStdInW); 1564 1555 if (RT_SUCCESS(rc)) 1565 1556 { 1566 RTHANDLE hStd Err;1567 PRTHANDLE phStd Err;1568 rc = vgsvcGstCtrlProcessSetupPipe( (pProcess->StartupInfo.uFlags & EXECUTEPROCESSFLAG_WAIT_STD ERR)1557 RTHANDLE hStdOut; 1558 PRTHANDLE phStdOut; 1559 rc = vgsvcGstCtrlProcessSetupPipe( (pProcess->StartupInfo.uFlags & EXECUTEPROCESSFLAG_WAIT_STDOUT) 1569 1560 ? "|" : "/dev/null", 1570 2 /*STDERR_FILENO*/,1571 &hStd Err, &phStdErr, &pProcess->hPipeStdErrR);1561 1 /*STDOUT_FILENO*/, 1562 &hStdOut, &phStdOut, &pProcess->hPipeStdOutR); 1572 1563 if (RT_SUCCESS(rc)) 1573 1564 { 1574 /* 1575 * Create a poll set for the pipes and let the 1576 * transport layer add stuff to it as well. 1577 */ 1578 rc = RTPollSetCreate(&pProcess->hPollSet); 1565 RTHANDLE hStdErr; 1566 PRTHANDLE phStdErr; 1567 rc = vgsvcGstCtrlProcessSetupPipe( (pProcess->StartupInfo.uFlags & EXECUTEPROCESSFLAG_WAIT_STDERR) 1568 ? "|" : "/dev/null", 1569 2 /*STDERR_FILENO*/, 1570 &hStdErr, &phStdErr, &pProcess->hPipeStdErrR); 1579 1571 if (RT_SUCCESS(rc)) 1580 1572 { 1581 uint32_t uFlags = RTPOLL_EVT_ERROR; 1582 #if 0 1583 /* Add reading event to pollset to get some more information. */ 1584 uFlags |= RTPOLL_EVT_READ; 1585 #endif 1586 /* Stdin. */ 1587 if (RT_SUCCESS(rc)) 1588 rc = RTPollSetAddPipe(pProcess->hPollSet, 1589 pProcess->hPipeStdInW, RTPOLL_EVT_ERROR, VBOXSERVICECTRLPIPEID_STDIN); 1590 /* Stdout. */ 1591 if (RT_SUCCESS(rc)) 1592 rc = RTPollSetAddPipe(pProcess->hPollSet, 1593 pProcess->hPipeStdOutR, uFlags, VBOXSERVICECTRLPIPEID_STDOUT); 1594 /* Stderr. */ 1595 if (RT_SUCCESS(rc)) 1596 rc = RTPollSetAddPipe(pProcess->hPollSet, 1597 pProcess->hPipeStdErrR, uFlags, VBOXSERVICECTRLPIPEID_STDERR); 1598 /* IPC notification pipe. */ 1599 if (RT_SUCCESS(rc)) 1600 rc = RTPipeCreate(&pProcess->hNotificationPipeR, &pProcess->hNotificationPipeW, 0 /* Flags */); 1601 if (RT_SUCCESS(rc)) 1602 rc = RTPollSetAddPipe(pProcess->hPollSet, 1603 pProcess->hNotificationPipeR, RTPOLL_EVT_READ, VBOXSERVICECTRLPIPEID_IPC_NOTIFY); 1573 /* 1574 * Create a poll set for the pipes and let the 1575 * transport layer add stuff to it as well. 1576 */ 1577 rc = RTPollSetCreate(&pProcess->hPollSet); 1604 1578 if (RT_SUCCESS(rc)) 1605 1579 { 1606 AssertPtr(pProcess->pSession); 1607 bool fNeedsImpersonation = !(pProcess->pSession->fFlags & VBOXSERVICECTRLSESSION_FLAG_SPAWN); 1608 1609 rc = vgsvcGstCtrlProcessCreateProcess(pProcess->StartupInfo.szCmd, papszArgs, hEnv, 1610 pProcess->StartupInfo.uFlags, 1611 phStdIn, phStdOut, phStdErr, 1612 fNeedsImpersonation ? pProcess->StartupInfo.szUser : NULL, 1613 fNeedsImpersonation ? pProcess->StartupInfo.szPassword : NULL, 1614 fNeedsImpersonation ? pProcess->StartupInfo.szDomain : NULL, 1615 &pProcess->hProcess); 1616 if (RT_FAILURE(rc)) 1617 VGSvcError("Error starting process, rc=%Rrc\n", rc); 1618 /* 1619 * Tell the session thread that it can continue 1620 * spawning guest processes. This needs to be done after the new 1621 * process has been started because otherwise signal handling 1622 * on (Open) Solaris does not work correctly (see @bugref{5068}). 1623 */ 1624 int rc2 = RTThreadUserSignal(RTThreadSelf()); 1580 uint32_t uFlags = RTPOLL_EVT_ERROR; 1581 #if 0 1582 /* Add reading event to pollset to get some more information. */ 1583 uFlags |= RTPOLL_EVT_READ; 1584 #endif 1585 /* Stdin. */ 1625 1586 if (RT_SUCCESS(rc)) 1626 rc = rc2; 1627 fSignalled = true; 1628 1587 rc = RTPollSetAddPipe(pProcess->hPollSet, 1588 pProcess->hPipeStdInW, RTPOLL_EVT_ERROR, VBOXSERVICECTRLPIPEID_STDIN); 1589 /* Stdout. */ 1590 if (RT_SUCCESS(rc)) 1591 rc = RTPollSetAddPipe(pProcess->hPollSet, 1592 pProcess->hPipeStdOutR, uFlags, VBOXSERVICECTRLPIPEID_STDOUT); 1593 /* Stderr. */ 1594 if (RT_SUCCESS(rc)) 1595 rc = RTPollSetAddPipe(pProcess->hPollSet, 1596 pProcess->hPipeStdErrR, uFlags, VBOXSERVICECTRLPIPEID_STDERR); 1597 /* IPC notification pipe. */ 1598 if (RT_SUCCESS(rc)) 1599 rc = RTPipeCreate(&pProcess->hNotificationPipeR, &pProcess->hNotificationPipeW, 0 /* Flags */); 1600 if (RT_SUCCESS(rc)) 1601 rc = RTPollSetAddPipe(pProcess->hPollSet, 1602 pProcess->hNotificationPipeR, RTPOLL_EVT_READ, VBOXSERVICECTRLPIPEID_IPC_NOTIFY); 1629 1603 if (RT_SUCCESS(rc)) 1630 1604 { 1605 AssertPtr(pProcess->pSession); 1606 bool fNeedsImpersonation = !(pProcess->pSession->fFlags & VBOXSERVICECTRLSESSION_FLAG_SPAWN); 1607 1608 rc = vgsvcGstCtrlProcessCreateProcess(pProcess->StartupInfo.szCmd, papszArgs, hEnv, 1609 pProcess->StartupInfo.uFlags, 1610 phStdIn, phStdOut, phStdErr, 1611 fNeedsImpersonation ? pProcess->StartupInfo.szUser : NULL, 1612 fNeedsImpersonation ? pProcess->StartupInfo.szPassword : NULL, 1613 fNeedsImpersonation ? pProcess->StartupInfo.szDomain : NULL, 1614 &pProcess->hProcess); 1615 if (RT_FAILURE(rc)) 1616 VGSvcError("Error starting process, rc=%Rrc\n", rc); 1631 1617 /* 1632 * Close the child ends of any pipes and redirected files. 1618 * Tell the session thread that it can continue 1619 * spawning guest processes. This needs to be done after the new 1620 * process has been started because otherwise signal handling 1621 * on (Open) Solaris does not work correctly (see @bugref{5068}). 1633 1622 */ 1634 rc2 = RTHandleClose(phStdIn); AssertRC(rc2); 1635 phStdIn = NULL; 1636 rc2 = RTHandleClose(phStdOut); AssertRC(rc2); 1637 phStdOut = NULL; 1638 rc2 = RTHandleClose(phStdErr); AssertRC(rc2); 1639 phStdErr = NULL; 1640 1641 /* Enter the process main loop. */ 1642 rc = vgsvcGstCtrlProcessProcLoop(pProcess); 1643 1644 /* 1645 * The handles that are no longer in the set have 1646 * been closed by the above call in order to prevent 1647 * the guest from getting stuck accessing them. 1648 * So, NIL the handles to avoid closing them again. 1649 */ 1650 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet, 1651 VBOXSERVICECTRLPIPEID_IPC_NOTIFY, NULL))) 1623 int rc2 = RTThreadUserSignal(RTThreadSelf()); 1624 if (RT_SUCCESS(rc)) 1625 rc = rc2; 1626 fSignalled = true; 1627 1628 if (RT_SUCCESS(rc)) 1652 1629 { 1653 pProcess->hNotificationPipeR = NIL_RTPIPE; 1654 pProcess->hNotificationPipeW = NIL_RTPIPE; 1630 /* 1631 * Close the child ends of any pipes and redirected files. 1632 */ 1633 rc2 = RTHandleClose(phStdIn); AssertRC(rc2); 1634 phStdIn = NULL; 1635 rc2 = RTHandleClose(phStdOut); AssertRC(rc2); 1636 phStdOut = NULL; 1637 rc2 = RTHandleClose(phStdErr); AssertRC(rc2); 1638 phStdErr = NULL; 1639 1640 /* Enter the process main loop. */ 1641 rc = vgsvcGstCtrlProcessProcLoop(pProcess); 1642 1643 /* 1644 * The handles that are no longer in the set have 1645 * been closed by the above call in order to prevent 1646 * the guest from getting stuck accessing them. 1647 * So, NIL the handles to avoid closing them again. 1648 */ 1649 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet, 1650 VBOXSERVICECTRLPIPEID_IPC_NOTIFY, NULL))) 1651 { 1652 pProcess->hNotificationPipeR = NIL_RTPIPE; 1653 pProcess->hNotificationPipeW = NIL_RTPIPE; 1654 } 1655 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet, 1656 VBOXSERVICECTRLPIPEID_STDERR, NULL))) 1657 pProcess->hPipeStdErrR = NIL_RTPIPE; 1658 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet, 1659 VBOXSERVICECTRLPIPEID_STDOUT, NULL))) 1660 pProcess->hPipeStdOutR = NIL_RTPIPE; 1661 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet, 1662 VBOXSERVICECTRLPIPEID_STDIN, NULL))) 1663 pProcess->hPipeStdInW = NIL_RTPIPE; 1655 1664 } 1656 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet,1657 VBOXSERVICECTRLPIPEID_STDERR, NULL)))1658 pProcess->hPipeStdErrR = NIL_RTPIPE;1659 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet,1660 VBOXSERVICECTRLPIPEID_STDOUT, NULL)))1661 pProcess->hPipeStdOutR = NIL_RTPIPE;1662 if (RT_FAILURE(RTPollSetQueryHandle(pProcess->hPollSet,1663 VBOXSERVICECTRLPIPEID_STDIN, NULL)))1664 pProcess->hPipeStdInW = NIL_RTPIPE;1665 1665 } 1666 RTPollSetDestroy(pProcess->hPollSet); 1667 1668 RTPipeClose(pProcess->hNotificationPipeR); 1669 pProcess->hNotificationPipeR = NIL_RTPIPE; 1670 RTPipeClose(pProcess->hNotificationPipeW); 1671 pProcess->hNotificationPipeW = NIL_RTPIPE; 1666 1672 } 1667 RTPollSetDestroy(pProcess->hPollSet); 1668 1669 RTPipeClose(pProcess->hNotificationPipeR); 1670 pProcess->hNotificationPipeR = NIL_RTPIPE; 1671 RTPipeClose(pProcess->hNotificationPipeW); 1672 pProcess->hNotificationPipeW = NIL_RTPIPE; 1673 RTPipeClose(pProcess->hPipeStdErrR); 1674 pProcess->hPipeStdErrR = NIL_RTPIPE; 1675 RTHandleClose(phStdErr); 1676 if (phStdErr) 1677 RTHandleClose(phStdErr); 1673 1678 } 1674 RTPipeClose(pProcess->hPipeStd ErrR);1675 pProcess->hPipeStd ErrR = NIL_RTPIPE;1676 RTHandleClose( phStdErr);1677 if (phStd Err)1678 RTHandleClose(phStd Err);1679 RTPipeClose(pProcess->hPipeStdOutR); 1680 pProcess->hPipeStdOutR = NIL_RTPIPE; 1681 RTHandleClose(&hStdOut); 1682 if (phStdOut) 1683 RTHandleClose(phStdOut); 1679 1684 } 1680 RTPipeClose(pProcess->hPipeStdOutR); 1681 pProcess->hPipeStdOutR = NIL_RTPIPE; 1682 RTHandleClose(&hStdOut); 1683 if (phStdOut) 1684 RTHandleClose(phStdOut); 1685 RTPipeClose(pProcess->hPipeStdInW); 1686 pProcess->hPipeStdInW = NIL_RTPIPE; 1687 RTHandleClose(phStdIn); 1685 1688 } 1686 RTPipeClose(pProcess->hPipeStdInW); 1687 pProcess->hPipeStdInW = NIL_RTPIPE; 1688 RTHandleClose(phStdIn); 1689 } 1690 } 1691 RTEnvDestroy(hEnv); 1689 } 1690 RTEnvDestroy(hEnv); 1691 } 1692 1692 } 1693 1693 … … 1759 1759 static DECLCALLBACK(int) vgsvcGstCtrlProcessThread(RTTHREAD hThreadSelf, void *pvUser) 1760 1760 { 1761 RT_NOREF1(hThreadSelf); 1761 1762 PVBOXSERVICECTRLPROCESS pProcess = (PVBOXSERVICECTRLPROCESS)pvUser; 1762 1763 AssertPtrReturn(pProcess, VERR_INVALID_POINTER); … … 2022 2023 RTMSINTERVAL uTimeoutMS, PRTREQ pReq, PFNRT pfnFunction, unsigned cArgs, va_list Args) 2023 2024 { 2025 RT_NOREF1(pHostCtx); 2024 2026 AssertPtrReturn(pProcess, VERR_INVALID_POINTER); 2025 2027 /* pHostCtx is optional. */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r62521 r62850 510 510 default: 511 511 rc = VERR_NOT_SUPPORTED; 512 uSeekMethodIprt = RTFILE_SEEK_BEGIN; /* Shut up MSC */ 512 513 break; 513 514 } … … 758 759 uint32_t cbSize; 759 760 761 #if 0 /* unused */ 760 762 uint32_t uStatus = INPUT_STS_UNDEFINED; /* Status sent back to the host. */ 761 763 uint32_t cbWritten = 0; /* Number of bytes written to the guest. */ 764 #endif 762 765 763 766 /* … … 1086 1089 1087 1090 int rcWait; 1088 if (RT_SUCCESS(rc)) 1089 { 1090 uint32_t uTimeoutsMS = 30 * 1000; /** @todo Make this configurable. Later. */ 1091 uint64_t u64TimeoutStart = 0; 1092 1093 for (;;) 1094 { 1095 rcWait = RTProcWaitNoResume(pThread->hProcess, RTPROCWAIT_FLAGS_NOBLOCK, &ProcessStatus); 1096 if (RT_UNLIKELY(rcWait == VERR_INTERRUPTED)) 1097 continue; 1098 1099 if ( rcWait == VINF_SUCCESS 1100 || rcWait == VERR_PROCESS_NOT_FOUND) 1091 uint32_t uTimeoutsMS = 30 * 1000; /** @todo Make this configurable. Later. */ 1092 uint64_t u64TimeoutStart = 0; 1093 1094 for (;;) 1095 { 1096 rcWait = RTProcWaitNoResume(pThread->hProcess, RTPROCWAIT_FLAGS_NOBLOCK, &ProcessStatus); 1097 if (RT_UNLIKELY(rcWait == VERR_INTERRUPTED)) 1098 continue; 1099 1100 if ( rcWait == VINF_SUCCESS 1101 || rcWait == VERR_PROCESS_NOT_FOUND) 1102 { 1103 fProcessAlive = false; 1104 break; 1105 } 1106 AssertMsgBreak(rcWait == VERR_PROCESS_RUNNING, 1107 ("Got unexpected rc=%Rrc while waiting for session process termination\n", rcWait)); 1108 1109 if (ASMAtomicReadBool(&pThread->fShutdown)) 1110 { 1111 if (!u64TimeoutStart) 1101 1112 { 1102 fProcessAlive = false; 1103 break; 1113 VGSvcVerbose(3, "Notifying guest session process (PID=%RU32, session ID=%RU32) ...\n", 1114 pThread->hProcess, uSessionID); 1115 1116 VBGLR3GUESTCTRLCMDCTX hostCtx = 1117 { 1118 /* .idClient = */ uClientID, 1119 /* .idContext = */ VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(uSessionID), 1120 /* .uProtocol = */ pThread->StartupInfo.uProtocol, 1121 /* .cParams = */ 2 1122 }; 1123 rc = VbglR3GuestCtrlSessionClose(&hostCtx, 0 /* fFlags */); 1124 if (RT_FAILURE(rc)) 1125 { 1126 VGSvcError("Unable to notify guest session process (PID=%RU32, session ID=%RU32), rc=%Rrc\n", 1127 pThread->hProcess, uSessionID, rc); 1128 1129 if (rc == VERR_NOT_SUPPORTED) 1130 { 1131 /* Terminate guest session process in case it's not supported by a too old host. */ 1132 rc = RTProcTerminate(pThread->hProcess); 1133 VGSvcVerbose(3, "Terminating guest session process (PID=%RU32) ended with rc=%Rrc\n", 1134 pThread->hProcess, rc); 1135 } 1136 break; 1137 } 1138 1139 VGSvcVerbose(3, "Guest session ID=%RU32 thread was asked to terminate, waiting for session process to exit (%RU32ms timeout) ...\n", 1140 uSessionID, uTimeoutsMS); 1141 u64TimeoutStart = RTTimeMilliTS(); 1142 continue; /* Don't waste time on waiting. */ 1104 1143 } 1105 AssertMsgBreak(rcWait == VERR_PROCESS_RUNNING, 1106 ("Got unexpected rc=%Rrc while waiting for session process termination\n", rcWait)); 1107 1108 if (ASMAtomicReadBool(&pThread->fShutdown)) 1144 if (RTTimeMilliTS() - u64TimeoutStart > uTimeoutsMS) 1109 1145 { 1110 if (!u64TimeoutStart) 1111 { 1112 VGSvcVerbose(3, "Notifying guest session process (PID=%RU32, session ID=%RU32) ...\n", 1113 pThread->hProcess, uSessionID); 1114 1115 VBGLR3GUESTCTRLCMDCTX hostCtx = 1116 { 1117 /* .idClient = */ uClientID, 1118 /* .idContext = */ VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(uSessionID), 1119 /* .uProtocol = */ pThread->StartupInfo.uProtocol, 1120 /* .cParams = */ 2 1121 }; 1122 rc = VbglR3GuestCtrlSessionClose(&hostCtx, 0 /* fFlags */); 1123 if (RT_FAILURE(rc)) 1124 { 1125 VGSvcError("Unable to notify guest session process (PID=%RU32, session ID=%RU32), rc=%Rrc\n", 1126 pThread->hProcess, uSessionID, rc); 1127 1128 if (rc == VERR_NOT_SUPPORTED) 1129 { 1130 /* Terminate guest session process in case it's not supported by a too old host. */ 1131 rc = RTProcTerminate(pThread->hProcess); 1132 VGSvcVerbose(3, "Terminating guest session process (PID=%RU32) ended with rc=%Rrc\n", 1133 pThread->hProcess, rc); 1134 } 1135 break; 1136 } 1137 1138 VGSvcVerbose(3, "Guest session ID=%RU32 thread was asked to terminate, waiting for session process to exit (%RU32ms timeout) ...\n", 1139 uSessionID, uTimeoutsMS); 1140 u64TimeoutStart = RTTimeMilliTS(); 1141 continue; /* Don't waste time on waiting. */ 1142 } 1143 if (RTTimeMilliTS() - u64TimeoutStart > uTimeoutsMS) 1144 { 1145 VGSvcVerbose(3, "Guest session ID=%RU32 process did not shut down within time\n", uSessionID); 1146 break; 1147 } 1146 VGSvcVerbose(3, "Guest session ID=%RU32 process did not shut down within time\n", uSessionID); 1147 break; 1148 1148 } 1149 1150 RTThreadSleep(100); /* Wait a bit. */ 1151 }1152 1153 if (!fProcessAlive) 1154 {1155 VGSvcVerbose(2, "Guest session process (ID=%RU32) terminated with rc=%Rrc, reason=%d, status=%d\n",1156 uSessionID, rcWait, ProcessStatus.enmReason, ProcessStatus.iStatus);1157 if (ProcessStatus.iStatus == RTEXITCODE_INIT)1158 {1159 VGSvcError("Guest session process (ID=%RU32) failed to initialize. Here some hints:\n", uSessionID);1160 VGSvcError("- Is logging enabled and the output directory is read-only by the guest session user?\n");1161 /** @todo Add more here. */1162 }1149 } 1150 1151 RTThreadSleep(100); /* Wait a bit. */ 1152 } 1153 1154 if (!fProcessAlive) 1155 { 1156 VGSvcVerbose(2, "Guest session process (ID=%RU32) terminated with rc=%Rrc, reason=%d, status=%d\n", 1157 uSessionID, rcWait, ProcessStatus.enmReason, ProcessStatus.iStatus); 1158 if (ProcessStatus.iStatus == RTEXITCODE_INIT) 1159 { 1160 VGSvcError("Guest session process (ID=%RU32) failed to initialize. Here some hints:\n", uSessionID); 1161 VGSvcError("- Is logging enabled and the output directory is read-only by the guest session user?\n"); 1162 /** @todo Add more here. */ 1163 1163 } 1164 1164 } … … 1650 1650 PVBOXSERVICECTRLSESSIONTHREAD pSessionThread, uint32_t uCtrlSessionThread) 1651 1651 { 1652 RT_NOREF1(uCtrlSessionThread); 1653 1652 1654 /* 1653 1655 * Is this an anonymous session? Anonymous sessions run with the same … … 1830 1832 } 1831 1833 #else 1832 RTHANDLE hStdIn;1833 1834 if (RT_SUCCESS(rc)) 1835 { 1836 RTHANDLE hStdIn; 1834 1837 rc = RTFileOpenBitBucket(&hStdIn.u.hFile, RTFILE_O_READ); 1835 if (RT_SUCCESS(rc))1836 {1837 hStdIn.enmType = RTHANDLETYPE_FILE;1838 1839 RTHANDLE hStdOutAndErr;1840 rc = RTFileOpenBitBucket(&hStdOutAndErr.u.hFile, RTFILE_O_WRITE);1841 1838 if (RT_SUCCESS(rc)) 1842 1839 { 1843 hStdOutAndErr.enmType = RTHANDLETYPE_FILE; 1844 1845 const char *pszUser; 1840 hStdIn.enmType = RTHANDLETYPE_FILE; 1841 1842 RTHANDLE hStdOutAndErr; 1843 rc = RTFileOpenBitBucket(&hStdOutAndErr.u.hFile, RTFILE_O_WRITE); 1844 if (RT_SUCCESS(rc)) 1845 { 1846 hStdOutAndErr.enmType = RTHANDLETYPE_FILE; 1847 1848 const char *pszUser = pSessionThread->StartupInfo.szUser; 1846 1849 # ifdef RT_OS_WINDOWS 1847 /* If a domain name is given, construct an UPN (User Principle Name) with 1848 * the domain name built-in, e.g. "[email protected]". */ 1849 char *pszUserUPN = NULL; 1850 if (strlen(pSessionThread->StartupInfo.szDomain)) 1851 { 1852 int cbUserUPN = RTStrAPrintf(&pszUserUPN, "%s@%s", 1853 pSessionThread->StartupInfo.szUser, 1854 pSessionThread->StartupInfo.szDomain); 1855 if (cbUserUPN > 0) 1850 /* If a domain name is given, construct an UPN (User Principle Name) with 1851 * the domain name built-in, e.g. "[email protected]". */ 1852 char *pszUserUPN = NULL; 1853 if (strlen(pSessionThread->StartupInfo.szDomain)) 1856 1854 { 1857 pszUser = pszUserUPN; 1858 VGSvcVerbose(3, "Using UPN: %s\n", pszUserUPN); 1855 int cbUserUPN = RTStrAPrintf(&pszUserUPN, "%s@%s", 1856 pSessionThread->StartupInfo.szUser, 1857 pSessionThread->StartupInfo.szDomain); 1858 if (cbUserUPN > 0) 1859 { 1860 pszUser = pszUserUPN; 1861 VGSvcVerbose(3, "Using UPN: %s\n", pszUserUPN); 1862 } 1859 1863 } 1864 # endif 1865 1866 rc = RTProcCreateEx(pszExeName, apszArgs, RTENV_DEFAULT, fProcCreate, 1867 &hStdIn, &hStdOutAndErr, &hStdOutAndErr, 1868 !fAnonymous ? pszUser : NULL, 1869 !fAnonymous ? pSessionThread->StartupInfo.szPassword : NULL, 1870 &pSessionThread->hProcess); 1871 # ifdef RT_OS_WINDOWS 1872 if (pszUserUPN) 1873 RTStrFree(pszUserUPN); 1874 # endif 1875 RTFileClose(hStdOutAndErr.u.hFile); 1860 1876 } 1861 1877 1862 if (!pszUserUPN) /* Fallback */ 1863 # endif 1864 pszUser = pSessionThread->StartupInfo.szUser; 1865 1866 rc = RTProcCreateEx(pszExeName, apszArgs, RTENV_DEFAULT, fProcCreate, 1867 &hStdIn, &hStdOutAndErr, &hStdOutAndErr, 1868 !fAnonymous ? pszUser : NULL, 1869 !fAnonymous ? pSessionThread->StartupInfo.szPassword : NULL, 1870 &pSessionThread->hProcess); 1871 # ifdef RT_OS_WINDOWS 1872 if (pszUserUPN) 1873 RTStrFree(pszUserUPN); 1874 # endif 1875 RTFileClose(hStdOutAndErr.u.hFile); 1878 RTFileClose(hStdIn.u.hFile); 1876 1879 } 1877 1878 RTFileClose(hStdIn.u.hFile);1879 1880 } 1880 1881 #endif … … 2013 2014 int VGSvcGstCtrlSessionThreadWait(PVBOXSERVICECTRLSESSIONTHREAD pThread, uint32_t uTimeoutMS, uint32_t fFlags) 2014 2015 { 2016 RT_NOREF1(fFlags); 2015 2017 AssertPtrReturn(pThread, VERR_INVALID_POINTER); 2016 2018 /** @todo Validate closing flags. */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
r62470 r62850 413 413 414 414 int rc = VINF_SUCCESS; 415 bool fUsageOK = true;416 415 417 416 const char *pszOutput = NULL; … … 1104 1103 AssertRCReturn(rc, RTEXITCODE_INIT); 1105 1104 1106 bool fVerbose = false;1107 1105 uint32_t fFlags = 0; 1108 1106 uint32_t fOutputFlags = 0; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp
r62679 r62850 56 56 uint32_t cbBuf = _1K; 57 57 void *pvBuf = NULL; 58 int rc ;58 int rc = VINF_SUCCESS; /* MSC can't figure out the loop */ 59 59 60 60 *ppszValue = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.