Solved

Replace files with long-file-name

Posted on 2002-04-11
15
196 Views
Last Modified: 2013-12-28
Hi,

 I have a little setup program, which replaces files in use by writing 'wininit.ini' and reboot.
 To be more precise I copy the new file to the desired location by an other name like 'ItsALongFileName.dll.tmp', than I write a line into the 'wininit.ini' that copies this file to 'ItsALongFileName.dll'.
 Unfortunately most of the files I have has long file name. Microsoft declares in PlatformSDK that 'Both DestinationFileName and SourceFileName must be short file names.'
 So before I write file names into the 'wininit.ini' I ask for the short file name of the specified file.
 The result of this, after reboot, is a file named 'ItsALo~1.dll', asumed that the original file was 'ItsALongFileName.dll'.

 How can I solve this problem?

Thanks
Peter
0
Comment
Question by:kepeter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
  • +1
15 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 6934417
Try puttin name in quotation marks ""
this may help.

If not, then because it is rocessed at the DOS level, before windows loads long file name handling, there is no solution without using a custom installer that handles long file names.

I hope this helps !

0
 
LVL 7

Expert Comment

by:jatcan
ID: 6937248
Sounds like you're writing a virus?
0
 
LVL 1

Author Comment

by:kepeter
ID: 6939643
To SysExpert,
 Quotation marks does not work...

To jatcan,
 Nothing between me and a virus. I talk about a setup program, that have to replace some files. All of them files that my company developed.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:SysExpert
ID: 6940089
If your company developed them, then tell them to use DOS names.
Very simple !

I hope this helps !
0
 
LVL 1

Author Comment

by:kepeter
ID: 6941148
Probably this is the most simple way, however we have more than 250 files (dll, ocx, exe) to rename!!!
0
 
LVL 7

Expert Comment

by:jatcan
ID: 6941747
Sorry about the virus thing. That is what it sounds like but I shouldn't have said it. That being said....readt this, it is probably the answer to your problem, providing you don't mind requiring a reboot to complete the installation:

How to Replace In-Use Windows NT System Files (Q184408)

The Mv.exe tool is a 32-bit version of the POSIX MV tool. Mv.exe has the following syntax:

mv [/x [/d]] file1 [ file2 ...] target
The command-line switches are:

/x: Do not save files that are replaced.

/d: Delay file move until system reboot.

Q228930 How to Replace Currently Locked Files with Inuse.exe

Aslo,

ODE97: Setup Wizard Disk Images Do Not Contain Long File Names (Q174495)-explains that the wizard truncates the names and re-expands them to the long file name format during installation onto a supportive OS OR leaves them truncated on a non-supported OS.

This is the Office developers setup wizard so it may not suit your purposes.

0
 
LVL 7

Expert Comment

by:jatcan
ID: 6941759
AND here it is:

Windows 95 and Windows 98 use Wininit.ini to move, replace, or delete files that are currently in use. Wininit.ini is processed by Wininit.exe before the protected mode disk system is loaded. Long file names are only available when the protected mode disk system is running. This problem is caused by a limitation in Wininit.exe that does not support the long file name format. This issue is addressed in Windows NT and Windows 2000 because these operating systems support the use of the Win32 API MoveFileEx that supports long file names.



RESOLUTION
There are two possible ways to work around this problem. The first is: before the installation takes place, make sure that all the files that will be installed with long file names are not in use, so that the Installer will able to replace them using the long file name format.

The other way to work around this problem is to write a custom action in the .msi file. The custom action will do the file copy rather than letting the Wininit.ini do it. Use the custom action to copy files to a temporary directory and write an entry to the RunOnce key in the registry that will call a utility (a program or a script) that will copy the files to the correct folder after the reboot.



STATUS
This behavior is by design.

0
 
LVL 7

Expert Comment

by:jatcan
ID: 6941805
This is more specific to Windows 2000/XP



HOWTO: Move Files That Are Currently in Use (Q140570)


It basically states that wininit.ini is operating before the long file name handler and therefore cannot be used with long file names. It suggests that if you need long file name handling, you should make an entry inot the runonce key of the registry that will move, copy,replace file names after the long file name handler has been initiated and that further, use mv.exe to replace file names in use. This setup may require two reboots.

Good Luck.
0
 
LVL 7

Expert Comment

by:jatcan
ID: 6941812
Sorry about the aboive post, it actually nearly duplicates the previous post. I've read at least 20 documents on this subject since you first posted the question. They're getting a little blurred...the information is all valid though.
0
 
LVL 1

Author Comment

by:kepeter
ID: 6941955
I check these different solutions, but meanwhile...
My problem exists only on windows98 and not WinNT or W2K.
0
 
LVL 1

Author Comment

by:kepeter
ID: 6942002
I check these different solutions, but meanwhile...
My problem exists only on windows98 and not WinNT or W2K.
0
 

Expert Comment

by:ComTech
ID: 6942310
Hi kepeter@devx, sorry to intrude into your question, but I have changed you from Devx, and will begin gettin emails from EE home, rather than devx.

Thanks,
ComTech
CS Admin @ EE
0
 
LVL 7

Accepted Solution

by:
jatcan earned 200 total points
ID: 6942321
Well, if it's not working then I guess the above answer of re-naming files may be your solution. Long process but you know it will work.
0
 
LVL 1

Author Comment

by:kepeter
ID: 6944005
After checking out all the options I found that not good solution exists for Win98 (For WinNT and W2K we have MoveFileEx).
So I choose RunOnce registry key to solve my problem, for that and for the great effort jatcan invested to help me I give him these points.

Thank you!
0
 
LVL 7

Expert Comment

by:jatcan
ID: 6944398
Nno thank you. Your question prompted me to learn a bit about something I never would look into myself...
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question