Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Enumerating messages

Enumerating messages

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gennady Oster
    wrote on last edited by
    #1

    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

    T 1 Reply Last reply
    0
    • G Gennady Oster

      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

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      All messages are stored in one RT_MESSAGETABLE. Have a look on MESSAGE_RESOURCE_DATA and friends. Tomasz Sowinski -- http://www.shooltz.com

      G 1 Reply Last reply
      0
      • T Tomasz Sowinski

        All messages are stored in one RT_MESSAGETABLE. Have a look on MESSAGE_RESOURCE_DATA and friends. Tomasz Sowinski -- http://www.shooltz.com

        G Offline
        G Offline
        Gennady Oster
        wrote on last edited by
        #3

        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

        T 1 Reply Last reply
        0
        • G Gennady Oster

          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

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          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

          G 1 Reply Last reply
          0
          • T Tomasz Sowinski

            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

            G Offline
            G Offline
            Gennady Oster
            wrote on last edited by
            #5

            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

            T 1 Reply Last reply
            0
            • G Gennady Oster

              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

              T Offline
              T Offline
              Tomasz Sowinski
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups