Help request: QuickTime ActiveX Control Heap Corruption the second time I open a dial
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 22

Thread: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a dial

Hybrid View

  1. #1
    Join Date
    May 2013
    Posts
    11

    Question Help request: QuickTime ActiveX Control Heap Corruption the second time I open a dial

    Hello everybody,

    I need to write a piece of code that opens a QuickTime VR image into an MFC Dialog.
    I drew a Dialog and put an "Apple QuickTime Control 2.0" into it.
    Then I created a Control variable in my Dialog class, called QtControl.
    In the OnInitDialog I set the file to open, calling the put_FileName of the control.

    I tested it by:

    - opening a dialog --> worked
    - closing it --> worked
    - opening again --> crashed. The error was:

    "Windows has triggered a breakpoint in TestOcx.exe.
    This may be due to a corruption of the heap, which indicates a bug in TestOcx.exe or any of the DLLs it has loaded.
    This may also be due to the user pressing F12 while TestOcx.exe has focus.
    The output window may have more diagnostic information."

    I tried many things and googled a lot, but the only way that I found to avoid this crash was hardcoding a valid URL in the QtControl resources at compile time.
    In other words, if I write a valid absolute path to a .mov into the URL property of the QtControl from Visual Studio and compile it, then it works.
    Obviously, I can't do this because the absolute Path is valid only on my PC.

    What I'm asking you is:

    - suggestion to solve this, or
    - any website where I can read or,
    - at worst, another implementation that is not based on the activeX and takes me 2 days of coding

    You may want to download a test application with the problem at this link

    Feel free to ask me any other detail, and any hint would be appreciated.

    Thanks in advance,
    E.Russo

  2. #2
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by emarusso View Post
    I tried many things
    Nowhere do you mention that you tried to debug the problem using the debugger.
    and googled a lot
    Google doesn't solve these problems -- you need to actually debug the issue by launching the application under the debugger.
    In other words, if I write a valid absolute path to a .mov into the URL property of the QtControl from Visual Studio and compile it, then it works.
    Then that makes it easy if you debug both scenarios and see what different path or what functions are called for each situation.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Hello,

    here's what I didn't explain in my last post. Every experiment has been done with the debugger attached.

    1. In Visual studio, I hardcoded into the URL property of my QuickTime ActiveX control a valid absolute path to a .mov file that was on my PC, say C:\something.mov

    in this case it works.

    2. I wanted to do something more flexible, so I compiled my program leaving the field empty, and setting it into the OnInitDialog method of the Dialog class that contains the control.

    in this case it throws exceptions when I close the dialog. I enabled the Exception flag into the debugger, and it catched the following first-chance one:

    First-chance exception at 0x773ac41f in TestOcx.exe: 0x0000071A: Remote procedure call was aborted

    this is the Call Stack:
    Code:
    >	KernelBase.dll!773ac41f() 	
     	[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]	
     	KernelBase.dll!773ac41f() 	
     	rpcrt4.dll!770c0e0b() 	
     	rpcrt4.dll!770c0d9a() 	
     	winsta.dll!6ae08930() 	
     	winsta.dll!6ae08981() 	
     	winsta.dll!6ae088ee() 	
     	rpcrt4.dll!7704b500() 	
     	rpcrt4.dll!7704b4b2() 	
     	rpcrt4.dll!7704d8b5() 	
     	rpcrt4.dll!7704dbc8() 	
     	rpcrt4.dll!7704db45() 	
     	rpcrt4.dll!7704de16() 	
     	rpcrt4.dll!7704dd5d() 	
     	rpcrt4.dll!7704daed() 	
     	winsta.dll!6ae08b18() 	
     	winsta.dll!6ae0baeb() 	
     	winsta.dll!6ae0baa2() 	
     	winsta.dll!6ae0ba49() 	
     	winsta.dll!6ae0b971() 	
     	QTOControl.dll!61bb4e29() 	
     	QTOControl.dll!61bb7d84() 	
     	QTOControl.dll!61bb0cfc()
    Then I passed the exception to the program and the following assert is thrown:

    wincore.cpp

    Code:
    LRESULT CALLBACK
    AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
    {
    	// special message which identifies the window as using AfxWndProc
    	if (nMsg == WM_QUERYAFXWNDPROC)
    		return 1;
    
    	// all other messages route through message map
    	CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
    	ASSERT(pWnd != NULL);
    After ignoring 3 times the assert, the program seems to work.
    But sometimes it throws the exception that I mentioned in my first post and the application crashes.


    3. I tried to "Shutdown" in some way the quicktime player, by editing the OnClose method of the Dialog, but both didn't solve my problem.

    I tried to:
    - call the method "QuickTimeTerminate" of the control
    - set the URL to empty string


    That's it. If you need other info, I'm here... :-)

    Regards,
    emarusso

  4. #4
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by emarusso View Post
    2. I wanted to do something more flexible, so I compiled my program leaving the field empty, and setting it into the OnInitDialog method of the Dialog class that contains the control.
    And how is this field set in terms of C++?

    In other words, a description of what you did is not enough. Show the actual code you claim sets this field. This is especially the case when it comes to strings, as it seems to be the case that too many persons make basic mistakes when it comes to handling string data in C++.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; May 20th, 2013 at 01:37 PM.

  5. #5
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    The code is here

    http://docs.google.com/file/d/0B7Mih...it?usp=sharing

    as I wrote in my first post.

    Here's the point where I set the URL:

    Code:
    BOOL CQuickTimeDlg::OnInitDialog()
    {
            CDialog::OnInitDialog();
    
            HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_QUICKTIME));
            SetIcon(hIcon, FALSE);
    
            m_kQtControl.put_FileName(m_strURL);
            m_kQtControl.put_FullScreen(m_bFullscreen);
            m_kQtControl.put_MovieControllerVisible(m_bMovieControllerVisible);
    
            return TRUE;  // return TRUE unless you set the focus to a control
            // ECCEZIONE: le pagine delle propriet� OCX devono restituire FALSE
    }
    where m_strURL is a CString, whose value is written in the CQuickTimeDlg constructor.

  6. #6
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by emarusso View Post
    m_kQtControl.put_FileName(m_strURL);
    And the function prototype for put_FileName is what exactly? Is it this?
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

    If so, then a CString is not a BSTR.

    http://forums.codeguru.com/showthrea...String-to-BSTR
    http://www.flounder.com/cstring.htm#CString%20to%20BSTR

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; May 21st, 2013 at 04:48 AM.

  7. #7
    Join Date
    Dec 2012
    Location
    England
    Posts
    1,997

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Have you checked that the contents of m_strURL.GetBuffer() are correct? What happens if you hardcode the URL as in

    Code:
    m_kQtControl.put_FileName(_T("MyURL"));
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  8. #8
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by 2kaud View Post
    Have you checked that the contents of m_strURL.GetBuffer() are correct? What happens if you hardcode the URL as in

    Code:
    m_kQtControl.put_FileName(_T("MyURL"));
    Nothing changes, the error's still there.

  9. #9
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by emarusso View Post
    Nothing changes, the error's still there.
    You are specifying a constant, and now it doesn't work? Before you said it did work when you specify a constant.

    Regards,

    Paul McKenzie

  10. #10
    Join Date
    Dec 2012
    Location
    England
    Posts
    1,997

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    From your first post

    I tried many things and googled a lot, but the only way that I found to avoid this crash was hardcoding a valid URL in the QtControl resources at compile time.
    If hardcoding a valid URL in the control at compile does not cause the problem, then IMO the cause of the problem is unlikely to be the control. I would be looking at how I passed the URL to the control.

    Where do you hard code the URL? I suggested a test of a hardcoded URL in my post #10 but you replied that this still causes the problem. I don't understand - as in one post you say hardcoding the URL works and in another you say it doesn't.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  11. #11
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by 2kaud View Post
    Where do you hard code the URL? I suggested a test of a hardcoded URL in my post #10 but you replied that this still causes the problem.
    When I wrote hardcoded I meant that I wrote it in the visual studio resource editor, in the property window.

    Name:  Immagine.png
Views: 23
Size:  25.0 KB

    What you said was to hardcode the string in the function call.

  12. #12
    Join Date
    Dec 2012
    Location
    England
    Posts
    1,997

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    The zip file contains the code from the link.

    qt.zip
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  13. #13
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    thanks for re-attaching it, I didn't know how to attach it to the thread.

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    Quote Originally Posted by emarusso View Post
    thanks for re-attaching it, I didn't know how to attach it to the thread.
    Then read the Announcement: Before you post....
    BTW, is your MFC project a UNICODE or ANSI one? And the same question - about QuickTime ActiveX Control.
    Victor Nijegorodov

  15. #15
    Join Date
    May 2013
    Posts
    11

    Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a

    My sample is UNICODE, I tried to compile it multi-byte but the problem's still there.
    I don't know wether the ActiveX is UNICODE, and I don't know how to check it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center