hivex: Complete the implementation of adding child nodes.
[libguestfs.git] / hivex / example5
1 #!/bin/bash -
2 # Copyright (C) 2009-2010 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 set -e
19
20 # This script adds a new node under \Microsoft in an existing software
21 # hive.
22
23 if [ $# -ne 2 ]; then
24     echo "$0 software software.new"
25     exit 1
26 fi
27
28 d=`dirname $0`
29
30 $d/hivexsh -w <<EOF
31 load $1
32 cd \Microsoft
33 add TestNode
34 cd TestNode
35 add Test1
36 add Test2
37 add Test3
38 add Test4
39 add Test5
40 cd Test1
41 setval 2
42 @
43 string:This is the default key of Test1
44 ThisIsTest1
45 dword:0x12345678
46 cd ..
47 cd Test5
48 setval 2
49 @
50 string:This is the default key of Test5
51 ThisIsTest5
52 dword:0x87654321
53 commit $2
54 EOF