| 1 | 2.3 Win32k.sys - native OS/2 PE-loader
|
|---|
| 2 | --------------------------------------
|
|---|
| 3 |
|
|---|
| 4 | The win32k.sys driver makes PE (Win32) executables equal to native OS/2
|
|---|
| 5 | executables by implementing a Ring 0 on-the-fly loader / converter.
|
|---|
| 6 |
|
|---|
| 7 | You may wonder how you may run a Win32 program using a device driver. You
|
|---|
| 8 | don't have to worry about that, simply treat the Win32 program just as an
|
|---|
| 9 | another OS/2 program. OS/2 can't tell the difference!
|
|---|
| 10 | No conversion of dlls or running programs thru Pe.EXE.
|
|---|
| 11 |
|
|---|
| 12 | For example, if you fancy playing windows solitaire.
|
|---|
| 13 | 1) Make sure the necessary DLLs (MSVCRT.DLL and CARDS.DLL) are in you
|
|---|
| 14 | PATH, current dir, SOL.EXE dir, Odin32 System32 dir, Odin32 System dir,
|
|---|
| 15 | Odin32 dir, or LIBPATHs; and that you have SOL.EXE somewhere.
|
|---|
| 16 |
|
|---|
| 17 | 2) Then start SOL.EXE by simply typing SOL.EXE (with path if necessary).
|
|---|
| 18 | It's also possible to start SOL.EXE from the desktop if you like.
|
|---|
| 19 | Simply find the SOL.EXE icon (or create it) and double click on it!
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | 2.3.1 WARNING
|
|---|
| 23 | -------------
|
|---|
| 24 |
|
|---|
| 25 | The Win32k.sys is quite alpha software and any bugs which haven't been found
|
|---|
| 26 | yet may crash and/or corrupt you entire system! Make sure you have backed up
|
|---|
| 27 | important stuff first!
|
|---|
| 28 |
|
|---|
| 29 | We are not responsible for ANYTHING AT ALL! See Odin32 disclaimer...
|
|---|
| 30 |
|
|---|
| 31 | Before you install Win32k.sys make sure that you have a backdoor to your system
|
|---|
| 32 | which works. For example try to boot your system using the Alt+F1 during bootup
|
|---|
| 33 | and choose Commandline boot (F2). Make sure you have an textmode editor which
|
|---|
| 34 | works; for example TEDIT.EXE.
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | 2.3.2 Requirements
|
|---|
| 38 | ------------------
|
|---|
| 39 |
|
|---|
| 40 | Win32k should at least work on OS/2 Warp 3 and above, but I don't get too
|
|---|
| 41 | surprised if it worked on 2.11 too. DBCS are not supported yet AFAIK.
|
|---|
| 42 |
|
|---|
| 43 | It no longer requires a kernel file for retail kernels (if you don't know what
|
|---|
| 44 | kernel you have, you have a retail kernel). Win32k does now contain a
|
|---|
| 45 | "database" for the most recent retail kernels. Currently this is:
|
|---|
| 46 | Warp 4 fp#1 -> fp#14
|
|---|
| 47 | Aurora GA, FP1, preFP2
|
|---|
| 48 | Warp 3 fp#32-> fp#42
|
|---|
| 49 |
|
|---|
| 50 | If the running kernel is not found in the "database" or is a debug kernel
|
|---|
| 51 | wink32.sys will look for symbolfiles as it allways did.
|
|---|
| 52 | If you use the -s:<symfile> argument the given symbol file will be
|
|---|
| 53 | investigated before the database is searched.
|
|---|
| 54 |
|
|---|
| 55 | NOTE! It hasn't been fully verified that all the different national fixpaks
|
|---|
| 56 | have the same symbols as the us-english ones. Feedback on this issue is
|
|---|
| 57 | appreciated.
|
|---|
| 58 |
|
|---|
| 59 | NOTE! A piece of advice for those playing with debug-kernels: Make sure that
|
|---|
| 60 | c:\OS2KRNL.SYM is matching the running kernel.
|
|---|
| 61 |
|
|---|
| 62 | 2.3.2.1 Warp 3
|
|---|
| 63 | --------------
|
|---|
| 64 |
|
|---|
| 65 | Win32k is not tested with Warp 3. It is _supposed_ to work with Warp 3
|
|---|
| 66 | provided you are running fixpack 32 or later.
|
|---|
| 67 | (Fixpack 32 + y2kclock.exe is required for Y2K readyness anyway so...)
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | 2.3.3 Installation
|
|---|
| 71 | ------------------
|
|---|
| 72 |
|
|---|
| 73 | To use Win32k.sys you have to add the following line into your config.sys:
|
|---|
| 74 | device=<d:\path\system32>win32k.sys
|
|---|
| 75 |
|
|---|
| 76 | Where <d:\path\system32> is the path to the win32k.sys, i.e. usually the odin32
|
|---|
| 77 | system32 directory.
|
|---|
| 78 |
|
|---|
| 79 | After doing this, you'll have to reboot your machine to load the driver. During
|
|---|
| 80 | the boot process you will on a successful installation see some lines of
|
|---|
| 81 | technical info and finally a line saying:
|
|---|
| 82 | Win32k - Odin32 support driver.
|
|---|
| 83 | Build: 14046 - v20.45
|
|---|
| 84 | Found symbolfile: Win32k Symbol Database
|
|---|
| 85 | Win32k.sys succesfully initiated!
|
|---|
| 86 |
|
|---|
| 87 | If you don't see the last line something is wrong, and some error info will be
|
|---|
| 88 | shown. In the case of error the 'rc=<value>' is important to remember.
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 | 2.3.4 Win32k parameters
|
|---|
| 92 | -----------------------
|
|---|
| 93 |
|
|---|
| 94 | The Capitalized letters are the one which is tested for when identifying the
|
|---|
| 95 | argument.
|
|---|
| 96 |
|
|---|
| 97 | There are some useful parameters for Win32k:
|
|---|
| 98 | -Quited Quiet driver initiation.
|
|---|
| 99 | Default: disabled (ie. -V)
|
|---|
| 100 |
|
|---|
| 101 | -Verbose Verbose driver initiation.
|
|---|
| 102 | Default: enabled
|
|---|
| 103 |
|
|---|
| 104 | -S:<filename> Full path to the current OS/2 kernel symbol file.
|
|---|
| 105 | When this is specified the given
|
|---|
| 106 | Default: symbol "database" and default locations are searched.
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | Loader parameters:
|
|---|
| 110 | -SCript:<Y|N> Enable / disable UNIX script support.
|
|---|
| 111 | Default: Enabled.
|
|---|
| 112 |
|
|---|
| 113 | -REXX:<Y|N> Enable / disable pure REXX script support.
|
|---|
| 114 | Default: Enabled.
|
|---|
| 115 |
|
|---|
| 116 | -Java:<Y|N> Enable / disable JAVA loading.
|
|---|
| 117 |
|
|---|
| 118 | -Pe:<MIXED|PE2LX|PE|NOT>
|
|---|
| 119 | Enabled / disable and set mode of the PE loading.
|
|---|
| 120 | MIXED: Mix of Pe2Lx and Pe.exe. It uses Pe2Lx when
|
|---|
| 121 | possible and backs out to pe.exe if the executables
|
|---|
| 122 | aren't supported by the converter.
|
|---|
| 123 | PE2LX: Pe2Lx loader only.
|
|---|
| 124 | PE: Pe.exe only. The program is started using Pe.exe,
|
|---|
| 125 | and the process name will be pe.exe.
|
|---|
| 126 | NOT: Disable PE loading.
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | Logging parameters:
|
|---|
| 130 | -L<:E|:D> Enables/Disables logging.
|
|---|
| 131 | Default: disabled.
|
|---|
| 132 |
|
|---|
| 133 | -Com:<1|2|3|4>
|
|---|
| 134 | or
|
|---|
| 135 | -C<1|2|3|4> Which com-port to log to.
|
|---|
| 136 | Default: -C2
|
|---|
| 137 |
|
|---|
| 138 | -Warning:<1|2|3|4>
|
|---|
| 139 | or
|
|---|
| 140 | -W<1|2|3|4> Warning/info level for PE loader. (This is warnings and info
|
|---|
| 141 | which is published thru the com-port as logging information.)
|
|---|
| 142 | Default: -W0
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | Heap parameters:
|
|---|
| 146 | -HEAPMax: Maximum swappable heap size in bytes.
|
|---|
| 147 | Default: 512KB
|
|---|
| 148 |
|
|---|
| 149 | -Heapinit: Initial heapsize in bytes.
|
|---|
| 150 | Default: 16MB
|
|---|
| 151 |
|
|---|
| 152 | -RESHEAPMax: Maximum resident heap size in bytes.
|
|---|
| 153 | Default: 256KB
|
|---|
| 154 |
|
|---|
| 155 | -Resheapinit: Initial resident in bytes.
|
|---|
| 156 | Default: 16MB
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | OS/2 Loader parameter:
|
|---|
| 160 | -Dllfixes<:E|:D>
|
|---|
| 161 | Enables or Disables the long DLL name and non .DLL
|
|---|
| 162 | extention fixes. OS/2 DLLs have been limited to 8 chars
|
|---|
| 163 | names since version 2.<something>. This is a very bad
|
|---|
| 164 | limitation. Also OS/2 forces all DLL loaded to loadtime
|
|---|
| 165 | to have the extention '.DLL'.
|
|---|
| 166 | Both these retritions are removed if this option is
|
|---|
| 167 | enabled.
|
|---|
| 168 | For DLL with non .DLL extention the internal name must
|
|---|
| 169 | have to the extention included. (If you the experiences
|
|---|
| 170 | problems with IMPLIB.EXE, enclose the internal name
|
|---|
| 171 | in double-quotes.)
|
|---|
| 172 | You should not make a DLL with a name starting with
|
|---|
| 173 | DOSCALLS, DOSCALLS1, IBMVGA32, IBMDEV32 or IBMXGA32.
|
|---|
| 174 | Current state for this feature is EXPERIMENTAL.
|
|---|
| 175 | Default: Enabled
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 | Obsolete:
|
|---|
| 179 | -K:<filename> Ignored. Win32k scans the kernel image in memory!
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | 2.3.5 PE Loading
|
|---|
| 183 | ----------------
|
|---|
| 184 |
|
|---|
| 185 | Win32k.sys are able to do PE loading in two different ways.
|
|---|
| 186 |
|
|---|
| 187 | 2.3.5.1 PE2LX
|
|---|
| 188 | -------------
|
|---|
| 189 | The first one is called PE2LX and hence uses the original Win32k.sys method
|
|---|
| 190 | which is similar to Pe2Lx. This only requires that KERNEL32.DLL (ie. Odin32
|
|---|
| 191 | System32 directory) is present somewhere in the PATH or LIBPATHs. The DLL
|
|---|
| 192 | search order of PE2LX is now conforming with the Win32 order:
|
|---|
| 193 | 1. The directory of the executable (.EXE).
|
|---|
| 194 | 2. The current directory.
|
|---|
| 195 | 3. The Odin32 System32 directory. (Kernel32.dll directory)
|
|---|
| 196 | 4. The Odin32 System directory. (sibling of system32)
|
|---|
| 197 | 5. The Odin32 directory. (parent of system32)
|
|---|
| 198 | 6. The PATH environment variable. (TODO: quotes are not currently supported)
|
|---|
| 199 | 7. The BEGINLIBPATH.
|
|---|
| 200 | 8. The LIBPATH.
|
|---|
| 201 | 9. The ENDLIBPATH.
|
|---|
| 202 | (Note that the OS/2 DLLs in the _Odin32_ process are also found using this
|
|---|
| 203 | search order. This shouldn't matter much as nearly all of the OS/2 DLL are
|
|---|
| 204 | allready loaded. But if this proves a problem it could be changed.)
|
|---|
| 205 |
|
|---|
| 206 | 2.3.5.2 PE
|
|---|
| 207 | ----------
|
|---|
| 208 | The second one is called PE and invokes the Pe.EXE to execute the PE (Win32)
|
|---|
| 209 | programs. This of course requies that PE.EXE is found in the PATH.
|
|---|
| 210 |
|
|---|
| 211 | 2.3.5.3 Modes
|
|---|
| 212 | --------------
|
|---|
| 213 | Win32k.sys have three (or four) different ways of combining these two methods,
|
|---|
| 214 | called modes:
|
|---|
| 215 | PE2LX only
|
|---|
| 216 | PE only
|
|---|
| 217 | PE2LX with fallback on PE.
|
|---|
| 218 | (fourth: NOT load any PE executables at all)
|
|---|
| 219 |
|
|---|
| 220 | The last one is the default one and is probably the best one currently.
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | 2.3.6 UNIX Shell Script Loader
|
|---|
| 224 | ------------------------------
|
|---|
| 225 |
|
|---|
| 226 | The UNIX Shell Script Loader makes OS/2 able to run UNIX shell scripts as
|
|---|
| 227 | native executables, just as UNIX does. A unix shell script is a text file
|
|---|
| 228 | which has a starting line which specifies the interpreter for the script.
|
|---|
| 229 |
|
|---|
| 230 | For example a perl script:
|
|---|
| 231 | #!/bin/perl5 -Sx
|
|---|
| 232 |
|
|---|
| 233 | Or the most common one:
|
|---|
| 234 | #! /bin/sh
|
|---|
| 235 |
|
|---|
| 236 | Since Most OS/2 systems don't have a /bin directory or a /usr/bin directory
|
|---|
| 237 | the executable specified are looked for in these ways:
|
|---|
| 238 | 1. The exact filename specified.
|
|---|
| 239 | 2. The filename specified with .EXE extention.
|
|---|
| 240 | 3. Search the PATH for the filename (with out path of course).
|
|---|
| 241 | 4. Search the PATH for the filename with .EXE extention (and with out path of course).
|
|---|
| 242 |
|
|---|
| 243 | So, you could now execute UNIX shell script in OS/2 without even modify the
|
|---|
| 244 | path of the interpreter!
|
|---|
| 245 |
|
|---|
| 246 | The UNIX Shell Script Loader is enabled by default.
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 | 2.3.6 Pure REXX Loader
|
|---|
| 250 | ----------------------
|
|---|
| 251 |
|
|---|
| 252 | The Pure REXX Loader is a win32k.sys feature which enables REXX script with
|
|---|
| 253 | the extentions .RX and .REX to run as native OS/2 executables. These REXX
|
|---|
| 254 | scripts are executed using kRX.EXE which is found in the Odin32 System32
|
|---|
| 255 | directory.
|
|---|
| 256 |
|
|---|
| 257 | When we say "Pure REXX" scripts, that means no use of command line should
|
|---|
| 258 | occure in the script.
|
|---|
| 259 |
|
|---|
| 260 | The Pure REXX Loader is enabled by default.
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 | 2.3.7 Java Loader/Invoker
|
|---|
| 264 | -------------------------
|
|---|
| 265 |
|
|---|
| 266 | Just for fun, I've added some code which detects JAVA class binaries and
|
|---|
| 267 | executes the class using JAVA.EXE. I first thougth this should be easy, but
|
|---|
| 268 | it turned out to have several problems.
|
|---|
| 269 | So please note the following:
|
|---|
| 270 | - The classname is case sensitive, you have to write the exact class
|
|---|
| 271 | name (with .class extention or what ever extention the file have)
|
|---|
| 272 | when trying to execute a class. This could cause some throuble making
|
|---|
| 273 | WPS program objects for the classes....
|
|---|
| 274 | - To support executing of .class-files which are not in the current
|
|---|
| 275 | directory win32k.sys send the directory of the .class-file in to
|
|---|
| 276 | java.exe as a '-classpath' option. This option I soon found out had the
|
|---|
| 277 | sideeffect of making JAVA.exe ignore the other CLASSPATH and not use
|
|---|
| 278 | it's default class path. So now the contents of the CLASSPATH env. var.
|
|---|
| 279 | or a generated default classpath is also sent in with the '-classpath'
|
|---|
| 280 | option.
|
|---|
| 281 | - The CLASSPATH environment variable should not be longer than 639 chars.
|
|---|
| 282 |
|
|---|
| 283 | When you have successfully installed Win32k.sys try type this at the
|
|---|
| 284 | commandline:
|
|---|
| 285 | c:\java11\demo\hello\hello.class
|
|---|
| 286 |
|
|---|
| 287 | This is then printed at my screen:
|
|---|
| 288 | Hello, Warped world!
|
|---|
| 289 |
|
|---|
| 290 | The JAVA Loader/Invoker is enabled by default.
|
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 | 2.3.8 Rings - Ring 0 / Ring 3
|
|---|
| 294 | -----------------------------
|
|---|
| 295 |
|
|---|
| 296 | FYI. Ring 0 is the most priveleged level of execution in OS/2. The OS/2 kernel
|
|---|
| 297 | and device drivers execute at this level, while user applications execute in
|
|---|
| 298 | Ring 3, the least priveleged executing level.
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 | 2.3.9 Win32k Control Center
|
|---|
| 302 | ---------------------------
|
|---|
| 303 |
|
|---|
| 304 | In your Odin32 System32 directory there is a program called Win32kCC.exe,
|
|---|
| 305 | this is the Win32k Control Center (Win32kCC). Win32kCC is as the name says
|
|---|
| 306 | a program controlling Win32k.sys.
|
|---|
| 307 |
|
|---|
| 308 | Win32kCC allows you to enable, disable and change behaviour of different
|
|---|
| 309 | parts in Win32k.sys.
|
|---|
| 310 |
|
|---|
| 311 | For example: You could disable PE loading, or change it from MIXED mode (see
|
|---|
| 312 | 2.3.4, -PE) to PE2LX mode. Or change it from PE2LX mode to PE mode to see
|
|---|
| 313 | if PE.EXE does a better job loading an executable.
|
|---|
| 314 |
|
|---|
| 315 | Note that the changes would not effect allready loaded executables.
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 | Win32kCC also displays status info on the running Win32k.sys and OS/2 kernel:
|
|---|
| 319 | -Win32k.sys version number
|
|---|
| 320 | -Win32k build time/date
|
|---|
| 321 | -Path of the symbol file which was used (or Win32k Symbol Database).
|
|---|
| 322 | -OS/2 kernel build number fixpack (guess)
|
|---|
| 323 | -OS/2 kernel type as win32k has detected it
|
|---|
| 324 | -Number of Pe2Lx currently loaded modules
|
|---|
| 325 | -Win32k resident and swappable heap stats.
|
|---|
| 326 |
|
|---|
| 327 | PS. Beside the "PE Loader" area there is an "Elf Loader" area this is for a
|
|---|
| 328 | future Elf2Lx loader.
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 | 2.4 The Ring3 conversion utility (Xx2Lx.exe)
|
|---|
| 333 | --------------------------------------------
|
|---|
| 334 |
|
|---|
| 335 | Xx2Lx.exe was the first method of running Win32 programs under
|
|---|
| 336 | OS/2. It is still provided and also functional but it has been
|
|---|
| 337 | deprecated. Using it is only sensible for debugging certain
|
|---|
| 338 | problems as it requires all DLLs and EXEs to be converted into
|
|---|
| 339 | another file format thus changing the original Win32 files.
|
|---|
| 340 | (It's only future use will be to convert Win32 executable with
|
|---|
| 341 | debuginfo to LX with HLL (IPMD/ICSDEBUG) debuginfo for
|
|---|
| 342 | sourcelevel debugging of Win32 executables under Odin32. This
|
|---|
| 343 | is not yet implemented but is being worked on.)
|
|---|
| 344 |
|
|---|
| 345 | Note. The name changed from Pe2Lx to Xx2Lx. It is in prepare for Elf2Lx.
|
|---|
| 346 |
|
|---|