Use new iohook_open_nul_fd() API

Makes error handling more consistent
This commit is contained in:
Tau
2019-11-03 11:02:54 -05:00
parent 7ee74214f7
commit 879dc0bfb4
6 changed files with 52 additions and 8 deletions

View File

@ -26,15 +26,27 @@ static HANDLE hwmon_fd;
HRESULT hwmon_hook_init(const struct hwmon_config *cfg)
{
HRESULT hr;
assert(cfg != NULL);
if (!cfg->enable) {
return S_FALSE;
}
hwmon_fd = iohook_open_dummy_fd();
hr = iohook_open_nul_fd(&hwmon_fd);
return iohook_push_handler(hwmon_handle_irp);
if (FAILED(hr)) {
return hr;
}
hr = iohook_push_handler(hwmon_handle_irp);
if (FAILED(hr)) {
return hr;
}
return S_OK;
}
static HRESULT hwmon_handle_irp(struct irp *irp)

View File

@ -139,7 +139,12 @@ HRESULT nusec_hook_init(
nusec_nearfull = 0x00010200;
nusec_play_count = 0;
nusec_play_limit = 1024;
nusec_fd = iohook_open_dummy_fd();
hr = iohook_open_nul_fd(&nusec_fd);
if (FAILED(hr)) {
return hr;
}
hr = iohook_push_handler(nusec_handle_irp);