📄 windrvr.h
字号:
/*
* W i n D r i v e r
* =================
*
* FOR DETAILS ON THE WinDriver FUNCTIONS, PLEASE SEE THE WinDriver MANUAL
* OR INCLUDED HELP FILES.
*
* This file may not be distributed -- it may only be used for development
* or evaluation purposes (See \WinDriver\docs\license.txt for details).
*
* Web site: http://www.jungo.com
* Email: support@jungo.com
*
* Copyright (C) Jungo 1997 - 2003
*/
#ifndef _WINDRVR_H_
#define _WINDRVR_H_
#if defined(__cplusplus)
extern "C" {
#endif
#include "wd_ver.h"
// these lines break standard VxWorks builds. remove the -asni flag from the
// compiler flags (from the makefile or the Tornado IDE) to compile WinDriver
// related source code.
#if defined(WIN32DLL)
#define DLLCALLCONV _stdcall
#else
#define DLLCALLCONV
#endif
#if defined(VXWORKS)
#define WD_PROD_NAME "DriverBuilder"
#else
#define WD_PROD_NAME "WinDriver"
#endif
#if defined(VXWORKS)
#if defined(MBX860)
#define WD_CPU_SPEC " PPC860"
#elif defined(MCP750)
#define WD_CPU_SPEC " PPC750"
#elif defined(x86)
#define WD_CPU_SPEC " X86"
#else
#define WD_CPU_SPEC ""
#endif
#else
#if defined(SPARC)
#define WD_CPU_SPEC " Sparc"
#elif defined(WINCE)
#define WD_CPU_SPEC ""
#else
#define WD_CPU_SPEC " X86"
#endif
#endif
#if defined(WINNT)
#define WD_FILE_FORMAT " SYS"
#elif defined(WIN95)
#define WD_FILE_FORMAT " VXD"
#else
#define WD_FILE_FORMAT ""
#endif
#define WD_VER_STR WD_PROD_NAME " v" WD_VERSION_STR " Jungo (c) 1997 - 2003 Build Date: " __DATE__ WD_CPU_SPEC WD_FILE_FORMAT
#if !defined(UNIX) && (defined(LINUX) || defined(SOLARIS) || defined(VXWORKS))
#define UNIX
#endif
#if !defined(SPARC) && (defined(__sparc__) || defined (__sparc) || \
defined(sparc))
#define SPARC
#endif
#if !defined(WIN32) && (defined(WINCE) || defined(WIN95) || defined(WINNT))
#define WIN32
#endif
#if defined(_WIN32_WCE) && !defined(WINCE)
#define WINCE
#endif
#if !defined(x86) && ( defined(LINUX) || (defined(WIN32) && !defined(WINCE) && !defined(_ALPHA_) ))
#define x86
#endif
#if defined(_KERNEL) && !defined(__KERNEL__)
#define __KERNEL__
#endif
#if defined( __KERNEL__) && !defined(_KERNEL)
#define _KERNEL
#endif
#if !defined(WIN32) && !defined(WINCE) && !defined(UNIX)
#define WIN32
#endif
#if !defined(POWERPC) && defined(VXWORKS) && !defined(x86)
#define POWERPC
#endif
#if !defined(_BIGENDIAN) && (defined (SPARC) || defined(POWERPC))
#define _BIGENDIAN
#endif
#if defined(UNIX)
#if !defined(__P_TYPES__)
#if !defined(VXWORKS)
typedef void VOID;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned int UINT;
typedef unsigned long ULONG;
typedef ULONG BOOL;
#endif
typedef void *PVOID;
typedef unsigned char *PBYTE;
typedef char CHAR;
typedef char *PCHAR;
typedef unsigned short *PWORD;
typedef unsigned long DWORD, *PDWORD;
typedef PVOID HANDLE;
#endif
#if !defined(__KERNEL__)
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#endif
#define TRUE 1
#define FALSE 0
#define __cdecl
#define WINAPI
#if defined(__KERNEL__)
#if defined(LINUX)
#include <linux/types.h>
#include <linux/string.h>
#endif
#else
#include <unistd.h>
#if defined(LINUX)
#include <sys/ioctl.h> /* for BSD ioctl() */
#include <unistd.h>
#else
#include <unistd.h> /* for SVR4 ioctl()*/
#endif
#if defined(VXWORKS)
#include <vxWorks.h>
#undef SPARC /* defined in vxworks.h */
#include <string.h>
#include <memLib.h>
#include <stdlib.h>
#include <taskLib.h>
#include <ioLib.h>
#include <iosLib.h>
#include <taskLib.h>
#include <semLib.h>
#include <timers.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#endif
#elif defined(WINCE)
#include <windows.h>
#include <winioctl.h>
typedef char CHAR;
#elif defined(WIN32)
#if defined(__KERNEL__)
int sprintf(char *buffer, const char *format, ...);
#else
#include <windows.h>
#include <winioctl.h>
#endif
#if defined(__KERNEL__) && defined(WIN32)
int sprintf(char *buffer, const char *format, ...);
#endif
#if defined(__KERNEL__) && defined(WIN95) && !defined(__KERPLUG__)
#include "kdstdlib.h"
#endif
#endif
#if !defined(_WINDEF_)
typedef unsigned char BYTE;
typedef unsigned short int WORD;
#endif
#define KPTR DWORD
typedef enum
{
CMD_NONE = 0, // No command
CMD_END = 1, // End command
RP_BYTE = 10, // Read port byte
RP_WORD = 11, // Read port word
RP_DWORD = 12, // Read port dword
WP_BYTE = 13, // Write port byte
WP_WORD = 14, // Write port word
WP_DWORD = 15, // Write port dword
RP_SBYTE = 20, // Read port string byte
RP_SWORD = 21, // Read port string word
RP_SDWORD = 22, // Read port string dword
WP_SBYTE = 23, // Write port string byte
WP_SWORD = 24, // Write port string word
WP_SDWORD = 25, // Write port string dword
RM_BYTE = 30, // Read memory byte
RM_WORD = 31, // Read memory word
RM_DWORD = 32, // Read memory dword
WM_BYTE = 33, // Write memory byte
WM_WORD = 34, // Write memory word
WM_DWORD = 35, // Write memory dword
RM_SBYTE = 40, // Read memory string byte
RM_SWORD = 41, // Read memory string word
RM_SDWORD = 42, // Read memory string dword
WM_SBYTE = 43, // Write memory string byte
WM_SWORD = 44, // Write memory string word
WM_SDWORD = 45, // Write memory string dword
RM_SQWORD = 46, // Read memory string quad word
WM_SQWORD = 47, // Write memory string quad word
} WD_TRANSFER_CMD;
enum { WD_DMA_PAGES = 256 };
enum {
DMA_KERNEL_BUFFER_ALLOC = 1, // The system allocates a contiguous buffer.
// The user does not need to supply linear_address.
DMA_KBUF_BELOW_16M = 2, // If DMA_KERNEL_BUFFER_ALLOC if used,
// this will make sure it is under 16M.
DMA_LARGE_BUFFER = 4, // If DMA_LARGE_BUFFER is used,
// the maximum number of pages are dwPages, and not
// WD_DMA_PAGES. If you lock a user buffer (not a kernel
// allocated buffer) that is larger than 1MB, then use this
// option and allocate memory for pages.
DMA_ALLOW_CACHE = 8, // allow caching of the memory for contiguous memory
// allocation on Windows NT/2k/XP (not recommended!)
};
typedef struct
{
KPTR pPhysicalAddr; // Physical address of page.
DWORD dwBytes; // Size of page.
} WD_DMA_PAGE, WD_DMA_PAGE_V30;
typedef struct
{
DWORD hDma; // Handle of dma buffer.
PVOID pUserAddr; // Beginning of buffer.
KPTR pKernelAddr; // Kernel mapping of kernel allocated buffer
DWORD dwBytes; // Size of buffer.
DWORD dwOptions; // Allocation options:
// DMA_KERNEL_BUFFER_ALLOC, DMA_KBUF_BELOW_16M, DMA_LARGE_BUFFER.
DWORD dwPages; // Number of pages in buffer.
DWORD dwPad1; // Reserved for internal use
WD_DMA_PAGE Page[WD_DMA_PAGES];
} WD_DMA, WD_DMA_V30;
typedef struct
{
KPTR dwPort; // IO port for transfer or kernel memory address.
DWORD cmdTrans; // Transfer command WD_TRANSFER_CMD.
// Parameters used for string transfers:
DWORD dwBytes; // For string transfer.
DWORD fAutoinc; // Transfer from one port/address
// or use incremental range of addresses.
DWORD dwOptions; // Must be 0.
union
{
BYTE Byte; // Use for 8 bit transfer.
WORD Word; // Use for 16 bit transfer.
DWORD Dword; // Use for 32 bit transfer.
BYTE Reserved[8]; // Reserved do not use
PVOID pBuffer; // Use for string transfer.
} Data;
} WD_TRANSFER, WD_TRANSFER_V30;
enum { INTERRUPT_LEVEL_SENSITIVE = 1 };
enum { INTERRUPT_CMD_COPY = 2 };
enum { INTERRUPT_CE_INT_ID = 4 };
typedef struct
{
DWORD hKernelPlugIn;
DWORD dwMessage;
PVOID pData;
DWORD dwResult;
} WD_KERNEL_PLUGIN_CALL, WD_KERNEL_PLUGIN_CALL_V40;
enum
{
INTERRUPT_STOPPED = 1,
INTERRUPT_INTERRUPTED,
};
typedef struct
{
DWORD hInterrupt; // Handle of interrupt.
DWORD dwOptions; // Interrupt options: can be INTERRUPT_CMD_COPY
WD_TRANSFER *Cmd; // Commands to do on interrupt.
DWORD dwCmds; // Number of commands.
// For WD_IntEnable():
WD_KERNEL_PLUGIN_CALL kpCall; // Kernel PlugIn call.
DWORD fEnableOk; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
// For WD_IntWait() and WD_IntCount():
DWORD dwCounter; // Number of interrupts received.
DWORD dwLost; // Number of interrupts not yet dealt with.
DWORD fStopped; // Was interrupt disabled during wait.
} WD_INTERRUPT, WD_INTERRUPT_V40;
typedef struct
{
DWORD dwVer;
CHAR cVer[128];
} WD_VERSION, WD_VERSION_V30;
enum
{
LICENSE_DEMO = 0x1,
LICENSE_WD = 0x4,
LICENSE_IO = 0x8,
LICENSE_MEM = 0x10,
LICENSE_INT = 0x20,
LICENSE_PCI = 0x40,
LICENSE_DMA = 0x80,
LICENSE_NT = 0x100,
LICENSE_95 = 0x200,
LICENSE_ISAPNP = 0x400,
LICENSE_PCMCIA = 0x800,
LICENSE_PCI_DUMP = 0x1000,
LICENSE_MSG_GEN = 0x2000,
LICENSE_MSG_EDU = 0x4000,
LICENSE_MSG_INT = 0x8000,
LICENSE_KER_PLUG = 0x10000,
LICENSE_LINUX = 0x20000,
LICENSE_CE = 0x80000,
LICENSE_VXWORKS = 0x10000000,
LICENSE_THIS_PC = 0x100000,
LICENSE_WIZARD = 0x200000,
LICENSE_KD = 0x400000,
LICENSE_SOLARIS = 0x800000,
LICENSE_CPU0 = 0x40000,
LICENSE_CPU1 = 0x1000000,
LICENSE_CPU2 = 0x2000000,
LICENSE_CPU3 = 0x4000000,
LICENSE_USB = 0x8000000,
};
enum
{
LICENSE2_EVENT = 0x8,
LICENSE2_WDLIB = 0x10,
};
enum
{
LICENSE_OS_WITH_WIZARD = LICENSE_95 | LICENSE_NT,
LICENSE_OS_WITHOUT_WIZARD = LICENSE_LINUX | LICENSE_CE | LICENSE_VXWORKS | LICENSE_SOLARIS,
};
enum
{
LICENSE_CPU_ALL = LICENSE_CPU3 | LICENSE_CPU2 | LICENSE_CPU1 |
LICENSE_CPU0,
LICENSE_X86 = LICENSE_CPU0,
LICENSE_ALPHA = LICENSE_CPU1,
LICENSE_SPARC = LICENSE_CPU1 | LICENSE_CPU0,
LICENSE_PPC = LICENSE_CPU2,
};
#define WD_LICENSE_LENGTH 128
typedef struct
{
CHAR cLicense[WD_LICENSE_LENGTH]; // Buffer with license string to put.
// If empty string then get current license setting
// into dwLicense.
DWORD dwLicense; // Returns license settings: LICENSE_DEMO, LICENSE_WD
// etc..., or 0 for invalid license.
DWORD dwLicense2; // Returns additional license settings, if dwLicense
// could not hold all the information.
// Then dwLicense will return 0.
} WD_LICENSE, WD_LICENSE_V44;
typedef struct
{
DWORD dwBusType; // Bus Type: ISA, EISA, PCI, PCMCIA.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -