home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <dos.h>
- #include <conio.h>
-
-
-
- typedef unsigned int BOOL;
- typedef unsigned int WORD;
- typedef unsigned long DWORD;
- #define FAR _far
-
-
- void MessageBox(unsigned long vxd_api, char FAR *pname,
- char *argname, int show_num, BOOL validate);
-
-
- /*
-
- This works fine with Borland C, version 3.1 compiled with small model.
-
- It should work ok with other memory models
- */
-
-
-
- char badexec_msg[] = { "\nTSTWINEX: failed to load windows application\n" };
-
- unsigned long GetEDOSVxDAPI(void);
-
- main( int argc, char **argv)
- {
- unsigned long vxd_api;
- unsigned int len;
-
- char Msg_line[128];
-
-
-
- vxd_api = GetEDOSVxDAPI(); // returns a seg:offset, pointer in a long
- if(!vxd_api) goto noesdi;
-
-
- fputs("\nEnter message string: ", stdout);
- fgets(Msg_line, sizeof(Msg_line)-1, stdin); // delete trailing \r
- len = strlen(Msg_line);
- if(len)
- Msg_line[len-1] = 0;
-
- MessageBox(vxd_api, Msg_line, "", 0, 0);
-
- goto ok;
- noesdi:
- fputs("TESTPRI error: Can't run without EDOS & Windows\n", stdout);
- return 1;
- ok:
-
- return 0;
- }
-
- unsigned long GetEDOSVxDAPI(void)
- {
-
- #define EDOS_ID 0x2925
-
- unsigned long vxd_api;
- _asm {
-
- push es
- mov di,0 // make sure es,di are set to zero
- mov es,di
- mov ax,0x1684 // the int 2f call number
-
- mov bx,EDOS_ID // edos VxD ID number
-
- int 0x2f
- mov word ptr [vxd_api+2],es // segment of v86 entry point in edos
- mov word ptr [vxd_api],di // offset of entry point
- mov ax,es
- or ax,di
- pop es
- mov al,10
- jz noesdi
- }
- return vxd_api;
-
- noesdi:
- return 0L;
-
- }
-
-
-
-
- void MessageBox(
- unsigned long vxd_api, // the entry point of the edos v86 api
- char FAR *msgline, // the message, FAR Pointer, maxlen=128
- char *dummy1,
- int dummy2,
- BOOL validate // do extra validation, not implemented yet
- )
-
- {
-
-
- _asm {
-
- mov cx,0 //; cx should be zero
-
- push es
- les bx, msgline // es:bx = seg:offset of message
- mov ax,es
- pop es
- mov dx,ax //; dx = segment of message to use
- mov ax,1 // ; message box function call
- call vxd_api
-
- }
-
- }
-