解决 WinXP下 libcurl.dll 无法定位程序输入点GetTickCount64问题

1. 问题描述

用 IDA 打开libcurl.dll 可以在导入表看到对 GetTickCount64的引用,在 xp 的kernel32.dll中没有 GetTickCount64,

所以会出现 无法定位 GetTickCount64的问题

 

 

2. 解决方法

下载源码,自己编译libcurl.dll 
 
编译环境:
Win7 64位系统 + vs2015
 
2.1  下载源码

 

https://curl.haxx.se/download/curl-7.50.3.tar.gz

2.2   打开 Visual Studio 2015 x64 x86 兼容工具命令提示符

注释掉以下文件中和 GetTickCount64有关的代码

{CURL_SRC}\lib\timeval.c

 

struct timeval curlx_tvnow(void)
{
  /*
  ** GetTickCount() is available on _all_ Windows versions from W95 up
  ** to nowadays. Returns milliseconds elapsed since last system boot,
  ** increases monotonically and wraps once 49.7 days have elapsed.
  */
  struct timeval now;
<span >//#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
    (_WIN32_WINNT < _WIN32_WINNT_VISTA)</span>
  DWORD milliseconds = GetTickCount();
  now.tv_sec = milliseconds / 1000;
  now.tv_usec = (milliseconds % 1000) * 1000;
<span >/*#else
  ULONGLONG milliseconds = GetTickCount64();
  now.tv_sec = (long) (milliseconds / 1000);
  now.tv_usec = (long) (milliseconds % 1000) * 1000;
#endif*/</span>

  return now;
}

{CURL_SRC}\src\tool_util.c

 

 

struct timeval tool_tvnow(void)
{
  /*
  ** GetTickCount() is available on _all_ Windows versions from W95 up
  ** to nowadays. Returns milliseconds elapsed since last system boot,
  ** increases monotonically and wraps once 49.7 days have elapsed.
  **
  ** GetTickCount64() is available on Windows version from Windows Vista
  ** and Windows Server 2008 up to nowadays. The resolution of the
  ** function is limited to the resolution of the system timer, which
  ** is typically in the range of 10 milliseconds to 16 milliseconds.
  */
  struct timeval now;
<span >/*#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
  ULONGLONG milliseconds = GetTickCount64();
#else*/</span>
  DWORD milliseconds = GetTickCount();
<span >//#endif</span>
  now.tv_sec = (long)(milliseconds / 1000);
  now.tv_usec = (milliseconds % 1000) * 1000;
  return now;
}


为了让vs2015编译的程序能在xp下运行,,需要修改{CURL_SRC}\winbuild\MakefileBuild.vc

CFLAGS      = /I. /I ../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL <span >/D_USING_V110_SDK71_</span>

 

 

 

CURL_CFLAGS   =  /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c <span >/D_USING_V110_SDK71_</span>
CURL_LFLAGS   = /nologo /out:$(DIRDIST)\bin\$(PROGRAM_NAME) <span >/subsystem:console,"5.01"</span> /machine:$(MACHINE)


在 Visual Studio 2015 x64 x86 兼容工具命令提示符下输入命令;

 

nmake /f Makefile.vc mode=dll MACHINE=x86 ENABLE_WINSSL=no ENABLE_IDN=no ENABLE_SSPI=no

编译成功后在 {CURL_SRC}\builds 目录生成目标文件.

转载于:https://www.cnblogs.com/yan-shi-yi/p/5928844.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值