Solved

Replace files with long-file-name

Posted on 2002-04-11
15
191 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ZIP or ZIPX 8 70
Convert MSI to MSM 1 28
LAPS - Local Administrator Password Solution 4 38
Folder size tool 6 61
If you Lost your Administrator password for Windows XP, Vista, or 7 this CD will help you reset the password to blank so you can log in. Once in you should change that blank password to something!! Download the ISO on this page http://www.spl…
Windows Mobile Barcode Scanning These days almost every product has a barcode in some way... amongst there are 1D barcodes en 2D barcodes.. From http://www.barcodeman.com/faq/2d.php I found some handy definitions and insights. 1D barcodes …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now