# HG changeset patch # User Andre Heinecke # Date 1398676769 0 # Node ID 3cf72c5282e8011f9edb268a6b27ad3061a4f10f # Parent 7f2cb85288d06eb4067683f623717ab83d2350ef Redirect errorprintf to output debug string on windows diff -r 7f2cb85288d0 -r 3cf72c5282e8 cinst/windowsstore.c --- a/cinst/windowsstore.c Mon Apr 28 09:18:55 2014 +0000 +++ b/cinst/windowsstore.c Mon Apr 28 09:19:29 2014 +0000 @@ -192,6 +192,7 @@ if (!hStore) { + ERRORPRINTF ("Failed to access store.\n"); return ERR_STORE_ACCESS_DENIED; } diff -r 7f2cb85288d0 -r 3cf72c5282e8 common/logging.h --- a/common/logging.h Mon Apr 28 09:18:55 2014 +0000 +++ b/common/logging.h Mon Apr 28 09:19:29 2014 +0000 @@ -81,7 +81,17 @@ * * Prints an error to stderr */ -#define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); +#ifdef WIN32 +# define ERRORPRINTF(fmt, ...) \ + { \ + char buf[512]; \ + snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \ + buf[511] = '\0'; \ + OutputDebugStringA(buf); \ + } +#else +# define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); +#endif #define PRINTLASTERROR(msg) \ char *my_error = getLastErrorMsg(); \