A Mind Lost
Anything and everything.
Tag Archives: programming
Windows 7 Locking Executable Files
Recently I’ve been toying with MinGW in an effort to brush up on my meager programming skills, but hit a small stumbling block. After a test run of my binary, followed by a few edits and a recompile, the linker would complain that it was unable to open the output file for writing. Thinking that perhaps there was a bug in binutils, I wrote up a small test case (good old “Hello, world!”) and tried building it with Visual Studio. Sure enough, after running the resulting executable and making a small change, attempts to relink the program failed with the error:
LINK : fatal error LNK1104: cannot open file "hello.exe"
After about an hour and a half of Googling, as well as disabling just about every service that could conceivably want to lock an executable, I was about ready to rip out my badly greying hair. I have indexing turned off on all my drives, no background virus scanners (I use ClamWin on-demand), and I even went so far as to turn off System Restore (something I had meant to do anyway… I’ve never used it). File permissions on the folder are very lax (My /Users/Public is R/W for Everyone).
Unfortunately, nothing worked. Sysinternals Process Explorer wasn’t particularly helpful, showing the file as being locked by the System process. Attempting to manually unlock the file just gave me an error.
Finally, after broadening my Google search query a bit, I stumbled across a seemingly unrelated post at Tech Gremlin. Reading through the comments, one person (“F-ingannoyed” hehe) offered a link to a blog posting on retrocopy.com that suggested the Application Experience service, which I had disabled, may be at fault. With fingers crossed and a quick reboot (only because I couldn’t recall all the services I’d manually stopped), I gave the solution a try and…
… it worked!
Two hours wasted thinking some obscure running service was at fault to find out it’s a disabled service that’s the culprit! Given the description of the service (“Processes application compatibility cache requests for applications as they are launched”) I have no idea why not running it causes the system to lock binaries long after they’ve exited, but it’s Microsoft. Inexplicable software behaviour is pretty much par for the course.
At least I didn’t have to rely on my fallback plan, which was to use VirtualBox to run either Slackware or Windows XP to (cross) compile and test.
OpenWatcom 1.9RC3
A new release candidate of my favourite compiler (a decade ago) is now available – OpenWatcom 1.9 RC 3.
I’ve been playing with the Watcom compiler since 1995’sh (v10.5) or so when a friend hooked me up with the 32-bit DOS parts of the C compiler. I bought v11.0 in 1997 for $500.00 CDN, a hefty price-tag for a hobby coder. Needless to say, I was quite disappointed when Sybase announced they had EOL’d the Watcom compilers. Disappointment then turned to joy when I found out that Sybase was going to open the source code, which then turned to apathy during the interminable wait for the code. Windows XP finally killed most of my interest in OpenWatcom, which had depended on my clinging to Windows 98SE and its virtual DOS machine.
I don’t follow the OpenWatcom newsgroup any more, but I still check every now and then for new releases. For DOS code, there’s no better environment available, although some might argue in favour of DJGPP, a port of the GNU Compiler Collection to DOS (well, 32-bit protected mode extended DOS).
OpenWatcom still targets a ton of output formats, such as DOS, OS/2, Win16/32, and various other nowadays less-common targets. I don’t believe that Win64 is supported yet. The Fortran compiler’s available, too, but who uses Fortran any more?