Skip to content

Commit

Permalink
Fixed bug in cursor resource, using wrong memory stream to full DIB b…
Browse files Browse the repository at this point in the history
…ytes.
  • Loading branch information
lkinsella committed Jul 13, 2016
1 parent 18f57d5 commit cbeb9c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions Src/Debug Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ static void Main(string[] args)
//string file_name = Assembly.GetEntryAssembly().Location;
//string file_name = @"C:\Windows\SysWOW64\kernel32.dll";
//string file_name = @"C:\Windows\System32\kernel32.dll";
//string file_name = @"C:\Windows\SysWOW64\shell32.dll";
string file_name = @"C:\Windows\SysWOW64\shell32.dll";
//string file_name = @"C:\Windows\System32\shell32.dll";
//string file_name = @"C:\Windows\System32\user32.dll";
//string file_name = @"C:\Windows\explorer.exe";
//string file_name = @"C:\Windows\SysWOW64\xpsservices.dll";
//string file_name = @"c:\windows\system32\advapi32.dll";
//string file_name = @"C:\Program Files (x86)\Notepad++\notepad++.exe";
string file_name = @"C:\Windows\WinSxS\x86_microsoft-windows-notepad.resources_31bf3856ad364e35_6.3.9600.16384_en-gb_aafce17aef6b0109\notepad.exe.mui";
//string file_name = @"C:\Windows\WinSxS\x86_microsoft-windows-notepad.resources_31bf3856ad364e35_6.3.9600.16384_en-gb_aafce17aef6b0109\notepad.exe.mui";
string error_message;

if (!ExecutableImage.IsValid(file_name,out error_message))
Expand All @@ -42,11 +42,12 @@ static void Main(string[] args)

ExecutableImage image = ExecutableImage.FromFile(file_name);
ResourceCollection resources = ResourceCollection.Get(image);
ResourceType types = resources.First(t => t.Id == ResourceType.RT_ACCELERATOR);
Resource resource = types.First(r => r.Id == "MAINACC");
AcceleratorResource accelerators = AcceleratorResource.Load(resource, 2057);
ResourceType types = resources.First(t => t.Id == ResourceType.RT_CURSOR);
Resource resource = types.First(r => r.Id == 97);
CursorResource cursor_resource = CursorResource.Load(resource);

cursor_resource.Save(@"D:\test.cur");

//Console.ReadKey();
}

}
Expand Down
2 changes: 1 addition & 1 deletion Src/Workshell.PE.Resources/Graphics/CursorResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static CursorResource Load(Resource resource, uint language)
{
mem.CopyTo(dib_mem, 4096);

dib = mem.ToArray();
dib = dib_mem.ToArray();
}

CursorResource cursor = new CursorResource(resource, language, hotspot_x, hotspot_y, dib);
Expand Down

0 comments on commit cbeb9c3

Please sign in to comment.