2018-11-21 01:29:40 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
2019-02-26 02:56:45 +00:00
|
|
|
|
2019-02-26 18:48:52 +00:00
|
|
|
#include "board/sg-reader.h"
|
2018-11-21 01:29:40 +00:00
|
|
|
|
|
|
|
#include "cardhook/_com12.h"
|
|
|
|
|
|
|
|
#include "hook/iohook.h"
|
|
|
|
|
|
|
|
static HRESULT com12_handle_irp(struct irp *irp);
|
|
|
|
|
2019-02-26 18:48:52 +00:00
|
|
|
static struct sg_reader com12_reader;
|
2018-11-21 01:29:40 +00:00
|
|
|
|
2019-02-26 02:56:45 +00:00
|
|
|
HRESULT com12_hook_init(void)
|
2018-11-21 01:29:40 +00:00
|
|
|
{
|
2019-02-26 02:56:45 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
2019-03-16 15:42:36 +00:00
|
|
|
hr = sg_reader_init(&com12_reader, 12);
|
2019-02-26 02:56:45 +00:00
|
|
|
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return iohook_push_handler(com12_handle_irp);
|
2018-11-21 01:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT com12_handle_irp(struct irp *irp)
|
|
|
|
{
|
|
|
|
assert(irp != NULL);
|
|
|
|
|
2019-03-16 15:42:36 +00:00
|
|
|
if (!sg_reader_match_irp(&com12_reader, irp)) {
|
|
|
|
return iohook_invoke_next(irp);
|
|
|
|
}
|
2018-11-21 01:29:40 +00:00
|
|
|
|
2019-03-16 15:42:36 +00:00
|
|
|
return sg_reader_handle_irp(&com12_reader, irp);
|
2018-11-21 01:29:40 +00:00
|
|
|
}
|