News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Message tables

Started by jj2007, June 03, 2012, 05:31:49 AM

Previous topic - Next topic

jj2007

As a by-product of recent efforts in Structured Exception Handling (SEH), MasmBasic learnt how to access a special kind of resources called "message tables". They hide in system DLLs and elsewhere, and are usually not that interesting. Nonetheless, here is a little proggie showing how to get them. I attach the source and some results.

include \masm32\MasmBasic\MasmBasic.inc   ; download
   Init tc, con   ; initialise with Try/Catch to console
   PrintLine "Dave's favourite message in raw format:", CrLf$, Utf8$(MsgTable$(0C0000005h))

   Open "O", #1, "MsgKernel32.txt"
   Open "O", #2, "MsgUser32.txt"
   Open "O", #3, "MsgNtDll.txt"
   void MsgTable$(#1, "Kernel32.dll")   ; you will like them
   void MsgTable$(#2, "User32.dll")   ; pretty boring stuff here
   void MsgTable$(#3)   ; no file arg means NtDll
   Close
   GfNoRecurse=1   ; stay inside this folder
   GetFiles Msg*.txt
   xchg eax, ebx
   .Repeat
      dec ebx
      Print GfDate$(ebx), ", ", GfTime$(ebx), Spc2$, Str$("%i bytes  \t", edx::GfSize(ebx)), Files$(ebx), CrLf$
   .Until ebx<=0
   PrintLine CrLf$, "Dave's favourite message again, nicely formatted:"
   inc dword ptr [ebx]   ; ebx points to quite an exceptional memory location ::)
   ; no ExitProcess needed here :greensml:
   TryCatchEnd   ; activate the SEH
end start

Output:
Dave's favourite message in raw format:
L'istruzione a "0x%08lx" ha fatto riferimento alla memoria a "0x%08lx". La memoria
non poteva essere "%s".

02.06.2012, 21:16:21  604 bytes         MsgUser32.txt
02.06.2012, 21:16:21  109368 bytes      MsgNtDll.txt
02.06.2012, 21:16:21  219893 bytes      MsgKernel32.txt

Dave's favourite message again, nicely formatted:
L'istruzione a "00401171" ha fatto riferimento alla memoria a "00000000". La memoria
non poteva essere "written".


If you want it in your native language, run the attached executable. I am curious to see if the Chinese and Arabic versions work - RichMasm and MS Word can read them, afaik :biggrin:

Antariy

Jochen, with full dump of messages you make unbeatable competition for AxMessageTableViewer !!! (just kidding :biggrin:). Are you using APIs like FormatMessage RtlFindMessage, or your own implementation?

Edit: Yes, it is your own :t In AxMessageTableViewer it the message finding code is my own, too, but it is different :biggrin:

jj2007

Quote from: Antariy on June 03, 2012, 12:20:30 PM
Jochen, with full dump of messages you make unbeatable competition for AxMessageTableViewer !!!

Hi Alex,

That must have been one of your first posts in the old Forum :t


Re: Unicode in edit window
I will attach to my post one my small app (archive "AxMsgTblViewer.zip"). It works on WinAll (tested on 98,2000,XP,Seven x64). It subclass almost all controls, and it have a manifest.
I write it for a good mood, but, without motivation, this pester to me very quickly :) So, its code 50/50 of beautiful/awesome :)
This app shows string or message from modules, by ID. So, it can show Win32 subsystem error-descriptions, native-subsys NTSTATUS-code description. And, if manual selection mode is on, you can add or drag'n'drop any Win32 executable/dll to the list, and see message/string by ID.
Algo of finding message/string by id - written by me (and not beauteful, but no reason to rewriting it). I simple investigated the format of MessageTable resource, and rev.-eng. the string-finding algo of Windows...

App is with MUI support, and now "speak" in English and Russian.

All code in this program is my own. And, for numbering-edit control used my procs for text(hex)-to-dword conversion.

dedndave

his English has improved a lot, since then   :t

Antariy

Quote from: jj2007 on June 03, 2012, 04:33:30 PM
That must have been one of your first posts in the old Forum :t

Yes :biggrin:

Quote from: dedndave on June 03, 2012, 11:07:30 PM
his English has improved a lot, since then   :t

:redface: :biggrin: