named pipe problem :(

This forum is about all development around libVLC.
robot468
New Cone
New Cone
Posts: 2
Joined: 16 Nov 2014 10:20

named pipe problem :(

Postby robot468 » 16 Nov 2014 10:47

hello everyone.

I'm using https://github.com/RexGrammer/Vlc.DotNet and vlc-3.0.0 (latest source from git).
I'm trying to modify file access plugin to work with named pipes - i want communicate between access module and main c# program. When i test this solution between C# and pure C program, compiled with mingw - everything is fine. Pipe is created, test messages are sent and received. But when i try to use exactly same code in modules/access/file.c - WaitNamedPipe exits with error 161(ERROR_BAD_PATHNAME), CreateFile exits with (ERROR_INVALID_NAME). I broke my head trying to understand whats wrong :(

Here is "pure" named pipes test:

Code: Select all

#include <stdio.h> #include <windows.h> #include <stdint.h> #include <string.h> //#define THE_PIPE "testpipe" #define THE_PIPE "\\\\.\\pipe\\vlcMediaPipe" HANDLE hOut; static int PipeRequest (uint32_t cmd, uint8_t *buf, uint64_t arg); void main() { printf("pwrite: waiting for the pipe...\n"); if (WaitNamedPipe(THE_PIPE, NMPWAIT_WAIT_FOREVER) == 0) { printf("WaitNamedPipe failed. error=%d\n", GetLastError()); return; } printf("pwrite: the pipe is ready\n"); hOut = CreateFile(THE_PIPE, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hOut == INVALID_HANDLE_VALUE) { printf("CreateFile failed with error %d\n", GetLastError()); return; } printf("Opened the pipe\n"); char buf[1024]; PipeRequest(1, buf, 1); printf("received: %s\n", buf); CloseHandle(hOut); printf("pwrite: done\n"); }
It is works fine. But EXACTLY the same code in modules/access/file.c returns error :( Here is modifeid file.c http://pastebin.com/D0HPpwTw , other files in source are not modified.

Is it any special flags to compiler or special settings in libvlc code, that make named pipes stop working? pls halp!

sorry for bad english :)

robot468
New Cone
New Cone
Posts: 2
Joined: 16 Nov 2014 10:20

Re: named pipe problem :(

Postby robot468 » 17 Nov 2014 19:11

solved :)

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: named pipe problem :(

Postby Jean-Baptiste Kempf » 10 Dec 2014 14:50

How?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 14 guests