Re: Legal Issues
Posted: Sun Oct 26, 2008 12:36 pm
Hi,
For example, imagine if my application contains something like this:
Your utility will look at this code, and might think the code is:
In this case, your utility might convert it into:
Now, not only would this mess up the jump table but you've also inserted bytes (due to different kernel APIs) and you'd need to recalculate every dword in the table. You've also got no way of knowing how large the table is - maybe the table only had one entry and you did the right thing when you changed the bytes after the first entry, but maybe the table had 8000 entries and you corrupted lots of data.
To avoid things like this you'd need to interpret every instruction, one by one, starting from the entry point and following every path from every branch (for e.g. for "jc .foo" you'd need to interpret the "branch taken" path and the "branch not taken" path), while keeping track of which instructions actually were instructions.
Maybe your OS is fundamentally different to Windows in some way. For a simple example, maybe your "open a file" API function returns a "this file is too smelly" error code that Windows doesn't support, so when the application tries to open a file there's no code in the application to handle your extra error code and your utility needs to automatically generate code that makes sense for the application (should it create a dialog box, or retry, or exit the application, or try a different file name? I don't know, but your utility would need to automatically figure out what it should do).
Just for fun, write down a very minimal specification for your kernel API that's just enough to display "Hello World". Then create a "Hello World" console application for Windows and disassemble it. See if you can convert the resulting disassembly (by hand) into something that might run using your kernel API. This might sound like an very simple task to you. I think it'd be valuable "proof of concept" exercise just to see how viable your utility will be...
Cheers,
Brendan
I mean data that happens to be mixed in with the code (and not in a separate section like the ".data" section, where it can easily be identified as data). By "trashing" I mean accidentally corrupting it.TheDragon wrote:What do you mean by embedded data and trashing it?
For example, imagine if my application contains something like this:
Code: Select all
myFunction:
mov eax,0x12345678
int 0x80 ;<-call windows API (not sure what it actually looks like)
mov eax,[esp+4]
mov ebx,[esp+8]
jmp [.myTable + eax*4 + ebx]
.myTable:
dd 0x90909090, 0x000080CD, 0x00000000
Code: Select all
mov eax,0x12345678
int 0x80 ;<-call windows API (not sure what it actually looks like)
mov eax,[esp+4]
mov ebx,[esp+8]
jmp [.myTable + eax*4 + ebx]
nop
nop
nop
nop
int 0x80 ;<-possibly another windows API call?
add eax,???
Code: Select all
mov eax,0x87654321
mov ebx,0x12345678
syscall ;<-equivelent API function for your OS
mov eax,[esp+4]
mov ebx,[esp+8]
jmp [.myTable + eax*4 + ebx]
nop
nop
nop
nop
mov eax,0x87654321
syscall ;<-equivelent API function for your OS
add eax,???
To avoid things like this you'd need to interpret every instruction, one by one, starting from the entry point and following every path from every branch (for e.g. for "jc .foo" you'd need to interpret the "branch taken" path and the "branch not taken" path), while keeping track of which instructions actually were instructions.
Maybe your OS is fundamentally different to Windows in some way. For a simple example, maybe your "open a file" API function returns a "this file is too smelly" error code that Windows doesn't support, so when the application tries to open a file there's no code in the application to handle your extra error code and your utility needs to automatically generate code that makes sense for the application (should it create a dialog box, or retry, or exit the application, or try a different file name? I don't know, but your utility would need to automatically figure out what it should do).
Just for fun, write down a very minimal specification for your kernel API that's just enough to display "Hello World". Then create a "Hello World" console application for Windows and disassemble it. See if you can convert the resulting disassembly (by hand) into something that might run using your kernel API. This might sound like an very simple task to you. I think it'd be valuable "proof of concept" exercise just to see how viable your utility will be...
IMHO the utility itself would be legal, but using the utility may or may not be legal depending on what you use the utility on and which country you happen to be in. In most countries, if you've got a legal original copy of the application then I think you can call it "fair use" and it would be legal to use the utility (but the legal definition for "fair use" in Australia is more specific, so it may or may not be legal where I live). However, I'm not a lawyer, and I am only considering copyright law. EULA's are a completely different issue...TheDragon wrote:But I think we are getting off topic here... Is this LEGAL OR NOT?
Cheers,
Brendan