Represents a Unicode string used for resource names in the resource section.
Inheritance: AbstractStructure
コード例 #1
0
 /// <summary>
 ///     Create a new instance of the IMAGE_RESOURCE_DIRECTORY_ENTRY.
 /// </summary>
 /// <param name="buff">A PE file as a byte array.</param>
 /// <param name="offset">Raw offset to the entry.</param>
 /// <param name="resourceDirOffset">Raw offset to the resource directory.</param>
 public IMAGE_RESOURCE_DIRECTORY_ENTRY(byte[] buff, uint offset, uint resourceDirOffset)
     : base(buff, offset)
 {
     // Resolve the Name
     try
     {
         if (IsIdEntry)
         {
             ResolvedName = Utility.ResolveResourceId(ID);
         }
         else if (IsNamedEntry)
         {
             var nameAddress = resourceDirOffset + (Name & 0x7FFFFFFF);
             var unicodeName = new IMAGE_RESOURCE_DIR_STRING_U(Buff, nameAddress);
             ResolvedName = unicodeName.NameString;
         }
     }
     catch (Exception)
     {
         ResolvedName = null;
     }
 }
コード例 #2
0
 /// <summary>
 ///     Create a new instance of the IMAGE_RESOURCE_DIRECTORY_ENTRY.
 /// </summary>
 /// <param name="buff">A PE file as a byte array.</param>
 /// <param name="offset">Raw offset to the entry.</param>
 /// <param name="resourceDirOffset">Raw offset to the resource directory.</param>
 public IMAGE_RESOURCE_DIRECTORY_ENTRY(byte[] buff, uint offset, uint resourceDirOffset)
     : base(buff, offset)
 {
     // Resolve the Name
     try
     {
         if (IsIdEntry)
         {
             ResolvedName = FlagResolver.ResolveResourceId(ID);
         }
         else if (IsNamedEntry)
         {
             var nameAddress = resourceDirOffset + (Name & 0x7FFFFFFF);
             var unicodeName = new IMAGE_RESOURCE_DIR_STRING_U(Buff, nameAddress);
             ResolvedName = unicodeName.NameString;
         }
     }
     catch (Exception)
     {
         ResolvedName = null;
     }
 }
コード例 #3
0
 public void ImageResourceDirStringUConstructorWorks_Test()
 {
     var resourceDirStringU = new IMAGE_RESOURCE_DIR_STRING_U(RawStructures.RawResourceDirStringU, 2);
     Assert.AreEqual((uint) 0x000b, resourceDirStringU.Length);
     Assert.AreEqual("Hello World", resourceDirStringU.NameString);
 }