Changeset 41374 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- May 21, 2012 6:04:03 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/Makefile.kmk
r40716 r41374 122 122 $(VBOX_LIB_IPRT_GUEST_R3) \ 123 123 $(VBOX_LIB_VBGL_R3) \ 124 Psapi.lib 124 Psapi.lib \ 125 $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger$(VBOX_SUFF_LIB) 125 126 126 127 # … … 133 134 $(VBOX_LIB_IPRT_GUEST_R3_X86) \ 134 135 $(VBOX_LIB_VBGL_R3_X86) \ 135 Psapi.lib 136 Psapi.lib \ 137 $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger-x86$(VBOX_SUFF_LIB) 136 138 VBoxDispD3D-x86_DEFS = $(VBoxDispD3D_DEFS) VBOX_WDDM_WOW64 137 139 … … 161 163 endif #VBOX_WITH_CRHGSMI 162 164 165 # 166 # VBoxDispMpLogger - display backdoor logger library 167 # 168 LIBRARIES += VBoxDispMpLogger 169 VBoxDispMpLogger_TEMPLATE = VBOXGUESTR3LIB 170 VBoxDispMpLogger_DEFS = UNICODE _UNICODE VBOX_WITH_CRHGSMI IN_VBOXCRHGSMI VBOX_WITH_WDDM VBOX_WITH_VDMA VBOX_WITH_HGCM 171 VBoxDispMpLogger_INCS = ../../../include .. 172 VBoxDispMpLogger_SOURCES = \ 173 wddm/VBoxDispMpLogger.cpp 174 VBoxDispMpLogger_SDKS = WINDDKWLH 175 176 # 177 # 64-bit systems needs a 32-bit version of VBoxCrHgsmi. 178 # 179 LIBRARIES.amd64 += VBoxDispMpLogger-x86 180 VBoxDispMpLogger-x86_TEMPLATE = VBOXGUESTR3LIB 181 VBoxDispMpLogger-x86_EXTENDS = VBoxDispMpLogger 182 VBoxDispMpLogger-x86_BLD_TRG_ARCH = x86 183 VBoxDispMpLogger-x86_DEFS = $(VBoxDispMpLogger_DEFS) VBOX_WDDM_WOW64 184 163 185 endif #ifdef VBOX_WITH_WDDM 164 186 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxCrHgsmi.cpp
r40483 r41374 253 253 } 254 254 255 VBOXCRHGSMI_DECL(void) VBoxCrHgsmiLog(char * szString)256 {257 vboxVDbgPrint(("%s", szString));258 }259 260 255 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConGetClientID(PVBOXUHGSMI pHgsmi, uint32_t *pu32ClientID) 261 256 { -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispDbg.cpp
r39819 r41374 715 715 716 716 #if defined(VBOXWDDMDISP_DEBUG) || defined(LOG_TO_BACKDOOR_DRV) 717 typedef enum 718 { 719 VBOXDISPDBG_STATE_UNINITIALIZED = 0, 720 VBOXDISPDBG_STATE_INITIALIZING, 721 VBOXDISPDBG_STATE_INITIALIZED, 722 } VBOXDISPDBG_STATE; 723 724 typedef struct VBOXDISPDBG 725 { 726 VBOXDISPKMT_CALLBACKS KmtCallbacks; 727 VBOXDISPDBG_STATE enmState; 728 } VBOXDISPDBG, *PVBOXDISPDBG; 729 730 static VBOXDISPDBG g_VBoxDispDbg = {0}; 731 732 PVBOXDISPDBG vboxDispDbgGet() 733 { 734 if (ASMAtomicCmpXchgU32((volatile uint32_t *)&g_VBoxDispDbg.enmState, VBOXDISPDBG_STATE_INITIALIZING, VBOXDISPDBG_STATE_UNINITIALIZED)) 735 { 736 HRESULT hr = vboxDispKmtCallbacksInit(&g_VBoxDispDbg.KmtCallbacks); 737 Assert(hr == S_OK); 738 if (hr == S_OK) 739 { 740 ASMAtomicWriteU32((volatile uint32_t *)&g_VBoxDispDbg.enmState, VBOXDISPDBG_STATE_INITIALIZED); 741 return &g_VBoxDispDbg; 742 } 743 else 744 { 745 ASMAtomicWriteU32((volatile uint32_t *)&g_VBoxDispDbg.enmState, VBOXDISPDBG_STATE_UNINITIALIZED); 746 } 747 } 748 else if (ASMAtomicReadU32((volatile uint32_t *)&g_VBoxDispDbg.enmState) == VBOXDISPDBG_STATE_INITIALIZED) 749 { 750 return &g_VBoxDispDbg; 751 } 752 Assert(0); 753 return NULL; 754 } 755 756 void vboxDispLogDrv(char * szString) 757 { 758 PVBOXDISPDBG pDbg = vboxDispDbgGet(); 759 if (!pDbg) 760 { 761 /* do not use WARN her esince this would lead to a recursion */ 762 BP_WARN(); 763 return; 764 } 765 766 VBOXDISPKMT_ADAPTER Adapter; 767 HRESULT hr = vboxDispKmtOpenAdapter(&pDbg->KmtCallbacks, &Adapter); 768 if (hr == S_OK) 769 { 770 uint32_t cbString = (uint32_t)strlen(szString) + 1; 771 uint32_t cbCmd = RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cbString]); 772 PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)RTMemAllocZ(cbCmd); 773 if (pCmd) 774 { 775 pCmd->EscapeHdr.escapeCode = VBOXESC_DBGPRINT; 776 memcpy(pCmd->aStringBuf, szString, cbString); 777 778 D3DKMT_ESCAPE EscapeData = {0}; 779 EscapeData.hAdapter = Adapter.hAdapter; 780 //EscapeData.hDevice = NULL; 781 EscapeData.Type = D3DKMT_ESCAPE_DRIVERPRIVATE; 782 // EscapeData.Flags.HardwareAccess = 1; 783 EscapeData.pPrivateDriverData = pCmd; 784 EscapeData.PrivateDriverDataSize = cbCmd; 785 //EscapeData.hContext = NULL; 786 787 int Status = pDbg->KmtCallbacks.pfnD3DKMTEscape(&EscapeData); 788 if (Status) 789 { 790 BP_WARN(); 791 } 792 793 RTMemFree(pCmd); 794 } 795 else 796 { 797 BP_WARN(); 798 } 799 hr = vboxDispKmtCloseAdapter(&Adapter); 800 if(hr != S_OK) 801 { 802 BP_WARN(); 803 } 804 } 805 } 806 807 void vboxDispLogDrvF(char * szString, ...) 808 { 809 char szBuffer[4096] = {0}; 810 va_list pArgList; 811 va_start(pArgList, szString); 812 _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList); 813 va_end(pArgList); 814 815 vboxDispLogDrv(szBuffer); 816 } 817 818 static void vboxDispDumpBufDrv(void *pvBuf, uint32_t cbBuf, VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE enmBuf) 819 { 820 PVBOXDISPDBG pDbg = vboxDispDbgGet(); 821 if (!pDbg) 822 { 823 /* do not use WARN her esince this would lead to a recursion */ 824 BP_WARN(); 825 return; 826 } 827 828 VBOXDISPKMT_ADAPTER Adapter; 829 HRESULT hr = vboxDispKmtOpenAdapter(&pDbg->KmtCallbacks, &Adapter); 830 if (hr == S_OK) 831 { 832 uint32_t cbCmd = RT_OFFSETOF(VBOXDISPIFESCAPE_DBGDUMPBUF, aBuf[cbBuf]); 833 PVBOXDISPIFESCAPE_DBGDUMPBUF pCmd = (PVBOXDISPIFESCAPE_DBGDUMPBUF)RTMemAllocZ(cbCmd); 834 if (pCmd) 835 { 836 pCmd->EscapeHdr.escapeCode = VBOXESC_DBGDUMPBUF; 837 pCmd->enmType = enmBuf; 838 #ifdef VBOX_WDDM_WOW64 839 pCmd->Flags.WoW64 = 1; 717 840 718 #endif 841 memcpy(pCmd->aBuf, pvBuf, cbBuf);842 843 D3DKMT_ESCAPE EscapeData = {0};844 EscapeData.hAdapter = Adapter.hAdapter;845 //EscapeData.hDevice = NULL;846 EscapeData.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;847 // EscapeData.Flags.HardwareAccess = 1;848 EscapeData.pPrivateDriverData = pCmd;849 EscapeData.PrivateDriverDataSize = cbCmd;850 //EscapeData.hContext = NULL;851 852 int Status = pDbg->KmtCallbacks.pfnD3DKMTEscape(&EscapeData);853 if (Status)854 {855 BP_WARN();856 }857 858 RTMemFree(pCmd);859 }860 else861 {862 BP_WARN();863 }864 hr = vboxDispKmtCloseAdapter(&Adapter);865 if(hr != S_OK)866 {867 BP_WARN();868 }869 }870 }871 872 void vboxDispDumpD3DCAPS9Drv(D3DCAPS9 *pCaps)873 {874 vboxDispDumpBufDrv(pCaps, sizeof (*pCaps), VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE_D3DCAPS9);875 }876 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispDbg.h
r39900 r41374 111 111 112 112 #if defined(LOG_TO_BACKDOOR_DRV) || defined(VBOXWDDMDISP_DEBUG_PRINTDRV) 113 # define DbgPrintDrv(_m) do { vboxDispLogDrvF _m; } while (0)114 # define DbgPrintDrvRel(_m) do { vboxDispLogDrvF _m; } while (0)115 # define DbgPrintDrvFlow(_m) do { vboxDispLogDrvF _m; } while (0)113 # define DbgPrintDrv(_m) do { VBoxDispMpLoggerLogF _m; } while (0) 114 # define DbgPrintDrvRel(_m) do { VBoxDispMpLoggerLogF _m; } while (0) 115 # define DbgPrintDrvFlow(_m) do { VBoxDispMpLoggerLogF _m; } while (0) 116 116 #else 117 117 # define DbgPrintDrv(_m) do { } while (0) … … 171 171 #if defined(VBOXWDDMDISP_DEBUG) || defined(LOG_TO_BACKDOOR_DRV) 172 172 173 void vboxDispLogDrvF(char * szString, ...); 174 void vboxDispLogDrv(char * szString); 175 void vboxDispDumpD3DCAPS9Drv(D3DCAPS9 *pCaps);176 177 # define vboxDispDumpD3DCAPS9(_pCaps) do { vboxDispDumpD3DCAPS9Drv(_pCaps); } while (0)173 #include "VBoxDispMpLogger.h" 174 175 VBOXDISPMPLOGGER_DECL(void) VBoxDispMpLoggerDumpD3DCAPS9(struct _D3DCAPS9 *pCaps); 176 177 # define vboxDispDumpD3DCAPS9(_pCaps) do { VBoxDispMpLoggerDumpD3DCAPS9(_pCaps); } while (0) 178 178 #else 179 179 # define vboxDispDumpD3DCAPS9(_pCaps) do { } while (0) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispMp.cpp
r38112 r41374 193 193 pCallbacks->pfnDisableEvents = vboxDispMpDisableEvents; 194 194 pCallbacks->pfnGetRegions = vboxDispMpGetRegions; 195 pCallbacks->pfnLog = vboxDispMpLog;196 195 return S_OK; 197 196 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispMp.h
r38114 r41374 58 58 */ 59 59 PFNVBOXDISPMP_GETREGIONS pfnGetRegions; 60 61 PFNVBOXDISPMP_LOG pfnLog;62 60 } VBOXDISPMP_CALLBACKS, *PVBOXDISPMP_CALLBACKS; 63 61 … … 68 66 /* enable this in case we include this in a dll*/ 69 67 # ifdef VBOXWDDMDISP 70 # define VBOXDISPMP_DECL(_type) DECLEXPORT(_type) 68 # define VBOXDISPMP_DECL(_type) DECLEXPORT(_type) VBOXCALL 71 69 # else 72 # define VBOXDISPMP_DECL(_type) DECLIMPORT(_type) 70 # define VBOXDISPMP_DECL(_type) DECLIMPORT(_type) VBOXCALL 73 71 # endif 74 72 75 #define VBOXDISPMP_IFVERSION 273 #define VBOXDISPMP_IFVERSION 3 76 74 #define VBOXDISPMP_VERSION (VBOXVIDEOIF_VERSION | (VBOXDISPMP_IFVERSION < 16)) 77 75 /** -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r41337 r41374 31 31 #include <VBoxDisplay.h> /* this is from Additions/WINNT/include/ to include escape codes */ 32 32 #include <VBox/Hardware/VBoxVideoVBE.h> 33 34 DWORD g_VBoxLogUm = 0; 33 35 34 36 #define VBOXWDDM_MEMTAG 'MDBV' … … 4055 4057 /* ensure the last char is \0*/ 4056 4058 *((uint8_t*)pDbgPrint + pEscape->PrivateDriverDataSize - 1) = '\0'; 4057 #if defined(DEBUG_misha) || defined(DEBUG_leo) 4058 DbgPrint("%s", pDbgPrint->aStringBuf); 4059 #else 4060 LOGREL_EXACT(("%s", pDbgPrint->aStringBuf)); 4061 #endif 4059 if (g_VBoxLogUm & VBOXWDDM_CFG_LOG_UM_DBGPRINT) 4060 DbgPrint("%s\n", pDbgPrint->aStringBuf); 4061 if (g_VBoxLogUm & VBOXWDDM_CFG_LOG_UM_BACKDOOR) 4062 LOGREL_EXACT(("%s\n", pDbgPrint->aStringBuf)); 4062 4063 } 4063 4064 Status = STATUS_SUCCESS; … … 6093 6094 } 6094 6095 6096 vboxWddmDrvCfgInit(RegistryPath); 6097 6095 6098 ULONG major, minor, build; 6096 6099 BOOLEAN checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.