Author Topic: 2.46.8 available  (Read 545 times)

Biterider

  • Member
  • **
  • Posts: 147
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: 2.46.8 available
« Reply #15 on: February 03, 2018, 09:40:07 PM »
Hi
Just downloaded UASM 2.46.9 and recompiled some major sources without problems.  :t
Biterider

ragdog

  • Member
  • ****
  • Posts: 552
Re: 2.46.8 available
« Reply #16 on: February 06, 2018, 04:59:38 AM »
Hello

I have some problems with my x64 project, if i use GetOpenFilename commdlg.inc ( WinInc209.zip).
It crash in GetOpenfileName if i use your OPENFILENAME structur.

The stuctur must alignment by 8

Code: [Select]
OPENFILENAME_ struct 8   ;-- padding (8 qword size) Thanks to fearless

In x86 works fine without alignment by 8

Regards,

jj2007

  • Member
  • *****
  • Posts: 7975
  • Assembler is fun ;-)
    • MasmBasic
Re: 2.46.8 available
« Reply #17 on: February 06, 2018, 05:22:00 AM »
Hi ragdog,
With x64, your assembler commandline must specify /Zp8

ragdog

  • Member
  • ****
  • Posts: 552
Re: 2.46.8 available
« Reply #18 on: February 06, 2018, 07:36:42 AM »
Thank you Jochen for this Information  :t

ragdog

  • Member
  • ****
  • Posts: 552
Re: 2.46.8 available
« Reply #19 on: February 06, 2018, 08:15:50 PM »
Hello

I have try with the switch -zp8 it works but if i close my dialog crash it on WM_CLOSE or use i Uasm64 works not

Code: [Select]
.686
.MMX
.XMM
.x64

option casemap : none
option win64 : 15
option frame : auto
;option stackbase : rsp

_WIN64 EQU 1
WINVER equ 0501h


my settings is
Code: [Select]
C:\jWasm\bin\rc /v "DlgMain.Rc"
C:\jWasm\bin\uasm64.exe /c -win64 -Zp8 /win64 /Cp /nologo "DlgMain.Asm"
C:\jWasm\bin\link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /MACHINE:X64 /OUT:"DlgMain.exe" /LIBPATH:C:\jWasm\Lib\x64 "DlgMain.obj"  "DlgMain.res"



Regards,

fearless

  • Member
  • ***
  • Posts: 300
    • LetTheLightIn
Re: 2.46.8 available
« Reply #20 on: February 06, 2018, 11:44:29 PM »
entry point in x64 needs:

Code: [Select]
WinMainCRTStartup proc FRAME
    invoke    GetModuleHandle,NULL
    mov       hInstance,rax;eax
    invoke    InitCommonControls
    invoke    DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
    invoke    ExitProcess,0
    ret
WinMainCRTStartup ENDP

...
; code
...

end WinMainCRTStartup

which replaces the start: and end start label entry point used in x86
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

ragdog

  • Member
  • ****
  • Posts: 552
Re: 2.46.8 available
« Reply #21 on: February 07, 2018, 12:09:52 AM »
Thank you Fearless i try out.

johnsa

  • Member
  • ****
  • Posts: 654
    • Uasm
Re: 2.46.8 available
« Reply #22 on: February 07, 2018, 12:32:19 AM »
Fearless beat me to it.. :)

Code: [Select]
.686
.MMX
.XMM
.x64

option casemap : none
option win64 : 7
option frame : auto
option stackbase : rbp

include DlgMain.Inc

.code

WinMainCRTStartup PROC FRAME

invoke GetModuleHandle,NULL
mov hInstance,rax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0

ret
WinMainCRTStartup ENDP

;########################################################################

DlgProc proc frame hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg == WM_NCCREATE


.elseif uMsg == WM_INITDIALOG

   ; Browse for JSON file to open
Invoke RtlZeroMemory, Addr JsonBrowseFilename, SIZEOF JsonBrowseFilename
push hWnd
pop BrowseFile.hwndOwner
lea rax, JsonBrowseFilter
mov BrowseFile.lpstrFilter, rax
lea rax, JsonBrowseFilename
mov BrowseFile.lpstrFile, rax
lea rax, JsonBrowseFileTitle
mov BrowseFile.lpstrTitle, rax
mov BrowseFile.nMaxFile, SIZEOF JsonBrowseFilename
mov BrowseFile.lpstrDefExt, 0
mov BrowseFile.Flags, OFN_EXPLORER
mov BrowseFile.lStructSize, SIZEOF BrowseFile
Invoke GetOpenFileName, Addr BrowseFile

; If user selected an JSON and didnt cancel browse operation...
.IF rax !=0
mov rax, TRUE
.ELSE
mov rax, FALSE
.ENDIF
 

.elseif uMsg==WM_COMMAND

.elseif uMsg==WM_CLOSE

invoke EndDialog,hWnd,0
invoke PostQuitMessage,0

.else

.endif

mov rax,TRUE
ret
DlgProc endp
end WinMainCRTStartup


under x64 you should always start with a proper PROC as the entry point, that way the assembler can correctly setup the stack and alignment.

jj2007

  • Member
  • *****
  • Posts: 7975
  • Assembler is fun ;-)
    • MasmBasic
Re: 2.46.8 available
« Reply #23 on: February 07, 2018, 12:40:13 AM »
You can use whatever you want, no need to pull in the CRT. This one, for example, just creates an enter 50h, 0:
Code: [Select]
include \Masm32\MasmBasic\Res\JBasic.inc ; ## builds in 32- or 64-bit mode with ML, AsmC, JWasm, HJWasm ##
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
  Inkey Chr$("This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
EndOfCode

This code was assembled with UAsm64 in 64-bit format

The Init stands for:
Code: [Select]
.code
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
  start proc
  enter 50h, 0 ; align stack
  start endp

johnsa

  • Member
  • ****
  • Posts: 654
    • Uasm
Re: 2.46.8 available
« Reply #24 on: February 07, 2018, 02:20:25 AM »
Yep, you can definitely do it yourself, I just call the proc WinmainCRTStartup for convention, but that isn't actually linked with the CRT.