On Fri, Sep 11, 2009 at 01:14:39AM +0200, Vincent van Ravesteijn wrote:
>>> You don't need Cygwin to test it.
>>>
>>> 1. Use "\\.\pipe\lyxpipe" (without quotes) as the LyXserver pipe path
>>>    in the preferences.
>>> 2. Quit and restart LyX.
>>> 3. In a cmd.exe terminal type
>>>      echo LYXCMD:test:file-open> \\.\pipe\lyxpipe.in
>>>      type \\.\pipe\lyxpipe.out
>>>
>>> If the file dialog opens, it works.
>> This doesn't work. I get an error message: "LyXComm: The parameter is  
>> invalid", or ERROR_INVALID_PARAMETER in server....@294.
>>
>> If I do the following it works (but it'll not be the correct fix, but  
>> you know at least that it works in this case):
>>
>> server....@280--282:
>>    success = ReadFile(pipe_[i].handle,
>>        pipe_[i].readbuf, PIPE_BUFSIZE - 1,
>> +       &pipe_[i].nbytes, &pipe_[i].overlap);
>> -       &pipe_[i].nbytes, NULL);
>>   
>
> The following fixes it for me:
>
>     bool LyXComm::startPipe(DWORD index)
>     {
>           pipe_[index].pending_io = false;
>   +         pipe_[index].overlap.Offset = 0;
> +         pipe_[index].overlap.OffsetHigh = 0;
>
>
> see http://msdn.microsoft.com/en-us/library/aa365603(VS.85).aspx and  
> scroll down to the third comment:
>
> CORRECTION
>
> Please Wait  Please Wait
> To make this code work you'll need to clear the OVERLAPPED struct before  
> it's used by ReadFile/WriteFile. For that correct the  
> ConnectToNewClient() method like this:
>
> |BOOL ConnectToNewClient(HANDLE hPipe, LPOVERLAPPED lpo) {   BOOL 
> fConnected, fPendingIO = FALSE; 
>
> |
>
> |*lpo->*|*Offset*| = 0;         //MISSING!
> |
>
> |*lpo->*|*OffsetHigh*| = 0;     //MISSING!|
>
>
> |// Start an overlapped connection for this pipe instance.   fConnected = 
> ConnectNamedPipe(hPipe, lpo); ...
> }

We are still in the thread that contained at some point of time

        > [...]
        5. It works.

right?

Andre'

Reply via email to