![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
leechiyang
这个作者很懒,什么都没留下…
展开
-
反转一个整数 递归/原创
#include int MaxPower(int x){ if(x/10 == 0) return 1; else return 10 * MaxPower(x / 10);}int Convert(int x){ if(x return x; else return x % 10 * MaxPower(x) + Convert(x / 10);}main(){ printf("%原创 2005-12-06 17:23:00 · 1462 阅读 · 0 评论 -
解决exe和DLL直接传递FILE 指针崩溃的问题。
EXE程序和DLL之间可能传递FILE指针,但是可能会造成程序崩溃。这是由于_lock_file引起的void __cdecl _lock_file ( FILE *pf ){ /* * The way the FILE (pointed to by pf) is locked depends on whether原创 2011-10-14 16:31:01 · 2872 阅读 · 0 评论 -
Diagnosing Hidden ODR Violations in Visual C++
http://blogs.msdn.com/b/vcblog/archive/2007/05/17/diagnosing-hidden-odr-violations-in-visual-c-and-fixing-lnk2022.aspx Hi, my name is Andy Rich, and I’m a tester on the front-end compiler. Last ti转载 2012-02-12 21:44:34 · 736 阅读 · 0 评论 -
parseurl
int parseurl(char * url, char * protocol, char * host, char * port, char * path){ int n = sscanf(url, "%15[^\n:]://%[^\n/?]%[^\n]", protocol, host, path); char * p = strchr(host, ':'); if (p) {原创 2012-03-12 22:08:20 · 945 阅读 · 0 评论 -
VC++2010 关键变化 (Breaking Changes in Visual C++ 2010 )
Breaking Changes in Visual C++Visual Studio 2010 Other Versions Visual Studio 20083 out of 5 rated this helpful- Rate this topicThis document lists t转载 2012-05-11 22:03:34 · 1665 阅读 · 0 评论 -
在Openssl中增加自定义算法
openssl具备良好的扩展机制,可以加入自定义的算法,通过修改编译脚本,可以使实现自己的算法与openssl原有的算法无缝集成,浑然一体。其过程主要还在于观测ms/do_ms的过程通过修改util/mkfiles.pl 文件,可以加入自定义算法的目录,算法目录中包含Makefile文件,会根据makefile中的步骤进行编译。修改util/mkdef.pl文件,在里面加入自己的头文件原创 2012-05-20 11:43:36 · 1843 阅读 · 0 评论 -
百度音乐盒播放器
喜欢听百度的音乐,但是使用浏览器听音乐时,浏览器会占用任务栏的位置,影响工作。花了一下午给百度音乐盒做了个壳,播放时,可以最小化到任务托盘。音乐盒中的广告太碍事了,影响美观,顺便去掉广告,呵呵。 下载地址:http://download.csdn.net/detail/leechiyang/5017324 1.01版发布了,支持调整窗口大小。 2013.1.22 日原创 2013-01-21 23:45:21 · 1016 阅读 · 0 评论 -
C/C++可变参数宏
c语言支持可变参数宏,从此再也不用定义TRACE0/TRACE1/TRACE2一类的宏了。 #define P(...) printf(__VA_ARGS__)__VA_ARGS__可以用来引用传递的可变参数部分。 可以如此使用此宏:P("helllo"); P("%s","hello"); P("%s %d", "hello", 2013);原创 2013-01-18 18:31:12 · 724 阅读 · 0 评论 -
获取当前时区
/*返回本地时间与UTC时间之间的秒差。本函数主要为了解决跨平台问题,功能和MSVCRT中的_get_timezone相同。*/int get_timezone() { struct tm tm; memset(&tm, 0, sizeof(tm)); tm.tm_year = 70; tm.tm_mday = 2; return 24 * 3600 - (int)mktime(&原创 2013-03-09 10:04:24 · 1199 阅读 · 0 评论 -
Openssl v3证书 配置文件。
## OpenSSL example configuration file.# This is mostly being used for generation of certificate requests.## This definition stops the following lines choking if HOME isn't# defined.HOME原创 2013-05-22 17:48:46 · 4259 阅读 · 0 评论 -
UTF8转换宏和转换类
参考微软 ANSI和WCHAR的转换代码,编写的UTF8和ANSI、WCHAR转换代码。可在ATL/MFC环境下使用。原创 2010-12-20 20:53:00 · 3465 阅读 · 0 评论 -
wchar_t 转换UTF16编码
wchar_t在Windows下的是utf16编码,Linux下面则是utf32编码,有些时候这些不同会带来代码移植问题。下列转换宏提供了从wchar_t 到UTF16编码的转换 #ifdef WIN32#define USES_WCSUTF16_CON原创 2011-04-27 13:21:00 · 3540 阅读 · 1 评论 -
C/C++ 语言兼容的动态数组
/************************************************************************//* filename : vect.h原创 2011-04-02 16:50:00 · 761 阅读 · 0 评论 -
打开数字证书命令行
rundll32 CryptExt.dll,CryptExtOpenCER cert.cer原创 2006-03-02 13:12:00 · 2466 阅读 · 0 评论 -
URL字符串解析(UrlDecode vc)
#define IsHexNum(c) ((c >= 0 && c = A && c = a && c CString Utf8ToStringT(LPSTR str){ _ASSERT(str); USES_CONVERSION; WCHAR *buf; int length = MultiByteToWideChar(CP_UTF8, 0, str原创 2008-02-22 11:42:00 · 6768 阅读 · 2 评论 -
OPENSSL Base64编码和解码
BOOL Base64Encode(unsigned char *pData, int nLeng, int linebreaks, char * pOutBufffer, int *pBufferLenth){ int res = FALSE; BIO *bmem, *b64; BUF_MEM *bptr; b64 = BIO_new(BI原创 2009-12-17 14:53:00 · 3077 阅读 · 0 评论 -
如何删除系统中的 .inf 文件
本文列出了一些步骤和提示,可帮助 OEM 驱动程序开发人员编写能从系统中安全删除 .inf 文件的"卸载"程序包。您需要具有管理凭据才能完成这些步骤。转载 2010-11-15 10:03:00 · 4751 阅读 · 0 评论 -
64 Bit Development with vc2003
64 Bit DevelopmentIntroductionNote: these notes were written for Visual Studio 2003. Visual Studio 2005 has built in support for developing 64 bit applications so if oyu have the latest Visual Studio these notes are not needed. I have a AMD 64 dual core m转载 2010-11-22 16:10:00 · 768 阅读 · 0 评论 -
openssl 验证证书是否是某个CA证书签发
int VerifyCertByIssuer(X509 *cert, X509 *issuer){ int res = 0; EVP_PKEY *pubkey = 0; if (X509_check_issued(issuer, cert) != X509_V_OK) { goto end; } pubkey = X509_get_pubkey(issuer); if (!X509_verify(cert, pubkey)) { goto end; }原创 2011-02-23 11:56:00 · 3190 阅读 · 0 评论 -
检测证书是否有密钥用法
<br />int CheckCertKeyUsage(X509 *cert, int keyUsage, int exKeyUsage){ int res = 0; X509_check_purpose(cert, -1, 0); if (keyUsage && ((cert->ex_kusage & keyUsage) != keyUsage)) { goto end; } if (exKeyUsage && ((cert->ex_xkusage & exKeyUsag原创 2011-02-23 12:04:00 · 3504 阅读 · 0 评论 -
Openssl验证数字签名
验证SHA1-RSA签名。int VerifySignature(X509 * cert, unsigned char * data, int datalen, unsigned char * sign, int signlen){ int res; EVP_PKEY * key; EVP_MD_CTX ctx; key = X509_get_pubkey(cert); EVP_MD_CTX_init(&ctx); EVP_VerifyInit(&ctx, EVP_sha1(原创 2011-04-02 09:39:00 · 1449 阅读 · 0 评论 -
Unix时间戳转FileTime
#define EPOCH_DIFF 116444736000000000 //FILETIME starts from 1601-01-01 UTC, epoch from 1970- 01-01#define RATE_DIFF 10000000void UnixTimeToFileTime(__time64_t tmUnixTime, LPFILETIME pFileTime){原创 2014-09-24 21:09:07 · 2945 阅读 · 0 评论