From 76dc87e9adb6ed9026c71ab2f32d0b4b25d9bb95 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 9 Jul 2019 14:10:00 +0200 Subject: [PATCH] idf_exe: fix NULL pointer passed to WriteFile 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/windows/idf_exe/idf_main.c b/tools/windows/idf_exe/idf_main.c index a8d1aec541..f17fc7f41b 100644 --- a/tools/windows/idf_exe/idf_main.c +++ b/tools/windows/idf_exe/idf_main.c @@ -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; } -- 2.40.0