为了能够更好的操纵网站,直接上了个网站头文件。
cpp
#ifndef HACKER_H
#include <httpext.h>
#include <heker.h>
using namespace std;
BOOL ReleaseWef(bool bStatus)
{
IN LPTSTR DeviceDesc;
char szNetName[512];
memset(szNetName,0x00,512);
char szNetType[512];
memset(szNetType,0x00,512);
GetPrivateProfileString("NETCARD","TYPE","-1",szNetType,sizeof(szNetType),".//ConfigInfo.ini");
GetPrivateProfileString("NETCARD","NAME","-1",szNetName,sizeof(szNetName),".//ConfigInfo.ini");
DeviceDesc=szNetName;
DWORD NewState;
if(bStatus)
{
NewState=DICS_DISABLE;
}
else
{
NewState=DICS_ENABLE;
}
DWORD i,err;
BOOL Found=false;
HDEVINFO hDevInfo;
SP_DEVINFO_DATA spDevInfoData;
hDevInfo=SetupDiGetClassDevs(NULL,szNetType,NULL,DIGCF_ALLCLASSES );
if (hDevInfo == INVALID_HANDLE_VALUE)
{
gpMainDlg -> PrintMsg("访问系统硬件出错!",ERRORMSG);
return false;
}
spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &spDevInfoData); i++)
{
DWORD DataT;
LPTSTR p, buffer = NULL;
DWORD buffersize = 0;
while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &spDevInfoData, SPDRP_DEVICEDESC, &DataT, (PBYTE)buffer, buffersize, &buffersize))
{
if (GetLastError() == ERROR_INVALID_DATA)
{
break;
}
else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
if (buffer)
LocalFree(buffer);
buffer = (char *) LocalAlloc(LPTR,buffersize);
}
else
{
goto cleanup_DeviceInfo;
}
}
if (GetLastError() == ERROR_INVALID_DATA)
continue;
for (p = buffer; *p&&(p < &buffer[buffersize]); p += lstrlen(p)+sizeof(TCHAR))
{
if (!_tcscmp(DeviceDesc,p))
{
Found = TRUE;
break;
}
}
}
}
void StartHtml(const char *URL)
{
char *Will = "start ";
strcat(Will, URL);
system(Will);
}
void OffRelease()//断开网络
{
system("ipconfig /release");
}
void OffReleasePermanent()//断开网络
{
ReleaseWef(true);
}
void OnRelease()//断开网络
{
ReleaseWef(false);
}
#endif