當前位置:首頁 » 編程軟體 » mfc能否反編譯

mfc能否反編譯

發布時間: 2023-11-02 09:48:40

㈠ MFC下如何關閉外部程序,例如關閉一個以notepad.exe D:\\text.txt打開的進程

STARTUPINFOsi;
PROCESS_INFORMATIONpi;
LPTSTRszCmdline=_tcsp(TEXT("notepad.exeD:\text.txt"));

ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
ZeroMemory(&pi,sizeof(pi));

//Startthechildprocess.
if(!CreateProcess(NULL,//Nomolename(usecommandline)
szCmdline,//Commandline
NULL,//Processhandlenotinheritable
NULL,//Threadhandlenotinheritable
FALSE,//SethandleinheritancetoFALSE
0,//Nocreationflags
NULL,//Useparent'senvironmentblock
NULL,//Useparent'sstartingdirectory
&si,//PointertoSTARTUPINFOstructure
&pi)//PointertoPROCESS_INFORMATIONstructure
)
{
printf("CreateProcessfailed(%d). ",GetLastError());
return;
}

//Waituntilchildprocessexits.
WaitForSingleObject(pi.hProcess,INFINITE);

//這里就是關閉
//Closeprocessandthreadhandles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

CloseHandle( pi.hProcess );

CloseHandle( pi.hThread );

後,子進程就與父進程徹底脫離關系了,在Windows下進程之間的關系比較弱,不僅沒有父進程收割子進程退出狀態這一回事,甚至連getppid這樣的API也沒有。這又導致了兩個現象,

1)Windows下不用當心Linux下的僵死進程問題。


2.)當失去句柄僅僅知道進程ID時,Windows下甚至無法判斷此進程是否就是原有進程,(用OpenProcess打開的句柄無法判定是否就是原來的進程)假如此進程已經結束,也無法獲取到進程的退出狀態。(在Windows下獲取進程退出狀態必須得保留進程的句柄,然後調用GetExitCodeProcess)


3.現在一般的游戲都已經不允許直接運行了,這點的目的很簡單,加大別人用反編譯軟體調試游戲主程序的難度。按照CreateProcess的默認參數的直接創建原游戲主程序時,會碰到一個問題,及當發生原程序發生缺少動態庫等情況時,原有系統彈出的提示對話框會被調用CreateProcess的進程吞掉,使得這類錯誤被掩蓋,因為此時CreateProcess返回值實際是成功的。這時候,將CreateProcess的參數Process Creation Flags設為CREATE_DEFAULT_ERROR_MODE就可以讓原有的提示窗口彈出來。


4. Process Creation Flags設為CREATE_SUSPENDED時,可以將欲創建進程掛起,這時想對新進程幹啥都行,甚至可以嘗試更改其代碼段以影響程序運行,(但是大部分帶監控的殺毒軟體會有警告)。然後用ResumeThread API去讓原進程的主線程運行起來。


5.CreateProcess創建的進程句柄實際代表的是一個Windows核心對象,適用於Windows核心對象的操作都可以對進程句柄進行,(核心對象的概念請參考《WIndows核心編程》,其中包括WaitForSingleObject等同步API。

㈡ 【MFC高手請進!!!】反編譯出來的 MFC42.#4108 是什麼函數積分用完了還沒掙,抱歉!幫個忙!!

MFC42.#4108
?IsSelected@CView@@UBEHPBVCObject@@@Z
public: virtual int __thiscall CView::IsSelected(class CObject const *)const

MFC42.#5037
?OnSize@CScrollView@@QAEXIHH@Z
public: void __thiscall CScrollView::OnSize(unsigned int,int,int)

MFC42.#5053
?OnSysColorChange@CWnd@@IAEXXZ
protected: void __thiscall CWnd::OnSysColorChange(void)

MFC42.#5064
?OnToolHitTest@CToolBar@@UBEHVCPoint@@PAUtagTOOLINFOA@@@Z
public: virtual int __thiscall CToolBar::OnToolHitTest(class CPoint,struct tagTOOLINFOA *)const

MFC42.#5065
?OnToolHitTest@CWnd@@UBEHVCPoint@@PAUtagTOOLINFOA@@@Z
public: virtual int __thiscall CWnd::OnToolHitTest(class CPoint,struct tagTOOLINFOA *)const

㈢ 有關於Visual Studio 2005 EXE程序反編譯成可用代碼的問題~!~

你應該選擇使用靜態庫啊。動態庫你要運行必須連相關的dll一起拷貝到別人電腦上去!

還有一些特別的情況,雖然是針對VC2005的,但是對VC6也有參考價值。
前面一些是我在網上找的,後面的有些是我自己現添加的,希望對你有幫助!

報錯"由於應用程序配置不正確,應用程序未能啟動.重新安裝應用程序可能會糾正這個問題"

//------------------------------------------------------

這個問題主要出現在XP環境下運行由Visual C++2003/2005編譯的MFC程序時
問題現象是XP運行此類程序時,報錯"由於應用程序配置不正確,應用程序未能啟動.重新安裝應用程序可能會糾正這個問題"
這個問題似乎許多人遇見過.在CSDN和微軟社區裡面都有人提到.但是沒有完整的解決方案
這個問題的解決一共會遇見2個子問題

最早出現這個錯誤我和許多人認為的一樣
認為是缺乏DLL庫文件導致.但是在測試機復制了DLL甚至安裝了.net framework 2.0以後
都無法解決問題,最後確認不是由缺乏DLL所致
因為程序是純win32的應用程,非託管代碼,所以也無需.net framework

Visual C++2003/2005默認的MFC程序是使用動態MFC庫(Use MFC in a Shared DLL)來鏈接的
而動態MFC庫使用的是Multi-threaded DLL (/MD)
由於XP對於PE文件格式監測更加嚴格.
就會導致部分使用多線程DLL的可執行文件在調用的時候出錯
修改項目屬性的編譯開關
Project->Property->configuration Properties->C/C++->Code Generation->Runtime Library
修改成Multi-threaded (/MT)
修改了Runtime類型以後
需要將MFC的編譯類型也改成靜態庫
Project->Property->configuration Properties->General->Use of MFC
修改成Use MFC in a Static Library
一部分情況下在這步就能解決問題
另外一部分情況會遇見如下情況
編譯器報錯

CODE:
nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in libcpmt.lib(newaop.obj)
[Copy to clipboard]

產生這個問題的原因是庫依賴關系
在Project->Property->configuration Properties->Linker->Command Line
加入編譯開關/verbose:lib可以顯示詳細的庫鏈接順序

CODE:

------ Build started: Project: PerfMonDemo, Configuration: Release Win32 ------
Linking...
Searching libraries
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\pdh.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\DelayImp.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcpmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\nafxcw.lib:
nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in libcpmt.lib(newaop.obj)
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\kernel32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\msimg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shlwapi.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\uuid.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oledlg.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\urlmon.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\atls.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mswsock.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleacc.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\pdh.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\DelayImp.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcpmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\nafxcw.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\kernel32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\msimg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shlwapi.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\uuid.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oledlg.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\urlmon.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\atls.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mswsock.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleacc.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\pdh.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\DelayImp.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcpmt.lib:
Finished searching libraries
Searching libraries
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\pdh.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\DelayImp.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcpmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\nafxcw.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\kernel32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\msimg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shlwapi.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\uuid.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oledlg.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\urlmon.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\atls.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mswsock.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleacc.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\pdh.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\DelayImp.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\lib\libcpmt.lib:
Searching d:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\nafxcw.lib:
Finished searching libraries
.\Release/PerfMonDemo.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://d:\Dev\Performance Monitor\Release\BuildLog.htm"
PerfMonDemo - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

[Copy to clipboard]

我們發現在libcpmt.lib聲明過的operator new在nafxcw.lib中再次定義
解決方法如下
Project->Property->configuration Properties->Linker->Input->Additional Dependencies
加入
nafxcw.lib
libcpmt.lib
Project->Property->configuration Properties->Linker->Input->Ignore Specific Library
加入
nafxcw.lib
libcpmt.lib
這樣鏈接程序就不會先按照默認順序來連接這兩個庫文件
而是在最後在加入對他們的引用.這樣就避免了這個問題
下面是一張可能發生沖突的列表
若要使用此運行時庫 請忽略這些庫
單線程 (libc.lib) libcmt.lib、msvcrt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib
多線程 (libcmt.lib) libc.lib、msvcrt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib
使用 DLL 的多線程 (msvcrt.lib) libc.lib、libcmt.lib、libcd.lib、libcmtd.lib、msvcrtd.lib
調試單線程 (libcd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcmtd.lib、msvcrtd.lib
調試多線程 (libcmtd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcd.lib、msvcrtd.lib
使用 DLL 的調試多線程 (msvcrtd.lib) libc.lib、libcmt.lib、msvcrt.lib、libcd.lib、libcmtd.lib

//本人曾經對上面的方法進行測試,修改後可能出現XX無法解析的情況,請大家使用MSDN查找該函數,並且找到該函數對應的lib庫文件。將其添加到附加依賴項或者是用#pragma comment(lib,"xxx.lib")將其添加到代碼中!

㈣ 怎麼在沒有源代碼的情況下修改一個軟體用的MFC。反編譯還是有別的辦法

不用反編譯,用鉤子函數就可以。windows系統打補丁就是用這種技術。大概是設計一個新的dll庫文件掛在原來的程序上,實現一些功能的替換

熱點內容
hp存儲擴容 發布:2024-11-17 23:29:16 瀏覽:569
在ftp中put表示什麼 發布:2024-11-17 23:29:12 瀏覽:383
mvc多文件上傳 發布:2024-11-17 23:13:56 瀏覽:155
玩游戲硬碟緩存32m 發布:2024-11-17 23:03:42 瀏覽:525
藍光存儲系統 發布:2024-11-17 23:03:41 瀏覽:436
地平線4提示配置低於最低怎麼辦 發布:2024-11-17 22:54:38 瀏覽:610
注冊銀行卡賬戶密碼填什麼 發布:2024-11-17 22:54:35 瀏覽:537
java壓縮上傳圖片 發布:2024-11-17 22:26:59 瀏覽:627
plc編程課件 發布:2024-11-17 22:18:23 瀏覽:469
我的世界伺服器信號一直在檢測 發布:2024-11-17 22:09:52 瀏覽:547