1 // 2 // Copyright (C) Microsoft. All rights reserved. 3 // 4 #include "mx.h" 5 6 VOID 7 Mx::MxDbgPrint( 8 __drv_formatString(printf) 9 __in PCSTR DebugMessage, 10 ... 11 ) 12 { 13 #if DBG 14 15 #define TEMP_BUFFER_SIZE 1024 16 va_list list; 17 CHAR debugMessageBuffer[TEMP_BUFFER_SIZE]; 18 NTSTATUS status; 19 20 va_start(list, DebugMessage); 21 22 if (DebugMessage) { 23 24 // 25 // Using new safe string functions instead of _vsnprintf. 26 // This function takes care of NULL terminating if the message 27 // is longer than the buffer. 28 // 29 status = RtlStringCbVPrintfA( debugMessageBuffer, 30 sizeof(debugMessageBuffer), 31 DebugMessage, 32 list ); 33 if(!NT_SUCCESS(status)) { 34 35 DbgPrint ("WDF DbgPrint: Unable to expand: %s", DebugMessage); 36 } 37 else { 38 DbgPrint("%s", debugMessageBuffer); 39 } 40 } 41 va_end(list); 42 43 #else 44 UNREFERENCED_PARAMETER(DebugMessage); 45 #endif 46 return; 47 } 48 49 50 VOID 51 Mx::MxGlobalInit( 52 VOID 53 ) 54 { 55 // 56 // Global initialization for kernel-mode primitives 57 // 58 } 59