OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Michle Fernando (tech_savyREDIFFMAIL.COM)
Date: Wed Aug 29 2001 - 02:44:34 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi Eric,
            I am enclosing my code with comment pls. find what is the error I am doing

    {
            HRESULT hRetVal;

            COSERVERINFO strServerInfo;
            COAUTHINFO strAuthInfo;
            COAUTHIDENTITY strIdentity;
            Itest *pItest = NULL;

            MULTI_QI strMultiQI[1];

            //Init Com Env
            hRetVal = CoInitialize(NULL);
            if(FAILED(hRetVal))
            {
                    MessageBox("Error while initializing Com Env.....");
                    return;
            }
            
            //Server Info
            strServerInfo.dwReserved1 = 0;
            strServerInfo.pwszName = (LPWSTR) malloc ((wcslen(SERVER_NAME)+1) * sizeof(WCHAR));
            wcscpy(strServerInfo.pwszName, L"163.37.69.241"); //Here I am setting the Remote server Name
            strServerInfo.pAuthInfo = &strAuthInfo;
            strServerInfo.dwReserved2;

            //Authentication Info
            strAuthInfo.dwAuthnSvc = RPC_C_AUTHN_WINNT;
            strAuthInfo.dwAuthzSvc = RPC_C_AUTHZ_NONE;
            strAuthInfo.pwszServerPrincName = NULL;
            strAuthInfo.dwAuthnLevel = RPC_C_AUTHN_LEVEL_CONNECT;
            strAuthInfo.dwImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE;
            strAuthInfo.pAuthIdentityData = &strIdentity;
            strAuthInfo.dwCapabilities = 0;

            //Identity Info
            strIdentity.User = (USHORT *) malloc ((wcslen(L"guest")+1) * sizeof(USHORT));
            wcscpy(strIdentity.User,L"guest"); //User ID
            strIdentity.UserLength = wcslen(strIdentity.User);
            strIdentity.Domain = (USHORT *) malloc ((wcslen(L"pinnacle")+1) * sizeof(USHORT));
            wcscpy(strIdentity.Domain, L"testdomain"); //Domain Name
            strIdentity.DomainLength = wcslen(strIdentity.Domain);
            strIdentity.Password = (USHORT *) malloc ((wcslen(L"guest123")+1) * sizeof(USHORT));
            wcscpy(strIdentity.Password, L"guest123"); //Password
            strIdentity.PasswordLength = wcslen(strIdentity.Password);
            strIdentity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;

            strMultiQI[0].hr = 0;
            strMultiQI[0].pIID = &IID_Itest;
            strMultiQI[0].pItf = NULL;

            hRetVal = CoCreateInstanceEx(CLSID_test, NULL, CLSCTX_REMOTE_SERVER, &strServerInfo, 1, &strMultiQI);
            //hRetVal = CoGetClassObject(CLSID_test, CLSCTX_ALL, &strServerInfo, IID_Itest, (LPVOID *)&pItest);
            if(FAILED(hRetVal))
            {
                    MessageBox("Error while Creating Component");
                    goto Err_OnButton1;
            }

    Err_OnButton1:
            CoUninitialize();
    }

    Regards,
    Michle

     
    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM