source: trunk/src/win32k/win32k.txt@ 10366

Last change on this file since 10366 was 5540, checked in by bird, 25 years ago

Pe2Lx.exe -> Xx2Lx.exe.

File size: 12.5 KB
Line 
12.3 Win32k.sys - native OS/2 PE-loader
2--------------------------------------
3
4The win32k.sys driver makes PE (Win32) executables equal to native OS/2
5executables by implementing a Ring 0 on-the-fly loader / converter.
6
7You may wonder how you may run a Win32 program using a device driver. You
8don't have to worry about that, simply treat the Win32 program just as an
9another OS/2 program. OS/2 can't tell the difference!
10No conversion of dlls or running programs thru Pe.EXE.
11
12For 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
222.3.1 WARNING
23-------------
24
25The Win32k.sys is quite alpha software and any bugs which haven't been found
26yet may crash and/or corrupt you entire system! Make sure you have backed up
27important stuff first!
28
29We are not responsible for ANYTHING AT ALL! See Odin32 disclaimer...
30
31Before you install Win32k.sys make sure that you have a backdoor to your system
32which works. For example try to boot your system using the Alt+F1 during bootup
33and choose Commandline boot (F2). Make sure you have an textmode editor which
34works; for example TEDIT.EXE.
35
36
372.3.2 Requirements
38------------------
39
40Win32k should at least work on OS/2 Warp 3 and above, but I don't get too
41surprised if it worked on 2.11 too. DBCS are not supported yet AFAIK.
42
43It no longer requires a kernel file for retail kernels (if you don't know what
44kernel 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
50If the running kernel is not found in the "database" or is a debug kernel
51wink32.sys will look for symbolfiles as it allways did.
52If you use the -s:<symfile> argument the given symbol file will be
53investigated before the database is searched.
54
55NOTE! It hasn't been fully verified that all the different national fixpaks
56have the same symbols as the us-english ones. Feedback on this issue is
57appreciated.
58
59NOTE! A piece of advice for those playing with debug-kernels: Make sure that
60c:\OS2KRNL.SYM is matching the running kernel.
61
622.3.2.1 Warp 3
63--------------
64
65Win32k is not tested with Warp 3. It is _supposed_ to work with Warp 3
66provided you are running fixpack 32 or later.
67(Fixpack 32 + y2kclock.exe is required for Y2K readyness anyway so...)
68
69
702.3.3 Installation
71------------------
72
73To use Win32k.sys you have to add the following line into your config.sys:
74 device=<d:\path\system32>win32k.sys
75
76Where <d:\path\system32> is the path to the win32k.sys, i.e. usually the odin32
77system32 directory.
78
79After doing this, you'll have to reboot your machine to load the driver. During
80the boot process you will on a successful installation see some lines of
81technical info and finally a line saying:
82Win32k - Odin32 support driver.
83 Build: 14046 - v20.45
84 Found symbolfile: Win32k Symbol Database
85Win32k.sys succesfully initiated!
86
87If you don't see the last line something is wrong, and some error info will be
88shown. In the case of error the 'rc=<value>' is important to remember.
89
90
912.3.4 Win32k parameters
92-----------------------
93
94The Capitalized letters are the one which is tested for when identifying the
95argument.
96
97There 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
109Loader 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
129Logging parameters:
130-L<:E|:D> Enables/Disables logging.
131 Default: disabled.
132
133-Com:<1|2|3|4>
134or
135-C<1|2|3|4> Which com-port to log to.
136 Default: -C2
137
138-Warning:<1|2|3|4>
139or
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
145Heap 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
159OS/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
178Obsolete:
179-K:<filename> Ignored. Win32k scans the kernel image in memory!
180
181
1822.3.5 PE Loading
183----------------
184
185Win32k.sys are able to do PE loading in two different ways.
186
1872.3.5.1 PE2LX
188-------------
189The first one is called PE2LX and hence uses the original Win32k.sys method
190which is similar to Pe2Lx. This only requires that KERNEL32.DLL (ie. Odin32
191System32 directory) is present somewhere in the PATH or LIBPATHs. The DLL
192search 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
203search order. This shouldn't matter much as nearly all of the OS/2 DLL are
204allready loaded. But if this proves a problem it could be changed.)
205
2062.3.5.2 PE
207----------
208The second one is called PE and invokes the Pe.EXE to execute the PE (Win32)
209programs. This of course requies that PE.EXE is found in the PATH.
210
2112.3.5.3 Modes
212--------------
213Win32k.sys have three (or four) different ways of combining these two methods,
214called modes:
215 PE2LX only
216 PE only
217 PE2LX with fallback on PE.
218 (fourth: NOT load any PE executables at all)
219
220The last one is the default one and is probably the best one currently.
221
222
2232.3.6 UNIX Shell Script Loader
224------------------------------
225
226The UNIX Shell Script Loader makes OS/2 able to run UNIX shell scripts as
227native executables, just as UNIX does. A unix shell script is a text file
228which has a starting line which specifies the interpreter for the script.
229
230For example a perl script:
231#!/bin/perl5 -Sx
232
233Or the most common one:
234#! /bin/sh
235
236Since Most OS/2 systems don't have a /bin directory or a /usr/bin directory
237the 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
243So, you could now execute UNIX shell script in OS/2 without even modify the
244path of the interpreter!
245
246The UNIX Shell Script Loader is enabled by default.
247
248
2492.3.6 Pure REXX Loader
250----------------------
251
252The Pure REXX Loader is a win32k.sys feature which enables REXX script with
253the extentions .RX and .REX to run as native OS/2 executables. These REXX
254scripts are executed using kRX.EXE which is found in the Odin32 System32
255directory.
256
257When we say "Pure REXX" scripts, that means no use of command line should
258occure in the script.
259
260The Pure REXX Loader is enabled by default.
261
262
2632.3.7 Java Loader/Invoker
264-------------------------
265
266Just for fun, I've added some code which detects JAVA class binaries and
267executes the class using JAVA.EXE. I first thougth this should be easy, but
268it turned out to have several problems.
269So 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
283When you have successfully installed Win32k.sys try type this at the
284commandline:
285c:\java11\demo\hello\hello.class
286
287This is then printed at my screen:
288Hello, Warped world!
289
290The JAVA Loader/Invoker is enabled by default.
291
292
2932.3.8 Rings - Ring 0 / Ring 3
294-----------------------------
295
296FYI. Ring 0 is the most priveleged level of execution in OS/2. The OS/2 kernel
297and device drivers execute at this level, while user applications execute in
298Ring 3, the least priveleged executing level.
299
300
3012.3.9 Win32k Control Center
302---------------------------
303
304In your Odin32 System32 directory there is a program called Win32kCC.exe,
305this is the Win32k Control Center (Win32kCC). Win32kCC is as the name says
306a program controlling Win32k.sys.
307
308Win32kCC allows you to enable, disable and change behaviour of different
309parts in Win32k.sys.
310
311For example: You could disable PE loading, or change it from MIXED mode (see
3122.3.4, -PE) to PE2LX mode. Or change it from PE2LX mode to PE mode to see
313if PE.EXE does a better job loading an executable.
314
315Note that the changes would not effect allready loaded executables.
316
317
318Win32kCC 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
327PS. Beside the "PE Loader" area there is an "Elf Loader" area this is for a
328future Elf2Lx loader.
329
330
331
3322.4 The Ring3 conversion utility (Xx2Lx.exe)
333--------------------------------------------
334
335Xx2Lx.exe was the first method of running Win32 programs under
336OS/2. It is still provided and also functional but it has been
337deprecated. Using it is only sensible for debugging certain
338problems as it requires all DLLs and EXEs to be converted into
339another file format thus changing the original Win32 files.
340(It's only future use will be to convert Win32 executable with
341debuginfo to LX with HLL (IPMD/ICSDEBUG) debuginfo for
342sourcelevel debugging of Win32 executables under Odin32. This
343is not yet implemented but is being worked on.)
344
345Note. The name changed from Pe2Lx to Xx2Lx. It is in prepare for Elf2Lx.
346
Note: See TracBrowser for help on using the repository browser.