named pipe problem :(
Posted: 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:
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
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");
}
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