Fix EXEC function 01 (load but don't execute): initial ax has to be on
[wine/hacks.git] / dlls / winedos / module.c
blobc297c53584bb723d813ccf44852ea9f40c4fa436
1 /*
2 * DOS (MZ) loader
4 * Copyright 1998 Ove Kåven
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Note: This code hasn't been completely cleaned up yet.
23 #include "config.h"
24 #include "wine/port.h"
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <fcntl.h>
31 #include <signal.h>
32 #ifdef HAVE_UNISTD_H
33 # include <unistd.h>
34 #endif
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #ifdef HAVE_SYS_TIME_H
38 # include <sys/time.h>
39 #endif
40 #include "windef.h"
41 #include "winbase.h"
42 #include "wine/winbase16.h"
43 #include "wingdi.h"
44 #include "winuser.h"
45 #include "winerror.h"
46 #include "wine/debug.h"
47 #include "dosexe.h"
48 #include "dosvm.h"
49 #include "vga.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(module);
53 static BOOL DOSVM_isdosexe;
55 /**********************************************************************
56 * DOSVM_IsWin16
58 * Return TRUE if we are in Windows process.
60 BOOL DOSVM_IsWin16(void)
62 return DOSVM_isdosexe ? FALSE : TRUE;
65 #ifdef MZ_SUPPORTED
67 #ifdef HAVE_SYS_MMAN_H
68 # include <sys/mman.h>
69 #endif
71 /* define this to try mapping through /proc/pid/mem instead of a temp file,
72 but Linus doesn't like mmapping /proc/pid/mem, so it doesn't work for me */
73 #undef MZ_MAPSELF
75 #define BIOS_DATA_SEGMENT 0x40
76 #define PSP_SIZE 0x10
78 #define SEG16(ptr,seg) ((LPVOID)((BYTE*)ptr+((DWORD)(seg)<<4)))
79 #define SEGPTR16(ptr,segptr) ((LPVOID)((BYTE*)ptr+((DWORD)SELECTOROF(segptr)<<4)+OFFSETOF(segptr)))
81 /* structures for EXEC */
83 #include "pshpack1.h"
85 typedef struct {
86 WORD env_seg;
87 DWORD cmdline;
88 DWORD fcb1;
89 DWORD fcb2;
90 WORD init_sp;
91 WORD init_ss;
92 WORD init_ip;
93 WORD init_cs;
94 } ExecBlock;
96 typedef struct {
97 WORD load_seg;
98 WORD rel_seg;
99 } OverlayBlock;
101 #include "poppack.h"
103 /* global variables */
105 pid_t dosvm_pid;
107 static WORD init_cs,init_ip,init_ss,init_sp;
108 static HANDLE dosvm_thread, loop_thread;
109 static DWORD dosvm_tid, loop_tid;
111 static void MZ_Launch( LPCSTR cmdtail, int length );
112 static BOOL MZ_InitTask(void);
114 static void MZ_CreatePSP( LPVOID lpPSP, WORD env, WORD par )
116 PDB16*psp=lpPSP;
118 psp->int20=0x20CD; /* int 20 */
119 /* some programs use this to calculate how much memory they need */
120 psp->nextParagraph=0x9FFF; /* FIXME: use a real value */
121 /* FIXME: dispatcher */
122 psp->savedint22 = DOSVM_GetRMHandler(0x22);
123 psp->savedint23 = DOSVM_GetRMHandler(0x23);
124 psp->savedint24 = DOSVM_GetRMHandler(0x24);
125 psp->parentPSP=par;
126 psp->environment=env;
127 /* FIXME: more PSP stuff */
130 static void MZ_FillPSP( LPVOID lpPSP, LPCSTR cmdtail, int length )
132 PDB16 *psp = lpPSP;
134 if(length > 127)
136 WARN( "Command tail truncated! (length %d)\n", length );
137 length = 126;
140 psp->cmdLine[0] = length;
143 * Length of exactly 127 bytes means that full command line is
144 * stored in environment variable CMDLINE and PSP contains
145 * command tail truncated to 126 bytes.
147 if(length == 127)
148 length = 126;
150 if(length > 0)
151 memmove(psp->cmdLine+1, cmdtail, length);
153 psp->cmdLine[length+1] = '\r';
155 /* FIXME: more PSP stuff */
158 static WORD MZ_InitEnvironment( LPCSTR env, LPCSTR name )
160 unsigned sz=0;
161 WORD seg;
162 LPSTR envblk;
164 if (env) {
165 /* get size of environment block */
166 while (env[sz++]) sz+=strlen(env+sz)+1;
167 } else sz++;
168 /* allocate it */
169 envblk=DOSMEM_GetBlock(sz+sizeof(WORD)+strlen(name)+1,&seg);
170 /* fill it */
171 if (env) {
172 memcpy(envblk,env,sz);
173 } else envblk[0]=0;
174 /* DOS 3.x: the block contains 1 additional string */
175 *(WORD*)(envblk+sz)=1;
176 /* being the program name itself */
177 strcpy(envblk+sz+sizeof(WORD),name);
178 return seg;
181 static BOOL MZ_InitMemory(void)
183 /* initialize the memory */
184 TRACE("Initializing DOS memory structures\n");
185 DOSMEM_Init(TRUE);
186 DOSDEV_InstallDOSDevices();
188 return TRUE;
191 static BOOL MZ_DoLoadImage( HANDLE hFile, LPCSTR filename, OverlayBlock *oblk )
193 IMAGE_DOS_HEADER mz_header;
194 DWORD image_start,image_size,min_size,max_size,avail;
195 BYTE*psp_start,*load_start,*oldenv;
196 int x, old_com=0, alloc;
197 SEGPTR reloc;
198 WORD env_seg, load_seg, rel_seg, oldpsp_seg;
199 DWORD len;
201 if (DOSVM_psp) {
202 /* DOS process already running, inherit from it */
203 PDB16* par_psp = (PDB16*)((DWORD)DOSVM_psp << 4);
204 alloc=0;
205 oldenv = (LPBYTE)((DWORD)par_psp->environment << 4);
206 oldpsp_seg = DOSVM_psp;
207 } else {
208 /* allocate new DOS process, inheriting from Wine environment */
209 alloc=1;
210 oldenv = GetEnvironmentStringsA();
211 oldpsp_seg = 0;
214 SetFilePointer(hFile,0,NULL,FILE_BEGIN);
215 if ( !ReadFile(hFile,&mz_header,sizeof(mz_header),&len,NULL)
216 || len != sizeof(mz_header)
217 || mz_header.e_magic != IMAGE_DOS_SIGNATURE) {
218 char *p = strrchr( filename, '.' );
219 if (!p || strcasecmp( p, ".com" )) /* check for .COM extension */
221 SetLastError(ERROR_BAD_FORMAT);
222 goto load_error;
224 old_com=1; /* assume .COM file */
225 image_start=0;
226 image_size=GetFileSize(hFile,NULL);
227 min_size=0x10000; max_size=0x100000;
228 mz_header.e_crlc=0;
229 mz_header.e_ss=0; mz_header.e_sp=0xFFFE;
230 mz_header.e_cs=0; mz_header.e_ip=0x100;
231 } else {
232 /* calculate load size */
233 image_start=mz_header.e_cparhdr<<4;
234 image_size=mz_header.e_cp<<9; /* pages are 512 bytes */
235 /* From Ralf Brown Interrupt List: If the word at offset 02h is 4, it should
236 * be treated as 00h, since pre-1.10 versions of the MS linker set it that
237 * way. */
238 if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp;
239 image_size-=image_start;
240 min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4);
241 max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4);
244 if (alloc) MZ_InitMemory();
246 if (oblk) {
247 /* load overlay into preallocated memory */
248 load_seg=oblk->load_seg;
249 rel_seg=oblk->rel_seg;
250 load_start=(LPBYTE)((DWORD)load_seg<<4);
251 } else {
252 /* allocate environment block */
253 env_seg=MZ_InitEnvironment(oldenv, filename);
255 /* allocate memory for the executable */
256 TRACE("Allocating DOS memory (min=%ld, max=%ld)\n",min_size,max_size);
257 avail=DOSMEM_Available();
258 if (avail<min_size) {
259 ERR("insufficient DOS memory\n");
260 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
261 goto load_error;
263 if (avail>max_size) avail=max_size;
264 psp_start=DOSMEM_GetBlock(avail,&DOSVM_psp);
265 if (!psp_start) {
266 ERR("error allocating DOS memory\n");
267 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
268 goto load_error;
270 load_seg=DOSVM_psp+(old_com?0:PSP_SIZE);
271 rel_seg=load_seg;
272 load_start=psp_start+(PSP_SIZE<<4);
273 MZ_CreatePSP(psp_start, env_seg, oldpsp_seg);
276 /* load executable image */
277 TRACE("loading DOS %s image, %08lx bytes\n",old_com?"COM":"EXE",image_size);
278 SetFilePointer(hFile,image_start,NULL,FILE_BEGIN);
279 if (!ReadFile(hFile,load_start,image_size,&len,NULL) || len != image_size) {
280 /* check if this is due to the workaround for the pre-1.10 MS linker and we
281 realy had only 4 bytes on the last page */
282 if (mz_header.e_cblp != 4 || image_size - len != 512 - 4) {
283 SetLastError(ERROR_BAD_FORMAT);
284 goto load_error;
288 if (mz_header.e_crlc) {
289 /* load relocation table */
290 TRACE("loading DOS EXE relocation table, %d entries\n",mz_header.e_crlc);
291 /* FIXME: is this too slow without read buffering? */
292 SetFilePointer(hFile,mz_header.e_lfarlc,NULL,FILE_BEGIN);
293 for (x=0; x<mz_header.e_crlc; x++) {
294 if (!ReadFile(hFile,&reloc,sizeof(reloc),&len,NULL) || len != sizeof(reloc)) {
295 SetLastError(ERROR_BAD_FORMAT);
296 goto load_error;
298 *(WORD*)SEGPTR16(load_start,reloc)+=rel_seg;
302 if (!oblk) {
303 init_cs = load_seg+mz_header.e_cs;
304 init_ip = mz_header.e_ip;
305 init_ss = load_seg+mz_header.e_ss;
306 init_sp = mz_header.e_sp;
308 TRACE("entry point: %04x:%04x\n",init_cs,init_ip);
311 if (alloc && !MZ_InitTask()) {
312 SetLastError(ERROR_GEN_FAILURE);
313 return FALSE;
316 return TRUE;
318 load_error:
319 DOSVM_psp = oldpsp_seg;
321 return FALSE;
324 /***********************************************************************
325 * wine_load_dos_exe (WINEDOS.@)
327 * Called from WineVDM when a new real-mode DOS process is started.
328 * Loads DOS program into memory and executes the program.
330 void WINAPI wine_load_dos_exe( LPCSTR filename, LPCSTR cmdline )
332 char dos_cmdtail[126];
333 int dos_length = 0;
335 HANDLE hFile = CreateFileA( filename, GENERIC_READ, FILE_SHARE_READ,
336 NULL, OPEN_EXISTING, 0, 0 );
337 if (hFile == INVALID_HANDLE_VALUE) return;
338 DOSVM_isdosexe = TRUE;
340 if(cmdline && *cmdline)
342 dos_length = strlen(cmdline);
343 memmove( dos_cmdtail + 1, cmdline,
344 (dos_length < 125) ? dos_length : 125 );
346 /* Non-empty command tail always starts with at least one space. */
347 dos_cmdtail[0] = ' ';
348 dos_length++;
351 * If command tail is longer than 126 characters,
352 * set tail length to 127 and fill CMDLINE environment variable
353 * with full command line (this includes filename).
355 if (dos_length > 126)
357 char *cmd = HeapAlloc( GetProcessHeap(), 0,
358 dos_length + strlen(filename) + 4 );
359 char *ptr = cmd;
361 if (!cmd)
362 return;
365 * Append filename. If path includes spaces, quote the path.
367 if (strchr(filename, ' '))
369 *ptr++ = '\"';
370 strcpy( ptr, filename );
371 ptr += strlen(filename);
372 *ptr++ = '\"';
374 else
376 strcpy( ptr, filename );
377 ptr += strlen(filename);
381 * Append command tail.
383 if (cmdline[0] != ' ')
384 *ptr++ = ' ';
385 strcpy( ptr, cmdline );
388 * Set environment variable. This will be passed to
389 * new DOS process.
391 if (!SetEnvironmentVariableA( "CMDLINE", cmd ))
393 HeapFree(GetProcessHeap(), 0, cmd );
394 return;
397 HeapFree(GetProcessHeap(), 0, cmd );
398 dos_length = 127;
402 if (MZ_DoLoadImage( hFile, filename, NULL ))
403 MZ_Launch( dos_cmdtail, dos_length );
406 /***********************************************************************
407 * MZ_Exec
409 * this may only be called from existing DOS processes
411 BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk )
413 DWORD binType;
414 STARTUPINFOA st;
415 PROCESS_INFORMATION pe;
416 HANDLE hFile;
418 BOOL ret = FALSE;
420 if(!GetBinaryTypeA(filename, &binType)) /* determine what kind of binary this is */
422 return FALSE; /* binary is not an executable */
425 /* handle non-dos executables */
426 if(binType != SCS_DOS_BINARY)
428 if(func == 0) /* load and execute */
430 LPBYTE fullCmdLine;
431 WORD fullCmdLength;
432 LPBYTE psp_start = (LPBYTE)((DWORD)DOSVM_psp << 4);
433 PDB16 *psp = (PDB16 *)psp_start;
434 ExecBlock *blk = (ExecBlock *)paramblk;
435 LPBYTE cmdline = PTR_REAL_TO_LIN(SELECTOROF(blk->cmdline),OFFSETOF(blk->cmdline));
436 LPBYTE envblock = PTR_REAL_TO_LIN(psp->environment, 0);
437 int cmdLength = cmdline[0];
440 * If cmdLength is 127, command tail is truncated and environment
441 * variable CMDLINE should contain full command line
442 * (this includes filename).
444 if (cmdLength == 127)
446 FIXME( "CMDLINE argument passing is unimplemented.\n" );
447 cmdLength = 126; /* FIXME */
450 fullCmdLength = (strlen(filename) + 1) + cmdLength + 1; /* filename + space + cmdline + terminating null character */
452 fullCmdLine = HeapAlloc(GetProcessHeap(), 0, fullCmdLength);
453 if(!fullCmdLine) return FALSE; /* return false on memory alloc failure */
455 /* build the full command line from the executable file and the command line being passed in */
456 snprintf(fullCmdLine, fullCmdLength, "%s ", filename); /* start off with the executable filename and a space */
457 memcpy(fullCmdLine + strlen(fullCmdLine), cmdline + 1, cmdLength); /* append cmdline onto the end */
458 fullCmdLine[fullCmdLength - 1] = 0; /* null terminate string */
460 ZeroMemory (&st, sizeof(STARTUPINFOA));
461 st.cb = sizeof(STARTUPINFOA);
462 ret = CreateProcessA (NULL, fullCmdLine, NULL, NULL, TRUE, 0, envblock, NULL, &st, &pe);
464 /* wait for the app to finish and clean up PROCESS_INFORMATION handles */
465 if(ret)
467 WaitForSingleObject(pe.hProcess, INFINITE); /* wait here until the child process is complete */
468 CloseHandle(pe.hProcess);
469 CloseHandle(pe.hThread);
472 HeapFree(GetProcessHeap(), 0, fullCmdLine); /* free the memory we allocated */
474 else
476 FIXME("EXEC type of %d not implemented for non-dos executables\n", func);
477 ret = FALSE;
480 return ret;
481 } /* if(binType != SCS_DOS_BINARY) */
484 /* handle dos executables */
486 hFile = CreateFileA( filename, GENERIC_READ, FILE_SHARE_READ,
487 NULL, OPEN_EXISTING, 0, 0);
488 if (hFile == INVALID_HANDLE_VALUE) return FALSE;
490 switch (func) {
491 case 0: /* load and execute */
492 case 1: /* load but don't execute */
494 /* save current process's return SS:SP now */
495 LPBYTE psp_start = (LPBYTE)((DWORD)DOSVM_psp << 4);
496 PDB16 *psp = (PDB16 *)psp_start;
497 psp->saveStack = (DWORD)MAKESEGPTR(context->SegSs, LOWORD(context->Esp));
499 ret = MZ_DoLoadImage( hFile, filename, NULL );
500 if (ret) {
501 /* MZ_LoadImage created a new PSP and loaded new values into it,
502 * let's work on the new values now */
503 LPBYTE psp_start = (LPBYTE)((DWORD)DOSVM_psp << 4);
504 ExecBlock *blk = (ExecBlock *)paramblk;
505 LPBYTE cmdline = PTR_REAL_TO_LIN(SELECTOROF(blk->cmdline),OFFSETOF(blk->cmdline));
507 /* First character contains the length of the command line. */
508 MZ_FillPSP(psp_start, cmdline + 1, cmdline[0]);
510 /* the lame MS-DOS engineers decided that the return address should be in int22 */
511 DOSVM_SetRMHandler(0x22, (FARPROC16)MAKESEGPTR(context->SegCs, LOWORD(context->Eip)));
512 if (func) {
513 /* don't execute, just return startup state */
515 * From Ralph Brown:
516 * For function 01h, the AX value to be passed to the child program
517 * is put on top of the child's stack
519 LPBYTE stack;
520 init_sp -= 2;
521 stack = (LPBYTE) CTX_SEG_OFF_TO_LIN(context, init_ss, init_sp);
522 /* FIXME: push AX correctly */
523 stack[0] = 0x00; /* push AL */
524 stack[1] = 0x00; /* push AH */
526 blk->init_cs = init_cs;
527 blk->init_ip = init_ip;
528 blk->init_ss = init_ss;
529 blk->init_sp = init_sp;
530 } else {
531 /* execute by making us return to new process */
532 context->SegCs = init_cs;
533 context->Eip = init_ip;
534 context->SegSs = init_ss;
535 context->Esp = init_sp;
536 context->SegDs = DOSVM_psp;
537 context->SegEs = DOSVM_psp;
538 context->Eax = 0;
541 break;
542 case 3: /* load overlay */
544 OverlayBlock *blk = (OverlayBlock *)paramblk;
545 ret = MZ_DoLoadImage( hFile, filename, blk );
547 break;
548 default:
549 FIXME("EXEC load type %d not implemented\n", func);
550 SetLastError(ERROR_INVALID_FUNCTION);
551 break;
553 CloseHandle(hFile);
554 return ret;
557 /***********************************************************************
558 * MZ_AllocDPMITask
560 void WINAPI MZ_AllocDPMITask( void )
562 MZ_InitMemory();
563 MZ_InitTask();
566 /***********************************************************************
567 * MZ_RunInThread
569 void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg )
571 if (loop_thread) {
572 DOS_SPC spc;
573 HANDLE event;
575 spc.proc = proc;
576 spc.arg = arg;
577 event = CreateEventA(NULL, TRUE, FALSE, NULL);
578 PostThreadMessageA(loop_tid, WM_USER, (WPARAM)event, (LPARAM)&spc);
579 WaitForSingleObject(event, INFINITE);
580 CloseHandle(event);
581 } else
582 proc(arg);
585 static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
587 CONTEXT context;
588 DWORD ret;
590 dosvm_pid = getpid();
592 memset( &context, 0, sizeof(context) );
593 context.SegCs = init_cs;
594 context.Eip = init_ip;
595 context.SegSs = init_ss;
596 context.Esp = init_sp;
597 context.SegDs = DOSVM_psp;
598 context.SegEs = DOSVM_psp;
599 context.EFlags = V86_FLAG | VIF_MASK;
600 DOSVM_SetTimer(0x10000);
601 ret = DOSVM_Enter( &context );
603 dosvm_pid = 0;
604 return ret;
607 static BOOL MZ_InitTask(void)
609 if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
610 GetCurrentProcess(), &loop_thread,
611 0, FALSE, DUPLICATE_SAME_ACCESS))
612 return FALSE;
613 dosvm_thread = CreateThread(NULL, 0, MZ_DOSVM, NULL, CREATE_SUSPENDED, &dosvm_tid);
614 if (!dosvm_thread) {
615 CloseHandle(loop_thread);
616 loop_thread = 0;
617 return FALSE;
619 loop_tid = GetCurrentThreadId();
620 return TRUE;
623 static void MZ_Launch( LPCSTR cmdtail, int length )
625 TDB *pTask = GlobalLock16( GetCurrentTask() );
626 BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
627 DWORD rv;
628 SYSLEVEL *lock;
630 MZ_FillPSP(psp_start, cmdtail, length);
631 pTask->flags |= TDBF_WINOLDAP;
633 /* DTA is set to PSP:0080h when a program is started. */
634 pTask->dta = MAKESEGPTR( DOSVM_psp, 0x80 );
636 GetpWin16Lock( &lock );
637 _LeaveSysLevel( lock );
639 ResumeThread(dosvm_thread);
640 rv = DOSVM_Loop(dosvm_thread);
642 CloseHandle(dosvm_thread);
643 dosvm_thread = 0; dosvm_tid = 0;
644 CloseHandle(loop_thread);
645 loop_thread = 0; loop_tid = 0;
647 VGA_Clean();
648 ExitProcess(rv);
651 /***********************************************************************
652 * MZ_Exit
654 void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
656 if (DOSVM_psp) {
657 WORD psp_seg = cs_psp ? context->SegCs : DOSVM_psp;
658 LPBYTE psp_start = (LPBYTE)((DWORD)psp_seg << 4);
659 PDB16 *psp = (PDB16 *)psp_start;
660 WORD parpsp = psp->parentPSP; /* check for parent DOS process */
661 if (parpsp) {
662 /* retrieve parent's return address */
663 FARPROC16 retaddr = DOSVM_GetRMHandler(0x22);
664 /* restore interrupts */
665 DOSVM_SetRMHandler(0x22, psp->savedint22);
666 DOSVM_SetRMHandler(0x23, psp->savedint23);
667 DOSVM_SetRMHandler(0x24, psp->savedint24);
668 /* FIXME: deallocate file handles etc */
669 /* free process's associated memory
670 * FIXME: walk memory and deallocate all blocks owned by process */
671 DOSMEM_FreeBlock( PTR_REAL_TO_LIN(psp->environment,0) );
672 DOSMEM_FreeBlock( PTR_REAL_TO_LIN(DOSVM_psp,0) );
673 /* switch to parent's PSP */
674 DOSVM_psp = parpsp;
675 psp_start = (LPBYTE)((DWORD)parpsp << 4);
676 psp = (PDB16 *)psp_start;
677 /* now return to parent */
678 DOSVM_retval = retval;
679 context->SegCs = SELECTOROF(retaddr);
680 context->Eip = OFFSETOF(retaddr);
681 context->SegSs = SELECTOROF(psp->saveStack);
682 context->Esp = OFFSETOF(psp->saveStack);
683 return;
684 } else
685 TRACE("killing DOS task\n");
687 ExitThread( retval );
691 /***********************************************************************
692 * MZ_Current
694 BOOL WINAPI MZ_Current( void )
696 return (dosvm_pid != 0); /* FIXME: do a better check */
699 #else /* !MZ_SUPPORTED */
701 /***********************************************************************
702 * wine_load_dos_exe (WINEDOS.@)
704 void WINAPI wine_load_dos_exe( LPCSTR filename, LPCSTR cmdline )
706 WARN("DOS executables not supported on this platform\n");
707 SetLastError(ERROR_BAD_FORMAT);
710 /***********************************************************************
711 * MZ_Exec
713 BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk )
715 /* can't happen */
716 SetLastError(ERROR_BAD_FORMAT);
717 return FALSE;
720 /***********************************************************************
721 * MZ_AllocDPMITask
723 void WINAPI MZ_AllocDPMITask( void )
725 ERR("Actual real-mode calls not supported on this platform!\n");
728 /***********************************************************************
729 * MZ_RunInThread
731 void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg )
733 proc(arg);
736 /***********************************************************************
737 * MZ_Exit
739 void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
741 ExitThread( retval );
744 /***********************************************************************
745 * MZ_Current
747 BOOL WINAPI MZ_Current( void )
749 return FALSE;
752 #endif /* !MZ_SUPPORTED */