博客
Microsoft Cabinet MSCE file structure
What’s MSCE? I found “MSCE” in the *.000 file of Windows Mobile installation file (*.cab). I go through the search result of Google. There is no description of MSCE.
Why I care the MSCE file? During I implement the theme package function of CVE (CHome Visual Editor). I need to package the files into a Windows Mobile cabinet file. Package files into a normal is easy. There are many component to do this. But a Windows Mobile cabinet contains a *.000 file. This should be the binary version file of cabinet *.inf.
Following is the C# structure definition of the MSCE file (incomplete, cannot compile):
[StructLayout(LayoutKind.Sequential)]
public struct MSCE
{
/// <summary>
/// Initializes a new instance of <see cref="MSCE"/>.
/// </summary>
public MSCE(ushort blockCount)
{
Header = "MSCE";
BlockCount = blockCount;
Entries = new Entry[25];
}
private string Header;
//[FieldOffset(0x04)]
public int Payload_1;
//[FieldOffset(0x08)]
public long Length;
//[FieldOffset(0x10)]
public long Payload_2;
//[FieldOffset(0x18)]
public long Payload_3;
//[FieldOffset(0x20)]
public long Payload_4;
//[FieldOffset(0x28)]
public long Payload_5;
//[FieldOffset(0x30)]
public ushort BlockCount;
//[FieldOffset(0x32)]
public ushort EntrySeparatorIndex;
//[FieldOffset(0x34)]
public ushort FileEntryCount;
//[FieldOffset(0x3C)]
public int EntryOffset;
//[FieldOffset(0x40)]
public int UnknownEntryOffset;
//[FieldOffset(0x44)]
public int FileEntryOffset;
//[FieldOffset(0x48)]
public int OtherEntryOffset1;
//[FieldOffset(0x4C)]
public int RegistryEntryOffset;
//[FieldOffset(0x50)]
public int EndOffset2;
//[FieldOffset(0x54)]
public ushort ApplicationNameOffset;
//[FieldOffset(0x56)]
public ushort ApplicationNameLength;
//[FieldOffset(0x58)]
public ushort CompanyNameOffset;
//[FieldOffset(0x5A)]
public ushort CompanyNameLength;
//[FieldOffset(0x5C)]
public int EntryOffset2;
//[FieldOffset(0x60)]
public int Payload_6;
//[FieldOffset(0x88)]
public Entry[] Entries;
public FileEntry[] FileEntries;
}
[StructLayout(LayoutKind.Sequential)]
public struct Entry
{
public ushort EntryId;
public ushort Length;
public string Content;//Should end by "00 00 00 00"/"00 00".
}
public struct FileEntry
{
public ushort EntryId;
public ushort BlockEntryId;//File Location.
public ushort EntryId2;
public int Mask;
public ushort Length;
public string Content;
}
public struct RegistryEntry
{
public ushort EntryId;
public int Mask;
public ushort Mask2;
public ushort Mask3;
public ushort Length;//Length = Key.Length + "00" + Value.Length + "00"(if value is string)
public RegistryValue Content;
}
public struct RegistryValue
{
public string Key;
public object Value;//When value is string, should end by "00".
}
public struct RegistryMapping
{
public ushort EntryId;
public int Mask;
public ushort Length;
public ushort[] Links;//Should end by "00 00".
}
水村,常用论坛ID:chimeny,现就职上海,每天起早探黑,主要从事.NET开发。业余爱好摄影及手机应用。