| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Script to modify kernel |
You may have followed the threads about the priority of PM drawing
operations, and you may have seen my message describing the poking of
the OS/2 kernel. I had no hex editors on my disk because of my hard
disk crash, and not a single C or Pascal compiler to make a program to
modify the kernel, so I wrote one in REXX.
It turns out that in addition to its text processing capabilities,
REXX is quite capable of handling binary data as well.
So, if you feel like poking the kernel priority table, here is this
REXX script to ease your job.
It is written in OREXX, so if you use plain REXX - sorry... I'm
learning OREXX right now, so I wrote it in OREXX. But it can very
easily be changed to plain REXX, if you don't feel like changing your
interpretter.
Don't forget to change the first two variables to suit your system!
Also, remove the ReadOnly, System and Hidden attributes from your
OS2KRNL file.
Here goes:
=================================================================
/* Editor za tabelata na prioriteti vo OS/2 kernelot */
KernelName = "C:\OS2KRNL"
Editor = "fte" /* For editing the textual representation of the table */
TableSig = "0300 0100 0200 0800 0300 0100 0200 0800"
Tail.0 = 16
Tail.1 = "----"
Tail.2 = "---S"
Tail.3 = "--D-"
Tail.4 = "--DS"
Tail.5 = "-F--"
Tail.6 = "-F-S"
Tail.7 = "-FD-"
Tail.8 = "-FDS"
Tail.9 = "W---"
Tail.10 = "W--S"
Tail.11 = "W-D-"
Tail.12 = "W-DS"
Tail.13 = "WF--"
Tail.14 = "WF-S"
Tail.15 = "WFD-"
Tail.16 = "WFDS"
say
say " !!!!! WARNING !!!!!"
say
say "This program is about to modify your OS/2 kernel file
("KernelName")!"
say "Make sure you have a backup copy of it, this program DOESN'T make a
backup!"
say "Press Ctrl-C to exit now, or ENTER to continue..."
call Beep 1000, 250
.Input
Kernel = .Stream~New(KernelName)
if Kernel~Query("Exists") == "" then do
say "Fajlot" KernelName "ne postoi"
return
end
if Kernel~Open("Binary") "READY:" then do
say "Ne mozam da go otvoram fajlot" KernelName
return
end
KernelData = Kernel~CharIn( , Kernel~Query("Size"))
TableOfs = KernelData~Pos(ConvertEndian(TableSig~X2C))
if TableOfs == 0 then do
say "Cannot find priority table in kernel file."
say "Did you unpack the kernel with LXLite?"
exit 1
end
TempName = "PriTab.tmp"
call ToText TempName, TableOfs
Editor TempName
call FromText TempName, TableOfs
Kernel~Seek(1 "Write")
Kernel~CharOut(KernelData)
Kernel~Close()
return 0
ConvertEndian: procedure
parse arg s
s = s~Space(0)
if s~Length // 2 0 then do
say "Invalid HexString"
exit 1
end
do i = 1 to s~Length by 2
s = s~Overlay(s~SubStr(i, 2)~Reverse, i)
end
return s
ToText: procedure expose KernelData Tail.
parse arg TempName, TableOfs
Temp = .Stream~New(TempName)
if Temp~Open("Write Replace") "READY:" then do
say "Ne mozam da go otvoram fajlot" TempName
exit 1
end
do n = 1 to 16
Linija = ConvertEndian(KernelData~SubStr(TableOfs, 16))~C2X
pom = ""
do i = 1 to Linija~Length by 4
pom = pom||Linija~SubStr(i, 4)||" "
end
Temp~LineOut(pom||Tail.n)
TableOfs = TableOfs + 16
end
Temp~LineOut("----------------------------------------------------------")
Temp~LineOut("Server Idle Regular TC | Server Idle
Regular TC")
Temp~LineOut("Not Keyboard (04) | Keyboard (04)")
Temp~LineOut("")
Temp~LineOut("Starved 08")
Temp~LineOut("Device I/O 10")
Temp~LineOut("Foreground 20")
Temp~LineOut("Window 40")
Temp~LineOut("VDM Interrupt 80")
Temp~Lineout("")
Temp~LineOut("Note: Use OVERTYPE mode for best editing")
Temp~Close
return 0
FromText: procedure expose KernelData
parse arg TempName, TableOfs
Temp = .Stream~New(TempName)
if Temp~Open("Read") "READY:" then do
say "Ne mozam da go otvoram fajlot" TempName
exit 1
end
do 16
Linija = Temp
Linija = ConvertEndian(Linija~Space(0)~SubStr(1,32)~X2C)
KernelData = KernelData~Overlay(Linija, TableOfs)
TableOfs = TableOfs + 16
end
Temp~Close
return 0
==================================================================
- Ivan -
.!. Word is a shadow of deed. Democritus (400 BC)
--- Terminate 5.00/Pro [OS/2]
þ TerMail/QWK þ
* Origin: GET ALL YOUR FIDO HERE! telnet://bbs.docsplace.org (1:3603/140)SEEN-BY: 396/1 632/0 371 633/260 267 270 371 635/444 506 728 639/252 670/218 @PATH: 3603/140 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.