'Iterate over the names of all keys in this key'

def iterkeynames(self, get_last_write_times=False):

    name_buf = ctypes.create_unicode_buffer(1024)
    lname_buf = DWORD(len(name_buf))
    i = 0
    while True:
        lname_buf.value = len(name_buf)
        try:
            file_time = RegEnumKeyEx(self.hkey, i, name_buf, ctypes.byref(lname_buf))
        except ValueError:
            raise RuntimeError(u'Enumerating    keys    failed    with    buffer    too    small,    which    should    never    happen')
        if get_last_write_times:
            (yield (name_buf.value[:lname_buf.value], filetime_to_datettime(file_time)))
        else:
            (yield name_buf.value[:lname_buf.value])
        i += 1
