K
KaiNeugebauer
Guest
Hi all,
I'm not a specialist in OLE. I got a project with a working OLE functionality and a test program. My job is to put the existing OLE functionality to a service and the OLE has to work without any changes on the test program.
I created a service via:
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv);
VOID WINAPI ServiceCtrlHandler (DWORD);
DWORD WINAPI ServiceWorkerThread (LPVOID lpParam);
and I called the OLE functionality in the ServiceWorkerThread.
if (!AfxOleInit())
{
// AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
// This provides a NULL DACL which will allow access to everyone.
CSecurityDescriptor sd;
sd.InitializeFromThreadToken();
hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
//hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
_ASSERTE(SUCCEEDED(hr));
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), LIBID_S7WMEDAX))
return SELFREG_E_TYPELIB;
if (!COleObjectFactory::UpdateRegistryAll())
return SELFREG_E_CLASS;
All OLE calls work without error. Startig the test program I got during
AfxGetClassIDFromString(LPCTSTR lpsz, LPCLSID lpClsID)
the following error: Ungültige Klassenzeichenfolge --> Invalid class string
Has any body an idea?
Continue reading...
I'm not a specialist in OLE. I got a project with a working OLE functionality and a test program. My job is to put the existing OLE functionality to a service and the OLE has to work without any changes on the test program.
I created a service via:
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv);
VOID WINAPI ServiceCtrlHandler (DWORD);
DWORD WINAPI ServiceWorkerThread (LPVOID lpParam);
and I called the OLE functionality in the ServiceWorkerThread.
if (!AfxOleInit())
{
// AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
// This provides a NULL DACL which will allow access to everyone.
CSecurityDescriptor sd;
sd.InitializeFromThreadToken();
hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
//hr = CoInitializeSecurity(sd, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
_ASSERTE(SUCCEEDED(hr));
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), LIBID_S7WMEDAX))
return SELFREG_E_TYPELIB;
if (!COleObjectFactory::UpdateRegistryAll())
return SELFREG_E_CLASS;
All OLE calls work without error. Startig the test program I got during
AfxGetClassIDFromString(LPCTSTR lpsz, LPCLSID lpClsID)
the following error: Ungültige Klassenzeichenfolge --> Invalid class string
Has any body an idea?
Continue reading...