Changeset 30483 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMpTst.cpp
- Timestamp:
- Jun 28, 2010 7:00:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMpTst.cpp
r30464 r30483 20 20 21 21 static RTTHREAD g_VBoxDispMpTstThread; 22 static VBOXDISPMP_CALLBACKS g_VBoxDispMpTstCallbacks; 23 static HMODULE g_hVBoxDispMpModule; 24 static PFNVBOXDISPMP_GETCALLBACKS g_pfnVBoxDispMpGetCallbacks; 25 22 26 23 27 static void vboxDispMpTstLogRect(const char * pPrefix, RECT *pRect, const char * pSuffix) 24 28 { 25 vboxVDbg DoPrint("%s left(%d), top(%d), right(%d), bottom(%d) %s", pPrefix, pRect->left, pRect->top, pRect->right, pRect->bottom, pSuffix);29 vboxVDbgPrint(("%s left(%d), top(%d), right(%d), bottom(%d) %s", pPrefix, pRect->left, pRect->top, pRect->right, pRect->bottom, pSuffix)); 26 30 } 27 31 … … 30 34 VBOXDISPMP_REGIONS Regions; 31 35 32 HRESULT hr; 36 HRESULT hr = g_VBoxDispMpTstCallbacks.pfnEnableEvents(); 37 Assert(hr == S_OK); 38 if (hr != S_OK) 39 return VERR_GENERAL_FAILURE; 40 33 41 do 34 42 { 35 hr = vboxDispMpGetRegions(&Regions, INFINITE);43 hr = g_VBoxDispMpTstCallbacks.pfnGetRegions(&Regions, INFINITE); 36 44 Assert(hr == S_OK); 37 45 if (hr == S_OK) 38 46 { 39 vboxVDbg DoPrint("\n>>>\n");47 vboxVDbgPrint(("\n>>>\n")); 40 48 HWND hWnd = Regions.hWnd; 41 49 if (Regions.pRegions->fFlags.bAddVisibleRects) … … 48 56 --cVidibleRects; 49 57 50 vboxVDbg DoPrint("hWnd (0x%p), position and/or size changed: ", hWnd);58 vboxVDbgPrint(("hWnd (0x%p), position and/or size changed: ", hWnd)); 51 59 vboxDispMpTstLogRect("", Regions.pRegions->RectsInfo.aRects, "\n"); 52 60 } 53 61 54 vboxVDbg DoPrint("hWnd (0x%p), visibleRects: \n", hWnd);62 vboxVDbgPrint(("hWnd (0x%p), visibleRects: \n", hWnd)); 55 63 for (uint32_t i = iVisibleRects; i < cVidibleRects; ++i) 56 64 { … … 60 68 else if (Regions.pRegions->fFlags.bAddHiddenRects) 61 69 { 62 vboxVDbg DoPrint("hWnd (0x%p), hiddenRects: \n", hWnd);70 vboxVDbgPrint(("hWnd (0x%p), hiddenRects: \n", hWnd)); 63 71 for (uint32_t i = 0; i < Regions.pRegions->RectsInfo.cRects; ++i) 64 72 { … … 67 75 } 68 76 69 vboxVDbg DoPrint("\n<<<\n");77 vboxVDbgPrint(("\n<<<\n")); 70 78 } 71 79 } while (1); 80 81 hr = g_VBoxDispMpTstCallbacks.pfnDisableEvents(); 82 Assert(hr == S_OK); 83 72 84 return VINF_SUCCESS; 73 85 } … … 75 87 HRESULT vboxDispMpTstStart() 76 88 { 77 HRESULT hr = vboxDispMpEnable(); 78 Assert(hr == S_OK); 79 if (hr == S_OK) 89 HRESULT hr = E_FAIL; 90 g_hVBoxDispMpModule = GetModuleHandleW(L"VBoxDispD3D.dll"); 91 Assert(g_hVBoxDispMpModule); 92 93 if (g_hVBoxDispMpModule) 80 94 { 81 int rc = RTThreadCreate(&g_VBoxDispMpTstThread, vboxDispMpTstThreadProc, NULL, 0, 82 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "VBoxDispMpTst"); 83 AssertRC(rc); 84 if (RT_SUCCESS(rc)) 85 return S_OK; 95 g_pfnVBoxDispMpGetCallbacks = (PFNVBOXDISPMP_GETCALLBACKS)GetProcAddress(g_hVBoxDispMpModule, "VBoxDispMpGetCallbacks"); 96 Assert(g_pfnVBoxDispMpGetCallbacks); 97 if (g_pfnVBoxDispMpGetCallbacks) 98 { 99 hr = g_pfnVBoxDispMpGetCallbacks(VBOXDISPMP_VERSION, &g_VBoxDispMpTstCallbacks); 100 Assert(hr == S_OK); 101 if (hr == S_OK) 102 { 103 int rc = RTThreadCreate(&g_VBoxDispMpTstThread, vboxDispMpTstThreadProc, NULL, 0, 104 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "VBoxDispMpTst"); 105 AssertRC(rc); 106 if (RT_SUCCESS(rc)) 107 return S_OK; 86 108 87 hr = vboxDispMpDisable(); 88 Assert(hr == S_OK); 89 hr = E_FAIL; 109 hr = E_FAIL; 110 } 111 } 112 FreeLibrary(g_hVBoxDispMpModule); 90 113 } 114 91 115 return hr; 92 116 } … … 94 118 HRESULT vboxDispMpTstStop() 95 119 { 96 HRESULT hr = vboxDispMpDisable();120 HRESULT hr = g_VBoxDispMpTstCallbacks.pfnDisableEvents(); 97 121 Assert(hr == S_OK); 122 #if 0 98 123 if (hr == S_OK) 99 124 { 100 125 int rc = RTThreadWaitNoResume(g_VBoxDispMpTstThread, RT_INDEFINITE_WAIT, NULL); 101 126 AssertRC(rc); 127 if (RT_SUCCESS(rc)) 128 { 129 BOOL bResult = FreeLibrary(g_hVBoxDispMpModule); 130 Assert(bResult); 131 #ifdef DEBUG 132 if (!bResult) 133 { 134 DWORD winEr = GetLastError(); 135 hr = HRESULT_FROM_WIN32(winEr); 136 } 137 #endif 138 } 139 else 140 hr = E_FAIL; 102 141 } 142 #endif 103 143 return hr; 104 144 }
Note:
See TracChangeset
for help on using the changeset viewer.