程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> 解決 WinXP下 libcurl.dll 無法定位程序輸入點GetTickCount64問題,qq無法定位libcurl

解決 WinXP下 libcurl.dll 無法定位程序輸入點GetTickCount64問題,qq無法定位libcurl

編輯:關於C語言

解決 WinXP下 libcurl.dll 無法定位程序輸入點GetTickCount64問題,qq無法定位libcurl


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 目錄生成目標文件.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved