From: <ag...@us...> - 2012-01-05 21:50:20
|
Revision: 2659 http://zoolib.svn.sourceforge.net/zoolib/?rev=2659&view=rev Author: agreen Date: 2012-01-05 21:50:14 +0000 (Thu, 05 Jan 2012) Log Message: ----------- Fix win version Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp 2012-01-05 21:49:41 UTC (rev 2658) +++ trunk/zoolib/source/cxx/more/zoolib/netscape/ZNetscape_GuestFactory.cpp 2012-01-05 21:50:14 UTC (rev 2659) @@ -27,6 +27,7 @@ #include "zoolib/ZUnicode.h" #include "zoolib/ZUtil_CF.h" #include "zoolib/ZUtil_MacOSX.h" +#include "zoolib/ZUtil_Win.h" #include "zoolib/ZVal_CF.h" #if ZCONFIG_SPI_Enabled(CoreFoundation) @@ -70,6 +71,13 @@ P sLookup_T(HMODULE iHMODULE, const char* iName) { return reinterpret_cast<P>(::GetProcAddress(iHMODULE, iName)); } +static ZQ<int> spQGetMajorVersion(const UTF16* iNativePath) + { + if (ZQ<uint64> theQ = ZUtil_Win::sQGetVersion_File(iNativePath)) + return (*theQ) >> 48; + return null; + } + #endif // ZCONFIG_SPI_Enabled(Win) // ================================================================================================= @@ -223,7 +231,12 @@ { return fNPPluginFuncs; } ZQ<int> GuestFactory_Win::QGetMajorVersion() - { return spQGetMajorVersion(fHMODULE); } + { + vector<UTF16> buffer(1024); + if (0 <::GetModuleFileNameW(::GetModuleHandleW(nullptr), &buffer[0], buffer.size())) + return spQGetMajorVersion(&buffer[0]); + return null; + } #endif // ZCONFIG_SPI_Enabled(Win) @@ -494,15 +507,15 @@ #if ZCONFIG_SPI_Enabled(Win) if (iEarliest || iLatest) { - if (ZQ<uint64,false> theQ = sQGetVersion_File(iNativePath)) + if (ZQ<int,false> theQ = spQGetMajorVersion(ZUnicode::sAsUTF16(iNativePath).c_str())) { return null; } else { - int theMajor = *theQ; - if (iEarliest && *iEarliest > theMajor) + if (iEarliest && *iEarliest > *theQ) { return null; } - else if (iLatest && *iLatest < theMajor) + else if (iLatest && *iLatest < *theQ) { return null; } + } } if (HMODULE theHMODULE = ::LoadLibraryW(ZUnicode::sAsUTF16(iNativePath).c_str())) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |