Strange Debugging results
-
In the C/C++ code below debugptr comes up as null however when I go into Disassembly the value return in register rax from __imp_Cwnd::FromHandle is correct as I place an eyecatcher "Debug" in CprogDebug and when I go to look at that memory address I can see that literal in the memory more so when I got to rsi + 118h the value of the rax register is there When I do a quickwatch in VS on Debugptr its NULL BTW I do a get an exception utilizing debugptr as a pointer
133: debugptr = (CprogDebug *)temptr->GetOwner();
00007FF635B24727 48 8B 88 98 00 00 00 mov rcx,qword ptr [rax+98h]
00007FF635B2472E 48 85 C9 test rcx,rcx
00007FF635B24731 75 0D jne CMypercolate::process_sdump+60h (07FF635B24740h)
00007FF635B24733 48 8B 48 40 mov rcx,qword ptr [rax+40h]
00007FF635B24737 FF 15 A3 AC 00 00 call qword ptr [__imp_GetParent (07FF635B2F3E0h)]
00007FF635B2473D 48 8B C8 mov rcx,rax
00007FF635B24740 FF 15 BA B8 00 00 call qword ptr [__imp_CWnd::FromHandle (07FF635B30000h)]
00007FF635B24746 48 89 86 18 01 00 00 mov qword ptr [rsi+118h],rax -
In the C/C++ code below debugptr comes up as null however when I go into Disassembly the value return in register rax from __imp_Cwnd::FromHandle is correct as I place an eyecatcher "Debug" in CprogDebug and when I go to look at that memory address I can see that literal in the memory more so when I got to rsi + 118h the value of the rax register is there When I do a quickwatch in VS on Debugptr its NULL BTW I do a get an exception utilizing debugptr as a pointer
133: debugptr = (CprogDebug *)temptr->GetOwner();
00007FF635B24727 48 8B 88 98 00 00 00 mov rcx,qword ptr [rax+98h]
00007FF635B2472E 48 85 C9 test rcx,rcx
00007FF635B24731 75 0D jne CMypercolate::process_sdump+60h (07FF635B24740h)
00007FF635B24733 48 8B 48 40 mov rcx,qword ptr [rax+40h]
00007FF635B24737 FF 15 A3 AC 00 00 call qword ptr [__imp_GetParent (07FF635B2F3E0h)]
00007FF635B2473D 48 8B C8 mov rcx,rax
00007FF635B24740 FF 15 BA B8 00 00 call qword ptr [__imp_CWnd::FromHandle (07FF635B30000h)]
00007FF635B24746 48 89 86 18 01 00 00 mov qword ptr [rsi+118h],rax -
Wow you are good I’ll do it again but I was still at a breakpoint when I copied the text while was tracing and verifying the output I’m in bed as it’s 2:37 in the morning so I’ll do it again tommorow or in the morning
-
ForNow wrote:
Wow you are good
Not at all. It's just that every so often I actually read a question carefully.
I re-built its the the code at 5:52 est I just tested it did a disassembly it the same disassembly I posted it strange because the value returned from Cwnd::FromHandle has a valid return in rax I check rsi + 118 h and that value has the rax register also nore rsi + 118h = FA2C48D158 however I do quick watch on &debugptr and that value is null the value of &debugptr is 7FFd34e61810 which is strange shouldn't rsi + 118h == &debugptr ??? thanks
-
I re-built its the the code at 5:52 est I just tested it did a disassembly it the same disassembly I posted it strange because the value returned from Cwnd::FromHandle has a valid return in rax I check rsi + 118 h and that value has the rax register also nore rsi + 118h = FA2C48D158 however I do quick watch on &debugptr and that value is null the value of &debugptr is 7FFd34e61810 which is strange shouldn't rsi + 118h == &debugptr ??? thanks
-
Sorry I must be missing something . I do not see the connection between
Cwnd::FromHandle
anddebugptr = (CprogDebug *)temptr->GetOwner();
.First let just say what I am trying to accomplish I have CProgDebug object of Cwnd type I am trying to save all the info in that Object I have two modal dialogboxes which gather info that I need so when I create these two Modal Dialog Boxes one after the other I create them with pParent being = to the Created Dialog the documentation says in that Case if pParent is not equal to NULL the pParent Cwnd will be the Parent or Owner maybe I should try debugptr = temptr->GetParent(); and see what Happens I think your logic is right though Thanks
-
First let just say what I am trying to accomplish I have CProgDebug object of Cwnd type I am trying to save all the info in that Object I have two modal dialogboxes which gather info that I need so when I create these two Modal Dialog Boxes one after the other I create them with pParent being = to the Created Dialog the documentation says in that Case if pParent is not equal to NULL the pParent Cwnd will be the Parent or Owner maybe I should try debugptr = temptr->GetParent(); and see what Happens I think your logic is right though Thanks
this is what documentation states
Quote:
Points to the parent or owner window object (of type CWnd
I just stepped thru my constructer of both modal dialog boxes in my quick watch I had this->m_WndOwner (from Cwnd) and this->m_pParent (from Cdialog) I had passed a valid Cwnd after in Disassembly mode I executed Cdialog:Cdialog this->m_pParent is Null while this->m_pParent has a value in fact the pointer to the pParent I pass as I can see the eyecatcher
-
this is what documentation states
Quote:
Points to the parent or owner window object (of type CWnd
I just stepped thru my constructer of both modal dialog boxes in my quick watch I had this->m_WndOwner (from Cwnd) and this->m_pParent (from Cdialog) I had passed a valid Cwnd after in Disassembly mode I executed Cdialog:Cdialog this->m_pParent is Null while this->m_pParent has a value in fact the pointer to the pParent I pass as I can see the eyecatcher
-
I have never used
GetOwner
, but there seem to be some caveats about its usage at CWnd::GetOwner[^]. You also need to be sure thattemptr
is pointing at the object you think it is.