![]() |
Jungo WinDriver
Official Documentation
|
#include "wd_ver.h"#include <windows.h>#include <winioctl.h>#include <stdarg.h>#include <inttypes.h>#include "windrvr_usb.h"Go to the source code of this file.
Macros | |
| #define | DLLCALLCONV |
| #define | _In_ |
| #define | _Inout_ |
| #define | _Out_ |
| #define | _Outptr_ |
| #define | WD_DRIVER_NAME_PREFIX "" |
| #define | __FUNCTION__ __func__ |
| #define | WD_DEFAULT_DRIVER_NAME_BASE "windrvr" WD_VER_ITOA |
| #define | WD_DEFAULT_DRIVER_NAME WD_DRIVER_NAME_PREFIX WD_DEFAULT_DRIVER_NAME_BASE |
| #define | WD_MAX_DRIVER_NAME_LENGTH 128 |
| #define | WD_MAX_KP_NAME_LENGTH 128 |
| #define | WD_VERSION_STR_LENGTH 128 |
| #define | WD_DRIVER_NAME WD_DriverName(NULL) |
| Get driver name. | |
| #define | WD_PROD_NAME "WinDriver" |
| #define | WD_CPU_SPEC " X86" |
| #define | WD_DATA_MODEL " 32bit" |
| #define | WD_VER_STR_SUFFIX "" |
| #define | WD_VER_STR |
| #define | WIN32 |
| #define | stricmp _stricmp |
| #define | va_copy(ap2, ap1) (ap2)=(ap1) |
| #define | WINAPI |
| #define | PRI64 "I64" |
| formatting for printing a 64bit variable | |
| #define | KPRI "" |
| formatting for printing a kernel pointer | |
| #define | UPRI "l" |
| #define | DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) |
| #define | DMA_ADDRESS_WIDTH_MASK 0x7f000000 |
| #define | DMA_OPTIONS_ALL |
| #define | DMA_DIRECTION_MASK DMA_TO_FROM_DEVICE |
| #define | DMA_READ_FROM_DEVICE DMA_FROM_DEVICE |
| Macros for backward compatibility. | |
| #define | DMA_WRITE_TO_DEVICE DMA_TO_DEVICE |
| #define | DMA_OPTIONS_ADDRESS_WIDTH_SHIFT |
| #define | WD_ENABLED_INT_TYPE_MASK 0x3f |
| #define | WD_ENABLED_INT_TYPE_GET_ENABLED_INT_TYPE_BITS(dwEnabledIntType) (dwEnabledIntType & WD_ENABLED_INT_TYPE_MASK) |
| #define | WD_ENABLED_INT_TYPE_NUM_VECTORS_POSITION_BITS 20 |
| #define | WD_LICENSE_LENGTH 3072 |
| #define | WD_PROCESS_NAME_LENGTH 128 |
| #define | DEBUG_USER_BUF_LEN 2048 |
| #define | WD_IPC_ALL_MSG (WD_IPC_UNICAST_MSG | WD_IPC_MULTICAST_MSG) |
| #define | WDU_USE_SHARED_OBJECT_HANDLE 0x1000000 |
| #define | WDU_DONT_INSERT_LICENSE 0x2000000 |
| #define | WD_ACTIONS_POWER |
| #define | WD_ACTIONS_ALL (WD_ACTIONS_POWER | WD_INSERT | WD_REMOVE) |
| #define | BZERO(buf) memset(&(buf), 0, sizeof(buf)) |
| #define | INVALID_HANDLE_VALUE ((HANDLE)(-1)) |
| #define | CTL_CODE(DeviceType, Function, Method, Access) |
| #define | METHOD_BUFFERED 0 |
| #define | METHOD_IN_DIRECT 1 |
| #define | METHOD_OUT_DIRECT 2 |
| #define | METHOD_NEITHER 3 |
| #define | FILE_ANY_ACCESS 0 |
| #define | FILE_READ_ACCESS 1 |
| file & pipe | |
| #define | FILE_WRITE_ACCESS 2 |
| file & pipe | |
| #define | WD_TYPE 38200 |
| Device type. | |
| #define | FUNC_MASK 0x0 |
| #define | WD_CTL_CODE(wFuncNum) |
| #define | WD_CTL_DECODE_FUNC(IoControlCode) ((IoControlCode >> 2) & 0xfff) |
| #define | WD_CTL_DECODE_TYPE(IoControlCode) DEVICE_TYPE_FROM_CTL_CODE(IoControlCode) |
| #define | WD_CTL_IS_64BIT_AWARE(IoControlCode) (WD_CTL_DECODE_FUNC(IoControlCode) & FUNC_MASK) |
| #define | IOCTL_WD_KERNEL_BUF_LOCK WD_CTL_CODE(0x901) |
| #define | IOCTL_WD_KERNEL_BUF_UNLOCK WD_CTL_CODE(0x902) |
| #define | IOCTL_WD_DMA_LOCK WD_CTL_CODE(0x903) |
| #define | IOCTL_WD_DMA_UNLOCK WD_CTL_CODE(0x904) |
| #define | IOCTL_WD_DMA_SYNC_CPU WD_CTL_CODE(0x905) |
| #define | IOCTL_WD_DMA_SYNC_IO WD_CTL_CODE(0x906) |
| #define | IOCTL_WD_DMA_TRANSACTION_INIT WD_CTL_CODE(0x907) |
| #define | IOCTL_WD_DMA_TRANSACTION_EXECUTE WD_CTL_CODE(0x908) |
| #define | IOCTL_WD_DMA_TRANSFER_COMPLETED_AND_CHECK WD_CTL_CODE(0x909) |
| #define | IOCTL_WD_DMA_TRANSACTION_RELEASE WD_CTL_CODE(0x90a) |
| #define | IOCTL_WD_TRANSFER WD_CTL_CODE(0x90b) |
| #define | IOCTL_WD_MULTI_TRANSFER WD_CTL_CODE(0x90c) |
| #define | IOCTL_WD_PCI_SCAN_CARDS WD_CTL_CODE(0x90d) |
| #define | IOCTL_WD_PCI_GET_CARD_INFO WD_CTL_CODE(0x90e) |
| #define | IOCTL_WD_PCI_SCAN_CAPS WD_CTL_CODE(0x90f) |
| #define | IOCTL_WD_PCI_CONFIG_DUMP WD_CTL_CODE(0x910) |
| #define | IOCTL_WD_VERSION WD_CTL_CODE(0x911) |
| #define | IOCTL_WD_KERNEL_PLUGIN_OPEN WD_CTL_CODE(0x912) |
| #define | IOCTL_WD_KERNEL_PLUGIN_CLOSE WD_CTL_CODE(0x913) |
| #define | IOCTL_WD_KERNEL_PLUGIN_CALL WD_CTL_CODE(0x914) |
| #define | IOCTL_WD_INT_ENABLE WD_CTL_CODE(0x915) |
| #define | IOCTL_WD_INT_DISABLE WD_CTL_CODE(0x916) |
| #define | IOCTL_WD_INT_COUNT WD_CTL_CODE(0x917) |
| #define | IOCTL_WD_INT_WAIT WD_CTL_CODE(0x918) |
| #define | IOCTL_WD_SLEEP WD_CTL_CODE(0x919) |
| #define | IOCTL_WD_DEBUG WD_CTL_CODE(0x91a) |
| #define | IOCTL_WD_DEBUG_DUMP WD_CTL_CODE(0x91b) |
| #define | IOCTL_WD_DEBUG_ADD WD_CTL_CODE(0x91c) |
| #define | IOCTL_WD_CARD_REGISTER WD_CTL_CODE(0x91d) |
| #define | IOCTL_WD_CARD_UNREGISTER WD_CTL_CODE(0x91e) |
| #define | IOCTL_WD_CARD_CLEANUP_SETUP WD_CTL_CODE(0x91f) |
| #define | IOCTL_WD_GET_DEVICE_PROPERTY WD_CTL_CODE(0x920) |
| #define | IOCTL_WD_EVENT_REGISTER WD_CTL_CODE(0x921) |
| #define | IOCTL_WD_EVENT_UNREGISTER WD_CTL_CODE(0x922) |
| #define | IOCTL_WD_EVENT_PULL WD_CTL_CODE(0x923) |
| #define | IOCTL_WD_EVENT_SEND WD_CTL_CODE(0x924) |
| #define | IOCTL_WDU_GET_DEVICE_DATA WD_CTL_CODE(0x925) |
| #define | IOCTL_WDU_WAKEUP WD_CTL_CODE(0x926) |
| #define | IOCTL_WDU_SET_INTERFACE WD_CTL_CODE(0x927) |
| #define | IOCTL_WDU_RESET_PIPE WD_CTL_CODE(0x928) |
| #define | IOCTL_WDU_TRANSFER WD_CTL_CODE(0x929) |
| #define | IOCTL_WDU_HALT_TRANSFER WD_CTL_CODE(0x92a) |
| #define | IOCTL_WDU_RESET_DEVICE WD_CTL_CODE(0x92b) |
| #define | IOCTL_WDU_STREAM_OPEN WD_CTL_CODE(0x92c) |
| #define | IOCTL_WDU_STREAM_CLOSE WD_CTL_CODE(0x92d) |
| #define | IOCTL_WDU_STREAM_START WD_CTL_CODE(0x92e) |
| #define | IOCTL_WDU_STREAM_STOP WD_CTL_CODE(0x92f) |
| #define | IOCTL_WDU_STREAM_FLUSH WD_CTL_CODE(0x930) |
| #define | IOCTL_WDU_STREAM_GET_STATUS WD_CTL_CODE(0x931) |
| #define | IOCTL_WDU_SELECTIVE_SUSPEND WD_CTL_CODE(0x932) |
| #define | IOCTL_WD_IPC_REGISTER WD_CTL_CODE(0x933) |
| #define | IOCTL_WD_IPC_UNREGISTER WD_CTL_CODE(0x934) |
| #define | IOCTL_WD_IPC_SCAN_PROCS WD_CTL_CODE(0x935) |
| #define | IOCTL_WD_IPC_SEND WD_CTL_CODE(0x936) |
| #define | IOCTL_WD_PCI_SRIOV_ENABLE WD_CTL_CODE(0x937) |
| #define | IOCTL_WD_PCI_SRIOV_DISABLE WD_CTL_CODE(0x938) |
| #define | IOCTL_WD_PCI_SRIOV_GET_NUMVFS WD_CTL_CODE(0x939) |
| #define | IOCTL_WD_IPC_SHARED_INT_ENABLE WD_CTL_CODE(0x93a) |
| #define | IOCTL_WD_IPC_SHARED_INT_DISABLE WD_CTL_CODE(0x93b) |
| #define | IOCTL_WD_USAGE WD_CTL_CODE(0x93c) |
| #define | IOCTL_WD_LICENSE WD_CTL_CODE(0x93d) |
| #define | IOCTL_WD_PCI_RESET_CARD WD_CTL_CODE(0x945) |
| #define | IOCTL_WD_PLATFORM_GET_DEVICE_INFO WD_CTL_CODE(0x946) |
| #define | IOCTL_WD_PLATFORM_SCAN_DEVICES WD_CTL_CODE(0x947) |
| #define | REGKEY_BUFSIZE 256 |
| #define | OS_CAN_NOT_DETECT_TEXT "OS CAN NOT DETECT" |
| #define | INSTALLATION_TYPE_NOT_DETECT_TEXT "unknown" |
| #define | WD_CloseLocal(h) CloseHandle(h) |
| #define | WD_UStreamRead(hFile, pBuffer, dwNumberOfBytesToRead, dwNumberOfBytesRead) |
| #define | WD_UStreamWrite(hFile, pBuffer, dwNumberOfBytesToWrite, dwNumberOfBytesWritten) |
| #define | WD_OpenLocal() |
| #define | WD_OpenStreamLocal(read, sync) |
| #define | WD_FUNCTION WD_FUNCTION_LOCAL |
| #define | WD_Close WD_CloseLocal |
| #define | WD_Open WD_OpenLocal |
| #define | WD_StreamOpen WD_OpenStreamLocal |
| #define | WD_StreamClose WD_CloseLocal |
| #define | SIZE_OF_WD_DMA(pDma) |
| #define | SIZE_OF_WD_EVENT(pEvent) |
| #define | WD_Debug(h, pDebug) WD_FUNCTION(IOCTL_WD_DEBUG, h, pDebug, sizeof(WD_DEBUG), FALSE) |
| Sets debugging level for collecting debug messages. | |
| #define | WD_DebugDump(h, pDebugDump) |
| Retrieves debug messages buffer. | |
| #define | WD_DebugAdd(h, pDebugAdd) WD_FUNCTION(IOCTL_WD_DEBUG_ADD, h, pDebugAdd, sizeof(WD_DEBUG_ADD), FALSE) |
| Sends debug messages to the debug log. | |
| #define | WD_Transfer(h, pTransfer) WD_FUNCTION(IOCTL_WD_TRANSFER, h, pTransfer, sizeof(WD_TRANSFER), FALSE) |
| Executes a single read/write instruction to an I/O port or to a memory address. | |
| #define | WD_MultiTransfer(h, pTransferArray, dwNumTransfers) |
| Executes multiple read/write instructions to I/O ports and/or memory addresses. | |
| #define | WD_KernelBufLock(h, pKerBuf) |
| Allocates a contiguous or non-contiguous non-paged kernel buffer, and maps it to user address space. | |
| #define | WD_KernelBufUnlock(h, pKerBuf) |
| Frees kernel buffer. | |
| #define | WD_DMALock(h, pDma) WD_FUNCTION(IOCTL_WD_DMA_LOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE) |
| Enables contiguous-buffer or Scatter/Gather DMA. | |
| #define | WD_DMAUnlock(h, pDma) WD_FUNCTION(IOCTL_WD_DMA_UNLOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE) |
| Unlocks a DMA buffer. | |
| #define | WD_DMATransactionInit(h, pDma) |
| Initializes the transaction, allocates a DMA buffer, locks it in physical memory, and returns mappings of the allocated buffer to physical address space and to user-mode and kernel virtual address spaces. | |
| #define | WD_DMATransactionExecute(h, pDma) |
| Begins the execution of a specified DMA transaction. | |
| #define | WD_DMATransferCompletedAndCheck(h, pDma) |
| Notifies WinDriver that a device's DMA transfer operation is completed. | |
| #define | WD_DMATransactionRelease(h, pDma) |
| Terminates a specified DMA transaction without deleting the associated WD_DMA transaction structure. | |
| #define | WD_DMATransactionUninit(h, pDma) WD_FUNCTION(IOCTL_WD_DMA_UNLOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE) |
| Unlocks and frees the memory allocated for a DMA buffer transaction by a previous call to WD_DMATransactionInit() | |
| #define | WD_DMASyncCpu(h, pDma) WD_FUNCTION(IOCTL_WD_DMA_SYNC_CPU, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE) |
| Synchronizes the cache of all CPUs with the DMA buffer, by flushing the data from the CPU caches. | |
| #define | WD_DMASyncIo(h, pDma) WD_FUNCTION(IOCTL_WD_DMA_SYNC_IO, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE) |
| Synchronizes the I/O caches with the DMA buffer, by flushing the data from the I/O caches and updating the CPU caches. | |
| #define | WD_CardRegister(h, pCard) |
| Card registration function. | |
| #define | WD_CardUnregister(h, pCard) |
| Unregisters a device and frees the resources allocated to it. | |
| #define | WD_IpcRegister(h, pIpcRegister) |
| Registers an application with WinDriver IPC. | |
| #define | WD_IpcUnRegister(h, pProcInfo) |
| This function unregisters the user application from WinDriver IPC. | |
| #define | WD_IpcScanProcs(h, pIpcScanProcs) |
| Scans and returns information of all WinDriver IPC registered processes that share the application process groupID. | |
| #define | WD_IpcSend(h, pIpcSend) WD_FUNCTION(IOCTL_WD_IPC_SEND, h, pIpcSend, sizeof(WD_IPC_SEND), FALSE) |
| Sends a message to other processes, depending on the content of the pIpcSend struct. | |
| #define | WD_SharedIntEnable(h, pIpcRegister) |
| Enables the shared interrupts mechanism of WinDriver. | |
| #define | WD_SharedIntDisable(h) WD_FUNCTION(IOCTL_WD_IPC_SHARED_INT_DISABLE, h, 0, 0, FALSE) |
| Disables the Shared Interrupts mechanism of WinDriver for all processes. | |
| #define | WD_PciSriovEnable(h, pPciSRIOV) |
| Enables SR-IOV for a supported device. | |
| #define | WD_PciSriovDisable(h, pPciSRIOV) |
| Disables SR-IOV for a supported device and removes all the assigned VFs. | |
| #define | WD_PciSriovGetNumVFs(h, pPciSRIOV) |
| Gets the number of virtual functions assigned to a supported device. | |
| #define | WD_CardCleanupSetup(h, pCardCleanup) |
| Sets a list of transfer cleanup commands to be performed for the specified card on any of the following occasions: The application exits abnormally. | |
| #define | WD_PciScanCards(h, pPciScan) |
| Detects PCI devices installed on the PCI bus, which conform to the input criteria (vendor ID and/or card ID), and returns the number and location (bus, slot and function) of the detected devices. | |
| #define | WD_PciScanCaps(h, pPciScanCaps) |
| Scans the specified PCI capabilities group of the given PCI slot for the specified capability (or for all capabilities). | |
| #define | WD_PciGetCardInfo(h, pPciCard) |
| Retrieves PCI device's resource information (i.e., Memory ranges, I/O ranges, Interrupt lines). | |
| #define | WD_PciConfigDump(h, pPciConfigDump) |
| Reads/writes from/to the PCI configuration space of a selected PCI card or the extended configuration space of a selected PCI Express card. | |
| #define | WD_PciResetCard(h, pPciSlot) |
| Reset the PCI function without affecting other functions on the device. | |
| #define | WD_Version(h, pVerInfo) WD_FUNCTION(IOCTL_WD_VERSION, h, pVerInfo, sizeof(WD_VERSION), FALSE) |
| Returns the version number of the WinDriver kernel module currently running. | |
| #define | WD_License(h, pLicense) WD_FUNCTION(IOCTL_WD_LICENSE, h, pLicense, sizeof(WD_LICENSE), FALSE) |
| Transfers the license string to the WinDriver kernel module When using the high-level WDC library APIs, described in the WinDriver PCI Manual, the license registration is done via the WDC_DriverOpen() function, so you do not need to call WD_License() directly. | |
| #define | WD_KernelPlugInOpen(h, pKernelPlugIn) |
| Obtain a valid handle to the Kernel PlugIn. | |
| #define | WD_KernelPlugInClose(h, pKernelPlugIn) |
| Closes the WinDriver Kernel PlugIn handle obtained from WD_KernelPlugInOpen() | |
| #define | WD_KernelPlugInCall(h, pKernelPlugInCall) |
| Calls a routine in the Kernel PlugIn to be executed. | |
| #define | WD_IntEnable(h, pInterrupt) WD_FUNCTION(IOCTL_WD_INT_ENABLE, h, pInterrupt, sizeof(WD_INTERRUPT), FALSE) |
| Registers an interrupt service routine (ISR) to be called upon interrupt. | |
| #define | WD_IntDisable(h, pInterrupt) |
| Disables interrupt processing. | |
| #define | WD_IntCount(h, pInterrupt) WD_FUNCTION(IOCTL_WD_INT_COUNT, h, pInterrupt, sizeof(WD_INTERRUPT), FALSE) |
| Retrieves the interrupts count since the call to WD_IntEnable() | |
| #define | WD_IntWait(h, pInterrupt) WD_FUNCTION(IOCTL_WD_INT_WAIT, h, pInterrupt, sizeof(WD_INTERRUPT), TRUE) |
| Waits for an interrupt. | |
| #define | WD_Sleep(h, pSleep) WD_FUNCTION(IOCTL_WD_SLEEP, h, pSleep, sizeof(WD_SLEEP), FALSE) |
| Delays execution for a specific duration of time. | |
| #define | WD_EventRegister(h, pEvent) |
| #define | WD_EventUnregister(h, pEvent) |
| #define | WD_EventPull(h, pEvent) WD_FUNCTION(IOCTL_WD_EVENT_PULL, h, pEvent, SIZE_OF_WD_EVENT(pEvent), FALSE) |
| #define | WD_EventSend(h, pEvent) WD_FUNCTION(IOCTL_WD_EVENT_SEND, h, pEvent, SIZE_OF_WD_EVENT(pEvent), FALSE) |
| #define | WD_Usage(h, pStop) WD_FUNCTION(IOCTL_WD_USAGE, h, pStop, sizeof(WD_USAGE), FALSE) |
| #define | WD_UGetDeviceData(h, pGetDevData) |
| #define | WD_GetDeviceProperty(h, pGetDevProperty) |
| #define | WD_USetInterface(h, pSetIfc) |
| #define | WD_UResetPipe(h, pResetPipe) |
| #define | WD_UTransfer(h, pTrans) WD_FUNCTION(IOCTL_WDU_TRANSFER, h, pTrans, sizeof(WDU_TRANSFER), TRUE); |
| #define | WD_UHaltTransfer(h, pHaltTrans) |
| #define | WD_UWakeup(h, pWakeup) WD_FUNCTION(IOCTL_WDU_WAKEUP, h, pWakeup, sizeof(WDU_WAKEUP), FALSE); |
| #define | WD_USelectiveSuspend(h, pSelectiveSuspend) |
| #define | WD_UResetDevice(h, pResetDevice) |
| #define | WD_UStreamOpen(h, pStream) WD_FUNCTION(IOCTL_WDU_STREAM_OPEN, h, pStream, sizeof(WDU_STREAM), FALSE); |
| #define | WD_UStreamClose(h, pStream) WD_FUNCTION(IOCTL_WDU_STREAM_CLOSE, h, pStream, sizeof(WDU_STREAM), FALSE); |
| #define | WD_UStreamStart(h, pStream) WD_FUNCTION(IOCTL_WDU_STREAM_START, h, pStream, sizeof(WDU_STREAM), FALSE); |
| #define | WD_UStreamStop(h, pStream) WD_FUNCTION(IOCTL_WDU_STREAM_STOP, h, pStream, sizeof(WDU_STREAM), FALSE); |
| #define | WD_UStreamFlush(h, pStream) WD_FUNCTION(IOCTL_WDU_STREAM_FLUSH, h, pStream, sizeof(WDU_STREAM), FALSE); |
| #define | WD_UStreamGetStatus(h, pStreamStatus) |
| #define | __ALIGN_DOWN(val, alignment) ( (val) & ~((alignment) - 1) ) |
| #define | __ALIGN_UP(val, alignment) ( ((val) + (alignment) - 1) & ~((alignment) - 1) ) |
| #define | MIN(a, b) ((a) > (b) ? (b) : (a)) |
| #define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
| #define | SAFE_STRING(s) ((s) ? (s) : "") |
| #define | UNUSED_VAR(x) (void)x |
Functions | |
| const char *DLLCALLCONV | WD_DriverName (const char *sName) |
| Sets the name of the WinDriver kernel module, which will be used by the calling application. | |
| WD_OS_INFO DLLCALLCONV | get_os_type (void) |
| Retrieves the type of the operating system in section. | |
| DWORD DLLCALLCONV | check_secureBoot_enabled (void) |
| Checks whether the Secure Boot feature is enabled on the system. | |