Malformed call to ChangeDisplaySettings() causing BSOD on Windows 7

1

The following program causes a BSOD on my fully patched Windows 7 machine and a Windows 7 machine of a colleague - the systems are very different configurations so I don't think it's a driver issue. It seems that something just can't handle a request for a display mode that only includes a zero display frequency. Here's the code that triggers a BSOD under Visual Studio 2012 Update 3:

#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    DEVMODE mode = { 0 };

    mode.dmSize = sizeof(DEVMODE);
    mode.dmFields = DM_DISPLAYFREQUENCY;

    ChangeDisplaySettings(&mode, CDS_FULLSCREEN);

    return 0;
}

Adding the following line prior to ChangeDisplaySettings() stops the BSOD occurring:

    mode.dmDisplayFrequency = 60;

The BSOD details are:

*** STOP 0x0000007E (0xFFFFFFFFC0000094, 0xFFFFF96000685577, 0xFFFFF88015313638, 0xFFFFF88015312E90)
***      cdd.dll - Address FFFFF96000685577 base at FFFFF96000680000, DateStamp 4d4a90a5

I'm posting this as a question because I'm interested if anyone else has noticed it or has any comments, and also so that a cause of this particular BSOD is out there in case it helps anyone in the future.

Also interested in whether others are able to reproduce it reliably as well.

If you post a thoughtful/interesting/relevant response/answer/discussion then the rep is yours!

windows
winapi
crash
bsod
asked on Stack Overflow Jul 29, 2013 by Richard Viney

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0