diff --git a/app/src/main.c b/app/src/main.c index 3334cbf9dd..b3d0f12e58 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -4,6 +4,10 @@ #include #include #include +#ifdef __WINDOWS__ +#include +#include "util/str.h" +#endif #ifdef HAVE_V4L2 # include #endif @@ -20,6 +24,17 @@ int main(int argc, char *argv[]) { #ifdef __WINDOWS__ + int wargc; + wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(), &wargc); + + if (argc != wargc) { + return SCRCPY_EXIT_FAILURE; + } + + for (int i = 0; i < wargc; ++i) { + argv[i] = sc_str_from_wchars(wargv[i]); + } + // disable buffering, we want logs immediately // even line buffering (setvbuf() with mode _IOLBF) is not sufficient setbuf(stdout, NULL);