Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/libsaio/ext2fs.c

Source at commit 333 created 13 years 9 months ago.
By meklort, Initial version of the module system. Basic at the moment, needs a lot of work. Modules (should) be able to link with any function or global variable exported by chameleon. Modules currently *cannot* lonk with each other, if you try to, bad things might happen. Lots fo verbose / debugging information is int modules.c. If you write a module that doesn't load properly, upload a copy of the module, the source, and the issues you are having to the issue tracker and I'll try to fix the bug.
1/*
2 * ext2fs.c
3 *
4 *
5 * Created by mackerintel on 1/26/09.
6 * Copyright 2009 __MyCompanyName__. All rights reserved.
7 *
8 */
9
10#include "libsaio.h"
11#include "sl.h"
12#include "ext2fs.h"
13
14#define EX2ProbeSize2048
15
16bool EX2Probe (const void *buf)
17{
18return (OSReadLittleInt16(buf+0x438,0)==0xEF53);
19}
20
21void EX2GetDescription(CICell ih, char *str, long strMaxLen)
22{
23char * buf=malloc (EX2ProbeSize);
24str[0]=0;
25if (!buf)
26return;
27Seek(ih, 0);
28Read(ih, (long)buf, EX2ProbeSize);
29if (!EX2Probe (buf))
30{
31free (buf);
32return;
33}
34if (OSReadLittleInt32 (buf+0x44c,0)<1)
35{
36free (buf);
37return;
38}
39str[strMaxLen]=0;
40strncpy (str, buf+0x478, min (strMaxLen, 16));
41free (buf);
42}
43

Archive Download this file

Revision: 333