News:

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

Main Menu

Tools in the latest build environment.

Started by hutch--, October 02, 2016, 08:58:58 AM

Previous topic - Next topic

hutch--

In the "tools64" directory there are a number of tools that should be useful writing code with ML64.

1. bin2db64.exe
   Convert any file into a compacted DB sequence so it can be written to disk from within an executable file. The main use I have had for this is storing icons and toolbars in code generators.

2. cvstrct.exe
   Convert C structures into MASM format. It is not a perfect conversion but takes much of the hack work out of the task.

3. editmake.exe
   A code generator that makes a basic editor application complete with toolbar and status bar. I use this tool for making other specialised tools that use an editor interface.

4. l2inc64.exe
   A tool for creating ML64 format include files from existing libraries. You use it by placing it in a separate directory and specifying the path of another directory on the command line.

5. mangle64.exe
   A tool to mangle text so it far harder to find in an executable file.

6. subclass64.exe
   A tool for subclassing controls. Same interface as the 32 bit version but with a ML64 compatible output.

7. tmake.exe
   A simple code generator that creates a bare window that you can write your own code in. It is mainly designed to take the hack work out of starting a window based app.

jj2007

Quote from: hutch-- on October 02, 2016, 08:58:58 AM2. cvstrct.exe
   Convert C structures into MASM format. It is not a perfect conversion but takes much of the hack work out of the task.

A notoriously difficult task :(

Here are some examples of C structures that don't translate well. Maybe we could establish a collection of tricky ones...
typedef struct tagMIXERCONTROLA {
    DWORD           cbStruct;           /* size in bytes of MIXERCONTROL */
    DWORD           dwControlID;        /* unique control id for mixer device */
    DWORD           dwControlType;      /* MIXERCONTROL_CONTROLTYPE_xxx */
    DWORD           fdwControl;         /* MIXERCONTROL_CONTROLF_xxx */
    DWORD           cMultipleItems;     /* if MIXERCONTROL_CONTROLF_MULTIPLE set */
    CHAR            szShortName[MIXER_SHORT_NAME_CHARS];
    CHAR            szName[MIXER_LONG_NAME_CHARS];
    union {
        struct {
            LONG    lMinimum;           /* signed minimum for this control */
            LONG    lMaximum;           /* signed maximum for this control */
        } DUMMYSTRUCTNAME;
        struct {
            DWORD   dwMinimum;          /* unsigned minimum for this control */
            DWORD   dwMaximum;          /* unsigned maximum for this control */
        } DUMMYSTRUCTNAME2;
        DWORD       dwReserved[6];
    } Bounds;
    union {
        DWORD       cSteps;             /* # of steps between min & max */
        DWORD       cbCustomData;       /* size in bytes of custom data */
        DWORD       dwReserved[6];      /* !!! needed? we have cbStruct.... */
    } Metrics;
} MIXERCONTROLA, *PMIXERCONTROLA, *LPMIXERCONTROLA;

struct GdiplusStartupInput
{
    UINT32 GdiplusVersion;             // Must be 1  (or 2 for the Ex version)
    DebugEventProc DebugEventCallback; // Ignored on free builds
    BOOL SuppressBackgroundThread;     // FALSE unless you're prepared to call
                                       // the hook/unhook functions properly
    BOOL SuppressExternalCodecs;       // FALSE unless you want GDI+ only to use
                                       // its internal image codecs.
   
    GdiplusStartupInput(
        DebugEventProc debugEventCallback = NULL,
        BOOL suppressBackgroundThread = FALSE,
        BOOL suppressExternalCodecs = FALSE)
    {
        GdiplusVersion = 1;
        DebugEventCallback = debugEventCallback;
        SuppressBackgroundThread = suppressBackgroundThread;
        SuppressExternalCodecs = suppressExternalCodecs;
    }
};

struct GdiplusStartupOutput
{
    NotificationHookProc NotificationHook;
    NotificationUnhookProc NotificationUnhook;
};

struct _PACKEDEVENTINFO
{
    DWORD               ulSize; 
    DWORD               ulNumEventsForLogFile;
    DWORD               ulOffsets[];           
};

struct  hostent {
        char     * h_name;           
        char     *  * h_aliases; 
        short   h_addrtype;             
        short   h_length;               
        char     *  * h_addr_list;
};

struct sockaddr {
        u_short sa_family;             
        char    sa_data[14];           
};


See also Raymond Chen on Why do some structures end with an array of size 1?

hutch--

Auto converted. The commented out union and structure names are left there for tools that don't support anonymous structures and unions.

  MIXERCONTROLA STRUCT QWORD
    cbStruct dd ?
    dwControlID dd ?
    dwControlType dd ?
    fdwControl dd ?
    cMultipleItems dd ?
    szShortName db MIXER_SHORT_NAME_CHARS dup (?)
    szName db MIXER_LONG_NAME_CHARS dup (?)
      UNION
        STRUCT
        lMinimum dd ?
        lMaximum dd ?
        ENDS ; DUMMYSTRUCTNAME
        STRUCT
        dwMinimum dd ?
        dwMaximum dd ?
        ENDS ; DUMMYSTRUCTNAME2
      dwReserved dd 6 dup (?)
      ENDS ; Bounds
      UNION
      cSteps dd ?
      cbCustomData dd ?
      dwReserved dd 6 dup (?)
      ENDS ; Metrics
  MIXERCONTROLA ENDS