- Jad (decompiler)
- ClassFileAnalyzer (disassembler)
- jasmin (assembler)
*1: http://web.archive.org/web/20080214075546/http://www.kpdus.com/jad.html
*2: http://classfileanalyzer.javaseiten.de/
*3: http://jasmin.sourceforge.net/
ソースはこんな感じ。お手軽ですよね。<?xml version="1.0" standalone="no"?>生成したSVGのプレビューや変換にはInkscape(*2)を使いました。Ubuntuからはapt-getでヘロっとインストールできました。EPSへの変換ができます。SVG Import Filter(*3)を使えばOpenOffice経由で色々と変換も可能。いきなりWMFとかにも出来るんだけど、グループ化を解除すると黒い豆腐になる問題があって、どういう経路で変換するのがベストかは今のところ模索中です。
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g>
<text fill="black" x="62" y="50" font-size="6">RI2S1_DATA</text>
<line stroke="black" stroke-width="1" x1="50" y1="53" x2="250" y2="53"/>
<polygon fill="black" stroke="black" stroke-width="1" points="244,50 244,56 250,53"/>
</g>
... 中略 ...
</svg>
#include <windows.h>
#include <stdio.h>
int WINAPI
WinMain
(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HANDLE hFile = CreateFile("shared_file",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (INVALID_HANDLE_VALUE != hFile) MessageBoxA(NULL, "CreateFile: success", "TEST", MB_OK);
HANDLE hShare = CreateFileMapping(hFile,
NULL,
PAGE_READWRITE,
0,
1024,
"shared_memory");
if (INVALID_HANDLE_VALUE != hShare) MessageBoxA(NULL, "CreateFileMapping: success", "TEST", MB_OK);
char *sharedBuffer;
sharedBuffer = (char *)MapViewOfFile(hShare,
FILE_MAP_WRITE,
0,
0,
1024);
if (NULL != sharedBuffer) MessageBoxA(NULL, "MapViewOfFile: success", "TEST", MB_OK);
snprintf(sharedBuffer, 1024, "this message is send via mmap");
MessageBoxA(NULL, "Write to Memory Mapped File", "TEST", MB_OK);
DWORD dwWrote;
BOOL rc = WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
"hello from exe",
15,
&dwWrote,
NULL);
if (rc) MessageBoxA(NULL, "WriteFile to STDOUT: success", "TEST", MB_OK);
else MessageBoxA(NULL, "WriteFile to STDOUT: failed", "TEST", MB_OK);
char readBuffer[256];
DWORD dwRead = 0;
rc = ReadFile(GetStdHandle(STD_INPUT_HANDLE),
readBuffer,
255,
&dwRead,
NULL);
readBuffer[dwRead] = 0;
char message[512];
snprintf(message, 512, "ReadFile from STDIN: %s", readBuffer);
MessageBoxA(NULL, message, "TEST", MB_OK);
return 0;
}
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/mman.h>
int
main
(int argc, char **argv)
{
int elf2exe_pipefd[2];
int exe2elf_pipefd[2];
if (-1 == pipe(elf2exe_pipefd)) perror("pipe: elf2exe");
if (-1 == pipe(exe2elf_pipefd)) perror("pipe: exe2elf");
pid_t cpid = fork();
if (-1 == cpid) perror("fork");
if (cpid == 0) {
// child (exe)
close(STDIN_FILENO);
close(STDOUT_FILENO);
if (-1 == dup2(elf2exe_pipefd[0], STDIN_FILENO)) perror("dup2: elf2exe");
if (-1 == dup2(exe2elf_pipefd[1], STDOUT_FILENO)) perror("dup2: exe2elf");
close(elf2exe_pipefd[0]);
close(elf2exe_pipefd[1]);
close(exe2elf_pipefd[0]);
close(exe2elf_pipefd[1]);
char *exec_argv[] = {
"wine",
"test.exe",
NULL,
};
execvp(exec_argv[0], exec_argv);
// no return
} else {
// parent (elf)
close(elf2exe_pipefd[0]);
close(exe2elf_pipefd[1]);
int fd_rd = exe2elf_pipefd[0];
int fd_wr = elf2exe_pipefd[1];
char buf[256];
ssize_t size = read(fd_rd, buf, 255);
if (-1 == size) perror("read");
buf[size] = 0;
printf("read from exe: %s\n", buf);
write(fd_wr, "hello from elf", 14);
int fd_map = open("shared_file", O_RDWR);
if (-1 == fd_map) perror("open");
char *shared = (char *)mmap(NULL, 1024,
PROT_READ | PROT_WRITE,
MAP_SHARED,
fd_map, 0);
if (NULL == shared) perror("mmap");
puts(shared);
fflush(stdout);
wait(NULL);
puts("parent process exit");
}
return 0;
}