Discoverd this trying to add data to comboboxes.
Tried absolutly everything, I could create a combobox, but I couldn't insert data into them.
Ended up placing the code in an area you shouldn't ever place code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
int result;
PAINTSTRUCT ps;
HDC hdc;
TCHAR szHello[MAX_LOADSTRING];
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
if(AllowBSOD==true)
{
combo1= CreateWindowEx(WS_EX_STATICEDGE, "COMBOBOX", "MyCombo1", CBS_DROPDOWNLIST | WS_VISIBLE, 100+(cnt*140), pzypos[9], 80, 14, hWnd, NULL, hInst, NULL);
SendMessage(combo1,CB_ADDSTRING , 0, (LPARAM) (LPCTSTR) strDesc);
}
switch (message)
{
case WM_CREATE:
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
RECT rt;
GetClientRect(hWnd, &rt);
DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
*** STOP: (0x0000007F 0x00000008, 0x8DB4E750, 0x00000000, 0x00000000)
0x0000007F UNEXPECTED_KERNEL_MODE_TRAP
The full list of BSOD errors are here:
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-code-reference2?redirectedfrom=MSDN
The UNEXPECTED_KERNEL_MODE_TRAP bug check has a value of 0x0000007F.
This bug check indicates that the Intel CPU generated a trap and the
kernel failed to catch this trap.
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7f--unexpected-kernel-mode-trap
The vulnerability only works on windows 7.
The full visual studio workplace for this bsod project is here:
https://easyupload.io/qvcd89
NtRaiseHardError
, an undocumented (but well-known) function, can trigger a BSOD from user mode. – Gynecologist