[comp.windows.misc] An MS Windows Question.

mguyott@mirror.TMC.COM (Marc Guyott) (09/28/88)

Questions, Questions, Questions, but first some background!

I am going to be doing some development work where I will be writing
the low level support for a network data server that will be running under
MS Windows 2.1 and will interface with a Novell Advanced Netware network.

I know of at least one piece of software that has been written to run under
Windows and that uses a Novell network (Automated Design Systems Inc.
is selling "Windows Intercom", a chat utility that allows Windows users to
exchange instantaneous messages with other LAN users while running
applications).

In order for a network application to wait for a message it calls LISTEN FOR
SEQUENCED PACKET (SPX protocol) and passes Netware the appropriate buffers
as well as a pointer to an Event Service Routine (ESR).  An ESR is a from of
interrupt service routine and it is called with INTERRUPTS DISABLED.

I currently have several questions that I have not been able to get
satisfactory answers to (I have looked in Petzold's book and in the Windows
documentation).  Does anyone know the answers to any of these questions?


1. Can an ESR post a message to the applications window queue while INTERRUPTS
   ARE DISABLED?  Since the ESR is part of the application, it will have access
   to the handle for the window.

2. Is there a way to look for a particular type of message in an applications
   window queue from within the application itself (not from within an ESR)?
   Specifically, what are the wMsgFilterMin and wMsgFilterMax parameters for
   in the PeekMessage call?  Do they specify an ordinal range, i.e. only give
   me messages starting with the 10th message and up to the 20th message, or
   do they specify the message type, i.e. give me the first messages of type
   WM_KEYDOWN (if wMsgFilterMin = wMsgFilterMax = WM_KEYDOWN)?

3. The DS register must be initialized by an ESR before any references are
   made to application variables.  Novell recommends setting DS in the
   following manner:

      public MyESR
      MyESR proc far
          mov  ax, DGroup
          mov  ds, ax
          call CFunction
          ret
      MyESR endp

   My question is will this work under Windows?  If the data segment is
   movable then I do not believe that this will work and I have serious
   doubts that this will work even if the data segment is fixed.  When is
   the symbol DGroup assigned a value?  At link time?  At load time?  Does
   Windows update the value of this symbol if the data segment is moved?

4. I thought of an alternative to the above which may work but I see one
   weak spot in it.  If I take a pointer to the 'C' portion of the ESR (which
   has been exported in the .def file) and create a code thunk for this
   routine (via MakeProcInstance) and then invoke the assembly code shown
   below which calls the code thunk, I should get the results that I desire
   (that is the DS register will be set to the appropriate value).

      public MyESR
      MyESR proc far
          push ss
          push sp
          call CCodeForESR
          pop  sp
          pop  ss
          ret
      MyESR endp

   The only problem is how do I get the appropriate value to call
   (CCodeForESR) - if this is a code thunk then the address is in a variable
   but I can not get to variables until I set the DS register and the DS
   register will not be set until I call the code thunk...

  Comments, questions, etc., are all welcome.
                                               Marc
----
       ... I never saw the morning until I stayed up all night ...
                               Tom Waits

Marc Guyott                                         mguyott@mirror.TMC.COM
{mit-eddie, pyramid, harvard!wjh12, xait, datacube}!mirror!mguyott
Mirror Systems	Cambridge, MA  02140                617/661-0777