Skip to content

[Win32]: Program.getImageData is broken for ".exe" extension #1130

@tmssngr

Description

@tmssngr

Describe the bug
Until recently Program.getImageData returned an image for .exe files. Now it doesn't any more.

To Reproduce

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.program.*;
import org.eclipse.swt.widgets.*;

public class ProgramIcons {

	public static void main(String[] args) {
		final Display display = new Display();

		final Program exeProgram = Program.findProgram(".exe");
		final ImageData imageData = exeProgram.getImageData();
		final Image image = new Image(display, imageData);

		final Shell shell = new Shell(display);
		shell.addListener(SWT.Paint, event -> {
			event.gc.drawImage(image, 0, 0);
		});

		shell.setSize(400, 300);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		image.dispose();

		display.dispose();
	}
}

Expected behavior
It still should return the generic file icon.

Screenshots
2024-03-21 11_14_06-

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Windows 11

  2. JRE/JDK version

Version since
Since commit 97ca656.

Workaround (or) Additional context
No workaround known.

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