1 | #include "libsaio.h"␊ |
2 | #include "sl.h"␊ |
3 | #include "freebsd.h"␊ |
4 | ␊ |
5 | #define FreeBSDProbeSize␉2048␊ |
6 | ␊ |
7 | bool FreeBSDProbe (const void *buf)␊ |
8 | {␊ |
9 | ␉return (OSReadLittleInt32(buf+0xA55C,0)==0x19540119);␊ |
10 | }␊ |
11 | void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen)␊ |
12 | {␊ |
13 | ␉char * buf=malloc(FreeBSDProbeSize);␊ |
14 | ␉str[0]=0;␊ |
15 | ␉if (!buf)␊ |
16 | ␉␉return;␊ |
17 | ␉Seek(ih, 0);␊ |
18 | ␉Read(ih, (long)buf, FreeBSDProbeSize);␊ |
19 | ␉if (!FreeBSDProbe (buf))␊ |
20 | ␉{␊ |
21 | ␉␉free (buf);␊ |
22 | ␉␉return;␊ |
23 | ␉}␊ |
24 | ␉if (OSReadLittleInt32 (buf+0x44c,0)<1)␊ |
25 | ␉{␊ |
26 | ␉␉free (buf);␊ |
27 | ␉␉return;␊ |
28 | ␉}␊ |
29 | ␉str[strMaxLen]=0;␊ |
30 | ␉strncpy (str, buf+0x478, MIN (strMaxLen, 32));␊ |
31 | ␉free (buf);␊ |
32 | }␊ |
33 | |