1. Error in old exw

Short version: when running an exe created about 11 years ago (which runs fine on my desktop) on my laptop it generates a command window that says:

Fatal run-time error: bad file number (-1)

Press Enter ....

Is there any windows process that will tell me what filename is associated with the (obviously?) missing file? I tried looking through the Event Viewer in Control Panel but didn't find anything.

Longer version: The program loads up the main Window just fine. It is a Win32Lib project built with version 1.0.5a of the IDE. The error occurs in a fairly well defined section of the code which is invoked when I select a command from the menu bar. I've looked through the code associated with the onClick event of the menu item (it is about 350 lines) but nothing jumps out at me. The code does a lot of work, opening a number of files and creating an output file. As I said, it works on my desktop but not my laptop.

It seems to me it has to be a computer configuration problem. I've confirmed that DEP is not on (obviously, because otherwise the program's main window wouldn't run at startup). The environment variables are the same for EUDIR, etc.

I'm capable of tracing and inserting debug print statements to find the error. The problem is that while I have the exe, the ide, the ide generated source code (.prj) and the pre-il source code (.exw) neither of the computers will compile the exw so I'm precluded from tracing and the like. I have obviously misconfigured something (or better I should say I never properly configured the laptop when copying the files from the machine that was used oh so long ago to actually program this thing).

On the one hand I'm sort of amazed that the exe has remained usefull for over 10 years, but I haven't done any heavy lifting since I built my laptop so I haven't even seen this error before.

Any nudge in the right direction would be appreciated.


new topic     » topic index » view message » categorize

2. Re: Error in old exw


The bad file handle number doesn't just mean the file is not present, it can also mean the file is no accessible, or in a folder that you don't have permiision to access. Have you tried running the exe as an administrator (I'm assuming Windows 8.1 +)



new topic     » goto parent     » topic index » view message » categorize

3. Re: Error in old exw

Good thought. I hadn't. However, it doesn't change anything. I didn't expect it to, as I have folder level access to all folders where files are being read, being written, or being modified.

Any other thoughts?



new topic     » goto parent     » topic index » view message » categorize

4. Re: Error in old exw

I would run Process Monitor on it.

Press stop capture (the blue magnifyng glass, or uncheck File/Capture or press Ctrl E) as soon as possible after it has gone wrong.
Be warned there are plenty of red herrings such as GetTickCount64.dll that you have to ignore or filter out.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Error in old exw

<duplicate post>

new topic     » goto parent     » topic index » view message » categorize

6. Re: Error in old exw

Thanks, guys. Process Monitor made it easy to spot the error. In my haste to get something usable about 10 years ago I hardcoded a path for an infrequently called logfile, with the code buried in an include file, no less. Haste makes waste, even 10 years hence.


new topic     » goto parent     » topic index » view message » categorize


Quick Links

User menu

Not signed in.

Misc Menu