parser = optparse.OptionParser("%s <BINDING> [path]" % sys.argv[0]) sambaopts = options.SambaOptions(parser) parser.add_option_group(sambaopts) parser.add_option("--createkey", type="string", metavar="KEYNAME", help="create a key") opts, args = parser.parse_args() if len(args) < 1: parser.print_usage() sys.exit(-1) binding = args[0] print "Connecting to " + binding conn = winreg.winreg(binding, sambaopts.get_loadparm()) def list_values(key): (num_values, max_valnamelen, max_valbufsize) = conn.QueryInfoKey(key, winreg.String())[4:8] for i in range(num_values): name = winreg.StringBuf() name.size = max_valnamelen (name, type, data, _, data_len) = conn.EnumValue(key, i, name, 0, "", max_valbufsize, 0) print "\ttype=%-30s size=%4d '%s'" % type, len, name if type in (winreg.REG_SZ, winreg.REG_EXPAND_SZ): print "\t\t'%s'" % data # if (v.type == reg.REG_MULTI_SZ) { # for (j in v.value) { # printf("\t\t'%s'\n", v.value[j]) # } # }
def setUp(self): super(WinregTests, self).setUp() self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), self.get_credentials())
def setUp(self): self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), self.get_credentials())