Bemanitools v5.26 release

This commit is contained in:
icex2
2019-09-27 22:36:50 +02:00
commit cbd7720349
718 changed files with 62731 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
exes += pcbidgen
libs_pcbidgen := \
security \
util \
src_pcbidgen := \
main.c \
+60
View File
@@ -0,0 +1,60 @@
#include <windows.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "security/id.h"
#include "util/hex.h"
static void print_usage(char** argv)
{
fprintf(stderr,
"Usage: %s <cmd> ...\n"
" gen: Generate a random pcbid\n"
" make <8 byte hex id>: Create a full pcbid (header + checksum) "
"of the provided id\n",
argv[0]);
}
int main(int argc, char** argv)
{
struct security_id id;
char* str;
if (argc < 2) {
print_usage(argv);
return -1;
}
if (!strcmp(argv[1], "gen")) {
srand(time(NULL));
for (uint8_t i = 0; i < sizeof(id.id); i++) {
id.id[i] = rand();
}
} else if (!strcmp(argv[1], "make")) {
if (argc < 3) {
print_usage(argv);
return -2;
}
if (strlen(argv[2]) != 16) {
fprintf(stderr, "Invaild length %d for id, must be 16\n",
strlen(argv[2]));
return -3;
}
hex_decode(id.id, sizeof(id.id), argv[2], strlen(argv[2]));
} else {
fprintf(stderr, "Invaild command '%s'\n", argv[1]);
return -4;
}
security_id_prepare(&id);
str = security_id_to_str(&id, false);
printf("%s\n", str);
free(str);
}