当前位置:网站首页>VS2005 compiles libcurl to normaliz Solution of Lib missing
VS2005 compiles libcurl to normaliz Solution of Lib missing
2022-06-26 08:28:00 【Tonyfield】
The recommended method is to curl of use dll Method implementation of IdnToAscii and IdnToUnicode, May refer to https://www.cnblogs.com/passedbylove/p/5979927.html. The following is based on curl 7.69.1 Modification of , It's no different from the modification of the original text , Just use ONLY_NORMALIZ_DLL Control the code , Convenient back .
You can also add... Directly to the system Windows SDK v7.1, It contains Normaliz.lib, Then it will correspond to library route (C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib) Add project configuration .
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/*
* IDN conversions using Windows kernel32 and normaliz libraries.
*/
#include "curl_setup.h"
#ifdef USE_WIN32_IDN
#define ONLY_NORMALIZ_DLL
#include "curl_multibyte.h"
#include "curl_memory.h"
#include "warnless.h"
/* The last #include file should be: */
#include "memdebug.h"
#ifdef WANT_IDN_PROTOTYPES
# if defined(ONLY_NORMALIZ_DLL)
typedef int (*fnIdnToAscii)(DWORD,const WCHAR *,int,WCHAR *,int);
typedef int (*fnIdnToUnicode)(DWORD,const WCHAR *,int,WCHAR *, int);
# elif defined(_SAL_VERSION)
WINNORMALIZEAPI int WINAPI
IdnToAscii(_In_ DWORD dwFlags,
_In_reads_(cchUnicodeChar) LPCWSTR lpUnicodeCharStr,
_In_ int cchUnicodeChar,
_Out_writes_opt_(cchASCIIChar) LPWSTR lpASCIICharStr,
_In_ int cchASCIIChar);
WINNORMALIZEAPI int WINAPI
IdnToUnicode(_In_ DWORD dwFlags,
_In_reads_(cchASCIIChar) LPCWSTR lpASCIICharStr,
_In_ int cchASCIIChar,
_Out_writes_opt_(cchUnicodeChar) LPWSTR lpUnicodeCharStr,
_In_ int cchUnicodeChar);
# else
WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
const WCHAR *lpUnicodeCharStr,
int cchUnicodeChar,
WCHAR *lpASCIICharStr,
int cchASCIIChar);
WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags,
const WCHAR *lpASCIICharStr,
int cchASCIIChar,
WCHAR *lpUnicodeCharStr,
int cchUnicodeChar);
# endif
#endif
#define IDN_MAX_LENGTH 255
bool curl_win32_idn_to_ascii(const char *in, char **out);
bool curl_win32_ascii_to_idn(const char *in, char **out);
bool curl_win32_idn_to_ascii(const char *in, char **out)
{
bool success = FALSE;
wchar_t punycode[IDN_MAX_LENGTH];
int chars = -1;
wchar_t *in_w = Curl_convert_UTF8_to_wchar(in);
if(in_w) {
#ifdef ONLY_NORMALIZ_DLL
fnIdnToAscii IdnToAscii;
HINSTANCE hNormalizDLL = LoadLibrary("normaliz.dll");
if (!hNormalizDLL) {
// FreeLibrary(hNormalizDLL);
assert(hNormalizDLL);
return FALSE;
}
IdnToAscii = (fnIdnToAscii)GetProcAddress(hNormalizDLL, "IdnToAscii");
if (!IdnToAscii) {
FreeLibrary(hNormalizDLL);
assert(IdnToAscii);
return TRUE;
}
#endif
chars = IdnToAscii(0, in_w, -1, punycode, IDN_MAX_LENGTH);
#ifdef ONLY_NORMALIZ_DLL
free(IdnToAscii);
FreeLibrary(hNormalizDLL);
#endif
free(in_w);
if(chars) {
*out = Curl_convert_wchar_to_UTF8(punycode);
if(*out)
success = TRUE;
}
}
return success;
}
bool curl_win32_ascii_to_idn(const char *in, char **out)
{
bool success = FALSE;
int chars = -1;
wchar_t *in_w = Curl_convert_UTF8_to_wchar(in);
if(in_w) {
size_t in_len = wcslen(in_w) + 1;
wchar_t unicode[IDN_MAX_LENGTH];
#ifdef ONLY_NORMALIZ_DLL
fnIdnToUnicode IdnToUnicode;
HINSTANCE hNormalizDLL = LoadLibrary("normaliz.dll");
if (!hNormalizDLL) {
// FreeLibrary(hNormalizDLL);
assert(hNormalizDLL);
return FALSE;
}
IdnToUnicode = (fnIdnToUnicode)GetProcAddress(hNormalizDLL, "IdnToUnicode");
if (!IdnToUnicode) {
FreeLibrary(hNormalizDLL);
assert(IdnToUnicode);
return FALSE;
}
#endif
chars = IdnToUnicode(0, in_w, curlx_uztosi(in_len),
unicode, IDN_MAX_LENGTH);
#ifdef ONLY_NORMALIZ_DLL
free(IdnToUnicode);
FreeLibrary(hNormalizDLL);
#endif
free(in_w);
if(chars) {
*out = Curl_convert_wchar_to_UTF8(unicode);
if(*out)
success = TRUE;
}
}
return success;
}
#endif /* USE_WIN32_IDN */Reference code :
边栏推荐
- 73b2d wireless charging and receiving chip scheme
- Deploy wiki system Wiki in kubesphere JS and enable Chinese full-text retrieval
- Leetcode22 summary of types of questions brushing in 2002 (XII) and collection search
- Using transformers of hugging face to realize text classification
- Use a switch to control the lighting and extinguishing of LEP lamp
- 批量执行SQL文件
- (5) Matrix key
- Stream analysis of hevc learning
- Read excel table and render with FileReader object
- Project practice: parameters of pycharm configuration for credit card digital recognition and how to use opencv in Anaconda
猜你喜欢

(4) Independent key
![[postgraduate entrance examination] group planning exercises: memory](/img/ac/5c63568399f68910a888ac91e0400c.png)
[postgraduate entrance examination] group planning exercises: memory

Reflection example of ads2020 simulation signal

Oracle 19C download installation steps

(2) Buzzer

Idea automatically sets author information and date

Rewrite string() method in go language

Recognize the interruption of 80s51

FFmpeg音视频播放器实现

Read excel table and render with FileReader object
随机推荐
Software engineering - high cohesion and low coupling
(5) Matrix key
loading view时,后面所有东西屏蔽
[postgraduate entrance examination: planning group] clarify the relationship among memory, main memory, CPU, etc
1GHz active probe DIY
Application of wireless charging receiving chip xs016 coffee mixing cup
Esp8266wifi module tutorial: punctual atom atk-esp8266 for network communication, single chip microcomputer and computer, single chip microcomputer and mobile phone to send data
Use of jupyter notebook
FFmpeg音视频播放器实现
How to debug plug-ins using vs Code
教你几招:30句哄女孩的“霸道”温馨话,不看后悔!
Necessary protection ring for weak current detection
Embedded Software Engineer (6-15k) written examination interview experience sharing (fresh graduates)
Ltp-- extract time, person and place
Win10 mysql-8.0.23-winx64 solution for forgetting MySQL password (detailed steps)
Pychart connects to Damon database
Opencv learning notes II
OpenCV Learning notes iii
GHUnit: Unit Testing Objective-C for the iPhone
2020-10-29