53 if (pMonitor->hrgnMonitor)
133 TRACE(
"Attaching monitor...\n");
137 if (pMonitor ==
NULL)
139 TRACE(
"Couldnt create monitor object\n");
143 pMonitor->
hDev = hDev;
148 TRACE(
"Primary monitor is beeing attached\n");
155 TRACE(
"Additional monitor is beeing attached\n");
184 while (pMonitor !=
NULL)
186 if (pMonitor->
hDev == hDev)
193 if (pMonitor ==
NULL)
233 if (pMonitor->
hDev == hDev)
237 if (pMonitor ==
NULL)
318 ULONG iNearestDistance = 0xffffffff;
323 RECTL MonitorRect, IntersectionRect;
327 TRACE(
"MonitorRect: left = %d, top = %d, right = %d, bottom = %d\n",
332 pPrimaryMonitor = pMonitor;
338 IntersectionRect = MonitorRect;
344 if (
dwFlags == MONITOR_DEFAULTTONEAREST)
350 abs(pRect->left - MonitorRect.
right));
358 if (iDistance < iNearestDistance)
360 iNearestDistance = iDistance;
361 pNearestMonitor = pMonitor;
369 if (cMonitors < dwListSize)
372 if (phMonitorList !=
NULL)
374 if (prcMonitorList !=
NULL)
375 prcMonitorList[cMonitors] = IntersectionRect;
386 if (
dwFlags == MONITOR_DEFAULTTONEAREST && pNearestMonitor)
388 if (phMonitorList && dwListSize > 0)
393 else if (
dwFlags == MONITOR_DEFAULTTOPRIMARY && pPrimaryMonitor)
395 if (phMonitorList !=
NULL && dwListSize > 0)
409 ULONG cMonitors, LargestArea = 0,
i;
415 if (
dwFlags != MONITOR_DEFAULTTONULL &&
416 dwFlags != MONITOR_DEFAULTTOPRIMARY &&
417 dwFlags != MONITOR_DEFAULTTONEAREST)
439 if (phMonitorList ==
NULL)
446 sizeof(
RECT) * cMonitors,
448 if (prcMonitorList ==
NULL)
459 for (
i = 0;
i < cMonitors;
i++)
462 (prcMonitorList[
i].
bottom - prcMonitorList[
i].
top);
463 if (Area >= LargestArea)
465 hMonitor = phMonitorList[
i];
489 if (
dwFlags != MONITOR_DEFAULTTONULL &&
490 dwFlags != MONITOR_DEFAULTTOPRIMARY &&
491 dwFlags != MONITOR_DEFAULTTONEAREST)
559 if (pUnsafeRect !=
NULL)
564 TRACE(
"MmCopyFromCaller() failed!\n");
579 TRACE(
"DC_LockDc() failed!\n");
588 TRACE(
"NtGdiGetRgnBox() failed!\n");
600 if (pUnsafeRect !=
NULL)
624 if (cMonitors == 0 || dwListSize == 0 ||
625 (phUnsafeMonitorList ==
NULL && prcUnsafeMonitorList ==
NULL))
628 TRACE(
"cMonitors = %u\n", cMonitors);
634 if (phUnsafeMonitorList !=
NULL && dwListSize != 0)
637 if (phMonitorList ==
NULL)
643 if (prcUnsafeMonitorList !=
NULL && dwListSize != 0)
646 if (prcMonitorList ==
NULL)
655 dwListSize, MONITOR_DEFAULTTONULL);
659 for (
i = 0;
i <
min(cMonitors, dwListSize);
i++)
664 prcMonitorList[
i].
top -= DcRect.
top;
670 if (phUnsafeMonitorList !=
NULL && dwListSize != 0)
679 if (prcUnsafeMonitorList !=
NULL && dwListSize != 0)
738 TRACE(
"Enter NtUserGetMonitorInfo\n");
745 TRACE(
"Couldnt find monitor %p\n", hMonitor);
750 if(pMonitorInfoUnsafe ==
NULL)
756 pwstrDeviceName = ((
PPDEVOBJ)(pMonitor->
hDev))->pGraphicsDevice->szWinDeviceName;
779 MonitorInfo.
dwFlags |= MONITORINFOF_PRIMARY;
795 TRACE(
"GetMonitorInfo: MmCopyToCaller failed\n");
800 TRACE(
"GetMonitorInfo: success\n");
804 TRACE(
"Leave NtUserGetMonitorInfo, ret=%i\n", bRet);
835 if (
dwFlags != MONITOR_DEFAULTTONULL &&
836 dwFlags != MONITOR_DEFAULTTOPRIMARY &&
837 dwFlags != MONITOR_DEFAULTTONEAREST)
881 ULONG cMonitors, LargestArea = 0,
i;
889 if (
dwFlags != MONITOR_DEFAULTTONULL &&
890 dwFlags != MONITOR_DEFAULTTOPRIMARY &&
891 dwFlags != MONITOR_DEFAULTTONEAREST)
923 if (phMonitorList ==
NULL)
930 sizeof(
RECT) * cMonitors,
932 if (prcMonitorList ==
NULL)
943 for (
i = 0;
i < cMonitors;
i++)
946 (prcMonitorList[
i].
bottom - prcMonitorList[
i].
top);
947 if (Area >= LargestArea)
949 hMonitor = phMonitorList[
i];
975 TRACE(
"Enter NtUserMonitorFromWindow\n");
978 if (
dwFlags != MONITOR_DEFAULTTONULL &&
979 dwFlags != MONITOR_DEFAULTTOPRIMARY &&
980 dwFlags != MONITOR_DEFAULTTONEAREST)
1005 TRACE(
"Leave NtUserMonitorFromWindow, ret=%p\n", hMonitor);
#define DBG_DEFAULT_CHANNEL(ch)
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
FORCEINLINE PDC DC_LockDc(HDC hdc)
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
static void cleanup(void)
#define ExAllocatePoolWithTag(hernya, size, tag)
GLdouble GLdouble GLdouble GLdouble top
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define UserHMGetHandle(obj)
struct _PDEVOBJ * PPDEVOBJ
#define MmCopyToCaller(x, y, z)
#define ExFreePoolWithTag(_P, _T)
struct _MONITOR * PMONITOR
#define _Analysis_assume_
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define GDI_OBJ_HMGR_POWNED
#define GDI_OBJ_HMGR_PUBLIC
NTSTRSAFEAPI RtlStringCbCopyNExW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
#define STRSAFE_FILL_BEHIND_NULL
VOID FASTCALL UserLeave(VOID)
VOID FASTCALL UserEnterShared(VOID)
PSIZEL FASTCALL PDEVOBJ_sizl(PPDEVOBJ ppdev, PSIZEL psizl)
_Out_opt_ int _Out_opt_ int * cy
PULONG MinorVersion OPTIONAL
struct _MONITOR * pMonitorNext
WCHAR szDevice[CCHDEVICENAME]
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
PWND FASTCALL UserGetWindowObject(HWND hWnd)
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, PRECTL pRect)
PMONITOR NTAPI UserMonitorFromRect(PRECTL pRect, DWORD dwFlags)
static PMONITOR gMonitorList
static PMONITOR IntCreateMonitorObject(VOID)
PMONITOR NTAPI UserGetMonitorObject(IN HMONITOR hMonitor)
HMONITOR APIENTRY NtUserMonitorFromPoint(IN POINT pt, IN DWORD dwFlags)
BOOL APIENTRY NtUserGetMonitorInfo(IN HMONITOR hMonitor, OUT LPMONITORINFO pMonitorInfoUnsafe)
static UINT IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect, OPTIONAL OUT HMONITOR *phMonitorList, OPTIONAL OUT PRECTL prcMonitorList, OPTIONAL IN DWORD dwListSize, OPTIONAL IN DWORD dwFlags)
HMONITOR APIENTRY NtUserMonitorFromRect(IN LPCRECTL pRectUnsafe, IN DWORD dwFlags)
PMONITOR FASTCALL UserMonitorFromPoint(IN POINT pt, IN DWORD dwFlags)
INT APIENTRY NtUserEnumDisplayMonitors(OPTIONAL IN HDC hdc, OPTIONAL IN LPCRECTL pUnsafeRect, OPTIONAL OUT HMONITOR *phUnsafeMonitorList, OPTIONAL OUT PRECTL prcUnsafeMonitorList, OPTIONAL IN DWORD dwListSize)
NTSTATUS NTAPI UserAttachMonitor(IN HDEV hDev)
static void IntDestroyMonitorObject(IN PMONITOR pMonitor)
NTSTATUS NTAPI UserUpdateMonitorSize(IN HDEV hDev)
HMONITOR APIENTRY NtUserMonitorFromWindow(IN HWND hWnd, IN DWORD dwFlags)
NTSTATUS NTAPI UserDetachMonitor(IN HDEV hDev)
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
BOOL FASTCALL UserDereferenceObject(PVOID Object)
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
PUSER_HANDLE_TABLE gHandleTable
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
#define ERROR_INVALID_MONITOR_HANDLE
#define ERROR_INVALID_FLAGS