platform/pcbid.c: Fixups

This commit is contained in:
Tau 2019-08-30 18:45:24 -04:00
parent 94005de9e9
commit 886b7c5990
1 changed files with 9 additions and 0 deletions

View File

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