Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2347 closed Bug (Fixed)

_WinAPI_GetMonitorInfo() returns incorrect data.

Reported by: Valik Owned by:
Milestone: Future Release Component: Standard UDFs
Version: Severity: None
Keywords: Cc:


The following line of _WinAPI_GetMonitorInfo() is incorrect:

If Not _WinAPI_MoveMemory(DllStructGetPtr($Result[$i]), DllStructGetPtr($tMIEX, $i + 1), 16) Then

DllStructGetPtr() is 1-indexed, not 0, so the code as originally written returns garbage. Actually it causes rcMonitor to return cbSize and the first 3 elements of rcMonitor and it causes rcWork to return rcMonitor. None of which is correct.

The fix is simple enough:

If Not _WinAPI_MoveMemory(DllStructGetPtr($Result[$i]), DllStructGetPtr($tMIEX, $i + 2), 16) Then

Better yet rewrite that part of the code to be less "clever" and more sane. Remember folks, clean and working code is better than clever broken code.

Attachments (0)

Change History (4)

comment:1 Changed 10 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from new to closed

comment:2 Changed 10 years ago by Jpm

  • Resolution Fixed deleted
  • Status changed from closed to reopened

comment:3 Changed 10 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from reopened to closed

Wrong editing rev 7759 really fix it

comment:4 Changed 10 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.