Wimlib_extract_from_pipe and Windows.

Comments, questions, bug reports, etc.
Post Reply
alekc
Posts: 4
Joined: Tue Nov 26, 2019 1:51 pm

Wimlib_extract_from_pipe and Windows.

Post by alekc »

Is it possible to somehow use the wimlib_extract_image_from_pipe() function with windows pipes? I create a handle for a named pipe using CreateFile(...) and when I use it I get an error: [ERROR] "[fd 1112]": Error reading header: Bad file descriptor. It doesn’t even wait for data to be written to the pipe; it returns with an error immediately.

I used the standard ReadFile() function to test the pipe and it worked fine.

I tried to use wimlib_open_wim() with the file name "\\.\pipe\<pipename>" and it opened the pipe normally and waited for the data to appear in it (but did not work for obvious reasons).

What am I doing wrong and what exactly should be passed as the 'pipe_fd' parameter to the wimlib_extract_image_from_pipe() function?

Important point: I am using a different programming language and therefore cannot use the _wopen() function.
synchronicity
Site Admin
Posts: 474
Joined: Sun Aug 02, 2015 10:31 pm

Re: Wimlib_extract_from_pipe and Windows.

Post by synchronicity »

I haven't tested wimlib_extract_image_from_pipe() on Windows.

On Windows, _open_osfhandle() (https://learn.microsoft.com/en-us/cpp/c ... w=msvc-170) is the usual way to allocate a C runtime file descriptor from an operating system file handle. Have you tried calling _open_osfhandle() on the handle to your pipe and passing the resulting file descriptor to wimlib_extract_image_from_pipe()?
alekc
Posts: 4
Joined: Tue Nov 26, 2019 1:51 pm

Re: Wimlib_extract_from_pipe and Windows.

Post by alekc »

No, I didn't know about this function, thanks. I will be able to check only next week, I will try to write about the result.
Post Reply