Undocumented Features of OS/2: Difference between revisions
(5 intermediate revisions by the same user not shown) | |||
Line 39: | Line 39: | ||
==The Color Selection Control== | ==The Color Selection Control== | ||
[[image:TheColorSelection.png]] | [[image:TheColorSelection.png|thumb|Color wheel control]] | ||
The color wheel control used by the Solid and Mixed Color Palette object is a publicly registered window class within OS/2, but is undocumented. The following notes are all that is necessary to use this control class: | The color wheel control used by the Solid and Mixed Color Palette object is a publicly registered window class within OS/2, but is undocumented. The following notes are all that is necessary to use this control class: | ||
# You must load the module WPCONFIG.DLL so that the publicly registered window message processor (ColorSelectWndProc) can be used without an addressing violation. | |||
# Create your control window with WinCreateWindow or through a dialog template, using the window class name "ColorSelectClass". | |||
# If you used WinCreateWindow you will need to reposition the control window each time the parent window is resized, as otherwise the control will reposition itself out of view. Dialogs seem to handle this automatically. | |||
# The only control message defined -to- the control is 0x0602 under OS/2 Warp 4 or later, or (by some reports) 0x1384 on older versions of OS/2. Message parameter one must contain the RGB value to which the color wheel will be set. | |||
# The only control message defined -from- the control is 0x0601 under OS/2 Warp 4 or later, or (by some reports) 0x130C on older versions of OS/2. Message parameter one will contain the RGB value to which the color wheel has been set. | |||
# The control can only be sized at creation, and should be sized so that its height is approximately 60% of it. | |||
==HPFS Large Disk Access== | ==HPFS Large Disk Access== | ||
Line 60: | Line 53: | ||
==Undocumented extensions to Event Semaphores== | ==Undocumented extensions to Event Semaphores== | ||
It is possible to do a post that releases one thread at a time as of fixpak 29 for Warp 3 and fixpack 4 for Warp 4. | It is possible to do a post that releases one thread at a time as of fixpak 29 for Warp 3 and fixpack 4 for Warp 4. | ||
#define DCE_AUTORESET 0x1000 // Auto-reset event semaphore | #define DCE_AUTORESET 0x1000 // Auto-reset event semaphore | ||
#define DCE_POSTONE 0x0800 // Post one flag | #define DCE_POSTONE 0x0800 // Post one flag | ||
This feature only slightly changes the API of DosCreateEventSem. Other APIs for event semaphores are kept the same, although their behaviors are changed. | This feature only slightly changes the API of DosCreateEventSem. Other APIs for event semaphores are kept the same, although their behaviors are changed. | ||
;DosCreateEventSem:The flags argument can specify the new behaviors of the event semaphore: DCE_AUTORESET means the event automatically resets itself after a thread obtains it through DosWaitEventSem, and DCE_POSTONE means that DosPostEventSem only wakes up one waiting thread if there is any. When DCE_POSTONE is specified, the event always automatically resets even if DCE_AUTORESET is not specified. We can define three types of events with these two flags: | |||
::Neither DCE_AUTORESET nor DCE_POSTONE set: The event has default behavior, which needs manual resets and wakes up all waiters when posted. | |||
The flags argument can specify the new behaviors of the event semaphore: DCE_AUTORESET means the event automatically resets itself after a thread obtains it through DosWaitEventSem, and DCE_POSTONE means that DosPostEventSem only wakes up one waiting thread if there is any. When DCE_POSTONE is specified, the event always automatically resets even if DCE_AUTORESET is not specified. We can define three types of events with these two flags: | ::DCE_AUTORESET set but not DCE_POSTONE: The event resets it after a wait is successfully executed. It wakes up all waiters when posted. | ||
::DCE_POSTONE set: The event resets it automatically after a wait is successfully executed. But it only wakes up one waiter when posted. | |||
Neither DCE_AUTORESET nor DCE_POSTONE set: The event has default behavior, which needs manual resets and wakes up all waiters when posted. | ;DosWaitEventSem:For an AUTORESET event, it automatically resets itself after this is successfully executed. Otherwise, it leaves the event in signalled (posted) state. | ||
;DosPostEventSem:For a POSTONE event, it wakes up only one waiter if there is any thread waiting for the event. Otherwise, it wakes up all events. | |||
DCE_AUTORESET set but not DCE_POSTONE: The event resets it after a wait is successfully executed. It wakes up all waiters when posted. | |||
DCE_POSTONE set: The event resets it automatically after a wait is successfully executed. But it only wakes up one waiter when posted. | |||
For an AUTORESET event, it automatically resets itself after this is successfully executed. Otherwise, it leaves the event in signalled (posted) state. | |||
For a POSTONE event, it wakes up only one waiter if there is any thread waiting for the event. Otherwise, it wakes up all events. | |||
==How to reset the Physical Palette== | ==How to reset the Physical Palette== | ||
Getting the 256-color mode palette manager to set itself up is not too hard, but getting it to reset itself to the default palette is not documented well. In the header file 'DIVE.H' is a nice piece of explanation: | Getting the 256-color mode palette manager to set itself up is not too hard, but getting it to reset itself to the default palette is not documented well. In the header file 'DIVE.H' is a nice piece of explanation: | ||
<pre> | |||
Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set the physical palette. If your application MUST set the PHYSICAL palette, try using no more than 236 entries (the middle 236: 10-245, thus leaving the top and bottom 10 entries for the Workplace Shell). If your application MUST use ALL 256 entries, it must do so as a full-screen (i.e. maximized) application. Remember, No WM_REALIZEPALETTE message will be sent to other running applications, meaning they will not redraw and their colors will be all wrong. It is not recommended that a developer use these commands: | Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set | ||
the physical palette. If your application MUST set the PHYSICAL palette, | |||
try using no more than 236 entries (the middle 236: 10-245, thus leaving | |||
the top and bottom 10 entries for the Workplace Shell). If your | |||
application MUST use ALL 256 entries, it must do so as a full-screen | |||
(i.e. maximized) application. Remember, No WM_REALIZEPALETTE message | |||
will be sent to other running applications, meaning they will not redraw | |||
and their colors will be all wrong. It is not recommended that a | |||
developer use these commands: | |||
To set physical palette, do the following: | To set physical palette, do the following: | ||
hps = WinGetPS ( HWND_DESKTOP ); | hps = WinGetPS ( HWND_DESKTOP ); | ||
Line 100: | Line 88: | ||
WinReleasePS ( hps ); | WinReleasePS ( hps ); | ||
To reset physical palette, do the following: | To reset physical palette, do the following: | ||
hps = WinGetPS ( HWND_DESKTOP ) ; | hps = WinGetPS ( HWND_DESKTOP ) ; | ||
Line 107: | Line 95: | ||
WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE ); | WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE ); | ||
WinReleasePS ( hps ) ; | WinReleasePS ( hps ) ; | ||
</pre> | |||
I have altered these examples slightly for clarity, replacing the Gre32Entry3 function calls with macros defined in 'PMDDIM.H'. | |||
I have altered these examples slightly for clarity, replacing the Gre32Entry3 function calls with macros defined in 'PMDDIM.H'. | |||
==Extensions to WinQuerySysValue and WinSetSysValue== | ==Extensions to WinQuerySysValue and WinSetSysValue== | ||
Several new system values have been defined in the Warp 4.0 (and possibly in the newer | Several new system values have been defined in the Warp 4.0 (and possibly in the newer fixpaks to Warp 3.0). They are: | ||
<code> | |||
#define SV_FULLWINDOWDRAG | #define SV_FULLWINDOWDRAG 99 /* FullWindowDrag */ | ||
#define SV_ALTTABSWITCHWIN | #define SV_ALTTABSWITCHWIN 100 /* Alt-Tab Switching windows */ | ||
#define SV_VIOMOUSEACTIONS | #define SV_VIOMOUSEACTIONS 101 /* VIO mouse actions */ | ||
#define SV_ASYNCFOCUSCHANGE | #define SV_ASYNCFOCUSCHANGE 102 /* Asynchronous focus change */ | ||
#define SV_FOCUSCHANGESENS | #define SV_FOCUSCHANGESENS 103 /* Focus Change sensitivity */ | ||
</code> | |||
The definition names given here are not official, and are not included in PMWIN.H. | The definition names given here are not official, and are not included in PMWIN.H. | ||
==Extensions to WinDrawBorder== | ==Extensions to WinDrawBorder== | ||
There are at least two undocumented option flags for the WinDrawBorder function which appear to have been provided to help in drawing pushbutton controls. They are: | There are at least two undocumented option flags for the WinDrawBorder function which appear to have been provided to help in drawing pushbutton controls. They are: | ||
<code> | |||
#define DB_RAISED | #define DB_RAISED 0x0400 /* Draw 3-d border giving the window a raised appearance. */ | ||
#define DB_DEPRESSED 0x0800 /* Draw 3-d border giving the window a sunken appearance. */ | #define DB_DEPRESSED 0x0800 /* Draw 3-d border giving the window a sunken appearance. */ | ||
</code> | |||
The definition names given here are not official, and are not included in PMWIN.H. | The definition names given here are not official, and are not included in PMWIN.H. | ||
==Environment Variables== | ==Environment Variables== | ||
There are a number of undocumented environment variables that change the behaviour of the system. These are a few of them: | There are a number of undocumented environment variables that change the behaviour of the system. These are a few of them: | ||
* COPYFROMFLOPPY=1 - You have replaced one or more of the files on the installation floppies, and you have successfully booted the installer in spite of your strange hardware. The installation proceeds, but it pulls in replacements to what you just replaced from either the later compressed diskettes, or from the CD. When the first phase of installation completes and the system reboots from the hard drive, you find that you no longer are using the replacement drivers. If you add this line to the CONFIG.SYS on install diskette 1 (before Warp 4.0) or on install diskette 2 (Warp 4.0 or later), then the installer will reload the replacement files from the early floppies before rebooting. | *<tt>COPYFROMFLOPPY=1</tt> - You have replaced one or more of the files on the installation floppies, and you have successfully booted the installer in spite of your strange hardware. The installation proceeds, but it pulls in replacements to what you just replaced from either the later compressed diskettes, or from the CD. When the first phase of installation completes and the system reboots from the hard drive, you find that you no longer are using the replacement drivers. If you add this line to the CONFIG.SYS on install diskette 1 (before Warp 4.0) or on install diskette 2 (Warp 4.0 or later), then the installer will reload the replacement files from the early floppies before rebooting. | ||
* KILLCONFIRMDISABLED=ON - Avoid the "Are you sure ..." dialog if using the WarpCenter kill feature. You must also have the SET SCKILLFEATUREENABLED variable installed. | *<tt>KILLCONFIRMDISABLED=ON</tt> - Avoid the "Are you sure ..." dialog if using the WarpCenter kill feature. You must also have the SET SCKILLFEATUREENABLED variable installed. | ||
* KILLFEATUREENABLED=ON - This enables the display of the full process list from WarpCenter by clicking on the task list button while pressing the Control key. Selecting a program from the list pops up a message box to confirm the killing of the process. | *<tt>KILLFEATUREENABLED=ON</tt> - This enables the display of the full process list from WarpCenter by clicking on the task list button while pressing the Control key. Selecting a program from the list pops up a message box to confirm the killing of the process. | ||
* MENUSFOLLOWPOINTER=ON - This makes the WarpCenter menus (but no others) behave more like the Start menu of Windows, in that once you open the menu, the menu selection will follow the mouse without your needing to keep the mouse button pressed down. Submenus will automatically open as you move the mouse pointer over them. This function only works on Warp 4.0 with fixpack 5 or later. | *<tt>MENUSFOLLOWPOINTER=ON</tt> - This makes the WarpCenter menus (but no others) behave more like the Start menu of Windows, in that once you open the menu, the menu selection will follow the mouse without your needing to keep the mouse button pressed down. Submenus will automatically open as you move the mouse pointer over them. This function only works on Warp 4.0 with fixpack 5 or later. | ||
* SCCANBENUKED=ON - Allows the WarpCenter to have a Delete option on its context menu. | *<tt>SCCANBENUKED=ON</tt> - Allows the WarpCenter to have a Delete option on its context menu. | ||
* SCFINDUTILITY=c:\os2\apps\pmseek.exe - This changes the function of the Find button on the WarpCenter to use PMSEEK instead of the limited-function default file finder. | *<tt>SCFINDUTILITY=c:\os2\apps\pmseek.exe</tt> - This changes the function of the Find button on the WarpCenter to use PMSEEK instead of the limited-function default file finder. | ||
* SCKILLCONFIRMDISABLED=ON - This is the same as KILLCONFIRMDISABLED=ON. | *<tt>SCKILLCONFIRMDISABLED=ON</tt> - This is the same as <tt>KILLCONFIRMDISABLED=ON</tt>. | ||
* SCKILLFEATUREENABLED=ON - This is the same as KILLFEATUREENABLED=ON. | *<tt>SCKILLFEATUREENABLED=ON</tt> - This is the same as <tt>KILLFEATUREENABLED=ON</tt>. | ||
* SCPRETTYCLOCK=1 - This changes the appearance of the WarpCenter clock, giving it a fancier border, a black background and green numbers. | *<tt>SCPRETTYCLOCK=1</tt> - This changes the appearance of the WarpCenter clock, giving it a fancier border, a black background and green numbers. | ||
* SHELLHANDLESINC= - This environment variable increments the number of file handles available to the Shell process (protshell). Users who need more file handles can add this statement to CONFIG.SYS. The maximum file handles will be incremented by the amount specified in the statement. The system defaults to 20 file handles in the Shell process. Therefore, if the statement specifies a 10, then the total would be incremented to 30. | *<tt>SHELLHANDLESINC=</tt> - This environment variable increments the number of file handles available to the Shell process (protshell). Users who need more file handles can add this statement to CONFIG.SYS. The maximum file handles will be incremented by the amount specified in the statement. The system defaults to 20 file handles in the Shell process. Therefore, if the statement specifies a 10, then the total would be incremented to 30. | ||
[[Category:The OS/2 API Project]] | [[Category:The OS/2 API Project]] |
Latest revision as of 18:27, 14 November 2018
By Rick Papo
Overview and Credits
This document is a collection of unofficial information gathered from a variety of sources about system API functions in OS/2 that are not officially documented for various reasons. Rick Papo built
Use this information totally at your own risk. Always test such use thoroughly for suitability in your own application and environment.
The information in this document was discovered or gathered by the following persons:
- Carsten Arnold
- Samuel Audet
- Alessandro Cantatore
- Scott Garfinkle
- Istvan Kovacs
- Alexander Mai
- Bob Markle
- Darren McBride
- Ferenc Pal
- Rick Papo
- Paul Ratcliffe
- Kai-Uwe Rommel
- Marco G. Salvagno
- Alexey Smirnov
- Uri J. Stern
- Holger Veit
API Functions
- DosDumpProcess
- DosForceSystemDump
- DosProfile
- DosQProcStat
- DosQueryMemState
- DosQueryModFromEIP
- DosQuerySysState
- DosReplaceModule
- DosSuppressPopUps
- WinSetTitle
- WinSetTitleAndIcon
- WinHSWITCHfromHAPP
The Color Selection Control

The color wheel control used by the Solid and Mixed Color Palette object is a publicly registered window class within OS/2, but is undocumented. The following notes are all that is necessary to use this control class:
- You must load the module WPCONFIG.DLL so that the publicly registered window message processor (ColorSelectWndProc) can be used without an addressing violation.
- Create your control window with WinCreateWindow or through a dialog template, using the window class name "ColorSelectClass".
- If you used WinCreateWindow you will need to reposition the control window each time the parent window is resized, as otherwise the control will reposition itself out of view. Dialogs seem to handle this automatically.
- The only control message defined -to- the control is 0x0602 under OS/2 Warp 4 or later, or (by some reports) 0x1384 on older versions of OS/2. Message parameter one must contain the RGB value to which the color wheel will be set.
- The only control message defined -from- the control is 0x0601 under OS/2 Warp 4 or later, or (by some reports) 0x130C on older versions of OS/2. Message parameter one will contain the RGB value to which the color wheel has been set.
- The control can only be sized at creation, and should be sized so that its height is approximately 60% of it.
HPFS Large Disk Access
DosRead/Write in direct-access mode will normally fail if the partition is greater than four gigabytes in size. If you wish to write an HPFS editor or other tool, you will need to know the "secret password" that unlocks the big disks. After you use DosOpen to get a handle to that volume, use FSCTL FSC_SECTORIO (0x9014) and in the parameter list, put a pointer to 0xDEADFACE. Doing so will put the handle in "sector" mode. All offsets and sizes will refer to sectors instead of bytes, allowing you to address 64Gb.
Undocumented extensions to Event Semaphores
It is possible to do a post that releases one thread at a time as of fixpak 29 for Warp 3 and fixpack 4 for Warp 4.
#define DCE_AUTORESET 0x1000 // Auto-reset event semaphore #define DCE_POSTONE 0x0800 // Post one flag
This feature only slightly changes the API of DosCreateEventSem. Other APIs for event semaphores are kept the same, although their behaviors are changed.
- DosCreateEventSem
- The flags argument can specify the new behaviors of the event semaphore: DCE_AUTORESET means the event automatically resets itself after a thread obtains it through DosWaitEventSem, and DCE_POSTONE means that DosPostEventSem only wakes up one waiting thread if there is any. When DCE_POSTONE is specified, the event always automatically resets even if DCE_AUTORESET is not specified. We can define three types of events with these two flags:
- Neither DCE_AUTORESET nor DCE_POSTONE set: The event has default behavior, which needs manual resets and wakes up all waiters when posted.
- DCE_AUTORESET set but not DCE_POSTONE: The event resets it after a wait is successfully executed. It wakes up all waiters when posted.
- DCE_POSTONE set: The event resets it automatically after a wait is successfully executed. But it only wakes up one waiter when posted.
- DosWaitEventSem
- For an AUTORESET event, it automatically resets itself after this is successfully executed. Otherwise, it leaves the event in signalled (posted) state.
- DosPostEventSem
- For a POSTONE event, it wakes up only one waiter if there is any thread waiting for the event. Otherwise, it wakes up all events.
How to reset the Physical Palette
Getting the 256-color mode palette manager to set itself up is not too hard, but getting it to reset itself to the default palette is not documented well. In the header file 'DIVE.H' is a nice piece of explanation:
Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set the physical palette. If your application MUST set the PHYSICAL palette, try using no more than 236 entries (the middle 236: 10-245, thus leaving the top and bottom 10 entries for the Workplace Shell). If your application MUST use ALL 256 entries, it must do so as a full-screen (i.e. maximized) application. Remember, No WM_REALIZEPALETTE message will be sent to other running applications, meaning they will not redraw and their colors will be all wrong. It is not recommended that a developer use these commands: To set physical palette, do the following: hps = WinGetPS ( HWND_DESKTOP ); hdc = GpiQueryDevice ( hps ); GpiCreateLogColorTable ( hps, LCOL_PURECOLOR | LCOL_REALIZABLE, LCOLF_CONSECRGB, 0, 256, (PLONG)plRGB2Entries ); DiveSetPhysicalPalette ( hDiveInst, hdc ); GreRealizeColorTable ( hdc ) ; WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE ); WinReleasePS ( hps ); To reset physical palette, do the following: hps = WinGetPS ( HWND_DESKTOP ) ; hdc = GpiQueryDevice ( hps ) ; GreUnrealizeColorTable ( hdc ) ; WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE ); WinReleasePS ( hps ) ;
I have altered these examples slightly for clarity, replacing the Gre32Entry3 function calls with macros defined in 'PMDDIM.H'.
Extensions to WinQuerySysValue and WinSetSysValue
Several new system values have been defined in the Warp 4.0 (and possibly in the newer fixpaks to Warp 3.0). They are:
#define SV_FULLWINDOWDRAG 99 /* FullWindowDrag */
#define SV_ALTTABSWITCHWIN 100 /* Alt-Tab Switching windows */
#define SV_VIOMOUSEACTIONS 101 /* VIO mouse actions */
#define SV_ASYNCFOCUSCHANGE 102 /* Asynchronous focus change */
#define SV_FOCUSCHANGESENS 103 /* Focus Change sensitivity */
The definition names given here are not official, and are not included in PMWIN.H.
Extensions to WinDrawBorder
There are at least two undocumented option flags for the WinDrawBorder function which appear to have been provided to help in drawing pushbutton controls. They are:
#define DB_RAISED 0x0400 /* Draw 3-d border giving the window a raised appearance. */
#define DB_DEPRESSED 0x0800 /* Draw 3-d border giving the window a sunken appearance. */
The definition names given here are not official, and are not included in PMWIN.H.
Environment Variables
There are a number of undocumented environment variables that change the behaviour of the system. These are a few of them:
- COPYFROMFLOPPY=1 - You have replaced one or more of the files on the installation floppies, and you have successfully booted the installer in spite of your strange hardware. The installation proceeds, but it pulls in replacements to what you just replaced from either the later compressed diskettes, or from the CD. When the first phase of installation completes and the system reboots from the hard drive, you find that you no longer are using the replacement drivers. If you add this line to the CONFIG.SYS on install diskette 1 (before Warp 4.0) or on install diskette 2 (Warp 4.0 or later), then the installer will reload the replacement files from the early floppies before rebooting.
- KILLCONFIRMDISABLED=ON - Avoid the "Are you sure ..." dialog if using the WarpCenter kill feature. You must also have the SET SCKILLFEATUREENABLED variable installed.
- KILLFEATUREENABLED=ON - This enables the display of the full process list from WarpCenter by clicking on the task list button while pressing the Control key. Selecting a program from the list pops up a message box to confirm the killing of the process.
- MENUSFOLLOWPOINTER=ON - This makes the WarpCenter menus (but no others) behave more like the Start menu of Windows, in that once you open the menu, the menu selection will follow the mouse without your needing to keep the mouse button pressed down. Submenus will automatically open as you move the mouse pointer over them. This function only works on Warp 4.0 with fixpack 5 or later.
- SCCANBENUKED=ON - Allows the WarpCenter to have a Delete option on its context menu.
- SCFINDUTILITY=c:\os2\apps\pmseek.exe - This changes the function of the Find button on the WarpCenter to use PMSEEK instead of the limited-function default file finder.
- SCKILLCONFIRMDISABLED=ON - This is the same as KILLCONFIRMDISABLED=ON.
- SCKILLFEATUREENABLED=ON - This is the same as KILLFEATUREENABLED=ON.
- SCPRETTYCLOCK=1 - This changes the appearance of the WarpCenter clock, giving it a fancier border, a black background and green numbers.
- SHELLHANDLESINC= - This environment variable increments the number of file handles available to the Shell process (protshell). Users who need more file handles can add this statement to CONFIG.SYS. The maximum file handles will be incremented by the amount specified in the statement. The system defaults to 20 file handles in the Shell process. Therefore, if the statement specifies a 10, then the total would be incremented to 30.