verifier
November 17th, 2003, 07:26 AM
Hello
I got two classes:
CPabxWorker - handles diffrent connection interfaces.
CPhilipsOm - a interface two a pbx.
Im using events to notify CPabxWorker when something have happend in CPhilipsOm.
Everything works ok when I have only one CPhilipsOm, but If I have more than one I get the following error on __raise:
Unhandled exception at 0x004c0cbf in hvdserver.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
event declaration:
__event void OnDone(int nId, bool bResult, int nExtension);
hooking the event:
bool CPabxWorker::AddOm(const char* pszHost, DWORD dwPort)
{
OM_CONTAINER* omCont = new OM_CONTAINER;
m_paOm.push_back(omCont);
omCont->bBusy = false;
omCont->bDisabled = false;
omCont->bInited = false;
omCont->nTimeout = 0;
try
{
printf("%d\n", __hook(&Philips::CPhilipsOm::OnDone, &omCont->Om, OnOmDone));
printf("%d\n", __hook(&Philips::CPhilipsOm::OnOmDisconnect, &omCont->Om, OnOmDisconnect));
omCont->Om.SetId(m_paOm.size()-1);
omCont->Om.InitTcpIp(pszHost, dwPort);
}
catch (Datatal::Exceptions::DtConnectError& ex)
{
WriteLog(Datatal::LP_HIGH, "OM", "OM init failed %s", ex.ToString());
return false;
}
WriteLog(Datatal::LP_NORMAL, "OM", "OM sucessfully inited: %s:%d", pszHost, dwPort);
omCont->bInited = true;
return true;
}
raising the event:
__raise OnDone(m_nId, true, m_nLastExt);
I got two classes:
CPabxWorker - handles diffrent connection interfaces.
CPhilipsOm - a interface two a pbx.
Im using events to notify CPabxWorker when something have happend in CPhilipsOm.
Everything works ok when I have only one CPhilipsOm, but If I have more than one I get the following error on __raise:
Unhandled exception at 0x004c0cbf in hvdserver.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
event declaration:
__event void OnDone(int nId, bool bResult, int nExtension);
hooking the event:
bool CPabxWorker::AddOm(const char* pszHost, DWORD dwPort)
{
OM_CONTAINER* omCont = new OM_CONTAINER;
m_paOm.push_back(omCont);
omCont->bBusy = false;
omCont->bDisabled = false;
omCont->bInited = false;
omCont->nTimeout = 0;
try
{
printf("%d\n", __hook(&Philips::CPhilipsOm::OnDone, &omCont->Om, OnOmDone));
printf("%d\n", __hook(&Philips::CPhilipsOm::OnOmDisconnect, &omCont->Om, OnOmDisconnect));
omCont->Om.SetId(m_paOm.size()-1);
omCont->Om.InitTcpIp(pszHost, dwPort);
}
catch (Datatal::Exceptions::DtConnectError& ex)
{
WriteLog(Datatal::LP_HIGH, "OM", "OM init failed %s", ex.ToString());
return false;
}
WriteLog(Datatal::LP_NORMAL, "OM", "OM sucessfully inited: %s:%d", pszHost, dwPort);
omCont->bInited = true;
return true;
}
raising the event:
__raise OnDone(m_nId, true, m_nLastExt);