As the title says, the attached proggie converts C/C++ structures to MASM format. It is meant to be added to the menu of qEditor. If it detects a C/C++ structure on the clipboard, the process is automatic, otherwise you have to paste the struct in the right pane and press Ctrl C.
Jochen,
you've included the ASC file. Why not the ASM source?
Gunther
Just open it in Wordpad, copy all, paste in whatever plain text editor you are using.
Jochen,
Quote from: jj2007 on February 17, 2014, 05:23:46 AM
Just open it in Wordpad, copy all, paste in whatever plain text editor you are using.
that works. Thank you.
Gunther
Version B attached on top of thread. It can handle MSDN OPENFILENAME (http://msdn.microsoft.com/en-us/library/ms646839%28VS.85%29.aspx) to 99%.
If anybody knows a tricky structure on MSDN, please let me know.
what do you mean by tricky?
INPUT_RECORD is a little tricky :P
NONCLIENTMETRICS (i think that's the name) is a little problematic, too
Quote from: dedndave on February 17, 2014, 11:55:12 AM
what do you mean by tricky?
INPUT_RECORD is a little tricky :P
Looks OK:
INPUT_RECORD STRUCT (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683499%28v=vs.85%29.aspx)
KeyEvent KEY_EVENT_RECORD <>
MouseEvent MOUSE_EVENT_RECORD <>
WindowBufferSizeEvent WINDOW_BUFFER_SIZE_RECORD <>
MenuEvent MENU_EVENT_RECORD <>
FocusEvent FOCUS_EVENT_RECORD <>
INPUT_RECORD ENDSQuoteNONCLIENTMETRICS (i think that's the name) is a little problematic, too
Could be worse:
NONCLIENTMETRICS (http://msdn.microsoft.com/en-us/library/windows/desktop/ff729175%28v=vs.85%29.aspx) STRUCT
cbSize UINT ?
iBorderWidth dd ?
iScrollWidth dd ?
iScrollHeight dd ?
iCaptionWidth dd ?
iCaptionHeight dd ?
lfCaptionFont LOGFONT <>
iSmCaptionWidth dd ?
iSmCaptionHeight dd ?
lfSmCaptionFont LOGFONT <>
iMenuWidth dd ?
iMenuHeight dd ?
lfMenuFont LOGFONT <>
lfStatusFont LOGFONT <>
lfMessageFont LOGFONT <>
if (WINVER ge 00600h)
iPaddedBorderWidth dd ?
endif
NONCLIENTMETRICS ENDS
NONCLIENTMETRICS is tricky because of alignment issues :biggrin:
INPUT_RECORD is a little tricky because it has the most complex unions that i could think of - lol
typedef struct _INPUT_RECORD {
WORD EventType;
union {
KEY_EVENT_RECORD KeyEvent;
MOUSE_EVENT_RECORD MouseEvent;
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
MENU_EVENT_RECORD MenuEvent;
FOCUS_EVENT_RECORD FocusEvent;
} Event;
} INPUT_RECORD;
Quote from: dedndave on February 17, 2014, 01:01:15 PM
INPUT_RECORD is a little tricky because it has the most complex unions that i could think of - lol
That translates to
INPUT_RECORD STRUCT
KeyEvent KEY_EVENT_RECORD <>
MouseEvent MOUSE_EVENT_RECORD <>
WindowBufferSizeEvent WINDOW_BUFFER_SIZE_RECORD <>
MenuEvent MENU_EVENT_RECORD <>
FocusEvent FOCUS_EVENT_RECORD <>
INPUT_RECORD ENDSi.e. you have to add the UNION yourself.
I've updated the app, see top of thread. It now handles this:
typedef struct {
int argc; /* Count of files to zip */
LPSTR lpszZipFN; /* name of archive to create/update */
char **FNV; /* array of file names to zip up */
} ZCL, _far *LPZCL;
... translates to ...
ZCL STRUCT
argc dd ? ; Count of files to zip
lpszZipFN LPSTR ? ; name of archive to create/update
FNV LPSTR ? ; array of file names to zip up
ZCL ENDSNot sure if that is correct (it will probably work, LPSTR is DWORD); maybe the C/C++ gurus can explain what the correct type for char ** would be ;-)
Hi Jochen
Nice little helper :t
QuoteNot sure if that is correct (it will probably work, LPSTR is DWORD); maybe the C/C++ gurus can explain what the correct type for char ** would be ;-)
http://petio.org/winasm/masm.html
But what good works to translate header to include is h2incx
http://www.japheth.de/h2incX.html
Quotei.e. you have to add the UNION yourself.
not sure what you mean by that - lol
INPUT_RECORD STRUCT
EventType WORD ?
two_byte_alignment WORD ?
UNION
KeyEvent KEY_EVENT_RECORD <>
MouseEvent MOUSE_EVENT_RECORD <>
WindowBufferSizeEvent WINDOW_BUFFER_SIZE_RECORD <>
MenuEvent MENU_EVENT_RECORD <>
FocusEvent FOCUS_EVENT_RECORD <>
ENDS
INPUT_RECORD ENDS
Quote from: ragdog on February 17, 2014, 05:02:29 PM
QuoteNot sure if that is correct (it will probably work, LPSTR is DWORD); maybe the C/C++ gurus can explain what the correct type for char ** would be ;-)
http://petio.org/winasm/masm.html
There is no char * on that page, let alone char **...
QuoteBut what good works to translate header to include is h2incx
http://www.japheth.de/h2incX.html
Yes, I've tested that one in the meantime. Very sophisticated tool indeed, although a bit clumsy to use for the simple task of translating a structure (and the comments are badly formatted, too).
Quote from: dedndave on February 17, 2014, 05:48:23 PMINPUT_RECORD STRUCT
EventType WORD ?
two_byte_alignment WORD ?
UNION
That looks like one of these wonderful bugs that are almost impossible to chase. Worth a separate thread imho :P
Quote from: jj2007 on February 17, 2014, 01:11:25 PM
...
typedef struct {
int argc; /* Count of files to zip */
LPSTR lpszZipFN; /* name of archive to create/update */
char **FNV; /* array of file names to zip up */
} ZCL, _far *LPZCL;
...
Where is this structure defined? I didn't find it in Windows SDK includes.
EDIT:Well, I've found it.
It's from
WIZDLL32 project
I think char ** is a dword
char **FNV;
I have translate with h2incx here is the result
ZCL struct
argc DWORD ?
lpszZipFN LPSTR ?
FNV DWORD ?
ZCL ends
Here are some findings:
Quotetypedef struct tagOCPFIPARAMS {
ULONG cbStructSize;
HWND hWndOwner;
int x;
int y;
LPCOLESTR lpszCaption;
ULONG cObjects;
LPUNKNOWN *lplpUnk;
ULONG cPages;
CLSID *lpPages;
LCID lcid;
DISPID dispidInitialProperty;
} OCPFIPARAMS, *LPOCPFIPARAMS;
QuoteOCPFIPARAMS STRUCT
cbStructSize ULONG ?
hWndOwner HWND ?
x dd ?
y dd ?
lpszCaption LPCOLESTR <>
cObjects ULONG ?
lplpUnk LPSTR ?
cPages ULONG ?
lpPages LPSTR ?
lcid LCID <>
dispidInitialProperty DISPID <>
OCPFIPARAMS ENDS
Quotetypedef struct tagPICTDESC {
UINT cbSizeofstruct;
UINT picType;
union {
struct {
HBITMAP hbitmap;
HPALETTE hpal;
} bmp;
struct {
HMETAFILE hmeta;
int xExt;
int yExt;
} wmf;
struct {
HICON hicon;
} icon;
struct {
HENHMETAFILE hemf;
} emf;
};
} PICTDESC, *LPPICTDESC;
QuotePICTDESC STRUCT
hemf HENHMETAFILE <>
PICTDESC ENDS
Not in MSDN in this way
Quotetypedef struct _GUID {
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
QuoteGUID STRUCT
long unsigned <>
short unsigned <>
short unsigned <>
char unsigned <>
GUID ENDS
Quote from: TWell on February 17, 2014, 07:46:41 PM
Here are some findings:
Thanxalot to everybody :icon14:
Version D on top of thread should now handle everything correctly. A TestStruct.h is included. Let me know if you find more goodies :P
Jochen,
Quote from: jj2007 on February 18, 2014, 03:44:18 AM
Thanxalot to everybody :icon14:
Version D on top of thread should now handle everything correctly. A TestStruct.h is included. Let me know if you find more goodies :P
seems to work correctly. Well done. :t
Gunther
Another little helper for the Tools menu of your editor: FindOnDisk
Usage:
- enter path and file mask ( for example, \Masm32\*.as?|*.inc )
- at least one search string
(if there are two, both must match)
- find modes as in MasmBasic Instr_() (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1153):
0=case-sensitive
1=case-insensitive
2=intelligent case (i.e. case of first char ignored)
4=full word
5=case-insensitive and full word
etc.
- click Find to start the search
- double-click on filename to open; note that
the most recently edited files are on top
Press Escape to quit
Jochen,
interesting tool. Could be helpful by searching large disks.
Gunther
Hi JJ!!
Is't posible to exclude certain file types? We don't have FindInFile source code. For example "\Masm32\masmbasic\*.*!*.exe|*.obj".
There is some crashes that, I think, happen when searching inside .exe files.
Thanks.
Try \Masm32\Examples\*.inc|*.asm|*.rc
with, for example, resource and mode 5
Excluding could be done with GfCallback (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1229), but that would require a bit of work :icon_mrgreen:
Problem is: the utility is very usefull!!
Search are not limited to masm projects. I search in *.java, *.c, *.cpp, *.bas, *.txt, *.htm* files just for example. But with *.* sometimes there is crashes.
I will study the GfCallback thing.
Thanks JJ!
Here is a new version, with an optional exclude field. Extensions must be comma-delimited, e.g. .dll, .exe
There is a second field that limits the size of files. I am curious what kind of file crashes? Can you give a concrete example?
Thanks very much!!
I can't reproduce the error, but I don't remember what I was searching a couple of month ago. Perhaps searching .exe files activate antivirus, I don't know.
Hi JJ!
Now I found very interesting that searchers in general (not only FindOnDisk aka JJSearch) don't find nothing inside libraries. (And it's a little boring open every library with HexEd to see what is inside :dazzled:)
Apparently the search is for strings, not for sequence of characters, wich rise another question: search is for ANSI strings and Unicode strings?
Thanks. HSE
What you are searching for?
Example to test?
EDIT: FindFile (http://www.johnfindlay.plus.com/pellesc/utils/utils.html)
Hi HSE,
The plugin is indeed designed for searching text files: asm, inc, rc, h, even asc = rtf will work, but search in binary files will stop at the first embedded zero.
Internally it uses the "long" version of GetFiles (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1056) - see the "WinSock" example.
There is a possibility to use a binary search with Instr_(FAST, ...), see here (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1153) (towards the end):
Quoteusing FAST, binary search in haystacks containing zeros is possible
... but it would require a rewrite. If I find time, ... ::)
deleted
#$&@%!! I forget doszip.
It's a very unusual search that kind of "binary search". Because Murphy's Law I skipped 1 of 16 very little libraries, and take me some time put order in the search. Not a big problem, but obviously is a different type of search.
FindFile make the "binary search" and have option for "unicode search" also. Wich, in some way, answer that unicode is a third type of search. Perhaps become more important in the future, and effort is worth here.
Just a note: FindFile and doszip make the binary search, but their internal viewers only show text.
Thanks. HSE
deleted
:t Sorry nidud, just last line of viewer is not visible here.
deleted
:biggrin: Yes it's in the help, but to read the manual...
deleted
Quote from: HSE on January 31, 2017, 07:42:19 AMNow I found very interesting that searchers in general (not only FindOnDisk aka JJSearch) don't find nothing inside libraries.
See http://masm32.com/board/index.php?topic=5314.msg63462#msg63462
It's working now. As in the old version, you can specify two search patterns, e.g. LoadLibrary and FreeLibrary; if applied to \Masm32\lib\*.*, you'll find 40 files that contain both strings.
Interestingly enough, if you leave the second search criterion blank, you'll find 51 files; i.e. 11 library files load a library but don't free it 8)
Quote from: jj2007 on January 31, 2017, 11:29:59 AM
but it would require a rewrite. If I find time, ... ::)
Perfect JJ! That was fast :t