|
I have Subclassed a Window using the SetWindowLong function. Now, I would like to UnSubclass it. Is there any way to UnSubclass a Window?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Did you use GetWindowLong() to save the previous window procedure? If so, just put the old one back again.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
use SetWindowLong with pointer to original window procedure.
-Saurabh
|
|
|
|
|
I reversed a dll in asm to my liking. I want to keep the dll's integrity and make the midifications at run-time.
I've been looking all over for a more intermediate tutorial for such a method of gaining access to another program. I have worked with C++ quite a bit in the past, but only for very simple things and mostly console based. I am starting to get a hang of the Windows API only recently and I need a little help figureing this out.
I have created an application that (as far as I can tell) successfully loads a dll into a process. I am not all too familiar with how these libraries work, but my assumption is that a process has to call methods from the dll. I just want to be clear on how it works, so here is where my stupid question comes in: Am I supposed to create the program to inject the dll, then access the dll from my injector program? Or is there a way to make the dll run code as soon as it is injected?
All the tutorials I have found on this subject have way too much extra stuff in them for me to tell what exactly is going on. I understand that I need to read up on how dlls are implemented so if anyone could direct me to a tutorial that would give me the knowledge for what I want to do, I would appreciate it.
This is the current code I am using to inject:
void Inject(HWND hWnd, char* strDll )<br />
{<br />
GetWindowThreadProcessId(hWnd, &pId);<br />
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);<br />
LPVOID lpRemoteAddress = VirtualAllocEx(hProcess, NULL, strlen(strDll), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);<br />
WriteProcessMemory(hProcess, lpRemoteAddress, (LPVOID)strDll, strlen(strDll), NULL);<br />
CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"), lpRemoteAddress, 0, NULL);<br />
}
I took the dll from a source I found for injecting into a task manager and ignorantly tried to inject it using my code. I received no errors, but it was to no avail. This is why I assume I need something executing the code in my injector. Am I right about that?
Thanks for any help or links, it would be much appreciated.
-- modified at 0:45 Friday 7th July, 2006
|
|
|
|
|
You might get farther wrapping the DLL. Write a stub dll with the exact same function names and definitions and replace your old dll with the new one. Then your new dll gets control both before and after each function call, as well as getting control in DLLMain (process / thread attach and detach). This should work as long as the caller is using LoadLibrary / GetProcAddress. If the caller is using load-time linking, then you have to take more care with laying functions out in the dll.
earl
|
|
|
|
|
Thank you. That simple answer was actually very informative. There is one thing I don't understand about it, though. If I know the original DLL is calling OpenProcess() and I want to stop it from calling that funciton, what can I put in the dll to basically redirect the code to just after that call? Can I redefine the function in my new dll, even though it is from another library?
One other thing that would be nice to understand goes with your statement that I can replace the dll. Just for learning purposes, I ran a program with the original dll, then I had my loader inject a copy of the same dll that I modified something obvious in asm. Nothing happend. Why is this different than creating a "stub" dll?
Thank you for your help, all this stuff is very intriguing to me.
|
|
|
|
|
Hi,yesyterday i posted this but now i narrowed my problem in to one.
CConfigurator oConfig("Configurator",this,0);
CGraphviewConfig oGrphconfig;
CGrpTrnConf oGrpConf;
oConfig.AddPage(&oGrphconfig);//error
oConfig.AddPage(&oGrpConf);
oConfig.DoModal();
This is my AddPage function.
The two CGraphviewConfig and CGrpTrnConf are dialog based and i changed CDilog in to CPropertyPage.
In this i checked for adding single page with CGrpTrnConf and its performing good.It asserts error only for another Class CGraphviewCOnfig.
I compared these two classes both having same kind of declaration and construction.Then why it occurs..I everything changed CDialog into CPropertyPage ..But why?
This is my construction of CGraphviewConfig
IMPLEMENT_DYNCREATE(CGraphviewConfig, CPropertyPage)
CGraphviewConfig::CGraphviewConfig()
: CPropertyPage(CGraphviewConfig::IDD)
{
//{{AFX_DATA_INIT(CGraphviewConfig)
m_sPageNo = _T("");
m_sGrPgTitle = _T("");
m_sPanelTitle1 = _T("");
m_sPanelTitle2 = _T("");
//}}AFX_DATA_INIT
}
CGraphviewConfig::~CGraphviewConfig()
{
}
Pls help me?
|
|
|
|
|
On which line does the assertion occures?
nave
|
|
|
|
|
|
when the assertion dialog apperaces, click the retry button. Then u will get the line from which the assertion occured.
post that line and context
nave
|
|
|
|
|
when press retry it goes to disassembly and it shows the line
5F427DF0 int 3
|
|
|
|
|
Sometimes it shows the UnHandledException in disassembly
5F4852E8 mov ecx,dword ptr [eax+20h]
|
|
|
|
|
Hi
1. Which are the default CODEC installed with Windows2000, XP, etc
2. How to install CODEC from our appliction (c++) by reading the input movie file
3. Which site/FTP gives us permission to download & install CODEC
Pls share Code if any...
Anil
|
|
|
|
|
Hi,
Often it happens that if I have created a class, a dialog box class or property page etc, and if the computer hangs up or shuts down for some reason or the other, the class name goes missing in the ClassWizard's list of classes.
So, if I want to add any new function or handle some message, I have to type it in for that particular class.
Is there anyway to correct this. Any way to add the class to the ClassWizard info.
I tried to look into the .clw file and make changes there, but maybe I am doing it wrong, because it dose'nt work.
Thanks,
Tara
Fortitudine Vincimus!
|
|
|
|
|
better u delete the corrupted clw file. The classwizard can generate a new clw file if u took class wizard again.
nave
|
|
|
|
|
Thank you. I did not know that one can delete the clw file.
Fortitudine Vincimus!
|
|
|
|
|
TheinstruTara wrote: Thank you. I did not know that one can delete the clw file.
you can also delete NCB,OPT and SUO file too.. without much problem
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I know about NCB, I guess it is to do with resource information, but what do OPT and SUO files contain?
Fortitudine Vincimus!
|
|
|
|
|
http://www.codeproject.com/useritems/HTMLHelp.asp[^]
Dear all,
I fellow the step in this Guide to include the HTML help into my project....
However, it get a error....
HtmlHelp(this->m_hWnd, "good.chm", HH_DISPLAY_TOPIC, NULL);
error C2660: 'CWnd::HtmlHelpA' : function does not take 4 arguments
How to solve it????
Thanks a lot.
|
|
|
|
|
You should have asked this in the article instead, but I will try to help anyways.
BTW did you add htmlhelp.h to your source file and linked your program with htmlhelp.lib (both are included in the source download)?
John
|
|
|
|
|
Sorry for asking this stupid question here, because I must do this urgently!!
I just use the source to build and debug!!!??
But it get this problem.
|
|
|
|
|
Use ::HtmlHelp(this->m_hWnd, "good.chm", HH_DISPLAY_TOPIC, NULL);
The CWnd::HtmlHelp() function only takes two parameters.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I saw that but the article that the link points to has a HtmlHelp function that takes 4 arguments.
John
|
|
|
|
|
John M. Drescher wrote: I saw that but the article that the link points to has a HtmlHelp function that takes 4 arguments.
Err yes. The global HtmlHelp() function takes 4 parameters... Or maybe I'm misunderstanding you...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Sorry, You are correct...
John
|
|
|
|