Print Page | Close Window

[solved] Runtime check Failure and Load Failed

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=23284
Printed Date: 21 November 2024 at 7:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] Runtime check Failure and Load Failed
Posted By: Cedric_ar
Subject: [solved] Runtime check Failure and Load Failed
Date Posted: 07 March 2017 at 1:29pm
hi,

I'm currently using 16.1 and I try to upgrade to 17.3. but I have 2 problem.

1st problem : Run-Time Check Failure #2 - Stack around the variable 'szHashName' was corrupted.

here my callstack

> ToolkitPro1730v140x64D.dll!CXTPSkinManagerSchemaCodeManager::MapKey(const TMS_SCHEMA_ENTRY * pArray, const char * key, const char * prefix) Line 1138 C++
  ToolkitPro1730v140x64D.dll!CXTPSkinManagerSchema::GetClassCode(const char * lpszClass) Line 328 C++
  ToolkitPro1730v140x64D.dll!CXTPSkinManagerSchema::GetClass(const ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > & strClassList) Line 1990 C++
  ToolkitPro1730v140x64D.dll!CXTPSkinManager::GetSkinClass(const CXTPSkinObject * pObject, ATL::CStringT<char,StrTraitMFC_DLL<char,ATL::ChTraitsCRT<char> > > strClassList) Line 751 C++
  ToolkitPro1730v140x64D.dll!CXTPSkinManagerApiHook::OnHookOpenThemeData(HWND__ * hWnd, const wchar_t * pszClassList) Line 2371 C++
  ToolkitPro1730v140x64D.dll!CXTPWinThemeWrapper::OpenThemeData(HWND__ * hWnd, const wchar_t * pszClassList) Line 553 C++
  KS_GUI.dll!KS_MFCEditorApp::InitApp() Line 237 C++

This problem appear when i writing This

m_themeWrapper.OpenThemeData( *m_pMainWnd, L"BUTTON;CLOCK;COMBOBOX;"
	L"COMMUNICATIONS;CONTROLPANEL;DATEPICKER;DRAGDROP;"
	L"EDIT;EXPLORERBAR;FLYOUT;GLOBALS;HEADER;LISTBOX;LISTVIEW;MENU;MENUBAND;"
	L"NAVIGATION;PAGE;PROGRESS;REBAR;SCROLLBAR;SEARCHEDITBOX;SPIN;STARTPANEL;"
	L"STATUS;TAB;TASKBAND;TASKBAR;TASKDIALOG;TEXTSTYLE;TOOLBAR;TOOLTIP;"
	L"TRACKBAR;TRAYNOTIFY;TREEVIEW;WINDOW" );

2nd problem : 

i've a assert on 
Program: \ToolkitPro1730v140x64D.dll
File: ..\..\Source\Common\XTPDrawHelpers.cpp
Line: 3900

the callstack
> ToolkitPro1730v140x64D.dll!CXTPPrimitiveDrawer::InitFont() Line 3900 C++
  ToolkitPro1730v140x64D.dll!CXTPPrimitiveDrawer::DrawSymbol(CDC * pDC, XTPPrimitiveSymbol nSymbol, const CRect & rc, unsigned long crForeColor, unsigned long crBackColor, int bOutline, HPEN__ * hOutlinePen) Line 3951 C++
  ToolkitPro1730v140x64D.dll!CXTPPaintManager::DrawDropDownGlyph(CDC * pDC, CXTPControl * __formal, CPoint pt, int bSelected, int bPopuped, int bEnabled, int bVert) Line 890 C++
  ToolkitPro1730v140x64D.dll!CXTPPaintManager::DrawControlToolBarParent(CDC * pDC, CXTPControl * pButton, int bDraw) Line 2227 C++
  ToolkitPro1730v140x64D.dll!CXTPPaintManager::DrawControl(CDC * pDC, CXTPControl * pButton, int bDraw) Line 1417 C++
  ToolkitPro1730v140x64D.dll!CXTPControl::GetSize(CDC * pDC) Line 158 C++
  ToolkitPro1730v140x64D.dll!CXTPControls::XTPBUTTONINFO::Attach(CDC * pDC, CXTPControl * p) Line 710 C++
  ToolkitPro1730v140x64D.dll!CXTPControls::CalcDynamicSize(CDC * pDC, int nLength, unsigned long dwMode, const CRect & rcBorder, int nWidth) Line 1451 C++
  ToolkitPro1730v140x64D.dll!CXTPToolBar::CalcDockingLayout(int nLength, unsigned long dwMode, int nWidth) Line 764 C++
  ToolkitPro1730v140x64D.dll!CXTPTabToolBar::CalcDockingLayout(int nLength, unsigned long dwMode, int nWidth) Line 647 C++
  ToolkitPro1730v140x64D.dll!CXTPDockBar::_AdjustRow(CArray<CXTPToolBar *,CXTPToolBar *> & arrRow, CPoint pt, int nLength, int bHorz, AFX_SIZEPARENTPARAMS * lpLayout, int & nRemove) Line 194 C++
  ToolkitPro1730v140x64D.dll!CXTPDockBar::AdjustRow(CArray<CXTPToolBar *,CXTPToolBar *> & arrRow, CPoint pt, int nLength, int bHorz, AFX_SIZEPARENTPARAMS * lpLayout) Line 355 C++
  ToolkitPro1730v140x64D.dll!CXTPDockBar::CalcDynamicLayout(int nLength, unsigned long nMode, AFX_SIZEPARENTPARAMS * lpLayout) Line 415 C++
  ToolkitPro1730v140x64D.dll!CXTPDockBar::OnSizeParent(unsigned __int64 __formal, __int64 lParam) Line 483 C++


with 16.1 i haven't those issue.  I'm using DLL without unicode.





Replies:
Posted By: olebed
Date Posted: 08 March 2017 at 3:21am
Hello,

First problem needs more time to investigation.
About second problem I can advice to review http://forum.codejock.com/forum_posts.asp?TID=23169&PID=75248" rel="nofollow - settings of project .

Regards,
 Oleksandr Lebed



Posted By: Cedric_ar
Date Posted: 08 March 2017 at 7:00am
thanks for the reply

for the 1st pb:
I forget to mention. I'm on Window 10 ( anniversary update ) with Visual Studio 2015 update 3

For the font problem i read this post. it's refer to a static utilisation of XTP. i'm using DLL version. My project setting ( dll project ) are correct :

'Configuration Properties' > General > 'Use of MFC' > 'Use MFC in a Shared DLL'
'Configuration Properties' > 'C/C++' > 'Code generation' > 'Runtime Library' > 'Multi-threaded DLL (/MD)'


regards



Posted By: olebed
Date Posted: 09 March 2017 at 6:48am
Originally posted by Cedric_ar Cedric_ar wrote:

i'm using DLL version

in that post described settings of ToolkitPro library. Please check its settings and rebuild it.


Posted By: olebed
Date Posted: 09 March 2017 at 10:13am
Originally posted by Cedric_ar Cedric_ar wrote:

...Stack around the variable 'szHashName' was corrupted.
m_themeWrapper.OpenThemeData( *m_pMainWnd, L"BUTTON;CLOCK;COMBOBOX;"
	L"COMMUNICATIONS;CONTROLPANEL;DATEPICKER;DRAGDROP;"
	L"EDIT;EXPLORERBAR;FLYOUT;GLOBALS;HEADER;LISTBOX;LISTVIEW;MENU;MENUBAND;"
	L"NAVIGATION;PAGE;PROGRESS;REBAR;SCROLLBAR;SEARCHEDITBOX;SPIN;STARTPANEL;"
	L"STATUS;TAB;TASKBAND;TASKBAR;TASKDIALOG;TEXTSTYLE;TOOLBAR;TOOLTIP;"
	L"TRACKBAR;TRAYNOTIFY;TREEVIEW;WINDOW" );


Documentation for CXTPWinThemeWrapper::OpenThemeData():

Open the theme data for the specified HWND and semi-colon separated list of class names. OpenThemeData() will try each class name, one at a time, and use the first matching theme info found.

void OpenThemeData(
    HWND hWnd, 
    LPCWSTR pszClassList
);

hWnd
Window handle of the control/window to be themed.
pszClassList
Class name (or list of names) to match to theme data section. if the list contains more than one name, the names are tested one at a time for a match. If a match is found, OpenThemeData() returns a theme handle associated with the matching class. This param is a list (instead of just a single class name) to provide the class an opportunity to get the "best" match between the class and the current theme. For example, a button might pass L"OkButton;Button" if its ID=ID_OK. If the current theme has an entry for OkButton, that will be used. Otherwise, we fall back on the normal Button entry.

See examples on this forum ( http://forum.codejock.com/forum_posts.asp?TID=10651&PID=35325" rel="nofollow - link , http://forum.codejock.com/forum_posts.asp?TID=7123&PID=22842" rel="nofollow - link )

I have explored callstack for CXTPSkinManagerSchemaCodeManager::MapKey and can see that SkinFramework doesn't support splitting of ClassList. To compare strings there is used _tcsicmp() which compare whole strings. That is why method MapKey even doesn't have checking of length of string on copying. It expects that class name will be one from global array with class names and parts (gSchemaClassAndPartsCodes).

Also if you want to use single CXTPWinThemeWrapper for all controls you should to know, that CXTPSkinManagerSchemaCodeManager::MapKey method caches key (pszClassList, second parameter of OpenThemeData()).  So for all further calls it will return the same value for this class list. Buffer szHashName size is 255. But even I make dynamic buffer size and splitting of ClassList, then your algorithm will not work because OpenThemeData() always handle first BUTTON and skip all other controls. Except cases when you set theme which doesn't have buttons.


Posted By: olebed
Date Posted: 10 March 2017 at 7:33am
I have fixed noticed defects. Changes will be available in next beta or final release.

Regards,
 Oleksandr Lebed


Posted By: SvenC
Date Posted: 10 March 2017 at 7:59am
Originally posted by olebed olebed wrote:

Changes will be available in next beta or final release

As you hinted several times about that: can you already announce an expected time frame for 18.0 beta and/or release? Really looking forward to that Smile


-------------
--
SvenC

Toolkit Pro 15.3.1, 16.2.4, 16.3.1, 16.4.0, 17.2.0, 17.3.0, 18.0.1, 18.2 with VC++ 2010, 2012, 2013, 2015, 2017


Posted By: olebed
Date Posted: 10 March 2017 at 10:37am
Hello SvenC,

Sorry, I don't know date.

http://www.codejock.com/corporate/release-date-policy.asp" rel="nofollow - When's the Next Product Release?

http://www.codejock.com/corporate/release-date-policy.asp" rel="nofollow - At times, Codejock may offer estimated release dates for version updates to help our customers plan for new features, but generally it is our policy to not provide exact release dates.

http://www.codejock.com/corporate/release-date-policy.asp" rel="nofollow - If an estimated release date is provided, all estimated release dates for version updates are tentative and may change without notice. Since internal scheduling conflicts and/or other unforeseen issues may arise, we can never guarantee an exact release date and therefore cannot be responsible for any delays that may occur. Codejock Software is not responsible for your product releases. When a Codejock Software product is updated and released it will be announced on our  - What's New page and  - RSS feed.



Posted By: Cedric_ar
Date Posted: 10 March 2017 at 11:57am
For runtime check failure. 
i'll change my code according to your reply.


For the Font loading

the Codejock dll project checked and it's ok

On codejock.Toolkitpro.shared project this options ar correctly setup

'Configuration Properties' > General > 'Use of MFC' > 'Use MFC in a Shared DLL'
'Configuration Properties' > 'C/C++' > 'Code generation' > 'Runtime Library' > 'Multi-threaded DLL (/MD)'

but i think it's my project setup that cause the problem. I've a small exe with plenty of dll. I have a dll use for the GUI, these dll is linked to XTP in dll too.

 When i debug void CXTPPrimitiveDrawer::InitFont() this line

HMODULE hResModule = AfxFindResourceHandle( MAKEINTRESOURCE(XTP_IDC_FONT_CODEJOCK), RT_FONT); 

always return my GUI dll not XTP dll ( i've checkef in my dll if a have a same resource type with the same id but no ). then if step in AfxFindResourceHandle, only my gui dll and mfc40s.dll are parsed.

then i try to add this at the begin of function and it's works now 

void CXTPPrimitiveDrawer::InitFont()
{
if (NULL == m_hCodejockMemFont)
{
// custom modification
#ifdef _AFXDLL
#ifdef _DEBUG
HMODULE hResDll = LoadLibrary( _T( "ToolkitPro1730v140x64D.dll") );
else
HMODULE hResDll = LoadLibrary( _T( "ToolkitPro1730v140x64.dll" ) );
#endif
AfxSetResourceHandle( hResDll );
#endif
        // 

I think it's not the best solution, but it's works for me.




Posted By: olebed
Date Posted: 01 October 2017 at 9:13am
Hello,

Thank you for information.
Problem was solved like in http://forum.codejock.com/forum_posts.asp?TID=23215&PID=75612&title=problem-with-docking-pane-icons-after-upgrade#75612" rel="nofollow - this post .


Regards,
 Oleksandr Lebed



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net