2011-12-29 15:26:36 +08:00
|
|
|
|
/*
|
2012-01-10 06:04:52 +08:00
|
|
|
|
Copyright (C) 2011-2012 de4dot@gmail.com
|
2011-12-29 15:26:36 +08:00
|
|
|
|
|
|
|
|
|
This file is part of de4dot.
|
|
|
|
|
|
|
|
|
|
de4dot is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
de4dot is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with de4dot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2012-11-02 22:57:11 +08:00
|
|
|
|
using dot10.DotNet;
|
|
|
|
|
using dot10.DotNet.Emit;
|
2011-12-29 15:26:36 +08:00
|
|
|
|
using de4dot.blocks;
|
|
|
|
|
|
|
|
|
|
namespace de4dot.code.deobfuscators.Goliath_NET {
|
2012-01-20 02:23:34 +08:00
|
|
|
|
class ArrayValueInliner : ValueInlinerBase<byte[]> {
|
2011-12-29 15:26:36 +08:00
|
|
|
|
InitializedDataCreator initializedDataCreator;
|
|
|
|
|
ModuleDefinition module;
|
|
|
|
|
|
|
|
|
|
public ArrayValueInliner(ModuleDefinition module, InitializedDataCreator initializedDataCreator) {
|
|
|
|
|
this.module = module;
|
|
|
|
|
this.initializedDataCreator = initializedDataCreator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void inlineReturnValues(IList<CallResult> callResults) {
|
|
|
|
|
foreach (var callResult in callResults) {
|
|
|
|
|
var block = callResult.block;
|
|
|
|
|
int num = callResult.callEndIndex - callResult.callStartIndex + 1;
|
|
|
|
|
|
2012-01-14 19:16:05 +08:00
|
|
|
|
var arrayData = (byte[])callResult.returnValue;
|
|
|
|
|
initializedDataCreator.addInitializeArrayCode(block, callResult.callStartIndex, num, module.TypeSystem.Byte, arrayData);
|
2012-11-11 12:31:11 +08:00
|
|
|
|
Logger.v("Decrypted array: {0} bytes", arrayData.Length);
|
2011-12-29 15:26:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|