Click here to Skip to main content
15,881,588 members
Articles / Programming Languages / C++

The Ultimate Process/Thread spy for Windows 9x.

Rate me:
Please Sign up or sign in to vote.
4.44/5 (9 votes)
27 Mar 20033 min read 106.1K   1K   26  
Process/thread creation/destruction detector for Windows 9x .
///////////////////////////////////////////////////////////////////////
// vdmad.h
//
// Wrapper prototypes and defines for VDMAD services.
//
// Tetradyne VxBuild.
//
// Copyright (C) 1997, Tetradyne Software Inc.
// All rights reserved.

#ifndef VDMAD_H
#define VDMAD_H

#define Function_Mask	0x0F0
#define Channel_Mask	0x07

// mode bits

#define DMA_type_verify 0x0000
#define DMA_type_write	0x0004
#define DMA_type_read	0x0008
#define DMA_AutoInit	0x0010
#define DMA_AdrDec		0x0020

#define DMA_demand_mode	0x00
#define DMA_single_mode 0x40
#define DMA_block_mode	0x80
#define DMA_cascade		0xc0

#define DMA_mode_mask	0xc0 // mask to isolate controller mode bits (above)
#define DMA_chan_sel	0x03

// state flag bits (overlay the unused channel selection bits)
#define DMA_masked		0x01
#define DMA_masked_bit	0x00
#define DMA_requested	0x02
#define DMA_req_bit		0x01

// extended mode bits
#define Programmed_IO	0x01
#define PS2_AutoInit	0x02
#define Transfer_Data	0x04
#define Write_Mem		0x08
#define _16_bit_xfer	0x40
#define _16_bit_xfer_bit 0x06

typedef struct
{
	DWORD physAddr;
	DWORD size;
} REGION;

typedef struct Extended_DDS_Struc
{
	DWORD DDS_size;
	DWORD DDS_linear;
	WORD DDS_seg;
	WORD DDS_reserved;
	WORD DDS_avail;
	WORD DDS_used;

} EXTENDED_DDS, *PEXTENDED_DDS;

typedef struct
{
	EXTENDED_DDS dds;
	union
	{
		REGION regionInfo[1];
		DWORD pte[1];
	};
} DDS, *PDDS;

typedef DWORD HDMA;

#define DMA_Buf_Copy		0x02
#define DMA_Buf_Copy_bit	0x01
#define DMA_No_Alloc_Buf	0x04
#define DMA_No_Alloc_Buf_bit 0x02
#define DMA_Align_64K		0x10
#define DMA_Align_64K_bit	0x04
#define DMA_Align_128K		0x20
#define DMA_Align_128K_bit	0x05
#define DMA_Get_PgTable		0x40
#define DMA_Get_PgTable_bit	0x06
#define DMA_Allow_NPs		0x80
#define DMA_Allow_NPs_bit	0x07

#define DMA_Not_Contiguous		0x01
#define DMA_Not_Aligned			0x02
#define DMA_Lock_Failed			0x03
#define DMA_No_Buffer			0x04
#define DMA_Buffer_Too_Small	0x05
#define DMA_Buffer_In_Use		0x06
#define DMA_Invalid_Region		0x07
#define DMA_Region_Not_Locked	0x08
#define DMA_Table_Too_Small		0x09
#define DMA_Invalid_Buffer		0x0A
#define DMA_Copy_Out_Range		0x0B
#define DMA_Invalid_Channel		0x0C
#define DMA_Disable_Cnt_Overflow	0x0D
#define DMA_Disable_Cnt_Underflow	0x0E
#define DMA_Func_Not_Supported		0x0F
#define DMA_NonZero_Reserved_Flags	0x10

// Flags definitions for VDMAD_Scatter_Lock and VDMAD_Scatter_Unlock

#define DMA_SL_Get_PgTable		0x01
#define DMA_SL_Get_PgTable_bit	0x00
#define DMA_SL_Allow_NPs		0x02
#define DMA_SL_Allow_NPs_bit	0x01
#define DMA_SL_Dont_Dirty		0x04
#define DMA_SL_Dont_Dirty_bit	0x02

#define VDMAD_Callbacks_ReadNotify  0x01
#define VDMAD_Callbacks_Valid       0x01

#define VDMAD_Callback_ReadCount    0x01
#define VDMAD_Callback_ReadPage     0x02
#define VDMAD_Callback_ReadBase     0x03

// VDMAD wrappers in vxbuild.clb

MAKE_HEADER(BOOL,_stdcall,VDMAD_Copy_From_Buffer,(ULONG nBufferID, PVOID pRegion, ULONG nBufferOffset, ULONG nBufferSize, PULONG pnError))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Copy_To_Buffer,(ULONG nBufferID, ULONG nRegion, ULONG nBufferOffset, ULONG nBufferSize, PULONG pnError))
MAKE_HEADER(void,_stdcall,VDMAD_Default_Handler,(HDMA hDMA, HVM hVM))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Disable_Translation,(HDMA hDMA, HVM hVM))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Enable_Translation,(HDMA hDMA, HVM hVM))
MAKE_HEADER(ULONG,_stdcall,VDMAD_Get_EISA_Adr_Mode,(ULONG nChannel, HDMA hDMA))
MAKE_HEADER(void,_stdcall,VDMAD_Get_Region_Info,(HDMA hDMA, PULONG pnBufferID, PBOOL pbLocked, PVOID* ppRegion, PULONG pnSize))
MAKE_HEADER(void,_stdcall,VDMAD_Get_Virt_State,(HDMA hDMA, HVM hVM, PVOID* ppAddress, PULONG pnCount, PULONG pnMode))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Lock_DMA_Region,(PVOID pRegion, ULONG nRegionSize, ULONG nAlignment, PULONG pnAddress, PULONG pnCount, PULONG pnError))
MAKE_HEADER(void,_stdcall,VDMAD_Mask_Channel,(HDMA hDMA))
MAKE_HEADER(void,_stdcall,VDMAD_Phys_Mask_Channel,(HDMA hDMA))
MAKE_HEADER(void,_stdcall,VDMAD_Phys_Unmask_Channel,(HDMA hDMA, HVM hVM))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Release_Buffer,(ULONG nBuffer))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Request_Buffer,(HDMA hDMA, ULONG RegionSize, PULONG pnID, PVOID* ppBuf, PULONG pnError))
MAKE_HEADER(void,_stdcall,VDMAD_Reserve_Buffer_Space,(ULONG PageCount, ULONG MaxAddress))
MAKE_HEADER(ULONG,_stdcall,VDMAD_Scatter_Lock,(HVM hVM, ULONG fFlags, ULONG DDS))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Scatter_Unlock,(HVM hVM, ULONG fFlags, ULONG DDS))
MAKE_HEADER(void,_stdcall,VDMAD_Set_EISA_Adr_Mode,(ULONG Channel, HDMA hDMA, ULONG nMode))
MAKE_HEADER(void,_stdcall,VDMAD_Set_IO_Address,(ULONG nChannel_Number, ULONG nPort_Number))
MAKE_HEADER(void,_stdcall,VDMAD_Set_Phys_State,(HDMA hDMA, HVM hVM, \
		ULONG fMode, ULONG fExtMode))
MAKE_HEADER(void,_stdcall,VDMAD_Set_Region_Info,(HDMA hDMA, ULONG nBufferID, \
		BOOL bLockStatus, ULONG nRegion, ULONG nRegionSize, ULONG physAddr))
MAKE_HEADER(void,_stdcall,VDMAD_Set_Virt_State,(HDMA hDMA, HVM hVM, ULONG nAddress, ULONG nSize, ULONG nMode, ULONG nExtMode))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Unlock_DMA_Region,(ULONG nDMA_Region, ULONG nSize))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Unlock_DMA_Region_No_Dirty,(ULONG nDMA_Region, ULONG nSize))
MAKE_HEADER(void,_stdcall,VDMAD_UnMask_Channel,(HDMA hDMA, HVM hVM))
MAKE_HEADER(BOOL,_stdcall,VDMAD_Unvirtualize_Channel,(HDMA hChannel))
MAKE_HEADER(HDMA,_stdcall,VDMAD_Virtualize_Channel,(ULONG nChannel,
		ULONG pfnCallback))

#define VDMAD_Copy_From_Buffer      PREPEND(VDMAD_Copy_From_Buffer)
#define VDMAD_Copy_To_Buffer		PREPEND(VDMAD_Copy_To_Buffer)
#define VDMAD_Default_Handler       PREPEND(VDMAD_Default_Handler)
#define VDMAD_Disable_Translation   PREPEND(VDMAD_Disable_Translation)
#define VDMAD_Enable_Translation	PREPEND(VDMAD_Enable_Translation)
#define VDMAD_Get_EISA_Adr_Mode		PREPEND(VDMAD_Get_EISA_Adr_Mode)
#define VDMAD_Get_Region_Info		PREPEND(VDMAD_Get_Region_Info)
#define VDMAD_Get_Virt_State		PREPEND(VDMAD_Get_Virt_State)
#define VDMAD_Lock_DMA_Region		PREPEND(VDMAD_Lock_DMA_Region)
#define VDMAD_Mask_Channel			PREPEND(VDMAD_Mask_Channel)
#define VDMAD_Phys_Mask_Channel		PREPEND(VDMAD_Phys_Mask_Channel)
#define VDMAD_Phys_Unmask_Channel   PREPEND(VDMAD_Phys_Unmask_Channel)
#define VDMAD_Release_Buffer		PREPEND(VDMAD_Release_Buffer)
#define VDMAD_Request_Buffer		PREPEND(VDMAD_Request_Buffer)
#define VDMAD_Reserve_Buffer_Space	PREPEND(VDMAD_Reserve_Buffer_Space)
#define VDMAD_Scatter_Lock			PREPEND(VDMAD_Scatter_Lock)
#define VDMAD_Scatter_Unlock		PREPEND(VDMAD_Scatter_Unlock)
#define VDMAD_Set_EISA_Adr_Mode		PREPEND(VDMAD_Set_EISA_Adr_Mode)
#define VDMAD_Set_IO_Address		PREPEND(VDMAD_Set_IO_Address)
#define VDMAD_Set_Phys_State        PREPEND(VDMAD_Set_Phys_State)
#define VDMAD_Set_Region_Info       PREPEND(VDMAD_Set_Region_Info)
#define VDMAD_Set_Virt_State		PREPEND(VDMAD_Set_Virt_State)
#define VDMAD_Unlock_DMA_Region		PREPEND(VDMAD_Unlock_DMA_Region)
#define VDMAD_Unlock_DMA_Region_No_Dirty	PREPEND(VDMAD_Unlock_DMA_Region_No_Dirty)
#define VDMAD_UnMask_Channel		PREPEND(VDMAD_UnMask_Channel)
#define VDMAD_Unvirtualize_Channel  PREPEND(VDMAD_Unvirtualize_Channel)
#define VDMAD_Virtualize_Channel    PREPEND(VDMAD_Virtualize_Channel)

#endif // ifndef VDMAD_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions