17static const GUID DISPLAY_GUID = { 0x67685559, 0x3106, 0x11D0, { 0xB9, 0x71, 0x00, 0xAA, 0x00, 0x34, 0x2F, 0x9F } };
44 pDisplayAdapter->dwStateFlags = pDisplayDevice->StateFlags;
45 pDisplayAdapter->bInUseFlag =
TRUE;
53 if (NearestBlack !=
RGB(0, 0, 0) || NearestWhite !=
RGB(255, 255, 255))
64 DWORD NumAdaptersInGroup;
69 for (FormatOpIndex = 0; FormatOpIndex < pDeviceData->DriverCaps.NumSupportedFormatOps; FormatOpIndex++)
71 LPDDSURFACEDESC pSurfaceDesc = &pDeviceData->DriverCaps.pSupportedFormatOps[FormatOpIndex];
82 NumAdaptersInGroup = 0;
83 AdapterGroupId = pDeviceData->DriverCaps.ulUniqueAdapterGroupId;
86 if (AdapterGroupId == pDisplayAdapters[
Index].DriverCaps.ulUniqueAdapterGroupId)
98 pDeviceData->pUnknown6BC
110 pDeviceData->pUnknown6BC
122 DPRINT1(
"Could not create dc for display adapter: %s", pDisplayAdapter->szDeviceName);
126 pDeviceData->hDC =
hDC;
127 pDeviceData->DisplayGuid = pDisplayAdapter->DisplayGuid;
132 if (pDisplayAdapter->bInUseFlag)
143 DPRINT1(
"Could not get device data for display adapter: %s", pDisplayAdapter->szDeviceName);
161 if (
NULL == pDeviceData)
163 DPRINT1(
"Out of memory, could not initialize Direct3D adapter");
169 DPRINT1(
"Could not create device data for adapter: %d", AdapterIndex);
189 pDirect3D9->NumDisplayAdapters = 0;
199 SetAdapterInfo(&pDirect3D9->DisplayAdapters[pDirect3D9->NumDisplayAdapters], &DisplayDevice);
201 if (pDirect3D9->NumDisplayAdapters == 0)
204 ++pDirect3D9->NumDisplayAdapters;
218 SetAdapterInfo(&pDirect3D9->DisplayAdapters[pDirect3D9->NumDisplayAdapters], &DisplayDevice);
219 ++pDirect3D9->NumDisplayAdapters;
229 for (AdapterIndex = 0; AdapterIndex < pDirect3D9->NumDisplayAdapters; AdapterIndex++)
241 if (ppDirect3D9 == 0)
256 pDirect3D9->
lpInt = pDirect3D9;
263 DPRINT1(
"Could not create Direct3D9 object");
enum _D3DFORMAT D3DFORMAT
#define D3D9_INT_MAX_NUM_ADAPTERS
struct IDirect3D9 * LPDIRECT3D9
void CreateDisplayModeList(LPCSTR lpszDeviceName, D3DDISPLAYMODE *pDisplayModes, DWORD *pNumDisplayModes, D3DFORMAT Default16BitFormat, D3D9_Unknown6BC *pUnknown6BC)
BOOL GetDeviceData(LPD3D9_DEVICEDATA pDeviceData)
struct IDirect3D9Vtbl Direct3D9_Vtbl
static CHAR D3D9_PrimaryDeviceName[CCHDEVICENAME]
static BOOL GetDisplayDeviceInfo(IN OUT LPDIRECT3D9_INT pDirect3D9)
static BOOL IsDirectDrawSupported()
BOOL CreateD3D9DeviceData(IN LPDIRECT3D9_DISPLAYADAPTER pDisplayAdapter, IN LPD3D9_DEVICEDATA pDeviceData)
static VOID SetAdapterInfo(IN OUT LPDIRECT3D9_DISPLAYADAPTER pDisplayAdapter, IN LPDISPLAY_DEVICEA pDisplayDevice)
void GetDisplayAdapterFromDevice(IN OUT LPDIRECT3D9_DISPLAYADAPTER pDisplayAdapters, IN DWORD AdapterIndex, IN LPD3D9_DEVICEDATA pDeviceData)
VOID DestroyD3D9DeviceData(IN LPD3D9_DEVICEDATA pDeviceData)
static BOOL GetDirect3D9AdapterInfo(IN OUT LPDIRECT3D9_DISPLAYADAPTER pDisplayAdapters, IN DWORD AdapterIndex)
static BOOL IsGDIDriver(HDC hDC)
static const GUID DISPLAY_GUID
HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9, UINT SDKVersion)
VOID AlignedFree(IN OUT LPVOID pObject)
HRESULT AlignedAlloc(IN OUT LPVOID *ppObject, IN SIZE_T dwSize)
#define D3DFORMAT_OP_DISPLAYMODE
#define HeapFree(x, y, z)
#define memcpy(s1, s2, n)
#define DDERR_OUTOFMEMORY
#define DDERR_INVALIDPARAMS
struct _DIRECT3D9_INT * lpInt
struct IDirect3D9Vtbl * lpVtbl
DWORD NumSupportedD3DFormats
CHAR szDeviceName[MAX_PATH]
DWORD AdapterIndexInGroup
D3D9_DRIVERCAPS DriverCaps
D3DDISPLAYMODE * pSupportedD3DFormats
D3DFORMAT Supported16bitFormat
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
_In_ WDFCOLLECTION _In_ ULONG Index
BOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags)
DWORD WINAPI GetCurrentThreadId(void)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define DISPLAY_DEVICE_MIRRORING_DRIVER
HDC WINAPI CreateDCA(_In_opt_ LPCSTR pszDriver, _In_opt_ LPCSTR pszDevice, _In_opt_ LPCSTR pszOutput, _In_opt_ const DEVMODEA *pdmInit)
#define DISPLAY_DEVICE_PRIMARY_DEVICE
COLORREF WINAPI GetNearestColor(_In_ HDC, _In_ COLORREF)
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
struct _DISPLAY_DEVICEA DISPLAY_DEVICEA
BOOL WINAPI DeleteDC(_In_ HDC)
#define DISPLAY_DEVICE_DISCONNECT
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)