1 | /*␊ |
2 | * ext2fs.c␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by mackerintel on 1/26/09.␊ |
6 | * Copyright 2009 __MyCompanyName__. All rights reserved.␊ |
7 | *␊ |
8 | */␊ |
9 | #include "libsaio.h"␊ |
10 | #include "sl.h"␊ |
11 | #include "ext2fs.h"␊ |
12 | ␊ |
13 | #define EX2ProbeSize␉2048␊ |
14 | ␊ |
15 | bool EX2Probe (const void *buf)␊ |
16 | {␊ |
17 | ␉return (OSReadLittleInt16(buf+0x438,0)==0xEF53);␊ |
18 | }␊ |
19 | ␊ |
20 | void EX2GetDescription(CICell ih, char *str, long strMaxLen)␊ |
21 | {␊ |
22 | ␉char * buf=malloc (EX2ProbeSize);␊ |
23 | ␉str[0]=0;␊ |
24 | ␉if (!buf)␊ |
25 | ␉␉return;␊ |
26 | ␉Seek(ih, 0);␊ |
27 | ␉Read(ih, (long)buf, EX2ProbeSize);␊ |
28 | ␉if (!EX2Probe (buf))␊ |
29 | ␉{␊ |
30 | ␉␉free (buf);␊ |
31 | ␉␉return;␊ |
32 | ␉}␊ |
33 | ␉if (OSReadLittleInt32 (buf+0x44c,0)<1)␊ |
34 | ␉{␊ |
35 | ␉␉free (buf);␊ |
36 | ␉␉return;␊ |
37 | ␉}␊ |
38 | ␉str[strMaxLen]=0;␊ |
39 | ␉strncpy (str, buf+0x478, min (strMaxLen, 16));␊ |
40 | ␉free (buf);␊ |
41 | }␊ |
42 | |