News:

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

Main Menu

OPENFILENAME in 64 bits

Started by Grincheux, August 09, 2013, 05:19:23 AM

Previous topic - Next topic

Grincheux

Here is my code :


[/code]OPENFILENAME STRUCT
   lStructSize        DWORD      ?
   hwndOwner          HWND      ?
   hInstance          HINSTANCE      ?
   lpstrFilter        LPSTR      ?
   lpstrCustomFilter  LPSTR      ?
   nMaxCustFilter     DWORD      ?
   nFilterIndex       DWORD      ?
   lpstrFile          LPSTR      ?
   nMaxFile           DWORD      ?
   lpstrFileTitle     LPSTR      ?
   nMaxFileTitle      DWORD      ?
   lpstrInitialDir    LPSTR      ?
   lpstrTitle         LPSTR      ?
   Flags              DWORD      ?
   nFileOffset         WORD      ?
   nFileExtension      WORD      ?
   lpstrDefExt        LPSTR      ?
   lCustData          LPARAM      ?
   lpfnHook           LPVOID      ?
   lpTemplateName     LPSTR      ?
OPENFILENAME ENDS


LPOPENFILENAME   TYPEDEF   PTR OPENFILENAME



File_Open                  PROC   __hWnd:HWND
                        LOCAL   _Ofn:OPENFILENAME


                        and      rsp,-16
                        sub      rsp,32


                        mov      __hWnd,rcx


                        push   rdi
                        xor      rax,rax
                        mov      rcx,SIZEOF OPENFILENAME
                        lea      rdi,_Ofn
                        rep      stosb
                        pop      rdi


                        mov      QWord Ptr szDsmFile,rax


                        lea      rcx,_Ofn
                        mov      rax,__hWnd


                        mov      (OPENFILENAME Ptr [rcx]).lStructSize,SIZEOF OPENFILENAME
                        mov      (OPENFILENAME Ptr [rcx]).hwndOwner,rax   ; rsp+28
                        lea      rax,szFilters
                        mov      (OPENFILENAME Ptr [rcx]).nFilterIndex,1      ; rsp+4c
                        mov      (OPENFILENAME Ptr [rcx]).lpstrFilter,rax   ; rsp+38
                        lea      rax,szDsmFile
                        mov      (OPENFILENAME Ptr [rcx]).nMaxFile,260
                        mov      (OPENFILENAME Ptr [rcx]).lpstrFile,rax      ; rsp+50
                        lea      rax,szDefExt
                        mov      (OPENFILENAME Ptr [rcx]).Flags,OFN_ENABLESIZING or OFN_FILEMUSTEXIST or OFN_FORCESHOWHIDDEN or OFN_PATHMUSTEXIST   ; rsp+80
                        mov      (OPENFILENAME Ptr [rcx]).lpstrDefExt,rax


                        call   GetOpenFileName
                        call   CommDlgExtendedError


                        add      rsp,32


                        xor      rax,rax
                        ret
File_Open                  ENDP



[hr]

[font=Verdana][size=78%]GetOpenFileName returns 0 and CommDlgExtendedError returns 1 which means "Invalid Structure size".[/font][/size]
[font=Verdana][size=78%]For me all seems correct. I tried with adding 16 bytes at the end of the structure (pReserved...). I alway get the same error. Who can help me?[/font][/size]

qWord

maybe a problem with the structure member alignment:
OPENFILENAME STRUCT 8
    ...

or cmd.-line switch /Zp8
MREAL macros - when you need floating point arithmetic while assembling!

habran

have look at this MDI64 :biggrin:
it is written for JWasm 64 bit
Cod-Father

Grincheux

Thank you qWord. I spent a lot of time just for a single 8. Now it's ok. Thanks again.

Grincheux

Thank you Habran, I keep the source. I tested the pgm, when I saw the "Open..." menu item, i was pleased, I said that there is an example.... The example is the "Save as...".


Thank you every body.