From 39e5f95cde683f36fa043241d09a3f0b3e1eb7e7 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 13 Sep 2021 00:39:42 +0200 Subject: [PATCH] r2pipe fixes for windows, fix some vs warnings --- libr/include/r_socket.h | 3 ++- libr/socket/r2pipe.c | 8 ++------ libr/util/sys.c | 2 +- vsfix.bat | 2 ++ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libr/include/r_socket.h b/libr/include/r_socket.h index 504538bdaf..09a0de0163 100644 --- a/libr/include/r_socket.h +++ b/libr/include/r_socket.h @@ -49,10 +49,11 @@ R_LIB_VERSION_HEADER (r_socket); #endif typedef struct { - int child; #if __WINDOWS__ HANDLE pipe; + HANDLE child; #else + int child; int input[2]; int output[2]; #endif diff --git a/libr/socket/r2pipe.c b/libr/socket/r2pipe.c index 5b8adec6e4..f5a06a930f 100644 --- a/libr/socket/r2pipe.c +++ b/libr/socket/r2pipe.c @@ -244,7 +244,7 @@ R_API R2Pipe *r2pipe_open(const char *cmd) { } #if __WINDOWS__ w32_createPipe (r2p, cmd); - r2p->child = (int)(r2p->pipe); + r2p->child = r2p->pipe; #else int r = pipe (r2p->input); if (r != 0) { @@ -258,11 +258,7 @@ R_API R2Pipe *r2pipe_open(const char *cmd) { r2pipe_close (r2p); return NULL; } -#if LIBC_HAVE_FORK - r2p->child = fork (); -#else - r2p->child = -1; -#endif + r2p->child = r_sys_fork (); if (r2p->child == -1) { r2pipe_close (r2p); return NULL; diff --git a/libr/util/sys.c b/libr/util/sys.c index 8626026c19..17d80dd6ec 100644 --- a/libr/util/sys.c +++ b/libr/util/sys.c @@ -1128,7 +1128,7 @@ R_API char *r_w32_handle_to_path(HANDLE processHandle) { tmp[length] = '\0'; TCHAR device[MAX_PATH]; TCHAR drv[3] = {'A',':', 0}; - for (; drv[0] <= TEXT('Z'); drv[0]++) { + for (; drv[0] <= 'Z'; drv[0]++) { if (QueryDosDevice (drv, device, maxlength) > 0) { char *dvc = r_sys_conv_win_to_utf8 (device); if (!dvc) { diff --git a/vsfix.bat b/vsfix.bat index 52b61cf5fc..eb9501a9b6 100644 --- a/vsfix.bat +++ b/vsfix.bat @@ -1,3 +1,5 @@ @cd vs\libr @for /r %%d in (*.dll) do @copy /Y "%%d" ..\binr\radare2 > NUL +@cd ..\binr +@for /r %%d in (*.exe) do @copy /Y "%%d" ..\binr\radare2 > NUL @cd ..\.. \ No newline at end of file