随笔分类 -  API

摘要:#include "stdafx.h" #include #include "RSACrypto.h" int main(int argc, char* argv[]) { prng_state prng; unsigned char buf[32]; int err; //加密 if ((err = rc4_start(&prng)) != CRYPT_OK) { print... 阅读全文
posted @ 2008-04-30 10:42 ahuo 阅读(832) 评论(0) 推荐(0)
摘要:密码库LibTomcrypt的内容介绍及分析 2.1 密码知识简介 2.1.1专业术语 发送者和接收者 假设发送者想发送消息给接收者,且想安全地发送信息:她想确信偷听者不能阅读发送的消息。 2.1.2消息和加密 消息被称为明文。用某种方法伪装消息以隐藏它的内容的过程称为加密,加了密的消息称为密文,而把密文转变为明文的过程称为解密。图1.1表明了这个过程。 (如果你遵循ISO 7... 阅读全文
posted @ 2008-04-29 09:53 ahuo 阅读(3830) 评论(0) 推荐(0)
摘要:#pragma data_seg("flag_data") int count=0; #pragma data_seg() #pragma comment(linker,"/SECTION:flag_data,RWS") 这种方法只能在没有def文件时使用,如果通过def文件进行导出的话,那么设置就要在def文件内设置而不能 在代码里设置了。 SETCTIONS flag_data REA... 阅读全文
posted @ 2008-04-08 23:56 ahuo 阅读(3907) 评论(2) 推荐(0)
摘要:设备控制选项的部分列表 操作 参数 设置成…… 撤消同一个卷的连接 dwIoControlCode F... 阅读全文
posted @ 2008-04-02 13:38 ahuo 阅读(443) 评论(0) 推荐(0)
摘要:int iMode = 1; //0:阻塞 ioctlsocket(socketc,FIONBIO, (u_long FAR*) &iMode);//非阻塞设置 rs=recvfrom(socketc,rbuf,sizeof(rbuf),0,(SOCKADDR*)&addr,&len); int ioctlsocket ( SOCKET s, long c... 阅读全文
posted @ 2008-01-09 11:56 ahuo 阅读(9169) 评论(3) 推荐(1)
摘要:#include "stdafx.h" #include #define FILEILTER "*.*" BOOL IsRoot(LPCTSTR lpszPath) { TCHAR szRoot[4]; wsprintf(szRoot, "%c:\\", lpszPath[0]); return (lstrcmp(szRoot, lpszPath) == 0... 阅读全文
posted @ 2008-01-03 23:26 ahuo 阅读(2066) 评论(0) 推荐(0)
摘要:void GBKSimplified2GBKTraditional(LPTSTR szSimplified) { LCID dwLocale; WORD wLangID; wLangID=MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED); dwLocale=MAKELCID(wLangID,SORT_CHINESE_PRC);... 阅读全文
posted @ 2007-12-28 16:36 ahuo 阅读(860) 评论(1) 推荐(0)
摘要:WTL应用程序的类型 下表对这些应用程序进行了描述. 这种弹性构成了WTL体系结构的一部分. 应用程序类型 描述 SDI Application 单文本界面 – 只有一个窗口 ... 阅读全文
posted @ 2007-12-26 15:07 ahuo 阅读(768) 评论(0) 推荐(0)
摘要:in_addr t1,t2; t1.S_un.S_addr=1; t2.S_un.S_addr=2; char *p1=inet_ntoa(t1); char *p2=inet_ntoa(t2); 这样你只能的得到2个相同的结果 因为它们用的是同一块空间。 解决办法是每次调用后都把值考走 如: char p1[20]={0}; strcpy(p1,inet_ntoa(t1)); 这样处理就没问... 阅读全文
posted @ 2007-12-17 20:45 ahuo 阅读(4773) 评论(1) 推荐(1)
摘要:#pragma pack(1) int main(int argc, char* argv[]) { struct sample { char a; double b; }; printf("%d\n",sizeof(sample)); return 0; } 结果是9 如果没有#pragma pack(1),结果是16 #pragma pack(1)意思是结构体和联合按1字节方式对齐... 阅读全文
posted @ 2007-12-06 09:33 ahuo 阅读(640) 评论(0) 推荐(0)
摘要:IsWindow 函数功能:该函数确定给定的窗口句柄是否识别一个已存在的窗口。 因数原型:BOOL IsWindow(HWND hWnd); 参数: ... 阅读全文
posted @ 2007-12-05 11:14 ahuo 阅读(1805) 评论(0) 推荐(0)
摘要:DHCP Server Management API Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0. Header ... 阅读全文
posted @ 2007-11-22 17:15 ahuo 阅读(896) 评论(0) 推荐(0)
摘要:m_dir=""; CHAR *buf=new char[100]; char drs[26]; GetLogicalDriveStrings(50,buf); int i=0; while (*buf) { drs[i]=*buf; while(*buf!='\0')buf++; buf++; ... 阅读全文
posted @ 2007-11-09 16:09 ahuo 阅读(428) 评论(0) 推荐(0)
摘要:HANDLE hProcess=NULL; HANDLE hToken=NULL; DWORD dwProcessID=GetProcessIDFromName("explorer.exe"); BOOL bRet=FALSE; if(dwProcessID) { hProcess=OpenProcess(PROCESS_ALL_ACCESS,FALSE,dwProcessID);... 阅读全文
posted @ 2007-11-05 18:00 ahuo 阅读(277) 评论(0) 推荐(0)
摘要:char buf[33]={"\0"}; srand(time(NULL)); for (int i=0;i48) || (c66) || (c97)) { break; } c=rand()%122; } buf[j]=c; } printf("%s\n",buf); } 阅读全文
posted @ 2007-10-31 17:39 ahuo 阅读(928) 评论(0) 推荐(0)
摘要:#include #include int main( void ) { FILE *stream; typedef struct _tt{ int a; int b; char buf[20]; }tt; tt temp; temp.a=10; temp.b=20; strcpy(temp.buf,"hello"); int c=sizeof(temp); ... 阅读全文
posted @ 2007-10-23 15:33 ahuo 阅读(702) 评论(0) 推荐(0)
摘要:printf("%s\n%s\n",getenv("temp"),getenv("windir")); _putenv( "LIB=c:\\mylib;c:\\yourlib" ); 阅读全文
posted @ 2007-10-17 11:51 ahuo 阅读(2989) 评论(0) 推荐(0)
摘要:#include #include #include void main( int argc, CHAR *lpszArgv[ ]) { PSHARE_INFO_502 BufPtr,p; NET_API_STATUS res; //LPTSTR lpszServer = NULL; DWORD er=0,tr=0,resume=0, i; do // begin do {... 阅读全文
posted @ 2007-10-15 09:54 ahuo 阅读(374) 评论(0) 推荐(0)
摘要:using System.Runtime.InteropServices; [DllImport("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImpor... 阅读全文
posted @ 2007-09-21 17:40 ahuo 阅读(766) 评论(1) 推荐(0)
摘要:Q 在NT/2000/XP中,我想用VC编写应用程序访问硬件设备,如获取磁盘参数、读写绝对扇区数据、测试光驱实际速度等,该从哪里入手呢? A 在NT/2000/XP中,应用程序可以通过API函数DeviceIoControl来实现对设备的访问—获取信息,发送命令,交换数据等。利用该接口函数向指定的设备驱动发送正确的控制码及数据,然后分析它的响应,就可以达到我们的目的。 DeviceIoContr... 阅读全文
posted @ 2007-09-20 15:43 ahuo 阅读(947) 评论(0) 推荐(0)