Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WINE and Windows named pipes

Here is my problem: I have a closed-source third-party Win32 application, which acts as a server for other programs via named pipes, i.e. it expects its clients to do smth like this:

HANDLE h = CreateFile("\\\\.\\pipe\\$pipe_name$", GENERIC_READ | GENERIC_WRITE, etc...);
// ...
TransactNamedPipe(h, buf, etc...);
// ...
CloseHandle(h);

This app runs perfectly in WINE, except that I can't communicate with it. So here is my question:

What exactly does WINE do when it is requested to open a pipe? Does it, say, map it to some FIFO file in ~/.wine/ or wherever? Is there any way to communicate with such program from a Linux application? Google doesn't know anything about it.

Thank you.

like image 706
ScumCoder Avatar asked Dec 13 '11 19:12

ScumCoder


1 Answers

Named pipes are hosted by the WINE server process. Requests are sent to this process by the WINE clients. For example, CreateNamedPipe uses a request like:

    SERVER_START_REQ( open_file_object )
    {
        req->access     = access;
        req->attributes = attr->Attributes;
        req->rootdir    = wine_server_obj_handle( attr->RootDirectory );
        req->sharing    = sharing;
        req->options    = options;
        wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
        io->u.Status = wine_server_call( req );
        *handle = wine_server_ptr_handle( reply->handle );
    }

The server manages connecting the named pipe. Once a client and server have connected, the WINE server gets out of the way by sending an fd to the client. I think this fd is just an anonymous pipe created by the WINE server, one end being sent to the pipe server and one end to the pipe client.

like image 193
Dark Falcon Avatar answered Oct 10 '22 09:10

Dark Falcon