pm_help.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /****************************************************************************
  2. *
  3. * SciTech OS Portability Manager Library
  4. *
  5. * ========================================================================
  6. *
  7. * The contents of this file are subject to the SciTech MGL Public
  8. * License Version 1.0 (the "License"); you may not use this file
  9. * except in compliance with the License. You may obtain a copy of
  10. * the License at http://www.scitechsoft.com/mgl-license.txt
  11. *
  12. * Software distributed under the License is distributed on an
  13. * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  14. * implied. See the License for the specific language governing
  15. * rights and limitations under the License.
  16. *
  17. * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
  18. *
  19. * The Initial Developer of the Original Code is SciTech Software, Inc.
  20. * All Rights Reserved.
  21. *
  22. * ========================================================================
  23. *
  24. * Language: ANSI C
  25. * Environment: Win32, OS/2
  26. *
  27. * Description: Include file for the SciTech Portability Manager 32-bit
  28. * helper VxD for Windows 9x for and the 16-bit ring 0
  29. * helper device driver for OS/2.
  30. *
  31. * This file documents all the public services used by the
  32. * SciTech Portability Manager library and SciTech Nucleus
  33. * loader library.
  34. *
  35. ****************************************************************************/
  36. #ifndef __PMHELP_H
  37. #define __PMHELP_H
  38. /* Include version information */
  39. #include "sdd/sddver.h"
  40. #define PMHELP_Major SDD_RELEASE_MAJOR
  41. #define PMHELP_Minor SDD_RELEASE_MINOR
  42. #define PMHELP_VERSION ((PMHELP_Major << 8) | PMHELP_Minor)
  43. #ifdef __OS2__
  44. /****************************************************************************
  45. * Public OS/2 Support functions
  46. ****************************************************************************/
  47. #include "scitech.h"
  48. #include "nucleus/graphics.h"
  49. /* Name of device driver */
  50. #define PMHELP_NAME (PSZ)"sddhelp$"
  51. /* Main IOCTL function to talk to device driver */
  52. #define PMHELP_IOCTL 0x0080
  53. /* Macro definition for defining IOCTL function control codes for the SDDHELP
  54. * device driver for OS/2. Similar to that used for the DOS/Win32 version.
  55. */
  56. #define PMHELP_CTL_CODE(name,value) \
  57. PMHELP_##name = value
  58. typedef enum {
  59. /* Version function used by all drivers */
  60. PMHELP_CTL_CODE(GETVER ,0x0001),
  61. PMHELP_CTL_CODE(MAPPHYS ,0x0002),
  62. PMHELP_CTL_CODE(ALLOCLOCKED ,0x0003),
  63. PMHELP_CTL_CODE(FREELOCKED ,0x0004),
  64. PMHELP_CTL_CODE(GETGDT32 ,0x0005),
  65. PMHELP_CTL_CODE(MALLOCSHARED ,0x0007),
  66. PMHELP_CTL_CODE(FREESHARED ,0x0008),
  67. PMHELP_CTL_CODE(MAPTOPROCESS ,0x0009),
  68. PMHELP_CTL_CODE(FREEPHYS ,0x000A),
  69. PMHELP_CTL_CODE(FLUSHTLB ,0x000B),
  70. PMHELP_CTL_CODE(SAVECR4 ,0x000C),
  71. PMHELP_CTL_CODE(RESTORECR4 ,0x000D),
  72. PMHELP_CTL_CODE(READMSR ,0x000E),
  73. PMHELP_CTL_CODE(WRITEMSR ,0x000F),
  74. PMHELP_CTL_CODE(GETPHYSICALADDR ,0x0010),
  75. PMHELP_CTL_CODE(GETPHYSICALADDRRANGE ,0x0011),
  76. PMHELP_CTL_CODE(LOCKPAGES ,0x0012),
  77. PMHELP_CTL_CODE(UNLOCKPAGES ,0x0013),
  78. PMHELP_CTL_CODE(GETSHAREDEXP ,0x0042),
  79. PMHELP_CTL_CODE(SETSHAREDEXP ,0x0043),
  80. PMHELP_CTL_CODE(GETSTACKSWITCHRTN ,0x0044),
  81. PMHELP_CTL_CODE(GETBUILDNO ,0x0050),
  82. } PMHELP_ctlCodes;
  83. #else
  84. /****************************************************************************
  85. * Public DOS/Windows Support functions
  86. ****************************************************************************/
  87. #ifdef DEVICE_MAIN
  88. #include <vtoolsc.h>
  89. #define PMHELP_Init_Order (VDD_INIT_ORDER-1)
  90. #define RETURN_LONGS(n) *p->dioc_bytesret = (n) * sizeof(ulong)
  91. #endif /* DEVICE_MAIN */
  92. #include "scitech.h"
  93. #include "nucleus/graphics.h"
  94. /* We connect to the SDDHELP.VXD module if it is staticly loaded (as part
  95. * of SciTech Display Doctor), otherwise we dynamically load the PMHELP.VXD
  96. * public helper VxD.
  97. */
  98. #define PMHELP_DeviceID 0x0000
  99. #define SDDHELP_DeviceID 0x3DF8
  100. #define VXDLDR_DeviceID 0x0027
  101. #define SDDHELP_MODULE "SDDHELP"
  102. #define SDDHELP_NAME "SDDHELP.VXD"
  103. #define PMHELP_MODULE "PMHELP"
  104. #define PMHELP_NAME "PMHELP.VXD"
  105. #define PMHELP_DDBNAME "pmhelp "
  106. #define SDDHELP_MODULE_PATH "\\\\.\\" SDDHELP_MODULE
  107. #define PMHELP_MODULE_PATH "\\\\.\\" PMHELP_MODULE
  108. #define PMHELP_VXD_PATH "\\\\.\\" PMHELP_NAME
  109. /* Macro definition for defining IOCTL function control codes for the PMHELP
  110. * device drivers for Windows 9x and NT. This macro is basically derived from
  111. * the CTL_CODE macro in the Windows 2000 DDK, but we hard code it here to
  112. * avoid having to #include any of the Windows 2000 DDK header files. We also
  113. * define both a 16-bit and 32-bit version of the control code within the same
  114. * macro to simplify future additions.
  115. *
  116. * Essentially the Win32 macro would normally expand to the following:
  117. *
  118. * CTL_CODE(FILE_DEVICE_VIDEO,0x800+value,METHOD_BUFFERED,FILE_ANY_ACCESS)
  119. */
  120. #define PMHELP_CTL_CODE(name,value) \
  121. PMHELP_##name = value, \
  122. PMHELP_##name##32 = ((0x23 << 16) | (0 << 14) | ((0x800+value) << 2) | (0))
  123. typedef enum {
  124. /* Include all the control codes. We keep them in a separate header
  125. * file so we can include them in multiple places to make this
  126. * more versatile.
  127. */
  128. #include "pm_wctl.h"
  129. } PMHELP_ctlCodes;
  130. /* For real mode VxD calls, we put the function number into the high
  131. * order word of EAX, and a value of 0x4FFF in AX. This allows our
  132. * VxD handler which is set up to handle Int 10's to recognise a native
  133. * PMHELP API call from a real mode DOS program.
  134. */
  135. #ifdef REALMODE
  136. #define API_NUM(num) (((ulong)(num) << 16) | 0x4FFF)
  137. #else
  138. #define API_NUM(num) (num)
  139. #endif
  140. #endif /* !__OS2__ */
  141. #endif /* __PMHELP_H */