Click here to Skip to main content
15,911,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
Dani10000126-Dec-04 15:16
Dani10000126-Dec-04 15:16 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
John R. Shaw27-Dec-04 6:04
John R. Shaw27-Dec-04 6:04 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
PJ Arends26-Dec-04 22:06
professionalPJ Arends26-Dec-04 22:06 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
John R. Shaw27-Dec-04 6:16
John R. Shaw27-Dec-04 6:16 
Generalquestion Pin
gamitech26-Dec-04 6:14
gamitech26-Dec-04 6:14 
GeneralRe: question Pin
Yulianto.26-Dec-04 13:54
Yulianto.26-Dec-04 13:54 
GeneralRe: question Pin
PJ Arends26-Dec-04 22:27
professionalPJ Arends26-Dec-04 22:27 
GeneralReplacing the mmemory allocator for "CoGetMalloc" function Pin
impeham26-Dec-04 5:34
impeham26-Dec-04 5:34 
Problem description:

I realized my own Memory allocator that is returned by calls to "CoGetMalloc" function (i use a hooked function)
I created a DLL that on its initialization phase replaces the original memory allocator for the process (that loads this DLL), and points it to mine
i return a pointer to my memory allocator instead of the default one.
My memory allocator simulates the original, but uses my own heap.
here's what i do:

1. I use a DLL injector EXE application which injects a dll to a process - the DLL name is sent as a parameter.
2. i added "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MyProcess.exe" to the registry,
and pointed it to the injector application with my DLL as its parameter.

The flow if what i expect to happen is this:
1. I execute "MyProcess.exe"
2. "MyProcess.exe" process is created and does nothing
3. The injector is executed, and injects my dll to "MyProcess.exe"
4. The injector activates the loadlibrary function which calls the initialization section in my DLL
5. This section hooks to the "CoGetMalloc" function, which uses my own memory allocator. (anyone who calls it, will get my memory allocator from now on
in this process)
6. the original "MyProcess.exe" is executed, but blindly using my memory allocator and heap instead of the default ones.

What actually happens is that i get a crash after few times the "Alloc" method is invoked, but i can't understand why. "Alloc" is the only method that
was called after launching "MyProcess.exe".

Can anyone see the problem with this scenario?

Thanks.

GeneralHelp in Editing Icon Pin
Azghar Hussain26-Dec-04 4:07
professionalAzghar Hussain26-Dec-04 4:07 
GeneralNeed a fancy name for a 'combined' variable Pin
TrueTom26-Dec-04 2:42
TrueTom26-Dec-04 2:42 
GeneralRe: Need a fancy name for a 'combined' variable Pin
User 665826-Dec-04 7:52
User 665826-Dec-04 7:52 
GeneralRe: Need a fancy name for a 'combined' variable Pin
TrueTom27-Dec-04 1:35
TrueTom27-Dec-04 1:35 
GeneralRe: Need a fancy name for a 'combined' variable Pin
TrueTom27-Dec-04 2:16
TrueTom27-Dec-04 2:16 
Generalupload files Pin
StoreErin26-Dec-04 1:26
StoreErin26-Dec-04 1:26 
GeneralRe: upload files Pin
Neville Franks26-Dec-04 9:56
Neville Franks26-Dec-04 9:56 
GeneralRe: upload files Pin
StoreErin26-Dec-04 13:26
StoreErin26-Dec-04 13:26 
GeneralpictureBox question. Pin
Link260025-Dec-04 22:31
Link260025-Dec-04 22:31 
QuestionHow to use message handler in MFC regular Dll? Pin
tttyip25-Dec-04 20:25
tttyip25-Dec-04 20:25 
AnswerRe: How to use message handler in MFC regular Dll? Pin
User 665825-Dec-04 22:56
User 665825-Dec-04 22:56 
QuestionWhere can I get the Microsoft Windows .NET DDK? Pin
momer25-Dec-04 20:04
momer25-Dec-04 20:04 
AnswerRe: Where can I get the Microsoft Windows .NET DDK? Pin
TrueTom26-Dec-04 2:45
TrueTom26-Dec-04 2:45 
Generalresize child frame window Pin
Anonymous25-Dec-04 14:50
Anonymous25-Dec-04 14:50 
GeneralQuestion Regarding ToolBarwindow32 Pin
sdssd25-Dec-04 11:44
sdssd25-Dec-04 11:44 
QuestionBelieve in yourself? Pin
Anonymous25-Dec-04 10:53
Anonymous25-Dec-04 10:53 
AnswerRe: Believe in yourself? Pin
alex.barylski25-Dec-04 14:45
alex.barylski25-Dec-04 14:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.