mirror of
https://gitea.tendokyu.moe/TeamTofuShop/taitools.git
synced 2026-09-26 16:18:02 +03:00
55 lines
850 B
C
55 lines
850 B
C
#include <windows.h>
|
|
|
|
#include <devioctl.h>
|
|
#include <hidclass.h>
|
|
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "board/guid.h"
|
|
#include "board/j9100647a.h"
|
|
|
|
#include "hook/iobuf.h"
|
|
#include "hook/iohook.h"
|
|
|
|
#include "hooklib/setupapi.h"
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
// USB IO
|
|
|
|
static HRESULT usbio_handle_irp(struct irp *irp);
|
|
|
|
static const wchar_t usbio_path[] = L"$usbio";
|
|
|
|
static HANDLE usbio_fd;
|
|
static void *usbio_ops_ctx;
|
|
|
|
HRESULT usbio_hook_init()
|
|
{
|
|
HRESULT hr;
|
|
|
|
hr = iohook_open_nul_fd(&usbio_fd);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
iohook_push_handler(usbio_handle_irp);
|
|
|
|
hr = setupapi_add_phantom_dev(&usbio_guid, usbio_path);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
static HRESULT usbio_handle_irp(struct irp *irp)
|
|
{
|
|
return S_OK;
|
|
}
|