News:

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

Main Menu

Full SDK 10.0 translate for 64 and 32 bits

Started by TouEnMasm, August 11, 2012, 10:04:25 PM

Previous topic - Next topic

TouEnMasm

EDIT: 2020 get it here https://github.com/ToutEnMasm71100

Translate of the Windows 10 header files,Those ones are a REAL translate:
You can build 64 bits or 32 bits prog with it
The .sdk files can be used with jwasm and ml  (after some corrections )
Jwasm HJWASM
To solve ml internal Error http://masm32.com/board/index.php?topic=3694.msg38983#msg38983
Works exactly as the original one.That is:
Alignment is the same as c++ (QWORD default)
32 64 bits is supported.
All versions of windows (win95 to Win 10.0)
All interfaces translated (- a few number,count on one hand doights)
All structures
All constantes
Functions      (a very few number can be missing)
All conditions  (constants switchs are put on windows 10.0,see translate.inc)
            This allow UNICODE support
              This allow various material adaptations

Translate is now in this form:
QuoteUpdateLayeredWindow PROTO hWnd:HWND ,hdcDst:HDC ,pptDst:XMASM ,psize:XMASM ,hdcSrc:HDC ,\
            pptSrc:XMASM ,crKey:COLORREF ,pblend:XMASM ,dwFlags:DWORD

The ready to use grant you the use of the list below  without problems.Others files can need a few minor corrections.Tested by compiled of my ide.
Included libraries are for the inline functions (printf..).

Quoteinclude sdk64.inc
                or
      include sdk32.inc
;**************************************************************************************
Full package with crt 2013
SDK 10.0 header's file
;*****************************************************************************************************
NOTES:
Adapting constants switchs to your system,use this tool:
sdkrc81\Before_use_me.exe.He will give you the correct swiths for your system.
Modify translate.inc with this switchs.The defaut system is windows 10.0

With a correct alignment,all translated structures,can be used as they are.
There is no need of any modifie.

Modifies made on the sdk for Jwasm
QuoteJWasm v2.08rc3, Aug  9 2012, Masm-compatible assembler.
QuoteThe ERROR macro in adoint.sdk must be renamed Ierror
The ERROR equate (ERROR equ <0>) must be put in comment in Wingdi.sdk
If you don't do that,you give this error message from jwasm
Quote.data ;------ here the error ---------
Error A2069: Segment, group or segment register expected

The following files had been tested,other can need some modifies
The before_use_me.exe allow you to adapt constants switchs to your version of windows

\sdkrc81\shared\rpc.sdk Nombre d'Include: 12       
\sdkrc81\um\amstream.sdk Nombre d'Include: 13       
\sdkrc81\um\AtscPsipParser.sdk Nombre d'Include: 10   
\sdkrc81\um\Audioclient.sdk Nombre d'Include: 11   
\sdkrc81\um\audioenginebaseapo.sdk Nombre d'Include: 10
\sdkrc81\um\AudioEngineEndpoint.sdk Nombre d'Include: 11
\sdkrc81\um\audiopolicy.sdk Nombre d'Include: 10   
\sdkrc81\um\Bits3_0.sdk Nombre d'Include: 10       
\sdkrc81\um\bits4_0.sdk Nombre d'Include: 11       
\sdkrc81\um\bits5_0.sdk Nombre d'Include: 11       
\sdkrc81\um\CertSrv.sdk Nombre d'Include: 10       
\sdkrc81\um\combaseapi.sdk Nombre d'Include: 10   
\sdkrc81\um\ComSvcs.sdk Nombre d'Include: 12       
\sdkrc81\um\d2d1.sdk Nombre d'Include: 10       
\sdkrc81\um\d3d10.sdk Nombre d'Include: 13       
\sdkrc81\um\d3d11.sdk Nombre d'Include: 15       
\sdkrc81\um\d3d11_2.sdk Nombre d'Include: 10       
\sdkrc81\um\devicetopology.sdk Nombre d'Include: 10   
\sdkrc81\um\dshow.sdk Nombre d'Include: 17       
\sdkrc81\um\DvbSiParser.sdk Nombre d'Include: 10   
\sdkrc81\um\ehstorapi.sdk Nombre d'Include: 10       
\sdkrc81\um\evr9.sdk Nombre d'Include: 10       
\sdkrc81\um\fsrmtlb.sdk Nombre d'Include: 12       
\sdkrc81\um\functiondiscoveryapi.sdk Include: 14   
\sdkrc81\um\FwCommon.sdk Nombre d'Include: 15       
\sdkrc81\um\gdiplus.sdk Nombre d'Include: 31       
\sdkrc81\um\Iadmw.sdk Nombre d'Include: 10       
\sdkrc81\um\LM.sdk Nombre d'Include: 19               
\sdkrc81\um\locationapi.sdk Nombre d'Include: 11   
\sdkrc81\um\minidrv.sdk Nombre d'Include: 20       
\sdkrc81\um\msctf.sdk Nombre d'Include: 10       
\sdkrc81\um\MsHTML.sdk Nombre d'Include: 12       
\sdkrc81\um\Mshtmlc.sdk Nombre d'Include: 11       
\sdkrc81\um\msopc.sdk Nombre d'Include: 11       
\sdkrc81\um\oledb.sdk Nombre d'Include: 93       
\sdkrc81\um\oledbdep.sdk Nombre d'Include: 22       
\sdkrc81\um\propsys.sdk Nombre d'Include: 11       
\sdkrc81\um\sapi.sdk Nombre d'Include: 11       
\sdkrc81\um\SearchAPI.sdk Nombre d'Include: 24   
\sdkrc81\um\segment.sdk Nombre d'Include: 12       
\sdkrc81\um\shdeprecated.sdk Nombre d'Include: 12   
\sdkrc81\um\ShObjIdl.sdk Nombre d'Include: 18   
\sdkrc81\um\sphelper.sdk Nombre d'Include: 14       
\sdkrc81\um\strmif.sdk Nombre d'Include: 18       
\sdkrc81\um\Tapi3.sdk Nombre d'Include: 13       
\sdkrc81\um\tuner.sdk Nombre d'Include: 10       
\sdkrc81\um\UtilLib.sdk Nombre d'Include: 10       
\sdkrc81\um\vds.sdk Nombre d'Include: 13       
\sdkrc81\um\vdshwprv.sdk Nombre d'Include: 13       
\sdkrc81\um\wiamindr_lh.sdk Nombre d'Include: 10   
\sdkrc81\um\wiamindr_xp.sdk Nombre d'Include: 10   
\sdkrc81\um\WinBase.sdk Nombre d'Include: 34       
\sdkrc81\um\wincodec.sdk Nombre d'Include: 10       
\sdkrc81\um\Windows.sdk Nombre d'Include: 38       
\sdkrc81\um\winnt.sdk Nombre d'Include: 13       
\sdkrc81\um\Wsdapi.sdk Nombre d'Include: 10       
KM\wdm.sdk
KM\miniport.sdk
KM\cifs.sdk
..



Fa is a musical note to play with CL

ragdog


dedndave


Gunther

You have to know the facts before you can distort them.

TouEnMasm

#4
I have modified the pack with the alignment of structures.
Now the alignment is made as the c++ do.
The defaut alignment (DWORD) must be change for (QWORD) in the translate.inc
file.
see following posts.
This solve all  the problems with structures.
Quote
   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   DefaultAlignement equ <QWORD>
   DEFALIGNMASM TEXTEQU  DefaultAlignement
   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


Fa is a musical note to play with CL

TouEnMasm


The good defaut alignment for the c++ is QWORD.
The proof is made by the PARTITION_INFORMATION.
This structure change of size with the alignment.
ASk to masm      with DWORD align sizeof PARTITION_INFORMATION == 28
                          with QWORD align sizeof PARTITION_INFORMATION == 32
Ask to c++     sizeof PARTITION_INFORMATION == 32
Thanks to japheth to point me on it.
This structure had a defaut alignment in the c++.
Proof is made,that defaut alignement for c++ = 8   
Fa is a musical note to play with CL

MichaelW

The alignment is QWORD and the structure is padded at the end to make the length a multiple of 8 bytes because the largest member is a QWORD. And at least for the PARTITION_INFORMATION structure the same alignment applies for C.

#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <stddef.h>

/*
typedef struct _PARTITION_INFORMATION {
  LARGE_INTEGER StartingOffset;
  LARGE_INTEGER PartitionLength;
  DWORD HiddenSectors;
  DWORD PartitionNumber;
  BYTE PartitionType;
  BOOLEAN BootIndicator;
  BOOLEAN RecognizedPartition;
  BOOLEAN RewritePartition;
} PARTITION_INFORMATION, *PPARTITION_INFORMATION;

typedef union _LARGE_INTEGER {
  struct {
    DWORD LowPart;
    LONG HighPart;
  };
  LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
*/

int main(void)
{
    printf( "sizeof(PARTITION_INFORMATION) %d\n", sizeof(PARTITION_INFORMATION) );
    printf( "offsetof(PARTITION_INFORMATION,StartingOffset) %d\n", offsetof(PARTITION_INFORMATION,StartingOffset) );
    printf( "offsetof(PARTITION_INFORMATION,PartitionLength) %d\n", offsetof(PARTITION_INFORMATION,PartitionLength) );
    printf( "offsetof(PARTITION_INFORMATION,HiddenSectors) %d\n", offsetof(PARTITION_INFORMATION,HiddenSectors) );
    printf( "offsetof(PARTITION_INFORMATION,PartitionNumber) %d\n", offsetof(PARTITION_INFORMATION,PartitionNumber) );
    printf( "offsetof(PARTITION_INFORMATION,PartitionType) %d\n", offsetof(PARTITION_INFORMATION,PartitionType) );
    printf( "offsetof(PARTITION_INFORMATION,BootIndicator) %d\n", offsetof(PARTITION_INFORMATION,BootIndicator) );
    printf( "offsetof(PARTITION_INFORMATION,RecognizedPartition) %d\n", offsetof(PARTITION_INFORMATION,RecognizedPartition) );
    printf( "offsetof(PARTITION_INFORMATION,RewritePartition) %d\n", offsetof(PARTITION_INFORMATION,RewritePartition) );
    getch();
    return 0;
}


sizeof(PARTITION_INFORMATION) 32
offsetof(PARTITION_INFORMATION,StartingOffset) 0
offsetof(PARTITION_INFORMATION,PartitionLength) 8
offsetof(PARTITION_INFORMATION,HiddenSectors) 16
offsetof(PARTITION_INFORMATION,PartitionNumber) 20
offsetof(PARTITION_INFORMATION,PartitionType) 24
offsetof(PARTITION_INFORMATION,BootIndicator) 25
offsetof(PARTITION_INFORMATION,RecognizedPartition) 26
offsetof(PARTITION_INFORMATION,RewritePartition) 27

Well Microsoft, here's another nice mess you've gotten us into.

TouEnMasm

#7
Thanks to you,
I have made the same thing with the "ready to use sdk" and find the same thing.
Quote
sizeof PARTITION_INFORMATION 32
offset PARTITION_INFORMATION.StartingOffset 0
offset PARTITION_INFORMATION.PartitionLengt 8
offset PARTITION_INFORMATION.HiddenSectors 16
offset PARTITION_INFORMATION.PartitionNumber 20
offset PARTITION_INFORMATION.PartitionType 24
offset PARTITION_INFORMATION.BootIndicator 25
offset PARTITION_INFORMATION.RecognizedPartition 26
offset PARTITION_INFORMATION.RewritePartition 27
translate.inc
Quote
   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   DefaultAlignement equ <QWORD>
   DEFALIGNMASM TEXTEQU  DefaultAlignement
   ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Nothing is perfect:
You can have a problem like this one:
http://masm32.com/board/index.php?topic=642.msg5658#msg5658
The tool in D:\sdkrc7\examples\cherche.exe could made a list of used functions.
dir /S/B *.sdk >  somename.sch           (list of FULL path *.sdk)
Put this file in the directory of "cherche".He will give you the same list that in the post. Menu "cherche">>"listes a rechercher"   select "somename.sch"
Fa is a musical note to play with CL

TouEnMasm


Posted a new version working exactly as the original windows sdk 7.1.
32 64 bits allowed and same alignment as c++ (QWORD DEFAULT).
Many changes to make it the 7.1 without to much problem.
The if statement are controled.Only one file show a problem,adoctint.h with a sum of if and end if = -1 (one if is missing).This is not given by the translate but by the header.h.
Fa is a musical note to play with CL

japheth

I downloaded the version from 21.9.2012. Tried examples\exampl01\listbox. It works!

However, if I want to create a listing ( adding /Fl to masm cmdline arguments ), I get very strange errors ( Masm v8, 9 and 10 ):


Assembling: listbox.asm
ULONG_PTR defined
\SDKRC7\rpcdcep.SDK(133) : error A2020:identifier not a record : RPC_SYNTAX_IDENTIFIER
\SDKRC7\rpcdcep.SDK(147) : error A2020:identifier not a record : RPC_SYNTAX_IDENTIFIER
\SDKRC7\rpcasync.SDK(191) : error A2009:syntax error in expression
\SDKRC7\winioctl.SDK(3137) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(89) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(115) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(350) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(368) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(401) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(429) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(474) : error A2009:syntax error in expression
\SDKRC7\winspool.SDK(503) : error A2009:syntax error in expression


I have no idea what the first two error msgs might cause. With Jwasm, there's no problem with /Fl.



TouEnMasm


I have made the same test and get the same problem with the listing.
I had try to made it with my ide , there is a pipe and a thread,No problem,the listing show no error.
The error is only under dos.
The jwasm haven't also this internal error of ml.
Quote
.NOLIST         ;signifie: ne rien mettre dans le listing
;------ emplacement des déclarations
   .486
   .model flat, stdcall
   option casemap :none   ; case sensitive

   ;include translate.inc   ;SDK translate include files (voir mon site)
   ExitProcess PROTO :DWORD
   ;include windows.sdk
   ;------- librairie courantes ,identiques masm32rt   
   includelib kernel32.lib
   .const
GUID   STRUCT
    Data1    dd ?
    Data2    dw ?
    Data3    dw ?
    Data4    db 8 dup(?)
GUID ENDS   
DEFALIGNMASM TEXTEQU <QWORD>   
PARTITION_INFORMATION_GPT   STRUCT   DEFALIGNMASM
   PartitionType GUID <>  ; Partition type. See table 16-3.
   PartitionId GUID <>  ; Unique GUID for this partition.
   Attributes QWORD ? ; See table 16-4.
   Name1 BYTE ? ; Partition Name in Unicode.
PARTITION_INFORMATION_GPT      ENDS

IFDEF (MIDL_PASS)
LARGE_INTEGER   STRUCT   DEFALIGNMASM
ELSE   
LARGE_INTEGER   UNION
   STRUCT   DUMMYSTRUCTNAME
   LowPart DWORD ?
   HighPart DWORD ?
   ENDS
   STRUCT   u
   LowPart DWORD ?
   HighPart DWORD ?
   ENDS
ENDIF ;MIDL_PASS
   QuadPart QWORD ?
LARGE_INTEGER      ENDS
PARTITION_INFORMATION_MBR   STRUCT DEFALIGNMASM
   PartitionType BYTE ?
   BootIndicator BYTE ?
   RecognizedPartition BYTE ?
   HiddenSectors DWORD ?
PARTITION_INFORMATION_MBR      ENDS   
   
DRIVE_LAYOUT_INFORMATION_GPT   STRUCT DEFALIGNMASM
   DiskId GUID <>
   StartingUsableOffset LARGE_INTEGER <>
   UsableLength LARGE_INTEGER <>
   MaxPartitionCount DWORD ?
DRIVE_LAYOUT_INFORMATION_GPT      ENDS

DRIVE_LAYOUT_INFORMATION_MBR   STRUCT DEFALIGNMASM
   Signature DWORD ?
DRIVE_LAYOUT_INFORMATION_MBR      ENDS
   
PARTITION_INFORMATION_EX   STRUCT DEFALIGNMASM
   PartitionStyle DWORD ?
   StartingOffset LARGE_INTEGER <>
   PartitionLength LARGE_INTEGER <>
   PartitionNumber DWORD ?
   RewritePartition BYTE ?
   union   DUMMYUNIONNAME
   Mbr PARTITION_INFORMATION_MBR <>
   Gpt PARTITION_INFORMATION_GPT <>
   ENDS
PARTITION_INFORMATION_EX      ENDS
   
DRIVE_LAYOUT_INFORMATION_EX   STRUCT DEFALIGNMASM
   PartitionStyle DWORD ?
   PartitionCount DWORD ?
   union   DUMMYUNIONNAME
   Mbr DRIVE_LAYOUT_INFORMATION_MBR <>
   Gpt DRIVE_LAYOUT_INFORMATION_GPT <>
   ENDS
   PartitionEntry PARTITION_INFORMATION_EX 1 dup (<>)
DRIVE_LAYOUT_INFORMATION_EX      ENDS   
   .data
   .code

   start:
   invoke ExitProcess,0

;################################################################   
   end start      
At each version of ml  i hope this one corrected but not.the 6.15 have it also but give more usefull information than ml 10..
Give the file path and the number of the line.



Fa is a musical note to play with CL

TouEnMasm


To avoid the internal error , there is need to explode the  PARTITION_INFORMATION_EX  structure like this:
Quote
EXPORT_PARTITION_INFORMATION_EX UNION
       Mbr PARTITION_INFORMATION_MBR <>
       Gpt PARTITION_INFORMATION_GPT <>
EXPORT_PARTITION_INFORMATION_EX ENDS

PARTITION_INFORMATION_EX   STRUCT   DEFALIGNMASM
   PartitionStyle DWORD ?
   StartingOffset LARGE_INTEGER <>
   PartitionLength LARGE_INTEGER <>
   PartitionNumber DWORD ?
   RewritePartition BYTE ?
   export_union EXPORT_PARTITION_INFORMATION_EX <>   
PARTITION_INFORMATION_EX      ENDS

Fa is a musical note to play with CL

bsdsource

Keep up this excellent work! :t :t I'll be following you on the forums. This is truly a great contribution to the community in addition to your translation tool Thank you so much.

asmcoder

Good Job !  Could you do me a favor to translate WDK7600?

TouEnMasm


Ready to use SDK 8.1 added in the first post,more easy to use than the 7.1.
many filters have been added in this version.

Fa is a musical note to play with CL