Skip to content

BUG:[windows] Missing error handling for RegisterClass in win32_window.cpp #245

@g-k-s-03

Description

@g-k-s-03

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Issue Overview
Some critical WinAPI calls such as RegisterClass and DwmSetWindowAttribute are used without checking their return values. This can make debugging difficult if these calls fail silently.

Steps to Reproduce
Inspect the implementation of WindowClassRegistrar::GetWindowClass()
Observe that RegisterClass is called without checking its return value
Inspect Win32Window::UpdateTheme()
Observe that DwmSetWindowAttribute is called without verifying success

Expected Behavior
WinAPI calls should have their return values checked
Failures should be logged or handled appropriately

Actual Behavior
Failures in these API calls are not detected
Debugging issues related to window creation or theme updates becomes difficult

Suggested Improvements
Add minimal error handling for these calls:
if (!RegisterClass(&window_class)) {
OutputDebugString(L"Failed to register window class\n");
}
HRESULT hr = DwmSetWindowAttribute(...);
if (FAILED(hr)) {
OutputDebugString(L"Failed to set dark mode attribute\n");
}

Record

  • I agree to follow this project's Code of Conduct
  • I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions