Spying on MUI

Posted by ALB42 on 20. Februar 20166 Comments

I wrote a program to Inspect MUI properties. Very helpful to read out positions and recheck the size calculations of LCL. The main problem at the start was how to tell the program which object I want to inspect. The idea was to type the address from debugout. But then I noticed that the Userdata of the intuition Window structure points to the MUI Window.mui object. Thats means I can simply browse through all the windows on the screen and search for windows with a Userdata and try to find if it is a MUI object. Check if the Class of the object is „window.mui“. I tested also with other UserData contents, „mostly“ it does not crash.
But this only works on AROS, I tried the same on MorphOS but there the UserData is always nil. Seems they use an other method to link them together, its a pity.

The program for i386-AROS is named MUIInspector and can be downloaded here:
MUIInspector 1.0 for AROS
Sadly many important fields of the MUI object are not readable so not all important things can be read back to the list.
Be warned, when the program which is inspected is quickly changing, means destroy/create objects, maybe the MUIInspector is crashing. So its really only a debugging tool for me, but maybe other find it interresting as well

6 comments to "Spying on MUI"

  1. magorium sagt:

    Looking nice there ALB42 🙂

    What is the used component on the right: a valuelist or stringgrid ?

    Thank you for this nice little gem.

  2. Julien sagt:

    Hi ALB42 🙂
    I just discovered your blog (and your work) today, and read all your posts in a row ! This is very impressive work ! Thanks a lot ! 🙂
    I’m a Free Pascal user myself (my chess engine is coded in free pascal), and a MorphOS user. So I knew about Karoly’s port, but ignored all about your AROS one.
    What impressed me the most was, apart your EdiSyn, was your work with a Lazarus Port. I hope you’ll get through with it, as it would be awesome to get this IDE on our Amiga !
    Do you plan on porting it to 68k too ? You might have heard that the FPGA Vampire accelerators will also come to the Amiga 500 and amiga 1200, bringing them 68k with speed higher than PPC. But they only plan to get 128MB memory onboard, which might be a bit tight for FPC/Lazarus…
    Anyway… Imagine running Lazarus on an Amiga 500 and develop new, modern, Amiga applications with it…. 🙂

  3. Geit sagt:

    MUI Objects are black boxes. And UserData can be set by any Application for any purpose. -> hence the name user data.

    If AROS uses these fields it is not compatible. Having the object pointer there may not be a big deal, but it is still not compatible and some ported application may expect userdata NULL until used. If AROS requires the pointer it is a major issue.

    UserData should only be filled/read using MUIA_UserData from the application side. That is why MorphOS has them NULLed out by default.

    Peeking in internal structures of MUI is a very bad thing. It may work now, but it may fail later and the knowledge gained by these peeking may simply be wrong due structure changes in the future.

  4. jacadcaps sagt:

    Interesting idea.

    What you should consider is making snapshots while the application is frozen (as in, you zero its wait signals while it’s in wait state and restore them when you’re done). Then go through the whole application tree and rather than poke internal fields, call OM_GET on the objects to get their properties.

    On a side note, it’s puzzling that zune guys didn’t extend struct IntWindow to accomodate the pointer to the MUI object, which is a nobrainer really. Using UserData fields is just stupid – those fields are for applications to use as they see fit.

  5. ALB42 sagt:

    1. Thats a debugging tool. MorphOS, Amiga supply VERY little debugging features so it should be allowed to write my own 😛 (debugoutputs and crashlog I count not as debugging features)

    2. Who said I use internal structures :-O. I just used GetAttr() thats the reason I wrote „Sadly many important fields of the MUI object are not readable so not all important things can be read back to the list.“ many fields are only W/I and not R… and missing in the list. The shown fields are all readable according to MUI 3.8 API documentation. I do not have any internal informations

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert