GlobalAlloc / GlobalFree problem on Windows 7

Posted on 2010-09-14
Last Modified: 2013-11-18
We receive strange errors when running our app on Windows 7 systems (we believe it is a Windows 7 problem). W7 runs as 32 Bit system, out app is VB6 based and calls some C++ DLLs, in one of which the error occurs. The app runs stable on 150 PCs (in majority Win2000 and Win XP).

This code fragment is a part of Chris Maunder's DataGridCtrl, where the complete grid shall be printed. See the code part and the error situation in the screenshot; GlobalFree causes an error.

I would try to use another allocating technique (if allocating an HGLOBAL can be done alternatively), but I'd like to understand what's the problem here in Windows 7.
Question by:PC-Alex
  • 3
  • 3
LVL 86

Expert Comment

ID: 33683126
"Break instruction exception" actually points to a an error condition being raised in 'datagrid.ocx' - you should rebuild that as 'Debug' with symbols to see what causes that. '0xc0000374' is 'STATUS_HEAP_CORRUPTION', see ("NTSTATUS values")

Author Comment

ID: 33683193

thanks for the comment ... we are *inside* datagrid.ocx there, where you see the code. This code is the code inside this ocx where the crash happens; this is the last place outside the Windows API or Kernel function until where I can track the error
LVL 86

Expert Comment

ID: 33683317
Yes, but the debugger also states "Cannot find symbols for datagrid.ocx", to a debug (or release) build with symbols might help tracking down the error.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 33683823
now I'm a little confused. I'm sure he knows where to access the .pdb file, otherwise he wouldn't show me the exact line of code. Or am I missing something ?

Is there more to the symbol information than the .pdb file ?

I've given him the path to the DebugU folder (where all compiler output is located) and reloaded, but nothing changed, see the screenshot.

I think he's missing symbols for the vb runtime ?
LVL 86

Accepted Solution

jkr earned 500 total points
ID: 33683893
Ah, OK, I might have missed that. The German variable names made me think it was the code that calls the OCX.

As a side note: There is no need to use 'GlobalAlloc()' for a DEVMODE struct, you can just declare it as

DEVMODE dmDevMode;

and use it. I wonder whether that would fix the whole problem or just the symptom...

Author Comment

ID: 33683913
OK, good Idea, I'll try and report ...

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 66
Change owner from userA to server Local Administrators 7 71
Line meaning 9 91
mapBully challenge 6 177
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question