//+------------------------------------------------------------------------ // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1993. // // File: bm_regis.cxx // // Contents: Ole object registration test // // Classes: COleRegistrationTest // // History: 12-July-93 t-martig Created // //-------------------------------------------------------------------------- #include #pragma hdrstop #include #include extern COleTestClassFactory theFactory; const CLSID *apClsid[] = {&CLSID_COleTestClass1, &CLSID_COleTestClass2, &CLSID_COleTestClass3, &CLSID_COleTestClass4, &CLSID_COleTestClass5, &CLSID_COleTestClass6, &CLSID_COleTestClass7, &CLSID_COleTestClass8}; TCHAR *COleRegistrationTest::Name () { return TEXT("ObjRegistration"); } SCODE COleRegistrationTest::Setup (CTestInput *pInput) { HRESULT sc; CTestBase::Setup(pInput); // get the iteration count m_ulIterations = pInput->GetIterations(Name()); // for the inproc case. load a class factory object to register. // this is temporary to fix a problem (ambiguity) in inproc // registration. sc = pInput->GetGUID(&m_Clsid[0], Name(), apszClsIDName[0]); if (FAILED(sc)) { Log (TEXT("Setup - GetClassID failed."), sc); return sc; } sc = pInput->GetGUID(&m_Clsid[1], Name(), apszClsIDName[1]); if (FAILED(sc)) { Log (TEXT("Setup - GetClassID failed."), sc); return sc; } sc = InitCOM(); if (FAILED(sc)) { Log (TEXT("Setup - CoInitialize failed."), sc); return sc; } // get the class factory sc = CoGetClassObject(m_Clsid[0], dwaClsCtx[0], NULL, IID_IClassFactory, (void **)&m_apICF[0]); if (FAILED(sc)) { Log (TEXT("Setup - CoGetClassObject failed."), sc); return sc; } // for local server, register an internal class. m_apICF[1] = (IClassFactory *)&theFactory; // init internal state for (ULONG iCtx=0; iCtxRelease(); UninitCOM(); return S_OK; } SCODE COleRegistrationTest::Run () { CStopWatch sw; DWORD dwReg; for (ULONG iCtx=0; iCtxPause(IP_ITERPAUSE); } } return S_OK; } SCODE COleRegistrationTest::Report (CTestOutput &output) { output.WriteSectionHeader (Name(), TEXT("CoRegisterClassObject / CoRevokeClassObject"), *m_pInput); for (ULONG iCtx=0; iCtx