Trouble in Language Monitor component



Hello,

I'm working on a language monitor component to extend theyc behaviors. This
component must be able to get some information with ethernet printer.
I build a special procedure: BOOL WINAPI WriteReadCommand(HANDLE hPort, ...)

The hPort is the valid port handle provded by spooler (in this special case
an ethernet port handle).

The write/tread data operation are performed by:
*pIniPort->fn.pfnWritePort)(pIniPort->hPort, cmd, dwWrite, &dwWritten)
and
*pIniPort->fn.pfnReadPort)(pIniPort->hPort, &cmd[dwWrite], dwRead, &dwReadden)
where these two pointer are a valid low level port monitor (tcpmon.dll)
procedure.

can succesfully send data to printer with *pIniPort->fn.pfnWritePort)(...)
but when I make read data with *pIniPort->fn.pfnReadPort)(...) return FALSE.
The next call to GetLastError() return system error 50: The request is not
supported.

I check the ethernet bus activity and I can see the request data packet and
the nswer data packet, but the *pIniPort->fn.pfnReadPort)(...) fail and no
data will be pump to language monitor context.

Someone can help me?
Thanks
WS

below the code used:

BOOL WINAPI WriteReadCommand(HANDLE hPort, unsigned char* cmd, DWORD
nByteWrCmd, DWORD nByteRdCmd)
{
DWORD dwWrite, dwWritten, dwRead, dwReadden;
PINIPORT pIniPort = (PINIPORT)((INIPORT *)hPort);
BOOL bNoError = TRUE;
DWORD dwSysErr = 0;

dwWritten = dwReadden = 0;
dwWrite = nByteWrCmd;
dwRead = nByteRdCmd;
CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) Begin"));

// write a command direct to port
if(!(*pIniPort->fn.pfnWritePort)(pIniPort->hPort, cmd, dwWrite,
&dwWritten))
{
dwSysErr = GetLastError();
CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) failed: system
error %d"), dwSysErr);
}

if(dwWritten < dwWrite)
{
CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) write failed:
%ws, written %d on %d"), cmd, dwWritten, dwWrite);
return dwWritten == dwWrite;
}

// read the printer answer
if(!(*pIniPort->fn.pfnReadPort)(pIniPort->hPort, &cmd[dwWrite], dwRead,
&dwReadden))
{ // error reading data
dwSysErr = GetLastError();
CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) NO DATA READ.
Failed: system error %d"), dwSysErr);
}

if(dwReadden < dwRead)
{
CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) read failed:
%ws, readden %d on %d"), cmd, dwReadden, dwRead);
//SetEvent(pIniPort->WakeUp);
return dwReadden == dwRead;
}

//
// CELM_LogToFile(DBGLVL_HIGH, hPort, ("WriteReadCommand(..) End"));
//
return dwReadden == dwRead;
}



.