Solve the problem that libcurl. dll cannot locate the program Input Point GetTickCount64 in WinXP, and qq cannot locate libcurl.
1. Problem Description
Open libcurl. dll with IDA and you can see the reference to GetTickCount64 in the import table. In xp's kernel32.dll, there is no GetTickCount64,
Therefore, the GetTickCount64 cannot be located.
2. Solution: Download the source code and compile the libcurl. dll compiling environment by yourself: Win7 64-bit system + vs2015 2.1 Download the source code
Https://curl.haxx.se/download/curl-7.50.3.tar.gz
2.2 Open the Visual Studio 2015x64x86 compatible tool command prompt
Comment out the Code related to GetTickCount64 in the following file.
{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;}
To enable the program compiled by vs2015 to run in xp, You need to modify {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)
Enter the command at the command prompt of the Visual Studio 2015x64x86 compatible tool;
Nmake/f Makefile. vc mode = dll MACHINE = x86 ENABLE_WINSSL = no ENABLE_IDN = no ENABLE_SSPI = no
After compilation is successful, the target file is generated in the {CURL_SRC} \ builds directory.