10#define WIN32_LEAN_AND_MEAN
15#define PIPEREAD_VERSION "0.3"
16#define PIPEREAD_NOPIPE (-101)
19#ifndef FILE_FLAG_FIRST_PIPE_INSTANCE
20#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
118 fprintf(
stderr,
"Could not open pipe: 20 second wait timed out.");
181 fprintf(
stderr,
"Example: piperead -c \\\\.\\pipe\\kdbg | log2lines -c\n\n");
187 const char* pipe_name;
188 const char* clientMode;
195 clientMode = *++
argv;
196 if (
strcmp(clientMode,
"-c") != 0) {
204 if (
strcmp(pipe_name,
"-h") == 0) {
217 if ( pipe_name[0] ==
'\\' ) {
int strcmp(const char *String1, const char *String2)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
_Check_return_opt_ _CRTIMP int __cdecl fgetc(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl setvbuf(_Inout_ FILE *_File, _Inout_updates_opt_z_(_Size) char *_Buf, _In_ int _Mode, _In_ size_t _Size)
#define ERROR_FILE_NOT_FOUND
#define sprintf(buf, format,...)
const char * strerror(int err)
#define FILE_FLAG_FIRST_PIPE_INSTANCE
static void print_error(DWORD win32_error)
static int fileClient(const char *path)
static int pipeServer(char *path)
static int pipeClient(char *path)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
DWORD WINAPI GetLastError(void)
#define PIPE_ACCESS_DUPLEX
#define ERROR_BROKEN_PIPE
#define ERROR_PIPE_LISTENING