OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
macserial.h
Go to the documentation of this file.
1//
2// Decode mac serial number
3//
4// Copyright (c) 2018-2020 vit9696
5// Copyright (c) 2020 Matis Schotte
6//
7
8#ifndef GENSERIAL_H
9#define GENSERIAL_H
10
11#include <stdbool.h>
12#include <stdint.h>
13
14#define PROGRAM_VERSION "2.1.8"
15
16#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
17
18#define SZUUID 16
19#define PRIUUID "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X"
20#define CASTUUID(uuid) (uuid)[0], (uuid)[1], (uuid)[2], (uuid)[3], (uuid)[4], (uuid)[5], (uuid)[6], \
21 (uuid)[7], (uuid)[8], (uuid)[9], (uuid)[10], (uuid)[11], (uuid)[12], (uuid)[13], (uuid)[14], (uuid)[15]
22
23#define SERIAL_WEEK_MIN 1
24#define SERIAL_WEEK_MAX 53
25#define SERIAL_YEAR_MIN 2000
26#define SERIAL_YEAR_MAX 2030
27
28#define SERIAL_YEAR_OLD_MIN 2003
29#define SERIAL_YEAR_OLD_MAX 2012
30
31#define SERIAL_YEAR_NEW_MIN 2010
32#define SERIAL_YEAR_NEW_MID 2020
33#define SERIAL_YEAR_NEW_MAX 2030
34
35#define SERIAL_COPY_MIN 1
36#define SERIAL_COPY_MAX 34
37
38#define SERIAL_LINE_MIN 0
39#define SERIAL_LINE_REPR_MAX 1155
40#define SERIAL_LINE_MAX 3399 /* 68*33 + 33*34 + 33 */
41
42#define SERIAL_OLD_LEN 11
43#define SERIAL_NEW_LEN 12
44
45#define MODEL_CODE_OLD_LEN 3
46#define MODEL_CODE_NEW_LEN 4
47
48#define COUNTRY_OLD_LEN 2
49#define COUNTRY_NEW_LEN 3
50
51#define MLB_MAX_SIZE 32
52
53typedef struct {
54 const char *productName;
55 const char *serialNumber;
57
58typedef struct {
59 const char *code;
60 const char *name;
62
63typedef struct {
64 const char *appleModel;
65 char country[4];
66 char year[3];
67 char week[3];
68 char line[4];
69 char model[5];
77 bool valid;
79
91
92#endif // GENSERIAL_H
INT32 int32_t
Definition lzss.h:34
PROGRAMMODE
Definition macserial.h:80
@ MODE_LIST_MODELS
Definition macserial.h:84
@ MODE_SYSTEM_INFO
Definition macserial.h:81
@ MODE_LIST_PRODUCTS
Definition macserial.h:85
@ MODE_GENERATE_ALL
Definition macserial.h:88
@ MODE_MLB_INFO
Definition macserial.h:83
@ MODE_GENERATE_CURRENT
Definition macserial.h:87
@ MODE_SERIAL_INFO
Definition macserial.h:82
@ MODE_GENERATE_MLB
Definition macserial.h:86
@ MODE_GENERATE_DERIVATIVES
Definition macserial.h:89
const char * name
Definition macserial.h:60
const char * code
Definition macserial.h:59
const char * serialNumber
Definition macserial.h:55
const char * productName
Definition macserial.h:54
int32_t modernCountryIdx
Definition macserial.h:71
int32_t decodedWeek
Definition macserial.h:74
int32_t modelIndex
Definition macserial.h:72
bool valid
Definition macserial.h:77
const char * appleModel
Definition macserial.h:64
int32_t decodedLine
Definition macserial.h:76
int32_t decodedYear
Definition macserial.h:73
int32_t legacyCountryIdx
Definition macserial.h:70
int32_t decodedCopy
Definition macserial.h:75