INFO NEEDED: DLLs and DOS Protected Mode

INFO NEEDED: DLLs and DOS Protected Mode

Post by Edward Yeu » Wed, 16 Feb 1994 01:00:28

I need some information on how to call a Windows DLL in DOS protected mode environment.
I read the article on the DOS Extender in Borland Pascal 7.0. But I need something
that's for C. Someone remember seeing something like this a year ago in either
Dr. Dobb or Microsoft System Journal, but don't know for sure which issue.
Any help will be appreciated.

Edward Yeung, Gradient Technology, Marlboro MA


1. Convert DOS addres to WINDOWS protected mode address

Hi programmers.

 I'm trying to convert DOS address to WINDOWS address in protected mode.
I got the following routine and it should do the job, but while running it
yells for error (in the line marked in arrow). The routine was originaly
written for MS/C, and I'm trying to make it work under BC++ 3.0.

1. Can anybody help me to make this routine work under BC++ 3.0 ?
2. If not, dose anybody know how to convert DOS addres (segment+offset) to
   WINDOWS protected mode addres ?
3. Could someone point me to some documentation on SetSelectorBase() and
   SetSelectorLimit() functions ?



The routine in question:
HANDLE PASCAL AllocateSelector(unsigned segment, unsigned offset, DWORD length)
    DWORD physicalAddress, linearAddress;       /* This function allocs & maps */
    HANDLE selector;                            /* a protected mode selector */
    struct SREGS sregs;                         /* for a real mode address */

    segread(&sregs);                            /* Copy DS selector */

    if ((selector = AllocSelector(sregs.ds)))   /* Successful Allocate? */
    {                                           /* Phys = Lin In 1st Megabyte */
        linearAddress = physicalAddress = ((DWORD) segment << 4L) + offset;
--->    SetSelectorBase(selector, linearAddress);  /* Set New Base Address */
        SetSelectorLimit(selector, length);     /* Set New Segment Range */
| Oded Malky - Computer Engineering                    phone: 972-4-230158  |

| Address: Zalman Shneor 36 ap. 23, Haifa 32545 ISRAEL                      |

2. External Modem for Win2K Pro?

3. Protect mode DOS under Windows

4. Wordup Graphics Toolkit Documentation now on-line!

5. Floating point processor under Windows 3.1 vs. DOS protected mode

6. Shared Borders, Margins

7. Access DOS Abs addresses in 32bit protected mode win app

8. PDF and Powerpoint

9. Protected mode in DOS?

10. Dos Protected mode crashing NTVDM in NT4

11. DPMI: Dos Protected Mode

12. Question about Protected mode / Real mode

13. Protected mode address -> Real mode address. HOW ?