News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A translator for sdk header files (64 and 32 bits translate)

Started by TouEnMasm, August 15, 2012, 04:16:27 AM

Previous topic - Next topic

LiaoMi

Hi TouEnMasm,

thanks, updated successfully, testing is in progress  :thup:

LiaoMi

Hi TouEnMasm,

in the previous version, the "Security" example was compiled without problems, in this version an error "Error A2080: Block nesting error: if-else" occurs.
Translated Windows SDK 10.0.19041.0 32 bits
ZUT
HIMAGELIST defined
security.asm : Error A2080: Block nesting error: if-else
security.asm: 261 lines, 1 passes, 1255 ms, 0 warnings, 1 errors

        include translate32.inc
        include windows.inc
        include WinUser.inc
        include ShlObj.inc
        include WinBase.inc
        include stdio.inc
        include sysinfoapi.inc
        include timezoneapi.inc
       
        includelib ntdll.lib
        includelib ntdllp.lib
       
        includelib kernel32.Lib
        includelib User32.Lib
        includelib ntoskrnl.lib
        includelib Advapi32.lib
       
        includelib ucrt.lib
    include stdio.inc
    include conio.inc

    include accCtrl.inc
    include aclapi.inc
    includelib crt10_32.lib

_getch
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getch-getwch?view=msvc-160
Syntax C
int _getch( void );
wint_t _getwch( void );

Is this the correct conversion?
_getch PROTO cproto void:DWORD

it was like
_getch PROTO

No prototypes are added here from
include stdio.inc

security.asm(228) : Error A2160: INVOKE requires prototype for procedure <- printf in stdio.inc
Translated Windows SDK 10.0.19041.0 32 bits
ZUT
HIMAGELIST defined
security.asm(228) : Error A2160: INVOKE requires prototype for procedure
security.asm(256) : Error A2147: Too few arguments to INVOKE: _getch
security.asm : Error A2080: Block nesting error: if-else
security.asm: 261 lines, 1 passes, 843 ms, 0 warnings, 3 errors

I have already written above, I added the prototypes by hand, therefore the error is not visible there.
printf PROTO cproto _Format:XMASM, :VARARG
_getch PROTO cproto void:DWORD

TouEnMasm

It's the new method in use who have re-make the problem.
the void:DWORD must be replace by nothing
I have modified headinc in the translatrorUS download.
Fa is a musical note to play with CL

TouEnMasm

Fa is a musical note to play with CL

LiaoMi

Hi TouEnMasm,

to carry out quality control I used the program - Compare It! 4.2 Unicode - https://www.grigsoft.com/files.htm, Portable - https://www.grigsoft.com/wincmp4u.zip

Here is a ready-made comparison of the old version and the new one - https://gofile.io/d/6ZzwUh

What is CPROTO? What does co-writing mean? - YourProc PROTO CPROTO

YourProc PROTO C arg1:DWORD,arg2:DWORD,extra_args:VARARG
YourProc PROTO CPROTO arg1:DWORD,arg2:DWORD,extra_args:VARARG

    ····_vcscanf_l PROTO·cproto _Format:XMASM ,_Locale:XMASM ,_ArgList:XMASM    43    _vcscanf_l PROTO _Format:XMASM ,_Locale:XMASM ,_ArgList:XMASM
44    ····_vcscanf PROTO·cproto _Format:XMASM ,_ArgList:XMASM    44    _vcscanf PROTO _Format:XMASM ,_ArgList:XMASM
45    ····_vcscanf_s_l PROTO·cproto _Format:XMASM ,_Locale:XMASM ,_ArgList:XMASM    45    _vcscanf_s_l PROTO _Format:XMASM ,_Locale:XMASM ,_ArgList:XMASM
46    ····_vcscanf_s PROTO·cproto _Format:XMASM ,_ArgList:XMASM    46    _vcscanf_s PROTO _Format:XMASM ,_ArgList:XMASM

TouEnMasm

Cproto is defined in the translate(XX).inc
in 32 ,   cproto equ <C> ,   stdproto equ <stdcall>       
in 64    ,    cproto equ <fastcall> , stdproto equ <fastcall>

The use of the constant cproto allow to change the type of call  of  the proto
in the crt ,all pprototypes are c prototypes with a variant in the name.
The various names for a same call don't help the translation.
It's for that i have added a DEFINE_PROTO section in egales.txt to allow the user to modify the type all call.
It is those two lines:
cproto,__cdecl,__CRTDECL,U_EXPORT2,LDAPAPI,STDMAPIINITCALLTYPE,MI_MAIN_CALL,WINAPIV,RPC_VAR_ENTRY
stdproto,__stdcall,CALLBACK,WINAPI,APIPRIVATE,PASCAL, __RPC_API,__RPC_USER,__RPC_STUB,RPC_ENTRY
When an another is found there is just to add this one in one of the two lines and the translate is modify.



Fa is a musical note to play with CL

LiaoMi

Hi TouEnMasm,

thanks for the clarification :thup:

A couple more questions, there is an example:
typedef long  Test_LONG64a;
typedef unsigned long  Test_LONG64b;
typedef long long int  Test_LONG64c;
typedef unsigned long long int  Test_LONG64d;
typedef __int64  Test_LONG64e;
typedef unsigned __int64  Test_LONG64f;

                                                         
#if Test_SIZEOF_LONG == ( 64 / Test_CHAR_BIT )

#define Test_LONG64
#define Test_INT64   long
#define Test_UINT64  unsigned long

#elif !defined( __STDC__ ) || defined( Test_CONFIG_OPTION_FORCE_INT64 )

#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L

#define Test_LONG64
#define Test_INT64   long long int
#define Test_UINT64  unsigned long long int


#elif defined( _MSC_VER ) && _MSC_VER >= 900

#define Test_LONG64
#define Test_INT64   __int64
#define Test_UINT64  unsigned __int64

#elif defined( __BORLANDC__ )

#define Test_LONG64
#define Test_INT64   __int64
#define Test_UINT64  unsigned __int64

#elif defined( __WATCOMC__ )

#elif defined( __MWERKS__ )

#define Test_LONG64
#define Test_INT64   long long int
#define Test_UINT64  unsigned long long int

#elif defined( __GNUC__ )

#define Test_LONG64
#define Test_INT64   long long int
#define Test_UINT64  unsigned long long int

#endif

#endif

#ifdef Test_LONG64
  typedef Test_INT64   Test_Int64;
  typedef Test_UINT64  Test_UInt64;
#endif


translated as

Test_LONG64a TYPEDEF DWORD

Test_LONG64b TYPEDEF DWORD

Test_LONG64c TYPEDEF DWORD

Test_LONG64d TYPEDEF DWORD

Test_LONG64e TYPEDEF QWORD

Test_LONG64f TYPEDEF QWORD

IF  Test_SIZEOF_LONG EQ (64 / Test_CHAR_BIT)
Test_LONG64 equ
Test_INT64 equ < long>
Test_UINT64 equ < unsigned long>
ELSEIF  NOTDEFINED( __STDC__ ) OR DEFINED( Test_CONFIG_OPTION_FORCE_INT64 )
IF DEFINED( __STDC_VERSION__ ) AND  __STDC_VERSION__ GE 199901
Test_LONG64 equ
Test_INT64 equ < long long int>
Test_UINT64 equ < unsigned long long int>
ELSEIF DEFINED( _MSC_VER ) AND  _MSC_VER GE 900
Test_LONG64 equ
Test_INT64 equ < __int64>
Test_UINT64 equ < unsigned __int64>
ELSEIF DEFINED( __BORLANDC__ )
Test_LONG64 equ
Test_INT64 equ < __int64>
Test_UINT64 equ < unsigned __int64>
ELSEIF DEFINED( __WATCOMC__ )
ELSEIF DEFINED( __MWERKS__ )
Test_LONG64 equ
Test_INT64 equ < long long int>
Test_UINT64 equ < unsigned long long int>
ELSEIF DEFINED( __GNUC__ )
Test_LONG64 equ
Test_INT64 equ < long long int>
Test_UINT64 equ < unsigned long long int>
ENDIF
ENDIF
IFDEF Test_LONG64
Test_Int64 TYPEDEF Test_INT64

Test_UInt64 TYPEDEF Test_UINT64

ENDIF


long long int and unsigned long long int have wrong values - DWORD
typedef long long int  Test_LONG64c;
typedef unsigned long long int  Test_LONG64d;

long long   8   none (but equivalent to __int64)   -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long   8   none (but equivalent to unsigned __int64)   0 to 18,446,744,073,709,551,615

Specifier(s)         Type
-------------    -------------
long long int    long long int
long long        long long int
long int         long int
long             long int

Next flaw (see further examples above  :arrow_up:)

#define Test_INT64
#define Test_INT64   long
#define Test_UINT64  unsigned long


translated as

Test_LONG64 equ
Test_INT64 equ < long>
Test_UINT64 equ < unsigned long>


but it should be

Test_LONG64 equ 1; TRUE
Test_INT64 equ DWORD
Test_UINT64 equ   DWORD


or

Test_LONG64 equ
Test_INT64 equ < long long int>
Test_UINT64 equ < unsigned long long int>


but it should be

Test_LONG64 equ 1
Test_INT64 equ QWORD
Test_UINT64 equ QWORD


it does not take into account the definition of a variable via #define  :tongue:

TouEnMasm

The translator as been made for the windows sdk header (not too many old ) and i see that those you show aren't.
__BORLANDC__ isn't one of those and there is syntax in the header you show who aren't Visual C,C++ header.
The translator couldn't translate any c headers,only those of  the visual c,c++ microsoft.
He couldn't be use also on the header of the project without corrections,they don't follow the same rules.
He could be use only on the sdk header.
After you can also made a census on the triple words used as variable, I will get it and made a correction.
They are very few for evident reasons (headinc know the long long and the double long used in the sdk).
Can you tell me what is a int char double ? (he can exist somewhere !).
A unique chance to translate that is to put it in a c code.

The SDK more often use typedef to define variables not define.




Fa is a musical note to play with CL

LiaoMi

Quote from: TouEnMasm on July 19, 2021, 12:10:54 AMThe translator as been made for the windows sdk header (not too many old ) and i see that those you show aren't.
__BORLANDC__ isn't one of those and there is syntax in the header you show who aren't Visual C,C++ header.
The translator couldn't translate any c headers,only those of  the visual c,c++ microsoft.
He couldn't be use also on the header of the project without corrections,they don't follow the same rules.
He could be use only on the sdk header.
After you can also made a census on the triple words used as variable, I will get it and made a correction.
They are very few for evident reasons (headinc know the long long and the double long used in the sdk).
Can you tell me what is a int char double ? (he can exist somewhere !).
A unique chance to translate that is to put it in a c code.

The SDK more often use typedef to define variables not define.

Hi TouEnMasm,

this is partially true, since overriding of types is a standard feature of the language, but I agree that such code does not appear in the visual studio.

QuoteCan you tell me what is a int char double ? (he can exist somewhere !).
It seems to me that this combination is impossible, since in a simple definition the integer expands in the type, there is no similar expansion here, since the types are completely different.

Type char is a distinct type that has an implementation-defined choice of "signed char" or "unsigned
char" as its underlying type. The values of type char can represent distinct codes for all members of
the implementation's basic character set. The three types char, signed char, and unsigned char are
collectively called ordinary character types. The ordinary character types and char8_t are collectively called
narrow character types. For narrow character types, each possible bit pattern of the object representation
represents a distinct value.

Types bool, char, wchar_t, char8_t, char16_t, char32_t, and the signed and unsigned integer types are
collectively called integral types. A synonym for integral type is integer type.

https://docs.microsoft.com/en-us/cpp/cpp/char-wchar-t-char16-t-char32-t?view=msvc-160


Kinds of literals
1 There are several kinds of literals.19
literal:
integer-literal
character-literal
floating-point-literal
string-literal
boolean-literal
pointer-literal
user-defined-literal
5.13.2 Integer literals [lex.icon]
integer-literal:
binary-literal integer-suffixopt
octal-literal integer-suffixopt
decimal-literal integer-suffixopt
hexadecimal-literal integer-suffixopt
binary-literal:
0b binary-digit
0B binary-digit
binary-literal 'opt binary-digit
octal-literal:
0
octal-literal 'opt octal-digit
decimal-literal:
nonzero-digit
decimal-literal 'opt digit
hexadecimal-literal:
hexadecimal-prefix hexadecimal-digit-sequence
binary-digit: one of
0 1
octal-digit: one of
0 1 2 3 4 5 6 7
nonzero-digit: one of
1 2 3 4 5 6 7 8 9
hexadecimal-prefix: one of
0x 0X
hexadecimal-digit-sequence:
hexadecimal-digit
hexadecimal-digit-sequence 'opt hexadecimal-digit
hexadecimal-digit: one of
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F
integer-suffix:
unsigned-suffix long-suffixopt
unsigned-suffix long-long-suffixopt
long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt
unsigned-suffix: one of
u U
long-suffix: one of
l L
long-long-suffix: one of
ll LL

TouEnMasm


I agree that a translator who don't cover all the forms  of code in use not only in the sdk headers but also in the code (header"s code)
is limited .The problem is simple:
JUST DO IT
I have made  some corrections in bigers file of [/url]http://luce.yves.pagesperso-orange.fr/sdkrc100_KIT_10.0.19041.0.7z[/url]
That will be enough for some times.
usable without  modifies (list not complete)

include OCIdl.sdk
include WindowsSearchErrors.sdk
include d3d11sdklayers.sdk
include imapi2fs.sdk
include fsrmpipeline.sdk
include d3d11_4.sdk
include wmcodecdsp.sdk
include netfw.sdk
include SearchAPI.sdk
include WindowsSearchErrors.sdk
include d3dukmdt.sdk
include ocidl.sdk
include WinBase.sdk
include WdsTptMgmt.sdk
include bdaiface.sdk
include ddraw.sdk
include ShObjIdl.sdk
include UIAnimation.sdk
include xenroll.sdk
include wingdi.sdk
include cscobj.sdk
include DbgModel.sdk
include d3d10.sdk
include msfeeds.sdk
include ObjIdlbase.sdk
include mfobjects.sdk
include UIAutomationCore.sdk
include d3d11_1.sdk
include dinput.sdk
include mbnapi.sdk
include MMC.sdk

include fsrmscreen.sdk
include miniport.sdk   ;utilise C++ structures
include minitape.sdk   ;    utilise C++ structures
include taskschd.sdk
include ExDisp.sdk
include urlmon.sdk
;#define CCH_WMDM_PROPNAME(sz) (sizeof(sz)/sizeof(sz[0]))
include vds.sdk
include winsync.sdk
include imapi2.sdk
include wincodec.sdk
include AppxPackaging.sdk
include activdbg.sdk
include nserror.sdk
include WbemDisp.sdk
include d3d11_3.sdk
include ShlDisp.sdk
include PortableDevice.sdk
include mfmediaengine.sdk
include pla.sdk
include CommCtrl.sdk
include ClusApi.sdk

include PrinterExtension.sdk

include msinkaut.sdk
include ObjIdl.sdk
include rtccore.sdk
include MSClus.sdk
include gpmgmt.sdk
include msctf.sdk
include adoint.sdk
include DvbSiParser.sdk
include adoint_Backcompat.sdk
include WinUser.sdk
include TOM.sdk
include msxml.sdk
include strmif.sdk
include segment.sdk
include sapi51.sdk
include wuapi.sdk
include consoleapi.sdk
include consoleapi2.sdk
include consoleapi3.sdk
include Iads.sdk
include FaxComEx.sdk
include wmsdkidl.sdk
include tuner.sdk
include oledb.sdk
include Tapi3if.sdk
include MqOaI.sdk
include MsHtmdid.sdk
include propkey.sdk
include ComSvcs.sdk
include icui18n.sdk
include d3d11.sdk
include azroles.sdk
include winioctl.sdk
include wmp.sdk
include sapi53.sdk
include propidl.sdk
include olectl.sdk
include icucommon.sdk
include AudioEngineEndpoint.sdk
include audiomediatype.sdk
include dxgi.sdk
include dxgi1_3.sdk
include dxgi1_4.sdk
include fwptypes.sdk
include iketypes.sdk
include ntddndis.sdk
include ntdef.sdk
include reshub.sdk
include rpc.sdk
include rpcdce.sdk
include rpcndr.sdk
include xpsobjectmodel.sdk
include eventdetectoroemadapter.sdk

include sensorsdef.sdk
include specstrings.sdk

include strsafe.sdk
include tdi.sdk
include  in6addr.sdk
include stdiostr.sdk
include animationcoordinator.sdk
include Wich_include.sdk


need to be modifies before translation

;----------------------------include microsoft.diagnostics.appanalysis.sdk
;----------------------------include WebServices.sdk
;----------------------------include esent.sdk
;----------------------------include mi.sdk ;_MI_ContextFT MI_ParameterSetFT
;------------------------- include mswmdm.sdk      static ++
;----------------------------include d3D10umddi.sdk


others need tests

Fa is a musical note to play with CL