Root/
Source at commit HEAD created 5 years 6 days ago. By ifabio, Few update to kernelPatcher (Credits to CrazyBirdy) | |
---|---|
1 | #include "libsaio.h"␊ |
2 | #include "sl.h"␊ |
3 | #include "openbsd.h"␊ |
4 | ␊ |
5 | #define OpenBSDProbeSize␉2048␊ |
6 | #define DISKMAGIC␉((uint32_t)0x82564557)␉/* The disk magic number */␊ |
7 | ␊ |
8 | bool OpenBSDProbe (const void *buf)␊ |
9 | {␊ |
10 | ␉return (OSReadLittleInt32(buf+0x200,0) == DISKMAGIC);␊ |
11 | }␊ |
12 | void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen)␊ |
13 | {␊ |
14 | ␉char * buf=malloc(OpenBSDProbeSize);␊ |
15 | ␉str[0]=0;␊ |
16 | ␉if (!buf)␊ |
17 | ␉␉return;␊ |
18 | ␉Seek(ih, 0);␊ |
19 | ␉Read(ih, (long)buf, OpenBSDProbeSize);␊ |
20 | ␉if (!OpenBSDProbe (buf))␊ |
21 | ␉{␊ |
22 | ␉␉free (buf);␊ |
23 | ␉␉return;␊ |
24 | ␉}␊ |
25 | ␉if (OSReadLittleInt32 (buf+0x44c,0)<1)␊ |
26 | ␉{␊ |
27 | ␉␉free (buf);␊ |
28 | ␉␉return;␊ |
29 | ␉}␊ |
30 | ␉str[strMaxLen]=0;␊ |
31 | ␉strncpy (str, buf+0x478, MIN (strMaxLen, 32));␊ |
32 | ␉free (buf);␊ |
33 | }␊ |
34 |