@@ -308,7 +308,8 @@ InitializeDialog(HWND hwndDlg, PDISPLAY_DEVICEW pDispDevice)
308308void InitializeDisplayAdapters (PDXDIAG_CONTEXT pContext )
309309{
310310 DISPLAY_DEVICEW DispDevice ;
311- HWND * hDlgs ;
311+ PDXDIAG_DISPLAY * pDisplayAdapters ;
312+ PDXDIAG_DISPLAY pDisplayAdapter ;
312313 HWND hwndDlg ;
313314 WCHAR szDisplay [20 ];
314315 WCHAR szText [30 ];
@@ -328,15 +329,19 @@ void InitializeDisplayAdapters(PDXDIAG_CONTEXT pContext)
328329 continue ;
329330 }
330331 if (pContext -> NumDisplayAdapter )
331- hDlgs = HeapReAlloc (GetProcessHeap (), 0 , pContext -> hDisplayWnd , (pContext -> NumDisplayAdapter + 1 ) * sizeof (HWND ));
332+ pDisplayAdapters = HeapReAlloc (GetProcessHeap (), 0 , pContext -> DisplayAdapters , (pContext -> NumDisplayAdapter + 1 ) * sizeof (PDXDIAG_DISPLAY ));
332333 else
333- hDlgs = HeapAlloc (GetProcessHeap (), 0 , ( pContext -> NumDisplayAdapter + 1 ) * sizeof (HWND ));
334+ pDisplayAdapters = HeapAlloc (GetProcessHeap (), 0 , sizeof (PDXDIAG_DISPLAY ));
334335
335- if (!hDlgs )
336+ if (!pDisplayAdapters )
336337 break ;
337338
338- pContext -> hDisplayWnd = hDlgs ;
339- hwndDlg = CreateDialogParamW (hInst , MAKEINTRESOURCEW (IDD_DISPLAY_DIALOG ), pContext -> hMainDialog , DisplayPageWndProc , (LPARAM )pContext ); EnableDialogTheme (hwndDlg );
339+ pDisplayAdapter = HeapAlloc (GetProcessHeap (), 0 , sizeof (DXDIAG_DISPLAY ));
340+ if (!pDisplayAdapter )
341+ break ;
342+
343+ pContext -> DisplayAdapters = pDisplayAdapters ;
344+ hwndDlg = CreateDialogParamW (hInst , MAKEINTRESOURCEW (IDD_DISPLAY_DIALOG ), pContext -> hMainDialog , DisplayPageWndProc , (LPARAM )pDisplayAdapter ); EnableDialogTheme (hwndDlg );
340345 if (!hwndDlg )
341346 break ;
342347
@@ -350,7 +355,8 @@ void InitializeDisplayAdapters(PDXDIAG_CONTEXT pContext)
350355 wsprintfW (szText , L"%s %u" , szDisplay , pContext -> NumDisplayAdapter + 1 );
351356 InsertTabCtrlItem (GetDlgItem (pContext -> hMainDialog , IDC_TAB_CONTROL ), pContext -> NumDisplayAdapter + 1 , szText );
352357
353- hDlgs [pContext -> NumDisplayAdapter ] = hwndDlg ;
358+ pDisplayAdapter -> hDisplayWnd = hwndDlg ;
359+ pDisplayAdapters [pContext -> NumDisplayAdapter ] = pDisplayAdapter ;
354360 pContext -> NumDisplayAdapter ++ ;
355361 }
356362
@@ -362,13 +368,14 @@ INT_PTR CALLBACK
362368DisplayPageWndProc (HWND hDlg , UINT message , WPARAM wParam , LPARAM lParam )
363369{
364370 RECT rect ;
365- PDXDIAG_CONTEXT pContext = (PDXDIAG_CONTEXT )GetWindowLongPtr (hDlg , DWLP_USER );
371+ HWND hMainDialog ;
372+ PDXDIAG_DISPLAY pDisplay = (PDXDIAG_DISPLAY )GetWindowLongPtr (hDlg , DWLP_USER );
366373 switch (message )
367374 {
368375 case WM_INITDIALOG :
369376 {
370- pContext = (PDXDIAG_CONTEXT ) lParam ;
371- SetWindowLongPtr (hDlg , DWLP_USER , (LONG_PTR )pContext );
377+ pDisplay = (PDXDIAG_DISPLAY ) lParam ;
378+ SetWindowLongPtr (hDlg , DWLP_USER , (LONG_PTR )pDisplay );
372379 SetWindowPos (hDlg , NULL , 10 , 32 , 0 , 0 , SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER );
373380 return TRUE;
374381 }
@@ -378,13 +385,14 @@ DisplayPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
378385 {
379386 case IDC_BUTTON_TESTDD :
380387 case IDC_BUTTON_TEST3D :
381- GetWindowRect (pContext -> hMainDialog , & rect );
388+ hMainDialog = GetWindow (hDlg , GW_OWNER );
389+ GetWindowRect (hMainDialog , & rect );
382390 /* FIXME log result errors */
383391 if (IDC_BUTTON_TESTDD == LOWORD (wParam ))
384392 DDTests ();
385393 else if (IDC_BUTTON_TEST3D == LOWORD (wParam ))
386394 D3DTests ();
387- SetWindowPos (pContext -> hMainDialog , NULL , rect .left , rect .top , rect .right , rect .bottom , SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER );
395+ SetWindowPos (hMainDialog , NULL , rect .left , rect .top , rect .right , rect .bottom , SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER );
388396 break ;
389397 }
390398 break ;
0 commit comments