Enumerating messages
-
Hi! I have a problem enumerating messages in the exe/dll. May be I was so lucky to fail on bug? Here is what I do (m_IDs defined as CDWordArray): BOOL CEventSource::Enumerate() { m_IDs.RemoveAll(); return (EnumResourceNames(m_hModule,RT_MESSAGETABLE,EnumIDsProc,(LONG)this)); } BOOL CEventSource::EnumIDsProc(HMODULE hModule,LPCTSTR lpType, LPTSTR lpName, LONG par) { CEventSource * pMe; pMe=(CEventSource *)par; pMe->m_IDs.Add((DWORD)lpName); return true; } Both functions return true, m_IDs contain the single element =1, doesn't matter, is there such event ID in the file, or not. To check the whole structure, I've replaced RT_MESSAGETABLE with RT_DIALOG and received the full list of dialog's IDs. So something wrong with messagetable. But what ? Any help will be greatly appreciated. Thanks in advance. Regards, Gennady
-
Hi! I have a problem enumerating messages in the exe/dll. May be I was so lucky to fail on bug? Here is what I do (m_IDs defined as CDWordArray): BOOL CEventSource::Enumerate() { m_IDs.RemoveAll(); return (EnumResourceNames(m_hModule,RT_MESSAGETABLE,EnumIDsProc,(LONG)this)); } BOOL CEventSource::EnumIDsProc(HMODULE hModule,LPCTSTR lpType, LPTSTR lpName, LONG par) { CEventSource * pMe; pMe=(CEventSource *)par; pMe->m_IDs.Add((DWORD)lpName); return true; } Both functions return true, m_IDs contain the single element =1, doesn't matter, is there such event ID in the file, or not. To check the whole structure, I've replaced RT_MESSAGETABLE with RT_DIALOG and received the full list of dialog's IDs. So something wrong with messagetable. But what ? Any help will be greatly appreciated. Thanks in advance. Regards, Gennady
All messages are stored in one RT_MESSAGETABLE. Have a look on MESSAGE_RESOURCE_DATA and friends. Tomasz Sowinski -- http://www.shooltz.com
-
All messages are stored in one RT_MESSAGETABLE. Have a look on MESSAGE_RESOURCE_DATA and friends. Tomasz Sowinski -- http://www.shooltz.com
I suspected something like this. But first, the description of RT_MESSAGETABLE constant (message-table ENTRY) confused me. Second, I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA. And last. If FormatMessage knows the resource structure, why EnumResourceNames doesn't ? If EnumResourceNames knows the structure of all other resources, why it doesn't recognize the message table. Why it is so peculiar. I guess, you're not the MS representative, so you may interpret the last questions as rhetorical.:-O Thanks. Regards, Gennady
-
I suspected something like this. But first, the description of RT_MESSAGETABLE constant (message-table ENTRY) confused me. Second, I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA. And last. If FormatMessage knows the resource structure, why EnumResourceNames doesn't ? If EnumResourceNames knows the structure of all other resources, why it doesn't recognize the message table. Why it is so peculiar. I guess, you're not the MS representative, so you may interpret the last questions as rhetorical.:-O Thanks. Regards, Gennady
I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA. LoadResource, then LockResource. If EnumResourceNames knows the structure of all other resources... Not sure about that. EnumResourceNames knows about PE file structure and knows how to interpret the resource directory. Note that you can add your own resource formats to a PE file. They're just embedded in the image and are 'raw bytes'; only your app knows how to deal with them. Tomasz Sowinski -- http://www.shooltz.com
-
I cannot discover, how to get the pointer to MESSAGE_RESOURCE_DATA. LoadResource, then LockResource. If EnumResourceNames knows the structure of all other resources... Not sure about that. EnumResourceNames knows about PE file structure and knows how to interpret the resource directory. Note that you can add your own resource formats to a PE file. They're just embedded in the image and are 'raw bytes'; only your app knows how to deal with them. Tomasz Sowinski -- http://www.shooltz.com
Thanks. As I've understand: FindResource LoadResource LockResource Deal with MESSAGE_RESOURCE_DATA, _BLOCK and _ENTRY I can't believe that nobody had done it for message table once and forever! Message table is standard and explotable enough to justify this effort. Thanks once more. Regards, Gennady
-
Thanks. As I've understand: FindResource LoadResource LockResource Deal with MESSAGE_RESOURCE_DATA, _BLOCK and _ENTRY I can't believe that nobody had done it for message table once and forever! Message table is standard and explotable enough to justify this effort. Thanks once more. Regards, Gennady
Yeah, Find/Load/LockResource works for me with app-defined resource format. I don't think you'll have much trouble with message tables. Cheers, Tomasz Sowinski -- http://www.shooltz.com