From c7255e3ebba8a3fef5563d336bb2a9a4c327ac60 Mon Sep 17 00:00:00 2001 From: Tau Date: Sun, 3 Nov 2019 19:54:31 -0500 Subject: [PATCH] platform/pcbid.c: Return HRESULT for consistency --- platform/pcbid.c | 8 +++++--- platform/pcbid.h | 2 +- platform/platform.c | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/pcbid.c b/platform/pcbid.c index 86a5f20..8652246 100644 --- a/platform/pcbid.c +++ b/platform/pcbid.c @@ -22,22 +22,24 @@ static const struct hook_symbol pcbid_syms[] = { } }; -void pcbid_hook_init(const struct pcbid_config *cfg) +HRESULT pcbid_hook_init(const struct pcbid_config *cfg) { assert(cfg != NULL); if (!cfg->enable) { - return; + return S_FALSE; } if (wcslen(cfg->serial_no) != 15) { dprintf("Pcbid: ERROR: Must be 15 chars! ex: ACAE01A99999999\n"); - return; + return E_INVALIDARG; } memcpy(&pcbid_cfg, cfg, sizeof(*cfg)); hook_table_apply(NULL, "kernel32.dll", pcbid_syms, _countof(pcbid_syms)); + + return S_OK; } static BOOL WINAPI pcbid_GetComputerNameA(char *dest, uint32_t *len) diff --git a/platform/pcbid.h b/platform/pcbid.h index 1346af1..90f2f83 100644 --- a/platform/pcbid.h +++ b/platform/pcbid.h @@ -2,4 +2,4 @@ #include "platform/config.h" -void pcbid_hook_init(const struct pcbid_config *cfg); +HRESULT pcbid_hook_init(const struct pcbid_config *cfg); diff --git a/platform/platform.c b/platform/platform.c index 73a0afa..09f956a 100644 --- a/platform/platform.c +++ b/platform/platform.c @@ -69,7 +69,11 @@ HRESULT platform_hook_init( return hr; } - pcbid_hook_init(&cfg->pcbid); + hr = pcbid_hook_init(&cfg->pcbid); + + if (FAILED(hr)) { + return hr; + } hr = vfs_hook_init(&cfg->vfs);