The MASM Forum

Microsoft 64 bit MASM => MASM64 SDK => Topic started by: hutch-- on October 25, 2022, 03:12:01 PM

Title: Important change for win64.inc
Post by: hutch-- on October 25, 2022, 03:12:01 PM
There was an error in Vasily's include file that I did not catch, the "message" member of the "MSG" struct was set to DWORD but it worked in most instances because of the structure alignment. The correct size is QWORD. Change this in your own copy of win64.inc. The next release will have it set correctly.

MSG STRUCT STRUCT_ALIGN
   hwnd  HWND ?
   message QWORD ?
   wParam  WPARAM ?
   lParam  LPARAM ?
   time  DWORD ?
   pt  POINT<>
MSG ENDS

Title: Re: Important change for win64.inc
Post by: Vortex on October 29, 2022, 08:42:34 PM
Hello,

Here is a patch file to update the win64.inc include file :

patch-win64-inc.sh

dos2unix win64.inc
patch win64.inc win64.inc.patch
unix2dos win64.inc


Applying the patch with busybox64 :

https://frippery.org/busybox/

https://frippery.org/files/busybox/busybox64.exe

G:\masm64\include64>busybox64.exe sh patch-win64-inc.sh
patching file win64.inc


Assuming that 0win64.inc is a copy of the original file win64.inc :

G:\masm64\include64>fc 0win64.inc win64.inc

***** 0win64.inc
   hwnd  HWND ?
   message DWORD ?
   wParam  WPARAM ?
***** WIN64.INC
   hwnd  HWND ?
   message QWORD ?
   wParam  WPARAM ?
*****

Title: Re: Important change for win64.inc
Post by: bluedevil on October 29, 2022, 11:39:31 PM
Thanks for the warning hutch, I have updated mine.

I hope you also consider my post here (https://masm32.com/board/index.php?topic=10425.0) before releasing the new SDK.

Regards
Title: Re: Important change for win64.inc
Post by: jj2007 on October 30, 2022, 12:03:32 AM
Another simple patcher (executable attached):

include \masm32\MasmBasic\MasmBasic.inc
  Init
  Let edi="\Masm64\include64\win64.inc"
  Let esi=FileRead$(edi)
  .if Instr_(esi, "MSG STRUCT")
.if Instr_(eax, "message DWORD") && edx<99
mov byte ptr [eax+8], "Q"
Rename edi, Replace$(edi, ".inc", ".old")
FileWrite edi, esi
MsgBox 0, "Successfully patched", "Hi", MB_OK
.endif
  .endif
EndOfCode


You can use fc to compare the files:
C:\Masm64\include64>fc win64.inc win64.old
Confronto in corso dei file win64.inc e WIN64.OLD
***** win64.inc
   hwnd  HWND ?
   message QWORD ?
   wParam  WPARAM ?
***** WIN64.OLD
   hwnd  HWND ?
   message DWORD ?
   wParam  WPARAM ?
*****
Title: Re: Important change for win64.inc
Post by: hutch-- on October 30, 2022, 05:51:11 PM
 :biggrin:

If I was going to make a patch, I would do it in BASIC but as I am fundamentally lazy, I would just change the structure member to the correct size.  :tongue: