The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: TouEnMasm on May 01, 2021, 03:54:13 PM

Title: ML64 A form of prototype who verify the number of arguments
Post by: TouEnMasm on May 01, 2021, 03:54:13 PM

include master_ml64.inc
includelib msvcrt.lib

HINSTANCE typedef QWORD
.const
;a macro as prototype ?
MessageBox MACRO hWnd:REQ,lpText:REQ,lpCaption:REQ,uType:REQ
  IFDEF __UNICODE__
MessageBoxW PROTO
invoke MessageBoxW, hWnd,lpText,lpCaption,uType
  ELSE
MessageBoxA PROTO
invoke MessageBoxA,hWnd,lpText,lpCaption,uType
  ENDIF
EXITM<> ;better look ()
ENDM

.data
salut db  "salut",0
titre db "titre",0
;-------------------
.LISTALL
.code
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,lpCmdLine:XMASM,nShowCmd:DWORD
MessageBox ( NULL,addr salut,addr titre,MB_OK)
ret
WinMain endp
end
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: hutch-- on May 03, 2021, 08:18:13 PM
Yves,

Its an old idea, I think Erol (Vortex) designed it about 10 years ago. It works but to make a comprehensive set, you would have to write a macro for every API and that would end up finished for Windows 3000.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: jj2007 on May 03, 2021, 08:56:36 PM
Quote from: hutch-- on May 03, 2021, 08:18:13 PMto make a comprehensive set, you would have to write a macro for every API

Not a big deal, these macros could be generated. The resulting file would have about 3MB. I'm not sure whether I would like it, though :cool:
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: hutch-- on May 03, 2021, 09:05:57 PM
The other problem is you would have to have 2 of them so you could handle the function form as well as the statement form.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: jj2007 on May 03, 2021, 09:28:41 PM
Quote from: hutch-- on May 03, 2021, 09:05:57 PM
The other problem is you would have to have 2 of them so you could handle the function form as well as the statement form.

The function form is enough. You can use void (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1213) if you don't need the return value.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: TouEnMasm on May 03, 2021, 10:19:15 PM

30 000 macros to write isn't a problem for me
It can be made with the extraxted list of protototypes from the windows sdk.
Have a look on this list (With the names of header) who as no duplicate or a  very few number.
The name of headers is a better choice than the name of lib because msdn refer to header more than lib.
The zip is a 7Z,because 7Z is not accepted.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: jj2007 on May 03, 2021, 10:28:49 PM
Some look a bit unfamiliar, Yves, but overall you've done an excellent job :thumbsup:

ChainesEgales PROTO  chaine1:DWORD ,chaine2 :DWORD,mode:DWORD
chercherChaine PROTO Debut:DWORD,Contenant:DWORD,Chercher:DWORD,Methode:DWORD
ChercherMotBornes PROTO Debut:DWORD,AdrPerdu:DWORD,AdrChercher:DWORD,Methode:DWORD,\
CmpChainLen PROTO pchain1:DWORD,  pchain2:DWORD,  methode:DWORD,longueur:DWORD
TraduireGuide PROTO  pguid:DWORD, adrNom:DWORD
LettreAvantLettreApresmot PROTO adrmot:DWORD,  adrphrase:DWORD ,position:DWORD
DateTimeToString PROTO pdt:PTR DATETIME, pszDateTime:PTR BYTE
GetLocalDateTime PROTO pdt:PTR DATETIME
FormatLocalDateTime PROTO  pchainReponse:DWORD
LongZtexte PROTO  Debut:DWORD
Limites PROTO  value:DWORD
MaitreTexte PROTO  Hfenetre:DWORD,FichierAnalyse:DWORD,Infotextascii:DWORD,\
Mid PROTO  adrtitre:DWORD,decale:DWORD,longueur:DWORD
ScrutationFichierTexte PROTO InfoT:DWORD
CompteurLignes PROTO  pmem:DWORD,taille:DWORD
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: HSE on May 03, 2021, 11:19:12 PM
Quote from: TouEnMasm on May 03, 2021, 10:19:15 PM
30 000 macros to write isn't a problem for me
It can be made with the extraxted list of protototypes from the windows sdk.

Nidud maked that some years ago in AsmC.

It's very interesting for C translation, because syntax is exactly that of C  :thumbsup:.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: jj2007 on May 03, 2021, 11:24:44 PM
Quote from: HSE on May 03, 2021, 11:19:12 PMIt's very interesting for C translation, because syntax is exactly that of C  :thumbsup:.

But it breaks old code and makes you dependent on new includes. I also like the option to search a fat source for invoke.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: TouEnMasm on May 03, 2021, 11:42:04 PM
Quote
Some look a bit unfamiliar, Yves, but overall you've done an excellent job
Those who lok unfamiliar are of of my personnal library,I will not include them in the pack.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: jj2007 on May 03, 2021, 11:43:43 PM
Just joking, Yves :thup:
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: Vortex on May 03, 2021, 11:47:06 PM
Hi HSE,

QuoteIt's very interesting for C translation, because syntax is exactly that of C

Kindly, could you expain why there are very few people who translated the whole MS SDK header files to assembly?
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: HSE on May 03, 2021, 11:59:52 PM
Quote from: jj2007 on May 03, 2021, 11:24:44 PM
But it breaks old code and
I don't think so.

Quote from: jj2007 on May 03, 2021, 11:24:44 PM
makes you dependent on new includes.
I don't pay attention if it's in includes or AsmC build that when read includes. Anyway, for compatibility reasons almost never used.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: HSE on May 04, 2021, 12:05:38 AM
Quote from: Vortex on May 03, 2021, 11:47:06 PM
Kindly, could you expain why there are very few people who translated the whole MS SDK header files to assembly?

Sorry, C translation is "C source code translation"

Header files translation is "madness" ? :biggrin:
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: Vortex on May 04, 2021, 12:23:41 AM
Hi HSE,

QuoteHeader files translation is "madness" ?

No worries. Exactly, that's the problem : The C\C++ header file set is very complicated. Translating them to asm is a very big job.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: hutch-- on May 04, 2021, 10:00:07 AM
There is another option for anyone who can write a reasonable parser, select the start of an API or similar function in your own assembler code then scan the function call from its start to its end. Count the arguments then refer to a fast access list to get the argument count.

A relatively straight forward tool to make and if you had it set up in the editor of your choice, you would place the cursor on the function name and just press a key and it would come back as an argument count plus any other information you wanted to attach to the function call.

Making the fast lookup list would take a lot of work but it could be done.
Title: Re: ML64 A form of prototype who verify the number of arguments
Post by: TouEnMasm on May 06, 2021, 03:50:33 AM
 :skrewy:
It seems that "Windows 3000." is going on.
After filtering with the contents of the libraries,I get  16029 functions and 489 files.
I need to made a little more tests,that all.