Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/i386/libsaio/befs.c

Source at commit 307 created 12 years 11 months ago.
By ifabio, merge changes from trunk (929). Also merge the module changes from Azimutz branche (fix compile error) Also edited the info.plist into AHCIPortInjector.kext: http://forum.voodooprojects.org/index.php/topic,1170.0.html
1/*
2 * befs.c
3 *
4 *
5 * Created by scorpius
6 * Copyright 2010
7 *
8 */
9
10#include "libsaio.h"
11#include "sl.h"
12#include "befs.h"
13
14#define BeFSProbeSize2048
15
16#define SUPER_BLOCK_MAGIC1 0x42465331 /* BFS1 */
17#define SUPER_BLOCK_MAGIC2 0xdd121031
18#define SUPER_BLOCK_MAGIC3 0x15b6830e
19
20/* Find BeFS signature */
21bool BeFSProbe (const void *buf)
22{
23return (OSReadLittleInt32(buf+0x220,0)==SUPER_BLOCK_MAGIC1);
24}
25
26/* Find BeFS volume label */
27void BeFSGetDescription(CICell ih, char *str, long strMaxLen)
28{
29char * buf=malloc (BeFSProbeSize);
30str[0]=0;
31if (!buf)
32return;
33Seek(ih, 0);
34Read(ih, (long)buf, BeFSProbeSize);
35if (!BeFSProbe (buf))
36{
37free (buf);
38return;
39}
40str[strMaxLen]=0;
41strncpy (str, buf+0x200, min (strMaxLen, 32));
42free (buf);
43}
44

Archive Download this file

Revision: 307