Recent

Author Topic: Help needed for a little stub program.  (Read 4649 times)

JasonM

  • Newbie
  • Posts: 3
Help needed for a little stub program.
« on: May 18, 2017, 01:32:28 pm »
Problem solved in another language thanks guys.
« Last Edit: May 18, 2017, 10:15:22 pm by JasonM »

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Help needed for a little stub program.
« Reply #1 on: May 18, 2017, 01:44:24 pm »
My own program uses stub to execute Win32 or Win64 version of program, depending on which one is available, while keeping the same cmd line and startup info (unused now, but I know one stupid program, that loses command line when launches update). Use it as example. Write it in assembler to avoid ~300Kb of runtime code. If written in assembler - it should be 2-3Kb.

P.S. Why can't you perform your "cleanup" directly from your program?
« Last Edit: May 18, 2017, 05:46:33 pm by Mr.Madguy »
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

Fungus

  • Sr. Member
  • ****
  • Posts: 353
Re: Help needed for a little stub program.
« Reply #2 on: May 18, 2017, 01:45:30 pm »
This sounds like something shady.. Like someone wants to remove an executable after it has been executed - bad behaviour! You should remove temp files in the program that creates them. A workaround for your issue is to launch cleanup.bat from classic.exe as the last thing before exiting classic.exe. In cleanup.bat make a loop which continuously tries to delete the temp folder until it succeeds.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Help needed for a little stub program.
« Reply #3 on: May 18, 2017, 03:57:56 pm »
This sounds like something shady.. Like someone wants to remove an executable after it has been executed - bad behaviour!

Then we should dump lazarus because of startlazarus ?  ;)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Help needed for a little stub program.
« Reply #4 on: May 18, 2017, 04:33:56 pm »
PS: The reason I need this stub is because I cannot delete a directory tree while it is locked and the only way it will unlock for deletion is after Classic.exe exits from memory
That's False. It is not restraint on the classic.exe any program/file that is open inside the tree will stop the deletion process.
so I have no other option but to use a stub like this.
Including the stub program you ask for if it resides in the same directory with classic.exe.
Spawning the task post-exit is not proving successful via node.js unfortunately... perhaps due to its asynchronous nature.
what task? which application performs this task and where is the application located? node.js needs your browser to execute it is not self sufficient.

In sort you are better of using the task scheduler (for example in windows) to schedule and execute a command like
Code: [Select]
cmd /c rmdir c:\test /s/q in say 30 or 60 seconds from now and then exit your application.
here is a short article for using the task scheduler in windows from the command line https://www.windows-commandline.com/schedule-tasks-command-line/
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

JasonM

  • Newbie
  • Posts: 3
Re: Help needed for a little stub program.
« Reply #5 on: May 18, 2017, 09:10:17 pm »
Guys, I really think we should stick to the Pascal section of my post which is why I am here. If I’ve posted this thread in the wrong section then do let me know.

Please note that I am NOT asking for advice in anything outside of the Pascal section thanks, so please don’t offer any. Thank you.

In the mid 90s it would’ve taken me probably <1 minute to proofread 4-5 lines of Pascal code to visually inspect and verify if it is correct and then probably another 2 minutes to dig into my libraries and copy-paste a string of a dozen compiler directives that will result in a fast and efficient Windows executable… had someone asked… and indeed I had helped countless people through the Fidonet and later Internet, in their programming endeavors, so I don’t believe I’m asking for too much here.

So, do we have a gentleman here that can do that for me?

That is…

1. Inspect and verify the code syntax above.

2. Suggest a string of compiler directives for a fast and efficient executable.

3. Perhaps comment a bit about compiling for all Windows versions… what is needed etc if anything special.

4. And finally offer a link to a decent compiler so we can generate an executable out of it.

Thanks in advance guys.  :D


Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: Help needed for a little stub program.
« Reply #6 on: May 18, 2017, 10:13:37 pm »
hi !   i will try to help :
1. post a link to your source
2. not any fancy directives are needed to compile this... especialy for windows... win xp ... win 10 console apps works out of the box
3. any version of the fpc will do the job... from 2.0 up to 3.02...  may be 32 bits to be able to run anywhere including wow
... anyway ... post the code i will compile it tomorrow morning ... now its late night in europe :)

p.s : i just mentioned your code is 2 lines :))) do not post it i will copy/paste :)))
« Last Edit: May 18, 2017, 10:18:03 pm by Blestan »
Speak postscript or die!
Translate to pdf and live!

JasonM

  • Newbie
  • Posts: 3
Re: Help needed for a little stub program.
« Reply #7 on: May 18, 2017, 10:23:00 pm »
Thanks a million for sticking to the issue at hand and offering to help but the problem has just been resolved.

 More people like you are needed in programming forums and far fewer of the above. :)

BobS

  • Full Member
  • ***
  • Posts: 153
Re: Help needed for a little stub program.
« Reply #8 on: May 19, 2017, 09:34:10 am »
Please don't replace your OP, now I have no idea what this was even about and it makes the replies useless. 

When you post in a general forum you're likely to get lots of answers, people may see ideas you hadn't though about, just be patient, you might learn something and if not, all you've wasted is a few seconds of time, but someone else might learn something--though not here with your OP gone. 

If you aren't getting what you need, then look and see why, maybe too vague, maybe people need to see source to help etc. or are just misunderstanding your OP in which case try to clarify.  Sarcasm will tend to get you nowhere, as in the future people will be less likely to want to help.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Help needed for a little stub program.
« Reply #9 on: May 19, 2017, 10:28:58 am »
Please don't replace your OP, now I have no idea what this was even about and it makes the replies useless. 

I also wonder what other language because the language doesn't matter here.
Specialize a type, not a var.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Help needed for a little stub program.
« Reply #10 on: May 19, 2017, 11:38:58 am »
Problem solved in another language thanks guys.
How rude! >:(
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018