How to determine the passed Data Type in a ? (any) parameter?

I’ve already written one which works for the params passed by address, but I was trying to get the data type for those passed by value and thought I was onto something but I wasnt!

GETTYPE.CLW (26.7 KB) GetType.inc (19.4 KB)

This TUFO.int is what is stumping me, I think I’ll have to use this in C11 and try to see what its fitting with and how, I’m assuming its fitting with something in the runtime.

So having loaded your app in C11, would I be correct in saying TUFO.int is a data structure, in the same sense as a Group, where the elements of the group are methods/procedures OVERed a part of the clarion runtime in memory, which is located and fixed over the runtime using Address() and What()?

If so, I can see why the comment exists that state this can change with future updates of the runtime.

This is what I thought I was looking at the other night which my GetType class but was stupidly looking back at the variable contents in memory of the procedure, aka my red herring.

Anyway I’m right, I’ll have a go at backporting this to C6 and see what differences exist in the two runtimes I have here.

This is why ASLR and other methods exists to jumble up the memory…

Its also why Astrings could perhaps be viewed as the haystack in which to hide a needle.

1 Like

An interface is kind of just a set of methods that a class will support.

In c6, there was a different interface, where the methods appeared in a different order

Yeah its a bit like a vertical key, so for now, my interface in C6 looks like this, and then I’ll see what happens with each method, so I should end up with the correct number of methods, the one’s that accept input and the one’s that have output including the datatype.

Its a bit like picking a barrel lock if you have ever watched LockPickingLawyer - YouTube! :roll_eyes:

iWTF    Interface,Type
p1      Procedure(long),long
p2      Procedure(long),long
p3      Procedure(long),long
p4      Procedure(long),long
p5      Procedure(long),long
p6      Procedure(long),long
p7      Procedure(long),long
p8      Procedure(long),long
p9      Procedure(long),long
p10     Procedure(long),long
p11     Procedure(long),long
p12     Procedure(long),long
p13     Procedure(long),long
p14     Procedure(long),long
p15     Procedure(long),long
p16     Procedure(long),long
p17     Procedure(long),long
p18     Procedure(long),long
p19     Procedure(long),long
p20     Procedure(long),long
p21     Procedure(long),long
p22     Procedure(long),long
p23     Procedure(long),long
p24     Procedure(long),long
p25     Procedure(long),long
p26     Procedure(long),long
p27     Procedure(long),long
p28     Procedure(long),long
p29     Procedure(long),long
p30     Procedure(long),long
p31     Procedure(long),long
p32     Procedure(long),long
p33     Procedure(long),long
p34     Procedure(long),long
p35     Procedure(long),long
        End

I think there are a couple of renditions on the news server somewhere.

I’m not going on the newsgroups, I’ll work this out myself, even if it becomes the death of me!

In C6:
Interface method 6 = DataType
Interface method 17 = Memory locations
Interface method 18 = Memory locations
Interface method 24 = Size

Its an interesting technique for extracting otherwise private class data! Kind of makes a mockery of what we get taught about computer security though.

Once I have my class writing template working properly, I’ll finish off the class I’ve written which I wrote to determine the above interface types, that way, TUFO is no longer an unknown, when a new runtime comes out.

So far, I’ve limited the class to only 50 interface methods, but as I dont know what it interface’s over although I suspect its parts of the runtime, I dont know if that is enough or not? Anyone know?

Just a reminder that the TUFO interface changed at one point (I think pre C7 and post C7)
Notice the two versions I have in TUFO.int

ClarionCommunity/TUFO.INT at master · MarkGoldberg/ClarionCommunity (github.com)

I think I found a tiny bit more on the origins of TUFO
www.attryde.com/clarion/binary/tswd.txt

(*  new types for clarion *)

    Decimal,
    Pdecimal,
    Bfloat,
    UFO,
    DynDecimal,
    DynPdecimal,

UFOs had been completely rewritten for future versions of Clarion. Any program bound to some particular implementation of ANY can become unusable. The same is for binding to other RTL internal structures, e.g. so called “type descriptor string” for GROUPs/QUEUEs/CLASSes/RECORDs.

1 Like

Can we please get UFOs and the TUFO interface documented.
I asked Z for that at a recent Florida CIDC, and he agreed it would be a good idea.

How should one define recent?

I believe it was the most recent Florida CIDC

2019? Recent seems so long ago.

I do not think that it is a good idea to make the internal structure of UFOs public. If you need to know how UFOs are organized, something is wrong with your program design. On the other hand, I’m not RZ.

I agree for the most part. However it can be useful to determine the type of variable passed into an *? argument. Possibly there are one of two other methods that developers have found useful in TUFO.

That’s fine with me, but providing a supported facility that could return the data type and address of the buffer (etc) would be nice.

Unless you’re writing RTCall or xlib. :slight_smile:

I, for one, have never seen you in the same room.

UFO allows doing Reflection or Introspection and know the Type. As can be done in .Net.

Not for use in Production code but during Development. I can have generic Reflection code to view any Class or Queue or Group. So when testing I have an idea what Class Data should be or Queue data. I can display the data to confirm it matches my understanding. Most of that can be done with WHO and WHAT, but UFO adds Type that is nice to know.

This free class allows viewing any Class, Queue, Group.


Using the new LIST From Address Property (7A23h) I can view the Queue for any LIST. Very handy to confirm the not visible stuff in the Q like Hot fields, Styles, Colors.

UFOs are wider than ANY. For example, the Application Generator uses special variants of UFOs during “executing” templates.

RTCall didn’t use any CW internals. It was the stuff to call a function with parameters if known its address and the prototype. Later the simpler method to do this was found which used knowledge how the linker works. And finally reference variables of procedural types had been introduced in the language.

XLib was written by the order before I joined TopSpeed and I never used it myself.

+1. [Post must be at least 20 characters]

Edit. I will add it is possible to use RegEx to workout some datatypes, like string and cstring, but I’ve not coded the data type discovery fully yet. However windows datastructures can be discovered and worked out by using just a string, which makes things easier, for data manipulation, but it ruins some types of security measures.