Recent

Author Topic: How to debug windows programs executed by a *.lnk  (Read 5756 times)

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
How to debug windows programs executed by a *.lnk
« on: March 18, 2017, 04:11:08 am »
Hi,

Please let me first ask: Is there any difference in either running a program by clicking at the executable or running a program by clicking at a .lnk (link, shortcut)?

I have a program that is behaving badly when executed using shortcuts. I am not completely sure why, I am just suspicious about the .lnk thing.
Be mindful and excellent with each other.
https://github.com/cpicanco/

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: How to debug windows programs executed by a *.lnk
« Reply #1 on: March 18, 2017, 04:53:27 am »
to my knowledge not, but .lnk files can set parameters and working directory differently.

Debugging is like all special execution cases: attach the debugger to the process after start.

Thaddy

  • Hero Member
  • *****
  • Posts: 14361
  • Sensorship about opinions does not belong here.
Re: How to debug windows programs executed by a *.lnk
« Reply #2 on: March 18, 2017, 05:59:48 am »
A .lnk file is comparable to a startup batch or cmd file. So yes, there is a difference in starting a file through its shortcut or directly. It is a binary format described here: https://msdn.microsoft.com/en-us/library/dd891343.aspx
But you can sort of debug it: right click on it and choose properties. Or write an editor/viewer  8-)
« Last Edit: March 18, 2017, 06:13:11 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: How to debug windows programs executed by a *.lnk
« Reply #3 on: March 18, 2017, 08:52:38 pm »
Thank you guys, I will try to figure it out what is happening.
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: How to debug windows programs executed by a *.lnk
« Reply #4 on: March 18, 2017, 08:56:20 pm »
Quote
Debugging is like all special execution cases: attach the debugger to the process after start.

Ok, now the question is how attach the debugger to the process after start?
Be mindful and excellent with each other.
https://github.com/cpicanco/

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1314
    • Lebeau Software
Re: How to debug windows programs executed by a *.lnk
« Reply #5 on: March 21, 2017, 05:39:18 pm »
I have a program that is behaving badly when executed using shortcuts.

Behaving badly HOW exactly?  What behavior is different than when running the EXE directly?
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Thaddy

  • Hero Member
  • *****
  • Posts: 14361
  • Sensorship about opinions does not belong here.
Re: How to debug windows programs executed by a *.lnk
« Reply #6 on: March 21, 2017, 05:53:29 pm »
Quote
Debugging is like all special execution cases: attach the debugger to the process after start.

Ok, now the question is how attach the debugger to the process after start?
Well. Wasn't that obvious... Attach the program that shows up in the lnk, not the lnk....
« Last Edit: March 21, 2017, 05:57:21 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: How to debug windows programs executed by a *.lnk
« Reply #7 on: March 21, 2017, 05:56:17 pm »
Quote
Debugging is like all special execution cases: attach the debugger to the process after start.

Ok, now the question is how attach the debugger to the process after start?

Run -> attach to program

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: How to debug windows programs executed by a *.lnk
« Reply #8 on: March 29, 2017, 06:58:21 pm »
I have a program that is behaving badly when executed using shortcuts.

Behaving badly HOW exactly?  What behavior is different than when running the EXE directly?

I need to load data from files placed at the same folder as the EXE file. Sometimes data is not loaded when running the .lnk. No problems at all when running the EXE directly.

Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: How to debug windows programs executed by a *.lnk
« Reply #9 on: March 29, 2017, 06:59:32 pm »


Run -> attach to program
[/quote]

Thank you marcov!!
Be mindful and excellent with each other.
https://github.com/cpicanco/

 

TinyPortal © 2005-2018