Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Post by Miguel A. Reynos » Wed, 08 Jan 2003 00:04:20



here is a snip of the code I am using....

typedef HANDLE ( WINAPI * lpCOM_Init) ( ULONG Identifier );

lpCOM_Init  COM_Init;

void CCObjResourceTestDlg::OnButton1()
{
 m_hKeydbDll =  LoadLibrary(TEXT("serial.dll"));

 if ( m_hKeydbDll )
  MessageBox (_T("Library Loaded"));

 CString tmp;
 COM_Init = (lpCOM_Init) GetProcAddress (m_hKeydbDll,TEXT("COM_Init"));
 tmp.Format (_T("COM_Init <0x%0x>(%ld)"), COM_Init, COM_Init);

 if ( COM_Init )
  MessageBox (tmp);

 CString tmp2 ("26\\Name");
 if ( COM_Init ((ULONG) tmp2.GetBuffer (0) ) )
//<<============ this is not working!!!!
  MessageBox (_T("COM_Init ed"));

 if ( FreeLibrary (m_hKeydbDll) )
  MessageBox (_T("Library Freed"));

Quote:}

 
 
 

Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Post by Miguel A. Reynos » Tue, 07 Jan 2003 23:54:07



 
 
 

Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Post by Paul G. Tobey [eMVP » Wed, 08 Jan 2003 01:04:46


I don't know why you would want to be doing that.  Don't you want the driver
to act like a driver?  If not, what error is occurring and where?

You should also set your subject line to something intelligible and *not*
include someone's name there...

Paul T.



Quote:> here is a snip of the code I am using....

> typedef HANDLE ( WINAPI * lpCOM_Init) ( ULONG Identifier );

> lpCOM_Init  COM_Init;

> void CCObjResourceTestDlg::OnButton1()
> {
>  m_hKeydbDll =  LoadLibrary(TEXT("serial.dll"));

>  if ( m_hKeydbDll )
>   MessageBox (_T("Library Loaded"));

>  CString tmp;
>  COM_Init = (lpCOM_Init) GetProcAddress (m_hKeydbDll,TEXT("COM_Init"));
>  tmp.Format (_T("COM_Init <0x%0x>(%ld)"), COM_Init, COM_Init);

>  if ( COM_Init )
>   MessageBox (tmp);

>  CString tmp2 ("26\\Name");
>  if ( COM_Init ((ULONG) tmp2.GetBuffer (0) ) )
> //<<============ this is not working!!!!
>   MessageBox (_T("COM_Init ed"));

>  if ( FreeLibrary (m_hKeydbDll) )
>   MessageBox (_T("Library Freed"));
> }

 
 
 

Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Post by eMVP » Wed, 08 Jan 2003 01:58:20


Go purchase the book "Building Powerful Platforms with Windows CE" by James
Wilson and Aspi Havewala. It has a chapter on a trick for doing this (and
the CD includes full source to a utility library for debugging drivers like
this.) If the driver uses PCMCIA (Like most implementations of serial.dll
do) You Cannot load it into any process space other then the device manager
(device.exe)

--
Steve Maillet (eMVP)
Entelechy Consulting
smaillet_AT_EntelechyConsulting_DOT_com

 
 
 

Paul G. Tobey [eMVP]: do you know how to call COM_Init in Serial.dll

Post by eMVP » Wed, 08 Jan 2003 01:54:55


Please do not address newsgroup posts to specific individuals. It's
insulting to everyone else.

--
Steve Maillet (eMVP)
Entelechy Consulting
smaillet_AT_EntelechyConsulting_DOT_com