Discussion:
dll -> com object and socketconnection
(too old to reply)
billaras
2007-07-19 05:46:11 UTC
Permalink
hello,
in the tsocketconnection component in the interceptname/guid properties
according to the help i must place the guid/name of a registered com object.
i already have a dll file that contains the desired code, i would like to
ask
if there is any way that i can change the dll file in order to work with the
tsocketconnection's interceptguid/name properties. if there is a way it can
save me a lot of trouble from creating a com object. i mean can i place any
code in the
dll file that will allow it to be placed to the interceptname/guid of the
socketconnection?

thank you very much for your time
Remy Lebeau (TeamB)
2007-07-19 05:54:10 UTC
Permalink
Post by billaras
in the tsocketconnection component in the interceptname/guid
properties according to the help i must place the guid/name
of a registered com object. i already have a dll file that
contains the desired code, i would like to ask if there is any
way that i can change the dll file in order to work with the
tsocketconnection's interceptguid/name properties.
As stated in the documentation, the properties represent a COM object that
implements the "IDataIntercept" interface. TSocketConnection will load the
specified COM object and query it for that interface.
Post by billaras
if there is a way it can save me a lot of trouble from
creating a com object.
There is not. The TSocketConnection requires a real COM object. If you
don't want to add a COM object to your existing DLL then you will have to a
separate DLL for the COM object and then have it use your main DLL
internally.


Gambit
billaras
2007-07-19 07:10:57 UTC
Permalink
thka for the answer.
i honestly dont know much about creating com objects,is there any online
tutorial that you could please recommend ?

if i have a vcl object can i create a com object that uses this vcl object(i
mean uses its methods)
and then place it in the interceptname/guid of the socketconnection?

finally,i read something about registering com objects to the operating
system,is this done
automaticaly when i create a com object?what happens when i distribute my
application?must
i register somehow the com object to the users pc also?

thanks
Post by Remy Lebeau (TeamB)
Post by billaras
in the tsocketconnection component in the interceptname/guid
properties according to the help i must place the guid/name
of a registered com object. i already have a dll file that
contains the desired code, i would like to ask if there is any
way that i can change the dll file in order to work with the
tsocketconnection's interceptguid/name properties.
As stated in the documentation, the properties represent a COM object that
implements the "IDataIntercept" interface. TSocketConnection will load the
specified COM object and query it for that interface.
Post by billaras
if there is a way it can save me a lot of trouble from
creating a com object.
There is not. The TSocketConnection requires a real COM object. If you
don't want to add a COM object to your existing DLL then you will have to a
separate DLL for the COM object and then have it use your main DLL
internally.
Gambit
Remy Lebeau (TeamB)
2007-07-19 10:29:00 UTC
Permalink
Post by billaras
i honestly dont know much about creating com objects,is
there any online tutorial that you could please recommend ?
http://www.techvanguards.com
Post by billaras
if i have a vcl object can i create a com object that uses
this vcl object and then place it in the interceptname/guid
of the socketconnection?
Yes.
Post by billaras
finally,i read something about registering com objects to
the operating system,is this done automaticaly when i
create a com object?
No.
Post by billaras
what happens when i distribute my application?
You must install the COM object on the user's PC.
Post by billaras
must i register somehow the com object to the users pc also?
Yes. Use the command-line regsvr32.exe utility that ships with the OS.


Gambit
billaras
2007-07-20 09:23:30 UTC
Permalink
thks for the replies.
i tryed to make a com object.
first i realized that i could not create a com object from the wizard
without making an activex library
i made one and then made a com object,based on some other threads in the
newsgroups , i
included sconnect. i think that ass (dimitri did in
http://groups.google.com/group/borland.public.cppbuilder.activex/browse_thread/thread/126300c8a424dcf4/56fede6423f34574?lnk=gst&q=intercept&rnum=2#56fede6423f34574)
i should take off the library.code until this point (if you can call it a
point...) is

// PackInterceptorH.h : Declaration of the TPackInterceptorImpl

#ifndef PackInterceptorH
#define PackInterceptorH

#define _ATL_APARTMENT_THREADED

#include "PackIntercept_TLB.h"

#include "sconnect.hpp"
/////////////////////////////////////////////////////////////////////////////
// TPackInterceptorImpl Implements IPackInterceptor, default interface
of PackInterceptor
// ThreadingModel : tmApartment
// Dual Interface : FALSE
// Event Support : FALSE
// Default ProgID : Project1.PackInterceptor
// Description : encryption decryption interceptor
/////////////////////////////////////////////////////////////////////////////
class ATL_NO_VTABLE TPackInterceptorImpl :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<TPackInterceptorImpl, &CLSID_PackInterceptor>,
public IPackInterceptor
{
public:
TPackInterceptorImpl()
{
}

// Data used when registering Object
//
DECLARE_THREADING_MODEL(otApartment);
DECLARE_PROGID("PackIntercept.PackInterceptor");
DECLARE_DESCRIPTION("encryption decryption interceptor");

// Function invoked to (un)register object
//
static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
{
TTypedComServerRegistrarT<TPackInterceptorImpl>
regObj(GetObjectCLSID(), GetProgID(), GetDescription());
return regObj.UpdateRegistry(bRegister);
}


BEGIN_COM_MAP(TPackInterceptorImpl)
COM_INTERFACE_ENTRY(IPackInterceptor)
END_COM_MAP()

// IPackInterceptor
public:

};

#endif //Unit1H
///in the above thread it is suggested that #include "PackIntercept_TLB.h"
should be removed
if i do this i get a undefined symbol CLSID_PackInterceptor in line:public
CComCoClass<TPackInterceptorImpl, &CLSID_PackInterceptor>,

i guess that i should create the DataIn and out methods,where do i place
these exactly?in the cpp file(i guess right?)
now i have plenty of files in the project group ,besides the cpp-h files i
have also the TLB.cpp and ATL.cpp,should i remove these?
i just need to make a com object that intercepts the packets from the
socketconnection.thank you for your time and effort.

Loading...