COM does not work with RDP

COM does not work with RDP

Postby Otto » Sat Jan 21, 2012 11:45 am

We have installed our application remote.

But now we face the problem that com1 forwarding with Fivewin does not work with RemoteDesktop.
We tested forwarding with other software and there the Com1 forwarding works.
Is there any solution?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm

Re: COM does not work with RDP

Postby Antonio Linares » Sat Jan 21, 2012 2:43 pm

Otto,

FWH uses standard Windows API CreateFile() to access the COM port and according to these docs:

http://support.microsoft.com/kb/259131

\\.\Global\DEVICEX should be used instead of \\.\DEVICEX

Try to use "\Global\COM1" instead of "COM1"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COM does not work with RDP

Postby Otto » Sat Jan 21, 2012 6:17 pm

Hello Antonio,
thank you for your help.
If I try to use \Global\COM1 I get a BuildCommDcb Error.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm

Re: COM does not work with RDP

Postby Antonio Linares » Sat Jan 21, 2012 7:22 pm

Otto,

Please try this one:

"\\.\COM1"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COM does not work with RDP

Postby Otto » Sun Jan 22, 2012 10:31 am

Hello Antonio,
I tried but with no success.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm

Re: COM does not work with RDP

Postby Antonio Linares » Sun Jan 22, 2012 11:19 am

Otto,

Is it a printer what you are trying to access ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COM does not work with RDP

Postby Otto » Sun Jan 22, 2012 11:30 am

Hello Antonio,
it is an
Addimat key reader a user identification for any POS system.
I have a cpp test program which is working.
This program uses following code to open the port.
Where do I find the source in xHarbour/FW to check if the values are identically?
Best regards,
Otto

Code: Select all  Expand view
int ComOpen(unsigned Nr,int Baud,int Parity,int Stopbits,int Databits)
{
static const int    iPMode[]={NOPARITY,EVENPARITY,ODDPARITY,SPACEPARITY,MARKPARITY};
static const int    iSMode[]={ONESTOPBIT,ONE5STOPBITS,TWOSTOPBITS,ONESTOPBIT};
TCHAR               cName[]=Z("\\\\.\\COM1");
HANDLE              hFile;
COMMTIMEOUTS        sTo;
DCB                 sDcb;



    if(Nr>=MAX_COM_PORTS)return 0;
    if(bIsOpen[Nr])return 0;


    cName[7]='1'+Nr;

       hFile= CreateFile(cName,GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
    if(hFile==INVALID_HANDLE_VALUE)
        {
        hFile=0;
        return 0;
        }

    if(Databits==7)Databits=0;


    memset(&sDcb,0,sizeof(sDcb));
    sDcb.DCBlength=sizeof(sDcb);
    sDcb.BaudRate       = Baud;
    sDcb.fParity        = (Parity!=0)? TRUE:FALSE;
    sDcb.fBinary        = TRUE;
    sDcb.Parity         = iPMode[Parity];
    sDcb.StopBits       = iSMode[Stopbits&3];
    sDcb.fOutxCtsFlow   = FALSE;
    sDcb.fOutxDsrFlow   = FALSE;
    sDcb.fDtrControl    = DTR_CONTROL_ENABLE;
    sDcb.fRtsControl    = RTS_CONTROL_ENABLE;
    sDcb.fDsrSensitivity= FALSE;
    sDcb.fAbortOnError  = FALSE;
    sDcb.ByteSize       = (Databits)? 8:7;

    if(!SetCommState(hFile,&sDcb))
        {
        CloseHandle(hFile);
        return 0;
        }


    sTo.ReadIntervalTimeout        = MAXDWORD;      // 0 ms Read-Tomeout
    sTo.ReadTotalTimeoutMultiplier = 0;
    sTo.ReadTotalTimeoutConstant   = 0;
    sTo.WriteTotalTimeoutMultiplier= 12000/Baud+1// ? ms Write timeout per byte
    sTo.WriteTotalTimeoutConstant  = sTo.WriteTotalTimeoutMultiplier+1;
    if(!SetCommTimeouts((HANDLE)hFile,&sTo))
        {
        CloseHandle(hFile);
        return 0;
        }


    hComFile[Nr]=hFile;
    bIsOpen [Nr]=TRUE;


return 1;
}
 


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm

Re: COM does not work with RDP

Postby Antonio Linares » Sun Jan 22, 2012 11:35 am

Otto,

FWH\source\winapi\comm.c
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COM does not work with RDP

Postby Antonio Linares » Sun Jan 22, 2012 11:42 am

Otto,

FWH is using FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED instead of FILE_ATTRIBUTE_NORMAL (in your example).

Not sure if this may be a significant difference.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: COM does not work with RDP

Postby Otto » Sun Jan 22, 2012 11:48 am

Hello Antonio,

can you please send me comm.c. I have not downloaded xHarbour sources.
I will try then.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6068
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 35 guests