Updating a dll

Updating a dll

Post by VnZpYW » Mon, 25 Oct 2004 00:51:01

I've searched the forums and gotten 2 hits, one of which doesn't relate and
the other which was unanswered.

My question is in regards to cards.dll in WinXP, which apparently resides in
the \system32 and \dllcache folders in your %system% folder.

Basically, I have an updated dll which shows different cards. Under Win98SE,
all I had to do was replace the default cards.dll in \system with my own, and
Freecell would display the new cards. Fine.

However, under WinXP, no such luck. I get a dialog box error saying: "The
application or DLL C:\WINDOWS\system32\CARDS.dll is not a valid Windows
image. Please check this against your installation diskette" when I change
cards.dll in both folders to my own cards.dll. Obviously, WinXP is keeping
track of the original cards.dll somewhere.

How would I go about telling WinXP, I want to update cards.dll (i.e., make
it ask me for a new one)? Googling has produced no results, and the few
forums I've asked have no clue either.

Please don't give me that "join our developer discussion" crap, I'm just an
end-user, and I don't want to change a "critical system dll". This is for the
card games, for heaven's sake.

Dlls get changed all the time, like when you run system update, or install
new drivers. If they can do it, how can we?

Updating a dll

Post by Ronnie Ver » Mon, 25 Oct 2004 05:57:16


Windows is trying to tell you that the dll file may not be compatible with
XP. Where did this file come from? You may be able to force this file into
XP, but you want to be sure that the result you are looking for is worth the
results that may follow which could be disastrous.

XP uses Windows File Protection to protect system files. This is
accomplished by placing a backup copy of the system file in the
Windows\System32\dllcache folder. If something happens to the file located
in the System32 folder, it is automatically and immediately replaced with a
copy of that file from the dllcache folder.

To replace the cards.dll file, first create a couple of empty folders that
are not in the Windows path. Move (do not delete) the copy in the
Windows\System32\dllcache folder first to one of these new folders. Next
move the cards.dll file in the Windows\System32 folder to the other empty
folder for safe keeping. When you move the copy from the System32 folder you
will receive a warning message. Cancel that message.

If this procedure fails, you will need to return the 2 files to their
original locations.

Good Luck


Ronnie Vernon
Microsoft MVP
Windows Shell/User


Updating a dll

Post by VnZpYW » Mon, 25 Oct 2004 12:05:01

Thanks for your reply. Let's see:

"Ronnie Vernon MVP" wrote:

Probably true. This "new" dll I have is old, as in mid-90s. I've used it
since Win95 came with card games. It was on a public ftp, and I think if you
google for it you may find some old sites with it. I'm all but certain it's
"safe", since I've been replacing cards.dll on previous Windows systems with
it many times before successfully, with no problems (I mean, what problems?
cards.dll is only used for the card games... it will either work, or stop
them from working, that's all).

By the way, the cards.dll that ships with WinXP looks exactly the same size
as cards.dll in Win98SE (same byte size, same date), so... don't you think it
is reasonable to think that WinXP is expecting the same format for cards.dll,
and therefore if the swap is made, it should work with the modified cards.dll?

Okay, I understand that. To elaborate on my experience, if I merely copy
over the modified cards.dll to \system32, when I run Freecell it will still
show the old cards, and investigation will reveal that cards.dll has been
reverted to the original copy (and like you said, it "backup"-ed from the
copy in \dllcache).

But that is what I did, and the error I mentioned in my original post shows

Even though BOTH cards.dll in \system32 and \dllcache match, WinXP somehow
knows it's not the original cards.dll.

Of course, restoring the original cards.dll to both folders will allow me to
play the card games again, but with the original old cards. Problem not

When we install new device drives, often dll's get changed (i.e. replaced
with new versions), right? Okay, coming back to my question: *How* do they do
that? Why does "Windows File Protection" not get in the way? Is there any way
I can talk to this protection, to let it know I want to upgrade cards.dll? Or
to paraphrase, how would I "install" the new cards.dll?

Thanks for trying. I really hope somebody knows the answer, after all, don't
dlls get swapped every day when people install stuff.

Updating a dll

Post by Ronnie Ver » Mon, 25 Oct 2004 14:05:38

vian wrote:


Before I replied, I tried the procedure to remove both of the cards.dll from
those 2 folders in my XP SP2 system and this worked as stated. I did find an
earlier version of the cards.dll file (from Windows 98) and tried replacing
this file in the System32 folder which did not work. Installation and update
programs use different programming techniques to replace system files. This
problem could be that your custom cards.dll file may be an old 16 bit file.

Here is something you may want to try. It's a shot in the dark workaround
that we have used in the past to get around some file version and duplicate
file name issues.

Open Windows Explorer and create a new folder called Freecell somewhere
outside the Windows path (Click the C: drive and right click an empty spot
in the right side window to select New/Folder).

Open the C:\Windows\System32 folder. Locate the Freecell.exe file. Use the
right mouse button to drag and drop the file to the new Freecell folder you
just created and click Copy Here. Place a copy of your custom Cards.dll file
in the same folder.

Double click the Freecell.exe file in the Freecell folder to run the
program. The program will find this dll file in it's own folder first and
use it instead of the copy in the System32 folder.

Post back here with the results.


Ronnie Vernon
Microsoft MVP
Windows Shell/User


Updating a dll

Post by VnZpYW » Tue, 26 Oct 2004 23:39:06


Okay, I created C:\temp, and copied Freecell.exe from \system32 into it, and
placed the new cards.dll in there as well.

I get the same error, but interestingly enough it mentions the folder it is
in (i.e. C:\temp) instead of C:\Windows\System32, so apparently it DOES look
in the current folder for the dll:

"The application or DLL C:\temp\CARDS.dll is not a valid Windows image.
Please check this against your installation diskette"

I guess I am forced to conclude the problem does lie with the dll. Perhaps
it is one of those 16-bit vs 32-bit issues, I have no idea. It looks like I'm
going to have to put it on my Win98SE partition after all (dll author has
long since vanished, you know how it is, students graduate, uni email becomes

Thanks for helping out, even though this was a rather trivial problem.

Updating a dll

Post by Ronnie Ver » Wed, 27 Oct 2004 01:08:10


It's only trivial if it's someone else's problem. :)

Sorry we couldn't resolve this.

Ronnie Vernon
Microsoft MVP
Windows Shell/User