Chameleon

Chameleon Commit Details

Date:2015-05-22 22:23:54 (8 years 11 months ago)
Author:ErmaC
Commit:2694
Parents: 2693
Message:Changed type definition for getStringFromUUID.
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/smbios.c
M/branches/ErmaC/Enoch/i386/libsaio/convert.c
M/branches/ErmaC/Enoch/i386/libsaio/saio_types.h
M/branches/ErmaC/Enoch/i386/libsaio/convert.h

File differences

branches/ErmaC/Enoch/i386/libsaio/smbios.c
12761276
12771277
12781278
1279
12791280
12801281
12811282
1282
1283
12831284
12841285
12851286
{
uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;
SMBStructHeader *structHeader = (SMBStructHeader *)ptr;
uint8_t *ret = NULL;
int i, isZero, isOnes;
uint8_t fixedUUID[UUID_LEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist); // try to get user's uuid from smbios.plist
uint8_t *ret = (uint8_t *)getUUIDFromString(sysId); // convert user's uuid from string
ret = (uint8_t *)getUUIDFromString(sysId); // convert user's uuid from string
for (;(structHeader->type != kSMBTypeSystemInformation);) // find System Information Table (Type 1) in patched SMBIOS
{
branches/ErmaC/Enoch/i386/libsaio/convert.c
1111
1212
1313
14
14
1515
1616
1717
......
197197
198198
199199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/* ======================================================= */
/** Transform a 16 bytes hexadecimal value UUID to a string */
const char *getStringFromUUID(const EFI_CHAR8 *eUUID)
const char *getStringFromUUID(const uint8_t *eUUID)
{
static char msg[UUID_LEN*2 + 8] = "";
if (!eUUID) return "";
}
/* ======================================================= */
// FIXME: can't use my original code here,
// Ironically, trying to reuse convertHexStr2Binary() would RESET the system!
/*
static EFI_CHAR8 *getUUIDFromString2(const char * szInUUID)
{
char szUUID[UUID_LEN+1], *p=szUUID;
int size=0;
void* ret;
if (!szInUUID || strlen(szInUUID)<UUID_LEN) return (EFI_CHAR8*) 0;
while(*szInUUID) if (*szInUUID!='-') *p++=*szInUUID++; else szInUUID++;
*p='\0';
ret = convertHexStr2Binary(szUUID, &size);
if (!ret || size!=UUID_LEN)
{
verbose("UUID: cannot convert string <%s> to valid UUID.\n", szUUID);
return (EFI_CHAR8*) 0;
}
return (EFI_CHAR8 *) ret; // new allocated buffer containing the converted string to bin
}
*/
branches/ErmaC/Enoch/i386/libsaio/saio_types.h
103103
104104
105105
106
106
107107
108108
109109
......
122122
123123
124124
125
125
126126
127127
128128
unsigned char dev_path[16];
unsigned char reserved3;
unsigned char checksum;
} params;
} params __attribute__((packed));
struct drive_dpte
{
unsigned short reserved;
unsigned char revision;
unsigned char checksum;
} dpte;
} dpte __attribute__((packed));
} __attribute__((packed));
typedef struct boot_drive_info boot_drive_info_t;
branches/ErmaC/Enoch/i386/libsaio/convert.h
1111
1212
1313
14
14
1515
1616
1717
#define UUID_LEN16
const char*getStringFromUUID(const EFI_CHAR8* uuid);
const char*getStringFromUUID(const uint8_t *uuid);
EFI_CHAR8*getUUIDFromString(const char *source);
void*convertHexStr2Binary(const char *hexStr, int *outLength);
uint32_tascii_hex_to_int(char *buff);

Archive Download the corresponding diff file

Revision: 2694