Sorry about that.  I did have the last quotation mark but it must have been a typo. Everything compiles fine.  I will attach a small exe of the program.  It will work fine on my desktop but not on my laptop.  It only happens with my program so it is not a system wide problem with file open boxes.
Attachments:
Posted on 2005-09-04 17:10:25 by Desp

Sorry about that.  I did have the last quotation mark but it must have been a typo. Everything compiles fine.   I will attach a small exe of the program.  It will work fine on my desktop but not on my laptop.  It only happens with my program so it is not a system wide problem with file open boxes.


I've tried opening and cancelling the GOF dialog of your sample app several times on my WinXP Home/SP2 machine and I can see nothing obviously unexpected happening.

I suspect there is something unusual about the configuration of your laptop. Do you have any extension dll's loaded into explorer (that you are aware of)? That would be my first port of call... Take a look in regedit under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects" and a few of the related keys to see if there is anything there you weren't previously aware of.

Also, does your debugger show any leaks occuring?

Just a thought...

Haqa...



Ok, the other key my brain was keeping me from remembering is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved

Which lists all the shell extensions which are allowed to run with in explorer (And of course the GOF dialog is a mini-explorer window) so one of these may be reacting badly to your code. (Stress may... I can't tell from what you've shown what might be getting the hump...)
Posted on 2005-09-04 17:38:41 by Haqa
Hmmmm.  I have checked for anything unusual in the keys you posted.  No BHO's or anything unusual.  How can I check for a leak?  It always crashes in shell32.dll when it happens.  Try this: open the program and open a file.  Go to open another file.  This will usually  cause my program to crash right there or it will allow me to open a few files and then crash.  I don't understand how it only happens with my program on the laptop but when run on another computer it is fine.  It seems like it wouldn't be something system-wide.
Posted on 2005-09-04 18:17:22 by Desp

Hmmmm.  I have checked for anything unusual in the keys you posted.  No BHO's or anything unusual.  How can I check for a leak?  It always crashes in shell32.dll when it happens.  Try this: open the program and open a file.  Go to open another file.  This will usually  cause my program to crash right there or it will allow me to open a few files and then crash.  I don't understand how it only happens with my program on the laptop but when run on another computer it is fine.  It seems like it wouldn't be something system-wide.


No dice, sorry. I can't reproduce your described behaviour at all. (Love the idea of a GUI for UPX btw...)

Could you post the code for the prog in base.zip?

Haqa...
Posted on 2005-09-04 18:22:58 by Haqa
Yeah, there are probably many GUI's already but i'm doing it to get better at programming.  I've attached the project.  Hopefully I can figure this out soon so I can continue work.
Attachments:
Posted on 2005-09-04 20:12:01 by Desp
Desp, thank you for posting executable and source. The EXE works without problems here. The source deviates somewhat from MS recommendations in that your DialogProc should return a non-zero value if it handles a message -- but I doubt that this causes the problem. All you can do is to compare, structure member for structure member, how the solutions posted by others initialize the OFN structure, and where they differ from your solution. Good luck!
Posted on 2005-09-04 21:34:35 by Frank
i don't know How throw off the path.

.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\Comdlg32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\Comdlg32.lib
includelib \masm32\lib\masm32.lib

include \masm32\macros\macros.asm
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.const
IDD_DLGNATIVECRY equ 101
IDC_EDTTARGET equ 1002
IDC_BTNOPENTAR equ 1003
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
szPattern db "All Files (*.*)",0,"*.*",0,0 
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hInstance dd ?
szTarget db MAX_PATH dup (?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DlgProc proc uses ecx hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg==WM_COMMAND
.IF wParam==IDC_BTNOPENTAR
invoke szCopy,OpenFileDlg(hWin,hInstance,NULL,ADDR szPattern),ADDR szTarget
invoke SetDlgItemText,hWin,IDC_EDTTARGET,ADDR szTarget
.ENDIF
.ELSEIF uMsg==WM_CLOSE
invoke EndDialog,hWin,0
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
mov hInstance,FUNC(GetModuleHandle,NULL)
invoke DialogBoxParam,hInstance,IDD_DLGNATIVECRY,NULL,ADDR DlgProc,NULL
invoke ExitProcess,0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

end start



#include <\masm32\include\RESOURCE.H>
#define IDD_DLGNATIVECRY 101
IDD_DLGNATIVECRY DIALOGEX 6,6,240,45
STYLE WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | DS_CENTER
CAPTION "Open File"
FONT 8,"MS Sans Serif",0,0
BEGIN
LTEXT "File:",1001,4,3,36,8,0
EDITTEXT 1002,4,14,190,11,ES_AUTOHSCROLL
DEFPUSHBUTTON "Open File",1003,198,14,40,11,BS_FLAT
END


regards
Posted on 2005-09-04 22:23:48 by dcskm4200

Yeah, there are probably many GUI's already but i'm doing it to get better at programming.  I've attached the project.  Hopefully I can figure this out soon so I can continue work.


I've taken a quick look at this, and as you say, there are no obvious dragons here. I'll try to take a better look tonight.
Posted on 2005-09-05 02:30:45 by Haqa
hi!
  LPCTSTR       lpTemplateName; 
#if (_WIN32_WINNT >= 0x0500)
  void *        pvReserved;
  DWORD        dwReserved;
  DWORD        FlagsEx;
#endif // (_WIN32_WINNT >= 0x0500)
} OPENFILENAME, *LPOPENFILENAME


try to add 3 zeroed dwords after ofn, recompile and then try on laptop again
Posted on 2005-09-05 03:09:24 by Shoo
secmask, there are many possible explanations, including (but not limited to) these: (1) the OPENFILENAME structure on the stack is accidentally not aligned by 4; (2) initialization of the OPENFILENAME structure partly relies on "whatever values happen to be there anyway" (which is usually zero in the .DATA and .DATA? sections, but some non-zero value on the stack); (3) the summed size of all local variables in that procedure is too large (try "local xyz[1024*1024]: DWORD" to see this in action). Of course I don't know if any of these explain the particular case that you have in mind.

dcskm4200, you could do some string handling (scan the string that you already have backwards until you either find a "\" or reach the start of the string -- that's where the filename without path starts). Or you could write a slightly modified version of OpenFileDialog that returns the filename without path to begin with (that's not as difficult as it may sound, since OpenFileDialog is a short procedure anyway, and only few changes would be required).
Posted on 2005-09-05 10:07:16 by Frank
I might have found the problem.  I looked around and it seems others were having a crash in shell32 also.  The reported cause was Adobe Acrobat software.  I had Acrobat Reader 7 installed on my laptop.  I tried updating to the latest version (7.0.3) to see if it would fix it.  It didn't so I decided to uninstall Acrobat Reader.  Since the uninstall I haven't been having the problem anymore although I will have to do more testing.  Needless to say I don't really trust Adobe software much anymore...
Posted on 2005-09-05 15:16:20 by Desp
That sounds pretty suspicious :s
Posted on 2005-09-05 15:36:09 by f0dder
Desp, time for a reformat?  ;)
Posted on 2005-09-05 20:10:50 by roticv
Heh, not time for a reformat.  Since I uninstalled Adobe Acrobat Reader the problem hasn't appeared.  I also tested on another laptop that had Acrobat Reader 7 on it and it crashed too.  Sounds like a bug with Adobe's software.
Posted on 2005-09-05 21:12:48 by Desp
I have Adobe Reader 7 on this box, as well as a laptop, and I don't have problems with GetOpenFileName. Perhaps Adobe installs something like a shell handler whatever, which for some weird problems cause the crash for you?

I remember that some versions of Reader would fail to load if you had softice installed (or running?) on your machine, because of the crappy DRM that is supports...
Posted on 2005-09-06 00:59:09 by f0dder
"parallel answer" :)
dcskm4200 - it is too easy to remove the path from gotten filename: add to filename buffer pointer value from nFileOffset, just do not forget - it is the word - so you have to convert it into the dword before adding.
regards!
Posted on 2005-09-06 01:05:52 by Shoo
Hello, Frank,Shoo
Thanks you for help.
Posted on 2005-09-06 06:40:58 by dcskm4200
solution for program crash at getopenfilename:
typical symptom: program terminates without any exception messages when openfile dialog box is opened with getopenfilename more than once and move the mouse in the box.
possible reason: - third party applications which set a shell extention. (some Acrobat Reader versions are suspects)
- getopenfilename uses some COM stuff (for tooltips etc.)

solution: use OleInitialize at the startup of the program and OleUninitialize at exit. OleInitialize has one parameter and it must be 0, OleUninitialize has no parameter. (of course, do not forget include ole32 library and include files)

I had same problem and looked for any solutions. I found this in other forum and wanna to share with you. It works (at least for me)
Posted on 2006-05-29 05:51:13 by ss#7
I've also seen such symptoms when the OPENFILENAME structure had uninitialized fields.
Posted on 2006-05-29 11:31:34 by QvasiModo