Thread: renaming executable file causes access violation

  1. #1
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838

    renaming executable file causes access violation

    On rare occasions, if I change the name of a the executable file after compiling it, it will no longer open.

    Most recently, a piece of software was running successfully for over a month, and then would no longer open after being closed.

    Recompiling the source on other computers did not produce the error, however, the problem persisted when transferring the malfunctioning exe to other computers.

    An executable freshly compiled and moved with it's entire project directory would run when transferred to the computer where the error occurred, but an error would recur if the exe was renamed.

    Written using Borland C++ Builder 6, on Win XP. Application is multithreaded.

    Any ideas on what is causing this and how do I avoid it?

  2. #2
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Does your project include DLLs linking back / using functionality from the main application? In this case the name of the exe file during compile time is mandatory and must not change

  3. #3
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    i'm not sure how to tell. i can say that the application is statically linked though.

    i should also again stress this happens intermittently, and only on very rare occasions. the same application file functioned for almost two months and then suddenly would not reopen.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    1. Does the program still have a .exe extension?
    2. Why are you renaming it in the first place?
    3. Are you running it by double-clicking the .exe file, or are you using a shortcut pointing to it?

  5. #5
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    1. yes
    2. because the project still has a generic title, and the IDE doesn't allow spaces.
    3. the exe file itself

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    i should also again stress this happens intermittently, and only on very rare occasions. the same application file functioned for almost two months and then suddenly would not reopen.
    Are you sure it's linked to the renaming, then?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    i am sure.

    An executable freshly compiled and moved with it's entire project directory would run when transferred to the computer where the error occurred, but an error would recur if the exe was renamed.
    i.e. it would run on the tool computer when the exe was copied with its entire project directory, but once it was renamed, it would produce the error again. i should have changed the name back to confirm the inverse, but i did not. (you start to go a little crazy after 8 straight hours in the cleanroom)

    It seems that once this error starts to happen, it is persistent; however, the onset of the problem happens sporadically.

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    After renaming and crashing, if you rename it back to what it was, does it start working again?

    Is there a way you can run the crashing program in a debugger and find out exactly where it's crashing? Or maybe enable some tracing to log details to a file and see how far that gets?

  9. #9
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    838
    Quote Originally Posted by cpjust View Post
    After renaming and crashing, if you rename it back to what it was, does it start working again?
    i'm not sure! i started going bonkers because by the time i had narrowed it down to changing the filename by an excruciating process of elimination, i'd been in the cleanroom for about 8 straight hours and i was just focused on getting our tool running again and getting the hell out of there!

    it occurred to me though that i might have seen this once before on my development computer once before several months ago. i'm not 100% sure on that, but just for the sake of argument; let's say i did, and i changed it back to the default name, and the error went away. any clues what that might mean? linking error?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. How to determine if a file is executable or not?
    By supernewb in forum C Programming
    Replies: 4
    Last Post: 04-14-2005, 05:38 AM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM