home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
APR94_2.ZIP
/
LISTDVCB
/
VMCBSPY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-01
|
2KB
|
82 lines
/*
VMCBSPY.C
From Dr. Dobbs Journal, April 1994
Klaus Mueller 1994, All Rights Reserved.
*/
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <alloc.h>
#include <listdvcb.h>
VMCB_Hook_Struc far *VMCB_Buf;
long int i, VMCB_Buf_Size;
/* Get entry point for the VxD API using Int 2Fh AX=1684h */
typedef void (far *api_entry)(void);
api_entry get_vxd_api(int vxd_id)
{
asm {
push es
push di
mov ax,1684h
mov bx,vxd_id
mov di,0
mov es,di
int 2fh
mov ax,di
mov dx,es
pop di
pop es
}
}
void main(int argc, char *argv[])
{
static api_entry api = NULL;
api = get_vxd_api(ListDVCB_ID);
if (api == 0)
{
printf("Error: ListDVCB.386 not loaded.");
exit(1);
}
asm { mov bx,offset VMCB_Buf_Size
mov ax,Hook_Buf_Size /* Determine size of VMCB buffer */
}
(*api)(); /* Call V86API of ListInst.386 */
if ( (VMCB_Buf=malloc(VMCB_Buf_Size)) == 0)
{
printf("Memory allocation error");
exit (1);
};
printf("\nVMCBSPY - Dumps the VxD specific data in the Virtual");
printf(" Machine Control Block.\n");
printf("Copyright Klaus Mueller 1994, All Rights Reserved.\n");
printf("\nCalling ListDVCB.386 ... \n");
asm { mov dx,offset VMCB_Buf
mov ax,Copy_Hook_Data /* Request VMCB map */
}
(*api)(); /* Call V86API of ListDVCB.386 */
asm jnc cbok
printf("Error: Cannot create VMCB map.");
exit(1);
cbok: /* Print received VxD data */
printf("\nV86 API from ListDVCB.386: Result of _Allocate_Device_CB_Area");
printf(" Hook.\n");
printf("\nName of VxD\t\t\t\tOffset in VMCB\t\tSize\n");
for ( i=0; i < VMCB_Buf_Size/sizeof(VMCB_Hook_Struc); i++)
printf("\n%s\t0x%08lX\t\t0x%08lX", &VMCB_Buf[i].caller_string, \
VMCB_Buf[i].VMCB_Hook.VMCB_Offset, VMCB_Buf[i].VMCB_Hook.VMCB_Len);
}