Author Topic: Windows API differences 32/64-bit  (Read 276 times)

sinsi

  • Member
  • *****
  • Posts: 1085
Windows API differences 32/64-bit
« 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...
I can walk on water but stagger on beer.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5897
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Windows API differences 32/64-bit
« Reply #1 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

jj2007

  • Member
  • *****
  • Posts: 8826
  • Assembler is fun ;-)
    • MasmBasic
Re: Windows API differences 32/64-bit
« Reply #2 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:
Code: [Select]
#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 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 ;)

sinsi

  • Member
  • *****
  • Posts: 1085
Re: Windows API differences 32/64-bit
« Reply #3 on: August 15, 2018, 01:20:27 AM »
Yeah, my thought is to have one set of includes. Cheers.
I can walk on water but stagger on beer.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5897
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Windows API differences 32/64-bit
« Reply #4 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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: