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

C / C++ / MFC

 
AnswerRe: Getting source code of a webpage Pin
Chris Losinger13-Jun-07 1:35
professionalChris Losinger13-Jun-07 1:35 
QuestionAlways on top Pin
Try12-Jun-07 23:25
Try12-Jun-07 23:25 
AnswerRe: Always on top Pin
Hans Dietrich12-Jun-07 23:44
mentorHans Dietrich12-Jun-07 23:44 
GeneralRe: Always on top Pin
Try13-Jun-07 18:50
Try13-Jun-07 18:50 
Questionregsrv32 command Pin
tyagineha12-Jun-07 23:16
tyagineha12-Jun-07 23:16 
AnswerRe: regsrv32 command Pin
Matthew Faithfull12-Jun-07 23:29
Matthew Faithfull12-Jun-07 23:29 
QuestionRibbon Control Pin
CDRAIN12-Jun-07 23:03
CDRAIN12-Jun-07 23:03 
QuestionHooking problem Pin
rrrado12-Jun-07 22:37
rrrado12-Jun-07 22:37 
I need to hook the user32.dll function for my process only.
My application is running multiple worker threads which are hosting
3rd party STA component which is calling hooked function where I need to override
it's default implementation.
I've tried to do this:
- created my function using exactly same parameters and definition as original function
- save originl function's address
- created critical section cs
- saved first 5 bytes of original code and replaced by jmp _my_function (5 bytes code)

my finction:
LONG retVal;
EnterCriticalSection(&cs);
// restore original code at original function
retVal = CallOriginal();
// restore jmp inftruction
LeaveCriticalSection(&cs);
return retVal;


The problem is that when I'm running more than one workng threads,
it will crash after some random time.
Do you have idea what could be wrong? Is there some problem with this design?

Thank you!

PS. EnterCriticalSection() seems to be working, because when I remove LeaveCriticalSection(), there is a deadlock.



rrrado

Questionclose an application Pin
Russell'12-Jun-07 22:04
Russell'12-Jun-07 22:04 
AnswerRe: close an application Pin
Doc Lobster12-Jun-07 22:34
Doc Lobster12-Jun-07 22:34 
AnswerRe: close an application Pin
Naveen13-Jun-07 0:22
Naveen13-Jun-07 0:22 
GeneralRe: close an application Pin
Russell'13-Jun-07 1:46
Russell'13-Jun-07 1:46 
GeneralRe: close an application Pin
Stephen Hewitt13-Jun-07 13:47
Stephen Hewitt13-Jun-07 13:47 
GeneralRe: close an application Pin
Stephen Hewitt13-Jun-07 13:49
Stephen Hewitt13-Jun-07 13:49 
GeneralRe: close an application Pin
Naveen13-Jun-07 14:03
Naveen13-Jun-07 14:03 
GeneralRe: close an application Pin
Stephen Hewitt13-Jun-07 14:09
Stephen Hewitt13-Jun-07 14:09 
GeneralRe: close an application Pin
Naveen13-Jun-07 14:10
Naveen13-Jun-07 14:10 
GeneralRe: close an application Pin
Stephen Hewitt13-Jun-07 14:13
Stephen Hewitt13-Jun-07 14:13 
GeneralRe: close an application Pin
Naveen13-Jun-07 14:23
Naveen13-Jun-07 14:23 
GeneralRe: close an application Pin
Stephen Hewitt13-Jun-07 14:26
Stephen Hewitt13-Jun-07 14:26 
GeneralRe: close an application Pin
Russell'13-Jun-07 22:57
Russell'13-Jun-07 22:57 
GeneralRe: close an application Pin
David Crow14-Jun-07 2:31
David Crow14-Jun-07 2:31 
AnswerRe: close an application Pin
Jhony george13-Jun-07 1:01
Jhony george13-Jun-07 1:01 
GeneralRe: close an application Pin
Russell'13-Jun-07 1:21
Russell'13-Jun-07 1:21 
AnswerRe: close an application Pin
Hamid_RT13-Jun-07 3:40
Hamid_RT13-Jun-07 3:40 

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.