- Delete cputointel and roswebparser as unfinished components which aren't going to be further developed.

- Delete zoomin because there is a nicely working magnify application, and zoomin development stopped in 2002.

svn path=/trunk/; revision=40344
This commit is contained in:
Aleksey Bragin 2009-04-03 09:16:09 +00:00
parent 1f6ff5aeae
commit 81b0e18658
54 changed files with 0 additions and 6329 deletions

View file

@ -1,17 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
CPU_INT AnyalsingProcess()
{
/* FIXME it will set a name to the memory if we got one */
/* FIXME build the jump table */
return 0;
}

View file

@ -1,261 +0,0 @@
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
/*
* eax = register 3
* edx = register 4
* esp = register 1
* ebp = register 31
* ecx = 8
* ebx = 9
* esi = 10
* edi = 11
* mmx/sse/fpu 0 = 12
* mmx/sse/fpu 1 = 14
* mmx/sse/fpu 2 = 16
* mmx/sse/fpu 3 = 18
* mmx/sse/fpu 4 = 20
* mmx/sse/fpu 5 = 22
* mmx/sse/fpu 6 = 24
* mmx/sse/fpu 7 = 28
*/
static void standardreg(CPU_INT *RegTableCount, CPU_INT reg, CPU_INT setup_ebp, FILE *outfp)
{
/* eax */
if (reg == RegTableCount[3])
{
fprintf(outfp,"eax");
}
/* ebp */
else if (reg == RegTableCount[31])
{
fprintf(outfp,"ebp");
}
/* edx */
else if (reg == RegTableCount[4])
{
fprintf(outfp,"edx");
}
/* esp */
else if (reg == RegTableCount[1])
{
fprintf(outfp,"esp");
}
/* ecx */
else if (reg == RegTableCount[8])
{
fprintf(outfp,"ecx");
}
/* ebx */
else if (reg == RegTableCount[9])
{
fprintf(outfp,"ebx");
}
/* esi */
else if (reg == RegTableCount[10])
{
fprintf(outfp,"esi");
}
/* edi */
else if (reg == RegTableCount[11])
{
fprintf(outfp,"edi");
}
else
{
if (setup_ebp == 1)
fprintf(outfp,"dword [ebx - %d]");
else
fprintf(outfp,"; unsuported should not happen it happen :(\n");
}
}
CPU_INT ConvertToIA32Process( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount)
{
CPU_INT stack = 0;
CPU_UNINT tmp;
CPU_INT setup_ebp = 0 ; /* 0 = no, 1 = yes */
CPU_INT t=0;
/* Fixme optimze the RegTableCount table */
//if (HowManyRegInUse > 9)
if (HowManyRegInUse > 8)
{
setup_ebp =1; /* we will use ebx as ebp */
stack = HowManyRegInUse * regbits;
}
if (RegTableCount[1]!=0)
t++;
if (RegTableCount[3]!=0)
t++;
if (RegTableCount[4]!=0)
t++;
if (RegTableCount[8]!=0)
t++;
if (RegTableCount[9]!=0)
t++;
if (RegTableCount[10]!=0)
t++;
if (RegTableCount[11]!=0)
t++;
if (RegTableCount[31]!=0)
t++;
if (HowManyRegInUse != t)
{
/* fixme optimze the table or active the frame pointer */
setup_ebp =1; /* we will use ebx as ebp */
stack = HowManyRegInUse * regbits;
}
fprintf(outfp,"BITS 32\n");
fprintf(outfp,"GLOBAL _main\n");
fprintf(outfp,"SECTION .text\n\n");
fprintf(outfp,"; compile with nasm filename.asm -f win32, ld filename.obj -o filename.exe\n\n");
fprintf(outfp,"_main:\n");
/* setup a frame pointer */
if (setup_ebp == 1)
{
fprintf(outfp,"\n; Setup frame pointer \n");
fprintf(outfp,"push ebx\n");
fprintf(outfp,"mov ebx,esp\n");
fprintf(outfp,"sub esp, %d ; Alloc %d bytes for reg\n\n",stack,stack);
}
fprintf(outfp,"; Start the program \n");
while (pMystart!=NULL)
{
/* fixme the line lookup from anaylysing process */
/* mov not full implement */
if (pMystart->op == OP_ANY_mov)
{
printf("waring OP_ANY_mov are not full implement\n");
if ((pMystart->type & 8)== 8)
{
/* dst are register */
tmp = stack - (pMystart->dst*regbits);
if ((pMystart->type & 2)== 2)
{
fprintf(outfp,"mov ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp," , ");
standardreg( RegTableCount,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp,"\n");
}
if ((pMystart->type & 16)== 16)
{
/* source are imm */
if ((pMystart->src == 0) &&
(setup_ebp == 0))
{
/* small optimze */
fprintf(outfp,"xor ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp,",");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp,"\n");
}
else
{
fprintf(outfp,"mov ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp,",%llu\n",pMystart->src);
}
} /* end "source are imm" */
} /* end pMyBrainAnalys->type & 8 */
if ((pMystart->type & 64)== 64)
{
if ((pMystart->type & 2)== 2)
{
/* dest [eax - 0x20], source reg */
fprintf(outfp,"mov dword [");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
if (pMystart->dst_extra>=0)
fprintf(outfp," +%d], ",pMystart->dst_extra);
else
fprintf(outfp," %d], ",pMystart->dst_extra);
standardreg( RegTableCount,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp,"\n");
if ((pMystart->type & 128)== 128)
{
fprintf(outfp,"mov ");
standardreg( RegTableCount,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp," , ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp," %d\n",pMystart->dst_extra);
}
}
}
}
/* return */
if (pMystart->op == OP_ANY_ret)
{
if (pMyBrainAnalys->ptr_next == NULL)
{
if (setup_ebp == 1)
{
fprintf(outfp,"\n; clean up after the frame \n");
fprintf(outfp,"mov esp, ebx\n");
fprintf(outfp,"pop ebx\n");
}
}
fprintf(outfp,"ret\n");
}
if (pMystart == pMyend)
pMystart=NULL;
else
pMystart = (PMYBrainAnalys) pMystart->ptr_next;
}
return 0;
}

View file

@ -1,180 +0,0 @@
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
static void standardreg(CPU_INT *RegTableCount, CPU_UNINT reg,
CPU_INT setup_ebp, FILE *outfp)
{
CPU_INT t, found = 0;
for (t=0;t<31;t++)
{
if (reg == RegTableCount[t])
{
fprintf(outfp,"r%d",t);
found++;
break;
}
}
if (found == 0)
{
fprintf(outfp,"r%d",reg);
}
}
CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount)
{
CPU_INT stack = 0;
//CPU_UNINT tmp;
CPU_INT setup_ebp = 0 ; /* 0 = no, 1 = yes */
CPU_INT t=0;
if (HowManyRegInUse > 31)
{
setup_ebp =1; /* we will use ebx as ebp */
stack = HowManyRegInUse * regbits;
}
if (RegTableCount[1]!=0)
t++;
if (RegTableCount[3]!=0)
t++;
if (RegTableCount[4]!=0)
t++;
if (RegTableCount[8]!=0)
t++;
if (RegTableCount[9]!=0)
t++;
if (RegTableCount[10]!=0)
t++;
if (RegTableCount[11]!=0)
t++;
if (RegTableCount[31]!=0)
t++;
if (HowManyRegInUse != t)
{
/* fixme optimze the table or active the frame pointer */
setup_ebp =1; /* we will use ebx as ebp */
stack = HowManyRegInUse * regbits;
}
/* fixme gas compatible
fprintf(outfp,"BITS 32\n");
fprintf(outfp,"GLOBAL _main\n");
fprintf(outfp,"SECTION .text\n\n");
fprintf(outfp,"; compile with nasm filename.asm -f win32, ld filename.obj -o filename.exe\n\n");
fprintf(outfp,"_main:\n");
*/
/* setup a frame pointer */
if (setup_ebp == 1)
{
/* fixme ppc frame pointer */
// fprintf(outfp,"\n; Setup frame pointer \n");
}
fprintf(outfp,"; Start the program \n");
while (pMystart!=NULL)
{
/* fixme the line lookup from anaylysing process */
/* mov not full implement */
if (pMystart->op == OP_ANY_mov)
{
printf("waring OP_ANY_mov are not full implement\n");
if ((pMystart->type & 8)== 8)
{
/* dst are register */
// FIXME frame pointer setup
// tmp = stack - (pMystart->dst*regbits);
if ((pMystart->type & 2)== 2)
{
fprintf(outfp,"mr ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp,",");
standardreg( RegTableCount,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp,"\n");
}
if ((pMystart->type & 16)== 16)
{
/* source are imm */
if (setup_ebp == 1)
fprintf(outfp,"not supporet\n");
else
{
fprintf(outfp,"li ");
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp," , %llu\n",pMystart->src);
}
}
} /* end pMyBrainAnalys->type & 8 */
if ((pMystart->type & 64)== 64)
{
if ((pMystart->type & 2)== 2)
{
/* dest [eax - 0x20], source reg */
if ((pMystart->type & 128)== 128)
{
fprintf(outfp,"stwu ");
}
else
{
fprintf(outfp,"stw ");
}
standardreg( RegTableCount,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp,", %d(",pMystart->dst_extra);
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
fprintf(outfp,")\n");
}
} /* end pMyBrainAnalys->type & 64 */
}
/* return */
if (pMystart->op == OP_ANY_ret)
{
if (pMyBrainAnalys->ptr_next == NULL)
{
if (setup_ebp == 1)
{
// FIXME end our own frame pointer
fprintf(outfp,"\n; clean up after the frame \n");
}
}
fprintf(outfp,"blr\n");
}
if (pMystart == pMyend)
pMystart=NULL;
else
pMystart = (PMYBrainAnalys) pMystart->ptr_next;
}
return 0;
}

View file

@ -1,100 +0,0 @@
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
/* hack should be in misc.h*/
CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid)
{
CPU_INT ret=0;
CPU_INT regbits=-1;
CPU_INT HowManyRegInUse = 0;
CPU_INT RegTableCount[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
CPU_INT t;
PMYBrainAnalys pMystart = pStartMyBrainAnalys;
PMYBrainAnalys pMyend = pMyBrainAnalys;
PMYBrainAnalys ptmpMystart = pStartMyBrainAnalys;
PMYBrainAnalys ptmpMyend = pMyBrainAnalys;
if ( (FromCpuid == IMAGE_FILE_MACHINE_POWERPC) ||
(FromCpuid == IMAGE_FILE_MACHINE_I386))
{
regbits = 32 / 8;
}
/* FIXME calc where todo first split */
/* count how many register we got */
ptmpMystart = pMystart;
ptmpMyend = pMyend;
while (ptmpMystart!=NULL)
{
if ((ptmpMystart->type & 2) == 2)
RegTableCount[ptmpMystart->src]++;
if ((ptmpMystart->type & 8) == 8)
RegTableCount[ptmpMystart->dst]++;
if ((ptmpMystart->type & 32) == 32)
RegTableCount[ptmpMystart->src]++;
if ((ptmpMystart->type & 64) == 64)
RegTableCount[ptmpMystart->dst]++;
if (ptmpMystart == ptmpMyend)
ptmpMystart=NULL;
else
ptmpMystart = (PMYBrainAnalys) ptmpMystart->ptr_next;
}
for (t=0;t<=31;t++)
{
if (RegTableCount[t]!=0)
{
HowManyRegInUse++;
RegTableCount[t]=t;
}
}
/* switch to the acual converting now */
switch (ToCpuid)
{
case IMAGE_FILE_MACHINE_I386:
ret = ConvertToIA32Process( outfp, pMystart,
pMyend, regbits,
HowManyRegInUse,
RegTableCount);
if (ret !=0)
{
printf("should not happen contact a devloper, x86 fail\n");
return -1;
}
break;
case IMAGE_FILE_MACHINE_POWERPC:
ret = ConvertToPPCProcess( outfp, pMystart,
pMyend, regbits,
HowManyRegInUse,
RegTableCount);
if (ret !=0)
{
printf("should not happen contact a devloper, x86 fail\n");
return -1;
}
break;
default:
printf("should not happen contact a devloper, unknown fail\n");
return -1;
}
return ret;
}

View file

@ -1,117 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
PMYBrainAnalys pMyBrainAnalys = NULL;
PMYBrainAnalys pStartMyBrainAnalys = NULL;
int main(int argc, char * argv[])
{
//CPU_UNINT BaseAddress=0;
//int t=0;
//char *infile=NULL;
//char *outfile=NULL;
//char *cpuid=NULL;
//CPU_INT type=0;
//CPU_INT mode = 1;
//printf("Usage :\n");
//printf(" need for -inbin and autodetect if it does not found a PE header \n");
//printf(" -cpu m68000 : convert motorala 68000/68008 to intel asm \n");
//printf(" -cpu m68010 : convert motorala 68010 to intel asm \n");
//printf(" -cpu m68020 : convert motorala 68020 to intel asm \n");
//printf(" -cpu m68030 : convert motorala 68030 to intel asm \n");
//printf(" -cpu m68040 : convert motorala 68040 to intel asm \n");
//printf(" -cpu ppc : convert PowerPC to intel asm \n");
//printf(" -cpu ARM4 : convert ARM4 to intel asm \n");
//printf("------------------------------------------------------------------\n");
//printf(" for -inbin and autodetect if it does not found a PE header or do\n");
//printf(" not set at all, this options are free to use \n");
//printf(".......-BaseAddress adr : the start base address only accpect \n");
//printf("....... dec value");
//printf("------------------------------------------------------------------\n");
//printf(" -in filename : try autodetect file type for you");
//printf(" whant convert\n");
//printf(" -inBin filename : the bin file you whant convert\n");
//printf(" -inExe filename : the PE file you whant convert\n");
//printf(" -OutAsm filename : the Asm file you whant create\n");
//printf(" -OutDis filename : Do disambler of the source file\n");
//printf("------------------------------------------------------------------\n");
//printf("More cpu will be added with the time or options, this is \n");
//printf("version 0.0.1 of the cpu to intel converter writen by \n");
//printf("Magnus Olsen (magnus@greatlord.com), it does not do anything \n");
//printf("yet, more that basic desgin how it should be writen. \n");
//printf("Copyright 2006 by Magnus Olsen, licen under GPL 2.0 for now. \n");
//if (argc <4)
// return 110;
///* fixme better error checking for the input param */
//for (t=1; t<argc;t+=2)
//{
// if (stricmp(argv[t],"-in"))
// {
// infile = argv[t+1];
// type=0;
// }
// if (stricmp(argv[t],"-inBin"))
// {
// infile = argv[t+1];
// type=1;
// }
// if (stricmp(argv[t],"-inExe"))
// {
// infile = argv[t+1];
// type=1;
// }
// if (stricmp(argv[t],"-OutAsm"))
// {
// outfile = argv[t+1];
// }
// if (stricmp(argv[t],"-OutDis"))
// {
// outfile = argv[t+1];
// mode = 0;
// }
// if (stricmp(argv[t],"-BaseAddress"))
// {
// BaseAddress = atol(argv[t+1]);
// }
// if (stricmp(argv[t],"-cpu"))
// {
// cpuid = argv[t+1];
// }
//}
// mode 0 disambler
// mode 1 convert to intel
// mode 2 convert to ppc
//return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode);
//LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1);
LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1);
//pMyBrainAnalys = NULL;
//pStartMyBrainAnalys = NULL;
//LoadPFileImage("e:\\testppc.exe","e:\\cputoppc.asm",0,0,0,2);
// return LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,1); // convert
return 0;
}

View file

@ -1,17 +0,0 @@
#include "../../misc.h"
CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp);
/* here we put the prototype for the opcode api that brain need we show a example for it */
CPU_INT ARM_(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
*/

View file

@ -1,98 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "ARMBrain.h"
#include "ARM.h"
#include "../../misc.h"
/*
* DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then.
*
* input param:
* cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
* cpu with same desgin but few other opcode or extend opcode
* outfp : the output file pointer
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
*/
CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp)
{
CPU_UNINT cpu_oldpos;
CPU_INT cpuint;
CPU_INT retcode = 0;
CPU_INT retsize;
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos];
/* Add */
if ((cpuint - (cpuint & GetMaskByte32(cpuARMInit_))) == ConvertBitToByte32(cpuARMInit_))
{
retsize = ARM_( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
break;
}
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
if (retcode == 0)
{
/* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2;
}
}
/* Erorro Found ? */
if (retcode!=0)
{
/* Erorro Found break and return the error code */
break;
}
}
return retcode;
}

View file

@ -1,12 +0,0 @@
#include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1
*/
CPU_BYTE cpuARMInit_[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,50 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists
* other or any sub model.
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* Return value :
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos
*/
CPU_INT ARM_( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
/*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte()
*/
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Add unimplement\n");
return -1;
}

View file

@ -1,17 +0,0 @@
#include "../../misc.h"
CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp);
/* here we put the prototype for the opcode api that brain need we show a example for it */
CPU_INT IA32_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
*/

View file

@ -1,107 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "IA32Brain.h"
#include "IA32.h"
#include "../../any_op.h"
#include "../../misc.h"
/*
* DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then.
*
* input param:
* cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
* cpu with same desgin but few other opcode or extend opcode
* outfp : the output file pointer
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
*/
CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp)
{
CPU_UNINT cpu_oldpos;
CPU_INT cpuint;
CPU_INT retcode = 0;
CPU_INT retsize;
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
/* use the GetData32Be or GetData32Le
to read from the memory the
Le is for small endian and the
Be is for big endian
the 32 is how many bits we should read
*/
cpuint = GetData32Be(&cpu_buffer[cpu_pos]);
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuIA32Init_Add))) == ConvertBitToByte(cpuIA32Init_Add))
{
retsize = IA32_Add( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
break;
}
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
if (retcode == 0)
{
/* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2;
}
}
/* Erorro Found ? */
if (retcode!=0)
{
/* Erorro Found break and return the error code */
break;
}
}
return retcode;
}

View file

@ -1,13 +0,0 @@
#include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1
*/
CPU_BYTE cpuIA32Init_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,50 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "IA32.h"
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists
* other or any sub model.
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* Return value :
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos
*/
CPU_INT IA32_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
/*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte()
*/
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Add unimplement\n");
return -1;
}

View file

@ -1,23 +0,0 @@
#include "../../misc.h"
CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp);
/* here we put the prototype for the opcode api that brain need we show a example for it */
CPU_INT PPC_Blr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT PPC_Li( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT PPC_mr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT PPC_Stw( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT PPC_Stwu( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
*/

View file

@ -1,143 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "PPCBrain.h"
#include "PPC.h"
#include "../../misc.h"
/*
* DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then.
*
* input param:
* cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
* cpu with same desgin but few other opcode or extend opcode
* outfp : the output file pointer
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
*/
CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp)
{
CPU_UNINT cpu_oldpos;
CPU_INT cpuint;
CPU_INT retcode = 0;
CPU_INT retsize;
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
cpuint = GetData32Le(&cpu_buffer[cpu_pos]);
/* blr */
if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Blr))) == ConvertBitToByte32(cpuPPCInit_Blr))
{
retsize = PPC_Blr( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Li*/
if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Li))) == ConvertBitToByte32(cpuPPCInit_Li))
{
retsize = PPC_Li( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* mr */
if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_mr))) == ConvertBitToByte32(cpuPPCInit_mr))
{
retsize = PPC_mr( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* stw */
if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_stw))) == ConvertBitToByte32(cpuPPCInit_stw))
{
retsize = PPC_Stw( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* stwu */
if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_stwu))) == ConvertBitToByte32(cpuPPCInit_stwu))
{
retsize = PPC_Stwu( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
break;
}
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
if (retcode == 0)
{
/* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2;
}
}
/* Erorro Found ? */
if (retcode!=0)
{
/* Erorro Found break and return the error code */
break;
}
}
return 0; // hack getting dismabler working or converting working
return retcode;
}

View file

@ -1,32 +0,0 @@
#include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1
*/
/* FIXME RA should be 0 in stwu */
CPU_BYTE cpuPPCInit_Blr[32] = {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 0,1,0,0,1,1, 1,0};
/* addi */
CPU_BYTE cpuPPCInit_Li[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0, 0,0,1,1,1,0, 2,2};
CPU_BYTE cpuPPCInit_stw[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,0,0,1,0,0, 2,2};
CPU_BYTE cpuPPCInit_stwu[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,0,0,1,0,1, 2,2};
CPU_BYTE cpuPPCInit_mr[32] = {0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,1,2,2,2,2,2,2,2,2, 0,1,1,1,1,1, 2,2};
CPU_BYTE cpuPPCInit_lwz[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,0,0,0,0,0, 2,2};
/* mask */
/*
* no mask we implement function getting the reg right
*/
/* bit index
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
*/

View file

@ -1,192 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "PPC.h"
#include "../../misc.h"
#include "../../any_op.h"
/* reg r0-r31
r3 = eax
*/
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists
* other or any sub model.
*
* Return value :
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos
*/
/* Get Dest register */
#define PPC_GetBitArraySrcReg(opcode) (((opcode & 0x3) << 3) | ((opcode & 0xE000) >> 13))
/* Get Source register */
CPU_UNINT PPC_GetBitArrayBto31xx(CPU_UNINT opcode)
{
CPU_INT x1;
/* FIXME make it to a macro
* not tested to 100% yet */
x1 = ((opcode & 0x1F00)>>8);
return x1;
}
CPU_UNINT PPC_GetBitArrayBto31(CPU_UNINT opcode)
{
CPU_INT x1;
/* FIXME make it to a macro
* not tested to 100% yet */
x1 = ((opcode & 0xFFFF0000)>>16);
return x1;
}
CPU_INT PPC_Blr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
BaseAddress +=cpu_pos;
/* own translatons langues */
if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
{
return -1;
}
pMyBrainAnalys->op = OP_ANY_ret;
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
}
CPU_INT PPC_Li( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
CPU_UNINT opcode;
opcode = GetData32Le(&cpu_buffer[cpu_pos]);
BaseAddress +=cpu_pos;
/* own translatons langues */
if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
{
return -1;
}
pMyBrainAnalys->op = OP_ANY_mov;
pMyBrainAnalys->type= 8 + 16; /* 8 dst reg, 16 imm */
pMyBrainAnalys->src_size = 16;
pMyBrainAnalys->src = PPC_GetBitArraySrcReg(opcode);
pMyBrainAnalys->dst = PPC_GetBitArrayBto31(opcode);
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
}
CPU_INT PPC_mr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
CPU_UNINT opcode;
opcode = GetData32Le(&cpu_buffer[cpu_pos]);
BaseAddress +=cpu_pos;
/* own translatons langues */
if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
{
return -1;
}
pMyBrainAnalys->op = OP_ANY_mov;
pMyBrainAnalys->type= 2 + 8; /* 8 dst reg, 2 src reg */
pMyBrainAnalys->src_size = 32;
pMyBrainAnalys->src = PPC_GetBitArraySrcReg(opcode);
pMyBrainAnalys->dst = PPC_GetBitArrayBto31xx(opcode);
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
}
CPU_INT PPC_Stw( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
/* r1 store at -0x20(r1) */
CPU_UNINT opcode;
CPU_SHORT tmp = 0;
opcode = GetData32Le(&cpu_buffer[cpu_pos]);
BaseAddress +=cpu_pos;
/* own translatons langues */
if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
{
return -1;
}
tmp = _byteswap_ushort( ((CPU_SHORT)((opcode >> 16) & 0xffff)));
pMyBrainAnalys->op = OP_ANY_mov;
pMyBrainAnalys->type= 2 + 64;
pMyBrainAnalys->src_size = 32;
pMyBrainAnalys->dst_size = 32;
pMyBrainAnalys->src = PPC_GetBitArraySrcReg(opcode);
pMyBrainAnalys->dst = PPC_GetBitArrayBto31xx(opcode);
pMyBrainAnalys-> dst_extra = tmp;
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
}
CPU_INT PPC_Stwu( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
/* r1 store at -0x20(r1) */
CPU_UNINT opcode;
CPU_INT DstReg;
CPU_SHORT tmp = 0;
opcode = GetData32Le(&cpu_buffer[cpu_pos]);
DstReg = PPC_GetBitArrayBto31xx(opcode);
if (DstReg == 0)
{
return 0;
}
BaseAddress +=cpu_pos;
/* own translatons langues */
if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
{
return -1;
}
tmp = _byteswap_ushort( ((CPU_SHORT)((opcode >> 16) & 0xffff)));
pMyBrainAnalys->op = OP_ANY_mov;
pMyBrainAnalys->type= 2 + 64 + 128;
pMyBrainAnalys->src_size = 32;
pMyBrainAnalys->dst_size = 32;
pMyBrainAnalys->src = PPC_GetBitArraySrcReg(opcode);
pMyBrainAnalys->dst = DstReg;
pMyBrainAnalys-> dst_extra = tmp;
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
}

View file

@ -1,17 +0,0 @@
#include "../../misc.h"
CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp);
/* here we put the prototype for the opcode api that brain need we show a example for it */
CPU_INT DUMMY_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
*/

View file

@ -1,95 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "DummyBrain.h"
#include "Dummy.h"
#include "../../misc.h"
/*
* DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then.
*
* input param:
* cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
* cpu with same desgin but few other opcode or extend opcode
* outfp : the output file pointer
*
* return value
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
*/
CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp)
{
CPU_UNINT cpu_oldpos;
CPU_INT cpuint;
CPU_INT retcode = 0;
CPU_INT retsize;
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
/* use the GetData32Be or GetData32Le
to read from the memory the
Le is for small endian and the
Be is for big endian
the 32 is how many bits we should read
*/
cpuint = GetData32Be(&cpu_buffer[cpu_pos]);
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuDummyInit_Add))) == ConvertBitToByte(cpuDummyInit_Add))
{
retsize = DUMMY_Add( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
break;
}
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
if (retcode == 0)
{
/* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2;
}
}
/* Erorro Found ? */
if (retcode!=0)
{
/* Erorro Found break and return the error code */
break;
}
}
return retcode;
}

View file

@ -1,12 +0,0 @@
#include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1
*/
CPU_BYTE cpuDummyInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,39 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "Dummy.h"
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists
* other or any sub model.
* Return value :
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos
*/
CPU_INT DUMMY_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
/*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte()
*/
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Add unimplement\n");
return -1;
}

View file

@ -1,320 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "M68kBrain.h"
#include "m68k.h"
#include "../../misc.h"
/*
* DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then.
*
* input param:
* cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
* cpu with same desgin but few other opcode or extend opcode
* outfp : the output file pointer
*
* return value
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
*/
CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp)
{
CPU_UNINT cpu_oldpos;
CPU_INT cpuint;
CPU_INT retcode = 0;
CPU_INT retsize;
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos];
/* Abcd */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Abcd))) == ConvertBitToByte(cpuM68kInit_Abcd))
{
retsize = M68k_Abcd( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Add))) == ConvertBitToByte(cpuM68kInit_Add))
{
retsize = M68k_Add( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Addi */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Addi))) == ConvertBitToByte(cpuM68kInit_Addi))
{
retsize = M68k_Addi( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Addq */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Addq))) == ConvertBitToByte(cpuM68kInit_Addq))
{
retsize = M68k_Addq( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Addx */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Addx))) == ConvertBitToByte(cpuM68kInit_Addx))
{
retsize = M68k_Addx( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* And */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_And))) == ConvertBitToByte(cpuM68kInit_And))
{
retsize = M68k_Add( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Andi */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Andi))) == ConvertBitToByte(cpuM68kInit_Andi))
{
retsize = M68k_Andi( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* AndToCCR */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRF))) == ConvertBitToByte(cpuM68kInit_AndToCCRF))
{
cpuint = cpu_buffer[cpu_pos+1];
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRS))) == ConvertBitToByte(cpuM68kInit_AndToCCRS))
{
cpu_pos++;
retsize = M68k_AndToCCR( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
else
{
cpuint = cpu_buffer[cpu_pos];
}
}
/* Bhi */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bhi))) == ConvertBitToByte(cpuM68kInit_Bhi))
{
retsize = M68k_Bhi( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bls */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bls))) == ConvertBitToByte(cpuM68kInit_Bls))
{
retsize = M68k_Bls( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bcc */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bcc))) == ConvertBitToByte(cpuM68kInit_Bcc))
{
retsize = M68k_Bcc( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bcs */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bcs))) == ConvertBitToByte(cpuM68kInit_Bcs))
{
retsize = M68k_Bcs( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bne */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bne))) == ConvertBitToByte(cpuM68kInit_Bne))
{
retsize = M68k_Bne( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Beq */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Beq))) == ConvertBitToByte(cpuM68kInit_Beq))
{
retsize = M68k_Beq( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bvc */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bvc))) == ConvertBitToByte(cpuM68kInit_Bvc))
{
retsize = M68k_Bvc( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bvs */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bvs))) == ConvertBitToByte(cpuM68kInit_Bvs))
{
retsize = M68k_Bvs( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bpl */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bpl))) == ConvertBitToByte(cpuM68kInit_Bpl))
{
retsize = M68k_Bpl( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bmi */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bmi))) == ConvertBitToByte(cpuM68kInit_Bmi))
{
retsize = M68k_Bmi( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bge */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bge))) == ConvertBitToByte(cpuM68kInit_Bge))
{
retsize = M68k_Bge( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Blt */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Blt))) == ConvertBitToByte(cpuM68kInit_Blt))
{
retsize = M68k_Blt( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Bgt */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Bgt))) == ConvertBitToByte(cpuM68kInit_Bgt))
{
retsize = M68k_Bgt( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Ble */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Ble))) == ConvertBitToByte(cpuM68kInit_Ble))
{
retsize = M68k_Ble( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch);
if (retsize<0)
retcode = 1;
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
break;
}
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
if (retcode == 0)
{
/* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2;
}
}
/* Erorro Found ? */
if (retcode!=0)
{
/* Erorro Found break and return the error code */
break;
}
}
return retcode;
}

View file

@ -1,38 +0,0 @@
#include "../../misc.h"
CPU_BYTE cpuM68kInit_Abcd[16] = {1,1,1,1,2,2,2,1,0,0,0,0,2,2,2,2};
CPU_BYTE cpuM68kInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Addi[16] = {0,0,0,0,0,1,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Addq[16] = {0,1,0,1,2,2,2,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Addx[16] = {1,1,0,1,2,2,2,1,2,2,0,0,2,2,2,2};
CPU_BYTE cpuM68kInit_And[16] = {1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Andi[16] = {0,0,0,0,0,0,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_AndToCCRF[16] = {0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0};
CPU_BYTE cpuM68kInit_AndToCCRS[16] = {0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Asl[16] = {1,1,1,0,2,2,2,0,2,2,2,0,0,2,2,2};
CPU_BYTE cpuM68kInit_Asr[16] = {1,1,1,0,2,2,2,1,2,2,2,0,0,2,2,2};
CPU_BYTE cpuM68kInit_Bhi[16] = {0,1,1,0,0,0,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bls[16] = {0,1,1,0,0,0,1,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bcc[16] = {0,1,1,0,0,1,0,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bcs[16] = {0,1,1,0,0,1,0,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bne[16] = {0,1,1,0,0,1,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Beq[16] = {0,1,1,0,0,1,1,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bvc[16] = {0,1,1,0,1,0,0,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bvs[16] = {0,1,1,0,1,0,0,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bpl[16] = {0,1,1,0,1,0,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bmi[16] = {0,1,1,0,1,0,1,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bge[16] = {0,1,1,0,1,1,0,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Blt[16] = {0,1,1,0,1,1,0,1,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Bgt[16] = {0,1,1,0,1,1,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Ble[16] = {0,1,1,0,1,1,1,1,2,2,2,2,2,2,2,2};
CPU_BYTE M68k_Rx[16] = {0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0};
CPU_BYTE M68k_RM[16] = {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0};
CPU_BYTE M68k_Ry[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1};
CPU_BYTE M68k_Opmode[16] = {0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0};
CPU_BYTE M68k_Mode[16] = {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0};
CPU_BYTE M68k_Size[16] = {0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0};

View file

@ -1,287 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "m68k.h"
#include "misc.h"
CPU_INT M68k_Abcd( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Abcd unimplement\n");
return -1;
}
CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
CPU_INT opmode;
CPU_INT mode;
CPU_INT Rx;
CPU_INT Ry;
//CPU_INT cpuint;
opmode = ConvertBitToByte(M68k_Opmode);
mode = ConvertBitToByte(M68k_Mode);
Rx = ConvertBitToByte(M68k_Rx);
Ry = ConvertBitToByte(M68k_Ry);
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
if (opmode == 0x00)
{
/* <ea> + Dn -> Dn */
printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n");
}
if (opmode == 0x01)
{
/* <ea> + Dn -> Dn */
printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n");
}
if (opmode == 0x02)
{
/* <ea> + Dn -> Dn */
printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n");
}
if (opmode == 0x03)
{
/* <ea> + An -> An */
printf(";Add unimplement of \"<ea> + An -> An\" \n");
}
if (opmode == 0x04)
{
/* Dn + <ea> -> <ea> */
printf(";Add unimplement of \"Dn + <ea> -> <ea>\" \n");
}
if (opmode == 0x05)
{
/* Dn + <ea> -> <ea> */
printf(";Add unimplement of \"Dn + <ea> -> <ea>\" \n");
}
if (opmode == 0x06)
{
/* Dn + <ea> -> <ea> */
printf(";Add unimplement of \"Dn + <ea> -> <ea>\" \n");
}
if (opmode == 0x07)
{
/* <ea> + An -> An */
printf(";Add unimplement of \"<ea> + An -> An\" \n");
}
return -1;
}
CPU_INT M68k_Addi( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Addi unimplement\n");
return -1;
}
CPU_INT M68k_Addq( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Addq unimplement\n");
return -1;
}
CPU_INT M68k_Addx( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Addx unimplement\n");
return -1;
}
CPU_INT M68k_And( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";And unimplement\n");
return -1;
}
CPU_INT M68k_Andi( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Andi unimplement\n");
return -1;
}
CPU_INT M68k_AndToCCR( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";AndToCCR unimplement\n");
return -1;
}
CPU_INT M68k_Asl( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Asl unimplement\n");
return -1;
}
CPU_INT M68k_Asr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Asr unimplement\n");
return -1;
}
CPU_INT M68k_Bhi( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bhi unimplement\n");
return -1;
}
CPU_INT M68k_Bls( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bls unimplement\n");
return -1;
}
CPU_INT M68k_Bcc( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bcc unimplement\n");
return -1;
}
CPU_INT M68k_Bcs( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bcs unimplement\n");
return -1;
}
CPU_INT M68k_Bne( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bne unimplement\n");
return -1;
}
CPU_INT M68k_Beq( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Beq unimplement\n");
return -1;
}
CPU_INT M68k_Bvc( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bvc unimplement\n");
return -1;
}
CPU_INT M68k_Bvs( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bvs unimplement\n");
return -1;
}
CPU_INT M68k_Bpl( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bpl unimplement\n");
return -1;
}
CPU_INT M68k_Bmi( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bmi unimplement\n");
return -1;
}
CPU_INT M68k_Bge( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bge unimplement\n");
return -1;
}
CPU_INT M68k_Blt( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Blt unimplement\n");
return -1;
}
CPU_INT M68k_Bgt( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Bgt unimplement\n");
return -1;
}
CPU_INT M68k_Ble( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
printf(";Ble unimplement\n");
return -1;
}

View file

@ -1,41 +0,0 @@
#include "../../misc.h"
CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
CPU_UNINT cpu_pos,
CPU_UNINT cpu_size,
CPU_UNINT BaseAddress,
CPU_UNINT cpuarch,
FILE *outfp);
CPU_INT M68k_Abcd(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Addi(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Addq(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Addx(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_And(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Andi(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_AndToCCR(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Asl(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Asr(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bhi(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bls(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bcc(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bcs(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bne(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Beq(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bvc(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bvs(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bpl(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bmi(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bge(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Blt(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Bgt(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT M68k_Ble(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
extern CPU_BYTE M68k_Rx[16];
extern CPU_BYTE M68k_RM[16];
extern CPU_BYTE M68k_Ry[16];
extern CPU_BYTE M68k_Opmode[16];
extern CPU_BYTE M68k_Mode[16];
extern CPU_BYTE M68k_Size[16];

View file

@ -1,563 +0,0 @@
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "From/ARM/ARM.h"
#include "From/m68k/m68k.h"
#include "From/PPC/PPC.h"
static CPU_INT machine_type = 0;
//static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_I386;
static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_POWERPC;
/*
* infileName file name to convert or disambler
* outputfileName file name to save to
* BaseAddress the address we should emulate
* cpuid the cpu we choice not vaild for pe loader
* type the loading mode Auto, PE, bin
* mode disambler mode : 0 the arch cpu.
* translate mode : 1 intel
* translate mode : 2 ppc
*
*/
static void SetCPU(CPU_INT FromCpu, CPU_INT mode)
{
machine_type = FromCpu;
switch(mode)
{
case 0:
ToMachine_type = machine_type;
break;
case 1:
ToMachine_type = IMAGE_FILE_MACHINE_I386;
break;
case 2:
ToMachine_type = IMAGE_FILE_MACHINE_POWERPC;
break;
default:
printf("Not supported mode\n");
break;
}
}
static void Convert(FILE *outfp, CPU_INT FromCpu, CPU_INT mode)
{
SetCPU(machine_type,mode);
AnyalsingProcess();
ConvertProcess(outfp, machine_type, ToMachine_type);
FreeAny();
}
CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
CPU_UNINT BaseAddress, char *cpuid,
CPU_UNINT type, CPU_INT mode)
{
FILE *infp;
FILE *outfp;
CPU_BYTE *cpu_buffer;
CPU_UNINT cpu_pos = 0;
CPU_UNINT cpu_size=0;
CPU_INT ret;
//fopen("testms.exe","RB");
/* Open file for read */
if (!(infp = fopen(infileName, "rb")))
{
printf("Can not open file %s\n",infileName);
return 3;
}
/* Open file for write */
if (!(outfp = fopen(outputfileName,"wb")))
{
printf("Can not open file %s\n",outputfileName);
return 4;
}
/* Load the binary file to a memory buffer */
fseek(infp,0,SEEK_END);
if (ferror(infp))
{
printf("error can not seek in the read file");
fclose(infp);
fclose(outfp);
return 5;
}
/* get the memory size buffer */
cpu_size = ftell(infp);
if (ferror(infp))
{
printf("error can not get file size of the read file");
fclose(infp);
fclose(outfp);
return 6;
}
/* Load the binary file to a memory buffer */
fseek(infp,0,SEEK_SET);
if (ferror(infp))
{
printf("error can not seek in the read file");
fclose(infp);
fclose(outfp);
return 5;
}
if (cpu_size==0)
{
printf("error file size is Zero lenght of the read file");
fclose(infp);
fclose(outfp);
return 7;
}
/* alloc memory now */
;
if (!(cpu_buffer = (unsigned char *) malloc(cpu_size+1)))
{
printf("error can not alloc %uld size for memory buffer",cpu_size);
fclose(infp);
fclose(outfp);
return 8;
}
ZeroMemory(cpu_buffer,cpu_size);
/* read from the file now in one sweep */
fread((void *)cpu_buffer,1,cpu_size,infp);
if (ferror(infp))
{
printf("error can not read file ");
fclose(infp);
fclose(outfp);
return 9;
}
fclose(infp);
if (type==0)
{
if ( PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode) !=0)
{
type=1;
}
else
{
if (mode > 0)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return 0;
}
/* fixme */
return -1;
}
if (type== 1)
{
if (stricmp(cpuid,"m68000"))
{
ret = M68KBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,68000,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
}
else if (stricmp(cpuid,"m68010"))
{
ret = M68KBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,68010,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
else if (stricmp(cpuid,"m68020"))
{
ret = M68KBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,68020,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
else if (stricmp(cpuid,"m68030"))
{
ret = M68KBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,68030,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
else if (stricmp(cpuid,"m68040"))
{
ret = M68KBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,68040,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
else if (stricmp(cpuid,"ppc"))
{
ret = PPCBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,0,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
else if (stricmp(cpuid,"arm4"))
{
ret = ARMBrain(cpu_buffer,cpu_pos,cpu_size,BaseAddress,4,outfp);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
}
if (type==2)
{
ret = PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode);
if (mode > 1)
{
Convert(outfp,machine_type,mode);
}
fclose(outfp);
return ret;
}
return 0;
}
#define MAXSECTIONNUMBER 16
CPU_INT PEFileStart( CPU_BYTE *memory, CPU_UNINT pos,
CPU_UNINT base, CPU_UNINT size,
FILE *outfp, CPU_INT mode)
{
PIMAGE_DOS_HEADER DosHeader;
PIMAGE_NT_HEADERS NtHeader;
IMAGE_SECTION_HEADER SectionHeader[MAXSECTIONNUMBER] = {NULL};
PIMAGE_SECTION_HEADER pSectionHeader;
PIMAGE_EXPORT_DIRECTORY ExportEntry;
INT NumberOfSections;
INT NumberOfSectionsCount=0;
INT i;
DosHeader = (PIMAGE_DOS_HEADER)memory;
if ( (DosHeader->e_magic != IMAGE_DOS_SIGNATURE) ||
(size < 0x3c+2) )
{
printf("No MZ file \n");
return -1;
}
NtHeader = (PIMAGE_NT_HEADERS) (((ULONG)memory) + ((ULONG)DosHeader->e_lfanew));
if (NtHeader->Signature != IMAGE_NT_SIGNATURE)
{
printf("No PE header found \n");
}
if (!(NtHeader->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE))
{
printf("No execute image found \n");
return -1;
}
switch(NtHeader->OptionalHeader.Subsystem)
{
case IMAGE_SUBSYSTEM_EFI_APPLICATION:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_EFI_APPLICATION\n");
printf("This exe file is desgin run in EFI bios as applactions\n");
break;
case IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER\n");
printf("This exe file is desgin run in EFI bios as service driver\n");
break;
case IMAGE_SUBSYSTEM_EFI_ROM:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_EFI_ROM\n");
printf("This exe file is EFI ROM\n");
break;
case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER\n");
printf("This exe file is desgin run in EFI bios as driver\n");
break;
case IMAGE_SUBSYSTEM_NATIVE:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_NATIVE\n");
printf("This exe file does not need any subsystem\n");
break;
case IMAGE_SUBSYSTEM_NATIVE_WINDOWS:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_NATIVE_WINDOWS\n");
printf("This exe file is desgin run on Windows 9x as driver \n");
break;
case IMAGE_SUBSYSTEM_OS2_CUI:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_OS2_CUI\n");
printf("This exe file is desgin run on OS2 as CUI\n");
break;
case IMAGE_SUBSYSTEM_POSIX_CUI:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_POSIX_CUI\n");
printf("This exe file is desgin run on POSIX as CUI\n");
break;
case IMAGE_SUBSYSTEM_WINDOWS_CE_GUI:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_WINDOWS_CE_GUI\n");
printf("This exe file is desgin run on Windows CE as GUI\n");
break;
case IMAGE_SUBSYSTEM_WINDOWS_CUI:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_WINDOWS_CUI\n");
printf("This exe file is desgin run on Windows as CUI\n");
break;
case IMAGE_SUBSYSTEM_WINDOWS_GUI:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_WINDOWS_GUI\n");
printf("This exe file is desgin run on Windows as GUI\n");
break;
case IMAGE_SUBSYSTEM_XBOX:
fprintf(outfp,"; OS type : IMAGE_SUBSYSTEM_XBOX\n");
printf("This exe file is desgin run on X-Box\n");
break;
default:
fprintf(outfp,"; OS type : Unknown\n");
printf("Unknown OS : SubID : %d\n",NtHeader->OptionalHeader.Subsystem);
break;
}
printf("Number of object : %d\n",NtHeader->FileHeader.NumberOfSections);
printf("Base Address : %8x\n\n",NtHeader->OptionalHeader.ImageBase);
pSectionHeader = IMAGE_FIRST_SECTION(NtHeader);
NumberOfSections = NtHeader->FileHeader.NumberOfSections;
for (i = 0; i < NumberOfSections; i++)
{
SectionHeader[i] = *pSectionHeader++;
printf("Found Sector : %s \n ",SectionHeader[i].Name);
printf("RVA: %08lX ",SectionHeader[i].VirtualAddress);
printf("Offset: %08lX ",SectionHeader[i].PointerToRawData);
printf("Size: %08lX ",SectionHeader[i].SizeOfRawData);
printf("Flags: %08lX \n\n",SectionHeader[i].Characteristics);
}
/* Get export data */
if (NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size != 0)
{
for (i = 0; i < NumberOfSections; i++)
{
if ( SectionHeader[i].VirtualAddress <= (ULONG) NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress &&
SectionHeader[i].VirtualAddress + SectionHeader[i].SizeOfRawData > (ULONG)NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress)
{
ExportEntry = (PIMAGE_NT_HEADERS) (((ULONG)memory) +
(ULONG)(NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress -
SectionHeader[i].VirtualAddress +
SectionHeader[i].PointerToRawData));
}
}
}
/* start decoding */
for (i=0;i < NumberOfSections; i++)
{
if (strnicmp((PCHAR) SectionHeader[i].Name,".text\0",6)==0)
{
switch (NtHeader->FileHeader.Machine)
{
case IMAGE_FILE_MACHINE_ALPHA:
printf("CPU ALPHA Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found Alpha\n");
machine_type = IMAGE_FILE_MACHINE_ALPHA;
return 3;
case IMAGE_FILE_MACHINE_ALPHA64:
printf("CPU ALPHA64/AXP64 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found Alpha64/AXP64\n");
machine_type = IMAGE_FILE_MACHINE_ALPHA64;
return 3;
case IMAGE_FILE_MACHINE_AM33:
printf("CPU AM33 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found AM33\n");
machine_type = IMAGE_FILE_MACHINE_AM33;
return 3;
case IMAGE_FILE_MACHINE_AMD64:
printf("CPU AMD64 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found AMD64\n");
machine_type = IMAGE_FILE_MACHINE_AMD64;
return 3;
case IMAGE_FILE_MACHINE_ARM:
printf("CPU ARM Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found ARM\n");
machine_type = IMAGE_FILE_MACHINE_ARM;
return 3;
case IMAGE_FILE_MACHINE_CEE:
printf("CPU CEE Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found CEE\n");
machine_type = IMAGE_FILE_MACHINE_CEE;
return 3;
case IMAGE_FILE_MACHINE_CEF:
printf("CPU CEF Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found CEF\n");
machine_type = IMAGE_FILE_MACHINE_CEF;
return 3;
case IMAGE_FILE_MACHINE_EBC:
printf("CPU EBC Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found EBC\n");
machine_type = IMAGE_FILE_MACHINE_EBC;
return 3;
case IMAGE_FILE_MACHINE_I386:
printf("CPU I386 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found I386\n");
machine_type = IMAGE_FILE_MACHINE_I386;
return 3;
case IMAGE_FILE_MACHINE_IA64:
printf("CPU IA64 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found IA64\n");
machine_type = IMAGE_FILE_MACHINE_IA64;
return 3;
case IMAGE_FILE_MACHINE_M32R:
printf("CPU M32R Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found M32R\n");
machine_type = IMAGE_FILE_MACHINE_M32R;
return 3;
case IMAGE_FILE_MACHINE_MIPS16:
printf("CPU MIPS16 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found MIPS16\n");
machine_type = IMAGE_FILE_MACHINE_MIPS16;
return 3;
case IMAGE_FILE_MACHINE_MIPSFPU:
printf("CPU MIPSFPU Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found MIPSFPU\n");
machine_type = IMAGE_FILE_MACHINE_MIPSFPU;
return 3;
case IMAGE_FILE_MACHINE_MIPSFPU16:
printf("CPU MIPSFPU16 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found MIPSFPU16\n");
machine_type = IMAGE_FILE_MACHINE_MIPSFPU16;
return 3;
case IMAGE_FILE_MACHINE_POWERPC:
printf("CPU POWERPC Detected partily CPUBrain implement for it\n");
fprintf(outfp,"; CPU found POWERPC\n");
//PPCBrain(memory, pos, cpu_size, base, 0, outfp);
machine_type = IMAGE_FILE_MACHINE_POWERPC;
PPCBrain(memory+SectionHeader[i].PointerToRawData, 0, SectionHeader[i].SizeOfRawData, NtHeader->OptionalHeader.ImageBase, 0, outfp);
break;
case IMAGE_FILE_MACHINE_POWERPCFP:
printf("CPU POWERPCFP Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found POWERPCFP\n");
machine_type = IMAGE_FILE_MACHINE_POWERPCFP;
return 3;
case IMAGE_FILE_MACHINE_R10000:
printf("CPU R10000 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found R10000\n");
machine_type = IMAGE_FILE_MACHINE_R10000;
return 3;
case IMAGE_FILE_MACHINE_R3000:
printf("CPU R3000 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found R3000\n");
machine_type = IMAGE_FILE_MACHINE_R3000;
return 3;
case IMAGE_FILE_MACHINE_R4000:
printf("CPU R4000 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found R4000\n");
machine_type = IMAGE_FILE_MACHINE_R4000;
return 3;
case IMAGE_FILE_MACHINE_SH3:
printf("CPU SH3 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found SH3\n");
machine_type = IMAGE_FILE_MACHINE_SH3;
return 3;
case IMAGE_FILE_MACHINE_SH3DSP:
printf("CPU SH3DSP Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found SH3DSP\n");
machine_type = IMAGE_FILE_MACHINE_SH3DSP;
return 3;
case IMAGE_FILE_MACHINE_SH3E:
printf("CPU SH3E Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found SH3E\n");
machine_type = IMAGE_FILE_MACHINE_SH3E;
return 3;
case IMAGE_FILE_MACHINE_SH4:
printf("CPU SH4 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found SH4\n");
machine_type = IMAGE_FILE_MACHINE_SH4;
return 3;
case IMAGE_FILE_MACHINE_SH5:
printf("CPU SH5 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found SH5\n");
machine_type = IMAGE_FILE_MACHINE_SH5;
return 3;
case IMAGE_FILE_MACHINE_THUMB:
printf("CPU THUMB Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found THUMB\n");
machine_type = IMAGE_FILE_MACHINE_THUMB;
return 3;
case IMAGE_FILE_MACHINE_TRICORE:
printf("CPU TRICORE Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found TRICORE\n");
machine_type = IMAGE_FILE_MACHINE_TRICORE;
return 3;
case IMAGE_FILE_MACHINE_WCEMIPSV2:
printf("CPU WCEMIPSV2 Detected no CPUBrain implement for it\n");
fprintf(outfp,"; CPU found WCEMIPSV2\n");
machine_type = IMAGE_FILE_MACHINE_WCEMIPSV2;
return 3;
default:
printf("Unknown Machine : %d",NtHeader->FileHeader.Machine);
return 4;
} /* end case switch*/
} /* end if text sector */
} /* end for */
return 0;
}

View file

@ -1,77 +0,0 @@
PowerPC 32bits
reg = R0-R31
#imm = a value you set
Bit expain
0 = mean bit is zero
1 = mean bit is set
2 = mean this bit can be 0 or 1
opcode Name Desciptions
0010 0000 0000 0000 1000 0000 0100 1110 blr return from a functions
0222 2222 2222 2222 2222 2222 0011 1000 Li reg,#imm move a value to a register
2222 2222 2222 2222 2222 2222 1001 0022 stw reg,mem store a value into memory
2222 2222 2222 2222 2222 2222 1001 0122 stwu reg,mem store contain of reg to memory and
move reg to that memory position
Here how the primary opcode work
xxxx xxxx xxxx xxxx DDDS SSSS 3333 33DD
3 = it is the primary opcode
D = Destions register
S = Source reigters
opcode
-------------------------
|bit order: 5432 10 67 |
------- ------- ----------- ----
34: | 0c 00 | | e1 93 | stw r31,12(r1) 0000 1100 0000 0000 1110 0001 | 1001 00 | 00
38: | 14 00 | | 01 90 | stw r0,20(r1) 0001 0100 0000 0000 0000 0001 | 1001 00 | 11
------- ------- ---------
| |
| |--> Get source register R0-R31 (0xE1 & 0x1F) = 1
| |
| |--> Get Dest register R0-R31 ((0xE1 & 0xE0)>>5) | ((0x90 & 0x3)<<3) = 31 or 0
| | (The adding the two last bit on the end is maybe wrong need examine it)
| |
| --> Get the opcpde (0x90 & 0xFC)
\ /
The address offset 12 or 20
opcode
---------------------------------------------------------
|bit order: pos 1111 1111 1111 1111 0000 0000 0000 0000 |
| 5432 10 |
|---------------------------------------------------------|
| bits 0000 1100 0000 0000 1110 0001 1001 0000 |
---------------------------------------------------------
| math (opcode>>2) & 0x3F |
---------------------------------------------------------
Dest Register
---------------------------------------------------------
|bit order: pos 1111 1111 1111 1111 0000 0000 0000 0000 |
| 210 43 |
|---------------------------------------------------------|
| bits 0000 1100 0000 0000 1110 0001 1001 0000 |
---------------------------------------------------------
| math (((opcode & 0x3) << 3) | ((opcode & 0xE000) >> 13))|
---------------------------------------------------------
source Register
---------------------------------------------------------
|bit order: pos 1111 1111 1111 1111 0000 0000 0000 0000 |
| x xxxx |
|---------------------------------------------------------|
| bits 0000 1100 0000 0000 1110 0001 1001 0000 |
---------------------------------------------------------
| math |
---------------------------------------------------------

View file

@ -1,76 +0,0 @@
CpuToIntel is a experment tools and is strict under havy devloping
The Idea
The idea is to converting binary files or win pe files
from one cpu to another cpu, But it does not exists
plan to port over diffent hardware architect like
how diffent hw comucate, example x86 DMA controller
to PPC like that stuff. It is only to convert the
binary or pe files to another cpu. it mean a user
mode apps will always be ported, but if it self
modify code it will not work. But it exists idea how
to deal with self modify code.
The idea to handling self modify code
The idea is to add a small emulator or adding
anaylysing process to dectect self modify code
and extract it. This is very hard part todo, some say
imposible, some other say almost imposble. and I say
it is posible todo but extream hard todo. for it is
very diffcul to dectect self modify code with a
analysing process.
Why the name are CpuToIntel
When I start write on it it was only ment to convert
from ARM, PPC, m68k to X86 but then I come think of
ReactOS PPC port that is going on. for or later we
will need something that doing convert from x86 to
PPC apps. It exists two way todo it. One is to use
dymatic translation a jit, like UAE or QEMU doing
converting. But it will lose of allot of speed if
it is a game or a havy apps to much. So the idea
is to convert the whole file in one sweep. will give
one other problem it will be a slow process todo it,
and hard dectect self modify program. so not all program
can be really convert with this process.
Who will it work
we take it step for step and I will describe the
binary translations how it works. The PE file
work simluare way.
step 1 : it will disambler the program frist
step 2 : translate everthing to a middle asm dialect,
it is own asm dialect it is not suite for a real
step 3 : (not implement) send it to ananalysing processs
to get any name or mark out which row is a new functions
step 3.5 (not implement) split the code into functions here
step 4 : Now it start the convert process.
step 4.5 (not implement) maybe a optimzer.
step 5 : now it is finish.
The arch that are plan
PPC to IA32, PPC (work in progress)
m68k to IA32, PPC (stubed)
ARM to IA32, PPC (stubed)
IA32 to IA32, PPC (work in progress)
The Winodws NT PPC and x85 diffrent
R1 The stack pointer equal with x86 esp
R3 The return reg equal with x86 eax
R4 The return reg equal with x86 edx
R31 The base pointer equal with x86 ebp

View file

@ -1,74 +0,0 @@
#ifndef __ANY_OP_H__
#define __ANY_OP_H__
#define OP_ANY_mov 0x00000000
#define OP_ANY_ret 0x00000001
/* We are using same abi as PPC
* eax = register 3
* edx = register 4
* esp = register 1
* ebp = register 31
* ecx = 8
* ebx = 9
* esi = 10
* edi = 11
* mmx/sse/fpu 0 = 12
* mmx/sse/fpu 1 = 14
* mmx/sse/fpu 2 = 16
* mmx/sse/fpu 3 = 18
* mmx/sse/fpu 4 = 20
* mmx/sse/fpu 5 = 22
* mmx/sse/fpu 6 = 24
* mmx/sse/fpu 7 = 28
*/
typedef struct _BrainAnalys
{
CPU_UNINT op; /* one tranlator for any cpu type set our own opcode */
CPU_INT type; /* 1 = source are memmory, 2 source are register */
/* 4 = dest are memmory, 8 dest are register */
/* 16 = source are imm */
/* 32 = soucre -xx(r1) or [eax-xx] */
/* 64 = dest -xx(r1) or [eax-xx] */
/* 128 = update form the src be update with dest */
CPU_INT src_size; /* who many bits are src not vaild for reg*/
CPU_INT dst_size; /* who many bits are dst not vaild for reg*/
CPU_UNINT64 src;
CPU_UNINT64 dst;
CPU_INT src_extra; /* if type == 32 are set */
CPU_INT dst_extra; /* if type == 32 are set */
CPU_UNINT memAdr; /* where are we in the current memory pos + baseaddress */
CPU_INT row; /* 0 = no row,
* 1 = row is bcc (conditions),
* 2 = row is jsr (Call)
*/
/* try translate the Adress to a name */
CPU_BYTE* ptr_next; /* hook next one */
CPU_BYTE* ptr_prev; /* hook previus one */
} MYBrainAnalys, *PMYBrainAnalys;
extern PMYBrainAnalys pMyBrainAnalys; /* current working address */
extern PMYBrainAnalys pStartMyBrainAnalys; /* start address */
CPU_INT ConvertToIA32Process( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount);
CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount);
#endif

View file

@ -1,31 +0,0 @@
<module name="cputointel" type="win32cui" installbase="system32" installname="cputointel.exe" stdlib="host">
<include base="cputointel">.</include>
<library>kernel32</library>
<library>user32</library>
<file>CpuToIntel.c</file>
<file>misc.c</file>
<file>From/ARM/ARMBrain.c</file>
<file>From/ARM/ARMopcode.c</file>
<file>From/IA32/IA32Brain.c</file>
<file>From/IA32/IA32opcode.c</file>
<file>From/m68k/M68kBrain.c</file>
<file>From/m68k/M68kopcode.c</file>
<file>From/PPC/PPCBrain.c</file>
<file>From/PPC/PPCopcode.c</file>
<file>From/dummycpu/DummyBrain.c</file>
<file>From/dummycpu/Dummyopcode.c</file>
<file>ImageLoader.c</file>
<file>AnyalsingProcess.c</file>
<file>ConvertingProcess.c</file>
<file>ConvertToIA32Process.c</file>
<file>ConvertToPPCProcess.c</file>
</module>

View file

@ -1,199 +0,0 @@
/* only for getting the pe struct */
#include <windows.h>
#include <winnt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "any_op.h"
#include "From/ARM/ARM.h"
#include "From/m68k/m68k.h"
#include "From/PPC/PPC.h"
/* retun
* 0 = Ok
* 1 = unimplemt
* 2 = Unkonwn Opcode
* 3 = can not open read file
* 4 = can not open write file
* 5 = can not seek to end of read file
* 6 = can not get the file size of the read file
* 7 = read file size is Zero
* 8 = can not alloc memory
* 9 = can not read file
*-------------------------
* type 0 : auto
* type 1 : bin
* type 2 : exe/dll/sys
*/
/* Conveting bit array to a int byte */
CPU_UNINT ConvertBitToByte(CPU_BYTE *bit)
{
CPU_UNINT Byte = 0;
CPU_INT t;
CPU_UNINT size = 15;
for(t=size;t>=0;t--)
{
if (bit[size-t] != 2)
Byte = Byte + (bit[size-t]<<t);
}
return Byte;
}
/* Conveting bit array mask to a int byte mask */
CPU_UNINT GetMaskByte(CPU_BYTE *bit)
{
CPU_UNINT MaskByte = 0;
CPU_INT t;
CPU_UNINT size = 15;
for(t=size;t>=0;t--)
{
if (bit[size-t] == 2)
{
MaskByte = MaskByte + ( (bit[size-t]-1) <<t);
}
}
return MaskByte;
}
/* Conveting bit array to a int byte */
CPU_UNINT ConvertBitToByte32(CPU_BYTE *bit)
{
CPU_UNINT Byte = 0;
CPU_INT t;
CPU_UNINT size = 31;
for(t=size;t>=0;t--)
{
if (bit[size-t] != 2)
Byte = Byte + (bit[size-t]<<t);
}
return Byte;
}
/* Conveting bit array mask to a int byte mask */
CPU_UNINT GetMaskByte32(CPU_BYTE *bit)
{
CPU_UNINT MaskByte = 0;
CPU_INT t;
CPU_UNINT size = 31;
for(t=size;t>=0;t--)
{
if (bit[size-t] == 2)
{
MaskByte = MaskByte + ( (bit[size-t]-1) <<t);
}
}
return MaskByte;
}
CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer)
{
CPU_UNINT cpuint;
CPU_UNINT split1;
CPU_UNINT split2;
CPU_UNINT split3;
CPU_UNINT split4;
cpuint = *((CPU_UNINT*) &cpu_buffer[0]);
split1 = cpu_buffer[0];
split2 = cpu_buffer[1];
split3 = cpu_buffer[2];
split4 = cpu_buffer[3];
cpuint = split4+(split3 <<8 )+(split2 <<16 )+(split1 <<24 );
return cpuint;
}
CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer)
{
CPU_UNINT cpuint;
cpuint = *((CPU_UNINT*) &cpu_buffer[0]);
return cpuint;
}
CPU_INT AllocAny()
{
if (pMyBrainAnalys== NULL)
{
pMyBrainAnalys = (PMYBrainAnalys) malloc(sizeof(MYBrainAnalys));
if (pMyBrainAnalys==NULL)
{
return -1;
}
ZeroMemory(pMyBrainAnalys,sizeof(MYBrainAnalys));
pStartMyBrainAnalys = pMyBrainAnalys;
}
else
{
PMYBrainAnalys tmp;
tmp = (PMYBrainAnalys) malloc(sizeof(MYBrainAnalys));
if (tmp==NULL)
{
return -1;
}
ZeroMemory(tmp,sizeof(MYBrainAnalys));
pMyBrainAnalys->ptr_next = (CPU_BYTE*)tmp;
tmp->ptr_prev= (CPU_BYTE*)pMyBrainAnalys;
pMyBrainAnalys = tmp;
}
return 0;
}
CPU_INT FreeAny()
{
PMYBrainAnalys tmp = NULL;
if (pMyBrainAnalys == NULL)
{
return -1;
}
tmp = (PMYBrainAnalys)pMyBrainAnalys->ptr_prev;
while (pMyBrainAnalys != NULL)
{
if (pMyBrainAnalys == NULL)
{
break;
}
free(pMyBrainAnalys);
if (pMyBrainAnalys != NULL)
{
printf("fail to free memory");
return -1;
}
pMyBrainAnalys = tmp;
}
return 0;
}

View file

@ -1,35 +0,0 @@
/* 64bits unsigned */
#define CPU_UNINT64 unsigned long long
/* 32bits */
#define CPU_UNINT unsigned int
#define CPU_INT int
/* 16 bits signed */
#define CPU_SHORT short
/* 8bits unsigned */
#define CPU_BYTE unsigned char
/* Prototypes for misc stuff */
CPU_INT LoadPFileImage(char *infileName, char *outputfileName, CPU_UNINT BaseAddress, char *cpuid, CPU_UNINT type, CPU_INT mode);
CPU_INT PEFileStart( CPU_BYTE *memory, CPU_UNINT pos, CPU_UNINT base, CPU_UNINT size, FILE *outfp, CPU_INT mode);
CPU_UNINT ConvertBitToByte(CPU_BYTE *bit);
CPU_UNINT GetMaskByte(CPU_BYTE *bit);
CPU_UNINT ConvertBitToByte32(CPU_BYTE *bit);
CPU_UNINT GetMaskByte32(CPU_BYTE *bit);
CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer);
CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer);
CPU_INT AllocAny();
CPU_INT FreeAny();
CPU_INT AnyalsingProcess();
CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid);

View file

@ -12,10 +12,6 @@
<xi:include href="genguid/genguid.rbuild" />
</directory>
<directory name="roswebparser">
<xi:include href="roswebparser/roswebparser.rbuild" />
</directory>
<directory name="syscalldump">
<xi:include href="syscalldump/syscalldump.rbuild" />
</directory>
@ -27,9 +23,5 @@
<directory name="vgafontedit">
<xi:include href="vgafontedit/vgafontedit.rbuild" />
</directory>
<directory name="zoomin">
<xi:include href="zoomin/zoomin.rbuild" />
</directory>
</group>

View file

@ -1,32 +0,0 @@
/*
* Windows OEM 457 code page table. need by english rc files, area 0x80 to 0x9f should be blank
*/
unsigned short table_Windows28591[256] =
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B,
0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045,
0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063,
0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D,
0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081,
0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B,
0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095,
0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9,
0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3,
0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD,
0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1,
0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB,
0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5,
0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9,
0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF};

View file

@ -1,33 +0,0 @@
/*
* Windows OEM 457 code page table. need by english rc files, area 0x80 to 0x9f should be blank
*/
unsigned short table_Windows28592[256] =
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B,
0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045,
0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063,
0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D,
0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081,
0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B,
0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095,
0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160,
0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142,
0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD,
0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143,
0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170,
0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A,
0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F,
0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9};

View file

@ -1,35 +0,0 @@
/*
* Windows OEM 457 code page table. need by english rc files
*/
unsigned short table_OEM437[256] =
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B,
0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045,
0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063,
0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D,
0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x00C7, 0x00FC,
0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF,
0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2,
0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310,
0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502,
0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C,
0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564,
0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588,
0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3,
0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219,
0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0};

View file

@ -1,32 +0,0 @@
/*
* Windows OEM 850 code page table. need by english rc files
*/
unsigned short table_OEM850[256] =
{
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B,
0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045,
0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063,
0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D,
0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x00C7, 0x00FC,
0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF,
0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2,
0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE,
0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502,
0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2,
0x00A5, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, 0x00F0, 0x00D0,
0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588,
0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5,
0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8,
0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0};

File diff suppressed because it is too large Load diff

View file

@ -1,8 +0,0 @@
<module name="roswebparser" type="win32cui" installbase="system32" installname="roswebparser.exe" allowwarnings ="true">
<include base="zoomin">.</include>
<library>kernel32</library>
<file>roswebparser.c</file>
<file>utf8.c</file>
</module>

View file

@ -1,75 +0,0 @@
/*
* Convert ansi to utf-8
* it does not support more that utf-16
* the table we are using is base on utf-16 then we convert the table to utf-8
*
* All table lookup the ansi char to utf-16 then we calc the utf-8 format.
*/
#include "oem437.h" /* windows oem 437 */
#include "oem850.h" /* windows oem 850 */
#include "Windows28591.h" /* windows 28591 aka ISO-2859-1 (Latin 1) */
#include "Windows28592.h" /* windows 28592 aka ISO-2859-2 (Latin 2) */
int ansiCodePage(int codepage, unsigned char *inBuffer, unsigned char *outBuffer, int Lenght)
{
int t;
int ch;
int pos=0;
for (t=0;t<Lenght;t++)
{
ch=-1;
if (codepage == 437)
{
ch = (int) table_OEM437[ ((unsigned char)inBuffer[t])];
}
if (codepage == 850)
{
ch = (int) table_OEM850[ ((unsigned char)inBuffer[t])];
}
if (codepage == 28591)
{
ch = (int) table_Windows28591[ ((unsigned char)inBuffer[t])];
}
if (codepage == 28592)
{
ch = (int) table_Windows28592[ ((unsigned char)inBuffer[t])];
}
if (ch == -1)
{
break;
}
if (ch <= 0x7F)
{
outBuffer[pos]=ch;
pos++;
}
else if (ch <=0x07FF) // 1 1111 11 1111
{
outBuffer[pos]= 0xC0 | (0x1F & (ch >> 6)); // 110x xxxx
outBuffer[pos+1]= 0x80 | (0x3f & ch); // 11xx xxxx
pos+=2;
}
else if (ch <=0xFFFF) // 11 11 11 11 11 11 11 11
{
outBuffer[pos]= 0xC2 | (0xf & (ch >> 12)); // 1110xxxx
outBuffer[pos+1]= 0x80 | (0x3f & (ch >> 6)); // 10xxxxxx
outBuffer[pos+1]= 0x80 | (0x3f & ch); // 10xxxxxx
pos+=3;
}
}
return pos;
}

View file

@ -1,240 +0,0 @@
/*
* ReactOS zoomin
*
* framewnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* Copyright (C) 2005 Martin Fuchs <martin-fuchs@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include "main.h"
#include "framewnd.h"
extern void ExitInstance();
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static int s_factor = 2; // zoom factor
static POINT s_srcPos = {0, 0}; // source rectangle position
static RECT s_lastSrc = {-1,-1,-1,-1}; // last cursor position
BOOL s_dragging = FALSE;
// zoom range
#define MIN_ZOOM 1
#define MAX_ZOOM 16
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: SetZoom()
//
// PURPOSE: Change zoom level
//
static void SetZoom(HWND hWnd, int factor)
{
TCHAR buffer[MAX_LOADSTRING];
if (factor>=MIN_ZOOM && factor<=MAX_ZOOM) {
s_factor = factor;
SetScrollPos(hWnd, SB_VERT, s_factor, TRUE);
wsprintf(buffer, TEXT("%s %dx"), szTitle, s_factor);
SetWindowText(hWnd, buffer);
}
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam)) {
// Parse the menu selections:
case ID_EDIT_EXIT:
DestroyWindow(hWnd);
break;
case ID_EDIT_COPY:
case ID_EDIT_REFRESH:
case ID_OPTIONS_REFRESH_RATE:
case ID_HELP_ABOUT:
// TODO:
break;
case ID_REFRESH:
InvalidateRect(hWnd, NULL, FALSE);
break;
default:
return FALSE;
}
return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
SetTimer(hWnd, 0, 200, NULL); // refresh display all 200 ms
SetScrollRange(hWnd, SB_VERT, 1, MAX_ZOOM, FALSE);
SetZoom(hWnd, s_factor);
break;
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdcMem;
RECT clnt;
SIZE size;
BeginPaint(hWnd, &ps);
hdcMem = GetDC(GetDesktopWindow());
GetClientRect(hWnd, &clnt);
size.cx = (clnt.right + s_factor-1) / s_factor;
size.cy = (clnt.bottom + s_factor-1) / s_factor;
StretchBlt(ps.hdc, 0, 0, size.cx*s_factor, size.cy*s_factor,
hdcMem, s_srcPos.x, s_srcPos.y, size.cx, size.cy, SRCCOPY);
ReleaseDC(GetDesktopWindow(), hdcMem);
EndPaint(hWnd, &ps);
break;}
case WM_TIMER:
if (s_dragging && GetCapture()==hWnd) {
RECT clnt, rect;
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
GetCursorPos(&s_srcPos);
GetClientRect(hWnd, &clnt);
s_srcPos.x -= clnt.right / s_factor / 2;
s_srcPos.y -= clnt.bottom / s_factor / 2;
if (s_srcPos.x < 0)
s_srcPos.x = 0;
else if (s_srcPos.x+clnt.right/s_factor > width)
s_srcPos.x = width - clnt.right/s_factor;
if (s_srcPos.y < 0)
s_srcPos.y = 0;
else if (s_srcPos.y+clnt.bottom/s_factor > height)
s_srcPos.y = height - clnt.bottom/s_factor;
if (memcmp(&rect, &s_lastSrc, sizeof(RECT))) {
HDC hdc = GetDC(0);
if (s_lastSrc.bottom != -1)
DrawFocusRect(hdc, &s_lastSrc);
rect.left = s_srcPos.x - 1;
rect.top = s_srcPos.y - 1;
rect.right = rect.left + clnt.right/s_factor + 2;
rect.bottom = rect.top + clnt.bottom/s_factor + 2;
DrawFocusRect(hdc, &rect);
ReleaseDC(0, hdc);
s_lastSrc = rect;
}
}
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
break;
case WM_LBUTTONDOWN:
s_dragging = TRUE;
SetCapture(hWnd);
break;
case WM_LBUTTONUP:
case WM_CANCELMODE:
if (s_dragging) {
HDC hdc = GetDC(0);
DrawFocusRect(hdc, &s_lastSrc);
ReleaseDC(0, hdc);
s_lastSrc.bottom = -1;
s_dragging = FALSE;
ReleaseCapture();
}
break;
case WM_VSCROLL:
switch(wParam) {
case SB_LINEUP:
case SB_PAGEUP:
SetZoom(hWnd, s_factor-1);
break;
case SB_LINEDOWN:
case SB_PAGEDOWN:
SetZoom(hWnd, s_factor+1);
break;
}
break;
case WM_DESTROY:
KillTimer(hWnd, 0);
PostQuitMessage(0);
ExitInstance();
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,32 +0,0 @@
/*
* ReactOS zoomin
*
* framewnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FRAMEWND_H__
#define __FRAMEWND_H__
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
#define WNDCLASS_ZOOMIN TEXT("ZOOMIN")
#endif // __FRAMEWND_H__

View file

@ -1,85 +0,0 @@
/* $Id: zoomin.rc 31932 2008-01-21 21:29:59Z dreimer $ */
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Refresh\tF5", ID_EDIT_REFRESH
END
POPUP "&Options"
BEGIN
MENUITEM "&Refresh Rate...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,85 +0,0 @@
/* $Id: zoomin.rc 31932 2008-01-21 21:29:59Z dreimer $ */
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&Archivo"
BEGIN
MENUITEM "Sa&lir\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Edición"
BEGIN
MENUITEM "&Copiar\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Actualizar\tF5", ID_EDIT_REFRESH
END
POPUP "&Opciones"
BEGIN
MENUITEM "&Velocidad de actualización...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "Ay&uda"
BEGIN
MENUITEM "&Acerca de ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Acerca de"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "Aceptar",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,83 +0,0 @@
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&Fichier"
BEGIN
MENUITEM "Quitter\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Édition"
BEGIN
MENUITEM "&Copier\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Rafraîchir\tF5", ID_EDIT_REFRESH
END
POPUP "&Options"
BEGIN
MENUITEM "Taux de &rafraîchissement...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "Aide"
BEGIN
MENUITEM "&A propos de...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "A propos de"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,85 +0,0 @@
/* $Id: zoomin.rc 31932 2008-01-21 21:29:59Z dreimer $ */
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&Fil"
BEGIN
MENUITEM "A&vslutt\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Rediger"
BEGIN
MENUITEM "&Kopier\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Oppdater\tF5", ID_EDIT_REFRESH
END
POPUP "&Valg"
BEGIN
MENUITEM "&Oppdatering hastighet...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "&Hjelp"
BEGIN
MENUITEM "&Om ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Om"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin versjon 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Enerett (C) 2002 ReactOS gruppen",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,87 +0,0 @@
/* TRANSLATOR : Mário Kaèmár /Mario Kacmar/ aka Kario (kario@szm.sk)
* DATE OF TR.: 04-09-2008
*/
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&Súbor"
BEGIN
MENUITEM "&Skonèi<C3A8>\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Upravi<76>"
BEGIN
MENUITEM "&Kopírova<76>\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Obnovi<76>\tF5", ID_EDIT_REFRESH
END
POPUP "&Možnos<6F>i"
BEGIN
MENUITEM "&Obnovovací kmitoèet...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "&Pomocník"
BEGIN
MENUITEM "È&o je ...", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Èo je Zoomin"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin verzia 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Autorské práva (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,91 +0,0 @@
/*
* PROJECT: ReactOS zoomin
* LICENSE: GPL - See COPYING in the top level directory
* FILE: devutils/zoomin/lang/uk-UA.rc
* PURPOSE: Ukraianian resource file
* TRANSLATOR: Artem Reznikov
*/
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN
POPUP "&Ôàéë"
BEGIN
MENUITEM "Â&èõ³ä\tAlt-F4", ID_EDIT_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Êîï³þâàòè\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Îíîâèòè\tF5", ID_EDIT_REFRESH
END
POPUP "&Options"
BEGIN
MENUITEM "&×àñòîòà îíîâëåííÿ...", ID_OPTIONS_REFRESH_RATE, GRAYED
END
POPUP "&Äîâ³äêà"
BEGIN
MENUITEM "&Ïðî ïðîãðàìó", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 230, 75
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Ïðî ïðîãðàìó"
FONT 8, "System"
BEGIN
ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16
LTEXT "ReactOS zoomin âåðñ³ÿ 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Zoomin"
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END

View file

@ -1,119 +0,0 @@
/*
* ReactOS zoomin
*
* main.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include "main.h"
#include "framewnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
HWND hFrameWnd;
HMENU hMenuFrame;
TCHAR szTitle[MAX_LOADSTRING];
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: creates main window
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
WNDCLASSEX wcFrame = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
FrameWndProc,
0/*cbClsExtra*/,
0/*cbWndExtra*/,
hInstance,
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN)),
LoadCursor(0, IDC_ARROW),
0,//(HBRUSH)(COLOR_BTNFACE+1),
0/*lpszMenuName*/,
WNDCLASS_ZOOMIN,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN_MENU));
hFrameWnd = CreateWindowEx(0, (LPCTSTR)UlongToPtr(hFrameWndClass), szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE | WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT, 250, 250,
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
}
ShowWindow(hFrameWnd, nCmdShow);
UpdateWindow(hFrameWnd);
return TRUE;
}
////////////////////////////////////////////////////////////////////////////////
void ExitInstance(void)
{
DestroyMenu(hMenuFrame);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccel;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN));
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}

View file

@ -1,40 +0,0 @@
/*
* ReactOS zoomin
*
* main.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#include "resource.h"
#define MAX_LOADSTRING 100
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern TCHAR szTitle[];
#endif // __MAIN_H__

View file

@ -1,22 +0,0 @@
#define ID_ZOOMIN_MENU 0
#define ID_FILE_MENU 1
#define ID_OPTIONS_MENU 2
#define ID_HELP_MENU 3
#define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103
#define IDI_ZOOMIN 107
#define IDI_SMALL 108
#define IDR_ZOOMIN_MENU 109
#define IDR_ZOOMIN 110
#define ID_EDIT_EXIT 32700
#define ID_EDIT_COPY 32701
#define ID_EDIT_REFRESH 32702
#define ID_OPTIONS_REFRESH_RATE 32704
#define ID_HELP_ABOUT 32703
#define ID_REFRESH 40001
#define IDC_STATIC -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,9 +0,0 @@
<module name="zoomin" type="win32gui" installbase="system32" installname="zoomin.exe">
<include base="zoomin">.</include>
<library>kernel32</library>
<library>gdi32</library>
<library>user32</library>
<file>framewnd.c</file>
<file>main.c</file>
<file>zoomin.rc</file>
</module>

View file

@ -1,16 +0,0 @@
/* $Id$ */
#include <windows.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Zoomin Utility\0"
#define REACTOS_STR_INTERNAL_NAME "zoomin\0"
#define REACTOS_STR_ORIGINAL_FILENAME "zoomin.exe\0"
#include <reactos/version.rc>
#include "lang/en-US.rc"
#include "lang/es-ES.rc"
#include "lang/fr-FR.rc"
#include "lang/no-NO.rc"
#include "lang/sk-SK.rc"
#include "lang/uk-UA.rc"