* Distribute magic files with w32dist

* Fix symstall of magic files
* Do not walk hidden files in magic
* Add has_va in RBinInfo class for bindings
This commit is contained in:
pancake 2011-11-29 18:31:26 +01:00
parent 3491055f76
commit 4a50f8a94d
8 changed files with 14 additions and 15 deletions

View File

@ -54,6 +54,8 @@ w32dist:
for a in `find libr | grep -e dll$$`; do cp $$a w32dist ; done
for a in `find binr | grep -e exe$$`; do cp $$a w32dist ; done
rm w32dist/plugin.dll
mkdir -p w32dist/radare2/${VERSION}/magic
cp -f libr/magic/d/default/* w32dist/radare2/${VERSION}/magic
mkdir -p w32dist/radare2/${VERSION}/syscall
cp -f libr/syscall/d/*.sdb w32dist/radare2/${VERSION}/syscall
mkdir -p w32dist/radare2/${VERSION}/opcodes

6
TODO
View File

@ -6,7 +6,6 @@
------8<-------------------8<--------------------8<-----------------8<----------
====[[ 0.9 ]]====
* rax2 must convert bin from stdin to hexpairs to stdout
* r_cons_visual_write_tail() -> fill end of screen with spaces \o/
* Add graph.nodecolor graph.bgcolor graph.edgecolor ??
* Add !load in r2 (oo args)
@ -37,11 +36,6 @@
- save memory and accelerate code analysis
- basicblock signatures must be just pointers to a big buf
OSX
===
* Proper support for MACH-O binaries
- rabin2 -f works? i think its used with '-a'
Other stuff
===========
* asm.pseudo for brainfuck

View File

@ -550,9 +550,11 @@ static int apprentice_load(RMagic *ms, struct r_magic **magicp, ut32 *nmagicp, c
dir = opendir (fn);
if (dir) {
while ((d = readdir (dir))) {
snprintf (subfn, sizeof(subfn), "%s/%s", fn, d->d_name);
if (*d->d_name=='.') continue;
snprintf (subfn, sizeof (subfn), "%s/%s", fn, d->d_name);
if (stat (subfn, &st) == 0 && S_ISREG (st.st_mode))
load_1 (ms, action, subfn, &errs, &marray, &marraycount);
else perror (subfn);
}
closedir (dir);
} else errs++;

View File

@ -7,7 +7,7 @@ install: ${F_SDB}
CWD=$(shell pwd)
symstall install-symlink: ${F_SDB}
mkdir -p ${DESTDIR}${PREFIX}/lib/radare2/${VERSION}/magic
cd default ; for a in * ; do ln -fs ${CWD}/default/d/$$a \
cd default ; for a in * ; do ln -fs ${CWD}/default/$$a \
${DESTDIR}${PREFIX}/lib/radare2/${VERSION}/magic/$$a ; done
.PHONY: install symstall

View File

@ -94,18 +94,18 @@ int file_fsmagic(struct r_magic_set *ms, const char *fn, struct stat *sb) {
*/
#ifdef S_IFLNK
if ((ms->flags & R_MAGIC_SYMLINK) == 0)
ret = lstat(fn, sb);
ret = lstat (fn, sb);
else
#endif
ret = stat(fn, sb); /* don't merge into if; see "ret =" above */
ret = stat (fn, sb); /* don't merge into if; see "ret =" above */
if (ret) {
if (ms->flags & R_MAGIC_ERROR) {
file_error(ms, errno, "cannot stat `%s'", fn);
file_error (ms, errno, "cannot stat `%s'", fn);
return -1;
}
if (file_printf(ms, "cannot open `%s' (%s)",
fn, strerror(errno)) == -1)
if (file_printf (ms, "cannot open `%s' (%s)",
fn, strerror (errno)) == -1)
return -1;
return 1;
}

View File

@ -195,7 +195,7 @@ int file_reset(RMagic *ms) {
ms->haderr = 0;
ms->error = -1;
if (ms->mlist == NULL) {
file_error (ms, 0, "no magic files loaded");
file_error (ms, 0, "no magic files loaded! ");
return -1;
}
return 0;

View File

@ -153,7 +153,7 @@ static void close_and_restore (const RMagic *ms, const char *name, int fd, const
close (fd);
}
static const char * file_or_fd(RMagic *ms, const char *inname, int fd) {
static const char *file_or_fd(RMagic *ms, const char *inname, int fd) {
int ispipe = 0, rv = -1;
unsigned char *buf;
struct stat sb;

View File

@ -114,6 +114,7 @@ namespace Radare {
public string os;
public string subsystem;
public int bits;
public bool has_va;
public bool big_endian;
public uint32 dbg_info;
}