Author Topic: Where does OS/2 store the screen resolution?  (Read 8125 times)

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1073
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Where does OS/2 store the screen resolution?
« on: June 23, 2023, 06:26:36 pm »
I'm interested in knowing the screen resolution that OS/2 will use. The program needs to read the information from disk for a volume that is not currently booted, for example, if the computer is booted from CD, but wants to show the resolution that a disk volume will use if it is booted.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1073
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: Where does OS/2 store the screen resolution?
« Reply #1 on: June 24, 2023, 04:12:14 pm »
Answering myself:

http://www.edm2.com/index.php/REXX_Tips_%26_Tricks:Change_the_WPS_with_REXX#Get_the_display_resolution

Code: [Select]
/* print the current resolution */
call rxFuncAdd "SysIni", "REXXUTIL", "SysIni"

inifile = 'USER'
rblock = SysIni(inifile, 'PM_DISPLAYDRIVERS', 'DEFAULTSYSTEMRESOLUTION')
say length(rblock) "chars:" c2x(rblock)

hres = reverse(substr(rblock,1,4))
say "horizontal:" c2d(hres)

vres = reverse(substr(rblock,5,4))
say "vertical:" c2d(vres)

dres = reverse(substr(rblock,9,4))
say "depth:" c2d(dres)

resolutionChangePending = SysIni(inifile ,"PM_DISPLAYDRIVERS", "RESOLUTION_CHANGED")
   
if resolutionChangePending = "1" || "00"x then
   resolutionChangePending = 1
else
   resolutionChangePending = 0
say "resolution change pending:" resolutionChangePending

return
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5026
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Where does OS/2 store the screen resolution?
« Reply #2 on: June 26, 2023, 02:07:02 pm »
Thanks Neil for posting the source. I was also wondering where to get that information.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5026
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Where does OS/2 store the screen resolution?
« Reply #3 on: July 02, 2023, 02:50:28 pm »
Hi Neil

I also found this PM sample that can show you the current resolution.
https://github.com/OS2World/DEV-SAMPLES-C-PM-DIVE-ShowJet

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1073
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: Where does OS/2 store the screen resolution?
« Reply #4 on: July 02, 2023, 03:14:44 pm »
Thanks, Martin. I did not look at OS/2 Multi-Media functions. DiveQueryCaps will give the information for the currently booted system, which is useful.

My main need was to work on a system that is not booted, and can't be booted to the desktop because of a wrong screen resolution. But my method doesn't work as well for the currently booted system, so I will be looking into DiveQueryCaps to do that better.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5026
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Where does OS/2 store the screen resolution?
« Reply #5 on: July 02, 2023, 03:27:14 pm »
Hi
My main need was to work on a system that is not booted, and can't be booted to the desktop because of a wrong screen resolution. But my method doesn't work as well for the currently booted system, so I will be looking into DiveQueryCaps to do that better.

I still have no idea how to pull that off. As you said before, there should be someplace where the screen resolution is stored, so booting from an OS/2 USB Flash, you can query which resolution uses the OS/2 installed on the hard drive.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 284
  • Karma: +5/-0
    • View Profile
Re: Where does OS/2 store the screen resolution?
« Reply #6 on: July 02, 2023, 07:39:37 pm »
The information is stored in C:\OS2\OS2.INI that you can specify instead of 'USER'.

As seen in Rexx Information:
'USER' The user INI file (usually C:\OS2\OS2.INI). This is the default.

'SYSTEM' The system INI file (usually C:\OS2\OS2SYS.INI).

'BOTH' For querying invocations, both the user and system INI files will be searched. For setting invocations, the user INI file will be written to.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5088
  • Karma: +117/-1
    • View Profile
Re: Where does OS/2 store the screen resolution?
« Reply #7 on: July 02, 2023, 11:22:18 pm »
If running Panorama, "panoutil -s x:" where X: is the drive, seems to work fine. From drive W:.
Code: [Select]
H:\tmp>panoutil -s d:

Status on drive d:
Custom resolution logic is enabled.
Use Native Resolution is disabled
No manual custom resolution is set.
No manual EDID is set.
No manual Desc Number is set
PM Resolution is set to: 1920x1200 @ 16777216 colors

H:\tmp>panoutil -s n:

Status on drive n:
Custom resolution logic is enabled.
Use Native Resolution is enabled
Manual custom resolution 1600x900 is set.
No manual EDID is set.
No manual Desc Number is set
PM Resolution is set to: 1600x900 @ 65536 colors

N: is an eCS partition that hasn't been booted in years, IIRC, when I had a 1600x900 monitor.

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1073
  • Karma: +27/-0
    • View Profile
    • Blonde Guy
Re: Where does OS/2 store the screen resolution?
« Reply #8 on: July 03, 2023, 03:32:35 pm »
The information is stored in C:\OS2\OS2.INI that you can specify instead of 'USER'.

For the currently booted system, the call to SysINI fails. USER works, but C:\OS2\OS2.INI does not. Boot to some other drive, including a bootAble CD, and C:\OS2\OS2.INI works fine in SysINI.

If I extend my example above, it works well to set the resolution if C:\OS2\OS2.INI is substituted for USER and then I save the values for the new resolution. This is useful if a bad resolution is set on C:, preventing the presentation manager from displaying on the screen. I know there are other ways involving going to VGA and reinstalling the video driver, but this is more elegant.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com