platform/pcbid.c: Return HRESULT for consistency

This commit is contained in:
Tau 2019-11-03 19:54:31 -05:00
parent a5a42c3326
commit c7255e3ebb
3 changed files with 11 additions and 5 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);