What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!)

RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!)
Author: Message:
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!)
quote:
Originally posted by Mnjul
I think it involves calling WriteProcessMemory, but Cookie, how do you know which part of the text segment is free to use?
I've done this too to call my own function. Here is how I did it (it can probably be adapted to your use):
  1. Obtain a DataBloc filled with the bytes you want to inject.
  2. Call VirtualAlloc, passing 0 for lpAddress, the size of the DataBloc for dwSize, MEM_COMMIT (0x1000) for flAllocationType, and PAGE_EXECUTE_READWRITE (0x40) for flProtect.
  3. Call WriteProcessMemory to write the contents of the DataBloc at the pointer to the allocated memory.
  4. To actually call the newly allocated function, I used CreateThread with the pointer to the function I got.
  5. Call WaitForSingleObject to wait for the function to end.
  6. Call CloseHandle for the thread handle.
  7. Call VirtualFree to remove the function you allocated.
This was done (with some help :P) to call a function not otherwise possible to call from JScript and without a dll. You can pass another databloc parameter to CreateThread to give the function extra data. If you were looking to subclass, just inject a message handler written in ASM into memory. Then, instead of calling CreateThread to call it yourself, just pass the pointer to SetWindowLong. You'll also have to change when you call VirtualFree to make sure it gets freed when you're done using it.

This post was edited on 03-31-2008 at 11:18 PM by deAd.
03-31-2008 11:15 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!) - by Mnjul on 03-31-2008 at 05:12 PM
RE: RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!) - by deAd on 03-31-2008 at 11:15 PM
RE: RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!) - by Mnjul on 04-01-2008 at 04:26 AM
RE: RE: [Resource] Subclassing ActiveXObjects (and [Release] TabbedStatusIcon too!) - by Mnjul on 10-11-2008 at 06:43 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On