Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionA QUESTION Pin
minihotto1-Sep-06 23:02
minihotto1-Sep-06 23:02 
AnswerRe: A QUESTION Pin
Kiran Pinjala2-Sep-06 0:28
Kiran Pinjala2-Sep-06 0:28 
Questionstatic varible? Pin
jalsa G1-Sep-06 22:57
jalsa G1-Sep-06 22:57 
AnswerRe: static varible? Pin
toxcct2-Sep-06 0:12
toxcct2-Sep-06 0:12 
AnswerRe: static varible? Pin
Jun Du2-Sep-06 6:13
Jun Du2-Sep-06 6:13 
QuestionDisabling a group of radio buttons Pin
cv_k3n1-Sep-06 21:57
cv_k3n1-Sep-06 21:57 
AnswerRe: Disabling a group of radio buttons Pin
Tony Hill2-Sep-06 4:55
mveTony Hill2-Sep-06 4:55 
Questionself modifying program Pin
blue_rabbit1-Sep-06 21:52
blue_rabbit1-Sep-06 21:52 
i can't write a program that it modify its code and execute it;
i tried it with assembly too (use _asm , but useless).
That's when i try to modify the virtual table of class with virtual function.
Ex:
class x{
virtual void f1(){cout<<"x::f1"<<endl;};
virtual="" void="" f2(){cout<<"x::f2"<<endl;};
="" others="" here
};
class="" fake{
="" f1(){cout<<"fake::f1"<<endl;};
};
int="" main(){
="" x="" *px="new" x;
="" fake="" *pfake="new" fake;
="" actually,="" i="" use="" pointer="" because="" if="" instance="" of="" object="" then
="" the="" call="" function="" will="" not="" table="" at="" all
="" px-="">f1();//if i call this the result is call x::f1 function
//but if i replace address of x::f1 function in virtual table to
//fake::f1 function then the call px->f1() will call fake::f1 function
//I modify address of x::f1 in vtable like below
DWORD **pfuncAdd = (DWORD **)px;//get address of vtable of class x
DWORD **pfakefunAdd = (DWORD **)px;//get address of vtable of class fake
(*pfuncAdd)[0] = (*pfakefunAdd)[0];//replace x::f1 == fake::f1, but
//i always get access violent while write at the address????
//i think it because i have modified the address inside the code program
//because when i debug i see the address inside code range
//how can i fix it
//if this work done, then when i call px->f1() actually i call fake::f1
}
Please help me, i also try modify my code when running with _asm keyword but
seem i don't know Dead | X|
AnswerRe: self modifying program Pin
Stephen Hewitt1-Sep-06 22:22
Stephen Hewitt1-Sep-06 22:22 
GeneralRe: self modifying program Pin
blue_rabbit4-Sep-06 21:52
blue_rabbit4-Sep-06 21:52 
QuestionAdd Reference (static library) Pin
sawerr1-Sep-06 21:17
sawerr1-Sep-06 21:17 
QuestionSocket programming doubt Pin
Kiran Pinjala1-Sep-06 20:26
Kiran Pinjala1-Sep-06 20:26 
AnswerRe: Socket programming doubt Pin
Mila0252-Sep-06 3:02
Mila0252-Sep-06 3:02 
QuestionGetModuleFileName Pin
dipali_be20031-Sep-06 19:38
dipali_be20031-Sep-06 19:38 
AnswerRe: GetModuleFileName Pin
Waldermort1-Sep-06 20:14
Waldermort1-Sep-06 20:14 
GeneralRe: GetModuleFileName Pin
dipali_be20031-Sep-06 20:41
dipali_be20031-Sep-06 20:41 
GeneralRe: GetModuleFileName Pin
toxcct2-Sep-06 0:14
toxcct2-Sep-06 0:14 
QuestionMessage Box Pin
radhika281-Sep-06 19:36
radhika281-Sep-06 19:36 
GeneralRe: Message Box Pin
_AnsHUMAN_ 1-Sep-06 19:41
_AnsHUMAN_ 1-Sep-06 19:41 
GeneralRe: Message Box Pin
radhika281-Sep-06 19:47
radhika281-Sep-06 19:47 
GeneralRe: Message Box Pin
Hamid_RT1-Sep-06 20:04
Hamid_RT1-Sep-06 20:04 
GeneralRe: Message Box Pin
_AnsHUMAN_ 1-Sep-06 20:05
_AnsHUMAN_ 1-Sep-06 20:05 
GeneralRe: Message Box Pin
radhika281-Sep-06 20:17
radhika281-Sep-06 20:17 
GeneralRe: Message Box Pin
_AnsHUMAN_ 1-Sep-06 20:21
_AnsHUMAN_ 1-Sep-06 20:21 
GeneralRe: Message Box Pin
Hamid_RT1-Sep-06 20:28
Hamid_RT1-Sep-06 20:28 

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.