DllMain Callback Function---Windows架構下呼叫dll的主程式結構
BOOL WINAPI DllMain(
__in HINSTANCE hinstDLL,
__in DWORD fdwReason,
__in LPVOID lpvReserved
);
XXX_IOControl (Device Manager)
This function sends a command to a device.
BOOL XXX_IOControl(
DWORD hOpenContext,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut
);
Parameters
hOpenContext
[in] Handle to the open context of the device. The XXX_Open (Device Manager) function creates and returns this identifier.
dwCode
[in] I/O control operation to perform. These codes are device-specific and are usually exposed to developers through a header file.
pBufIn
[in] Pointer to the buffer containing data to transfer to the device.
dwLenIn
[in] Number of bytes of data in the buffer specified for pBufIn.
pBufOut
[out] Pointer to the buffer used to transfer the output data from the device.
dwLenOut
[in] Maximum number of bytes in the buffer specified by pBufOut.
pdwActualOut
[out] Pointer to the DWORD buffer that this function uses to return the actual number of bytes received from the device.
MmMapIoSpace
This function maps a physical address space to a nonpaged, process-dependent address space. It provides a virtual address, which is directly mapped, to the device.
BOOL WINAPI DllMain(
__in HINSTANCE hinstDLL,
__in DWORD fdwReason,
__in LPVOID lpvReserved
);
XXX_IOControl (Device Manager)
This function sends a command to a device.
BOOL XXX_IOControl(
DWORD hOpenContext,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut
);
Parameters
hOpenContext
[in] Handle to the open context of the device. The XXX_Open (Device Manager) function creates and returns this identifier.
dwCode
[in] I/O control operation to perform. These codes are device-specific and are usually exposed to developers through a header file.
pBufIn
[in] Pointer to the buffer containing data to transfer to the device.
dwLenIn
[in] Number of bytes of data in the buffer specified for pBufIn.
pBufOut
[out] Pointer to the buffer used to transfer the output data from the device.
dwLenOut
[in] Maximum number of bytes in the buffer specified by pBufOut.
pdwActualOut
[out] Pointer to the DWORD buffer that this function uses to return the actual number of bytes received from the device.
MmMapIoSpace
This function maps a physical address space to a nonpaged, process-dependent address space. It provides a virtual address, which is directly mapped, to the device.
PVOID MmMapIoSpace(
PHYSICAL_ADDRESS PhysicalAddress,
ULONG NumberOfBytes,
BOOLEAN CacheEnable
);
Parameters
PhysicalAddress
[in] Starting physical address of the I/O range to map.
NumberOfBytes
[in] Number of bytes to map.
CacheEnable
[in]Flag to indicate whether the physical address range can map as cached memory. For device registers, this value is usually FALSE.
NDIS_PHYSICAL_ADDRESS
This data type is equivalent to the system-defined LARGE_INTEGER type.
留言