static void clearDllBit(byte[] peImageData) { using (var mainPeImage = new MyPEImage(peImageData)) { uint characteristicsOffset = (uint)mainPeImage.PEImage.ImageNTHeaders.FileHeader.StartOffset + 18; ushort characteristics = mainPeImage.offsetReadUInt16(characteristicsOffset); characteristics &= 0xDFFF; characteristics |= 2; mainPeImage.offsetWriteUInt16(characteristicsOffset, characteristics); } }