Author Topic: Console apps and folders with spaces.  (Read 153 times)

AssemblyChallenge

  • Member
  • **
  • Posts: 93
Console apps and folders with spaces.
« on: November 10, 2017, 05:28:41 PM »
Hi, good friend Ramon.

Several days ago I was sorting out some stuff in my computer and simply decided to run one of my tools. To my surprise, it crashed, as you can see in the attached images. After checking back and forth for incompatibilities -none found- I noted that crashing only happens if I put the exe file in a folder with spaces on its name, say:

c:\myapps\miprog.exe  --> all good
c:\my apps\miprog.exe --> crash

The program in question was finished months ago with one of the 2.01 versions of EC, also, it is a command line program (Visual one's are Ok).
Then, I took another program, finished two years ago and also crashed when copied on any folder with spaces. No big deal, I told myself, so in order to replicate the problem I created a new empty command line project ("Hello world") and after compiling... it doesn't crash  :dazzled:

Any light on this? Reading the history of fixes there is none I can find regarding this issue.

Thank you.

rsala

  • Moderator
  • Member
  • *****
  • Posts: 239
    • Easy Code
Re: Console apps and folders with spaces.
« Reply #1 on: November 13, 2017, 10:03:39 PM »
Hi friend,

I am at work now, but I will have a look when I can. However, I am afraid that is a Windows restriction. A whole path or a file name with spaces must be passed between doble quotes "c:\my apps\miprog.exe" and I do not remember if EC takes care of that (but I do not think so).

Regards!
EC coder

AssemblyChallenge

  • Member
  • **
  • Posts: 93
Re: Console apps and folders with spaces.
« Reply #2 on: November 14, 2017, 03:44:40 AM »
Interesting.

My poor programs don't even have the chance to complain, they crash right away :lol:

Yet, it is so simple as creating a new folder with spaces, put a copy of the app and double clicking in Explorer.

Really puzzled about this one. Let me know if I can help you.  :t

rsala

  • Moderator
  • Member
  • *****
  • Posts: 239
    • Easy Code
Re: Console apps and folders with spaces.
« Reply #3 on: November 14, 2017, 04:26:33 AM »
Hi again,

I created the "c:\my apps" folder (with a space), then created a default console program and it compiles and works fine, so I cannot see what you report. Could you send the failing project please?

Thanks in advance!
EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 239
    • Easy Code
Re: Console apps and folders with spaces.
« Reply #4 on: November 16, 2017, 04:31:08 AM »
There is no problem with EC v2 and folders with spaces. The only problem is that executable file (console or not console) can not have any space in its name, but that is a Windows restriction and there is nothing EC v2 can do about it.

Please make sure you have the latest version of EC v2.

Regards!
EC coder

jj2007

  • Member
  • *****
  • Posts: 7627
  • Assembler is fun ;-)
    • MasmBasic
Re: Console apps and folders with spaces.
« Reply #5 on: November 16, 2017, 04:41:16 AM »
executable file (console or not console) can not have any space in its name, but that is a Windows restriction

Hi Ramon,

What exactly do you mean with that? See attachment with New Win32.exe, works fine on Win7-64...

AssemblyChallenge

  • Member
  • **
  • Posts: 93
Re: Console apps and folders with spaces.
« Reply #6 on: November 16, 2017, 02:27:32 PM »
Right. There are no problems in Windows with LFN (oniy deep structures) nor issues with spaces in names/folders, except when typing commands in CMD or doing scripting, where is always advisable to enclose those between double quotes.

Anyway, I had the chance to dig some more and here are my findings. I'm using one of my projects, the one I sent to Ramon by mail.

- Event Viewer is fun filled with 0x8000002 errors, they all come from the same address.
- MSDN and others say it's a "Data Misaligned", WinDbg agreed when debugged the app's crash dump.
- The error is not in my code portion but some other place (GetCommandLineA).

Please take a look at the attached info. WinDbg gave me the best insight, and thanks to that I was able to follow the code and spot the place where, supposedly, lies the problem. I welcome your views.  :biggrin:


rsala

  • Moderator
  • Member
  • *****
  • Posts: 239
    • Easy Code
Re: Console apps and folders with spaces.
« Reply #7 on: November 17, 2017, 01:43:28 AM »
Hi jj2007,

Glad to hear from you.

Of course it works fine if you run it from the Explorer as it takes care of the space in the file name, but try to run it from the console (a cmd box) and you will see that it cannot be launched if you do not enclose its name between double quotes.

So, I really do not know what we are exactly talking about, I mean, I do not know what EC v2 is suposed to do.

Regards.

EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 239
    • Easy Code
Re: Console apps and folders with spaces.
« Reply #8 on: November 17, 2017, 01:47:19 AM »
Hi AssemblyChallenge,

I am sorry if I am misunderstanding something, but as I was saying in my previous post I still do not know where the problem is. What is EC v2 doing wrong?

Regards.
EC coder