Windows


Windows - 3


/* LIBENTRY.ASM */

#pragma alloc_text(FIXED_TEXT,WEP)

 

HANDLE hLibInstance ;

FARPROC lpfnPrevISR ; /* ISR*/

DWORD lpfnPrevRMISR ;

/* ISR */

HANDLE hReflector ;

 

DWORD DPMI_AllocateRMCallback(FARPROC lpfnCallback,

_RMCS FAR *lpRMCS)

{

DWORD dwRet ;

_asm {

push ds

lds si,lpfnCallback

les di,lpRMCS

mov ax,DPMI_ALLOCRMC

int IVEC_DPMI

pop ds

jc lbl1

mov word ptr dwRet,dx ;

mov word ptr dwRet+2,cx

jmp short lbl2

lbl1:

mov word ptr dwRet,ax ; ax

mov word ptr dwRet+2,0 ; seg=0,

lbl2:

}

 

return dwRet ;

}

 

DWORD DPMI_FreeRMCallback(FARPROC lpfnCallback)

{

DWORD wRet ;

 

_asm {

mov dx,word ptr lpfnCallback

mov cx,word ptr lpfnCallback+2

mov ax,DPMI_FREERMC

int IVEC_DPMI

jc lbl1

xor ax,ax

lbl1:

mov wRet,ax

}

return wRet ;

}

 

DWORD DPMI_GetRMVector(int iVector)

{

DWORD dwRet ;

_asm {

mov ax,DPMI_GETRMVEC

mov bl,byte ptr iVector

int 31h

mov word ptr dwRet,dx

mov word ptr dwRet+2,cx

}

return dwRet ;

}

 

void DPMI_SetRMVector(int iVector, DWORD lpfnRMISR)

{

_asm {

mov ax,DPMI_SETRMVEC

mov bl,byte ptr iVector

mov dx,word ptr lpfnRMISR

mov cx,word ptr lpfnRMISR+2

int 31h

}

}

 

FARPROC GetPMVector(int iVector)

{

FARPROC dwRet ;

_asm {

mov bl,byte ptr iVector

mov ah,35h

int 21h

mov word ptr dwRet,bx

mov word ptr dwRet+2,es ;

}

return dwRet ;

}

 

void SetPMVector(int iVector, FARPROC lpfnISR)

{

_asm {

push ds

lds dx,lpfnISR

mov al,byte ptr iVector

mov ah,25h




- -  - -  - -