Skip to content

Commit

Permalink
Some changes around resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkinsella committed Aug 9, 2016
1 parent 7f437f7 commit 1afcb1e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Src/Workshell.PE/Content/Resources/ResourceDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ public sealed class ResourceDirectory : ExecutableImageContent, IEnumerable<Reso
{

private IMAGE_RESOURCE_DIRECTORY directory;
private ResourceDirectory parent_directory;
private ResourceDirectoryEntry directory_entry;
private ResourceDirectoryEntry[] entries;

internal ResourceDirectory(DataDirectory dataDirectory, Location dataLocation, ResourceDirectory parentDirectory) : base(dataDirectory,dataLocation)
internal ResourceDirectory(DataDirectory dataDirectory, Location dataLocation, ResourceDirectoryEntry directoryEntry) : base(dataDirectory,dataLocation)
{
LocationCalculator calc = DataDirectory.Directories.Image.GetCalculator();
Stream stream = DataDirectory.Directories.Image.GetStream();

stream.Seek(dataLocation.FileOffset.ToInt64(),SeekOrigin.Begin);

directory = Utils.Read<IMAGE_RESOURCE_DIRECTORY>(stream);
parent_directory = parentDirectory;
directory_entry = directoryEntry;

int count = directory.NumberOfNamedEntries + directory.NumberOfIdEntries;
List<ResourceDirectoryEntry> list = new List<ResourceDirectoryEntry>(count);
Expand Down Expand Up @@ -135,11 +135,11 @@ public byte[] GetBytes()

#region Properties

public ResourceDirectory Parent
public ResourceDirectoryEntry DirectoryEntry
{
get
{
return parent_directory;
return directory_entry;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public ResourceDirectory GetDirectory()
Section section = calc.RVAToSection(rva);
Location location = new Location(file_offset, rva, va, size, size, section);

directory = new ResourceDirectory(parent_directory.DataDirectory,location,parent_directory);
directory = new ResourceDirectory(parent_directory.DataDirectory,location,this);
}

return directory;
Expand Down
2 changes: 1 addition & 1 deletion Src/Workshell.PE/Workshell.PE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Compile Include="Content\Resources\ResourceDirectory.cs" />
<Compile Include="Content\Resources\ResourceDirectoryEntry.cs" />
<Compile Include="Content\Resources\ResourceId.cs" />
<Compile Include="Content\Resources\Resources.cs" />
<Compile Include="Content\Resources\ResourceCollection.cs" />
<Compile Include="Content\TLS\TLSDirectory.cs" />
<Compile Include="DataDirectory.cs" />
<Compile Include="DOSHeader.cs" />
Expand Down

0 comments on commit 1afcb1e

Please sign in to comment.