Changeset 96123 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Aug 8, 2022 11:13:44 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152925
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/3D/win/VBoxWddmUmHlp/VBoxMpLogger.cpp
r95955 r96123 2 2 /** @file 3 3 * VBox WDDM Display logger implementation 4 * 5 * We're unable to use standard r3 vbgl-based backdoor logging API because 6 * win8 Metro apps can not do CreateFile/Read/Write by default. This is why 7 * we use miniport escape functionality to issue backdoor log string to the 8 * miniport and submit it to host via standard r0 backdoor logging api 9 * accordingly 4 10 */ 5 11 … … 16 22 */ 17 23 18 /* We're unable to use standard r3 vbgl-based backdoor logging API because win8 Metro apps19 * can not do CreateFile/Read/Write by default.20 * This is why we use miniport escape functionality to issue backdoor log string to the miniport21 * and submit it to host via standard r0 backdoor logging api accordingly22 */23 24 24 #define IPRT_NO_CRT_FOR_3RD_PARTY /* To get malloc and free wrappers in IPRT_NO_CRT mode. Doesn't link with IPRT in non-no-CRT mode. */ 25 25 #include "UmHlpInternal.h" … … 33 33 # include <stdio.h> 34 34 #endif 35 #include <VBox/VBoxGuestLib.h> 35 36 36 DECLCALLBACK(void) VBoxDispMpLoggerLog(const char *pszString) 37 38 static void VBoxDispMpLoggerLogN(const char *pchString, size_t cchString) 37 39 { 38 40 D3DKMTFUNCTIONS const *d3dkmt = D3DKMTFunctions(); … … 45 47 if (Status == 0) 46 48 { 47 uint32_t c bString = (uint32_t)strlen(pszString) + 1;48 uint32_t cbCmd = RT_UOFFSETOF_DYN(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[c bString]);49 uint32_t cchString2 = (uint32_t)RT_MIN(cchString, _64K - 1U); 50 uint32_t cbCmd = RT_UOFFSETOF_DYN(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cchString2 + 1]); 49 51 PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)malloc(cbCmd); 50 52 Assert(pCmd); … … 53 55 pCmd->EscapeHdr.escapeCode = VBOXESC_DBGPRINT; 54 56 pCmd->EscapeHdr.u32CmdSpecific = 0; 55 memcpy(pCmd->aStringBuf, pszString, cbString); 57 memcpy(pCmd->aStringBuf, pchString, cchString2); 58 pCmd->aStringBuf[cchString2] = '\0'; 56 59 57 60 D3DKMT_ESCAPE EscapeData; … … 76 79 } 77 80 81 82 DECLCALLBACK(void) VBoxDispMpLoggerLog(const char *pszString) 83 { 84 VBoxDispMpLoggerLogN(pszString, strlen(pszString)); 85 } 86 87 78 88 DECLCALLBACK(void) VBoxDispMpLoggerLogF(const char *pszFormat, ...) 79 89 { … … 94 104 VBoxDispMpLoggerLog(szBuffer); 95 105 } 106 107 108 /* Interface used for backdoor logging. In no-CRT mode we will drag in IPRT 109 logging and it will be used on assertion in the no-CRT and IPRT code. */ 110 VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cch) 111 { 112 VBoxDispMpLoggerLogN(pch, cch); 113 return VINF_SUCCESS; 114 } 115 96 116 97 117 /** … … 135 155 VBoxDispMpLoggerLog(szBuffer); 136 156 } 157
Note:
See TracChangeset
for help on using the changeset viewer.