minivdd.h
来自「用于查询PC机上的USB端口是否有设备挂接上」· C头文件 代码 · 共 1,208 行 · 第 1/3 页
H
1,208 行
//
//
// VDD_DRIVER_UNREGISTER
//
// Entry:
// Client_EBX device handle, or device id (1-N)
// Exit:
//
//
// VDD_ENABLE
//
// entry:
// Client_EAX - VDD_ENABLE (0x008B)
// Client_EBX - device handle
// Client_EDX - enable flags (see below)
//
// exit:
// Client_EAX - previous enable state.
//
// only one device at a time can have VGAMEM, VGAIO, or ROM access
// at a time.
//
#define ENABLE_IO 0x00000001 // enable IO.
#define ENABLE_MEM 0x00000002 // enable memory.
#define ENABLE_VGA 0x00000030 // enable VGA
#define ENABLE_ROM 0x00000080 // enable ROM at C000.
#define ENABLE_ALL 0x000000FF // enable all access to this device
#define ENABLE_NONE 0x00000000 // disable device.
#define ENABLE_VALID 0x000000FF // valid flags.
#define ENABLE_ERROR 0xFFFFFFFF // enable fail code
//
// VDD_OPEN
//
// open a device given a name
//
// Entry:
// Client_ES:EDI - device name
// Client_EDX - flags
// Client_EBX - device id (only for VDD_OPEN_ENUM)
// Exit:
// Client_EAX - device handle
//
#define VDD_OPEN_EXIST 0x00000001 // check if the device name is valid
#define VDD_OPEN_ENUM 0x00000002 // return the Nth device
#define VDD_OPEN_LOCK 0x00000000 // lock the device (default)
#define VDD_OPEN_TEST VDD_OPEN_EXIST
//
// VDD_OPEN_KEY
//
// opens the setting key in the registry for the given device
// the caller must close the key when done.
//
// Entry:
// Client_ES:EDI - points to place to store the opened registry key
// Client_ECX - must be 4, ie sizeof(HKEY)
// Client_EDX - flags
// Client_EBX - device handle
// Exit:
// Client_EAX - 0 for success, or Win32 error code
//
#define VDD_OPEN_KEY_WRITE 0x00000001 // will be writing settings
#define VDD_OPEN_KEY_READ 0x00000002 // only gonig to read settings
#define VDD_OPEN_KEY_USER 0x00000010 // open the per user settings
#define VDD_OPEN_KEY_GLOBAL 0x00000020 // open the global (not per user) settings
//
// WIN32 IOCTLS
//
// The following defines are used with the Win32 function DeviceIOControl
//
#define VDD_IOCTL_SET_NOTIFY 0x10000001 // set mode change notify
#define VDD_IOCTL_GET_DDHAL 0x10000002 // get DDHAL functions from miniVDD
#define VDD_IOCTL_COPY_PROTECTION 0x10000003 // copy protection enable/disable
#define VDD_IOCTL_I2C_OPEN 0x10000004 // open i2c port for access
#define VDD_IOCTL_I2C_ACCESS 0x10000005 // read/write interface
//
// VDD_IOCTL_SET_NOTIFY
//
// sets a notification function that will be called when events
// happen on the device.
//
// input:
// NotifyMask - bitfield of events
//
// VDD_NOTIFY_START_MODE_CHANGE - start of mode change in sysVM
// VDD_NOTIFY_END_MODE_CHANGE - end of mode change in sysVM
// VDD_NOTIFY_ENABLE - sysVM is gaining display focus
// VDD_NOTIFY_DISABLE - sysVM is losing display focus
//
// NotifyType - type of notify
//
// VDD_NOTIFY_TYPE_CALLBACK - NotifyProc is a Ring0 callback
//
// NotifyProc - notify procedure
// NotifyData - client data
//
// output:
// none
//
// return:
// ERROR_SUCCES if callback is set successfuly
//
// notes:
// currenly only one callback, per device can be active.
//
// to unregister a callback do a SET_NOTIFY with a NotifyMask == 0
//
// your callback better be in pagelocked code.
//
// NotifyProc has the following form:
//
// void __cdecl NotifyProc(DWORD NotifyDevice, DWORD NotifyEvent, DWORD NotifyData)
//
// NotifyDevice internal VDD device handle
// NotifyEvent event code (VDD_NOTIFY_*)
// NotifyData your client data
//
//
// VDD_IOCTL_SET_NOTIFY_INPUT
//
typedef struct tagVDD_IOCTL_SET_NOTIFY_INPUT {
DWORD NotifyMask;
DWORD NotifyType;
DWORD NotifyProc;
DWORD NotifyData;
} VDD_IOCTL_SET_NOTIFY_INPUT;
//
// VDD_IOCTL_SET_NOTIFY_INPUT.NotifyMask
//
#define VDD_NOTIFY_START_MODE_CHANGE 0x00000001
#define VDD_NOTIFY_END_MODE_CHANGE 0x00000002
#define VDD_NOTIFY_ENABLE 0x00000004
#define VDD_NOTIFY_DISABLE 0x00000008
//
// VDD_IOCTL_SET_NOTIFY_INPUT.NotifyType
//
#define VDD_NOTIFY_TYPE_CALLBACK 1
//
// Port size equates:
//
#define BYTE_LENGTHED 1
#define WORD_LENGTHED 2
//
// Flag equates:
//
#define GOING_TO_WINDOWS_MODE 1
#define GOING_TO_VGA_MODE 2
#define DISPLAY_DRIVER_DISABLED 4
#define IN_WINDOWS_HIRES_MODE 8
#define BLOCK_INT10 16
//
// DISPLAYINFO structure
//
typedef struct DISPLAYINFO {
WORD diHdrSize;
WORD diInfoFlags;
//
// display mode specific data
//
DWORD diDevNodeHandle;
char diDriverName[16];
WORD diXRes;
WORD diYRes;
WORD diDPI;
BYTE diPlanes;
BYTE diBpp;
//
// monitor specific data
//
WORD diRefreshRateMax;
WORD diRefreshRateMin;
WORD diLowHorz;
WORD diHighHorz;
WORD diLowVert;
WORD diHighVert;
DWORD diMonitorDevNodeHandle;
BYTE diHorzSyncPolarity;
BYTE diVertSyncPolarity;
//
// new 4.1 stuff
//
DWORD diUnitNumber; // device unit number
DWORD diDisplayFlags; // mode specific flags
DWORD diXDesktopPos; // position of desktop
DWORD diYDesktopPos; // ...
DWORD diXDesktopSize; // size of desktop (for panning)
DWORD diYDesktopSize; // ...
} DISPLAYINFO;
/*ASM
DISPLAYINFO_SIZE equ diRefreshRateMax+2-diHdrSize
DISPLAYINFO_SIZE1 equ diBpp+1-diHdrSize
DISPLAYINFO_SIZE2 equ diVertSyncPolarity+1-diHdrSize
DISPLAYINFO_SIZE3 equ diMemorySize+4-diHdrSize
*/
//
// Following are values for the diInfoFlags word in DISPLAYINFO:
//
#define RETURNED_DATA_IS_STALE 0x0001
#define MINIVDD_FAILED_TO_LOAD 0x0002
#define MINIVDD_CHIP_ID_DIDNT_MATCH 0x0004
#define REGISTRY_BPP_NOT_VALID 0x0008
#define REGISTRY_RESOLUTION_NOT_VALID 0x0010
#define REGISTRY_DPI_NOT_VALID 0x0020
#define MONITOR_DEVNODE_NOT_ACTIVE 0x0040
#define MONITOR_INFO_NOT_VALID 0x0080
#define MONITOR_INFO_DISABLED_BY_USER 0x0100
#define REFRESH_RATE_MAX_ONLY 0x0200
#define CARD_VDD_LOADED_OK 0x0400
#define DEVICE_IS_NOT_VGA 0x0800
//
// Following are explanations for the diInfoFlags word in DISPLAYINFO:
//
// RETURNED_DATA_IS_STALE, if set, means that this call to VDD_GET_DISPLAY_CONFIG
// or VDD_GetDisplayInfo (which are the Ring 3 and Ring 0 methods by which a
// program would get the DISPLAYINFO structure returned to him) caused the VDD
// to return data that was read in a previous call to VDD_GET_DISPLAY_CONFIG
// insted of actually going out and reading "fresh" data from the Registry.
//
// This flag brings to light the fact that there are some circumstances when the
// VDD cannot go out and read the registry in response to the call to
// VDD_GET_DISPLAY_CONFIG or VDD_GetDisplayInfo (due to system multi-tasking
// considerations). In this case, this flag will be set to a 1 to indicate that
// the information being returned isn't "fresh" -- that is -- it may be
// incorrect and obsolete. The caller should respond accordingly if this flag
// is set.
//
//
// MINIVDD_FAILED_TO_LOAD if set, indicates that for some reason (typically
// that the MiniVDD didn't match the chipset installed in the machine), the
// MiniVDD didn't load. Callers can examine this flag and act accordingly.
//
//
// MINIVDD_CHIP_ID_DIDNT_MATCH means that although the MiniVDD did load
// successfully, when the ChipID that the MiniVDD calculated was compared
// against the value saved in the registry, they didn't match. An example of
// when this would happen is when the user is happily using an S3-911 card
// and then decides to upgrade his display card to an S3-864. Since both
// cards use S3.VXD, the MiniVDD will load, however, since the card model
// is different, the VDD will return a defect to configuration manager and
// set this flag. Callers of the GET_DISPLAY_CONFIG functions can use this
// flag to take appropriate actions to make sure that the user gets his
// configuration correct.
//
//
// REGISTRY_BPP_NOT_VALID if set, means that we failed to obtain the BPP value
// from the registry when the VDD tried to read it.
//
//
// REGISTRY_RESOLUTION_NOT_VALID if set, means that we failed to obtain the
// resolution value from the registry when the VDD tried to read it.
//
//
// REGISTRY_DPI_NOT_VALID if set, means that we failed to obtain the
// DPI value from the registry when the VDD tried to read it.
//
//
// MONITOR_DEVNODE_NOT_ACTIVE is set if someone tries to make a call to the
// GET_DISPLAY_CONFIG function before the monitor DevNode has been created.
// This is certainly not fatal by any means. It simply means that the
// monitor refresh rate info in the DISPLAYINFO data structure is totally
// invalid!
//
//
// MONITOR_INFO_NOT_VALID indicates that something within the code which
// retrieves and calculates the refresh rate data has failed. This indicates
// that the values in diRefreshRateMax through diVertSyncPolarity are not
// valid and could contain random data.
//
//
// MONITOR_INFO_DISABLED_BY_USER indicates that the either the RefreshRate=
// string in SYSTEM.INI had a negative number in it or that the string in
// the display's software key RefreshRate = string was 0 or a negative number.
//
//
// REFRESH_RATE_MAX_ONLY indicates that there was no diLowHorz, diHighHorz,
// diLowVert, diHighVert, or sync polarity data in the registry. The
// value returned in diRefreshRateMax is the only refresh rate data that
// we have available. This was derived either from RefreshRate= in SYSTEM.INI
// or the display software key RefreshRate = string in the registry.
//
//
// CARD_VDD_LOADED_OK indicates that a second MiniVDD (which is useful for
// display card manufacturers wishing to extend the capabilities of the chip level
// MiniVDD's ) has successfully been loaded and initialized.
//
// DEVICE_IS_NOT_VGA indicates that this device is not the primary vga
//
#define NoTrace_VIRTUALIZE_CRTC_IN
#define NoTrace_VIRTUALIZE_CRTC_OUT
#define NoTrace_VIRTUALIZE_SEQUENCER_IN
#define NoTrace_VIRTUALIZE_SEQUENCER_OUT
#define NoTrace_VIRTUALIZE_GCR_IN
#define NoTrace_VIRTUALIZE_GCR_OUT
#define NoTrace_VIRTUALIZE_DAC_OUT
#define NoTrace_VIRTUALIZE_DAC_IN
#define NoTrace_CHECK_HIRES_MODE
/*ASM
ifdef NEC_98
;******************************************************************************
; E Q U A T E S
;******************************************************************************
;
; Mini-VDD Static Flags
;
vFlg_Machine_Std equ 00000001b
vFlg_Machine_Multi equ 00000010b
vFlg_Machine_Mate equ 00000100b
vFlg_Machine_H98 equ 00001000b
vFlg_CRT_New equ 00010000b
vFlg_CRT_NonInter equ 00100000b
vFlg_GDC_5MHz equ 01000000b
vFlg_GDC_Emulate equ 10000000b
vFlg_Acc_Internal equ 0000000100000000b
vFlg_Acc_External equ 0000001000000000b
vFlg_Acc_PCI equ 0000010000000000b
vFlg_Acc_ML equ 0000100000000000b
vFlg_Acc_PVD equ 0001000000000000b
vFlg_Mode_NH equ 0010000000000000b
vFlg_Mode_H equ 0100000000000000b
vFlg_Initialized equ 1000000000000000b
vFlg_Opt_MFR equ 000000010000000000000000b
vFlg_Opt_NewMFR equ 000000100000000000000000b
vFlg_Opt_VDP equ 000001000000000000000000b
vFlg_Opt_NewVDP equ 000010000000000000000000b
vFlg_Local equ 000000000100000010000000b
;
; Mini-VDD Support Max
;
MaxMiniVDD equ 16
MaxMiniTrap equ 32
MaxMultiTrap equ 3
MaxMultiFunc equ MaxMiniVDD
;
; MiniVDD_LTrap_Struct.LTrap_Status
; MiniVDD_LTrap_Struct.LTrap_Flags.xxxx
;
LT_Enable equ 00000001b
LT_Enable_bit equ 0
LT_Initialized equ 10000000b
LT_Initialized_bit equ 7
;******************************************************************************
; D A T A S T R U C T U R E S
;******************************************************************************
;
; Vids_struct
;
Vids_struct struc
;
; Common Data supplied by Base-VDD. Some data(bits) set by Mini-VDD.
;
Vids_SFlags dd ? ; Static flags
Vids_CB_Offset dd ? ;
Vids_Msg_Pseudo_VM dd ? ;
;
; Common Procedure supplied by Base-VDD
;
VDD_TGDC_Draw_Off dd ? ;
VDD_TGDC_Sync_Off dd ? ;
VDD_TGDC_Sync_On dd ? ;
VDD_TGDC_FIFO_Empty dd ? ;
VDD_GGDC_Draw_Off dd ? ;
VDD_GGDC_Sync_Off dd ? ;
VDD_GGDC_Sync_On dd ? ;
VDD_GGDC_FIFO_Empty dd ? ;
VDD_GGDC_MOD_Emulate dd ? ;
;
; Common Procedure supplied by Mini-VDD
;
H98_FLORA_Change dd ? ; H98 - NH mode
H98_Clear_Text dd ? ; H98 - NH mode
H98_Rest_GCs dd ? ; H98
H98_Rest_etc dd ? ; H98
H98_Save_ModeFF dd ? ; H98
Vids_struct ends
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?