RE: Screen mode retrieval/trace tool for Windows

2008-03-05 Thread Matteo Italia
I think that you could just write a Windows application that listens for
WM_DISPLAYCHANGE messages (that are generated when the
ChangeDisplaySettingsEx succeeds) and logs the parameters recieved somewhere
(keep in mind that wParam = new BPP; LOWORD(lParam) = new horizontal
resolution; HIWORD(lParam) = new vertical resolution). If you need other
infos about the screen settings just use the GetDeviceCaps API with the
handle returned by GetDC(NULL) (see the MSDN for info about these APIs).
If you need any help, I'm here. :-)

Bye

Matteo

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Denver Gingerich
Sent: Tuesday, March 04, 2008 11:09 PM
To: wine-devel@winehq.org
Subject: Screen mode retrieval/trace tool for Windows

I am trying to trace the sequence of screen mode (resolution/bpp/refresh
rate) changes that occur when StarCraft is run in Windows so that I can make
Wine emulate Windows' behavior.  Right now I'm trying to see exactly what
resolution, bits per pixel, and refresh rate StarCraft is using.
Unfortunately, I can't just go into Display Properties while StarCraft is
running because it switches the resolution back when you Alt-Tab out of the
game.

My current plan is to install an SSH or telnet server on the Windows machine
and run a command line tool to check the current screen mode
while StarCraft is running.   I have used a couple of command-line
tools for changing the screen mode [1] [2], but neither of them have an
option to list the current mode.  Does anyone know of a tool or can anyone
quickly create a tool that will list the resolution currently in use from
the command line?

I have tried using StraceNT [3] to see the parameters passed to
ChangeDisplaySettingsEx (which is the function StarCraft uses to change the
resolution), but it does not let me look at the DEVMODE structure that is
passed in.  Does anyone know of a trace tool that would let me do that?

Based on my testing so far, there appears to be a discrepancy in how Windows
and Wine set the refresh rate if none is specified on a resolution change.
Wine always picks the first mode with a matching resolution, while Windows
does not.  My tests in Windows have shown that even though StarCraft asks
for 640x480 and the first mode with that resolution has a 60 Hz refresh
rate, Windows chooses a higher refresh rate.  Unfortunately, I don't know
exactly which refresh rate, but I can verify by sight that 60 Hz is not
being used (the screen doesn't flicker as it would at 60 Hz).  This
discrepancy is why I wish to run further tests and acquire more precise
information about the refresh rate being used.

I am performing this testing according to a request in a previous thread
[4].  If you have any questions about my testing, please let me know.

Denver


1. http://www.vrdevelopers.de/content/view/15/44/
2. http://www.nirsoft.net/utils/nircmd.html
3. http://www.intellectualheaven.com/default.asp?BH=projectsH=strace.htm
4. http://www.winehq.org/pipermail/wine-devel/2008-March/063150.html



smime.p7s
Description: S/MIME cryptographic signature



Re: Screen mode retrieval/trace tool for Windows

2008-03-04 Thread mark cox
Perhaps use detours to hook the ChangeDisplaySettingsEx function and dump
the devmode structure to a file?
Regards,
mark


On Wed, Mar 5, 2008 at 9:09 AM, Denver Gingerich [EMAIL PROTECTED] wrote:

 I am trying to trace the sequence of screen mode
 (resolution/bpp/refresh rate) changes that occur when StarCraft is run
 in Windows so that I can make Wine emulate Windows' behavior.  Right
 now I'm trying to see exactly what resolution, bits per pixel, and
 refresh rate StarCraft is using.  Unfortunately, I can't just go into
 Display Properties while StarCraft is running because it switches the
 resolution back when you Alt-Tab out of the game.

 My current plan is to install an SSH or telnet server on the Windows
 machine and run a command line tool to check the current screen mode
 while StarCraft is running.   I have used a couple of command-line
 tools for changing the screen mode [1] [2], but neither of them have
 an option to list the current mode.  Does anyone know of a tool or can
 anyone quickly create a tool that will list the resolution currently
 in use from the command line?

 I have tried using StraceNT [3] to see the parameters passed to
 ChangeDisplaySettingsEx (which is the function StarCraft uses to
 change the resolution), but it does not let me look at the DEVMODE
 structure that is passed in.  Does anyone know of a trace tool that
 would let me do that?

 Based on my testing so far, there appears to be a discrepancy in how
 Windows and Wine set the refresh rate if none is specified on a
 resolution change.  Wine always picks the first mode with a matching
 resolution, while Windows does not.  My tests in Windows have shown
 that even though StarCraft asks for 640x480 and the first mode with
 that resolution has a 60 Hz refresh rate, Windows chooses a higher
 refresh rate.  Unfortunately, I don't know exactly which refresh rate,
 but I can verify by sight that 60 Hz is not being used (the screen
 doesn't flicker as it would at 60 Hz).  This discrepancy is why I wish
 to run further tests and acquire more precise information about the
 refresh rate being used.

 I am performing this testing according to a request in a previous
 thread [4].  If you have any questions about my testing, please let me
 know.

 Denver


 1. http://www.vrdevelopers.de/content/view/15/44/
 2. http://www.nirsoft.net/utils/nircmd.html
 3. http://www.intellectualheaven.com/default.asp?BH=projectsH=strace.htm
 4. http://www.winehq.org/pipermail/wine-devel/2008-March/063150.html






Re: Screen mode retrieval/trace tool for Windows

2008-03-04 Thread Stefan Dösinger
Am Mittwoch, 5. März 2008 01:38:59 schrieb mark cox:
 Perhaps use detours to hook the ChangeDisplaySettingsEx function and dump
 the devmode structure to a file?
That's rather complex, a simple C app calling 
EnumDisplaySettingsEx(ENUM_CURRENT_MODE) called from command line should do 
that as well, and it is much easier to write




signature.asc
Description: This is a digitally signed message part.



Re: Screen mode retrieval/trace tool for Windows

2008-03-04 Thread Denver Gingerich
On Tue, Mar 4, 2008 at 5:33 PM, Stefan Dösinger [EMAIL PROTECTED] wrote:
 Am Mittwoch, 5. März 2008 01:38:59 schrieb mark cox:

  Perhaps use detours to hook the ChangeDisplaySettingsEx function and dump
   the devmode structure to a file?
  That's rather complex, a simple C app calling
  EnumDisplaySettingsEx(ENUM_CURRENT_MODE) called from command line should do
  that as well, and it is much easier to write

I'm having some trouble getting such an app compiled.  I'm using MinGW
5.1.3 on Windows XP.  Here's what's happening:

type x.c
#include windows.h

int main()
{
DEVMODE dm;
dm.dmSize = sizeof(dm);
EnumDisplaySettingsEx(NULL, ENUM_CURRENT_SETTINGS, dm, 0);
return 0;
}

gcc -c x.c

gcc -lgdi32 -luser32 -o x x.o -mwindows
x.o:x.c:(.text+0x5e): undefined reference to `EnumDisplaySettingsExA'
collect2: ld returned 1 exit status


I'm not very familiar with building applications that use the Windows
API with MinGW so it's very likely that I made a silly mistake.
Suggestions on how to fix this would be appreciated.

Denver




Re: Screen mode retrieval/trace tool for Windows

2008-03-04 Thread Dmitry Timoshkov
Denver Gingerich [EMAIL PROTECTED] wrote:

 gcc -lgdi32 -luser32 -o x x.o -mwindows
 x.o:x.c:(.text+0x5e): undefined reference to `EnumDisplaySettingsExA'
 collect2: ld returned 1 exit status
 
 
 I'm not very familiar with building applications that use the Windows
 API with MinGW so it's very likely that I made a silly mistake.
 Suggestions on how to fix this would be appreciated.

You could try EnumDisplaySettings instead.

-- 
Dmitry.





Re: Screen mode retrieval/trace tool for Windows

2008-03-04 Thread Denver Gingerich
On Tue, Mar 4, 2008 at 7:07 PM, Dmitry Timoshkov [EMAIL PROTECTED] wrote:
 Denver Gingerich [EMAIL PROTECTED] wrote:


  gcc -lgdi32 -luser32 -o x x.o -mwindows
   x.o:x.c:(.text+0x5e): undefined reference to `EnumDisplaySettingsExA'
   collect2: ld returned 1 exit status
  
  
   I'm not very familiar with building applications that use the Windows
   API with MinGW so it's very likely that I made a silly mistake.
   Suggestions on how to fix this would be appreciated.

  You could try EnumDisplaySettings instead.

Surprisingly (to me), that worked.  Thanks for the tip.  I'll report
back after I've run the tests.

Denver