本文整理汇总了C#中SerializedSignature类的典型用法代码示例。如果您正苦于以下问题:C# SerializedSignature类的具体用法?C# SerializedSignature怎么用?C# SerializedSignature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializedSignature类属于命名空间,在下文中一共展示了SerializedSignature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public void Parse(string signatureString)
{
this.str = signatureString;
idx = 0;
try
{
var ret = ParseReturn();
var procName = ParseProcedureName();
if (procName == null)
return;
var procArgs = ParseProcedureArgs();
if (procArgs == null)
return;
ProcedureName = procName;
Signature = new SerializedSignature();
Signature.ReturnValue = ret;
Signature.Arguments = procArgs;
IsValid = true;
}
catch
{
IsValid = false;
}
}
示例2: Given_Sig
private void Given_Sig(SerializedType ret, params Argument_v1 [] args)
{
ssig = new SerializedSignature
{
ReturnValue = new Argument_v1 { Type = ret }
};
}
示例3: Deserialize
public override ProcedureSignature Deserialize(SerializedSignature ss, Frame frame)
{
if (ss == null)
return null;
this.argser = new ArgumentSerializer(this, Architecture, frame, ss.Convention);
Identifier ret = null;
int fpuDelta = FpuStackOffset;
FpuStackOffset = 0;
if (ss.ReturnValue != null)
{
ret = argser.DeserializeReturnValue(ss.ReturnValue);
fpuDelta += FpuStackOffset;
}
FpuStackOffset = 0;
var args = new List<Identifier>();
if (ss.Arguments != null)
{
for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
{
var sArg = ss.Arguments[iArg];
var arg = DeserializeArgument(sArg, iArg, ss.Convention);
args.Add(arg);
}
fpuDelta -= FpuStackOffset;
}
FpuStackOffset = fpuDelta;
var sig = new ProcedureSignature(ret, args.ToArray());
ApplyConvention(ss, sig);
return sig;
}
示例4: Deserialize
public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
{
if (ss == null)
return new FunctionType();
if (ss == null)
return null;
var argser = new ArgumentDeserializer(this, Architecture, frame, 0, Architecture.WordWidth.Size);
Identifier ret = null;
if (ss.ReturnValue != null)
{
ret = argser.DeserializeReturnValue(ss.ReturnValue);
}
var args = new List<Identifier>();
this.gr = 0;
if (ss.Arguments != null)
{
for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
{
var sArg = ss.Arguments[iArg];
Identifier arg = DeserializeArgument(argser, sArg);
args.Add(arg);
}
}
var sig = new FunctionType(ret, args.ToArray());
return sig;
}
示例5: Deserialize
public override ProcedureSignature Deserialize(SerializedSignature ss, Frame frame)
{
if (ss == null)
return null;
var argser = new ArgumentSerializer(this, Architecture, frame, ss.Convention);
Identifier ret = null;
if (ss.ReturnValue != null)
{
ret = argser.DeserializeReturnValue(ss.ReturnValue);
}
var args = new List<Identifier>();
if (ss.Arguments != null)
{
for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
{
var sArg = ss.Arguments[iArg];
Identifier arg = argser.Deserialize(sArg);
args.Add(arg);
}
}
var sig = new ProcedureSignature(ret, args.ToArray());
return sig;
}
示例6: Dec_LoadCallSignatures
public void Dec_LoadCallSignatures()
{
var arch = new X86ArchitectureReal();
Program program = new Program {
Architecture = arch,
Platform = new MsdosPlatform(sc, arch)
};
decompiler.Project = new Project
{
Programs = { program },
};
SerializedSignature sig = new SerializedSignature();
sig.Arguments = new Argument_v1[] {
new Argument_v1 {
Kind = new Register_v1("ds")
},
new Argument_v1 {
Kind = new Register_v1("bx"),
}
};
var al = new List<SerializedCall_v1> {
new SerializedCall_v1(Address.SegPtr(0x0C32, 0x3200), sig)
};
var sigs = decompiler.LoadCallSignatures(program, al);
FunctionType ps = sigs[Address.SegPtr(0x0C32, 0x3200)];
Assert.IsNotNull(ps, "Expected a call signature for address");
}
示例7: Dec_LoadCallSignatures
public void Dec_LoadCallSignatures()
{
var arch = new IntelArchitecture(ProcessorMode.Real);
Program program = new Program {
Architecture = arch,
Platform = new MsdosPlatform(null, arch)
};
decompiler.Project = new Project
{
Programs = { program },
};
List<SerializedCall_v1> al = new List<SerializedCall_v1>();
SerializedSignature sig = new SerializedSignature();
sig.Arguments = new Argument_v1[] {
new Argument_v1 {
Kind = new Register_v1("ds")
},
new Argument_v1 {
Kind = new Register_v1("bx"),
}
};
al.Add(new SerializedCall_v1(Address.SegPtr(0x0C32, 0x3200), sig));
var sigs = decompiler.LoadCallSignatures(program, al);
ProcedureSignature ps = sigs[Address.SegPtr(0x0C32, 0x3200)];
Assert.IsNotNull(ps, "Expected a call signature for address");
}
示例8: VoidFunctionSignature
public void VoidFunctionSignature()
{
SerializedSignature sig = new SerializedSignature();
Given_X86ProcedureSerializer();
ProcedureSignature ps = ser.Deserialize(sig, arch.CreateFrame());
Assert.AreEqual("void foo()", ps.ToString("foo"));
Assert.IsTrue(ps.ParametersValid);
}
示例9: ApplyConvention
public void ApplyConvention(SerializedSignature ssig, FunctionType sig)
{
string d = ssig.Convention;
if (d == null || d.Length == 0)
d = DefaultConvention;
sig.StackDelta = 0;
sig.FpuStackDelta = FpuStackOffset;
}
示例10: PopulateSignatureFields
private void PopulateSignatureFields(SerializedSignature sig)
{
if (sig.ReturnValue != null)
{
ListViewItem item = new ListViewItem("<Return value>");
item.Tag = sig.ReturnValue;
dlg.ArgumentList.Items.Add(item);
}
}
示例11: Deserialize
public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
{
int ncrn = 0;
int nsaa = 0;
// mem arg forb ret val
var argser = new ArgumentDeserializer(
this,
Architecture,
frame,
Architecture.PointerType.Size,
Architecture.WordWidth.Size);
Identifier ret = null;
if (ss.ReturnValue != null)
{
ret = argser.DeserializeReturnValue(ss.ReturnValue);
}
var args = new List<Identifier>();
if (ss.Arguments != null)
{
foreach (var sArg in ss.Arguments)
{
var dt = sArg.Type.Accept(TypeLoader);
var sizeInWords = (dt.Size + 3) / 4;
if (sizeInWords == 2 && (ncrn & 1) == 1)
++ncrn;
Identifier arg;
if (sizeInWords <= 4 - ncrn)
{
if (sizeInWords == 2)
{
arg = frame.EnsureSequence(
Architecture.GetRegister(argRegs[ncrn]),
Architecture.GetRegister(argRegs[ncrn + 1]),
dt);
ncrn += 2;
}
else
{
arg = frame.EnsureRegister(
Architecture.GetRegister(argRegs[ncrn]));
ncrn += 1;
}
}
else
{
arg = frame.EnsureStackArgument(nsaa, dt);
nsaa += AlignedStackArgumentSize(dt);
}
args.Add(arg);
}
}
return new FunctionType(ret, args.ToArray());
}
示例12: ApplyConvention
public void ApplyConvention(SerializedSignature ssig, ProcedureSignature sig)
{
string d = ssig.Convention;
if (d == null || d.Length == 0)
d = DefaultConvention;
if (d == "stdapi" || d == "__stdcall" || d == "pascal")
sig.StackDelta = StackOffset;
sig.FpuStackDelta = FpuStackOffset;
}
示例13: Deserialize
public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
{
if (ss == null)
return null;
this.argDeser = new ArgumentDeserializer(
this,
Architecture,
frame,
Architecture.PointerType.Size, //$BUG: x86 real mode?
Architecture.WordWidth.Size);
Identifier ret = null;
int fpuDelta = FpuStackOffset;
FpuStackOffset = 0;
if (ss.ReturnValue != null)
{
ret = argDeser.DeserializeReturnValue(ss.ReturnValue);
fpuDelta += FpuStackOffset;
}
FpuStackOffset = 0;
var args = new List<Identifier>();
if (ss.EnclosingType != null)
{
var arg = DeserializeImplicitThisArgument(ss);
args.Add(arg);
}
if (ss.Arguments != null)
{
if (ss.Convention == "pascal")
{
for (int iArg = ss.Arguments.Length -1; iArg >= 0; --iArg)
{
var sArg = ss.Arguments[iArg];
var arg = DeserializeArgument(sArg, iArg, ss.Convention);
args.Add(arg);
}
args.Reverse();
}
else
{
for (int iArg = 0; iArg < ss.Arguments.Length; ++iArg)
{
var sArg = ss.Arguments[iArg];
var arg = DeserializeArgument(sArg, iArg, ss.Convention);
args.Add(arg);
}
}
fpuDelta -= FpuStackOffset;
}
FpuStackOffset = fpuDelta;
var sig = new FunctionType(ret, args.ToArray());
sig.IsInstanceMetod = ss.IsInstanceMethod;
ApplyConvention(ss, sig);
return sig;
}
示例14: ApplyConvention
public void ApplyConvention(SerializedSignature ssig, ProcedureSignature sig)
{
string d = ssig.Convention;
if (d == null || d.Length == 0)
d = defaultConvention;
if (d != null && d == "stdapi")
sig.StackDelta = stackOffset;
sig.FpuStackDelta = fpuStackOffset;
}
示例15: Verify
private void Verify(SerializedSignature ssig, string outputFilename)
{
using (FileUnitTester fut = new FileUnitTester(outputFilename))
{
XmlTextWriter x = new FilteringXmlWriter(fut.TextWriter);
x.Formatting = Formatting.Indented;
XmlSerializer ser = SerializedLibrary.CreateSerializer_v1(ssig.GetType());
ser.Serialize(x, ssig);
fut.AssertFilesEqual();
}
}