Re: Obfuscator and Decompiler
From: Jonathan Pierce (jpierce_at_nyc.rr.com)
Date: 07/20/04
- Next message: Marty McDonald: "recommended reading?"
- Previous message: Jonathan Pierce: "Re: Obfuscator and Decompiler"
- In reply to: Eugene: "Re: Obfuscator and Decompiler"
- Next in thread: Jonathan Pierce: "Re: Obfuscator and Decompiler"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 20 Jul 2004 07:26:09 -0700
"Eugene" <eugeneh@nospam.hotmail.com> wrote in message news:<OLqiWGgbEHA.1248@TK2MSFTNGP11.phx.gbl>...
> Funny enough Reflector 4.0.15.0 outputs the right code:
>
> public int ReadInt32()
> {
> return ((int) (((this.buffer[this.position++] |
> (this.buffer[this.position++] << 8)) | (this.buffer[this.position++] << 16))
> | (this.buffer[this.position++] << 24)));
> }
>
>
Eugene,
Here's a few more Reflector code generation errors that generate
compile errors. It's not a complete list since I know about several
others but haven't enumerated them all but this a start for Lutz to
start working on. I didn't bother to exclude the runtime ones that I
already mentioned but you can see several compile time errors here
that Reflector 4.0.15 does not handle where Decompiler.NET compiles
and runs the generated code correctly. I'll be happy to post some more
after he fixes these. I didn't describe them here since you can see
them yourself by compiling this code, decompiling it with Reflector,
and trying to recompile the generated code.
using System;
using System.Runtime.InteropServices;
namespace TestReflectorNamespace
{
internal interface IInternalInterfaceIndexTest
{
char this [int index] { get; }
}
[System.Runtime.InteropServices.ComImport()]
[System.Runtime.InteropServices.GuidAttribute("E5CB7A31-7512-11d2-89CE-0080C792E5D8")]
internal class TestInternalCOMImport // CorMetaDataDispenser
{
}
class TestReflector : IInternalInterfaceIndexTest
{
private unsafe byte* fBuffer = null;
internal unsafe bool Boolean (int i)
{
return (* ((bool*) (this.fBuffer + i)));
}
const byte kSearchByteValue = 93;
private static void Write (byte theByte)
{
if (theByte == kSearchByteValue)
{
Console.Write ("Found SearchByteValue...");
}
Console.WriteLine ("The value is: " + theByte.ToString ("X4"));
}
private static void Write (int theInt)
{
Console.WriteLine ("The value is: " + theInt.ToString ("X4"));
}
private static void TestMethodArgumentCast (uint theUnsignedInt)
{
}
private static void TestOutBooleanParameter (out bool theBool)
{
theBool = true;
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
int i1 = 0;
TestMethodArgumentCast ((uint) (100663296 | i1));
bool theBoolean1;
TestOutBooleanParameter (out theBoolean1);
Write (kSearchByteValue);
unsafePointer ("foo");
}
#region IIndexTest Members
char IInternalInterfaceIndexTest.this[int index]
{
get
{
return 'a';
}
}
unsafe static bool unsafePointer(string s)
{
char[] c = new char[10];
s.CopyTo(0,c,0,10);
fixed(char *p=c)
{
*(p+5) = 'x';
for (int i = 0; i < 10; i++)
if (*(p+i) == 'p')
return true;
}
return false;
}
#endregion
}
}
Jonathan Pierce
President
Jungle Creatures, Inc.
http://www.junglecreatures.com/
- Next message: Marty McDonald: "recommended reading?"
- Previous message: Jonathan Pierce: "Re: Obfuscator and Decompiler"
- In reply to: Eugene: "Re: Obfuscator and Decompiler"
- Next in thread: Jonathan Pierce: "Re: Obfuscator and Decompiler"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|