예제 #1
0
void win16_probe_for_wine() { /* Probing for WINE from the Win16 layer */
	DWORD callw,retv;

	if (!genthunk32_init()) return;
	if (genthunk32w_ntdll == 0) return;

	callw = __GetProcAddress32W(genthunk32w_ntdll,"wine_get_version");
	if (callw == 0) return;

	retv = __CallProcEx32W(CPEX_DEST_STDCALL/*nothing to convert*/,0/*0 param*/,callw);
	if (retv == 0) return;

	windows_emulation = WINEMU_WINE;
	{
		/* NTS: We assume that WINE, just like real Windows, will not move or relocate
		 *      NTDLL.DLL and will not move the string it just returned. */
		/* TODO: You need a function the host program can call to free the selector
		 *       you allocated here, in case it wants to reclaim resources */
		uint16_t sel;
		uint16_t myds=0;
		__asm mov myds,ds
		sel = AllocSelector(myds);
		if (sel != 0) {
			/* the selector is directed at the string, then retained in this
			 * code as a direct FAR pointer to WINE's version string */
			SetSelectorBase(sel,retv);
			SetSelectorLimit(sel,0xFFF);	/* WINE's version string is rarely longer than 14 chars */
			windows_emulation_comment_str = MK_FP(sel,0);
		}
	}
}
예제 #2
0
void
_86_SetSelectorLimit (ENV *envp,LONGPROC f)
{
    UINT uSel;
    DWORD dwLimit;

    uSel = (UINT)GETWORD(SP+8);
    dwLimit = GETDWORD(SP+4);
    SetSelectorLimit(uSel,dwLimit);
    envp->reg.ax = 0;
    envp->reg.dx = 0;
    envp->reg.sp += UINT_86 + DWORD_86 + RET_86;
}