From 886b7c59905a76f43228811ad9cc93b0f0adc2e0 Mon Sep 17 00:00:00 2001 From: Tau Date: Fri, 30 Aug 2019 18:45:24 -0400 Subject: [PATCH] platform/pcbid.c: Fixups --- platform/pcbid.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/pcbid.c b/platform/pcbid.c index 7c66c24..86a5f20 100644 --- a/platform/pcbid.c +++ b/platform/pcbid.c @@ -30,6 +30,12 @@ void pcbid_hook_init(const struct pcbid_config *cfg) return; } + if (wcslen(cfg->serial_no) != 15) { + dprintf("Pcbid: ERROR: Must be 15 chars! ex: ACAE01A99999999\n"); + + return; + } + memcpy(&pcbid_cfg, cfg, sizeof(*cfg)); hook_table_apply(NULL, "kernel32.dll", pcbid_syms, _countof(pcbid_syms)); } @@ -53,7 +59,10 @@ static BOOL WINAPI pcbid_GetComputerNameA(char *dest, uint32_t *len) } dprintf("Pcbid: Get PCB serial\n"); + wcstombs_s(NULL, dest, *len, pcbid_cfg.serial_no, *len - 1); + SetLastError(ERROR_SUCCESS); + *len = required - 1; return TRUE; }