Search code examples
delphidelphi-10.3-rio

Error when trying to debug a 64-bit console application


I try to debug a simple 64-bit console application in Delphi 10.3.3 Rio:

program ShellLinkShortcutTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  JclShell,
  System.SysUtils;

const
  ShortcutFile = 'R:\myshortcut.lnk';
  ShortcutTarget = 'C:\Windows\System32\notepad.exe';

function SaveShortcutShellLink(const AFile: string): string;
var
  SL: JclShell.TShellLink;
  HR: Integer;
begin
  Result := 'error';

  SL.Target := ShortcutTarget;
  SL.Description := 'My description';
  HR := JclShell.ShellLinkCreate(SL, AFile);
end;

begin
  try
    Writeln(SaveShortcutShellLink(ShortcutFile));
    Readln;
  except
    on E: Exception do
    begin
      Writeln(E.ClassName, ': ', E.Message);
      Readln;
    end;
  end;
end.

enter image description here

But as soon as I press F9 I get this error message:

enter image description here

What is even more strange: The file wmcipc.cpp does not exist!

However, debugging the same program as 32-bit works without problems.

My OS: Windows 7 x64 SP1

What is wrong here?


Solution

  • But as soon as I press F9 I get this error message:

    That is a very old and well-known error in the Delphi 64-bit debugger:

    https://forums.embarcadero.com/thread.jspa?messageID=712725 (link dead, here is an archive.org snapshot from December 8th, 2016)

    It has a simple fix:

    Open a command prompt as Administrator, and run

    netsh winsock reset

    After rebooting, your 64-bit debugger should work again.

    This will remove any other winsock LSPs that you have, so you will need to re-install them. (firewalls, security software, etc.)


    What is even more strange: The file wmcipc.cpp does not exist!

    It is not supposed to exist on your machine. You are seeing an assertion error raised from the debugger itself, not from your project. The wmcipc.cpp source file is internal to the debugger's implementation.