mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 05:28:14 +00:00
* Fixed d3d9 critical section not being unlocked in GetAdapterIdentifier
* Implemeted IDirect3D9::GetAdapterMonitor svn path=/trunk/; revision=32190
This commit is contained in:
parent
df5582f1dd
commit
89a49eb4b7
4 changed files with 81 additions and 4 deletions
|
@ -10,11 +10,20 @@
|
|||
#include <d3d9.h>
|
||||
#include <ddraw.h>
|
||||
#include <strsafe.h>
|
||||
#include "adapter.h"
|
||||
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
||||
typedef BOOL (WINAPI *LPFN_DISABLEWOW64FSREDIRECTION) (PVOID*);
|
||||
typedef BOOL (WINAPI *LPFN_REVERTWOW64FSREDIRECTION) (PVOID);
|
||||
|
||||
|
||||
typedef struct _ADAPTERMONITOR
|
||||
{
|
||||
LPCSTR lpszDeviceName;
|
||||
HMONITOR hMonitor;
|
||||
} ADAPTERMONITOR, *LPADAPTERMONITOR;
|
||||
|
||||
|
||||
static BOOL GetDriverName(LPDISPLAY_DEVICEA pDisplayDevice, D3DADAPTER_IDENTIFIER9* pIdentifier)
|
||||
{
|
||||
HKEY hKey;
|
||||
|
@ -156,3 +165,33 @@ BOOL GetAdapterInfo(LPCSTR lpszDeviceName, D3DADAPTER_IDENTIFIER9* pIdentifier)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK AdapterMonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
|
||||
{
|
||||
MONITORINFOEXA MonitorInfoEx;
|
||||
LPADAPTERMONITOR lpAdapterMonitor = (LPADAPTERMONITOR)dwData;
|
||||
|
||||
memset(&MonitorInfoEx, 0, sizeof(MONITORINFOEXA));
|
||||
MonitorInfoEx.cbSize = sizeof(MONITORINFOEXA);
|
||||
|
||||
GetMonitorInfoA(hMonitor, (LPMONITORINFO)&MonitorInfoEx);
|
||||
|
||||
if (_stricmp(lpAdapterMonitor->lpszDeviceName, MonitorInfoEx.szDevice) == 0)
|
||||
{
|
||||
lpAdapterMonitor->hMonitor = hMonitor;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HMONITOR GetAdapterMonitor(LPCSTR lpszDeviceName)
|
||||
{
|
||||
ADAPTERMONITOR AdapterMonitor;
|
||||
AdapterMonitor.lpszDeviceName = lpszDeviceName;
|
||||
AdapterMonitor.hMonitor = NULL;
|
||||
|
||||
EnumDisplayMonitors(NULL, NULL, AdapterMonitorEnumProc, (LPARAM)&AdapterMonitor);
|
||||
|
||||
return AdapterMonitor.hMonitor;
|
||||
}
|
||||
|
|
|
@ -11,4 +11,6 @@
|
|||
|
||||
BOOL GetAdapterInfo(LPCSTR lpszDeviceName, D3DADAPTER_IDENTIFIER9* pIdentifier);
|
||||
|
||||
HMONITOR GetAdapterMonitor(LPCSTR lpszDeviceName);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,9 @@ static LPCSTR D3D9_DebugRegPath = "Software\\Microsoft\\Direct3D";
|
|||
|
||||
LPDIRECT3D9_INT impl_from_IDirect3D9(LPDIRECT3D9 iface)
|
||||
{
|
||||
if (IsBadWritePtr(iface, sizeof(LPDIRECT3D9_INT)))
|
||||
return NULL;
|
||||
|
||||
return (LPDIRECT3D9_INT)((ULONG_PTR)iface - FIELD_OFFSET(DIRECT3D9_INT, lpVtbl));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, v
|
|||
* @param LPDIRECT3D iface
|
||||
* Pointer to the IDirect3D object returned from Direct3DCreate9()
|
||||
*
|
||||
* @return
|
||||
* @return UINT
|
||||
* The number of display adapters on the system when Direct3DCreate9() was called.
|
||||
*
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface)
|
|||
* Pointer to a D3DADAPTER_IDENTIFIER9 structure to be filled with the available information
|
||||
* about the display adapter.
|
||||
*
|
||||
* @return
|
||||
* @return HRESULT
|
||||
* If the method successfully fills the pIdentified structure, the return value is D3D_OK.
|
||||
* If Adapter is out of range, Flags is invalid or pIdentifier is a bad pointer, the return value
|
||||
* will be D3DERR_INVALIDCALL.
|
||||
|
@ -148,6 +148,7 @@ HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapt
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
UNLOCK_D3D9();
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
@ -223,11 +224,43 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapt
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name IDirect3D9::GetAdapterMonitor
|
||||
* @implemented
|
||||
*
|
||||
* The function IDirect3D9Impl_GetAdapterMonitor returns the monitor associated
|
||||
* with the specified display adapter.
|
||||
*
|
||||
* @param LPDIRECT3D iface
|
||||
* Pointer to the IDirect3D object returned from Direct3DCreate9()
|
||||
*
|
||||
* @param UINT Adapter
|
||||
* Adapter index to get information about. D3DADAPTER_DEFAULT is the primary display.
|
||||
* The maximum value for this is the value returned by IDirect3D::GetAdapterCount().
|
||||
*
|
||||
* @return HMONITOR
|
||||
* If the method successfully it returns the HMONITOR belonging to the specified adapter.
|
||||
* If the method fails, the return value is NULL.
|
||||
*
|
||||
*/
|
||||
static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
HMONITOR hAdapterMonitor = NULL;
|
||||
|
||||
return NULL;
|
||||
LPDIRECT3D9_INT This = impl_from_IDirect3D9(iface);
|
||||
LOCK_D3D9();
|
||||
|
||||
if (Adapter < This->NumDisplayAdapters)
|
||||
{
|
||||
hAdapterMonitor = GetAdapterMonitor(This->DisplayAdapters[Adapter].szDeviceName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Invalid Adapter number specified");
|
||||
}
|
||||
|
||||
UNLOCK_D3D9();
|
||||
return hAdapterMonitor;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
|
|
Loading…
Reference in a new issue