BUG: MMC - Access Violation with Multiple Property Pages (309554)
The information in this article applies to:
- Microsoft Management Console 2.0
- Microsoft Management Console 1.0
- Microsoft Management Console 1.1
- Microsoft Management Console 1.2
This article was previously published under Q309554 SYMPTOMS Microsoft Management Console (MMC) may experience an access
violation (AV) when two property sheets are displayed at the same time and the
user switches back and forth between pages on the two sheets. This can happen
when two snap-ins are implemented in the same dynamic link library (DLL) and
both snap-ins are displaying property sheets with pages derived from MFC's CPropertyPage class. CAUSE MMC's library function MMCPropPageCallback only maintains a single pointer to a property page callback
function. The pointer is always set by the last call to this library function.
When multiple property page callbacks are used at the same time in a single
DLL, all the callbacks will point to the last set callback function, which
might not be the one a particular page is expecting. An AV will likely happen
if this last set callback function is expecting to interpret the page's data.
For example, it might cast LPARAM to a pointer for a specific class. Use of
this pointer will then likely cause an AV. RESOLUTION There are a several ways to work around this problem:
- Call MMCPropPageCallback before you assign your custom callback to m_psp.pfnCallback. Then, MMC's internal pointer will always point to MFC's callback
function AfxPropPageCallback.
- Use a single callback function for multiple property
pages.
- Do not implement more than one snap-in in a single
DLL.
Note When you are using CPropertyPage with MMC, it is required that you call MMCPropPageCallback to set the correct MFC module state during page creation.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.
Modification Type: | Minor | Last Reviewed: | 3/20/2004 |
---|
Keywords: | kbDSWManage2003Swept kbbug kbnofix KB309554 |
---|
|