• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            簡單的CreateRemoteThread例程2Dll-初學者必看

            // dll.cpp : Defines the initialization routines for the DLL.
            // Author:秋鎮菜

            #include "stdafx.h"
            #include <afxdllx.h>

            #ifdef _DEBUG
            #define new DEBUG_NEW
            #undef THIS_FILE
            static char THIS_FILE[] = __FILE__;
            #endif


            static AFX_EXTENSION_MODULE DllDLL = { NULL, NULL };

            extern "C" int APIENTRY
            DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
            {
            // Remove this if you use lpReserved
            UNREFERENCED_PARAMETER(lpReserved);

            if (dwReason == DLL_PROCESS_ATTACH)
            {
               TRACE0("DLL.DLL Initializing!\n");
              
               // Extension DLL one-time initialization
               if (!AfxInitExtensionModule(DllDLL, hInstance))
                return 0;

               // Insert this DLL into the resource chain
               // NOTE: If this Extension DLL is being implicitly linked to by
               // an MFC Regular DLL (such as an ActiveX Control)
               // instead of an MFC application, then you will want to
               // remove this line from DllMain and put it in a separate
               // function exported from this Extension DLL. The Regular DLL
               // that uses this Extension DLL should then explicitly call that
               // function to initialize this Extension DLL. Otherwise,
               // the CDynLinkLibrary object will not be attached to the
               // Regular DLL's resource chain, and serious problems will
               // result.
               MessageBox(NULL, "對話框", NULL, MB_OK);
               new CDynLinkLibrary(DllDLL);
            }
            else if (dwReason == DLL_PROCESS_DETACH)
            {
               TRACE0("DLL.DLL Terminating!\n");
               // Terminate the library before destructors are called
               AfxTermExtensionModule(DllDLL);
            }
            return 1;   // ok
            }


            // remotethread.cpp : Defines the entry point for the console application.
            // Author:秋鎮菜

            #include "stdafx.h"
            #include "windows.h"

            int main(int argc, char* argv[])
            {
            HWND hWnd = FindWindow("notepad", NULL);
            DWORD dwId;
            GetWindowThreadProcessId(hWnd, &dwId);
            HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwId);
            if (! hProcess)
               return 0;

            char sz[MAX_PATH];
            GetModuleFileName(NULL, sz, MAX_PATH);
            strcpy(strstr(sz,".exe"), ".dll");
            strcpy(sz, "c:\\windows\\dll.dll");
            void *pData = VirtualAllocEx(hProcess, 0, sizeof (sz), MEM_COMMIT, PAGE_READWRITE);
            if (! pData)
               return 0;
            if (! WriteProcessMemory(hProcess, pData, sz, sizeof (sz), 0))
               return 0;
            HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0,
               (LPTHREAD_START_ROUTINE)GetProcAddress(
               LoadLibrary("kernel32.dll"), "LoadLibraryA"), pData, 0, 0);
            if (hThread == NULL)
               return 0;
            printf("sssssssssssssssssssssssssssssss\r\n");
            WaitForSingleObject(hThread, INFINITE);
            DWORD dwModule;
            GetExitCodeThread(hThread, &dwModule);
            CloseHandle(hThread);
            VirtualFreeEx(hProcess, pData, sizeof (sz), MEM_RELEASE);
            printf("...............................\r\n");
            hThread = CreateRemoteThread(hProcess, NULL, 0,
               (LPTHREAD_START_ROUTINE)GetProcAddress(
               LoadLibrary("kernel32.dll"), "FreeLibrary"), &dwModule, 0, 0);
            if (hThread == NULL)
               return 0;
            WaitForSingleObject(hThread, INFINITE);
            CloseHandle(hThread);
            CloseHandle(hProcess);
            printf(sz);
            printf("\r\n");
            Sleep(2000);
            return 0;
            }

            posted on 2010-06-21 22:53 lhking 閱讀(376) 評論(0)  編輯 收藏 引用

            導航

            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            統計

            常用鏈接

            留言簿

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            7777久久亚洲中文字幕| 日韩欧美亚洲国产精品字幕久久久| 18禁黄久久久AAA片| 人妻少妇久久中文字幕一区二区| 久久er99热精品一区二区| 亚洲伊人久久大香线蕉苏妲己| 国产一区二区三精品久久久无广告 | 亚洲国产精品久久久久婷婷老年| 久久精品一区二区国产| 一本综合久久国产二区| 久久99精品久久久久久久久久| 久久国产免费| 久久99国内精品自在现线| 久久久综合香蕉尹人综合网| 精品国产一区二区三区久久久狼 | 99久久99久久| 7777久久久国产精品消防器材| 99久久免费国产精品热| 97香蕉久久夜色精品国产| 四虎国产精品免费久久5151| 麻豆AV一区二区三区久久 | 久久亚洲国产成人影院网站| 久久亚洲AV无码精品色午夜| 一本久久a久久精品综合夜夜| 蜜臀av性久久久久蜜臀aⅴ| 国内精品伊人久久久久妇| 久久高清一级毛片| 91久久精品无码一区二区毛片| 日本欧美久久久久免费播放网| 亚洲精品tv久久久久久久久久| 久久久久这里只有精品| 51久久夜色精品国产| 色综合久久最新中文字幕| 青青青国产成人久久111网站| 九九久久自然熟的香蕉图片| 久久青青草原精品国产| 精品久久久久久无码中文字幕一区| 久久亚洲AV成人无码国产 | 国产69精品久久久久APP下载| 久久精品国产精品亚洲艾草网美妙| 久久九九全国免费|