Changeset 50117 in vbox for trunk/src/VBox/Main/src-server/xpcom
- Timestamp:
- Jan 20, 2014 2:05:02 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 91661
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/xpcom/server_module.cpp
r47117 r50117 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 92 92 */ 93 93 94 NS_DECL_CLASSINFO 95 NS_IMPL_CI_INTERFACE_GETTER1 94 NS_DECL_CLASSINFO(VirtualBox) 95 NS_IMPL_CI_INTERFACE_GETTER1(VirtualBox, IVirtualBox) 96 96 97 97 static nsresult vboxsvcSpawnDaemon(void) … … 168 168 */ 169 169 static NS_IMETHODIMP 170 VirtualBoxConstructor 171 170 VirtualBoxConstructor(nsISupports *aOuter, REFNSIID aIID, 171 void **aResult) 172 172 { 173 173 LogFlowFuncEnter(); … … 189 189 /* Get the directory containing XPCOM components -- the VBoxSVC 190 190 * executable is expected in the parent directory. */ 191 nsCOMPtr <nsIProperties> dirServ = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rc);191 nsCOMPtr<nsIProperties> dirServ = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rc); 192 192 if (NS_SUCCEEDED(rc)) 193 193 { 194 nsCOMPtr 195 rc = dirServ->Get 196 NS_GET_IID (nsIFile), getter_AddRefs(componentDir));194 nsCOMPtr<nsIFile> componentDir; 195 rc = dirServ->Get(NS_XPCOM_COMPONENT_DIR, 196 NS_GET_IID(nsIFile), getter_AddRefs(componentDir)); 197 197 198 198 if (NS_SUCCEEDED(rc)) 199 199 { 200 200 nsCAutoString path; 201 componentDir->GetNativePath 202 203 LogFlowFunc 204 AssertBreakStmt (path.Length() + strlen(VBoxSVC_exe) < RTPATH_MAX,205 201 componentDir->GetNativePath(path); 202 203 LogFlowFunc(("component directory = \"%s\"\n", path.get())); 204 AssertBreakStmt(path.Length() + strlen(VBoxSVC_exe) < RTPATH_MAX, 205 rc = NS_ERROR_FAILURE); 206 206 207 207 #if defined(RT_OS_SOLARIS) && defined(VBOX_WITH_HARDENING) 208 208 char achKernArch[128]; 209 int cbKernArch = sysinfo 209 int cbKernArch = sysinfo(SI_ARCHITECTURE_K, achKernArch, sizeof(achKernArch)); 210 210 if (cbKernArch > 0) 211 211 { … … 216 216 rc = NS_ERROR_UNEXPECTED; 217 217 #else 218 strcpy 219 RTPathStripFilename 220 strcat 218 strcpy(VBoxSVCPath, path.get()); 219 RTPathStripFilename(VBoxSVCPath); 220 strcat(VBoxSVCPath, VBoxSVC_exe); 221 221 222 222 IsVBoxSVCPathSet = true; … … 228 228 } 229 229 230 nsCOMPtr <ipcIService> ipcServ = do_GetService(IPC_SERVICE_CONTRACTID, &rc);230 nsCOMPtr<ipcIService> ipcServ = do_GetService(IPC_SERVICE_CONTRACTID, &rc); 231 231 if (NS_FAILED(rc)) 232 232 break; … … 239 239 do 240 240 { 241 LogFlowFunc 241 LogFlowFunc(("Resolving server name \"%s\"...\n", VBOXSVC_IPC_NAME)); 242 242 243 243 PRUint32 serverID = 0; 244 rc = ipcServ->ResolveClientName 244 rc = ipcServ->ResolveClientName(VBOXSVC_IPC_NAME, &serverID); 245 245 if (NS_FAILED(rc)) 246 246 { 247 LogFlowFunc 247 LogFlowFunc(("Starting server \"%s\"...\n", VBoxSVCPath)); 248 248 249 249 startedOnce = true; … … 256 256 do 257 257 { 258 RTThreadSleep 259 rc = ipcServ->ResolveClientName 258 RTThreadSleep(VBoxSVC_WaitSlice); 259 rc = ipcServ->ResolveClientName(VBOXSVC_IPC_NAME, &serverID); 260 260 if (NS_SUCCEEDED(rc)) 261 261 break; … … 276 276 } 277 277 278 LogFlowFunc 279 280 nsCOMPtr 281 do_GetService 278 LogFlowFunc(("Connecting to server (ID=%d)...\n", serverID)); 279 280 nsCOMPtr<ipcIDConnectService> dconServ = 281 do_GetService(IPC_DCONNECTSERVICE_CONTRACTID, &rc); 282 282 if (NS_FAILED(rc)) 283 283 break; 284 284 285 rc = dconServ->CreateInstance 286 287 285 rc = dconServ->CreateInstance(serverID, 286 CLSID_VirtualBox, 287 aIID, aResult); 288 288 if (NS_SUCCEEDED(rc)) 289 289 break; 290 290 291 LogFlowFunc 291 LogFlowFunc(("Failed to connect (rc=%Rhrc (%#08x))\n", rc, rc)); 292 292 293 293 /* It's possible that the server gets shut down after we … … 298 298 { 299 299 nsresult rc2 = 300 ipcServ->ResolveClientName 300 ipcServ->ResolveClientName(VBOXSVC_IPC_NAME, &serverID); 301 301 if (NS_SUCCEEDED(rc2)) 302 302 break; 303 303 304 LogFlowFunc (("Server seems to have terminated before " 305 "receiving our request. Will try again.\n")); 304 LogFlowFunc(("Server seems to have terminated before receiving our request. Will try again.\n")); 306 305 } 307 306 else … … 312 311 while (0); 313 312 314 LogFlowFunc 313 LogFlowFunc(("rc=%Rhrc (%#08x), vrc=%Rrc\n", rc, rc, vrc)); 315 314 LogFlowFuncLeave(); 316 315 … … 331 330 */ 332 331 static NS_IMETHODIMP 333 VirtualBoxRegistration 334 335 336 337 332 VirtualBoxRegistration(nsIComponentManager *aCompMgr, 333 nsIFile *aPath, 334 const char *aLoaderStr, 335 const char *aType, 336 const nsModuleComponentInfo *aInfo) 338 337 { 339 338 nsCAutoString modulePath; 340 aPath->GetNativePath 339 aPath->GetNativePath(modulePath); 341 340 nsCAutoString moduleTarget; 342 aPath->GetNativeTarget 343 344 LogFlowFunc 345 341 aPath->GetNativeTarget(moduleTarget); 342 343 LogFlowFunc(("aPath=%s, aTarget=%s, aLoaderStr=%s, aType=%s\n", 344 modulePath.get(), moduleTarget.get(), aLoaderStr, aType)); 346 345 347 346 nsresult rc = NS_OK; … … 372 371 }; 373 372 374 NS_IMPL_NSGETMODULE 373 NS_IMPL_NSGETMODULE(VirtualBox_Server_Module, components)
Note:
See TracChangeset
for help on using the changeset viewer.