解决FileZilla服务器端0.9.60版本无法启动的问题

在Windows 7系统下无法运行官网下载的FileZilla Server,版本号是0.9.60

双击FileZilla Server Interface.exe会报错:

Could not load TLS libraries. Aborting start of administration interface.

看到这个提示信息,很明确是加载SSL的动态库失败了,但是程序目录下面,明明有ssleay32.dll和libeay32.dll。

为什么会加载失败呢?

好在FileZilla是开源软件,下载软件包还自带源代码,所以去源代码找到了加载过程:

首先搜索报错提示,定位到了FileZilla server.cpp第103行,其中相关源码如下:


	auto sslLoader = std::make_unique<CAsyncSslSocketLayer>(0);
	if (sslLoader->InitSSL() != 0) {
		AfxMessageBox(_T("Could not load TLS libraries. Aborting start of administration interface."), MB_ICONEXCLAMATION);
		return false;
	}

继续跟踪InitSSL函数,定位到AsyncSslSocketLayer.cpp第318行,关键代码如下:

int CAsyncSslSocketLayer::InitSSL()
{
	if (m_bSslInitialized)
		return 0;

	simple_lock lock(m_mutex);

	if (!m_nSslRefCount) {
		if (!m_sslDll2.load(_T("libeay32.dll"))) {
			return SSL_FAILURE_LOADDLLS;
		}

		bool bError = false;
		proc(m_sslDll2, BIO_ctrl_pending);
		proc(m_sslDll2, BIO_read);
		proc(m_sslDll2, BIO_ctrl);
		proc(m_sslDll2, BIO_write);
        /*以下代码太多,不列出来了。*/
}

失败信息来自m_sslDll2.load函数,于是继续定位到dll.cpp第18行,代码如下:

bool DLL::load(CString const& s)
{
	clear();
	hModule = LoadLibraryEx(s, 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
	return hModule != 0;
}

问题的关键就在于这个LoadLibraryEx函数,在MSDN找到函数描述:

LOAD_LIBRARY_SEARCH_APPLICATION_DIR

0x00000200

If this value is used, the application's installation directory is searched for the DLL and its dependencies. Directories in the standard search path are not searched. This value cannot be combined withLOAD_WITH_ALTERED_SEARCH_PATH.

Windows 7, Windows Server 2008 R2, Windows Vista and Windows Server 2008:  This value requires KB2533623 to be installed.

Windows Server 2003 and Windows XP:  This value is not supported.

参考链接:https://docs.microsoft.com/zh-cn/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibraryexa

LOAD_LIBRARY_SEARCH_APPLICATION_DIR标志加载应用程序目录下面的dll文件,

Win7以上系统则需要安装补丁KB2533623。

 

由于不想安装系统补丁,所以采取了修改代码的方式,去掉LOAD_LIBRARY_SEARCH_APPLICATION_DIR标志。

那么LoadLibraryEx的行为就和LoadLibrary一致,使用默认的搜索路径,则可以成功加载libeay32.dll

但是又发现它提供的源码是高版本VS编译的,本机只有VS2005,没法直接编译。

于是只能修改反汇编了。

反汇编修改过程中,顺便修改了默认xml配置文件的名字,默认配置文件名是FileZilla Server.xml和FileZilla Server Interface.xml

这两个文件都有空格,会有诸多不便,所以去掉文件名的空格,改为FileZillaServer.xml和FileZillaServerUI.xml。

顺便提供修正后的文件供有需要的朋友下载:

下载地址:https://download.csdn.net/download/qq446252221/11259439

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值