divahook: Add initial Project Diva hook

This commit is contained in:
Tau
2019-03-16 11:57:17 -04:00
parent 690f96f276
commit 24b82b64e6
10 changed files with 528 additions and 0 deletions

38
divahook/_com10.c Normal file
View File

@ -0,0 +1,38 @@
#include <windows.h>
#include <assert.h>
#include <stdint.h>
#include "board/sg-reader.h"
#include "divahook/_com10.h"
#include "hook/iohook.h"
static HRESULT com10_handle_irp(struct irp *irp);
static struct sg_reader com10_reader;
HRESULT com10_hook_init(void)
{
HRESULT hr;
hr = sg_reader_init(&com10_reader, 10);
if (FAILED(hr)) {
return hr;
}
return iohook_push_handler(com10_handle_irp);
}
static HRESULT com10_handle_irp(struct irp *irp)
{
assert(irp != NULL);
if (!sg_reader_match_irp(&com10_reader, irp)) {
return iohook_invoke_next(irp);
}
return sg_reader_handle_irp(&com10_reader, irp);
}