Recent

Author Topic: [LAZARUS 3.2] TIHelp32 not found  (Read 2285 times)

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
[LAZARUS 3.2] TIHelp32 not found
« on: May 22, 2024, 01:59:25 pm »
I'm trying to port program from Delphi 7 to Lazarus but I'm stuck at the very beginning. 
Why does Lazarus report this error? File is not missing as you can see?

https://i.postimg.cc/BbFsCfDw/Capture.png
https://i.postimg.cc/nV9HxB5Y/Capture2.png




Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #1 on: May 22, 2024, 02:02:19 pm »
Save your project and keep all files in the same directory

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #2 on: May 22, 2024, 02:09:53 pm »
Save your project and keep all files in the same directory

ok. manually copying tlhelp32.pas to project folder fixed this issue. Why do we have to do this now in lazarus? Delphi 7 didn't have that problem.
« Last Edit: May 22, 2024, 02:11:59 pm by Atak_Snajpera »

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #3 on: May 22, 2024, 02:14:38 pm »
Thats how FPC looks for unit files. Either add paths to the project options or keep files in the same directory (C:\Users\...\Temp\project1.lpr vs C:\Lazarus\...\tlhelp32.pas).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11947
  • FPC developer.
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #4 on: May 22, 2024, 02:15:59 pm »
That tlhelp32 is for windows CE. Which is why it isn't found by default.

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #5 on: May 22, 2024, 02:16:31 pm »
Oh its not your unit? Right

use JwaTlHelp32

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #6 on: May 22, 2024, 02:23:04 pm »
JwaTlHelp32 is better than tlhelp32?

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #7 on: May 22, 2024, 02:27:04 pm »
FPC doesnt have tlhelp32.pas (at least I dont see it in my installation (except for WinCE)), so the only choice is the JEDI version

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #8 on: May 22, 2024, 02:31:15 pm »
Thank you for you help.
By the way. Can Lazarus automatically convert old delphi 7 console app code to new layout used in Lazarus?

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #9 on: May 22, 2024, 02:37:56 pm »
Can Lazarus automatically convert old delphi 7 console app code
Yes and no. If you have only components and units wich are in Delphi and Lazarus it can work. But often 3rd party components are used and then the convert (and rewrite) must be done by hand.

Sometimes you are faster do the conversion by hand and step by step. You can convert a sample and look what trhe conversion tool is doing.
 
regards
Andreas

440bx

  • Hero Member
  • *****
  • Posts: 4746
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #10 on: May 22, 2024, 02:40:18 pm »
I ran into that problem a few years ago.

I made my own copy of TLHelp32 which works for Delphi (I use Delphi 2) and FPC.

In case you might find it useful, I attached it to this post.  Actually, what is attached is an example program that uses toolhelp to determine the bitness and subsystem of every program running in the system.  Note that you may get a warning about being unable to acquire the debug privilege if you run the program as a normal user.  Full source and project included (along with the copy of TLHelp32.pas you need.)  Enjoy!.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #11 on: May 22, 2024, 02:59:32 pm »
I see that converting from 32bit Delphi 7 to 64bit Lazarus gives me a lot of errors



 

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11947
  • FPC developer.
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #12 on: May 22, 2024, 03:07:54 pm »
Delphi 7's RTL hasn't been changed for 64-bit issues yet, while FPC's has.  You need at least Delphi XE2 or XE3 for 64-bit on the Delphi side.

Don't forget to compile in {$mode delphi}

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #13 on: May 22, 2024, 03:17:22 pm »
Even simple Synchronize does not work

Code: Pascal  [Select][+][-]
  1. procedure TWorkerThread.OutputSynchronizationWhite;
  2. var text:string;
  3. begin
  4.  
  5.   ProcessIDtoSupervise:=ProcessID;
  6.   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
  7.   text:='['+DateTimeToStr(Now)+'] '+ProcessCommandLine+' (PID:'+IntToStr(ProcessID)+') executed.';
  8.   WriteLn(text);
  9.   Log.Add(text);
  10.  
  11. end;
  12.  
  13. procedure TWorkerThread.RunProcess(CMD:String;ProcessPriority:cardinal;WindowStatus:Word);
  14. const ReadBuffer = 2400;
  15. var
  16.    Security : TSecurityAttributes;
  17.    ReadPipe,WritePipe : THandle;
  18.    startInfo : TStartUpInfo;
  19.    ProcessInfo : TProcessInformation;
  20.    Buffer : Pchar;
  21.    BytesRead : DWord;
  22.    Apprunning : DWord;
  23. begin
  24.  
  25.   With Security do
  26.   begin
  27.  
  28.     nlength := SizeOf(TSecurityAttributes) ;
  29.     binherithandle := true;
  30.     lpsecuritydescriptor := nil;
  31.  
  32.   end;
  33.  
  34.   if Createpipe (ReadPipe, WritePipe, @Security, 0) then
  35.   begin
  36.  
  37.     Buffer := AllocMem(ReadBuffer + 1) ;
  38.     FillChar(StartInfo,Sizeof(Start),#0) ;
  39.     startInfo.cb := SizeOf(start) ;
  40.     startInfo.dwFlags := STARTF_USESHOWWINDOW;
  41.     startInfo.wShowWindow := WindowStatus;
  42.  
  43.     if CreateProcess(nil,PChar(CMD),nil,nil,true,ProcessPriority,nil,nil,startInfo,ProcessInfo) then
  44.     begin
  45.       ProcessCommandLine:=CMD;
  46.       ProcessID:=ProcessInfo.dwProcessId;
  47.       Synchronize(OutputSynchronizationWhite);
  48.       repeat
  49.         Apprunning := WaitForSingleObject(ProcessInfo.hProcess,100);
  50.       until (Apprunning <> WAIT_TIMEOUT);
  51.  
  52.     end;
  53.  
  54.     FreeMem(Buffer);
  55.     CloseHandle(ProcessInfo.hProcess);
  56.     CloseHandle(ProcessInfo.hThread);
  57.     CloseHandle(ReadPipe);
  58.     CloseHandle(WritePipe);
  59.  
  60.   end;
  61.  
  62. end;                              

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: [LAZARUS 3.2] TIHelp32 not found
« Reply #14 on: May 22, 2024, 03:29:32 pm »
If you are curious I have attached full Delphi 7 source code which I'm trying to convert to 64 bit lazarus.

 

TinyPortal © 2005-2018