DosQuerySysInfo: Difference between revisions
No edit summary |
No edit summary |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Returns values of static system variables. | Returns values of static system variables. | ||
==Syntax== | ==Syntax== | ||
DosQuerySysInfo( ''ulStartIndex'', ''ulLastIndex'', ''pDataBuffer'', ''ulDataBufferLength'' ) | |||
==Parameters== | ==Parameters== | ||
; ulStartIndex ([[ULONG]]) - input: Index of the first info to query. | |||
; | ; ulLastIndex (ULONG) - input: Index of the last info to query. Equal to ''ulStartIndex'' if it is the only wanted info. | ||
: Index of the first info to query. | ; pDataBuffer ([[PVOID]]) - output: Address to a data buffer to put the information in. | ||
; | ; ulDataBufferLengt ([[LONG]]) - input: Size of ''pDataBuffer''. Valid values for ''ulStartIndex'' and ''ulLastIndex'' | ||
: Index of the last info to query. Equal to ''ulStartIndex'' if it is the only wanted info. | |||
; | |||
: Address to a data buffer to put the information in. | |||
; LONG | |||
: Size of ''pDataBuffer''. Valid values for ''ulStartIndex'' and ''ulLastIndex'' | |||
{| class="wikitable" | {| class="wikitable" | ||
! No. | ! No.||Name||Description||OS/2 Version | ||
|- | |- | ||
| 1 | | 1 | ||
Line 149: | Line 140: | ||
| QSV_NUMPROCESSORS | | QSV_NUMPROCESSORS | ||
| Number of processors in the computer. | | Number of processors in the computer. | ||
| Warp | |||
|- | |||
| 27 | |||
| QSV_MAXHPRMEM | |||
| Maximum amount of free space in the high private arena for this process. This number does not indicate the largest single memory object that can be allocated, since the arena is probably fragmented. | |||
| Warp | |||
|- | |||
| 28 | |||
| QSV_MAXHSHMEM | |||
| Maximum amount of free space in the high shared arena for this process. This number does not indicate the largest single memory object that can be allocated, since the arena is probably fragmented. | |||
| Warp | |||
|- | |||
| 29 | |||
| QSV_MAXPROCESSES | |||
| Maximum number of concurrent processes supported. | |||
| Warp | |||
|- | |||
| 30 | |||
| QSV_VIRTUALADDRESSLIMIT | |||
| Size of the user's address space in MB. | |||
| Warp | | Warp | ||
|} | |} | ||
;Note: Major, minor and revision numbers for versions of OS/2 operating system are described below: | |||
<PRE> | |||
┌──────────┬──────────┬──────────┬──────────┐ | |||
│ │Major │Minor │Revision │ | |||
├──────────┼──────────┼──────────┼──────────┤ | |||
│OS/2 2.0 │20 │00 │0 │ | |||
├──────────┼──────────┼──────────┼──────────┤ | |||
│OS/2 2.1 │20 │10 │0 │ | |||
├──────────┼──────────┼──────────┼──────────┤ | |||
│OS/2 2.11 │20 │11 │0 │ | |||
├──────────┼──────────┼──────────┼──────────┤ | |||
│OS/2 3.0 │20 │30 │0 │ | |||
├──────────┼──────────┼──────────┼──────────┤ | |||
│OS/2 4.0 │20 │40 │0 │ | |||
└──────────┴──────────┴──────────┴──────────┘ | |||
</PRE> | |||
An application can specify file objects managed by an installable file system that supports long file names. Because some installable file systems support longer names than others, the application should issue DosQuerySysInfo upon initialization. | |||
DosQuerySysInfo returns the maximum path length (QSV_MAX_PATH_LENGTH) supported by the installed file system. The path length includes the drive specifier (d:), the leading backslash ( \ ), and the trailing null character. The value returned by DosQuerySysInfo can be used to allocate buffers for path names returned by other functions. | |||
Since memory usage in the system changes constantly, the values returned by QSV_MAXHPRMEM and QSV_MAXHSMMEM should only be used as an indication of current memory usage. | |||
==Returns== | ==Returns== | ||
; rc ([[APIRET]]) - returns | |||
; APIRET | : Indicates if any error occurred. | ||
: Indicates if any error | |||
{| class="wikitable" | {| class="wikitable" | ||
| 0 | | 0 | ||
Line 168: | Line 200: | ||
==Include Info== | ==Include Info== | ||
#define INCL_DOSMISC | #define INCL_DOSMISC | ||
#include <os2.h> | #include <os2.h> | ||
==Usage Explanation== | ==Usage Explanation== | ||
DosQuerySysInfo queries different information about the system. and returns it in a buffer sent to it with the call. | DosQuerySysInfo queries different information about the system. and returns it in a buffer sent to it with the call. | ||
== | ==Sample Code== | ||
Declaration: | |||
</PRE> | |||
#define INCL_DOSMISC | |||
#include <os2.h> | |||
ULONG iStart; /* Ordinal of the first system variable to return. */ | |||
ULONG iLast; /* Ordinal of the last system variable to return. */ | |||
PVOID pBuf; /* Address of the data buffer where the system returns the variable values. */ | |||
ULONG cbBuf; /* Length, in bytes, of the data buffer. */ | |||
APIRET ulrc; /* Return Code. */ | |||
ulrc = DosQuerySysInfo(iStart, iLast, pBuf, cbBuf); | |||
</PRE> | |||
Sample: | |||
ULONG aulBuffer[4]; | ULONG aulBuffer[4]; | ||
APIRET rc; | APIRET rc; | ||
Line 231: | Line 270: | ||
==Related Functions== | ==Related Functions== | ||
* [[ | * [[DosCreateDir]] | ||
* [[ | * [[DosFindFirst]] | ||
* [[ | * [[DosFindNext]] | ||
* [[ | * [[DosOpen]] | ||
* [[ | * [[DosQueryCurrentDir]] | ||
* [[ | * [[DosQueryFSInfo]] | ||
* [[ | * [[DosQueryPathInfo]] | ||
* [[ | * [[DosSearchPath]] | ||
* [[ | * [[DosSetCurrentDir]] | ||
* [[ | * [[DosSetPathInfo]] | ||
* [[ | * [[DosSetFSInfo]] | ||
[[Category: | [[Category:Dos]] |
Latest revision as of 02:15, 17 May 2025
Returns values of static system variables.
Syntax
DosQuerySysInfo( ulStartIndex, ulLastIndex, pDataBuffer, ulDataBufferLength )
Parameters
- ulStartIndex (ULONG) - input
- Index of the first info to query.
- ulLastIndex (ULONG) - input
- Index of the last info to query. Equal to ulStartIndex if it is the only wanted info.
- pDataBuffer (PVOID) - output
- Address to a data buffer to put the information in.
- ulDataBufferLengt (LONG) - input
- Size of pDataBuffer. Valid values for ulStartIndex and ulLastIndex
No. | Name | Description | OS/2 Version |
---|---|---|---|
1 | QSV_MAX_PATH_LENGTH | Maximum length of a path name (bytes). Use this when allocating filename buffers. | All |
2 | QSV_MAX_TEXT_SESSIONS | Maximum number of text sessions. | All |
3 | QSV_MAX_PM_SESSIONS | Maximum number of PM sessions. | All |
4 | QSV_MAX_VDM_SESSIONS | Maximum number of DOS sessions. | All |
5 | QSV_BOOT_DRIVE | Boot drive (1 = A:, 2 = B:, 3 = C, and so on). | All |
6 | QSV_DYN_PRI_VARIATION | Absolute(= 0)/Dynamic(= 1) priority. | All |
7 | QSV_MAX_WAIT | Maximum wait time (seconds). | All |
8 | QSV_MIN_SLICE | Minimum time slice allowed (milliseconds). | All |
9 | QSV_MAX_SLICE | Maximum time slice allowed (milliseconds). | All |
10 | QSV_PAGE_SIZE | Memory page size (bytes). Default 4096 bytes. | All |
11 | QSV_VERSION_MAJOR | Major version number. | All |
12 | QSV_VERSION_MINOR | Minor version number. | All |
13 | QSV_VERSION_REVISION | Revision letter. | All |
14 | QSV_MS_COUNT | Value of a 32-bit, free-running counter (milliseconds). Zero at boot time. | All |
15 | QSV_TIME_LOW | Low-order 32 bits of the time since January 1, 1980 (seconds). | All |
16 | QSV_TIME_HIGH | High-order 32 bits of the time since January 1, 1980 (seconds). | All |
17 | QSV_TOTPHYSMEM | Total number of bytes of physical memory. | All |
18 | QSV_TOTRESMEM | Total number of bytes of system-resident memory. | All |
19 | QSV_TOTAVAILMEM | Maximum number of bytes available for all processes in the system RIGHT NOW. | All |
20 | QSV_MAXPRMEM | Maximum number of bytes available for this process RIGHT NOW. | All |
21 | QSV_MAXSHMEM | Maximum number of shareable bytes available RIGHT NOW. | All |
22 | QSV_TIMER_INTERVAL | Timer interval (1/10 milliseconds). | All |
23 | QSV_MAX_COMP_LENGTH | Maximum length of one component in a path name (bytes). | All |
24 | QSV_FOREGROUND_FS_SESSION | Session ID of the current foreground full screen session. (any PM, VIO or Win-DOS session would be ID = 1). | Warp |
25 | QSV_FOREGROUND_PROCESS | Process ID of the current foreground process. | Warp |
26 | QSV_NUMPROCESSORS | Number of processors in the computer. | Warp |
27 | QSV_MAXHPRMEM | Maximum amount of free space in the high private arena for this process. This number does not indicate the largest single memory object that can be allocated, since the arena is probably fragmented. | Warp |
28 | QSV_MAXHSHMEM | Maximum amount of free space in the high shared arena for this process. This number does not indicate the largest single memory object that can be allocated, since the arena is probably fragmented. | Warp |
29 | QSV_MAXPROCESSES | Maximum number of concurrent processes supported. | Warp |
30 | QSV_VIRTUALADDRESSLIMIT | Size of the user's address space in MB. | Warp |
- Note
- Major, minor and revision numbers for versions of OS/2 operating system are described below:
┌──────────┬──────────┬──────────┬──────────┐ │ │Major │Minor │Revision │ ├──────────┼──────────┼──────────┼──────────┤ │OS/2 2.0 │20 │00 │0 │ ├──────────┼──────────┼──────────┼──────────┤ │OS/2 2.1 │20 │10 │0 │ ├──────────┼──────────┼──────────┼──────────┤ │OS/2 2.11 │20 │11 │0 │ ├──────────┼──────────┼──────────┼──────────┤ │OS/2 3.0 │20 │30 │0 │ ├──────────┼──────────┼──────────┼──────────┤ │OS/2 4.0 │20 │40 │0 │ └──────────┴──────────┴──────────┴──────────┘
An application can specify file objects managed by an installable file system that supports long file names. Because some installable file systems support longer names than others, the application should issue DosQuerySysInfo upon initialization.
DosQuerySysInfo returns the maximum path length (QSV_MAX_PATH_LENGTH) supported by the installed file system. The path length includes the drive specifier (d:), the leading backslash ( \ ), and the trailing null character. The value returned by DosQuerySysInfo can be used to allocate buffers for path names returned by other functions.
Since memory usage in the system changes constantly, the values returned by QSV_MAXHPRMEM and QSV_MAXHSMMEM should only be used as an indication of current memory usage.
Returns
- rc (APIRET) - returns
- Indicates if any error occurred.
0 | NO_ERROR |
87 | ERROR_INVALID_PARAMETER |
111 | ERROR_BUFFER_OVERFLOW |
Include Info
#define INCL_DOSMISC #include <os2.h>
Usage Explanation
DosQuerySysInfo queries different information about the system. and returns it in a buffer sent to it with the call.
Sample Code
Declaration:
- define INCL_DOSMISC
- include <os2.h>
ULONG iStart; /* Ordinal of the first system variable to return. */ ULONG iLast; /* Ordinal of the last system variable to return. */ PVOID pBuf; /* Address of the data buffer where the system returns the variable values. */ ULONG cbBuf; /* Length, in bytes, of the data buffer. */ APIRET ulrc; /* Return Code. */
ulrc = DosQuerySysInfo(iStart, iLast, pBuf, cbBuf);
Sample:
ULONG aulBuffer[4]; APIRET rc; rc = DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT, (void *)aulBuffer, 4*sizeof(ULONG)); if(rc) { printf("Error! DosQuerySysInfo returned %d.\n",rc); return(-1); } else { printf("You are running version %d.%d revision %c.\n", aulBuffer[0], aulBuffer[1], (char) aulBuffer[2]); printf("Your system has been running %d hour(s) and %d minute(s).\n", aulBuffer[3]/3600000, (aulBuffer[3]%3600000)/60000); }
This example queries and displays the maximum length for a path name and the total amount of physical memory in bytes.
#define INCL_DOSMISC /* DOS Miscellaneous values */ #define INCL_DOSERRORS /* DOS Error values */ #include <os2.h> #include <stdio.h> int main(VOID) { ULONG aulSysInfo[QSV_MAX] = {0}; /* System Information Data Buffer */ APIRET rc = NO_ERROR; /* Return code */ rc = DosQuerySysInfo(1L, /* Request all available system */ QSV_MAX, /* information */ (PVOID)aulSysInfo, sizeof(ULONG)*QSV_MAX); if (rc != NO_ERROR) { printf("DosQuerySysInfo error: return code = %u\n", rc); return 1; } else { printf("Maximum length for a path name is %u characters.\n", aulSysInfo[QSV_MAX_PATH_LENGTH-1]); /* Max length of path name */ printf("Total physical memory is %u bytes.\n", aulSysInfo[QSV_TOTPHYSMEM-1]); /* Total physical memory */ } /* endif */ return NO_ERROR; }