2009-09-03 23:54 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/axcore.c
! removed the hack I added in previous commit with interface enumeration
which was accepting any interface without validation its ID.
+ added 3-rd parameter to __AXREGISTERHANDLER() as Mindaugas proposed.
Now this function has the following syntax:
__AXREGISTERHANDLER( <pDisp>, <bHandler> | <hHandlers>
[, <cIID> ] ) -> <pDisp>
default value for <cIID> is IID_IDispatch.
This commit is contained in:
@@ -17,6 +17,16 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-09-03 23:54 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/hbwin/axcore.c
|
||||
! removed the hack I added in previous commit with interface enumeration
|
||||
which was accepting any interface without validation its ID.
|
||||
+ added 3-rd parameter to __AXREGISTERHANDLER() as Mindaugas proposed.
|
||||
Now this function has the following syntax:
|
||||
__AXREGISTERHANDLER( <pDisp>, <bHandler> | <hHandlers>
|
||||
[, <cIID> ] ) -> <pDisp>
|
||||
default value for <cIID> is IID_IDispatch.
|
||||
|
||||
2009-09-03 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/compiler/hbmain.c
|
||||
! added missing pFunc initialization in symbol structure.
|
||||
|
||||
@@ -407,51 +407,44 @@ HB_FUNC( __AXREGISTERHANDLER ) /* ( pDisp, bHandler ) --> pSink */
|
||||
{
|
||||
IConnectionPointContainer* pCPC = NULL;
|
||||
IConnectionPoint* pCP = NULL;
|
||||
HRESULT lOleError;
|
||||
IID rriid = IID_IUnknown;
|
||||
HRESULT lOleError = S_OK;
|
||||
IID rriid = IID_IDispatch;
|
||||
const char* cID = hb_parc( 3 );
|
||||
|
||||
if( cID )
|
||||
{
|
||||
wchar_t* wCLSID = hb_mbtowc( cID );
|
||||
lOleError = CLSIDFromString( wCLSID, &rriid );
|
||||
hb_xfree( wCLSID );
|
||||
}
|
||||
|
||||
lOleError = HB_VTBL( pDisp )->QueryInterface( HB_THIS_( pDisp ) HB_ID_REF( IID_IConnectionPointContainer ), ( void** ) ( void* ) &pCPC );
|
||||
if( lOleError == S_OK )
|
||||
{
|
||||
lOleError = HB_VTBL( pCPC )->FindConnectionPoint( HB_THIS_( pCPC ) HB_ID_REF( IID_IDispatch ), &pCP );
|
||||
if( lOleError != S_OK )
|
||||
{
|
||||
IEnumConnectionPoints* pEnumCPs = NULL;
|
||||
|
||||
lOleError = HB_VTBL( pCPC )->EnumConnectionPoints( HB_THIS_( pCPC ) &pEnumCPs );
|
||||
if( lOleError == S_OK )
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
lOleError = HB_VTBL( pEnumCPs )->Next( HB_THIS_( pEnumCPs ) 1, &pCP, NULL );
|
||||
if( lOleError != S_OK )
|
||||
break;
|
||||
if( HB_VTBL( pCP )->GetConnectionInterface( HB_THIS_( pCP ) &rriid ) == S_OK )
|
||||
break;
|
||||
rriid = IID_IUnknown;
|
||||
}
|
||||
HB_VTBL( pEnumCPs )->Release( HB_THIS( pEnumCPs ) );
|
||||
}
|
||||
}
|
||||
lOleError = HB_VTBL( pDisp )->QueryInterface( HB_THIS_( pDisp ) HB_ID_REF( IID_IConnectionPointContainer ), ( void** ) ( void* ) &pCPC );
|
||||
|
||||
if( lOleError == S_OK )
|
||||
{
|
||||
DWORD dwCookie = 0;
|
||||
ISink * pSink;
|
||||
lOleError = HB_VTBL( pCPC )->FindConnectionPoint( HB_THIS_( pCPC ) HB_ID_REF( rriid ), &pCP );
|
||||
|
||||
pSink = ( ISink* ) hb_xgrab( sizeof( ISink ) ); /* TODO: GlobalAlloc/Free GMEM_FIXED ??? */
|
||||
if( lOleError == S_OK )
|
||||
{
|
||||
DWORD dwCookie = 0;
|
||||
ISink * pSink;
|
||||
|
||||
pSink->lpVtbl = ( IDispatchVtbl * ) &ISink_Vtbl;
|
||||
pSink->count = 1; /* 1 for Harbour collectible pointer [Mindaugas] */
|
||||
pSink->pItemHandler = hb_itemNew( pItemBlock );
|
||||
pSink->rriid = rriid;
|
||||
lOleError = HB_VTBL( pCP )->Advise( HB_THIS_( pCP ) ( IUnknown* ) pSink, &dwCookie );
|
||||
pSink->pConnectionPoint = pCP;
|
||||
pSink->dwCookie = dwCookie;
|
||||
pSink = ( ISink* ) hb_xgrab( sizeof( ISink ) ); /* TODO: GlobalAlloc/Free GMEM_FIXED ??? */
|
||||
|
||||
hb_oleItemPut( hb_stackReturnItem(), ( IDispatch* ) pDisp );
|
||||
pSink->lpVtbl = ( IDispatchVtbl * ) &ISink_Vtbl;
|
||||
pSink->count = 1; /* 1 for Harbour collectible pointer [Mindaugas] */
|
||||
pSink->pItemHandler = hb_itemNew( pItemBlock );
|
||||
pSink->rriid = rriid;
|
||||
lOleError = HB_VTBL( pCP )->Advise( HB_THIS_( pCP ) ( IUnknown* ) pSink, &dwCookie );
|
||||
pSink->pConnectionPoint = pCP;
|
||||
pSink->dwCookie = dwCookie;
|
||||
|
||||
hb_oleItemPut( hb_stackReturnItem(), ( IDispatch* ) pDisp );
|
||||
}
|
||||
HB_VTBL( pCPC )->Release( HB_THIS( pCPC ) );
|
||||
}
|
||||
HB_VTBL( pCPC )->Release( HB_THIS( pCPC ) );
|
||||
}
|
||||
|
||||
hb_oleSetError( lOleError );
|
||||
|
||||
Reference in New Issue
Block a user