18

I have two Autorun.inf files, the code inside them are exact same. But only 1 works, other one doesn't work.

The one that work is copied from DVD, and i edited it. The one that doesn't work created on my desktop by renaming text file ( i correctly renamed it ).

This one works

enter image description here

This one doesn't work

enter image description here

If you want the files :

Working one : http://www16.zippyshare.com/v/64IutSu4/file.html

Not working one : http://www98.zippyshare.com/v/zEqU2BZ7/file.html

Does anyone know why doesn't the one i created on my desktop wont work? and how can i get it working? and whats the difference between those 2 file?

Thanks.

user4335407
  • 345
  • 1
  • 3
  • 8
  • I opened both with a hex editor and they are quite different when looking at the hex values. Its easy enough to make a new one. Make a Autorun text file and type in the data, save the file and change the extension from txt to inf. – Moab Feb 16 '16 at 01:21
  • @Moab That's what i did but i saved it as "UTF-8 with an UTF-8 BOM" - (dxiv) and that was the issue. Thanks for the response :) – user4335407 Feb 16 '16 at 02:05
  • 1
    I would dissagree in them beeing exact copies. This is simply impossible IF they are. – Zaibis Feb 16 '16 at 14:46
  • The first file says "usb". The second file says "usbk". Look at the last lines. Seems like a simple typo. – ApproachingDarknessFish Feb 16 '16 at 22:17

2 Answers2

35

The 2nd .inf, which doesn't work, appears to have been saved as UTF-8 with a UTF-8 BOM.

The UTF-8 BOM means that the file starts with the binary sequence EF BB BF (in hex). But Windows expects autorun.inf files to be plain text, so it won't recognize this one as such.

My advice is to choose the plain-text option in your text editor when saving .inf files or similar.

psmears
  • 496
  • 3
  • 8
dxiv
  • 2,023
  • 13
  • 20
  • 2
    and this is why you do not use notepad for editing program files. – Thorbjørn Ravn Andersen Feb 16 '16 at 08:17
  • 4
    @ThorbjørnRavnAndersen i dont think notepad adds BOM. – Sharky Feb 16 '16 at 08:22
  • 1
    It doesn't, but it doesn't tell you about BOM either, and it will save it back in the same encoding as the original file. – Nelson Feb 16 '16 at 12:11
  • 1
    UTF8 *is* plain text. I presume that you are talking about ASCII. – elaforma Feb 16 '16 at 15:33
  • 1
    @fNek UTF-8 is a _variable-length_ (multi-byte) encoding. In this context, _plain text_ referred to a _single-byte_ encoding, commonly 7-bit ASCII. I guess 8-bit extended ASCII might be interpreted in the default Windows codepage and work, too, though I did not verify it and couldn't find it documented. – dxiv Feb 16 '16 at 16:42
  • 2
    It's not even the variable-length encoding that is the problem. It's that the "BOM" (which isn't really a BOM at all, because a BOM is only used to distinguish little-endian from big-endian encodings of 16-bit or larger Unicode) is not visible inside the editor. And the invisibility of the "BOM" is what makes it no longer plain text. – Monty Harder Feb 16 '16 at 19:59
  • UTF-8 text is plain-tet, just like @fNek said. If you mean ASCII instead, say so. – Deduplicator Feb 16 '16 at 20:41
  • @Deduplicator I did not mean that UTF-8 encoded text would _not_ be text. Of course it is. But, as I already clarified in my previous comment, in this context `plain text` referred to 7-bit ASCII or possibly 8-bit codepage encoding. While not rigorously precise, calling it `plain text` is rather common usage in Windows world. For example, if you run MS Word and Save-As a file, one format available is `plain text`, which defaults to the active ANSI codepage. – dxiv Feb 17 '16 at 05:57
  • @dxiv: The default encoding for plain-text on windows is active ANSI codepage, and MS doesn't and won't support unicode as the ANSI-codepage, sure. But that doesn't change the fact that you can select UTF-8 without MS BOM there, and it's still plain-text. – Deduplicator Feb 17 '16 at 16:15
  • The default encoding for INF files in Windows is UTF-16 (LE), MS explicitly prohibits ANSI and UTF-8: `INF files should be saved and encoded as Unicode (UTF-16); they must not be ANSI or UTF-8.` https://docs.microsoft.com/en-us/windows-hardware/drivers/display/general-unicode-requirement `Microsoft uses UTF-16, little endian byte order.` https://docs.microsoft.com/en-us/windows/win32/intl/using-byte-order-marks – Thorsten Schöning Apr 05 '22 at 14:48
31

As dxiv has said, this is caused by UTF-8 BOM.

The file editor you are using, Notepad++, can tell you the encoding of the file.

enter image description here

UTF-8 BOM adds header bytes to the file that breaks their compatibility with standard ASCII files, whereas UTF-8 without BOM (or just plain UTF-8) files are fully reverse compatible with standard ASCII file, assuming you do not use any UTF-8 characters.

Notepad++ also has a HEX editor plugin and you will be able to see these extra bytes with it:

enter image description here

Nelson
  • 1,363
  • 10
  • 13