• 0

Replacing a file in a CAB file


Question

Does anyone know how to replace a file in a CAB file without corrupting the CAB file?

I want to install a program using a setup.exe file. It uses a CAB file as part of installtion. However, I need to change one of the INF files inside the CAB file to make the program work for my hardware. Now, I can use PowerArchiver to extract the files from the CAB file, edit and replace the INF file that I want to change, and then repack all the files back to a CAB file (I've tried using CABARC.EXE but it doesn't support long file names/extensions.)

However, when I run setup.exe again, it gives me an error that the CAB file is corrupt because it can't find a file inside the CAB file. (The file it refers to is not the INF file that I editted but the first file in the list when sorted in alphabetical order).

How can I edit a CAB file and still make it valid for installation??? :unsure:

Edited by Conquerz
Link to comment
https://www.neowin.net/forum/topic/563204-replacing-a-file-in-a-cab-file/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

There's really no context here, so this could be either of three errors - either you didn't edit the INF properly (there should be at least three references to the file in question, IIRC), or you've just invalidated a security signature, or you've saved it out as the wrong CAB subtype. That's just guessing based upon my experience in this field.

  • 0
  zachdms said:
There's really no context here, so this could be either of three errors - either you didn't edit the INF properly (there should be at least three references to the file in question, IIRC), or you've just invalidated a security signature, or you've saved it out as the wrong CAB subtype. That's just guessing based upon my experience in this field.

Thanks for the response zachdms. I don't think editing the INF could have caused such a big problem as not being able to find files in the CAB. I only made minor changes to the INF. I just changed the name of the driver ID, that?s all. The setup.exe file is supposed to extract the files inside the CAB and then deal with them. But it seems that it can't even extract them. So the problem is with the CAB file and not the INF.

As for the CAB file itself, I did repack it using the same compression type as it was originally compressed with (i.e. LZX:21).

One thing I've noticed however is that the size of the repacked CAB file is smaller than the size of the original CAB file. I am not sure why there has been a size difference. Maybe some data was lost during the repacking process? All the files are still there.

Maybe a signature issue?

Do you know of any method where I could extract a file, edit it, and put it back into the CAB file without corrupting it???

Thanks.

  • 0

I can pretty easily get that exact type of error to occur via taking a valid CAB and modifying the associated INF - it's not difficult, and I recognize the message you get can be confusing. You may want to check your %temp% directory to see whether it is actually extracted, which would give you an actual answer on that end.

There's cab subtypes that have different headers - I wasn't referring to LZX/Diamond/etc compression, but rather that the same basic CAB format gets reused by various companies with specific extensions. Again, you have provided zero details, so we're all guessing.

Since there's no details here and this isn't a valid product on the market, just an attempt to hack something together, I think I'm done with this. Talk to the manufacturer. :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.