How was Plus! done? |
Author: |
Message: |
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: How was Plus! done?
No that's probably all for the core..
|
|
02-17-2007 04:27 PM |
|
|
Patchou
Messenger Plus! Creator
Posts: 8607 Reputation: 201
43 / /
Joined: Apr 2002
|
RE: How was Plus! done?
Actually, msimg32.dll is the only thing that loads Messenger Plus! into Messenger. Detours is used after, to hook a couple of API functions (using Detours gives better results than patching the IAT like older versions of Messenger Plus! used to do, but you can achieve similar results with both methods). You could also use a CBT hook, check the documentation of SetWindowsHookEx, it's probably easier to start with that.
Then it's all a matter of intercepting the creation of each window and sending the proiper messages to send their behaviours, add stuff to the various menus, etc... changing the Messenger UI involves hooking some of the resource APIs like LoadResource yes.
Good luck
|
|
02-18-2007 08:06 AM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: RE: How was Plus! done?
quote: Originally posted by Patchou
Actually, msimg32.dll is the only thing that loads Messenger Plus! into Messenger. Detours is used after, to hook a couple of API functions (using Detours gives better results than patching the IAT like older versions of Messenger Plus! used to do, but you can achieve similar results with both methods). You could also use a CBT hook, check the documentation of SetWindowsHookEx, it's probably easier to start with that.
Then it's all a matter of intercepting the creation of each window and sending the proiper messages to send their behaviours, add stuff to the various menus, etc... changing the Messenger UI involves hooking some of the resource APIs like LoadResource yes.
Good luck
That was what I tried to say. And CreateWindow was just an example. CBT hook is better for window creations, but even best is a RET Hook, with the WM_CREATE interception, because thats after the window is created (when the Message is handled by Messenger.
|
|
02-18-2007 03:34 PM |
|
|
muttantegg
New Member
Posts: 11
41 / – / –
Joined: Feb 2007
|
O.P. RE: How was Plus! done?
Hehe. Hooking windows sounds fun Can't wait to add my own menus to Messenger!
That will have to wait though. All the examples I've seen so far are a bit outdated and/or won't compile in VS 2005. When I get some free time I'll play around with it a bit
A big 'Thank you' to all who replied and especially to Patchou for making Plus!
|
|
02-18-2007 04:22 PM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: How was Plus! done?
Sure! If you need any help, PM me, I've done this.
|
|
02-18-2007 04:40 PM |
|
|
muttantegg
New Member
Posts: 11
41 / – / –
Joined: Feb 2007
|
O.P. RE: How was Plus! done?
Hi guys! It's me again
quote: Originally posted by Patchou
Actually, msimg32.dll is the only thing that loads Messenger Plus! into Messenger.
Okay. I've been reading the MSDN pages refering to Dlls (and DllMain) and came across this :
quote: The entry-point function should perform only simple initialization or termination tasks. It must not call the LoadLibrary or LoadLibraryEx function (or a function that calls these functions), because this may create dependency loops in the DLL load order.
So, if you shouldn't load libraries in msimg32.dll's DllMain, where do you do it? You have to load MsgPlusLive.dll somewhere... Is this one of those times when you do it, even though is dangerous?
|
|
02-19-2007 12:49 PM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: How was Plus! done?
I did, Patchou too I guess. Not a problem.
Or write it using MFC; I think you can put it in InitInstace (the MFC DllMain) without any problemos .
|
|
02-19-2007 04:37 PM |
|
|
Patchou
Messenger Plus! Creator
Posts: 8607 Reputation: 201
43 / /
Joined: Apr 2002
|
RE: How was Plus! done?
Although the rule must be generally respected, this depends on each particuliar scenario and situation. If you create a dll file to be loaded in a particular process and it works, then it will simply always work. Jsut make sure you do the strict minimum in DllMain (don't start calling functions from other dlls except to put in place basic hooking, delay your initialisation for later).
|
|
02-19-2007 07:45 PM |
|
|
TheSteve
Full Member
The Man from Japan
Posts: 179 Reputation: 23
40 / /
Joined: Aug 2005
|
RE: How was Plus! done?
Here is a pretty good list of what you should and shouldn't do when you are creating DllMain. See the document for more details.
quote: Originally posted by http://www.microsoft.com/whdc/driver/kernel/dll_bestprac.mspx
You should never perform the following tasks from within DllMain:
- Call LoadLibrary or LoadLibraryEx (either directly or indirectly). This can cause a deadlock or a crash.
- Synchronize with other threads. This can cause a deadlock.
- Acquire a synchronization object that is owned by code that is waiting to acquire the loader lock. This can cause a deadlock.
- Initialize COM threads by using CoInitializeEx. Under certain conditions, this function can call LoadLibraryEx.
- Call the registry functions. These functions are implemented in Advapi32.dll. If Advapi32.dll is not initialized before your DLL, the DLL can access uninitialized memory and cause the process to crash.
- Call CreateProces. Creating a process can load another DLL.
- Call ExitThread. Exiting a thread during DLL detach can cause the loader lock to be acquired again, causing a deadlock or a crash.
- Call CreateThread. Creating a thread can work if you do not synchronize with other threads, but it is risky.
- Create a named pipe or other named object (Windows 2000 only). In Windows 2000, named objects are provided by the Terminal Services DLL. If this DLL is not initialized, calls to the DLL can cause the process to crash.
- Use the memory management function from the dynamic C Run-Time (CRT). If the CRT DLL is not initialized, calls to these functions can cause the process to crash.
- Call functions in User32.dll or Gdi32.dll. Some functions load another DLL, which may not be initialized.
- Use managed code.
The following tasks are safe to perform within DllMain:
- Initialize static data structures and members at compile time.
- Create and initialize synchronization objects.
- Allocate memory and initialize dynamic data structures (avoiding the functions listed above.)
- Set up thread local storage (TLS).
- Open, read from, and write to files.
- Call functions in Kernel32.dll (except the functions that are listed above).
- Set global pointers to NULL, putting off the initialization of dynamic members. In Microsoft Windows Vista™, you can use the one-time initialization functions to ensure that a block of code is executed only once in a multithreaded environment.
|
|
02-20-2007 02:32 AM |
|
|
muttantegg
New Member
Posts: 11
41 / – / –
Joined: Feb 2007
|
O.P. RE: How was Plus! done?
Hey guys! I got my fake Dll working
And thanks to code: #pragma warning( disable:4273 )
it even compiles nicely!
Now comes the fun part... Anyone knows the signature of Initialize in MsgPlusLive.dll ?
|
|
02-20-2007 04:35 AM |
|
|
Pages: (4):
« First
«
1
[ 2 ]
3
4
»
Last »
|
|