Changeset 64292 in vbox for trunk/src/VBox/Additions/WINNT/Installer
- Timestamp:
- Oct 17, 2016 10:38:53 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp
r64291 r64292 33 33 #include <iprt/localipc.h> 34 34 #include <iprt/mem.h> 35 #include <iprt/process.h> 35 36 #include <iprt/string.h> 36 37 … … 138 139 static int vboxConnectToVBoxTray(RTLOCALIPCSESSION *phSession) 139 140 { 140 int rc = VINF_SUCCESS; 141 142 RTUTF16 wszUserName[255]; 143 DWORD cchUserName = sizeof(wszUserName) / sizeof(RTUTF16); 144 BOOL fRc = GetUserNameW(wszUserName, &cchUserName); 145 if (!fRc) 146 rc = RTErrConvertFromWin32(GetLastError()); 147 141 char szPipeName[512 + sizeof(VBOXTRAY_IPC_PIPE_PREFIX)]; 142 memcpy(szPipeName, VBOXTRAY_IPC_PIPE_PREFIX, sizeof(VBOXTRAY_IPC_PIPE_PREFIX)); 143 int rc = RTProcQueryUsername(NIL_RTPROCESS, 144 &szPipeName[sizeof(VBOXTRAY_IPC_PIPE_PREFIX) - 1], 145 sizeof(szPipeName) - sizeof(VBOXTRAY_IPC_PIPE_PREFIX) + 1, 146 NULL /*pcbUser*/); 148 147 if (RT_SUCCESS(rc)) 149 { 150 char *pszUserName; 151 rc = RTUtf16ToUtf8(wszUserName, &pszUserName); 152 if (RT_SUCCESS(rc)) 153 { 154 char szPipeName[255]; 155 if (RTStrPrintf(szPipeName, sizeof(szPipeName), "%s%s", 156 VBOXTRAY_IPC_PIPE_PREFIX, pszUserName)) 157 { 158 rc = RTLocalIpcSessionConnect(phSession, szPipeName, 0 /* Flags */); 159 } 160 else 161 rc = VERR_NO_MEMORY; 162 163 RTStrFree(pszUserName); 164 } 165 } 166 148 rc = RTLocalIpcSessionConnect(phSession, szPipeName, RTLOCALIPC_FLAGS_NATIVE_NAME); 167 149 return rc; 168 150 }
Note:
See TracChangeset
for help on using the changeset viewer.