]> granicus.if.org Git - esp-idf/commitdiff
idf_exe: fix NULL pointer passed to WriteFile
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 9 Jul 2019 12:10:00 +0000 (14:10 +0200)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 9 Jul 2019 12:15:09 +0000 (14:15 +0200)
For an unknown reason, passing NULL pointer instead of &written worked
on Windows 10 and on Windows 7 when stdout is not redirected.

Closes https://github.com/espressif/esp-idf/issues/3740

tools/windows/idf_exe/idf_main.c

index a8d1aec541572bd87a605f8e0815cbad397c3a46..f17fc7f41bc625ba14a9273ae4a20d18ac77c673 100644 (file)
@@ -48,7 +48,8 @@ int main(int argc, LPTSTR argv[])
             (StrCmp(argv[1], TEXT("--version")) == 0 ||
              StrCmp(argv[1], TEXT("-v")) == 0)) {
         LPCSTR msg = VERSION "\n";
-        WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msg, lstrlen(msg), NULL, NULL);
+        DWORD written;
+        WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msg, lstrlen(msg), &written, NULL);
         return 0;
     }