简体   繁体   中英

Extract original file from CAB archive and determine version (.net CE 2.0 app)

I am trying to update a win mobile 6.0 project to allow it to have update notifications.

To make this easier from our end, I wan to be able to update the installer CAB file via a web interface and have the web determine the version of the application automatically.

In .net, I know a way to determnine a file's version is:

FileVersionInfo.GetVersionInfo

But since the files are in a CAB, and CABs don't have versions, I can't determine the version.

I also know there is an extract.exe tool to extract CAB contents, but it doesn't extract the same way as when the CAB is installed on a device. For example, the exe file is extracted like this: APPEXENAME~1.026

I can't get the file version from that. Plus, I wouldn't even know which file was the ".exe" anyway since al lot of the files start with "APPEXENAME".

Is what I am trying to do even possible? Or will I have to manually enter the version number every time we update?

Although this is a quite old question, here is one answer:

Windows CE CAB files are created with CabWizard normally. The contents of these CAB files can be viewed/listed with some archive apps like extract or 7z for example. The file names are mangled and the file names are mapped within a xml file inside the CAB:

Sample file list:

  000KBDUS.002
  0MSTSCAX.003
  00MVKLIB.004
  0TSCSCAN.006
  00WPCTSC.005
  FILTER~1.001
  REMOTE~1.000
  REMOTE~1.008
  _setup.xml
  TSCSHIFT.007

You see the _setup.xml file. It lists the file mappings (mangled to real file name) and some more information:

<wap-provisioningdoc>
  <characteristic type="Install">
    <parm name="InstallPhase" value="install"/>
    <parm name="AppName" value="Microsoft Remote Desktop Mobile"/>
    <parm name="NumDirs" value="3"/>
    <parm name="NumFiles" value="8"/>
    <parm name="NumRegKeys" value="4"/>
    <parm name="NumRegVals" value="15"/>
    <parm name="NumShortcuts" value="1"/>
  </characteristic>
  <characteristic type="FileOperation">
    <characteristic type="%CE2%" translation="install">
      <characteristic type="MakeDir"/>
      <characteristic type="filterfsd.dll" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="FILTER~1.001"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="kbdus.dll" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="000KBDUS.002"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="mstscax.dll" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="0MSTSCAX.003"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="MvkLib.dll" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="00MVKLIB.004"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="wpctsc.exe" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="00WPCTSC.005"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="tscscan.txt" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="0TSCSCAN.006"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
      <characteristic type="tscshift.txt" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="TSCSHIFT.007"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
    </characteristic>
    <characteristic type="%CE2%\Help" translation="install">
      <characteristic type="MakeDir"/>
      <characteristic type="RemoteDesktopMobile.htm" translation="install">
        <characteristic type="Extract">
          <parm name="Source" value="REMOTE~1.008"/>
          <parm name="WarnIfSkip"/>
        </characteristic>
      </characteristic>
    </characteristic>
    <characteristic type="%CE11%" translation="install">
      <characteristic type="MakeDir"/>
      <characteristic type="Remote Desktop Mobile.lnk" translation="install">
        <characteristic type="Shortcut">
          <parm name="Source" value="%CE2%\wpctsc.exe" translation="install"/>
        </characteristic>
      </characteristic>
    </characteristic>
  </characteristic>
  <characteristic type="Registry">
    <characteristic type="HKLM\SYSTEM\CurrentControlSet\Control\Layouts\00000409">
      <parm name="Layout File" value="kbdus.dll" datatype="string"/>
      <parm name="Layout Text" value="US" datatype="string"/>
      <parm name="PS2_AT" value="kbdus.dll" datatype="string"/>
    </characteristic>
    <characteristic type="HKLM\Software\Microsoft\Terminal Server Client">
      <parm name="BitmapPersistCacheLocation" value="\Temp" datatype="string"/>
      <parm name="Shadow Bitmap Enabled" value="1" datatype="integer"/>
      <parm name="CEConfig" value="Maxall" datatype="string"/>
      <parm name="MapVirtualKeyLib" value="\Windows\MvkLib.dll" datatype="string"/>
    </characteristic>
    <characteristic type="HKLM\SYSTEM\GWE">
      <parm name="LoadRdp" value="1" datatype="integer"/>
    </characteristic>
    <characteristic type="HKLM\System\StorageManager\AutoLoad\FilterFsd">
      <parm name="Dll" value="filterfsd.dll" datatype="string"/>
      <parm name="Paging" value="0" datatype="integer"/>
      <parm name="LoadFlags" value="1" datatype="integer"/>
      <parm name="BootPhase" value="2" datatype="integer"/>
      <parm name="MountFlags" value="1" datatype="integer"/>
      <parm name="FolderName" value="FILTERFS" datatype="string"/>
      <parm name="RootPath" value="\" datatype="string"/>
    </characteristic>
  </characteristic>
</wap-provisioningdoc>

You see the file name mappings and then can evaluate or rename them to read file version info from exe or dll files (if these contain such information, then that is a different point).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM