Chameleon

Chameleon Svn Source Tree

Root/branches/Bungo/i386/libsaio/befs.c

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;
33}
34Seek(ih, 0);
35Read(ih, (long)buf, BeFSProbeSize);
36if (!BeFSProbe (buf))
37{
38free (buf);
39return;
40}
41str[strMaxLen]=0;
42strncpy (str, buf+0x200, MIN (strMaxLen, 32));
43free (buf);
44}
45

Archive Download this file

Revision: 2360