**NOTE** In the process of researching this feature request it seems like
it might have already been implemented/fixed in Trunk due to changes on
Revision 25495 - 'Replace calls to "RUNDLL32 Shell32,OpenAs_RunDLL
(which is not officially documented!) with the official API
SHOpenWithDialog().' **However** this might be unintended and further more
is not in the latest released version
(1.8.7, Build 25475 - 64 Bit , 2014/05/05 20:52:12).
We would rather have the new functionality presented in Trunk, but thought
we'd give a heads up that you might be changing a little used feature just
in case you didn't intend to do so.
{{Summary}}
TortoiseSVN's Repository Browser offers in its context menu (activated by
right clicking an item) an "Open with..." command. We request that the
ability to select "Always use selected program to open this file" be
disabled by default (or optional with the default set to false).
The particular scenario we're trying to resolve is situations in which a
developer will browse to the repository using the browser and want to
investigate a small piece of code using a lighter weight editor and will
often forget to de-check this checkbox. In most cases the fix is easy;
however we recently have been burned by a situation in which the default
for batch files (*.bat) was reassigned to a text editor (which can be
resolved, but was a bit more intensive). There are valid work arounds but
we'd like to try and prevent the issue if possible. An internal poll has
showed that, at least in our use cases, the default of
"Always use selected program to open this file", is never used internally.
{{Evaluation}}
In Trunk the "Open with..." command now calls to the Windows SHOpenWithDialog
function (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762234%28v=vs.85%29.aspx)
to display the Open With dialog which allows the user to select a program
to open the file with. This function is passed a newly initialized
OPENASINFO structure (http://msdn.microsoft.com/en-us/library/windows/desktop/bb773363%28v=vs.85%29.aspx)
with an OPENASINFO structure set to OAIF_EXEC. The code in question is in
RepositoryBrowser.cpp starting at line 2280 as of revision 25661 (trunk).
Reading the Microsoft documentation it looks like the OPENASINFO structure
can have the OPEN_AS_INFO_FLAGS set such that OAIF_ALLOW_REGISTRATION is
set, which according to the documentation will:
"Enable the "always use this program" checkbox. If not passed, it will be disabled."
Apparently in previous versions of TortoiseSVN which utilized
"RUNDLL32 Shell32,OpenAs_RunDLL " this flag must have been passed. The new
version only passes OAIF_EXEC, which will execute the file after selection.
Further testing has shown that SHOpenWithDialog appears to be smart enough
that when passed a batch file (.bat) it will not allow you to change the
default registration, even if the OAIF_ALLOW_REGISTRATION flag is passed.
Even further it looks like the checkbox is disabled by default for other
file types which is the desired effect.
{{Reproducible?}}
Yes
{{Steps To Reproduce}}
Consider the following Test Programs (examples provided in C# using the
pInvoke signatures from pinvoke.net):
// Current Code as of Trunk:25661
OPENASINFO info = new OPENASINFO();
info.cszFile = @"R:\Test.txt";
info.oaifInFlags = OPEN_AS_INFO_FLAGS.OAIF_EXEC;
SHOpenWithDialog(IntPtr.Zero, ref info);
// Checkbox will be completely disabled
We can see that the dialog is presented and does not allow the user to
select from the "Always use selected program to open this file" this
behavior is acceptable, however is a change from previous versions of
TortoiseSVN (might be unexpected). Passing the OAIF_ALLOW_REGISTRATION
returns previous functionality:
// Code that restores previous functionality
OPENASINFO info = new OPENASINFO();
info.cszFile = @"R:\Test.txt";
info.oaifInFlags = OPEN_AS_INFO_FLAGS.OAIF_EXEC | OPEN_AS_INFO_FLAGS.OAIF_ALLOW_REGISTRATION;
SHOpenWithDialog(IntPtr.Zero, ref info);
// Checkbox will be avaliable but dechecked by default
However this doesn't restore the previous functionality completely, by
default the checkbox is not checked (which is considered a bonus
personally). Additionally this corner case, which caused us to research
the issue, is also fixed in this version:
// SHOpenWithDialog apparently checks to see if its a .bat file!
OPENASINFO info = new OPENASINFO();
info.cszFile = @"R:\Test.bat";
info.oaifInFlags = OPEN_AS_INFO_FLAGS.OAIF_EXEC | OPEN_AS_INFO_FLAGS.OAIF_ALLOW_REGISTRATION;
SHOpenWithDialog(IntPtr.Zero, ref info);
// Checkbox will be DISABLED!
This seems to give us the best of both worlds for our corner case.
{{Work Around}}
Until Trunk is released ensure that you do not check this checkbox, should
you accidently do this for a batch file you can navigate to
\HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\
and delete the "UserChoice" key. Any other file can use the "Open With"
command present in the Explorer context menu (this is disabled for batch
files).
{{Bug Previously Reported?}}
A search of the Mailing List has shown no previous report. However there
was a recent commit to Trunk (25495) which resolves the issue.
{{Version(s)}}
* 1.8.7, Build 25475 - 64 Bit , 2014/05/05 20:52:12
** Exhibits the behavior we want changed.
* Trunk
** Behaves as our feature requests, but removes previous
functionality (which was not important to us).
{{Contact}}
Reported on the vendors mailing list. If additional information is
required, it can be provided upon request via the mailing list.
{{Remarks}}
Thanks again for your hard work!
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3084905
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2014-07-10 21:21:46 CEST