* * *

Author Topic: Compile IDE for non supported OS (actually could I modify source a bit)  (Read 351 times)

Azvareth

  • New member
  • *
  • Posts: 10
Hi

Before anyone shout out that this OS is not supported and what not, actually what I am trying to do is to figure out if it is possible to remove some part in the source (or change it) to compile the IDE.

Background:
I tried to recompile the IDE 1.4.4 on a physical Windows 98SE, 512MB RAM, AMD Athlon 3200+ and all unofficial updates and patches that exists to this day (as far as I know). According to the documentation that exists it should work, but I came along some problem, a call to Process32FirstW in kernel32.dll I think (which came with XP?) that function name does not exist on W98:Kernel32.DLL, or if it does it throw an error when launching lazarus IDE. as far as I know it is named Process32First there.

So I run a search in the source files and found that the call was made from (pasted from agent ransack)
debugattachdialog.pas H:\DEV\lazarus\debugger\                                    2015-01-09 11:33:13 9 KB  Pascal Source Code 1   
jwatlhelp32.pas       H:\DEV\lazarus\fpc\2.6.4\source\packages\winunits-jedi\src\ 2010-04-30 15:01:55 19 KB Pascal Source Code 9

As you can see, there is two references, my question is (based on the names of the files) is it possible to remove those references (or files) and still get the IDE to work?

Or perhaps modify the reference to take the Win98 function

in debugattachdialog.pas the call is made like this
Code: Pascal  [Select]
  1.   {$ifdef WIN9XPLATFORM}
  2.   Result := False;
  3.   {$else}
  4.   Result := True; // we can enumerate processes
  5.   if not Assigned(AList) then
  6.     Exit;
  7.  
  8.   hShot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  9.   if hShot = INVALID_HANDLE_VALUE then
  10.     Exit;
  11.  
  12.   try
  13.     FillByte(pe, SizeOf(pe), 0);
  14.     pe.dwSize := SizeOf(pe);
  15.     if Process32FirstW(hShot, pe) then           //<------------ NOT CORRECT OR?
  16.     repeat
  17.       item := TRunningProcessInfo.Create(pe.th32ProcessID, pe.szExeFile);
  18.       AList.Add(item);
  19.     until not Process32NextW(hShot, pe);      //<------------- NOT CORRECT OR?
  20.   finally
  21.     CloseHandle(hShot);
  22.   end;
  23.   {$endif}


the function arguments for the Win98 seems similar to the latter OS versions (only the name differs) is it possible to change this without breaking something else or do you have other method to use when fixing stuff?

And btw, I am not a pro coder, more like a scriptie elderly - so I am not to familiar with deeper OS and system stuff, or how lazarus works behind the sceene...

I hope someone understand what I am trying to achieve here, and hopefully can give some advice. Thank you.

wp

  • Hero Member
  • *****
  • Posts: 4743
The only advice that you will get in such a border case is: Try it. What can go wrong? And it is free code, you can do on your machine whatever you want.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

GetMem

  • Hero Member
  • *****
  • Posts: 3083
You should build the IDE with Process32First, Process32Next those functions are available in win98.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6328
Rule of thumb: if the system comes with FPC 3.0.x, it will be hard.

In your case it comes with 2.6.x, so at least you have a change. There are probably only two hands of places that might need fixing, maybe even less.

So it is just find place where missing call is used (and that is probably not jwatlhelp32, but some other places that USES those declarations), fix/replace it (internet is your friend) recompile everything, check what breaks next etc etc.

Or just try to go versions back in time till you find one that works.

Azvareth

  • New member
  • *
  • Posts: 10
The only advice that you will get in such a border case is: Try it. What can go wrong? And it is free code, you can do on your machine whatever you want.

->Thank you!

You should build the IDE with Process32First, Process32Next those functions are available in win98.

-> I did exactly that in the source of debugattachdialog.pas

Rule of thumb: if the system comes with FPC 3.0.x, it will be hard.

In your case it comes with 2.6.x, so at least you have a change. There are probably only two hands of places that might need fixing, maybe even less.

So it is just find place where missing call is used (and that is probably not jwatlhelp32, but some other places that USES those declarations), fix/replace it (internet is your friend) recompile everything, check what breaks next etc etc.

Or just try to go versions back in time till you find one that works.

-> Actually I have also read, but I might be wrong that some IDE's that where shipped with 3.x of FPC could be made to compile with the FPC2.6.x



So it did work, I changed the function names in debugattachdialog.pas file and it compiled fine just as before, when I tried to launch the IDE it did work... I tested a Button and MessageBox "hello world" test and it compiled and did run just fine... Can't tell if more complex applications would fail.

Conclusion: The code inside the source is wrong, there is directive that IF it is compiled for Win9x use a library that is for XP and up. However noone has complained? I guess that noone has ever tried it with W9x so there is not much to say about it, just that if someone else "would" like to compile it for the same OS, this post provides information to fix that error...


//Thank you!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4666
    • wiki
The code in debugattach.... is only used by the attach dialog to. Afaik it shows a list of all running processes. So you will be able to live without it. Normal debugging (F9) should not be affected.

Also IIRC if the dialog returns false or something, then you  can still enter the PID directly. That is if you need "attach".

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus