public void Upsvc_Match_Wildcard() { var image = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x00 }; var sig = new ImageSignature { EntryPointPattern = "??34" }; var upsvc = new UnpackingService(sc); Assert.IsTrue(upsvc.Matches(sig, image, 4)); }
public void Upsvc_Find_Match() { var image = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x00, 0x00 }; var le = mr.Stub<LoaderElement>(); le.Label = "LoaderKey"; le.TypeName = typeof(TestImageLoader).AssemblyQualifiedName; cfgSvc.Stub(c => c.GetImageLoaders()).Return(new List<LoaderElement> { le }); sc.AddService(typeof(IConfigurationService), cfgSvc); mr.ReplayAll(); var upSvc = new UnpackingService(sc); upSvc.Signatures.Add(new ImageSignature { Name = "LoaderKey", EntryPointPattern = "1234", }); var loader = upSvc.FindUnpackerBySignature("foo.exe", image, 4); Assert.IsInstanceOf<TestImageLoader>(loader); }