--- mstools/samples/mcitest/debug.c 2018/08/09 18:22:16 1.1.1.1 +++ mstools/samples/mcitest/debug.c 2018/08/09 18:24:31 1.1.1.2 @@ -17,7 +17,7 @@ #if DBG -#define DEFAULTDEBUGLEVEL 2 +#define DEFAULTDEBUGLEVEL 1 int __iDebugLevel = DEFAULTDEBUGLEVEL; void dDbgSetDebugMenuLevel(int i) @@ -32,7 +32,7 @@ void dDbgSetDebugMenuLevel(int i) } CheckMenuItem(hMenu, (UINT)(i + IDM_DEBUG0), MF_CHECKED); __iDebugLevel = i; - dprintf3("Debug level set to %d", i); + dprintf3((TEXT("Debug level set to %d"), i)); } /*************************************************************************** @@ -49,19 +49,19 @@ void dDbgSetDebugMenuLevel(int i) ****************************************************************************/ -void dDbgOut(LPSTR lpszFormat, ...) +void dDbgOut(LPTSTR lpszFormat, ...) { int i; - char buf[256]; + TCHAR buf[256]; va_list va; - i = wsprintf(buf, "%s: ", aszAppName); + i = wsprintf(buf, TEXT("%s: "), aszAppName); va_start(va, lpszFormat); - i += vsprintf(buf+i, lpszFormat, va); + i += wvsprintf(buf+i, lpszFormat, va); va_end(va); - buf[i++] = '\n'; + buf[i++] = TEXT('\n'); buf[i] = 0; OutputDebugString(buf); @@ -82,9 +82,9 @@ void dDbgOut(LPSTR lpszFormat, ...) ****************************************************************************/ -int dDbgGetLevel(LPSTR lpszAppName) +int dDbgGetLevel(LPTSTR lpszAppName) { - return GetProfileInt("mmdebug", lpszAppName, DEFAULTDEBUGLEVEL); + return GetProfileInt(TEXT("mmdebug"), lpszAppName, DEFAULTDEBUGLEVEL); } /*************************************************************************** @@ -103,12 +103,12 @@ int dDbgGetLevel(LPSTR lpszAppName) ****************************************************************************/ -void dDbgSaveLevel(LPSTR lpszAppName, int iLevel) +void dDbgSaveLevel(LPTSTR lpszAppName, int iLevel) { - char buf[80]; + TCHAR buf[80]; - sprintf(buf, "%d", iLevel); - WriteProfileString("debug", lpszAppName, buf); + wsprintf(buf, TEXT("%d"), iLevel); + WriteProfileString(TEXT("debug"), lpszAppName, buf); } /*************************************************************************** @@ -129,14 +129,14 @@ void dDbgSaveLevel(LPSTR lpszAppName, in ****************************************************************************/ -void dDbgAssert(LPSTR exp, LPSTR file, int line) +void dDbgAssert(LPTSTR exp, LPTSTR file, int line) { - char bufTmp[256]; + TCHAR bufTmp[256]; int iResponse; HWND hWnd; - sprintf(bufTmp, - "Expression: %s\nFile: %s, Line: %d\n\nAbort: Exit Process\nRetry: Enter Debugger\nIgnore: Continue", + wsprintf(bufTmp, + TEXT("Expression: %s\nFile: %s, Line: %d\n\nAbort: Exit Process\nRetry: Enter Debugger\nIgnore: Continue"), exp, file, line); // try to use the active window, but NULL is ok if there @@ -146,7 +146,7 @@ void dDbgAssert(LPSTR exp, LPSTR file, i iResponse = MessageBox(hWnd, bufTmp, - "Assertion Failure", + TEXT("Assertion Failure"), MB_TASKMODAL | MB_ICONEXCLAMATION | MB_DEFBUTTON3 @@ -154,9 +154,9 @@ void dDbgAssert(LPSTR exp, LPSTR file, i switch (iResponse) { case 0: - dprintf1("Assert message box failed"); - dprintf2(" Expression: %s", exp); - dprintf2(" File: %s, Line: %d", file, line); + dprintf1((TEXT("Assert message box failed"))); + dprintf2((TEXT(" Expression: %s"), exp)); + dprintf2((TEXT(" File: %s, Line: %d"), file, line)); break; case IDABORT: ExitProcess(1);