Closed Bug 133282 Opened 18 years ago Closed 18 years ago

Scan for plugins in their installation folders


(Core :: Plug-ins, defect, P1)

Windows XP





(Reporter: peterlubczynski-bugs, Assigned: peterl-bugs)



(Keywords: topembed+, Whiteboard: [ADT1] [m5+] [hitlist])


(3 files, 10 obsolete files)

28.65 KB, patch
: review+
: superreview+
Details | Diff | Splinter Review
13.21 KB, patch
: review+
: superreview+
Details | Diff | Splinter Review
29.59 KB, patch
: review+
: superreview+
Details | Diff | Splinter Review
On Windows, we currently have the problem of forcing users to re-install plugins
and/or copy DLLs if the browser is installed AFTER the plugin. One possible idea
is to locate some of these installed popular plugins via the Windows registry
and scan for them in their installed location. We currently have this option for
Sun JRE 1.3.x and this bug is about extending that to other plugins.
Attached patch possible patch? (obsolete) — Splinter Review
Here's a patch that implements some new prefs:

pref("plugin.do_Acrobat_Plugin_Scan", true);
pref("plugin.do_Quicktime_Plugin_Scan", true);
pref("plugin.do_WMP_Plugin_Scan", true);
pref("plugin.do_4x_PluginScan", true);
pref("plugin.do_JRE_Plugin_Scan", true);  (exisiting)

With this patch, when these prefs are trued on, we'll go search for plugins
from where they are installed at run-time like we already can do for Java. The
4.x pref controls scanning all, none, or filtered like we do now.

There is a bug 76015 which addressed the same issue,
and definitely we have to implement something like this,
the patch looks workable to me.
For now I have only one concern - performance.
Is it possible to cache installed plugins info at mozilla installation time, and 
do not scan the OS registry after that at all? 
nsPluginDirServiceProvider looks like a pure windoze stuff, so why not use
it only on windows? At least, why not put all those win-specific |if|s
undef single |#ifdef|? I mean  
if (some-crossplatform-stuff-if-any) {
#if defined (XP_WIN)
else if (win-only-stuff-1) {
} else if (win-only-stuff-2)

I think, the fewer |#ifdef|s, the better %-) 

OTOH, there is some plugin related stuff in xpcom/ds/XXXDirServiceProvider 
- can we use only nsPluginDirServiceProvider for plugin dir services (or, why we need plugin's own dir service provider?).

I'm not expert here, but I like bug 76015 approach more (put plugins in some
place instead of scanning registry).
Bug 76015 is a great place where we can track changes for the future, but it
does not help everyone who already has a plugin installed. Plus, asking plugin
vendors to change installers is not that trivial and takes a long time.

The patch in this bug will allow us to knock off some of the top plugins from
their exsiting installations. Therefore anyone, including embedding, can make
use of it without any installer foo. And there is some flexibility with the prefs.

Because of our plugin caching mechnism, I'm thinking this patch may not be that
much of a performance problem. Although cacheing in the appreg does need some
work in bug 109739 and the Windows registry may slow it down a bit, there aren't
that many extra files and checking time stamps isn't that expensive. I will
conduct some tests.
Keywords: patch
moving to 1.0.1, this patch will help prevent those issues where the plug-in is 
already installed on the system, but the application doesn't recognize that 
Priority: -- → P3
Target Milestone: --- → mozilla1.0.1
Firstly, this is a grotesquely undernominated bug.  This is an important
requirement for embedders such as the public AOL beta which pulls Mozilla, so
let's see some "+" "-)
Secondly, here's official scanning information from Adobe about the Acrobat
plugin, including details about i18n issues.  This was in response to my
question "does Adobe pre-emptively leave Netscape plugin DLLs on the Windows
desktop if there's no Netscape or Mozilla-based browser on the destkop?"

Yes it does.  For Acrobat, you can get the location from the following reg key:
HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe Acrobat\4.0\InstallPath
HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe Acrobat\5.0\InstallPath
HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe Acrobat\6.0\InstallPath
The default value under each of these keys is the path to the parent directory.
 It will look something like this:
C:\Program Files\Adobe\Acrobat 5.0\Acrobat
Append to it so you have this:
C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Browser\nppdf32.dll
Note that there are a total of 15 files - nppdf32.dll is the binary with
USEnglish resources.  There are 14 additional files containing the resources for
other languages.  You can get all of these in the same folder by using a
wildcard, "nppdf32.*"
Hope this helps. 
Keywords: nsbeta1, topembed
Priority: P3 → P1
Target Milestone: mozilla1.0.1 → mozilla1.0
Topembed+ per EDT triage.  Very important to embedding.
Keywords: topembedtopembed+
This particular issue has increased in importance, this will resolve the issues 
where the user is instructed to download a plug-in application, and after the 
install, they go back to the page where the plug-in instance is located and when 
they select it again, they are agian instructed to install the plug-in 
Keywords: nsbeta1nsbeta1+
Whiteboard: [ADT1]
Stop ship for commercial release. 
NP parsing of the xpcom components directory should be disabled in the mozilla
build.  I suggest using some build flag magic which the commercial build (or any
build for that matter) can set to enable this hack.  

I don't want to promote nor support np-style plugins in the xpcom components
directory.  This leads to confusion as to where exactly plugins should be place.  
The problems raised in Bugscape 14100 will be solved by "NP parsing" in Netscape
commercial browsers of the Components directory.  
This bug seems to have morphed.  The installation folders referred to in the
summary are not the same as the xpcom components folder.  In particular, the
existing patch is nothing like an "NP parsing" solution.  Are we in the right
bug with this parsing stuff?
Whiteboard: [ADT1] → [ADT1] [m5+]
*** Bug 140042 has been marked as a duplicate of this bug. ***
Whiteboard: [ADT1] [m5+] → [ADT1] [m5+] [hitlist]
Attached patch patch v.2 (obsolete) — Splinter Review
Alrighty, this patch has some new features (all controled by prefs):

* Scan for nppl3260.dll in a special, one-off hack, in the components folder
(do not do this if we've already found the Real mime-type elsewhere, like
perhaps with Real One in the plugins folder). This is on by default in all
builds, use a pref to turn off explicity.

* Scan the the latest JRE installed. With the JRE pref turned on, no longer
need to sync DLL's with the browser. We'll go and find the newest one, whatever
that may be, in its installation directory. Tested situation where 1.3.1_02
DLL's are in plugins folder and we STILL use 1.4 from it's installed location.
No DLL copying or regxpcom needed here, all these "features" are run-time
sweeps. This solves the "first-install" problem for Java.

* Scan for Quicktime, whatever version (only 1 can be installed at a time), in
its install directory. This should fix the missing QT DLL problem as well as
fix the QT control panel to actually correctly re-write the mime types in the
version table. This solves the "first-install" problem for Quicktime.

* Scan for Acrobat 5.0 in its installed location. It's hard-coded for 5.0, will
fix if time permits. This solves the "first-install" problem for Acrobat 5.

* Scan for Windows Media Player in its installed location. We'll pick whatever
version is there. I have not implemented a manditory version yet. This solves
the "first-install" problem for WMP.

* 4.x folder now has a pref. By default, with the pref missing, NOTHING HAS
CHANGED. You can now add this pref to control if all or none of the plugins for
the 4.x folder are scanning. This is here for QA and the Mozilla community to
test the feasibility of allowing all plugins in future expansion.

* Do we want to limit the version of the plugin we sweep for? It's a little
more work and different for each plugin. How much time is left? Please advise
on what approach to take.

* Testing, testing, testing....It would be helpful it people could run with
this patch on all falvors fo Windows and all sorts of plugins. Version and OS
matter here. I'll turn on file sharing on my machine if QA would like to run my
debug build on different configurations.
Attachment #75979 - Attachment is obsolete: true
CCing myself.

when this lands will it find nppl3260.dll in a netscape 4.x plugins directory?
No! We NEVER sweep for Real in the 4.x folder. 

We have a new problem now -- Real's installer is not finding Netscape because
we've changed some registry keys. For my full dissertation, see:

Patch v.2 might be obsolete if Real isn't going to be dropping the DLL in the
components folder.
We dicussed the fact that the fix for 12512 would be obsoleted when this lands.
 Once this gets in file a new bug on me and I'll take out it back out.  
*** Bug 140766 has been marked as a duplicate of this bug. ***
Who can review and super review?
Whiteboard: [ADT1] [m5+] [hitlist] → [ADT1] [m5+] [hitlist] [needs r=/sr=/approval]
I will review it today.
Attached patch patch v.3 (obsolete) — Splinter Review
New and improved patch:

 * By popular demand from embedding vendors, you can now specify a minimum
version for either JRE, WMP, Acrobat, or Quicktime for these "extra" scan prefs

 * New pref names:

+pref("plugin.scan.SunJRE", "1.3");
+pref("plugin.scan.Acrobat", "5.0");
+pref("plugin.scan.Quicktime", "5.0");
+pref("plugin.scan.WindowsMediaPlayer", "7.0");
+pref("plugin.do_4x_PluginScan", false);

For example, some versions of WMP 6.4 may crash. By specifying this pref, we
can limit to only 7.0 and above WMP:
pref("plugin.scan.WindowsMediaPlayer", "7.0");

Note: This "feature" is only for this extra pref scanning. If we find the
plugin DLL elsewhere, we'll use it.

Versioning is done differently for each plugin:
 * For QT and WMP, we actually look up the player's EXE and read the version
 * For Acrobat and JRE, we look in the registry at key values

Note: This patch removes the old plugin.do_JRE_Scan pref. Use this instead:
pref("plugin.scan.SunJRE", "1.3");

Please review/comment/test out.
Attachment #81215 - Attachment is obsolete: true
Comment on attachment 81534 [details] [diff] [review]
patch v.3

Looks like our plugin scanning architecture is approaching its limits.
Implementing new demands makes the code more and more ugly. Codewise it looks
fine to me, you can take it as r=av, but we should probably redesign it in the

Before you do anything esle would you please fix tabs to be 2 space chars?

Is my understanding correct that we no longer do 4x sweep by default?
Attachment #81534 - Flags: review+
Who should sr= this?
Whiteboard: [ADT1] [m5+] [hitlist] [needs r=/sr=/approval] → [ADT1] [m5+] [hitlist] [needs sr=/approval]
Attached patch patch v.4 (obsolete) — Splinter Review
Updated the patch from testing:

* Changed default indenting in nsPluginDirServiceProvider.cpp back to two
* Fixed problems finding Acrobat (can be in either 'Acrobat' or 'Reader' keys)
* Fixed leaking string in GetKeyValue
* other little nits
Attachment #81534 - Attachment is obsolete: true
Default 4.x folder sweeping has not changed. This patch now adds the option to
turn off filtering or completely shut it off.
Comment on attachment 81735 [details] [diff] [review]
patch v.4

Attachment #81735 - Flags: review+
Comment on attachment 81735 [details] [diff] [review]
patch v.4

Attachment #81735 - Flags: superreview+
Blocks: 121324
adding adt1.0.0+.  Please get drivers approval and then check into the branch as
soon as possible and add the fixed1.0.0 keyword.
No longer blocks: 121324
Keywords: adt1.0.0+
Blocks: 121324
This is the patch (v.5) that went into the trunk. It's been merged to the tip
(and with darin's NS_NewNativeLocalFile changes). As of right now, patch v.4
should apply to the 1.0 branch.
Attachment #81819 - Flags: superreview+
Attachment #81819 - Flags: review+
Patch in trunk, marking FIXED and requesting Mozilla Driver's approval.
Closed: 18 years ago
Keywords: approval
Resolution: --- → FIXED
Whiteboard: [ADT1] [m5+] [hitlist] [needs sr=/approval] → [ADT1] [m5+] [hitlist] [needs drivers approval][patch in trunk]
Comment on attachment 81788 [details] [diff] [review]
patch v.4  (whitespace stripped version)

a=asa (on behalf of drivers) for checkin to the 1.0 branch
Attachment #81788 - Flags: approval+
Whiteboard: [ADT1] [m5+] [hitlist] [needs drivers approval][patch in trunk] → [ADT1] [m5+] [hitlist] [ETA 05/02][needs a=][patch in trunk]
This doesn't work for me for Windows Media Player.
I have US English wmplayer.exe Build
I'm running Windows XP Pro.
I stepped through the code and here is what I found:

The way used to get file version is wrong. The file version is stored in a
VERSION resource which has 2 parts: one is language dependant and the other one
is language neutral. This code (trunk patch v5) uses the language dependant part
and the language is hardcoded to 040904b0 (Unicode US English) for quicktime and
040904E4 (ANSI US English) for WMP. This is not good. For correct way of getting
the file version and doing file version comparisons see (for instance) :

Specifically, all you need is in 3 functions:


I suggest that you :

1) use TranslateVersionStr() on pref strings
2) use GetFileVersion() to get the file version in a language independant way
3) use CompareVersion() to detect the plugin

This applies to quicktime plugin and WMP plugin

A temporary fix that works for me is to replace the line:
PL_strcpy(wmpVer, GetKeyValue(verbuf, \\StringFileInfo\\040904E4\\FileVersion"));
PL_strcpy(wmpVer, GetKeyValue(verbuf, \\StringFileInfo\\040904b0\\FileVersion"));

obviously this won't work for anyone but it can help ...

PL_strcpy(qtVer, GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileVersion"));

PL_strcpy(qtVer, GetKeyValue(verbuf, "\\StringFileInfo\\040904b0\\FileVersion"));

Plugin import that works in 1st may build (for win32) :

Java RE 1.4.0
Quicktime 5.0.2
Adobe Acrobat

Great !

What about : Real and windows media player ?
For NS folks, adding that Bugscape 14100 is a dup of this and should be verified
when this is fixed.
windows media player is supposed to work !
(See my comments)

what OS and what wmplayer.exe version are you using ?
Attached patch patch v.5.1 (obsolete) — Splinter Review
Here is a new patch for the trunk. It fixes the problem of language dependancy
when comparing version information on Windows. Please review.
Reopening for new trunk patch
Keywords: approval
Resolution: FIXED → ---
Whiteboard: [ADT1] [m5+] [hitlist] [ETA 05/02][needs a=][patch in trunk] → [ADT1] [m5+] [hitlist] [ETA 05/02]
In answert to comment #37

Using WinXP, so Windows Media Player 8.0

Copied npdsplay.dll in my mozilla plugins folder.
I've applied the patch and rebuilt
It looks good.

Something strange:
my breakpoints are not hit anymore so I couldn't see the code in action
Are the plugins cached ?
I removed registry.dat with no success

Anyway I have QuickTime and WMP correctly detected. Thanks !

A few remarks reading the code:

1) macros HIDWORD and LODWORD are not used. they can be removed

2) struct structVer:

ULONGLONG can be replaced by WORD safely
"ull" prefix then should be "w"

3) FileExists()

should return a BOOL 
GetFileAttributes() does not return an HRESULT but a DWORD

the function should just be
"return GetFileAttributes(szFile) != INVALID_FILE_ATTRIBUTES;"

4) in various places LPSTR should be LPCSTR

5) GetFileVersion()

user ClearVersion() instead of zeroing members
malloc(sizeof(long)*dwLen) should be malloc(dwLen)

6) CopyVersion()

parameter "verBlock ver2" should be "verBlock *ver2"
why push a struct by value on the stack ?
change code accordingly

7) TranslateVersionStr()

strtok: I thought it was evil :-)
why not use strchr() instead ?
and replace atoi64 by atoi if ULONGULONG is now WORD

8) Now I think that verBlock should be a class :-)
just to avoid future mistakes, in comment #1 you write:
pref("plugin.do_4x_PluginScan", true);
but in fact it is (in winpref.js):
pref("plugin.scan.4xPluginFolder", false);
is this correct ?

Attached patch patch v.5.2 (obsolete) — Splinter Review
Okay, I made half of your changes. Some the compiler didn't like, others (like
strtok) are probably okay in how they are used here. Please review.

Yes, plugins are "cached". You may need to 'touch' them.

Yes, I made a mistake in my comment in the bug. The pref name is indeed
Attachment #81903 - Attachment is obsolete: true
Attached patch patch v.5.3 (obsolete) — Splinter Review
oops, forgot to remove the useless macros.
Attachment #81939 - Attachment is obsolete: true
Attached patch patch v.6 (branch patch) (obsolete) — Splinter Review
This is a complete patch for the 1.0 branch, merged to the 1.0 tip, with the
changes that are already in the trunk (v.5) and the new changes (v.5.3).
Attachment #81735 - Attachment is obsolete: true
Attachment #81788 - Attachment is obsolete: true
Comment on attachment 81940 [details] [diff] [review]
patch v.5.3

I would really like to see all the helper functions for version manipulating
members of some class. I understand we have little time now so at least make
them |static|. With this change and filing a new bug on cleaning this up --
Attachment #81940 - Flags: review+
Comment on attachment 81950 [details] [diff] [review]
patch v.6 (branch patch)

My comments in previous attachment apply here too. r=av.
Attachment #81950 - Flags: review+
New trunk patch with statics. Will open new bug on making a file version class.
Attachment #81940 - Attachment is obsolete: true
Attachment #81954 - Flags: review+
Attached patch patch 6.1 (branch patch) (obsolete) — Splinter Review
Attachment #81950 - Attachment is obsolete: true
Attachment #81956 - Attachment is obsolete: true
Attachment #81957 - Flags: review+
Keywords: review
Whiteboard: [ADT1] [m5+] [hitlist] [ETA 05/02] → [ADT1] [m5+] [hitlist] [ETA 05/02][needs sr=]
Looks good (still) :-)
I've just tried patch 5.4 (trunk patch) on another machine (Windows 2000)
and I can see that WMP, QuickTime, JRE, Flash (from Netscape 4), Acrobat
are all detected in their respective locations.

Comment on attachment 81954 [details] [diff] [review]
patch 5.4 (trunk patch)

check the malloc return in
lpData = (LPVOID)malloc(dwLen);
Attachment #81954 - Flags: superreview+
Comment on attachment 81957 [details] [diff] [review]
patch 6.1 (branch patch)

Attachment #81957 - Flags: superreview+
Comment on attachment 81957 [details] [diff] [review]
patch 6.1 (branch patch)

a=asa (on behalf of drivers) for checkin to the 1.0 branch. (re-approval)
Attachment #81957 - Flags: approval+
Peter - Pls check this in today, and add the fixed1.0.0 keyword ... and be ADT
free!!! :-)
Whiteboard: [ADT1] [m5+] [hitlist] [ETA 05/02][needs sr=] → [ADT1] [m5+] [hitlist] [ETA 05/02]
patch in trunk and 1.0 branch, marking FIXED and adding fixed1.0.0

Thanks all!
Closed: 18 years ago18 years ago
Keywords: fixed1.0.0
Resolution: --- → FIXED
Whiteboard: [ADT1] [m5+] [hitlist] [ETA 05/02] → [ADT1] [m5+] [hitlist]
sorry for the spam, patch mentions Windows Media Player 7.0.
However, 7.1 is required, 7.0 won't work, see bug 104506.
I might be wrong but I want to be sure as this is to be in release 1.0.
WMP 7.0 WFM on my machine and those I tested. I could not find a bug
specifically on WMP 7.0 (I think bug 66015 is about 6.4 or maybe fixed) not
working so please open a new one so we can track this issue individually and
determine the root cause of this failure.
In answer to comment #37 (and final comment for this comment !)

Windows Media Player 8.0 (aka XP) is recognized and working fine with 2002050304
trunk build ;-)
Thanks for all the help in verification,guys. This works nicely on today's 
branch 0503 build on winnt/98/xp.
Keywords: verified1.0.0
Blocks: 141840
No longer blocks: 141840
*** Bug 143013 has been marked as a duplicate of this bug. ***
*** Bug 142980 has been marked as a duplicate of this bug. ***
*** Bug 119056 has been marked as a duplicate of this bug. ***
works on the trunk as well. (0812)
Can the patch added to later version of Mozilla?
Depends on: 1317108
Depends on: 1317109
Depends on: 1317110
You need to log in before you can comment on or make changes to this bug.