Editing an accelerator causes no effect on the application.

pitoloko

2014-12-20 02:44:38

Hello

Recentlly I've asked a question on other site about How I could set the default keyboard shortcuts for an specific program (WinAmp music player), and one guy have recommend me to use a resource editor to edit the accelerator table.

This is the executable where I was testing the changes (I share it unmodified):
https://www.mediafire.com/?kjtw88swpkmh8ll

Well, the executable comes with 3 accelerator tables, I would like to change the "B" key behavior to an "M" key, I've ensured that does not exists any ther "M" key association in any of the three accelerator tables.

After I've edited the "B" key to "M", just a simple and easy change using the edit mode of Restorator GUI, winamp loosses all the acceleator capabilities, all. the "B" does not works, the "M" does not works. Something goes wrong when I've edited the accelerator key.

But I'm sure is not my fault, because I tried to reproduce the same change in ResourceHacker, and it worked perfectlly.

What could be the problem?

I noticed that Restorator seems to generate a wrong accelerator resource, this is the content before any edit:

Code: Select all

1373 ACCELERATORS
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
	VK_F4, 40224, NOINVERT, CONTROL, VIRTKEY
	VK_NUMPAD4, 40044, NOINVERT, VIRTKEY
	VK_Z, 40044, NOINVERT, VIRTKEY
	VK_Z, 40154, NOINVERT, CONTROL, VIRTKEY
	VK_Z, 40144, NOINVERT, SHIFT, VIRTKEY
	VK_NUMPAD5, 40045, NOINVERT, VIRTKEY
	VK_X, 40045, NOINVERT, VIRTKEY
	VK_C, 40046, NOINVERT, VIRTKEY
	VK_V, 40047, NOINVERT, VIRTKEY
	VK_V, 40157, NOINVERT, CONTROL, VIRTKEY
	VK_V, 40147, NOINVERT, SHIFT, VIRTKEY
	VK_B, 40048, NOINVERT, VIRTKEY
	VK_NUMPAD6, 40048, NOINVERT, VIRTKEY
	VK_B, 40158, NOINVERT, CONTROL, VIRTKEY
	VK_B, 40148, NOINVERT, SHIFT, VIRTKEY
	VK_I, 40320, NOINVERT, ALT, CONTROL, VIRTKEY
	VK_3, 40188, NOINVERT, ALT, VIRTKEY
	VK_S, 40219, NOINVERT, ALT, VIRTKEY
	VK_NUMPAD9, 40060, NOINVERT, VIRTKEY
	VK_RIGHT, 40060, NOINVERT, VIRTKEY
	VK_L, 40187, NOINVERT, SHIFT, VIRTKEY
	VK_INSERT, 40187, NOINVERT, VIRTKEY
	VK_L, 40185, NOINVERT, CONTROL, VIRTKEY
	VK_NUMPAD0, 40185, NOINVERT, CONTROL, VIRTKEY
	VK_X, 40185, NOINVERT, CONTROL, VIRTKEY
	VK_R, 40395, NOINVERT, SHIFT, VIRTKEY
	VK_L, 40029, NOINVERT, VIRTKEY
	VK_NUMPAD0, 40029, NOINVERT, VIRTKEY
	VK_X, 40029, NOINVERT, SHIFT, VIRTKEY
	VK_R, 40022, NOINVERT, VIRTKEY
	VK_S, 40023, NOINVERT, VIRTKEY
	VK_NUMPAD1, 40197, NOINVERT, VIRTKEY
	VK_NUMPAD3, 40195, NOINVERT, VIRTKEY
	VK_J, 40194, NOINVERT, VIRTKEY
	VK_DECIMAL, 40194, NOINVERT, VIRTKEY
	VK_A, 40019, NOINVERT, CONTROL, VIRTKEY
	VK_F3, 40318, NOINVERT, VIRTKEY
	VK_F5, 40291, NOINVERT, VIRTKEY
	VK_LEFT, 40061, NOINVERT, VIRTKEY
	VK_NUMPAD7, 40061, NOINVERT, VIRTKEY
	VK_DOWN, 40059, NOINVERT, VIRTKEY
	VK_NUMPAD2, 40059, NOINVERT, VIRTKEY
	VK_NUMPAD8, 40058, NOINVERT, VIRTKEY
	VK_UP, 40058, NOINVERT, VIRTKEY
	VK_E, 40186, NOINVERT, CONTROL, VIRTKEY
}
And this is the resulting content after Restorator edit, the virtual key codes are wrong typed and treated as a string?, why happens this?:

Code: Select all

1373 ACCELERATORS
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
	VK_F4, 40224, CONTROL, VIRTKEY
	"4", 40044
	"Z", 40044
	VK_Z, 40154, CONTROL, VIRTKEY
	VK_Z, 40144, SHIFT, VIRTKEY
	"5", 40045
	"X", 40045
	"C", 40046
	"V", 40047
	VK_V, 40157, CONTROL, VIRTKEY
	VK_V, 40147, SHIFT, VIRTKEY
	"M", 40048
	"6", 40048
	VK_B, 40158, CONTROL, VIRTKEY
	VK_B, 40148, SHIFT, VIRTKEY
	VK_I, 40320, ALT, CONTROL, VIRTKEY
	VK_3, 40188, ALT, VIRTKEY
	VK_S, 40219, ALT, VIRTKEY
	"9", 40060
	VK_RIGHT, 40060, VIRTKEY
	VK_L, 40187, SHIFT, VIRTKEY
	VK_INSERT, 40187, VIRTKEY
	VK_L, 40185, CONTROL, VIRTKEY
	VK_0, 40185, CONTROL, VIRTKEY
	VK_X, 40185, CONTROL, VIRTKEY
	VK_R, 40395, SHIFT, VIRTKEY
	"L", 40029
	"0", 40029
	VK_X, 40029, SHIFT, VIRTKEY
	"R", 40022
	"S", 40023
	"1", 40197
	"3", 40195
	"J", 40194
	VK_DECIMAL, 40194, VIRTKEY
	VK_A, 40019, CONTROL, VIRTKEY
	VK_F3, 40318, VIRTKEY
	VK_F5, 40291, VIRTKEY
	VK_LEFT, 40061, VIRTKEY
	"7", 40061
	VK_DOWN, 40059, VIRTKEY
	"2", 40059
	"8", 40058
	VK_UP, 40058, VIRTKEY
	VK_E, 40186, CONTROL, VIRTKEY
}
EDIT: The unique change that I manually did on the accelerator table is change the "B" to an "M" and as I said I did it using the edit mode of Restorator, but after saving the changes it is written like that... if I'm not missing anything then this seems obviouslly a bug.

florian

2014-12-20 14:45:04

Hi, according to the specification, you can use a one-char string instead of the virtual key code, without the VIRTKEY flag. The following two lines are identical:

Code: Select all

VK_Z, 40044, VIRTKEY
"Z", 40044
See: http://msdn.microsoft.com/en-us/library ... 85%29.aspx

However, I'm not sure it's good that Restorator converts the format. In particular, all the "NOINVERT" flags are removed. I doubt that this will cause WinAmp to fail on the modified resource, but it's possible.

We'll look into this problem.
Thanks,
Florian

pitoloko

2014-12-20 20:42:48

Thankyou for your fast answer and the info about that the char representation is also valid, good to know it!

If I understood good, the problem is that Restorator removes the NOINVERT flag and that posssibly causes the WinAmp behavior to don't recognize any accelerator key? (ANY in this case because all the keys in the original table has that flag) so, in other words: The resulting table is not corrupt, but WinAmp can't identify the keys because a Flag is missing after conversion, that's it?

Thanks for your time, I have a fast question if you could help me to know:

Restorator updates are for lifetime once purchased this program?,
I ask this because whit ResourceHacker I don't get this problem but its UserInterface sucks, I recently discovered the powerfull of Restorator and its easier to use than ResHacker, also comes with an useful "Edit Mode", so I would like to wait for a possible Restorator update about this problem to purchase it, you really did a great job!

florian

2015-01-04 21:42:35

Hi, sorry for the late reply (holidays took more of my time than I anticipated!). Yes, Restorator updates are free of charge. We're working on a new version, but we don't guarantee availability at any particular date. I've added this issue to the bug list.
Happy New Year!
Florian