From unknown Tue Aug 19 10:01:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13065 <13065@debbugs.gnu.org> To: bug#13065 <13065@debbugs.gnu.org> Subject: Status: Bug in x-file-dialog with GetOpenFileName Reply-To: bug#13065 <13065@debbugs.gnu.org> Date: Tue, 19 Aug 2025 17:01:13 +0000 retitle 13065 Bug in x-file-dialog with GetOpenFileName reassign 13065 emacs,w32 submitter 13065 Du Yanning severity 13065 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 03 06:12:29 2012 Received: (at submit) by debbugs.gnu.org; 3 Dec 2012 11:12:29 +0000 Received: from localhost ([127.0.0.1]:50862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfTwq-0002fa-OR for submit@debbugs.gnu.org; Mon, 03 Dec 2012 06:12:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51117) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfTwo-0002fS-82 for submit@debbugs.gnu.org; Mon, 03 Dec 2012 06:12:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfTuP-0001u1-NC for submit@debbugs.gnu.org; Mon, 03 Dec 2012 06:10:03 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfTuP-0001tx-Je for submit@debbugs.gnu.org; Mon, 03 Dec 2012 06:09:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfTuO-0003lZ-Ll for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2012 06:09:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfTuI-0001sL-Qf for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2012 06:09:56 -0500 Received: from mail-oa0-f41.google.com ([209.85.219.41]:44128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfTuI-0001s2-LL for bug-gnu-emacs@gnu.org; Mon, 03 Dec 2012 06:09:50 -0500 Received: by mail-oa0-f41.google.com with SMTP id k14so2896306oag.0 for ; Mon, 03 Dec 2012 03:09:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=1a0oAEQK7sDGfdHJC8/A+2BN85s9473jeOpD7bQekAE=; b=anrh2fTs4EIxsVypgVqta9P+2fr9QJFT5/OFjA6lJWf0+gIYIWdZsmE8krr0ASu82f 2diL+sfmaoBQZbiFoLQx/yTxfYZwkwJO0omH/KfudSO4T2E3pE9yuo1FqM52M6ruglNU Y1BfjUaupsyrNSOB3MookDlG7a2A7zlvyisZ7frG64ZvaKnfQpxim/5PTbFELPJdsrbV CQ4Fai8vSl94O3w6wSaBGIUMsiDgmfpfsRbVjG4iNnSiLd42C53eVUGQ5Hrz69j5SfaT wGKoYa2ziit8iU2C7325AiOLrRS6xx98ZGcXWuepriquYjqExBFobvxjdwEaB/BrCo/u u/Ag== MIME-Version: 1.0 Received: by 10.182.194.70 with SMTP id hu6mr4073353obc.4.1354532990019; Mon, 03 Dec 2012 03:09:50 -0800 (PST) Received: by 10.76.27.103 with HTTP; Mon, 3 Dec 2012 03:09:49 -0800 (PST) Date: Mon, 3 Dec 2012 19:09:49 +0800 Message-ID: Subject: Bug in x-file-dialog with GetOpenFileName From: Du Yanning To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=f46d04447ecfb4e86304cff0c9d9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) --f46d04447ecfb4e86304cff0c9d9 Content-Type: text/plain; charset=ISO-8859-1 Platform: Windows 7 Emacs version: 24.2.1 Steps to reproduce this bug: emacs -Q copy and paste the next line into the *scratch* buffer: (x-file-dialog "hi" "c:\\") C-x C-e to evaluate it. The dialog appears. Type "abc" (without the enclosing double quotes) in the "File name" field. Click the "Desktop" icon on the left side of the dialog. Click the "Open" button. The dialog does NOT disappear while it should. I have tried GetOpenFileName/GetSaveFileName in my own Win32 programs and found that this behavior is casued by GetOpenFileName and GetSaveFileName is OK in such situation. However, simply replacing GetOpenFileName with GetSaveFileName will break other code in x-file-dialog. --f46d04447ecfb4e86304cff0c9d9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Platform: Windows 7
Emacs version: 24.2.1

Steps to reproduce th= is bug:
emacs -Q

copy and paste the next line into the *scratch* b= uffer:
(x-file-dialog "hi" "c:\\")

C-x C-e to = evaluate it.
The dialog appears.

Type "abc" (without the enclosing doubl= e quotes) in the "File name" field.
Click the "Desktop&qu= ot; icon on the left side of the dialog.
Click the "Open" butt= on.
The dialog does NOT disappear while it should.

I have tried GetOpenFi= leName/GetSaveFileName in my own Win32 programs and found that this behavio= r is casued by GetOpenFileName and GetSaveFileName is OK in such situation.= However, simply replacing GetOpenFileName with GetSaveFileName will break = other code in x-file-dialog.

--f46d04447ecfb4e86304cff0c9d9-- From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 04 14:10:48 2012 Received: (at 13065) by debbugs.gnu.org; 4 Dec 2012 19:10:48 +0000 Received: from localhost ([127.0.0.1]:53609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfxtH-0001w5-Ne for submit@debbugs.gnu.org; Tue, 04 Dec 2012 14:10:48 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:58183) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfxtF-0001vx-T8 for 13065@debbugs.gnu.org; Tue, 04 Dec 2012 14:10:47 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MEI00500SPE0N00@a-mtaout21.012.net.il> for 13065@debbugs.gnu.org; Tue, 04 Dec 2012 21:10:41 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MEI005XKT9S0Q20@a-mtaout21.012.net.il>; Tue, 04 Dec 2012 21:10:41 +0200 (IST) Date: Tue, 04 Dec 2012 21:10:39 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: X-012-Sender: halo1@inter.net.il To: Du Yanning , jasonr@gnu.org Message-id: <83liddr5u8.fsf@gnu.org> References: X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > Date: Mon, 3 Dec 2012 19:09:49 +0800 > From: Du Yanning > > Platform: Windows 7 > Emacs version: 24.2.1 > > Steps to reproduce this bug: > emacs -Q > > copy and paste the next line into the *scratch* buffer: > (x-file-dialog "hi" "c:\\") > > C-x C-e to evaluate it. > The dialog appears. > > Type "abc" (without the enclosing double quotes) in the "File name" field. > Click the "Desktop" icon on the left side of the dialog. > Click the "Open" button. > The dialog does NOT disappear while it should. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.169 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > Date: Mon, 3 Dec 2012 19:09:49 +0800 > From: Du Yanning > > Platform: Windows 7 > Emacs version: 24.2.1 > > Steps to reproduce this bug: > emacs -Q > > copy and paste the next line into the *scratch* buffer: > (x-file-dialog "hi" "c:\\") > > C-x C-e to evaluate it. > The dialog appears. > > Type "abc" (without the enclosing double quotes) in the "File name" field. > Click the "Desktop" icon on the left side of the dialog. > Click the "Open" button. > The dialog does NOT disappear while it should. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.169 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] > Date: Mon, 3 Dec 2012 19:09:49 +0800 > From: Du Yanning > > Platform: Windows 7 > Emacs version: 24.2.1 > > Steps to reproduce this bug: > emacs -Q > > copy and paste the next line into the *scratch* buffer: > (x-file-dialog "hi" "c:\\") > > C-x C-e to evaluate it. > The dialog appears. > > Type "abc" (without the enclosing double quotes) in the "File name" field. > Click the "Desktop" icon on the left side of the dialog. > Click the "Open" button. > The dialog does NOT disappear while it should. This works fine on XP. On Windows 7, I indeed see the problem, and it seems to be related to any action in the dialog that changes the original directory, which results in receiving in the dialog hook procedure of the CDN_FOLDERCHANGE and CDN_SELCHANGE notifications (which we don't handle). If you just type "abc" and click "Open", the dialog works as expected. It also works if you do change to another directory and select an existing file. > I have tried GetOpenFileName/GetSaveFileName in my own Win32 programs and > found that this behavior is casued by GetOpenFileName and GetSaveFileName > is OK in such situation. GetSaveFileName only works with existing files, which might explain why it works where GetOpenFileName fails. I tried to get this to work on Windows 7, or at least figure out why it doesn't, but came up empty-handed. Which is not surprising, since I know absolutely nothing about Windows GUI dialogs in general, and this dialog in particular. It doesn't particularly help that: a) Windows 7 deprecated this kind of dialogs and instead wants us to use some hotshot new ones. So it could be simply a bug in the implementation of this dialog on Windows 7. b) We use a file selection dialog in non-standard ways, to be able to open directories, not just files. The way we do this employs some undocumented tricks which I don't fully understand. E.g., when the hook gets the CDN_INITDONE notification, we access the File Name field of the dialog, but don't do anything with it, and just call EnableWindow. Is that really necessary, and if so, why? c) The filter string uses some "*|*" magic in the directory filter, which doesn't seem to be documented anywhere. What does it do? I CC Jason, who is the author of this code, in the hope that he will be able to give some advice. Failing that, I really don't know what to do to fix this. Ideas and advice will be most appreciated. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 08 08:11:10 2013 Received: (at 13065) by debbugs.gnu.org; 8 Jan 2013 13:11:10 +0000 Received: from localhost ([127.0.0.1]:56348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsYxO-000156-Qt for submit@debbugs.gnu.org; Tue, 08 Jan 2013 08:11:10 -0500 Received: from mail-da0-f53.google.com ([209.85.210.53]:41330) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsYxJ-00014T-D8 for 13065@debbugs.gnu.org; Tue, 08 Jan 2013 08:11:05 -0500 Received: by mail-da0-f53.google.com with SMTP id x6so189099dac.40 for <13065@debbugs.gnu.org>; Tue, 08 Jan 2013 05:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=S3gIUYCwGpdFXJLYKz7+GE4VE2azh5EParxfNN4nyRo=; b=loYwFB+3w/z4Y0W7TuQCb7AFiSrT6J8XECAHfZAFzZEu7ne7IASNH7QapnP7d16UqR KzJSE6Icwg8EeX2h0GTSLCRmgjMp66ASwuzlBTwuLJeBvr4VM1RQ0ZBhHyb7fKIk4IAe NZ+K0e9mIFB0WmBk9Qo9Fucfz5qkKGWYesXZG4rZyWB1kSyVsULPhry8GNfFu/vHIidP GYQRYZezs1rcPMqQr5QC2aFhiWn6HJdd9C2KtNrzDS+kgdpf5uw0nvKIeqAuL87yGx1n 9CN/JiO8AhLiKc/u7UkakYu8zlZoCIhJIXnvGO6C+aEhvSIG49V6u5KFIZaQOYQaGJmG 0c5g== X-Received: by 10.68.223.131 with SMTP id qu3mr198072203pbc.89.1357650651438; Tue, 08 Jan 2013 05:10:51 -0800 (PST) Received: from home.jasonrumney.net ([180.75.201.177]) by mx.google.com with ESMTPS id vk5sm39622761pbc.34.2013.01.08.05.10.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 05:10:50 -0800 (PST) Received: by home.jasonrumney.net (Postfix, from userid 1000) id 666FA10AA; Tue, 8 Jan 2013 21:10:35 +0800 (MYT) From: Jason Rumney To: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName References: <83liddr5u8.fsf@gnu.org> Date: Tue, 08 Jan 2013 21:10:35 +0800 In-Reply-To: <83liddr5u8.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 04 Dec 2012 21:10:39 +0200") Message-ID: <87pq1fhlbo.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, Du Yanning X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) Sorry for the late reply. Eli Zaretskii writes: > a) Windows 7 deprecated this kind of dialogs and instead wants us to > use some hotshot new ones. So it could be simply a bug in the > implementation of this dialog on Windows 7. Is it not just a case of doing the same as we did previously? /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 compatibility) we end up with the old file dialogs. Define a big enough struct for the new dialog to trick GetOpenFileName into giving us the new dialogs on newer versions of Windows. */ > b) We use a file selection dialog in non-standard ways, to be able to > open directories, not just files. The way we do this employs some > undocumented tricks which I don't fully understand. E.g., when > the hook gets the CDN_INITDONE notification, we access the File > Name field of the dialog, but don't do anything with it, and just > call EnableWindow. Is that really necessary, and if so, why? The purpose is to disable the File Name field when "Directories" is selected so the user does not try to type a filename (which will subsequently be ignored). "Current Directory" is put into the field when it is disabled to indicate to the user that the current directory will be chosen if they press OK. > > c) The filter string uses some "*|*" magic in the directory filter, > which doesn't seem to be documented anywhere. What does it do? Nothing. It has to be different than the *.* that is used for normal file selection, but couldn't be simply * IIRC. The magic is in the callback function and the code that strips away the filename when the dialog call has finished if the "Directories" option is selected. But in this report, the Directory filter was never chosen, so I don't think it is related. You could try removing the Directories portion of the filter string and the callback to be sure. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 08 16:26:50 2013 Received: (at 13065) by debbugs.gnu.org; 8 Jan 2013 21:26:50 +0000 Received: from localhost ([127.0.0.1]:57357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tsgh7-0007xQ-Ox for submit@debbugs.gnu.org; Tue, 08 Jan 2013 16:26:50 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:40453) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tsgh5-0007xB-Rj for 13065@debbugs.gnu.org; Tue, 08 Jan 2013 16:26:48 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MGB00H00S50A900@a-mtaout21.012.net.il> for 13065@debbugs.gnu.org; Tue, 08 Jan 2013 23:26:12 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGB00H3DSVJAY20@a-mtaout21.012.net.il>; Tue, 08 Jan 2013 23:26:07 +0200 (IST) Date: Tue, 08 Jan 2013 23:26:20 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: <87pq1fhlbo.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: Jason Rumney Message-id: <83r4lvgydf.fsf@gnu.org> References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > From: Jason Rumney > Cc: Du Yanning , 13065@debbugs.gnu.org > Date: Tue, 08 Jan 2013 21:10:35 +0800 > > > Sorry for the late reply. Thanks for chiming in. > > a) Windows 7 deprecated this kind of dialogs and instead wants us to > > use some hotshot new ones. So it could be simply a bug in the > > implementation of this dialog on Windows 7. > > Is it not just a case of doing the same as we did previously? > > /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > compatibility) we end up with the old file dialogs. Define a big > enough struct for the new dialog to trick GetOpenFileName into > giving us the new dialogs on newer versions of Windows. */ [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.169 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.5000] X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > From: Jason Rumney > Cc: Du Yanning , 13065@debbugs.gnu.org > Date: Tue, 08 Jan 2013 21:10:35 +0800 > > > Sorry for the late reply. Thanks for chiming in. > > a) Windows 7 deprecated this kind of dialogs and instead wants us to > > use some hotshot new ones. So it could be simply a bug in the > > implementation of this dialog on Windows 7. > > Is it not just a case of doing the same as we did previously? > > /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > compatibility) we end up with the old file dialogs. Define a big > enough struct for the new dialog to trick GetOpenFileName into > giving us the new dialogs on newer versions of Windows. */ [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.169 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4700] > From: Jason Rumney > Cc: Du Yanning , 13065@debbugs.gnu.org > Date: Tue, 08 Jan 2013 21:10:35 +0800 > > > Sorry for the late reply. Thanks for chiming in. > > a) Windows 7 deprecated this kind of dialogs and instead wants us to > > use some hotshot new ones. So it could be simply a bug in the > > implementation of this dialog on Windows 7. > > Is it not just a case of doing the same as we did previously? > > /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > compatibility) we end up with the old file dialogs. Define a big > enough struct for the new dialog to trick GetOpenFileName into > giving us the new dialogs on newer versions of Windows. */ Sorry, I don't understand: we still do what the above comment describes. Thanks for the other info. Unfortunately, I'm still clueless as to what could be causing the problem. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 13 07:53:13 2013 Received: (at 13065) by debbugs.gnu.org; 13 Jan 2013 12:53:13 +0000 Received: from localhost ([127.0.0.1]:57769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuN3p-0007aC-Ci for submit@debbugs.gnu.org; Sun, 13 Jan 2013 07:53:13 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:46353) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuN3n-0007Zz-4z for 13065@debbugs.gnu.org; Sun, 13 Jan 2013 07:53:12 -0500 Received: by mail-pb0-f51.google.com with SMTP id ro12so1708521pbb.10 for <13065@debbugs.gnu.org>; Sun, 13 Jan 2013 04:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=zA1B6Qm5QayiyT8z/ltlmDlcud0mCOlKmxJgVHa7SbA=; b=h1wtyEps2g0GZ+lQuTybshTO4uTaSFycDxbDJAzHtFpd+UguVpLUjKVP+1yAii1KB7 uTsIHHMZe/spG4Ojs6qDiPt4rO2qD3cxMqbkBm9Roaa0Qks4bLraLxG1m7gjqTQb6L8L dX8UPo87QY7la6ZjMKaLvvMCy1UQvV/K2Z7UPmLwUgE0KuzPWfW9UHSGRXKH0UI1GGx5 7m1vIq/SS+kmEFok49eyQ3oMvjT4vr2V7vsDo5mIebWwdShaK4+CSNWoOKUwf0JQCvp4 s9gp+D5mefv7BLoquA/63DaIehSlQK1oRV7v9M7ypMxAr18Xm+4W+Xu4Nv+U27M5LBDb CVGQ== X-Received: by 10.66.76.194 with SMTP id m2mr223454089paw.14.1358081566126; Sun, 13 Jan 2013 04:52:46 -0800 (PST) Received: from home.jasonrumney.net ([180.75.201.177]) by mx.google.com with ESMTPS id bf3sm6780220pab.12.2013.01.13.04.52.39 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Jan 2013 04:52:44 -0800 (PST) Received: by home.jasonrumney.net (Postfix, from userid 1000) id B46D1325; Sun, 13 Jan 2013 20:52:25 +0800 (MYT) From: Jason Rumney To: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> Date: Sun, 13 Jan 2013 20:52:25 +0800 In-Reply-To: <83r4lvgydf.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Jan 2013 23:26:20 +0200") Message-ID: <87fw251bzq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Eli Zaretskii writes: >> Is it not just a case of doing the same as we did previously? >> >> /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 >> compatibility) we end up with the old file dialogs. Define a big >> enough struct for the new dialog to trick GetOpenFileName into >> giving us the new dialogs on newer versions of Windows. */ > > Sorry, I don't understand: we still do what the above comment > describes. I meant maybe we need to increase the size of the struct again to fool Windows 7 into thinking we are compiling against a more recent version of the SDK. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 13 11:35:42 2013 Received: (at 13065) by debbugs.gnu.org; 13 Jan 2013 16:35:42 +0000 Received: from localhost ([127.0.0.1]:58375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuQX7-0004Ke-TE for submit@debbugs.gnu.org; Sun, 13 Jan 2013 11:35:42 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:64687) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuQX5-0004KQ-LL for 13065@debbugs.gnu.org; Sun, 13 Jan 2013 11:35:40 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MGK00I00O30KQ00@a-mtaout22.012.net.il> for 13065@debbugs.gnu.org; Sun, 13 Jan 2013 18:35:14 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGK00IGJOQPJX50@a-mtaout22.012.net.il>; Sun, 13 Jan 2013 18:35:14 +0200 (IST) Date: Sun, 13 Jan 2013 18:35:41 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: <87fw251bzq.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: Jason Rumney Message-id: <83boctrqg2.fsf@gnu.org> References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> <87fw251bzq.fsf@gnu.org> X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > From: Jason Rumney > Cc: duyanning@gmail.com, 13065@debbugs.gnu.org > Date: Sun, 13 Jan 2013 20:52:25 +0800 > > Eli Zaretskii writes: > > >> Is it not just a case of doing the same as we did previously? > >> > >> /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > >> compatibility) we end up with the old file dialogs. Define a big > >> enough struct for the new dialog to trick GetOpenFileName into > >> giving us the new dialogs on newer versions of Windows. */ > > > > Sorry, I don't understand: we still do what the above comment > > describes. > > I meant maybe we need to increase the size of the struct again to fool > Windows 7 into thinking we are compiling against a more recent version > of the SDK. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.172 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4925] X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.7 (/) > From: Jason Rumney > Cc: duyanning@gmail.com, 13065@debbugs.gnu.org > Date: Sun, 13 Jan 2013 20:52:25 +0800 > > Eli Zaretskii writes: > > >> Is it not just a case of doing the same as we did previously? > >> > >> /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > >> compatibility) we end up with the old file dialogs. Define a big > >> enough struct for the new dialog to trick GetOpenFileName into > >> giving us the new dialogs on newer versions of Windows. */ > > > > Sorry, I don't understand: we still do what the above comment > > describes. > > I meant maybe we need to increase the size of the struct again to fool > Windows 7 into thinking we are compiling against a more recent version > of the SDK. Thanks, will try that some time soon. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 15 13:03:36 2013 Received: (at 13065) by debbugs.gnu.org; 15 Jan 2013 18:03:36 +0000 Received: from localhost ([127.0.0.1]:33684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvArH-0004jz-GS for submit@debbugs.gnu.org; Tue, 15 Jan 2013 13:03:35 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:47769) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvArD-0004jk-Om for 13065@debbugs.gnu.org; Tue, 15 Jan 2013 13:03:33 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MGO00400I1Z2500@a-mtaout20.012.net.il> for 13065@debbugs.gnu.org; Tue, 15 Jan 2013 20:02:55 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGO003FLI4UOXC0@a-mtaout20.012.net.il>; Tue, 15 Jan 2013 20:02:55 +0200 (IST) Date: Tue, 15 Jan 2013 20:03:24 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: <83boctrqg2.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: jasonr@gnu.org Message-id: <83wqve8gsz.fsf@gnu.org> References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> <87fw251bzq.fsf@gnu.org> <83boctrqg2.fsf@gnu.org> X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > Date: Sun, 13 Jan 2013 18:35:41 +0200 > From: Eli Zaretskii > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > > > From: Jason Rumney > > Cc: duyanning@gmail.com, 13065@debbugs.gnu.org > > Date: Sun, 13 Jan 2013 20:52:25 +0800 > > > > Eli Zaretskii writes: > > > > >> Is it not just a case of doing the same as we did previously? > > >> > > >> /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 > > >> compatibility) we end up with the old file dialogs. Define a big > > >> enough struct for the new dialog to trick GetOpenFileName into > > >> giving us the new dialogs on newer versions of Windows. */ > > > > > > Sorry, I don't understand: we still do what the above comment > > > describes. > > > > I meant maybe we need to increase the size of the struct again to fool > > Windows 7 into thinking we are compiling against a more recent version > > of the SDK. > > Thanks, will try that some time soon. I spent some more time tinkering with this. First, the new Windows 7 dialogs are not merely an extension of the old ones, they are an entirely different implementation, via COM objects and a C++ interface. They also don't accept a structure similar to OPENFILENAME. So the trick to expand the structure is not going to help us. > > c) The filter string uses some "*|*" magic in the directory filter, > > which doesn't seem to be documented anywhere. What does it do? > > Nothing. It has to be different than the *.* that is used for normal > file selection, but couldn't be simply * IIRC. The magic is in the > callback function and the code that strips away the filename when the > dialog call has finished if the "Directories" option is selected. > > But in this report, the Directory filter was never chosen, so I don't > think it is related. You could try removing the Directories portion of > the filter string and the callback to be sure. Tried without the Directories portion, didn't help. I tried to attack this from a different angle. I compiled a simple stand-alone program (source below) that just opens the file selector dialog and prints the selected name after you click Open. This program works fine both on XP and on Windows 7, and shows a dialog that is almost exactly the same as what Emacs displays -- the only difference, which only shows on Windows 7, is in the slightly different visual appearance of the "Open" and "Cancel" buttons (on XP the dialog is identical to what Emacs shows, including the buttons). (To show dialogs like Emacs does, compile the program with the "-D_WIN32_WINNT=0x0501" switch, otherwise you get old-style dialogs.) Then I examined the Emacs sources for any differences between how we set up the dialog and this sample program, and modified the Emacs source to exactly match the sample program, right down to use of ZeroMemory instead of memset (ridiculous, I know; but I was desperate). Nothing helped: the same code in Emacs still won't close the dialog and return the file name, unless I select an existing file. By contrast, the sample program below will return any file name, whether or not that file exists, in any directory. Maybe I'm blind and missed some difference that I didn't eliminate. You are welcome to try that experiment and see if you succeed where I failed. Failing that, I'm beginning to think that the problem is elsewhere in Emacs. But what could that be? Is it possible that one of our message pumps somehow interferes with the dialog interaction, e.g., by intercepting some of the messages that were supposed to wind up in our hook procedure? Could it be due to the fact that our main message pump uses Unicode APIs, while the file selector uses ANSI APIs? Something else? I'm stumped. Here's the program to try: #include #include static UINT_PTR CALLBACK file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return 0; } int main (void) { OPENFILENAMEA ofn; // common dialog box structure char szFile[260]; // buffer for file name // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = NULL; ofn.lpstrFile = szFile; // Set lpstrFile[0] to '\0' so that GetOpenFileName does not // use the contents of szFile to initialize itself. ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_ENABLEHOOK); ofn.lpfnHook = file_dialog_callback; // Display the Open dialog box. if (GetOpenFileNameA(&ofn)==TRUE) printf ("GetOpenFile: '%s'\n", ofn.lpstrFile); else printf ("Failure: 0x%x\n", (unsigned)CommDlgExtendedError ()); return 0; } From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 16 07:24:12 2013 Received: (at 13065) by debbugs.gnu.org; 16 Jan 2013 12:24:12 +0000 Received: from localhost ([127.0.0.1]:34658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvS2M-0007yX-Dd for submit@debbugs.gnu.org; Wed, 16 Jan 2013 07:24:11 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:51926) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvS2J-0007yP-WF for 13065@debbugs.gnu.org; Wed, 16 Jan 2013 07:24:09 -0500 Received: by mail-pa0-f42.google.com with SMTP id rl6so764125pac.15 for <13065@debbugs.gnu.org>; Wed, 16 Jan 2013 04:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ai7H3uGDqI/Jh2dDmbD0vZk5gHGIUJgrtOdGCdpTF+A=; b=sMm3tETZ5dnkLVWx8TnQ6ueer+Yakhdupe1EnsY50w7HbFE5wXTnMrUdMMT4qPaCR/ X8Rl05VbQXlYpzkUHfC00yzEIistleoNoTBlohpXyKTj6VYilSflUlFT1no6Tf0t3YEe khtMOuHfYtthCLQFWJwQRhGOlUuEbJayPtuCe+sFfZeUEipv+5RoCmh0FXUuGZqC6HXU n+upT+fjov3ms+4FNuvwoRVaEABny5kDToKT9hZvtLoVbRzNtvqjqT1SIDpFtjaxapRB UqG5XJQIEEjz7hILoRsQjR7MHKevDNgGTadKYpSs6dw0d2D3O3jI4ycSRNrjMDZAawut BR5Q== X-Received: by 10.68.220.161 with SMTP id px1mr2069660pbc.167.1358339012324; Wed, 16 Jan 2013 04:23:32 -0800 (PST) Received: from home.jasonrumney.net ([180.75.201.177]) by mx.google.com with ESMTPS id ho4sm12208698pbc.54.2013.01.16.04.23.28 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 04:23:30 -0800 (PST) Received: by home.jasonrumney.net (Postfix, from userid 1000) id A0CB642D; Wed, 16 Jan 2013 20:23:19 +0800 (MYT) From: Jason Rumney To: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> <87fw251bzq.fsf@gnu.org> <83boctrqg2.fsf@gnu.org> <83wqve8gsz.fsf@gnu.org> Date: Wed, 16 Jan 2013 20:23:19 +0800 In-Reply-To: <83wqve8gsz.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Jan 2013 20:03:24 +0200") Message-ID: <87sj61uxjc.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Eli Zaretskii writes: > Failing that, I'm beginning to think that the problem is elsewhere in > Emacs. But what could that be? Is it possible that one of our > message pumps somehow interferes with the dialog interaction, e.g., by > intercepting some of the messages that were supposed to wind up in our > hook procedure? That seems like the most likely candidate. Do you have Spy++, or an equivalent that can show the Windows messages going to and from your sample program and the Open/Save dialog in Emacs? > Could it be due to the fact that our main message > pump uses Unicode APIs, while the file selector uses ANSI APIs? Since that's quite a recent change, it should be easy to test by trying an older version of Emacs on Windows 7. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 16 13:54:56 2013 Received: (at 13065) by debbugs.gnu.org; 16 Jan 2013 18:54:57 +0000 Received: from localhost ([127.0.0.1]:35593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvY8V-00020a-NJ for submit@debbugs.gnu.org; Wed, 16 Jan 2013 13:54:56 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:54622) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvY8S-00020Q-3Y for 13065@debbugs.gnu.org; Wed, 16 Jan 2013 13:54:54 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MGQ00400F5HG100@a-mtaout23.012.net.il> for 13065@debbugs.gnu.org; Wed, 16 Jan 2013 20:54:11 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGQ00423F62AL50@a-mtaout23.012.net.il>; Wed, 16 Jan 2013 20:54:03 +0200 (IST) Date: Wed, 16 Jan 2013 20:54:05 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: <87sj61uxjc.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: Jason Rumney Message-id: <83fw217ycy.fsf@gnu.org> References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> <87fw251bzq.fsf@gnu.org> <83boctrqg2.fsf@gnu.org> <83wqve8gsz.fsf@gnu.org> <87sj61uxjc.fsf@gnu.org> X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > From: Jason Rumney > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > Date: Wed, 16 Jan 2013 20:23:19 +0800 > > Eli Zaretskii writes: > > > Failing that, I'm beginning to think that the problem is elsewhere in > > Emacs. But what could that be? Is it possible that one of our > > message pumps somehow interferes with the dialog interaction, e.g., by > > intercepting some of the messages that were supposed to wind up in our > > hook procedure? > > That seems like the most likely candidate. Do you have Spy++, or an > equivalent that can show the Windows messages going to and from your > sample program and the Open/Save dialog in Emacs? > > > Could it be due to the fact that our main message > > pump uses Unicode APIs, while the file selector uses ANSI APIs? > > Since that's quite a recent change, it should be easy to test by trying > an older version of Emacs on Windows 7. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.175 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4999] X-Debbugs-Envelope-To: 13065 Cc: 13065@debbugs.gnu.org, duyanning@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Jason Rumney > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > Date: Wed, 16 Jan 2013 20:23:19 +0800 > > Eli Zaretskii writes: > > > Failing that, I'm beginning to think that the problem is elsewhere in > > Emacs. But what could that be? Is it possible that one of our > > message pumps somehow interferes with the dialog interaction, e.g., by > > intercepting some of the messages that were supposed to wind up in our > > hook procedure? > > That seems like the most likely candidate. Do you have Spy++, or an > equivalent that can show the Windows messages going to and from your > sample program and the Open/Save dialog in Emacs? > > > Could it be due to the fact that our main message > > pump uses Unicode APIs, while the file selector uses ANSI APIs? > > Since that's quite a recent change, it should be easy to test by trying > an older version of Emacs on Windows 7. Yes, I also had the idea to check older versions. It was a good idea, because it allowed me to find the reason for the problem. It wasn't an interference between message pumps. It was memory. Here are the details. In preparation for Emacs 24.1, we changed the amount of memory we reserve at startup: where Emacs 23 asked the OS to reserve 256MB, we now try to reserve as much as possible, starting with 2GB and gradually decreasing the amount until the OS grants the request. On XP, we typically end up with 1.1 to 1.5GB, but on Windows 7 we get more: about 1.8GB. Now, when we launch the file selector dialog, Windows starts several threads in our process to support that (I see 4 threads on XP and between 6 and 7 on Windows 7). My guess is that with so much of the address space reserved, these threads fail to reserve enough memory for themselves, probably for their stack (which is set to 8MB in Emacs), and misbehave as result of that. We already had a similar problem with the threads we ourselves create to support subprocesses, see http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00119.html. In that case, we were able to fix the problem without decreasing the amount of memory we ask at startup. But here, these are threads that are started outside our control, so a similar solution is not possible, AFAIU. So, unless someone has a better idea, I will soon commit to the emacs-24 branch the patch shown below. It fixes the problem on Windows 7 and does not affect XP in any visible way. The initial amount of memory to reserve was found by trial and error. (After this patch, the original recipe still doesn't work: you need to type "abc" _after_ clicking "Desktop". But the same happens with Emacs 23, so I guess this is just a minor change in behavior of Windows 7.) === modified file 'src/w32heap.c' --- src/w32heap.c 2013-01-01 09:11:05 +0000 +++ src/w32heap.c 2013-01-16 18:34:38 +0000 @@ -98,7 +98,11 @@ allocate_heap (void) #ifdef _WIN64 size_t size = 0x4000000000i64; /* start by asking for 32GB */ #else - size_t size = 0x80000000; /* start by asking for 2GB */ + /* We used to start with 2GB here, but on Windows 7 that would leave + too little room in the address space for threads started by + Windows on our behalf, e.g. when we pop up the file selection + dialog. */ + size_t size = 0x68000000; /* start by asking for 1.7GB */ #endif void *ptr = NULL; From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 22 08:33:57 2013 Received: (at 13065-done) by debbugs.gnu.org; 22 Jan 2013 13:33:57 +0000 Received: from localhost ([127.0.0.1]:44395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxdzA-0007vm-Nw for submit@debbugs.gnu.org; Tue, 22 Jan 2013 08:33:56 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:62479) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Txdz9-0007vf-9i for 13065-done@debbugs.gnu.org; Tue, 22 Jan 2013 08:33:55 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MH100E0041WW200@a-mtaout22.012.net.il> for 13065-done@debbugs.gnu.org; Tue, 22 Jan 2013 15:32:25 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MH100E5L49YXE00@a-mtaout22.012.net.il>; Tue, 22 Jan 2013 15:32:22 +0200 (IST) Date: Tue, 22 Jan 2013 15:32:41 +0200 From: Eli Zaretskii Subject: Re: bug#13065: Bug in x-file-dialog with GetOpenFileName In-reply-to: <83fw217ycy.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: jasonr@gnu.org, duyanning@gmail.com Message-id: <83zk01mjgm.fsf@gnu.org> References: <83liddr5u8.fsf@gnu.org> <87pq1fhlbo.fsf@gnu.org> <83r4lvgydf.fsf@gnu.org> <87fw251bzq.fsf@gnu.org> <83boctrqg2.fsf@gnu.org> <83wqve8gsz.fsf@gnu.org> <87sj61uxjc.fsf@gnu.org> <83fw217ycy.fsf@gnu.org> X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > Date: Wed, 16 Jan 2013 20:54:05 +0200 > From: Eli Zaretskii > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > > So, unless someone has a better idea, I will soon commit to the > emacs-24 branch the patch shown below. It fixes the problem on > Windows 7 and does not affect XP in any visible way. The initial > amount of memory to reserve was found by trial and error. > > (After this patch, the original recipe still doesn't work: you need to > type "abc" _after_ clicking "Desktop". But the same happens with > Emacs 23, so I guess this is just a minor change in behavior of > Windows 7.) > > === modified file 'src/w32heap.c' > --- src/w32heap.c 2013-01-01 09:11:05 +0000 > +++ src/w32heap.c 2013-01-16 18:34:38 +0000 > @@ -98, 7 +98, 11 @@ allocate_heap (void) > #ifdef _WIN64 > size_t size = 0x4000000000i64; /* start by asking for 32GB */ > #else > - size_t size = 0x80000000; /* start by asking for 2GB */ > + /* We used to start with 2GB here, but on Windows 7 that would leave > + too little room in the address space for threads started by > + Windows on our behalf, e.g. when we pop up the file selection > + dialog. */ > + size_t size = 0x68000000; /* start by asking for 1.7GB */ > #endif > void *ptr = NULL; [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.172 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4997] X-Debbugs-Envelope-To: 13065-done Cc: 13065-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > Date: Wed, 16 Jan 2013 20:54:05 +0200 > From: Eli Zaretskii > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > > So, unless someone has a better idea, I will soon commit to the > emacs-24 branch the patch shown below. It fixes the problem on > Windows 7 and does not affect XP in any visible way. The initial > amount of memory to reserve was found by trial and error. > > (After this patch, the original recipe still doesn't work: you need to > type "abc" _after_ clicking "Desktop". But the same happens with > Emacs 23, so I guess this is just a minor change in behavior of > Windows 7.) > > === modified file 'src/w32heap.c' > --- src/w32heap.c 2013-01-01 09:11:05 +0000 > +++ src/w32heap.c 2013-01-16 18:34:38 +0000 > @@ -98,7 +98,11 @@ allocate_heap (void) > #ifdef _WIN64 > size_t size = 0x4000000000i64; /* start by asking for 32GB */ > #else > - size_t size = 0x80000000; /* start by asking for 2GB */ > + /* We used to start with 2GB here, but on Windows 7 that would leave > + too little room in the address space for threads started by > + Windows on our behalf, e.g. when we pop up the file selection > + dialog. */ > + size_t size = 0x68000000; /* start by asking for 1.7GB */ > #endif > void *ptr = NULL; [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.179.55.172 listed in list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4532] > Date: Wed, 16 Jan 2013 20:54:05 +0200 > From: Eli Zaretskii > Cc: 13065@debbugs.gnu.org, duyanning@gmail.com > > So, unless someone has a better idea, I will soon commit to the > emacs-24 branch the patch shown below. It fixes the problem on > Windows 7 and does not affect XP in any visible way. The initial > amount of memory to reserve was found by trial and error. > > (After this patch, the original recipe still doesn't work: you need to > type "abc" _after_ clicking "Desktop". But the same happens with > Emacs 23, so I guess this is just a minor change in behavior of > Windows 7.) > > === modified file 'src/w32heap.c' > --- src/w32heap.c 2013-01-01 09:11:05 +0000 > +++ src/w32heap.c 2013-01-16 18:34:38 +0000 > @@ -98,7 +98,11 @@ allocate_heap (void) > #ifdef _WIN64 > size_t size = 0x4000000000i64; /* start by asking for 32GB */ > #else > - size_t size = 0x80000000; /* start by asking for 2GB */ > + /* We used to start with 2GB here, but on Windows 7 that would leave > + too little room in the address space for threads started by > + Windows on our behalf, e.g. when we pop up the file selection > + dialog. */ > + size_t size = 0x68000000; /* start by asking for 1.7GB */ > #endif > void *ptr = NULL; No further comments, so I committed this to the emacs-24 branch (revision 111192), and I'm closing this bug report. From unknown Tue Aug 19 10:01:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Feb 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator