From a78d55b5276a89d615c0f753f8697cf61c0a8855 Mon Sep 17 00:00:00 2001 From: Roald van Doorn Date: Mon, 4 Dec 2023 11:01:23 +0100 Subject: [PATCH] Resolved 64-bit incompatibility in singe instance checks --- X2UtSingleInstance.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/X2UtSingleInstance.pas b/X2UtSingleInstance.pas index 3be43b8..b04cb28 100644 --- a/X2UtSingleInstance.pas +++ b/X2UtSingleInstance.pas @@ -300,7 +300,7 @@ begin { Attempt to create shared memory } SetLastError(0); - FFileMapping := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, + FFileMapping := CreateFileMapping(INVALID_HANDLE_VALUE, nil, PAGE_READWRITE, 0, SizeOf(TX2InstanceMapData), PChar(ScopePrefix[Global] + 'SingleInstance.' + ApplicationID)); @@ -330,8 +330,7 @@ begin if FileMapData^.Window = 0 then RaiseLastOSError(); - SetWindowLong(FileMapData^.Window, GWL_WNDPROC, - Integer(MakeObjectInstance(WindowProc))); + SetWindowLongPtr(FileMapData^.Window, GWL_WNDPROC, NativeInt(MakeObjectInstance(WindowProc))); end; Inc(FFileMapData^.RefCount);