4 * Copyright 1995 Anand Kumria
13 #include "selectors.h"
21 #define VXD_BARF(context,name) \
22 DUMP( "vxd %s: unknown/not implemented parameters:\n" \
23 "vxd %s: AX %04x, BX %04x, CX %04x, DX %04x, " \
24 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
25 (name), (name), AX_reg(context), BX_reg(context), \
26 CX_reg(context), DX_reg(context), SI_reg(context), \
27 DI_reg(context), (WORD)DS_reg(context), (WORD)ES_reg(context) )
30 static WORD
VXD_WinVersion(void)
32 WORD version
= LOWORD(GetVersion16());
33 return (version
>> 8) | (version
<< 8);
36 /***********************************************************************
39 void VXD_VMM ( CONTEXT
*context
)
41 unsigned service
= AX_reg(context
);
43 TRACE(vxd
,"[%04x] VMM \n", (UINT16
)service
);
47 case 0x0000: /* version */
48 AX_reg(context
) = VXD_WinVersion();
52 case 0x026d: /* Get_Debug_Flag '/m' */
53 case 0x026e: /* Get_Debug_Flag '/n' */
59 VXD_BARF( context
, "VMM" );
63 /***********************************************************************
66 void WINAPI
VXD_PageFile( CONTEXT
*context
)
68 unsigned service
= AX_reg(context
);
70 /* taken from Ralf Brown's Interrupt List */
72 TRACE(vxd
,"[%04x] PageFile\n", (UINT16
)service
);
76 case 0x00: /* get version, is this windows version? */
77 TRACE(vxd
,"returning version\n");
78 AX_reg(context
) = VXD_WinVersion();
82 case 0x01: /* get swap file info */
83 TRACE(vxd
,"VxD PageFile: returning swap file info\n");
84 AX_reg(context
) = 0x00; /* paging disabled */
85 ECX_reg(context
) = 0; /* maximum size of paging file */
86 /* FIXME: do I touch DS:SI or DS:DI? */
90 case 0x02: /* delete permanent swap on exit */
91 TRACE(vxd
,"VxD PageFile: supposed to delete swap\n");
95 case 0x03: /* current temporary swap file size */
96 TRACE(vxd
,"VxD PageFile: what is current temp. swap size\n");
100 case 0x04: /* read or write?? INTERRUP.D */
101 case 0x05: /* cancel?? INTERRUP.D */
102 case 0x06: /* test I/O valid INTERRUP.D */
104 VXD_BARF( context
, "pagefile" );
109 /***********************************************************************
112 void VXD_Reboot ( CONTEXT
*context
)
114 unsigned service
= AX_reg(context
);
116 TRACE(vxd
,"[%04x] VMM \n", (UINT16
)service
);
120 case 0x0000: /* version */
121 AX_reg(context
) = VXD_WinVersion();
122 RESET_CFLAG(context
);
126 VXD_BARF( context
, "REBOOT" );
130 /***********************************************************************
133 void VXD_VDD ( CONTEXT
*context
)
135 unsigned service
= AX_reg(context
);
137 TRACE(vxd
,"[%04x] VDD \n", (UINT16
)service
);
141 case 0x0000: /* version */
142 AX_reg(context
) = VXD_WinVersion();
143 RESET_CFLAG(context
);
147 VXD_BARF( context
, "VDD" );
151 /***********************************************************************
154 void VXD_VMD ( CONTEXT
*context
)
156 unsigned service
= AX_reg(context
);
158 TRACE(vxd
,"[%04x] VMD \n", (UINT16
)service
);
162 case 0x0000: /* version */
163 AX_reg(context
) = VXD_WinVersion();
164 RESET_CFLAG(context
);
168 VXD_BARF( context
, "VMD" );
172 /***********************************************************************
175 void WINAPI
VXD_Shell( CONTEXT
*context
)
177 unsigned service
= DX_reg(context
);
179 TRACE(vxd
,"[%04x] Shell\n", (UINT16
)service
);
181 switch (service
) /* Ralf Brown says EDX, but I use DX instead */
184 TRACE(vxd
,"returning version\n");
185 AX_reg(context
) = VXD_WinVersion();
186 EBX_reg(context
) = 1; /* system VM Handle */
194 VXD_BARF( context
, "shell" );
197 case 0x0006: /* SHELL_Get_VM_State */
198 TRACE(vxd
,"VxD Shell: returning VM state\n");
199 /* Actually we don't, not yet. We have to return a structure
200 * and I am not to sure how to set it up and return it yet,
201 * so for now let's do nothing. I can (hopefully) get this
202 * by the next release
204 /* RESET_CFLAG(context); */
223 VXD_BARF( context
, "SHELL" );
226 /* the new Win95 shell API */
227 case 0x0100: /* get version */
228 AX_reg(context
) = VXD_WinVersion();
231 case 0x0104: /* retrieve Hook_Properties list */
232 case 0x0105: /* call Hook_Properties callbacks */
233 VXD_BARF( context
, "SHELL" );
236 case 0x0106: /* install timeout callback */
237 TRACE( vxd
, "VxD Shell: ignoring shell callback (%ld sec.)\n",
238 EBX_reg( context
) );
242 case 0x0107: /* get version of any VxD */
244 VXD_BARF( context
, "SHELL" );
250 /***********************************************************************
253 void WINAPI
VXD_Comm( CONTEXT
*context
)
255 unsigned service
= AX_reg(context
);
257 TRACE(vxd
,"[%04x] Comm\n", (UINT16
)service
);
261 case 0x0000: /* get version */
262 TRACE(vxd
,"returning version\n");
263 AX_reg(context
) = VXD_WinVersion();
264 RESET_CFLAG(context
);
267 case 0x0001: /* set port global */
268 case 0x0002: /* get focus */
269 case 0x0003: /* virtualise port */
271 VXD_BARF( context
, "comm" );
275 /***********************************************************************
278 void VXD_Timer( CONTEXT
*context
)
280 unsigned service
= AX_reg(context
);
282 TRACE(vxd
,"[%04x] Virtual Timer\n", (UINT16
)service
);
286 case 0x0000: /* version */
287 AX_reg(context
) = VXD_WinVersion();
288 RESET_CFLAG(context
);
291 case 0x0100: /* clock tick time, in 840nsecs */
292 EAX_reg(context
) = GetTickCount();
294 EDX_reg(context
) = EAX_reg(context
) >> 22;
295 EAX_reg(context
) <<= 10; /* not very precise */
298 case 0x0101: /* current Windows time, msecs */
299 case 0x0102: /* current VM time, msecs */
300 EAX_reg(context
) = GetTickCount();
304 VXD_BARF( context
, "VTD" );
308 /***********************************************************************
311 void VXD_TimerAPI ( CONTEXT
*context
)
313 static DWORD clockTicks
= 0;
314 static WORD clockTickSelector
= 0;
316 unsigned service
= AX_reg(context
);
318 TRACE(vxd
,"[%04x] TimerAPI \n", (UINT16
)service
);
322 case 0x0000: /* version */
323 AX_reg(context
) = VXD_WinVersion();
324 RESET_CFLAG(context
);
327 case 0x0009: /* get system time selector */
328 FIXME(vxd
, "Get_System_Time_Selector: this clock doesn't tick!\n");
330 if ( !clockTickSelector
)
331 clockTickSelector
= SELECTOR_AllocBlock( &clockTicks
, sizeof(DWORD
),
332 SEGMENT_DATA
, FALSE
, TRUE
);
333 AX_reg(context
) = clockTickSelector
;
334 RESET_CFLAG(context
);
338 VXD_BARF( context
, "VTDAPI" );
342 /***********************************************************************
345 void VXD_ConfigMG ( CONTEXT
*context
)
347 unsigned service
= AX_reg(context
);
349 TRACE(vxd
,"[%04x] ConfigMG \n", (UINT16
)service
);
353 case 0x0000: /* version */
354 AX_reg(context
) = VXD_WinVersion();
355 RESET_CFLAG(context
);
359 VXD_BARF( context
, "CONFIGMG" );
363 /***********************************************************************
366 void VXD_Enable ( CONTEXT
*context
)
368 unsigned service
= AX_reg(context
);
370 TRACE(vxd
,"[%04x] Enable \n", (UINT16
)service
);
374 case 0x0000: /* version */
375 AX_reg(context
) = VXD_WinVersion();
376 RESET_CFLAG(context
);
380 VXD_BARF( context
, "ENABLE" );
384 /***********************************************************************
387 void VXD_APM ( CONTEXT
*context
)
389 unsigned service
= AX_reg(context
);
391 TRACE(vxd
,"[%04x] APM \n", (UINT16
)service
);
395 case 0x0000: /* version */
396 AX_reg(context
) = VXD_WinVersion();
397 RESET_CFLAG(context
);
401 VXD_BARF( context
, "APM" );
405 /***********************************************************************
408 * This is an implementation of the services of the Win32s VxD.
409 * Since official documentation of these does not seem to be available,
410 * certain arguments of some of the services remain unclear.
412 * FIXME: The following services are currently unimplemented:
413 * Exception handling (0x01, 0x1C)
414 * Debugger support (0x0C, 0x14, 0x17)
415 * Low-level memory access (0x02, 0x03, 0x0A, 0x0B)
416 * Memory Statistics (0x1B)
419 * We have a specific problem running Win32s on Linux (and probably also
420 * the other x86 unixes), since Win32s tries to allocate its main 'flat
421 * code/data segment' selectors with a base of 0xffff0000 (and limit 4GB).
422 * The rationale for this seems to be that they want one the one hand to
423 * be able to leave the Win 3.1 memory (starting with the main DOS memory)
424 * at linear address 0, but want at other hand to have offset 0 of the
425 * flat data/code segment point to an unmapped page (to catch NULL pointer
426 * accesses). Hence they allocate the flat segments with a base of 0xffff0000
427 * so that the Win 3.1 memory area at linear address zero shows up in the
428 * flat segments at offset 0x10000 (since linear addresses wrap around at
429 * 4GB). To compensate for that discrepancy between flat segment offsets
430 * and plain linear addresses, all flat pointers passed between the 32-bit
431 * and the 16-bit parts of Win32s are shifted by 0x10000 in the appropriate
432 * direction by the glue code (mainly) in W32SKRNL and WIN32S16.
434 * The problem for us is now that Linux does not allow a LDT selector with
435 * base 0xffff0000 to be created, since it would 'see' a part of the kernel
436 * address space. To address this problem we introduce *another* offset:
437 * We add 0x10000 to every linear address we get as an argument from Win32s.
438 * This means especially that the flat code/data selectors get actually
439 * allocated with base 0x0, so that flat offsets and (real) linear addresses
440 * do again agree! In fact, every call e.g. of a Win32s VxD service now
441 * has all pointer arguments (which are offsets in the flat data segement)
442 * first reduced by 0x10000 by the W32SKRNL glue code, and then again
443 * increased by 0x10000 by *our* code.
445 * Note that to keep everything consistent, this offset has to be applied by
446 * every Wine function that operates on 'linear addresses' passed to it by
447 * Win32s. Fortunately, since Win32s does not directly call any Wine 32-bit
448 * API routines, this affects only two locations: this VxD and the DPMI
449 * handler. (NOTE: Should any Win32s application pass a linear address to
450 * any routine apart from those, e.g. some other VxD handler, that code
451 * would have to take the offset into account as well!)
453 * The application of the offset is triggered by marking the current process
454 * as a Win32s process by setting the PDB32_WIN32S_PROC flag in the process
455 * database. This is done the first time any application calls the GetVersion()
456 * service of the Win32s VxD. (Note that the flag is never removed.)
460 void VXD_Win32s( CONTEXT
*context
)
462 switch (AX_reg(context
))
464 case 0x0000: /* Get Version */
468 * Output: EAX: LoWord: Win32s Version (1.30)
469 * HiWord: VxD Version (200)
475 * EDX: Debugging Flags
479 * 1 if VMCPD VxD not found
482 TRACE(vxd
, "GetVersion()\n");
484 EAX_reg(context
) = VXD_WinVersion() | (200 << 16);
485 EBX_reg(context
) = 0;
486 ECX_reg(context
) = 0;
487 EDX_reg(context
) = 0;
488 EDI_reg(context
) = 0;
491 * If this is the first time we are called for this process,
492 * hack the memory image of WIN32S16 so that it doesn't try
493 * to access the GDT directly ...
495 * The first code segment of WIN32S16 (version 1.30) contains
496 * an unexported function somewhere between the exported functions
497 * SetFS and StackLinearToSegmented that tries to find a selector
498 * in the LDT that maps to the memory image of the LDT itself.
499 * If it succeeds, it stores this selector into a global variable
500 * which will be used to speed up execution by using this selector
501 * to modify the LDT directly instead of using the DPMI calls.
503 * To perform this search of the LDT, this function uses the
504 * sgdt and sldt instructions to find the linear address of
505 * the (GDT and then) LDT. While those instructions themselves
506 * execute without problem, the linear address that sgdt returns
507 * points (at least under Linux) to the kernel address space, so
508 * that any subsequent access leads to a segfault.
510 * Fortunately, WIN32S16 still contains as a fallback option the
511 * mechanism of using DPMI calls to modify LDT selectors instead
512 * of direct writes to the LDT. Thus we can circumvent the problem
513 * by simply replacing the first byte of the offending function
514 * with an 'retf' instruction. This means that the global variable
515 * supposed to contain the LDT alias selector will remain zero,
516 * and hence WIN32S16 will fall back to using DPMI calls.
518 * The heuristic we employ to _find_ that function is as follows:
519 * We search between the addresses of the exported symbols SetFS
520 * and StackLinearToSegmented for the byte sequence '0F 01 04'
521 * (this is the opcode of 'sgdt [si]'). We then search backwards
522 * from this address for the last occurrance of 'CB' (retf) that marks
523 * the end of the preceeding function. The following byte (which
524 * should now be the first byte of the function we are looking for)
525 * will be replaced by 'CB' (retf).
527 * This heuristic works for the retail as well as the debug version
528 * of Win32s version 1.30. For versions earlier than that this
529 * hack should not be necessary at all, since the whole mechanism
530 * ('PERF130') was introduced only in 1.30 to improve the overall
531 * performance of Win32s.
534 if (!(PROCESS_Current()->flags
& PDB32_WIN32S_PROC
))
536 HMODULE16 hModule
= GetModuleHandle16("win32s16");
537 SEGPTR func1
= (SEGPTR
)WIN32_GetProcAddress16(hModule
, "SetFS");
538 SEGPTR func2
= (SEGPTR
)WIN32_GetProcAddress16(hModule
,
539 "StackLinearToSegmented");
541 if ( hModule
&& func1
&& func2
542 && SELECTOROF(func1
) == SELECTOROF(func2
))
544 BYTE
*start
= PTR_SEG_TO_LIN(func1
);
545 BYTE
*end
= PTR_SEG_TO_LIN(func2
);
546 BYTE
*p
, *retv
= NULL
;
549 for (p
= start
; p
< end
; p
++)
550 if (*p
== 0xCB) found
= 0, retv
= p
;
551 else if (*p
== 0x0F) found
= 1;
552 else if (*p
== 0x01 && found
== 1) found
= 2;
553 else if (*p
== 0x04 && found
== 2) { found
= 3; break; }
556 if (found
== 3 && retv
)
558 TRACE(vxd
, "PERF130 hack: "
559 "Replacing byte %02X at offset %04X:%04X\n",
560 *(retv
+1), SELECTOROF(func1
),
561 OFFSETOF(func1
) + retv
+1-start
);
563 *(retv
+1) = (BYTE
)0xCB;
569 * Mark process as Win32s, so that subsequent DPMI calls
570 * will perform the W32S_APP2WINE/W32S_WINE2APP address shift.
573 PROCESS_Current()->flags
|= PDB32_WIN32S_PROC
;
577 case 0x0001: /* Install Exception Handling */
579 * Input: EBX: Flat address of W32SKRNL Exception Data
581 * ECX: LoWord: Flat Code Selector
582 * HiWord: Flat Data Selector
584 * EDX: Flat address of W32SKRNL Exception Handler
585 * (this is equal to W32S_BackTo32 + 0x40)
587 * ESI: SEGPTR KERNEL.HASGPHANDLER
589 * EDI: SEGPTR phCurrentTask (KERNEL.THHOOK + 0x10)
591 * Output: EAX: 0 if OK
594 TRACE(vxd
, "[0001] EBX=%lx ECX=%lx EDX=%lx ESI=%lx EDI=%lx\n",
595 EBX_reg(context
), ECX_reg(context
), EDX_reg(context
),
596 ESI_reg(context
), EDI_reg(context
));
600 EAX_reg(context
) = 0;
604 case 0x0002: /* Set Page Access Flags */
606 * Input: EBX: New access flags
607 * Bit 2: User Page if set, Supervisor Page if clear
608 * Bit 1: Read-Write if set, Read-Only if clear
610 * ECX: Size of memory area to change
612 * EDX: Flat start address of memory area
614 * Output: EAX: Size of area changed
617 TRACE(vxd
, "[0002] EBX=%lx ECX=%lx EDX=%lx\n",
618 EBX_reg(context
), ECX_reg(context
), EDX_reg(context
));
622 EAX_reg(context
) = ECX_reg(context
);
626 case 0x0003: /* Get Page Access Flags */
628 * Input: EDX: Flat address of page to query
630 * Output: EAX: Page access flags
631 * Bit 2: User Page if set, Supervisor Page if clear
632 * Bit 1: Read-Write if set, Read-Only if clear
635 TRACE(vxd
, "[0003] EDX=%lx\n", EDX_reg(context
));
639 EAX_reg(context
) = 6;
643 case 0x0004: /* Map Module */
645 * Input: ECX: IMTE (offset in Module Table) of new module
647 * EDX: Flat address of Win32s Module Table
649 * Output: EAX: 0 if OK
652 if (!EDX_reg(context
) || CX_reg(context
) == 0xFFFF)
654 TRACE(vxd
, "MapModule: Initialization call\n");
655 EAX_reg(context
) = 0;
660 * Structure of a Win32s Module Table Entry:
675 * Note: This function should set up a demand-paged memory image
676 * of the given module. Since mmap does not allow file offsets
677 * not aligned at 1024 bytes, we simply load the image fully
681 struct Win32sModule
*moduleTable
=
682 (struct Win32sModule
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
683 struct Win32sModule
*module
= moduleTable
+ ECX_reg(context
);
685 IMAGE_NT_HEADERS
*nt_header
= PE_HEADER(module
->baseAddr
);
686 IMAGE_SECTION_HEADER
*pe_seg
= PE_SECTIONS(module
->baseAddr
);
688 HFILE32 image
= FILE_Open(module
->pathName
, O_RDONLY
,0);
689 BOOL32 error
= (image
== INVALID_HANDLE_VALUE32
);
692 TRACE(vxd
, "MapModule: Loading %s\n", module
->pathName
);
695 !error
&& i
< nt_header
->FileHeader
.NumberOfSections
;
697 if(!(pe_seg
->Characteristics
& IMAGE_SCN_CNT_UNINITIALIZED_DATA
))
699 DWORD off
= pe_seg
->PointerToRawData
;
700 DWORD len
= pe_seg
->SizeOfRawData
;
701 LPBYTE addr
= module
->baseAddr
+ pe_seg
->VirtualAddress
;
703 TRACE(vxd
, "MapModule: "
704 "Section %d at %08lx from %08lx len %08lx\n",
705 i
, (DWORD
)addr
, off
, len
);
707 if ( _llseek32(image
, off
, SEEK_SET
) != off
708 || _lread32(image
, addr
, len
) != len
)
715 ERR(vxd
, "MapModule: Unable to load %s\n", module
->pathName
);
717 else if (module
->relocDelta
!= 0)
719 IMAGE_DATA_DIRECTORY
*dir
= nt_header
->OptionalHeader
.DataDirectory
720 + IMAGE_DIRECTORY_ENTRY_BASERELOC
;
721 IMAGE_BASE_RELOCATION
*r
= (IMAGE_BASE_RELOCATION
*)
722 (dir
->Size
? module
->baseAddr
+ dir
->VirtualAddress
: 0);
724 TRACE(vxd
, "MapModule: Reloc delta %08lx\n", module
->relocDelta
);
726 while (r
&& r
->VirtualAddress
)
728 LPBYTE page
= module
->baseAddr
+ r
->VirtualAddress
;
729 int count
= (r
->SizeOfBlock
- 8) / 2;
731 TRACE(vxd
, "MapModule: %d relocations for page %08lx\n",
734 for(i
= 0; i
< count
; i
++)
736 int offset
= r
->TypeOffset
[i
] & 0xFFF;
737 int type
= r
->TypeOffset
[i
] >> 12;
740 case IMAGE_REL_BASED_ABSOLUTE
:
742 case IMAGE_REL_BASED_HIGH
:
743 *(WORD
*)(page
+offset
) += HIWORD(module
->relocDelta
);
745 case IMAGE_REL_BASED_LOW
:
746 *(WORD
*)(page
+offset
) += LOWORD(module
->relocDelta
);
748 case IMAGE_REL_BASED_HIGHLOW
:
749 *(DWORD
*)(page
+offset
) += module
->relocDelta
;
752 WARN(vxd
, "MapModule: Unsupported fixup type\n");
757 r
= (IMAGE_BASE_RELOCATION
*)((LPBYTE
)r
+ r
->SizeOfBlock
);
761 EAX_reg(context
) = 0;
762 RESET_CFLAG(context
);
767 case 0x0005: /* UnMap Module */
769 * Input: EDX: Flat address of module image
771 * Output: EAX: 1 if OK
774 TRACE(vxd
, "UnMapModule: %lx\n", (DWORD
)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
));
776 /* As we didn't map anything, there's nothing to unmap ... */
778 EAX_reg(context
) = 1;
782 case 0x0006: /* VirtualAlloc */
784 * Input: ECX: Current Process
786 * EDX: Flat address of arguments on stack
788 * DWORD *retv [out] Flat base address of allocated region
789 * LPVOID base [in] Flat address of region to reserve/commit
790 * DWORD size [in] Size of region
791 * DWORD type [in] Type of allocation
792 * DWORD prot [in] Type of access protection
794 * Output: EAX: NtStatus
797 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
798 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
799 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
800 DWORD size
= stack
[2];
801 DWORD type
= stack
[3];
802 DWORD prot
= stack
[4];
805 TRACE(vxd
, "VirtualAlloc(%lx, %lx, %lx, %lx, %lx)\n",
806 (DWORD
)retv
, (DWORD
)base
, size
, type
, prot
);
808 if (type
& 0x80000000)
810 WARN(vxd
, "VirtualAlloc: strange type %lx\n", type
);
814 if (!base
&& (type
& MEM_COMMIT
) && prot
== PAGE_READONLY
)
816 WARN(vxd
, "VirtualAlloc: NLS hack, allowing write access!\n");
817 prot
= PAGE_READWRITE
;
820 result
= (DWORD
)VirtualAlloc(base
, size
, type
, prot
);
822 if (W32S_WINE2APP(result
, W32S_OFFSET
))
823 *retv
= W32S_WINE2APP(result
, W32S_OFFSET
),
824 EAX_reg(context
) = STATUS_SUCCESS
;
827 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
832 case 0x0007: /* VirtualFree */
834 * Input: ECX: Current Process
836 * EDX: Flat address of arguments on stack
838 * DWORD *retv [out] TRUE if success, FALSE if failure
839 * LPVOID base [in] Flat address of region
840 * DWORD size [in] Size of region
841 * DWORD type [in] Type of operation
843 * Output: EAX: NtStatus
846 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
847 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
848 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
849 DWORD size
= stack
[2];
850 DWORD type
= stack
[3];
853 TRACE(vxd
, "VirtualFree(%lx, %lx, %lx, %lx)\n",
854 (DWORD
)retv
, (DWORD
)base
, size
, type
);
856 result
= VirtualFree(base
, size
, type
);
860 EAX_reg(context
) = STATUS_SUCCESS
;
863 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
868 case 0x0008: /* VirtualProtect */
870 * Input: ECX: Current Process
872 * EDX: Flat address of arguments on stack
874 * DWORD *retv [out] TRUE if success, FALSE if failure
875 * LPVOID base [in] Flat address of region
876 * DWORD size [in] Size of region
877 * DWORD new_prot [in] Desired access protection
878 * DWORD *old_prot [out] Previous access protection
880 * Output: EAX: NtStatus
883 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
884 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
885 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
886 DWORD size
= stack
[2];
887 DWORD new_prot
= stack
[3];
888 DWORD
*old_prot
= (DWORD
*)W32S_APP2WINE(stack
[4], W32S_OFFSET
);
891 TRACE(vxd
, "VirtualProtect(%lx, %lx, %lx, %lx, %lx)\n",
892 (DWORD
)retv
, (DWORD
)base
, size
, new_prot
, (DWORD
)old_prot
);
894 result
= VirtualProtect(base
, size
, new_prot
, old_prot
);
898 EAX_reg(context
) = STATUS_SUCCESS
;
901 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
906 case 0x0009: /* VirtualQuery */
908 * Input: ECX: Current Process
910 * EDX: Flat address of arguments on stack
912 * DWORD *retv [out] Nr. bytes returned
913 * LPVOID base [in] Flat address of region
914 * LPMEMORY_BASIC_INFORMATION info [out] Info buffer
915 * DWORD len [in] Size of buffer
917 * Output: EAX: NtStatus
920 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
921 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
922 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
923 LPMEMORY_BASIC_INFORMATION info
=
924 (LPMEMORY_BASIC_INFORMATION
)W32S_APP2WINE(stack
[2], W32S_OFFSET
);
925 DWORD len
= stack
[3];
928 TRACE(vxd
, "VirtualQuery(%lx, %lx, %lx, %lx)\n",
929 (DWORD
)retv
, (DWORD
)base
, (DWORD
)info
, len
);
931 result
= VirtualQuery(base
, info
, len
);
934 EAX_reg(context
) = STATUS_SUCCESS
;
939 case 0x000A: /* SetVirtMemProcess */
941 * Input: ECX: Process Handle
943 * EDX: Flat address of region
945 * Output: EAX: NtStatus
948 TRACE(vxd
, "[000a] ECX=%lx EDX=%lx\n",
949 ECX_reg(context
), EDX_reg(context
));
953 EAX_reg(context
) = STATUS_SUCCESS
;
957 case 0x000B: /* ??? some kind of cleanup */
959 * Input: ECX: Process Handle
961 * Output: EAX: NtStatus
964 TRACE(vxd
, "[000b] ECX=%lx\n", ECX_reg(context
));
968 EAX_reg(context
) = STATUS_SUCCESS
;
972 case 0x000C: /* Set Debug Flags */
974 * Input: EDX: Debug Flags
976 * Output: EDX: Previous Debug Flags
979 FIXME(vxd
, "[000c] EDX=%lx\n", EDX_reg(context
));
983 EDX_reg(context
) = 0;
987 case 0x000D: /* NtCreateSection */
989 * Input: EDX: Flat address of arguments on stack
991 * HANDLE32 *retv [out] Handle of Section created
992 * DWORD flags1 [in] (?? unknown ??)
993 * DWORD atom [in] Name of Section to create
994 * LARGE_INTEGER *size [in] Size of Section
995 * DWORD protect [in] Access protection
996 * DWORD flags2 [in] (?? unknown ??)
997 * HFILE32 hFile [in] Handle of file to map
998 * DWORD psp [in] (Win32s: PSP that hFile belongs to)
1000 * Output: EAX: NtStatus
1003 DWORD
*stack
= (DWORD
*) W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1004 HANDLE32
*retv
= (HANDLE32
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1005 DWORD flags1
= stack
[1];
1006 DWORD atom
= stack
[2];
1007 LARGE_INTEGER
*size
= (LARGE_INTEGER
*)W32S_APP2WINE(stack
[3], W32S_OFFSET
);
1008 DWORD protect
= stack
[4];
1009 DWORD flags2
= stack
[5];
1010 HFILE32 hFile
= HFILE16_TO_HFILE32(stack
[6]);
1011 DWORD psp
= stack
[7];
1013 HANDLE32 result
= INVALID_HANDLE_VALUE32
;
1016 TRACE(vxd
, "NtCreateSection(%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx)\n",
1017 (DWORD
)retv
, flags1
, atom
, (DWORD
)size
, protect
, flags2
,
1020 if (!atom
|| GlobalGetAtomName32A(atom
, name
, sizeof(name
)))
1022 TRACE(vxd
, "NtCreateSection: name=%s\n", atom
? name
: NULL
);
1024 result
= CreateFileMapping32A(hFile
, NULL
, protect
,
1025 size
? size
->HighPart
: 0,
1026 size
? size
->LowPart
: 0,
1030 if (result
== INVALID_HANDLE_VALUE32
)
1031 WARN(vxd
, "NtCreateSection: failed!\n");
1033 TRACE(vxd
, "NtCreateSection: returned %lx\n", (DWORD
)result
);
1035 if (result
!= INVALID_HANDLE_VALUE32
)
1037 EAX_reg(context
) = STATUS_SUCCESS
;
1040 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1045 case 0x000E: /* NtOpenSection */
1047 * Input: EDX: Flat address of arguments on stack
1049 * HANDLE32 *retv [out] Handle of Section opened
1050 * DWORD protect [in] Access protection
1051 * DWORD atom [in] Name of Section to create
1053 * Output: EAX: NtStatus
1056 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1057 HANDLE32
*retv
= (HANDLE32
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1058 DWORD protect
= stack
[1];
1059 DWORD atom
= stack
[2];
1061 HANDLE32 result
= INVALID_HANDLE_VALUE32
;
1064 TRACE(vxd
, "NtOpenSection(%lx, %lx, %lx)\n",
1065 (DWORD
)retv
, protect
, atom
);
1067 if (atom
&& GlobalGetAtomName32A(atom
, name
, sizeof(name
)))
1069 TRACE(vxd
, "NtOpenSection: name=%s\n", name
);
1071 result
= OpenFileMapping32A(protect
, FALSE
, name
);
1074 if (result
== INVALID_HANDLE_VALUE32
)
1075 WARN(vxd
, "NtOpenSection: failed!\n");
1077 TRACE(vxd
, "NtOpenSection: returned %lx\n", (DWORD
)result
);
1079 if (result
!= INVALID_HANDLE_VALUE32
)
1081 EAX_reg(context
) = STATUS_SUCCESS
;
1084 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1089 case 0x000F: /* NtCloseSection */
1091 * Input: EDX: Flat address of arguments on stack
1093 * HANDLE32 handle [in] Handle of Section to close
1094 * DWORD *id [out] Unique ID (?? unclear ??)
1096 * Output: EAX: NtStatus
1099 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1100 HANDLE32 handle
= stack
[0];
1101 DWORD
*id
= (DWORD
*)W32S_APP2WINE(stack
[1], W32S_OFFSET
);
1103 TRACE(vxd
, "NtCloseSection(%lx, %lx)\n", (DWORD
)handle
, (DWORD
)id
);
1105 CloseHandle(handle
);
1106 if (id
) *id
= 0; /* FIXME */
1108 EAX_reg(context
) = STATUS_SUCCESS
;
1113 case 0x0010: /* NtDupSection */
1115 * Input: EDX: Flat address of arguments on stack
1117 * HANDLE32 handle [in] Handle of Section to duplicate
1119 * Output: EAX: NtStatus
1122 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1123 HANDLE32 handle
= stack
[0];
1125 TRACE(vxd
, "NtDupSection(%lx)\n", (DWORD
)handle
);
1127 /* Handle is 'duplicated' by incrementing RefCount */
1128 HANDLE_GetObjPtr(PROCESS_Current(), handle
, K32OBJ_MEM_MAPPED_FILE
, 0,NULL
);
1130 EAX_reg(context
) = STATUS_SUCCESS
;
1135 case 0x0011: /* NtMapViewOfSection */
1137 * Input: EDX: Flat address of arguments on stack
1139 * HANDLE32 SectionHandle [in] Section to be mapped
1140 * DWORD ProcessHandle [in] Process to be mapped into
1141 * DWORD * BaseAddress [in/out] Address to be mapped at
1142 * DWORD ZeroBits [in] (?? unclear ??)
1143 * DWORD CommitSize [in] (?? unclear ??)
1144 * LARGE_INTEGER *SectionOffset [in] Offset within section
1145 * DWORD * ViewSize [in] Size of view
1146 * DWORD InheritDisposition [in] (?? unclear ??)
1147 * DWORD AllocationType [in] (?? unclear ??)
1148 * DWORD Protect [in] Access protection
1150 * Output: EAX: NtStatus
1153 DWORD
* stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1154 HANDLE32 SectionHandle
= stack
[0];
1155 DWORD ProcessHandle
= stack
[1]; /* ignored */
1156 DWORD
* BaseAddress
= (DWORD
*)W32S_APP2WINE(stack
[2], W32S_OFFSET
);
1157 DWORD ZeroBits
= stack
[3];
1158 DWORD CommitSize
= stack
[4];
1159 LARGE_INTEGER
*SectionOffset
= (LARGE_INTEGER
*)W32S_APP2WINE(stack
[5], W32S_OFFSET
);
1160 DWORD
* ViewSize
= (DWORD
*)W32S_APP2WINE(stack
[6], W32S_OFFSET
);
1161 DWORD InheritDisposition
= stack
[7];
1162 DWORD AllocationType
= stack
[8];
1163 DWORD Protect
= stack
[9];
1165 LPBYTE address
= (LPBYTE
)(BaseAddress
?
1166 W32S_APP2WINE(*BaseAddress
, W32S_OFFSET
) : 0);
1167 DWORD access
= 0, result
;
1169 switch (Protect
& ~(PAGE_GUARD
|PAGE_NOCACHE
))
1171 case PAGE_READONLY
: access
= FILE_MAP_READ
; break;
1172 case PAGE_READWRITE
: access
= FILE_MAP_WRITE
; break;
1173 case PAGE_WRITECOPY
: access
= FILE_MAP_COPY
; break;
1175 case PAGE_EXECUTE_READ
: access
= FILE_MAP_READ
; break;
1176 case PAGE_EXECUTE_READWRITE
: access
= FILE_MAP_WRITE
; break;
1177 case PAGE_EXECUTE_WRITECOPY
: access
= FILE_MAP_COPY
; break;
1180 TRACE(vxd
, "NtMapViewOfSection"
1181 "(%lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx, %lx)\n",
1182 (DWORD
)SectionHandle
, ProcessHandle
, (DWORD
)BaseAddress
,
1183 ZeroBits
, CommitSize
, (DWORD
)SectionOffset
, (DWORD
)ViewSize
,
1184 InheritDisposition
, AllocationType
, Protect
);
1185 TRACE(vxd
, "NtMapViewOfSection: "
1186 "base=%lx, offset=%lx, size=%lx, access=%lx\n",
1187 (DWORD
)address
, SectionOffset
? SectionOffset
->LowPart
: 0,
1188 ViewSize
? *ViewSize
: 0, access
);
1190 result
= (DWORD
)MapViewOfFileEx(SectionHandle
, access
,
1191 SectionOffset
? SectionOffset
->HighPart
: 0,
1192 SectionOffset
? SectionOffset
->LowPart
: 0,
1193 ViewSize
? *ViewSize
: 0, address
);
1195 TRACE(vxd
, "NtMapViewOfSection: result=%lx\n", result
);
1197 if (W32S_WINE2APP(result
, W32S_OFFSET
))
1199 if (BaseAddress
) *BaseAddress
= W32S_WINE2APP(result
, W32S_OFFSET
);
1200 EAX_reg(context
) = STATUS_SUCCESS
;
1203 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1208 case 0x0012: /* NtUnmapViewOfSection */
1210 * Input: EDX: Flat address of arguments on stack
1212 * DWORD ProcessHandle [in] Process (defining address space)
1213 * LPBYTE BaseAddress [in] Base address of view to be unmapped
1215 * Output: EAX: NtStatus
1218 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1219 DWORD ProcessHandle
= stack
[0]; /* ignored */
1220 LPBYTE BaseAddress
= (LPBYTE
)W32S_APP2WINE(stack
[1], W32S_OFFSET
);
1222 TRACE(vxd
, "NtUnmapViewOfSection(%lx, %lx)\n",
1223 ProcessHandle
, (DWORD
)BaseAddress
);
1225 UnmapViewOfFile(BaseAddress
);
1227 EAX_reg(context
) = STATUS_SUCCESS
;
1232 case 0x0013: /* NtFlushVirtualMemory */
1234 * Input: EDX: Flat address of arguments on stack
1236 * DWORD ProcessHandle [in] Process (defining address space)
1237 * LPBYTE *BaseAddress [in?] Base address of range to be flushed
1238 * DWORD *ViewSize [in?] Number of bytes to be flushed
1239 * DWORD *unknown [???] (?? unknown ??)
1241 * Output: EAX: NtStatus
1244 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1245 DWORD ProcessHandle
= stack
[0]; /* ignored */
1246 DWORD
*BaseAddress
= (DWORD
*)W32S_APP2WINE(stack
[1], W32S_OFFSET
);
1247 DWORD
*ViewSize
= (DWORD
*)W32S_APP2WINE(stack
[2], W32S_OFFSET
);
1248 DWORD
*unknown
= (DWORD
*)W32S_APP2WINE(stack
[3], W32S_OFFSET
);
1250 LPBYTE address
= (LPBYTE
)(BaseAddress
? W32S_APP2WINE(*BaseAddress
, W32S_OFFSET
) : 0);
1251 DWORD size
= ViewSize
? *ViewSize
: 0;
1253 TRACE(vxd
, "NtFlushVirtualMemory(%lx, %lx, %lx, %lx)\n",
1254 ProcessHandle
, (DWORD
)BaseAddress
, (DWORD
)ViewSize
,
1256 TRACE(vxd
, "NtFlushVirtualMemory: base=%lx, size=%lx\n",
1257 (DWORD
)address
, size
);
1259 FlushViewOfFile(address
, size
);
1261 EAX_reg(context
) = STATUS_SUCCESS
;
1266 case 0x0014: /* Get/Set Debug Registers */
1268 * Input: ECX: 0 if Get, 1 if Set
1270 * EDX: Get: Flat address of buffer to receive values of
1271 * debug registers DR0 .. DR7
1272 * Set: Flat address of buffer containing values of
1273 * debug registers DR0 .. DR7 to be set
1277 FIXME(vxd
, "[0014] ECX=%lx EDX=%lx\n",
1278 ECX_reg(context
), EDX_reg(context
));
1284 case 0x0015: /* Set Coprocessor Emulation Flag */
1286 * Input: EDX: 0 to deactivate, 1 to activate coprocessor emulation
1291 TRACE(vxd
, "[0015] EDX=%lx\n", EDX_reg(context
));
1293 /* We don't care, as we always have a coprocessor anyway */
1297 case 0x0016: /* Init Win32S VxD PSP */
1299 * If called to query required PSP size:
1302 * Output: EDX: Required size of Win32s VxD PSP
1304 * If called to initialize allocated PSP:
1306 * Input: EBX: LoWord: Selector of Win32s VxD PSP
1307 * HiWord: Paragraph of Win32s VxD PSP (DOSMEM)
1311 if (EBX_reg(context
) == 0)
1312 EDX_reg(context
) = 0x80;
1315 PDB
*psp
= PTR_SEG_OFF_TO_LIN(BX_reg(context
), 0);
1317 psp
->fileHandlesPtr
= MAKELONG(HIWORD(EBX_reg(context
)), 0x5c);
1318 memset((LPBYTE
)psp
+ 0x5c, '\xFF', 32);
1323 case 0x0017: /* Set Break Point */
1325 * Input: EBX: Offset of Break Point
1326 * CX: Selector of Break Point
1331 FIXME(vxd
, "[0017] EBX=%lx CX=%x\n",
1332 EBX_reg(context
), CX_reg(context
));
1338 case 0x0018: /* VirtualLock */
1340 * Input: ECX: Current Process
1342 * EDX: Flat address of arguments on stack
1344 * DWORD *retv [out] TRUE if success, FALSE if failure
1345 * LPVOID base [in] Flat address of range to lock
1346 * DWORD size [in] Size of range
1348 * Output: EAX: NtStatus
1351 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1352 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1353 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
1354 DWORD size
= stack
[2];
1357 TRACE(vxd
, "VirtualLock(%lx, %lx, %lx)\n",
1358 (DWORD
)retv
, (DWORD
)base
, size
);
1360 result
= VirtualLock(base
, size
);
1364 EAX_reg(context
) = STATUS_SUCCESS
;
1367 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1372 case 0x0019: /* VirtualUnlock */
1374 * Input: ECX: Current Process
1376 * EDX: Flat address of arguments on stack
1378 * DWORD *retv [out] TRUE if success, FALSE if failure
1379 * LPVOID base [in] Flat address of range to unlock
1380 * DWORD size [in] Size of range
1382 * Output: EAX: NtStatus
1385 DWORD
*stack
= (DWORD
*)W32S_APP2WINE(EDX_reg(context
), W32S_OFFSET
);
1386 DWORD
*retv
= (DWORD
*)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1387 LPVOID base
= (LPVOID
) W32S_APP2WINE(stack
[1], W32S_OFFSET
);
1388 DWORD size
= stack
[2];
1391 TRACE(vxd
, "VirtualUnlock(%lx, %lx, %lx)\n",
1392 (DWORD
)retv
, (DWORD
)base
, size
);
1394 result
= VirtualUnlock(base
, size
);
1398 EAX_reg(context
) = STATUS_SUCCESS
;
1401 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1406 case 0x001A: /* KGetSystemInfo */
1410 * Output: ECX: Start of sparse memory arena
1411 * EDX: End of sparse memory arena
1414 TRACE(vxd
, "KGetSystemInfo()\n");
1417 * Note: Win32s reserves 0GB - 2GB for Win 3.1 and uses 2GB - 4GB as
1418 * sparse memory arena. We do it the other way around, since
1419 * we have to reserve 3GB - 4GB for Linux, and thus use
1420 * 0GB - 3GB as sparse memory arena.
1422 * FIXME: What about other OSes ?
1425 ECX_reg(context
) = W32S_WINE2APP(0x00000000, W32S_OFFSET
);
1426 EDX_reg(context
) = W32S_WINE2APP(0xbfffffff, W32S_OFFSET
);
1430 case 0x001B: /* KGlobalMemStat */
1432 * Input: ESI: Flat address of buffer to receive memory info
1437 struct Win32sMemoryInfo
1439 DWORD DIPhys_Count
; /* Total physical pages */
1440 DWORD DIFree_Count
; /* Free physical pages */
1441 DWORD DILin_Total_Count
; /* Total virtual pages (private arena) */
1442 DWORD DILin_Total_Free
; /* Free virtual pages (private arena) */
1444 DWORD SparseTotal
; /* Total size of sparse arena (bytes ?) */
1445 DWORD SparseFree
; /* Free size of sparse arena (bytes ?) */
1448 struct Win32sMemoryInfo
*info
=
1449 (struct Win32sMemoryInfo
*)W32S_APP2WINE(ESI_reg(context
), W32S_OFFSET
);
1451 FIXME(vxd
, "KGlobalMemStat(%lx)\n", (DWORD
)info
);
1458 case 0x001C: /* Enable/Disable Exceptions */
1460 * Input: ECX: 0 to disable, 1 to enable exception handling
1465 TRACE(vxd
, "[001c] ECX=%lx\n", ECX_reg(context
));
1471 case 0x001D: /* VirtualAlloc called from 16-bit code */
1473 * Input: EDX: Segmented address of arguments on stack
1475 * LPVOID base [in] Flat address of region to reserve/commit
1476 * DWORD size [in] Size of region
1477 * DWORD type [in] Type of allocation
1478 * DWORD prot [in] Type of access protection
1480 * Output: EAX: NtStatus
1481 * EDX: Flat base address of allocated region
1484 DWORD
*stack
= PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context
)),
1485 HIWORD(EDX_reg(context
)));
1486 LPVOID base
= (LPVOID
)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1487 DWORD size
= stack
[1];
1488 DWORD type
= stack
[2];
1489 DWORD prot
= stack
[3];
1492 TRACE(vxd
, "VirtualAlloc16(%lx, %lx, %lx, %lx)\n",
1493 (DWORD
)base
, size
, type
, prot
);
1495 if (type
& 0x80000000)
1497 WARN(vxd
, "VirtualAlloc16: strange type %lx\n", type
);
1501 result
= (DWORD
)VirtualAlloc(base
, size
, type
, prot
);
1503 if (W32S_WINE2APP(result
, W32S_OFFSET
))
1504 EDX_reg(context
) = W32S_WINE2APP(result
, W32S_OFFSET
),
1505 EAX_reg(context
) = STATUS_SUCCESS
;
1507 EDX_reg(context
) = 0,
1508 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1509 TRACE(vxd
, "VirtualAlloc16: returning base %lx\n", EDX_reg(context
));
1514 case 0x001E: /* VirtualFree called from 16-bit code */
1516 * Input: EDX: Segmented address of arguments on stack
1518 * LPVOID base [in] Flat address of region
1519 * DWORD size [in] Size of region
1520 * DWORD type [in] Type of operation
1522 * Output: EAX: NtStatus
1523 * EDX: TRUE if success, FALSE if failure
1526 DWORD
*stack
= PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context
)),
1527 HIWORD(EDX_reg(context
)));
1528 LPVOID base
= (LPVOID
)W32S_APP2WINE(stack
[0], W32S_OFFSET
);
1529 DWORD size
= stack
[1];
1530 DWORD type
= stack
[2];
1533 TRACE(vxd
, "VirtualFree16(%lx, %lx, %lx)\n",
1534 (DWORD
)base
, size
, type
);
1536 result
= VirtualFree(base
, size
, type
);
1539 EDX_reg(context
) = TRUE
,
1540 EAX_reg(context
) = STATUS_SUCCESS
;
1542 EDX_reg(context
) = FALSE
,
1543 EAX_reg(context
) = STATUS_NO_MEMORY
; /* FIXME */
1548 case 0x001F: /* FWorkingSetSize */
1550 * Input: EDX: 0 if Get, 1 if Set
1552 * ECX: Get: Buffer to receive Working Set Size
1553 * Set: Buffer containing Working Set Size
1558 DWORD
*ptr
= (DWORD
*)W32S_APP2WINE(ECX_reg(context
), W32S_OFFSET
);
1559 BOOL32 set
= EDX_reg(context
);
1561 TRACE(vxd
, "FWorkingSetSize(%lx, %lx)\n", (DWORD
)ptr
, (DWORD
)set
);
1564 /* We do it differently ... */;
1568 EAX_reg(context
) = STATUS_SUCCESS
;
1574 VXD_BARF( context
, "W32S" );