News:

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

Win SP@ and common dialogs - trouble!

Started by lamer, May 04, 2005, 07:15:23 PM

Previous topic - Next topic

AeroASM

What are you on about? In the faulty code, he Does use RtlZeroMemory!

QvasiModo

Quote from: lamer on May 05, 2005, 08:56:16 PM
QvasiModo,
Waw! Great! It works! :clap:
I can't believe it! With old structure! Guys, initialize all! Applause!
Quote from: lamer on May 05, 2005, 02:50:02 PM
By the way, I have found that GDI+ does not work, when call it from modal dialog.
But this is another story...
And this began to work as well!
Where have you been before?! :thumbu

:bg :bg :bg
Glad to know it's working now! :U

QvasiModo

Quote from: AeroASM on May 05, 2005, 08:58:34 PM
What are you on about? In the faulty code, he Does use RtlZeroMemory!
Look closer, he was using RtlZeroMemory only on the filename buffer.

pbrennick

Aero,
You are doing it again...  :boohoo:

QvasiModo,
You rock, I did not realize that local variables are uninitialized or else I just forgot.  I always zero these veriables in my code as a matter of course so it slipped by me being someone else's code.  Anyway, very timely posting, dude!

Paul

tenkey

I would either remove the use of EBX or properly preserve EBX in either the DialogProc or the OpenFileProc.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

MichaelW

Quote from: pbrennick on May 05, 2005, 09:13:33 AM
MichaelW,
Since I have a WINNT machine, adding those 3 declarations to the structure in windows.inc should solve the problem if you are correct.  Unfortunately, this is not the case, adding to the structure does not solve the problem.

Hi Paul,

I was not suggesting that this was the cause of the problem, just that there was an inconsistency that should be investigated (I should have made that clear). I did notice this in the PSDK documentation:
Quote
lStructSize

Specifies the length, in bytes, of the structure.

Windows NT 4.0: In an application that is compiled with WINVER and _WIN32_WINNT >= 0x0500, use    OPENFILENAME_SIZE_VERSION_400 for this member.

Windows 2000/XP: Use sizeof (OPENFILENAME) for this parameter.
And then from CommDlg.h:

#ifndef CDSIZEOF_STRUCT
#define CDSIZEOF_STRUCT(structname, member)  (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
#endif

#if (_WIN32_WINNT >= 0x0500)
#define OPENFILENAME_SIZE_VERSION_400A  CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName)
#define OPENFILENAME_SIZE_VERSION_400W  CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName)
#ifdef UNICODE
#define OPENFILENAME_SIZE_VERSION_400  OPENFILENAME_SIZE_VERSION_400W
#else
#define OPENFILENAME_SIZE_VERSION_400  OPENFILENAME_SIZE_VERSION_400A
#endif // !UNICODE
#endif // (_WIN32_WINNT >= 0x0500)


But I'm not sure what sizeof (OPENFILENAME) would return. The MASM32 structure is 76 bytes. Would the PSDK structure be 76 or 88 bytes? Or just test both values?
eschew obfuscation