Revision 28d354ce

b/image_creator/os_type/windows.py
46 46
import random
47 47
import string
48 48
import subprocess
49
import struct
49 50

  
50 51
kvm = get_command('kvm')
51 52

  
......
175 176

  
176 177
            tasks = self.list_syspreps()
177 178
            enabled = filter(lambda x: x.enabled, tasks)
178

  
179 179
            size = len(enabled)
180 180

  
181 181
            # Make sure the ms sysprep is the last task to run if it is enabled
......
358 358
            h.node_set_value(runonce,
359 359
                             {'key': "BootMonitor", 't': 1, 'value': value})
360 360

  
361
            value = (
362
                r'REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion'
363
                r'\policies\system /v LocalAccountTokenFilterPolicy'
364
                r' /t REG_DWORD /d 1 /f').encode('utf-16le')
365

  
366
            h.node_set_value(runonce,
367
                             {'key': "UpdateRegistry", 't': 1, 'value': value})
368

  
361 369
            h.commit(None)
362 370

  
363 371
            self.g.upload(software, path)
......
413 421
                assert h.value_type(old_value)[1] == 4
414 422
                old_values.append(h.value_dword(old_value))
415 423

  
416
                new_value = '\x00' if new_values.pop(0) == 0 else '\x01'
417
                h.node_set_value(node, {'key': 'EnableFirewall', 't': 4L,
418
                                        'value': '%s\x00\x00\x00' % new_value})
424
                h.node_set_value(
425
                    node, {'key': 'EnableFirewall', 't': 4L,
426
                           'value': struct.pack("<I", new_values.pop(0))})
419 427

  
420 428
            h.commit(None)
421 429
            self.g.upload(system, path)
......
468 476
            elif value == 0:
469 477
                return False
470 478

  
471
            new_value = {
472
                'key': "LocalAccountTokenFilterPolicy", 't': 4L,
473
                'value': '%s\x00\x00\x00' % '\x00' if value == 0 else '\x01'}
479
            new_value = {'key': "LocalAccountTokenFilterPolicy", 't': 4L,
480
                         'value': struct.pack("<I", value)}
474 481

  
475 482
            h.node_set_value(key, new_value)
476 483
            h.commit(None)

Also available in: Unified diff