-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpCode not supported: Ckfinite #3344
Comments
This is the first time I've seen the By the way, the meaning of this opcode is essentially:
It should not be too hard to implement support in the decompiler (using a non-inlinable argument slot to deal with the duplicate |
Hi dgrunwald! Thanks for your comment! The code are really weird with a lot of custom code like operators and attributes and everything I know about the code is that it was a migration from Delphi 6 to dotnet and the original dotnet code was gone (It is a class library that simulate a soccer match). When I searched the internet for ckfinite, I saw that it is a very unusual use (as you said). Before looking at this code I didn't know that is possible create custom operators to allow something like ClassA + ClassB // Custom operators
public static TDateTime operator +([In][TTime] TDateTime Left, [In] TDateTime Right)
{
double num = Left.ToOADate() + Right.ToOADate();
/*OpCode not supported: Ckfinite*/;
return num;
}
public static double operator -([In] TDateTime Left, [In] TDateTime Right)
{
double num = Left.ToOADate() - Right.ToOADate();
/*OpCode not supported: Ckfinite*/;
return num;
}
public static TDateTime operator -([In] TDateTime Left, [In] double Right)
{
TDateTime Result = default(TDateTime);
Result.FValue = Left.FValue - TimeSpan.FromDays(Right);
return Result;
}
public static TDateTime operator -([In] double Left, [In] TDateTime Right)
{
double num = Left - (double)Right;
/*OpCode not supported: Ckfinite*/;
TDateTime Result = default(TDateTime);
Result.FValue = (TDateTime)num;
return Result;
}
public static double operator *([In] TDateTime Left, int Right)
{
double num = Left.ToOADate() * (double)Right;
/*OpCode not supported: Ckfinite*/;
return num;
}
public static double operator /([In] TDateTime Left, [In] TDateTime Right)
{
double num = Left.ToOADate() / Right.ToOADate();
/*OpCode not supported: Ckfinite*/;
return num;
} And here are some use of the custom operator public static bool TryStrToDateTime([In] string S, out TDateTime Value)
{
bool Result = true;
int Pos = 1;
TDateTime Time = 0;
TDateTime Date = default(TDateTime);
if (!ScanDate(S, ref Pos, ref Date) || (Pos <= (S?.Length ?? 0) && !ScanTime(S, ref Pos, ref Time)))
{
Result = TryStrToTime(S, out Value);
}
else if (Date >= 0)
{
Value = Date + Time; // error here
}
else
{
Value = Date - Time; // and here because the ILSpy was not able to decompile the custom operators due to ckfinite.
}
return Result;
} And here the IL of some custom operators with ckfinite error. .method public hidebysig specialname static
valuetype Borland.Delphi.TDateTime op_Addition (
[in] valuetype Borland.Delphi.TDateTime Left,
[in] valuetype Borland.Delphi.TDateTime modopt(Borland.Delphi.TTime) Right
) cil managed
{
.param [2]
.custom instance void Borland.Delphi.TTime::.ctor() = (
01 00 00 00
)
// Method begins at RVA 0x2824
// Header size: 12
// Code size: 24 (0x18)
.maxstack 2
.locals init (
[0] valuetype Borland.Delphi.TDateTime Result
)
IL_0000: ldarga.s Left
IL_0002: call instance float64 Borland.Delphi.TDateTime::ToOADate()
IL_0007: ldarga.s Right
IL_0009: call instance float64 Borland.Delphi.TDateTime::ToOADate()
IL_000e: add
IL_000f: ckfinite
IL_0010: call valuetype Borland.Delphi.TDateTime Borland.Delphi.TDateTime::op_Implicit(float64)
IL_0015: stloc.0
IL_0016: ldloc.0
IL_0017: ret
} // end of method TDateTime::op_Addition
.method public hidebysig specialname static
valuetype Borland.Delphi.TDateTime op_Subtraction (
[in] valuetype Borland.Delphi.TDateTime Left,
[in] valuetype Borland.Delphi.TDateTime modopt(Borland.Delphi.TDate) Right
) cil managed
{
.param [2]
.custom instance void Borland.Delphi.TDate::.ctor() = (
01 00 00 00
)
// Method begins at RVA 0x2930
// Header size: 12
// Code size: 24 (0x18)
.maxstack 2
.locals init (
[0] valuetype Borland.Delphi.TDateTime Result
)
IL_0000: ldarga.s Left
IL_0002: call instance float64 Borland.Delphi.TDateTime::ToOADate()
IL_0007: ldarga.s Right
IL_0009: call instance float64 Borland.Delphi.TDateTime::ToOADate()
IL_000e: sub
IL_000f: ckfinite
IL_0010: call valuetype Borland.Delphi.TDateTime Borland.Delphi.TDateTime::op_Implicit(float64)
IL_0015: stloc.0
IL_0016: ldloc.0
IL_0017: ret
} // end of method TDateTime::op_Subtraction I just trying to compile the project without update the code to prevent change any business rule and then create a new library with new code. |
Input code
I'm trying to decompile a very old assembly that I guess is in the dotnet framework 4 or lower. A lot of methods was not decompiled and ILSpy added this comment on all methods: /OpCode not supported: Ckfinite/
Here is the IL code
Erroneous output
I thought that could be some missing old dll, so I created a windows XP VM, installed dotnet framework 3.5 and 4.0 and downloaded the first version of ILSpy and it displayed the same error (OpCode not supported: Ckfinite)
Unfortunately I'm not authorized to upload the complete assembly due to company copyrights. I'm not sure if I provided all necessary information but I'm trying to get any advice to get all assembly decompiled.
The text was updated successfully, but these errors were encountered: