Exemplo n.º 1
0
/*
 *----------------------------------------------------------------------
 * DumpROMFObjFile --
 *
 *	Dump a Relocatable Object Module Format file, displaying only
 *	the exported symbols.
 *----------------------------------------------------------------------
 */
void
DumpROMFObjFile(LPVOID pBuffer, FILE *fout)
{
	BYTE type, length, *bp;
	char symbol[1024];

	while (1) {
#if MOB
		type = SkipToNextRecord(&(BYTE*)pBuffer);
#else
		bp = (BYTE*) pBuffer;
		type = SkipToNextRecord(&bp);
#endif
		if (type == 0x90) {	/* PUBDEF */
			if (((BYTE*)pBuffer)[4] != 0) {
				length = ((BYTE*)pBuffer)[5];
				strncpy(symbol, ((char*)pBuffer) + 6, length);
				symbol[length] = '\0';
				fprintf(fout, "\t%s\n", symbol);
			}
		} else if (type == 0x8B || type == 0x8A) { /* MODEND */
			break;
		}
	}
}
Exemplo n.º 2
0
/*
 *----------------------------------------------------------------------
 * DumpROMFObjFile --
 *
 *	Dump a Relocatable Object Module Format file, displaying only
 *	the exported symbols.
 *----------------------------------------------------------------------
 */
void
DumpROMFObjFile(LPVOID pBuffer, FILE *fout)
{
    BYTE type, length;
    char symbol[1024], *s;

    while (1) {
	type = SkipToNextRecord(&(BYTE*)pBuffer);
	if (type == 0x90) {	/* PUBDEF */
	    if (((BYTE*)pBuffer)[4] != 0) {
		length = ((BYTE*)pBuffer)[5];
		strncpy(symbol, ((char*)pBuffer) + 6, length);
		symbol[length] = '\0';
		s = symbol;
		if ((stricmp(s, "DllEntryPoint") != 0) 
			&& (stricmp(s, "DllMain") != 0)) {
		    if (s[0] == '_') {
			s++;
			fprintf(fout, "\t_%s\n\t%s=_%s\n", s, s, s);
		    } else {
			fprintf(fout, "\t%s\n", s);
		    }
		}
	    }
	} else if (type == 0x8B || type == 0x8A) { /* MODEND */
	    break;
	}
    }
}