News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetSaveFileName don't want to change his look

Started by ToutEnMasm, December 05, 2006, 04:42:03 PM

Previous topic - Next topic

ToutEnMasm

Hello,
I have a problem with GetSaveFileName that keep an explorer look with NULL flags.
Attached is a sample with a GetOpenFileName (good look) and GetSaveFileName (bad look).

Some computer don't like the explorer look and i need to delet the OFN_EXPLORER flag.
Without this flag GetOpenFileName is correct.
Without this flag GetSaveFileName stay with an explorer look.

If someone can tell me if it appear good on some computer or the trick to make it appear in old style ?.
                    Thanks
                               ToutEnMasm




[attachment deleted by admin]

Tedd

It seems to be a strange effect caused by the flags you select..

Make sure you have the OFN_ALLOWMULTISELECT flag and it will show the old style dialogs :wink
No snowflake in an avalanche feels responsible.

ToutEnMasm


Thanks,it work.
I finally find in the SDK, that using OFNHookProcOldStyle (a callback returning NULL) with the OFN_ENABLEHOOK show also the old style.
A last question, Is there a test to know if the EXPLORER style is supported ?.
The SDK say nothing on that and the dialog box load many dll,perhaps it's the Key ?

                         ToutEnMasm

Quote
loaded modules by GetSaveFileName
       
ModLoad: 76590000 765ad000   C:\WINDOWS\System32\CSCDLL.dll
ModLoad: 75f10000 7600d000   C:\WINDOWS\System32\browseui.dll
ModLoad: 76960000 76a15000   C:\WINDOWS\system32\USERENV.dll
ModLoad: 778e0000 779d8000   C:\WINDOWS\system32\SETUPAPI.dll
ModLoad: 76930000 76956000   C:\WINDOWS\system32\ntshrui.dll
ModLoad: 76ac0000 76ad1000   C:\WINDOWS\system32\ATL.DLL
ModLoad: 6fee0000 6ff34000   C:\WINDOWS\system32\NETAPI32.dll
ModLoad: 77720000 77890000   C:\WINDOWS\System32\shdocvw.dll
ModLoad: 779e0000 77a76000   C:\WINDOWS\system32\CRYPT32.dll
ModLoad: 77a80000 77a92000   C:\WINDOWS\system32\MSASN1.dll
ModLoad: 76610000 76694000   C:\WINDOWS\system32\CRYPTUI.dll
ModLoad: 76be0000 76c0e000   C:\WINDOWS\system32\WINTRUST.dll
ModLoad: 76c40000 76c68000   C:\WINDOWS\system32\IMAGEHLP.dll
ModLoad: 771b0000 7727e000   C:\WINDOWS\system32\WININET.dll
ModLoad: 013b0000 013b9000   C:\WINDOWS\system32\Normaliz.dll
ModLoad: 5dca0000 5dce5000   C:\WINDOWS\system32\iertutil.dll
ModLoad: 76f10000 76f3d000   C:\WINDOWS\system32\WLDAP32.dll
ModLoad: 20000000 202da000   C:\WINDOWS\system32\xpsp2res.dll
ModLoad: 013f0000 0140c000   c:\Program Files\Adobe\Acrobat 7.0\ActiveX\PDFShell.dll


Tedd

It will depend on the version of comdlg used (and/or whichever other dlls that uses); which will probably be updated with common-controls.
The question is how to find this version.
No snowflake in an avalanche feels responsible.

ToutEnMasm

Hello,
Good question , I have some answers

Following is two kind of dll that accept and don't accept the EXPLORER look
Quote
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0
                     .2600.2982_x-ww_ac3f9c03\comctl32.dll
               Product  Version 6.00.2900.2982 taille du fichier 1 M0
                 File version 6.0 (xpsp.060825-0040)
                 

D:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0
                     .10.0_x-ww_f7fb5805\comctl32.dll
      comdlg32.dll :  257 k  date 29/08/02 11:44

The function DllGetVersion is supposed to get the answer
Quote
declare
        PcomctlVersion TYPEDEF PROTO :DWORD
        fcomctlVersion   TYPEDEF PTR PcomctlVersion
        comctlVersion TEXTEQU <fcomctlVersion ptr HcomctlVersion>      

      
.const
; Platform IDs for DLLVERSIONINFO
DLLVER_PLATFORM_WINDOWS   equ   <000000001h>
DLLVER_PLATFORM_NT   equ   <000000002h>
;IF (COMPARE (_WIN32_IE,GE,00501h))

DLLVERSIONINFO2   STRUCT
   info1 DLLVERSIONINFO <>
   dwFlags DWORD ?  ; No flags currently defined
   ullVersion QWORD ? ; Encoded as:
            ; Major 0xFFFF 0000 0000 0000
            ; Minor 0x0000 FFFF 0000 0000
            ; Build 0x0000 0000 FFFF 0000
            ; QFE   0x0000 0000 0000 FFFF

DLLVERSIONINFO2      ENDS

DLLVER_MAJOR_MASK   equ   <0FFFF000000000000h>
DLLVER_MINOR_MASK   equ   <00000FFFF00000000h>
DLLVER_BUILD_MASK   equ   <000000000FFFF0000h>
DLLVER_QFE_MASK   equ   <0000000000000FFFFh>
;ENDIF


.data
HcomctlVersion dd 0
Hcomctl32       dd 0
comctl32dll db "comctl32.dll",0
FunctionName db "DllGetVersion",0
dllversion DLLVERSIONINFO2 <>
.code
   mov dllversion.info1.cbSize,sizeof DLLVERSIONINFO2
   mov     Hcomctl32,FUNC(LoadLibrary, addr comctl32dll)   
   .if eax == NULL
      INVOKE     MessageBox, NULL,addr comctl32dll,SADR("librairie Load failed"), MB_OK or MB_ICONERROR
   .else
      invoke GetProcAddress,Hcomctl32,addr FunctionName
      .if eax==NULL
         invoke MessageBox,NULL,SADR("fonction Non Trouvé"),addr FunctionName,MB_OK
         INVOKE     FreeLibrary, Hcomctl32
         mov    Hcomctl32,0
      .else
         mov HcomctlVersion,eax ;on peut interroger la dll
         invoke comctlVersion,addr dllversion
         ;SADR("VERSIONINFO")
         invoke FindResource,Hcomctl32,1,RT_VERSION
         .if eax != 0
            mov edx,eax
            invoke LoadResource,Hcomctl32,edx
            .if eax != 0         
                  mov edx,eax      
               invoke MessageBox,NULL,edx,SADR("Titre"),MB_OK
            .endif
         .endif
         INVOKE     FreeLibrary, Hcomctl32
         mov    Hcomctl32,0         
      .endif      
   .endif

The most important is the product version,it is use in the path of the dll.
The DllGetVersion function don't give it.Only reading the VERSIONINFO resource seem able to do that.
The loaded resource is in unicode format.
Is there something to read it ?
                                      ToutEnMasm








ToutEnMasm

Later .....

Complete answer to get the dll version information
some macros just pass the adress of a string

Quote
   main PROTO C
   WaitKeyCrt PROTO
   GetDllVersion PROTO  :DWORD
   
   
   ;------------------------- MACRO ------------------------------------
   
   
   PACKVERSION MACRO   b,a      
      xor eax,eax
      xor edx,edx
      mov eax,a
      mov edx,b
      and eax,0ffffh
      and edx,0ffffh
      shl edx,16      
      or eax,edx
      EXITM <eax>   
   ENDM
      ;Value equ (((  a AND 0ffffh ) ) OR(((  b AND 0ffffh ) ) ) SHL 16 )
   

PcomctlVersion TYPEDEF PROTO :DWORD
fcomctlVersion TYPEDEF PTR PcomctlVersion
DllGetVersion  TEXTEQU <fcomctlVersion ptr pDllGetVersion>

solution equ MAKELONG (71,4)

.DATA
retourligne db 13,10,0
.CODE

main PROC C
   LOCAL MajorVersion:DWORD,MinorVersion,Version
   invoke GetDllVersion,SADR("C:\WINDOWS\SYSTEM32\comctl32.dll",dllpath)   
   mov edx,eax
   mov Version,eax
   shr edx,16
   mov MajorVersion,edx
   and eax,0FFFFh
   mov MinorVersion,eax
   INVOKE printf,TEXT("C:\WINDOWS\SYSTEM32\comctl32.dll",13,10)
   INVOKE printf, TEXT("File Version: %d.%02d",13,10),MajorVersion,MinorVersion            
   INVOKE printf, TEXT(" Version: hexa: %X decimal: %02d",13,10),Version,Version
   INVOKE WaitKeyCrt
   ret
main ENDP


;################################################################
GetDllVersion PROC  lpszDllName:DWORD
         align 8
         LOcal dvi:DLLVERSIONINFO2
         LOCAL pDllGetVersion:DWORD,Hdll         
         Local dwVersion:DWORD
         ZEROLOCALES dwVersion
   comment µ
    For security purposes, LoadLibrary should be provided with a
       fully-qualified path to the DLL. The lpszDllName variable should be
       tested to ensure that it is a fully qualified path before it is used.
µ         
   mov dwVersion,0
   mov dvi.info1.cbSize,sizeof DLLVERSIONINFO2
         
   mov     Hdll,FUNC(LoadLibrary,lpszDllName )   
   .if eax == NULL
      jmp FindeGetDllVersion
   .else
      invoke GetProcAddress,Hdll,SADR("DllGetVersion",szdllgetversion)
        ; Because some DLLs might not implement this function, you
        ;must test for it explicitly. Depending on the particular
        ;DLL, the lack of a DllGetVersion function can be a useful
        ;indicator of the version. */      
      .if eax==NULL
         jmp FindeGetDllVersion
      .else
         mov pDllGetVersion,eax ;on peut interroger la dll
         invoke DllGetVersion,addr dvi         
         .if eax >= 0
            mov dwVersion,PACKVERSION (dvi.info1.dwMajorVersion,dvi.info1.dwMinorVersion)
         .endif
      .endif     
      INVOKE     FreeLibrary, Hdll
      mov    Hdll,0      
   .endif            
FindeGetDllVersion:
         mov eax,dwVersion
         ret
GetDllVersion endp

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



WaitKeyCrt PROC
   INVOKE printf, TEXT(13,10,"Press any key to continue...")
   INVOKE _getch
   .IF (eax == 0) || (eax == 0E0h)
      INVOKE _getch
   .ENDIF
   INVOKE printf,addr retourligne
ret
WaitKeyCrt ENDP

END