Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.misc > #1718

Re: win32 via odin

Newsgroups comp.os.os2.programmer.misc
Date 2023-07-15 23:17 -0700
References (2 earlier) <83234834-db2d-42ac-8bc6-0fcf631f53b9n@googlegroups.com> <7ee4e13c-63ae-4c02-a17d-b183c5045e92n@googlegroups.com> <e48bb3c4-e0c0-409f-b13b-c172afb74b47n@googlegroups.com> <fc31cff0-19f8-4a52-a14b-976c91b3387an@googlegroups.com> <79c75676-6bce-4df4-83fd-50327e0d81a8n@googlegroups.com>
Message-ID <543e1a11-17f0-4344-9a8b-8a53e8eb3d12n@googlegroups.com> (permalink)
Subject Re: win32 via odin
From Paul Edwards <mutazilah@gmail.com>

Show all headers | View raw


On Sunday, July 16, 2023 at 11:43:58 AM UTC+8, xhajt03 wrote:

> I'm pretty sure the docs must be elsewhere as well and not only scans. Try searching for "OS/2 Control Program Reference". 

Although a google search didn't find it, I eventually found it here:

http://www.edm2.com/
(auto-redirects to:)
http://www.edm2.com/index.php/Main_Page
(click on "List of OS/2 Documentation")
http://www.edm2.com/index.php/List_of_OS/2_Documentation
(click on "IBM Publications")
http://www.edm2.com/index.php/IBM_Publications
(under "BM OS/2 Toolkit Information (IBM External Submission #24167)"
click on "Control Program Programming Guide and Reference")
http://www.edm2.com/index.php/Control_Program_Programming_Guide_and_Reference
(and then click on things on the right)

> Have you made sure to set the application type to "VIO" (or "VIO compatible",
> or whatever it's named there - not PM and not FS)

commands valid for the OS/2 and DOS/4G Systems executable formats only:

form      ::= "OS2" ["FLat"|"LE"|"LX"] ["PHYSdevice" | "VIRTdevice"
            | ["DLl"["INITGlobal"|"INITInstance" ["TERMInstance"|"TERMGlobal"]]
            | "PM" | "PMCompatible" | "FULLscreen"]


"fullscreen" opens a full screen when I tried, so that's not
the default. I tried "PMC" and that had no effect from the
original. I didn't see any VIO mentioned.

C:\devel\pdos\pdpclib>wlink /? | grep -i vio

C:\devel\pdos\pdpclib>

> but simple console programs are not supposed to do that.

This is not necessarily simple though. It's intended to be part
of my C runtime library (pdpclib) for OS/2 so that any app that
links with it can do a setvbuf NBF and it automatically switches
off echo and returns keystrokes, which is exactly what is needed
for fullscreen apps like the microemacs editor. At the same time
I wish to present those apps with ANSI escapes, e.g. ESC [ A, for
cursor keys, the same way as ANSI escapes are already being
handled automatically for output.

Basically the C library hides any "deficiencies" in the OS.

Another thing I noticed was this:

http://www.edm2.com/index.php/OS/2_Device_Driver_Frequently_Asked_Questions

How can I query the OS/2 language version at initialisation time
Question: I want my driver query the language version of the system so I can output messages in the correct language.

Answer: There are several ways to do this:

Open the keyboard driver (DosOpen ("KBD$", ...)) and pass in an IOCtl request to query the current codepage.



And here too:

http://www.edm2.com/index.php/CPGuide_-_Device_I/O#Accessing_Devices

Device Names
To open a device using DosOpen, the application must supply the reserved name for that device. For example, to open the console (both keyboard and screen), you must specify the name CON.

(it clearly says that applications can do this)

and a little further down it says:

(Applications can communicate with device drivers also, by using DosDevIOCtl. See IOCtl Interface)


Regardless, I tried to do a DosOpen of both KBD$ and CON,
but in both cases - even though that was successful - the
DosDevIOCtl failed with rc 22 still.

Here is the code I used:

#ifdef __OS2__
    APIRET rc;
    ULONG tempRead;
    USHORT parm = 1;
    ULONG parmlen = sizeof parm;
    KBDKEYINFO cd;
    ULONG datalen = 0;

    ULONG  action;
    ULONG  newsize = 0;
    ULONG  fileAttr = 0;
    ULONG  openAction = FILE_OPEN;
    ULONG  openMode = 0;

#endif

#ifdef __OS2__
printf("about to open\n");
openMode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
        /* openAction |= OPEN_ACTION_OPEN_IF_EXISTS; */
        /* tried KBD$ and CON */
    rc = DosOpen((PSZ)"CON",
                 &stream->hfile,
                 &action,
                 newsize,
                 fileAttr,
                 openAction,
                 openMode,
                 NULL);
    printf("rc is %d\n", rc);
printf("about to ioctl\n");
/* was Dos, try VDH */
    rc = DosDevIOCtl(stream->hfile, /* handle */
                     4, /* category */
                     0x74, /* function */
                     &parm, /* parm area */
                     sizeof parm,
                     &parmlen, /* potentially output */
                     &cd, /* data area */
                     sizeof cd, /* maximum size */
                     &datalen); /* potentially output */
    printf("rc is %d\n", rc);
printf("about to do dosread of %d\n", (int)stream->hfile);
    rc = DosRead(stream->hfile, ptr, toread, &tempRead);
    printf("rc is %d\n", rc);


There is one more thing I found before resorting to 16-bit calls:


http://www.edm2.com/index.php/Input/Output_Device_Driver_Reference/Keyboard_Device_Driver

Keystroke Monitors
Some applications need to view the raw keystrokes as they arrive from the keyboard at interrupt time. These applications might consume, modify, or replace keystrokes. This is made possible by the keystroke monitor function.

An application operating with the OS/2 system cannot register a keyboard monitor for a Presentation Manager session. When DosMonReg is issued with keyboard devices, the INDEX parameter indicates which OS/2 session, requested by the caller, is to register the monitor. The INDEX parameter indicates an OS/2 session from 0-15. (For more information on DevHlp_ DosGetInfoSeg, refer to the OS/2 Physical Device Driver Reference.)

An INDEX parameter value of -1 indicates that the session of the calling thread is being requested. If the caller requests either the Presentation Manager session or a DOS session, a MONITORS_NOT_SUPPORTED error is returned. 


I will try that next I guess.

BFN. Paul.

Back to comp.os.os2.programmer.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-13 13:46 -0700
  Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-13 20:30 -0700
    Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-14 22:02 -0700
      Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-15 15:34 -0700
        Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 16:05 -0700
          Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 17:56 -0700
            Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 18:29 -0700
            Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-15 20:43 -0700
              Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 23:17 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 23:47 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 02:20 -0700
                Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-16 03:58 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 09:03 -0700
                Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-16 14:51 -0700
              Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 10:35 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 14:16 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 16:24 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 20:10 +0800
            Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 20:30 -0700
          Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 20:44 -0700
            Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 21:11 -0700
              Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 23:04 -0700
                Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 23:11 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:07 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:13 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:48 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 16:50 -0700

csiph-web