Solved

Replace files with long-file-name

Posted on 2002-04-11
15
192 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
  • 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
 
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
Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

 
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

Are your corporate email signatures appalling?

Is it scary how unprofessional your email signatures look? Do users create their own terrible designs and give themselves stupid job titles? You can make this a lot easier for yourself by choosing an email signature management solution from Exclaimer today.

Question has a verified solution.

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

Suggested Solutions

Update 11/3/2014 - Although the below article will get you to relocate the WINSXS folder, Microsoft has finally released a utility to reduce the size of the WINSXS folder. For some reason, it's not that straightforward. It only works on Windows 2008…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now