locked
how to configure DCOM settings to create instance remotely on dll module? RRS feed

  • Question

  • Hi All:

    We have a dll module which is supposed to be run as DCOM server on remote PC.

    I could successfully create remote instance from my test program (console app), however I got Access Denied error when I try to do that in our enterprise App (from windows service), After the investigation, I found the difference is that my test program is running under login user account which is from Administrator group, while windows service is running under SYSTEM account. Even though I added Everyone, Anonymous accounts to Launch/Activiation and Access Permission of this dll in DCOM Config, I still failed to create instance remotely from windows service.

    Here is the code:

     

    ...
      // get server address and ServerUUID
    
    	// following code is commented as CoInitializeSecurity return error code even I could create instance successfully.
    	//sd.InitializeFromThreadToken();
    	//hr = CoInitializeSecurity( sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
    	//printf( "CoInitializeSecurity: hr = %d\n", hr );
    		
    	COSERVERINFO serverInfo = { 0 };
    
    	serverInfo.pwszName	= szServerAddr;
    	serverInfo.pAuthInfo	= 0;
    	serverInfo.dwReserved1	= 0;
    	serverInfo.dwReserved2	= 0;
    
    	MULTI_QI qi = {&(__uuidof(IAppServer)), NULL, S_OK};
    
    	hr = CoCreateInstanceEx( ServerUUID, NULL, CLSCTX_REMOTE_SERVER, &serverInfo, 1, &qi );
    	if(SUCCEEDED(hr))
    		m_pServer = (IAppServer *)qi.pItf;
    
    ...
    

     

    The test is running on XP sp3 client to XP sp3 server, I got same error on XP sp3 client to Vista server.

    I think if it's a EXE rather than DLL, all these settings should be sufficient to allow instance created remotely. However it's a DLL to be running in DllHost.exe, Do I need some extra settings?

    Any reference would be appreciated, thanks in advance!


    fight for future!
    Tuesday, May 25, 2010 5:55 AM