📄 isochapi.c
字号:
&dwBytesRet,
&overLapped);
dwRet = GetLastError();
if ((dwRet != ERROR_SUCCESS) && (dwRet != ERROR_IO_PENDING)) {
TRACE(TL_ERROR, (hWnd, "IsochAttachBuffers Failed = %d\r\n", dwRet));
}
else {
// we got a pending, so we need to wait...
if (dwRet == ERROR_IO_PENDING) {
if (!GetOverlappedResult(hDevice, &overLapped, &dwBytesRet, TRUE)) {
// getoverlappedresult failed, lets find out why...
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "IsochAttachBuffers: GetOverlappedResult Failed! dwRet = %d\r\n", dwRet));
}
}
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
Exit_IsochAttachBuffers:
TRACE(TL_TRACE, (hWnd, "pIsochDescriptor = 0x%x\r\n", pIsochAttachBuffers->pIsochDescriptor));
TRACE(TL_TRACE, (hWnd, "Exit IsochAttachBuffers\r\n"));
return(dwRet);
} // IsochAttachBuffers
ULONG
WINAPI
IsochDetachBuffers(
HWND hWnd,
PSTR szDeviceName,
PISOCH_DETACH_BUFFERS isochDetachBuffers
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochDetachBuffers\r\n"));
TRACE(TL_TRACE, (hWnd, "hResource = %p\r\n", isochDetachBuffers->hResource));
TRACE(TL_TRACE, (hWnd, "nNumberOfDescriptors = 0x%x\r\n", isochDetachBuffers->nNumberOfDescriptors));
TRACE(TL_TRACE, (hWnd, "pIsochDescriptor = 0x%x\r\n", isochDetachBuffers->pIsochDescriptor));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_DETACH_BUFFERS,
isochDetachBuffers,
sizeof(ISOCH_DETACH_BUFFERS),
NULL,
0,
&dwBytesRet,
NULL
);
if (!dwRet) {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
else {
dwRet = ERROR_SUCCESS;
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
TRACE(TL_TRACE, (hWnd, "Exit IsochDetachBuffers = %d\r\n", dwRet));
return(dwRet);
} // IsochDetachBuffers
ULONG
WINAPI
IsochFreeBandwidth(
HWND hWnd,
PSTR szDeviceName,
HANDLE hBandwidth
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochFreeBandwidth\r\n"));
TRACE(TL_TRACE, (hWnd, "hBandwidth = 0x%x\r\n", hBandwidth));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_FREE_BANDWIDTH,
&hBandwidth,
sizeof(HANDLE),
NULL,
0,
&dwBytesRet,
NULL
);
if (!dwRet) {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
else {
dwRet = ERROR_SUCCESS;
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
TRACE(TL_TRACE, (hWnd, "Exit IsochFreeBandwidth = %d\r\n", dwRet));
return(dwRet);
} // IsochFreeBandwidth
ULONG
WINAPI
IsochFreeChannel(
HWND hWnd,
PSTR szDeviceName,
ULONG nChannel
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochFreeChannel\r\n"));
TRACE(TL_TRACE, (hWnd, "nChannel = 0x%x\r\n", nChannel));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_FREE_CHANNEL,
&nChannel,
sizeof(ULONG),
NULL,
0,
&dwBytesRet,
NULL
);
if (!dwRet) {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
else {
dwRet = ERROR_SUCCESS;
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
TRACE(TL_TRACE, (hWnd, "Exit IsochFreeChannel = %d\r\n", dwRet));
return(dwRet);
} // IsochFreeChannel
ULONG
WINAPI
IsochFreeResources(
HWND hWnd,
PSTR szDeviceName,
HANDLE hResource
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochFreeResources\r\n"));
TRACE(TL_TRACE, (hWnd, "hResource = %p\r\n", hResource));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_FREE_RESOURCES,
&hResource,
sizeof(HANDLE),
NULL,
0,
&dwBytesRet,
NULL
);
if (!dwRet) {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
else {
dwRet = ERROR_SUCCESS;
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
TRACE(TL_TRACE, (hWnd, "Exit IsochFreeResources = %d\r\n", dwRet));
return(dwRet);
} // IsochFreeResources
ULONG
WINAPI
IsochListen(
HWND hWnd,
PSTR szDeviceName,
PISOCH_LISTEN isochListen
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochListen\r\n"));
TRACE(TL_TRACE, (hWnd, "hResource = %p\r\n", isochListen->hResource));
TRACE(TL_TRACE, (hWnd, "fulFlags = 0x%x\r\n", isochListen->fulFlags));
TRACE(TL_TRACE, (hWnd, "StartTime.CL_CycleOffset = 0x%x\r\n", isochListen->StartTime.CL_CycleOffset));
TRACE(TL_TRACE, (hWnd, "StartTime.CL_CycleCount = 0x%x\r\n", isochListen->StartTime.CL_CycleCount));
TRACE(TL_TRACE, (hWnd, "StartTime.CL_SecondCount = 0x%x\r\n", isochListen->StartTime.CL_SecondCount));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_LISTEN,
isochListen,
sizeof(ISOCH_LISTEN),
NULL,
0,
&dwBytesRet,
NULL
);
if (!dwRet) {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
else {
dwRet = ERROR_SUCCESS;
}
// free up resources
CloseHandle(hDevice);
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
TRACE(TL_TRACE, (hWnd, "Exit IsochListen = %d\r\n", dwRet));
return(dwRet);
} // IsochListen
ULONG
WINAPI
IsochQueryCurrentCycleTime(
HWND hWnd,
PSTR szDeviceName,
PCYCLE_TIME CycleTime
)
{
HANDLE hDevice;
DWORD dwRet, dwBytesRet;
TRACE(TL_TRACE, (hWnd, "Enter IsochQueryCurrentCycleTime\r\n"));
hDevice = OpenDevice(hWnd, szDeviceName, FALSE);
if (hDevice != INVALID_HANDLE_VALUE) {
dwRet = DeviceIoControl( hDevice,
IOCTL_ISOCH_QUERY_CURRENT_CYCLE_TIME,
NULL,
0,
CycleTime,
sizeof(CYCLE_TIME),
&dwBytesRet,
NULL
);
if (dwRet) {
dwRet = ERROR_SUCCESS;
TRACE(TL_TRACE, (hWnd, "CycleTime.CL_CycleOffset = 0x%x\r\n", CycleTime->CL_CycleOffset));
TRACE(TL_TRACE, (hWnd, "CycleTime.CL_CycleCount = 0x%x\r\n", CycleTime->CL_CycleCount));
TRACE(TL_TRACE, (hWnd, "CycleTime.CL_SecondCount = 0x%x\r\n", CycleTime->CL_SecondCount));
}
else {
dwRet = GetLastError();
TRACE(TL_ERROR, (hWnd, "Error = 0x%x\r\n", dwRet));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -