none
Device property page extension dll failing on certain 32-bit OS RRS feed

  • Question

  • I'm getting a "Device Manager MMC Snapin has stopped working" dialog when attempting to invoke a custom property page provider.  This is only happening in Win7 Pro x86.  Win8.x Pro x86 and all other x64 work.  I build x64 and x86 and install the OS-appropriate version.

    If I debug in Windbg, I see:

     

    (774.654): Access violation - code c0000005 (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    eax=7f4b4f44 ebx=00000000 ecx=774c5279 edx=0200001c esi=00000000 edi=00181fec
    eip=6e3510ca esp=000ff410 ebp=000ff41c iopl=0         nv up ei pl nz na po nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
    devmgr!CPropSheetData::InsertPage+0x37:
    6e3510ca 8b58fc          mov     ebx,dword ptr [eax-4] ds:0023:7f4b4f40=????????

    0:000> kb
    ChildEBP RetAddr  Args to Child              
    000ff41c 6e35d34b 00181fec 00000000 349e66cf devmgr!CPropSheetData::InsertPage+0x37
    000ff928 6e35d877 000d0210 00000000 001764f8 devmgr!DevicePropertiesEx+0x234
    000ff988 6e35dba5 000d0210 00030000 00172866 devmgr!DeviceProperties_RunDLL+0x79
    000ff9cc 0003137d 000d0210 00030000 00172866 devmgr!DeviceProperties_RunDLLW+0x30
    000ffa44 00031326 6e35db75 000d0210 00030000 rundll32!CallRunDllFunction+0x22
    000ffa90 00031901 00172820 00000000 00172866 rundll32!wWinMain+0x122
    000ffb24 7657ee1c 7ffdd000 000ffb70 77bd37eb rundll32!_initterm_e+0x1b1
    000ffb30 77bd37eb 7ffdd000 77c4e86e 00000000 kernel32!BaseThreadInitThunk+0xe
    000ffb70 77bd37be 0003178c 7ffdd000 00000000 ntdll!__RtlUserThreadStart+0x70
    000ffb88 00000000 0003178c 7ffdd000 00000000 ntdll!_RtlUserThreadStart+0x1b

    This happens after my dll has been loaded, called CreatePropertySheetPage(), called the passed registration "fAddFunc" callback and exited my UAC2PropertyPageProvider function (shown below).

    I've stepped through the faulting code in devmgr.dll but its pretty difficult to see whats happening without private symbols, etc.

    Why would this happen only on Win7 x86 and NOT win8 x86?  And furthermore, why would it work in x64 unilaterally?

    Any help is appreciated greatly. 

    Provider function for reference

    /////////////////////////////////////////////////////////////////////////////////
    // UAC2PropPageProvider
    /////////////////////////////////////////////////////////////////////////////////
    // This function gets called by the device manager when it asks for additional
    // property sheet pages. The parameter fAddFunc is the function that we call to
    // add the sheet page to the dialog.
    // This routine gets called because the registry entry "EnumPropPage32" tells
    // the device manager that there is a dll with a exported function that will add
    // a property sheet page.
    // Because we want to fail this function (not create the sheet) if the driver
    // doesn't support the private property, we have to do all the work here, that
    // means we open the device and get all the information, then we close the
    // device and return.
    //
    // Arguments:
    //    pPropPageRequest - points to SP_PROPSHEETPAGE_REQUEST
    //    fAddFunc         - function ptr to call to add sheet.
    //    lparam           - add sheet functions private data handle.
    //
    // Return Value:
    //    BOOL: FALSE if pages could not be added, TRUE on success
    BOOL UAC2PROPERTYPAGE_API UAC2PropertyPageProvider(PSP_PROPSHEETPAGE_REQUEST pPropPageRequest, LPFNADDPROPSHEETPAGE fAddFunc, LPARAM lParam)
    {
    	//    PSP_DEVICE_INTERFACE_DETAIL_DATA pDeviceInterfaceDetailData;
    	PROPSHEETPAGE                    PropSheetPage;
    	HPROPSHEETPAGE                   hPropSheetPage;
    
    	// Check page requested
    	if (pPropPageRequest->PageRequested != SPPSR_ENUM_ADV_DEVICE_PROPERTIES)
    	{
    		return FALSE;
    	}
    
    	// Check device info set and data
    	if ((!pPropPageRequest->DeviceInfoSet) || (!pPropPageRequest->DeviceInfoData))
    	{
    		return FALSE;
    	}
    
    	// Make sure the driver can be accessed...
    
    	filterList.Enumerate();
    	if (filterList.size() < 1)
    	{
    		MessageBox(NULL, _T("Device notPresent"),_T("UAC2 Property Page Provider"), MB_OK);
    		return FALSE;
    	}
    	g_NvnKsAudFilter = (CFFUSB2AudioFilter *)filterList[0];
    
    
    	// initialize the property page
    	PropSheetPage.dwSize = sizeof(PROPSHEETPAGE);
    	PropSheetPage.dwFlags = 0;
    	PropSheetPage.hInstance = ghInstance;
    	PropSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE);
    	PropSheetPage.pfnDlgProc = DialogProc;
    	PropSheetPage.lParam = (LPARAM)g_NvnKsAudFilter;
    	PropSheetPage.pfnCallback = NULL;
    
    	// create the page and get back a handle
    	hPropSheetPage = CreatePropertySheetPage(&PropSheetPage);
    	// add the property page
    	if (!(*fAddFunc)(hPropSheetPage, lParam))
    	{
    		DestroyPropertySheetPage(hPropSheetPage);
    		return FALSE;
    	}
    
    	return TRUE;
    }



    Monday, May 5, 2014 12:49 PM

Answers

  • Hi Doron.  I've stepped through my provider export function called by devmgr no visible stack corruption as it returns to the correct point in devmgr.dll.  

    The DialogProc never gets called.  The only other callback (that I'm aware of) would be from PropSheetPage.lpfnCallback if it were not NULL, which it is.

    Heap corruption maybe, which I will investigate, but why does this fail ONLY under Win7 Pro x86???  Its working under:

    Win7 x64, Win8Pro x86, x64 Win8.1Pro x86, x64

    Win7Pro x86 is the only one it does not work on.  We have tried multiple fresh installs both with and without SP1!

    Might the checked build of devmgr.dll (or some component) have some logging that could be enabled?

    Thanks.

    • Marked as answer by Wade_Dawson Saturday, December 20, 2014 11:43 PM
    Monday, May 5, 2014 10:09 PM

All replies

  • you have to step through your code and all callbacks. you could very well be corrupting the stack or passing a freed pointer back.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, May 5, 2014 9:40 PM
  • Hi Doron.  I've stepped through my provider export function called by devmgr no visible stack corruption as it returns to the correct point in devmgr.dll.  

    The DialogProc never gets called.  The only other callback (that I'm aware of) would be from PropSheetPage.lpfnCallback if it were not NULL, which it is.

    Heap corruption maybe, which I will investigate, but why does this fail ONLY under Win7 Pro x86???  Its working under:

    Win7 x64, Win8Pro x86, x64 Win8.1Pro x86, x64

    Win7Pro x86 is the only one it does not work on.  We have tried multiple fresh installs both with and without SP1!

    Might the checked build of devmgr.dll (or some component) have some logging that could be enabled?

    Thanks.

    • Marked as answer by Wade_Dawson Saturday, December 20, 2014 11:43 PM
    Monday, May 5, 2014 10:09 PM
  • I guess I'll open a support incident.  I'm stuck here.
    Thursday, May 8, 2014 6:38 PM
  • Did you ever find a solution for this problem?  I am having a similar issue with a device CoInstaller when adding a property page.  64-bit works fine, but 32-bit keeps throwing an access violation exception.

    Friday, October 28, 2016 6:11 PM