hw/arm/armsse: Add support for SSE variants with a system counter
[qemu.git] / scripts / extract-vsssdk-headers
blob9e38510f042ef60596c7c437d0f0b1ff0c0fc11a
1 #! /bin/bash
3 # extract-vsssdk-headers
4 # Author: Paolo Bonzini <pbonzini@redhat.com>
6 set -e
7 if test $# != 1 || ! test -f "$1"; then
8 echo 'Usage: extract-vsssdk-headers /path/to/setup.exe' >&2
9 exit 1
12 if ! command -v msiextract > /dev/null; then
13 echo 'msiextract not found. Please install msitools.' >&2
14 exit 1
17 if test -e inc; then
18 echo '"inc" already exists.' >&2
19 exit 1
22 # Extract .MSI file in the .exe, looking for the OLE compound
23 # document signature. Extra data at the end does not matter.
24 export LC_ALL=C
25 MAGIC=$'\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1'
26 offset=$(grep -abom1 "$MAGIC" "$1" | sed -n 's/:/\n/; P')
27 tmpdir=$(mktemp -d)
28 trap 'rm -fr -- "$tmpdir" vsssdk.msi' EXIT HUP INT QUIT ALRM TERM
29 tail -c +$(($offset+1)) -- "$1" > vsssdk.msi
31 # Now extract the files.
32 msiextract -C $tmpdir vsssdk.msi
33 mv "$tmpdir/Program Files/Microsoft/VSSSDK72/inc" inc
34 echo 'Extracted SDK headers into "inc" directory.'
35 exit 0