* * *

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

cpicanco

  • Full Member
  • ***
  • Posts: 208
    • My 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.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5429
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: 3640
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 »
Why do the Danish always try to fuck up any programming language?

cpicanco

  • Full Member
  • ***
  • Posts: 208
    • My 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.

cpicanco

  • Full Member
  • ***
  • Posts: 208
    • My 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?

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 260
    • 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) open source project - Admin, Developer

Thaddy

  • Hero Member
  • *****
  • Posts: 3640
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 »
Why do the Danish always try to fuck up any programming language?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5429
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

  • Full Member
  • ***
  • Posts: 208
    • My 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.


cpicanco

  • Full Member
  • ***
  • Posts: 208
    • My 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!!

 

Recent

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