MSDRIVER


MSDRIVER .

, , 3.5.

3.5. msdriver\handler.asm

;**

;.Name ms_handl

;.Title

;

;.Descr ,

; -

; .

;

; , .

;



;.Proto void far ms_handl(void);

;

;.Params

;**

DOSSEG

DGROUP GROUP _DATA

_DATA SEGMENT WORD PUBLIC 'DATA'

_DATA ENDS

_TEXT SEGMENT WORD PUBLIC 'CODE'

ASSUME cs:_TEXT, ds:DGROUP, ss:DGROUP

;

extrn _ms_flag:word

;

extrn _ms_bx:word

extrn _ms_cx:word

extrn _ms_dx:word

extrn _ms_si:word

extrn _ms_di:word

extrn _ms_ds:word

public _ms_handl

_ms_handl proc far

mov _ms_ds, ds

; DS

; ,

; ;

push ax

mov ax, DGROUP

mov ds, ax

pop ax

mov _ms_bx, bx

mov _ms_cx, cx

mov _ms_dx, dx

mov _ms_si, si

mov _ms_di, di

; 1,

; , .

mov _ms_flag, 1

ret

_ms_handl endp

_TEXT ENDS

END

_ms_flag , .

, _ms_flag, - (, ), _ms_flag.
- ( , ) . , _ms_bx, _ms_dx, ..

MSDRIVER 3.6.

3.6. msdriver\msdriver.

// =====================================================

//

//

// (C) ., 1997

//

// E-mail: frolov@glas.apc.org

// WWW: http://www.glasnet.ru/~frolov

//

// http://www.dials.ccas.ru/frolov

// =====================================================

#include <dos.h>

#include <stdio.h>

#include <conio.h>

union REGS reg;

struct SREGS segregs;

extern void far MS_HANDL(void);

void ms_seth(int mask, void (far *hand)());

// .

// 1

unsigned MS_FLAG;

//

// .

unsigned MS_BX;

unsigned MS_CX;

unsigned MS_DX;

unsigned MS_SI;

unsigned MS_DI;

unsigned MS_DS;

int main (void)

{

MS_FLAG=0;

//

reg.x.ax = 0;

int86(0x33, &reg, &reg);



if(reg.x.bx == 0)

{

printf("Mouse not found\n");

return -1;

}

// ,

// ,

//

ms_seth(2 | 8, MS_HANDL);

//

reg.x.ax = 1;

int86(0x33, &reg, &reg);

// .

for(;;)

{

if(MS_FLAG)

{

printf("\nRegisters on driver entry:"

"\nms_bx: %0X"

"\nms_cx: %0X"

"\nms_dx: %0X"

"\nms_si: %0X"

"\nms_di: %0X"

"\nms_ds: %0X",

MS_BX, MS_CX, MS_DX, MS_SI, MS_DI, MS_DS);

printf("\nPress any key...");

getch();

return 0;

}

}

}

void ms_seth(int mask, void (far *hand)())

{

reg.x.ax = 0x14;

reg.x.cx = mask;

reg.x.dx = FP_OFF(hand);

segregs.es = FP_SEG(hand);

int86x(0x33,&reg,&reg,&segregs);

}










Forekc.ru
, , , , , , , , , ,