int main(void)
{
DWORD dwStatus;
{
printf("Failed to set the driver name for WDC library.\n");
return WD_INTERNAL_ERROR;
}
{
printf("Failed to initialize debug options for WDC library.\n"
"Error 0x%lx - %s\n", dwStatus,
Stat2Str(dwStatus));
return dwStatus;
}
{
printf("Failed to initialize the WDC library. Error 0x%lx - %s\n",
return dwStatus;
}
{
printf("Failed retrieving the device's resources "
"information. Error [0x%lx - %s]\n", dwStatus,
Stat2Str(dwStatus));
goto Exit;
}
{
printf("Failed opening a WDC device handle. Error 0x%lx - %s\n",
goto Exit;
}
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
if (dwResult)
goto Exit;
Exit:
if (hDev)
{
{
printf("Failed closing a WDC device handle (0x%p). Error 0x%lx "
"- %s\n", hDev, dwStatus,
Stat2Str(dwStatus));
}
}
}
const char *DLLCALLCONV Stat2Str(_In_ DWORD dwStatus)
Retrieves the status string that corresponds to a status code.
WD_PCI_SLOT pciSlot
PCI slot information.
#define WDC_ReadAddrBlock8(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_ReadAddrBlock with 1 byte mode.
#define WDC_WriteAddrBlock8(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_WriteAddrBlock with 1 byte mode.
DWORD DLLCALLCONV WDC_SetDebugOptions(_In_ WDC_DBG_OPTIONS dbgOptions, _In_ const CHAR *pcDbgFile)
Sets debug options for the WDC library - see the description of WDC_DBG_OPTIONS for details regarding...
DWORD DLLCALLCONV WDC_PciDeviceOpen(_Outptr_ WDC_DEVICE_HANDLE *phDev, _In_ const WD_PCI_CARD_INFO *pDeviceInfo, _In_ const PVOID pDevCtx)
Allocates and initializes a WDC PCI device structure, registers the device with WinDriver,...
#define WDC_WriteAddrBlock32(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_WriteAddrBlock with 4 bytes mode.
#define WDC_DRV_OPEN_DEFAULT
DWORD DLLCALLCONV WDC_DriverClose(void)
Closes the WDC WinDriver handle (acquired and stored by a previous call to WDC_DriverOpen()) and unin...
DWORD DLLCALLCONV WDC_PciDeviceClose(_In_ WDC_DEVICE_HANDLE hDev)
Uninitializes a WDC PCI device structure and frees the memory allocated for it.
#define WDC_ReadAddrBlock32(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_ReadAddrBlock with 4 bytes mode.
#define WDC_DBG_DEFAULT
Convenient debug options combinations/defintions.
DWORD DLLCALLCONV WDC_PciGetDeviceInfo(_Inout_ WD_PCI_CARD_INFO *pDeviceInfo)
Retrieves a PCI device's resources information (memory and I/O ranges and interrupt information).
@ WDC_ADDR_RW_DEFAULT
Default: memory resource - direct access; autoincrement on block transfers.
#define WDC_WriteAddrBlock64(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_WriteAddrBlock with 8 bytes mode.
#define WDC_ReadAddrBlock16(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_ReadAddrBlock with 2 bytes mode.
#define WDC_ReadAddrBlock64(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_ReadAddrBlock with 8 bytes mode.
DWORD DLLCALLCONV WDC_DriverOpen(_In_ WDC_DRV_OPEN_OPTIONS openOptions, _In_ const CHAR *pcLicense)
Opens and stores a handle to WinDriver's kernel module and initializes the WDC library according to t...
void * WDC_DEVICE_HANDLE
Handle to device information struct.
#define WDC_WriteAddrBlock16(hDev, dwAddrSpace, dwOffset, dwBytes, pData, options)
WDC_WriteAddrBlock with 2 bytes mode.
@ WD_STATUS_SUCCESS
[0] Operation completed successfully
const char *DLLCALLCONV WD_DriverName(const char *sName)
Sets the name of the WinDriver kernel module, which will be used by the calling application.