![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||
|
||||||||||||||
![]() |
#1
|
|||
|
|||
![]() ...To all, but specially to de4dot's author.
I'm seeking for help with this function: Code:
[return: MarshalAs(UnmanagedType.U1)] public virtual unsafe bool IsSerialValid(SerialNumber serialNumber) { byte num4; cSerialNumber number; int num2 = (int) stackalloc byte[__CxxQueryExceptionSize()]; SerialToImpl(&number, serialNumber); byte num3 = 0; try { uint num; try { bool flag = ActivatorLib.cSerialNumber.IsValid((cSerialNumber modopt(IsConst)* modopt(IsConst) modopt(IsConst)) &number); num3 = 1; ActivatorLib.cSerialNumber.{dtor}(&number); num4 = (byte) flag; goto Label_01FC; } catch when (?) { num = 0; __CxxRegisterExceptionObject((void*) Marshal.GetExceptionPointers(), (void*) num2); try { try { bad_activator modopt(IsConst)* modopt(IsImplicitlyDereferenced) _activatorPtr; throw new ActivatorException(new string(*_activatorPtr[0][4](_activatorPtr))); } catch when (?) { } if (num != 0) { throw; } } finally { __CxxUnregisterExceptionObject((void*) num2, (int) num); } } catch when (?) { num = 0; __CxxRegisterExceptionObject((void*) Marshal.GetExceptionPointers(), (void*) num2); try { try { throw new ActivatorException("Out of memory"); } catch when (?) { } if (num != 0) { throw; } } finally { __CxxUnregisterExceptionObject((void*) num2, (int) num); } } catch when (?) { num = 0; __CxxRegisterExceptionObject((void*) Marshal.GetExceptionPointers(), (void*) num2); try { try { basic_string<char,std::char_traits<char>,std::allocator<char> > local; std.basic_string<char,std::char_traits<char>,std::allocator<char> >.{ctor}(&local, &??_C@_0BF@JJANBHDP@Standard?5exception?3?5?$AA@); try { exception modopt(IsConst)* modopt(IsImplicitlyDereferenced) exceptionPtr; std.basic_string<char,std::char_traits<char>,std::allocator<char> >.+=(&local, *exceptionPtr[0][4](exceptionPtr)); throw new ActivatorException(new string(std.basic_string<char,std::char_traits<char>,std::allocator<char> >.c_str((basic_string<char,std::char_traits<char>,std::allocator<char> > modopt(IsConst)* modopt(IsConst) modopt(IsConst)) &local))); } fault { ___CxxCallUnwindDtor(std.basic_string<char,std::char_traits<char>,std::allocator<char> >.{dtor}, (void*) &local); } } catch when (?) { } if (num != 0) { throw; } } finally { __CxxUnregisterExceptionObject((void*) num2, (int) num); } } catch when (?) { num = 0; __CxxRegisterExceptionObject((void*) Marshal.GetExceptionPointers(), (void*) num2); try { try { throw new ActivatorException("Unkown exception"); } catch when (?) { } if (num != 0) { throw; } } finally { __CxxUnregisterExceptionObject((void*) num2, (int) num); } } } fault { if (num3 == 0) { ___CxxCallUnwindDtor(ActivatorLib.cSerialNumber.{dtor}, (void*) &number); } } ActivatorLib.cSerialNumber.{dtor}(&number); num3 = 0; try { num4 = 0; } fault { if (num3 == 0) { ___CxxCallUnwindDtor(ActivatorLib.cSerialNumber.{dtor}, (void*) &number); } } Label_01FC: return (bool) num4; } I'd like to try keygenning this, but I'm so newbie I don't know what the statements starting with __ do. Plus I don't know how can I see the native code in ActivatorLib.cSerialNumber.IsValid. Code:
[return: MarshalAs(UnmanagedType.U1)] [PreserveSig, MethodImpl(MethodImplOptions.Unmanaged, MethodCodeType=MethodCodeType.Native), SuppressUnmanagedCodeSecurity] public static unsafe bool modopt(CallConvThiscall) ActivatorLib.cSerialNumber.IsValid(cSerialNumber modopt(IsConst)* modopt(IsConst) modopt(IsConst)); Pointers in the right direction will be greatly appreciated. Thanks! Last edited by Git : 11-17-2011 at 10:22 AM. |
#2
|
|||
|
|||
![]() To get address of unmanaged functions, you can use ILDASM.
You'll see something like this: Code:
.method public static pinvokeimpl(/* No map */) bool modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall) marshal( unsigned int8) MemoQ.ActivatorLib.cSerialNumber.IsValid(valuetype MemoQ.ActivatorLib.cSerialNumber modopt([mscorlib]System.Runtime.CompilerServices.IsConst)* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) A_0) native unmanaged preservesig { .custom instance void [mscorlib]System.Security.SuppressUnmanagedCodeSecurityAttribute::.ctor() = ( 01 00 00 00 ) // Embedded native code // Disassembly of native methods is not supported. // Managed TargetRVA = 0x00025790 } // end of global method MemoQ.ActivatorLib.cSerialNumber.IsValid |
#3
|
|||
|
|||
![]() MANY thanks kao for the tip!! I will start looking there
![]() |