Update vendored windows libs

This commit is contained in:
Labrys of Knossos 2022-11-28 05:59:32 -05:00
commit b1cefa94e5
226 changed files with 33472 additions and 11882 deletions

View file

@ -1,5 +1,3 @@
# -*- coding: UTF-8 -*-
"""cookies.py
Cookie support utilities
@ -8,52 +6,50 @@ Cookie support utilities
import os
import itertools
import six
class CookieMonster(object):
"Read cookies out of a user's IE cookies file"
"Read cookies out of a user's IE cookies file"
@property
def cookie_dir(self):
import _winreg as winreg
key = winreg.OpenKeyEx(
winreg.HKEY_CURRENT_USER, 'Software'
'\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cookie_dir, type = winreg.QueryValueEx(key, 'Cookies')
return cookie_dir
@property
def cookie_dir(self):
import _winreg as winreg
def entries(self, filename):
with open(os.path.join(self.cookie_dir, filename)) as cookie_file:
while True:
entry = itertools.takewhile(
self.is_not_cookie_delimiter,
cookie_file)
entry = list(map(six.text_type.rstrip, entry))
if not entry:
break
cookie = self.make_cookie(*entry)
yield cookie
key = winreg.OpenKeyEx(
winreg.HKEY_CURRENT_USER,
'Software' r'\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',
)
cookie_dir, type = winreg.QueryValueEx(key, 'Cookies')
return cookie_dir
@staticmethod
def is_not_cookie_delimiter(s):
return s != '*\n'
def entries(self, filename):
with open(os.path.join(self.cookie_dir, filename)) as cookie_file:
while True:
entry = itertools.takewhile(self.is_not_cookie_delimiter, cookie_file)
entry = [item.rstrip() for item in entry]
if not entry:
break
cookie = self.make_cookie(*entry)
yield cookie
@staticmethod
def make_cookie(
key, value, domain, flags, ExpireLow, ExpireHigh,
CreateLow, CreateHigh):
expires = (int(ExpireHigh) << 32) | int(ExpireLow)
created = (int(CreateHigh) << 32) | int(CreateLow)
flags = int(flags)
domain, sep, path = domain.partition('/')
path = '/' + path
return dict(
key=key,
value=value,
domain=domain,
flags=flags,
expires=expires,
created=created,
path=path,
)
@staticmethod
def is_not_cookie_delimiter(s):
return s != '*\n'
@staticmethod
def make_cookie(
key, value, domain, flags, ExpireLow, ExpireHigh, CreateLow, CreateHigh
):
expires = (int(ExpireHigh) << 32) | int(ExpireLow)
created = (int(CreateHigh) << 32) | int(CreateLow)
flags = int(flags)
domain, sep, path = domain.partition('/')
path = '/' + path
return dict(
key=key,
value=value,
domain=domain,
flags=flags,
expires=expires,
created=created,
path=path,
)