2019-03-05 20:34:43 +01:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "board/sg-reader.h"
|
|
|
|
|
|
|
|
#include "hook/iohook.h"
|
|
|
|
|
2019-03-16 16:42:36 +01:00
|
|
|
#include "idzhook/_com10.h"
|
2019-03-05 20:34:43 +01:00
|
|
|
|
2019-03-16 16:42:36 +01:00
|
|
|
static HRESULT com10_handle_irp(struct irp *irp);
|
2019-03-05 20:34:43 +01:00
|
|
|
|
|
|
|
static struct sg_reader com10_reader;
|
|
|
|
|
|
|
|
HRESULT com10_hook_init(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
2019-03-16 16:42:36 +01:00
|
|
|
hr = sg_reader_init(&com10_reader, 10);
|
2019-03-05 20:34:43 +01:00
|
|
|
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return iohook_push_handler(com10_handle_irp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT com10_handle_irp(struct irp *irp)
|
|
|
|
{
|
|
|
|
assert(irp != NULL);
|
|
|
|
|
2019-03-16 16:42:36 +01:00
|
|
|
if (!sg_reader_match_irp(&com10_reader, irp)) {
|
|
|
|
return iohook_invoke_next(irp);
|
|
|
|
}
|
2019-03-05 20:34:43 +01:00
|
|
|
|
2019-03-16 16:42:36 +01:00
|
|
|
return sg_reader_handle_irp(&com10_reader, irp);
|
2019-03-05 20:34:43 +01:00
|
|
|
}
|