Пример #1
0
static int w32_createPipe(R2Pipe *r2p, const char *cmd) {
    CHAR buf[1024];
    r2p->pipe = CreateNamedPipe ("\\\\.\\pipe\\R2PIPE_IN",
                                 PIPE_ACCESS_DUPLEX,PIPE_TYPE_MESSAGE | \
                                 PIPE_READMODE_MESSAGE | \
                                 PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
                                 sizeof (buf), sizeof (buf), 0, NULL);
    if (w32_createChildProcess (cmd)) {
        if (ConnectNamedPipe (r2p->pipe, NULL))
            return true;
    }
    return false;
}
Пример #2
0
static int w32_createPipe(R2Pipe *r2p, const char *cmd) {
	DWORD dwRead, dwWritten;
	CHAR buf[1024];
	BOOL bSuccess = FALSE;
	SECURITY_ATTRIBUTES saAttr;
	int res = 0;
	r2p->pipe = CreateNamedPipe ("\\\\.\\pipe\\R2PIPE_IN",
		PIPE_ACCESS_DUPLEX,PIPE_TYPE_MESSAGE | \
		PIPE_READMODE_MESSAGE | \
		PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
		sizeof (buf), sizeof (buf), 0, NULL);
	if (w32_createChildProcess (cmd) != R_TRUE) {
		//eprintf("Error spawning process: %s\n",code);
		return R_TRUE;
	}
	bSuccess = ConnectNamedPipe (r2p->pipe, NULL);
	if (!bSuccess) {
		//eprintf("Error connecting pipe.\n");
		return R_TRUE;
	}
	return R_TRUE;
}