
Use Named Pipes on Windows with CreateNamedPipe
Build a Windows named pipe server and client in C with CreateNamedPipeW, ConnectNamedPipe and message mode, handle a busy pipe and secure access to it.
Tag
7 posts

Build a Windows named pipe server and client in C with CreateNamedPipeW, ConnectNamedPipe and message mode, handle a busy pipe and secure access to it.

Use WaitForSingleObject and WaitForMultipleObjects to block on events, threads, processes and mutexes, read the return codes and avoid the 64 handle limit.

Compare CreateThread and _beginthreadex on Windows, see why C runtime code should use the second, and pass arguments, return values and handles safely.

Open, create, read, write, append and seek files with CreateFileW, ReadFile and WriteFile, with share modes, dispositions and error codes explained.

Start a program from C with CreateProcessW, quote the command line correctly, redirect its output to a file, wait with a timeout and avoid handle leaks.

What a Windows HANDLE is, how the per-process handle table refers to kernel objects, how handles are closed, duplicated and inherited, and how to spot leaks.

Learn Win32 from scratch in C: handles, files, processes, threads, synchronization, memory, pipes, DLLs, windows and error handling, with code for each.