The MASM Forum

General => The Workshop => Topic started by: sinsi on August 15, 2018, 12:04:28 AM

Title: Windows API differences 32/64-bit
Post by: sinsi on August 15, 2018, 12:04:28 AM
Are there any Windows API calls with a different count of arguments between 32- and 64-bit? Logic says no, but never assume...
Title: Re: Windows API differences 32/64-bit
Post by: hutch-- on August 15, 2018, 12:42:45 AM
Not that I have seen but that is no guarantee. Usual irritations are argument sizes, with some structures that have DWORD members that have to be called in 64 bit ABI, the invoke I have done handles that but you can put it in a 32 register then use the 64 bit register to manually call the API.
Title: Re: Windows API differences 32/64-bit
Post by: jj2007 on August 15, 2018, 01:07:52 AM
Check the header files for WIN64 near WINAPI - here is one (irrelevant) example where a switch changes an include file:#if defined(_WIN64)
#include <pshpack8.h>
#else
#include <pshpack4.h>
#endif


And take a thorough look at the SetWindowLongPtr debate. So far, I never found differences, and my "dual" sources (http://masm32.com/board/index.php?topic=5314.msg59884#msg59884) all build fine in both modes. If C/C++ compilers can build their executables with one set of header files, then you can certainly do the same with a macro assembler. My \Masm32\MasmBasic\Res\DualWin.inc could be a source of inspiration ;)
Title: Re: Windows API differences 32/64-bit
Post by: sinsi on August 15, 2018, 01:20:27 AM
Yeah, my thought is to have one set of includes. Cheers.
Title: Re: Windows API differences 32/64-bit
Post by: hutch-- on August 15, 2018, 01:33:24 AM
C has always done that, you can build a win3.0 window written in pure C in Win64. In 64 bit MASM it has its own set of API headers and the earlier include files are not compatible with 64 bit MASM so there is no loss in them being different.

64 bit MASM includes look like this.

externdef __imp_AddAtomA:PPROC
AddAtomA equ <__imp_AddAtomA>
  IFNDEF __UNICODE__
    AddAtom equ <__imp_AddAtomA>
  ENDIF

externdef __imp_AddAtomW:PPROC
AddAtomW equ <__imp_AddAtomW>
  IFDEF __UNICODE__
    AddAtom equ <__imp_AddAtomW>
  ENDIF

externdef __imp_AddConsoleAliasA:PPROC
AddConsoleAliasA equ <__imp_AddConsoleAliasA>
  IFNDEF __UNICODE__
    AddConsoleAlias equ <__imp_AddConsoleAliasA>
  ENDIF