The MASM Forum

Projects => Rarely Used Projects => Full SDK Include Project => Topic started by: TouEnMasm on August 15, 2012, 04:16:27 AM

Title: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on August 15, 2012, 04:16:27 AM
Hello,
Final version for Windows 10 can be found here http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)

version 10.1.(download in one parts,don't view my next post)
It has been made for Win 10.0  and allow to build 64 or 32 bits prog.
He is now able to translate driver headers (km directory)
Support all windows , is a real translate with all features of a windows SDK .
Alignment,Unicode,...........
He is abble to answer the question "What is this and where it is defined",see multiple files translation
Usage:read the readme.rtf file in the zip.
Translate is now in this form:
Quote
UpdateLayeredWindow PROTO hWnd:HWND ,hdcDst:HDC ,pptDst:XMASM ,psize:XMASM ,hdcSrc:HDC ,\
         pptSrc:XMASM ,crKey:COLORREF ,pblend:XMASM ,dwFlags:DWORD

All Prototypes (API and interface) used the standard notation of masm .You have just to follow the SDK help files,usage is the same.

The translation need a very few changes to use what is translate.UNICODE is supported.
Are translated,constants,structures,enums,Interfaces ,prototypes, most common GUID and some macros.A comment (;API) is added before the prototypes to find them quickly(all prototypes are not API).The readme file in the zip say you more.
***************************************************************
This version have made the windows.sdk downloadable on my site
Problem at link solved,Some prototypes have the same name in interfaces and/or are duplicate.
This provide a "error LNK2001: unresolved external symbol"
The title INTERFACE_API_CONFLIT_NOM added in egales.txt is here to solve this

***************************************************************
Before translate anything,have a look at the full set of SDK header files translated (crt 2013 included)
http://masm32.com/board/index.php?topic=563.0 (http://masm32.com/board/index.php?topic=563.0)

VC++ 2008 header's file translated ( CRT )
http://masm32.com/board/index.php?topic=573.0 (http://masm32.com/board/index.php?topic=573.0)
=========================================== 

////////////////////////////////// C++ library //////////////////////////////////////////
The defaut prototype is C for the header of the C++,it's not like that in the SDK.
So you have to manually (use an editor) to change:
PROTO ------> PROTO C
You can also have functions with a decorated name in the library.
Use this tool:
http://masm32.com/board/index.php?topic=580.msg4701#msg4701 (http://masm32.com/board/index.php?topic=580.msg4701#msg4701)

===================== Dynamic load of functions ============
Some functions could be only used by dynamic load of the dll.
It's the case for the opengl extensions.
In other cases,you haven't the lib or this one change too often.
A dynamic load is also an answer in this cases.
Use this tool:
http://masm32.com/board/index.php?topic=581.msg4705#msg4705 (http://masm32.com/board/index.php?topic=581.msg4705#msg4705)

Final version for Windows 10 can be found here http://luce.yves.pagesperso-
Some Inlines functions  are contents in crt10_32.lib (64)
 (http://luce.yves.pagesperso-orange.fr/header.htm)
Title: Re: A translator for sdk header files
Post by: Gunther on August 15, 2012, 05:14:31 AM
Hi ToutEnMasm,

well done  :t

Gunther
Title: Re: A translator for sdk header files
Post by: Siekmanski on August 15, 2012, 06:41:26 PM
Unfortunately I can't download the file "http://luce.yves.pagesperso-orange.fr/sdkrc7.cab"
Connection to the server is broken when starting downloading or at 99% of the download.
Now and then I try to download it again but no succes.   :(
Title: Re: A translator for sdk header files
Post by: TouEnMasm on August 16, 2012, 12:12:31 AM
Quote
Unfortunately I can't download the file "http://luce.yves.pagesperso-orange.fr/sdkrc7.cab"
it seems there is some problems with my internet provider.I have also some problems to connect my site.
Try later...





Later: part of the translator to download
Title: Re: A translator for sdk header files
Post by: jj2007 on August 16, 2012, 01:00:06 AM
If it wasn't 17 MB, I'd post it here... ::)
Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 16, 2012, 03:08:02 AM
Hello,
I have posted a new version of the translator.

The translation will give you the same advantages as the windows sdk.
Alignment is the same as c++,64 bits ,unicode and ++.
At the instant only the windows sdk had all this.
Other need a modify of there text files.

I have no way to test the 64 bits usage.
Reports on it's use will be usefull.




Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 17, 2012, 06:47:53 AM
 :icon_mrgreen:
I had forgotten to write the 32_64 values in the prototypes.
Mistake corrected.
Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 22, 2012, 04:47:30 AM

New version posted had made the "ready to use sdk 7.1" working exactly as the original windows sdk.
Title: Re: A translator for sdk header files
Post by: GoneFishing on March 16, 2013, 03:43:24 AM
Hello ToutEnMasm!

Thank you for reply and link to your post. I've already downloaded headinc.zip . I'll try it.
I'm making my first steps in MASM and it's important for me to understand how to translate C++ headers to MASM includes.
Title: Re: A translator for sdk header files
Post by: GoneFishing on March 19, 2013, 05:07:49 AM
I've just translated several headers. Your utility is very easy to use and fast. But dbgeng.h has two dependencies which in turn have their own ones and so on ... so I've downloaded your sdkrc7 .cab (without any problems)
Thanks!
Title: Re: A translator for sdk header files
Post by: Magnum on March 19, 2013, 05:50:45 AM
I do not understand how these are used.

Thanks,
              Andy
Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 23, 2014, 05:15:49 PM

New version to adapt it to Windows 8.1
** Update of the list of variables (egales.txt)
     This avoid your favorite nightmare,What is this and where it is who generate errors at compile time.

** Many useless (for masm) defines added by MIDL are filtered.
** The search for duplicates names between api and interfaces fonctions is automatised (cherche_duplicate.txt)
    a 1 is added at the end of the interface name function.Made link happy.
** define values too long for ml are cutted in pieces (max 254).
** one correction  Machin bidule[] generate a dword
and more
 
Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 25, 2014, 12:46:49 AM

corrected problem with _when_ (generating bad prototypes)
Title: Re: A translator for sdk header files
Post by: TouEnMasm on September 26, 2014, 05:06:06 PM

Posted the version who had made the ready to use sdk 8.1.
It's a little too much filtered to be sure not to fall on a comment.
The file specstrings_undef.sdk is the image of that.
Title: Re: A translator for sdk header files
Post by: TouEnMasm on October 02, 2014, 05:27:44 PM

Added the translation of conditionnal prototypes ,with #if #else #endif inside,I's the more current form.
Added in structure translation of  ,,; ex:RECT rect,recta,rectb;
added translation of #define Fillmystructure {,,,35]
small modified to decrease the number of manual corrections.
Most often,you have to modify duplicate name who can't be corrected all.
Title: Re: A translator for sdk header files
Post by: Gunther on October 02, 2014, 10:05:24 PM
ToutEnMasm,

is it the current zip file under the first post of this thread?

Gunther
Title: Re: A translator for sdk header files
Post by: TouEnMasm on October 03, 2014, 12:16:52 AM

Yes ,he is in the first post.
 
Title: Re: A translator for sdk header files
Post by: Gunther on October 03, 2014, 02:08:25 AM
Thank you, ToutEnMasm.

Gunther
Title: Re: A translator for sdk header files
Post by: TouEnMasm on October 03, 2014, 04:28:04 AM

corrected a problem with multiple files translation.This is done in a thread and the heap memory was fragmented.There was less variables found and more Unknown(inconnu) generated.
Title: Re: A translator for sdk header files
Post by: TouEnMasm on October 09, 2014, 06:08:22 PM
Added the missing alignment on Union.
Headinc align now in the same way as the c++ instruction
#pragma pack(push,N)   
#pragma pack(pop)

To view the alignment:
#pragma pack(show)   
or
SHOW_ALIGNMENT   STRUCT DEFALIGNMASM
;SHOW_ALIGNMENT size=18h BYTE,1Ah WORD,1CH DWORD,20h QWORD
   zaaaff QWORD ?
   xbaaff BYTE ?
   ycaaff DWORD ?
   wdaaff WORD ?
   qeaaff BYTE ?
   rfaaff QWORD ?
SHOW_ALIGNMENT      ENDS

Title: Re: A translator for sdk header files
Post by: Gunther on October 10, 2014, 04:12:50 AM
Thank you, ToutEnMasm.  :t

Gunther
Title: Re: A translator for sdk header files
Post by: TouEnMasm on November 20, 2014, 09:02:03 PM
Minor changes
Quote
#define SRCCOPY             (DWORD)0x00CC0020 /* dest = source */ ;corrected
#define SRCCOPY             0x00CC0020
_aaaaaaaaaaaaaaaaa              ();corrected
_aaaaaaaaaaaaaaaaa()
The 8.4 version wait the next windows sdk before new changes
Title: Re: A translator for sdk header files
Post by: TouEnMasm on November 21, 2014, 03:12:59 AM
corrected a bug  :icon_mrgreen:
Title: Re: A translator for sdk header files
Post by: Gunther on November 21, 2014, 07:19:48 AM
Hi ToutEnMasm,

thank you for sharing it. Good work.

Gunther
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on October 01, 2015, 07:20:55 PM
New version
Translate is now in this form:
Quote
UpdateLayeredWindow PROTO hWnd:HWND ,hdcDst:HDC ,pptDst:XMASM ,psize:XMASM ,hdcSrc:HDC ,\
         pptSrc:XMASM ,crKey:COLORREF ,pblend:XMASM ,dwFlags:DWORD
Argument of prototype  like "float Number[4]" are translated as structure
Cherche_Duplicate.txt avoid duplicate between  Interface fonctions and api who generate link errors.
some more corrections ..
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on October 12, 2015, 04:49:56 AM

Full update for Windows 10.0 (Cherche_Duplicate.txt who avoid problems at link)
Added a filter on the prototypes Argument. offset:DWORD = aoffset:DWORD
see INCOMPATIBLE in egales.txt,you can modifie the list as you want.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on December 15, 2015, 07:37:22 PM
added strsafe functions (inline) to the crt lib (Windows 10 inline functions)
macros_forum.inc added ,macros of the masm32 package usable with the translated sdk
small modifies.
error
http://masm32.com/board/index.php?topic=563.msg4563#msg4563
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on February 14, 2016, 08:27:12 PM
New version (Windows 10 headers)
---- Translate c++ interface , the d2XXX.h will be fully translated.
---- Extended his use to the driver headers.
The translate of structures accept now complex forms with macros and proto.
usual updates,more filters.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on February 26, 2016, 02:06:56 AM
Further modifies to fulfill the km directorie:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\km

Further files need to be modifies before translate.
This version give better informations to find wich ( or ) is missed in one block of (())(()))
Macro with structure arguments Inside are not translate.
to do that ,change the c++ macro in c++ structure and rename the translate  a MACRO.

This complex form of structure:
Quote
typedef struct _CLS_SCAN_CONTEXT
{
    CLFS_NODE_ID cidNode;
    PLOG_FILE_OBJECT plfoLog;
    __declspec(align(8)) ULONG cIndex;
    __declspec(align(8)) ULONG cContainers;
    __declspec(align(8)) ULONG cContainersReturned;
    __declspec(align(8)) CLFS_SCAN_MODE eScanMode;
    __declspec(align(8)) PCLS_CONTAINER_INFORMATION pinfoContainer;
   
} CLS_SCAN_CONTEXT, *PCLS_SCAN_CONTEXT, **PPCLS_SCAN_CONTEXT;
is translated like that
Quote
CLS_SCAN_CONTEXT   STRUCT DEFALIGNMASM
   cidNode CLFS_NODE_ID ?
   plfoLog PLOG_FILE_OBJECT ?
__declspec(align(8))
   cIndex DWORD ?
__declspec(align(8))
   cContainers DWORD ?
__declspec(align(8))
   cContainersReturned DWORD ?
__declspec(align(8))
   eScanMode BYTE ?
__declspec(align(8))
   pinfoContainer PCLS_CONTAINER_INFORMATION ?
CLS_SCAN_CONTEXT      ENDS

The translater let's you rewrite the __declspec MACRO as you want (align 8 is enough).


Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on July 01, 2020, 04:54:27 PM
Final version is here in english(US)
http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)
The headinc link give you the translator,The SDK10.0 pack give you SDK headers translated and usable immediately.
You can translate the page in further languages with the button at the lefft.
The headers support 64/32 bits,unicode .. and give you the same alignment as the C headers (This avoid many problems).
You can also use Windows switchs (constants) to adapt the headers at your machine.
The more common headers can be used without changes (they are numerous),others need minor modifies to make the compilator happy.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: LiaoMi on July 03, 2020, 03:52:28 AM
Final version is here in english(US)
http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)
The headinc link give you the translator,The SDK10.0 pack give you SDK headers translated and usable immediately.
You can translate the page in further languages with the button at the lefft.
The headers support 64/32 bits,unicode .. and give you the same alignment as the C headers (This avoid many problems).
You can also use Windows switchs (constants) to adapt the headers at your machine.
The more common headers can be used without changes (they are numerous),others need minor modifies to make the compilator happy.

Hi TouEnMasm,

http://masm32.com/board/index.php?topic=8126.msg89196#msg89196
and
http://masm32.com/board/index.php?topic=8126.msg89199#msg89199
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on July 03, 2020, 03:25:07 PM

I see than you speak about Size_T  and about PTR ,have you  a modify to ask ?
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: LiaoMi on July 05, 2020, 05:28:32 PM

I see than you speak about Size_T  and about PTR ,have you  a modify to ask ?

Hi TouEnMasm,

your constant is defined as
SIZE_T = DWORD ; intsafe.h

but should be SIZE_T =XMASM ; intsafe.h

there are a lot of such places in the SDK, manual correction in this case is not possible. And a question from the past, are you going to publish the source code of your converter?
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on July 06, 2020, 03:03:43 AM

Not an error of the translator,must be the include who have changed.
he is defined in basetsd SDK\10.0.19041.0\shared show:

Quote
typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
translated by headinc in :
Quote
SIZE_T TYPEDEF XMASM
PSIZE_T TYPEDEF XMASM
SSIZE_T TYPEDEF XMASM
PSSIZE_T TYPEDEF XMASM

I will correct this one manually.If you find another like that,verify that the translator give not an another translate and post it here.






Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on July 23, 2020, 02:09:44 AM
Hello,
The upper needed modifie has been done in the file basetsd.sdk.
I have had bad surprise using COM in 64 bits and this as needed modifies:
riid:DWORD begin riid:XMASM
rclsid:DWORD begin rclsid:XMASM           and those in all the sdk files.
The corresponding changes (REFIID,..,REF..) had been also made in egales.txt used by the translatorus.
There was trouble with COM in 64 bits,32 is not affect by the change
If you have problem's  don't hesitate to post it here.
I will do my best to arrange this






Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: LiaoMi on October 18, 2020, 08:11:35 PM

Not an error of the translator,must be the include who have changed.
he is defined in basetsd SDK\10.0.19041.0\shared show:

Quote
typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
translated by headinc in :
Quote
SIZE_T TYPEDEF XMASM
PSIZE_T TYPEDEF XMASM
SSIZE_T TYPEDEF XMASM
PSSIZE_T TYPEDEF XMASM

I will correct this one manually.If you find another like that,verify that the translator give not an another translate and post it here.

Hi TouEnMasm,

this is not true since I compared another constant, I downloaded the latest version of your converter, the file egales.txt contains two constants PSIZE_T = XMASM and SIZE_T = DWORD ; intsafe.h or size_t = DWORD ; intsafe.h, but it should be PSIZE_T = XMASM and SIZE_T = XMASM ; intsafe.h or size_t = XMASM ; intsafe.h. There are a lot of such errors, so there are problems with compilation, correct conversion does not work everywhere, the error example is given above.

Here is the original code from your SDK (WinBase.sdk)...
;API
GlobalAlloc PROTO uFlags:DWORD ,dwBytes:DWORD

but it should be

GlobalAlloc PROTO uFlags:DWORD ,dwBytes:XMASM

 :azn:
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on October 20, 2020, 02:23:33 AM
Corrected,size_t SIZE_T, for headinc .Re-translate of Winbase.sdk to take count of the change in sdkrc100 (um).
ADDED the CUNI,CANS and CANS_UNI macro to create data in unicode and switch easily from ansi to UNI.
There is just need to define UNICODE to switch to unicode for the entire source.
Sample here http://masm32.com/board/index.php?topic=1796.msg19015#msg19015 (http://masm32.com/board/index.php?topic=1796.msg19015#msg19015)

For sdkrc100 and translatorus here:
http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)
Some Inlines functions  are contents in crt10_32.lib (64) ; -:\sdkrc100\crt_lib\IX86\release\crt10_32.lib printf and more
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on January 18, 2021, 03:42:22 AM

added extraction of prototypes in inlines functions,very useful now with recents headers,version 10.3.

Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: jj2007 on January 18, 2021, 04:43:39 AM
Good to see somebody is still coding here, Yves :thumbsup:
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on April 17, 2021, 04:52:15 PM

modify the translation of  :
unsigned char EncryptionState[15][16];     

http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)

Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: LiaoMi on April 17, 2021, 09:20:16 PM

modify the translation of  :
unsigned char EncryptionState[15][16];     

http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)

Hi TouEnMasm,

I don't see any fixes in SDK? Has something changed there? And there are no changes in the source section yet.
http://luce.yves.pagesperso-orange.fr/SourceCode.htm
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on April 17, 2021, 11:03:30 PM
The fix is in headinc (10.4) who translate it now the good way (you can verify this translating test.txt).
Without promise,I will do what i can to modify the sdk files.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on April 19, 2021, 03:01:02 AM
I have corrected some  importants files in the header package.WinUser wincrypt ...
In headinc,I have made a full adaptation for  multi dimensionnal structures and constantes.
4 levels are needed by the sdk ,headinc can do 5.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on May 26, 2021, 04:32:37 PM
Hello,
Headinc hab been updated to translate the last sdk 10.0.19041.0
The translation of the typedef had been re-writed and use the ptr instead of changing it in XMASM
What is pointed on by the ptr is shown in comment to avoid the questions of the compiler.

The sdkrc100 begin a carefull update to the  10.0.19041.0 version.
At this time,only the files used by windows.h (80 files) and the CRT(vc dir) had beeen changed.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on May 27, 2021, 04:18:39 PM
Hello,
I made an oversight in the 10.6 version,corrected in the 10.7
I have also eliminates the risk with annotations in structures.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: LiaoMi on May 27, 2021, 06:10:46 PM
Hello,
I made an oversight in the 10.6 version,corrected in the 10.7
I have also eliminates the risk with annotations in structures.

Hi TouEnMasm,

we will test it, thanks for your work  :thumbsup:

P.S.
Did you check knownfolders.h?
http://masm32.com/board/index.php?topic=9282.0
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on May 28, 2021, 02:01:41 AM

Thanks for your help,I have made a last change in the code ,The typedef multi-dimensionnal are now translated as strucrure and usable by MASM.
Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on May 28, 2021, 11:40:37 PM
 :greensml:
I hope last change this time,Some structures wasn't recognize as there.Corrected.
Corrected thread problem,some files wasn't translate (list of files).
A very few number of files don't want to be translated in a list (threaded) and can be only translated as individual.
Those are
Quote
H:\Program Files\editmasm\ref\outils\translator\windows.phone.restricted.cellular.rcspresence.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\abi\windows.phone.restricted.cellular.videotelephony.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ndis\version.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\km\hbapiwmi.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\km\iscsidef.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\km\iscsiop.h
I don't know for what on 2000 files those ones don't want to be translate in a thread.


Title: Re: A translator for sdk header files (64 and 32 bits translate)
Post by: TouEnMasm on May 31, 2021, 11:55:00 PM
Hello,
Hope was lost but not the result.
This one:
Filter the MIDL_PASS Lines
Filter the VC++ structures and made a report in the journal.txt.
Solve the thread problem (Not enough memory)
                                         Three files are still resisting to the translation (group files mod,list) ,they are in asm (kxarm..).
Must stay the usual errors to correct.
* Constants not declared        (version number ,you can use an equate with the first term of the comparison GE)
* redefinitions of symbols  name = aname ....conflicting definitions

Tested on the whole sdk 10.0.19041.0 http://luce.yves.pagesperso-orange.fr/header.htm (http://luce.yves.pagesperso-orange.fr/header.htm)
Don't be afraid by the needed corrections,one ; to put definitions in comment is very usefull.
Chance is also possible,It's it work at the first time,It's not me but the chance.