repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringlengths
1
5
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
jtyr/ansible-modules-core
network/eos/_eos_template.py
19
7276
#!/usr/bin/python # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # DOCUMENTATION = """ --- module: eos_template version_added: "2.1" author: "Peter Sprygada (@privateip)" short_description: Manage Arista EOS device configurations description: - Manages network device configurations over SSH or eAPI. This module allows implementers to work with the device running-config. It provides a way to push a set of commands onto a network device by evaluating the current running-config and only pushing configuration commands that are not already configured. The config source can be a set of commands or a template. deprecated: Deprecated in 2.2. Use eos_config instead extends_documentation_fragment: eos options: src: description: - The path to the config source. The source can be either a file with config or a template that will be merged during runtime. By default the task will search for the source file in role or playbook root folder in templates directory. required: true force: description: - The force argument instructs the module to not consider the current devices running-config. When set to true, this will cause the module to push the contents of I(src) into the device without first checking if already configured. required: false default: false choices: ['yes', 'no'] include_defaults: description: - By default when the M(eos_template) connects to the remote device to retrieve the configuration it will issue the C(show running-config) command. If this option is set to True then the issued command will be C(show running-config all). required: false default: false choices: ['yes', 'no'] backup: description: - When this argument is configured true, the module will backup the running-config from the node prior to making any changes. The backup file will be written to backup_{{ hostname }} in the root of the playbook directory. required: false default: false choices: ['yes', 'no'] replace: description: - This argument will cause the provided configuration to be replaced on the destination node. The use of the replace argument will always cause the task to set changed to true and will implies C(force=true). This argument is only valid with C(transport=eapi). required: false default: false choices: ['yes', 'no'] config: description: - The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The I(config) argument allows the implementer to pass in the configuration to use as the base config for comparison. required: false default: null """ EXAMPLES = """ - name: Push a configuration onto the device eos_template: src: config.j2 - name: Forceable push a configuration onto the device eos_template: src: config.j2 force: yes - name: Provide the base configuration for comparison eos_template: src: candidate_config.txt config: current_config.txt """ RETURN = """ updates: description: The set of commands that will be pushed to the remote device returned: always type: list sample: ['...', '...'] responses: description: The set of responses from issuing the commands on the device returned: when not check_mode type: list sample: ['...', '...'] """ import re import ansible.module_utils.eos from ansible.module_utils.network import NetworkModule from ansible.module_utils.netcfg import NetworkConfig, dumps def get_config(module): config = module.params.get('config') defaults = module.params['include_defaults'] if not config and not module.params['force']: config = module.config.get_config(include_defaults=defaults) return config def filter_exit(commands): # Filter out configuration mode commands followed immediately by an # exit command indented by one level only, e.g. # - route-map map01 permit 10 # - exit # # Build a temporary list as we filter, then copy the temp list # back onto the commands list. temp = [] ind_prev = 999 count = 0 for c in commands: ind_this = c.count(' ') if re.search(r"^\s*exit$", c) and ind_this == ind_prev + 1: temp.pop() count -= 1 if count != 0: ind_prev = temp[-1].count(' ') continue temp.append(c) ind_prev = ind_this count += 1 return temp def main(): """ main entry point for module execution """ argument_spec = dict( src=dict(required=True), force=dict(default=False, type='bool'), include_defaults=dict(default=False, type='bool'), backup=dict(default=False, type='bool'), replace=dict(default=False, type='bool'), config=dict() ) mutually_exclusive = [('config', 'backup'), ('config', 'force')] module = NetworkModule(argument_spec=argument_spec, mutually_exclusive=mutually_exclusive, supports_check_mode=True) replace = module.params['replace'] commands = list() running = None result = dict(changed=False) candidate = NetworkConfig(contents=module.params['src'], indent=3) if replace: if module.params['transport'] == 'cli': module.fail_json(msg='config replace is only supported over eapi') commands = str(candidate).split('\n') else: contents = get_config(module) if contents: running = NetworkConfig(contents=contents, indent=3) result['_backup'] = contents if not module.params['force']: commands = candidate.difference((running or list())) commands = dumps(commands, 'commands').split('\n') commands = [str(c) for c in commands if c] else: commands = str(candidate).split('\n') commands = filter_exit(commands) if commands: if not module.check_mode: response = module.config.load_config(commands, replace=replace, commit=True) result['responses'] = response result['changed'] = True result['updates'] = commands module.exit_json(**result) if __name__ == '__main__': main()
gpl-3.0
dharamgollapudi/jaikuengine
middleware/auth.py
34
1198
# Copyright 2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from django.conf import settings # TODO andy: this is very basic to begin with, it will need to do some # fancy bits if we are going to support more kinds of wild # authenticatory neatness # copied largely from django's contrib.auth stuff class LazyUser(object): def __get__(self, request, obj_type=None): if not hasattr(request, '_cached_user'): from common import user request._cached_user = user.get_user_from_request(request) return request._cached_user class AuthenticationMiddleware(object): def process_request(self, request): request.__class__.user = LazyUser()
apache-2.0
Gentlemanlylad5/googlepersonfinder
tools/babel/support.py
54
13005
# -*- coding: utf-8 -*- # # Copyright (C) 2007 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://babel.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://babel.edgewall.org/log/. """Several classes and functions that help with integrating and using Babel in applications. .. note: the code in this module is not used by Babel itself """ from datetime import date, datetime, time import gettext from babel.core import Locale from babel.dates import format_date, format_datetime, format_time, LC_TIME from babel.numbers import format_number, format_decimal, format_currency, \ format_percent, format_scientific, LC_NUMERIC from babel.util import set, UTC __all__ = ['Format', 'LazyProxy', 'Translations'] __docformat__ = 'restructuredtext en' class Format(object): """Wrapper class providing the various date and number formatting functions bound to a specific locale and time-zone. >>> fmt = Format('en_US', UTC) >>> fmt.date(date(2007, 4, 1)) u'Apr 1, 2007' >>> fmt.decimal(1.2345) u'1.234' """ def __init__(self, locale, tzinfo=None): """Initialize the formatter. :param locale: the locale identifier or `Locale` instance :param tzinfo: the time-zone info (a `tzinfo` instance or `None`) """ self.locale = Locale.parse(locale) self.tzinfo = tzinfo def date(self, date=None, format='medium'): """Return a date formatted according to the given pattern. >>> fmt = Format('en_US') >>> fmt.date(date(2007, 4, 1)) u'Apr 1, 2007' :see: `babel.dates.format_date` """ return format_date(date, format, locale=self.locale) def datetime(self, datetime=None, format='medium'): """Return a date and time formatted according to the given pattern. >>> from pytz import timezone >>> fmt = Format('en_US', tzinfo=timezone('US/Eastern')) >>> fmt.datetime(datetime(2007, 4, 1, 15, 30)) u'Apr 1, 2007 11:30:00 AM' :see: `babel.dates.format_datetime` """ return format_datetime(datetime, format, tzinfo=self.tzinfo, locale=self.locale) def time(self, time=None, format='medium'): """Return a time formatted according to the given pattern. >>> from pytz import timezone >>> fmt = Format('en_US', tzinfo=timezone('US/Eastern')) >>> fmt.time(datetime(2007, 4, 1, 15, 30)) u'11:30:00 AM' :see: `babel.dates.format_time` """ return format_time(time, format, tzinfo=self.tzinfo, locale=self.locale) def number(self, number): """Return an integer number formatted for the locale. >>> fmt = Format('en_US') >>> fmt.number(1099) u'1,099' :see: `babel.numbers.format_number` """ return format_number(number, locale=self.locale) def decimal(self, number, format=None): """Return a decimal number formatted for the locale. >>> fmt = Format('en_US') >>> fmt.decimal(1.2345) u'1.234' :see: `babel.numbers.format_decimal` """ return format_decimal(number, format, locale=self.locale) def currency(self, number, currency): """Return a number in the given currency formatted for the locale. :see: `babel.numbers.format_currency` """ return format_currency(number, currency, locale=self.locale) def percent(self, number, format=None): """Return a number formatted as percentage for the locale. >>> fmt = Format('en_US') >>> fmt.percent(0.34) u'34%' :see: `babel.numbers.format_percent` """ return format_percent(number, format, locale=self.locale) def scientific(self, number): """Return a number formatted using scientific notation for the locale. :see: `babel.numbers.format_scientific` """ return format_scientific(number, locale=self.locale) class LazyProxy(object): """Class for proxy objects that delegate to a specified function to evaluate the actual object. >>> def greeting(name='world'): ... return 'Hello, %s!' % name >>> lazy_greeting = LazyProxy(greeting, name='Joe') >>> print lazy_greeting Hello, Joe! >>> u' ' + lazy_greeting u' Hello, Joe!' >>> u'(%s)' % lazy_greeting u'(Hello, Joe!)' This can be used, for example, to implement lazy translation functions that delay the actual translation until the string is actually used. The rationale for such behavior is that the locale of the user may not always be available. In web applications, you only know the locale when processing a request. The proxy implementation attempts to be as complete as possible, so that the lazy objects should mostly work as expected, for example for sorting: >>> greetings = [ ... LazyProxy(greeting, 'world'), ... LazyProxy(greeting, 'Joe'), ... LazyProxy(greeting, 'universe'), ... ] >>> greetings.sort() >>> for greeting in greetings: ... print greeting Hello, Joe! Hello, universe! Hello, world! """ __slots__ = ['_func', '_args', '_kwargs', '_value'] def __init__(self, func, *args, **kwargs): # Avoid triggering our own __setattr__ implementation object.__setattr__(self, '_func', func) object.__setattr__(self, '_args', args) object.__setattr__(self, '_kwargs', kwargs) object.__setattr__(self, '_value', None) def value(self): if self._value is None: value = self._func(*self._args, **self._kwargs) object.__setattr__(self, '_value', value) return self._value value = property(value) def __contains__(self, key): return key in self.value def __nonzero__(self): return bool(self.value) def __dir__(self): return dir(self.value) def __iter__(self): return iter(self.value) def __len__(self): return len(self.value) def __str__(self): return str(self.value) def __unicode__(self): return unicode(self.value) def __add__(self, other): return self.value + other def __radd__(self, other): return other + self.value def __mod__(self, other): return self.value % other def __rmod__(self, other): return other % self.value def __mul__(self, other): return self.value * other def __rmul__(self, other): return other * self.value def __call__(self, *args, **kwargs): return self.value(*args, **kwargs) def __lt__(self, other): return self.value < other def __le__(self, other): return self.value <= other def __eq__(self, other): return self.value == other def __ne__(self, other): return self.value != other def __gt__(self, other): return self.value > other def __ge__(self, other): return self.value >= other def __delattr__(self, name): delattr(self.value, name) def __getattr__(self, name): return getattr(self.value, name) def __setattr__(self, name, value): setattr(self.value, name, value) def __delitem__(self, key): del self.value[key] def __getitem__(self, key): return self.value[key] def __setitem__(self, key, value): self.value[key] = value class Translations(gettext.GNUTranslations, object): """An extended translation catalog class.""" DEFAULT_DOMAIN = 'messages' def __init__(self, fileobj=None, domain=DEFAULT_DOMAIN): """Initialize the translations catalog. :param fileobj: the file-like object the translation should be read from """ gettext.GNUTranslations.__init__(self, fp=fileobj) self.files = filter(None, [getattr(fileobj, 'name', None)]) self.domain = domain self._domains = {} def load(cls, dirname=None, locales=None, domain=DEFAULT_DOMAIN): """Load translations from the given directory. :param dirname: the directory containing the ``MO`` files :param locales: the list of locales in order of preference (items in this list can be either `Locale` objects or locale strings) :param domain: the message domain :return: the loaded catalog, or a ``NullTranslations`` instance if no matching translations were found :rtype: `Translations` """ if locales is not None: if not isinstance(locales, (list, tuple)): locales = [locales] locales = [str(locale) for locale in locales] if not domain: domain = cls.DEFAULT_DOMAIN filename = gettext.find(domain, dirname, locales) if not filename: return gettext.NullTranslations() return cls(fileobj=open(filename, 'rb'), domain=domain) load = classmethod(load) def __repr__(self): return '<%s: "%s">' % (type(self).__name__, self._info.get('project-id-version')) def add(self, translations, merge=True): """Add the given translations to the catalog. If the domain of the translations is different than that of the current catalog, they are added as a catalog that is only accessible by the various ``d*gettext`` functions. :param translations: the `Translations` instance with the messages to add :param merge: whether translations for message domains that have already been added should be merged with the existing translations :return: the `Translations` instance (``self``) so that `merge` calls can be easily chained :rtype: `Translations` """ domain = getattr(translations, 'domain', self.DEFAULT_DOMAIN) if merge and domain == self.domain: return self.merge(translations) existing = self._domains.get(domain) if merge and existing is not None: existing.merge(translations) else: translations.add_fallback(self) self._domains[domain] = translations return self def merge(self, translations): """Merge the given translations into the catalog. Message translations in the specified catalog override any messages with the same identifier in the existing catalog. :param translations: the `Translations` instance with the messages to merge :return: the `Translations` instance (``self``) so that `merge` calls can be easily chained :rtype: `Translations` """ if isinstance(translations, gettext.GNUTranslations): self._catalog.update(translations._catalog) if isinstance(translations, Translations): self.files.extend(translations.files) return self def dgettext(self, domain, message): """Like ``gettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).gettext(message) def ldgettext(self, domain, message): """Like ``lgettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).lgettext(message) def dugettext(self, domain, message): """Like ``ugettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).ugettext(message) def dngettext(self, domain, singular, plural, num): """Like ``ngettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).ngettext(singular, plural, num) def ldngettext(self, domain, singular, plural, num): """Like ``lngettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).lngettext(singular, plural, num) def dungettext(self, domain, singular, plural, num): """Like ``ungettext()`` but look the message up in the specified domain. """ return self._domains.get(domain, self).ungettext(singular, plural, num)
apache-2.0
bgalehouse/grr
client/client_actions/plist.py
8
2510
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. """Client actions related to plist files.""" import cStringIO import types from binplist import binplist from grr.client import actions from grr.client import vfs from grr.lib import plist as plist_lib from grr.lib.rdfvalues import plist as rdfplist from grr.lib.rdfvalues import protodict class PlistQuery(actions.ActionPlugin): """Parses the plist request specified and returns the results. PlistQuery allows you to obtain data from a plist, optionally only if it matches the given filter. Querying for a plist is done in two steps. First, its contents are retrieved. For plists where the top level element is a dict, you can use the key parameter of the PlistRequest to specify a path into the dict to retrieve. When specifying a key, the requested key values are places under a dictionary key called "key". Whether you've specified a key or not, the query parameter allows you to filter based on the """ in_rdfvalue = rdfplist.PlistRequest out_rdfvalue = protodict.RDFValueArray MAX_PLIST_SIZE = 1024 * 1024 * 100 # 100 MB def Run(self, args): self.context = args.context self.filter_query = args.query with vfs.VFSOpen(args.pathspec, progress_callback=self.Progress) as fd: data = fd.Read(self.MAX_PLIST_SIZE) plist = binplist.readPlist(cStringIO.StringIO(data)) # Create the query parser parser = plist_lib.PlistFilterParser(self.filter_query).Parse() filter_imp = plist_lib.PlistFilterImplementation matcher = parser.Compile(filter_imp) if self.context: # Obtain the values for the context using the value expander value_expander = filter_imp.FILTERS["ValueExpander"] iterator = value_expander().Expand(plist, self.context) else: # If we didn't get a context, the context is the whole plist iterator = [plist] reply = protodict.RDFValueArray() for item in iterator: # As we're setting the context manually, we need to account for types if isinstance(item, types.ListType): for sub_item in item: partial_plist = plist_lib.PlistValueToPlainValue(sub_item) if matcher.Matches(partial_plist): reply.Append(sub_item) else: partial_plist = plist_lib.PlistValueToPlainValue(item) if matcher.Matches(partial_plist): reply.Append(partial_plist) self.SendReply(reply)
apache-2.0
OpenTrons/opentrons-api
api/tests/opentrons/api/test_session.py
2
18003
from unittest.mock import patch import itertools import copy import pytest import base64 from opentrons.api import session from opentrons.api.session import ( _accumulate, _dedupe) from opentrons.hardware_control import ThreadedAsyncForbidden from tests.opentrons.conftest import state from functools import partial from opentrons.protocols.types import APIVersion from opentrons.protocol_api import MAX_SUPPORTED_VERSION from opentrons.protocols.execution.errors import ExceptionInProtocolError state = partial(state, 'session') @pytest.fixture def run_session(request, session_manager): return session_manager.create('dino', 'from opentrons import robot') async def test_load_from_text(session_manager, protocol): session = session_manager.create(name='<blank>', contents=protocol.text) assert session.name == '<blank>' acc = [] def traverse(commands): for command in commands: acc.append(command) traverse(command['children']) traverse(session.commands) # Less commands now that trash is built in assert len(acc) == 75 async def test_clear_tips(session_manager, tip_clear_protocol): session = session_manager.create( name='<blank>', contents=tip_clear_protocol.text) assert len(session._instruments) == 1 for instrument in session._instruments: assert not instrument.tip_attached async def test_async_notifications(main_router): main_router.broker.publish( 'session', {'name': 'foo', 'payload': {'bar': 'baz'}}) # Get async iterator aiter = main_router.notifications.__aiter__() # Then read the first item res = await aiter.__anext__() assert res == {'name': 'foo', 'payload': {'bar': 'baz'}} @pytest.mark.parametrize( 'proto_with_error', [ ''' metadata={"apiLevel": "2.0"} blah def run(ctx): pass''', 'metadata={"apiLevel": "1.0"}; blah', ]) def test_load_protocol_with_error(session_manager, hardware, proto_with_error): with pytest.raises(NameError) as e: session = session_manager.create( name='<blank>', contents=proto_with_error) assert session is None args, = e.value.args assert args == "name 'blah' is not defined" @pytest.mark.parametrize( 'protocol_file', ['testosaur_v2.py', 'testosaur.py', 'multi-single.py']) async def test_load_and_run_v2( main_router, protocol, protocol_file, loop): session = main_router.session_manager.create( name='<blank>', contents=protocol.text) assert main_router.notifications.queue.qsize() == 1 assert session.state == 'loaded' assert session.command_log == {} def run(): session.run() await loop.run_in_executor(executor=None, func=run) assert session.command_log old_log = copy.deepcopy(session.command_log) res = [] index = 0 async for notification in main_router.notifications: payload = notification['payload'] index += 1 # Command log in sync with add-command events emitted if type(payload) is dict: state = payload.get('state') else: state = payload.state res.append(state) if state == 'finished': break assert [key for key, _ in itertools.groupby(res)] == \ ['loaded', 'running', 'finished'] assert main_router.notifications.queue.qsize() == 0,\ 'Notification should be empty after receiving "finished" event' session.run() assert len(session.command_log) == len(old_log) assert session.protocol_text == protocol.text def test_init(run_session): assert run_session.state == 'loaded' assert run_session.name == 'dino' def test_set_state(run_session): states = 'loaded', 'running', 'finished', 'stopped', 'paused' for state in states: run_session.set_state(state) assert run_session.state == state with pytest.raises(ValueError): run_session.set_state('impossible-state') def test_set_state_info(run_session, monkeypatch): assert run_session.stateInfo == {} run_session.set_state('paused', reason='test1', user_message='cool message', duration=10) assert run_session.stateInfo == {'message': 'test1', 'userMessage': 'cool message', 'estimatedDuration': 10} run_session.startTime = 300 monkeypatch.setattr(session, 'now', lambda: 350) run_session.set_state('running') assert run_session.stateInfo == {'changedAt': 50} def test_error_append(run_session): foo = Exception('Foo') bar = Exception('Bar') run_session.error_append(foo) run_session.error_append(bar) errors = [ value for value in run_session.errors if isinstance(value.pop('timestamp'), int) ] assert errors == [ {'error': foo}, {'error': bar} ] def test_accumulate(): res = \ _accumulate([ (['a'], ['d'], ['g', 'h']), (['b', 'c'], ['e', 'f'], ['i']) ]) assert res == (['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']) assert _accumulate([]) == ([], [], [], []) def test_dedupe(): assert ''.join(_dedupe('aaaaabbbbcbbbbcccaa')) == 'abc' async def test_session_model_functional(session_manager, protocol): session = session_manager.create(name='<blank>', contents=protocol.text) assert [container.name for container in session.containers] == \ ['tiprack', 'trough', 'plate', 'opentrons_1_trash_1100ml_fixed'] names = [instrument.name for instrument in session.instruments] assert names == ['p300_single_v1'] @pytest.mark.parametrize('protocol_file', ['testosaur-gen2.py', 'testosaur-gen2-v2.py']) async def test_requested_as(session_manager, protocol, protocol_file): session = session_manager.create(name='<blank>', contents=protocol.text) assert session.get_instruments()[0].requested_as == 'p300_single_gen2' # TODO(artyom 20171018): design a small protocol specifically for the test @pytest.mark.parametrize('protocol_file', ['bradford_assay.py']) async def test_drop_tip_with_trash(session_manager, protocol, protocol_file): """ Bradford Assay is using drop_tip() with no arguments that assumes tip drop into trash-box. In this test we are confirming that that trash location is being inferred from a command, and trash is listed as a container for a protocol, as well as a container instruments are interacting with. """ session = session_manager.create(name='<blank>', contents=protocol.text) assert 'opentrons_1_trash_1100ml_fixed' in [ c.name for c in session.get_containers()] containers = sum([i.containers for i in session.get_instruments()], []) assert 'opentrons_1_trash_1100ml_fixed' in [c.name for c in containers] async def test_session_create_error(main_router): with pytest.raises(SyntaxError): main_router.session_manager.create( name='<blank>', contents='from opentrons import instruments; syntax error ;(') with pytest.raises(TimeoutError): # No state change is expected await main_router.wait_until(lambda _: True) with pytest.raises(ZeroDivisionError): main_router.session_manager.create( name='<blank>', contents='from opentrons import instruments; 1/0') with pytest.raises(TimeoutError): # No state change is expected await main_router.wait_until(lambda _: True) async def test_session_metadata_v1(main_router): expected = { 'hello': 'world', 'what?': 'no' } prot = """ from opentrons import instruments this = 0 that = 1 metadata = { 'what?': 'no', 'hello': 'world' } print('wat?') """ session = main_router.session_manager.create( name='<blank>', contents=prot) assert session.metadata == expected async def test_session_metadata_v2(main_router): expected = { 'hello': 'world', 'what?': 'no', 'apiLevel': '2.0' } prot = """ this = 0 that = 1 metadata = { 'what?': 'no', 'hello': 'world', 'apiLevel': '2.0' } print('wat?') def run(ctx): print('hi there') """ session = main_router.session_manager.create( name='<blank>', contents=prot) assert session.metadata == expected async def test_too_high_version(main_router): minor_over = APIVersion(MAX_SUPPORTED_VERSION.major, MAX_SUPPORTED_VERSION.minor + 1) minor_over_mdata = {'apiLevel': str(minor_over)} proto = 'metadata=' + str(minor_over_mdata) + """ def run(ctx): pass """ with pytest.raises(RuntimeError): main_router.session_manager.create( name='<blank>', contents=proto) @pytest.mark.api2_only async def test_session_extra_labware(main_router, get_labware_fixture, virtual_smoothie_env): proto = ''' metadata = {"apiLevel": "2.0"} def run(ctx): tr = ctx.load_labware("fixture_12_trough", "1") tiprack = ctx.load_labware("opentrons_96_tiprack_300ul", "2") instr = ctx.load_instrument("p300_single", "right", tip_racks=[tiprack]) instr.pick_up_tip() instr.aspirate(300, tr["A1"]) ''' extra_labware = [ get_labware_fixture('fixture_12_trough') ] session = main_router.session_manager.create_with_extra_labware( name='<blank>', contents=proto, extra_labware=extra_labware) assert not session.errors session_conts = session.get_containers() for lw in extra_labware: assert lw['parameters']['loadName'] in [ c.name for c in session_conts] session.run() assert not session.errors with pytest.raises(ExceptionInProtocolError): main_router.session_manager.create( name='<blank>', contents=proto) @pytest.mark.api2_only async def test_session_bundle(main_router, get_bundle_fixture, virtual_smoothie_env): bundle = get_bundle_fixture('simple_bundle') b64d = base64.b64encode(bundle['binary_zipfile']) session1 = main_router.session_manager.create(name='bundle.zip', contents=b64d, is_binary=True) session2 = main_router.session_manager.create_from_bundle( name='bundle.zip', contents=b64d) assert session1._protocol == session2._protocol async def test_session_unused_hardware(main_router, virtual_smoothie_env, get_json_protocol_fixture): # both python v2 and json should have their instruments and modules appear # in the session properties even if they are not used proto = ''' metadata = {"apiLevel": "2.0"} def run(ctx): rack1 = ctx.load_labware('opentrons_96_tiprack_300ul', '1') rack2 = ctx.load_labware('opentrons_96_tiprack_300ul', '2') left = ctx.load_instrument('p300_single', 'left', tip_racks=[rack1]) right = ctx.load_instrument('p10_multi', 'right', tip_racks=[rack2]) mod = ctx.load_module('magdeck', '4') mod2 = ctx.load_module('tempdeck', '5') plate = mod2.load_labware('corning_96_wellplate_360ul_flat') mod2.set_temperature(60) left.pick_up_tip() left.aspirate(50, plate['A1']) left.dispense(50, plate['A2']) left.drop_tip() ''' session = main_router.session_manager.create('dummy-pipette', proto) assert 'p300_single_v1' in [pip.name for pip in session.instruments] assert 'p10_multi_v1' in [pip.name for pip in session.instruments] assert 'magdeck' in [mod.name for mod in session.modules] assert 'magneticModuleV1' in [mod.model for mod in session.modules] assert 'temperatureModuleV1' in [mod.model for mod in session.modules] assert 'tempdeck' in [mod.name for mod in session.modules] v1proto = ''' from opentrons import instruments, modules, labware racks = [labware.load('opentrons_96_tiprack_300ul', slot) for slot in (1, 2)] magdeck = modules.load('magdeck', '4') tempdeck = modules.load('tempdeck', '5') plate = labware.load('corning_96_wellplate_360ul_flat', '5', share=True) left = instruments.P300_Single('left', tip_racks=[racks[0]]) right = instruments.P10_Multi('right', tip_racks=[racks[1]]) tempdeck.set_temperature(60) left.pick_up_tip() left.aspirate(plate.wells(0)) left.dispense(plate.wells(1)) left.drop_tip() ''' # json protocols don't support modules so we only have to check pipettes jsonp = get_json_protocol_fixture('3', 'unusedPipette', decode=False) session2 = main_router.session_manager.create('dummy-pipette-json', jsonp) assert 'p50_single_v1' in [pip.name for pip in session2.instruments] assert 'p10_single_v1' in [pip.name for pip in session2.instruments] # do not change behavior for v1: instruments must have interactions # to appear session3 = main_router.session_manager.create('dummy-pipette_v1', v1proto) assert ['p300_single_v1'] == [pip.name for pip in session3.instruments] assert ['temperatureModuleV1'] == [mod.model for mod in session3.modules] assert ['tempdeck'] == [mod.name for mod in session3.modules] async def test_session_robot_connect_not_allowed(main_router, virtual_smoothie_env): proto = """ from opentrons import robot robot.connect() """ with pytest.raises(RuntimeError, match='.*robot.connect.*'): main_router.session_manager.create('calls-connect', proto) async def test_session_run_concurrently( main_router, get_labware_fixture, virtual_smoothie_env): """This test proves that we are not able to start a protocol run while one is active. This cross boundaries into the RPC because it emulates how the RPC server handles requests. It uses a thread executor with two threads. This test was added to prove that there's a deadlock if a protocol with a pause is started twice. """ # Create a protocol that does nothing but pause. proto = ''' metadata = {"apiLevel": "2.0"} def run(ctx): ctx.pause() ''' session = main_router.session_manager.create_with_extra_labware( name='<blank>', contents=proto, extra_labware=[] ) from concurrent.futures import ThreadPoolExecutor, as_completed from time import sleep def run_while_running(): """The entry point to threads that try to run while a protocol is running""" with pytest.raises(ThreadedAsyncForbidden): session.run() # Do this twice to prove we run again after completion. for _ in range(2): # Use two as the max workers, just like RPC. max_workers = 2 with ThreadPoolExecutor(max_workers=max_workers) as m: tasks = list() # Start the run. tasks.append(m.submit(lambda: session.run())) # Try to start running the protocol a whole bunch of times. for _ in range(max_workers * 5): tasks.append(m.submit(run_while_running)) # wait to enter pause sleep(0.05) # Now resume tasks.append(m.submit(lambda: session.resume())) for future in as_completed(tasks): future.result() @pytest.mark.parametrize(argnames="create_func,extra_kwargs", argvalues=[ [session.SessionManager.create, {}], [session.SessionManager.create_from_bundle, {}], [session.SessionManager.create_with_extra_labware, {"extra_labware": {}}] ]) def test_http_protocol_sessions_disabled(session_manager, protocol, create_func, extra_kwargs): """Test that we can create a session if enableHttpProtocolSessions is disabled.""" with patch.object(session.Session, "build_and_prep") as mock_build: with patch("opentrons.api.util.enable_http_protocol_sessions") as m: m.return_value = False create_func(session_manager, name='<blank>', contents=protocol.text, **extra_kwargs) mock_build.assert_called_once() @pytest.mark.parametrize(argnames="create_func,extra_kwargs", argvalues=[ [session.SessionManager.create, {}], [session.SessionManager.create_from_bundle, {}], [session.SessionManager.create_with_extra_labware, {"extra_labware": {}}] ]) async def test_http_protocol_sessions_enabled(session_manager, protocol, create_func, extra_kwargs): """Test that we cannot create a session if enableHttpProtocolSessions is enabled.""" with patch.object(session.Session, "build_and_prep"): with patch("opentrons.api.util.enable_http_protocol_sessions") as m: m.return_value = True with pytest.raises( RuntimeError, match="Please disable the 'Enable Experimental HTTP " "Protocol Sessions' advanced setting for this robot " "if you'd like to upload protocols from the " "Opentrons App"): session_manager.create(name='<blank>', contents=protocol.text)
apache-2.0
jelly/calibre
src/calibre/gui2/tweak_book/preview.py
2
23925
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import time, textwrap, json from bisect import bisect_right from base64 import b64encode from future_builtins import map from threading import Thread from Queue import Queue, Empty from functools import partial from urlparse import urlparse from PyQt5.Qt import ( QWidget, QVBoxLayout, QApplication, QSize, QNetworkAccessManager, QMenu, QIcon, QNetworkReply, QTimer, QNetworkRequest, QUrl, Qt, QToolBar, pyqtSlot, pyqtSignal) from PyQt5.QtWebKitWidgets import QWebView, QWebInspector, QWebPage from calibre import prints from calibre.constants import FAKE_PROTOCOL, FAKE_HOST from calibre.ebooks.oeb.polish.parsing import parse from calibre.ebooks.oeb.base import serialize, OEB_DOCS from calibre.gui2 import error_dialog, open_url, NO_URL_FORMATTING, secure_web_page from calibre.gui2.tweak_book import current_container, editors, tprefs, actions, TOP from calibre.gui2.viewer.documentview import apply_settings from calibre.gui2.viewer.config import config from calibre.gui2.widgets2 import HistoryLineEdit2 from calibre.utils.ipc.simple_worker import offload_worker shutdown = object() def get_data(name): 'Get the data for name. Returns a unicode string if name is a text document/stylesheet' if name in editors: return editors[name].get_raw_data() return current_container().raw_data(name) # Parsing of html to add linenumbers {{{ def parse_html(raw): root = parse(raw, decoder=lambda x:x.decode('utf-8'), line_numbers=True, linenumber_attribute='data-lnum') return serialize(root, 'text/html').encode('utf-8') class ParseItem(object): __slots__ = ('name', 'length', 'fingerprint', 'parsing_done', 'parsed_data') def __init__(self, name): self.name = name self.length, self.fingerprint = 0, None self.parsed_data = None self.parsing_done = False def __repr__(self): return 'ParsedItem(name=%r, length=%r, fingerprint=%r, parsing_done=%r, parsed_data_is_None=%r)' % ( self.name, self.length, self.fingerprint, self.parsing_done, self.parsed_data is None) class ParseWorker(Thread): daemon = True SLEEP_TIME = 1 def __init__(self): Thread.__init__(self) self.requests = Queue() self.request_count = 0 self.parse_items = {} self.launch_error = None def run(self): mod, func = 'calibre.gui2.tweak_book.preview', 'parse_html' try: # Connect to the worker and send a dummy job to initialize it self.worker = offload_worker(priority='low') self.worker(mod, func, '<p></p>') except: import traceback traceback.print_exc() self.launch_error = traceback.format_exc() return while True: time.sleep(self.SLEEP_TIME) x = self.requests.get() requests = [x] while True: try: requests.append(self.requests.get_nowait()) except Empty: break if shutdown in requests: self.worker.shutdown() break request = sorted(requests, reverse=True)[0] del requests pi, data = request[1:] try: res = self.worker(mod, func, data) except: import traceback traceback.print_exc() else: pi.parsing_done = True parsed_data = res['result'] if res['tb']: prints("Parser error:") prints(res['tb']) else: pi.parsed_data = parsed_data def add_request(self, name): data = get_data(name) ldata, hdata = len(data), hash(data) pi = self.parse_items.get(name, None) if pi is None: self.parse_items[name] = pi = ParseItem(name) else: if pi.parsing_done and pi.length == ldata and pi.fingerprint == hdata: return pi.parsed_data = None pi.parsing_done = False pi.length, pi.fingerprint = ldata, hdata self.requests.put((self.request_count, pi, data)) self.request_count += 1 def shutdown(self): self.requests.put(shutdown) def get_data(self, name): return getattr(self.parse_items.get(name, None), 'parsed_data', None) def clear(self): self.parse_items.clear() def is_alive(self): return Thread.is_alive(self) or (hasattr(self, 'worker') and self.worker.is_alive()) parse_worker = ParseWorker() # }}} # Override network access to load data "live" from the editors {{{ class NetworkReply(QNetworkReply): def __init__(self, parent, request, mime_type, name): QNetworkReply.__init__(self, parent) self.setOpenMode(QNetworkReply.ReadOnly | QNetworkReply.Unbuffered) self.setRequest(request) self.setUrl(request.url()) self._aborted = False if mime_type in OEB_DOCS: self.resource_name = name QTimer.singleShot(0, self.check_for_parse) else: data = get_data(name) if isinstance(data, type('')): data = data.encode('utf-8') mime_type += '; charset=utf-8' self.__data = data mime_type = { # Prevent warning in console about mimetype of fonts 'application/vnd.ms-opentype':'application/x-font-ttf', 'application/x-font-truetype':'application/x-font-ttf', 'application/font-sfnt': 'application/x-font-ttf', }.get(mime_type, mime_type) self.setHeader(QNetworkRequest.ContentTypeHeader, mime_type) self.setHeader(QNetworkRequest.ContentLengthHeader, len(self.__data)) QTimer.singleShot(0, self.finalize_reply) def check_for_parse(self): if self._aborted: return data = parse_worker.get_data(self.resource_name) if data is None: return QTimer.singleShot(10, self.check_for_parse) self.__data = data self.setHeader(QNetworkRequest.ContentTypeHeader, 'application/xhtml+xml; charset=utf-8') self.setHeader(QNetworkRequest.ContentLengthHeader, len(self.__data)) self.finalize_reply() def bytesAvailable(self): try: return len(self.__data) except AttributeError: return 0 def isSequential(self): return True def abort(self): self._aborted = True def readData(self, maxlen): ans, self.__data = self.__data[:maxlen], self.__data[maxlen:] return ans read = readData def finalize_reply(self): if self._aborted: return self.setFinished(True) self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "Ok") self.metaDataChanged.emit() self.downloadProgress.emit(len(self.__data), len(self.__data)) self.readyRead.emit() self.finished.emit() class NetworkAccessManager(QNetworkAccessManager): def createRequest(self, operation, request, data): qurl = request.url() if operation == self.GetOperation and qurl.host() == FAKE_HOST: name = qurl.path()[1:] c = current_container() if c.has_name(name): try: return NetworkReply(self, request, c.mime_map.get(name, 'application/octet-stream'), name) except Exception: import traceback traceback.print_exc() return QNetworkAccessManager.createRequest(self, operation, request, data) # }}} def uniq(vals): ''' Remove all duplicates from vals, while preserving order. ''' vals = vals or () seen = set() seen_add = seen.add return tuple(x for x in vals if x not in seen and not seen_add(x)) def find_le(a, x): 'Find rightmost value in a less than or equal to x' try: return a[bisect_right(a, x)] except IndexError: return a[-1] class WebPage(QWebPage): sync_requested = pyqtSignal(object, object, object) split_requested = pyqtSignal(object, object) def __init__(self, parent): QWebPage.__init__(self, parent) settings = self.settings() apply_settings(settings, config().parse()) settings.setMaximumPagesInCache(0) secure_web_page(settings) settings.setAttribute(settings.PrivateBrowsingEnabled, True) settings.setAttribute(settings.LinksIncludedInFocusChain, False) settings.setAttribute(settings.DeveloperExtrasEnabled, True) settings.setDefaultTextEncoding('utf-8') data = 'data:text/css;charset=utf-8;base64,' css = '[data-in-split-mode="1"] [data-is-block="1"]:hover { cursor: pointer !important; border-top: solid 5px green !important }' data += b64encode(css.encode('utf-8')) settings.setUserStyleSheetUrl(QUrl(data)) self.setNetworkAccessManager(NetworkAccessManager(self)) self.setLinkDelegationPolicy(self.DelegateAllLinks) self.mainFrame().javaScriptWindowObjectCleared.connect(self.init_javascript) self.init_javascript() def javaScriptConsoleMessage(self, msg, lineno, source_id): prints('preview js:%s:%s:'%(unicode(source_id), lineno), unicode(msg)) def init_javascript(self): if not hasattr(self, 'js'): from calibre.utils.resources import compiled_coffeescript self.js = compiled_coffeescript('ebooks.oeb.display.utils', dynamic=False) self.js += P('csscolorparser.js', data=True, allow_user_override=False) self.js += compiled_coffeescript('ebooks.oeb.polish.preview', dynamic=False) self._line_numbers = None mf = self.mainFrame() mf.addToJavaScriptWindowObject("py_bridge", self) mf.evaluateJavaScript(self.js) @pyqtSlot(str, str, str) def request_sync(self, tag_name, href, sourceline_address): try: self.sync_requested.emit(unicode(tag_name), unicode(href), json.loads(unicode(sourceline_address))) except (TypeError, ValueError, OverflowError, AttributeError): pass def go_to_anchor(self, anchor, lnum): self.mainFrame().evaluateJavaScript('window.calibre_preview_integration.go_to_anchor(%s, %s)' % ( json.dumps(anchor), json.dumps(str(lnum)))) @pyqtSlot(str, str) def request_split(self, loc, totals): actions['split-in-preview'].setChecked(False) loc, totals = json.loads(unicode(loc)), json.loads(unicode(totals)) if not loc or not totals: return error_dialog(self.view(), _('Invalid location'), _('Cannot split on the body tag'), show=True) self.split_requested.emit(loc, totals) @property def line_numbers(self): if self._line_numbers is None: def atoi(x): try: ans = int(x) except (TypeError, ValueError): ans = None return ans val = self.mainFrame().evaluateJavaScript('window.calibre_preview_integration.line_numbers()') self._line_numbers = sorted(uniq(filter(lambda x:x is not None, map(atoi, val)))) return self._line_numbers def go_to_line(self, lnum): try: lnum = find_le(self.line_numbers, lnum) except IndexError: return self.mainFrame().evaluateJavaScript( 'window.calibre_preview_integration.go_to_line(%d)' % lnum) def go_to_sourceline_address(self, sourceline_address): lnum, tags = sourceline_address if lnum is None: return tags = [x.lower() for x in tags] self.mainFrame().evaluateJavaScript( 'window.calibre_preview_integration.go_to_sourceline_address(%d, %s)' % (lnum, json.dumps(tags))) def split_mode(self, enabled): self.mainFrame().evaluateJavaScript( 'window.calibre_preview_integration.split_mode(%s)' % ( 'true' if enabled else 'false')) class WebView(QWebView): def __init__(self, parent=None): QWebView.__init__(self, parent) self.inspector = QWebInspector(self) w = QApplication.instance().desktop().availableGeometry(self).width() self._size_hint = QSize(int(w/3), int(w/2)) self._page = WebPage(self) self.setPage(self._page) self.inspector.setPage(self._page) self.clear() self.setAcceptDrops(False) def sizeHint(self): return self._size_hint def refresh(self): self.pageAction(self.page().Reload).trigger() @dynamic_property def scroll_pos(self): def fget(self): mf = self.page().mainFrame() return (mf.scrollBarValue(Qt.Horizontal), mf.scrollBarValue(Qt.Vertical)) def fset(self, val): mf = self.page().mainFrame() mf.setScrollBarValue(Qt.Horizontal, val[0]) mf.setScrollBarValue(Qt.Vertical, val[1]) return property(fget=fget, fset=fset) def clear(self): self.setHtml(_( ''' <h3>Live preview</h3> <p>Here you will see a live preview of the HTML file you are currently editing. The preview will update automatically as you make changes. <p style="font-size:x-small; color: gray">Note that this is a quick preview only, it is not intended to simulate an actual e-book reader. Some aspects of your e-book will not work, such as page breaks and page margins. ''')) def inspect(self): self.inspector.parent().show() self.inspector.parent().raise_() self.pageAction(self.page().InspectElement).trigger() def contextMenuEvent(self, ev): menu = QMenu(self) p = self.page() mf = p.mainFrame() r = mf.hitTestContent(ev.pos()) url = unicode(r.linkUrl().toString(NO_URL_FORMATTING)).strip() ca = self.pageAction(QWebPage.Copy) if ca.isEnabled(): menu.addAction(ca) menu.addAction(actions['reload-preview']) menu.addAction(QIcon(I('debug.png')), _('Inspect element'), self.inspect) if url.partition(':')[0].lower() in {'http', 'https'}: menu.addAction(_('Open link'), partial(open_url, r.linkUrl())) menu.exec_(ev.globalPos()) class Preview(QWidget): sync_requested = pyqtSignal(object, object) split_requested = pyqtSignal(object, object, object) split_start_requested = pyqtSignal() link_clicked = pyqtSignal(object, object) refresh_starting = pyqtSignal() refreshed = pyqtSignal() def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QVBoxLayout() self.setLayout(l) l.setContentsMargins(0, 0, 0, 0) self.view = WebView(self) self.view.page().sync_requested.connect(self.request_sync) self.view.page().split_requested.connect(self.request_split) self.view.page().loadFinished.connect(self.load_finished) self.inspector = self.view.inspector self.inspector.setPage(self.view.page()) l.addWidget(self.view) self.bar = QToolBar(self) l.addWidget(self.bar) ac = actions['auto-reload-preview'] ac.setCheckable(True) ac.setChecked(True) ac.toggled.connect(self.auto_reload_toggled) self.auto_reload_toggled(ac.isChecked()) self.bar.addAction(ac) ac = actions['sync-preview-to-editor'] ac.setCheckable(True) ac.setChecked(True) ac.toggled.connect(self.sync_toggled) self.sync_toggled(ac.isChecked()) self.bar.addAction(ac) self.bar.addSeparator() ac = actions['split-in-preview'] ac.setCheckable(True) ac.setChecked(False) ac.toggled.connect(self.split_toggled) self.split_toggled(ac.isChecked()) self.bar.addAction(ac) ac = actions['reload-preview'] ac.triggered.connect(self.refresh) self.bar.addAction(ac) actions['preview-dock'].toggled.connect(self.visibility_changed) self.current_name = None self.last_sync_request = None self.refresh_timer = QTimer(self) self.refresh_timer.timeout.connect(self.refresh) parse_worker.start() self.current_sync_request = None self.search = HistoryLineEdit2(self) self.search.initialize('tweak_book_preview_search') self.search.setPlaceholderText(_('Search in preview')) self.search.returnPressed.connect(partial(self.find, 'next')) self.bar.addSeparator() self.bar.addWidget(self.search) for d in ('next', 'prev'): ac = actions['find-%s-preview' % d] ac.triggered.connect(partial(self.find, d)) self.bar.addAction(ac) def find(self, direction): text = unicode(self.search.text()) self.view.findText(text, QWebPage.FindWrapsAroundDocument | ( QWebPage.FindBackward if direction == 'prev' else QWebPage.FindFlags(0))) def request_sync(self, tagname, href, lnum): if self.current_name: c = current_container() if tagname == 'a' and href: if href and href.startswith('#'): name = self.current_name else: name = c.href_to_name(href, self.current_name) if href else None if name == self.current_name: return self.view.page().go_to_anchor(urlparse(href).fragment, lnum) if name and c.exists(name) and c.mime_map[name] in OEB_DOCS: return self.link_clicked.emit(name, urlparse(href).fragment or TOP) self.sync_requested.emit(self.current_name, lnum) def request_split(self, loc, totals): if self.current_name: self.split_requested.emit(self.current_name, loc, totals) def sync_to_editor(self, name, sourceline_address): self.current_sync_request = (name, sourceline_address) QTimer.singleShot(100, self._sync_to_editor) def _sync_to_editor(self): if not actions['sync-preview-to-editor'].isChecked(): return try: if self.refresh_timer.isActive() or self.current_sync_request[0] != self.current_name: return QTimer.singleShot(100, self._sync_to_editor) except TypeError: return # Happens if current_sync_request is None sourceline_address = self.current_sync_request[1] self.current_sync_request = None self.view.page().go_to_sourceline_address(sourceline_address) def report_worker_launch_error(self): if parse_worker.launch_error is not None: tb, parse_worker.launch_error = parse_worker.launch_error, None error_dialog(self, _('Failed to launch worker'), _( 'Failed to launch the worker process used for rendering the preview'), det_msg=tb, show=True) def name_to_qurl(self, name=None): name = name or self.current_name qurl = QUrl() qurl.setScheme(FAKE_PROTOCOL), qurl.setAuthority(FAKE_HOST), qurl.setPath('/' + name) return qurl def show(self, name): if name != self.current_name: self.refresh_timer.stop() self.current_name = name self.report_worker_launch_error() parse_worker.add_request(name) self.view.setUrl(self.name_to_qurl()) return True def refresh(self): if self.current_name: self.refresh_timer.stop() # This will check if the current html has changed in its editor, # and re-parse it if so self.report_worker_launch_error() parse_worker.add_request(self.current_name) # Tell webkit to reload all html and associated resources current_url = self.name_to_qurl() self.refresh_starting.emit() if current_url != self.view.url(): # The container was changed self.view.setUrl(current_url) else: self.view.refresh() self.refreshed.emit() def clear(self): self.view.clear() self.current_name = None @property def is_visible(self): return actions['preview-dock'].isChecked() @property def live_css_is_visible(self): try: return actions['live-css-dock'].isChecked() except KeyError: return False def start_refresh_timer(self): if self.live_css_is_visible or (self.is_visible and actions['auto-reload-preview'].isChecked()): self.refresh_timer.start(tprefs['preview_refresh_time'] * 1000) def stop_refresh_timer(self): self.refresh_timer.stop() def auto_reload_toggled(self, checked): if self.live_css_is_visible and not actions['auto-reload-preview'].isChecked(): actions['auto-reload-preview'].setChecked(True) error_dialog(self, _('Cannot disable'), _( 'Auto reloading of the preview panel cannot be disabled while the' ' Live CSS panel is open.'), show=True) actions['auto-reload-preview'].setToolTip(_( 'Auto reload preview when text changes in editor') if not checked else _( 'Disable auto reload of preview')) def sync_toggled(self, checked): actions['sync-preview-to-editor'].setToolTip(_( 'Disable syncing of preview position to editor position') if checked else _( 'Enable syncing of preview position to editor position')) def visibility_changed(self, is_visible): if is_visible: self.refresh() def split_toggled(self, checked): actions['split-in-preview'].setToolTip(textwrap.fill(_( 'Abort file split') if checked else _( 'Split this file at a specified location.\n\nAfter clicking this button, click' ' inside the preview panel above at the location you want the file to be split.'))) if checked: self.split_start_requested.emit() else: self.view.page().split_mode(False) def do_start_split(self): self.view.page().split_mode(True) def stop_split(self): actions['split-in-preview'].setChecked(False) def load_finished(self, ok): if actions['split-in-preview'].isChecked(): if ok: self.do_start_split() else: self.stop_split() def apply_settings(self): s = self.view.page().settings() s.setFontSize(s.DefaultFontSize, tprefs['preview_base_font_size']) s.setFontSize(s.DefaultFixedFontSize, tprefs['preview_mono_font_size']) s.setFontSize(s.MinimumLogicalFontSize, tprefs['preview_minimum_font_size']) s.setFontSize(s.MinimumFontSize, tprefs['preview_minimum_font_size']) sf, ssf, mf = tprefs['preview_serif_family'], tprefs['preview_sans_family'], tprefs['preview_mono_family'] s.setFontFamily(s.StandardFont, {'serif':sf, 'sans':ssf, 'mono':mf, None:sf}[tprefs['preview_standard_font_family']]) s.setFontFamily(s.SerifFont, sf) s.setFontFamily(s.SansSerifFont, ssf) s.setFontFamily(s.FixedFont, mf)
gpl-3.0
BrotherPhil/django
tests/staticfiles_tests/test_storage.py
147
18183
from __future__ import unicode_literals import os import sys import unittest from django.conf import settings from django.contrib.staticfiles import finders, storage from django.contrib.staticfiles.management.commands import collectstatic from django.contrib.staticfiles.management.commands.collectstatic import \ Command as CollectstaticCommand from django.core.cache.backends.base import BaseCache from django.core.management import call_command from django.test import SimpleTestCase, override_settings from django.utils import six from django.utils.encoding import force_text from .cases import ( BaseCollectionTestCase, BaseStaticFilesTestCase, StaticFilesTestCase, ) from .settings import TEST_ROOT, TEST_SETTINGS, TESTFILES_PATH def hashed_file_path(test, path): fullpath = test.render_template(test.static_template_snippet(path)) return fullpath.replace(settings.STATIC_URL, '') class TestHashedFiles(object): hashed_file_path = hashed_file_path def tearDown(self): # Clear hashed files to avoid side effects among tests. storage.staticfiles_storage.hashed_files.clear() def test_template_tag_return(self): """ Test the CachedStaticFilesStorage backend. """ self.assertStaticRaises(ValueError, "does/not/exist.png", "/static/does/not/exist.png") self.assertStaticRenders("test/file.txt", "/static/test/file.dad0999e4f8f.txt") self.assertStaticRenders("test/file.txt", "/static/test/file.dad0999e4f8f.txt", asvar=True) self.assertStaticRenders("cached/styles.css", "/static/cached/styles.bb84a0240107.css") self.assertStaticRenders("path/", "/static/path/") self.assertStaticRenders("path/?query", "/static/path/?query") def test_template_tag_simple_content(self): relpath = self.hashed_file_path("cached/styles.css") self.assertEqual(relpath, "cached/styles.bb84a0240107.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) def test_path_ignored_completely(self): relpath = self.hashed_file_path("cached/css/ignored.css") self.assertEqual(relpath, "cached/css/ignored.6c77f2643390.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertIn(b'#foobar', content) self.assertIn(b'http:foobar', content) self.assertIn(b'https:foobar', content) self.assertIn(b'data:foobar', content) self.assertIn(b'//foobar', content) def test_path_with_querystring(self): relpath = self.hashed_file_path("cached/styles.css?spam=eggs") self.assertEqual(relpath, "cached/styles.bb84a0240107.css?spam=eggs") with storage.staticfiles_storage.open( "cached/styles.bb84a0240107.css") as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) def test_path_with_fragment(self): relpath = self.hashed_file_path("cached/styles.css#eggs") self.assertEqual(relpath, "cached/styles.bb84a0240107.css#eggs") with storage.staticfiles_storage.open( "cached/styles.bb84a0240107.css") as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) def test_path_with_querystring_and_fragment(self): relpath = self.hashed_file_path("cached/css/fragments.css") self.assertEqual(relpath, "cached/css/fragments.75433540b096.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertIn(b'fonts/font.a4b0478549d0.eot?#iefix', content) self.assertIn(b'fonts/font.b8d603e42714.svg#webfontIyfZbseF', content) self.assertIn(b'data:font/woff;charset=utf-8;base64,d09GRgABAAAAADJoAA0AAAAAR2QAAQAAAAAAAAAAAAA', content) self.assertIn(b'#default#VML', content) def test_template_tag_absolute(self): relpath = self.hashed_file_path("cached/absolute.css") self.assertEqual(relpath, "cached/absolute.ae9ef2716fe3.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"/static/cached/styles.css", content) self.assertIn(b"/static/cached/styles.bb84a0240107.css", content) self.assertIn(b'/static/cached/img/relative.acae32e4532b.png', content) def test_template_tag_denorm(self): relpath = self.hashed_file_path("cached/denorm.css") self.assertEqual(relpath, "cached/denorm.c5bd139ad821.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"..//cached///styles.css", content) self.assertIn(b"../cached/styles.bb84a0240107.css", content) self.assertNotIn(b"url(img/relative.png )", content) self.assertIn(b'url("img/relative.acae32e4532b.png', content) def test_template_tag_relative(self): relpath = self.hashed_file_path("cached/relative.css") self.assertEqual(relpath, "cached/relative.b0375bd89156.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"../cached/styles.css", content) self.assertNotIn(b'@import "styles.css"', content) self.assertNotIn(b'url(img/relative.png)', content) self.assertIn(b'url("img/relative.acae32e4532b.png")', content) self.assertIn(b"../cached/styles.bb84a0240107.css", content) def test_import_replacement(self): "See #18050" relpath = self.hashed_file_path("cached/import.css") self.assertEqual(relpath, "cached/import.2b1d40b0bbd4.css") with storage.staticfiles_storage.open(relpath) as relfile: self.assertIn(b"""import url("styles.bb84a0240107.css")""", relfile.read()) def test_template_tag_deep_relative(self): relpath = self.hashed_file_path("cached/css/window.css") self.assertEqual(relpath, "cached/css/window.3906afbb5a17.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b'url(img/window.png)', content) self.assertIn(b'url("img/window.acae32e4532b.png")', content) def test_template_tag_url(self): relpath = self.hashed_file_path("cached/url.css") self.assertEqual(relpath, "cached/url.902310b73412.css") with storage.staticfiles_storage.open(relpath) as relfile: self.assertIn(b"https://", relfile.read()) def test_post_processing(self): """ Test that post_processing behaves correctly. Files that are alterable should always be post-processed; files that aren't should be skipped. collectstatic has already been called once in setUp() for this testcase, therefore we check by verifying behavior on a second run. """ collectstatic_args = { 'interactive': False, 'verbosity': 0, 'link': False, 'clear': False, 'dry_run': False, 'post_process': True, 'use_default_ignore_patterns': True, 'ignore_patterns': ['*.ignoreme'], } collectstatic_cmd = CollectstaticCommand() collectstatic_cmd.set_options(**collectstatic_args) stats = collectstatic_cmd.collect() self.assertIn(os.path.join('cached', 'css', 'window.css'), stats['post_processed']) self.assertIn(os.path.join('cached', 'css', 'img', 'window.png'), stats['unmodified']) self.assertIn(os.path.join('test', 'nonascii.css'), stats['post_processed']) def test_css_import_case_insensitive(self): relpath = self.hashed_file_path("cached/styles_insensitive.css") self.assertEqual(relpath, "cached/styles_insensitive.c609562b6d3c.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) @override_settings( STATICFILES_DIRS=[os.path.join(TEST_ROOT, 'project', 'faulty')], STATICFILES_FINDERS=['django.contrib.staticfiles.finders.FileSystemFinder'], ) def test_post_processing_failure(self): """ Test that post_processing indicates the origin of the error when it fails. Regression test for #18986. """ finders.get_finder.cache_clear() err = six.StringIO() with self.assertRaises(Exception): call_command('collectstatic', interactive=False, verbosity=0, stderr=err) self.assertEqual("Post-processing 'faulty.css' failed!\n\n", err.getvalue()) # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict( TEST_SETTINGS, STATICFILES_STORAGE='django.contrib.staticfiles.storage.CachedStaticFilesStorage', DEBUG=False, )) class TestCollectionCachedStorage(TestHashedFiles, BaseCollectionTestCase, BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ def test_cache_invalidation(self): name = "cached/styles.css" hashed_name = "cached/styles.bb84a0240107.css" # check if the cache is filled correctly as expected cache_key = storage.staticfiles_storage.hash_key(name) cached_name = storage.staticfiles_storage.hashed_files.get(cache_key) self.assertEqual(self.hashed_file_path(name), cached_name) # clearing the cache to make sure we re-set it correctly in the url method storage.staticfiles_storage.hashed_files.clear() cached_name = storage.staticfiles_storage.hashed_files.get(cache_key) self.assertEqual(cached_name, None) self.assertEqual(self.hashed_file_path(name), hashed_name) cached_name = storage.staticfiles_storage.hashed_files.get(cache_key) self.assertEqual(cached_name, hashed_name) def test_cache_key_memcache_validation(self): """ Handle cache key creation correctly, see #17861. """ name = ( "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff" "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff" "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff" "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff" "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff" "/some crazy/\x16\xb4" ) cache_key = storage.staticfiles_storage.hash_key(name) cache_validator = BaseCache({}) cache_validator.validate_key(cache_key) self.assertEqual(cache_key, 'staticfiles:821ea71ef36f95b3922a77f7364670e7') # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict( TEST_SETTINGS, STATICFILES_STORAGE='django.contrib.staticfiles.storage.ManifestStaticFilesStorage', DEBUG=False, )) class TestCollectionManifestStorage(TestHashedFiles, BaseCollectionTestCase, BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ def setUp(self): super(TestCollectionManifestStorage, self).setUp() self._clear_filename = os.path.join(TESTFILES_PATH, 'cleared.txt') with open(self._clear_filename, 'w') as f: f.write('to be deleted in one test') def tearDown(self): super(TestCollectionManifestStorage, self).tearDown() if os.path.exists(self._clear_filename): os.unlink(self._clear_filename) def test_manifest_exists(self): filename = storage.staticfiles_storage.manifest_name path = storage.staticfiles_storage.path(filename) self.assertTrue(os.path.exists(path)) def test_loaded_cache(self): self.assertNotEqual(storage.staticfiles_storage.hashed_files, {}) manifest_content = storage.staticfiles_storage.read_manifest() self.assertIn( '"version": "%s"' % storage.staticfiles_storage.manifest_version, force_text(manifest_content) ) def test_parse_cache(self): hashed_files = storage.staticfiles_storage.hashed_files manifest = storage.staticfiles_storage.load_manifest() self.assertEqual(hashed_files, manifest) def test_clear_empties_manifest(self): cleared_file_name = os.path.join('test', 'cleared.txt') # collect the additional file self.run_collectstatic() hashed_files = storage.staticfiles_storage.hashed_files self.assertIn(cleared_file_name, hashed_files) manifest_content = storage.staticfiles_storage.load_manifest() self.assertIn(cleared_file_name, manifest_content) original_path = storage.staticfiles_storage.path(cleared_file_name) self.assertTrue(os.path.exists(original_path)) # delete the original file form the app, collect with clear os.unlink(self._clear_filename) self.run_collectstatic(clear=True) self.assertFileNotFound(original_path) hashed_files = storage.staticfiles_storage.hashed_files self.assertNotIn(cleared_file_name, hashed_files) manifest_content = storage.staticfiles_storage.load_manifest() self.assertNotIn(cleared_file_name, manifest_content) # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict( TEST_SETTINGS, STATICFILES_STORAGE='staticfiles_tests.storage.SimpleCachedStaticFilesStorage', DEBUG=False, )) class TestCollectionSimpleCachedStorage(BaseCollectionTestCase, BaseStaticFilesTestCase, SimpleTestCase): """ Tests for the Cache busting storage """ hashed_file_path = hashed_file_path def test_template_tag_return(self): """ Test the CachedStaticFilesStorage backend. """ self.assertStaticRaises(ValueError, "does/not/exist.png", "/static/does/not/exist.png") self.assertStaticRenders("test/file.txt", "/static/test/file.deploy12345.txt") self.assertStaticRenders("cached/styles.css", "/static/cached/styles.deploy12345.css") self.assertStaticRenders("path/", "/static/path/") self.assertStaticRenders("path/?query", "/static/path/?query") def test_template_tag_simple_content(self): relpath = self.hashed_file_path("cached/styles.css") self.assertEqual(relpath, "cached/styles.deploy12345.css") with storage.staticfiles_storage.open(relpath) as relfile: content = relfile.read() self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.deploy12345.css", content) class CustomStaticFilesStorage(storage.StaticFilesStorage): """ Used in TestStaticFilePermissions """ def __init__(self, *args, **kwargs): kwargs['file_permissions_mode'] = 0o640 kwargs['directory_permissions_mode'] = 0o740 super(CustomStaticFilesStorage, self).__init__(*args, **kwargs) @unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports chmod.") class TestStaticFilePermissions(BaseCollectionTestCase, StaticFilesTestCase): command_params = { 'interactive': False, 'post_process': True, 'verbosity': 0, 'ignore_patterns': ['*.ignoreme'], 'use_default_ignore_patterns': True, 'clear': False, 'link': False, 'dry_run': False, } def setUp(self): self.umask = 0o027 self.old_umask = os.umask(self.umask) super(TestStaticFilePermissions, self).setUp() def tearDown(self): os.umask(self.old_umask) super(TestStaticFilePermissions, self).tearDown() # Don't run collectstatic command in this test class. def run_collectstatic(self, **kwargs): pass @override_settings( FILE_UPLOAD_PERMISSIONS=0o655, FILE_UPLOAD_DIRECTORY_PERMISSIONS=0o765, ) def test_collect_static_files_permissions(self): collectstatic.Command().execute(**self.command_params) test_file = os.path.join(settings.STATIC_ROOT, "test.txt") test_dir = os.path.join(settings.STATIC_ROOT, "subdir") file_mode = os.stat(test_file)[0] & 0o777 dir_mode = os.stat(test_dir)[0] & 0o777 self.assertEqual(file_mode, 0o655) self.assertEqual(dir_mode, 0o765) @override_settings( FILE_UPLOAD_PERMISSIONS=None, FILE_UPLOAD_DIRECTORY_PERMISSIONS=None, ) def test_collect_static_files_default_permissions(self): collectstatic.Command().execute(**self.command_params) test_file = os.path.join(settings.STATIC_ROOT, "test.txt") test_dir = os.path.join(settings.STATIC_ROOT, "subdir") file_mode = os.stat(test_file)[0] & 0o777 dir_mode = os.stat(test_dir)[0] & 0o777 self.assertEqual(file_mode, 0o666 & ~self.umask) self.assertEqual(dir_mode, 0o777 & ~self.umask) @override_settings( FILE_UPLOAD_PERMISSIONS=0o655, FILE_UPLOAD_DIRECTORY_PERMISSIONS=0o765, STATICFILES_STORAGE='staticfiles_tests.test_storage.CustomStaticFilesStorage', ) def test_collect_static_files_subclass_of_static_storage(self): collectstatic.Command().execute(**self.command_params) test_file = os.path.join(settings.STATIC_ROOT, "test.txt") test_dir = os.path.join(settings.STATIC_ROOT, "subdir") file_mode = os.stat(test_file)[0] & 0o777 dir_mode = os.stat(test_dir)[0] & 0o777 self.assertEqual(file_mode, 0o640) self.assertEqual(dir_mode, 0o740)
bsd-3-clause
sinnwerkstatt/landmatrix
apps/landmatrix/models/activity_changeset.py
1
1373
from django.conf import settings from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class ReviewDecision(models.Model): name = models.CharField(_("Name"), max_length=255) description = models.TextField(_("Description"), blank=True, null=True) class ActivityChangeset(models.Model): fk_activity = models.ForeignKey( "landmatrix.HistoricalActivity", verbose_name=_("Activity"), blank=True, null=True, related_name="changesets", on_delete=models.CASCADE, ) fk_country = models.ForeignKey( "landmatrix.Country", verbose_name=_("Country"), blank=True, null=True, on_delete=models.SET_NULL, ) fk_user = models.ForeignKey( settings.AUTH_USER_MODEL, verbose_name=_("User"), blank=True, null=True, on_delete=models.SET_NULL, ) timestamp = models.DateTimeField(_("Timestamp"), default=timezone.now) fk_review_decision = models.ForeignKey( ReviewDecision, verbose_name=_("Review decision"), blank=True, null=True, on_delete=models.SET_NULL, ) comment = models.TextField(_("Comment"), blank=True, null=True) class Meta: ordering = ("-timestamp",) get_latest_by = "timestamp"
agpl-3.0
TridevGuha/pywikibot-core
pywikibot/daemonize.py
6
1961
# -*- coding: utf-8 -*- """Module to daemonize the current process on Unix.""" # # (C) Pywikibot team, 2007-2015 # # Distributed under the terms of the MIT license. # __version__ = '$Id$' # import os import sys import codecs is_daemon = False def daemonize(close_fd=True, chdir=True, write_pid=False, redirect_std=None): """ Daemonize the current process. Only works on POSIX compatible operating systems. The process will fork to the background and return control to terminal. @param close_fd: Close the standard streams and replace them by /dev/null @type close_fd: bool @param chdir: Change the current working directory to / @type chdir: bool @param write_pid: Write the pid to sys.argv[0] + '.pid' @type write_pid: bool @param redirect_std: Filename to redirect stdout and stdin to @type redirect_std: str """ # Fork away if not os.fork(): # Become session leader os.setsid() # Fork again to prevent the process from acquiring a # controlling terminal pid = os.fork() if not pid: global is_daemon is_daemon = True if close_fd: os.close(0) os.close(1) os.close(2) os.open('/dev/null', os.O_RDWR) if redirect_std: os.open(redirect_std, os.O_WRONLY | os.O_APPEND | os.O_CREAT) else: os.dup2(0, 1) os.dup2(1, 2) if chdir: os.chdir('/') return else: # Write out the pid path = os.path.basename(sys.argv[0]) + '.pid' with codecs.open(path, 'w', 'utf-8') as f: f.write(str(pid)) os._exit(0) else: # Exit to return control to the terminal # os._exit to prevent the cleanup to run os._exit(0)
mit
JeffRoy/mi-dataset
mi/dataset/parser/pco2a_a_dcl.py
3
9450
#!/usr/bin/env python """ @package mi.dataset.parser.pco2a_a_dcl @file marine-integrations/mi/dataset/parser/pco2a_a_dcl.py @author Sung Ahn @brief Parser for the pco2a_a_dcl dataset driver This file contains code for the pco2a_a_dcl parser and code to produce data particles. For instrument telemetered data, there is one driver which produces two(air/water) types of data particle. For instrument recover data, there is one driver which produces two(air/water) types of data particle. The input files and the content of the data particles are the same for both instrument telemetered and instrument recovered. Only the names of the output particle streams are different. The input file is ASCII and contains 2 types of records. Records are separated by a newline. All records start with a timestamp. Metadata records: timestamp [text] more text newline. Sensor Data records: timestamp sensor_data newline. Only sensor data records produce particles if properly formed. Mal-formed sensor data records and all metadata records produce no particles. Release notes: Initial Release """ __author__ = 'Sung Ahn' __license__ = 'Apache 2.0' import re from mi.core.log import get_logger log = get_logger() from mi.core.common import BaseEnum from mi.dataset.parser.dcl_file_common import DclInstrumentDataParticle, \ DclFileCommonParser, SENSOR_GROUP_TIMESTAMP, TIMESTAMP,\ START_METADATA, END_METADATA, START_GROUP, END_GROUP from mi.dataset.parser.common_regexes import END_OF_LINE_REGEX, SPACE_REGEX, \ FLOAT_REGEX, UNSIGNED_INT_REGEX, TIME_HR_MIN_SEC_REGEX, ANY_CHARS_REGEX # Basic patterns UINT = '('+UNSIGNED_INT_REGEX+')' # unsigned integer as a group FLOAT = '('+FLOAT_REGEX+')' # floating point as a captured group W_CHAR = r'(W)' A_CHAR = r'(A)' COMMA = ',' SHARP = '#' CHAR_M = ' *M' EXTRA_CR = '\s*?' # account for random <CR> found in some live files. # Timestamp at the start of each record: YYYY/MM/DD HH:MM:SS.mmm # Metadata fields: [text] more text # Sensor data has tab-delimited fields (date, time, integers) # All records end with one of the newlines. SENSOR_DATE = r'(\d{4}/\d{2}/\d{2})' # Sensor Date: MM/DD/YY # Metadata record: # Timestamp [Text]MoreText newline METADATA_PATTERN = TIMESTAMP + SPACE_REGEX # dcl controller timestamp METADATA_PATTERN += START_METADATA # Metadata record starts with '[' METADATA_PATTERN += ANY_CHARS_REGEX # followed by text METADATA_PATTERN += END_METADATA # followed by ']' METADATA_PATTERN += ANY_CHARS_REGEX # followed by more text METADATA_PATTERN += END_OF_LINE_REGEX # metadata record ends with LF METADATA_MATCHER = re.compile(METADATA_PATTERN) # Sensor data record: # Timestamp Date<space>Time<space>SensorData # where SensorData are comma-separated unsigned integer numbers SENSOR_DATA_PATTERN = TIMESTAMP + SPACE_REGEX # dcl controller timestamp SENSOR_DATA_PATTERN += SHARP + START_GROUP + SENSOR_DATE + SPACE_REGEX # sensor date SENSOR_DATA_PATTERN += TIME_HR_MIN_SEC_REGEX + END_GROUP + COMMA + CHAR_M + COMMA # sensor time SENSOR_DATA_PATTERN += UINT + COMMA # measurement wavelength beta SENSOR_DATA_PATTERN += UINT + COMMA # raw signal beta SENSOR_DATA_PATTERN += FLOAT + COMMA # measurement wavelength chl SENSOR_DATA_PATTERN += FLOAT + COMMA # raw signal chl SENSOR_DATA_PATTERN += FLOAT + COMMA # measurement wavelength cdom SENSOR_DATA_PATTERN += FLOAT + COMMA # raw signal cdom SENSOR_DATA_PATTERN += UINT + COMMA # raw signal beta SENSOR_DATA_PATTERN += FLOAT + COMMA # raw signal cdom SENSOR_DATA_PATTERN += FLOAT + COMMA # raw signal cdom SENSOR_DATA_PATTERN_AIR = SENSOR_DATA_PATTERN + A_CHAR + EXTRA_CR + END_OF_LINE_REGEX SENSOR_DATA_MATCHER_AIR = re.compile(SENSOR_DATA_PATTERN_AIR) SENSOR_DATA_PATTERN_WATER = SENSOR_DATA_PATTERN + W_CHAR + EXTRA_CR + END_OF_LINE_REGEX SENSOR_DATA_MATCHER_WATER = re.compile(SENSOR_DATA_PATTERN_WATER) # Manual test is below # >>me = re.match(r"((\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2})\.(\d{3})) #((\d{4}/\d{2}/\d{2}) # (\d{2}):(\d{2}):(\d{2})), *M,(\d*),(\d*),(\d+.\d+),(\d+.\d+),(\d+.\d+),(\d+.\d+),(\d*), # (\d+.\d+),(\d+.\d+),(\D)", # "2014/08/10 00:20:24.274 #3765/07/27 01:00:11, M,43032,40423,397.04,40.1,21.221, # 28.480,1026,39.9,40.4,W") # >>> me.group() # '2014/08/10 00:20:24.274 #3765/07/27 01:00:11, M,43032,40423,397.04,40.1,21.221,28.480,1026,39.9,40.4,W' # SENSOR_DATA_MATCHER produces the following groups. # The following are indices into groups() produced by SENSOR_DATA_MATCHER. # i.e, match.groups()[INDEX] SENSOR_GROUP_SENSOR_DATE_TIME = 8 SENSOR_GROUP_SENSOR_DATE = 9 SENSOR_GROUP_SENSOR_HOUR = 10 SENSOR_GROUP_SENSOR_MINUTE = 11 SENSOR_GROUP_SENSOR_SECOND = 12 SENSOR_GROUP_ZERO_A2D = 13 SENSOR_GROUP_CURRENT_A2D = 14 SENSOR_GROUP_CO2 = 15 SENSOR_GROUP_AVG_IRGA_TEMP = 16 SENSOR_GROUP_HUMIDITY = 17 SENSOR_GROUP_HUMIDITY_TEMP = 18 SENSOR_GROUP_STREAM_PRESSURE = 19 SENSOR_GROUP_DETECTOR_TEMP = 20 SENSOR_GROUP_SOURCE_TEMP = 21 SENSOR_GROUP_SAMPLE_TYPE = 22 INSTRUMENT_PARTICLE_AIR_MAP = [ ('dcl_controller_timestamp', SENSOR_GROUP_TIMESTAMP, str), ('date_time_string', SENSOR_GROUP_SENSOR_DATE_TIME, str), ('zero_a2d', SENSOR_GROUP_ZERO_A2D, int), ('current_a2d', SENSOR_GROUP_CURRENT_A2D, int), ('measured_air_co2', SENSOR_GROUP_CO2, float), ('avg_irga_temperature', SENSOR_GROUP_AVG_IRGA_TEMP, float), ('humidity', SENSOR_GROUP_HUMIDITY, float), ('humidity_temperature', SENSOR_GROUP_HUMIDITY_TEMP, float), ('gas_stream_pressure', SENSOR_GROUP_STREAM_PRESSURE, int), ('irga_detector_temperature', SENSOR_GROUP_DETECTOR_TEMP, float), ('irga_source_temperature', SENSOR_GROUP_SOURCE_TEMP, float) ] INSTRUMENT_PARTICLE_WATER_MAP = [ ('dcl_controller_timestamp', SENSOR_GROUP_TIMESTAMP, str), ('date_time_string', SENSOR_GROUP_SENSOR_DATE_TIME, str), ('zero_a2d', SENSOR_GROUP_ZERO_A2D, int), ('current_a2d', SENSOR_GROUP_CURRENT_A2D, int), ('measured_water_co2', SENSOR_GROUP_CO2, float), ('avg_irga_temperature', SENSOR_GROUP_AVG_IRGA_TEMP, float), ('humidity', SENSOR_GROUP_HUMIDITY, float), ('humidity_temperature', SENSOR_GROUP_HUMIDITY_TEMP, float), ('gas_stream_pressure', SENSOR_GROUP_STREAM_PRESSURE, int), ('irga_detector_temperature', SENSOR_GROUP_DETECTOR_TEMP, float), ('irga_source_temperature', SENSOR_GROUP_SOURCE_TEMP, float) ] class DataParticleType(BaseEnum): PCO2A_INSTRUMENT_AIR_PARTICLE = 'pco2a_a_dcl_instrument_air' PCO2A_INSTRUMENT_WATER_PARTICLE = 'pco2a_a_dcl_instrument_water' PCO2A_INSTRUMENT_AIR_RECOVERED_PARTICLE = 'pco2a_a_dcl_instrument_air_recovered' PCO2A_INSTRUMENT_WATER_RECOVERED_PARTICLE = 'pco2a_a_dcl_instrument_water_recovered' class Pco2aADclParticleClassKey(BaseEnum): """ An enum for the keys application to the pco2a_a_dcl particle classes """ AIR_PARTICLE_CLASS = 'air_particle_class' WATER_PARTICLE_CLASS = 'water_particle_class' class Pco2aADclInstrumentDataParticleAir(DclInstrumentDataParticle): """ Class for generating the Pco2a_a_dcl instrument particles. """ data_matcher = SENSOR_DATA_MATCHER_AIR def __init__(self, raw_data, *args, **kwargs): super(Pco2aADclInstrumentDataParticleAir, self).__init__( raw_data, INSTRUMENT_PARTICLE_AIR_MAP, *args, **kwargs) class Pco2aADclInstrumentDataParticleWater(DclInstrumentDataParticle): """ Class for generating the Pco2a_a_dcl instrument particles. """ data_matcher = SENSOR_DATA_MATCHER_WATER def __init__(self, raw_data, *args, **kwargs): super(Pco2aADclInstrumentDataParticleWater, self).__init__( raw_data, INSTRUMENT_PARTICLE_WATER_MAP, *args, **kwargs) class Pco2aADclTelemeteredInstrumentDataParticleAir(Pco2aADclInstrumentDataParticleAir): """ Class for generating Offset Data Particles from Telemetered air data. """ _data_particle_type = DataParticleType.PCO2A_INSTRUMENT_AIR_PARTICLE class Pco2aADclTelemeteredInstrumentDataParticleWater(Pco2aADclInstrumentDataParticleWater): """ Class for generating Offset Data Particles from Telemetered water data. """ _data_particle_type = DataParticleType.PCO2A_INSTRUMENT_WATER_PARTICLE class Pco2aADclRecoveredInstrumentDataParticleAir(Pco2aADclInstrumentDataParticleAir): """ Class for generating Offset Data Particles from Recovered air data. """ _data_particle_type = DataParticleType.PCO2A_INSTRUMENT_AIR_RECOVERED_PARTICLE class Pco2aADclRecoveredInstrumentDataParticleWater(Pco2aADclInstrumentDataParticleWater): """ Class for generating Offset Data Particles from Recovered water data. """ _data_particle_type = DataParticleType.PCO2A_INSTRUMENT_WATER_RECOVERED_PARTICLE class Pco2aADclParser(DclFileCommonParser): """ This is the entry point for the parser. """ def __init__(self, config, stream_handle, exception_callback): super(Pco2aADclParser, self).__init__(config, stream_handle, exception_callback, None, METADATA_MATCHER)
bsd-2-clause
jrha/aquilon
tests/broker/test_constraints_location.py
2
1424
#!/usr/bin/env python2.6 # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Module for testing constraints in commands involving locations.""" import unittest if __name__ == "__main__": import utils utils.import_depends() from brokertest import TestBrokerCommand class TestLocationConstraints(TestBrokerCommand): def testdelut3(self): command = ["del", "rack", "--rack", "ut3"] out = self.badrequesttest(command) self.matchoutput(out, "Could not delete rack ut3, hardware objects " "were found using this location.", command) if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromTestCase( TestLocationConstraints) unittest.TextTestRunner(verbosity=2).run(suite)
apache-2.0
zaccoz/odoo
addons/account/res_currency.py
340
2267
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010 OpenERP s.a. (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import osv """Inherit res.currency to handle accounting date values when converting currencies""" class res_currency_account(osv.osv): _inherit = "res.currency" def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None): if context is None: context = {} rate = super(res_currency_account, self)._get_conversion_rate(cr, uid, from_currency, to_currency, context=context) #process the case where the account doesn't work with an outgoing currency rate method 'at date' but 'average' account = context.get('res.currency.compute.account') account_invert = context.get('res.currency.compute.account_invert') if account and account.currency_mode == 'average' and account.currency_id: query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+query, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) return rate
agpl-3.0
dfdx2/django
tests/aggregation/models.py
104
1242
from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField('self', blank=True) def __str__(self): return self.name class Publisher(models.Model): name = models.CharField(max_length=255) num_awards = models.IntegerField() duration = models.DurationField(blank=True, null=True) def __str__(self): return self.name class Book(models.Model): isbn = models.CharField(max_length=9) name = models.CharField(max_length=255) pages = models.IntegerField() rating = models.FloatField() price = models.DecimalField(decimal_places=2, max_digits=6) authors = models.ManyToManyField(Author) contact = models.ForeignKey(Author, models.CASCADE, related_name='book_contact_set') publisher = models.ForeignKey(Publisher, models.CASCADE) pubdate = models.DateField() def __str__(self): return self.name class Store(models.Model): name = models.CharField(max_length=255) books = models.ManyToManyField(Book) original_opening = models.DateTimeField() friday_night_closing = models.TimeField() def __str__(self): return self.name
bsd-3-clause
OGGM/oggm
oggm/cli/benchmark.py
2
8716
"""Command line arguments to the oggm_benchmark command Type `$ oggm_benchmark -h` for help """ # External modules import os import sys import argparse import time import logging import pandas as pd import geopandas as gpd # Locals import oggm.cfg as cfg from oggm import utils, workflow, tasks from oggm.exceptions import InvalidParamsError def _add_time_to_df(df, index, t): df.loc[index, 't'] = t m, s = divmod(t, 60) h, m = divmod(m, 60) df.loc[index, 'H'] = h df.loc[index, 'M'] = m df.loc[index, 'S'] = s def run_benchmark(rgi_version=None, rgi_reg=None, border=None, output_folder='', working_dir='', is_test=False, test_rgidf=None, test_intersects_file=None, test_topofile=None): """Does the actual job. Parameters ---------- rgi_version : str the RGI version to use (defaults to cfg.PARAMS) rgi_reg : str the RGI region to process border : int the number of pixels at the maps border output_folder : str path to the output folder (where to put the preprocessed tar files) working_dir : str path to the OGGM working directory is_test : bool to test on a couple of glaciers only! test_rgidf : shapefile for testing purposes only test_intersects_file : shapefile for testing purposes only test_topofile : str for testing purposes only """ # Module logger log = logging.getLogger(__name__) # Params params = {} # Local paths utils.mkdir(working_dir) params['working_dir'] = working_dir # Initialize OGGM and set up the run parameters cfg.initialize(logging_level='WORKFLOW', params=params, future=True) # Use multiprocessing? cfg.PARAMS['use_multiprocessing'] = True # How many grid points around the glacier? # Make it large if you expect your glaciers to grow large cfg.PARAMS['border'] = border # Set to True for operational runs cfg.PARAMS['continue_on_error'] = True # For statistics odf = pd.DataFrame() if rgi_version is None: rgi_version = cfg.PARAMS['rgi_version'] base_dir = os.path.join(output_folder) # Add a package version file utils.mkdir(base_dir) opath = os.path.join(base_dir, 'package_versions.txt') with open(opath, 'w') as vfile: vfile.write(utils.show_versions(logger=log)) # Read RGI start = time.time() if test_rgidf is None: # Get the RGI file rgidf = gpd.read_file(utils.get_rgi_region_file(rgi_reg, version=rgi_version)) # We use intersects rgif = utils.get_rgi_intersects_region_file(rgi_reg, version=rgi_version) cfg.set_intersects_db(rgif) else: rgidf = test_rgidf cfg.set_intersects_db(test_intersects_file) if is_test: # Just for fun rgidf = rgidf.sample(2) _add_time_to_df(odf, 'Read RGI', time.time()-start) # Sort for more efficient parallel computing rgidf = rgidf.sort_values('Area', ascending=False) log.workflow('Starting prepro run for RGI reg: {} ' 'and border: {}'.format(rgi_reg, border)) log.workflow('Number of glaciers: {}'.format(len(rgidf))) # Input if test_topofile: cfg.PATHS['dem_file'] = test_topofile utils.apply_test_ref_tstars() # Initialize working directories start = time.time() gdirs = workflow.init_glacier_directories(rgidf, reset=True, force=True) _add_time_to_df(odf, 'init_glacier_directories', time.time()-start) # Tasks task_list = [ tasks.define_glacier_region, tasks.process_cru_data, tasks.glacier_masks, tasks.compute_centerlines, tasks.initialize_flowlines, tasks.compute_downstream_line, tasks.compute_downstream_bedshape, tasks.catchment_area, tasks.catchment_intersections, tasks.catchment_width_geom, tasks.catchment_width_correction, tasks.local_t_star, tasks.mu_star_calibration, tasks.prepare_for_inversion, tasks.mass_conservation_inversion, tasks.filter_inversion_output, tasks.init_present_time_glacier, ] for task in task_list: start = time.time() workflow.execute_entity_task(task, gdirs) _add_time_to_df(odf, task.__name__, time.time()-start) # Runs start = time.time() workflow.execute_entity_task(tasks.run_random_climate, gdirs, nyears=250, bias=0, seed=0, output_filesuffix='_tstar') _add_time_to_df(odf, 'run_random_climate_tstar_250', time.time()-start) start = time.time() workflow.execute_entity_task(tasks.run_random_climate, gdirs, nyears=250, y0=1995, seed=0, output_filesuffix='_commit') _add_time_to_df(odf, 'run_random_climate_commit_250', time.time()-start) # Compile results start = time.time() utils.compile_glacier_statistics(gdirs) _add_time_to_df(odf, 'compile_glacier_statistics', time.time()-start) start = time.time() utils.compile_climate_statistics(gdirs, add_climate_period=[1920, 1960, 2000]) _add_time_to_df(odf, 'compile_climate_statistics', time.time()-start) start = time.time() utils.compile_run_output(gdirs, input_filesuffix='_tstar') _add_time_to_df(odf, 'compile_run_output_tstar', time.time()-start) start = time.time() utils.compile_run_output(gdirs, input_filesuffix='_commit') _add_time_to_df(odf, 'compile_run_output_commit', time.time()-start) # Log opath = os.path.join(base_dir, 'benchmarks_b{:03d}.csv'.format(border)) odf.index.name = 'Task' odf.to_csv(opath) log.workflow('OGGM benchmarks is done!') def parse_args(args): """Check input arguments and env variables""" # CLI args description = ('Run an OGGM benchmark on a selected RGI Region. ' 'This writes a benchmark_{border}.txt file where ' 'the results are summarized') parser = argparse.ArgumentParser(description=description) parser.add_argument('--map-border', type=int, help='the size of the map border. Is required if ' '$OGGM_MAP_BORDER is not set.') parser.add_argument('--rgi-reg', type=str, help='the rgi region to process. Is required if ' '$OGGM_RGI_REG is not set.') parser.add_argument('--rgi-version', type=str, help='the RGI version to use. Defaults to the OGGM ' 'default.') parser.add_argument('--working-dir', type=str, help='path to the directory where to write the ' 'output. Defaults to current directory or ' '$OGGM_WORKDIR.') parser.add_argument('--output', type=str, help='path to the directory where to write the ' 'output. Defaults to current directory or' '$OGGM_OUTDIR.') parser.add_argument('--test', nargs='?', const=True, default=False, help='if you want to do a test on a couple of ' 'glaciers first.') args = parser.parse_args(args) # Check input rgi_reg = args.rgi_reg if not rgi_reg: rgi_reg = os.environ.get('OGGM_RGI_REG', None) if rgi_reg is None: raise InvalidParamsError('--rgi-reg is required!') rgi_reg = '{:02}'.format(int(rgi_reg)) rgi_version = args.rgi_version border = args.map_border if not border: border = os.environ.get('OGGM_MAP_BORDER', None) if border is None: raise InvalidParamsError('--map-border is required!') working_dir = args.working_dir if not working_dir: working_dir = os.environ.get('OGGM_WORKDIR', '') output_folder = args.output if not output_folder: output_folder = os.environ.get('OGGM_OUTDIR', '') border = int(border) output_folder = os.path.abspath(output_folder) working_dir = os.path.abspath(working_dir) # All good return dict(rgi_version=rgi_version, rgi_reg=rgi_reg, border=border, output_folder=output_folder, working_dir=working_dir, is_test=args.test) def main(): """Script entry point""" run_benchmark(**parse_args(sys.argv[1:]))
bsd-3-clause
arguman/arguman.org
web/premises/admin.py
2
1481
from django.contrib import admin from django.db import models from django.db.models import Count from django.forms import Textarea from premises.models import Contention, Premise, Report class ReportAdmin(admin.ModelAdmin): list_display = ('reporter', 'premise', 'contention') class PremiseInline(admin.TabularInline): model = Premise extra = 0 fields = ('user', 'premise_type', 'text', 'sources', 'is_approved') fk_name = "argument" raw_id_fields = ('user', ) formfield_overrides = { models.TextField: { 'widget': Textarea( attrs={'rows': 2, 'cols': 40} )}, } class ContentionAdmin(admin.ModelAdmin): list_display = ('title', 'language', 'is_featured', 'is_published', 'premise_count') list_editable = ('language', 'is_featured',) search_fields = ('title', 'nouns__text') list_per_page = 100 list_filter = ('language', 'is_featured',) filter_horizontal = ('nouns', 'related_nouns') inlines = [PremiseInline] def premise_count(self, obj): return obj.premises.count() class PremiseAdmin(admin.ModelAdmin): list_display = ('text', 'argument', 'is_deleted') list_filter = ('is_deleted',) def get_queryset(self, request): return Premise.objects.all_with_deleted() admin.site.register(Report, ReportAdmin) admin.site.register(Contention, ContentionAdmin) admin.site.register(Premise, PremiseAdmin)
agpl-3.0
corona10/Simple-MiniC-Compiler
lib/llvm-3.5.0.src/examples/Kaleidoscope/MCJIT/complete/genk-timing.py
108
11103
#!/usr/bin/env python import sys import random class TimingScriptGenerator: """Used to generate a bash script which will invoke the toy and time it""" def __init__(self, scriptname, outputname): self.timeFile = outputname self.shfile = open(scriptname, 'w') self.shfile.write("echo \"\" > %s\n" % self.timeFile) def writeTimingCall(self, filename, numFuncs, funcsCalled, totalCalls): """Echo some comments and invoke both versions of toy""" rootname = filename if '.' in filename: rootname = filename[:filename.rfind('.')] self.shfile.write("echo \"%s: Calls %d of %d functions, %d total\" >> %s\n" % (filename, funcsCalled, numFuncs, totalCalls, self.timeFile)) self.shfile.write("echo \"\" >> %s\n" % self.timeFile) self.shfile.write("echo \"With MCJIT (original)\" >> %s\n" % self.timeFile) self.shfile.write("/usr/bin/time -f \"Command %C\\n\\tuser time: %U s\\n\\tsytem time: %S s\\n\\tmax set: %M kb\"") self.shfile.write(" -o %s -a " % self.timeFile) self.shfile.write("./toy -suppress-prompts -use-mcjit=true -enable-lazy-compilation=false < %s > %s-mcjit.out 2> %s-mcjit.err\n" % (filename, rootname, rootname)) self.shfile.write("echo \"\" >> %s\n" % self.timeFile) self.shfile.write("echo \"With MCJIT (lazy)\" >> %s\n" % self.timeFile) self.shfile.write("/usr/bin/time -f \"Command %C\\n\\tuser time: %U s\\n\\tsytem time: %S s\\n\\tmax set: %M kb\"") self.shfile.write(" -o %s -a " % self.timeFile) self.shfile.write("./toy -suppress-prompts -use-mcjit=true -enable-lazy-compilation=true < %s > %s-mcjit-lazy.out 2> %s-mcjit-lazy.err\n" % (filename, rootname, rootname)) self.shfile.write("echo \"\" >> %s\n" % self.timeFile) self.shfile.write("echo \"With JIT\" >> %s\n" % self.timeFile) self.shfile.write("/usr/bin/time -f \"Command %C\\n\\tuser time: %U s\\n\\tsytem time: %S s\\n\\tmax set: %M kb\"") self.shfile.write(" -o %s -a " % self.timeFile) self.shfile.write("./toy -suppress-prompts -use-mcjit=false < %s > %s-jit.out 2> %s-jit.err\n" % (filename, rootname, rootname)) self.shfile.write("echo \"\" >> %s\n" % self.timeFile) self.shfile.write("echo \"\" >> %s\n" % self.timeFile) class KScriptGenerator: """Used to generate random Kaleidoscope code""" def __init__(self, filename): self.kfile = open(filename, 'w') self.nextFuncNum = 1 self.lastFuncNum = None self.callWeighting = 0.1 # A mapping of calls within functions with no duplicates self.calledFunctionTable = {} # A list of function calls which will actually be executed self.calledFunctions = [] # A comprehensive mapping of calls within functions # used for computing the total number of calls self.comprehensiveCalledFunctionTable = {} self.totalCallsExecuted = 0 def updateTotalCallCount(self, callee): # Count this call self.totalCallsExecuted += 1 # Then count all the functions it calls if callee in self.comprehensiveCalledFunctionTable: for child in self.comprehensiveCalledFunctionTable[callee]: self.updateTotalCallCount(child) def updateFunctionCallMap(self, caller, callee): """Maintains a map of functions that are called from other functions""" if not caller in self.calledFunctionTable: self.calledFunctionTable[caller] = [] if not callee in self.calledFunctionTable[caller]: self.calledFunctionTable[caller].append(callee) if not caller in self.comprehensiveCalledFunctionTable: self.comprehensiveCalledFunctionTable[caller] = [] self.comprehensiveCalledFunctionTable[caller].append(callee) def updateCalledFunctionList(self, callee): """Maintains a list of functions that will actually be called""" # Update the total call count self.updateTotalCallCount(callee) # If this function is already in the list, don't do anything else if callee in self.calledFunctions: return # Add this function to the list of those that will be called. self.calledFunctions.append(callee) # If this function calls other functions, add them too if callee in self.calledFunctionTable: for subCallee in self.calledFunctionTable[callee]: self.updateCalledFunctionList(subCallee) def setCallWeighting(self, weight): """ Sets the probably of generating a function call""" self.callWeighting = weight def writeln(self, line): self.kfile.write(line + '\n') def writeComment(self, comment): self.writeln('# ' + comment) def writeEmptyLine(self): self.writeln("") def writePredefinedFunctions(self): self.writeComment("Define ':' for sequencing: as a low-precedence operator that ignores operands") self.writeComment("and just returns the RHS.") self.writeln("def binary : 1 (x y) y;") self.writeEmptyLine() self.writeComment("Helper functions defined within toy") self.writeln("extern putchard(x);") self.writeln("extern printd(d);") self.writeln("extern printlf();") self.writeEmptyLine() self.writeComment("Print the result of a function call") self.writeln("def printresult(N Result)") self.writeln(" # 'result('") self.writeln(" putchard(114) : putchard(101) : putchard(115) : putchard(117) : putchard(108) : putchard(116) : putchard(40) :") self.writeln(" printd(N) :"); self.writeln(" # ') = '") self.writeln(" putchard(41) : putchard(32) : putchard(61) : putchard(32) :") self.writeln(" printd(Result) :"); self.writeln(" printlf();") self.writeEmptyLine() def writeRandomOperation(self, LValue, LHS, RHS): shouldCallFunc = (self.lastFuncNum > 2 and random.random() < self.callWeighting) if shouldCallFunc: funcToCall = random.randrange(1, self.lastFuncNum - 1) self.updateFunctionCallMap(self.lastFuncNum, funcToCall) self.writeln(" %s = func%d(%s, %s) :" % (LValue, funcToCall, LHS, RHS)) else: possibleOperations = ["+", "-", "*", "/"] operation = random.choice(possibleOperations) if operation == "-": # Don't let our intermediate value become zero # This is complicated by the fact that '<' is our only comparison operator self.writeln(" if %s < %s then" % (LHS, RHS)) self.writeln(" %s = %s %s %s" % (LValue, LHS, operation, RHS)) self.writeln(" else if %s < %s then" % (RHS, LHS)) self.writeln(" %s = %s %s %s" % (LValue, LHS, operation, RHS)) self.writeln(" else") self.writeln(" %s = %s %s %f :" % (LValue, LHS, operation, random.uniform(1, 100))) else: self.writeln(" %s = %s %s %s :" % (LValue, LHS, operation, RHS)) def getNextFuncNum(self): result = self.nextFuncNum self.nextFuncNum += 1 self.lastFuncNum = result return result def writeFunction(self, elements): funcNum = self.getNextFuncNum() self.writeComment("Auto-generated function number %d" % funcNum) self.writeln("def func%d(X Y)" % funcNum) self.writeln(" var temp1 = X,") self.writeln(" temp2 = Y,") self.writeln(" temp3 in") # Initialize the variable names to be rotated first = "temp3" second = "temp1" third = "temp2" # Write some random operations for i in range(elements): self.writeRandomOperation(first, second, third) # Rotate the variables temp = first first = second second = third third = temp self.writeln(" " + third + ";") self.writeEmptyLine() def writeFunctionCall(self): self.writeComment("Call the last function") arg1 = random.uniform(1, 100) arg2 = random.uniform(1, 100) self.writeln("printresult(%d, func%d(%f, %f) )" % (self.lastFuncNum, self.lastFuncNum, arg1, arg2)) self.writeEmptyLine() self.updateCalledFunctionList(self.lastFuncNum) def writeFinalFunctionCounts(self): self.writeComment("Called %d of %d functions" % (len(self.calledFunctions), self.lastFuncNum)) def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript): """ Generate a random Kaleidoscope script based on the given parameters """ print "Generating " + filename print(" %d functions, %d elements per function, %d functions between execution" % (numFuncs, elementsPerFunc, funcsBetweenExec)) print(" Call weighting = %f" % callWeighting) script = KScriptGenerator(filename) script.setCallWeighting(callWeighting) script.writeComment("===========================================================================") script.writeComment("Auto-generated script") script.writeComment(" %d functions, %d elements per function, %d functions between execution" % (numFuncs, elementsPerFunc, funcsBetweenExec)) script.writeComment(" call weighting = %f" % callWeighting) script.writeComment("===========================================================================") script.writeEmptyLine() script.writePredefinedFunctions() funcsSinceLastExec = 0 for i in range(numFuncs): script.writeFunction(elementsPerFunc) funcsSinceLastExec += 1 if funcsSinceLastExec == funcsBetweenExec: script.writeFunctionCall() funcsSinceLastExec = 0 # Always end with a function call if funcsSinceLastExec > 0: script.writeFunctionCall() script.writeEmptyLine() script.writeFinalFunctionCounts() funcsCalled = len(script.calledFunctions) print " Called %d of %d functions, %d total" % (funcsCalled, numFuncs, script.totalCallsExecuted) timingScript.writeTimingCall(filename, numFuncs, funcsCalled, script.totalCallsExecuted) # Execution begins here random.seed() timingScript = TimingScriptGenerator("time-toy.sh", "timing-data.txt") dataSets = [(5000, 3, 50, 0.50), (5000, 10, 100, 0.10), (5000, 10, 5, 0.10), (5000, 10, 1, 0.0), (1000, 3, 10, 0.50), (1000, 10, 100, 0.10), (1000, 10, 5, 0.10), (1000, 10, 1, 0.0), ( 200, 3, 2, 0.50), ( 200, 10, 40, 0.10), ( 200, 10, 2, 0.10), ( 200, 10, 1, 0.0)] # Generate the code for (numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting) in dataSets: filename = "test-%d-%d-%d-%d.k" % (numFuncs, elementsPerFunc, funcsBetweenExec, int(callWeighting * 100)) generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript) print "All done!"
mit
Southpaw-TACTIC/TACTIC
3rd_party/python3/site-packages/cherrypy/test/test_proxy.py
6
5630
import cherrypy from cherrypy.test import helper script_names = ['', '/path/to/myapp'] class ProxyTest(helper.CPWebCase): @staticmethod def setup_server(): # Set up site cherrypy.config.update({ 'tools.proxy.on': True, 'tools.proxy.base': 'www.mydomain.test', }) # Set up application class Root: def __init__(self, sn): # Calculate a URL outside of any requests. self.thisnewpage = cherrypy.url( '/this/new/page', script_name=sn) @cherrypy.expose def pageurl(self): return self.thisnewpage @cherrypy.expose def index(self): raise cherrypy.HTTPRedirect('dummy') @cherrypy.expose def remoteip(self): return cherrypy.request.remote.ip @cherrypy.expose @cherrypy.config(**{ 'tools.proxy.local': 'X-Host', 'tools.trailing_slash.extra': True, }) def xhost(self): raise cherrypy.HTTPRedirect('blah') @cherrypy.expose def base(self): return cherrypy.request.base @cherrypy.expose @cherrypy.config(**{'tools.proxy.scheme': 'X-Forwarded-Ssl'}) def ssl(self): return cherrypy.request.base @cherrypy.expose def newurl(self): return ("Browse to <a href='%s'>this page</a>." % cherrypy.url('/this/new/page')) @cherrypy.expose @cherrypy.config(**{ 'tools.proxy.base': None, }) def base_no_base(self): return cherrypy.request.base for sn in script_names: cherrypy.tree.mount(Root(sn), sn) def testProxy(self): self.getPage('/') self.assertHeader('Location', '%s://www.mydomain.test%s/dummy' % (self.scheme, self.prefix())) # Test X-Forwarded-Host (Apache 1.3.33+ and Apache 2) self.getPage( '/', headers=[('X-Forwarded-Host', 'http://www.example.test')]) self.assertHeader('Location', 'http://www.example.test/dummy') self.getPage('/', headers=[('X-Forwarded-Host', 'www.example.test')]) self.assertHeader('Location', '%s://www.example.test/dummy' % self.scheme) # Test multiple X-Forwarded-Host headers self.getPage('/', headers=[ ('X-Forwarded-Host', 'http://www.example.test, www.cherrypy.test'), ]) self.assertHeader('Location', 'http://www.example.test/dummy') # Test X-Forwarded-For (Apache2) self.getPage('/remoteip', headers=[('X-Forwarded-For', '192.168.0.20')]) self.assertBody('192.168.0.20') # Fix bug #1268 self.getPage('/remoteip', headers=[ ('X-Forwarded-For', '67.15.36.43, 192.168.0.20') ]) self.assertBody('67.15.36.43') # Test X-Host (lighttpd; see https://trac.lighttpd.net/trac/ticket/418) self.getPage('/xhost', headers=[('X-Host', 'www.example.test')]) self.assertHeader('Location', '%s://www.example.test/blah' % self.scheme) # Test X-Forwarded-Proto (lighttpd) self.getPage('/base', headers=[('X-Forwarded-Proto', 'https')]) self.assertBody('https://www.mydomain.test') # Test X-Forwarded-Ssl (webfaction?) self.getPage('/ssl', headers=[('X-Forwarded-Ssl', 'on')]) self.assertBody('https://www.mydomain.test') # Test cherrypy.url() for sn in script_names: # Test the value inside requests self.getPage(sn + '/newurl') self.assertBody( "Browse to <a href='%s://www.mydomain.test" % self.scheme + sn + "/this/new/page'>this page</a>.") self.getPage(sn + '/newurl', headers=[('X-Forwarded-Host', 'http://www.example.test')]) self.assertBody("Browse to <a href='http://www.example.test" + sn + "/this/new/page'>this page</a>.") # Test the value outside requests port = '' if self.scheme == 'http' and self.PORT != 80: port = ':%s' % self.PORT elif self.scheme == 'https' and self.PORT != 443: port = ':%s' % self.PORT host = self.HOST if host in ('0.0.0.0', '::'): import socket host = socket.gethostname() expected = ('%s://%s%s%s/this/new/page' % (self.scheme, host, port, sn)) self.getPage(sn + '/pageurl') self.assertBody(expected) # Test trailing slash (see # https://github.com/cherrypy/cherrypy/issues/562). self.getPage('/xhost/', headers=[('X-Host', 'www.example.test')]) self.assertHeader('Location', '%s://www.example.test/xhost' % self.scheme) def test_no_base_port_in_host(self): """ If no base is indicated, and the host header is used to resolve the base, it should rely on the host header for the port also. """ headers = {'Host': 'localhost:8080'}.items() self.getPage('/base_no_base', headers=headers) self.assertBody('http://localhost:8080')
epl-1.0
dude-pa/dude
tests/food/test_suggest_drinks.py
1
1181
from mock import patch import unittest import yoda from click.testing import CliRunner class TestSuggestDrink(unittest.TestCase): """ Test for the following commands: | Module: food | command: suggest_drinks """ RANDOM_DRINK = { 'drinks': [{ 'strDrink': 'Oatmeal Cookie', 'strInstructions': 'Just mix it all together.', 'strIngredient1': 'Kahlua', 'strIngredient2': 'Bailey', 'strIngredient3': 'Butterscotch schnapps', 'strIngredient4': 'Jagermeister', 'strIngredient5': 'Goldschlager', 'strMeasure1': '2 parts', 'strMeasure2': '2 parts', 'strMeasure3': '4 parts', 'strMeasure4': '1 part', 'strMeasure5': '1/2 part' }] } def __init__(self, methodName="runTest"): super(TestSuggestDrink, self).__init__() self.runner = CliRunner() @patch('modules.food.requests') def runTest(self, requests): requests.get.json.return_value = self.RANDOM_DRINK # Test Drink Suggestion result = self.runner.invoke(yoda.cli, ["food", "suggest_drinks"]) self.assertIsNone(result.exception)
mit
OpenTreeOfLife/peyotl
peyotl/nexson_validation/adaptor.py
2
1724
#!/usr/bin/env python """NexsonValidationAdaptor class. """ from peyotl.nexson_validation._badgerfish_validation import BadgerFishValidationAdaptor from peyotl.nexson_validation._by_id_validation import ByIdHBFValidationAdaptor from peyotl.nexson_syntax import detect_nexson_version from peyotl.nexson_syntax.helper import (find_val_for_first_hbf_l_meta, DIRECT_HONEY_BADGERFISH, _is_badgerfish_version, _is_by_id_hbf, _is_direct_hbf) from peyotl.utility import get_logger _LOG = get_logger(__name__) class DirectHBFValidationAdaptor(BadgerFishValidationAdaptor): def __init__(self, obj, logger, **kwargs): self._find_first_literal_meta = find_val_for_first_hbf_l_meta self._syntax_version = DIRECT_HONEY_BADGERFISH BadgerFishValidationAdaptor.__init__(self, obj, logger, **kwargs) def create_validation_adaptor(obj, logger, **kwargs): try: nexson_version = detect_nexson_version(obj) except: return BadgerFishValidationAdaptor(obj, logger, **kwargs) if _is_by_id_hbf(nexson_version): # _LOG.debug('validating as ById...') return ByIdHBFValidationAdaptor(obj, logger, **kwargs) elif _is_badgerfish_version(nexson_version): # _LOG.debug('validating as BadgerFish...') return BadgerFishValidationAdaptor(obj, logger, **kwargs) elif _is_direct_hbf(nexson_version): # _LOG.debug('validating as DirectHBF...') return DirectHBFValidationAdaptor(obj, logger, **kwargs) raise NotImplementedError('nexml2json version {v}'.format(v=nexson_version))
bsd-2-clause
meskio/bitmask_client
src/leap/bitmask/util/__init__.py
1
3265
# -*- coding: utf-8 -*- # __init__.py # Copyright (C) 2013 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """ Some small and handy functions. """ import datetime import itertools import os from leap.bitmask.config import flags from leap.common.config import get_path_prefix as common_get_path_prefix # functional goodies for a healthier life: # We'll give your money back if it does not alleviate the eye strain, at least. def first(things): """ Return the head of a collection. :param things: a sequence to extract the head from. :type things: sequence :return: object, or None """ try: return things[0] except (IndexError, TypeError): return None def flatten(things): """ Return a generator iterating through a flattened sequence. :param things: a nested sequence, eg, a list of lists. :type things: sequence :rtype: generator """ return itertools.chain(*things) # leap repetitive chores def get_path_prefix(): return common_get_path_prefix(flags.STANDALONE) def get_modification_ts(path): """ Gets modification time of a file. :param path: the path to get ts from :type path: str :returns: modification time :rtype: datetime object """ ts = os.path.getmtime(path) return datetime.datetime.fromtimestamp(ts) def update_modification_ts(path): """ Sets modification time of a file to current time. :param path: the path to set ts to. :type path: str :returns: modification time :rtype: datetime object """ os.utime(path, None) return get_modification_ts(path) def is_file(path): """ Returns True if the path exists and is a file. """ return os.path.isfile(path) def is_empty_file(path): """ Returns True if the file at path is empty. """ return os.stat(path).st_size is 0 def make_address(user, provider): """ Return a full identifier for an user, as a email-like identifier. :param user: the username :type user: basestring :param provider: the provider domain :type provider: basestring """ return "%s@%s" % (user, provider) def force_eval(items): """ Return a sequence that evaluates any callable in the sequence, instantiating it beforehand if the item is a class, and leaves the non-callable items without change. """ def do_eval(thing): if isinstance(thing, type): return thing()() if callable(thing): return thing() return thing if isinstance(items, (list, tuple)): return map(do_eval, items) else: return do_eval(items)
gpl-3.0
Gr1ph00n/staticwebanalyzer
SDK/dnspython-1.11.1/tests/generate.py
12
19826
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import sys sys.path.insert(0, '../') # Force the local project to be *the* dns import cStringIO import filecmp import os import unittest import dns.exception import dns.rdata import dns.rdataclass import dns.rdatatype import dns.rrset import dns.zone import pprint pp = pprint.PrettyPrinter(indent=2) import pdb example_text = """$TTL 1h $ORIGIN 0.0.192.IN-ADDR.ARPA. $GENERATE 1-2 0 CNAME SERVER$.EXAMPLE. """ example_text1 = """$TTL 1h $ORIGIN 0.0.192.IN-ADDR.ARPA. $GENERATE 1-10 fooo$ CNAME $.0 """ example_text2 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 3-5 foo$ A 10.0.0.$ """ example_text3 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 4-8/2 foo$ A 10.0.0.$ """ example_text4 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-13 wp-db${-10,2,d}.services.mozilla.com 0 CNAME SERVER.FOOBAR. """ example_text5 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-13 wp-db${10,2,d}.services.mozilla.com 0 CNAME SERVER.FOOBAR. """ example_text6 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-13 wp-db${+10,2,d}.services.mozilla.com 0 CNAME SERVER.FOOBAR. """ example_text7 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-13 sync${-10}.db IN A 10.10.16.0 """ example_text8 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-12 wp-db${-10,2,d} IN A 10.10.16.0 """ example_text9 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 11-12 wp-db${-10,2,d} IN A 10.10.16.0 $GENERATE 11-13 sync${-10}.db IN A 10.10.16.0 """ example_text10 = """$TTL 1h @ 3600 IN SOA foo bar 1 2 3 4 5 @ 3600 IN NS ns1 @ 3600 IN NS ns2 bar.foo 300 IN MX 0 blaz.foo ns1 3600 IN A 10.0.0.1 ns2 3600 IN A 10.0.0.2 $GENERATE 27-28 $.2 PTR zlb${-26}.oob """ class GenerateTestCase(unittest.TestCase): def testFromText(self): def bad(): z = dns.zone.from_text(example_text, 'example.', relativize=True) self.failUnlessRaises(dns.zone.NoSOA, bad) def testFromText1(self): def bad(): z = dns.zone.from_text(example_text1, 'example.', relativize=True) self.failUnlessRaises(dns.zone.NoSOA, bad) def testIterateAllRdatas2(self): z = dns.zone.from_text(example_text2, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('foo3', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.3')), (dns.name.from_text('foo4', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.4')), (dns.name.from_text('foo5', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.5'))] exl.sort() self.failUnless(l == exl) def testIterateAllRdatas3(self): z = dns.zone.from_text(example_text3, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('foo4', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.4')), (dns.name.from_text('foo6', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.6')), (dns.name.from_text('foo8', None), 3600, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.8'))] exl.sort() self.failUnless(l == exl) def testGenerate1(self): z = dns.zone.from_text(example_text4, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('wp-db01.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db02.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db03.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.'))] exl.sort() self.failUnless(l == exl) def testGenerate2(self): z = dns.zone.from_text(example_text5, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('wp-db21.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db22.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db23.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.'))] exl.sort() self.failUnless(l == exl) def testGenerate3(self): z = dns.zone.from_text(example_text6, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('wp-db21.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db22.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.')), (dns.name.from_text('wp-db23.services.mozilla.com', None), 0L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.CNAME, 'SERVER.FOOBAR.'))] exl.sort() self.failUnless(l == exl) def testGenerate4(self): z = dns.zone.from_text(example_text7, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('sync1.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('sync2.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('sync3.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0'))] exl.sort() self.failUnless(l == exl) def testGenerate6(self): z = dns.zone.from_text(example_text9, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('wp-db01', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('wp-db02', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('sync1.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('sync2.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0')), (dns.name.from_text('sync3.db', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.10.16.0'))] exl.sort() self.failUnless(l == exl) def testGenerate7(self): z = dns.zone.from_text(example_text10, 'example.', relativize=True) l = list(z.iterate_rdatas()) l.sort() exl = [(dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns1')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NS, 'ns2')), (dns.name.from_text('@', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, 'foo bar 1 2 3 4 5')), (dns.name.from_text('bar.foo', None), 300L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.MX, '0 blaz.foo')), (dns.name.from_text('ns1', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.1')), (dns.name.from_text('ns2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.A, '10.0.0.2')), (dns.name.from_text('27.2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.PTR, 'zlb1.oob')), (dns.name.from_text('28.2', None), 3600L, dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.PTR, 'zlb2.oob'))] exl.sort() self.failUnless(l == exl) if __name__ == '__main__': unittest.main()
mit
bhairavmehta95/flashcard-helper-alexa-skill
venv/lib/python2.7/site-packages/pymysql/tests/test_SSCursor.py
27
3920
import sys try: from pymysql.tests import base import pymysql.cursors except Exception: # For local testing from top-level directory, without installing sys.path.append('../pymysql') from pymysql.tests import base import pymysql.cursors class TestSSCursor(base.PyMySQLTestCase): def test_SSCursor(self): affected_rows = 18446744073709551615 conn = self.connections[0] data = [ ('America', '', 'America/Jamaica'), ('America', '', 'America/Los_Angeles'), ('America', '', 'America/Lima'), ('America', '', 'America/New_York'), ('America', '', 'America/Menominee'), ('America', '', 'America/Havana'), ('America', '', 'America/El_Salvador'), ('America', '', 'America/Costa_Rica'), ('America', '', 'America/Denver'), ('America', '', 'America/Detroit'),] try: cursor = conn.cursor(pymysql.cursors.SSCursor) # Create table cursor.execute(('CREATE TABLE tz_data (' 'region VARCHAR(64),' 'zone VARCHAR(64),' 'name VARCHAR(64))')) conn.begin() # Test INSERT for i in data: cursor.execute('INSERT INTO tz_data VALUES (%s, %s, %s)', i) self.assertEqual(conn.affected_rows(), 1, 'affected_rows does not match') conn.commit() # Test fetchone() iter = 0 cursor.execute('SELECT * FROM tz_data') while True: row = cursor.fetchone() if row is None: break iter += 1 # Test cursor.rowcount self.assertEqual(cursor.rowcount, affected_rows, 'cursor.rowcount != %s' % (str(affected_rows))) # Test cursor.rownumber self.assertEqual(cursor.rownumber, iter, 'cursor.rowcount != %s' % (str(iter))) # Test row came out the same as it went in self.assertEqual((row in data), True, 'Row not found in source data') # Test fetchall cursor.execute('SELECT * FROM tz_data') self.assertEqual(len(cursor.fetchall()), len(data), 'fetchall failed. Number of rows does not match') # Test fetchmany cursor.execute('SELECT * FROM tz_data') self.assertEqual(len(cursor.fetchmany(2)), 2, 'fetchmany failed. Number of rows does not match') # So MySQLdb won't throw "Commands out of sync" while True: res = cursor.fetchone() if res is None: break # Test update, affected_rows() cursor.execute('UPDATE tz_data SET zone = %s', ['Foo']) conn.commit() self.assertEqual(cursor.rowcount, len(data), 'Update failed. affected_rows != %s' % (str(len(data)))) # Test executemany cursor.executemany('INSERT INTO tz_data VALUES (%s, %s, %s)', data) self.assertEqual(cursor.rowcount, len(data), 'executemany failed. cursor.rowcount != %s' % (str(len(data)))) # Test multiple datasets cursor.execute('SELECT 1; SELECT 2; SELECT 3') self.assertListEqual(list(cursor), [(1, )]) self.assertTrue(cursor.nextset()) self.assertListEqual(list(cursor), [(2, )]) self.assertTrue(cursor.nextset()) self.assertListEqual(list(cursor), [(3, )]) self.assertFalse(cursor.nextset()) finally: cursor.execute('DROP TABLE tz_data') cursor.close() __all__ = ["TestSSCursor"] if __name__ == "__main__": import unittest unittest.main()
mit
40223134/0512
static/Brython3.1.1-20150328-091302/Lib/unittest/result.py
727
6397
"""Test result object""" import io import sys import traceback from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() return method(self, *args, **kw) return inner STDOUT_LINE = '\nStdout:\n%s' STDERR_LINE = '\nStderr:\n%s' class TestResult(object): """Holder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. """ _previousTestClass = None _testRunEntered = False _moduleSetUpFailed = False def __init__(self, stream=None, descriptions=None, verbosity=None): self.failfast = False self.failures = [] self.errors = [] self.testsRun = 0 self.skipped = [] self.expectedFailures = [] self.unexpectedSuccesses = [] self.shouldStop = False self.buffer = False self._stdout_buffer = None self._stderr_buffer = None self._original_stdout = sys.stdout self._original_stderr = sys.stderr self._mirrorOutput = False def printErrors(self): "Called by TestRunner after test run" #fixme brython pass def startTest(self, test): "Called when the given test is about to be run" self.testsRun += 1 self._mirrorOutput = False self._setupStdout() def _setupStdout(self): if self.buffer: if self._stderr_buffer is None: self._stderr_buffer = io.StringIO() self._stdout_buffer = io.StringIO() sys.stdout = self._stdout_buffer sys.stderr = self._stderr_buffer def startTestRun(self): """Called once before any tests are executed. See startTest for a method called before each test. """ def stopTest(self, test): """Called when the given test has been run""" self._restoreStdout() self._mirrorOutput = False def _restoreStdout(self): if self.buffer: if self._mirrorOutput: output = sys.stdout.getvalue() error = sys.stderr.getvalue() if output: if not output.endswith('\n'): output += '\n' self._original_stdout.write(STDOUT_LINE % output) if error: if not error.endswith('\n'): error += '\n' self._original_stderr.write(STDERR_LINE % error) sys.stdout = self._original_stdout sys.stderr = self._original_stderr self._stdout_buffer.seek(0) self._stdout_buffer.truncate() self._stderr_buffer.seek(0) self._stderr_buffer.truncate() def stopTestRun(self): """Called once after all tests are executed. See stopTest for a method called after each test. """ @failfast def addError(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err, test))) self._mirrorOutput = True @failfast def addFailure(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" self.failures.append((test, self._exc_info_to_string(err, test))) self._mirrorOutput = True def addSuccess(self, test): "Called when a test has completed successfully" pass def addSkip(self, test, reason): """Called when a test is skipped.""" self.skipped.append((test, reason)) def addExpectedFailure(self, test, err): """Called when an expected failure/error occured.""" self.expectedFailures.append( (test, self._exc_info_to_string(err, test))) @failfast def addUnexpectedSuccess(self, test): """Called when a test was expected to fail, but succeed.""" self.unexpectedSuccesses.append(test) def wasSuccessful(self): "Tells whether or not this result was a success" return len(self.failures) == len(self.errors) == 0 def stop(self): "Indicates that the tests should be aborted" self.shouldStop = True def _exc_info_to_string(self, err, test): """Converts a sys.exc_info()-style tuple of values into a string.""" exctype, value, tb = err # Skip test runner traceback levels while tb and self._is_relevant_tb_level(tb): tb = tb.tb_next if exctype is test.failureException: # Skip assert*() traceback levels length = self._count_relevant_tb_levels(tb) msgLines = traceback.format_exception(exctype, value, tb, length) else: msgLines = traceback.format_exception(exctype, value, tb) if self.buffer: output = sys.stdout.getvalue() error = sys.stderr.getvalue() if output: if not output.endswith('\n'): output += '\n' msgLines.append(STDOUT_LINE % output) if error: if not error.endswith('\n'): error += '\n' msgLines.append(STDERR_LINE % error) return ''.join(msgLines) def _is_relevant_tb_level(self, tb): #fix me brython #return '__unittest' in tb.tb_frame.f_globals return True #for now, lets just return False def _count_relevant_tb_levels(self, tb): length = 0 while tb and not self._is_relevant_tb_level(tb): length += 1 tb = tb.tb_next return length def __repr__(self): return ("<%s run=%i errors=%i failures=%i>" % (util.strclass(self.__class__), self.testsRun, len(self.errors), len(self.failures)))
gpl-3.0
uli/scummvm-spmp8000
devtools/tasmrecover/tasm/op.py
61
9469
# ScummVM - Graphic Adventure Engine # # ScummVM is the legal property of its developers, whose names # are too numerous to list here. Please refer to the COPYRIGHT # file distributed with this source distribution. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # import re import lex class Unsupported(Exception): pass class var: def __init__(self, size, offset): self.size = size self.offset = offset class const: def __init__(self, value): self.value = value class reg: def __init__(self, name): self.name = name def size(self): return 2 if self.name[1] == 'x' else 1 def __str__(self): return "<register %s>" %self.name class unref: def __init__(self, exp): self.exp = exp def __str__(self): return "<unref %s>" %self.exp class ref: def __init__(self, name): self.name = name def __str__(self): return "<ref %s>" %self.name class glob: def __init__(self, name): self.name = name def __str__(self): return "<global %s>" %self.name class segment: def __init__(self, name): self.name = name def __str__(self): return "<segment %s>" %self.name class baseop(object): def parse_arg(self, arg): return arg def split(self, text): a, b = lex.parse_args(text) return self.parse_arg(a), self.parse_arg(b) def __str__(self): return str(self.__class__) class basejmp(baseop): pass class _call(baseop): def __init__(self, arg): self.name = arg def visit(self, visitor): visitor._call(self.name) def __str__(self): return "call(%s)" %self.name class _rep(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._rep() class _mov(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._mov(self.dst, self.src) def __str__(self): return "mov(%s, %s)" %(self.dst, self.src) class _mov2(baseop): def __init__(self, dst, src): self.dst, self.src = dst, src def visit(self, visitor): visitor._mov(self.dst, self.src) class _shr(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._shr(self.dst, self.src) class _shl(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._shl(self.dst, self.src) class _ror(baseop): def __init__(self, arg): pass class _rol(baseop): def __init__(self, arg): pass class _sar(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._sar(self.dst, self.src) class _sal(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._sal(self.dst, self.src) class _rcl(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._rcl(self.dst, self.src) class _rcr(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._rcr(self.dst, self.src) class _neg(baseop): def __init__(self, arg): self.arg = arg def visit(self, visitor): visitor._neg(self.arg) class _dec(baseop): def __init__(self, arg): self.dst = arg def visit(self, visitor): visitor._dec(self.dst) class _inc(baseop): def __init__(self, arg): self.dst = arg def visit(self, visitor): visitor._inc(self.dst) class _add(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._add(self.dst, self.src) class _sub(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._sub(self.dst, self.src) class _mul(baseop): def __init__(self, arg): self.arg = self.parse_arg(arg) def visit(self, visitor): visitor._mul(self.arg) class _div(baseop): def __init__(self, arg): self.arg = self.parse_arg(arg) def visit(self, visitor): visitor._div(self.arg) class _and(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._and(self.dst, self.src) class _xor(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._xor(self.dst, self.src) class _or(baseop): def __init__(self, arg): self.dst, self.src = self.split(arg) def visit(self, visitor): visitor._or(self.dst, self.src) class _cmp(baseop): def __init__(self, arg): self.a, self.b = self.split(arg) def visit(self, visitor): visitor._cmp(self.a, self.b) class _test(baseop): def __init__(self, arg): self.a, self.b = self.split(arg) def visit(self, visitor): visitor._test(self.a, self.b) class _xchg(baseop): def __init__(self, arg): self.a, self.b = self.split(arg) def visit(self, visitor): visitor._xchg(self.a, self.b) class _jnz(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jnz(self.label) class _jz(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jz(self.label) class _jc(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jc(self.label) class _jnc(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jnc(self.label) class _js(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._js(self.label) class _jns(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jns(self.label) class _jl(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jl(self.label) class _jg(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jg(self.label) class _jle(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jle(self.label) class _jge(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jge(self.label) class _jmp(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._jmp(self.label) class _loop(basejmp): def __init__(self, label): self.label = label def visit(self, visitor): visitor._loop(self.label) class _push(baseop): def __init__(self, arg): self.regs = [] for r in arg.split(): self.regs.append(self.parse_arg(r)) def visit(self, visitor): visitor._push(self.regs) class _pop(baseop): def __init__(self, arg): self.regs = [] for r in arg.split(): self.regs.append(self.parse_arg(r)) def visit(self, visitor): visitor._pop(self.regs) class _ret(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._ret() class _lodsb(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._lodsb() class _lodsw(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._lodsw() class _stosw(baseop): def __init__(self, arg): self.repeat = 1 self.clear_cx = False def visit(self, visitor): visitor._stosw(self.repeat, self.clear_cx) class _stosb(baseop): def __init__(self, arg): self.repeat = 1 self.clear_cx = False def visit(self, visitor): visitor._stosb(self.repeat, self.clear_cx) class _movsw(baseop): def __init__(self, arg): self.repeat = 1 self.clear_cx = False def visit(self, visitor): visitor._movsw(self.repeat, self.clear_cx) class _movsb(baseop): def __init__(self, arg): self.repeat = 1 self.clear_cx = False def visit(self, visitor): visitor._movsb(self.repeat, self.clear_cx) class _in(baseop): def __init__(self, arg): self.arg = arg def visit(self, visitor): raise Unsupported("input from port: %s" %self.arg) class _out(baseop): def __init__(self, arg): self.arg = arg def visit(self, visitor): raise Unsupported("out to port: %s" %self.arg) class _cli(baseop): def __init__(self, arg): pass def visit(self, visitor): raise Unsupported("cli") class _sti(baseop): def __init__(self, arg): pass def visit(self, visitor): raise Unsupported("sli") class _int(baseop): def __init__(self, arg): self.arg = arg def visit(self, visitor): raise Unsupported("interrupt: %s" %self.arg) class _iret(baseop): def __init__(self, arg): pass def visit(self, visitor): raise Unsupported("interrupt return") class _cbw(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._cbw() class _nop(baseop): def __init__(self, arg): pass def visit(self, visitor): pass class _stc(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._stc() class _clc(baseop): def __init__(self, arg): pass def visit(self, visitor): visitor._clc() class label(baseop): def __init__(self, name): self.name = name def visit(self, visitor): visitor._label(self.name)
gpl-2.0
denys-duchier/django
django/contrib/gis/db/models/functions.py
5
19280
from decimal import Decimal from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import ( Area as AreaMeasure, Distance as DistanceMeasure, ) from django.core.exceptions import FieldError from django.db.models import ( BooleanField, FloatField, IntegerField, TextField, Transform, ) from django.db.models.expressions import Func, Value from django.db.models.functions import Cast NUMERIC_TYPES = (int, float, Decimal) class GeoFuncMixin: function = None output_field_class = None geom_param_pos = (0,) def __init__(self, *expressions, **extra): if 'output_field' not in extra and self.output_field_class: extra['output_field'] = self.output_field_class() super().__init__(*expressions, **extra) # Ensure that value expressions are geometric. for pos in self.geom_param_pos: expr = self.source_expressions[pos] if not isinstance(expr, Value): continue try: output_field = expr.output_field except FieldError: output_field = None geom = expr.value if not isinstance(geom, Geometry) or output_field and not isinstance(output_field, GeometryField): raise TypeError("%s function requires a geometric argument in position %d." % (self.name, pos + 1)) if not geom.srid and not output_field: raise ValueError("SRID is required for all geometries.") if not output_field: self.source_expressions[pos] = Value(geom, output_field=GeometryField(srid=geom.srid)) @property def name(self): return self.__class__.__name__ @property def srid(self): return self.source_expressions[self.geom_param_pos[0]].field.srid @property def geo_field(self): return GeometryField(srid=self.srid) if self.srid else None def as_sql(self, compiler, connection, function=None, **extra_context): if not self.function and not function: function = connection.ops.spatial_function_name(self.name) return super().as_sql(compiler, connection, function=function, **extra_context) def resolve_expression(self, *args, **kwargs): res = super().resolve_expression(*args, **kwargs) # Ensure that expressions are geometric. source_fields = res.get_source_fields() for pos in self.geom_param_pos: field = source_fields[pos] if not isinstance(field, GeometryField): raise TypeError( "%s function requires a GeometryField in position %s, got %s." % ( self.name, pos + 1, type(field).__name__, ) ) base_srid = res.srid for pos in self.geom_param_pos[1:]: expr = res.source_expressions[pos] expr_srid = expr.output_field.srid if expr_srid != base_srid: # Automatic SRID conversion so objects are comparable. res.source_expressions[pos] = Transform(expr, base_srid).resolve_expression(*args, **kwargs) return res def _handle_param(self, value, param_name='', check_types=None): if not hasattr(value, 'resolve_expression'): if check_types and not isinstance(value, check_types): raise TypeError( "The %s parameter has the wrong type: should be %s." % ( param_name, check_types) ) return value class GeoFunc(GeoFuncMixin, Func): pass class GeomOutputGeoFunc(GeoFunc): def __init__(self, *expressions, **extra): if 'output_field' not in extra: extra['output_field'] = GeometryField() super(GeomOutputGeoFunc, self).__init__(*expressions, **extra) def resolve_expression(self, *args, **kwargs): res = super().resolve_expression(*args, **kwargs) res.output_field.srid = res.srid return res class SQLiteDecimalToFloatMixin: """ By default, Decimal values are converted to str by the SQLite backend, which is not acceptable by the GIS functions expecting numeric values. """ def as_sqlite(self, compiler, connection): for expr in self.get_source_expressions(): if hasattr(expr, 'value') and isinstance(expr.value, Decimal): expr.value = float(expr.value) return super().as_sql(compiler, connection) class OracleToleranceMixin: tolerance = 0.05 def as_oracle(self, compiler, connection): tol = self.extra.get('tolerance', self.tolerance) return self.as_sql(compiler, connection, template="%%(function)s(%%(expressions)s, %s)" % tol) class Area(OracleToleranceMixin, GeoFunc): output_field_class = AreaField arity = 1 def as_sql(self, compiler, connection, **extra_context): if connection.ops.geography: self.output_field.area_att = 'sq_m' else: # Getting the area units of the geographic field. geo_field = self.geo_field if geo_field.geodetic(connection): if connection.features.supports_area_geodetic: self.output_field.area_att = 'sq_m' else: # TODO: Do we want to support raw number areas for geodetic fields? raise NotImplementedError('Area on geodetic coordinate systems not supported.') else: units_name = geo_field.units_name(connection) if units_name: self.output_field.area_att = AreaMeasure.unit_attname(units_name) return super().as_sql(compiler, connection, **extra_context) def as_oracle(self, compiler, connection): self.output_field = AreaField('sq_m') # Oracle returns area in units of meters. return super().as_oracle(compiler, connection) def as_sqlite(self, compiler, connection, **extra_context): if self.geo_field.geodetic(connection): extra_context['template'] = '%(function)s(%(expressions)s, %(spheroid)d)' extra_context['spheroid'] = True return self.as_sql(compiler, connection, **extra_context) class Azimuth(GeoFunc): output_field_class = FloatField arity = 2 geom_param_pos = (0, 1) class AsGeoJSON(GeoFunc): output_field_class = TextField def __init__(self, expression, bbox=False, crs=False, precision=8, **extra): expressions = [expression] if precision is not None: expressions.append(self._handle_param(precision, 'precision', int)) options = 0 if crs and bbox: options = 3 elif bbox: options = 1 elif crs: options = 2 if options: expressions.append(options) super().__init__(*expressions, **extra) class AsGML(GeoFunc): geom_param_pos = (1,) output_field_class = TextField def __init__(self, expression, version=2, precision=8, **extra): expressions = [version, expression] if precision is not None: expressions.append(self._handle_param(precision, 'precision', int)) super().__init__(*expressions, **extra) def as_oracle(self, compiler, connection, **extra_context): source_expressions = self.get_source_expressions() version = source_expressions[0] clone = self.copy() clone.set_source_expressions([source_expressions[1]]) extra_context['function'] = 'SDO_UTIL.TO_GML311GEOMETRY' if version.value == 3 else 'SDO_UTIL.TO_GMLGEOMETRY' return super(AsGML, clone).as_sql(compiler, connection, **extra_context) class AsKML(AsGML): def as_sqlite(self, compiler, connection): # No version parameter clone = self.copy() clone.set_source_expressions(self.get_source_expressions()[1:]) return clone.as_sql(compiler, connection) class AsSVG(GeoFunc): output_field_class = TextField def __init__(self, expression, relative=False, precision=8, **extra): relative = relative if hasattr(relative, 'resolve_expression') else int(relative) expressions = [ expression, relative, self._handle_param(precision, 'precision', int), ] super().__init__(*expressions, **extra) class BoundingCircle(OracleToleranceMixin, GeoFunc): def __init__(self, expression, num_seg=48, **extra): super().__init__(*[expression, num_seg], **extra) def as_oracle(self, compiler, connection): clone = self.copy() clone.set_source_expressions([self.get_source_expressions()[0]]) return super(BoundingCircle, clone).as_oracle(compiler, connection) class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): arity = 1 class Difference(OracleToleranceMixin, GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1) class DistanceResultMixin: output_field_class = DistanceField def source_is_geography(self): return self.get_source_fields()[0].geography and self.srid == 4326 def distance_att(self, connection): dist_att = None geo_field = self.geo_field if geo_field.geodetic(connection): if connection.features.supports_distance_geodetic: dist_att = 'm' else: units = geo_field.units_name(connection) if units: dist_att = DistanceMeasure.unit_attname(units) return dist_att def as_sql(self, compiler, connection, **extra_context): clone = self.copy() clone.output_field.distance_att = self.distance_att(connection) return super(DistanceResultMixin, clone).as_sql(compiler, connection, **extra_context) class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): geom_param_pos = (0, 1) spheroid = None def __init__(self, expr1, expr2, spheroid=None, **extra): expressions = [expr1, expr2] if spheroid is not None: self.spheroid = spheroid expressions += (self._handle_param(spheroid, 'spheroid', bool),) super().__init__(*expressions, **extra) def as_postgresql(self, compiler, connection): function = None geo_field = GeometryField(srid=self.srid) # Fake field to get SRID info expr2 = self.source_expressions[1] geography = self.source_is_geography() if expr2.output_field.geography != geography: if isinstance(expr2, Value): expr2.output_field.geography = geography else: self.source_expressions[1] = Cast( expr2, GeometryField(srid=expr2.output_field.srid, geography=geography), ) if not geography and geo_field.geodetic(connection): # Geometry fields with geodetic (lon/lat) coordinates need special distance functions if self.spheroid: # DistanceSpheroid is more accurate and resource intensive than DistanceSphere function = connection.ops.spatial_function_name('DistanceSpheroid') # Replace boolean param by the real spheroid of the base field self.source_expressions[2] = Value(geo_field.spheroid(connection)) else: function = connection.ops.spatial_function_name('DistanceSphere') return super().as_sql(compiler, connection, function=function) def as_oracle(self, compiler, connection): if self.spheroid: self.source_expressions.pop(2) return super().as_oracle(compiler, connection) def as_sqlite(self, compiler, connection, **extra_context): if self.spheroid: self.source_expressions.pop(2) if self.geo_field.geodetic(connection): # SpatiaLite returns NULL instead of zero on geodetic coordinates extra_context['template'] = 'COALESCE(%(function)s(%(expressions)s, %(spheroid)s), 0)' extra_context['spheroid'] = int(bool(self.spheroid)) return super().as_sql(compiler, connection, **extra_context) class Envelope(GeomOutputGeoFunc): arity = 1 class ForceRHR(GeomOutputGeoFunc): arity = 1 class GeoHash(GeoFunc): output_field_class = TextField def __init__(self, expression, precision=None, **extra): expressions = [expression] if precision is not None: expressions.append(self._handle_param(precision, 'precision', int)) super().__init__(*expressions, **extra) def as_mysql(self, compiler, connection): clone = self.copy() # If no precision is provided, set it to the maximum. if len(clone.source_expressions) < 2: clone.source_expressions.append(Value(100)) return clone.as_sql(compiler, connection) class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1) @BaseSpatialField.register_lookup class IsValid(OracleToleranceMixin, GeoFuncMixin, Transform): lookup_name = 'isvalid' output_field = BooleanField() def as_oracle(self, compiler, connection, **extra_context): sql, params = super().as_oracle(compiler, connection, **extra_context) return "CASE %s WHEN 'TRUE' THEN 1 ELSE 0 END" % sql, params class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc): def __init__(self, expr1, spheroid=True, **extra): self.spheroid = spheroid super().__init__(expr1, **extra) def as_sql(self, compiler, connection, **extra_context): geo_field = GeometryField(srid=self.srid) # Fake field to get SRID info if geo_field.geodetic(connection) and not connection.features.supports_length_geodetic: raise NotImplementedError("This backend doesn't support Length on geodetic fields") return super().as_sql(compiler, connection, **extra_context) def as_postgresql(self, compiler, connection): function = None geo_field = GeometryField(srid=self.srid) # Fake field to get SRID info if self.source_is_geography(): self.source_expressions.append(Value(self.spheroid)) elif geo_field.geodetic(connection): # Geometry fields with geodetic (lon/lat) coordinates need length_spheroid function = connection.ops.spatial_function_name('LengthSpheroid') self.source_expressions.append(Value(geo_field.spheroid(connection))) else: dim = min(f.dim for f in self.get_source_fields() if f) if dim > 2: function = connection.ops.length3d return super().as_sql(compiler, connection, function=function) def as_sqlite(self, compiler, connection): function = None geo_field = GeometryField(srid=self.srid) if geo_field.geodetic(connection): function = 'GeodesicLength' if self.spheroid else 'GreatCircleLength' return super().as_sql(compiler, connection, function=function) class LineLocatePoint(GeoFunc): output_field_class = FloatField arity = 2 geom_param_pos = (0, 1) class MakeValid(GeoFunc): pass class MemSize(GeoFunc): output_field_class = IntegerField arity = 1 class NumGeometries(GeoFunc): output_field_class = IntegerField arity = 1 class NumPoints(GeoFunc): output_field_class = IntegerField arity = 1 def as_sql(self, compiler, connection): if self.source_expressions[self.geom_param_pos[0]].output_field.geom_type != 'LINESTRING': if not connection.features.supports_num_points_poly: raise TypeError('NumPoints can only operate on LineString content on this database.') return super().as_sql(compiler, connection) class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): arity = 1 def as_postgresql(self, compiler, connection): function = None geo_field = GeometryField(srid=self.srid) # Fake field to get SRID info if geo_field.geodetic(connection) and not self.source_is_geography(): raise NotImplementedError("ST_Perimeter cannot use a non-projected non-geography field.") dim = min(f.dim for f in self.get_source_fields()) if dim > 2: function = connection.ops.perimeter3d return super().as_sql(compiler, connection, function=function) def as_sqlite(self, compiler, connection): geo_field = GeometryField(srid=self.srid) # Fake field to get SRID info if geo_field.geodetic(connection): raise NotImplementedError("Perimeter cannot use a non-projected field.") return super().as_sql(compiler, connection) class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): arity = 1 class Reverse(GeoFunc): arity = 1 class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): def __init__(self, expression, x, y, z=0.0, **extra): expressions = [ expression, self._handle_param(x, 'x', NUMERIC_TYPES), self._handle_param(y, 'y', NUMERIC_TYPES), ] if z != 0.0: expressions.append(self._handle_param(z, 'z', NUMERIC_TYPES)) super().__init__(*expressions, **extra) class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): def __init__(self, expression, *args, **extra): nargs = len(args) expressions = [expression] if nargs in (1, 2): expressions.extend( [self._handle_param(arg, '', NUMERIC_TYPES) for arg in args] ) elif nargs == 4: # Reverse origin and size param ordering expressions.extend( [self._handle_param(arg, '', NUMERIC_TYPES) for arg in args[2:]] ) expressions.extend( [self._handle_param(arg, '', NUMERIC_TYPES) for arg in args[0:2]] ) else: raise ValueError('Must provide 1, 2, or 4 arguments to `SnapToGrid`.') super().__init__(*expressions, **extra) class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1) class Transform(GeomOutputGeoFunc): def __init__(self, expression, srid, **extra): expressions = [ expression, self._handle_param(srid, 'srid', int), ] if 'output_field' not in extra: extra['output_field'] = GeometryField(srid=srid) super().__init__(*expressions, **extra) @property def srid(self): # Make srid the resulting srid of the transformation return self.source_expressions[1].value class Translate(Scale): def as_sqlite(self, compiler, connection): if len(self.source_expressions) < 4: # Always provide the z parameter for ST_Translate self.source_expressions.append(Value(0)) return super().as_sqlite(compiler, connection) class Union(OracleToleranceMixin, GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1)
bsd-3-clause
keven/ibpy
ib/opt/sender.py
3
2332
#!/usr/bin/env python # -*- coding: utf-8 -*- ## # Defines Sender class to handle outbound requests. # # Sender instances defer failed attribute lookup to their # EClientSocket member objects. # ## from ib.ext.EClientSocket import EClientSocket from ib.opt.message import registry, clientSocketMethods class Sender(object): """ Encapsulates an EClientSocket instance, and proxies attribute lookup to it. """ client = None def __init__(self, dispatcher): """ Initializer. @param dispatcher message dispatcher instance """ self.dispatcher = dispatcher self.clientMethodNames = [m[0] for m in clientSocketMethods] def connect(self, host, port, clientId, handler, clientType=EClientSocket): """ Creates a TWS client socket and connects it. @param host name of host for connection; default is localhost @param port port number for connection; default is 7496 @param clientId client identifier to send when connected @param handler object to receive reader messages @keyparam clientType=EClientSocket callable producing socket client @return True if connected, False otherwise """ def reconnect(): self.client = client = clientType(handler) client.eConnect(host, port, clientId) return client.isConnected() self.reconnect = reconnect return self.reconnect() def disconnect(self): """ Disconnects the client. @return True if disconnected, False otherwise """ client = self.client if client and client.isConnected(): client.eDisconnect() return not client.isConnected() return False def __getattr__(self, name): """ x.__getattr__('name') <==> x.name @return named attribute from EClientSocket object """ try: value = getattr(self.client, name) except (AttributeError, ): raise if name in self.clientMethodNames: before, after = registry[name+'Before'], registry[name+'After'] def wrapperMethod(*args): self.dispatcher(name+'Before', dict(zip(before.__slots__, args))) result = value(*args) self.dispatcher(name+'After', dict(zip(after.__slots__, args))) return result return wrapperMethod return value
bsd-3-clause
nicky-ji/edx-nicky
common/lib/xmodule/xmodule/modulestore/modulestore_settings.py
9
4467
""" This file contains helper functions for configuring module_store_setting settings and support for backward compatibility with older formats. """ import warnings import copy def convert_module_store_setting_if_needed(module_store_setting): """ Converts old-style module_store_setting configuration settings to the new format. """ def convert_old_stores_into_list(old_stores): """ Converts and returns the given stores in old (unordered) dict-style format to the new (ordered) list format """ new_store_list = [] for store_name, store_settings in old_stores.iteritems(): store_settings['NAME'] = store_name if store_name == 'default': new_store_list.insert(0, store_settings) else: new_store_list.append(store_settings) # migrate request for the old 'direct' Mongo store to the Draft store if store_settings['ENGINE'] == 'xmodule.modulestore.mongo.MongoModuleStore': warnings.warn("MongoModuleStore is deprecated! Please use DraftModuleStore.", DeprecationWarning) store_settings['ENGINE'] = 'xmodule.modulestore.mongo.draft.DraftModuleStore' return new_store_list if module_store_setting is None: return None if module_store_setting['default']['ENGINE'] != 'xmodule.modulestore.mixed.MixedModuleStore': warnings.warn("Direct access to a modulestore is deprecated. Please use MixedModuleStore.", DeprecationWarning) # convert to using mixed module_store new_module_store_setting = { "default": { "ENGINE": "xmodule.modulestore.mixed.MixedModuleStore", "OPTIONS": { "mappings": {}, "stores": [] } } } # copy the old configurations into the new settings new_module_store_setting['default']['OPTIONS']['stores'] = convert_old_stores_into_list( module_store_setting ) module_store_setting = new_module_store_setting elif isinstance(module_store_setting['default']['OPTIONS']['stores'], dict): warnings.warn( "Using a dict for the Stores option in the MixedModuleStore is deprecated. Please use a list instead.", DeprecationWarning ) # convert old-style (unordered) dict to (an ordered) list module_store_setting['default']['OPTIONS']['stores'] = convert_old_stores_into_list( module_store_setting['default']['OPTIONS']['stores'] ) assert isinstance(module_store_setting['default']['OPTIONS']['stores'], list) # If Split is not defined but the DraftMongoModuleStore is configured, add Split as a copy of Draft mixed_stores = module_store_setting['default']['OPTIONS']['stores'] is_split_defined = any((store['ENGINE'].endswith('.DraftVersioningModuleStore')) for store in mixed_stores) if not is_split_defined: # find first setting of mongo store mongo_store = next( (store for store in mixed_stores if ( store['ENGINE'].endswith('.DraftMongoModuleStore') or store['ENGINE'].endswith('.DraftModuleStore') )), None ) if mongo_store: # deepcopy mongo -> split split_store = copy.deepcopy(mongo_store) # update the ENGINE and NAME fields split_store['ENGINE'] = 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore' split_store['NAME'] = 'split' # add split to the end of the list mixed_stores.append(split_store) return module_store_setting def update_module_store_settings( module_store_setting, doc_store_settings=None, module_store_options=None, xml_store_options=None, ): """ Updates the settings for each store defined in the given module_store_setting settings with the given doc store configuration and options, overwriting existing keys. """ for store in module_store_setting['default']['OPTIONS']['stores']: if store['NAME'] == 'xml': xml_store_options and store['OPTIONS'].update(xml_store_options) else: module_store_options and store['OPTIONS'].update(module_store_options) doc_store_settings and store['DOC_STORE_CONFIG'].update(doc_store_settings)
agpl-3.0
elkingtonmcb/django
django/contrib/gis/db/backends/postgis/schema.py
333
3091
from django.db.backends.postgresql.schema import DatabaseSchemaEditor class PostGISSchemaEditor(DatabaseSchemaEditor): geom_index_type = 'GIST' geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND' rast_index_wrapper = 'ST_ConvexHull(%s)' sql_add_spatial_index = "CREATE INDEX %(index)s ON %(table)s USING %(index_type)s (%(column)s %(ops)s)" sql_clear_geometry_columns = "DELETE FROM geometry_columns WHERE f_table_name = %(table)s" def __init__(self, *args, **kwargs): super(PostGISSchemaEditor, self).__init__(*args, **kwargs) self.geometry_sql = [] def geo_quote_name(self, name): return self.connection.ops.geo_quote_name(name) def column_sql(self, model, field, include_default=False): from django.contrib.gis.db.models.fields import BaseSpatialField if not isinstance(field, BaseSpatialField): return super(PostGISSchemaEditor, self).column_sql(model, field, include_default) column_sql = super(PostGISSchemaEditor, self).column_sql(model, field, include_default) if field.spatial_index: # Spatial indexes created the same way for both Geometry and # Geography columns. field_column = self.quote_name(field.column) if field.geom_type == 'RASTER': # For raster fields, wrap index creation SQL statement with ST_ConvexHull. # Indexes on raster columns are based on the convex hull of the raster. field_column = self.rast_index_wrapper % field_column index_ops = '' elif field.geography: index_ops = '' else: # Use either "nd" ops which are fast on multidimensional cases # or just plain gist index for the 2d case. if field.dim > 2: index_ops = self.geom_index_ops_nd else: index_ops = '' self.geometry_sql.append( self.sql_add_spatial_index % { "index": self.quote_name('%s_%s_id' % (model._meta.db_table, field.column)), "table": self.quote_name(model._meta.db_table), "column": field_column, "index_type": self.geom_index_type, "ops": index_ops, } ) return column_sql def create_model(self, model): super(PostGISSchemaEditor, self).create_model(model) # Create geometry columns for sql in self.geometry_sql: self.execute(sql) self.geometry_sql = [] def delete_model(self, model): super(PostGISSchemaEditor, self).delete_model(model) self.execute(self.sql_clear_geometry_columns % { "table": self.geo_quote_name(model._meta.db_table), }) def add_field(self, model, field): super(PostGISSchemaEditor, self).add_field(model, field) # Create geometry columns for sql in self.geometry_sql: self.execute(sql) self.geometry_sql = []
bsd-3-clause
YanTangZhai/tf
tensorflow/python/ops/sparse_ops.py
3
22657
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== # pylint: disable=g-short-docstring-punctuation """## Sparse Tensor Representation Tensorflow supports a `SparseTensor` representation for data that is sparse in multiple dimensions. Contrast this representation with `IndexedSlices`, which is efficient for representing tensors that are sparse in their first dimension, and dense along all other dimensions. @@SparseTensor @@SparseTensorValue ## Sparse to Dense Conversion @@sparse_to_dense @@sparse_tensor_to_dense @@sparse_to_indicator ## Manipulation @@sparse_concat @@sparse_reorder @@sparse_retain @@sparse_fill_empty_rows """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.python.platform import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.framework import tensor_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import constant_op from tensorflow.python.ops import gen_sparse_ops from tensorflow.python.ops import math_ops # pylint: disable=wildcard-import from tensorflow.python.ops.gen_sparse_ops import * # pylint: enable=wildcard-import # pylint: disable=protected-access def sparse_concat(concat_dim, sp_inputs, name=None): """Concatenates a list of `SparseTensor` along the specified dimension. Concatenation is with respect to the dense versions of each sparse input. It is assumed that each inputs is a `SparseTensor` whose elements are ordered along increasing dimension number. All inputs' shapes must match, except for the concat dimension. The `indices`, `values`, and `shapes` lists must have the same length. The output shape is identical to the inputs', except along the concat dimension, where it is the sum of the inputs' sizes along that dimension. The output elements will be resorted to preserve the sort order along increasing dimension number. This op runs in `O(M log M)` time, where `M` is the total number of non-empty values across all inputs. This is due to the need for an internal sort in order to concatenate efficiently across an arbitrary dimension. For example, if `concat_dim = 1` and the inputs are sp_inputs[0]: shape = [2, 3] [0, 2]: "a" [1, 0]: "b" [1, 1]: "c" sp_inputs[1]: shape = [2, 4] [0, 1]: "d" [0, 2]: "e" then the output will be shape = [2, 7] [0, 2]: "a" [0, 4]: "d" [0, 5]: "e" [1, 0]: "b" [1, 1]: "c" Graphically this is equivalent to doing [ a] concat [ d e ] = [ a d e ] [b c ] [ ] [b c ] Args: concat_dim: Dimension to concatenate along. sp_inputs: List of `SparseTensor` to concatenate. name: A name prefix for the returned tensors (optional). Returns: A `SparseTensor` with the concatenated output. Raises: TypeError: If `sp_inputs` is not a list of `SparseTensor`. """ if not isinstance(sp_inputs, list): raise TypeError("Inputs must be a list") if not all(isinstance(sp_input, ops.SparseTensor) for sp_input in sp_inputs): raise TypeError("All inputs must be SparseTensors") if len(sp_inputs) == 1: # Degenerate case of one tensor. return sp_inputs[0] inds = [sp_input.indices for sp_input in sp_inputs] vals = [sp_input.values for sp_input in sp_inputs] shapes = [sp_input.shape for sp_input in sp_inputs] output_ind, output_val, output_shape = ( gen_sparse_ops._sparse_concat( inds, vals, shapes, concat_dim, name=name)) return ops.SparseTensor(output_ind, output_val, output_shape) @ops.RegisterShape("SparseConcat") def _SparseConcatShape(op): """Shape function for SparseConcat op.""" num_inputs = int(op.get_attr("N")) # TF flattens and concatenates all list inputs, so reconstruct the lists here. ind_shapes = [ind.get_shape().with_rank(2) for ind in op.inputs[0:num_inputs]] val_shapes = [val.get_shape().with_rank(1) for val in op.inputs[num_inputs:2 * num_inputs]] shape_shapes = [shape.get_shape().with_rank(1) for shape in op.inputs[2 * num_inputs:]] output_ind_rows = tensor_shape.Dimension(0) output_ind_cols = tensor_shape.Dimension(None) output_val_elems = tensor_shape.Dimension(0) output_shape_shape = tensor_shape.TensorShape(None) for i in xrange(num_inputs): num_elems_i = ind_shapes[i][0].merge_with(val_shapes[i][0]) output_ind_rows += num_elems_i output_ind_cols = output_ind_cols.merge_with(ind_shapes[i][1]) output_val_elems += num_elems_i output_shape_shape = output_shape_shape.merge_with(shape_shapes[i]) output_ind_shape = tensor_shape.matrix(output_ind_rows, output_ind_cols) output_val_shape = tensor_shape.vector(output_val_elems) return [output_ind_shape, output_val_shape, output_shape_shape] def sparse_reorder(sp_input, name=None): """Reorders a `SparseTensor` into the canonical, row-major ordering. Note that by convention, all sparse ops preserve the canonical ordering along increasing dimension number. The only time ordering can be violated is during manual manipulation of the indices and values to add entries. Reordering does not affect the shape of the `SparseTensor`. For example, if `sp_input` has shape `[4, 5]` and `indices` / `values`: [0, 3]: b [0, 1]: a [3, 1]: d [2, 0]: c then the output will be a `SparseTensor` of shape `[4, 5]` and `indices` / `values`: [0, 1]: a [0, 3]: b [2, 0]: c [3, 1]: d Args: sp_input: The input `SparseTensor`. name: A name prefix for the returned tensors (optional) Returns: A `SparseTensor` with the same shape and non-empty values, but in canonical ordering. Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor") reordered_ind, reordered_val = ( gen_sparse_ops._sparse_reorder( sp_input.indices, sp_input.values, sp_input.shape, name=name)) return ops.SparseTensor( reordered_ind, reordered_val, array_ops.identity(sp_input.shape)) @ops.RegisterShape("SparseReorder") def _SparseReorderShape(op): """Shape function for SparseReorder op.""" input_indices_shape = op.inputs[0].get_shape().with_rank(2) input_values_shape = op.inputs[1].get_shape().with_rank(1) unused_shape_shape = op.inputs[2].get_shape().with_rank(1) return [input_indices_shape, input_values_shape] @ops.RegisterShape("SparseToDense") def _SparseToDenseShape(op): input_shape = tensor_util.ConstantValue(op.inputs[1]) if input_shape is not None: if np.ndim(input_shape) > 1: raise ValueError("Input shape should be a vector") return [tensor_shape.TensorShape(input_shape.tolist())] else: input_shape_shape = op.inputs[1].get_shape().with_rank_at_most(1) return [tensor_shape.unknown_shape(ndims=input_shape_shape.num_elements())] def sparse_to_dense(sparse_indices, output_shape, sparse_values, default_value=0, name=None): """Converts a sparse representation into a dense tensor. Builds an array `dense` with shape `output_shape` such that ```python # If sparse_indices is scalar dense[i] = (i == sparse_indices ? sparse_values : default_value) # If sparse_indices is a vector, then for each i dense[sparse_indices[i]] = sparse_values[i] # If sparse_indices is an n by d matrix, then for each i in [0, n) dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] ``` All other values in `dense` are set to `default_value`. If `sparse_values` is a scalar, all sparse indices are set to this single value. Args: sparse_indices: A 0-D, 1-D, or 2-D `Tensor` of type `int32` or `int64`. `sparse_indices[i]` contains the complete index where `sparse_values[i]` will be placed. output_shape: A 1-D `Tensor` of the same type as `sparse_indices`. Shape of the dense output tensor. sparse_values: A 0-D or 1-D `Tensor`. Values corresponding to each row of `sparse_indices`, or a scalar value to be used for all sparse indices. default_value: A 0-D `Tensor` of the same type as `sparse_values`. Value to set for indices not specified in `sparse_indices`. Defaults to zero. name: A name for the operation (optional). Returns: Dense `Tensor` of shape `output_shape`. Has the same type as `sparse_values`. """ return gen_sparse_ops._sparse_to_dense(sparse_indices, output_shape, sparse_values, default_value, name=name) def sparse_tensor_to_dense(sp_input, default_value=0, name=None): """Converts a `SparseTensor` into a dense tensor. This op is a convenience wrapper around `sparse_to_dense` for `SparseTensor`s. For example, if `sp_input` has shape `[3, 5]` and non-empty string values: [0, 1]: a [0, 3]: b [2, 0]: c and `default_value` is `x`, then the output will be a dense `[3, 5]` string tensor with values: [[x a x b x] [x x x x x] [c x x x x]] Args: sp_input: The input `SparseTensor`. default_value: Scalar value to set for indices not specified in `sp_input`. Defaults to zero. name: A name prefix for the returned tensors (optional). Returns: A dense tensor with shape `sp_input.shape` and values specified by the non-empty values in `sp_input`. Indices not in `sp_input` are assigned `default_value`. Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor") return sparse_to_dense(sp_input.indices, sp_input.shape, sp_input.values, default_value, name=name) def sparse_to_indicator(sp_input, vocab_size, name=None): """Converts a `SparseTensor` of ids into a dense bool indicator tensor. The last dimension of `sp_input` is discarded and replaced with the values of `sp_input`. If `sp_input.shape = [D0, D1, ..., Dn, K]`, then `output.shape = [D0, D1, ..., Dn, vocab_size]`, where output[d_0, d_1, ..., d_n, sp_input[d_0, d_1, ..., d_n, k]] = True and False elsewhere in `output`. For example, if `sp_input.shape = [2, 3, 4]` with non-empty values: [0, 0, 0]: 0 [0, 1, 0]: 10 [1, 0, 3]: 103 [1, 1, 2]: 112 [1, 1, 3]: 113 [1, 2, 1]: 121 and `vocab_size = 200`, then the output will be a `[2, 3, 200]` dense bool tensor with False everywhere except at positions (0, 0, 0), (0, 1, 10), (1, 0, 103), (1, 1, 112), (1, 1, 113), (1, 2, 121). This op is useful for converting `SparseTensor`s into dense formats for compatibility with ops that expect dense tensors. The input `SparseTensor` must be in row-major order. Args: sp_input: A `SparseTensor` of type `int32` or `int64`. vocab_size: The new size of the last dimension, with `all(0 <= sp_input.values < vocab_size)`. name: A name prefix for the returned tensors (optional) Returns: A dense bool indicator tensor representing the indices with specified value. Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor") with ops.op_scope([sp_input], name, "SparseToIndicator") as name: indices_shape = array_ops.shape(sp_input.indices) num_entries = indices_shape[0] rank = indices_shape[1] ids = sp_input.values if ids.dtype != dtypes.int64: ids = math_ops.cast(ids, dtypes.int64) # Slice off the last dimension of indices, then then tack on the ids indices_columns_to_preserve = array_ops.slice( sp_input.indices, [0, 0], array_ops.pack([-1, rank - 1])) new_indices = array_ops.concat( 1, [indices_columns_to_preserve, array_ops.reshape(ids, [-1, 1])]) new_values = array_ops.fill(array_ops.expand_dims(num_entries, 0), True) new_shape = array_ops.concat( 0, [array_ops.slice(sp_input.shape, [0], array_ops.expand_dims(rank - 1, 0)), [vocab_size]]) sp_new = ops.SparseTensor(new_indices, new_values, new_shape) return sparse_tensor_to_dense(sp_new, False, name=name) def sparse_retain(sp_input, to_retain): """Retains specified non-empty values within a `SparseTensor`. For example, if `sp_input` has shape `[4, 5]` and 4 non-empty string values: [0, 1]: a [0, 3]: b [2, 0]: c [3, 1]: d and `to_retain = [True, False, False, True]`, then the output will be a `SparseTensor` of shape `[4, 5]` with 2 non-empty values: [0, 1]: a [3, 1]: d Args: sp_input: The input `SparseTensor` with `N` non-empty elements. to_retain: A bool vector of length `N` with `M` true values. Returns: A `SparseTensor` with the same shape as the input and `M` non-empty elements corresponding to the true positions in `to_retain`. Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor") to_retain = ops.convert_to_tensor(to_retain) # Shape checking, if shape is known at graph construction time retain_shape = to_retain.get_shape() retain_shape.assert_has_rank(1) sp_input.values.get_shape()[0].merge_with(retain_shape[0]) where_true = array_ops.reshape(array_ops.where(to_retain), [-1]) new_indices = array_ops.gather(sp_input.indices, where_true) new_values = array_ops.gather(sp_input.values, where_true) return ops.SparseTensor( new_indices, new_values, array_ops.identity(sp_input.shape)) def sparse_fill_empty_rows(sp_input, default_value, name=None): """Fills empty rows in the input 2-D `SparseTensor` with a default value. This op adds entries with the specified `default_value` at index `[row, 0]` for any row in the input that does not already have a value. For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: [0, 1]: a [0, 3]: b [2, 0]: c [3, 1]: d Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: [0, 1]: a [0, 3]: b [1, 0]: default_value [2, 0]: c [3, 1]: d [4, 0]: default_value Note that the input may have empty columns at the end, with no effect on this op. The output `SparseTensor` will be in row-major order and will have the same shape as the input. This op also returns an indicator vector such that empty_row_indicator[i] = True iff row i was an empty row. Args: sp_input: A `SparseTensor` with shape `[N, M]`. default_value: The value to fill for empty rows, with the same type as `sp_input.` name: A name prefix for the returned tensors (optional) Returns: sp_ordered_output: A `SparseTensor` with shape `[N, M]`, and with all empty rows filled in with `default_value`. empty_row_indicator: A bool vector of length `N` indicating whether each input row was empty. Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor") with ops.op_scope([sp_input], name, "SparseFillEmptyRows"): default_value = ops.convert_to_tensor( default_value, dtype=sp_input.values.dtype) num_rows = math_ops.cast(sp_input.shape[0], dtypes.int32) all_row_indices = math_ops.cast(math_ops.range(num_rows), dtypes.int64) empty_row_indices, _ = array_ops.list_diff( all_row_indices, sp_input.indices[:, 0]) empty_row_indicator = sparse_to_dense( empty_row_indices, array_ops.expand_dims(sp_input.shape[0], -1), True, False) empty_row_indices_as_column = array_ops.reshape(empty_row_indices, [-1, 1]) additional_indices = array_ops.concat( 1, [empty_row_indices_as_column, array_ops.zeros_like(empty_row_indices_as_column)]) additional_values = array_ops.fill(array_ops.shape(empty_row_indices), default_value) all_indices_unordered = array_ops.concat( 0, [sp_input.indices, additional_indices]) all_values_unordered = array_ops.concat( 0, [sp_input.values, additional_values]) sp_unordered_output = ops.SparseTensor( all_indices_unordered, all_values_unordered, sp_input.shape) sp_ordered_output = sparse_reorder(sp_unordered_output) return sp_ordered_output, empty_row_indicator def serialize_sparse(sp_input, name=None): """Serialize a `SparseTensor` into a string 3-vector (1-D `Tensor`) object. Args: sp_input: The input `SparseTensor`. name: A name prefix for the returned tensors (optional). Returns: A string 3-vector (1D `Tensor`), with each column representing the serialized `SparseTensor`'s indices, values, and shape (respectively). Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor.") return gen_sparse_ops._serialize_sparse( sp_input.indices, sp_input.values, sp_input.shape, name=name) @ops.RegisterShape("SerializeSparse") def _SerializeSparseShape(op): # pylint: disable=invalid-name """Shape function for SerializeSparse op.""" op.inputs[0].get_shape().with_rank(2) op.inputs[1].get_shape().with_rank(1) op.inputs[2].get_shape().with_rank(1) return [tensor_shape.vector(3)] def serialize_many_sparse(sp_input, name=None): """Serialize an `N`-minibatch `SparseTensor` into an `[N, 3]` string `Tensor`. The `SparseTensor` must have rank `R` greater than 1, and the first dimension is treated as the minibatch dimension. Elements of the `SparseTensor` must be sorted in increasing order of this first dimension. The serialized `SparseTensor` objects going into each row of the output `Tensor` will have rank `R-1`. The minibatch size `N` is extracted from `sparse_shape[0]`. Args: sp_input: The input rank `R` `SparseTensor`. name: A name prefix for the returned tensors (optional). Returns: A string matrix (2-D `Tensor`) with `N` rows and `3` columns. Each column represents serialized `SparseTensor`'s indices, values, and shape (respectively). Raises: TypeError: If `sp_input` is not a `SparseTensor`. """ if not isinstance(sp_input, ops.SparseTensor): raise TypeError("Input must be a SparseTensor.") return gen_sparse_ops._serialize_many_sparse( sp_input.indices, sp_input.values, sp_input.shape, name=name) @ops.RegisterShape("SerializeManySparse") def _SerializeManySparseShape(op): # pylint: disable=invalid-name """Shape function for SerializeSparse op.""" op.inputs[0].get_shape().with_rank(2) op.inputs[1].get_shape().with_rank(1) op.inputs[2].get_shape().with_rank(1) return [tensor_shape.matrix(None, 3)] def deserialize_many_sparse(serialized_sparse, dtype, name=None): """Deserialize and concatenate `SparseTensors` from a serialized minibatch. The input `serialized_sparse` must be a string matrix of shape `[N x 3]` where `N` is the minibatch size and the rows correspond to packed outputs of `serialize_sparse`. The ranks of the original `SparseTensor` objects must all match. When the final `SparseTensor` is created, it has rank one higher than the ranks of the incoming `SparseTensor` objects (they have been concatenated along a new row dimension). The output `SparseTensor` object's shape values for all dimensions but the first are the max across the input `SparseTensor` objects' shape values for the corresponding dimensions. Its first shape value is `N`, the minibatch size. The input `SparseTensor` objects' indices are assumed ordered in standard lexicographic order. If this is not the case, after this step run `sparse_reorder` to restore index ordering. For example, if the serialized input is a `[2, 3]` matrix representing two original `SparseTensor` objects: index = [ 0] [10] [20] values = [1, 2, 3] shape = [50] and index = [ 2] [10] values = [4, 5] shape = [30] then the final deserialized `SparseTensor` will be: index = [0 0] [0 10] [0 20] [1 2] [1 10] values = [1, 2, 3, 4, 5] shape = [2 50] Args: serialized_sparse: 2-D `Tensor` of type `string` of shape `[N, 3]`. The serialized and packed `SparseTensor' objects. dtype: The `dtype` of the serialized `SparseTensor` objects. name: A name prefix for the returned tensors (optional) Returns: A `SparseTensor` representing the deserialized `SparseTensor`s, concatenated along the `SparseTensor`s' first dimension. All of the serialized `SparseTensor`s must have had the same rank and type. """ output_indices, output_values, output_shape = ( gen_sparse_ops._deserialize_many_sparse( serialized_sparse, dtype, name=name)) return ops.SparseTensor(output_indices, output_values, output_shape) @ops.RegisterShape("DeserializeManySparse") def _DeserializeSparseShape(op): # pylint: disable=invalid-name """Shape function for DeserializeManySparse op.""" serialized_sparse_shape = op.inputs[0].get_shape().with_rank(2) serialized_sparse_shape.merge_with( tensor_shape.TensorShape([None, 3])) return [tensor_shape.matrix(None, None), tensor_shape.vector(None), tensor_shape.vector(None)]
apache-2.0
janocat/odoo
addons/project_timesheet/__init__.py
441
1084
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import project_timesheet import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
skrzym/monday-morning-quarterback
Research/report.py
1
13031
from matplotlib import pyplot as plt import matplotlib.ticker as plticker import seaborn as sns import pandas as pd import numpy as np import math import warnings from collections import Counter import nfldatatools as nfltools rs_pbp = nfltools.gather_data(playoffs=False) po_pbp = nfltools.gather_data(playoffs=True) sns.set_style("whitegrid") #Set general plot properties sns.set_style("white", {"axes.grid": True}) sns.set_context({"figure.figsize": (10, 7)}) ################################################ # Figure 1 - HeatMap def fig1(): filters=[ ['Season', 2009, '>='] ] yard_grouping = 10 fig,(ax1, ax2) = plt.subplots(1,2,figsize=(15,10)) nfltools.plotPassingHeatMap(rs_pbp, filters=filters, ax=ax1, yard_grouping=yard_grouping) nfltools.plotPassingHeatMap(po_pbp, filters=filters, ax=ax2, yard_grouping=yard_grouping) return fig figure_1 = fig1() ############################################################### # Figure 1 - HeatMap def match(playtype): valid_play_types = [ 'Field Goal', 'Pass', 'Run', 'QB Kneel', 'Punt', 'Extra Point', 'Sack', 'Spike', 'Timeout' ] return playtype in valid_play_types def condense_pbp_data(df): new_df = df[['qtr', 'down', 'TimeUnder','TimeSecs', 'yrdline100', 'ScoreDiff', 'PlayType','Season']] new_df = new_df[new_df.PlayType.map(match)] new_df = new_df[new_df['down'].isnull()==False] return new_df playoffs = condense_pbp_data(po_pbp) regular = condense_pbp_data(rs_pbp) def makeDF(season=2009): rdf = regular#[regular.Season==season] rdf = rdf.groupby('PlayType').agg({'qtr':len}).reset_index() rdf.columns = ['PlayType', 'Count'] rdf['Percent Total'] = rdf.Count/rdf.Count.sum()*100 rdf['ID'] = 'Regular' pdf = playoffs[playoffs.Season==season] pdf = pdf.groupby('PlayType').agg({'qtr':len}).reset_index() pdf.columns = ['PlayType', 'Count'] pdf['Percent Total'] = pdf.Count/pdf.Count.sum()*100 pdf['ID'] = 'Playoffs' x = rdf.append(pdf, ignore_index=True) fig, ax1 = plt.subplots(1,1,figsize=(12,10)) sns.barplot(ax=ax1, data=x, y='PlayType', x='Percent Total',hue='ID', order=['Pass', 'Run', 'Punt', 'Field Goal', 'QB Kneel']) ax1.set_xlim(0,60) return fig figure_2 = makeDF() ############################################################### # Figure 1 - HeatMap def fig3(): sns.set_style('whitegrid') sns.set_palette(['blue', 'green','red']) fig, axes = plt.subplots(2, 1, figsize=(15,15)) shade = True bw = '2' sns.kdeplot(ax=axes[0],data=rs_pbp[rs_pbp.PlayType == 'Pass'].ScoreDiff.dropna(),label='Pass',shade=shade,bw=bw) sns.kdeplot(ax=axes[0],data=rs_pbp[rs_pbp.PlayType == 'Run'].ScoreDiff.dropna(),label='Run',shade=shade,bw=bw) sns.kdeplot(ax=axes[0],data=rs_pbp[rs_pbp.PlayType == 'Extra Point'].ScoreDiff.dropna(),label='Extra Point',shade=shade,bw=bw) axes[0].set_xlim(-40,40) axes[0].set_ylim(0,0.09) sns.kdeplot(ax=axes[1],data=po_pbp[po_pbp.PlayType == 'Pass'].ScoreDiff.dropna(),label='Pass',shade=shade,bw=bw) sns.kdeplot(ax=axes[1],data=po_pbp[po_pbp.PlayType == 'Run'].ScoreDiff.dropna(),label='Run',shade=shade,bw=bw) sns.kdeplot(ax=axes[1],data=po_pbp[po_pbp.PlayType == 'Extra Point'].ScoreDiff.dropna(),label='Extra Point',shade=shade,bw=bw) axes[1].set_xlim(-40,40) axes[1].set_ylim(0,0.09) #SMOOTH IT OUT! return fig figure_3 = fig3() ############################################################### # Figure 1 - HeatMap def plot_PlayType(df,stat,playtypelist=['Pass','Run','Field Goal','QB Kneel','Punt'],percent_total=False): g = df.groupby([stat,'PlayType']).count().reset_index() g = g[g.columns[0:3]] last_col_name = g.columns[-1] g1 = g.groupby([stat, 'PlayType']).agg({last_col_name: 'sum'}) if percent_total: g1 = g1.groupby(level=1).apply(lambda x: 100 * x / float(x.sum())) g1 = g1.reset_index() g1 = g1[g1.PlayType.apply(lambda x: x in playtypelist)] return sns.barplot(x=stat, y=last_col_name, hue="PlayType", data=g1) def fig4(): fig = plt.figure(figsize=(16,32)) ax3 = fig.add_subplot(513) ax3 = plot_PlayType(regular,'qtr',['Run','Pass'],False) ax4 = fig.add_subplot(514) ax4 = plot_PlayType(regular,'yrdline100',['Run','Pass'],False) ax4.xaxis.set_ticks(range(4, 99, 5)) ax4.xaxis.set_ticklabels(range(5,100,5)) ax4.grid(True,'major','both') return fig figure_4 = fig4() ############################################################### # Figure 1 - HeatMap def fig5(): fig, axes = plt.subplots(2,1,figsize=(14,7)) sns.kdeplot(ax=axes[0],data=regular[regular.PlayType == 'Pass'].TimeSecs,bw=20,label='Pass') sns.kdeplot(ax=axes[0],data=regular[regular.PlayType == 'Run'].TimeSecs,bw=20,label='Run') loc = plticker.MultipleLocator(base=120.0) # this locator puts ticks at regular intervals axes[0].xaxis.set_major_locator(loc) axes[0].set_xlim(0,3600) axes[0].set_ylim(0,0.00085) axes[0].vlines([x*60 for x in [15,30,45]],0,0.0009,colors='black') axes[0].grid(True,'major','y') axes[0].grid(False,'major','x') sns.kdeplot(ax=axes[1],data=playoffs[playoffs.PlayType == 'Pass'].TimeSecs,bw=20,label='Pass') sns.kdeplot(ax=axes[1],data=playoffs[playoffs.PlayType == 'Run'].TimeSecs,bw=20,label='Run') loc = plticker.MultipleLocator(base=120.0) # this locator puts ticks at regular intervals axes[1].xaxis.set_major_locator(loc) axes[1].set_xlim(0,3600) axes[1].set_ylim(0,0.00085) axes[1].vlines([x*60 for x in [15,30,45]],0,0.0009,colors='black') axes[1].grid(True,'major','y') axes[1].grid(False,'major','x') return fig figure_5 = fig5() ################################################################# # Figure 1 - HeatMap def fig6(): rs_fg = rs_pbp[rs_pbp.PlayType =='Field Goal'].groupby('FieldGoalResult').agg({'Date':len}).reset_index() rs_fg.columns=['FieldGoalResult', 'Count'] rs_fg['Percent Total'] = rs_fg.Count.apply(lambda x: 100 * x / float(rs_fg.Count.sum())) po_fg = po_pbp[po_pbp.PlayType =='Field Goal'].groupby('FieldGoalResult').agg({'Date':len}).reset_index() po_fg.columns=['FieldGoalResult', 'Count'] po_fg['Percent Total'] = po_fg.Count.apply(lambda x: 100 * x / float(po_fg.Count.sum())) sns.set_palette(['green', 'orange', 'red']) fig, axes = plt.subplots(2, 2,sharey=True,figsize=(14,7)) order = ['Good','Blocked','No Good'] sns.violinplot(ax=axes[0][0], data=rs_pbp[rs_pbp.PlayType=='Field Goal'], x='FieldGoalDistance', y='FieldGoalResult',order=order, scale='width', bw=0.05) sns.violinplot(ax=axes[1][0], data=po_pbp[po_pbp.PlayType=='Field Goal'], x='FieldGoalDistance', y='FieldGoalResult',order=order, scale='width', bw=0.05) axes[0][0].set_xlim(0,100) axes[1][0].set_xlim(0,100) sns.barplot(ax=axes[0][1], data=rs_fg,y='FieldGoalResult', x='Percent Total',order=order) sns.barplot(ax=axes[1][1], data=po_fg,y='FieldGoalResult', x='Percent Total',order=order) axes[0][1].set_xlim(0,100) axes[1][1].set_xlim(0,100) axes[0][1].set_xticklabels(['0%','20%','40%','60%','80%','100%']) axes[1][1].set_xticklabels(['0%','20%','40%','60%','80%','100%']) axes[0][0].set_title('Field Goal Results by Distance') axes[0][0].set_xlabel('') axes[0][0].set_ylabel('Regular Season') axes[0][1].set_title('Field Goal Results Distribution') axes[0][1].set_xlabel('') axes[0][1].set_ylabel('') axes[1][0].set_ylabel('Playoffs') axes[1][0].set_xlabel('Field Goal Distance (yds)') axes[1][0].figure axes[1][1].set_ylabel('') axes[1][1].set_xlabel('Percent Total') return fig figure_6 = fig6() ##################################################################### # Figure 1 - HeatMap teams = [['ARI', 'Arizona', 'Cardinals', 'Arizona Cardinals'], ['ATL', 'Atlanta', 'Falcons', 'Atlanta Falcons'], ['BAL', 'Baltimore', 'Ravens', 'Baltimore Ravens'], ['BUF', 'Buffalo', 'Bills', 'Buffalo Bills'], ['CAR', 'Carolina', 'Panthers', 'Carolina Panthers'], ['CHI', 'Chicago', 'Bears', 'Chicago Bears'], ['CIN', 'Cincinnati', 'Bengals', 'Cincinnati Bengals'], ['CLE', 'Cleveland', 'Browns', 'Cleveland Browns'], ['DAL', 'Dallas', 'Cowboys', 'Dallas Cowboys'], ['DEN', 'Denver', 'Broncos', 'Denver Broncos'], ['DET', 'Detroit', 'Lions', 'Detroit Lions'], ['GB', 'Green Bay', 'Packers', 'Green Bay Packers', 'G.B.', 'GNB'], ['HOU', 'Houston', 'Texans', 'Houston Texans'], ['IND', 'Indianapolis', 'Colts', 'Indianapolis Colts'], ['JAC', 'Jacksonville', 'Jaguars', 'Jacksonville Jaguars', 'JAX'], ['KC', 'Kansas City', 'Chiefs', 'Kansas City Chiefs', 'K.C.', 'KAN'], ['LA', 'Los Angeles', 'Rams', 'Los Angeles Rams', 'L.A.'], ['MIA', 'Miami', 'Dolphins', 'Miami Dolphins'], ['MIN', 'Minnesota', 'Vikings', 'Minnesota Vikings'], ['NE', 'New England', 'Patriots', 'New England Patriots', 'N.E.', 'NWE'], ['NO', 'New Orleans', 'Saints', 'New Orleans Saints', 'N.O.', 'NOR'], ['NYG', 'Giants', 'New York Giants', 'N.Y.G.'], ['NYJ', 'Jets', 'New York Jets', 'N.Y.J.'], ['OAK', 'Oakland', 'Raiders', 'Oakland Raiders'], ['PHI', 'Philadelphia', 'Eagles', 'Philadelphia Eagles'], ['PIT', 'Pittsburgh', 'Steelers', 'Pittsburgh Steelers'], ['SD', 'San Diego', 'Chargers', 'San Diego Chargers', 'S.D.', 'SDG'], ['SEA', 'Seattle', 'Seahawks', 'Seattle Seahawks'], ['SF', 'San Francisco', '49ers', 'San Francisco 49ers', 'S.F.', 'SFO'], ['STL', 'St. Louis', 'Rams', 'St. Louis Rams', 'S.T.L.'], ['TB', 'Tampa Bay', 'Buccaneers', 'Tampa Bay Buccaneers', 'T.B.', 'TAM'], ['TEN', 'Tennessee', 'Titans', 'Tennessee Titans'], ['WAS', 'Washington', 'Redskins', 'Washington Redskins', 'WSH']] teams_dict = {x[3]:x[0] for x in teams} # Jacksonville Data Fix rs_pbp.posteam = rs_pbp.posteam.replace('JAX', 'JAC') rs_pbp.HomeTeam = rs_pbp.HomeTeam.replace('JAX', 'JAC') rs_pbp.AwayTeam = rs_pbp.AwayTeam.replace('JAX', 'JAC') pass_rush_attempts_by_team = rs_pbp.groupby(['posteam','Season']).agg(sum)[['PassAttempt','RushAttempt']] pass_rush_attempts_by_team['PassRushRatio'] = pass_rush_attempts_by_team.apply(lambda x: (x.PassAttempt * 1.0) / x.RushAttempt, axis=1) sns.set_palette('muted') plot_df = pass_rush_attempts_by_team plot_teams = teams_dict def plotPassRushByTeam(team_focus_1, team_focus_2): fig,ax = plt.subplots(1,1,figsize=(15,8)) for team in plot_teams: if (plot_teams[team] != team_focus_1) or (plot_teams[team] != team_focus_1): plt.plot(plot_df.loc[plot_teams[team]]['PassRushRatio'], color='0.91') plt.plot(plot_df.loc[team_focus_1]['PassRushRatio'], color='Blue', axes=ax) plt.plot(plot_df.loc[team_focus_2]['PassRushRatio'], color='Red', axes=ax) return fig def fig7(): sns.set_style('white') return plotPassRushByTeam(team_focus_1 = 'NYG', team_focus_2 = 'NYJ') figure_7 = fig7() ########################################################## # Figure 1 - HeatMap playoff_teams = {year:po_pbp.mask('Season',year).posteam.dropna().unique().tolist() for year in np.arange(2009,2017,1)} def madeit(row): team, season = row.name return int(team in playoff_teams[season]) next_df = pass_rush_attempts_by_team.copy() next_df['PO'] = next_df.apply(madeit, axis=1) next_df.reset_index().groupby(['posteam','PO']).agg({'PassRushRatio':np.mean}).reset_index().pivot('posteam','PO','PassRushRatio') def fig8(): sns.set_context('talk') #sns.heatmap(data = pass_rush_attempts_by_team.reset_index().pivot('posteam','PO','PassRushRatio'), # vmin=0,vmax=1,square=False,cmap='rainbow', annot=False) fig,ax = plt.subplots(1,1) new_df = next_df.reset_index().groupby(['posteam','PO']).agg({'PassRushRatio':np.mean}).reset_index().pivot('posteam','PO','PassRushRatio') sns.heatmap(data = new_df, square=False, annot=False, cmap='Greens') return fig figure_8 = fig8() ############################################################ def fig9(): fig,ax = plt.subplots(1,1) pass_rush_attempts_by_team.loc['DEN']['PassRushRatio'].plot() return fig figure_9 = fig9() ############################################################# def fig10(): fig, ax = plt.subplots(1,1,figsize=(3,5)) sns.boxplot(data=next_df.reset_index(),x='PO', y='PassRushRatio', ax=ax) return fig figure_10 = fig10() ############################################################# avg_prr_by_team = pass_rush_attempts_by_team.reset_index().groupby('posteam').agg({'PassRushRatio':np.mean}).sort_values('PassRushRatio') avg_prr_by_season = pass_rush_attempts_by_team.reset_index().groupby('Season').agg({'PassRushRatio':np.mean}).sort_values('PassRushRatio') def fig11(): with sns.axes_style('ticks'): fig,ax = plt.subplots(1,1,figsize=(20,7)) sns.boxplot(data=next_df.reset_index(),x='posteam', y='PassRushRatio', ax=ax, order=avg_prr_by_team.index.tolist(),hue='PO') return fig figure_11 = fig11()
mit
namecoin/namecoin-core
contrib/zmq/zmq_sub.py
28
3470
#!/usr/bin/env python3 # Copyright (c) 2014-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ ZMQ example using python3's asyncio Bitcoin should be started with the command line arguments: bitcoind -testnet -daemon \ -zmqpubrawtx=tcp://127.0.0.1:28332 \ -zmqpubrawblock=tcp://127.0.0.1:28332 \ -zmqpubhashtx=tcp://127.0.0.1:28332 \ -zmqpubhashblock=tcp://127.0.0.1:28332 \ -zmqpubsequence=tcp://127.0.0.1:28332 We use the asyncio library here. `self.handle()` installs itself as a future at the end of the function. Since it never returns with the event loop having an empty stack of futures, this creates an infinite loop. An alternative is to wrap the contents of `handle` inside `while True`. A blocking example using python 2.7 can be obtained from the git history: https://github.com/bitcoin/bitcoin/blob/37a7fe9e440b83e2364d5498931253937abe9294/contrib/zmq/zmq_sub.py """ import binascii import asyncio import zmq import zmq.asyncio import signal import struct import sys if (sys.version_info.major, sys.version_info.minor) < (3, 5): print("This example only works with Python 3.5 and greater") sys.exit(1) port = 28332 class ZMQHandler(): def __init__(self): self.loop = asyncio.get_event_loop() self.zmqContext = zmq.asyncio.Context() self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) self.zmqSubSocket.setsockopt(zmq.RCVHWM, 0) self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashblock") self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "hashtx") self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawblock") self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "rawtx") self.zmqSubSocket.setsockopt_string(zmq.SUBSCRIBE, "sequence") self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % port) async def handle(self) : topic, body, seq = await self.zmqSubSocket.recv_multipart() sequence = "Unknown" if len(seq) == 4: sequence = str(struct.unpack('<I', seq)[-1]) if topic == b"hashblock": print('- HASH BLOCK ('+sequence+') -') print(binascii.hexlify(body)) elif topic == b"hashtx": print('- HASH TX ('+sequence+') -') print(binascii.hexlify(body)) elif topic == b"rawblock": print('- RAW BLOCK HEADER ('+sequence+') -') print(binascii.hexlify(body[:80])) elif topic == b"rawtx": print('- RAW TX ('+sequence+') -') print(binascii.hexlify(body)) elif topic == b"sequence": hash = binascii.hexlify(body[:32]) label = chr(body[32]) mempool_sequence = None if len(body) != 32+1+8 else struct.unpack("<Q", body[32+1:])[0] print('- SEQUENCE ('+sequence+') -') print(hash, label, mempool_sequence) # schedule ourselves to receive the next message asyncio.ensure_future(self.handle()) def start(self): self.loop.add_signal_handler(signal.SIGINT, self.stop) self.loop.create_task(self.handle()) self.loop.run_forever() def stop(self): self.loop.stop() self.zmqContext.destroy() daemon = ZMQHandler() daemon.start()
mit
qpxu007/luigi
luigi/parameter.py
1
22062
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ''' Parameters are one of the core concepts of Luigi. All Parameters sit on :class:`~luigi.task.Task` classes. See :ref:`Parameter` for more info on how to define parameters. ''' import abc import datetime import warnings try: from ConfigParser import NoOptionError, NoSectionError except ImportError: from configparser import NoOptionError, NoSectionError from luigi import task_register from luigi import six from luigi import configuration from luigi.deprecate_kwarg import deprecate_kwarg _no_value = object() class ParameterException(Exception): """ Base exception. """ pass class MissingParameterException(ParameterException): """ Exception signifying that there was a missing Parameter. """ pass class UnknownParameterException(ParameterException): """ Exception signifying that an unknown Parameter was supplied. """ pass class DuplicateParameterException(ParameterException): """ Exception signifying that a Parameter was specified multiple times. """ pass class UnknownConfigException(ParameterException): """ Exception signifying that the ``config_path`` for the Parameter could not be found. """ pass class Parameter(object): """ An untyped Parameter Parameters are objects set on the Task class level to make it possible to parameterize tasks. For instance: class MyTask(luigi.Task): foo = luigi.Parameter() This makes it possible to instantiate multiple tasks, eg ``MyTask(foo='bar')`` and ``MyTask(foo='baz')``. The task will then have the ``foo`` attribute set appropriately. There are subclasses of ``Parameter`` that define what type the parameter has. This is not enforced within Python, but are used for command line interaction. When a task is instantiated, it will first use any argument as the value of the parameter, eg. if you instantiate a = TaskA(x=44) then a.x == 44. If this does not exist, it will use the value of the Parameter object, which is defined on a class level. This will be resolved in this order of falling priority: * Any value provided on the command line on the class level (eg. ``--TaskA-param xyz``) * Any value provided via config (using the ``config_path`` argument) * Any default value set using the ``default`` flag. """ counter = 0 """non-atomically increasing counter used for ordering parameters.""" @deprecate_kwarg('is_boolean', 'is_bool', False) def __init__(self, default=_no_value, is_boolean=False, is_global=False, significant=True, description=None, config_path=None, positional=True): """ :param default: the default value for this parameter. This should match the type of the Parameter, i.e. ``datetime.date`` for ``DateParameter`` or ``int`` for ``IntParameter``. By default, no default is stored and the value must be specified at runtime. :param bool is_bool: specify ``True`` if the parameter is a bool value. Default: ``False``. Bool's have an implicit default value of ``False``. :param bool significant: specify ``False`` if the parameter should not be treated as part of the unique identifier for a Task. An insignificant Parameter might also be used to specify a password or other sensitive information that should not be made public via the scheduler. Default: ``True``. :param str description: A human-readable string describing the purpose of this Parameter. For command-line invocations, this will be used as the `help` string shown to users. Default: ``None``. :param dict config_path: a dictionary with entries ``section`` and ``name`` specifying a config file entry from which to read the default value for this parameter. DEPRECATED. Default: ``None``. :param bool positional: If true, you can set the argument as a positional argument. Generally we recommend ``positional=False`` as positional arguments become very tricky when you have inheritance and whatnot. """ # The default default is no default self.__default = default self.__global = _no_value self.is_bool = is_boolean # Only BoolParameter should ever use this. TODO(erikbern): should we raise some kind of exception? if is_global: warnings.warn("is_global support is removed. Assuming positional=False", DeprecationWarning, stacklevel=2) positional = False self.significant = significant # Whether different values for this parameter will differentiate otherwise equal tasks self.positional = positional self.description = description if config_path is not None and ('section' not in config_path or 'name' not in config_path): raise ParameterException('config_path must be a hash containing entries for section and name') self.__config = config_path self.counter = Parameter.counter # We need to keep track of this to get the order right (see Task class) Parameter.counter += 1 def _get_value_from_config(self, section, name): """Loads the default from the config. Returns _no_value if it doesn't exist""" conf = configuration.get_config() try: value = conf.get(section, name) except (NoSectionError, NoOptionError): return _no_value return self.parse(value) def _get_value(self, task_name=None, param_name=None): if self.__global != _no_value: return self.__global if task_name and param_name: v = self._get_value_from_config(task_name, param_name) if v != _no_value: return v v = self._get_value_from_config(task_name, param_name.replace('_', '-')) if v != _no_value: warnings.warn( 'The use of the configuration [%s] %s (with dashes) should be avoided. Please use underscores.' % (task_name, param_name), DeprecationWarning, stacklevel=2) return v if self.__config: v = self._get_value_from_config(self.__config['section'], self.__config['name']) if v != _no_value and task_name and param_name: warnings.warn( 'The use of the configuration [%s] %s is deprecated. Please use [%s] %s' % (self.__config['section'], self.__config['name'], task_name, param_name), DeprecationWarning, stacklevel=2) if v != _no_value: return v if self.__default != _no_value: return self.__default return _no_value @property def has_value(self): """ ``True`` if a default was specified or if config_path references a valid entry in the conf. Note that "value" refers to the Parameter object itself - it can be either 1. The default value for this parameter 2. A value read from the config 3. A global value Any Task instance can have its own value set that overrides this. """ return self._get_value() != _no_value @property def value(self): """ The value for this Parameter. This refers to any value defined by a default, a config option, or a global value. :raises MissingParameterException: if a value is not set. :return: the parsed value. """ value = self._get_value() if value == _no_value: raise MissingParameterException("No default specified") else: return value def has_task_value(self, task_name, param_name): return self._get_value(task_name, param_name) != _no_value def task_value(self, task_name, param_name): value = self._get_value(task_name, param_name) if value == _no_value: raise MissingParameterException("No default specified") else: return value def set_global(self, value): """ Set the global value of this Parameter. :param value: the new global value. """ self.__global = value def reset_global(self): self.__global = _no_value def parse(self, x): """ Parse an individual value from the input. The default implementation is an identify (it returns ``x``), but subclasses should override this method for specialized parsing. This method is called by :py:meth:`parse_from_input` if ``x`` exists. :param str x: the value to parse. :return: the parsed value. """ return x # default impl def serialize(self, x): # opposite of parse """ Opposite of :py:meth:`parse`. Converts the value ``x`` to a string. :param x: the value to serialize. """ return str(x) def parse_from_input(self, param_name, x, task_name=None): """ Parses the parameter value from input ``x``, handling defaults. :param param_name: the name of the parameter. This is used for the message in ``MissingParameterException``. :param x: the input value to parse. :raises MissingParameterException: if x is false-y and no default is specified. """ if not x: if self.has_task_value(param_name=param_name, task_name=task_name): return self.task_value(param_name=param_name, task_name=task_name) elif self.is_bool: return False else: raise MissingParameterException("No value for '%s' (%s) submitted and no default value has been assigned." % (param_name, "--" + param_name.replace('_', '-'))) else: return self.parse(x) def serialize_to_input(self, x): return self.serialize(x) def parser_dest(self, param_name, task_name, glob=False, is_without_section=False): if is_without_section: if glob: return param_name else: return None else: if glob: return task_name + '_' + param_name else: return param_name def add_to_cmdline_parser(self, parser, param_name, task_name, glob=False, is_without_section=False): dest = self.parser_dest(param_name, task_name, glob, is_without_section=is_without_section) if not dest: return flag = '--' + dest.replace('_', '-') description = [] description.append('%s.%s' % (task_name, param_name)) if glob: description.append('for all instances of class %s' % task_name) elif self.description: description.append(self.description) if self.has_task_value(param_name=param_name, task_name=task_name): value = self.task_value(param_name=param_name, task_name=task_name) description.append(" [default: %s]" % (value,)) if self.is_bool: action = "store_true" else: action = "store" parser.add_argument(flag, help=' '.join(description), action=action, dest=dest) def parse_from_args(self, param_name, task_name, args, params): # Note: modifies arguments dest = self.parser_dest(param_name, task_name, glob=False) if dest is not None: value = getattr(args, dest, None) params[param_name] = self.parse_from_input(param_name, value, task_name=task_name) def set_global_from_args(self, param_name, task_name, args, is_without_section=False): # Note: side effects dest = self.parser_dest(param_name, task_name, glob=True, is_without_section=is_without_section) if dest is not None: value = getattr(args, dest, None) if value: self.set_global(self.parse_from_input(param_name, value, task_name=task_name)) else: # either False (bools) or None (everything else) self.reset_global() class DateParameterBase(Parameter): """ Base class Parameter for dates. Code reuse is made possible since all date parameters are serialized in the same way. """ @abc.abstractproperty def date_format(self): """ Override me with a :py:meth:`~datetime.date.strftime` string. """ pass def serialize(self, dt): """ Converts the date to a string using the :py:attr:`~DateParameterBase.date_format`. """ if dt is None: return str(dt) return dt.strftime(self.date_format) class DateParameter(DateParameterBase): """ Parameter whose value is a :py:class:`~datetime.date`. A DateParameter is a Date string formatted ``YYYY-MM-DD``. For example, ``2013-07-10`` specifies July 10, 2013. """ date_format = '%Y-%m-%d' def parse(self, s): """ Parses a date string formatted as ``YYYY-MM-DD``. """ return datetime.datetime.strptime(s, self.date_format).date() class MonthParameter(DateParameter): """ Parameter whose value is a :py:class:`~datetime.date`, specified to the month (day of :py:class:`~datetime.date` is "rounded" to first of the month). A MonthParameter is a Date string formatted ``YYYY-MM``. For example, ``2013-07`` specifies July of 2013. """ date_format = '%Y-%m' class YearParameter(DateParameter): """ Parameter whose value is a :py:class:`~datetime.date`, specified to the year (day and month of :py:class:`~datetime.date` is "rounded" to first day of the year). A YearParameter is a Date string formatted ``YYYY``. """ date_format = '%Y' class DateHourParameter(DateParameterBase): """ Parameter whose value is a :py:class:`~datetime.datetime` specified to the hour. A DateHourParameter is a `ISO 8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ formatted date and time specified to the hour. For example, ``2013-07-10T19`` specifies July 10, 2013 at 19:00. """ date_format = '%Y-%m-%dT%H' # ISO 8601 is to use 'T' def parse(self, s): """ Parses a string to a :py:class:`~datetime.datetime` using the format string ``%Y-%m-%dT%H``. """ return datetime.datetime.strptime(s, self.date_format) class DateMinuteParameter(DateHourParameter): """ Parameter whose value is a :py:class:`~datetime.datetime` specified to the minute. A DateMinuteParameter is a `ISO 8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ formatted date and time specified to the minute. For example, ``2013-07-10T1907`` specifies July 10, 2013 at 19:07. """ date_format = '%Y-%m-%dT%H%M' deprecated_date_format = '%Y-%m-%dT%HH%M' def parse(self, s): try: value = datetime.datetime.strptime(s, self.deprecated_date_format) warnings.warn( 'Using "H" between hours and minutes is deprecated, omit it instead.', DeprecationWarning, stacklevel=2 ) return value except ValueError: return super(DateMinuteParameter, self).parse(s) class IntParameter(Parameter): """ Parameter whose value is an ``int``. """ def parse(self, s): """ Parses an ``int`` from the string using ``int()``. """ return int(s) class FloatParameter(Parameter): """ Parameter whose value is a ``float``. """ def parse(self, s): """ Parses a ``float`` from the string using ``float()``. """ return float(s) class BoolParameter(Parameter): """ A Parameter whose value is a ``bool``. """ def __init__(self, *args, **kwargs): """ This constructor passes along args and kwargs to ctor for :py:class:`Parameter` but specifies ``is_bool=True``. """ super(BoolParameter, self).__init__(*args, is_bool=True, **kwargs) def parse(self, s): """ Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case. """ return {'true': True, 'false': False}[str(s).lower()] class BooleanParameter(BoolParameter): def __init__(self, *args, **kwargs): warnings.warn( 'BooleanParameter is deprecated, use BoolParameter instead', DeprecationWarning, stacklevel=2 ) super(BooleanParameter, self).__init__(*args, **kwargs) class DateIntervalParameter(Parameter): """ A Parameter whose value is a :py:class:`~luigi.date_interval.DateInterval`. Date Intervals are specified using the ISO 8601 `Time Interval <http://en.wikipedia.org/wiki/ISO_8601#Time_intervals>`_ notation. """ # Class that maps to/from dates using ISO 8601 standard # Also gives some helpful interval algebra def parse(self, s): """ Parses a `:py:class:`~luigi.date_interval.DateInterval` from the input. see :py:mod:`luigi.date_interval` for details on the parsing of DateIntervals. """ # TODO: can we use xml.utils.iso8601 or something similar? from luigi import date_interval as d for cls in [d.Year, d.Month, d.Week, d.Date, d.Custom]: i = cls.parse(s) if i: return i else: raise ValueError('Invalid date interval - could not be parsed') class TimeDeltaParameter(Parameter): """ Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHnMnS`` (each field optional, years and months not supported) * ISO 8601 duration ``PnW`` See https://en.wikipedia.org/wiki/ISO_8601#Durations """ def _apply_regex(self, regex, input): from datetime import timedelta import re re_match = re.match(regex, input) if re_match: kwargs = {} has_val = False for k, v in six.iteritems(re_match.groupdict(default="0")): val = int(v) has_val = has_val or val != 0 kwargs[k] = val if has_val: return timedelta(**kwargs) def _parseIso8601(self, input): def field(key): return "(?P<%s>\d+)%s" % (key, key[0].upper()) def optional_field(key): return "(%s)?" % field(key) # A little loose: ISO 8601 does not allow weeks in combination with other fields, but this regex does (as does python timedelta) regex = "P(%s|%s(T%s)?)" % (field("weeks"), optional_field("days"), "".join([optional_field(key) for key in ["hours", "minutes", "seconds"]])) return self._apply_regex(regex, input) def _parseSimple(self, input): keys = ["weeks", "days", "hours", "minutes", "seconds"] # Give the digits a regex group name from the keys, then look for text with the first letter of the key, # optionally followed by the rest of the word, with final char (the "s") optional regex = "".join(["((?P<%s>\d+) ?%s(%s)?(%s)? ?)?" % (k, k[0], k[1:-1], k[-1]) for k in keys]) return self._apply_regex(regex, input) def parse(self, input): """ Parses a time delta from the input. See :py:class:`TimeDeltaParameter` for details on supported formats. """ result = self._parseIso8601(input) if not result: result = self._parseSimple(input) if result: return result else: raise ParameterException("Invalid time delta - could not parse %s" % input) class TaskParameter(Parameter): """ A parameter that takes another luigi task class. When used programatically, the parameter should be specified directly with the :py:class:`luigi.task.Task` (sub) class. Like ``MyMetaTask(my_task_param=my_tasks.MyTask)``. On the command line, you specify the :py:attr:`luigi.task.Task.task_family`. Like .. code:: console $ luigi --module my_tasks MyMetaTask --my_task_param my_namespace.MyTask Where ``my_namespace.MyTask`` is defined in the ``my_tasks`` python module. When the :py:class:`luigi.task.Task` class is instantiated to an object. The value will always be a task class (and not a string). """ def parse(self, input): """ Parse a task_famly using the :class:`~luigi.task_register.Register` """ return task_register.Register.get_task_cls(input)
apache-2.0
jnphilipp/FCPM
fcpm.py
1
18629
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import getopt import operator import re import string import sys import time grammer = '' next = 0 nonterminal_symbol = '\\' recompress_symbol = '#' repair_pattern = '' repair_text = '' to_transform = '' verbose = False ################################################# ################################################## def main(argv): global grammer global nonterminal_symbol global recompress_symbol global repair_pattern global repair_text global to_transform global verbose try: opts, args = getopt.getopt(argv, 'hvg:t:p:r:n:f:', ['help', 'verbose', 'grammer=', 'repair_text=', 'repair_pattern=', 'recompress_symbol=', 'nonterminal_symbol=', 'transform=']) except getopt.GetoptError: help() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): help() sys.exit() elif opt in ("-v", "--verbose"): verbose = True elif opt in ("-g", "--grammer"): grammer = arg elif opt in ("-p", "--repair_pattern"): repair_pattern = arg elif opt in ("-t", "--repair_text"): repair_text = arg elif opt in ("-r", "--recompress_symbol"): recompress_symbol = arg elif opt in ("-n", "--nonterminal_symbol"): nonterminal_symbol = arg elif opt in ("-f", "--transform"): to_transform = arg if grammer == '' and (repair_text == '' or repair_pattern == '') and to_transform == '': help() sys.exit(2) def help(): print 'Fully Compressed Pattern Matching' print '' print 'Usage: fcpm.py [ OPTIONS ]\n' print 'Options supported by fcpm:' print ' -f or --transform\n Path to a repair to transform it' print ' -g or --grammer\n Path to the grammer file' print ' -h or --help\n Print this message' print ' -n or --nonterminal_symbol\n Symbol that indicats begin and end of a nonterminal\n default: \\' print ' -p or --repair_pattern\n Compressed pattern provied by the repair algorithm' print ' -r or --recompress_symbol\n Symbol that indicats begin and end of recompressed symbols\n default: #' print ' -t or --repair_text\n Compressed text provied by the repair algorithm' print ' -v or --verbose\n Enables detailed console output' ################################################## ################################################## def transform_repair(): global to_transform start_time = time.time() transformed = to_transform + '.transformed' current_index=0 read = open(to_transform, 'r') write = open(transformed, 'w') for line in read: s = string.replace(line, '\n', '').split(' -> ') current_index = int(s[0]) offset = 0 while len(re.findall((nonterminal_symbol + '[0-9]+?' + nonterminal_symbol).encode('string-escape'), s[1])) > 2: match = re.search((nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol).encode('string-escape'), s[1]) while match: write.write(str(current_index + offset) + ' -> ' + match.group(0) + '\n') s[1] = re.sub(re.escape(match.group(0)), (nonterminal_symbol + str(current_index + offset) + nonterminal_symbol).encode('string-escape'), s[1]) offset += 1 match = re.search((nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol).encode('string-escape'), s[1]) match = re.search(('(^.*?' + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + '.+?' + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + '.*?)(' + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol+ ')').encode('string-escape'), s[1]) if match: write.write(str(current_index + offset) + ' -> ' + match.group(1) + '\n') s[1] = re.sub(re.escape(match.group(1)), (nonterminal_symbol + str(current_index + offset) + nonterminal_symbol).encode('string-escape'), s[1]) offset += 1 write.write(str(current_index + offset) + ' -> ' + s[1] + '\n') read.close() write.close() elapsed_time = time.time() - start_time print 'File transformed.' print 'Time:', elapsed_time def load_grammer(): global grammer first = False g = [] m = 0 mn = 0 f = open(grammer, 'r') for line in f: if not first: s = line.split(';') m = int(s[0]) mn = int(s[1]) first = True else: if len(re.findall((nonterminal_symbol + '[0-9]+?' + nonterminal_symbol).encode('string-escape'), line)) > 2: print 'Grammer has the wrong format. Only two nonterminals are permitted on each right side.' sys.exit(1) else: g.append(string.replace(line, '\n', '')) f.close() return (g, m, mn) def load_repair_grammer(): global repair_text global repair_pattern first = False g = [] last_index = -1 m = 0 mn = 0 f = open(repair_pattern, 'r') for line in f: s = re.sub('\n', '', line).split(' -> ') if last_index + 1 == int(s[0]): g.append(s[1]) last_index = int(s[0]) else: for i in xrange(last_index + 1, int(s[0])): g.append('') g.append(s[1]) last_index = int(s[0]) f.close() m = last_index f = open(repair_text, 'r') for line in f: s = re.sub('\n', '', line).split(' -> ') if last_index + 1 == int(s[0]) + m + 1: g.append(modify_repair_nonterminals(s[1], m + 1)) last_index = int(s[0]) + m + 1 else: for i in xrange(last_index + 1, int(s[0]) + m + 1): g.append('') g.append(modify_repair_nonterminals(s[1], m + 1)) last_index = int(s[0]) + m + 1 f.close() mn = last_index return (g, m, mn) def modify_repair_nonterminals(rule, add): s = set(re.findall((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), rule)) nonterminals = list() for n in s: nonterminals.append(int(n)) nonterminals = sorted(nonterminals, reverse=True) for nonterminal in nonterminals: rule = re.sub((nonterminal_symbol + str(nonterminal) + nonterminal_symbol).encode('string-escape'), ('\\' + str(nonterminal + add) + '\\').encode('string-escape'), rule) return rule ################################################## ################################################## def is_terminal(symbol): if symbol == '': return False match = re.search((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), symbol) if match: return False else: return True def is_nonterminal(symbol): if symbol == '': return False match = re.search((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), symbol) if match: return True else: return False def val(g, index): if g[index] == '': return '' else: val_index = g[index] nonterminals = set(re.findall((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), g[index])) for nonterminal in nonterminals: val_index = re.sub((nonterminal_symbol + str(nonterminal) + nonterminal_symbol).encode('string-escape'), val(g, int(nonterminal)).encode('string-escape'), val_index) return val_index def print_rules(g): print '########################################' for i in xrange(len(g)): print i, ':', g[i] print '########################################' ################################################# ################################################# def next_symbol(g, nonterminal, prefix): if g[nonterminal] == '': return '' match = re.search(('^' + prefix + '((' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')|(' + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + ')|(.))').encode('string-escape'), g[nonterminal]) if match: return match.group(1) else: return '' def prev_symbol(g, nonterminal, suffix): if g[nonterminal] == '': return '' match = re.search(('((' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')|(' + nonterminal_symbol + '[0-9]+?' + nonterminal_symbol + ')|(.))' + suffix + '$').encode('string-escape'), g[nonterminal]) if match: return match.group(1) else: return '' def all_letters(g, m): letters = set() for i in xrange(m + 1): if g[i] == '': continue letters.update(set(re.sub((nonterminal_symbol + '[0-9]+?' + nonterminal_symbol).encode('string-escape'), '', g[i]))) return list(letters) def get_pairs(g, m): pairs = set() for i in xrange(m, -1, -1): if g[i] == '': continue a = next_symbol(g, i, '') b = next_symbol(g, i, a) prefix = a while b != '': if is_nonterminal(a): l = last(g, int(a[1:-1])) if l != b: pairs.add((l + b, l, b)) elif is_nonterminal(b): f = first(g, int(b[1:-1])) if a != f: pairs.add((a + f, a, f)) a = next_symbol(g, i, prefix) prefix += a b = next_symbol(g, i, prefix) return list(pairs) ################################################## ################################################## def fcpm(g, m, mn): global verbose global next start_time = time.time() sys.stdout.write("searching") sys.stdout.flush() if verbose: print '\nBefor starting:' print_rules(g) preprocessing(g, m, mn) letters = all_letters(g, m) if verbose: print 'After preprocessing:' print_rules(g) s = re.search(('^((' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')|(.))$').encode('string-escape'), g[m]) while not s: sys.stdout.write(".") sys.stdout.flush() pairs = get_pairs(g, m) rem_cr_blocks(g, m, mn) fix_beginning(g, m, mn, first(g, m)) fix_ending(g, m, mn, last(g, m)) if verbose: print '\nAfter fixing begin and end:' print_rules(g) pairs_comp(g, mn, pairs) for i in xrange(len(letters)): compress_block(g, m, mn, letters[i]) if verbose: print 'After pair and block compression:' print_rules(g) if g[m] == '': break s = re.search(('^((' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')|(.))$').encode('string-escape'), g[m]) matches=0 for i in xrange(m + 1, mn + 1): matches += len(re.findall(g[m].encode('string-escape'), g[i].encode('string-escape'))) sys.stdout.write("\n") if matches != 0: print 'Pattern found %s times.' % matches else: print 'Pattern not found.' elapsed_time = time.time() - start_time print 'Time:', elapsed_time def preprocessing(g, m, mn): for i in xrange(mn + 1): if i == m or i == mn or g[i] == '': continue left_pop(g, m, mn, i) right_pop(g, m, mn, i) if g[i] == '': remove_nonterminal(g, m, mn, i) def fix_beginning(g, m, mn, beginning): global next s = next_symbol(g, m, beginning) if is_nonterminal(s): nonterminal = int(s[1:-1]) s = first(g, nonterminal) left_pop(g, m, mn, nonterminal) if beginning == s: compress_block(g, m, mn, beginning) else: pair_comp(g, mn, beginning + s) def fix_ending(g, m, mn, ending): global next s = prev_symbol(g, m, ending) if is_nonterminal(s): nonterminal = int(s[1:-1]) s = last(g, m, nonterminal) right_pop(g, mn, nonterminal) if ending == s: compress_block(g, m, mn, ending) else: pair_comp(g, mn, s + ending) def pair_comp(g, mn, pair): global next match = re.search(('^' + recompress_symbol + '([0-9]+?)' + recompress_symbol).encode('string-escape'), pair) if match: first_pair = match.group(0) else: first_pair = pair[0] last_pair = pair[len(first_pair):] if first_pair == last_pair: return for j in xrange(mn + 1): if g[j] == '': continue f = first(g, j) begin = first_pair + nonterminal_symbol + str(j) + nonterminal_symbol l = last(g, j) end = nonterminal_symbol + str(j) + nonterminal_symbol + last_pair for i in xrange(mn + 1): if begin in g[i] and last_pair == f: left_pop(g, m, mn, j) if end in g[i] and first_pair == l: right_pop(g, m, mn, j) g[j] = re.sub(pair.encode('string-escape'), (recompress_symbol + str(next) + recompress_symbol), g[j]) for i in xrange(mn + 1): if g[i] == '': remove_nonterminal(g, m, mn, i) next += 1 def pairs_comp(g, mn, pairs): global next for j in xrange(mn + 1): if g[j] == '': continue left = re.search(('(' + recompress_symbol + '[0-9]+?' + recompress_symbol + '|.)' + nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), g[j]) right = re.search((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol + '(.|' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')').encode('string-escape'), g[j]) for i in xrange(len(pairs)): if left: if left.group(1) == pairs[i][1]: if first(g, int(left.group(2))) == pairs[i][2]: left_pop(g, m, mn, int(left.group(2))) if right: if right.group(2) == pairs[i][2]: if last(g, int(right.group(1))) == pairs[i][1]: right_pop(g, m, mn, int(right.group(1))) if pairs[i][0] in g[j]: if len(pairs[i]) == 3: g[j] = re.sub(pairs[i][0].encode('string-escape'), (recompress_symbol + str(next) + recompress_symbol), g[j]) pairs[i] = pairs[i] + (next,) next += 1 else: g[j] = re.sub(pairs[i][0].encode('string-escape'), (recompress_symbol + str(pairs[i][3]) + recompress_symbol), g[j]) for i in xrange(mn + 1): if g[i] == '': remove_nonterminal(g, m, mn, i) def rem_cr_blocks(g, m, mn): for i in xrange(mn + 1): if i == m or i == mn or g[i] == '': continue remove_prefix(g, mn, i) remove_suffix(g, mn, i) if g[i] == '': remove_nonterminal(g, m, mn, i) def remove_prefix(g, mn, index): if g[index] == '': return symbol = first(g, index) left_pop(g, m, mn, index) while first(g, index) == symbol: left_pop(g, m, mn, index) def remove_suffix(g, mn, index): if g[index] == '': return symbol = last(g, index) right_pop(g, m, mn, index) while last(g, index) == symbol: right_pop(g, m, mn, index) def compress_block(g, m, mn, letter): if letter == '': return global next blocks = set() for i in xrange(m + 1): if g[i] == '': continue block = re.findall((letter + '+').encode('string-escape'), g[i]) for b in block: if len(b) > 1: blocks.add(b) blocks = list(blocks) blocks.sort(reverse=True) for j in xrange(len(blocks)): for i in xrange(mn + 1): if g[i] == '': continue block = re.findall((letter + '+').encode('string-escape'), g[i]) for b in block: if len(b) > len(blocks[j]): g[i] = re.sub(b, (recompress_symbol + str(next) + recompress_symbol + b[:-len(blocks[j])] + recompress_symbol + str(next) + recompress_symbol).encode('string-escape'), g[i]) elif len(b) == len(blocks[j]): g[i] = re.sub(blocks[j], (recompress_symbol + str(next) + recompress_symbol).encode('string-escape'), g[i]) next += 1 ################################################## ################################################## def first(g, index): if g[index] == '': return '' else: match = re.search(('^' + nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), g[index]) if match: return first(g, int(match.group(1))) else: match = re.search(('^(' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')').encode('string-escape'), g[index]) if match: return match.group(0) else: return g[index][0] def last(g, index): if g[index] == '': return '' else: match = re.search((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol + '$').encode('string-escape'), g[index]) if match: return last(g, int(match.group(1))) else: match = re.search(('(' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')$').encode('string-escape'), g[index]) if match: return match.group(0) else: return g[index][-1] def left_pop(g, m, mn, index): if g[index] == '': return f = first(g, index) match = re.search(('^' + nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol).encode('string-escape'), g[index]) if match: left_pop(g, m, mn, int(match.group(1))) match = re.search(('^(' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')').encode('string-escape'), g[index]) if match: g[index] = g[index][len(match.group(0)):] else: g[index] = g[index][1:] if index < m: for i in xrange(m + 1): g[i] = re.sub((nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), (f + nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), g[i]) else : for i in xrange(m + 1, mn + 1): g[i] = re.sub((nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), (f + nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), g[i]) def right_pop(g, m, mn, index): if g[index] == '': return l = last(g, index) match = re.search((nonterminal_symbol + '([0-9]+?)' + nonterminal_symbol + '$').encode('string-escape'), g[index]) if match: right_pop(g, m, mn, int(match.group(1))) match = re.search(('(' + recompress_symbol + '[0-9]+?' + recompress_symbol + ')$').encode('string-escape'), g[index]) if match: g[index] = g[index][:-len(match.group(0))] else: g[index] = g[index][:-1] if index < m: for i in xrange(m + 1): g[i] = re.sub((nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), (nonterminal_symbol + str(index) + nonterminal_symbol + l).encode('string-escape'), g[i]) else : for i in xrange(m + 1, mn + 1): g[i] = re.sub((nonterminal_symbol + str(index) + nonterminal_symbol).encode('string-escape'), (nonterminal_symbol + str(index) + nonterminal_symbol + l).encode('string-escape'), g[i]) def remove_nonterminal(g, m, mn, nonterminal): if nonterminal < m: for i in xrange(m + 1): if g[i] == '': continue g[i] = re.sub((nonterminal_symbol + str(nonterminal) + nonterminal_symbol).encode('string-escape'), '', g[i]) else: for i in xrange(m + 1, mn + 1): if g[i] == '': continue g[i] = re.sub((nonterminal_symbol + str(nonterminal) + nonterminal_symbol).encode('string-escape'), '', g[i]) ################################################## ################################################## if __name__ == "__main__": g = None main(sys.argv[1:]) if repair_text != '' and repair_pattern != '': g, m, mn = load_repair_grammer() elif grammer != '': g, m, mn = load_grammer() elif to_transform != '': transform_repair() if g != None: fcpm(g, m, mn)
gpl-3.0
asedunov/intellij-community
python/helpers/python-skeletons/nose/tools/__init__.py
80
5457
"""Skeleton for 'nose.tools' module. Project: nose 1.3 <https://nose.readthedocs.org/> Skeleton by: Andrey Vlasovskikh <[email protected]> """ import sys def assert_equal(first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ pass def assert_not_equal(first, second, msg=None): """Fail if the two objects are equal as determined by the '==' operator. """ pass def assert_true(expr, msg=None): """Check that the expression is true.""" pass def assert_false(expr, msg=None): """Check that the expression is false.""" pass if sys.version_info >= (2, 7): def assert_is(expr1, expr2, msg=None): """Just like assert_true(a is b), but with a nicer default message.""" pass def assert_is_not(expr1, expr2, msg=None): """Just like assert_true(a is not b), but with a nicer default message. """ pass def assert_is_none(obj, msg=None): """Same as assert_true(obj is None), with a nicer default message. """ pass def assert_is_not_none(obj, msg=None): """Included for symmetry with assert_is_none.""" pass def assert_in(member, container, msg=None): """Just like assert_true(a in b), but with a nicer default message.""" pass def assert_not_in(member, container, msg=None): """Just like assert_true(a not in b), but with a nicer default message. """ pass def assert_is_instance(obj, cls, msg=None): """Same as assert_true(isinstance(obj, cls)), with a nicer default message. """ pass def assert_not_is_instance(obj, cls, msg=None): """Included for symmetry with assert_is_instance.""" pass def assert_raises(excClass, callableObj=None, *args, **kwargs): """Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If called with callableObj omitted or None, will return a context object used like this:: with assert_raises(SomeException): do_something() :rtype: unittest.case._AssertRaisesContext | None """ pass if sys.version_info >= (2, 7): def assert_raises_regexp(expected_exception, expected_regexp, callable_obj=None, *args, **kwargs): """Asserts that the message in a raised exception matches a regexp. :rtype: unittest.case._AssertRaisesContext | None """ pass def assert_almost_equal(first, second, places=None, msg=None, delta=None): """Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is more than the given delta. """ pass def assert_not_almost_equal(first, second, places=None, msg=None, delta=None): """Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is less than the given delta. """ pass if sys.version_info >= (2, 7): def assert_greater(a, b, msg=None): """Just like assert_true(a > b), but with a nicer default message.""" pass def assert_greater_equal(a, b, msg=None): """Just like assert_true(a >= b), but with a nicer default message.""" pass def assert_less(a, b, msg=None): """Just like assert_true(a < b), but with a nicer default message.""" pass def assert_less_equal(a, b, msg=None): """Just like self.assertTrue(a <= b), but with a nicer default message. """ pass def assert_regexp_matches(text, expected_regexp, msg=None): """Fail the test unless the text matches the regular expression.""" pass def assert_not_regexp_matches(text, unexpected_regexp, msg=None): """Fail the test if the text matches the regular expression.""" pass def assert_items_equal(expected_seq, actual_seq, msg=None): """An unordered sequence specific comparison. It asserts that actual_seq and expected_seq have the same element counts. """ pass def assert_dict_contains_subset(expected, actual, msg=None): """Checks whether actual is a superset of expected.""" pass def assert_multi_line_equal(first, second, msg=None): """Assert that two multi-line strings are equal.""" pass def assert_sequence_equal(seq1, seq2, msg=None, seq_type=None): """An equality assertion for ordered sequences (like lists and tuples). """ pass def assert_list_equal(list1, list2, msg=None): """A list-specific equality assertion.""" pass def assert_tuple_equal(tuple1, tuple2, msg=None): """A tuple-specific equality assertion.""" pass def assert_set_equal(set1, set2, msg=None): """A set-specific equality assertion.""" pass def assert_dict_equal(d1, d2, msg=None): """A dict-specific equality assertion.""" pass assert_equals = assert_equal assert_not_equals = assert_not_equal assert_almost_equals = assert_almost_equal assert_not_almost_equals = assert_not_almost_equal
apache-2.0
mzdaniel/oh-mainline
vendor/packages/Django/django/contrib/flatpages/tests/forms.py
155
1271
from django.conf import settings from django.contrib.flatpages.admin import FlatpageForm from django.test import TestCase class FlatpageAdminFormTests(TestCase): def setUp(self): self.form_data = { 'title': "A test page", 'content': "This is a test", 'sites': [settings.SITE_ID], } def test_flatpage_admin_form_url_validation(self): "The flatpage admin form validates correctly validates urls" self.assertTrue(FlatpageForm(data=dict(url='/new_flatpage/', **self.form_data)).is_valid()) self.assertTrue(FlatpageForm(data=dict(url='/some.special~chars/', **self.form_data)).is_valid()) self.assertTrue(FlatpageForm(data=dict(url='/some.very_special~chars-here/', **self.form_data)).is_valid()) self.assertFalse(FlatpageForm(data=dict(url='/a space/', **self.form_data)).is_valid()) self.assertFalse(FlatpageForm(data=dict(url='/a % char/', **self.form_data)).is_valid()) self.assertFalse(FlatpageForm(data=dict(url='/a ! char/', **self.form_data)).is_valid()) self.assertFalse(FlatpageForm(data=dict(url='/a & char/', **self.form_data)).is_valid()) self.assertFalse(FlatpageForm(data=dict(url='/a ? char/', **self.form_data)).is_valid())
agpl-3.0
pdubroy/kurt
build/MacOS/PyInstaller/pyinstaller-svn-r812/buildtests/test1.py
1
1267
# Copyright (C) 2005, Giovanni Bajo # Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA print "test1 - hooks / strange pkg structures" e1 = 'a_func from pkg2.a' e2 = 'b_func from pkg2.b (pkg2/extra/b.py)' e3 = 'notamodule from pkg2.__init__' from pkg1 import * t1 = a.a_func() if t1 != e1: print "expected:", e1 print " got:", t1 t2 = b.b_func() if t2 != e2: print "expected:", e2 print " got:", t2 t3 = notamodule() if t3 != e3: print "expected:", e3 print " got:", t3 print "test1 complete"
gpl-2.0
sgerhart/ansible
lib/ansible/modules/cloud/azure/azure_rm_containerinstance_facts.py
33
9452
#!/usr/bin/python # # Copyright (c) 2017 Zim Kalinowski, <[email protected]> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: azure_rm_containerinstance_facts version_added: "2.8" short_description: Get Azure Container Instance facts. description: - Get facts of Container Instance. options: resource_group: description: - The name of the resource group. required: True name: description: - The name of the container instance. tags: description: - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. extends_documentation_fragment: - azure author: - "Zim Kalinowski (@zikalino)" ''' EXAMPLES = ''' - name: Get specific Container Instance facts azure_rm_containerinstance_facts: resource_group: resource_group_name name: container_group_name - name: List Container Instances in a specified resource group name azure_rm_containerinstance_facts: resource_group: resource_group_name ''' RETURN = ''' container_groups: description: A list of Container Instance dictionaries. returned: always type: complex contains: id: description: - The resource id. returned: always type: str sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/my containers" resource_group: description: - Resource group where the container exists. returned: always type: str sample: testrg name: description: - The resource name. returned: always type: str sample: mycontainers location: description: - The resource location. returned: always type: str sample: westus os_type: description: - The OS type of containers. returned: always type: str sample: linux ip_address: description: - IP address of the container instance. returned: always type: str sample: 173.15.18.1 ports: description: - List of ports exposed by the container instance. returned: always type: list sample: [ 80, 81 ] containers: description: - The containers within the container group. returned: always type: complex sample: containers contains: name: description: - The name of the container instance. returned: always type: str sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/my containers" image: description: - The container image name. returned: always type: str sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/my containers" memory: description: - The required memory of the containers in GB. returned: always type: float sample: 1.5 cpu: description: - The required number of CPU cores of the containers. returned: always type: int sample: 1 ports: description: - List of ports exposed within the container group. returned: always type: list sample: [ 80, 81 ] tags: description: Tags assigned to the resource. Dictionary of string:string pairs. type: dict sample: { "tag1": "abc" } ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller from azure.mgmt.containerinstance import ContainerInstanceManagementClient from msrest.serialization import Model except ImportError: # This is handled in azure_rm_common pass class AzureRMContainerInstanceFacts(AzureRMModuleBase): def __init__(self): # define user inputs into argument self.module_arg_spec = dict( resource_group=dict( type='str', required=True ), name=dict( type='str' ), tags=dict( type='list' ) ) # store the results of the module operation self.results = dict( changed=False, ansible_facts=dict() ) self.resource_group = None self.name = None super(AzureRMContainerInstanceFacts, self).__init__(self.module_arg_spec, supports_tags=False) def exec_module(self, **kwargs): for key in self.module_arg_spec: setattr(self, key, kwargs[key]) if (self.name is not None): self.results['containerinstances'] = self.get() elif (self.resource_group is not None): self.results['containerinstances'] = self.list_by_resource_group() else: self.results['containerinstances'] = self.list_all() return self.results def get(self): response = None results = [] try: response = self.containerinstance_client.container_groups.get(resource_group_name=self.resource_group, container_group_name=self.name) self.log("Response : {0}".format(response)) except CloudError as e: self.log('Could not get facts for Container Instances.') if response is not None and self.has_tags(response.tags, self.tags): results.append(self.format_item(response)) return results def list_by_resource_group(self): response = None results = [] try: response = self.containerinstance_client.container_groups.list_by_resource_group(resource_group_name=self.resource_group) self.log("Response : {0}".format(response)) except CloudError as e: self.fail('Could not list facts for Container Instances.') if response is not None: for item in response: if self.has_tags(item.tags, self.tags): results.append(self.format_item(item)) return results def list_all(self): response = None results = [] try: response = self.containerinstance_client.container_groups.list() self.log("Response : {0}".format(response)) except CloudError as e: self.fail('Could not list facts for Container Instances.') if response is not None: for item in response: if self.has_tags(item.tags, self.tags): results.append(self.format_item(item)) return results def format_item(self, item): d = item.as_dict() containers = d['containers'] ports = d['ip_address']['ports'] resource_group = d['id'].split('resourceGroups/')[1].split('/')[0] for port_index in range(len(ports)): ports[port_index] = ports[port_index]['port'] for container_index in range(len(containers)): old_container = containers[container_index] new_container = { 'name': old_container['name'], 'image': old_container['image'], 'memory': old_container['resources']['requests']['memory_in_gb'], 'cpu': old_container['resources']['requests']['cpu'], 'ports': [] } for port_index in range(len(old_container['ports'])): new_container['ports'].append(old_container['ports'][port_index]['port']) containers[container_index] = new_container d = { 'id': d['id'], 'resource_group': resource_group, 'name': d['name'], 'os_type': d['os_type'], 'ip_address': 'public' if d['ip_address']['type'] == 'Public' else 'none', 'ports': ports, 'location': d['location'], 'containers': containers, 'tags': d.get('tags', None) } return d def main(): AzureRMContainerInstanceFacts() if __name__ == '__main__': main()
mit
KousikaGanesh/purchaseandInventory
openerp/addons/sale/wizard/sale_make_invoice.py
34
3548
############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp import netsvc class sale_make_invoice(osv.osv_memory): _name = "sale.make.invoice" _description = "Sales Make Invoice" _columns = { 'grouped': fields.boolean('Group the invoices', help='Check the box to group the invoices for the same customers'), 'invoice_date': fields.date('Invoice Date'), } _defaults = { 'grouped': False, 'invoice_date': fields.date.context_today, } def view_init(self, cr, uid, fields_list, context=None): if context is None: context = {} record_id = context and context.get('active_id', False) order = self.pool.get('sale.order').browse(cr, uid, record_id, context=context) if order.state == 'draft': raise osv.except_osv(_('Warning!'), _('You cannot create invoice when sales order is not confirmed.')) return False def make_invoices(self, cr, uid, ids, context=None): order_obj = self.pool.get('sale.order') mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') wf_service = netsvc.LocalService("workflow") newinv = [] if context is None: context = {} data = self.read(cr, uid, ids)[0] for sale_order in order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context): if sale_order.state != 'manual': raise osv.except_osv(_('Warning!'), _("You shouldn't manually invoice the following sale order %s") % (sale_order.name)) order_obj.action_invoice_create(cr, uid, context.get(('active_ids'), []), data['grouped'], date_invoice=data['invoice_date']) orders = order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context) for o in orders: for i in o.invoice_ids: newinv.append(i.id) # Dummy call to workflow, will not create another invoice but bind the new invoice to the subflow for id in [o.id for o in orders if o.order_policy == 'manual']: wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr) result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree1') id = result and result[1] or False result = act_obj.read(cr, uid, [id], context=context)[0] result['domain'] = "[('id','in', [" + ','.join(map(str, newinv)) + "])]" return result sale_make_invoice() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
jn7163/django
tests/multiple_database/routers.py
379
1927
from __future__ import unicode_literals from django.db import DEFAULT_DB_ALIAS class TestRouter(object): """ Vaguely behave like primary/replica, but the databases aren't assumed to propagate changes. """ def db_for_read(self, model, instance=None, **hints): if instance: return instance._state.db or 'other' return 'other' def db_for_write(self, model, **hints): return DEFAULT_DB_ALIAS def allow_relation(self, obj1, obj2, **hints): return obj1._state.db in ('default', 'other') and obj2._state.db in ('default', 'other') def allow_migrate(self, db, app_label, **hints): return True class AuthRouter(object): """ Control all database operations on models in the contrib.auth application. """ def db_for_read(self, model, **hints): "Point all read operations on auth models to 'default'" if model._meta.app_label == 'auth': # We use default here to ensure we can tell the difference # between a read request and a write request for Auth objects return 'default' return None def db_for_write(self, model, **hints): "Point all operations on auth models to 'other'" if model._meta.app_label == 'auth': return 'other' return None def allow_relation(self, obj1, obj2, **hints): "Allow any relation if a model in Auth is involved" if obj1._meta.app_label == 'auth' or obj2._meta.app_label == 'auth': return True return None def allow_migrate(self, db, app_label, **hints): "Make sure the auth app only appears on the 'other' db" if app_label == 'auth': return db == 'other' return None class WriteRouter(object): # A router that only expresses an opinion on writes def db_for_write(self, model, **hints): return 'writer'
bsd-3-clause
Jgarcia-IAS/SAT
openerp/addons-extra/odoo-pruebas/odoo-server/openerp/addons/base/ir/ir_qweb.py
6
59875
# -*- coding: utf-8 -*- import collections import cStringIO import datetime import hashlib import json import itertools import logging import math import os import re import sys import textwrap import uuid from subprocess import Popen, PIPE from urlparse import urlparse import babel import babel.dates import werkzeug from lxml import etree, html from PIL import Image import openerp.http import openerp.tools from openerp.tools.func import lazy_property import openerp.tools.lru from openerp.http import request from openerp.tools.safe_eval import safe_eval as eval from openerp.osv import osv, orm, fields from openerp.tools import html_escape as escape from openerp.tools.translate import _ _logger = logging.getLogger(__name__) #-------------------------------------------------------------------- # QWeb template engine #-------------------------------------------------------------------- class QWebException(Exception): def __init__(self, message, **kw): Exception.__init__(self, message) self.qweb = dict(kw) def pretty_xml(self): if 'node' not in self.qweb: return '' return etree.tostring(self.qweb['node'], pretty_print=True) class QWebTemplateNotFound(QWebException): pass def raise_qweb_exception(etype=None, **kw): if etype is None: etype = QWebException orig_type, original, tb = sys.exc_info() try: raise etype, original, tb except etype, e: for k, v in kw.items(): e.qweb[k] = v # Will use `raise foo from bar` in python 3 and rename cause to __cause__ e.qweb['cause'] = original raise class QWebContext(dict): def __init__(self, cr, uid, data, loader=None, templates=None, context=None): self.cr = cr self.uid = uid self.loader = loader self.templates = templates or {} self.context = context dic = dict(data) super(QWebContext, self).__init__(dic) self['defined'] = lambda key: key in self def safe_eval(self, expr): locals_dict = collections.defaultdict(lambda: None) locals_dict.update(self) locals_dict.pop('cr', None) locals_dict.pop('loader', None) return eval(expr, None, locals_dict, nocopy=True, locals_builtins=True) def copy(self): return QWebContext(self.cr, self.uid, dict.copy(self), loader=self.loader, templates=self.templates, context=self.context) def __copy__(self): return self.copy() class QWeb(orm.AbstractModel): """QWeb Xml templating engine The templating engine use a very simple syntax based "magic" xml attributes, to produce textual output (even non-xml). The core magic attributes are: flow attributes: t-if t-foreach t-call output attributes: t-att t-raw t-esc t-trim assignation attribute: t-set QWeb can be extended like any OpenERP model and new attributes can be added. If you need to customize t-fields rendering, subclass the ir.qweb.field model (and its sub-models) then override :meth:`~.get_converter_for` to fetch the right field converters for your qweb model. Beware that if you need extensions or alterations which could be incompatible with other subsystems, you should create a local object inheriting from ``ir.qweb`` and customize that. """ _name = 'ir.qweb' _void_elements = frozenset([ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']) _format_regex = re.compile( '(?:' # ruby-style pattern '#\{(.+?)\}' ')|(?:' # jinja-style pattern '\{\{(.+?)\}\}' ')') def __init__(self, pool, cr): super(QWeb, self).__init__(pool, cr) self._render_tag = self.prefixed_methods('render_tag_') self._render_att = self.prefixed_methods('render_att_') def prefixed_methods(self, prefix): """ Extracts all methods prefixed by ``prefix``, and returns a mapping of (t-name, method) where the t-name is the method name with prefix removed and underscore converted to dashes :param str prefix: :return: dict """ n_prefix = len(prefix) return dict( (name[n_prefix:].replace('_', '-'), getattr(type(self), name)) for name in dir(self) if name.startswith(prefix) ) def register_tag(self, tag, func): self._render_tag[tag] = func def add_template(self, qwebcontext, name, node): """Add a parsed template in the context. Used to preprocess templates.""" qwebcontext.templates[name] = node def load_document(self, document, res_id, qwebcontext): """ Loads an XML document and installs any contained template in the engine """ if hasattr(document, 'documentElement'): dom = document elif document.startswith("<?xml"): dom = etree.fromstring(document) else: dom = etree.parse(document) for node in dom: if node.get('t-name'): name = str(node.get("t-name")) self.add_template(qwebcontext, name, node) if res_id and node.tag == "t": self.add_template(qwebcontext, res_id, node) res_id = None def get_template(self, name, qwebcontext): origin_template = qwebcontext.get('__caller__') or qwebcontext['__stack__'][0] if qwebcontext.loader and name not in qwebcontext.templates: try: xml_doc = qwebcontext.loader(name) except ValueError: raise_qweb_exception(QWebTemplateNotFound, message="Loader could not find template %r" % name, template=origin_template) self.load_document(xml_doc, isinstance(name, (int, long)) and name or None, qwebcontext=qwebcontext) if name in qwebcontext.templates: return qwebcontext.templates[name] raise QWebTemplateNotFound("Template %r not found" % name, template=origin_template) def eval(self, expr, qwebcontext): try: return qwebcontext.safe_eval(expr) except Exception: template = qwebcontext.get('__template__') raise_qweb_exception(message="Could not evaluate expression %r" % expr, expression=expr, template=template) def eval_object(self, expr, qwebcontext): return self.eval(expr, qwebcontext) def eval_str(self, expr, qwebcontext): if expr == "0": return qwebcontext.get(0, '') val = self.eval(expr, qwebcontext) if isinstance(val, unicode): return val.encode("utf8") if val is False or val is None: return '' return str(val) def eval_format(self, expr, qwebcontext): expr, replacements = self._format_regex.subn( lambda m: self.eval_str(m.group(1) or m.group(2), qwebcontext), expr ) if replacements: return expr try: return str(expr % qwebcontext) except Exception: template = qwebcontext.get('__template__') raise_qweb_exception(message="Format error for expression %r" % expr, expression=expr, template=template) def eval_bool(self, expr, qwebcontext): return int(bool(self.eval(expr, qwebcontext))) def render(self, cr, uid, id_or_xml_id, qwebcontext=None, loader=None, context=None): if qwebcontext is None: qwebcontext = {} if not isinstance(qwebcontext, QWebContext): qwebcontext = QWebContext(cr, uid, qwebcontext, loader=loader, context=context) qwebcontext['__template__'] = id_or_xml_id stack = qwebcontext.get('__stack__', []) if stack: qwebcontext['__caller__'] = stack[-1] stack.append(id_or_xml_id) qwebcontext['__stack__'] = stack qwebcontext['xmlid'] = str(stack[0]) # Temporary fix return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext) def render_node(self, element, qwebcontext): generated_attributes = "" t_render = None template_attributes = {} for (attribute_name, attribute_value) in element.attrib.iteritems(): attribute_name = str(attribute_name) if attribute_name == "groups": cr = qwebcontext.get('request') and qwebcontext['request'].cr or None uid = qwebcontext.get('request') and qwebcontext['request'].uid or None can_see = self.user_has_groups(cr, uid, groups=attribute_value) if cr and uid else False if not can_see: return '' attribute_value = attribute_value.encode("utf8") if attribute_name.startswith("t-"): for attribute in self._render_att: if attribute_name[2:].startswith(attribute): att, val = self._render_att[attribute](self, element, attribute_name, attribute_value, qwebcontext) if val: generated_attributes += self.render_attribute(element, att, val, qwebcontext) break else: if attribute_name[2:] in self._render_tag: t_render = attribute_name[2:] template_attributes[attribute_name[2:]] = attribute_value else: generated_attributes += self.render_attribute(element, attribute_name, attribute_value, qwebcontext) if 'debug' in template_attributes: debugger = template_attributes.get('debug', 'pdb') __import__(debugger).set_trace() # pdb, ipdb, pudb, ... if t_render: result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext) else: result = self.render_element(element, template_attributes, generated_attributes, qwebcontext) if element.tail: result += element.tail.encode('utf-8') if isinstance(result, unicode): return result.encode('utf-8') return result def render_element(self, element, template_attributes, generated_attributes, qwebcontext, inner=None): # element: element # template_attributes: t-* attributes # generated_attributes: generated attributes # qwebcontext: values # inner: optional innerXml if inner: g_inner = inner.encode('utf-8') if isinstance(inner, unicode) else inner else: g_inner = [] if element.text is None else [element.text.encode('utf-8')] for current_node in element.iterchildren(tag=etree.Element): try: g_inner.append(self.render_node(current_node, qwebcontext)) except QWebException: raise except Exception: template = qwebcontext.get('__template__') raise_qweb_exception(message="Could not render element %r" % element.tag, node=element, template=template) name = str(element.tag) inner = "".join(g_inner) trim = template_attributes.get("trim", 0) if trim == 0: pass elif trim == 'left': inner = inner.lstrip() elif trim == 'right': inner = inner.rstrip() elif trim == 'both': inner = inner.strip() if name == "t": return inner elif len(inner) or name not in self._void_elements: return "<%s%s>%s</%s>" % tuple( qwebcontext if isinstance(qwebcontext, str) else qwebcontext.encode('utf-8') for qwebcontext in (name, generated_attributes, inner, name) ) else: return "<%s%s/>" % (name, generated_attributes) def render_attribute(self, element, name, value, qwebcontext): return ' %s="%s"' % (name, escape(value)) # Attributes def render_att_att(self, element, attribute_name, attribute_value, qwebcontext): if attribute_name.startswith("t-attf-"): att, val = attribute_name[7:], self.eval_format(attribute_value, qwebcontext) elif attribute_name.startswith("t-att-"): att, val = attribute_name[6:], self.eval(attribute_value, qwebcontext) else: att, val = self.eval_object(attribute_value, qwebcontext) if val and not isinstance(val, str): val = unicode(val).encode("utf8") return att, val # Tags def render_tag_raw(self, element, template_attributes, generated_attributes, qwebcontext): inner = self.eval_str(template_attributes["raw"], qwebcontext) return self.render_element(element, template_attributes, generated_attributes, qwebcontext, inner) def render_tag_esc(self, element, template_attributes, generated_attributes, qwebcontext): options = json.loads(template_attributes.get('esc-options') or '{}') widget = self.get_widget_for(options.get('widget')) inner = widget.format(template_attributes['esc'], options, qwebcontext) return self.render_element(element, template_attributes, generated_attributes, qwebcontext, inner) def render_tag_foreach(self, element, template_attributes, generated_attributes, qwebcontext): expr = template_attributes["foreach"] enum = self.eval_object(expr, qwebcontext) if enum is None: template = qwebcontext.get('__template__') raise QWebException("foreach enumerator %r is not defined while rendering template %r" % (expr, template), template=template) varname = template_attributes['as'].replace('.', '_') copy_qwebcontext = qwebcontext.copy() size = -1 if isinstance(enum, collections.Sized): size = len(enum) copy_qwebcontext["%s_size" % varname] = size copy_qwebcontext["%s_all" % varname] = enum ru = [] for index, item in enumerate(enum): copy_qwebcontext.update({ varname: item, '%s_value' % varname: item, '%s_index' % varname: index, '%s_first' % varname: index == 0, '%s_last' % varname: index + 1 == size, }) if index % 2: copy_qwebcontext.update({ '%s_parity' % varname: 'odd', '%s_even' % varname: False, '%s_odd' % varname: True, }) else: copy_qwebcontext.update({ '%s_parity' % varname: 'even', '%s_even' % varname: True, '%s_odd' % varname: False, }) ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext)) return "".join(ru) def render_tag_if(self, element, template_attributes, generated_attributes, qwebcontext): if self.eval_bool(template_attributes["if"], qwebcontext): return self.render_element(element, template_attributes, generated_attributes, qwebcontext) return "" def render_tag_call(self, element, template_attributes, generated_attributes, qwebcontext): d = qwebcontext.copy() d[0] = self.render_element(element, template_attributes, generated_attributes, d) cr = d.get('request') and d['request'].cr or None uid = d.get('request') and d['request'].uid or None template = self.eval_format(template_attributes["call"], d) try: template = int(template) except ValueError: pass return self.render(cr, uid, template, d) def render_tag_call_assets(self, element, template_attributes, generated_attributes, qwebcontext): """ This special 't-call' tag can be used in order to aggregate/minify javascript and css assets""" if len(element): # An asset bundle is rendered in two differents contexts (when genereting html and # when generating the bundle itself) so they must be qwebcontext free # even '0' variable is forbidden template = qwebcontext.get('__template__') raise QWebException("t-call-assets cannot contain children nodes", template=template) xmlid = template_attributes['call-assets'] cr, uid, context = [getattr(qwebcontext, attr) for attr in ('cr', 'uid', 'context')] bundle = AssetsBundle(xmlid, cr=cr, uid=uid, context=context, registry=self.pool) css = self.get_attr_bool(template_attributes.get('css'), default=True) js = self.get_attr_bool(template_attributes.get('js'), default=True) return bundle.to_html(css=css, js=js, debug=bool(qwebcontext.get('debug'))) def render_tag_set(self, element, template_attributes, generated_attributes, qwebcontext): if "value" in template_attributes: qwebcontext[template_attributes["set"]] = self.eval_object(template_attributes["value"], qwebcontext) elif "valuef" in template_attributes: qwebcontext[template_attributes["set"]] = self.eval_format(template_attributes["valuef"], qwebcontext) else: qwebcontext[template_attributes["set"]] = self.render_element(element, template_attributes, generated_attributes, qwebcontext) return "" def render_tag_field(self, element, template_attributes, generated_attributes, qwebcontext): """ eg: <span t-record="browse_record(res.partner, 1)" t-field="phone">+1 555 555 8069</span>""" node_name = element.tag assert node_name not in ("table", "tbody", "thead", "tfoot", "tr", "td", "li", "ul", "ol", "dl", "dt", "dd"),\ "RTE widgets do not work correctly on %r elements" % node_name assert node_name != 't',\ "t-field can not be used on a t element, provide an actual HTML node" record, field_name = template_attributes["field"].rsplit('.', 1) record = self.eval_object(record, qwebcontext) column = record._all_columns[field_name].column options = json.loads(template_attributes.get('field-options') or '{}') field_type = get_field_type(column, options) converter = self.get_converter_for(field_type) return converter.to_html(qwebcontext.cr, qwebcontext.uid, field_name, record, options, element, template_attributes, generated_attributes, qwebcontext, context=qwebcontext.context) def get_converter_for(self, field_type): return self.pool.get('ir.qweb.field.' + field_type, self.pool['ir.qweb.field']) def get_widget_for(self, widget): widget_model = ('ir.qweb.widget.' + widget) if widget else 'ir.qweb.widget' return self.pool.get(widget_model) or self.pool['ir.qweb.widget'] def get_attr_bool(self, attr, default=False): if attr: attr = attr.lower() if attr in ('false', '0'): return False elif attr in ('true', '1'): return True return default #-------------------------------------------------------------------- # QWeb Fields converters #-------------------------------------------------------------------- class FieldConverter(osv.AbstractModel): """ Used to convert a t-field specification into an output HTML field. :meth:`~.to_html` is the entry point of this conversion from QWeb, it: * converts the record value to html using :meth:`~.record_to_html` * generates the metadata attributes (``data-oe-``) to set on the root result node * generates the root result node itself through :meth:`~.render_element` """ _name = 'ir.qweb.field' def attributes(self, cr, uid, field_name, record, options, source_element, g_att, t_att, qweb_context, context=None): """ Generates the metadata attributes (prefixed by ``data-oe-`` for the root node of the field conversion. Attribute values are escaped by the parent. The default attributes are: * ``model``, the name of the record's model * ``id`` the id of the record to which the field belongs * ``field`` the name of the converted field * ``type`` the logical field type (widget, may not match the column's ``type``, may not be any _column subclass name) * ``translate``, a boolean flag (``0`` or ``1``) denoting whether the column is translatable * ``expression``, the original expression :returns: iterable of (attribute name, attribute value) pairs. """ column = record._all_columns[field_name].column field_type = get_field_type(column, options) return [ ('data-oe-model', record._name), ('data-oe-id', record.id), ('data-oe-field', field_name), ('data-oe-type', field_type), ('data-oe-expression', t_att['field']), ] def value_to_html(self, cr, uid, value, column, options=None, context=None): """ Converts a single value to its HTML version/output """ if not value: return '' return value def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None): """ Converts the specified field of the browse_record ``record`` to HTML """ return self.value_to_html( cr, uid, record[field_name], column, options=options, context=context) def to_html(self, cr, uid, field_name, record, options, source_element, t_att, g_att, qweb_context, context=None): """ Converts a ``t-field`` to its HTML output. A ``t-field`` may be extended by a ``t-field-options``, which is a JSON-serialized mapping of configuration values. A default configuration key is ``widget`` which can override the field's own ``_type``. """ try: content = self.record_to_html( cr, uid, field_name, record, record._all_columns[field_name].column, options, context=context) if options.get('html-escape', True): content = escape(content) elif hasattr(content, '__html__'): content = content.__html__() except Exception: _logger.warning("Could not get field %s for model %s", field_name, record._name, exc_info=True) content = None inherit_branding = context and context.get('inherit_branding') if not inherit_branding and context and context.get('inherit_branding_auto'): inherit_branding = self.pool['ir.model.access'].check(cr, uid, record._name, 'write', False, context=context) if inherit_branding: # add branding attributes g_att += ''.join( ' %s="%s"' % (name, escape(value)) for name, value in self.attributes( cr, uid, field_name, record, options, source_element, g_att, t_att, qweb_context) ) return self.render_element(cr, uid, source_element, t_att, g_att, qweb_context, content) def qweb_object(self): return self.pool['ir.qweb'] def render_element(self, cr, uid, source_element, t_att, g_att, qweb_context, content): """ Final rendering hook, by default just calls ir.qweb's ``render_element`` """ return self.qweb_object().render_element( source_element, t_att, g_att, qweb_context, content or '') def user_lang(self, cr, uid, context): """ Fetches the res.lang object corresponding to the language code stored in the user's context. Fallbacks to en_US if no lang is present in the context *or the language code is not valid*. :returns: res.lang browse_record """ if context is None: context = {} lang_code = context.get('lang') or 'en_US' Lang = self.pool['res.lang'] lang_ids = Lang.search(cr, uid, [('code', '=', lang_code)], context=context) \ or Lang.search(cr, uid, [('code', '=', 'en_US')], context=context) return Lang.browse(cr, uid, lang_ids[0], context=context) class FloatConverter(osv.AbstractModel): _name = 'ir.qweb.field.float' _inherit = 'ir.qweb.field' def precision(self, cr, uid, column, options=None, context=None): _, precision = column.digits or (None, None) return precision def value_to_html(self, cr, uid, value, column, options=None, context=None): if context is None: context = {} precision = self.precision(cr, uid, column, options=options, context=context) fmt = '%f' if precision is None else '%.{precision}f' lang_code = context.get('lang') or 'en_US' lang = self.pool['res.lang'] formatted = lang.format(cr, uid, [lang_code], fmt.format(precision=precision), value, grouping=True) # %f does not strip trailing zeroes. %g does but its precision causes # it to switch to scientific notation starting at a million *and* to # strip decimals. So use %f and if no precision was specified manually # strip trailing 0. if precision is None: formatted = re.sub(r'(?:(0|\d+?)0+)$', r'\1', formatted) return formatted class DateConverter(osv.AbstractModel): _name = 'ir.qweb.field.date' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): if not value: return '' lang = self.user_lang(cr, uid, context=context) locale = babel.Locale.parse(lang.code) if isinstance(value, basestring): value = datetime.datetime.strptime( value, openerp.tools.DEFAULT_SERVER_DATE_FORMAT) if options and 'format' in options: pattern = options['format'] else: strftime_pattern = lang.date_format pattern = openerp.tools.posix_to_ldml(strftime_pattern, locale=locale) return babel.dates.format_date( value, format=pattern, locale=locale) class DateTimeConverter(osv.AbstractModel): _name = 'ir.qweb.field.datetime' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): if not value: return '' lang = self.user_lang(cr, uid, context=context) locale = babel.Locale.parse(lang.code) if isinstance(value, basestring): value = datetime.datetime.strptime( value, openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT) value = fields.datetime.context_timestamp( cr, uid, timestamp=value, context=context) if options and 'format' in options: pattern = options['format'] else: strftime_pattern = (u"%s %s" % (lang.date_format, lang.time_format)) pattern = openerp.tools.posix_to_ldml(strftime_pattern, locale=locale) if options and options.get('hide_seconds'): pattern = pattern.replace(":ss", "").replace(":s", "") return babel.dates.format_datetime(value, format=pattern, locale=locale) class TextConverter(osv.AbstractModel): _name = 'ir.qweb.field.text' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): """ Escapes the value and converts newlines to br. This is bullshit. """ if not value: return '' return nl2br(value, options=options) class SelectionConverter(osv.AbstractModel): _name = 'ir.qweb.field.selection' _inherit = 'ir.qweb.field' def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None): value = record[field_name] if not value: return '' selection = dict(fields.selection.reify( cr, uid, record._model, column, context=context)) return self.value_to_html( cr, uid, selection[value], column, options=options) class ManyToOneConverter(osv.AbstractModel): _name = 'ir.qweb.field.many2one' _inherit = 'ir.qweb.field' def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None): [read] = record.read([field_name]) if not read[field_name]: return '' _, value = read[field_name] return nl2br(value, options=options) class HTMLConverter(osv.AbstractModel): _name = 'ir.qweb.field.html' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): return HTMLSafe(value or '') class ImageConverter(osv.AbstractModel): """ ``image`` widget rendering, inserts a data:uri-using image tag in the document. May be overridden by e.g. the website module to generate links instead. .. todo:: what happens if different output need different converters? e.g. reports may need embedded images or FS links whereas website needs website-aware """ _name = 'ir.qweb.field.image' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): try: image = Image.open(cStringIO.StringIO(value.decode('base64'))) image.verify() except IOError: raise ValueError("Non-image binary fields can not be converted to HTML") except: # image.verify() throws "suitable exceptions", I have no idea what they are raise ValueError("Invalid image content") return HTMLSafe('<img src="data:%s;base64,%s">' % (Image.MIME[image.format], value)) class MonetaryConverter(osv.AbstractModel): """ ``monetary`` converter, has a mandatory option ``display_currency``. The currency is used for formatting *and rounding* of the float value. It is assumed that the linked res_currency has a non-empty rounding value and res.currency's ``round`` method is used to perform rounding. .. note:: the monetary converter internally adds the qweb context to its options mapping, so that the context is available to callees. It's set under the ``_qweb_context`` key. """ _name = 'ir.qweb.field.monetary' _inherit = 'ir.qweb.field' def to_html(self, cr, uid, field_name, record, options, source_element, t_att, g_att, qweb_context, context=None): options['_qweb_context'] = qweb_context return super(MonetaryConverter, self).to_html( cr, uid, field_name, record, options, source_element, t_att, g_att, qweb_context, context=context) def record_to_html(self, cr, uid, field_name, record, column, options, context=None): if context is None: context = {} Currency = self.pool['res.currency'] display_currency = self.display_currency(cr, uid, options['display_currency'], options) # lang.format mandates a sprintf-style format. These formats are non- # minimal (they have a default fixed precision instead), and # lang.format will not set one by default. currency.round will not # provide one either. So we need to generate a precision value # (integer > 0) from the currency's rounding (a float generally < 1.0). # # The log10 of the rounding should be the number of digits involved if # negative, if positive clamp to 0 digits and call it a day. # nb: int() ~ floor(), we want nearest rounding instead precision = int(round(math.log10(display_currency.rounding))) fmt = "%.{0}f".format(-precision if precision < 0 else 0) from_amount = record[field_name] if options.get('from_currency'): from_currency = self.display_currency(cr, uid, options['from_currency'], options) from_amount = Currency.compute(cr, uid, from_currency.id, display_currency.id, from_amount) lang_code = context.get('lang') or 'en_US' lang = self.pool['res.lang'] formatted_amount = lang.format(cr, uid, [lang_code], fmt, Currency.round(cr, uid, display_currency, from_amount), grouping=True, monetary=True) pre = post = u'' if display_currency.position == 'before': pre = u'{symbol} ' else: post = u' {symbol}' return HTMLSafe(u'{pre}<span class="oe_currency_value">{0}</span>{post}'.format( formatted_amount, pre=pre, post=post, ).format( symbol=display_currency.symbol, )) def display_currency(self, cr, uid, currency, options): return self.qweb_object().eval_object( currency, options['_qweb_context']) TIMEDELTA_UNITS = ( ('year', 3600 * 24 * 365), ('month', 3600 * 24 * 30), ('week', 3600 * 24 * 7), ('day', 3600 * 24), ('hour', 3600), ('minute', 60), ('second', 1) ) class DurationConverter(osv.AbstractModel): """ ``duration`` converter, to display integral or fractional values as human-readable time spans (e.g. 1.5 as "1 hour 30 minutes"). Can be used on any numerical field. Has a mandatory option ``unit`` which can be one of ``second``, ``minute``, ``hour``, ``day``, ``week`` or ``year``, used to interpret the numerical field value before converting it. Sub-second values will be ignored. """ _name = 'ir.qweb.field.duration' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): units = dict(TIMEDELTA_UNITS) if value < 0: raise ValueError(_("Durations can't be negative")) if not options or options.get('unit') not in units: raise ValueError(_("A unit must be provided to duration widgets")) locale = babel.Locale.parse( self.user_lang(cr, uid, context=context).code) factor = units[options['unit']] sections = [] r = value * factor for unit, secs_per_unit in TIMEDELTA_UNITS: v, r = divmod(r, secs_per_unit) if not v: continue section = babel.dates.format_timedelta( v*secs_per_unit, threshold=1, locale=locale) if section: sections.append(section) return ' '.join(sections) class RelativeDatetimeConverter(osv.AbstractModel): _name = 'ir.qweb.field.relative' _inherit = 'ir.qweb.field' def value_to_html(self, cr, uid, value, column, options=None, context=None): parse_format = openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT locale = babel.Locale.parse( self.user_lang(cr, uid, context=context).code) if isinstance(value, basestring): value = datetime.datetime.strptime(value, parse_format) # value should be a naive datetime in UTC. So is fields.datetime.now() reference = datetime.datetime.strptime(column.now(), parse_format) return babel.dates.format_timedelta( value - reference, add_direction=True, locale=locale) class Contact(orm.AbstractModel): _name = 'ir.qweb.field.contact' _inherit = 'ir.qweb.field.many2one' def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None): if context is None: context = {} if options is None: options = {} opf = options.get('fields') or ["name", "address", "phone", "mobile", "fax", "email"] if not getattr(record, field_name): return None id = getattr(record, field_name).id context.update(show_address=True) field_browse = self.pool[column._obj].browse(cr, openerp.SUPERUSER_ID, id, context=context) value = field_browse.name_get()[0][1] val = { 'name': value.split("\n")[0], 'address': escape("\n".join(value.split("\n")[1:])), 'phone': field_browse.phone, 'mobile': field_browse.mobile, 'fax': field_browse.fax, 'city': field_browse.city, 'country_id': field_browse.country_id.display_name, 'website': field_browse.website, 'email': field_browse.email, 'fields': opf, 'object': field_browse, 'options': options } html = self.pool["ir.ui.view"].render(cr, uid, "base.contact", val, engine='ir.qweb', context=context).decode('utf8') return HTMLSafe(html) class QwebView(orm.AbstractModel): _name = 'ir.qweb.field.qweb' _inherit = 'ir.qweb.field.many2one' def record_to_html(self, cr, uid, field_name, record, column, options=None, context=None): if not getattr(record, field_name): return None view = getattr(record, field_name) if view._model._name != "ir.ui.view": _logger.warning("%s.%s must be a 'ir.ui.view' model." % (record, field_name)) return None ctx = (context or {}).copy() ctx['object'] = record html = view.render(ctx, engine='ir.qweb', context=ctx).decode('utf8') return HTMLSafe(html) class QwebWidget(osv.AbstractModel): _name = 'ir.qweb.widget' def _format(self, inner, options, qwebcontext): return self.pool['ir.qweb'].eval_str(inner, qwebcontext) def format(self, inner, options, qwebcontext): return escape(self._format(inner, options, qwebcontext)) class QwebWidgetMonetary(osv.AbstractModel): _name = 'ir.qweb.widget.monetary' _inherit = 'ir.qweb.widget' def _format(self, inner, options, qwebcontext): inner = self.pool['ir.qweb'].eval(inner, qwebcontext) display = self.pool['ir.qweb'].eval_object(options['display_currency'], qwebcontext) precision = int(round(math.log10(display.rounding))) fmt = "%.{0}f".format(-precision if precision < 0 else 0) lang_code = qwebcontext.context.get('lang') or 'en_US' formatted_amount = self.pool['res.lang'].format( qwebcontext.cr, qwebcontext.uid, [lang_code], fmt, inner, grouping=True, monetary=True ) pre = post = u'' if display.position == 'before': pre = u'{symbol} ' else: post = u' {symbol}' return u'{pre}{0}{post}'.format( formatted_amount, pre=pre, post=post ).format(symbol=display.symbol,) class HTMLSafe(object): """ HTMLSafe string wrapper, Werkzeug's escape() has special handling for objects with a ``__html__`` methods but AFAIK does not provide any such object. Wrapping a string in HTML will prevent its escaping """ __slots__ = ['string'] def __init__(self, string): self.string = string def __html__(self): return self.string def __str__(self): s = self.string if isinstance(s, unicode): return s.encode('utf-8') return s def __unicode__(self): s = self.string if isinstance(s, str): return s.decode('utf-8') return s def nl2br(string, options=None): """ Converts newlines to HTML linebreaks in ``string``. Automatically escapes content unless options['html-escape'] is set to False, and returns the result wrapped in an HTMLSafe object. :param str string: :param dict options: :rtype: HTMLSafe """ if options is None: options = {} if options.get('html-escape', True): string = escape(string) return HTMLSafe(string.replace('\n', '<br>\n')) def get_field_type(column, options): """ Gets a t-field's effective type from the field's column and its options """ return options.get('widget', column._type) class AssetError(Exception): pass class AssetNotFound(AssetError): pass class AssetsBundle(object): # Sass installation: # # sudo gem install sass compass bootstrap-sass # # If the following error is encountered: # 'ERROR: Cannot load compass.' # Use this: # sudo gem install compass --pre cmd_sass = ['sass', '--stdin', '-t', 'compressed', '--unix-newlines', '--compass', '-r', 'bootstrap-sass'] rx_css_import = re.compile("(@import[^;{]+;?)", re.M) rx_sass_import = re.compile("""(@import\s?['"]([^'"]+)['"])""") rx_css_split = re.compile("\/\*\! ([a-f0-9-]+) \*\/") def __init__(self, xmlid, debug=False, cr=None, uid=None, context=None, registry=None): self.xmlid = xmlid self.cr = request.cr if cr is None else cr self.uid = request.uid if uid is None else uid self.context = request.context if context is None else context self.registry = request.registry if registry is None else registry self.javascripts = [] self.stylesheets = [] self.css_errors = [] self.remains = [] self._checksum = None context = self.context.copy() context['inherit_branding'] = False context['rendering_bundle'] = True self.html = self.registry['ir.ui.view'].render(self.cr, self.uid, xmlid, context=context) self.parse() def parse(self): fragments = html.fragments_fromstring(self.html) for el in fragments: if isinstance(el, basestring): self.remains.append(el) elif isinstance(el, html.HtmlElement): src = el.get('src', '') href = el.get('href', '') atype = el.get('type') media = el.get('media') if el.tag == 'style': if atype == 'text/sass' or src.endswith('.sass'): self.stylesheets.append(SassAsset(self, inline=el.text, media=media)) else: self.stylesheets.append(StylesheetAsset(self, inline=el.text, media=media)) elif el.tag == 'link' and el.get('rel') == 'stylesheet' and self.can_aggregate(href): if href.endswith('.sass') or atype == 'text/sass': self.stylesheets.append(SassAsset(self, url=href, media=media)) else: self.stylesheets.append(StylesheetAsset(self, url=href, media=media)) elif el.tag == 'script' and not src: self.javascripts.append(JavascriptAsset(self, inline=el.text)) elif el.tag == 'script' and self.can_aggregate(src): self.javascripts.append(JavascriptAsset(self, url=src)) else: self.remains.append(html.tostring(el)) else: try: self.remains.append(html.tostring(el)) except Exception: # notYETimplementederror raise NotImplementedError def can_aggregate(self, url): return not urlparse(url).netloc and not url.startswith(('/web/css', '/web/js')) def to_html(self, sep=None, css=True, js=True, debug=False): if sep is None: sep = '\n ' response = [] if debug: if css and self.stylesheets: self.compile_sass() for style in self.stylesheets: response.append(style.to_html()) if js: for jscript in self.javascripts: response.append(jscript.to_html()) else: url_for = self.context.get('url_for', lambda url: url) if css and self.stylesheets: href = '/web/css/%s/%s' % (self.xmlid, self.version) response.append('<link href="%s" rel="stylesheet"/>' % url_for(href)) if js: src = '/web/js/%s/%s' % (self.xmlid, self.version) response.append('<script type="text/javascript" src="%s"></script>' % url_for(src)) response.extend(self.remains) return sep + sep.join(response) @lazy_property def last_modified(self): """Returns last modified date of linked files""" return max(itertools.chain( (asset.last_modified for asset in self.javascripts), (asset.last_modified for asset in self.stylesheets), )) @lazy_property def version(self): return self.checksum[0:7] @lazy_property def checksum(self): """ Not really a full checksum. We compute a SHA1 on the rendered bundle + max linked files last_modified date """ check = self.html + str(self.last_modified) return hashlib.sha1(check).hexdigest() def js(self): content = self.get_cache('js') if content is None: content = ';\n'.join(asset.minify() for asset in self.javascripts) self.set_cache('js', content) return content def css(self): content = self.get_cache('css') if content is None: self.compile_sass() content = '\n'.join(asset.minify() for asset in self.stylesheets) if self.css_errors: msg = '\n'.join(self.css_errors) content += self.css_message(msg.replace('\n', '\\A ')) # move up all @import rules to the top matches = [] def push(matchobj): matches.append(matchobj.group(0)) return '' content = re.sub(self.rx_css_import, push, content) matches.append(content) content = u'\n'.join(matches) if self.css_errors: return content self.set_cache('css', content) return content def get_cache(self, type): content = None domain = [('url', '=', '/web/%s/%s/%s' % (type, self.xmlid, self.version))] bundle = self.registry['ir.attachment'].search_read(self.cr, self.uid, domain, ['datas'], context=self.context) if bundle and bundle[0]['datas']: content = bundle[0]['datas'].decode('base64') return content def set_cache(self, type, content): ira = self.registry['ir.attachment'] url_prefix = '/web/%s/%s/' % (type, self.xmlid) # Invalidate previous caches oids = ira.search(self.cr, self.uid, [('url', '=like', url_prefix + '%')], context=self.context) if oids: ira.unlink(self.cr, openerp.SUPERUSER_ID, oids, context=self.context) url = url_prefix + self.version ira.create(self.cr, openerp.SUPERUSER_ID, dict( datas=content.encode('utf8').encode('base64'), type='binary', name=url, url=url, ), context=self.context) def css_message(self, message): return """ body:before { background: #ffc; width: 100%%; font-size: 14px; font-family: monospace; white-space: pre; content: "%s"; } """ % message.replace('"', '\\"') def compile_sass(self): """ Checks if the bundle contains any sass content, then compiles it to css. Css compilation is done at the bundle level and not in the assets because they are potentially interdependant. """ sass = [asset for asset in self.stylesheets if isinstance(asset, SassAsset)] if not sass: return source = '\n'.join([asset.get_source() for asset in sass]) # move up all @import rules to the top and exclude file imports imports = [] def push(matchobj): ref = matchobj.group(2) line = '@import "%s"' % ref if '.' not in ref and line not in imports and not ref.startswith(('.', '/', '~')): imports.append(line) return '' source = re.sub(self.rx_sass_import, push, source) imports.append(source) source = u'\n'.join(imports) try: compiler = Popen(self.cmd_sass, stdin=PIPE, stdout=PIPE, stderr=PIPE) except Exception: msg = "Could not find 'sass' program needed to compile sass/scss files" _logger.error(msg) self.css_errors.append(msg) return result = compiler.communicate(input=source.encode('utf-8')) if compiler.returncode: error = self.get_sass_error(''.join(result), source=source) _logger.warning(error) self.css_errors.append(error) return compiled = result[0].strip().decode('utf8') fragments = self.rx_css_split.split(compiled)[1:] while fragments: asset_id = fragments.pop(0) asset = next(asset for asset in sass if asset.id == asset_id) asset._content = fragments.pop(0) def get_sass_error(self, stderr, source=None): # TODO: try to find out which asset the error belongs to error = stderr.split('Load paths')[0].replace(' Use --trace for backtrace.', '') error += "This error occured while compiling the bundle '%s' containing:" % self.xmlid for asset in self.stylesheets: if isinstance(asset, SassAsset): error += '\n - %s' % (asset.url if asset.url else '<inline sass>') return error class WebAsset(object): html_url = '%s' def __init__(self, bundle, inline=None, url=None): self.id = str(uuid.uuid4()) self.bundle = bundle self.inline = inline self.url = url self.cr = bundle.cr self.uid = bundle.uid self.registry = bundle.registry self.context = bundle.context self._content = None self._filename = None self._ir_attach = None name = '<inline asset>' if inline else url self.name = "%s defined in bundle '%s'" % (name, bundle.xmlid) if not inline and not url: raise Exception("An asset should either be inlined or url linked") def stat(self): if not (self.inline or self._filename or self._ir_attach): addon = filter(None, self.url.split('/'))[0] try: # Test url against modules static assets mpath = openerp.http.addons_manifest[addon]['addons_path'] self._filename = mpath + self.url.replace('/', os.path.sep) except Exception: try: # Test url against ir.attachments fields = ['__last_update', 'datas', 'mimetype'] domain = [('type', '=', 'binary'), ('url', '=', self.url)] ira = self.registry['ir.attachment'] attach = ira.search_read(self.cr, self.uid, domain, fields, context=self.context) self._ir_attach = attach[0] except Exception: raise AssetNotFound("Could not find %s" % self.name) def to_html(self): raise NotImplementedError() @lazy_property def last_modified(self): try: self.stat() if self._filename: return datetime.datetime.fromtimestamp(os.path.getmtime(self._filename)) elif self._ir_attach: server_format = openerp.tools.misc.DEFAULT_SERVER_DATETIME_FORMAT last_update = self._ir_attach['__last_update'] try: return datetime.datetime.strptime(last_update, server_format + '.%f') except ValueError: return datetime.datetime.strptime(last_update, server_format) except Exception: pass return datetime.datetime(1970, 1, 1) @property def content(self): if not self._content: self._content = self.inline or self._fetch_content() return self._content def _fetch_content(self): """ Fetch content from file or database""" try: self.stat() if self._filename: with open(self._filename, 'rb') as fp: return fp.read().decode('utf-8') else: return self._ir_attach['datas'].decode('base64') except UnicodeDecodeError: raise AssetError('%s is not utf-8 encoded.' % self.name) except IOError: raise AssetNotFound('File %s does not exist.' % self.name) except: raise AssetError('Could not get content for %s.' % self.name) def minify(self): return self.content def with_header(self, content=None): if content is None: content = self.content return '\n/* %s */\n%s' % (self.name, content) class JavascriptAsset(WebAsset): def minify(self): return self.with_header(rjsmin(self.content)) def _fetch_content(self): try: return super(JavascriptAsset, self)._fetch_content() except AssetError, e: return "console.error(%s);" % json.dumps(e.message) def to_html(self): if self.url: return '<script type="text/javascript" src="%s"></script>' % (self.html_url % self.url) else: return '<script type="text/javascript" charset="utf-8">%s</script>' % self.with_header() class StylesheetAsset(WebAsset): rx_import = re.compile(r"""@import\s+('|")(?!'|"|/|https?://)""", re.U) rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://|data:)""", re.U) rx_sourceMap = re.compile(r'(/\*# sourceMappingURL=.*)', re.U) rx_charset = re.compile(r'(@charset "[^"]+";)', re.U) def __init__(self, *args, **kw): self.media = kw.pop('media', None) super(StylesheetAsset, self).__init__(*args, **kw) @property def content(self): content = super(StylesheetAsset, self).content if self.media: content = '@media %s { %s }' % (self.media, content) return content def _fetch_content(self): try: content = super(StylesheetAsset, self)._fetch_content() web_dir = os.path.dirname(self.url) content = self.rx_import.sub( r"""@import \1%s/""" % (web_dir,), content, ) content = self.rx_url.sub( r"url(\1%s/" % (web_dir,), content, ) # remove charset declarations, we only support utf-8 content = self.rx_charset.sub('', content) except AssetError, e: self.bundle.css_errors.append(e.message) return '' return content def minify(self): # remove existing sourcemaps, make no sense after re-mini content = self.rx_sourceMap.sub('', self.content) # comments content = re.sub(r'/\*.*?\*/', '', content, flags=re.S) # space content = re.sub(r'\s+', ' ', content) content = re.sub(r' *([{}]) *', r'\1', content) return self.with_header(content) def to_html(self): media = (' media="%s"' % werkzeug.utils.escape(self.media)) if self.media else '' if self.url: href = self.html_url % self.url return '<link rel="stylesheet" href="%s" type="text/css"%s/>' % (href, media) else: return '<style type="text/css"%s>%s</style>' % (media, self.with_header()) class SassAsset(StylesheetAsset): html_url = '%s.css' rx_indent = re.compile(r'^( +|\t+)', re.M) indent = None reindent = ' ' def minify(self): return self.with_header() def to_html(self): if self.url: ira = self.registry['ir.attachment'] url = self.html_url % self.url domain = [('type', '=', 'binary'), ('url', '=', self.url)] ira_id = ira.search(self.cr, self.uid, domain, context=self.context) if ira_id: # TODO: update only if needed ira.write(self.cr, openerp.SUPERUSER_ID, [ira_id], {'datas': self.content}, context=self.context) else: ira.create(self.cr, openerp.SUPERUSER_ID, dict( datas=self.content.encode('utf8').encode('base64'), mimetype='text/css', type='binary', name=url, url=url, ), context=self.context) return super(SassAsset, self).to_html() def get_source(self): content = textwrap.dedent(self.inline or self._fetch_content()) def fix_indent(m): ind = m.group() if self.indent is None: self.indent = ind if self.indent == self.reindent: # Don't reindent the file if identation is the final one (reindent) raise StopIteration() return ind.replace(self.indent, self.reindent) try: content = self.rx_indent.sub(fix_indent, content) except StopIteration: pass return "/*! %s */\n%s" % (self.id, content) def rjsmin(script): """ Minify js with a clever regex. Taken from http://opensource.perlig.de/rjsmin Apache License, Version 2.0 """ def subber(match): """ Substitution callback """ groups = match.groups() return ( groups[0] or groups[1] or groups[2] or groups[3] or (groups[4] and '\n') or (groups[5] and ' ') or (groups[6] and ' ') or (groups[7] and ' ') or '' ) result = re.sub( r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?' r'\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|' r'\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?:(?<=[(,=:\[!&|?{};\r\n]' r')(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/' r'))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*' r'(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]*' r'))|(?:(?<=[\000-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\01' r'6-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*((?:/(?![\r\n/*])[^/' r'\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]' r'*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]*))|(?<=[^\000-!#%&(*,./' r':-@\[\\^`{|~])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/' r'*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\01' r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#' r'%-\047)*,./:-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-' r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^' r'\000-#%-,./:-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|' r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\0' r'13\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\0' r'00-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:' r'(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*' r']*\*+(?:[^/*][^*]*\*+)*/))*)+', subber, '\n%s\n' % script ).strip() return result # vim:et:
agpl-3.0
neilLasrado/erpnext
erpnext/projects/doctype/project_update/project_update.py
18
2577
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class ProjectUpdate(Document): pass @frappe.whitelist() def daily_reminder(): project = frappe.db.sql("""SELECT `tabProject`.project_name,`tabProject`.frequency,`tabProject`.expected_start_date,`tabProject`.expected_end_date,`tabProject`.percent_complete FROM `tabProject`;""") for projects in project: project_name = projects[0] frequency = projects[1] date_start = projects[2] date_end = projects [3] progress = projects [4] draft = frappe.db.sql("""SELECT count(docstatus) from `tabProject Update` WHERE `tabProject Update`.project = %s AND `tabProject Update`.docstatus = 0;""",project_name) for drafts in draft: number_of_drafts = drafts[0] update = frappe.db.sql("""SELECT name,date,time,progress,progress_details FROM `tabProject Update` WHERE `tabProject Update`.project = %s AND date = DATE_ADD(CURDATE(), INTERVAL -1 DAY);""",project_name) email_sending(project_name,frequency,date_start,date_end,progress,number_of_drafts,update) def email_sending(project_name,frequency,date_start,date_end,progress,number_of_drafts,update): holiday = frappe.db.sql("""SELECT holiday_date FROM `tabHoliday` where holiday_date = CURDATE();""") msg = "<p>Project Name: " + project_name + "</p><p>Frequency: " + " " + frequency + "</p><p>Update Reminder:" + " " + str(date_start) + "</p><p>Expected Date End:" + " " + str(date_end) + "</p><p>Percent Progress:" + " " + str(progress) + "</p><p>Number of Updates:" + " " + str(len(update)) + "</p>" + "</p><p>Number of drafts:" + " " + str(number_of_drafts) + "</p>" msg += """</u></b></p><table class='table table-bordered'><tr> <th>Project ID</th><th>Date Updated</th><th>Time Updated</th><th>Project Status</th><th>Notes</th>""" for updates in update: msg += "<tr><td>" + str(updates[0]) + "</td><td>" + str(updates[1]) + "</td><td>" + str(updates[2]) + "</td><td>" + str(updates[3]) + "</td>" + "</td><td>" + str(updates[4]) + "</td></tr>" msg += "</table>" if len(holiday) == 0: email = frappe.db.sql("""SELECT user from `tabProject User` WHERE parent = %s;""", project_name) for emails in email: frappe.sendmail(recipients=emails,subject=frappe._(project_name + ' ' + 'Summary'),message = msg) else: pass
gpl-3.0
volatilityfoundation/volatility
volatility/plugins/overlays/windows/win10_x86_vtypes.py
4
703386
ntkrpamp_types = { 'LIST_ENTRY64' : [ 0x10, { 'Flink' : [ 0x0, ['unsigned long long']], 'Blink' : [ 0x8, ['unsigned long long']], } ], 'LIST_ENTRY32' : [ 0x8, { 'Flink' : [ 0x0, ['unsigned long']], 'Blink' : [ 0x4, ['unsigned long']], } ], '_KUSER_SHARED_DATA' : [ 0x708, { 'TickCountLowDeprecated' : [ 0x0, ['unsigned long']], 'TickCountMultiplier' : [ 0x4, ['unsigned long']], 'InterruptTime' : [ 0x8, ['_KSYSTEM_TIME']], 'SystemTime' : [ 0x14, ['_KSYSTEM_TIME']], 'TimeZoneBias' : [ 0x20, ['_KSYSTEM_TIME']], 'ImageNumberLow' : [ 0x2c, ['unsigned short']], 'ImageNumberHigh' : [ 0x2e, ['unsigned short']], 'NtSystemRoot' : [ 0x30, ['array', 260, ['wchar']]], 'MaxStackTraceDepth' : [ 0x238, ['unsigned long']], 'CryptoExponent' : [ 0x23c, ['unsigned long']], 'TimeZoneId' : [ 0x240, ['unsigned long']], 'LargePageMinimum' : [ 0x244, ['unsigned long']], 'AitSamplingValue' : [ 0x248, ['unsigned long']], 'AppCompatFlag' : [ 0x24c, ['unsigned long']], 'RNGSeedVersion' : [ 0x250, ['unsigned long long']], 'GlobalValidationRunlevel' : [ 0x258, ['unsigned long']], 'TimeZoneBiasStamp' : [ 0x25c, ['long']], 'NtBuildNumber' : [ 0x260, ['unsigned long']], 'NtProductType' : [ 0x264, ['Enumeration', dict(target = 'long', choices = {1: 'NtProductWinNt', 2: 'NtProductLanManNt', 3: 'NtProductServer'})]], 'ProductTypeIsValid' : [ 0x268, ['unsigned char']], 'Reserved0' : [ 0x269, ['array', 1, ['unsigned char']]], 'NativeProcessorArchitecture' : [ 0x26a, ['unsigned short']], 'NtMajorVersion' : [ 0x26c, ['unsigned long']], 'NtMinorVersion' : [ 0x270, ['unsigned long']], 'ProcessorFeatures' : [ 0x274, ['array', 64, ['unsigned char']]], 'Reserved1' : [ 0x2b4, ['unsigned long']], 'Reserved3' : [ 0x2b8, ['unsigned long']], 'TimeSlip' : [ 0x2bc, ['unsigned long']], 'AlternativeArchitecture' : [ 0x2c0, ['Enumeration', dict(target = 'long', choices = {0: 'StandardDesign', 1: 'NEC98x86', 2: 'EndAlternatives'})]], 'BootId' : [ 0x2c4, ['unsigned long']], 'SystemExpirationDate' : [ 0x2c8, ['_LARGE_INTEGER']], 'SuiteMask' : [ 0x2d0, ['unsigned long']], 'KdDebuggerEnabled' : [ 0x2d4, ['unsigned char']], 'MitigationPolicies' : [ 0x2d5, ['unsigned char']], 'NXSupportPolicy' : [ 0x2d5, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned char')]], 'SEHValidationPolicy' : [ 0x2d5, ['BitField', dict(start_bit = 2, end_bit = 4, native_type='unsigned char')]], 'CurDirDevicesSkippedForDlls' : [ 0x2d5, ['BitField', dict(start_bit = 4, end_bit = 6, native_type='unsigned char')]], 'Reserved' : [ 0x2d5, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], 'Reserved6' : [ 0x2d6, ['array', 2, ['unsigned char']]], 'ActiveConsoleId' : [ 0x2d8, ['unsigned long']], 'DismountCount' : [ 0x2dc, ['unsigned long']], 'ComPlusPackage' : [ 0x2e0, ['unsigned long']], 'LastSystemRITEventTickCount' : [ 0x2e4, ['unsigned long']], 'NumberOfPhysicalPages' : [ 0x2e8, ['unsigned long']], 'SafeBootMode' : [ 0x2ec, ['unsigned char']], 'Reserved12' : [ 0x2ed, ['array', 3, ['unsigned char']]], 'SharedDataFlags' : [ 0x2f0, ['unsigned long']], 'DbgErrorPortPresent' : [ 0x2f0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DbgElevationEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'DbgVirtEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'DbgInstallerDetectEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'DbgLkgEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'DbgDynProcessorEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'DbgConsoleBrokerEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'DbgSecureBootEnabled' : [ 0x2f0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'DbgMultiSessionSku' : [ 0x2f0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'SpareBits' : [ 0x2f0, ['BitField', dict(start_bit = 9, end_bit = 32, native_type='unsigned long')]], 'DataFlagsPad' : [ 0x2f4, ['array', 1, ['unsigned long']]], 'TestRetInstruction' : [ 0x2f8, ['unsigned long long']], 'QpcFrequency' : [ 0x300, ['long long']], 'SystemCallPad' : [ 0x308, ['array', 3, ['unsigned long long']]], 'TickCount' : [ 0x320, ['_KSYSTEM_TIME']], 'TickCountQuad' : [ 0x320, ['unsigned long long']], 'ReservedTickCountOverlay' : [ 0x320, ['array', 3, ['unsigned long']]], 'TickCountPad' : [ 0x32c, ['array', 1, ['unsigned long']]], 'Cookie' : [ 0x330, ['unsigned long']], 'CookiePad' : [ 0x334, ['array', 1, ['unsigned long']]], 'ConsoleSessionForegroundProcessId' : [ 0x338, ['long long']], 'TimeUpdateLock' : [ 0x340, ['unsigned long long']], 'BaselineSystemTimeQpc' : [ 0x348, ['unsigned long long']], 'BaselineInterruptTimeQpc' : [ 0x350, ['unsigned long long']], 'QpcSystemTimeIncrement' : [ 0x358, ['unsigned long long']], 'QpcInterruptTimeIncrement' : [ 0x360, ['unsigned long long']], 'QpcSystemTimeIncrementShift' : [ 0x368, ['unsigned char']], 'QpcInterruptTimeIncrementShift' : [ 0x369, ['unsigned char']], 'UnparkedProcessorCount' : [ 0x36a, ['unsigned short']], 'Reserved8' : [ 0x36c, ['array', 20, ['unsigned char']]], 'UserModeGlobalLogger' : [ 0x380, ['array', 16, ['unsigned short']]], 'ImageFileExecutionOptions' : [ 0x3a0, ['unsigned long']], 'LangGenerationCount' : [ 0x3a4, ['unsigned long']], 'Reserved4' : [ 0x3a8, ['unsigned long long']], 'InterruptTimeBias' : [ 0x3b0, ['unsigned long long']], 'QpcBias' : [ 0x3b8, ['unsigned long long']], 'ActiveProcessorCount' : [ 0x3c0, ['unsigned long']], 'ActiveGroupCount' : [ 0x3c4, ['unsigned char']], 'Reserved9' : [ 0x3c5, ['unsigned char']], 'QpcData' : [ 0x3c6, ['unsigned short']], 'QpcBypassEnabled' : [ 0x3c6, ['unsigned char']], 'QpcShift' : [ 0x3c7, ['unsigned char']], 'TimeZoneBiasEffectiveStart' : [ 0x3c8, ['_LARGE_INTEGER']], 'TimeZoneBiasEffectiveEnd' : [ 0x3d0, ['_LARGE_INTEGER']], 'XState' : [ 0x3d8, ['_XSTATE_CONFIGURATION']], } ], '__unnamed_107d' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], } ], '_ULARGE_INTEGER' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], 'u' : [ 0x0, ['__unnamed_107d']], 'QuadPart' : [ 0x0, ['unsigned long long']], } ], '__unnamed_1081' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], } ], '_LARGE_INTEGER' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], 'u' : [ 0x0, ['__unnamed_1081']], 'QuadPart' : [ 0x0, ['long long']], } ], '__unnamed_109c' : [ 0x4, { 'LongFunction' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Persistent' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Private' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_109e' : [ 0x4, { 'Flags' : [ 0x0, ['unsigned long']], 's' : [ 0x0, ['__unnamed_109c']], } ], '_TP_CALLBACK_ENVIRON_V3' : [ 0x28, { 'Version' : [ 0x0, ['unsigned long']], 'Pool' : [ 0x4, ['pointer', ['_TP_POOL']]], 'CleanupGroup' : [ 0x8, ['pointer', ['_TP_CLEANUP_GROUP']]], 'CleanupGroupCancelCallback' : [ 0xc, ['pointer', ['void']]], 'RaceDll' : [ 0x10, ['pointer', ['void']]], 'ActivationContext' : [ 0x14, ['pointer', ['_ACTIVATION_CONTEXT']]], 'FinalizationCallback' : [ 0x18, ['pointer', ['void']]], 'u' : [ 0x1c, ['__unnamed_109e']], 'CallbackPriority' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'TP_CALLBACK_PRIORITY_HIGH', 1: 'TP_CALLBACK_PRIORITY_NORMAL', 2: 'TP_CALLBACK_PRIORITY_LOW', 3: 'TP_CALLBACK_PRIORITY_COUNT'})]], 'Size' : [ 0x24, ['unsigned long']], } ], '_TEB' : [ 0x1000, { 'NtTib' : [ 0x0, ['_NT_TIB']], 'EnvironmentPointer' : [ 0x1c, ['pointer', ['void']]], 'ClientId' : [ 0x20, ['_CLIENT_ID']], 'ActiveRpcHandle' : [ 0x28, ['pointer', ['void']]], 'ThreadLocalStoragePointer' : [ 0x2c, ['pointer', ['void']]], 'ProcessEnvironmentBlock' : [ 0x30, ['pointer', ['_PEB']]], 'LastErrorValue' : [ 0x34, ['unsigned long']], 'CountOfOwnedCriticalSections' : [ 0x38, ['unsigned long']], 'CsrClientThread' : [ 0x3c, ['pointer', ['void']]], 'Win32ThreadInfo' : [ 0x40, ['pointer', ['void']]], 'User32Reserved' : [ 0x44, ['array', 26, ['unsigned long']]], 'UserReserved' : [ 0xac, ['array', 5, ['unsigned long']]], 'WOW32Reserved' : [ 0xc0, ['pointer', ['void']]], 'CurrentLocale' : [ 0xc4, ['unsigned long']], 'FpSoftwareStatusRegister' : [ 0xc8, ['unsigned long']], 'ReservedForDebuggerInstrumentation' : [ 0xcc, ['array', 16, ['pointer', ['void']]]], 'SystemReserved1' : [ 0x10c, ['array', 38, ['pointer', ['void']]]], 'ExceptionCode' : [ 0x1a4, ['long']], 'ActivationContextStackPointer' : [ 0x1a8, ['pointer', ['_ACTIVATION_CONTEXT_STACK']]], 'InstrumentationCallbackSp' : [ 0x1ac, ['unsigned long']], 'InstrumentationCallbackPreviousPc' : [ 0x1b0, ['unsigned long']], 'InstrumentationCallbackPreviousSp' : [ 0x1b4, ['unsigned long']], 'InstrumentationCallbackDisabled' : [ 0x1b8, ['unsigned char']], 'SpareBytes' : [ 0x1b9, ['array', 23, ['unsigned char']]], 'TxFsContext' : [ 0x1d0, ['unsigned long']], 'GdiTebBatch' : [ 0x1d4, ['_GDI_TEB_BATCH']], 'RealClientId' : [ 0x6b4, ['_CLIENT_ID']], 'GdiCachedProcessHandle' : [ 0x6bc, ['pointer', ['void']]], 'GdiClientPID' : [ 0x6c0, ['unsigned long']], 'GdiClientTID' : [ 0x6c4, ['unsigned long']], 'GdiThreadLocalInfo' : [ 0x6c8, ['pointer', ['void']]], 'Win32ClientInfo' : [ 0x6cc, ['array', 62, ['unsigned long']]], 'glDispatchTable' : [ 0x7c4, ['array', 233, ['pointer', ['void']]]], 'glReserved1' : [ 0xb68, ['array', 29, ['unsigned long']]], 'glReserved2' : [ 0xbdc, ['pointer', ['void']]], 'glSectionInfo' : [ 0xbe0, ['pointer', ['void']]], 'glSection' : [ 0xbe4, ['pointer', ['void']]], 'glTable' : [ 0xbe8, ['pointer', ['void']]], 'glCurrentRC' : [ 0xbec, ['pointer', ['void']]], 'glContext' : [ 0xbf0, ['pointer', ['void']]], 'LastStatusValue' : [ 0xbf4, ['unsigned long']], 'StaticUnicodeString' : [ 0xbf8, ['_UNICODE_STRING']], 'StaticUnicodeBuffer' : [ 0xc00, ['array', 261, ['wchar']]], 'DeallocationStack' : [ 0xe0c, ['pointer', ['void']]], 'TlsSlots' : [ 0xe10, ['array', 64, ['pointer', ['void']]]], 'TlsLinks' : [ 0xf10, ['_LIST_ENTRY']], 'Vdm' : [ 0xf18, ['pointer', ['void']]], 'ReservedForNtRpc' : [ 0xf1c, ['pointer', ['void']]], 'DbgSsReserved' : [ 0xf20, ['array', 2, ['pointer', ['void']]]], 'HardErrorMode' : [ 0xf28, ['unsigned long']], 'Instrumentation' : [ 0xf2c, ['array', 9, ['pointer', ['void']]]], 'ActivityId' : [ 0xf50, ['_GUID']], 'SubProcessTag' : [ 0xf60, ['pointer', ['void']]], 'PerflibData' : [ 0xf64, ['pointer', ['void']]], 'EtwTraceData' : [ 0xf68, ['pointer', ['void']]], 'WinSockData' : [ 0xf6c, ['pointer', ['void']]], 'GdiBatchCount' : [ 0xf70, ['unsigned long']], 'CurrentIdealProcessor' : [ 0xf74, ['_PROCESSOR_NUMBER']], 'IdealProcessorValue' : [ 0xf74, ['unsigned long']], 'ReservedPad0' : [ 0xf74, ['unsigned char']], 'ReservedPad1' : [ 0xf75, ['unsigned char']], 'ReservedPad2' : [ 0xf76, ['unsigned char']], 'IdealProcessor' : [ 0xf77, ['unsigned char']], 'GuaranteedStackBytes' : [ 0xf78, ['unsigned long']], 'ReservedForPerf' : [ 0xf7c, ['pointer', ['void']]], 'ReservedForOle' : [ 0xf80, ['pointer', ['void']]], 'WaitingOnLoaderLock' : [ 0xf84, ['unsigned long']], 'SavedPriorityState' : [ 0xf88, ['pointer', ['void']]], 'ReservedForCodeCoverage' : [ 0xf8c, ['unsigned long']], 'ThreadPoolData' : [ 0xf90, ['pointer', ['void']]], 'TlsExpansionSlots' : [ 0xf94, ['pointer', ['pointer', ['void']]]], 'MuiGeneration' : [ 0xf98, ['unsigned long']], 'IsImpersonating' : [ 0xf9c, ['unsigned long']], 'NlsCache' : [ 0xfa0, ['pointer', ['void']]], 'pShimData' : [ 0xfa4, ['pointer', ['void']]], 'HeapVirtualAffinity' : [ 0xfa8, ['unsigned short']], 'LowFragHeapDataSlot' : [ 0xfaa, ['unsigned short']], 'CurrentTransactionHandle' : [ 0xfac, ['pointer', ['void']]], 'ActiveFrame' : [ 0xfb0, ['pointer', ['_TEB_ACTIVE_FRAME']]], 'FlsData' : [ 0xfb4, ['pointer', ['void']]], 'PreferredLanguages' : [ 0xfb8, ['pointer', ['void']]], 'UserPrefLanguages' : [ 0xfbc, ['pointer', ['void']]], 'MergedPrefLanguages' : [ 0xfc0, ['pointer', ['void']]], 'MuiImpersonation' : [ 0xfc4, ['unsigned long']], 'CrossTebFlags' : [ 0xfc8, ['unsigned short']], 'SpareCrossTebBits' : [ 0xfc8, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned short')]], 'SameTebFlags' : [ 0xfca, ['unsigned short']], 'SafeThunkCall' : [ 0xfca, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'InDebugPrint' : [ 0xfca, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'HasFiberData' : [ 0xfca, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'SkipThreadAttach' : [ 0xfca, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'WerInShipAssertCode' : [ 0xfca, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'RanProcessInit' : [ 0xfca, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned short')]], 'ClonedThread' : [ 0xfca, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'SuppressDebugMsg' : [ 0xfca, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned short')]], 'DisableUserStackWalk' : [ 0xfca, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned short')]], 'RtlExceptionAttached' : [ 0xfca, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned short')]], 'InitialThread' : [ 0xfca, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned short')]], 'SessionAware' : [ 0xfca, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned short')]], 'LoadOwner' : [ 0xfca, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned short')]], 'LoaderWorker' : [ 0xfca, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned short')]], 'SpareSameTebBits' : [ 0xfca, ['BitField', dict(start_bit = 14, end_bit = 16, native_type='unsigned short')]], 'TxnScopeEnterCallback' : [ 0xfcc, ['pointer', ['void']]], 'TxnScopeExitCallback' : [ 0xfd0, ['pointer', ['void']]], 'TxnScopeContext' : [ 0xfd4, ['pointer', ['void']]], 'LockCount' : [ 0xfd8, ['unsigned long']], 'WowTebOffset' : [ 0xfdc, ['long']], 'ResourceRetValue' : [ 0xfe0, ['pointer', ['void']]], 'ReservedForWdf' : [ 0xfe4, ['pointer', ['void']]], 'ReservedForCrt' : [ 0xfe8, ['unsigned long long']], 'EffectiveContainerId' : [ 0xff0, ['_GUID']], } ], '_LIST_ENTRY' : [ 0x8, { 'Flink' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'Blink' : [ 0x4, ['pointer', ['_LIST_ENTRY']]], } ], '_SINGLE_LIST_ENTRY' : [ 0x4, { 'Next' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_RTL_SPLAY_LINKS' : [ 0xc, { 'Parent' : [ 0x0, ['pointer', ['_RTL_SPLAY_LINKS']]], 'LeftChild' : [ 0x4, ['pointer', ['_RTL_SPLAY_LINKS']]], 'RightChild' : [ 0x8, ['pointer', ['_RTL_SPLAY_LINKS']]], } ], '_RTL_DYNAMIC_HASH_TABLE_CONTEXT' : [ 0xc, { 'ChainHead' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'PrevLinkage' : [ 0x4, ['pointer', ['_LIST_ENTRY']]], 'Signature' : [ 0x8, ['unsigned long']], } ], '_RTL_DYNAMIC_HASH_TABLE_ENUMERATOR' : [ 0x14, { 'HashEntry' : [ 0x0, ['_RTL_DYNAMIC_HASH_TABLE_ENTRY']], 'CurEntry' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'ChainHead' : [ 0xc, ['pointer', ['_LIST_ENTRY']]], 'BucketIndex' : [ 0x10, ['unsigned long']], } ], '_RTL_DYNAMIC_HASH_TABLE' : [ 0x24, { 'Flags' : [ 0x0, ['unsigned long']], 'Shift' : [ 0x4, ['unsigned long']], 'TableSize' : [ 0x8, ['unsigned long']], 'Pivot' : [ 0xc, ['unsigned long']], 'DivisorMask' : [ 0x10, ['unsigned long']], 'NumEntries' : [ 0x14, ['unsigned long']], 'NonEmptyBuckets' : [ 0x18, ['unsigned long']], 'NumEnumerators' : [ 0x1c, ['unsigned long']], 'Directory' : [ 0x20, ['pointer', ['void']]], } ], '_UNICODE_STRING' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x4, ['pointer', ['unsigned short']]], } ], '_STRING' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x4, ['pointer', ['unsigned char']]], } ], '_LUID' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['long']], } ], '_IMAGE_NT_HEADERS' : [ 0xf8, { 'Signature' : [ 0x0, ['unsigned long']], 'FileHeader' : [ 0x4, ['_IMAGE_FILE_HEADER']], 'OptionalHeader' : [ 0x18, ['_IMAGE_OPTIONAL_HEADER']], } ], '_IMAGE_DOS_HEADER' : [ 0x40, { 'e_magic' : [ 0x0, ['unsigned short']], 'e_cblp' : [ 0x2, ['unsigned short']], 'e_cp' : [ 0x4, ['unsigned short']], 'e_crlc' : [ 0x6, ['unsigned short']], 'e_cparhdr' : [ 0x8, ['unsigned short']], 'e_minalloc' : [ 0xa, ['unsigned short']], 'e_maxalloc' : [ 0xc, ['unsigned short']], 'e_ss' : [ 0xe, ['unsigned short']], 'e_sp' : [ 0x10, ['unsigned short']], 'e_csum' : [ 0x12, ['unsigned short']], 'e_ip' : [ 0x14, ['unsigned short']], 'e_cs' : [ 0x16, ['unsigned short']], 'e_lfarlc' : [ 0x18, ['unsigned short']], 'e_ovno' : [ 0x1a, ['unsigned short']], 'e_res' : [ 0x1c, ['array', 4, ['unsigned short']]], 'e_oemid' : [ 0x24, ['unsigned short']], 'e_oeminfo' : [ 0x26, ['unsigned short']], 'e_res2' : [ 0x28, ['array', 10, ['unsigned short']]], 'e_lfanew' : [ 0x3c, ['long']], } ], '_RTL_RB_TREE' : [ 0x8, { 'Root' : [ 0x0, ['pointer', ['_RTL_BALANCED_NODE']]], 'Min' : [ 0x4, ['pointer', ['_RTL_BALANCED_NODE']]], } ], '_RTL_BALANCED_NODE' : [ 0xc, { 'Children' : [ 0x0, ['array', 2, ['pointer', ['_RTL_BALANCED_NODE']]]], 'Left' : [ 0x0, ['pointer', ['_RTL_BALANCED_NODE']]], 'Right' : [ 0x4, ['pointer', ['_RTL_BALANCED_NODE']]], 'Red' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Balance' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned char')]], 'ParentValue' : [ 0x8, ['unsigned long']], } ], '_RTL_AVL_TREE' : [ 0x4, { 'Root' : [ 0x0, ['pointer', ['_RTL_BALANCED_NODE']]], } ], '_GUID' : [ 0x10, { 'Data1' : [ 0x0, ['unsigned long']], 'Data2' : [ 0x4, ['unsigned short']], 'Data3' : [ 0x6, ['unsigned short']], 'Data4' : [ 0x8, ['array', 8, ['unsigned char']]], } ], '_KPCR' : [ 0x4a20, { 'NtTib' : [ 0x0, ['_NT_TIB']], 'Used_ExceptionList' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'Used_StackBase' : [ 0x4, ['pointer', ['void']]], 'MxCsr' : [ 0x8, ['unsigned long']], 'TssCopy' : [ 0xc, ['pointer', ['void']]], 'ContextSwitches' : [ 0x10, ['unsigned long']], 'SetMemberCopy' : [ 0x14, ['unsigned long']], 'Used_Self' : [ 0x18, ['pointer', ['void']]], 'SelfPcr' : [ 0x1c, ['pointer', ['_KPCR']]], 'Prcb' : [ 0x20, ['pointer', ['_KPRCB']]], 'Irql' : [ 0x24, ['unsigned char']], 'IRR' : [ 0x28, ['unsigned long']], 'IrrActive' : [ 0x2c, ['unsigned long']], 'IDR' : [ 0x30, ['unsigned long']], 'KdVersionBlock' : [ 0x34, ['pointer', ['void']]], 'IDT' : [ 0x38, ['pointer', ['_KIDTENTRY']]], 'GDT' : [ 0x3c, ['pointer', ['_KGDTENTRY']]], 'TSS' : [ 0x40, ['pointer', ['_KTSS']]], 'MajorVersion' : [ 0x44, ['unsigned short']], 'MinorVersion' : [ 0x46, ['unsigned short']], 'SetMember' : [ 0x48, ['unsigned long']], 'StallScaleFactor' : [ 0x4c, ['unsigned long']], 'SpareUnused' : [ 0x50, ['unsigned char']], 'Number' : [ 0x51, ['unsigned char']], 'Spare0' : [ 0x52, ['unsigned char']], 'SecondLevelCacheAssociativity' : [ 0x53, ['unsigned char']], 'VdmAlert' : [ 0x54, ['unsigned long']], 'KernelReserved' : [ 0x58, ['array', 14, ['unsigned long']]], 'SecondLevelCacheSize' : [ 0x90, ['unsigned long']], 'HalReserved' : [ 0x94, ['array', 16, ['unsigned long']]], 'InterruptMode' : [ 0xd4, ['unsigned long']], 'Spare1' : [ 0xd8, ['unsigned char']], 'KernelReserved2' : [ 0xdc, ['array', 17, ['unsigned long']]], 'PrcbData' : [ 0x120, ['_KPRCB']], } ], '_KPRCB' : [ 0x4900, { 'MinorVersion' : [ 0x0, ['unsigned short']], 'MajorVersion' : [ 0x2, ['unsigned short']], 'CurrentThread' : [ 0x4, ['pointer', ['_KTHREAD']]], 'NextThread' : [ 0x8, ['pointer', ['_KTHREAD']]], 'IdleThread' : [ 0xc, ['pointer', ['_KTHREAD']]], 'LegacyNumber' : [ 0x10, ['unsigned char']], 'NestingLevel' : [ 0x11, ['unsigned char']], 'BuildType' : [ 0x12, ['unsigned short']], 'CpuType' : [ 0x14, ['unsigned char']], 'CpuID' : [ 0x15, ['unsigned char']], 'CpuStep' : [ 0x16, ['unsigned short']], 'CpuStepping' : [ 0x16, ['unsigned char']], 'CpuModel' : [ 0x17, ['unsigned char']], 'ProcessorState' : [ 0x18, ['_KPROCESSOR_STATE']], 'ParentNode' : [ 0x338, ['pointer', ['_KNODE']]], 'PriorityState' : [ 0x33c, ['pointer', ['unsigned char']]], 'KernelReserved' : [ 0x340, ['array', 14, ['unsigned long']]], 'HalReserved' : [ 0x378, ['array', 16, ['unsigned long']]], 'CFlushSize' : [ 0x3b8, ['unsigned long']], 'CoresPerPhysicalProcessor' : [ 0x3bc, ['unsigned char']], 'LogicalProcessorsPerCore' : [ 0x3bd, ['unsigned char']], 'CpuVendor' : [ 0x3be, ['unsigned char']], 'PrcbPad0' : [ 0x3bf, ['array', 1, ['unsigned char']]], 'MHz' : [ 0x3c0, ['unsigned long']], 'GroupIndex' : [ 0x3c4, ['unsigned char']], 'Group' : [ 0x3c5, ['unsigned char']], 'PrcbPad05' : [ 0x3c6, ['array', 2, ['unsigned char']]], 'GroupSetMember' : [ 0x3c8, ['unsigned long']], 'Number' : [ 0x3cc, ['unsigned long']], 'ClockOwner' : [ 0x3d0, ['unsigned char']], 'PendingTickFlags' : [ 0x3d1, ['unsigned char']], 'PendingTick' : [ 0x3d1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'PendingBackupTick' : [ 0x3d1, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'PrcbPad10' : [ 0x3d2, ['array', 70, ['unsigned char']]], 'LockQueue' : [ 0x418, ['array', 17, ['_KSPIN_LOCK_QUEUE']]], 'InterruptCount' : [ 0x4a0, ['unsigned long']], 'KernelTime' : [ 0x4a4, ['unsigned long']], 'UserTime' : [ 0x4a8, ['unsigned long']], 'DpcTime' : [ 0x4ac, ['unsigned long']], 'DpcTimeCount' : [ 0x4b0, ['unsigned long']], 'InterruptTime' : [ 0x4b4, ['unsigned long']], 'AdjustDpcThreshold' : [ 0x4b8, ['unsigned long']], 'PageColor' : [ 0x4bc, ['unsigned long']], 'DebuggerSavedIRQL' : [ 0x4c0, ['unsigned char']], 'NodeColor' : [ 0x4c1, ['unsigned char']], 'DeepSleep' : [ 0x4c2, ['unsigned char']], 'PrcbPad20' : [ 0x4c3, ['array', 5, ['unsigned char']]], 'NodeShiftedColor' : [ 0x4c8, ['unsigned long']], 'SecondaryColorMask' : [ 0x4cc, ['unsigned long']], 'DpcTimeLimit' : [ 0x4d0, ['unsigned long']], 'PrcbPad21' : [ 0x4d4, ['array', 3, ['unsigned long']]], 'CcFastReadNoWait' : [ 0x4e0, ['unsigned long']], 'CcFastReadWait' : [ 0x4e4, ['unsigned long']], 'CcFastReadNotPossible' : [ 0x4e8, ['unsigned long']], 'CcCopyReadNoWait' : [ 0x4ec, ['unsigned long']], 'CcCopyReadWait' : [ 0x4f0, ['unsigned long']], 'CcCopyReadNoWaitMiss' : [ 0x4f4, ['unsigned long']], 'MmSpinLockOrdering' : [ 0x4f8, ['long']], 'IoReadOperationCount' : [ 0x4fc, ['long']], 'IoWriteOperationCount' : [ 0x500, ['long']], 'IoOtherOperationCount' : [ 0x504, ['long']], 'IoReadTransferCount' : [ 0x508, ['_LARGE_INTEGER']], 'IoWriteTransferCount' : [ 0x510, ['_LARGE_INTEGER']], 'IoOtherTransferCount' : [ 0x518, ['_LARGE_INTEGER']], 'CcFastMdlReadNoWait' : [ 0x520, ['unsigned long']], 'CcFastMdlReadWait' : [ 0x524, ['unsigned long']], 'CcFastMdlReadNotPossible' : [ 0x528, ['unsigned long']], 'CcMapDataNoWait' : [ 0x52c, ['unsigned long']], 'CcMapDataWait' : [ 0x530, ['unsigned long']], 'CcPinMappedDataCount' : [ 0x534, ['unsigned long']], 'CcPinReadNoWait' : [ 0x538, ['unsigned long']], 'CcPinReadWait' : [ 0x53c, ['unsigned long']], 'CcMdlReadNoWait' : [ 0x540, ['unsigned long']], 'CcMdlReadWait' : [ 0x544, ['unsigned long']], 'CcLazyWriteHotSpots' : [ 0x548, ['unsigned long']], 'CcLazyWriteIos' : [ 0x54c, ['unsigned long']], 'CcLazyWritePages' : [ 0x550, ['unsigned long']], 'CcDataFlushes' : [ 0x554, ['unsigned long']], 'CcDataPages' : [ 0x558, ['unsigned long']], 'CcLostDelayedWrites' : [ 0x55c, ['unsigned long']], 'CcFastReadResourceMiss' : [ 0x560, ['unsigned long']], 'CcCopyReadWaitMiss' : [ 0x564, ['unsigned long']], 'CcFastMdlReadResourceMiss' : [ 0x568, ['unsigned long']], 'CcMapDataNoWaitMiss' : [ 0x56c, ['unsigned long']], 'CcMapDataWaitMiss' : [ 0x570, ['unsigned long']], 'CcPinReadNoWaitMiss' : [ 0x574, ['unsigned long']], 'CcPinReadWaitMiss' : [ 0x578, ['unsigned long']], 'CcMdlReadNoWaitMiss' : [ 0x57c, ['unsigned long']], 'CcMdlReadWaitMiss' : [ 0x580, ['unsigned long']], 'CcReadAheadIos' : [ 0x584, ['unsigned long']], 'KeAlignmentFixupCount' : [ 0x588, ['unsigned long']], 'KeExceptionDispatchCount' : [ 0x58c, ['unsigned long']], 'KeSystemCalls' : [ 0x590, ['unsigned long']], 'AvailableTime' : [ 0x594, ['unsigned long']], 'PrcbPad22' : [ 0x598, ['array', 2, ['unsigned long']]], 'PPLookasideList' : [ 0x5a0, ['array', 16, ['_PP_LOOKASIDE_LIST']]], 'PPNxPagedLookasideList' : [ 0x620, ['array', 32, ['_GENERAL_LOOKASIDE_POOL']]], 'PPNPagedLookasideList' : [ 0xf20, ['array', 32, ['_GENERAL_LOOKASIDE_POOL']]], 'PPPagedLookasideList' : [ 0x1820, ['array', 32, ['_GENERAL_LOOKASIDE_POOL']]], 'PacketBarrier' : [ 0x2120, ['long']], 'ReverseStall' : [ 0x2124, ['long']], 'IpiFrame' : [ 0x2128, ['pointer', ['void']]], 'PrcbPad3' : [ 0x212c, ['array', 52, ['unsigned char']]], 'CurrentPacket' : [ 0x2160, ['array', 3, ['pointer', ['void']]]], 'TargetSet' : [ 0x216c, ['unsigned long']], 'WorkerRoutine' : [ 0x2170, ['pointer', ['void']]], 'IpiFrozen' : [ 0x2174, ['unsigned long']], 'PrcbPad4' : [ 0x2178, ['array', 40, ['unsigned char']]], 'RequestSummary' : [ 0x21a0, ['unsigned long']], 'TargetCount' : [ 0x21a4, ['long']], 'PrcbPad50' : [ 0x21a8, ['array', 40, ['unsigned char']]], 'InterruptLastCount' : [ 0x21d0, ['unsigned long']], 'InterruptRate' : [ 0x21d4, ['unsigned long']], 'DeviceInterrupts' : [ 0x21d8, ['unsigned long']], 'IsrDpcStats' : [ 0x21dc, ['pointer', ['void']]], 'DpcData' : [ 0x21e0, ['array', 2, ['_KDPC_DATA']]], 'DpcStack' : [ 0x2210, ['pointer', ['void']]], 'MaximumDpcQueueDepth' : [ 0x2214, ['long']], 'DpcRequestRate' : [ 0x2218, ['unsigned long']], 'MinimumDpcRate' : [ 0x221c, ['unsigned long']], 'DpcLastCount' : [ 0x2220, ['unsigned long']], 'PrcbLock' : [ 0x2224, ['unsigned long']], 'DpcGate' : [ 0x2228, ['_KGATE']], 'IdleState' : [ 0x2238, ['unsigned char']], 'QuantumEnd' : [ 0x2239, ['unsigned char']], 'DpcRoutineActive' : [ 0x223a, ['unsigned char']], 'IdleSchedule' : [ 0x223b, ['unsigned char']], 'DpcRequestSummary' : [ 0x223c, ['long']], 'DpcRequestSlot' : [ 0x223c, ['array', 2, ['short']]], 'NormalDpcState' : [ 0x223c, ['short']], 'ThreadDpcState' : [ 0x223e, ['short']], 'DpcNormalProcessingActive' : [ 0x223c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DpcNormalProcessingRequested' : [ 0x223c, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'DpcNormalThreadSignal' : [ 0x223c, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'DpcNormalTimerExpiration' : [ 0x223c, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'DpcNormalDpcPresent' : [ 0x223c, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'DpcNormalLocalInterrupt' : [ 0x223c, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'DpcNormalSpare' : [ 0x223c, ['BitField', dict(start_bit = 6, end_bit = 16, native_type='unsigned long')]], 'DpcThreadActive' : [ 0x223c, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'DpcThreadRequested' : [ 0x223c, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'DpcThreadSpare' : [ 0x223c, ['BitField', dict(start_bit = 18, end_bit = 32, native_type='unsigned long')]], 'LastTimerHand' : [ 0x2240, ['unsigned long']], 'LastTick' : [ 0x2244, ['unsigned long']], 'PeriodicCount' : [ 0x2248, ['unsigned long']], 'PeriodicBias' : [ 0x224c, ['unsigned long']], 'ClockInterrupts' : [ 0x2250, ['unsigned long']], 'ReadyScanTick' : [ 0x2254, ['unsigned long']], 'GroupSchedulingOverQuota' : [ 0x2258, ['unsigned char']], 'ThreadDpcEnable' : [ 0x2259, ['unsigned char']], 'PrcbPad41' : [ 0x225a, ['array', 2, ['unsigned char']]], 'TimerTable' : [ 0x2260, ['_KTIMER_TABLE']], 'CallDpc' : [ 0x3aa0, ['_KDPC']], 'ClockKeepAlive' : [ 0x3ac0, ['long']], 'PrcbPad6' : [ 0x3ac4, ['array', 4, ['unsigned char']]], 'DpcWatchdogPeriod' : [ 0x3ac8, ['long']], 'DpcWatchdogCount' : [ 0x3acc, ['long']], 'KeSpinLockOrdering' : [ 0x3ad0, ['long']], 'PrcbPad70' : [ 0x3ad4, ['array', 1, ['unsigned long']]], 'QueueIndex' : [ 0x3ad8, ['unsigned long']], 'DeferredReadyListHead' : [ 0x3adc, ['_SINGLE_LIST_ENTRY']], 'ReadySummary' : [ 0x3ae0, ['unsigned long']], 'AffinitizedSelectionMask' : [ 0x3ae4, ['long']], 'WaitLock' : [ 0x3ae8, ['unsigned long']], 'WaitListHead' : [ 0x3aec, ['_LIST_ENTRY']], 'ScbOffset' : [ 0x3af4, ['unsigned long']], 'StartCycles' : [ 0x3af8, ['unsigned long long']], 'TaggedCyclesStart' : [ 0x3b00, ['unsigned long long']], 'TaggedCycles' : [ 0x3b08, ['array', 2, ['unsigned long long']]], 'GenerationTarget' : [ 0x3b18, ['unsigned long long']], 'CycleTime' : [ 0x3b20, ['unsigned long long']], 'AffinitizedCycles' : [ 0x3b28, ['unsigned long long']], 'HighCycleTime' : [ 0x3b30, ['unsigned long']], 'Cycles' : [ 0x3b38, ['array', 4, ['array', 2, ['unsigned long long']]]], 'PrcbPad71' : [ 0x3b78, ['array', 10, ['unsigned long']]], 'DispatcherReadyListHead' : [ 0x3ba0, ['array', 32, ['_LIST_ENTRY']]], 'ChainedInterruptList' : [ 0x3ca0, ['pointer', ['void']]], 'LookasideIrpFloat' : [ 0x3ca4, ['long']], 'ScbQueue' : [ 0x3ca8, ['_RTL_RB_TREE']], 'ScbList' : [ 0x3cb0, ['_LIST_ENTRY']], 'MmPageFaultCount' : [ 0x3cb8, ['long']], 'MmCopyOnWriteCount' : [ 0x3cbc, ['long']], 'MmTransitionCount' : [ 0x3cc0, ['long']], 'MmCacheTransitionCount' : [ 0x3cc4, ['long']], 'MmDemandZeroCount' : [ 0x3cc8, ['long']], 'MmPageReadCount' : [ 0x3ccc, ['long']], 'MmPageReadIoCount' : [ 0x3cd0, ['long']], 'MmCacheReadCount' : [ 0x3cd4, ['long']], 'MmCacheIoCount' : [ 0x3cd8, ['long']], 'MmDirtyPagesWriteCount' : [ 0x3cdc, ['long']], 'MmDirtyWriteIoCount' : [ 0x3ce0, ['long']], 'MmMappedPagesWriteCount' : [ 0x3ce4, ['long']], 'MmMappedWriteIoCount' : [ 0x3ce8, ['long']], 'CachedCommit' : [ 0x3cec, ['unsigned long']], 'CachedResidentAvailable' : [ 0x3cf0, ['unsigned long']], 'HyperPte' : [ 0x3cf4, ['pointer', ['void']]], 'PrcbPad8' : [ 0x3cf8, ['array', 4, ['unsigned char']]], 'VendorString' : [ 0x3cfc, ['array', 13, ['unsigned char']]], 'InitialApicId' : [ 0x3d09, ['unsigned char']], 'LogicalProcessorsPerPhysicalProcessor' : [ 0x3d0a, ['unsigned char']], 'PrcbPad9' : [ 0x3d0b, ['array', 1, ['unsigned char']]], 'FeatureBits' : [ 0x3d10, ['unsigned long long']], 'UpdateSignature' : [ 0x3d18, ['_LARGE_INTEGER']], 'IsrTime' : [ 0x3d20, ['unsigned long long']], 'PrcbPad90' : [ 0x3d28, ['array', 2, ['unsigned long']]], 'PowerState' : [ 0x3d30, ['_PROCESSOR_POWER_STATE']], 'PrcbPad91' : [ 0x3eb0, ['array', 17, ['unsigned long']]], 'DpcWatchdogDpc' : [ 0x3ef4, ['_KDPC']], 'DpcWatchdogTimer' : [ 0x3f18, ['_KTIMER']], 'HypercallPageList' : [ 0x3f40, ['_SLIST_HEADER']], 'HypercallCachedPages' : [ 0x3f48, ['pointer', ['void']]], 'VirtualApicAssist' : [ 0x3f4c, ['pointer', ['void']]], 'StatisticsPage' : [ 0x3f50, ['pointer', ['unsigned long long']]], 'Cache' : [ 0x3f54, ['array', 5, ['_CACHE_DESCRIPTOR']]], 'CacheCount' : [ 0x3f90, ['unsigned long']], 'PackageProcessorSet' : [ 0x3f94, ['_KAFFINITY_EX']], 'SharedReadyQueueMask' : [ 0x3fa0, ['unsigned long']], 'SharedReadyQueue' : [ 0x3fa4, ['pointer', ['_KSHARED_READY_QUEUE']]], 'SharedQueueScanOwner' : [ 0x3fa8, ['unsigned long']], 'CoreProcessorSet' : [ 0x3fac, ['unsigned long']], 'ScanSiblingMask' : [ 0x3fb0, ['unsigned long']], 'LLCMask' : [ 0x3fb4, ['unsigned long']], 'CacheProcessorMask' : [ 0x3fb8, ['array', 5, ['unsigned long']]], 'ScanSiblingIndex' : [ 0x3fcc, ['unsigned long']], 'WheaInfo' : [ 0x3fd0, ['pointer', ['void']]], 'EtwSupport' : [ 0x3fd4, ['pointer', ['void']]], 'InterruptObjectPool' : [ 0x3fd8, ['_SLIST_HEADER']], 'PrcbPad92' : [ 0x3fe0, ['array', 3, ['unsigned long']]], 'PteBitCache' : [ 0x3fec, ['unsigned long']], 'PteBitOffset' : [ 0x3ff0, ['unsigned long']], 'PrcbPad93' : [ 0x3ff4, ['unsigned long']], 'ProcessorProfileControlArea' : [ 0x3ff8, ['pointer', ['_PROCESSOR_PROFILE_CONTROL_AREA']]], 'ProfileEventIndexAddress' : [ 0x3ffc, ['pointer', ['void']]], 'TimerExpirationDpc' : [ 0x4000, ['_KDPC']], 'SynchCounters' : [ 0x4020, ['_SYNCH_COUNTERS']], 'FsCounters' : [ 0x40d8, ['_FILESYSTEM_DISK_COUNTERS']], 'Context' : [ 0x40e8, ['pointer', ['_CONTEXT']]], 'ContextFlagsInit' : [ 0x40ec, ['unsigned long']], 'ExtendedState' : [ 0x40f0, ['pointer', ['_XSAVE_AREA']]], 'EntropyTimingState' : [ 0x40f4, ['_KENTROPY_TIMING_STATE']], 'IsrStack' : [ 0x421c, ['pointer', ['void']]], 'VectorToInterruptObject' : [ 0x4220, ['array', 208, ['pointer', ['_KINTERRUPT']]]], 'AbSelfIoBoostsList' : [ 0x4560, ['_SINGLE_LIST_ENTRY']], 'AbPropagateBoostsList' : [ 0x4564, ['_SINGLE_LIST_ENTRY']], 'AbDpc' : [ 0x4568, ['_KDPC']], 'IoIrpStackProfilerCurrent' : [ 0x4588, ['_IOP_IRP_STACK_PROFILER']], 'IoIrpStackProfilerPrevious' : [ 0x45dc, ['_IOP_IRP_STACK_PROFILER']], 'TimerExpirationTrace' : [ 0x4630, ['array', 16, ['_KTIMER_EXPIRATION_TRACE']]], 'TimerExpirationTraceCount' : [ 0x4730, ['unsigned long']], 'ExSaPageArray' : [ 0x4734, ['pointer', ['void']]], 'PrcbPad100' : [ 0x4738, ['array', 10, ['unsigned long']]], 'LocalSharedReadyQueue' : [ 0x4760, ['_KSHARED_READY_QUEUE']], 'PrcbPad95' : [ 0x4894, ['array', 12, ['unsigned char']]], 'Mailbox' : [ 0x48a0, ['pointer', ['_REQUEST_MAILBOX']]], 'PrcbPad' : [ 0x48a4, ['array', 60, ['unsigned char']]], 'RequestMailbox' : [ 0x48e0, ['array', 1, ['_REQUEST_MAILBOX']]], } ], '_KAPC' : [ 0x30, { 'Type' : [ 0x0, ['unsigned char']], 'SpareByte0' : [ 0x1, ['unsigned char']], 'Size' : [ 0x2, ['unsigned char']], 'SpareByte1' : [ 0x3, ['unsigned char']], 'SpareLong0' : [ 0x4, ['unsigned long']], 'Thread' : [ 0x8, ['pointer', ['_KTHREAD']]], 'ApcListEntry' : [ 0xc, ['_LIST_ENTRY']], 'KernelRoutine' : [ 0x14, ['pointer', ['void']]], 'RundownRoutine' : [ 0x18, ['pointer', ['void']]], 'NormalRoutine' : [ 0x1c, ['pointer', ['void']]], 'Reserved' : [ 0x14, ['array', 3, ['pointer', ['void']]]], 'NormalContext' : [ 0x20, ['pointer', ['void']]], 'SystemArgument1' : [ 0x24, ['pointer', ['void']]], 'SystemArgument2' : [ 0x28, ['pointer', ['void']]], 'ApcStateIndex' : [ 0x2c, ['unsigned char']], 'ApcMode' : [ 0x2d, ['unsigned char']], 'Inserted' : [ 0x2e, ['unsigned char']], } ], '_CPU_INFO' : [ 0x10, { 'AsUINT32' : [ 0x0, ['array', 4, ['unsigned long']]], 'Eax' : [ 0x0, ['unsigned long']], 'Ebx' : [ 0x4, ['unsigned long']], 'Ecx' : [ 0x8, ['unsigned long']], 'Edx' : [ 0xc, ['unsigned long']], } ], '_EXT_SET_PARAMETERS_V0' : [ 0x10, { 'Version' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'NoWakeTolerance' : [ 0x8, ['long long']], } ], '_KPROCESS' : [ 0xa8, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'ProfileListHead' : [ 0x10, ['_LIST_ENTRY']], 'DirectoryTableBase' : [ 0x18, ['unsigned long']], 'LdtDescriptor' : [ 0x1c, ['_KGDTENTRY']], 'Int21Descriptor' : [ 0x24, ['_KIDTENTRY']], 'ThreadListHead' : [ 0x2c, ['_LIST_ENTRY']], 'ProcessLock' : [ 0x34, ['unsigned long']], 'DeepFreezeStartTime' : [ 0x38, ['unsigned long long']], 'Affinity' : [ 0x40, ['_KAFFINITY_EX']], 'ReadyListHead' : [ 0x4c, ['_LIST_ENTRY']], 'SwapListEntry' : [ 0x54, ['_SINGLE_LIST_ENTRY']], 'ActiveProcessors' : [ 0x58, ['_KAFFINITY_EX']], 'AutoAlignment' : [ 0x64, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='long')]], 'DisableBoost' : [ 0x64, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='long')]], 'DisableQuantum' : [ 0x64, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='long')]], 'DeepFreeze' : [ 0x64, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'TimerVirtualization' : [ 0x64, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'CheckStackExtents' : [ 0x64, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'SpareFlags0' : [ 0x64, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned long')]], 'ActiveGroupsMask' : [ 0x64, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'ReservedFlags' : [ 0x64, ['BitField', dict(start_bit = 9, end_bit = 32, native_type='long')]], 'ProcessFlags' : [ 0x64, ['long']], 'BasePriority' : [ 0x68, ['unsigned char']], 'QuantumReset' : [ 0x69, ['unsigned char']], 'Visited' : [ 0x6a, ['unsigned char']], 'Flags' : [ 0x6b, ['_KEXECUTE_OPTIONS']], 'ThreadSeed' : [ 0x6c, ['array', 1, ['unsigned long']]], 'IdealNode' : [ 0x70, ['array', 1, ['unsigned short']]], 'IdealGlobalNode' : [ 0x72, ['unsigned short']], 'Spare1' : [ 0x74, ['unsigned short']], 'IopmOffset' : [ 0x76, ['unsigned short']], 'SchedulingGroup' : [ 0x78, ['pointer', ['_KSCHEDULING_GROUP']]], 'StackCount' : [ 0x7c, ['_KSTACK_COUNT']], 'ProcessListEntry' : [ 0x80, ['_LIST_ENTRY']], 'CycleTime' : [ 0x88, ['unsigned long long']], 'ContextSwitches' : [ 0x90, ['unsigned long long']], 'FreezeCount' : [ 0x98, ['unsigned long']], 'KernelTime' : [ 0x9c, ['unsigned long']], 'UserTime' : [ 0xa0, ['unsigned long']], 'VdmTrapcHandler' : [ 0xa4, ['pointer', ['void']]], } ], '_KTHREAD' : [ 0x348, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'SListFaultAddress' : [ 0x10, ['pointer', ['void']]], 'QuantumTarget' : [ 0x18, ['unsigned long long']], 'InitialStack' : [ 0x20, ['pointer', ['void']]], 'StackLimit' : [ 0x24, ['pointer', ['void']]], 'StackBase' : [ 0x28, ['pointer', ['void']]], 'ThreadLock' : [ 0x2c, ['unsigned long']], 'CycleTime' : [ 0x30, ['unsigned long long']], 'HighCycleTime' : [ 0x38, ['unsigned long']], 'ServiceTable' : [ 0x3c, ['pointer', ['void']]], 'CurrentRunTime' : [ 0x40, ['unsigned long']], 'ExpectedRunTime' : [ 0x44, ['unsigned long']], 'KernelStack' : [ 0x48, ['pointer', ['void']]], 'StateSaveArea' : [ 0x4c, ['pointer', ['_XSAVE_FORMAT']]], 'SchedulingGroup' : [ 0x50, ['pointer', ['_KSCHEDULING_GROUP']]], 'WaitRegister' : [ 0x54, ['_KWAIT_STATUS_REGISTER']], 'Running' : [ 0x55, ['unsigned char']], 'Alerted' : [ 0x56, ['array', 2, ['unsigned char']]], 'AutoBoostActive' : [ 0x58, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReadyTransition' : [ 0x58, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'WaitNext' : [ 0x58, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'SystemAffinityActive' : [ 0x58, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Alertable' : [ 0x58, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'UserStackWalkActive' : [ 0x58, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'ApcInterruptRequest' : [ 0x58, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'QuantumEndMigrate' : [ 0x58, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'UmsDirectedSwitchEnable' : [ 0x58, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'TimerActive' : [ 0x58, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'SystemThread' : [ 0x58, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'ProcessDetachActive' : [ 0x58, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'CalloutActive' : [ 0x58, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'ScbReadyQueue' : [ 0x58, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'ApcQueueable' : [ 0x58, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'ReservedStackInUse' : [ 0x58, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'UmsPerformingSyscall' : [ 0x58, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'TimerSuspended' : [ 0x58, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'SuspendedWaitMode' : [ 0x58, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'SuspendSchedulerApcWait' : [ 0x58, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'Reserved' : [ 0x58, ['BitField', dict(start_bit = 20, end_bit = 32, native_type='unsigned long')]], 'MiscFlags' : [ 0x58, ['long']], 'AutoAlignment' : [ 0x5c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DisableBoost' : [ 0x5c, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ThreadFlagsSpare0' : [ 0x5c, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'AlertedByThreadId' : [ 0x5c, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'QuantumDonation' : [ 0x5c, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'EnableStackSwap' : [ 0x5c, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'GuiThread' : [ 0x5c, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'DisableQuantum' : [ 0x5c, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'ChargeOnlySchedulingGroup' : [ 0x5c, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'DeferPreemption' : [ 0x5c, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'QueueDeferPreemption' : [ 0x5c, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'ForceDeferSchedule' : [ 0x5c, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'SharedReadyQueueAffinity' : [ 0x5c, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'FreezeCount' : [ 0x5c, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'TerminationApcRequest' : [ 0x5c, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'AutoBoostEntriesExhausted' : [ 0x5c, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'KernelStackResident' : [ 0x5c, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'CommitFailTerminateRequest' : [ 0x5c, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'ProcessStackCountDecremented' : [ 0x5c, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'ThreadFlagsSpare' : [ 0x5c, ['BitField', dict(start_bit = 19, end_bit = 24, native_type='unsigned long')]], 'EtwStackTraceApcInserted' : [ 0x5c, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], 'ThreadFlags' : [ 0x5c, ['long']], 'Tag' : [ 0x60, ['unsigned char']], 'SystemHeteroCpuPolicy' : [ 0x61, ['unsigned char']], 'UserHeteroCpuPolicy' : [ 0x62, ['BitField', dict(start_bit = 0, end_bit = 7, native_type='unsigned char')]], 'ExplicitSystemHeteroCpuPolicy' : [ 0x62, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'Spare0' : [ 0x63, ['unsigned char']], 'SystemCallNumber' : [ 0x64, ['unsigned long']], 'FirstArgument' : [ 0x68, ['pointer', ['void']]], 'TrapFrame' : [ 0x6c, ['pointer', ['_KTRAP_FRAME']]], 'ApcState' : [ 0x70, ['_KAPC_STATE']], 'ApcStateFill' : [ 0x70, ['array', 23, ['unsigned char']]], 'Priority' : [ 0x87, ['unsigned char']], 'UserIdealProcessor' : [ 0x88, ['unsigned long']], 'ContextSwitches' : [ 0x8c, ['unsigned long']], 'State' : [ 0x90, ['unsigned char']], 'Spare12' : [ 0x91, ['unsigned char']], 'WaitIrql' : [ 0x92, ['unsigned char']], 'WaitMode' : [ 0x93, ['unsigned char']], 'WaitStatus' : [ 0x94, ['long']], 'WaitBlockList' : [ 0x98, ['pointer', ['_KWAIT_BLOCK']]], 'WaitListEntry' : [ 0x9c, ['_LIST_ENTRY']], 'SwapListEntry' : [ 0x9c, ['_SINGLE_LIST_ENTRY']], 'Queue' : [ 0xa4, ['pointer', ['_DISPATCHER_HEADER']]], 'Teb' : [ 0xa8, ['pointer', ['void']]], 'RelativeTimerBias' : [ 0xb0, ['unsigned long long']], 'Timer' : [ 0xb8, ['_KTIMER']], 'WaitBlock' : [ 0xe0, ['array', 4, ['_KWAIT_BLOCK']]], 'WaitBlockFill8' : [ 0xe0, ['array', 20, ['unsigned char']]], 'ThreadCounters' : [ 0xf4, ['pointer', ['_KTHREAD_COUNTERS']]], 'WaitBlockFill9' : [ 0xe0, ['array', 44, ['unsigned char']]], 'XStateSave' : [ 0x10c, ['pointer', ['_XSTATE_SAVE']]], 'WaitBlockFill10' : [ 0xe0, ['array', 68, ['unsigned char']]], 'Win32Thread' : [ 0x124, ['pointer', ['void']]], 'WaitBlockFill11' : [ 0xe0, ['array', 88, ['unsigned char']]], 'WaitTime' : [ 0x138, ['unsigned long']], 'KernelApcDisable' : [ 0x13c, ['short']], 'SpecialApcDisable' : [ 0x13e, ['short']], 'CombinedApcDisable' : [ 0x13c, ['unsigned long']], 'QueueListEntry' : [ 0x140, ['_LIST_ENTRY']], 'NextProcessor' : [ 0x148, ['unsigned long']], 'NextProcessorNumber' : [ 0x148, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='unsigned long')]], 'SharedReadyQueue' : [ 0x148, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'QueuePriority' : [ 0x14c, ['long']], 'Process' : [ 0x150, ['pointer', ['_KPROCESS']]], 'UserAffinity' : [ 0x154, ['_GROUP_AFFINITY']], 'UserAffinityFill' : [ 0x154, ['array', 6, ['unsigned char']]], 'PreviousMode' : [ 0x15a, ['unsigned char']], 'BasePriority' : [ 0x15b, ['unsigned char']], 'PriorityDecrement' : [ 0x15c, ['unsigned char']], 'ForegroundBoost' : [ 0x15c, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned char')]], 'UnusualBoost' : [ 0x15c, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], 'Preempted' : [ 0x15d, ['unsigned char']], 'AdjustReason' : [ 0x15e, ['unsigned char']], 'AdjustIncrement' : [ 0x15f, ['unsigned char']], 'AffinityVersion' : [ 0x160, ['unsigned long']], 'Affinity' : [ 0x164, ['_GROUP_AFFINITY']], 'AffinityFill' : [ 0x164, ['array', 6, ['unsigned char']]], 'ApcStateIndex' : [ 0x16a, ['unsigned char']], 'WaitBlockCount' : [ 0x16b, ['unsigned char']], 'IdealProcessor' : [ 0x16c, ['unsigned long']], 'Spare15' : [ 0x170, ['array', 1, ['unsigned long']]], 'SavedApcState' : [ 0x174, ['_KAPC_STATE']], 'SavedApcStateFill' : [ 0x174, ['array', 23, ['unsigned char']]], 'WaitReason' : [ 0x18b, ['unsigned char']], 'SuspendCount' : [ 0x18c, ['unsigned char']], 'Saturation' : [ 0x18d, ['unsigned char']], 'SListFaultCount' : [ 0x18e, ['unsigned short']], 'SchedulerApc' : [ 0x190, ['_KAPC']], 'SchedulerApcFill0' : [ 0x190, ['array', 1, ['unsigned char']]], 'ResourceIndex' : [ 0x191, ['unsigned char']], 'SchedulerApcFill1' : [ 0x190, ['array', 3, ['unsigned char']]], 'QuantumReset' : [ 0x193, ['unsigned char']], 'SchedulerApcFill2' : [ 0x190, ['array', 4, ['unsigned char']]], 'KernelTime' : [ 0x194, ['unsigned long']], 'SchedulerApcFill3' : [ 0x190, ['array', 36, ['unsigned char']]], 'WaitPrcb' : [ 0x1b4, ['pointer', ['_KPRCB']]], 'SchedulerApcFill4' : [ 0x190, ['array', 40, ['unsigned char']]], 'LegoData' : [ 0x1b8, ['pointer', ['void']]], 'SchedulerApcFill5' : [ 0x190, ['array', 47, ['unsigned char']]], 'CallbackNestingLevel' : [ 0x1bf, ['unsigned char']], 'UserTime' : [ 0x1c0, ['unsigned long']], 'SuspendEvent' : [ 0x1c4, ['_KEVENT']], 'ThreadListEntry' : [ 0x1d4, ['_LIST_ENTRY']], 'MutantListHead' : [ 0x1dc, ['_LIST_ENTRY']], 'AbEntrySummary' : [ 0x1e4, ['unsigned char']], 'AbWaitEntryCount' : [ 0x1e5, ['unsigned char']], 'Spare20' : [ 0x1e6, ['unsigned short']], 'LockEntries' : [ 0x1e8, ['array', 6, ['_KLOCK_ENTRY']]], 'PropagateBoostsEntry' : [ 0x308, ['_SINGLE_LIST_ENTRY']], 'IoSelfBoostsEntry' : [ 0x30c, ['_SINGLE_LIST_ENTRY']], 'PriorityFloorCounts' : [ 0x310, ['array', 16, ['unsigned char']]], 'PriorityFloorSummary' : [ 0x320, ['unsigned long']], 'AbCompletedIoBoostCount' : [ 0x324, ['long']], 'KeReferenceCount' : [ 0x328, ['short']], 'AbOrphanedEntrySummary' : [ 0x32a, ['unsigned char']], 'AbOwnedEntryCount' : [ 0x32b, ['unsigned char']], 'ForegroundLossTime' : [ 0x32c, ['unsigned long']], 'GlobalForegroundListEntry' : [ 0x330, ['_LIST_ENTRY']], 'ForegroundDpcStackListEntry' : [ 0x330, ['_SINGLE_LIST_ENTRY']], 'InGlobalForegroundList' : [ 0x334, ['unsigned long']], 'QueuedScb' : [ 0x338, ['pointer', ['_KSCB']]], 'NpxState' : [ 0x340, ['unsigned long long']], } ], '_KSTACK_CONTROL' : [ 0x20, { 'StackBase' : [ 0x0, ['unsigned long']], 'ActualLimit' : [ 0x4, ['unsigned long']], 'StackExpansion' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PreviousTrapFrame' : [ 0x8, ['pointer', ['_KTRAP_FRAME']]], 'PreviousExceptionList' : [ 0xc, ['pointer', ['void']]], 'Previous' : [ 0x10, ['_KERNEL_STACK_SEGMENT']], } ], '_KSPIN_LOCK_QUEUE' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_KSPIN_LOCK_QUEUE']]], 'Lock' : [ 0x4, ['pointer', ['unsigned long']]], } ], '_FAST_MUTEX' : [ 0x20, { 'Count' : [ 0x0, ['long']], 'Owner' : [ 0x4, ['pointer', ['void']]], 'Contention' : [ 0x8, ['unsigned long']], 'Event' : [ 0xc, ['_KEVENT']], 'OldIrql' : [ 0x1c, ['unsigned long']], } ], '_KEVENT' : [ 0x10, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], } ], '_SLIST_HEADER' : [ 0x8, { 'Alignment' : [ 0x0, ['unsigned long long']], 'Next' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Depth' : [ 0x4, ['unsigned short']], 'CpuId' : [ 0x6, ['unsigned short']], } ], '_LOOKASIDE_LIST_EX' : [ 0x48, { 'L' : [ 0x0, ['_GENERAL_LOOKASIDE_POOL']], } ], '_NPAGED_LOOKASIDE_LIST' : [ 0xc0, { 'L' : [ 0x0, ['_GENERAL_LOOKASIDE']], 'Lock__ObsoleteButDoNotDelete' : [ 0x80, ['unsigned long']], } ], '_PAGED_LOOKASIDE_LIST' : [ 0xc0, { 'L' : [ 0x0, ['_GENERAL_LOOKASIDE']], 'Lock__ObsoleteButDoNotDelete' : [ 0x80, ['_FAST_MUTEX']], } ], '_IO_STATUS_BLOCK' : [ 0x8, { 'Status' : [ 0x0, ['long']], 'Pointer' : [ 0x0, ['pointer', ['void']]], 'Information' : [ 0x4, ['unsigned long']], } ], '_QUAD' : [ 0x8, { 'UseThisFieldToCopy' : [ 0x0, ['long long']], 'DoNotUseThisField' : [ 0x0, ['double']], } ], '_WORK_QUEUE_ITEM' : [ 0x10, { 'List' : [ 0x0, ['_LIST_ENTRY']], 'WorkerRoutine' : [ 0x8, ['pointer', ['void']]], 'Parameter' : [ 0xc, ['pointer', ['void']]], } ], '_EXT_DELETE_PARAMETERS' : [ 0x10, { 'Version' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'DeleteCallback' : [ 0x8, ['pointer', ['void']]], 'DeleteContext' : [ 0xc, ['pointer', ['void']]], } ], '_EX_PUSH_LOCK' : [ 0x4, { 'Locked' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Waiting' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Waking' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'MultipleShared' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Shared' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 32, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], 'Ptr' : [ 0x0, ['pointer', ['void']]], } ], '_PP_LOOKASIDE_LIST' : [ 0x8, { 'P' : [ 0x0, ['pointer', ['_GENERAL_LOOKASIDE']]], 'L' : [ 0x4, ['pointer', ['_GENERAL_LOOKASIDE']]], } ], '_GENERAL_LOOKASIDE' : [ 0x80, { 'ListHead' : [ 0x0, ['_SLIST_HEADER']], 'SingleListHead' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Depth' : [ 0x8, ['unsigned short']], 'MaximumDepth' : [ 0xa, ['unsigned short']], 'TotalAllocates' : [ 0xc, ['unsigned long']], 'AllocateMisses' : [ 0x10, ['unsigned long']], 'AllocateHits' : [ 0x10, ['unsigned long']], 'TotalFrees' : [ 0x14, ['unsigned long']], 'FreeMisses' : [ 0x18, ['unsigned long']], 'FreeHits' : [ 0x18, ['unsigned long']], 'Type' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPoolBase', 1: 'PagedPool', 2: 'NonPagedPoolBaseMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolBaseCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolBaseCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 516: 'NonPagedPoolNxCacheAligned', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 512: 'NonPagedPoolNx', 544: 'NonPagedPoolSessionNx', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'Tag' : [ 0x20, ['unsigned long']], 'Size' : [ 0x24, ['unsigned long']], 'AllocateEx' : [ 0x28, ['pointer', ['void']]], 'Allocate' : [ 0x28, ['pointer', ['void']]], 'FreeEx' : [ 0x2c, ['pointer', ['void']]], 'Free' : [ 0x2c, ['pointer', ['void']]], 'ListEntry' : [ 0x30, ['_LIST_ENTRY']], 'LastTotalAllocates' : [ 0x38, ['unsigned long']], 'LastAllocateMisses' : [ 0x3c, ['unsigned long']], 'LastAllocateHits' : [ 0x3c, ['unsigned long']], 'Future' : [ 0x40, ['array', 2, ['unsigned long']]], } ], '_KNODE' : [ 0x100, { 'IdleNonParkedCpuSet' : [ 0x0, ['unsigned long']], 'IdleSmtSet' : [ 0x4, ['unsigned long']], 'IdleCpuSet' : [ 0x8, ['unsigned long']], 'DeepIdleSet' : [ 0x40, ['unsigned long']], 'IdleConstrainedSet' : [ 0x44, ['unsigned long']], 'NonParkedSet' : [ 0x48, ['unsigned long']], 'ParkLock' : [ 0x4c, ['long']], 'Seed' : [ 0x50, ['unsigned long']], 'SiblingMask' : [ 0x80, ['unsigned long']], 'Affinity' : [ 0x84, ['_GROUP_AFFINITY']], 'AffinityFill' : [ 0x84, ['array', 6, ['unsigned char']]], 'NodeNumber' : [ 0x8a, ['unsigned short']], 'PrimaryNodeNumber' : [ 0x8c, ['unsigned short']], 'Stride' : [ 0x8e, ['unsigned char']], 'Spare0' : [ 0x8f, ['unsigned char']], 'SharedReadyQueueLeaders' : [ 0x90, ['unsigned long']], 'ProximityId' : [ 0x94, ['unsigned long']], 'Lowest' : [ 0x98, ['unsigned long']], 'Highest' : [ 0x9c, ['unsigned long']], 'MaximumProcessors' : [ 0xa0, ['unsigned char']], 'Flags' : [ 0xa1, ['_flags']], 'Spare10' : [ 0xa2, ['unsigned char']], 'HeteroSets' : [ 0xa4, ['array', 5, ['_KHETERO_PROCESSOR_SET']]], } ], '_ENODE' : [ 0x380, { 'Ncb' : [ 0x0, ['_KNODE']], 'ExWorkQueues' : [ 0x100, ['array', 8, ['pointer', ['_EX_WORK_QUEUE']]]], 'ExWorkQueue' : [ 0x120, ['_EX_WORK_QUEUE']], 'ExpThreadSetManagerEvent' : [ 0x2d8, ['_KEVENT']], 'ExpDeadlockTimer' : [ 0x2e8, ['_KTIMER']], 'ExpThreadReaperEvent' : [ 0x310, ['_KEVENT']], 'WaitBlocks' : [ 0x320, ['array', 3, ['_KWAIT_BLOCK']]], 'ExpWorkerThreadBalanceManagerPtr' : [ 0x368, ['pointer', ['_ETHREAD']]], 'ExpWorkerSeed' : [ 0x36c, ['unsigned long']], 'ExWorkerFullInit' : [ 0x370, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ExWorkerStructInit' : [ 0x370, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ExWorkerFlags' : [ 0x370, ['unsigned long']], } ], '_HANDLE_TABLE' : [ 0x5c, { 'NextHandleNeedingPool' : [ 0x0, ['unsigned long']], 'ExtraInfoPages' : [ 0x4, ['long']], 'TableCode' : [ 0x8, ['unsigned long']], 'QuotaProcess' : [ 0xc, ['pointer', ['_EPROCESS']]], 'HandleTableList' : [ 0x10, ['_LIST_ENTRY']], 'UniqueProcessId' : [ 0x18, ['unsigned long']], 'Flags' : [ 0x1c, ['unsigned long']], 'StrictFIFO' : [ 0x1c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'EnableHandleExceptions' : [ 0x1c, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Rundown' : [ 0x1c, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Duplicated' : [ 0x1c, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'RaiseUMExceptionOnInvalidHandleClose' : [ 0x1c, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'HandleContentionEvent' : [ 0x20, ['_EX_PUSH_LOCK']], 'HandleTableLock' : [ 0x24, ['_EX_PUSH_LOCK']], 'FreeLists' : [ 0x28, ['array', 1, ['_HANDLE_TABLE_FREE_LIST']]], 'ActualEntry' : [ 0x28, ['array', 20, ['unsigned char']]], 'DebugInfo' : [ 0x3c, ['pointer', ['_HANDLE_TRACE_DEBUG_INFO']]], } ], '_HANDLE_TABLE_ENTRY_INFO' : [ 0x4, { 'AuditMask' : [ 0x0, ['unsigned long']], } ], '_HANDLE_TABLE_ENTRY' : [ 0x8, { 'VolatileLowValue' : [ 0x0, ['long']], 'LowValue' : [ 0x0, ['long']], 'InfoTable' : [ 0x0, ['pointer', ['_HANDLE_TABLE_ENTRY_INFO']]], 'HighValue' : [ 0x4, ['long']], 'NextFreeHandleEntry' : [ 0x4, ['pointer', ['_HANDLE_TABLE_ENTRY']]], 'LeafHandleValue' : [ 0x4, ['_EXHANDLE']], 'Unlocked' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Attributes' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 3, native_type='unsigned long')]], 'ObjectPointerBits' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'RefCountField' : [ 0x4, ['long']], 'GrantedAccessBits' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 25, native_type='unsigned long')]], 'ProtectFromClose' : [ 0x4, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'NoRightsUpgrade' : [ 0x4, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'RefCnt' : [ 0x4, ['BitField', dict(start_bit = 27, end_bit = 32, native_type='unsigned long')]], } ], '_EX_FAST_REF' : [ 0x4, { 'Object' : [ 0x0, ['pointer', ['void']]], 'RefCnt' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], } ], '__unnamed_131d' : [ 0x2c, { 'InitialPrivilegeSet' : [ 0x0, ['_INITIAL_PRIVILEGE_SET']], 'PrivilegeSet' : [ 0x0, ['_PRIVILEGE_SET']], } ], '_ACCESS_STATE' : [ 0x74, { 'OperationID' : [ 0x0, ['_LUID']], 'SecurityEvaluated' : [ 0x8, ['unsigned char']], 'GenerateAudit' : [ 0x9, ['unsigned char']], 'GenerateOnClose' : [ 0xa, ['unsigned char']], 'PrivilegesAllocated' : [ 0xb, ['unsigned char']], 'Flags' : [ 0xc, ['unsigned long']], 'RemainingDesiredAccess' : [ 0x10, ['unsigned long']], 'PreviouslyGrantedAccess' : [ 0x14, ['unsigned long']], 'OriginalDesiredAccess' : [ 0x18, ['unsigned long']], 'SubjectSecurityContext' : [ 0x1c, ['_SECURITY_SUBJECT_CONTEXT']], 'SecurityDescriptor' : [ 0x2c, ['pointer', ['void']]], 'AuxData' : [ 0x30, ['pointer', ['void']]], 'Privileges' : [ 0x34, ['__unnamed_131d']], 'AuditPrivileges' : [ 0x60, ['unsigned char']], 'ObjectName' : [ 0x64, ['_UNICODE_STRING']], 'ObjectTypeName' : [ 0x6c, ['_UNICODE_STRING']], } ], '_AUX_ACCESS_DATA' : [ 0xc4, { 'PrivilegesUsed' : [ 0x0, ['pointer', ['_PRIVILEGE_SET']]], 'GenericMapping' : [ 0x4, ['_GENERIC_MAPPING']], 'AccessesToAudit' : [ 0x14, ['unsigned long']], 'MaximumAuditMask' : [ 0x18, ['unsigned long']], 'TransactionId' : [ 0x1c, ['_GUID']], 'NewSecurityDescriptor' : [ 0x2c, ['pointer', ['void']]], 'ExistingSecurityDescriptor' : [ 0x30, ['pointer', ['void']]], 'ParentSecurityDescriptor' : [ 0x34, ['pointer', ['void']]], 'DeRefSecurityDescriptor' : [ 0x38, ['pointer', ['void']]], 'SDLock' : [ 0x3c, ['pointer', ['void']]], 'AccessReasons' : [ 0x40, ['_ACCESS_REASONS']], 'GenerateStagingEvents' : [ 0xc0, ['unsigned char']], } ], '_OBJECT_HANDLE_INFORMATION' : [ 0x8, { 'HandleAttributes' : [ 0x0, ['unsigned long']], 'GrantedAccess' : [ 0x4, ['unsigned long']], } ], '_ETHREAD' : [ 0x458, { 'Tcb' : [ 0x0, ['_KTHREAD']], 'CreateTime' : [ 0x348, ['_LARGE_INTEGER']], 'ExitTime' : [ 0x350, ['_LARGE_INTEGER']], 'KeyedWaitChain' : [ 0x350, ['_LIST_ENTRY']], 'ChargeOnlySession' : [ 0x358, ['pointer', ['void']]], 'PostBlockList' : [ 0x35c, ['_LIST_ENTRY']], 'ForwardLinkShadow' : [ 0x35c, ['pointer', ['void']]], 'StartAddress' : [ 0x360, ['pointer', ['void']]], 'TerminationPort' : [ 0x364, ['pointer', ['_TERMINATION_PORT']]], 'ReaperLink' : [ 0x364, ['pointer', ['_ETHREAD']]], 'KeyedWaitValue' : [ 0x364, ['pointer', ['void']]], 'ActiveTimerListLock' : [ 0x368, ['unsigned long']], 'ActiveTimerListHead' : [ 0x36c, ['_LIST_ENTRY']], 'Cid' : [ 0x374, ['_CLIENT_ID']], 'KeyedWaitSemaphore' : [ 0x37c, ['_KSEMAPHORE']], 'AlpcWaitSemaphore' : [ 0x37c, ['_KSEMAPHORE']], 'ClientSecurity' : [ 0x390, ['_PS_CLIENT_SECURITY_CONTEXT']], 'IrpList' : [ 0x394, ['_LIST_ENTRY']], 'TopLevelIrp' : [ 0x39c, ['unsigned long']], 'DeviceToVerify' : [ 0x3a0, ['pointer', ['_DEVICE_OBJECT']]], 'Win32StartAddress' : [ 0x3a4, ['pointer', ['void']]], 'LegacyPowerObject' : [ 0x3a8, ['pointer', ['void']]], 'ThreadListEntry' : [ 0x3ac, ['_LIST_ENTRY']], 'RundownProtect' : [ 0x3b4, ['_EX_RUNDOWN_REF']], 'ThreadLock' : [ 0x3b8, ['_EX_PUSH_LOCK']], 'ReadClusterSize' : [ 0x3bc, ['unsigned long']], 'MmLockOrdering' : [ 0x3c0, ['long']], 'CmLockOrdering' : [ 0x3c4, ['long']], 'CrossThreadFlags' : [ 0x3c8, ['unsigned long']], 'Terminated' : [ 0x3c8, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ThreadInserted' : [ 0x3c8, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'HideFromDebugger' : [ 0x3c8, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ActiveImpersonationInfo' : [ 0x3c8, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'HardErrorsAreDisabled' : [ 0x3c8, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'BreakOnTermination' : [ 0x3c8, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'SkipCreationMsg' : [ 0x3c8, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'SkipTerminationMsg' : [ 0x3c8, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'CopyTokenOnOpen' : [ 0x3c8, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'ThreadIoPriority' : [ 0x3c8, ['BitField', dict(start_bit = 9, end_bit = 12, native_type='unsigned long')]], 'ThreadPagePriority' : [ 0x3c8, ['BitField', dict(start_bit = 12, end_bit = 15, native_type='unsigned long')]], 'RundownFail' : [ 0x3c8, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'UmsForceQueueTermination' : [ 0x3c8, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'IndirectCpuSets' : [ 0x3c8, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'ReservedCrossThreadFlags' : [ 0x3c8, ['BitField', dict(start_bit = 18, end_bit = 32, native_type='unsigned long')]], 'SameThreadPassiveFlags' : [ 0x3cc, ['unsigned long']], 'ActiveExWorker' : [ 0x3cc, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'MemoryMaker' : [ 0x3cc, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ClonedThread' : [ 0x3cc, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'KeyedEventInUse' : [ 0x3cc, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'SelfTerminate' : [ 0x3cc, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'RespectIoPriority' : [ 0x3cc, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'ReservedSameThreadPassiveFlags' : [ 0x3cc, ['BitField', dict(start_bit = 6, end_bit = 32, native_type='unsigned long')]], 'SameThreadApcFlags' : [ 0x3d0, ['unsigned long']], 'OwnsProcessAddressSpaceExclusive' : [ 0x3d0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'OwnsProcessAddressSpaceShared' : [ 0x3d0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'HardFaultBehavior' : [ 0x3d0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'StartAddressInvalid' : [ 0x3d0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'EtwCalloutActive' : [ 0x3d0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'SuppressSymbolLoad' : [ 0x3d0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'Prefetching' : [ 0x3d0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'OwnsVadExclusive' : [ 0x3d0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'SystemPagePriorityActive' : [ 0x3d1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'SystemPagePriority' : [ 0x3d1, ['BitField', dict(start_bit = 1, end_bit = 4, native_type='unsigned char')]], 'CacheManagerActive' : [ 0x3d4, ['unsigned char']], 'DisablePageFaultClustering' : [ 0x3d5, ['unsigned char']], 'ActiveFaultCount' : [ 0x3d6, ['unsigned char']], 'LockOrderState' : [ 0x3d7, ['unsigned char']], 'AlpcMessageId' : [ 0x3d8, ['unsigned long']], 'AlpcMessage' : [ 0x3dc, ['pointer', ['void']]], 'AlpcReceiveAttributeSet' : [ 0x3dc, ['unsigned long']], 'ExitStatus' : [ 0x3e0, ['long']], 'AlpcWaitListEntry' : [ 0x3e4, ['_LIST_ENTRY']], 'CacheManagerCount' : [ 0x3ec, ['unsigned long']], 'IoBoostCount' : [ 0x3f0, ['unsigned long']], 'BoostList' : [ 0x3f4, ['_LIST_ENTRY']], 'DeboostList' : [ 0x3fc, ['_LIST_ENTRY']], 'BoostListLock' : [ 0x404, ['unsigned long']], 'IrpListLock' : [ 0x408, ['unsigned long']], 'ReservedForSynchTracking' : [ 0x40c, ['pointer', ['void']]], 'CmCallbackListHead' : [ 0x410, ['_SINGLE_LIST_ENTRY']], 'ActivityId' : [ 0x414, ['pointer', ['_GUID']]], 'SeLearningModeListHead' : [ 0x418, ['_SINGLE_LIST_ENTRY']], 'VerifierContext' : [ 0x41c, ['pointer', ['void']]], 'KernelStackReference' : [ 0x420, ['unsigned long']], 'AdjustedClientToken' : [ 0x424, ['pointer', ['void']]], 'WorkingOnBehalfClient' : [ 0x428, ['pointer', ['void']]], 'PropertySet' : [ 0x42c, ['_PS_PROPERTY_SET']], 'PicoContext' : [ 0x438, ['pointer', ['void']]], 'UserFsBase' : [ 0x43c, ['unsigned long']], 'UserGsBase' : [ 0x440, ['unsigned long']], 'EnergyValues' : [ 0x444, ['pointer', ['_THREAD_ENERGY_VALUES']]], 'CmCellReferences' : [ 0x448, ['unsigned long']], 'SelectedCpuSets' : [ 0x44c, ['unsigned long']], 'SelectedCpuSetsIndirect' : [ 0x44c, ['pointer', ['unsigned long']]], 'Silo' : [ 0x450, ['pointer', ['_ESILO']]], } ], '_EPROCESS' : [ 0x380, { 'Pcb' : [ 0x0, ['_KPROCESS']], 'ProcessLock' : [ 0xa8, ['_EX_PUSH_LOCK']], 'RundownProtect' : [ 0xac, ['_EX_RUNDOWN_REF']], 'VdmObjects' : [ 0xb0, ['pointer', ['void']]], 'UniqueProcessId' : [ 0xb4, ['pointer', ['void']]], 'ActiveProcessLinks' : [ 0xb8, ['_LIST_ENTRY']], 'Flags2' : [ 0xc0, ['unsigned long']], 'JobNotReallyActive' : [ 0xc0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'AccountingFolded' : [ 0xc0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'NewProcessReported' : [ 0xc0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ExitProcessReported' : [ 0xc0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'ReportCommitChanges' : [ 0xc0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'LastReportMemory' : [ 0xc0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'ForceWakeCharge' : [ 0xc0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'CrossSessionCreate' : [ 0xc0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'NeedsHandleRundown' : [ 0xc0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'RefTraceEnabled' : [ 0xc0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'DisableDynamicCode' : [ 0xc0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'EmptyJobEvaluated' : [ 0xc0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'DefaultPagePriority' : [ 0xc0, ['BitField', dict(start_bit = 12, end_bit = 15, native_type='unsigned long')]], 'PrimaryTokenFrozen' : [ 0xc0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'ProcessVerifierTarget' : [ 0xc0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'StackRandomizationDisabled' : [ 0xc0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'AffinityPermanent' : [ 0xc0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'AffinityUpdateEnable' : [ 0xc0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'PropagateNode' : [ 0xc0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'ExplicitAffinity' : [ 0xc0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'ProcessExecutionState' : [ 0xc0, ['BitField', dict(start_bit = 22, end_bit = 24, native_type='unsigned long')]], 'DisallowStrippedImages' : [ 0xc0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'HighEntropyASLREnabled' : [ 0xc0, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'ExtensionPointDisable' : [ 0xc0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'ForceRelocateImages' : [ 0xc0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'ProcessStateChangeRequest' : [ 0xc0, ['BitField', dict(start_bit = 28, end_bit = 30, native_type='unsigned long')]], 'ProcessStateChangeInProgress' : [ 0xc0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'DisallowWin32kSystemCalls' : [ 0xc0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'Flags' : [ 0xc4, ['unsigned long']], 'CreateReported' : [ 0xc4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'NoDebugInherit' : [ 0xc4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ProcessExiting' : [ 0xc4, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ProcessDelete' : [ 0xc4, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'ControlFlowGuardEnabled' : [ 0xc4, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'VmDeleted' : [ 0xc4, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'OutswapEnabled' : [ 0xc4, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'Outswapped' : [ 0xc4, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'FailFastOnCommitFail' : [ 0xc4, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Wow64VaSpace4Gb' : [ 0xc4, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'AddressSpaceInitialized' : [ 0xc4, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned long')]], 'SetTimerResolution' : [ 0xc4, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'BreakOnTermination' : [ 0xc4, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'DeprioritizeViews' : [ 0xc4, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'WriteWatch' : [ 0xc4, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'ProcessInSession' : [ 0xc4, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'OverrideAddressSpace' : [ 0xc4, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'HasAddressSpace' : [ 0xc4, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'LaunchPrefetched' : [ 0xc4, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'Background' : [ 0xc4, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'VmTopDown' : [ 0xc4, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'ImageNotifyDone' : [ 0xc4, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'PdeUpdateNeeded' : [ 0xc4, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'VdmAllowed' : [ 0xc4, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'ProcessRundown' : [ 0xc4, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'ProcessInserted' : [ 0xc4, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'DefaultIoPriority' : [ 0xc4, ['BitField', dict(start_bit = 27, end_bit = 30, native_type='unsigned long')]], 'ProcessSelfDelete' : [ 0xc4, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'SetTimerResolutionLink' : [ 0xc4, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'CreateTime' : [ 0xc8, ['_LARGE_INTEGER']], 'ProcessQuotaUsage' : [ 0xd0, ['array', 2, ['unsigned long']]], 'ProcessQuotaPeak' : [ 0xd8, ['array', 2, ['unsigned long']]], 'PeakVirtualSize' : [ 0xe0, ['unsigned long']], 'VirtualSize' : [ 0xe4, ['unsigned long']], 'SessionProcessLinks' : [ 0xe8, ['_LIST_ENTRY']], 'ExceptionPortData' : [ 0xf0, ['pointer', ['void']]], 'ExceptionPortValue' : [ 0xf0, ['unsigned long']], 'ExceptionPortState' : [ 0xf0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Token' : [ 0xf4, ['_EX_FAST_REF']], 'WorkingSetPage' : [ 0xf8, ['unsigned long']], 'AddressCreationLock' : [ 0xfc, ['_EX_PUSH_LOCK']], 'PageTableCommitmentLock' : [ 0x100, ['_EX_PUSH_LOCK']], 'RotateInProgress' : [ 0x104, ['pointer', ['_ETHREAD']]], 'ForkInProgress' : [ 0x108, ['pointer', ['_ETHREAD']]], 'CommitChargeJob' : [ 0x10c, ['pointer', ['_EJOB']]], 'CloneRoot' : [ 0x110, ['_RTL_AVL_TREE']], 'NumberOfPrivatePages' : [ 0x114, ['unsigned long']], 'NumberOfLockedPages' : [ 0x118, ['unsigned long']], 'Win32Process' : [ 0x11c, ['pointer', ['void']]], 'Job' : [ 0x120, ['pointer', ['_EJOB']]], 'SectionObject' : [ 0x124, ['pointer', ['void']]], 'SectionBaseAddress' : [ 0x128, ['pointer', ['void']]], 'Cookie' : [ 0x12c, ['unsigned long']], 'WorkingSetWatch' : [ 0x130, ['pointer', ['_PAGEFAULT_HISTORY']]], 'Win32WindowStation' : [ 0x134, ['pointer', ['void']]], 'InheritedFromUniqueProcessId' : [ 0x138, ['pointer', ['void']]], 'LdtInformation' : [ 0x13c, ['pointer', ['void']]], 'OwnerProcessId' : [ 0x140, ['unsigned long']], 'Peb' : [ 0x144, ['pointer', ['_PEB']]], 'Session' : [ 0x148, ['pointer', ['void']]], 'AweInfo' : [ 0x14c, ['pointer', ['void']]], 'QuotaBlock' : [ 0x150, ['pointer', ['_EPROCESS_QUOTA_BLOCK']]], 'ObjectTable' : [ 0x154, ['pointer', ['_HANDLE_TABLE']]], 'DebugPort' : [ 0x158, ['pointer', ['void']]], 'PaeTop' : [ 0x15c, ['pointer', ['void']]], 'DeviceMap' : [ 0x160, ['pointer', ['void']]], 'EtwDataSource' : [ 0x164, ['pointer', ['void']]], 'PageDirectoryPte' : [ 0x168, ['unsigned long long']], 'ImageFileName' : [ 0x170, ['array', 15, ['unsigned char']]], 'PriorityClass' : [ 0x17f, ['unsigned char']], 'SecurityPort' : [ 0x180, ['pointer', ['void']]], 'SeAuditProcessCreationInfo' : [ 0x184, ['_SE_AUDIT_PROCESS_CREATION_INFO']], 'JobLinks' : [ 0x188, ['_LIST_ENTRY']], 'HighestUserAddress' : [ 0x190, ['pointer', ['void']]], 'ThreadListHead' : [ 0x194, ['_LIST_ENTRY']], 'ActiveThreads' : [ 0x19c, ['unsigned long']], 'ImagePathHash' : [ 0x1a0, ['unsigned long']], 'DefaultHardErrorProcessing' : [ 0x1a4, ['unsigned long']], 'LastThreadExitStatus' : [ 0x1a8, ['long']], 'PrefetchTrace' : [ 0x1ac, ['_EX_FAST_REF']], 'LockedPagesList' : [ 0x1b0, ['pointer', ['void']]], 'ReadOperationCount' : [ 0x1b8, ['_LARGE_INTEGER']], 'WriteOperationCount' : [ 0x1c0, ['_LARGE_INTEGER']], 'OtherOperationCount' : [ 0x1c8, ['_LARGE_INTEGER']], 'ReadTransferCount' : [ 0x1d0, ['_LARGE_INTEGER']], 'WriteTransferCount' : [ 0x1d8, ['_LARGE_INTEGER']], 'OtherTransferCount' : [ 0x1e0, ['_LARGE_INTEGER']], 'CommitChargeLimit' : [ 0x1e8, ['unsigned long']], 'CommitCharge' : [ 0x1ec, ['unsigned long']], 'CommitChargePeak' : [ 0x1f0, ['unsigned long']], 'Vm' : [ 0x1f4, ['_MMSUPPORT']], 'MmProcessLinks' : [ 0x274, ['_LIST_ENTRY']], 'ModifiedPageCount' : [ 0x27c, ['unsigned long']], 'ExitStatus' : [ 0x280, ['long']], 'VadRoot' : [ 0x284, ['_RTL_AVL_TREE']], 'VadHint' : [ 0x288, ['pointer', ['void']]], 'VadCount' : [ 0x28c, ['unsigned long']], 'VadPhysicalPages' : [ 0x290, ['unsigned long']], 'VadPhysicalPagesLimit' : [ 0x294, ['unsigned long']], 'AlpcContext' : [ 0x298, ['_ALPC_PROCESS_CONTEXT']], 'TimerResolutionLink' : [ 0x2a8, ['_LIST_ENTRY']], 'TimerResolutionStackRecord' : [ 0x2b0, ['pointer', ['_PO_DIAG_STACK_RECORD']]], 'RequestedTimerResolution' : [ 0x2b4, ['unsigned long']], 'SmallestTimerResolution' : [ 0x2b8, ['unsigned long']], 'ExitTime' : [ 0x2c0, ['_LARGE_INTEGER']], 'ActiveThreadsHighWatermark' : [ 0x2c8, ['unsigned long']], 'LargePrivateVadCount' : [ 0x2cc, ['unsigned long']], 'ThreadListLock' : [ 0x2d0, ['_EX_PUSH_LOCK']], 'WnfContext' : [ 0x2d4, ['pointer', ['void']]], 'Spare0' : [ 0x2d8, ['unsigned long']], 'SignatureLevel' : [ 0x2dc, ['unsigned char']], 'SectionSignatureLevel' : [ 0x2dd, ['unsigned char']], 'Protection' : [ 0x2de, ['_PS_PROTECTION']], 'HangCount' : [ 0x2df, ['unsigned char']], 'Flags3' : [ 0x2e0, ['unsigned long']], 'Minimal' : [ 0x2e0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReplacingPageRoot' : [ 0x2e0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'DisableNonSystemFonts' : [ 0x2e0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'AuditNonSystemFontLoading' : [ 0x2e0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Crashed' : [ 0x2e0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'JobVadsAreTracked' : [ 0x2e0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'VadTrackingDisabled' : [ 0x2e0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'AuxiliaryProcess' : [ 0x2e0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'SubsystemProcess' : [ 0x2e0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'IndirectCpuSets' : [ 0x2e0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'InPrivate' : [ 0x2e0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'DeviceAsid' : [ 0x2e4, ['long']], 'SvmData' : [ 0x2e8, ['pointer', ['void']]], 'SvmProcessLock' : [ 0x2ec, ['_EX_PUSH_LOCK']], 'SvmLock' : [ 0x2f0, ['unsigned long']], 'SvmProcessDeviceListHead' : [ 0x2f4, ['_LIST_ENTRY']], 'LastFreezeInterruptTime' : [ 0x300, ['unsigned long long']], 'DiskCounters' : [ 0x308, ['pointer', ['_PROCESS_DISK_COUNTERS']]], 'PicoContext' : [ 0x30c, ['pointer', ['void']]], 'KeepAliveCounter' : [ 0x310, ['unsigned long']], 'NoWakeKeepAliveCounter' : [ 0x314, ['unsigned long']], 'HighPriorityFaultsAllowed' : [ 0x318, ['unsigned long']], 'InstrumentationCallback' : [ 0x31c, ['pointer', ['void']]], 'EnergyValues' : [ 0x320, ['pointer', ['_PROCESS_ENERGY_VALUES']]], 'VmContext' : [ 0x324, ['pointer', ['void']]], 'Silo' : [ 0x328, ['pointer', ['_ESILO']]], 'SiloEntry' : [ 0x32c, ['_LIST_ENTRY']], 'SequenceNumber' : [ 0x338, ['unsigned long long']], 'CreateInterruptTime' : [ 0x340, ['unsigned long long']], 'CreateUnbiasedInterruptTime' : [ 0x348, ['unsigned long long']], 'TotalUnbiasedFrozenTime' : [ 0x350, ['unsigned long long']], 'LastAppStateUpdateTime' : [ 0x358, ['unsigned long long']], 'LastAppStateUptime' : [ 0x360, ['BitField', dict(start_bit = 0, end_bit = 61, native_type='unsigned long long')]], 'LastAppState' : [ 0x360, ['BitField', dict(start_bit = 61, end_bit = 64, native_type='unsigned long long')]], 'SharedCommitCharge' : [ 0x368, ['unsigned long']], 'SharedCommitLock' : [ 0x36c, ['_EX_PUSH_LOCK']], 'SharedCommitLinks' : [ 0x370, ['_LIST_ENTRY']], 'AllowedCpuSets' : [ 0x378, ['unsigned long']], 'DefaultCpuSets' : [ 0x37c, ['unsigned long']], 'AllowedCpuSetsIndirect' : [ 0x378, ['pointer', ['unsigned long']]], 'DefaultCpuSetsIndirect' : [ 0x37c, ['pointer', ['unsigned long']]], } ], '__unnamed_1376' : [ 0x4, { 'MasterIrp' : [ 0x0, ['pointer', ['_IRP']]], 'IrpCount' : [ 0x0, ['long']], 'SystemBuffer' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_137c' : [ 0x8, { 'UserApcRoutine' : [ 0x0, ['pointer', ['void']]], 'IssuingProcess' : [ 0x0, ['pointer', ['void']]], 'UserApcContext' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_137e' : [ 0x8, { 'AsynchronousParameters' : [ 0x0, ['__unnamed_137c']], 'AllocationSize' : [ 0x0, ['_LARGE_INTEGER']], } ], '__unnamed_1389' : [ 0x2c, { 'DeviceQueueEntry' : [ 0x0, ['_KDEVICE_QUEUE_ENTRY']], 'DriverContext' : [ 0x0, ['array', 4, ['pointer', ['void']]]], 'Thread' : [ 0x10, ['pointer', ['_ETHREAD']]], 'AuxiliaryBuffer' : [ 0x14, ['pointer', ['unsigned char']]], 'ListEntry' : [ 0x18, ['_LIST_ENTRY']], 'CurrentStackLocation' : [ 0x20, ['pointer', ['_IO_STACK_LOCATION']]], 'PacketType' : [ 0x20, ['unsigned long']], 'OriginalFileObject' : [ 0x24, ['pointer', ['_FILE_OBJECT']]], 'IrpExtension' : [ 0x28, ['pointer', ['void']]], } ], '__unnamed_138b' : [ 0x30, { 'Overlay' : [ 0x0, ['__unnamed_1389']], 'Apc' : [ 0x0, ['_KAPC']], 'CompletionKey' : [ 0x0, ['pointer', ['void']]], } ], '_IRP' : [ 0x70, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'MdlAddress' : [ 0x4, ['pointer', ['_MDL']]], 'Flags' : [ 0x8, ['unsigned long']], 'AssociatedIrp' : [ 0xc, ['__unnamed_1376']], 'ThreadListEntry' : [ 0x10, ['_LIST_ENTRY']], 'IoStatus' : [ 0x18, ['_IO_STATUS_BLOCK']], 'RequestorMode' : [ 0x20, ['unsigned char']], 'PendingReturned' : [ 0x21, ['unsigned char']], 'StackCount' : [ 0x22, ['unsigned char']], 'CurrentLocation' : [ 0x23, ['unsigned char']], 'Cancel' : [ 0x24, ['unsigned char']], 'CancelIrql' : [ 0x25, ['unsigned char']], 'ApcEnvironment' : [ 0x26, ['unsigned char']], 'AllocationFlags' : [ 0x27, ['unsigned char']], 'UserIosb' : [ 0x28, ['pointer', ['_IO_STATUS_BLOCK']]], 'UserEvent' : [ 0x2c, ['pointer', ['_KEVENT']]], 'Overlay' : [ 0x30, ['__unnamed_137e']], 'CancelRoutine' : [ 0x38, ['pointer', ['void']]], 'UserBuffer' : [ 0x3c, ['pointer', ['void']]], 'Tail' : [ 0x40, ['__unnamed_138b']], } ], '__unnamed_1392' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'FileAttributes' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'EaLength' : [ 0xc, ['unsigned long']], } ], '__unnamed_1396' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'Parameters' : [ 0xc, ['pointer', ['_NAMED_PIPE_CREATE_PARAMETERS']]], } ], '__unnamed_139a' : [ 0x10, { 'SecurityContext' : [ 0x0, ['pointer', ['_IO_SECURITY_CONTEXT']]], 'Options' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned short']], 'ShareAccess' : [ 0xa, ['unsigned short']], 'Parameters' : [ 0xc, ['pointer', ['_MAILSLOT_CREATE_PARAMETERS']]], } ], '__unnamed_139c' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'Key' : [ 0x4, ['unsigned long']], 'ByteOffset' : [ 0x8, ['_LARGE_INTEGER']], } ], '__unnamed_13a0' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'FileName' : [ 0x4, ['pointer', ['_UNICODE_STRING']]], 'FileInformationClass' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileIoCompletionNotificationInformation', 42: 'FileIoStatusBlockRangeInformation', 43: 'FileIoPriorityHintInformation', 44: 'FileSfioReserveInformation', 45: 'FileSfioVolumeInformation', 46: 'FileHardLinkInformation', 47: 'FileProcessIdsUsingFileInformation', 48: 'FileNormalizedNameInformation', 49: 'FileNetworkPhysicalNameInformation', 50: 'FileIdGlobalTxDirectoryInformation', 51: 'FileIsRemoteDeviceInformation', 52: 'FileUnusedInformation', 53: 'FileNumaNodeInformation', 54: 'FileStandardLinkInformation', 55: 'FileRemoteProtocolInformation', 56: 'FileRenameInformationBypassAccessCheck', 57: 'FileLinkInformationBypassAccessCheck', 58: 'FileVolumeNameInformation', 59: 'FileIdInformation', 60: 'FileIdExtdDirectoryInformation', 61: 'FileReplaceCompletionInformation', 62: 'FileHardLinkFullIdInformation', 63: 'FileIdExtdBothDirectoryInformation', 64: 'FileMaximumInformation'})]], 'FileIndex' : [ 0xc, ['unsigned long']], } ], '__unnamed_13a2' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'CompletionFilter' : [ 0x4, ['unsigned long']], } ], '__unnamed_13a4' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'FileInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileIoCompletionNotificationInformation', 42: 'FileIoStatusBlockRangeInformation', 43: 'FileIoPriorityHintInformation', 44: 'FileSfioReserveInformation', 45: 'FileSfioVolumeInformation', 46: 'FileHardLinkInformation', 47: 'FileProcessIdsUsingFileInformation', 48: 'FileNormalizedNameInformation', 49: 'FileNetworkPhysicalNameInformation', 50: 'FileIdGlobalTxDirectoryInformation', 51: 'FileIsRemoteDeviceInformation', 52: 'FileUnusedInformation', 53: 'FileNumaNodeInformation', 54: 'FileStandardLinkInformation', 55: 'FileRemoteProtocolInformation', 56: 'FileRenameInformationBypassAccessCheck', 57: 'FileLinkInformationBypassAccessCheck', 58: 'FileVolumeNameInformation', 59: 'FileIdInformation', 60: 'FileIdExtdDirectoryInformation', 61: 'FileReplaceCompletionInformation', 62: 'FileHardLinkFullIdInformation', 63: 'FileIdExtdBothDirectoryInformation', 64: 'FileMaximumInformation'})]], } ], '__unnamed_13a6' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'FileInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileDirectoryInformation', 2: 'FileFullDirectoryInformation', 3: 'FileBothDirectoryInformation', 4: 'FileBasicInformation', 5: 'FileStandardInformation', 6: 'FileInternalInformation', 7: 'FileEaInformation', 8: 'FileAccessInformation', 9: 'FileNameInformation', 10: 'FileRenameInformation', 11: 'FileLinkInformation', 12: 'FileNamesInformation', 13: 'FileDispositionInformation', 14: 'FilePositionInformation', 15: 'FileFullEaInformation', 16: 'FileModeInformation', 17: 'FileAlignmentInformation', 18: 'FileAllInformation', 19: 'FileAllocationInformation', 20: 'FileEndOfFileInformation', 21: 'FileAlternateNameInformation', 22: 'FileStreamInformation', 23: 'FilePipeInformation', 24: 'FilePipeLocalInformation', 25: 'FilePipeRemoteInformation', 26: 'FileMailslotQueryInformation', 27: 'FileMailslotSetInformation', 28: 'FileCompressionInformation', 29: 'FileObjectIdInformation', 30: 'FileCompletionInformation', 31: 'FileMoveClusterInformation', 32: 'FileQuotaInformation', 33: 'FileReparsePointInformation', 34: 'FileNetworkOpenInformation', 35: 'FileAttributeTagInformation', 36: 'FileTrackingInformation', 37: 'FileIdBothDirectoryInformation', 38: 'FileIdFullDirectoryInformation', 39: 'FileValidDataLengthInformation', 40: 'FileShortNameInformation', 41: 'FileIoCompletionNotificationInformation', 42: 'FileIoStatusBlockRangeInformation', 43: 'FileIoPriorityHintInformation', 44: 'FileSfioReserveInformation', 45: 'FileSfioVolumeInformation', 46: 'FileHardLinkInformation', 47: 'FileProcessIdsUsingFileInformation', 48: 'FileNormalizedNameInformation', 49: 'FileNetworkPhysicalNameInformation', 50: 'FileIdGlobalTxDirectoryInformation', 51: 'FileIsRemoteDeviceInformation', 52: 'FileUnusedInformation', 53: 'FileNumaNodeInformation', 54: 'FileStandardLinkInformation', 55: 'FileRemoteProtocolInformation', 56: 'FileRenameInformationBypassAccessCheck', 57: 'FileLinkInformationBypassAccessCheck', 58: 'FileVolumeNameInformation', 59: 'FileIdInformation', 60: 'FileIdExtdDirectoryInformation', 61: 'FileReplaceCompletionInformation', 62: 'FileHardLinkFullIdInformation', 63: 'FileIdExtdBothDirectoryInformation', 64: 'FileMaximumInformation'})]], 'FileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], 'ReplaceIfExists' : [ 0xc, ['unsigned char']], 'AdvanceOnly' : [ 0xd, ['unsigned char']], 'ClusterCount' : [ 0xc, ['unsigned long']], 'DeleteHandle' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13a8' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'EaList' : [ 0x4, ['pointer', ['void']]], 'EaListLength' : [ 0x8, ['unsigned long']], 'EaIndex' : [ 0xc, ['unsigned long']], } ], '__unnamed_13aa' : [ 0x4, { 'Length' : [ 0x0, ['unsigned long']], } ], '__unnamed_13ae' : [ 0x8, { 'Length' : [ 0x0, ['unsigned long']], 'FsInformationClass' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {1: 'FileFsVolumeInformation', 2: 'FileFsLabelInformation', 3: 'FileFsSizeInformation', 4: 'FileFsDeviceInformation', 5: 'FileFsAttributeInformation', 6: 'FileFsControlInformation', 7: 'FileFsFullSizeInformation', 8: 'FileFsObjectIdInformation', 9: 'FileFsDriverPathInformation', 10: 'FileFsVolumeFlagsInformation', 11: 'FileFsSectorSizeInformation', 12: 'FileFsDataCopyInformation', 13: 'FileFsMetadataSizeInformation', 14: 'FileFsMaximumInformation'})]], } ], '__unnamed_13b0' : [ 0x10, { 'OutputBufferLength' : [ 0x0, ['unsigned long']], 'InputBufferLength' : [ 0x4, ['unsigned long']], 'FsControlCode' : [ 0x8, ['unsigned long']], 'Type3InputBuffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13b3' : [ 0x10, { 'Length' : [ 0x0, ['pointer', ['_LARGE_INTEGER']]], 'Key' : [ 0x4, ['unsigned long']], 'ByteOffset' : [ 0x8, ['_LARGE_INTEGER']], } ], '__unnamed_13b5' : [ 0x10, { 'OutputBufferLength' : [ 0x0, ['unsigned long']], 'InputBufferLength' : [ 0x4, ['unsigned long']], 'IoControlCode' : [ 0x8, ['unsigned long']], 'Type3InputBuffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13b7' : [ 0x8, { 'SecurityInformation' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], } ], '__unnamed_13b9' : [ 0x8, { 'SecurityInformation' : [ 0x0, ['unsigned long']], 'SecurityDescriptor' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_13bd' : [ 0x8, { 'Vpb' : [ 0x0, ['pointer', ['_VPB']]], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], } ], '__unnamed_13c1' : [ 0x4, { 'Srb' : [ 0x0, ['pointer', ['_SCSI_REQUEST_BLOCK']]], } ], '__unnamed_13c5' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'StartSid' : [ 0x4, ['pointer', ['void']]], 'SidList' : [ 0x8, ['pointer', ['_FILE_GET_QUOTA_INFORMATION']]], 'SidListLength' : [ 0xc, ['unsigned long']], } ], '__unnamed_13c9' : [ 0x4, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'BusRelations', 1: 'EjectionRelations', 2: 'PowerRelations', 3: 'RemovalRelations', 4: 'TargetDeviceRelation', 5: 'SingleBusRelations', 6: 'TransportRelations'})]], } ], '__unnamed_13cd' : [ 0x10, { 'InterfaceType' : [ 0x0, ['pointer', ['_GUID']]], 'Size' : [ 0x4, ['unsigned short']], 'Version' : [ 0x6, ['unsigned short']], 'Interface' : [ 0x8, ['pointer', ['_INTERFACE']]], 'InterfaceSpecificData' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13d1' : [ 0x4, { 'Capabilities' : [ 0x0, ['pointer', ['_DEVICE_CAPABILITIES']]], } ], '__unnamed_13d5' : [ 0x4, { 'IoResourceRequirementList' : [ 0x0, ['pointer', ['_IO_RESOURCE_REQUIREMENTS_LIST']]], } ], '__unnamed_13d7' : [ 0x10, { 'WhichSpace' : [ 0x0, ['unsigned long']], 'Buffer' : [ 0x4, ['pointer', ['void']]], 'Offset' : [ 0x8, ['unsigned long']], 'Length' : [ 0xc, ['unsigned long']], } ], '__unnamed_13d9' : [ 0x1, { 'Lock' : [ 0x0, ['unsigned char']], } ], '__unnamed_13dd' : [ 0x4, { 'IdType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'BusQueryDeviceID', 1: 'BusQueryHardwareIDs', 2: 'BusQueryCompatibleIDs', 3: 'BusQueryInstanceID', 4: 'BusQueryDeviceSerialNumber', 5: 'BusQueryContainerID'})]], } ], '__unnamed_13e1' : [ 0x8, { 'DeviceTextType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceTextDescription', 1: 'DeviceTextLocationInformation'})]], 'LocaleId' : [ 0x4, ['unsigned long']], } ], '__unnamed_13e5' : [ 0x8, { 'InPath' : [ 0x0, ['unsigned char']], 'Reserved' : [ 0x1, ['array', 3, ['unsigned char']]], 'Type' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceUsageTypeUndefined', 1: 'DeviceUsageTypePaging', 2: 'DeviceUsageTypeHibernation', 3: 'DeviceUsageTypeDumpFile', 4: 'DeviceUsageTypeBoot', 5: 'DeviceUsageTypePostDisplay'})]], } ], '__unnamed_13e9' : [ 0x4, { 'PowerState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], '__unnamed_13ed' : [ 0x4, { 'PowerSequence' : [ 0x0, ['pointer', ['_POWER_SEQUENCE']]], } ], '__unnamed_13f5' : [ 0x10, { 'SystemContext' : [ 0x0, ['unsigned long']], 'SystemPowerStateContext' : [ 0x0, ['_SYSTEM_POWER_STATE_CONTEXT']], 'Type' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SystemPowerState', 1: 'DevicePowerState'})]], 'State' : [ 0x8, ['_POWER_STATE']], 'ShutdownType' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject', 8: 'PowerActionDisplayOff'})]], } ], '__unnamed_13f9' : [ 0x8, { 'AllocatedResources' : [ 0x0, ['pointer', ['_CM_RESOURCE_LIST']]], 'AllocatedResourcesTranslated' : [ 0x4, ['pointer', ['_CM_RESOURCE_LIST']]], } ], '__unnamed_13fb' : [ 0x10, { 'ProviderId' : [ 0x0, ['unsigned long']], 'DataPath' : [ 0x4, ['pointer', ['void']]], 'BufferSize' : [ 0x8, ['unsigned long']], 'Buffer' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13fd' : [ 0x10, { 'Argument1' : [ 0x0, ['pointer', ['void']]], 'Argument2' : [ 0x4, ['pointer', ['void']]], 'Argument3' : [ 0x8, ['pointer', ['void']]], 'Argument4' : [ 0xc, ['pointer', ['void']]], } ], '__unnamed_13ff' : [ 0x10, { 'Create' : [ 0x0, ['__unnamed_1392']], 'CreatePipe' : [ 0x0, ['__unnamed_1396']], 'CreateMailslot' : [ 0x0, ['__unnamed_139a']], 'Read' : [ 0x0, ['__unnamed_139c']], 'Write' : [ 0x0, ['__unnamed_139c']], 'QueryDirectory' : [ 0x0, ['__unnamed_13a0']], 'NotifyDirectory' : [ 0x0, ['__unnamed_13a2']], 'QueryFile' : [ 0x0, ['__unnamed_13a4']], 'SetFile' : [ 0x0, ['__unnamed_13a6']], 'QueryEa' : [ 0x0, ['__unnamed_13a8']], 'SetEa' : [ 0x0, ['__unnamed_13aa']], 'QueryVolume' : [ 0x0, ['__unnamed_13ae']], 'SetVolume' : [ 0x0, ['__unnamed_13ae']], 'FileSystemControl' : [ 0x0, ['__unnamed_13b0']], 'LockControl' : [ 0x0, ['__unnamed_13b3']], 'DeviceIoControl' : [ 0x0, ['__unnamed_13b5']], 'QuerySecurity' : [ 0x0, ['__unnamed_13b7']], 'SetSecurity' : [ 0x0, ['__unnamed_13b9']], 'MountVolume' : [ 0x0, ['__unnamed_13bd']], 'VerifyVolume' : [ 0x0, ['__unnamed_13bd']], 'Scsi' : [ 0x0, ['__unnamed_13c1']], 'QueryQuota' : [ 0x0, ['__unnamed_13c5']], 'SetQuota' : [ 0x0, ['__unnamed_13aa']], 'QueryDeviceRelations' : [ 0x0, ['__unnamed_13c9']], 'QueryInterface' : [ 0x0, ['__unnamed_13cd']], 'DeviceCapabilities' : [ 0x0, ['__unnamed_13d1']], 'FilterResourceRequirements' : [ 0x0, ['__unnamed_13d5']], 'ReadWriteConfig' : [ 0x0, ['__unnamed_13d7']], 'SetLock' : [ 0x0, ['__unnamed_13d9']], 'QueryId' : [ 0x0, ['__unnamed_13dd']], 'QueryDeviceText' : [ 0x0, ['__unnamed_13e1']], 'UsageNotification' : [ 0x0, ['__unnamed_13e5']], 'WaitWake' : [ 0x0, ['__unnamed_13e9']], 'PowerSequence' : [ 0x0, ['__unnamed_13ed']], 'Power' : [ 0x0, ['__unnamed_13f5']], 'StartDevice' : [ 0x0, ['__unnamed_13f9']], 'WMI' : [ 0x0, ['__unnamed_13fb']], 'Others' : [ 0x0, ['__unnamed_13fd']], } ], '_IO_STACK_LOCATION' : [ 0x24, { 'MajorFunction' : [ 0x0, ['unsigned char']], 'MinorFunction' : [ 0x1, ['unsigned char']], 'Flags' : [ 0x2, ['unsigned char']], 'Control' : [ 0x3, ['unsigned char']], 'Parameters' : [ 0x4, ['__unnamed_13ff']], 'DeviceObject' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], 'FileObject' : [ 0x18, ['pointer', ['_FILE_OBJECT']]], 'CompletionRoutine' : [ 0x1c, ['pointer', ['void']]], 'Context' : [ 0x20, ['pointer', ['void']]], } ], '__unnamed_1415' : [ 0x28, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Wcb' : [ 0x0, ['_WAIT_CONTEXT_BLOCK']], } ], '_DEVICE_OBJECT' : [ 0xb8, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'ReferenceCount' : [ 0x4, ['long']], 'DriverObject' : [ 0x8, ['pointer', ['_DRIVER_OBJECT']]], 'NextDevice' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'AttachedDevice' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'CurrentIrp' : [ 0x14, ['pointer', ['_IRP']]], 'Timer' : [ 0x18, ['pointer', ['_IO_TIMER']]], 'Flags' : [ 0x1c, ['unsigned long']], 'Characteristics' : [ 0x20, ['unsigned long']], 'Vpb' : [ 0x24, ['pointer', ['_VPB']]], 'DeviceExtension' : [ 0x28, ['pointer', ['void']]], 'DeviceType' : [ 0x2c, ['unsigned long']], 'StackSize' : [ 0x30, ['unsigned char']], 'Queue' : [ 0x34, ['__unnamed_1415']], 'AlignmentRequirement' : [ 0x5c, ['unsigned long']], 'DeviceQueue' : [ 0x60, ['_KDEVICE_QUEUE']], 'Dpc' : [ 0x74, ['_KDPC']], 'ActiveThreadCount' : [ 0x94, ['unsigned long']], 'SecurityDescriptor' : [ 0x98, ['pointer', ['void']]], 'DeviceLock' : [ 0x9c, ['_KEVENT']], 'SectorSize' : [ 0xac, ['unsigned short']], 'Spare1' : [ 0xae, ['unsigned short']], 'DeviceObjectExtension' : [ 0xb0, ['pointer', ['_DEVOBJ_EXTENSION']]], 'Reserved' : [ 0xb4, ['pointer', ['void']]], } ], '_KDPC' : [ 0x20, { 'TargetInfoAsUlong' : [ 0x0, ['unsigned long']], 'Type' : [ 0x0, ['unsigned char']], 'Importance' : [ 0x1, ['unsigned char']], 'Number' : [ 0x2, ['unsigned short']], 'DpcListEntry' : [ 0x4, ['_SINGLE_LIST_ENTRY']], 'ProcessorHistory' : [ 0x8, ['unsigned long']], 'DeferredRoutine' : [ 0xc, ['pointer', ['void']]], 'DeferredContext' : [ 0x10, ['pointer', ['void']]], 'SystemArgument1' : [ 0x14, ['pointer', ['void']]], 'SystemArgument2' : [ 0x18, ['pointer', ['void']]], 'DpcData' : [ 0x1c, ['pointer', ['void']]], } ], '_IO_DRIVER_CREATE_CONTEXT' : [ 0x10, { 'Size' : [ 0x0, ['short']], 'ExtraCreateParameter' : [ 0x4, ['pointer', ['_ECP_LIST']]], 'DeviceObjectHint' : [ 0x8, ['pointer', ['void']]], 'TxnParameters' : [ 0xc, ['pointer', ['_TXN_PARAMETER_BLOCK']]], } ], '_IO_PRIORITY_INFO' : [ 0x10, { 'Size' : [ 0x0, ['unsigned long']], 'ThreadPriority' : [ 0x4, ['unsigned long']], 'PagePriority' : [ 0x8, ['unsigned long']], 'IoPriority' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'IoPriorityVeryLow', 1: 'IoPriorityLow', 2: 'IoPriorityNormal', 3: 'IoPriorityHigh', 4: 'IoPriorityCritical', 5: 'MaxIoPriorityTypes'})]], } ], '_MDL' : [ 0x1c, { 'Next' : [ 0x0, ['pointer', ['_MDL']]], 'Size' : [ 0x4, ['short']], 'MdlFlags' : [ 0x6, ['short']], 'Process' : [ 0x8, ['pointer', ['_EPROCESS']]], 'MappedSystemVa' : [ 0xc, ['pointer', ['void']]], 'StartVa' : [ 0x10, ['pointer', ['void']]], 'ByteCount' : [ 0x14, ['unsigned long']], 'ByteOffset' : [ 0x18, ['unsigned long']], } ], '_EVENT_DATA_DESCRIPTOR' : [ 0x10, { 'Ptr' : [ 0x0, ['unsigned long long']], 'Size' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], 'Type' : [ 0xc, ['unsigned char']], 'Reserved1' : [ 0xd, ['unsigned char']], 'Reserved2' : [ 0xe, ['unsigned short']], } ], '_EVENT_DESCRIPTOR' : [ 0x10, { 'Id' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned char']], 'Channel' : [ 0x3, ['unsigned char']], 'Level' : [ 0x4, ['unsigned char']], 'Opcode' : [ 0x5, ['unsigned char']], 'Task' : [ 0x6, ['unsigned short']], 'Keyword' : [ 0x8, ['unsigned long long']], } ], '_EVENT_RECORD' : [ 0x68, { 'EventHeader' : [ 0x0, ['_EVENT_HEADER']], 'BufferContext' : [ 0x50, ['_ETW_BUFFER_CONTEXT']], 'ExtendedDataCount' : [ 0x54, ['unsigned short']], 'UserDataLength' : [ 0x56, ['unsigned short']], 'ExtendedData' : [ 0x58, ['pointer', ['_EVENT_HEADER_EXTENDED_DATA_ITEM']]], 'UserData' : [ 0x5c, ['pointer', ['void']]], 'UserContext' : [ 0x60, ['pointer', ['void']]], } ], '_PERFINFO_GROUPMASK' : [ 0x20, { 'Masks' : [ 0x0, ['array', 8, ['unsigned long']]], } ], '_FILE_OBJECT' : [ 0x80, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'Vpb' : [ 0x8, ['pointer', ['_VPB']]], 'FsContext' : [ 0xc, ['pointer', ['void']]], 'FsContext2' : [ 0x10, ['pointer', ['void']]], 'SectionObjectPointer' : [ 0x14, ['pointer', ['_SECTION_OBJECT_POINTERS']]], 'PrivateCacheMap' : [ 0x18, ['pointer', ['void']]], 'FinalStatus' : [ 0x1c, ['long']], 'RelatedFileObject' : [ 0x20, ['pointer', ['_FILE_OBJECT']]], 'LockOperation' : [ 0x24, ['unsigned char']], 'DeletePending' : [ 0x25, ['unsigned char']], 'ReadAccess' : [ 0x26, ['unsigned char']], 'WriteAccess' : [ 0x27, ['unsigned char']], 'DeleteAccess' : [ 0x28, ['unsigned char']], 'SharedRead' : [ 0x29, ['unsigned char']], 'SharedWrite' : [ 0x2a, ['unsigned char']], 'SharedDelete' : [ 0x2b, ['unsigned char']], 'Flags' : [ 0x2c, ['unsigned long']], 'FileName' : [ 0x30, ['_UNICODE_STRING']], 'CurrentByteOffset' : [ 0x38, ['_LARGE_INTEGER']], 'Waiters' : [ 0x40, ['unsigned long']], 'Busy' : [ 0x44, ['unsigned long']], 'LastLock' : [ 0x48, ['pointer', ['void']]], 'Lock' : [ 0x4c, ['_KEVENT']], 'Event' : [ 0x5c, ['_KEVENT']], 'CompletionContext' : [ 0x6c, ['pointer', ['_IO_COMPLETION_CONTEXT']]], 'IrpListLock' : [ 0x70, ['unsigned long']], 'IrpList' : [ 0x74, ['_LIST_ENTRY']], 'FileObjectExtension' : [ 0x7c, ['pointer', ['void']]], } ], '_EX_RUNDOWN_REF' : [ 0x4, { 'Count' : [ 0x0, ['unsigned long']], 'Ptr' : [ 0x0, ['pointer', ['void']]], } ], '_MM_PAGE_ACCESS_INFO_HEADER' : [ 0x38, { 'Link' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Type' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'MmPteAccessType', 1: 'MmCcReadAheadType', 2: 'MmPfnRepurposeType', 3: 'MmMaximumPageAccessType'})]], 'EmptySequenceNumber' : [ 0x8, ['unsigned long']], 'CurrentFileIndex' : [ 0x8, ['unsigned long']], 'CreateTime' : [ 0x10, ['unsigned long long']], 'EmptyTime' : [ 0x18, ['unsigned long long']], 'TempEntry' : [ 0x18, ['pointer', ['_MM_PAGE_ACCESS_INFO']]], 'PageEntry' : [ 0x20, ['pointer', ['_MM_PAGE_ACCESS_INFO']]], 'FileEntry' : [ 0x24, ['pointer', ['unsigned long']]], 'FirstFileEntry' : [ 0x28, ['pointer', ['unsigned long']]], 'Process' : [ 0x2c, ['pointer', ['_EPROCESS']]], 'SessionId' : [ 0x30, ['unsigned long']], 'PageFrameEntry' : [ 0x20, ['pointer', ['unsigned long']]], 'LastPageFrameEntry' : [ 0x24, ['pointer', ['unsigned long']]], } ], '_WHEA_ERROR_PACKET_V2' : [ 0x50, { 'Signature' : [ 0x0, ['unsigned long']], 'Version' : [ 0x4, ['unsigned long']], 'Length' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['_WHEA_ERROR_PACKET_FLAGS']], 'ErrorType' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrTypeProcessor', 1: 'WheaErrTypeMemory', 2: 'WheaErrTypePCIExpress', 3: 'WheaErrTypeNMI', 4: 'WheaErrTypePCIXBus', 5: 'WheaErrTypePCIXDevice', 6: 'WheaErrTypeGeneric'})]], 'ErrorSeverity' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSevRecoverable', 1: 'WheaErrSevFatal', 2: 'WheaErrSevCorrected', 3: 'WheaErrSevInformational'})]], 'ErrorSourceId' : [ 0x18, ['unsigned long']], 'ErrorSourceType' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSrcTypeMCE', 1: 'WheaErrSrcTypeCMC', 2: 'WheaErrSrcTypeCPE', 3: 'WheaErrSrcTypeNMI', 4: 'WheaErrSrcTypePCIe', 5: 'WheaErrSrcTypeGeneric', 6: 'WheaErrSrcTypeINIT', 7: 'WheaErrSrcTypeBOOT', 8: 'WheaErrSrcTypeSCIGeneric', 9: 'WheaErrSrcTypeIPFMCA', 10: 'WheaErrSrcTypeIPFCMC', 11: 'WheaErrSrcTypeIPFCPE', 12: 'WheaErrSrcTypeMax'})]], 'NotifyType' : [ 0x20, ['_GUID']], 'Context' : [ 0x30, ['unsigned long long']], 'DataFormat' : [ 0x38, ['Enumeration', dict(target = 'long', choices = {0: 'WheaDataFormatIPFSalRecord', 1: 'WheaDataFormatXPFMCA', 2: 'WheaDataFormatMemory', 3: 'WheaDataFormatPCIExpress', 4: 'WheaDataFormatNMIPort', 5: 'WheaDataFormatPCIXBus', 6: 'WheaDataFormatPCIXDevice', 7: 'WheaDataFormatGeneric', 8: 'WheaDataFormatMax'})]], 'Reserved1' : [ 0x3c, ['unsigned long']], 'DataOffset' : [ 0x40, ['unsigned long']], 'DataLength' : [ 0x44, ['unsigned long']], 'PshedDataOffset' : [ 0x48, ['unsigned long']], 'PshedDataLength' : [ 0x4c, ['unsigned long']], } ], '_WHEA_ERROR_RECORD' : [ 0xc8, { 'Header' : [ 0x0, ['_WHEA_ERROR_RECORD_HEADER']], 'SectionDescriptor' : [ 0x80, ['array', 1, ['_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR']]], } ], '_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR' : [ 0x48, { 'SectionOffset' : [ 0x0, ['unsigned long']], 'SectionLength' : [ 0x4, ['unsigned long']], 'Revision' : [ 0x8, ['_WHEA_REVISION']], 'ValidBits' : [ 0xa, ['_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS']], 'Reserved' : [ 0xb, ['unsigned char']], 'Flags' : [ 0xc, ['_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS']], 'SectionType' : [ 0x10, ['_GUID']], 'FRUId' : [ 0x20, ['_GUID']], 'SectionSeverity' : [ 0x30, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSevRecoverable', 1: 'WheaErrSevFatal', 2: 'WheaErrSevCorrected', 3: 'WheaErrSevInformational'})]], 'FRUText' : [ 0x34, ['array', 20, ['unsigned char']]], } ], '_FSRTL_ADVANCED_FCB_HEADER' : [ 0x48, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteSize' : [ 0x2, ['short']], 'Flags' : [ 0x4, ['unsigned char']], 'IsFastIoPossible' : [ 0x5, ['unsigned char']], 'Flags2' : [ 0x6, ['unsigned char']], 'Reserved' : [ 0x7, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned char')]], 'Version' : [ 0x7, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], 'Resource' : [ 0x8, ['pointer', ['_ERESOURCE']]], 'PagingIoResource' : [ 0xc, ['pointer', ['_ERESOURCE']]], 'AllocationSize' : [ 0x10, ['_LARGE_INTEGER']], 'FileSize' : [ 0x18, ['_LARGE_INTEGER']], 'ValidDataLength' : [ 0x20, ['_LARGE_INTEGER']], 'FastMutex' : [ 0x28, ['pointer', ['_FAST_MUTEX']]], 'FilterContexts' : [ 0x2c, ['_LIST_ENTRY']], 'PushLock' : [ 0x34, ['_EX_PUSH_LOCK']], 'FileContextSupportPointer' : [ 0x38, ['pointer', ['pointer', ['void']]]], 'Oplock' : [ 0x3c, ['pointer', ['void']]], 'ReservedForRemote' : [ 0x3c, ['pointer', ['void']]], 'ReservedContext' : [ 0x40, ['pointer', ['void']]], } ], '_iobuf' : [ 0x20, { '_ptr' : [ 0x0, ['pointer', ['unsigned char']]], '_cnt' : [ 0x4, ['long']], '_base' : [ 0x8, ['pointer', ['unsigned char']]], '_flag' : [ 0xc, ['long']], '_file' : [ 0x10, ['long']], '_charbuf' : [ 0x14, ['long']], '_bufsiz' : [ 0x18, ['long']], '_tmpfname' : [ 0x1c, ['pointer', ['unsigned char']]], } ], '_TlgProvider_t' : [ 0x30, { 'LevelPlus1' : [ 0x0, ['unsigned long']], 'ProviderMetadataPtr' : [ 0x4, ['pointer', ['unsigned short']]], 'KeywordAny' : [ 0x8, ['unsigned long long']], 'KeywordAll' : [ 0x10, ['unsigned long long']], 'RegHandle' : [ 0x18, ['unsigned long long']], 'EnableCallback' : [ 0x20, ['pointer', ['void']]], 'CallbackContext' : [ 0x24, ['pointer', ['void']]], 'AnnotationFunc' : [ 0x28, ['pointer', ['void']]], } ], '_EVENT_FILTER_DESCRIPTOR' : [ 0x10, { 'Ptr' : [ 0x0, ['unsigned long long']], 'Size' : [ 0x8, ['unsigned long']], 'Type' : [ 0xc, ['unsigned long']], } ], '_TlgProviderMetadata_t' : [ 0x13, { 'Type' : [ 0x0, ['unsigned char']], 'ProviderId' : [ 0x1, ['_GUID']], 'RemainingSize' : [ 0x11, ['unsigned short']], } ], '_SID' : [ 0xc, { 'Revision' : [ 0x0, ['unsigned char']], 'SubAuthorityCount' : [ 0x1, ['unsigned char']], 'IdentifierAuthority' : [ 0x2, ['_SID_IDENTIFIER_AUTHORITY']], 'SubAuthority' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '__unnamed_15e3' : [ 0x8, { 'Long' : [ 0x0, ['unsigned long long']], 'VolatileLong' : [ 0x0, ['unsigned long long']], 'HighLow' : [ 0x0, ['_MMPTE_HIGHLOW']], 'Flush' : [ 0x0, ['_HARDWARE_PTE']], 'Hard' : [ 0x0, ['_MMPTE_HARDWARE']], 'Proto' : [ 0x0, ['_MMPTE_PROTOTYPE']], 'Soft' : [ 0x0, ['_MMPTE_SOFTWARE']], 'TimeStamp' : [ 0x0, ['_MMPTE_TIMESTAMP']], 'Trans' : [ 0x0, ['_MMPTE_TRANSITION']], 'Subsect' : [ 0x0, ['_MMPTE_SUBSECTION']], 'List' : [ 0x0, ['_MMPTE_LIST']], } ], '_MMPTE' : [ 0x8, { 'u' : [ 0x0, ['__unnamed_15e3']], } ], '_EX_PUSH_LOCK_AUTO_EXPAND' : [ 0xc, { 'LocalLock' : [ 0x0, ['_EX_PUSH_LOCK']], 'State' : [ 0x4, ['_EX_PUSH_LOCK_AUTO_EXPAND_STATE']], 'Stats' : [ 0x8, ['unsigned long']], } ], '_ERESOURCE' : [ 0x38, { 'SystemResourcesList' : [ 0x0, ['_LIST_ENTRY']], 'OwnerTable' : [ 0x8, ['pointer', ['_OWNER_ENTRY']]], 'ActiveCount' : [ 0xc, ['short']], 'Flag' : [ 0xe, ['unsigned short']], 'ReservedLowFlags' : [ 0xe, ['unsigned char']], 'WaiterPriority' : [ 0xf, ['unsigned char']], 'SharedWaiters' : [ 0x10, ['_KWAIT_CHAIN']], 'ExclusiveWaiters' : [ 0x14, ['pointer', ['_KEVENT']]], 'OwnerEntry' : [ 0x18, ['_OWNER_ENTRY']], 'ActiveEntries' : [ 0x20, ['unsigned long']], 'ContentionCount' : [ 0x24, ['unsigned long']], 'NumberOfSharedWaiters' : [ 0x28, ['unsigned long']], 'NumberOfExclusiveWaiters' : [ 0x2c, ['unsigned long']], 'Address' : [ 0x30, ['pointer', ['void']]], 'CreatorBackTraceIndex' : [ 0x30, ['unsigned long']], 'SpinLock' : [ 0x34, ['unsigned long']], } ], '_MI_CACHED_PTE' : [ 0x8, { 'GlobalTimeStamp' : [ 0x0, ['unsigned long']], 'PteIndex' : [ 0x4, ['unsigned long']], 'Long' : [ 0x0, ['long long']], } ], '_KLOCK_QUEUE_HANDLE' : [ 0xc, { 'LockQueue' : [ 0x0, ['_KSPIN_LOCK_QUEUE']], 'OldIrql' : [ 0x8, ['unsigned char']], } ], '_MMPFNLIST' : [ 0x14, { 'Total' : [ 0x0, ['unsigned long']], 'ListName' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'ZeroedPageList', 1: 'FreePageList', 2: 'StandbyPageList', 3: 'ModifiedPageList', 4: 'ModifiedNoWritePageList', 5: 'BadPageList', 6: 'ActiveAndValid', 7: 'TransitionPage'})]], 'Flink' : [ 0x8, ['unsigned long']], 'Blink' : [ 0xc, ['unsigned long']], 'Lock' : [ 0x10, ['unsigned long']], } ], '__unnamed_161b' : [ 0x4, { 'Flink' : [ 0x0, ['unsigned long']], 'WsIndex' : [ 0x0, ['unsigned long']], 'Event' : [ 0x0, ['pointer', ['_KEVENT']]], 'Next' : [ 0x0, ['pointer', ['void']]], 'VolatileNext' : [ 0x0, ['pointer', ['void']]], 'KernelStackOwner' : [ 0x0, ['pointer', ['_KTHREAD']]], 'NextStackPfn' : [ 0x0, ['_SINGLE_LIST_ENTRY']], } ], '__unnamed_161f' : [ 0x4, { 'ReferenceCount' : [ 0x0, ['unsigned short']], 'ShortFlags' : [ 0x2, ['unsigned short']], 'VolatileShortFlags' : [ 0x2, ['unsigned short']], } ], '__unnamed_1621' : [ 0x4, { 'ReferenceCount' : [ 0x0, ['unsigned short']], 'e1' : [ 0x2, ['_MMPFNENTRY']], 'e2' : [ 0x0, ['__unnamed_161f']], } ], '__unnamed_1626' : [ 0x4, { 'PteFrame' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'PageIdentity' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 27, native_type='unsigned long')]], 'PrototypePte' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'PageColor' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 32, native_type='unsigned long')]], 'EntireField' : [ 0x0, ['unsigned long']], } ], '_MMPFN' : [ 0x1c, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'TreeNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'u1' : [ 0x0, ['__unnamed_161b']], 'PteAddress' : [ 0x4, ['pointer', ['_MMPTE']]], 'VolatilePteAddress' : [ 0x4, ['pointer', ['void']]], 'PteLong' : [ 0x4, ['unsigned long']], 'OriginalPte' : [ 0x8, ['_MMPTE']], 'u2' : [ 0x10, ['_MIPFNBLINK']], 'u3' : [ 0x14, ['__unnamed_1621']], 'u4' : [ 0x18, ['__unnamed_1626']], } ], '_MI_SYSTEM_PTE_TYPE' : [ 0x34, { 'Bitmap' : [ 0x0, ['_RTL_BITMAP']], 'BasePte' : [ 0x8, ['pointer', ['_MMPTE']]], 'Flags' : [ 0xc, ['unsigned long']], 'VaType' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'MiVaUnused', 1: 'MiVaSessionSpace', 2: 'MiVaProcessSpace', 3: 'MiVaBootLoaded', 4: 'MiVaPfnDatabase', 5: 'MiVaNonPagedPool', 6: 'MiVaPagedPool', 7: 'MiVaSpecialPoolPaged', 8: 'MiVaSystemCache', 9: 'MiVaSystemPtes', 10: 'MiVaHal', 11: 'MiVaSessionGlobalSpace', 12: 'MiVaDriverImages', 13: 'MiVaSpecialPoolNonPaged', 14: 'MiVaPagedProtoPool', 15: 'MiVaMaximumType', 16: 'MiVaSystemPtesLarge'})]], 'FailureCount' : [ 0x14, ['pointer', ['unsigned long']]], 'PteFailures' : [ 0x18, ['unsigned long']], 'SpinLock' : [ 0x1c, ['unsigned long']], 'GlobalPushLock' : [ 0x1c, ['pointer', ['_EX_PUSH_LOCK']]], 'Vm' : [ 0x20, ['pointer', ['_MMSUPPORT']]], 'TotalSystemPtes' : [ 0x24, ['unsigned long']], 'Hint' : [ 0x28, ['unsigned long']], 'CachedPtes' : [ 0x2c, ['pointer', ['_MI_CACHED_PTES']]], 'TotalFreeSystemPtes' : [ 0x30, ['unsigned long']], } ], '_MMCLONE_DESCRIPTOR' : [ 0x30, { 'CloneNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'Next' : [ 0x0, ['pointer', ['_MMCLONE_DESCRIPTOR']]], 'StartingCloneBlock' : [ 0xc, ['pointer', ['_MMCLONE_BLOCK']]], 'EndingCloneBlock' : [ 0x10, ['pointer', ['_MMCLONE_BLOCK']]], 'NumberOfPtes' : [ 0x14, ['unsigned long']], 'NumberOfReferences' : [ 0x18, ['unsigned long']], 'CloneHeader' : [ 0x1c, ['pointer', ['_MMCLONE_HEADER']]], 'NonPagedPoolQuotaCharge' : [ 0x20, ['unsigned long']], 'NestingLevel' : [ 0x28, ['unsigned long long']], } ], '__unnamed_1654' : [ 0x4, { 'VirtualAddress' : [ 0x0, ['pointer', ['void']]], 'Long' : [ 0x0, ['unsigned long']], 'e1' : [ 0x0, ['_MMWSLENTRY']], 'e2' : [ 0x0, ['_MMWSLE_FREE_ENTRY']], } ], '_MMWSLE' : [ 0x4, { 'u1' : [ 0x0, ['__unnamed_1654']], } ], '_MMWSL' : [ 0xe20, { 'FirstFree' : [ 0x0, ['unsigned long']], 'FirstDynamic' : [ 0x4, ['unsigned long']], 'LastEntry' : [ 0x8, ['unsigned long']], 'NextSlot' : [ 0xc, ['unsigned long']], 'LastInitializedWsle' : [ 0x10, ['unsigned long']], 'NextAgingSlot' : [ 0x14, ['unsigned long']], 'NextAccessClearingSlot' : [ 0x18, ['unsigned long']], 'LastAccessClearingRemainder' : [ 0x1c, ['unsigned long']], 'LastAgingRemainder' : [ 0x20, ['unsigned long']], 'WsleSize' : [ 0x24, ['unsigned long']], 'NonDirectCount' : [ 0x28, ['unsigned long']], 'LowestPagableAddress' : [ 0x2c, ['pointer', ['void']]], 'NonDirectHash' : [ 0x30, ['pointer', ['_MMWSLE_NONDIRECT_HASH']]], 'HashTableStart' : [ 0x34, ['pointer', ['_MMWSLE_HASH']]], 'HighestPermittedHashAddress' : [ 0x38, ['pointer', ['_MMWSLE_HASH']]], 'ActiveWsleCounts' : [ 0x3c, ['array', 16, ['unsigned long']]], 'ActiveWsles' : [ 0x7c, ['array', 16, ['_MI_ACTIVE_WSLE_LISTHEAD']]], 'Wsle' : [ 0xfc, ['pointer', ['_MMWSLE']]], 'UserVaInfo' : [ 0x100, ['_MI_USER_VA_INFO']], } ], '_MMSUPPORT' : [ 0x80, { 'WorkingSetLock' : [ 0x0, ['long']], 'ExitOutswapGate' : [ 0x4, ['pointer', ['_KGATE']]], 'AccessLog' : [ 0x8, ['pointer', ['void']]], 'WorkingSetExpansionLinks' : [ 0xc, ['_LIST_ENTRY']], 'AgeDistribution' : [ 0x14, ['array', 7, ['unsigned long']]], 'MinimumWorkingSetSize' : [ 0x30, ['unsigned long']], 'WorkingSetLeafSize' : [ 0x34, ['unsigned long']], 'WorkingSetLeafPrivateSize' : [ 0x38, ['unsigned long']], 'WorkingSetSize' : [ 0x3c, ['unsigned long']], 'WorkingSetPrivateSize' : [ 0x40, ['unsigned long']], 'MaximumWorkingSetSize' : [ 0x44, ['unsigned long']], 'ChargedWslePages' : [ 0x48, ['unsigned long']], 'ActualWslePages' : [ 0x4c, ['unsigned long']], 'WorkingSetSizeOverhead' : [ 0x50, ['unsigned long']], 'PeakWorkingSetSize' : [ 0x54, ['unsigned long']], 'HardFaultCount' : [ 0x58, ['unsigned long']], 'VmWorkingSetList' : [ 0x5c, ['pointer', ['_MMWSL']]], 'NextPageColor' : [ 0x60, ['unsigned short']], 'LastTrimStamp' : [ 0x62, ['unsigned short']], 'PageFaultCount' : [ 0x64, ['unsigned long']], 'TrimmedPageCount' : [ 0x68, ['unsigned long']], 'ForceTrimPages' : [ 0x6c, ['unsigned long']], 'Flags' : [ 0x70, ['_MMSUPPORT_FLAGS']], 'ReleasedCommitDebt' : [ 0x74, ['unsigned long']], 'WsSwapSupport' : [ 0x78, ['pointer', ['void']]], 'CommitReAcquireFailSupport' : [ 0x7c, ['pointer', ['void']]], } ], '__unnamed_166f' : [ 0x4, { 'ImageCommitment' : [ 0x0, ['unsigned long']], 'CreatingProcess' : [ 0x0, ['pointer', ['_EPROCESS']]], } ], '__unnamed_1673' : [ 0x4, { 'ImageInformation' : [ 0x0, ['pointer', ['_MI_SECTION_IMAGE_INFORMATION']]], 'FirstMappedVa' : [ 0x0, ['pointer', ['void']]], } ], '_SEGMENT' : [ 0x30, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'TotalNumberOfPtes' : [ 0x4, ['unsigned long']], 'SegmentFlags' : [ 0x8, ['_SEGMENT_FLAGS']], 'NumberOfCommittedPages' : [ 0xc, ['unsigned long']], 'SizeOfSegment' : [ 0x10, ['unsigned long long']], 'ExtendInfo' : [ 0x18, ['pointer', ['_MMEXTEND_INFO']]], 'BasedAddress' : [ 0x18, ['pointer', ['void']]], 'SegmentLock' : [ 0x1c, ['_EX_PUSH_LOCK']], 'u1' : [ 0x20, ['__unnamed_166f']], 'u2' : [ 0x24, ['__unnamed_1673']], 'PrototypePte' : [ 0x28, ['pointer', ['_MMPTE']]], } ], '__unnamed_1678' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x0, ['_MMSECTION_FLAGS']], } ], '__unnamed_1683' : [ 0xc, { 'NumberOfSystemCacheViews' : [ 0x0, ['unsigned long']], 'ImageRelocationStartBit' : [ 0x0, ['unsigned long']], 'WritableUserReferences' : [ 0x4, ['long']], 'ImageRelocationSizeIn64k' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'Unused' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 25, native_type='unsigned long')]], 'SystemImage' : [ 0x4, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'StrongCode' : [ 0x4, ['BitField', dict(start_bit = 26, end_bit = 28, native_type='unsigned long')]], 'CantMove' : [ 0x4, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'BitMap' : [ 0x4, ['BitField', dict(start_bit = 29, end_bit = 31, native_type='unsigned long')]], 'ImageActive' : [ 0x4, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'FlushInProgressCount' : [ 0x8, ['unsigned long']], 'NumberOfSubsections' : [ 0x8, ['unsigned long']], 'SeImageStub' : [ 0x8, ['pointer', ['_MI_IMAGE_SECURITY_REFERENCE']]], } ], '__unnamed_1685' : [ 0xc, { 'e2' : [ 0x0, ['__unnamed_1683']], } ], '_CONTROL_AREA' : [ 0x50, { 'Segment' : [ 0x0, ['pointer', ['_SEGMENT']]], 'ListHead' : [ 0x4, ['_LIST_ENTRY']], 'NumberOfSectionReferences' : [ 0xc, ['unsigned long']], 'NumberOfPfnReferences' : [ 0x10, ['unsigned long']], 'NumberOfMappedViews' : [ 0x14, ['unsigned long']], 'NumberOfUserReferences' : [ 0x18, ['unsigned long']], 'u' : [ 0x1c, ['__unnamed_1678']], 'FilePointer' : [ 0x20, ['_EX_FAST_REF']], 'ControlAreaLock' : [ 0x24, ['long']], 'ModifiedWriteCount' : [ 0x28, ['unsigned long']], 'WaitList' : [ 0x2c, ['pointer', ['_MI_CONTROL_AREA_WAIT_BLOCK']]], 'u2' : [ 0x30, ['__unnamed_1685']], 'LockedPages' : [ 0x40, ['unsigned long long']], 'FileObjectLock' : [ 0x48, ['_EX_PUSH_LOCK']], } ], '__unnamed_1696' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'VadFlags' : [ 0x0, ['_MMVAD_FLAGS']], } ], '__unnamed_1699' : [ 0x4, { 'LongFlags1' : [ 0x0, ['unsigned long']], 'VadFlags1' : [ 0x0, ['_MMVAD_FLAGS1']], } ], '_MMVAD_SHORT' : [ 0x28, { 'VadNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'NextVad' : [ 0x0, ['pointer', ['_MMVAD_SHORT']]], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], 'ReferenceCount' : [ 0x14, ['long']], 'PushLock' : [ 0x18, ['_EX_PUSH_LOCK']], 'u' : [ 0x1c, ['__unnamed_1696']], 'u1' : [ 0x20, ['__unnamed_1699']], 'EventList' : [ 0x24, ['pointer', ['_MI_VAD_EVENT_BLOCK']]], } ], '_MI_PARTITION' : [ 0x1740, { 'Core' : [ 0x0, ['_MI_PARTITION_CORE']], 'Modwriter' : [ 0xe8, ['_MI_PARTITION_MODWRITES']], 'Store' : [ 0x298, ['_MI_PARTITION_STORES']], 'Segments' : [ 0x2e8, ['_MI_PARTITION_SEGMENTS']], 'PageLists' : [ 0x3c0, ['_MI_PARTITION_PAGE_LISTS']], 'Commit' : [ 0xa80, ['_MI_PARTITION_COMMIT']], 'Zeroing' : [ 0xaa0, ['_MI_PARTITION_ZEROING']], 'PageCombine' : [ 0xad0, ['_MI_PAGE_COMBINING_SUPPORT']], 'WorkingSetControl' : [ 0xba8, ['pointer', ['void']]], 'WorkingSetExpansionHead' : [ 0xbac, ['_MMWORKING_SET_EXPANSION_HEAD']], 'Vp' : [ 0xbc0, ['_MI_VISIBLE_PARTITION']], } ], '_MM_STORE_KEY' : [ 0x4, { 'KeyLow' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 28, native_type='unsigned long')]], 'KeyHigh' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 32, native_type='unsigned long')]], 'EntireKey' : [ 0x0, ['unsigned long']], } ], '_MMPAGING_FILE' : [ 0x90, { 'Size' : [ 0x0, ['unsigned long']], 'MaximumSize' : [ 0x4, ['unsigned long']], 'MinimumSize' : [ 0x8, ['unsigned long']], 'FreeSpace' : [ 0xc, ['unsigned long']], 'PeakUsage' : [ 0x10, ['unsigned long']], 'HighestPage' : [ 0x14, ['unsigned long']], 'FreeReservationSpace' : [ 0x18, ['unsigned long']], 'LargestReserveCluster' : [ 0x1c, ['unsigned long']], 'File' : [ 0x20, ['pointer', ['_FILE_OBJECT']]], 'Entry' : [ 0x24, ['array', 2, ['pointer', ['_MMMOD_WRITER_MDL_ENTRY']]]], 'PfnsToFree' : [ 0x30, ['_SLIST_HEADER']], 'PageFileName' : [ 0x38, ['_UNICODE_STRING']], 'Bitmaps' : [ 0x40, ['pointer', ['_MI_PAGING_FILE_SPACE_BITMAPS']]], 'AllocationBitmapHint' : [ 0x44, ['unsigned long']], 'ReservationBitmapHint' : [ 0x48, ['unsigned long']], 'LargestNonReservedClusterSize' : [ 0x4c, ['unsigned long']], 'RefreshClusterSize' : [ 0x50, ['unsigned long']], 'LastRefreshClusterSize' : [ 0x54, ['unsigned long']], 'ReservedClusterSizeAggregate' : [ 0x58, ['unsigned long']], 'ToBeEvictedCount' : [ 0x5c, ['unsigned long']], 'HybridPriority' : [ 0x5c, ['unsigned long']], 'PageFileNumber' : [ 0x60, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned short')]], 'WsSwapPagefile' : [ 0x60, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'NoReservations' : [ 0x60, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned short')]], 'VirtualStorePagefile' : [ 0x60, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'SwapSupported' : [ 0x60, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned short')]], 'NodeInserted' : [ 0x60, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned short')]], 'StackNotified' : [ 0x60, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned short')]], 'Spare0' : [ 0x60, ['BitField', dict(start_bit = 10, end_bit = 15, native_type='unsigned short')]], 'AdriftMdls' : [ 0x62, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Spare1' : [ 0x62, ['BitField', dict(start_bit = 1, end_bit = 8, native_type='unsigned char')]], 'Spare2' : [ 0x63, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'PageHashPages' : [ 0x64, ['unsigned long']], 'PageHashPagesPeak' : [ 0x68, ['unsigned long']], 'PageHash' : [ 0x6c, ['pointer', ['unsigned long']]], 'FileHandle' : [ 0x70, ['pointer', ['void']]], 'Lock' : [ 0x74, ['unsigned long']], 'LockOwner' : [ 0x78, ['pointer', ['_ETHREAD']]], 'FlowThroughReadRoot' : [ 0x7c, ['_RTL_AVL_TREE']], 'Partition' : [ 0x80, ['pointer', ['_MI_PARTITION']]], 'FileObjectNode' : [ 0x84, ['_RTL_BALANCED_NODE']], } ], 'tagSWITCH_CONTEXT' : [ 0x68, { 'Attribute' : [ 0x0, ['tagSWITCH_CONTEXT_ATTRIBUTE']], 'Data' : [ 0x18, ['tagSWITCH_CONTEXT_DATA']], } ], '__unnamed_16da' : [ 0xc, { 'Failure' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: '_None', 1: '_CmInitializeHive', 2: '_HvInitializeHive', 3: '_HvpBuildMap', 4: '_HvpBuildMapForLoaderHive', 5: '_HvpInitMap', 6: '_HvLoadHive', 7: '_HvpMapHiveImage', 8: '_HvpRecoverData', 9: '_CmpValidateHiveSecurityDescriptors', 10: '_HvpEnlistBinInMap', 11: '_CmCheckRegistry', 12: '_CmRegistryIO', 13: '_CmCheckRegistry2', 14: '_CmpCheckKey', 15: '_CmpCheckValueList', 16: '_HvCheckHive', 17: '_HvCheckBin', 18: '_HvpGetLogEntryDirtyVector', 19: '_HvpReadLogEntryHeader', 20: '_HvpReadLogEntry', 21: '_CmpMountPreloadedHives', 22: '_CmpLoadHiveThread'})]], 'Status' : [ 0x4, ['long']], 'Point' : [ 0x8, ['unsigned long']], } ], '__unnamed_16dd' : [ 0xc, { 'Action' : [ 0x0, ['unsigned long']], 'Handle' : [ 0x4, ['pointer', ['void']]], 'Status' : [ 0x8, ['long']], } ], '__unnamed_16df' : [ 0x4, { 'CheckStack' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_16e3' : [ 0x10, { 'Cell' : [ 0x0, ['unsigned long']], 'CellPoint' : [ 0x4, ['pointer', ['_CELL_DATA']]], 'RootPoint' : [ 0x8, ['pointer', ['void']]], 'Index' : [ 0xc, ['unsigned long']], } ], '__unnamed_16e5' : [ 0x10, { 'List' : [ 0x0, ['pointer', ['_CELL_DATA']]], 'Index' : [ 0x4, ['unsigned long']], 'Cell' : [ 0x8, ['unsigned long']], 'CellPoint' : [ 0xc, ['pointer', ['_CELL_DATA']]], } ], '__unnamed_16e9' : [ 0xc, { 'Space' : [ 0x0, ['unsigned long']], 'MapPoint' : [ 0x4, ['unsigned long']], 'BinPoint' : [ 0x8, ['pointer', ['_HBIN']]], } ], '__unnamed_16ed' : [ 0x8, { 'Bin' : [ 0x0, ['pointer', ['_HBIN']]], 'CellPoint' : [ 0x4, ['pointer', ['_HCELL']]], } ], '__unnamed_16ef' : [ 0x4, { 'FileOffset' : [ 0x0, ['unsigned long']], } ], '_HIVE_LOAD_FAILURE' : [ 0x120, { 'Hive' : [ 0x0, ['pointer', ['_HHIVE']]], 'Index' : [ 0x4, ['unsigned long']], 'RecoverableIndex' : [ 0x8, ['unsigned long']], 'Locations' : [ 0xc, ['array', 8, ['__unnamed_16da']]], 'RecoverableLocations' : [ 0x6c, ['array', 8, ['__unnamed_16da']]], 'RegistryIO' : [ 0xcc, ['__unnamed_16dd']], 'CheckRegistry2' : [ 0xd8, ['__unnamed_16df']], 'CheckKey' : [ 0xdc, ['__unnamed_16e3']], 'CheckValueList' : [ 0xec, ['__unnamed_16e5']], 'CheckHive' : [ 0xfc, ['__unnamed_16e9']], 'CheckHive1' : [ 0x108, ['__unnamed_16e9']], 'CheckBin' : [ 0x114, ['__unnamed_16ed']], 'RecoverData' : [ 0x11c, ['__unnamed_16ef']], } ], '_PCW_COUNTER_DESCRIPTOR' : [ 0x8, { 'Id' : [ 0x0, ['unsigned short']], 'StructIndex' : [ 0x2, ['unsigned short']], 'Offset' : [ 0x4, ['unsigned short']], 'Size' : [ 0x6, ['unsigned short']], } ], '_PCW_REGISTRATION_INFORMATION' : [ 0x18, { 'Version' : [ 0x0, ['unsigned long']], 'Name' : [ 0x4, ['pointer', ['_UNICODE_STRING']]], 'CounterCount' : [ 0x8, ['unsigned long']], 'Counters' : [ 0xc, ['pointer', ['_PCW_COUNTER_DESCRIPTOR']]], 'Callback' : [ 0x10, ['pointer', ['void']]], 'CallbackContext' : [ 0x14, ['pointer', ['void']]], } ], '_PCW_PROCESSOR_INFO' : [ 0xc0, { 'IdleTime' : [ 0x0, ['unsigned long long']], 'AvailableTime' : [ 0x8, ['unsigned long long']], 'UserTime' : [ 0x10, ['unsigned long long']], 'KernelTime' : [ 0x18, ['unsigned long long']], 'Interrupts' : [ 0x20, ['unsigned long']], 'DpcTime' : [ 0x28, ['unsigned long long']], 'InterruptTime' : [ 0x30, ['unsigned long long']], 'ClockInterrupts' : [ 0x38, ['unsigned long']], 'DpcCount' : [ 0x3c, ['unsigned long']], 'DpcRate' : [ 0x40, ['unsigned long']], 'C1Time' : [ 0x48, ['unsigned long long']], 'C2Time' : [ 0x50, ['unsigned long long']], 'C3Time' : [ 0x58, ['unsigned long long']], 'C1Transitions' : [ 0x60, ['unsigned long long']], 'C2Transitions' : [ 0x68, ['unsigned long long']], 'C3Transitions' : [ 0x70, ['unsigned long long']], 'StallTime' : [ 0x78, ['unsigned long long']], 'ParkingStatus' : [ 0x80, ['unsigned long']], 'CurrentFrequency' : [ 0x84, ['unsigned long']], 'PercentMaxFrequency' : [ 0x88, ['unsigned long']], 'StateFlags' : [ 0x8c, ['unsigned long']], 'NominalThroughput' : [ 0x90, ['unsigned long']], 'ActiveThroughput' : [ 0x94, ['unsigned long']], 'ScaledThroughput' : [ 0x98, ['unsigned long long']], 'ScaledKernelThroughput' : [ 0xa0, ['unsigned long long']], 'AverageIdleTime' : [ 0xa8, ['unsigned long long']], 'IdleBreakEvents' : [ 0xb0, ['unsigned long long']], 'PerformanceLimit' : [ 0xb8, ['unsigned long']], 'PerformanceLimitFlags' : [ 0xbc, ['unsigned long']], } ], '_PCW_DATA' : [ 0x8, { 'Data' : [ 0x0, ['pointer', ['void']]], 'Size' : [ 0x4, ['unsigned long']], } ], '_SYNCH_COUNTERS' : [ 0xb8, { 'SpinLockAcquireCount' : [ 0x0, ['unsigned long']], 'SpinLockContentionCount' : [ 0x4, ['unsigned long']], 'SpinLockSpinCount' : [ 0x8, ['unsigned long']], 'IpiSendRequestBroadcastCount' : [ 0xc, ['unsigned long']], 'IpiSendRequestRoutineCount' : [ 0x10, ['unsigned long']], 'IpiSendSoftwareInterruptCount' : [ 0x14, ['unsigned long']], 'ExInitializeResourceCount' : [ 0x18, ['unsigned long']], 'ExReInitializeResourceCount' : [ 0x1c, ['unsigned long']], 'ExDeleteResourceCount' : [ 0x20, ['unsigned long']], 'ExecutiveResourceAcquiresCount' : [ 0x24, ['unsigned long']], 'ExecutiveResourceContentionsCount' : [ 0x28, ['unsigned long']], 'ExecutiveResourceReleaseExclusiveCount' : [ 0x2c, ['unsigned long']], 'ExecutiveResourceReleaseSharedCount' : [ 0x30, ['unsigned long']], 'ExecutiveResourceConvertsCount' : [ 0x34, ['unsigned long']], 'ExAcqResExclusiveAttempts' : [ 0x38, ['unsigned long']], 'ExAcqResExclusiveAcquiresExclusive' : [ 0x3c, ['unsigned long']], 'ExAcqResExclusiveAcquiresExclusiveRecursive' : [ 0x40, ['unsigned long']], 'ExAcqResExclusiveWaits' : [ 0x44, ['unsigned long']], 'ExAcqResExclusiveNotAcquires' : [ 0x48, ['unsigned long']], 'ExAcqResSharedAttempts' : [ 0x4c, ['unsigned long']], 'ExAcqResSharedAcquiresExclusive' : [ 0x50, ['unsigned long']], 'ExAcqResSharedAcquiresShared' : [ 0x54, ['unsigned long']], 'ExAcqResSharedAcquiresSharedRecursive' : [ 0x58, ['unsigned long']], 'ExAcqResSharedWaits' : [ 0x5c, ['unsigned long']], 'ExAcqResSharedNotAcquires' : [ 0x60, ['unsigned long']], 'ExAcqResSharedStarveExclusiveAttempts' : [ 0x64, ['unsigned long']], 'ExAcqResSharedStarveExclusiveAcquiresExclusive' : [ 0x68, ['unsigned long']], 'ExAcqResSharedStarveExclusiveAcquiresShared' : [ 0x6c, ['unsigned long']], 'ExAcqResSharedStarveExclusiveAcquiresSharedRecursive' : [ 0x70, ['unsigned long']], 'ExAcqResSharedStarveExclusiveWaits' : [ 0x74, ['unsigned long']], 'ExAcqResSharedStarveExclusiveNotAcquires' : [ 0x78, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveAttempts' : [ 0x7c, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveAcquiresExclusive' : [ 0x80, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveAcquiresShared' : [ 0x84, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveAcquiresSharedRecursive' : [ 0x88, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveWaits' : [ 0x8c, ['unsigned long']], 'ExAcqResSharedWaitForExclusiveNotAcquires' : [ 0x90, ['unsigned long']], 'ExSetResOwnerPointerExclusive' : [ 0x94, ['unsigned long']], 'ExSetResOwnerPointerSharedNew' : [ 0x98, ['unsigned long']], 'ExSetResOwnerPointerSharedOld' : [ 0x9c, ['unsigned long']], 'ExTryToAcqExclusiveAttempts' : [ 0xa0, ['unsigned long']], 'ExTryToAcqExclusiveAcquires' : [ 0xa4, ['unsigned long']], 'ExBoostExclusiveOwner' : [ 0xa8, ['unsigned long']], 'ExBoostSharedOwners' : [ 0xac, ['unsigned long']], 'ExEtwSynchTrackingNotificationsCount' : [ 0xb0, ['unsigned long']], 'ExEtwSynchTrackingNotificationsAccountedCount' : [ 0xb4, ['unsigned long']], } ], '_ETW_PERF_COUNTERS' : [ 0x18, { 'TotalActiveSessions' : [ 0x0, ['long']], 'TotalBufferMemoryNonPagedPool' : [ 0x4, ['long']], 'TotalBufferMemoryPagedPool' : [ 0x8, ['long']], 'TotalGuidsEnabled' : [ 0xc, ['long']], 'TotalGuidsNotEnabled' : [ 0x10, ['long']], 'TotalGuidsPreEnabled' : [ 0x14, ['long']], } ], '_ETW_SESSION_PERF_COUNTERS' : [ 0x18, { 'BufferMemoryPagedPool' : [ 0x0, ['long']], 'BufferMemoryNonPagedPool' : [ 0x4, ['long']], 'EventsLoggedCount' : [ 0x8, ['unsigned long long']], 'EventsLost' : [ 0x10, ['long']], 'NumConsumers' : [ 0x14, ['long']], } ], '_FILESYSTEM_DISK_COUNTERS' : [ 0x10, { 'FsBytesRead' : [ 0x0, ['unsigned long long']], 'FsBytesWritten' : [ 0x8, ['unsigned long long']], } ], '_THERMAL_ZONE_COUNTERS' : [ 0xc, { 'Temperature' : [ 0x0, ['unsigned long']], 'ThrottleLimit' : [ 0x4, ['unsigned long']], 'ThrottleReasons' : [ 0x8, ['unsigned long']], } ], '_TEB32' : [ 0x1000, { 'NtTib' : [ 0x0, ['_NT_TIB32']], 'EnvironmentPointer' : [ 0x1c, ['unsigned long']], 'ClientId' : [ 0x20, ['_CLIENT_ID32']], 'ActiveRpcHandle' : [ 0x28, ['unsigned long']], 'ThreadLocalStoragePointer' : [ 0x2c, ['unsigned long']], 'ProcessEnvironmentBlock' : [ 0x30, ['unsigned long']], 'LastErrorValue' : [ 0x34, ['unsigned long']], 'CountOfOwnedCriticalSections' : [ 0x38, ['unsigned long']], 'CsrClientThread' : [ 0x3c, ['unsigned long']], 'Win32ThreadInfo' : [ 0x40, ['unsigned long']], 'User32Reserved' : [ 0x44, ['array', 26, ['unsigned long']]], 'UserReserved' : [ 0xac, ['array', 5, ['unsigned long']]], 'WOW32Reserved' : [ 0xc0, ['unsigned long']], 'CurrentLocale' : [ 0xc4, ['unsigned long']], 'FpSoftwareStatusRegister' : [ 0xc8, ['unsigned long']], 'ReservedForDebuggerInstrumentation' : [ 0xcc, ['array', 16, ['unsigned long']]], 'SystemReserved1' : [ 0x10c, ['array', 38, ['unsigned long']]], 'ExceptionCode' : [ 0x1a4, ['long']], 'ActivationContextStackPointer' : [ 0x1a8, ['unsigned long']], 'InstrumentationCallbackSp' : [ 0x1ac, ['unsigned long']], 'InstrumentationCallbackPreviousPc' : [ 0x1b0, ['unsigned long']], 'InstrumentationCallbackPreviousSp' : [ 0x1b4, ['unsigned long']], 'InstrumentationCallbackDisabled' : [ 0x1b8, ['unsigned char']], 'SpareBytes' : [ 0x1b9, ['array', 23, ['unsigned char']]], 'TxFsContext' : [ 0x1d0, ['unsigned long']], 'GdiTebBatch' : [ 0x1d4, ['_GDI_TEB_BATCH32']], 'RealClientId' : [ 0x6b4, ['_CLIENT_ID32']], 'GdiCachedProcessHandle' : [ 0x6bc, ['unsigned long']], 'GdiClientPID' : [ 0x6c0, ['unsigned long']], 'GdiClientTID' : [ 0x6c4, ['unsigned long']], 'GdiThreadLocalInfo' : [ 0x6c8, ['unsigned long']], 'Win32ClientInfo' : [ 0x6cc, ['array', 62, ['unsigned long']]], 'glDispatchTable' : [ 0x7c4, ['array', 233, ['unsigned long']]], 'glReserved1' : [ 0xb68, ['array', 29, ['unsigned long']]], 'glReserved2' : [ 0xbdc, ['unsigned long']], 'glSectionInfo' : [ 0xbe0, ['unsigned long']], 'glSection' : [ 0xbe4, ['unsigned long']], 'glTable' : [ 0xbe8, ['unsigned long']], 'glCurrentRC' : [ 0xbec, ['unsigned long']], 'glContext' : [ 0xbf0, ['unsigned long']], 'LastStatusValue' : [ 0xbf4, ['unsigned long']], 'StaticUnicodeString' : [ 0xbf8, ['_STRING32']], 'StaticUnicodeBuffer' : [ 0xc00, ['array', 261, ['wchar']]], 'DeallocationStack' : [ 0xe0c, ['unsigned long']], 'TlsSlots' : [ 0xe10, ['array', 64, ['unsigned long']]], 'TlsLinks' : [ 0xf10, ['LIST_ENTRY32']], 'Vdm' : [ 0xf18, ['unsigned long']], 'ReservedForNtRpc' : [ 0xf1c, ['unsigned long']], 'DbgSsReserved' : [ 0xf20, ['array', 2, ['unsigned long']]], 'HardErrorMode' : [ 0xf28, ['unsigned long']], 'Instrumentation' : [ 0xf2c, ['array', 9, ['unsigned long']]], 'ActivityId' : [ 0xf50, ['_GUID']], 'SubProcessTag' : [ 0xf60, ['unsigned long']], 'PerflibData' : [ 0xf64, ['unsigned long']], 'EtwTraceData' : [ 0xf68, ['unsigned long']], 'WinSockData' : [ 0xf6c, ['unsigned long']], 'GdiBatchCount' : [ 0xf70, ['unsigned long']], 'CurrentIdealProcessor' : [ 0xf74, ['_PROCESSOR_NUMBER']], 'IdealProcessorValue' : [ 0xf74, ['unsigned long']], 'ReservedPad0' : [ 0xf74, ['unsigned char']], 'ReservedPad1' : [ 0xf75, ['unsigned char']], 'ReservedPad2' : [ 0xf76, ['unsigned char']], 'IdealProcessor' : [ 0xf77, ['unsigned char']], 'GuaranteedStackBytes' : [ 0xf78, ['unsigned long']], 'ReservedForPerf' : [ 0xf7c, ['unsigned long']], 'ReservedForOle' : [ 0xf80, ['unsigned long']], 'WaitingOnLoaderLock' : [ 0xf84, ['unsigned long']], 'SavedPriorityState' : [ 0xf88, ['unsigned long']], 'ReservedForCodeCoverage' : [ 0xf8c, ['unsigned long']], 'ThreadPoolData' : [ 0xf90, ['unsigned long']], 'TlsExpansionSlots' : [ 0xf94, ['unsigned long']], 'MuiGeneration' : [ 0xf98, ['unsigned long']], 'IsImpersonating' : [ 0xf9c, ['unsigned long']], 'NlsCache' : [ 0xfa0, ['unsigned long']], 'pShimData' : [ 0xfa4, ['unsigned long']], 'HeapVirtualAffinity' : [ 0xfa8, ['unsigned short']], 'LowFragHeapDataSlot' : [ 0xfaa, ['unsigned short']], 'CurrentTransactionHandle' : [ 0xfac, ['unsigned long']], 'ActiveFrame' : [ 0xfb0, ['unsigned long']], 'FlsData' : [ 0xfb4, ['unsigned long']], 'PreferredLanguages' : [ 0xfb8, ['unsigned long']], 'UserPrefLanguages' : [ 0xfbc, ['unsigned long']], 'MergedPrefLanguages' : [ 0xfc0, ['unsigned long']], 'MuiImpersonation' : [ 0xfc4, ['unsigned long']], 'CrossTebFlags' : [ 0xfc8, ['unsigned short']], 'SpareCrossTebBits' : [ 0xfc8, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned short')]], 'SameTebFlags' : [ 0xfca, ['unsigned short']], 'SafeThunkCall' : [ 0xfca, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'InDebugPrint' : [ 0xfca, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'HasFiberData' : [ 0xfca, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'SkipThreadAttach' : [ 0xfca, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'WerInShipAssertCode' : [ 0xfca, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'RanProcessInit' : [ 0xfca, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned short')]], 'ClonedThread' : [ 0xfca, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'SuppressDebugMsg' : [ 0xfca, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned short')]], 'DisableUserStackWalk' : [ 0xfca, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned short')]], 'RtlExceptionAttached' : [ 0xfca, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned short')]], 'InitialThread' : [ 0xfca, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned short')]], 'SessionAware' : [ 0xfca, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned short')]], 'LoadOwner' : [ 0xfca, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned short')]], 'LoaderWorker' : [ 0xfca, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned short')]], 'SpareSameTebBits' : [ 0xfca, ['BitField', dict(start_bit = 14, end_bit = 16, native_type='unsigned short')]], 'TxnScopeEnterCallback' : [ 0xfcc, ['unsigned long']], 'TxnScopeExitCallback' : [ 0xfd0, ['unsigned long']], 'TxnScopeContext' : [ 0xfd4, ['unsigned long']], 'LockCount' : [ 0xfd8, ['unsigned long']], 'WowTebOffset' : [ 0xfdc, ['long']], 'ResourceRetValue' : [ 0xfe0, ['unsigned long']], 'ReservedForWdf' : [ 0xfe4, ['unsigned long']], 'ReservedForCrt' : [ 0xfe8, ['unsigned long long']], 'EffectiveContainerId' : [ 0xff0, ['_GUID']], } ], '_TEB64' : [ 0x1838, { 'NtTib' : [ 0x0, ['_NT_TIB64']], 'EnvironmentPointer' : [ 0x38, ['unsigned long long']], 'ClientId' : [ 0x40, ['_CLIENT_ID64']], 'ActiveRpcHandle' : [ 0x50, ['unsigned long long']], 'ThreadLocalStoragePointer' : [ 0x58, ['unsigned long long']], 'ProcessEnvironmentBlock' : [ 0x60, ['unsigned long long']], 'LastErrorValue' : [ 0x68, ['unsigned long']], 'CountOfOwnedCriticalSections' : [ 0x6c, ['unsigned long']], 'CsrClientThread' : [ 0x70, ['unsigned long long']], 'Win32ThreadInfo' : [ 0x78, ['unsigned long long']], 'User32Reserved' : [ 0x80, ['array', 26, ['unsigned long']]], 'UserReserved' : [ 0xe8, ['array', 5, ['unsigned long']]], 'WOW32Reserved' : [ 0x100, ['unsigned long long']], 'CurrentLocale' : [ 0x108, ['unsigned long']], 'FpSoftwareStatusRegister' : [ 0x10c, ['unsigned long']], 'ReservedForDebuggerInstrumentation' : [ 0x110, ['array', 16, ['unsigned long long']]], 'SystemReserved1' : [ 0x190, ['array', 38, ['unsigned long long']]], 'ExceptionCode' : [ 0x2c0, ['long']], 'Padding0' : [ 0x2c4, ['array', 4, ['unsigned char']]], 'ActivationContextStackPointer' : [ 0x2c8, ['unsigned long long']], 'InstrumentationCallbackSp' : [ 0x2d0, ['unsigned long long']], 'InstrumentationCallbackPreviousPc' : [ 0x2d8, ['unsigned long long']], 'InstrumentationCallbackPreviousSp' : [ 0x2e0, ['unsigned long long']], 'TxFsContext' : [ 0x2e8, ['unsigned long']], 'InstrumentationCallbackDisabled' : [ 0x2ec, ['unsigned char']], 'Padding1' : [ 0x2ed, ['array', 3, ['unsigned char']]], 'GdiTebBatch' : [ 0x2f0, ['_GDI_TEB_BATCH64']], 'RealClientId' : [ 0x7d8, ['_CLIENT_ID64']], 'GdiCachedProcessHandle' : [ 0x7e8, ['unsigned long long']], 'GdiClientPID' : [ 0x7f0, ['unsigned long']], 'GdiClientTID' : [ 0x7f4, ['unsigned long']], 'GdiThreadLocalInfo' : [ 0x7f8, ['unsigned long long']], 'Win32ClientInfo' : [ 0x800, ['array', 62, ['unsigned long long']]], 'glDispatchTable' : [ 0x9f0, ['array', 233, ['unsigned long long']]], 'glReserved1' : [ 0x1138, ['array', 29, ['unsigned long long']]], 'glReserved2' : [ 0x1220, ['unsigned long long']], 'glSectionInfo' : [ 0x1228, ['unsigned long long']], 'glSection' : [ 0x1230, ['unsigned long long']], 'glTable' : [ 0x1238, ['unsigned long long']], 'glCurrentRC' : [ 0x1240, ['unsigned long long']], 'glContext' : [ 0x1248, ['unsigned long long']], 'LastStatusValue' : [ 0x1250, ['unsigned long']], 'Padding2' : [ 0x1254, ['array', 4, ['unsigned char']]], 'StaticUnicodeString' : [ 0x1258, ['_STRING64']], 'StaticUnicodeBuffer' : [ 0x1268, ['array', 261, ['wchar']]], 'Padding3' : [ 0x1472, ['array', 6, ['unsigned char']]], 'DeallocationStack' : [ 0x1478, ['unsigned long long']], 'TlsSlots' : [ 0x1480, ['array', 64, ['unsigned long long']]], 'TlsLinks' : [ 0x1680, ['LIST_ENTRY64']], 'Vdm' : [ 0x1690, ['unsigned long long']], 'ReservedForNtRpc' : [ 0x1698, ['unsigned long long']], 'DbgSsReserved' : [ 0x16a0, ['array', 2, ['unsigned long long']]], 'HardErrorMode' : [ 0x16b0, ['unsigned long']], 'Padding4' : [ 0x16b4, ['array', 4, ['unsigned char']]], 'Instrumentation' : [ 0x16b8, ['array', 11, ['unsigned long long']]], 'ActivityId' : [ 0x1710, ['_GUID']], 'SubProcessTag' : [ 0x1720, ['unsigned long long']], 'PerflibData' : [ 0x1728, ['unsigned long long']], 'EtwTraceData' : [ 0x1730, ['unsigned long long']], 'WinSockData' : [ 0x1738, ['unsigned long long']], 'GdiBatchCount' : [ 0x1740, ['unsigned long']], 'CurrentIdealProcessor' : [ 0x1744, ['_PROCESSOR_NUMBER']], 'IdealProcessorValue' : [ 0x1744, ['unsigned long']], 'ReservedPad0' : [ 0x1744, ['unsigned char']], 'ReservedPad1' : [ 0x1745, ['unsigned char']], 'ReservedPad2' : [ 0x1746, ['unsigned char']], 'IdealProcessor' : [ 0x1747, ['unsigned char']], 'GuaranteedStackBytes' : [ 0x1748, ['unsigned long']], 'Padding5' : [ 0x174c, ['array', 4, ['unsigned char']]], 'ReservedForPerf' : [ 0x1750, ['unsigned long long']], 'ReservedForOle' : [ 0x1758, ['unsigned long long']], 'WaitingOnLoaderLock' : [ 0x1760, ['unsigned long']], 'Padding6' : [ 0x1764, ['array', 4, ['unsigned char']]], 'SavedPriorityState' : [ 0x1768, ['unsigned long long']], 'ReservedForCodeCoverage' : [ 0x1770, ['unsigned long long']], 'ThreadPoolData' : [ 0x1778, ['unsigned long long']], 'TlsExpansionSlots' : [ 0x1780, ['unsigned long long']], 'DeallocationBStore' : [ 0x1788, ['unsigned long long']], 'BStoreLimit' : [ 0x1790, ['unsigned long long']], 'MuiGeneration' : [ 0x1798, ['unsigned long']], 'IsImpersonating' : [ 0x179c, ['unsigned long']], 'NlsCache' : [ 0x17a0, ['unsigned long long']], 'pShimData' : [ 0x17a8, ['unsigned long long']], 'HeapVirtualAffinity' : [ 0x17b0, ['unsigned short']], 'LowFragHeapDataSlot' : [ 0x17b2, ['unsigned short']], 'Padding7' : [ 0x17b4, ['array', 4, ['unsigned char']]], 'CurrentTransactionHandle' : [ 0x17b8, ['unsigned long long']], 'ActiveFrame' : [ 0x17c0, ['unsigned long long']], 'FlsData' : [ 0x17c8, ['unsigned long long']], 'PreferredLanguages' : [ 0x17d0, ['unsigned long long']], 'UserPrefLanguages' : [ 0x17d8, ['unsigned long long']], 'MergedPrefLanguages' : [ 0x17e0, ['unsigned long long']], 'MuiImpersonation' : [ 0x17e8, ['unsigned long']], 'CrossTebFlags' : [ 0x17ec, ['unsigned short']], 'SpareCrossTebBits' : [ 0x17ec, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned short')]], 'SameTebFlags' : [ 0x17ee, ['unsigned short']], 'SafeThunkCall' : [ 0x17ee, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'InDebugPrint' : [ 0x17ee, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'HasFiberData' : [ 0x17ee, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'SkipThreadAttach' : [ 0x17ee, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'WerInShipAssertCode' : [ 0x17ee, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'RanProcessInit' : [ 0x17ee, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned short')]], 'ClonedThread' : [ 0x17ee, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'SuppressDebugMsg' : [ 0x17ee, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned short')]], 'DisableUserStackWalk' : [ 0x17ee, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned short')]], 'RtlExceptionAttached' : [ 0x17ee, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned short')]], 'InitialThread' : [ 0x17ee, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned short')]], 'SessionAware' : [ 0x17ee, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned short')]], 'LoadOwner' : [ 0x17ee, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned short')]], 'LoaderWorker' : [ 0x17ee, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned short')]], 'SpareSameTebBits' : [ 0x17ee, ['BitField', dict(start_bit = 14, end_bit = 16, native_type='unsigned short')]], 'TxnScopeEnterCallback' : [ 0x17f0, ['unsigned long long']], 'TxnScopeExitCallback' : [ 0x17f8, ['unsigned long long']], 'TxnScopeContext' : [ 0x1800, ['unsigned long long']], 'LockCount' : [ 0x1808, ['unsigned long']], 'WowTebOffset' : [ 0x180c, ['long']], 'ResourceRetValue' : [ 0x1810, ['unsigned long long']], 'ReservedForWdf' : [ 0x1818, ['unsigned long long']], 'ReservedForCrt' : [ 0x1820, ['unsigned long long']], 'EffectiveContainerId' : [ 0x1828, ['_GUID']], } ], '_HV_X64_HYPERVISOR_FEATURES' : [ 0x10, { 'PartitionPrivileges' : [ 0x0, ['_HV_PARTITION_PRIVILEGE_MASK']], 'MaxSupportedCState' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned long')]], 'HpetNeededForC3PowerState_Deprecated' : [ 0x8, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Reserved' : [ 0x8, ['BitField', dict(start_bit = 5, end_bit = 32, native_type='unsigned long')]], 'MwaitAvailable_Deprecated' : [ 0xc, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'GuestDebuggingAvailable' : [ 0xc, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PerformanceMonitorsAvailable' : [ 0xc, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'CpuDynamicPartitioningAvailable' : [ 0xc, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'XmmRegistersForFastHypercallAvailable' : [ 0xc, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'GuestIdleAvailable' : [ 0xc, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'HypervisorSleepStateSupportAvailable' : [ 0xc, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'NumaDistanceQueryAvailable' : [ 0xc, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'FrequencyRegsAvailable' : [ 0xc, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'SyntheticMachineCheckAvailable' : [ 0xc, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'GuestCrashRegsAvailable' : [ 0xc, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'DebugRegsAvailable' : [ 0xc, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'Npiep1Available' : [ 0xc, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'DisableHypervisorAvailable' : [ 0xc, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'ExtendedGvaRangesForFlushVirtualAddressListAvailable' : [ 0xc, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'FastHypercallOutputAvailable' : [ 0xc, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'SvmFeaturesAvailable' : [ 0xc, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'SintPollingModeAvailable' : [ 0xc, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'Reserved1' : [ 0xc, ['BitField', dict(start_bit = 18, end_bit = 32, native_type='unsigned long')]], } ], '_HV_PARTITION_PRIVILEGE_MASK' : [ 0x8, { 'AsUINT64' : [ 0x0, ['unsigned long long']], 'AccessVpRunTimeReg' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'AccessPartitionReferenceCounter' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'AccessSynicRegs' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'AccessSyntheticTimerRegs' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long long')]], 'AccessIntrCtrlRegs' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long long')]], 'AccessHypercallMsrs' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long long')]], 'AccessVpIndex' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long long')]], 'AccessResetReg' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long long')]], 'AccessStatsReg' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long long')]], 'AccessPartitionReferenceTsc' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long long')]], 'AccessGuestIdleReg' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'AccessFrequencyRegs' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'AccessDebugRegs' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long long')]], 'Reserved1' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 32, native_type='unsigned long long')]], 'CreatePartitions' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 33, native_type='unsigned long long')]], 'AccessPartitionId' : [ 0x0, ['BitField', dict(start_bit = 33, end_bit = 34, native_type='unsigned long long')]], 'AccessMemoryPool' : [ 0x0, ['BitField', dict(start_bit = 34, end_bit = 35, native_type='unsigned long long')]], 'AdjustMessageBuffers' : [ 0x0, ['BitField', dict(start_bit = 35, end_bit = 36, native_type='unsigned long long')]], 'PostMessages' : [ 0x0, ['BitField', dict(start_bit = 36, end_bit = 37, native_type='unsigned long long')]], 'SignalEvents' : [ 0x0, ['BitField', dict(start_bit = 37, end_bit = 38, native_type='unsigned long long')]], 'CreatePort' : [ 0x0, ['BitField', dict(start_bit = 38, end_bit = 39, native_type='unsigned long long')]], 'ConnectPort' : [ 0x0, ['BitField', dict(start_bit = 39, end_bit = 40, native_type='unsigned long long')]], 'AccessStats' : [ 0x0, ['BitField', dict(start_bit = 40, end_bit = 41, native_type='unsigned long long')]], 'Reserved2' : [ 0x0, ['BitField', dict(start_bit = 41, end_bit = 43, native_type='unsigned long long')]], 'Debugging' : [ 0x0, ['BitField', dict(start_bit = 43, end_bit = 44, native_type='unsigned long long')]], 'CpuManagement' : [ 0x0, ['BitField', dict(start_bit = 44, end_bit = 45, native_type='unsigned long long')]], 'ConfigureProfiler' : [ 0x0, ['BitField', dict(start_bit = 45, end_bit = 46, native_type='unsigned long long')]], 'AccessVpExitTracing' : [ 0x0, ['BitField', dict(start_bit = 46, end_bit = 47, native_type='unsigned long long')]], 'EnableExtendedGvaRangesForFlushVirtualAddressList' : [ 0x0, ['BitField', dict(start_bit = 47, end_bit = 48, native_type='unsigned long long')]], 'AccessVsm' : [ 0x0, ['BitField', dict(start_bit = 48, end_bit = 49, native_type='unsigned long long')]], 'AccessVpRegisters' : [ 0x0, ['BitField', dict(start_bit = 49, end_bit = 50, native_type='unsigned long long')]], 'UnusedBit' : [ 0x0, ['BitField', dict(start_bit = 50, end_bit = 51, native_type='unsigned long long')]], 'FastHypercallOutput' : [ 0x0, ['BitField', dict(start_bit = 51, end_bit = 52, native_type='unsigned long long')]], 'EnableExtendedHypercalls' : [ 0x0, ['BitField', dict(start_bit = 52, end_bit = 53, native_type='unsigned long long')]], 'StartVirtualProcessor' : [ 0x0, ['BitField', dict(start_bit = 53, end_bit = 54, native_type='unsigned long long')]], 'Reserved3' : [ 0x0, ['BitField', dict(start_bit = 54, end_bit = 64, native_type='unsigned long long')]], } ], '_KTIMER_TABLE' : [ 0x1840, { 'TimerExpiry' : [ 0x0, ['array', 16, ['pointer', ['_KTIMER']]]], 'TimerEntries' : [ 0x40, ['array', 256, ['_KTIMER_TABLE_ENTRY']]], } ], '_KTIMER_TABLE_ENTRY' : [ 0x18, { 'Lock' : [ 0x0, ['unsigned long']], 'Entry' : [ 0x4, ['_LIST_ENTRY']], 'Time' : [ 0x10, ['_ULARGE_INTEGER']], } ], '_XSTATE_SAVE' : [ 0x20, { 'Reserved1' : [ 0x0, ['long long']], 'Reserved2' : [ 0x8, ['unsigned long']], 'Prev' : [ 0xc, ['pointer', ['_XSTATE_SAVE']]], 'Reserved3' : [ 0x10, ['pointer', ['_XSAVE_AREA']]], 'Thread' : [ 0x14, ['pointer', ['_KTHREAD']]], 'Reserved4' : [ 0x18, ['pointer', ['void']]], 'Level' : [ 0x1c, ['unsigned char']], 'XStateContext' : [ 0x0, ['_XSTATE_CONTEXT']], } ], '_XSAVE_AREA' : [ 0x240, { 'LegacyState' : [ 0x0, ['_XSAVE_FORMAT']], 'Header' : [ 0x200, ['_XSAVE_AREA_HEADER']], } ], '_KSHARED_READY_QUEUE' : [ 0x134, { 'Lock' : [ 0x0, ['unsigned long']], 'ReadySummary' : [ 0x4, ['unsigned long']], 'ReadyListHead' : [ 0x8, ['array', 32, ['_LIST_ENTRY']]], 'RunningSummary' : [ 0x108, ['array', 32, ['unsigned char']]], 'Span' : [ 0x128, ['unsigned char']], 'LowProcIndex' : [ 0x129, ['unsigned char']], 'QueueIndex' : [ 0x12a, ['unsigned char']], 'ProcCount' : [ 0x12b, ['unsigned char']], 'ScanOwner' : [ 0x12c, ['unsigned char']], 'Spare' : [ 0x12d, ['array', 3, ['unsigned char']]], 'Affinity' : [ 0x130, ['unsigned long']], } ], '_KAFFINITY_EX' : [ 0xc, { 'Count' : [ 0x0, ['unsigned short']], 'Size' : [ 0x2, ['unsigned short']], 'Reserved' : [ 0x4, ['unsigned long']], 'Bitmap' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '_KAFFINITY_ENUMERATION_CONTEXT' : [ 0xc, { 'Affinity' : [ 0x0, ['pointer', ['_KAFFINITY_EX']]], 'CurrentMask' : [ 0x4, ['unsigned long']], 'CurrentIndex' : [ 0x8, ['unsigned short']], } ], '__unnamed_17fc' : [ 0x4, { 'LegacyDeviceNode' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], 'PendingDeviceRelations' : [ 0x0, ['pointer', ['_DEVICE_RELATIONS']]], 'Information' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_17fe' : [ 0x4, { 'NextResourceDeviceNode' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], } ], '__unnamed_1802' : [ 0x10, { 'DockStatus' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'DOCK_NOTDOCKDEVICE', 1: 'DOCK_QUIESCENT', 2: 'DOCK_ARRIVING', 3: 'DOCK_DEPARTING', 4: 'DOCK_EJECTIRP_COMPLETED'})]], 'ListEntry' : [ 0x4, ['_LIST_ENTRY']], 'SerialNumber' : [ 0xc, ['pointer', ['unsigned short']]], } ], '_DEVICE_NODE' : [ 0x1cc, { 'Sibling' : [ 0x0, ['pointer', ['_DEVICE_NODE']]], 'Child' : [ 0x4, ['pointer', ['_DEVICE_NODE']]], 'Parent' : [ 0x8, ['pointer', ['_DEVICE_NODE']]], 'LastChild' : [ 0xc, ['pointer', ['_DEVICE_NODE']]], 'PhysicalDeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'InstancePath' : [ 0x14, ['_UNICODE_STRING']], 'ServiceName' : [ 0x1c, ['_UNICODE_STRING']], 'PendingIrp' : [ 0x24, ['pointer', ['_IRP']]], 'FxDevice' : [ 0x28, ['pointer', ['_POP_FX_DEVICE']]], 'FxDeviceLock' : [ 0x2c, ['long']], 'FxRemoveEvent' : [ 0x30, ['_KEVENT']], 'FxActivationCount' : [ 0x40, ['long']], 'FxSleepCount' : [ 0x44, ['long']], 'Plugin' : [ 0x48, ['pointer', ['_POP_FX_PLUGIN']]], 'Level' : [ 0x4c, ['unsigned long']], 'CurrentPowerState' : [ 0x50, ['_POWER_STATE']], 'Notify' : [ 0x54, ['_PO_DEVICE_NOTIFY']], 'PoIrpManager' : [ 0x90, ['_PO_IRP_MANAGER']], 'UniqueId' : [ 0xa0, ['_UNICODE_STRING']], 'PowerFlags' : [ 0xa8, ['unsigned long']], 'State' : [ 0xac, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]], 'PreviousState' : [ 0xb0, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]], 'StateHistory' : [ 0xb4, ['array', -80, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]]], 'StateHistoryEntry' : [ 0x104, ['unsigned long']], 'CompletionStatus' : [ 0x108, ['long']], 'Flags' : [ 0x10c, ['unsigned long']], 'UserFlags' : [ 0x110, ['unsigned long']], 'Problem' : [ 0x114, ['unsigned long']], 'ProblemStatus' : [ 0x118, ['long']], 'ResourceList' : [ 0x11c, ['pointer', ['_CM_RESOURCE_LIST']]], 'ResourceListTranslated' : [ 0x120, ['pointer', ['_CM_RESOURCE_LIST']]], 'DuplicatePDO' : [ 0x124, ['pointer', ['_DEVICE_OBJECT']]], 'ResourceRequirements' : [ 0x128, ['pointer', ['_IO_RESOURCE_REQUIREMENTS_LIST']]], 'InterfaceType' : [ 0x12c, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0x130, ['unsigned long']], 'ChildInterfaceType' : [ 0x134, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'ChildBusNumber' : [ 0x138, ['unsigned long']], 'ChildBusTypeIndex' : [ 0x13c, ['unsigned short']], 'RemovalPolicy' : [ 0x13e, ['unsigned char']], 'HardwareRemovalPolicy' : [ 0x13f, ['unsigned char']], 'TargetDeviceNotify' : [ 0x140, ['_LIST_ENTRY']], 'DeviceArbiterList' : [ 0x148, ['_LIST_ENTRY']], 'DeviceTranslatorList' : [ 0x150, ['_LIST_ENTRY']], 'NoTranslatorMask' : [ 0x158, ['unsigned short']], 'QueryTranslatorMask' : [ 0x15a, ['unsigned short']], 'NoArbiterMask' : [ 0x15c, ['unsigned short']], 'QueryArbiterMask' : [ 0x15e, ['unsigned short']], 'OverUsed1' : [ 0x160, ['__unnamed_17fc']], 'OverUsed2' : [ 0x164, ['__unnamed_17fe']], 'BootResources' : [ 0x168, ['pointer', ['_CM_RESOURCE_LIST']]], 'BootResourcesTranslated' : [ 0x16c, ['pointer', ['_CM_RESOURCE_LIST']]], 'CapabilityFlags' : [ 0x170, ['unsigned long']], 'DockInfo' : [ 0x174, ['__unnamed_1802']], 'DisableableDepends' : [ 0x184, ['unsigned long']], 'PendedSetInterfaceState' : [ 0x188, ['_LIST_ENTRY']], 'LegacyBusListEntry' : [ 0x190, ['_LIST_ENTRY']], 'DriverUnloadRetryCount' : [ 0x198, ['unsigned long']], 'PreviousParent' : [ 0x19c, ['pointer', ['_DEVICE_NODE']]], 'DeletedChildren' : [ 0x1a0, ['long']], 'NumaNodeIndex' : [ 0x1a4, ['unsigned long']], 'ContainerID' : [ 0x1a8, ['_GUID']], 'OverrideFlags' : [ 0x1b8, ['unsigned char']], 'DeviceIdsHash' : [ 0x1bc, ['unsigned long']], 'RequiresUnloadedDriver' : [ 0x1c0, ['unsigned char']], 'PendingEjectRelations' : [ 0x1c4, ['pointer', ['_PENDING_RELATIONS_LIST_ENTRY']]], 'StateFlags' : [ 0x1c8, ['unsigned long']], } ], '_MCGEN_TRACE_CONTEXT' : [ 0x38, { 'RegistrationHandle' : [ 0x0, ['unsigned long long']], 'Logger' : [ 0x8, ['unsigned long long']], 'MatchAnyKeyword' : [ 0x10, ['unsigned long long']], 'MatchAllKeyword' : [ 0x18, ['unsigned long long']], 'Flags' : [ 0x20, ['unsigned long']], 'IsEnabled' : [ 0x24, ['unsigned long']], 'Level' : [ 0x28, ['unsigned char']], 'Reserve' : [ 0x29, ['unsigned char']], 'EnableBitsCount' : [ 0x2a, ['unsigned short']], 'EnableBitMask' : [ 0x2c, ['pointer', ['unsigned long']]], 'EnableKeyWords' : [ 0x30, ['pointer', ['unsigned long long']]], 'EnableLevel' : [ 0x34, ['pointer', ['unsigned char']]], } ], '_PNP_DEVICE_COMPLETION_QUEUE' : [ 0x2c, { 'DispatchedList' : [ 0x0, ['_LIST_ENTRY']], 'DispatchedCount' : [ 0x8, ['unsigned long']], 'CompletedList' : [ 0xc, ['_LIST_ENTRY']], 'CompletedSemaphore' : [ 0x14, ['_KSEMAPHORE']], 'SpinLock' : [ 0x28, ['unsigned long']], } ], '_KSEMAPHORE' : [ 0x14, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'Limit' : [ 0x10, ['long']], } ], '_DEVOBJ_EXTENSION' : [ 0x38, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['unsigned short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'PowerFlags' : [ 0x8, ['unsigned long']], 'Dope' : [ 0xc, ['pointer', ['_DEVICE_OBJECT_POWER_EXTENSION']]], 'ExtensionFlags' : [ 0x10, ['unsigned long']], 'DeviceNode' : [ 0x14, ['pointer', ['void']]], 'AttachedTo' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'StartIoCount' : [ 0x1c, ['long']], 'StartIoKey' : [ 0x20, ['long']], 'StartIoFlags' : [ 0x24, ['unsigned long']], 'Vpb' : [ 0x28, ['pointer', ['_VPB']]], 'DependencyNode' : [ 0x2c, ['pointer', ['void']]], 'InterruptContext' : [ 0x30, ['pointer', ['void']]], 'VerifierContext' : [ 0x34, ['pointer', ['void']]], } ], '_GROUP_AFFINITY' : [ 0xc, { 'Mask' : [ 0x0, ['unsigned long']], 'Group' : [ 0x4, ['unsigned short']], 'Reserved' : [ 0x6, ['array', 3, ['unsigned short']]], } ], '_PNP_ASSIGN_RESOURCES_CONTEXT' : [ 0xc, { 'IncludeFailedDevices' : [ 0x0, ['unsigned long']], 'DeviceCount' : [ 0x4, ['unsigned long']], 'DeviceList' : [ 0x8, ['array', 1, ['pointer', ['_DEVICE_OBJECT']]]], } ], '_PNP_RESOURCE_REQUEST' : [ 0x28, { 'PhysicalDevice' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], 'Flags' : [ 0x4, ['unsigned long']], 'AllocationType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'ArbiterRequestLegacyReported', 1: 'ArbiterRequestHalReported', 2: 'ArbiterRequestLegacyAssigned', 3: 'ArbiterRequestPnpDetected', 4: 'ArbiterRequestPnpEnumerated', -1: 'ArbiterRequestUndefined'})]], 'Priority' : [ 0xc, ['unsigned long']], 'Position' : [ 0x10, ['unsigned long']], 'ResourceRequirements' : [ 0x14, ['pointer', ['_IO_RESOURCE_REQUIREMENTS_LIST']]], 'ReqList' : [ 0x18, ['pointer', ['void']]], 'ResourceAssignment' : [ 0x1c, ['pointer', ['_CM_RESOURCE_LIST']]], 'TranslatedResourceAssignment' : [ 0x20, ['pointer', ['_CM_RESOURCE_LIST']]], 'Status' : [ 0x24, ['long']], } ], '_IO_RESOURCE_REQUIREMENTS_LIST' : [ 0x48, { 'ListSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0x8, ['unsigned long']], 'SlotNumber' : [ 0xc, ['unsigned long']], 'Reserved' : [ 0x10, ['array', 3, ['unsigned long']]], 'AlternativeLists' : [ 0x1c, ['unsigned long']], 'List' : [ 0x20, ['array', 1, ['_IO_RESOURCE_LIST']]], } ], '_EXCEPTION_RECORD64' : [ 0x98, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['unsigned long long']], 'ExceptionAddress' : [ 0x10, ['unsigned long long']], 'NumberParameters' : [ 0x18, ['unsigned long']], '__unusedAlignment' : [ 0x1c, ['unsigned long']], 'ExceptionInformation' : [ 0x20, ['array', 15, ['unsigned long long']]], } ], '_EXCEPTION_RECORD32' : [ 0x50, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['unsigned long']], 'ExceptionAddress' : [ 0xc, ['unsigned long']], 'NumberParameters' : [ 0x10, ['unsigned long']], 'ExceptionInformation' : [ 0x14, ['array', 15, ['unsigned long']]], } ], '_DBGKM_EXCEPTION64' : [ 0xa0, { 'ExceptionRecord' : [ 0x0, ['_EXCEPTION_RECORD64']], 'FirstChance' : [ 0x98, ['unsigned long']], } ], '_DBGKM_EXCEPTION32' : [ 0x54, { 'ExceptionRecord' : [ 0x0, ['_EXCEPTION_RECORD32']], 'FirstChance' : [ 0x50, ['unsigned long']], } ], '_X86_KTRAP_FRAME' : [ 0x8c, { 'DbgEbp' : [ 0x0, ['unsigned long']], 'DbgEip' : [ 0x4, ['unsigned long']], 'DbgArgMark' : [ 0x8, ['unsigned long']], 'DbgArgPointer' : [ 0xc, ['unsigned long']], 'TempSegCs' : [ 0x10, ['unsigned long']], 'TempEsp' : [ 0x14, ['unsigned long']], 'Dr0' : [ 0x18, ['unsigned long']], 'Dr1' : [ 0x1c, ['unsigned long']], 'Dr2' : [ 0x20, ['unsigned long']], 'Dr3' : [ 0x24, ['unsigned long']], 'Dr6' : [ 0x28, ['unsigned long']], 'Dr7' : [ 0x2c, ['unsigned long']], 'SegGs' : [ 0x30, ['unsigned long']], 'SegEs' : [ 0x34, ['unsigned long']], 'SegDs' : [ 0x38, ['unsigned long']], 'Edx' : [ 0x3c, ['unsigned long']], 'Ecx' : [ 0x40, ['unsigned long']], 'Eax' : [ 0x44, ['unsigned long']], 'PreviousPreviousMode' : [ 0x48, ['unsigned char']], 'EntropyQueueDpc' : [ 0x49, ['unsigned char']], 'Reserved' : [ 0x4a, ['array', 2, ['unsigned char']]], 'ExceptionList' : [ 0x4c, ['unsigned long']], 'SegFs' : [ 0x50, ['unsigned long']], 'Edi' : [ 0x54, ['unsigned long']], 'Esi' : [ 0x58, ['unsigned long']], 'Ebx' : [ 0x5c, ['unsigned long']], 'Ebp' : [ 0x60, ['unsigned long']], 'ErrCode' : [ 0x64, ['unsigned long']], 'Eip' : [ 0x68, ['unsigned long']], 'SegCs' : [ 0x6c, ['unsigned long']], 'EFlags' : [ 0x70, ['unsigned long']], 'HardwareEsp' : [ 0x74, ['unsigned long']], 'HardwareSegSs' : [ 0x78, ['unsigned long']], 'V86Es' : [ 0x7c, ['unsigned long']], 'V86Ds' : [ 0x80, ['unsigned long']], 'V86Fs' : [ 0x84, ['unsigned long']], 'V86Gs' : [ 0x88, ['unsigned long']], } ], '_X86_KTRAP_FRAME_BLUE' : [ 0x8c, { 'DbgEbp' : [ 0x0, ['unsigned long']], 'DbgEip' : [ 0x4, ['unsigned long']], 'DbgArgMark' : [ 0x8, ['unsigned long']], 'TempSegCs' : [ 0xc, ['unsigned short']], 'Logging' : [ 0xe, ['unsigned char']], 'FrameType' : [ 0xf, ['unsigned char']], 'TempEsp' : [ 0x10, ['unsigned long']], 'Dr0' : [ 0x14, ['unsigned long']], 'Dr1' : [ 0x18, ['unsigned long']], 'Dr2' : [ 0x1c, ['unsigned long']], 'Dr3' : [ 0x20, ['unsigned long']], 'Dr6' : [ 0x24, ['unsigned long']], 'Dr7' : [ 0x28, ['unsigned long']], 'SegGs' : [ 0x2c, ['unsigned long']], 'SegEs' : [ 0x30, ['unsigned long']], 'SegDs' : [ 0x34, ['unsigned long']], 'Edx' : [ 0x38, ['unsigned long']], 'Ecx' : [ 0x3c, ['unsigned long']], 'Eax' : [ 0x40, ['unsigned long']], 'PreviousPreviousMode' : [ 0x44, ['unsigned char']], 'EntropyQueueDpc' : [ 0x45, ['unsigned char']], 'Reserved' : [ 0x46, ['array', 2, ['unsigned char']]], 'MxCsr' : [ 0x48, ['unsigned long']], 'ExceptionList' : [ 0x4c, ['unsigned long']], 'SegFs' : [ 0x50, ['unsigned long']], 'Edi' : [ 0x54, ['unsigned long']], 'Esi' : [ 0x58, ['unsigned long']], 'Ebx' : [ 0x5c, ['unsigned long']], 'Ebp' : [ 0x60, ['unsigned long']], 'ErrCode' : [ 0x64, ['unsigned long']], 'Eip' : [ 0x68, ['unsigned long']], 'SegCs' : [ 0x6c, ['unsigned long']], 'EFlags' : [ 0x70, ['unsigned long']], 'HardwareEsp' : [ 0x74, ['unsigned long']], 'HardwareSegSs' : [ 0x78, ['unsigned long']], 'V86Es' : [ 0x7c, ['unsigned long']], 'V86Ds' : [ 0x80, ['unsigned long']], 'V86Fs' : [ 0x84, ['unsigned long']], 'V86Gs' : [ 0x88, ['unsigned long']], } ], '_DBGKD_LOAD_SYMBOLS64' : [ 0x28, { 'PathNameLength' : [ 0x0, ['unsigned long']], 'BaseOfDll' : [ 0x8, ['unsigned long long']], 'ProcessId' : [ 0x10, ['unsigned long long']], 'CheckSum' : [ 0x18, ['unsigned long']], 'SizeOfImage' : [ 0x1c, ['unsigned long']], 'UnloadSymbols' : [ 0x20, ['unsigned char']], } ], '_DBGKD_LOAD_SYMBOLS32' : [ 0x18, { 'PathNameLength' : [ 0x0, ['unsigned long']], 'BaseOfDll' : [ 0x4, ['unsigned long']], 'ProcessId' : [ 0x8, ['unsigned long']], 'CheckSum' : [ 0xc, ['unsigned long']], 'SizeOfImage' : [ 0x10, ['unsigned long']], 'UnloadSymbols' : [ 0x14, ['unsigned char']], } ], '_DBGKD_READ_MEMORY64' : [ 0x10, { 'TargetBaseAddress' : [ 0x0, ['unsigned long long']], 'TransferCount' : [ 0x8, ['unsigned long']], 'ActualBytesRead' : [ 0xc, ['unsigned long']], } ], '_DBGKD_READ_MEMORY32' : [ 0xc, { 'TargetBaseAddress' : [ 0x0, ['unsigned long']], 'TransferCount' : [ 0x4, ['unsigned long']], 'ActualBytesRead' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_MEMORY64' : [ 0x10, { 'TargetBaseAddress' : [ 0x0, ['unsigned long long']], 'TransferCount' : [ 0x8, ['unsigned long']], 'ActualBytesWritten' : [ 0xc, ['unsigned long']], } ], '_DBGKD_WRITE_MEMORY32' : [ 0xc, { 'TargetBaseAddress' : [ 0x0, ['unsigned long']], 'TransferCount' : [ 0x4, ['unsigned long']], 'ActualBytesWritten' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_BREAKPOINT64' : [ 0x10, { 'BreakPointAddress' : [ 0x0, ['unsigned long long']], 'BreakPointHandle' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_BREAKPOINT32' : [ 0x8, { 'BreakPointAddress' : [ 0x0, ['unsigned long']], 'BreakPointHandle' : [ 0x4, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO64' : [ 0x10, { 'IoAddress' : [ 0x0, ['unsigned long long']], 'DataSize' : [ 0x8, ['unsigned long']], 'DataValue' : [ 0xc, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO32' : [ 0xc, { 'DataSize' : [ 0x0, ['unsigned long']], 'IoAddress' : [ 0x4, ['unsigned long']], 'DataValue' : [ 0x8, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO_EXTENDED64' : [ 0x20, { 'DataSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['unsigned long']], 'BusNumber' : [ 0x8, ['unsigned long']], 'AddressSpace' : [ 0xc, ['unsigned long']], 'IoAddress' : [ 0x10, ['unsigned long long']], 'DataValue' : [ 0x18, ['unsigned long']], } ], '_DBGKD_READ_WRITE_IO_EXTENDED32' : [ 0x18, { 'DataSize' : [ 0x0, ['unsigned long']], 'InterfaceType' : [ 0x4, ['unsigned long']], 'BusNumber' : [ 0x8, ['unsigned long']], 'AddressSpace' : [ 0xc, ['unsigned long']], 'IoAddress' : [ 0x10, ['unsigned long']], 'DataValue' : [ 0x14, ['unsigned long']], } ], '_DBGKD_SET_SPECIAL_CALL32' : [ 0x4, { 'SpecialCall' : [ 0x0, ['unsigned long']], } ], '_DBGKD_SET_SPECIAL_CALL64' : [ 0x8, { 'SpecialCall' : [ 0x0, ['unsigned long long']], } ], '_DBGKD_SET_INTERNAL_BREAKPOINT32' : [ 0x8, { 'BreakpointAddress' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x4, ['unsigned long']], } ], '_DBGKD_SET_INTERNAL_BREAKPOINT64' : [ 0x10, { 'BreakpointAddress' : [ 0x0, ['unsigned long long']], 'Flags' : [ 0x8, ['unsigned long']], } ], '_DBGKD_GET_INTERNAL_BREAKPOINT64' : [ 0x20, { 'BreakpointAddress' : [ 0x0, ['unsigned long long']], 'Flags' : [ 0x8, ['unsigned long']], 'Calls' : [ 0xc, ['unsigned long']], 'MaxCallsPerPeriod' : [ 0x10, ['unsigned long']], 'MinInstructions' : [ 0x14, ['unsigned long']], 'MaxInstructions' : [ 0x18, ['unsigned long']], 'TotalInstructions' : [ 0x1c, ['unsigned long']], } ], '_DBGKD_GET_INTERNAL_BREAKPOINT32' : [ 0x1c, { 'BreakpointAddress' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x4, ['unsigned long']], 'Calls' : [ 0x8, ['unsigned long']], 'MaxCallsPerPeriod' : [ 0xc, ['unsigned long']], 'MinInstructions' : [ 0x10, ['unsigned long']], 'MaxInstructions' : [ 0x14, ['unsigned long']], 'TotalInstructions' : [ 0x18, ['unsigned long']], } ], '__unnamed_18fc' : [ 0x28, { 'ReadMemory' : [ 0x0, ['_DBGKD_READ_MEMORY64']], 'WriteMemory' : [ 0x0, ['_DBGKD_WRITE_MEMORY64']], 'GetContext' : [ 0x0, ['_DBGKD_GET_CONTEXT']], 'SetContext' : [ 0x0, ['_DBGKD_SET_CONTEXT']], 'WriteBreakPoint' : [ 0x0, ['_DBGKD_WRITE_BREAKPOINT64']], 'RestoreBreakPoint' : [ 0x0, ['_DBGKD_RESTORE_BREAKPOINT']], 'Continue' : [ 0x0, ['_DBGKD_CONTINUE']], 'Continue2' : [ 0x0, ['_DBGKD_CONTINUE2']], 'ReadWriteIo' : [ 0x0, ['_DBGKD_READ_WRITE_IO64']], 'ReadWriteIoExtended' : [ 0x0, ['_DBGKD_READ_WRITE_IO_EXTENDED64']], 'QuerySpecialCalls' : [ 0x0, ['_DBGKD_QUERY_SPECIAL_CALLS']], 'SetSpecialCall' : [ 0x0, ['_DBGKD_SET_SPECIAL_CALL64']], 'SetInternalBreakpoint' : [ 0x0, ['_DBGKD_SET_INTERNAL_BREAKPOINT64']], 'GetInternalBreakpoint' : [ 0x0, ['_DBGKD_GET_INTERNAL_BREAKPOINT64']], 'GetVersion64' : [ 0x0, ['_DBGKD_GET_VERSION64']], 'BreakPointEx' : [ 0x0, ['_DBGKD_BREAKPOINTEX']], 'ReadWriteMsr' : [ 0x0, ['_DBGKD_READ_WRITE_MSR']], 'SearchMemory' : [ 0x0, ['_DBGKD_SEARCH_MEMORY']], 'GetSetBusData' : [ 0x0, ['_DBGKD_GET_SET_BUS_DATA']], 'FillMemory' : [ 0x0, ['_DBGKD_FILL_MEMORY']], 'QueryMemory' : [ 0x0, ['_DBGKD_QUERY_MEMORY']], 'SwitchPartition' : [ 0x0, ['_DBGKD_SWITCH_PARTITION']], 'GetContextEx' : [ 0x0, ['_DBGKD_CONTEXT_EX']], 'SetContextEx' : [ 0x0, ['_DBGKD_CONTEXT_EX']], 'WriteCustomBreakPoint' : [ 0x0, ['_DBGKD_WRITE_CUSTOM_BREAKPOINT']], } ], '_DBGKD_MANIPULATE_STATE64' : [ 0x38, { 'ApiNumber' : [ 0x0, ['unsigned long']], 'ProcessorLevel' : [ 0x4, ['unsigned short']], 'Processor' : [ 0x6, ['unsigned short']], 'ReturnStatus' : [ 0x8, ['long']], 'u' : [ 0x10, ['__unnamed_18fc']], } ], '__unnamed_1903' : [ 0x28, { 'ReadMemory' : [ 0x0, ['_DBGKD_READ_MEMORY32']], 'WriteMemory' : [ 0x0, ['_DBGKD_WRITE_MEMORY32']], 'ReadMemory64' : [ 0x0, ['_DBGKD_READ_MEMORY64']], 'WriteMemory64' : [ 0x0, ['_DBGKD_WRITE_MEMORY64']], 'GetContext' : [ 0x0, ['_DBGKD_GET_CONTEXT']], 'SetContext' : [ 0x0, ['_DBGKD_SET_CONTEXT']], 'WriteBreakPoint' : [ 0x0, ['_DBGKD_WRITE_BREAKPOINT32']], 'RestoreBreakPoint' : [ 0x0, ['_DBGKD_RESTORE_BREAKPOINT']], 'Continue' : [ 0x0, ['_DBGKD_CONTINUE']], 'Continue2' : [ 0x0, ['_DBGKD_CONTINUE2']], 'ReadWriteIo' : [ 0x0, ['_DBGKD_READ_WRITE_IO32']], 'ReadWriteIoExtended' : [ 0x0, ['_DBGKD_READ_WRITE_IO_EXTENDED32']], 'QuerySpecialCalls' : [ 0x0, ['_DBGKD_QUERY_SPECIAL_CALLS']], 'SetSpecialCall' : [ 0x0, ['_DBGKD_SET_SPECIAL_CALL32']], 'SetInternalBreakpoint' : [ 0x0, ['_DBGKD_SET_INTERNAL_BREAKPOINT32']], 'GetInternalBreakpoint' : [ 0x0, ['_DBGKD_GET_INTERNAL_BREAKPOINT32']], 'GetVersion32' : [ 0x0, ['_DBGKD_GET_VERSION32']], 'BreakPointEx' : [ 0x0, ['_DBGKD_BREAKPOINTEX']], 'ReadWriteMsr' : [ 0x0, ['_DBGKD_READ_WRITE_MSR']], 'SearchMemory' : [ 0x0, ['_DBGKD_SEARCH_MEMORY']], 'GetContextEx' : [ 0x0, ['_DBGKD_CONTEXT_EX']], 'SetContextEx' : [ 0x0, ['_DBGKD_CONTEXT_EX']], } ], '_DBGKD_MANIPULATE_STATE32' : [ 0x34, { 'ApiNumber' : [ 0x0, ['unsigned long']], 'ProcessorLevel' : [ 0x4, ['unsigned short']], 'Processor' : [ 0x6, ['unsigned short']], 'ReturnStatus' : [ 0x8, ['long']], 'u' : [ 0xc, ['__unnamed_1903']], } ], '_DBGKD_READ_WRITE_MSR' : [ 0xc, { 'Msr' : [ 0x0, ['unsigned long']], 'DataValueLow' : [ 0x4, ['unsigned long']], 'DataValueHigh' : [ 0x8, ['unsigned long']], } ], '_DBGKD_BREAKPOINTEX' : [ 0x8, { 'BreakPointCount' : [ 0x0, ['unsigned long']], 'ContinueStatus' : [ 0x4, ['long']], } ], '_DBGKD_SEARCH_MEMORY' : [ 0x18, { 'SearchAddress' : [ 0x0, ['unsigned long long']], 'FoundAddress' : [ 0x0, ['unsigned long long']], 'SearchLength' : [ 0x8, ['unsigned long long']], 'PatternLength' : [ 0x10, ['unsigned long']], } ], '_DBGKD_RESTORE_BREAKPOINT' : [ 0x4, { 'BreakPointHandle' : [ 0x0, ['unsigned long']], } ], '_DBGKD_CONTINUE' : [ 0x4, { 'ContinueStatus' : [ 0x0, ['long']], } ], '_DBGKD_CONTINUE2' : [ 0x20, { 'ContinueStatus' : [ 0x0, ['long']], 'ControlSet' : [ 0x4, ['_X86_DBGKD_CONTROL_SET']], 'AnyControlSet' : [ 0x4, ['_DBGKD_ANY_CONTROL_SET']], } ], '_PEP_ACPI_RESOURCE' : [ 0x48, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'IoMemory' : [ 0x0, ['_PEP_ACPI_IO_MEMORY_RESOURCE']], 'Interrupt' : [ 0x0, ['_PEP_ACPI_INTERRUPT_RESOURCE']], 'Gpio' : [ 0x0, ['_PEP_ACPI_GPIO_RESOURCE']], 'SpbI2c' : [ 0x0, ['_PEP_ACPI_SPB_I2C_RESOURCE']], 'SpbSpi' : [ 0x0, ['_PEP_ACPI_SPB_SPI_RESOURCE']], 'SpbUart' : [ 0x0, ['_PEP_ACPI_SPB_UART_RESOURCE']], 'ExtendedAddress' : [ 0x0, ['_PEP_ACPI_EXTENDED_ADDRESS']], } ], '_PEP_ACPI_IO_MEMORY_RESOURCE' : [ 0x20, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'Information' : [ 0x4, ['unsigned char']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], 'Alignment' : [ 0x18, ['unsigned long']], 'Length' : [ 0x1c, ['unsigned long']], } ], '_PEP_ACPI_INTERRUPT_RESOURCE' : [ 0x18, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'InterruptType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'LevelSensitive', 1: 'Latched'})]], 'InterruptPolarity' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'InterruptPolarityUnknown', 1: 'InterruptRisingEdge', 2: 'InterruptFallingEdge', 3: 'InterruptActiveBothTriggerLow', 4: 'InterruptActiveBothTriggerHigh'})]], 'Flags' : [ 0xc, ['_PEP_ACPI_RESOURCE_FLAGS']], 'Count' : [ 0x10, ['unsigned char']], 'Pins' : [ 0x14, ['pointer', ['unsigned long']]], } ], '_PEP_ACPI_GPIO_RESOURCE' : [ 0x30, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'Flags' : [ 0x4, ['_PEP_ACPI_RESOURCE_FLAGS']], 'InterruptType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'LevelSensitive', 1: 'Latched'})]], 'InterruptPolarity' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'InterruptPolarityUnknown', 1: 'InterruptRisingEdge', 2: 'InterruptFallingEdge', 3: 'InterruptActiveBothTriggerLow', 4: 'InterruptActiveBothTriggerHigh'})]], 'PinConfig' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'PullDefault', 1: 'PullUp', 2: 'PullDown', 3: 'PullNone'})]], 'IoRestrictionType' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'IoRestrictionNone', 1: 'IoRestrictionInputOnly', 2: 'IoRestrictionOutputOnly', 3: 'IoRestrictionNoneAndPreserve'})]], 'DriveStrength' : [ 0x18, ['unsigned short']], 'DebounceTimeout' : [ 0x1a, ['unsigned short']], 'PinTable' : [ 0x1c, ['pointer', ['unsigned short']]], 'PinCount' : [ 0x20, ['unsigned short']], 'ResourceSourceIndex' : [ 0x22, ['unsigned char']], 'ResourceSourceName' : [ 0x24, ['pointer', ['_UNICODE_STRING']]], 'VendorData' : [ 0x28, ['pointer', ['unsigned char']]], 'VendorDataLength' : [ 0x2c, ['unsigned short']], } ], '_PEP_ACPI_SPB_I2C_RESOURCE' : [ 0x20, { 'SpbCommon' : [ 0x0, ['_PEP_ACPI_SPB_RESOURCE']], 'ConnectionSpeed' : [ 0x18, ['unsigned long']], 'SlaveAddress' : [ 0x1c, ['unsigned short']], } ], '_PEP_ACPI_SPB_UART_RESOURCE' : [ 0x24, { 'SpbCommon' : [ 0x0, ['_PEP_ACPI_SPB_RESOURCE']], 'BaudRate' : [ 0x18, ['unsigned long']], 'RxBufferSize' : [ 0x1c, ['unsigned short']], 'TxBufferSize' : [ 0x1e, ['unsigned short']], 'Parity' : [ 0x20, ['unsigned char']], 'LinesInUse' : [ 0x21, ['unsigned char']], } ], '_PEP_ACPI_SPB_SPI_RESOURCE' : [ 0x24, { 'SpbCommon' : [ 0x0, ['_PEP_ACPI_SPB_RESOURCE']], 'ConnectionSpeed' : [ 0x18, ['unsigned long']], 'DataBitLength' : [ 0x1c, ['unsigned char']], 'Phase' : [ 0x1d, ['unsigned char']], 'Polarity' : [ 0x1e, ['unsigned char']], 'DeviceSelection' : [ 0x20, ['unsigned short']], } ], '_PEP_ACPI_EXTENDED_ADDRESS' : [ 0x48, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'Flags' : [ 0x4, ['_PEP_ACPI_RESOURCE_FLAGS']], 'ResourceFlags' : [ 0x8, ['unsigned char']], 'GeneralFlags' : [ 0x9, ['unsigned char']], 'TypeSpecificFlags' : [ 0xa, ['unsigned char']], 'RevisionId' : [ 0xb, ['unsigned char']], 'Reserved' : [ 0xc, ['unsigned char']], 'Granularity' : [ 0x10, ['unsigned long long']], 'MinimumAddress' : [ 0x18, ['unsigned long long']], 'MaximumAddress' : [ 0x20, ['unsigned long long']], 'TranslationAddress' : [ 0x28, ['unsigned long long']], 'AddressLength' : [ 0x30, ['unsigned long long']], 'TypeAttribute' : [ 0x38, ['unsigned long long']], 'DescriptorName' : [ 0x40, ['pointer', ['_UNICODE_STRING']]], } ], '_PPM_PLATFORM_STATES' : [ 0x100, { 'StateCount' : [ 0x0, ['unsigned long']], 'InterfaceVersion' : [ 0x4, ['unsigned long']], 'ProcessorCount' : [ 0x8, ['unsigned long']], 'CoordinatedInterface' : [ 0xc, ['unsigned char']], 'IdleTest' : [ 0x10, ['pointer', ['void']]], 'IdlePreExecute' : [ 0x14, ['pointer', ['void']]], 'IdleComplete' : [ 0x18, ['pointer', ['void']]], 'QueryPlatformStateResidency' : [ 0x1c, ['pointer', ['void']]], 'Accounting' : [ 0x20, ['pointer', ['_PLATFORM_IDLE_ACCOUNTING']]], 'State' : [ 0x40, ['array', 1, ['_PPM_PLATFORM_STATE']]], } ], '_POP_CPU_INFO' : [ 0x10, { 'Eax' : [ 0x0, ['unsigned long']], 'Ebx' : [ 0x4, ['unsigned long']], 'Ecx' : [ 0x8, ['unsigned long']], 'Edx' : [ 0xc, ['unsigned long']], } ], '_POP_PPM_PROFILE' : [ 0x1a8, { 'Name' : [ 0x0, ['pointer', ['unsigned short']]], 'Id' : [ 0x4, ['unsigned char']], 'Guid' : [ 0x8, ['_GUID']], 'Flags' : [ 0x18, ['unsigned long']], 'Priority' : [ 0x1c, ['unsigned char']], 'Settings' : [ 0x20, ['array', 2, ['_PPM_ENGINE_SETTINGS']]], 'StartTime' : [ 0x180, ['unsigned long long']], 'Count' : [ 0x188, ['unsigned long long']], 'MaxDuration' : [ 0x190, ['unsigned long long']], 'MinDuration' : [ 0x198, ['unsigned long long']], 'TotalDuration' : [ 0x1a0, ['unsigned long long']], } ], '_PPM_ENGINE_SETTINGS' : [ 0xb0, { 'ExplicitSetting' : [ 0x0, ['array', 2, ['_PPM_POLICY_SETTINGS_MASK']]], 'ThrottlingPolicy' : [ 0x10, ['unsigned char']], 'PerfTimeCheck' : [ 0x14, ['unsigned long']], 'PerfHistoryCount' : [ 0x18, ['array', 2, ['unsigned char']]], 'PerfMinPolicy' : [ 0x1a, ['array', 2, ['unsigned char']]], 'PerfMaxPolicy' : [ 0x1c, ['array', 2, ['unsigned char']]], 'PerfDecreaseTime' : [ 0x1e, ['array', 2, ['unsigned char']]], 'PerfIncreaseTime' : [ 0x20, ['array', 2, ['unsigned char']]], 'PerfDecreasePolicy' : [ 0x22, ['array', 2, ['unsigned char']]], 'PerfIncreasePolicy' : [ 0x24, ['array', 2, ['unsigned char']]], 'PerfDecreaseThreshold' : [ 0x26, ['array', 2, ['unsigned char']]], 'PerfIncreaseThreshold' : [ 0x28, ['array', 2, ['unsigned char']]], 'PerfBoostPolicy' : [ 0x2c, ['unsigned long']], 'PerfBoostMode' : [ 0x30, ['unsigned long']], 'PerfReductionTolerance' : [ 0x34, ['unsigned long']], 'EnergyPerfPreference' : [ 0x38, ['unsigned long']], 'AutonomousActivityWindow' : [ 0x3c, ['unsigned long']], 'AutonomousPreference' : [ 0x40, ['unsigned char']], 'LatencyHintPerf' : [ 0x41, ['array', 2, ['unsigned char']]], 'LatencyHintUnpark' : [ 0x43, ['array', 2, ['unsigned char']]], 'DutyCycling' : [ 0x45, ['unsigned char']], 'ParkingPerfState' : [ 0x46, ['array', 2, ['unsigned char']]], 'DistributeUtility' : [ 0x48, ['unsigned char']], 'CoreParkingOverUtilizationThreshold' : [ 0x49, ['unsigned char']], 'CoreParkingConcurrencyThreshold' : [ 0x4a, ['unsigned char']], 'CoreParkingHeadroomThreshold' : [ 0x4b, ['unsigned char']], 'CoreParkingDistributionThreshold' : [ 0x4c, ['unsigned char']], 'CoreParkingDecreasePolicy' : [ 0x4d, ['unsigned char']], 'CoreParkingIncreasePolicy' : [ 0x4e, ['unsigned char']], 'CoreParkingDecreaseTime' : [ 0x50, ['unsigned long']], 'CoreParkingIncreaseTime' : [ 0x54, ['unsigned long']], 'CoreParkingMinCores' : [ 0x58, ['array', 2, ['unsigned char']]], 'CoreParkingMaxCores' : [ 0x5a, ['array', 2, ['unsigned char']]], 'AllowScaling' : [ 0x5c, ['unsigned char']], 'IdleDisabled' : [ 0x5d, ['unsigned char']], 'IdleTimeCheck' : [ 0x60, ['unsigned long']], 'IdleDemotePercent' : [ 0x64, ['unsigned char']], 'IdlePromotePercent' : [ 0x65, ['unsigned char']], 'HeteroDecreaseTime' : [ 0x66, ['unsigned char']], 'HeteroIncreaseTime' : [ 0x67, ['unsigned char']], 'HeteroDecreaseThreshold' : [ 0x68, ['array', 32, ['unsigned char']]], 'HeteroIncreaseThreshold' : [ 0x88, ['array', 32, ['unsigned char']]], 'Class0FloorPerformance' : [ 0xa8, ['unsigned char']], 'Class1InitialPerformance' : [ 0xa9, ['unsigned char']], } ], '_POP_FX_COMPONENT_FLAGS' : [ 0x8, { 'Value' : [ 0x0, ['long']], 'Value2' : [ 0x4, ['long']], 'RefCount' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'Idling' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'Active' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'CriticalIdleOverride' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ResidentOverride' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reserved' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], } ], '_POP_FX_PERF_FLAGS' : [ 0x4, { 'Value' : [ 0x0, ['long']], 'Progress' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 27, native_type='unsigned long')]], 'Synchronicity' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 29, native_type='unsigned long')]], 'RequestPepCompleted' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'RequestSucceeded' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'NestedCallback' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_POP_FX_DEVICE_STATUS' : [ 0x4, { 'Value' : [ 0x0, ['long']], 'SystemTransition' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PepD0Notify' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'IdleTimerOn' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'IgnoreIdleTimeout' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'IrpInUse' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'IrpPending' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'DPNRDeviceNotified' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'DPNRReceivedFromPep' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'IrpFirstPendingIndex' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'IrpLastPendingIndex' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 32, native_type='unsigned long')]], } ], '_POP_RW_LOCK' : [ 0x8, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'Thread' : [ 0x4, ['pointer', ['_KTHREAD']]], } ], '_VOLUME_CACHE_MAP' : [ 0x90, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteCode' : [ 0x2, ['short']], 'UseCount' : [ 0x4, ['unsigned long']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'VolumeCacheMapLinks' : [ 0xc, ['_LIST_ENTRY']], 'DirtyPages' : [ 0x14, ['unsigned long']], 'LogHandleContext' : [ 0x18, ['_LOG_HANDLE_CONTEXT']], 'Flags' : [ 0x80, ['unsigned long']], 'PagesQueuedToDisk' : [ 0x84, ['unsigned long']], 'LoggedPagesQueuedToDisk' : [ 0x88, ['unsigned long']], } ], '_SHARED_CACHE_MAP' : [ 0x178, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteSize' : [ 0x2, ['short']], 'OpenCount' : [ 0x4, ['unsigned long']], 'FileSize' : [ 0x8, ['_LARGE_INTEGER']], 'BcbList' : [ 0x10, ['_LIST_ENTRY']], 'SectionSize' : [ 0x18, ['_LARGE_INTEGER']], 'ValidDataLength' : [ 0x20, ['_LARGE_INTEGER']], 'ValidDataGoal' : [ 0x28, ['_LARGE_INTEGER']], 'InitialVacbs' : [ 0x30, ['array', 4, ['pointer', ['_VACB']]]], 'Vacbs' : [ 0x40, ['pointer', ['pointer', ['_VACB']]]], 'FileObjectFastRef' : [ 0x44, ['_EX_FAST_REF']], 'VacbLock' : [ 0x48, ['_EX_PUSH_LOCK']], 'DirtyPages' : [ 0x4c, ['unsigned long']], 'LoggedStreamLinks' : [ 0x50, ['_LIST_ENTRY']], 'SharedCacheMapLinks' : [ 0x58, ['_LIST_ENTRY']], 'Flags' : [ 0x60, ['unsigned long']], 'Status' : [ 0x64, ['long']], 'Mbcb' : [ 0x68, ['pointer', ['_MBCB']]], 'Section' : [ 0x6c, ['pointer', ['void']]], 'CreateEvent' : [ 0x70, ['pointer', ['_KEVENT']]], 'WaitOnActiveCount' : [ 0x74, ['pointer', ['_KEVENT']]], 'PagesToWrite' : [ 0x78, ['unsigned long']], 'BeyondLastFlush' : [ 0x80, ['long long']], 'Callbacks' : [ 0x88, ['pointer', ['_CACHE_MANAGER_CALLBACKS']]], 'LazyWriteContext' : [ 0x8c, ['pointer', ['void']]], 'PrivateList' : [ 0x90, ['_LIST_ENTRY']], 'V1' : [ 0x98, ['_LOGGED_STREAM_CALLBACK_V1']], 'V2' : [ 0x98, ['_LOGGED_STREAM_CALLBACK_V2']], 'LargestLSN' : [ 0xa0, ['_LARGE_INTEGER']], 'DirtyPageThreshold' : [ 0xa8, ['unsigned long']], 'LazyWritePassCount' : [ 0xac, ['unsigned long']], 'UninitializeEvent' : [ 0xb0, ['pointer', ['_CACHE_UNINITIALIZE_EVENT']]], 'BcbLock' : [ 0xb4, ['_FAST_MUTEX']], 'LastUnmapBehindOffset' : [ 0xd8, ['_LARGE_INTEGER']], 'Event' : [ 0xe0, ['_KEVENT']], 'HighWaterMappingOffset' : [ 0xf0, ['_LARGE_INTEGER']], 'PrivateCacheMap' : [ 0xf8, ['_PRIVATE_CACHE_MAP']], 'WriteBehindWorkQueueEntry' : [ 0x160, ['pointer', ['void']]], 'VolumeCacheMap' : [ 0x164, ['pointer', ['_VOLUME_CACHE_MAP']]], 'ProcImagePathHash' : [ 0x168, ['unsigned long']], 'WritesInProgress' : [ 0x16c, ['unsigned long']], 'AsyncReadRequestCount' : [ 0x170, ['unsigned long']], } ], '__unnamed_19e9' : [ 0x8, { 'FileOffset' : [ 0x0, ['_LARGE_INTEGER']], 'ActiveCount' : [ 0x0, ['unsigned short']], 'Links' : [ 0x0, ['_LIST_ENTRY']], } ], '_VACB' : [ 0x18, { 'BaseAddress' : [ 0x0, ['pointer', ['void']]], 'SharedCacheMap' : [ 0x4, ['pointer', ['_SHARED_CACHE_MAP']]], 'Overlay' : [ 0x8, ['__unnamed_19e9']], 'ArrayHead' : [ 0x10, ['pointer', ['_VACB_ARRAY_HEADER']]], } ], '__unnamed_1a0e' : [ 0x4, { 'FileObject' : [ 0x0, ['pointer', ['_FILE_OBJECT']]], } ], '__unnamed_1a10' : [ 0x4, { 'SharedCacheMap' : [ 0x0, ['pointer', ['_SHARED_CACHE_MAP']]], } ], '__unnamed_1a12' : [ 0x4, { 'Event' : [ 0x0, ['pointer', ['_KEVENT']]], } ], '__unnamed_1a14' : [ 0x4, { 'Reason' : [ 0x0, ['unsigned long']], } ], '__unnamed_1a16' : [ 0x1c, { 'SharedCacheMap' : [ 0x0, ['pointer', ['_SHARED_CACHE_MAP']]], 'IoStatus' : [ 0x4, ['pointer', ['_IO_STATUS_BLOCK']]], 'CallerWaitEvent' : [ 0x8, ['_KEVENT']], 'IsLowPriWriteBehind' : [ 0x18, ['unsigned char']], } ], '__unnamed_1a1a' : [ 0x38, { 'SharedCacheMap' : [ 0x0, ['pointer', ['_SHARED_CACHE_MAP']]], 'FileOffset' : [ 0x8, ['_LARGE_INTEGER']], 'FileObject' : [ 0x10, ['pointer', ['_FILE_OBJECT']]], 'Length' : [ 0x14, ['unsigned long']], 'PrefetchList' : [ 0x18, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'PrefetchPagePriority' : [ 0x1c, ['unsigned long']], 'Mdl' : [ 0x20, ['pointer', ['_MDL']]], 'IoStatusBlock' : [ 0x24, ['pointer', ['_IO_STATUS_BLOCK']]], 'CallbackContext' : [ 0x28, ['pointer', ['_CC_ASYNC_READ_CONTEXT']]], 'OriginatingProcess' : [ 0x2c, ['pointer', ['_EPROCESS']]], 'RequestorMode' : [ 0x30, ['unsigned char']], 'NestingLevel' : [ 0x34, ['unsigned long']], } ], '__unnamed_1a1c' : [ 0x38, { 'Read' : [ 0x0, ['__unnamed_1a0e']], 'Write' : [ 0x0, ['__unnamed_1a10']], 'Event' : [ 0x0, ['__unnamed_1a12']], 'Notification' : [ 0x0, ['__unnamed_1a14']], 'LowPriWrite' : [ 0x0, ['__unnamed_1a16']], 'AsyncRead' : [ 0x0, ['__unnamed_1a1a']], } ], '_WORK_QUEUE_ENTRY' : [ 0x48, { 'WorkQueueLinks' : [ 0x0, ['_LIST_ENTRY']], 'Parameters' : [ 0x8, ['__unnamed_1a1c']], 'Function' : [ 0x40, ['unsigned char']], } ], '_CC_EXTERNAL_CACHE_INFO' : [ 0x18, { 'Callback' : [ 0x0, ['pointer', ['void']]], 'DirtyPageStatistics' : [ 0x4, ['_DIRTY_PAGE_STATISTICS']], 'Links' : [ 0x10, ['_LIST_ENTRY']], } ], '_LOG_HANDLE_CONTEXT' : [ 0x68, { 'LogHandle' : [ 0x0, ['pointer', ['void']]], 'FlushToLsnRoutine' : [ 0x4, ['pointer', ['void']]], 'QueryLogHandleInfoRoutine' : [ 0x8, ['pointer', ['void']]], 'DirtyPageStatistics' : [ 0xc, ['_DIRTY_PAGE_STATISTICS']], 'DirtyPageThresholds' : [ 0x18, ['_DIRTY_PAGE_THRESHOLDS']], 'AdditionalPagesToWrite' : [ 0x40, ['unsigned long']], 'CcLWScanDPThreshold' : [ 0x44, ['unsigned long']], 'LargestLsnForCurrentLWScan' : [ 0x48, ['_LARGE_INTEGER']], 'RelatedFileObject' : [ 0x50, ['pointer', ['_FILE_OBJECT']]], 'LargestLsnFileObjectKey' : [ 0x54, ['unsigned long']], 'LastLWTimeStamp' : [ 0x58, ['_LARGE_INTEGER']], 'Flags' : [ 0x60, ['unsigned long']], } ], '_MBCB' : [ 0x88, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeIsInZone' : [ 0x2, ['short']], 'PagesToWrite' : [ 0x4, ['unsigned long']], 'DirtyPages' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], 'BitmapRanges' : [ 0x10, ['_LIST_ENTRY']], 'ResumeWritePage' : [ 0x18, ['long long']], 'MostRecentlyDirtiedPage' : [ 0x20, ['long long']], 'BitmapRange1' : [ 0x28, ['_BITMAP_RANGE']], 'BitmapRange2' : [ 0x48, ['_BITMAP_RANGE']], 'BitmapRange3' : [ 0x68, ['_BITMAP_RANGE']], } ], '_BITMAP_RANGE' : [ 0x20, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'BasePage' : [ 0x8, ['long long']], 'FirstDirtyPage' : [ 0x10, ['unsigned long']], 'LastDirtyPage' : [ 0x14, ['unsigned long']], 'DirtyPages' : [ 0x18, ['unsigned long']], 'Bitmap' : [ 0x1c, ['pointer', ['unsigned long']]], } ], 'VACB_LEVEL_ALLOCATION_LIST' : [ 0x10, { 'VacbLevelList' : [ 0x0, ['_LIST_ENTRY']], 'VacbLevelWithBcbListHeads' : [ 0x8, ['pointer', ['void']]], 'VacbLevelsAllocated' : [ 0xc, ['unsigned long']], } ], '_VACB_LEVEL_REFERENCE' : [ 0x8, { 'Reference' : [ 0x0, ['long']], 'SpecialReference' : [ 0x4, ['long']], } ], '_CACHE_UNINITIALIZE_EVENT' : [ 0x14, { 'Next' : [ 0x0, ['pointer', ['_CACHE_UNINITIALIZE_EVENT']]], 'Event' : [ 0x4, ['_KEVENT']], } ], '_HEAP_LIST_LOOKUP' : [ 0x24, { 'ExtendedLookup' : [ 0x0, ['pointer', ['_HEAP_LIST_LOOKUP']]], 'ArraySize' : [ 0x4, ['unsigned long']], 'ExtraItem' : [ 0x8, ['unsigned long']], 'ItemCount' : [ 0xc, ['unsigned long']], 'OutOfRangeItems' : [ 0x10, ['unsigned long']], 'BaseIndex' : [ 0x14, ['unsigned long']], 'ListHead' : [ 0x18, ['pointer', ['_LIST_ENTRY']]], 'ListsInUseUlong' : [ 0x1c, ['pointer', ['unsigned long']]], 'ListHints' : [ 0x20, ['pointer', ['pointer', ['_LIST_ENTRY']]]], } ], '_HEAP' : [ 0x248, { 'Segment' : [ 0x0, ['_HEAP_SEGMENT']], 'Entry' : [ 0x0, ['_HEAP_ENTRY']], 'SegmentSignature' : [ 0x8, ['unsigned long']], 'SegmentFlags' : [ 0xc, ['unsigned long']], 'SegmentListEntry' : [ 0x10, ['_LIST_ENTRY']], 'Heap' : [ 0x18, ['pointer', ['_HEAP']]], 'BaseAddress' : [ 0x1c, ['pointer', ['void']]], 'NumberOfPages' : [ 0x20, ['unsigned long']], 'FirstEntry' : [ 0x24, ['pointer', ['_HEAP_ENTRY']]], 'LastValidEntry' : [ 0x28, ['pointer', ['_HEAP_ENTRY']]], 'NumberOfUnCommittedPages' : [ 0x2c, ['unsigned long']], 'NumberOfUnCommittedRanges' : [ 0x30, ['unsigned long']], 'SegmentAllocatorBackTraceIndex' : [ 0x34, ['unsigned short']], 'Reserved' : [ 0x36, ['unsigned short']], 'UCRSegmentList' : [ 0x38, ['_LIST_ENTRY']], 'Flags' : [ 0x40, ['unsigned long']], 'ForceFlags' : [ 0x44, ['unsigned long']], 'CompatibilityFlags' : [ 0x48, ['unsigned long']], 'EncodeFlagMask' : [ 0x4c, ['unsigned long']], 'Encoding' : [ 0x50, ['_HEAP_ENTRY']], 'Interceptor' : [ 0x58, ['unsigned long']], 'VirtualMemoryThreshold' : [ 0x5c, ['unsigned long']], 'Signature' : [ 0x60, ['unsigned long']], 'SegmentReserve' : [ 0x64, ['unsigned long']], 'SegmentCommit' : [ 0x68, ['unsigned long']], 'DeCommitFreeBlockThreshold' : [ 0x6c, ['unsigned long']], 'DeCommitTotalFreeThreshold' : [ 0x70, ['unsigned long']], 'TotalFreeSize' : [ 0x74, ['unsigned long']], 'MaximumAllocationSize' : [ 0x78, ['unsigned long']], 'ProcessHeapsListIndex' : [ 0x7c, ['unsigned short']], 'HeaderValidateLength' : [ 0x7e, ['unsigned short']], 'HeaderValidateCopy' : [ 0x80, ['pointer', ['void']]], 'NextAvailableTagIndex' : [ 0x84, ['unsigned short']], 'MaximumTagIndex' : [ 0x86, ['unsigned short']], 'TagEntries' : [ 0x88, ['pointer', ['_HEAP_TAG_ENTRY']]], 'UCRList' : [ 0x8c, ['_LIST_ENTRY']], 'AlignRound' : [ 0x94, ['unsigned long']], 'AlignMask' : [ 0x98, ['unsigned long']], 'VirtualAllocdBlocks' : [ 0x9c, ['_LIST_ENTRY']], 'SegmentList' : [ 0xa4, ['_LIST_ENTRY']], 'AllocatorBackTraceIndex' : [ 0xac, ['unsigned short']], 'NonDedicatedListLength' : [ 0xb0, ['unsigned long']], 'BlocksIndex' : [ 0xb4, ['pointer', ['void']]], 'UCRIndex' : [ 0xb8, ['pointer', ['void']]], 'PseudoTagEntries' : [ 0xbc, ['pointer', ['_HEAP_PSEUDO_TAG_ENTRY']]], 'FreeLists' : [ 0xc0, ['_LIST_ENTRY']], 'LockVariable' : [ 0xc8, ['pointer', ['_HEAP_LOCK']]], 'CommitRoutine' : [ 0xcc, ['pointer', ['void']]], 'FrontEndHeap' : [ 0xd0, ['pointer', ['void']]], 'FrontHeapLockCount' : [ 0xd4, ['unsigned short']], 'FrontEndHeapType' : [ 0xd6, ['unsigned char']], 'RequestedFrontEndHeapType' : [ 0xd7, ['unsigned char']], 'FrontEndHeapUsageData' : [ 0xd8, ['pointer', ['unsigned short']]], 'FrontEndHeapMaximumIndex' : [ 0xdc, ['unsigned short']], 'FrontEndHeapStatusBitmap' : [ 0xde, ['array', 257, ['unsigned char']]], 'Counters' : [ 0x1e0, ['_HEAP_COUNTERS']], 'TuningParameters' : [ 0x23c, ['_HEAP_TUNING_PARAMETERS']], } ], '__unnamed_1a8a' : [ 0x38, { 'CriticalSection' : [ 0x0, ['_RTL_CRITICAL_SECTION']], 'Resource' : [ 0x0, ['_ERESOURCE']], } ], '_HEAP_LOCK' : [ 0x38, { 'Lock' : [ 0x0, ['__unnamed_1a8a']], } ], '_HEAP_ENTRY' : [ 0x8, { 'UnpackedEntry' : [ 0x0, ['_HEAP_UNPACKED_ENTRY']], 'Size' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned char']], 'SmallTagIndex' : [ 0x3, ['unsigned char']], 'SubSegmentCode' : [ 0x0, ['unsigned long']], 'PreviousSize' : [ 0x4, ['unsigned short']], 'SegmentOffset' : [ 0x6, ['unsigned char']], 'LFHFlags' : [ 0x6, ['unsigned char']], 'UnusedBytes' : [ 0x7, ['unsigned char']], 'ExtendedEntry' : [ 0x0, ['_HEAP_EXTENDED_ENTRY']], 'FunctionIndex' : [ 0x0, ['unsigned short']], 'ContextValue' : [ 0x2, ['unsigned short']], 'InterceptorValue' : [ 0x0, ['unsigned long']], 'UnusedBytesLength' : [ 0x4, ['unsigned short']], 'EntryOffset' : [ 0x6, ['unsigned char']], 'ExtendedBlockSignature' : [ 0x7, ['unsigned char']], 'Code1' : [ 0x0, ['unsigned long']], 'Code2' : [ 0x4, ['unsigned short']], 'Code3' : [ 0x6, ['unsigned char']], 'Code4' : [ 0x7, ['unsigned char']], 'Code234' : [ 0x4, ['unsigned long']], 'AgregateCode' : [ 0x0, ['unsigned long long']], } ], '_HEAP_SEGMENT' : [ 0x40, { 'Entry' : [ 0x0, ['_HEAP_ENTRY']], 'SegmentSignature' : [ 0x8, ['unsigned long']], 'SegmentFlags' : [ 0xc, ['unsigned long']], 'SegmentListEntry' : [ 0x10, ['_LIST_ENTRY']], 'Heap' : [ 0x18, ['pointer', ['_HEAP']]], 'BaseAddress' : [ 0x1c, ['pointer', ['void']]], 'NumberOfPages' : [ 0x20, ['unsigned long']], 'FirstEntry' : [ 0x24, ['pointer', ['_HEAP_ENTRY']]], 'LastValidEntry' : [ 0x28, ['pointer', ['_HEAP_ENTRY']]], 'NumberOfUnCommittedPages' : [ 0x2c, ['unsigned long']], 'NumberOfUnCommittedRanges' : [ 0x30, ['unsigned long']], 'SegmentAllocatorBackTraceIndex' : [ 0x34, ['unsigned short']], 'Reserved' : [ 0x36, ['unsigned short']], 'UCRSegmentList' : [ 0x38, ['_LIST_ENTRY']], } ], '_HEAP_VIRTUAL_ALLOC_ENTRY' : [ 0x20, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'ExtraStuff' : [ 0x8, ['_HEAP_ENTRY_EXTRA']], 'CommitSize' : [ 0x10, ['unsigned long']], 'ReserveSize' : [ 0x14, ['unsigned long']], 'BusyBlock' : [ 0x18, ['_HEAP_ENTRY']], } ], '_HEAP_FREE_ENTRY' : [ 0x10, { 'HeapEntry' : [ 0x0, ['_HEAP_ENTRY']], 'UnpackedEntry' : [ 0x0, ['_HEAP_UNPACKED_ENTRY']], 'Size' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned char']], 'SmallTagIndex' : [ 0x3, ['unsigned char']], 'SubSegmentCode' : [ 0x0, ['unsigned long']], 'PreviousSize' : [ 0x4, ['unsigned short']], 'SegmentOffset' : [ 0x6, ['unsigned char']], 'LFHFlags' : [ 0x6, ['unsigned char']], 'UnusedBytes' : [ 0x7, ['unsigned char']], 'ExtendedEntry' : [ 0x0, ['_HEAP_EXTENDED_ENTRY']], 'FunctionIndex' : [ 0x0, ['unsigned short']], 'ContextValue' : [ 0x2, ['unsigned short']], 'InterceptorValue' : [ 0x0, ['unsigned long']], 'UnusedBytesLength' : [ 0x4, ['unsigned short']], 'EntryOffset' : [ 0x6, ['unsigned char']], 'ExtendedBlockSignature' : [ 0x7, ['unsigned char']], 'Code1' : [ 0x0, ['unsigned long']], 'Code2' : [ 0x4, ['unsigned short']], 'Code3' : [ 0x6, ['unsigned char']], 'Code4' : [ 0x7, ['unsigned char']], 'Code234' : [ 0x4, ['unsigned long']], 'AgregateCode' : [ 0x0, ['unsigned long long']], 'FreeList' : [ 0x8, ['_LIST_ENTRY']], } ], '__unnamed_1add' : [ 0x4, { 'DataLength' : [ 0x0, ['short']], 'TotalLength' : [ 0x2, ['short']], } ], '__unnamed_1adf' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1add']], 'Length' : [ 0x0, ['unsigned long']], } ], '__unnamed_1ae1' : [ 0x4, { 'Type' : [ 0x0, ['short']], 'DataInfoOffset' : [ 0x2, ['short']], } ], '__unnamed_1ae3' : [ 0x4, { 's2' : [ 0x0, ['__unnamed_1ae1']], 'ZeroInit' : [ 0x0, ['unsigned long']], } ], '_PORT_MESSAGE' : [ 0x18, { 'u1' : [ 0x0, ['__unnamed_1adf']], 'u2' : [ 0x4, ['__unnamed_1ae3']], 'ClientId' : [ 0x8, ['_CLIENT_ID']], 'DoNotUseThisField' : [ 0x8, ['double']], 'MessageId' : [ 0x10, ['unsigned long']], 'ClientViewSize' : [ 0x14, ['unsigned long']], 'CallbackId' : [ 0x14, ['unsigned long']], } ], '_ALPC_MESSAGE_ATTRIBUTES' : [ 0x8, { 'AllocatedAttributes' : [ 0x0, ['unsigned long']], 'ValidAttributes' : [ 0x4, ['unsigned long']], } ], '_ALPC_HANDLE_ENTRY' : [ 0x4, { 'Object' : [ 0x0, ['pointer', ['void']]], } ], '_BLOB_TYPE' : [ 0x20, { 'ResourceId' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'BLOB_TYPE_UNKNOWN', 1: 'BLOB_TYPE_CONNECTION_INFO', 2: 'BLOB_TYPE_MESSAGE', 3: 'BLOB_TYPE_SECURITY_CONTEXT', 4: 'BLOB_TYPE_SECTION', 5: 'BLOB_TYPE_REGION', 6: 'BLOB_TYPE_VIEW', 7: 'BLOB_TYPE_RESERVE', 8: 'BLOB_TYPE_DIRECT_TRANSFER', 9: 'BLOB_TYPE_HANDLE_DATA', 10: 'BLOB_TYPE_MAX_ID'})]], 'PoolTag' : [ 0x4, ['unsigned long']], 'LookasideIndex' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['unsigned long']], 'Counters' : [ 0x10, ['pointer', ['_BLOB_COUNTERS']]], 'DeleteProcedure' : [ 0x14, ['pointer', ['void']]], 'DestroyProcedure' : [ 0x18, ['pointer', ['void']]], 'UsualSize' : [ 0x1c, ['unsigned long']], } ], '__unnamed_1b00' : [ 0x1, { 'ReferenceCache' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Lookaside' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Initializing' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Deleted' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], } ], '__unnamed_1b02' : [ 0x1, { 's1' : [ 0x0, ['__unnamed_1b00']], 'Flags' : [ 0x0, ['unsigned char']], } ], '_BLOB' : [ 0x18, { 'ResourceList' : [ 0x0, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'u1' : [ 0x8, ['__unnamed_1b02']], 'ResourceId' : [ 0x9, ['unsigned char']], 'CachedReferences' : [ 0xa, ['short']], 'ReferenceCount' : [ 0xc, ['long']], 'Pad' : [ 0x10, ['unsigned long']], 'Lock' : [ 0x14, ['_EX_PUSH_LOCK']], } ], '__unnamed_1b16' : [ 0x4, { 'Internal' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Secure' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], } ], '__unnamed_1b18' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1b16']], } ], '_KALPC_SECTION' : [ 0x28, { 'SectionObject' : [ 0x0, ['pointer', ['void']]], 'Size' : [ 0x4, ['unsigned long']], 'HandleTable' : [ 0x8, ['pointer', ['_ALPC_HANDLE_TABLE']]], 'SectionHandle' : [ 0xc, ['pointer', ['void']]], 'OwnerProcess' : [ 0x10, ['pointer', ['_EPROCESS']]], 'OwnerPort' : [ 0x14, ['pointer', ['_ALPC_PORT']]], 'u1' : [ 0x18, ['__unnamed_1b18']], 'NumberOfRegions' : [ 0x1c, ['unsigned long']], 'RegionListHead' : [ 0x20, ['_LIST_ENTRY']], } ], '__unnamed_1b21' : [ 0x4, { 'Secure' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], } ], '__unnamed_1b23' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1b21']], } ], '_KALPC_REGION' : [ 0x30, { 'RegionListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Section' : [ 0x8, ['pointer', ['_KALPC_SECTION']]], 'Offset' : [ 0xc, ['unsigned long']], 'Size' : [ 0x10, ['unsigned long']], 'ViewSize' : [ 0x14, ['unsigned long']], 'u1' : [ 0x18, ['__unnamed_1b23']], 'NumberOfViews' : [ 0x1c, ['unsigned long']], 'ViewListHead' : [ 0x20, ['_LIST_ENTRY']], 'ReadOnlyView' : [ 0x28, ['pointer', ['_KALPC_VIEW']]], 'ReadWriteView' : [ 0x2c, ['pointer', ['_KALPC_VIEW']]], } ], '__unnamed_1b29' : [ 0x4, { 'WriteAccess' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'AutoRelease' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ForceUnlink' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], } ], '__unnamed_1b2b' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1b29']], } ], '_KALPC_VIEW' : [ 0x34, { 'ViewListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Region' : [ 0x8, ['pointer', ['_KALPC_REGION']]], 'OwnerPort' : [ 0xc, ['pointer', ['_ALPC_PORT']]], 'OwnerProcess' : [ 0x10, ['pointer', ['_EPROCESS']]], 'Address' : [ 0x14, ['pointer', ['void']]], 'Size' : [ 0x18, ['unsigned long']], 'SecureViewHandle' : [ 0x1c, ['pointer', ['void']]], 'WriteAccessHandle' : [ 0x20, ['pointer', ['void']]], 'u1' : [ 0x24, ['__unnamed_1b2b']], 'NumberOfOwnerMessages' : [ 0x28, ['unsigned long']], 'ProcessViewListEntry' : [ 0x2c, ['_LIST_ENTRY']], } ], '_ALPC_COMMUNICATION_INFO' : [ 0x28, { 'ConnectionPort' : [ 0x0, ['pointer', ['_ALPC_PORT']]], 'ServerCommunicationPort' : [ 0x4, ['pointer', ['_ALPC_PORT']]], 'ClientCommunicationPort' : [ 0x8, ['pointer', ['_ALPC_PORT']]], 'CommunicationList' : [ 0xc, ['_LIST_ENTRY']], 'HandleTable' : [ 0x14, ['_ALPC_HANDLE_TABLE']], 'CloseMessage' : [ 0x24, ['pointer', ['_KALPC_MESSAGE']]], } ], '__unnamed_1b48' : [ 0x4, { 'Initialized' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Type' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 3, native_type='unsigned long')]], 'ConnectionPending' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'ConnectionRefused' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Disconnected' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Closed' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'NoFlushOnClose' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'ReturnExtendedInfo' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'Waitable' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'DynamicSecurity' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Wow64CompletionList' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'Lpc' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'LpcToLpc' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'HasCompletionList' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'HadCompletionList' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'EnableCompletionList' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], } ], '__unnamed_1b4a' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1b48']], 'State' : [ 0x0, ['unsigned long']], } ], '_ALPC_PORT' : [ 0x11c, { 'PortListEntry' : [ 0x0, ['_LIST_ENTRY']], 'CommunicationInfo' : [ 0x8, ['pointer', ['_ALPC_COMMUNICATION_INFO']]], 'OwnerProcess' : [ 0xc, ['pointer', ['_EPROCESS']]], 'CompletionPort' : [ 0x10, ['pointer', ['void']]], 'CompletionKey' : [ 0x14, ['pointer', ['void']]], 'CompletionPacketLookaside' : [ 0x18, ['pointer', ['_ALPC_COMPLETION_PACKET_LOOKASIDE']]], 'PortContext' : [ 0x1c, ['pointer', ['void']]], 'StaticSecurity' : [ 0x20, ['_SECURITY_CLIENT_CONTEXT']], 'IncomingQueueLock' : [ 0x5c, ['_EX_PUSH_LOCK']], 'MainQueue' : [ 0x60, ['_LIST_ENTRY']], 'LargeMessageQueue' : [ 0x68, ['_LIST_ENTRY']], 'PendingQueueLock' : [ 0x70, ['_EX_PUSH_LOCK']], 'PendingQueue' : [ 0x74, ['_LIST_ENTRY']], 'DirectQueueLock' : [ 0x7c, ['_EX_PUSH_LOCK']], 'DirectQueue' : [ 0x80, ['_LIST_ENTRY']], 'WaitQueueLock' : [ 0x88, ['_EX_PUSH_LOCK']], 'WaitQueue' : [ 0x8c, ['_LIST_ENTRY']], 'Semaphore' : [ 0x94, ['pointer', ['_KSEMAPHORE']]], 'DummyEvent' : [ 0x94, ['pointer', ['_KEVENT']]], 'PortAttributes' : [ 0x98, ['_ALPC_PORT_ATTRIBUTES']], 'ResourceListLock' : [ 0xc4, ['_EX_PUSH_LOCK']], 'ResourceListHead' : [ 0xc8, ['_LIST_ENTRY']], 'PortObjectLock' : [ 0xd0, ['_EX_PUSH_LOCK']], 'CompletionList' : [ 0xd4, ['pointer', ['_ALPC_COMPLETION_LIST']]], 'CallbackObject' : [ 0xd8, ['pointer', ['_CALLBACK_OBJECT']]], 'CallbackContext' : [ 0xdc, ['pointer', ['void']]], 'CanceledQueue' : [ 0xe0, ['_LIST_ENTRY']], 'SequenceNo' : [ 0xe8, ['long']], 'ReferenceNo' : [ 0xec, ['long']], 'ReferenceNoWait' : [ 0xf0, ['pointer', ['_PALPC_PORT_REFERENCE_WAIT_BLOCK']]], 'u1' : [ 0xf4, ['__unnamed_1b4a']], 'TargetQueuePort' : [ 0xf8, ['pointer', ['_ALPC_PORT']]], 'TargetSequencePort' : [ 0xfc, ['pointer', ['_ALPC_PORT']]], 'CachedMessage' : [ 0x100, ['pointer', ['_KALPC_MESSAGE']]], 'MainQueueLength' : [ 0x104, ['unsigned long']], 'LargeMessageQueueLength' : [ 0x108, ['unsigned long']], 'PendingQueueLength' : [ 0x10c, ['unsigned long']], 'DirectQueueLength' : [ 0x110, ['unsigned long']], 'CanceledQueueLength' : [ 0x114, ['unsigned long']], 'WaitQueueLength' : [ 0x118, ['unsigned long']], } ], '_ALPC_COMPLETION_LIST' : [ 0x58, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'OwnerProcess' : [ 0x8, ['pointer', ['_EPROCESS']]], 'CompletionListLock' : [ 0xc, ['_EX_PUSH_LOCK']], 'Mdl' : [ 0x10, ['pointer', ['_MDL']]], 'UserVa' : [ 0x14, ['pointer', ['void']]], 'UserLimit' : [ 0x18, ['pointer', ['void']]], 'DataUserVa' : [ 0x1c, ['pointer', ['void']]], 'SystemVa' : [ 0x20, ['pointer', ['void']]], 'TotalSize' : [ 0x24, ['unsigned long']], 'Header' : [ 0x28, ['pointer', ['_ALPC_COMPLETION_LIST_HEADER']]], 'List' : [ 0x2c, ['pointer', ['void']]], 'ListSize' : [ 0x30, ['unsigned long']], 'Bitmap' : [ 0x34, ['pointer', ['void']]], 'BitmapSize' : [ 0x38, ['unsigned long']], 'Data' : [ 0x3c, ['pointer', ['void']]], 'DataSize' : [ 0x40, ['unsigned long']], 'BitmapLimit' : [ 0x44, ['unsigned long']], 'BitmapNextHint' : [ 0x48, ['unsigned long']], 'ConcurrencyCount' : [ 0x4c, ['unsigned long']], 'AttributeFlags' : [ 0x50, ['unsigned long']], 'AttributeSize' : [ 0x54, ['unsigned long']], } ], '_OBJECT_ATTRIBUTES' : [ 0x18, { 'Length' : [ 0x0, ['unsigned long']], 'RootDirectory' : [ 0x4, ['pointer', ['void']]], 'ObjectName' : [ 0x8, ['pointer', ['_UNICODE_STRING']]], 'Attributes' : [ 0xc, ['unsigned long']], 'SecurityDescriptor' : [ 0x10, ['pointer', ['void']]], 'SecurityQualityOfService' : [ 0x14, ['pointer', ['void']]], } ], '_OBJECT_TYPE' : [ 0x90, { 'TypeList' : [ 0x0, ['_LIST_ENTRY']], 'Name' : [ 0x8, ['_UNICODE_STRING']], 'DefaultObject' : [ 0x10, ['pointer', ['void']]], 'Index' : [ 0x14, ['unsigned char']], 'TotalNumberOfObjects' : [ 0x18, ['unsigned long']], 'TotalNumberOfHandles' : [ 0x1c, ['unsigned long']], 'HighWaterNumberOfObjects' : [ 0x20, ['unsigned long']], 'HighWaterNumberOfHandles' : [ 0x24, ['unsigned long']], 'TypeInfo' : [ 0x28, ['_OBJECT_TYPE_INITIALIZER']], 'TypeLock' : [ 0x80, ['_EX_PUSH_LOCK']], 'Key' : [ 0x84, ['unsigned long']], 'CallbackList' : [ 0x88, ['_LIST_ENTRY']], } ], '_PALPC_PORT_REFERENCE_WAIT_BLOCK' : [ 0x14, { 'DesiredReferenceNoEvent' : [ 0x0, ['_KEVENT']], 'DesiredReferenceNo' : [ 0x10, ['long']], } ], '__unnamed_1b6d' : [ 0x4, { 'QueueType' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'QueuePortType' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 7, native_type='unsigned long')]], 'Canceled' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Ready' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'ReleaseMessage' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'SharedQuota' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'ReplyWaitReply' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'OwnerPortReference' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'ReserveReference' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'ReceiverReference' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'ViewAttributeRetrieved' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'InDispatch' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], } ], '__unnamed_1b6f' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1b6d']], 'State' : [ 0x0, ['unsigned long']], } ], '_KALPC_MESSAGE' : [ 0x90, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'PortQueue' : [ 0x8, ['pointer', ['_ALPC_PORT']]], 'OwnerPort' : [ 0xc, ['pointer', ['_ALPC_PORT']]], 'WaitingThread' : [ 0x10, ['pointer', ['_ETHREAD']]], 'u1' : [ 0x14, ['__unnamed_1b6f']], 'SequenceNo' : [ 0x18, ['long']], 'QuotaProcess' : [ 0x1c, ['pointer', ['_EPROCESS']]], 'QuotaBlock' : [ 0x1c, ['pointer', ['void']]], 'CancelSequencePort' : [ 0x20, ['pointer', ['_ALPC_PORT']]], 'CancelQueuePort' : [ 0x24, ['pointer', ['_ALPC_PORT']]], 'CancelSequenceNo' : [ 0x28, ['long']], 'CancelListEntry' : [ 0x2c, ['_LIST_ENTRY']], 'Reserve' : [ 0x34, ['pointer', ['_KALPC_RESERVE']]], 'MessageAttributes' : [ 0x38, ['_KALPC_MESSAGE_ATTRIBUTES']], 'DataUserVa' : [ 0x58, ['pointer', ['void']]], 'CommunicationInfo' : [ 0x5c, ['pointer', ['_ALPC_COMMUNICATION_INFO']]], 'ConnectionPort' : [ 0x60, ['pointer', ['_ALPC_PORT']]], 'ServerThread' : [ 0x64, ['pointer', ['_ETHREAD']]], 'WakeReference' : [ 0x68, ['pointer', ['void']]], 'ExtensionBuffer' : [ 0x6c, ['pointer', ['void']]], 'ExtensionBufferSize' : [ 0x70, ['unsigned long']], 'PortMessage' : [ 0x78, ['_PORT_MESSAGE']], } ], '_ALPC_DISPATCH_CONTEXT' : [ 0x24, { 'PortObject' : [ 0x0, ['pointer', ['_ALPC_PORT']]], 'Message' : [ 0x4, ['pointer', ['_KALPC_MESSAGE']]], 'CommunicationInfo' : [ 0x8, ['pointer', ['_ALPC_COMMUNICATION_INFO']]], 'TargetThread' : [ 0xc, ['pointer', ['_ETHREAD']]], 'TargetPort' : [ 0x10, ['pointer', ['_ALPC_PORT']]], 'DirectEvent' : [ 0x14, ['_KALPC_DIRECT_EVENT']], 'Flags' : [ 0x18, ['unsigned long']], 'TotalLength' : [ 0x1c, ['unsigned short']], 'Type' : [ 0x1e, ['unsigned short']], 'DataInfoOffset' : [ 0x20, ['unsigned short']], 'SignalCompletion' : [ 0x22, ['unsigned char']], 'PostedToCompletionList' : [ 0x23, ['unsigned char']], } ], '_REMOTE_PORT_VIEW' : [ 0xc, { 'Length' : [ 0x0, ['unsigned long']], 'ViewSize' : [ 0x4, ['unsigned long']], 'ViewBase' : [ 0x8, ['pointer', ['void']]], } ], '_KALPC_RESERVE' : [ 0x14, { 'OwnerPort' : [ 0x0, ['pointer', ['_ALPC_PORT']]], 'HandleTable' : [ 0x4, ['pointer', ['_ALPC_HANDLE_TABLE']]], 'Handle' : [ 0x8, ['pointer', ['void']]], 'Message' : [ 0xc, ['pointer', ['_KALPC_MESSAGE']]], 'Active' : [ 0x10, ['long']], } ], '_KALPC_HANDLE_DATA' : [ 0x20, { 'Flags' : [ 0x0, ['unsigned long']], 'ObjectType' : [ 0x4, ['unsigned long']], 'DuplicateContext' : [ 0x8, ['_OB_DUPLICATE_OBJECT_STATE']], } ], '_KALPC_MESSAGE_ATTRIBUTES' : [ 0x20, { 'ClientContext' : [ 0x0, ['pointer', ['void']]], 'ServerContext' : [ 0x4, ['pointer', ['void']]], 'PortContext' : [ 0x8, ['pointer', ['void']]], 'CancelPortContext' : [ 0xc, ['pointer', ['void']]], 'SecurityData' : [ 0x10, ['pointer', ['_KALPC_SECURITY_DATA']]], 'View' : [ 0x14, ['pointer', ['_KALPC_VIEW']]], 'HandleData' : [ 0x18, ['pointer', ['_KALPC_HANDLE_DATA']]], 'DirectEvent' : [ 0x1c, ['_KALPC_DIRECT_EVENT']], } ], '__unnamed_1bb2' : [ 0x4, { 'Revoked' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Impersonated' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], } ], '__unnamed_1bb4' : [ 0x4, { 's1' : [ 0x0, ['__unnamed_1bb2']], } ], '_KALPC_SECURITY_DATA' : [ 0x50, { 'HandleTable' : [ 0x0, ['pointer', ['_ALPC_HANDLE_TABLE']]], 'ContextHandle' : [ 0x4, ['pointer', ['void']]], 'OwningProcess' : [ 0x8, ['pointer', ['_EPROCESS']]], 'OwnerPort' : [ 0xc, ['pointer', ['_ALPC_PORT']]], 'DynamicSecurity' : [ 0x10, ['_SECURITY_CLIENT_CONTEXT']], 'u1' : [ 0x4c, ['__unnamed_1bb4']], } ], '_KALPC_DIRECT_EVENT' : [ 0x4, { 'Event' : [ 0x0, ['unsigned long']], 'Referenced' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '_IO_MINI_COMPLETION_PACKET_USER' : [ 0x28, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'PacketType' : [ 0x8, ['unsigned long']], 'KeyContext' : [ 0xc, ['pointer', ['void']]], 'ApcContext' : [ 0x10, ['pointer', ['void']]], 'IoStatus' : [ 0x14, ['long']], 'IoStatusInformation' : [ 0x18, ['unsigned long']], 'MiniPacketCallback' : [ 0x1c, ['pointer', ['void']]], 'Context' : [ 0x20, ['pointer', ['void']]], 'Allocated' : [ 0x24, ['unsigned char']], } ], '_IOP_IRP_EXTENSION' : [ 0x28, { 'ExtensionFlags' : [ 0x0, ['unsigned short']], 'Allocated' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'PropagateId' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'SpareBits' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 16, native_type='unsigned short')]], 'TypesAllocated' : [ 0x2, ['unsigned short']], 'GenericExtension' : [ 0x4, ['array', 4, ['unsigned char']]], 'VerifierContext' : [ 0x8, ['pointer', ['void']]], 'ActivityId' : [ 0xc, ['_GUID']], 'Timestamp' : [ 0x1c, ['_LARGE_INTEGER']], 'ZeroingOffset' : [ 0x1c, ['unsigned long']], 'FsTrackOffsetBlob' : [ 0x1c, ['pointer', ['_IO_IRP_EXT_TRACK_OFFSET_HEADER']]], 'FsTrackedOffset' : [ 0x20, ['long long']], } ], '_DRIVER_OBJECT' : [ 0xa8, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'Flags' : [ 0x8, ['unsigned long']], 'DriverStart' : [ 0xc, ['pointer', ['void']]], 'DriverSize' : [ 0x10, ['unsigned long']], 'DriverSection' : [ 0x14, ['pointer', ['void']]], 'DriverExtension' : [ 0x18, ['pointer', ['_DRIVER_EXTENSION']]], 'DriverName' : [ 0x1c, ['_UNICODE_STRING']], 'HardwareDatabase' : [ 0x24, ['pointer', ['_UNICODE_STRING']]], 'FastIoDispatch' : [ 0x28, ['pointer', ['_FAST_IO_DISPATCH']]], 'DriverInit' : [ 0x2c, ['pointer', ['void']]], 'DriverStartIo' : [ 0x30, ['pointer', ['void']]], 'DriverUnload' : [ 0x34, ['pointer', ['void']]], 'MajorFunction' : [ 0x38, ['array', 28, ['pointer', ['void']]]], } ], '_FILE_SEGMENT_ELEMENT' : [ 0x8, { 'Buffer' : [ 0x0, ['pointer64', ['void']]], 'Alignment' : [ 0x0, ['unsigned long long']], } ], '_RELATIVE_SYMLINK_INFO' : [ 0x14, { 'ExposedNamespaceLength' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'DeviceNameLength' : [ 0x4, ['unsigned short']], 'Reserved' : [ 0x6, ['unsigned short']], 'InteriorMountPoint' : [ 0x8, ['pointer', ['_RELATIVE_SYMLINK_INFO']]], 'OpenedName' : [ 0xc, ['_UNICODE_STRING']], } ], '_ECP_LIST' : [ 0x10, { 'Signature' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x4, ['unsigned long']], 'EcpList' : [ 0x8, ['_LIST_ENTRY']], } ], '_IOP_FILE_OBJECT_EXTENSION' : [ 0x24, { 'FoExtFlags' : [ 0x0, ['unsigned long']], 'FoExtPerTypeExtension' : [ 0x4, ['array', 7, ['pointer', ['void']]]], 'FoIoPriorityHint' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'IopIoPriorityNotSet', 1: 'IopIoPriorityVeryLow', 2: 'IopIoPriorityLow', 3: 'IopIoPriorityNormal', 4: 'IopIoPriorityHigh', 5: 'IopIoPriorityCritical', 6: 'MaxIopIoPriorityTypes'})]], } ], '_OPEN_PACKET' : [ 0x70, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'FileObject' : [ 0x4, ['pointer', ['_FILE_OBJECT']]], 'FinalStatus' : [ 0x8, ['long']], 'Information' : [ 0xc, ['unsigned long']], 'ParseCheck' : [ 0x10, ['unsigned long']], 'RelatedFileObject' : [ 0x14, ['pointer', ['_FILE_OBJECT']]], 'ReferencedDeviceObject' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], 'OriginalAttributes' : [ 0x18, ['pointer', ['_OBJECT_ATTRIBUTES']]], 'AllocationSize' : [ 0x20, ['_LARGE_INTEGER']], 'CreateOptions' : [ 0x28, ['unsigned long']], 'FileAttributes' : [ 0x2c, ['unsigned short']], 'ShareAccess' : [ 0x2e, ['unsigned short']], 'EaBuffer' : [ 0x30, ['pointer', ['void']]], 'EaLength' : [ 0x34, ['unsigned long']], 'Options' : [ 0x38, ['unsigned long']], 'Disposition' : [ 0x3c, ['unsigned long']], 'BasicInformation' : [ 0x40, ['pointer', ['_FILE_BASIC_INFORMATION']]], 'NetworkInformation' : [ 0x44, ['pointer', ['_FILE_NETWORK_OPEN_INFORMATION']]], 'CreateFileType' : [ 0x48, ['Enumeration', dict(target = 'long', choices = {0: 'CreateFileTypeNone', 1: 'CreateFileTypeNamedPipe', 2: 'CreateFileTypeMailslot'})]], 'MailslotOrPipeParameters' : [ 0x4c, ['pointer', ['void']]], 'Override' : [ 0x50, ['unsigned char']], 'QueryOnly' : [ 0x51, ['unsigned char']], 'DeleteOnly' : [ 0x52, ['unsigned char']], 'FullAttributes' : [ 0x53, ['unsigned char']], 'LocalFileObject' : [ 0x54, ['pointer', ['_DUMMY_FILE_OBJECT']]], 'InternalFlags' : [ 0x58, ['unsigned long']], 'AccessMode' : [ 0x5c, ['unsigned char']], 'DriverCreateContext' : [ 0x60, ['_IO_DRIVER_CREATE_CONTEXT']], } ], '_ETW_SYSTEMTIME' : [ 0x10, { 'Year' : [ 0x0, ['unsigned short']], 'Month' : [ 0x2, ['unsigned short']], 'DayOfWeek' : [ 0x4, ['unsigned short']], 'Day' : [ 0x6, ['unsigned short']], 'Hour' : [ 0x8, ['unsigned short']], 'Minute' : [ 0xa, ['unsigned short']], 'Second' : [ 0xc, ['unsigned short']], 'Milliseconds' : [ 0xe, ['unsigned short']], } ], '_TIME_FIELDS' : [ 0x10, { 'Year' : [ 0x0, ['short']], 'Month' : [ 0x2, ['short']], 'Day' : [ 0x4, ['short']], 'Hour' : [ 0x6, ['short']], 'Minute' : [ 0x8, ['short']], 'Second' : [ 0xa, ['short']], 'Milliseconds' : [ 0xc, ['short']], 'Weekday' : [ 0xe, ['short']], } ], '__unnamed_1c7f' : [ 0x4, { 'MajorVersion' : [ 0x0, ['unsigned char']], 'MinorVersion' : [ 0x1, ['unsigned char']], 'SubVersion' : [ 0x2, ['unsigned char']], 'SubMinorVersion' : [ 0x3, ['unsigned char']], } ], '_TRACE_LOGFILE_HEADER' : [ 0x110, { 'BufferSize' : [ 0x0, ['unsigned long']], 'Version' : [ 0x4, ['unsigned long']], 'VersionDetail' : [ 0x4, ['__unnamed_1c7f']], 'ProviderVersion' : [ 0x8, ['unsigned long']], 'NumberOfProcessors' : [ 0xc, ['unsigned long']], 'EndTime' : [ 0x10, ['_LARGE_INTEGER']], 'TimerResolution' : [ 0x18, ['unsigned long']], 'MaximumFileSize' : [ 0x1c, ['unsigned long']], 'LogFileMode' : [ 0x20, ['unsigned long']], 'BuffersWritten' : [ 0x24, ['unsigned long']], 'LogInstanceGuid' : [ 0x28, ['_GUID']], 'StartBuffers' : [ 0x28, ['unsigned long']], 'PointerSize' : [ 0x2c, ['unsigned long']], 'EventsLost' : [ 0x30, ['unsigned long']], 'CpuSpeedInMHz' : [ 0x34, ['unsigned long']], 'LoggerName' : [ 0x38, ['pointer', ['unsigned short']]], 'LogFileName' : [ 0x3c, ['pointer', ['unsigned short']]], 'TimeZone' : [ 0x40, ['_RTL_TIME_ZONE_INFORMATION']], 'BootTime' : [ 0xf0, ['_LARGE_INTEGER']], 'PerfFreq' : [ 0xf8, ['_LARGE_INTEGER']], 'StartTime' : [ 0x100, ['_LARGE_INTEGER']], 'ReservedFlags' : [ 0x108, ['unsigned long']], 'BuffersLost' : [ 0x10c, ['unsigned long']], } ], '_WMI_LOGGER_CONTEXT' : [ 0x288, { 'LoggerId' : [ 0x0, ['unsigned long']], 'BufferSize' : [ 0x4, ['unsigned long']], 'MaximumEventSize' : [ 0x8, ['unsigned long']], 'LoggerMode' : [ 0xc, ['unsigned long']], 'AcceptNewEvents' : [ 0x10, ['long']], 'EventMarker' : [ 0x14, ['array', 1, ['unsigned long']]], 'ErrorMarker' : [ 0x18, ['unsigned long']], 'SizeMask' : [ 0x1c, ['unsigned long']], 'GetCpuClock' : [ 0x20, ['pointer', ['void']]], 'LoggerThread' : [ 0x24, ['pointer', ['_ETHREAD']]], 'LoggerStatus' : [ 0x28, ['long']], 'FailureReason' : [ 0x2c, ['unsigned long']], 'BufferQueue' : [ 0x30, ['_ETW_BUFFER_QUEUE']], 'OverflowQueue' : [ 0x3c, ['_ETW_BUFFER_QUEUE']], 'GlobalList' : [ 0x48, ['_LIST_ENTRY']], 'ProviderBinaryList' : [ 0x50, ['_LIST_ENTRY']], 'BatchedBufferList' : [ 0x58, ['pointer', ['_WMI_BUFFER_HEADER']]], 'CurrentBuffer' : [ 0x58, ['_EX_FAST_REF']], 'LoggerName' : [ 0x5c, ['_UNICODE_STRING']], 'LogFileName' : [ 0x64, ['_UNICODE_STRING']], 'LogFilePattern' : [ 0x6c, ['_UNICODE_STRING']], 'NewLogFileName' : [ 0x74, ['_UNICODE_STRING']], 'ClockType' : [ 0x7c, ['unsigned long']], 'LastFlushedBuffer' : [ 0x80, ['unsigned long']], 'FlushTimer' : [ 0x84, ['unsigned long']], 'FlushThreshold' : [ 0x88, ['unsigned long']], 'ByteOffset' : [ 0x90, ['_LARGE_INTEGER']], 'MinimumBuffers' : [ 0x98, ['unsigned long']], 'BuffersAvailable' : [ 0x9c, ['long']], 'NumberOfBuffers' : [ 0xa0, ['long']], 'MaximumBuffers' : [ 0xa4, ['unsigned long']], 'EventsLost' : [ 0xa8, ['unsigned long']], 'PeakBuffersCount' : [ 0xac, ['long']], 'BuffersWritten' : [ 0xb0, ['unsigned long']], 'LogBuffersLost' : [ 0xb4, ['unsigned long']], 'RealTimeBuffersDelivered' : [ 0xb8, ['unsigned long']], 'RealTimeBuffersLost' : [ 0xbc, ['unsigned long']], 'SequencePtr' : [ 0xc0, ['pointer', ['long']]], 'LocalSequence' : [ 0xc4, ['unsigned long']], 'InstanceGuid' : [ 0xc8, ['_GUID']], 'MaximumFileSize' : [ 0xd8, ['unsigned long']], 'FileCounter' : [ 0xdc, ['long']], 'PoolType' : [ 0xe0, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPoolBase', 1: 'PagedPool', 2: 'NonPagedPoolBaseMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolBaseCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolBaseCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 516: 'NonPagedPoolNxCacheAligned', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 512: 'NonPagedPoolNx', 544: 'NonPagedPoolSessionNx', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'ReferenceTime' : [ 0xe8, ['_ETW_REF_CLOCK']], 'CollectionOn' : [ 0xf8, ['long']], 'ProviderInfoSize' : [ 0xfc, ['unsigned long']], 'Consumers' : [ 0x100, ['_LIST_ENTRY']], 'NumConsumers' : [ 0x108, ['unsigned long']], 'TransitionConsumer' : [ 0x10c, ['pointer', ['_ETW_REALTIME_CONSUMER']]], 'RealtimeLogfileHandle' : [ 0x110, ['pointer', ['void']]], 'RealtimeLogfileName' : [ 0x114, ['_UNICODE_STRING']], 'RealtimeWriteOffset' : [ 0x120, ['_LARGE_INTEGER']], 'RealtimeReadOffset' : [ 0x128, ['_LARGE_INTEGER']], 'RealtimeLogfileSize' : [ 0x130, ['_LARGE_INTEGER']], 'RealtimeLogfileUsage' : [ 0x138, ['unsigned long long']], 'RealtimeMaximumFileSize' : [ 0x140, ['unsigned long long']], 'RealtimeBuffersSaved' : [ 0x148, ['unsigned long']], 'RealtimeReferenceTime' : [ 0x150, ['_ETW_REF_CLOCK']], 'NewRTEventsLost' : [ 0x160, ['Enumeration', dict(target = 'long', choices = {0: 'EtwRtEventNoLoss', 1: 'EtwRtEventLost', 2: 'EtwRtBufferLost', 3: 'EtwRtBackupLost', 4: 'EtwRtEventLossMax'})]], 'LoggerEvent' : [ 0x164, ['_KEVENT']], 'FlushEvent' : [ 0x174, ['_KEVENT']], 'FlushTimeOutTimer' : [ 0x188, ['_KTIMER']], 'LoggerDpc' : [ 0x1b0, ['_KDPC']], 'LoggerMutex' : [ 0x1d0, ['_KMUTANT']], 'LoggerLock' : [ 0x1f0, ['_EX_PUSH_LOCK']], 'BufferListSpinLock' : [ 0x1f4, ['unsigned long']], 'BufferListPushLock' : [ 0x1f4, ['_EX_PUSH_LOCK']], 'ClientSecurityContext' : [ 0x1f8, ['_SECURITY_CLIENT_CONTEXT']], 'TokenAccessInformation' : [ 0x234, ['pointer', ['_TOKEN_ACCESS_INFORMATION']]], 'SecurityDescriptor' : [ 0x238, ['_EX_FAST_REF']], 'StartTime' : [ 0x240, ['_LARGE_INTEGER']], 'LogFileHandle' : [ 0x248, ['pointer', ['void']]], 'BufferSequenceNumber' : [ 0x250, ['long long']], 'Flags' : [ 0x258, ['unsigned long']], 'Persistent' : [ 0x258, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'AutoLogger' : [ 0x258, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'FsReady' : [ 0x258, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'RealTime' : [ 0x258, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Wow' : [ 0x258, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'KernelTrace' : [ 0x258, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'NoMoreEnable' : [ 0x258, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'StackTracing' : [ 0x258, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'ErrorLogged' : [ 0x258, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'RealtimeLoggerContextFreed' : [ 0x258, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'PebsTracing' : [ 0x258, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'PmcCounters' : [ 0x258, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PageAlignBuffers' : [ 0x258, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'StackLookasideListAllocated' : [ 0x258, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'SecurityTrace' : [ 0x258, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'SpareFlags1' : [ 0x258, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'SystemLoggerIndex' : [ 0x258, ['BitField', dict(start_bit = 16, end_bit = 24, native_type='unsigned long')]], 'StackCaching' : [ 0x258, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'SpareFlags2' : [ 0x258, ['BitField', dict(start_bit = 25, end_bit = 32, native_type='unsigned long')]], 'RequestFlag' : [ 0x25c, ['unsigned long']], 'DbgRequestNewFile' : [ 0x25c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DbgRequestUpdateFile' : [ 0x25c, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'DbgRequestFlush' : [ 0x25c, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'DbgRequestDisableRealtime' : [ 0x25c, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'DbgRequestDisconnectConsumer' : [ 0x25c, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'DbgRequestConnectConsumer' : [ 0x25c, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'DbgRequestNotifyConsumer' : [ 0x25c, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'DbgRequestUpdateHeader' : [ 0x25c, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'DbgRequestDeferredFlush' : [ 0x25c, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'DbgRequestDeferredFlushTimer' : [ 0x25c, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'DbgRequestFlushTimer' : [ 0x25c, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'DbgRequestUpdateDebugger' : [ 0x25c, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'DbgSpareRequestFlags' : [ 0x25c, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], 'HookIdMap' : [ 0x260, ['_RTL_BITMAP']], 'StackCache' : [ 0x268, ['pointer', ['_ETW_STACK_CACHE']]], 'PmcData' : [ 0x26c, ['pointer', ['_ETW_PMC_SUPPORT']]], 'WinRtProviderBinaryList' : [ 0x270, ['_LIST_ENTRY']], 'ScratchArray' : [ 0x278, ['pointer', ['pointer', ['_WMI_BUFFER_HEADER']]]], 'DisallowedGuids' : [ 0x27c, ['_DISALLOWED_GUIDS']], 'ServerSilo' : [ 0x284, ['pointer', ['_ESILO']]], } ], '_ETW_PMC_SUPPORT' : [ 0x24, { 'Source' : [ 0x0, ['array', -16, ['Enumeration', dict(target = 'long', choices = {0: 'ProfileTime', 1: 'ProfileAlignmentFixup', 2: 'ProfileTotalIssues', 3: 'ProfilePipelineDry', 4: 'ProfileLoadInstructions', 5: 'ProfilePipelineFrozen', 6: 'ProfileBranchInstructions', 7: 'ProfileTotalNonissues', 8: 'ProfileDcacheMisses', 9: 'ProfileIcacheMisses', 10: 'ProfileCacheMisses', 11: 'ProfileBranchMispredictions', 12: 'ProfileStoreInstructions', 13: 'ProfileFpInstructions', 14: 'ProfileIntegerInstructions', 15: 'Profile2Issue', 16: 'Profile3Issue', 17: 'Profile4Issue', 18: 'ProfileSpecialInstructions', 19: 'ProfileTotalCycles', 20: 'ProfileIcacheIssues', 21: 'ProfileDcacheAccesses', 22: 'ProfileMemoryBarrierCycles', 23: 'ProfileLoadLinkedIssues', 24: 'ProfileMaximum'})]]], 'HookIdCount' : [ 0x10, ['unsigned long']], 'HookId' : [ 0x14, ['array', 4, ['unsigned short']]], 'CountersCount' : [ 0x1c, ['unsigned long']], 'ProcessorCtrs' : [ 0x20, ['array', 1, ['pointer', ['_HAL_PMC_COUNTERS']]]], } ], '_ETW_LOGGER_HANDLE' : [ 0x1, { 'DereferenceAndLeave' : [ 0x0, ['unsigned char']], } ], '_ETW_SILODRIVERSTATE' : [ 0x190, { 'EtwpSecurityProviderPID' : [ 0x0, ['unsigned long']], 'EtwpSecurityProviderGuidEntry' : [ 0x8, ['_ETW_GUID_ENTRY']], 'AuditLoggerId' : [ 0x168, ['unsigned long']], 'EtwPsProvRegHandle' : [ 0x170, ['unsigned long long']], 'EtwpSecurityLoggers' : [ 0x178, ['array', 8, ['unsigned short']]], 'EtwpSecurityProviderEnableMask' : [ 0x188, ['unsigned char']], 'EtwpShutdownInProgress' : [ 0x189, ['unsigned char']], } ], '_LUID_AND_ATTRIBUTES' : [ 0xc, { 'Luid' : [ 0x0, ['_LUID']], 'Attributes' : [ 0x8, ['unsigned long']], } ], '_TOKEN' : [ 0x298, { 'TokenSource' : [ 0x0, ['_TOKEN_SOURCE']], 'TokenId' : [ 0x10, ['_LUID']], 'AuthenticationId' : [ 0x18, ['_LUID']], 'ParentTokenId' : [ 0x20, ['_LUID']], 'ExpirationTime' : [ 0x28, ['_LARGE_INTEGER']], 'TokenLock' : [ 0x30, ['pointer', ['_ERESOURCE']]], 'ModifiedId' : [ 0x34, ['_LUID']], 'Privileges' : [ 0x40, ['_SEP_TOKEN_PRIVILEGES']], 'AuditPolicy' : [ 0x58, ['_SEP_AUDIT_POLICY']], 'SessionId' : [ 0x78, ['unsigned long']], 'UserAndGroupCount' : [ 0x7c, ['unsigned long']], 'RestrictedSidCount' : [ 0x80, ['unsigned long']], 'VariableLength' : [ 0x84, ['unsigned long']], 'DynamicCharged' : [ 0x88, ['unsigned long']], 'DynamicAvailable' : [ 0x8c, ['unsigned long']], 'DefaultOwnerIndex' : [ 0x90, ['unsigned long']], 'UserAndGroups' : [ 0x94, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'RestrictedSids' : [ 0x98, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'PrimaryGroup' : [ 0x9c, ['pointer', ['void']]], 'DynamicPart' : [ 0xa0, ['pointer', ['unsigned long']]], 'DefaultDacl' : [ 0xa4, ['pointer', ['_ACL']]], 'TokenType' : [ 0xa8, ['Enumeration', dict(target = 'long', choices = {1: 'TokenPrimary', 2: 'TokenImpersonation'})]], 'ImpersonationLevel' : [ 0xac, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'TokenFlags' : [ 0xb0, ['unsigned long']], 'TokenInUse' : [ 0xb4, ['unsigned char']], 'IntegrityLevelIndex' : [ 0xb8, ['unsigned long']], 'MandatoryPolicy' : [ 0xbc, ['unsigned long']], 'LogonSession' : [ 0xc0, ['pointer', ['_SEP_LOGON_SESSION_REFERENCES']]], 'OriginatingLogonSession' : [ 0xc4, ['_LUID']], 'SidHash' : [ 0xcc, ['_SID_AND_ATTRIBUTES_HASH']], 'RestrictedSidHash' : [ 0x154, ['_SID_AND_ATTRIBUTES_HASH']], 'pSecurityAttributes' : [ 0x1dc, ['pointer', ['_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION']]], 'Package' : [ 0x1e0, ['pointer', ['void']]], 'Capabilities' : [ 0x1e4, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'CapabilityCount' : [ 0x1e8, ['unsigned long']], 'CapabilitiesHash' : [ 0x1ec, ['_SID_AND_ATTRIBUTES_HASH']], 'LowboxNumberEntry' : [ 0x274, ['pointer', ['_SEP_LOWBOX_NUMBER_ENTRY']]], 'LowboxHandlesEntry' : [ 0x278, ['pointer', ['_SEP_LOWBOX_HANDLES_ENTRY']]], 'pClaimAttributes' : [ 0x27c, ['pointer', ['_AUTHZBASEP_CLAIM_ATTRIBUTES_COLLECTION']]], 'TrustLevelSid' : [ 0x280, ['pointer', ['void']]], 'TrustLinkedToken' : [ 0x284, ['pointer', ['_TOKEN']]], 'IntegrityLevelSidValue' : [ 0x288, ['pointer', ['void']]], 'TokenSidValues' : [ 0x28c, ['pointer', ['_SEP_SID_VALUES_BLOCK']]], 'VariablePart' : [ 0x290, ['unsigned long']], } ], '_SEP_LOGON_SESSION_REFERENCES' : [ 0x5c, { 'Next' : [ 0x0, ['pointer', ['_SEP_LOGON_SESSION_REFERENCES']]], 'LogonId' : [ 0x4, ['_LUID']], 'BuddyLogonId' : [ 0xc, ['_LUID']], 'ReferenceCount' : [ 0x14, ['long']], 'Flags' : [ 0x18, ['unsigned long']], 'pDeviceMap' : [ 0x1c, ['pointer', ['_DEVICE_MAP']]], 'Token' : [ 0x20, ['pointer', ['void']]], 'AccountName' : [ 0x24, ['_UNICODE_STRING']], 'AuthorityName' : [ 0x2c, ['_UNICODE_STRING']], 'LowBoxHandlesTable' : [ 0x34, ['_SEP_LOWBOX_HANDLES_TABLE']], 'SharedDataLock' : [ 0x3c, ['_EX_PUSH_LOCK']], 'SharedClaimAttributes' : [ 0x40, ['pointer', ['_AUTHZBASEP_CLAIM_ATTRIBUTES_COLLECTION']]], 'SharedSidValues' : [ 0x44, ['pointer', ['_SEP_SID_VALUES_BLOCK']]], 'RevocationBlock' : [ 0x48, ['_OB_HANDLE_REVOCATION_BLOCK']], 'ServerSilo' : [ 0x58, ['pointer', ['_ESILO']]], } ], '_OBJECT_HEADER' : [ 0x20, { 'PointerCount' : [ 0x0, ['long']], 'HandleCount' : [ 0x4, ['long']], 'NextToFree' : [ 0x4, ['pointer', ['void']]], 'Lock' : [ 0x8, ['_EX_PUSH_LOCK']], 'TypeIndex' : [ 0xc, ['unsigned char']], 'TraceFlags' : [ 0xd, ['unsigned char']], 'DbgRefTrace' : [ 0xd, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'DbgTracePermanent' : [ 0xd, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'InfoMask' : [ 0xe, ['unsigned char']], 'Flags' : [ 0xf, ['unsigned char']], 'NewObject' : [ 0xf, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'KernelObject' : [ 0xf, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'KernelOnlyAccess' : [ 0xf, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'ExclusiveObject' : [ 0xf, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'PermanentObject' : [ 0xf, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'DefaultSecurityQuota' : [ 0xf, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'SingleHandleEntry' : [ 0xf, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'DeletedInline' : [ 0xf, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'ObjectCreateInfo' : [ 0x10, ['pointer', ['_OBJECT_CREATE_INFORMATION']]], 'QuotaBlockCharged' : [ 0x10, ['pointer', ['void']]], 'SecurityDescriptor' : [ 0x14, ['pointer', ['void']]], 'Body' : [ 0x18, ['_QUAD']], } ], '_OBJECT_HEADER_QUOTA_INFO' : [ 0x10, { 'PagedPoolCharge' : [ 0x0, ['unsigned long']], 'NonPagedPoolCharge' : [ 0x4, ['unsigned long']], 'SecurityDescriptorCharge' : [ 0x8, ['unsigned long']], 'SecurityDescriptorQuotaBlock' : [ 0xc, ['pointer', ['void']]], } ], '_OBJECT_HEADER_PROCESS_INFO' : [ 0x8, { 'ExclusiveProcess' : [ 0x0, ['pointer', ['_EPROCESS']]], 'Reserved' : [ 0x4, ['unsigned long']], } ], '_OBJECT_HEADER_HANDLE_INFO' : [ 0x8, { 'HandleCountDataBase' : [ 0x0, ['pointer', ['_OBJECT_HANDLE_COUNT_DATABASE']]], 'SingleEntry' : [ 0x0, ['_OBJECT_HANDLE_COUNT_ENTRY']], } ], '_OBJECT_HEADER_NAME_INFO' : [ 0x10, { 'Directory' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY']]], 'Name' : [ 0x4, ['_UNICODE_STRING']], 'ReferenceCount' : [ 0xc, ['long']], } ], '_OBJECT_HEADER_CREATOR_INFO' : [ 0x10, { 'TypeList' : [ 0x0, ['_LIST_ENTRY']], 'CreatorUniqueProcess' : [ 0x8, ['pointer', ['void']]], 'CreatorBackTraceIndex' : [ 0xc, ['unsigned short']], 'Reserved' : [ 0xe, ['unsigned short']], } ], '_OBJECT_HEADER_AUDIT_INFO' : [ 0x8, { 'SecurityDescriptor' : [ 0x0, ['pointer', ['void']]], 'Reserved' : [ 0x4, ['unsigned long']], } ], '_OBJECT_HEADER_HANDLE_REVOCATION_INFO' : [ 0x10, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'RevocationBlock' : [ 0x8, ['pointer', ['_OB_HANDLE_REVOCATION_BLOCK']]], 'Padding1' : [ 0xc, ['array', 4, ['unsigned char']]], } ], '_OBP_LOOKUP_CONTEXT' : [ 0x18, { 'Directory' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY']]], 'Object' : [ 0x4, ['pointer', ['void']]], 'EntryLink' : [ 0x8, ['pointer', ['pointer', ['_OBJECT_DIRECTORY_ENTRY']]]], 'HashValue' : [ 0xc, ['unsigned long']], 'HashIndex' : [ 0x10, ['unsigned short']], 'DirectoryLocked' : [ 0x12, ['unsigned char']], 'LockedExclusive' : [ 0x13, ['unsigned char']], 'LockStateSignature' : [ 0x14, ['unsigned long']], } ], '_OBJECT_DIRECTORY' : [ 0xac, { 'HashBuckets' : [ 0x0, ['array', 37, ['pointer', ['_OBJECT_DIRECTORY_ENTRY']]]], 'Lock' : [ 0x94, ['_EX_PUSH_LOCK']], 'DeviceMap' : [ 0x98, ['pointer', ['_DEVICE_MAP']]], 'ShadowDirectory' : [ 0x9c, ['pointer', ['_OBJECT_DIRECTORY']]], 'SessionId' : [ 0xa0, ['unsigned long']], 'NamespaceEntry' : [ 0xa4, ['pointer', ['void']]], 'Flags' : [ 0xa8, ['unsigned long']], } ], '_OBP_SILODRIVERSTATE' : [ 0x74, { 'SystemDeviceMap' : [ 0x0, ['pointer', ['_DEVICE_MAP']]], 'SystemDosDeviceState' : [ 0x4, ['_OBP_SYSTEM_DOS_DEVICE_STATE']], 'DeviceMapLock' : [ 0x70, ['_EX_PUSH_LOCK']], } ], '_DEVICE_MAP' : [ 0x34, { 'DosDevicesDirectory' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY']]], 'GlobalDosDevicesDirectory' : [ 0x4, ['pointer', ['_OBJECT_DIRECTORY']]], 'DosDevicesDirectoryHandle' : [ 0x8, ['pointer', ['void']]], 'ReferenceCount' : [ 0xc, ['long']], 'DriveMap' : [ 0x10, ['unsigned long']], 'DriveType' : [ 0x14, ['array', 32, ['unsigned char']]], } ], '_WHEAP_INFO_BLOCK' : [ 0xc, { 'ErrorSourceCount' : [ 0x0, ['unsigned long']], 'ErrorSourceTable' : [ 0x4, ['pointer', ['_WHEAP_ERROR_SOURCE_TABLE']]], 'WorkQueue' : [ 0x8, ['pointer', ['_WHEAP_WORK_QUEUE']]], } ], '_WHEAP_ERROR_SOURCE' : [ 0x418, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'FailedAllocations' : [ 0x8, ['unsigned long']], 'PlatformErrorSourceId' : [ 0xc, ['unsigned long']], 'ErrorCount' : [ 0x10, ['long']], 'RecordCount' : [ 0x14, ['unsigned long']], 'RecordLength' : [ 0x18, ['unsigned long']], 'PoolTag' : [ 0x1c, ['unsigned long']], 'Type' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSrcTypeMCE', 1: 'WheaErrSrcTypeCMC', 2: 'WheaErrSrcTypeCPE', 3: 'WheaErrSrcTypeNMI', 4: 'WheaErrSrcTypePCIe', 5: 'WheaErrSrcTypeGeneric', 6: 'WheaErrSrcTypeINIT', 7: 'WheaErrSrcTypeBOOT', 8: 'WheaErrSrcTypeSCIGeneric', 9: 'WheaErrSrcTypeIPFMCA', 10: 'WheaErrSrcTypeIPFCMC', 11: 'WheaErrSrcTypeIPFCPE', 12: 'WheaErrSrcTypeMax'})]], 'Records' : [ 0x24, ['pointer', ['_WHEAP_ERROR_RECORD_WRAPPER']]], 'Context' : [ 0x28, ['pointer', ['void']]], 'SectionCount' : [ 0x2c, ['unsigned long']], 'SectionLength' : [ 0x30, ['unsigned long']], 'TickCountAtLastError' : [ 0x38, ['_LARGE_INTEGER']], 'AccumulatedErrors' : [ 0x40, ['unsigned long']], 'TotalErrors' : [ 0x44, ['unsigned long']], 'Deferred' : [ 0x48, ['unsigned char']], 'Descriptor' : [ 0x49, ['_WHEA_ERROR_SOURCE_DESCRIPTOR']], } ], '_WHEAP_ERROR_RECORD_WRAPPER' : [ 0xe4, { 'WorkEntry' : [ 0x0, ['_LIST_ENTRY']], 'Length' : [ 0x8, ['unsigned long']], 'ProcessorNumber' : [ 0xc, ['unsigned long']], 'Flags' : [ 0x10, ['_WHEAP_ERROR_RECORD_WRAPPER_FLAGS']], 'InUse' : [ 0x14, ['long']], 'ErrorSource' : [ 0x18, ['pointer', ['_WHEAP_ERROR_SOURCE']]], 'ErrorRecord' : [ 0x1c, ['_WHEA_ERROR_RECORD']], } ], '_KSECONDARY_IDT_ENTRY' : [ 0x1c, { 'SpinLock' : [ 0x0, ['unsigned long']], 'ConnectLock' : [ 0x4, ['_KEVENT']], 'LineMasked' : [ 0x14, ['unsigned char']], 'InterruptList' : [ 0x18, ['pointer', ['_KINTERRUPT']]], } ], '_WNF_STATE_NAME' : [ 0x8, { 'Data' : [ 0x0, ['array', 2, ['unsigned long']]], } ], '_PS_CLIENT_SECURITY_CONTEXT' : [ 0x4, { 'ImpersonationData' : [ 0x0, ['unsigned long']], 'ImpersonationToken' : [ 0x0, ['pointer', ['void']]], 'ImpersonationLevel' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'EffectiveOnly' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], } ], '_DBGKD_ANY_CONTROL_SET' : [ 0x1c, { 'X86ControlSet' : [ 0x0, ['_X86_DBGKD_CONTROL_SET']], 'AlphaControlSet' : [ 0x0, ['unsigned long']], 'IA64ControlSet' : [ 0x0, ['_IA64_DBGKD_CONTROL_SET']], 'Amd64ControlSet' : [ 0x0, ['_AMD64_DBGKD_CONTROL_SET']], 'ArmControlSet' : [ 0x0, ['_ARM_DBGKD_CONTROL_SET']], 'Arm64ControlSet' : [ 0x0, ['_ARM64_DBGKD_CONTROL_SET']], 'ArmCeControlSet' : [ 0x0, ['_ARMCE_DBGKD_CONTROL_SET']], 'PpcControlSet' : [ 0x0, ['_PPC_DBGKD_CONTROL_SET']], } ], '_MI_VERIFIER_POOL_HEADER' : [ 0x4, { 'VerifierPoolEntry' : [ 0x0, ['pointer', ['_VI_POOL_ENTRY']]], } ], '_POP_FX_PLUGIN' : [ 0x70, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Version' : [ 0x8, ['unsigned long']], 'Flags' : [ 0x10, ['unsigned long long']], 'WorkQueue' : [ 0x18, ['_KQUEUE']], 'AcceptDeviceNotification' : [ 0x40, ['pointer', ['void']]], 'AcceptProcessorNotification' : [ 0x44, ['pointer', ['void']]], 'AcceptAcpiNotification' : [ 0x48, ['pointer', ['void']]], 'WorkOrderCount' : [ 0x4c, ['unsigned long']], 'WorkOrders' : [ 0x50, ['array', 1, ['_POP_FX_WORK_ORDER']]], } ], '_ARM_DBGKD_CONTROL_SET' : [ 0xc, { 'Continue' : [ 0x0, ['unsigned long']], 'CurrentSymbolStart' : [ 0x4, ['unsigned long']], 'CurrentSymbolEnd' : [ 0x8, ['unsigned long']], } ], '_LPCP_MESSAGE' : [ 0x30, { 'Entry' : [ 0x0, ['_LIST_ENTRY']], 'FreeEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Reserved0' : [ 0x4, ['unsigned long']], 'SenderPort' : [ 0x8, ['pointer', ['void']]], 'RepliedToThread' : [ 0xc, ['pointer', ['_ETHREAD']]], 'PortContext' : [ 0x10, ['pointer', ['void']]], 'Request' : [ 0x18, ['_PORT_MESSAGE']], } ], '_HARDWARE_PTE' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'Owner' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long long')]], 'Accessed' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long long')]], 'Dirty' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long long')]], 'LargePage' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long long')]], 'Global' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'reserved0' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 38, native_type='unsigned long long')]], 'reserved1' : [ 0x0, ['BitField', dict(start_bit = 38, end_bit = 64, native_type='unsigned long long')]], 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], } ], '_ALPC_PORT_ATTRIBUTES' : [ 0x2c, { 'Flags' : [ 0x0, ['unsigned long']], 'SecurityQos' : [ 0x4, ['_SECURITY_QUALITY_OF_SERVICE']], 'MaxMessageLength' : [ 0x10, ['unsigned long']], 'MemoryBandwidth' : [ 0x14, ['unsigned long']], 'MaxPoolUsage' : [ 0x18, ['unsigned long']], 'MaxSectionSize' : [ 0x1c, ['unsigned long']], 'MaxViewSize' : [ 0x20, ['unsigned long']], 'MaxTotalSectionSize' : [ 0x24, ['unsigned long']], 'DupObjectTypes' : [ 0x28, ['unsigned long']], } ], '_MI_PARTITION_SEGMENTS' : [ 0xa8, { 'DeleteSubsectionCleanup' : [ 0x0, ['_KEVENT']], 'UnusedSegmentCleanup' : [ 0x10, ['_KEVENT']], 'SubsectionDeletePtes' : [ 0x20, ['unsigned long']], 'DereferenceSegmentHeader' : [ 0x24, ['_MMDEREFERENCE_SEGMENT_HEADER']], 'DeleteOnCloseList' : [ 0x40, ['_LIST_ENTRY']], 'DeleteOnCloseTimer' : [ 0x48, ['_KTIMER']], 'DeleteOnCloseTimerActive' : [ 0x70, ['unsigned char']], 'DeleteOnCloseCount' : [ 0x74, ['unsigned long']], 'UnusedSegmentList' : [ 0x78, ['_LIST_ENTRY']], 'UnusedSubsectionList' : [ 0x80, ['_LIST_ENTRY']], 'DeleteSubsectionList' : [ 0x88, ['_LIST_ENTRY']], 'ControlAreaDeleteEvent' : [ 0x90, ['_KEVENT']], 'ControlAreaDeleteList' : [ 0xa0, ['_SINGLE_LIST_ENTRY']], } ], '_KSTACK_COUNT' : [ 0x4, { 'Value' : [ 0x0, ['long']], 'State' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'StackCount' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], } ], '_KENTROPY_TIMING_STATE' : [ 0x128, { 'EntropyCount' : [ 0x0, ['unsigned long']], 'Buffer' : [ 0x4, ['array', 64, ['unsigned long']]], 'Dpc' : [ 0x104, ['_KDPC']], 'LastDeliveredBuffer' : [ 0x124, ['unsigned long']], } ], '_HEAP_UNPACKED_ENTRY' : [ 0x8, { 'Size' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned char']], 'SmallTagIndex' : [ 0x3, ['unsigned char']], 'SubSegmentCode' : [ 0x0, ['unsigned long']], 'PreviousSize' : [ 0x4, ['unsigned short']], 'SegmentOffset' : [ 0x6, ['unsigned char']], 'LFHFlags' : [ 0x6, ['unsigned char']], 'UnusedBytes' : [ 0x7, ['unsigned char']], } ], '_PEP_ACPI_SPB_RESOURCE' : [ 0x18, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PepAcpiMemory', 1: 'PepAcpiIoPort', 2: 'PepAcpiInterrupt', 3: 'PepAcpiGpioIo', 4: 'PepAcpiGpioInt', 5: 'PepAcpiSpbI2c', 6: 'PepAcpiSpbSpi', 7: 'PepAcpiSpbUart', 8: 'PepAcpiExtendedMemory', 9: 'PepAcpiExtendedIo'})]], 'Flags' : [ 0x4, ['_PEP_ACPI_RESOURCE_FLAGS']], 'TypeSpecificFlags' : [ 0x8, ['unsigned short']], 'ResourceSourceIndex' : [ 0xa, ['unsigned char']], 'ResourceSourceName' : [ 0xc, ['pointer', ['_UNICODE_STRING']]], 'VendorData' : [ 0x10, ['pointer', ['unsigned char']]], 'VendorDataLength' : [ 0x14, ['unsigned short']], } ], '_DISPATCHER_HEADER' : [ 0x10, { 'Lock' : [ 0x0, ['long']], 'LockNV' : [ 0x0, ['long']], 'Type' : [ 0x0, ['unsigned char']], 'Signalling' : [ 0x1, ['unsigned char']], 'Size' : [ 0x2, ['unsigned char']], 'Reserved1' : [ 0x3, ['unsigned char']], 'TimerType' : [ 0x0, ['unsigned char']], 'TimerControlFlags' : [ 0x1, ['unsigned char']], 'Absolute' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Wake' : [ 0x1, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'EncodedTolerableDelay' : [ 0x1, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], 'Hand' : [ 0x2, ['unsigned char']], 'TimerMiscFlags' : [ 0x3, ['unsigned char']], 'Index' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Processor' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 6, native_type='unsigned char')]], 'Inserted' : [ 0x3, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'Expired' : [ 0x3, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'Timer2Type' : [ 0x0, ['unsigned char']], 'Timer2Flags' : [ 0x1, ['unsigned char']], 'Timer2Inserted' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Timer2Expiring' : [ 0x1, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Timer2CancelPending' : [ 0x1, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Timer2SetPending' : [ 0x1, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Timer2Running' : [ 0x1, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'Timer2Disabled' : [ 0x1, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'Timer2ReservedFlags' : [ 0x1, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], 'Timer2Reserved1' : [ 0x2, ['unsigned char']], 'Timer2Reserved2' : [ 0x3, ['unsigned char']], 'QueueType' : [ 0x0, ['unsigned char']], 'QueueControlFlags' : [ 0x1, ['unsigned char']], 'Abandoned' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'DisableIncrement' : [ 0x1, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'QueueReservedControlFlags' : [ 0x1, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], 'QueueSize' : [ 0x2, ['unsigned char']], 'QueueReserved' : [ 0x3, ['unsigned char']], 'ThreadType' : [ 0x0, ['unsigned char']], 'ThreadReserved' : [ 0x1, ['unsigned char']], 'ThreadControlFlags' : [ 0x2, ['unsigned char']], 'CycleProfiling' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'CounterProfiling' : [ 0x2, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'GroupScheduling' : [ 0x2, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'AffinitySet' : [ 0x2, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Tagged' : [ 0x2, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'EnergyProfiling' : [ 0x2, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'Instrumented' : [ 0x2, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'ThreadReservedControlFlags' : [ 0x2, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'DebugActive' : [ 0x3, ['unsigned char']], 'MutantType' : [ 0x0, ['unsigned char']], 'MutantSize' : [ 0x1, ['unsigned char']], 'DpcActive' : [ 0x2, ['unsigned char']], 'MutantReserved' : [ 0x3, ['unsigned char']], 'SignalState' : [ 0x4, ['long']], 'WaitListHead' : [ 0x8, ['_LIST_ENTRY']], } ], '_ETW_GUID_ENTRY' : [ 0x160, { 'GuidList' : [ 0x0, ['_LIST_ENTRY']], 'RefCount' : [ 0x8, ['long']], 'Guid' : [ 0xc, ['_GUID']], 'RegListHead' : [ 0x1c, ['_LIST_ENTRY']], 'SecurityDescriptor' : [ 0x24, ['pointer', ['void']]], 'LastEnable' : [ 0x28, ['_ETW_LAST_ENABLE_INFO']], 'MatchId' : [ 0x28, ['unsigned long long']], 'ProviderEnableInfo' : [ 0x38, ['_TRACE_ENABLE_INFO']], 'EnableInfo' : [ 0x58, ['array', 8, ['_TRACE_ENABLE_INFO']]], 'FilterData' : [ 0x158, ['pointer', ['_ETW_FILTER_HEADER']]], 'ServerSilo' : [ 0x15c, ['pointer', ['_ESILO']]], } ], '_VI_POOL_ENTRY' : [ 0x10, { 'PageHeader' : [ 0x0, ['_VI_POOL_PAGE_HEADER']], 'InUse' : [ 0x0, ['_VI_POOL_ENTRY_INUSE']], 'NextFree' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_MM_PAGE_ACCESS_INFO' : [ 0x8, { 'Flags' : [ 0x0, ['_MM_PAGE_ACCESS_INFO_FLAGS']], 'FileOffset' : [ 0x0, ['unsigned long long']], 'VirtualAddress' : [ 0x0, ['pointer', ['void']]], 'DontUse0' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Spare0' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'PointerProtoPte' : [ 0x4, ['pointer', ['void']]], } ], '_MI_CONTROL_AREA_WAIT_BLOCK' : [ 0x1c, { 'Next' : [ 0x0, ['pointer', ['_MI_CONTROL_AREA_WAIT_BLOCK']]], 'WaitReason' : [ 0x4, ['unsigned long']], 'WaitResponse' : [ 0x8, ['unsigned long']], 'Gate' : [ 0xc, ['_KGATE']], } ], '_HEAP_COUNTERS' : [ 0x5c, { 'TotalMemoryReserved' : [ 0x0, ['unsigned long']], 'TotalMemoryCommitted' : [ 0x4, ['unsigned long']], 'TotalMemoryLargeUCR' : [ 0x8, ['unsigned long']], 'TotalSizeInVirtualBlocks' : [ 0xc, ['unsigned long']], 'TotalSegments' : [ 0x10, ['unsigned long']], 'TotalUCRs' : [ 0x14, ['unsigned long']], 'CommittOps' : [ 0x18, ['unsigned long']], 'DeCommitOps' : [ 0x1c, ['unsigned long']], 'LockAcquires' : [ 0x20, ['unsigned long']], 'LockCollisions' : [ 0x24, ['unsigned long']], 'CommitRate' : [ 0x28, ['unsigned long']], 'DecommittRate' : [ 0x2c, ['unsigned long']], 'CommitFailures' : [ 0x30, ['unsigned long']], 'InBlockCommitFailures' : [ 0x34, ['unsigned long']], 'PollIntervalCounter' : [ 0x38, ['unsigned long']], 'DecommitsSinceLastCheck' : [ 0x3c, ['unsigned long']], 'HeapPollInterval' : [ 0x40, ['unsigned long']], 'AllocAndFreeOps' : [ 0x44, ['unsigned long']], 'AllocationIndicesActive' : [ 0x48, ['unsigned long']], 'InBlockDeccommits' : [ 0x4c, ['unsigned long']], 'InBlockDeccomitSize' : [ 0x50, ['unsigned long']], 'HighWatermarkSize' : [ 0x54, ['unsigned long']], 'LastPolledSize' : [ 0x58, ['unsigned long']], } ], '_TraceLoggingMetadata_t' : [ 0x10, { 'Signature' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned short']], 'Version' : [ 0x6, ['unsigned char']], 'Flags' : [ 0x7, ['unsigned char']], 'Magic' : [ 0x8, ['unsigned long long']], } ], '_MI_VISIBLE_PARTITION' : [ 0xb80, { 'LowestPhysicalPage' : [ 0x0, ['unsigned long']], 'HighestPhysicalPage' : [ 0x4, ['unsigned long']], 'NumberOfPhysicalPages' : [ 0x8, ['unsigned long']], 'NumberOfPagingFiles' : [ 0xc, ['unsigned long']], 'PagingFile' : [ 0x10, ['array', 16, ['pointer', ['_MMPAGING_FILE']]]], 'AvailablePages' : [ 0x80, ['unsigned long']], 'ResidentAvailablePages' : [ 0xc0, ['unsigned long']], 'TotalCommittedPages' : [ 0xc4, ['unsigned long']], 'ModifiedPageListHead' : [ 0x100, ['_MMPFNLIST']], 'ModifiedNoWritePageListHead' : [ 0x140, ['_MMPFNLIST']], 'TotalCommitLimit' : [ 0x154, ['unsigned long']], 'TotalPagesForPagingFile' : [ 0x158, ['unsigned long']], 'VadPhysicalPages' : [ 0x15c, ['unsigned long']], 'ProcessLockedFilePages' : [ 0x160, ['unsigned long']], 'ChargeCommitmentFailures' : [ 0x164, ['array', 4, ['unsigned long']]], 'PageFileTraceIndex' : [ 0x174, ['long']], 'PageFileTraces' : [ 0x178, ['array', 32, ['_MI_PAGEFILE_TRACES']]], } ], '_OB_HANDLE_REVOCATION_BLOCK' : [ 0x10, { 'RevocationInfos' : [ 0x0, ['_LIST_ENTRY']], 'Lock' : [ 0x8, ['_EX_PUSH_LOCK']], 'Rundown' : [ 0xc, ['_EX_RUNDOWN_REF']], } ], '_SYSPTES_HEADER' : [ 0x8c, { 'ListHead' : [ 0x0, ['array', 16, ['_LIST_ENTRY']]], 'Count' : [ 0x80, ['unsigned long']], 'NumberOfEntries' : [ 0x84, ['unsigned long']], 'NumberOfEntriesPeak' : [ 0x88, ['unsigned long']], } ], '_EXCEPTION_RECORD' : [ 0x50, { 'ExceptionCode' : [ 0x0, ['long']], 'ExceptionFlags' : [ 0x4, ['unsigned long']], 'ExceptionRecord' : [ 0x8, ['pointer', ['_EXCEPTION_RECORD']]], 'ExceptionAddress' : [ 0xc, ['pointer', ['void']]], 'NumberParameters' : [ 0x10, ['unsigned long']], 'ExceptionInformation' : [ 0x14, ['array', 15, ['unsigned long']]], } ], '_MI_ACTIVE_WSLE_LISTHEAD' : [ 0x8, { 'Flink' : [ 0x0, ['unsigned long']], 'Blink' : [ 0x4, ['unsigned long']], } ], '_PENDING_RELATIONS_LIST_ENTRY' : [ 0x44, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'WorkItem' : [ 0x8, ['_WORK_QUEUE_ITEM']], 'DeviceEvent' : [ 0x18, ['pointer', ['_PNP_DEVICE_EVENT_ENTRY']]], 'DeviceObject' : [ 0x1c, ['pointer', ['_DEVICE_OBJECT']]], 'RelationsList' : [ 0x20, ['pointer', ['_RELATION_LIST']]], 'EjectIrp' : [ 0x24, ['pointer', ['_IRP']]], 'Lock' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'IRPLOCK_CANCELABLE', 1: 'IRPLOCK_CANCEL_STARTED', 2: 'IRPLOCK_CANCEL_COMPLETE', 3: 'IRPLOCK_COMPLETED'})]], 'Problem' : [ 0x2c, ['unsigned long']], 'ProfileChangingEject' : [ 0x30, ['unsigned char']], 'DisplaySafeRemovalDialog' : [ 0x31, ['unsigned char']], 'LightestSleepState' : [ 0x34, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DockInterface' : [ 0x38, ['pointer', ['DOCK_INTERFACE']]], 'DequeuePending' : [ 0x3c, ['unsigned char']], 'DeleteType' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'QueryRemoveDevice', 1: 'CancelRemoveDevice', 2: 'RemoveDevice', 3: 'SurpriseRemoveDevice', 4: 'EjectDevice', 5: 'RemoveFailedDevice', 6: 'RemoveUnstartedFailedDevice', 7: 'MaxDeviceDeleteType'})]], } ], '_PPM_PLATFORM_STATE' : [ 0xc0, { 'Latency' : [ 0x0, ['unsigned long']], 'BreakEvenDuration' : [ 0x4, ['unsigned long']], 'VetoAccounting' : [ 0x8, ['_PPM_VETO_ACCOUNTING']], 'TransitionDebugger' : [ 0x1c, ['unsigned char']], 'Platform' : [ 0x1d, ['unsigned char']], 'DependencyListCount' : [ 0x20, ['unsigned long']], 'Processors' : [ 0x24, ['_KAFFINITY_EX']], 'Name' : [ 0x30, ['_UNICODE_STRING']], 'DependencyLists' : [ 0x38, ['pointer', ['_PPM_SELECTION_DEPENDENCY']]], 'Synchronization' : [ 0x3c, ['_PPM_COORDINATED_SYNCHRONIZATION']], 'EnterTime' : [ 0x40, ['unsigned long long']], 'RefCount' : [ 0x80, ['long']], 'CacheAlign0' : [ 0x80, ['array', 64, ['unsigned char']]], } ], '_MI_SECTION_IMAGE_INFORMATION' : [ 0x38, { 'ExportedImageInformation' : [ 0x0, ['_SECTION_IMAGE_INFORMATION']], 'InternalImageInformation' : [ 0x30, ['_MI_EXTRA_IMAGE_INFORMATION']], } ], '_TOKEN_ACCESS_INFORMATION' : [ 0x38, { 'SidHash' : [ 0x0, ['pointer', ['_SID_AND_ATTRIBUTES_HASH']]], 'RestrictedSidHash' : [ 0x4, ['pointer', ['_SID_AND_ATTRIBUTES_HASH']]], 'Privileges' : [ 0x8, ['pointer', ['_TOKEN_PRIVILEGES']]], 'AuthenticationId' : [ 0xc, ['_LUID']], 'TokenType' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {1: 'TokenPrimary', 2: 'TokenImpersonation'})]], 'ImpersonationLevel' : [ 0x18, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'MandatoryPolicy' : [ 0x1c, ['_TOKEN_MANDATORY_POLICY']], 'Flags' : [ 0x20, ['unsigned long']], 'AppContainerNumber' : [ 0x24, ['unsigned long']], 'PackageSid' : [ 0x28, ['pointer', ['void']]], 'CapabilitiesHash' : [ 0x2c, ['pointer', ['_SID_AND_ATTRIBUTES_HASH']]], 'TrustLevelSid' : [ 0x30, ['pointer', ['void']]], 'SecurityAttributes' : [ 0x34, ['pointer', ['void']]], } ], '_CELL_DATA' : [ 0x50, { 'u' : [ 0x0, ['_u']], } ], '_INITIAL_PRIVILEGE_SET' : [ 0x2c, { 'PrivilegeCount' : [ 0x0, ['unsigned long']], 'Control' : [ 0x4, ['unsigned long']], 'Privilege' : [ 0x8, ['array', 3, ['_LUID_AND_ATTRIBUTES']]], } ], '_HEAP_TUNING_PARAMETERS' : [ 0x8, { 'CommittThresholdShift' : [ 0x0, ['unsigned long']], 'MaxPreCommittThreshold' : [ 0x4, ['unsigned long']], } ], '_MMWSLE_NONDIRECT_HASH' : [ 0x8, { 'Key' : [ 0x0, ['pointer', ['void']]], 'Index' : [ 0x4, ['unsigned long']], } ], '_POP_FX_WORK_ORDER' : [ 0x1c, { 'WorkItem' : [ 0x0, ['_WORK_QUEUE_ITEM']], 'WorkCount' : [ 0x10, ['long']], 'Context' : [ 0x14, ['pointer', ['void']]], 'WatchdogTimerInfo' : [ 0x18, ['pointer', ['_POP_FX_WORK_ORDER_WATCHDOG_INFO']]], } ], '_SEGMENT_FLAGS' : [ 0x4, { 'TotalNumberOfPtes4132' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 10, native_type='unsigned short')]], 'Spare0' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned short')]], 'LargePages' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned short')]], 'DebugSymbolsLoaded' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned short')]], 'WriteCombined' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned short')]], 'NoCache' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned short')]], 'Short0' : [ 0x0, ['unsigned short']], 'FloppyMedia' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'DefaultProtectionMask' : [ 0x2, ['BitField', dict(start_bit = 1, end_bit = 6, native_type='unsigned char')]], 'Binary32' : [ 0x2, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'ContainsDebug' : [ 0x2, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'UChar1' : [ 0x2, ['unsigned char']], 'ForceCollision' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'ImageSigningType' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 4, native_type='unsigned char')]], 'ImageSigningLevel' : [ 0x3, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], 'UChar2' : [ 0x3, ['unsigned char']], } ], '_KTIMER_EXPIRATION_TRACE' : [ 0x10, { 'InterruptTime' : [ 0x0, ['unsigned long long']], 'PerformanceCounter' : [ 0x8, ['_LARGE_INTEGER']], } ], '_POOL_TRACKER_BIG_PAGES' : [ 0x10, { 'Va' : [ 0x0, ['unsigned long']], 'Key' : [ 0x4, ['unsigned long']], 'Pattern' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'PoolType' : [ 0x8, ['BitField', dict(start_bit = 8, end_bit = 20, native_type='unsigned long')]], 'SlushSize' : [ 0x8, ['BitField', dict(start_bit = 20, end_bit = 32, native_type='unsigned long')]], 'NumberOfBytes' : [ 0xc, ['unsigned long']], } ], 'tagSWITCH_CONTEXT_DATA' : [ 0x50, { 'ullOsMaxVersionTested' : [ 0x0, ['unsigned long long']], 'ulTargetPlatform' : [ 0x8, ['unsigned long']], 'ullContextMinimum' : [ 0x10, ['unsigned long long']], 'guPlatform' : [ 0x18, ['_GUID']], 'guMinPlatform' : [ 0x28, ['_GUID']], 'ulContextSource' : [ 0x38, ['unsigned long']], 'ulElementCount' : [ 0x3c, ['unsigned long']], 'guElements' : [ 0x40, ['array', 1, ['_GUID']]], } ], '_WHEAP_ERROR_SOURCE_TABLE' : [ 0x20, { 'Signature' : [ 0x0, ['unsigned long']], 'Count' : [ 0x4, ['long']], 'Items' : [ 0x8, ['_LIST_ENTRY']], 'InsertLock' : [ 0x10, ['_KEVENT']], } ], '_TEB_ACTIVE_FRAME' : [ 0xc, { 'Flags' : [ 0x0, ['unsigned long']], 'Previous' : [ 0x4, ['pointer', ['_TEB_ACTIVE_FRAME']]], 'Context' : [ 0x8, ['pointer', ['_TEB_ACTIVE_FRAME_CONTEXT']]], } ], '_FILE_GET_QUOTA_INFORMATION' : [ 0x14, { 'NextEntryOffset' : [ 0x0, ['unsigned long']], 'SidLength' : [ 0x4, ['unsigned long']], 'Sid' : [ 0x8, ['_SID']], } ], '_ACCESS_REASONS' : [ 0x80, { 'Data' : [ 0x0, ['array', 32, ['unsigned long']]], } ], '_CM_KEY_BODY' : [ 0x2c, { 'Type' : [ 0x0, ['unsigned long']], 'KeyControlBlock' : [ 0x4, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'NotifyBlock' : [ 0x8, ['pointer', ['_CM_NOTIFY_BLOCK']]], 'ProcessID' : [ 0xc, ['pointer', ['void']]], 'KeyBodyList' : [ 0x10, ['_LIST_ENTRY']], 'Flags' : [ 0x18, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'HandleTags' : [ 0x18, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long')]], 'KtmTrans' : [ 0x1c, ['pointer', ['void']]], 'KtmUow' : [ 0x20, ['pointer', ['_GUID']]], 'ContextListHead' : [ 0x24, ['_LIST_ENTRY']], } ], '_KWAIT_BLOCK' : [ 0x18, { 'WaitListEntry' : [ 0x0, ['_LIST_ENTRY']], 'WaitType' : [ 0x8, ['unsigned char']], 'BlockState' : [ 0x9, ['unsigned char']], 'WaitKey' : [ 0xa, ['unsigned short']], 'Thread' : [ 0xc, ['pointer', ['_KTHREAD']]], 'NotificationQueue' : [ 0xc, ['pointer', ['_KQUEUE']]], 'Object' : [ 0x10, ['pointer', ['void']]], 'SparePtr' : [ 0x14, ['pointer', ['void']]], } ], '_ARM64_DBGKD_CONTROL_SET' : [ 0x18, { 'Continue' : [ 0x0, ['unsigned long']], 'TraceFlag' : [ 0x4, ['unsigned long']], 'CurrentSymbolStart' : [ 0x8, ['unsigned long long']], 'CurrentSymbolEnd' : [ 0x10, ['unsigned long long']], } ], '_MMPTE_PROTOTYPE' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'DemandFillProto' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'HiberVerifyConverted' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'Unused1' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 8, native_type='unsigned long long')]], 'ReadOnly' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long long')]], 'Combined' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 16, native_type='unsigned long long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long long')]], 'ProtoAddress' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 64, native_type='unsigned long long')]], } ], '_WHEA_ERROR_PACKET_FLAGS' : [ 0x4, { 'PreviousError' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Reserved1' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'HypervisorError' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Simulated' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'PlatformPfaControl' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'PlatformDirectedOffline' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Reserved2' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_THERMAL_INFORMATION_EX' : [ 0x58, { 'ThermalStamp' : [ 0x0, ['unsigned long']], 'ThermalConstant1' : [ 0x4, ['unsigned long']], 'ThermalConstant2' : [ 0x8, ['unsigned long']], 'SamplingPeriod' : [ 0xc, ['unsigned long']], 'CurrentTemperature' : [ 0x10, ['unsigned long']], 'PassiveTripPoint' : [ 0x14, ['unsigned long']], 'ThermalStandbyTripPoint' : [ 0x18, ['unsigned long']], 'CriticalTripPoint' : [ 0x1c, ['unsigned long']], 'ActiveTripPointCount' : [ 0x20, ['unsigned char']], 'ActiveTripPoint' : [ 0x24, ['array', 10, ['unsigned long']]], 'S4TransitionTripPoint' : [ 0x4c, ['unsigned long']], 'MinimumThrottle' : [ 0x50, ['unsigned long']], 'OverThrottleThreshold' : [ 0x54, ['unsigned long']], } ], '__unnamed_1e51' : [ 0x4, { 'FilePointerIndex' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned long')]], 'HardFault' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Image' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'Spare0' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], } ], '__unnamed_1e53' : [ 0x4, { 'FilePointerIndex' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned long')]], 'HardFault' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Spare1' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned long')]], } ], '_MM_PAGE_ACCESS_INFO_FLAGS' : [ 0x4, { 'File' : [ 0x0, ['__unnamed_1e51']], 'Private' : [ 0x0, ['__unnamed_1e53']], } ], '_KTIMER2' : [ 0x58, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'RbNodes' : [ 0x10, ['array', 2, ['_RTL_BALANCED_NODE']]], 'ListEntry' : [ 0x10, ['_LIST_ENTRY']], 'DueTime' : [ 0x28, ['unsigned long long']], 'MaximumDueTime' : [ 0x30, ['unsigned long long']], 'Period' : [ 0x38, ['long long']], 'Callback' : [ 0x40, ['pointer', ['void']]], 'CallbackContext' : [ 0x44, ['pointer', ['void']]], 'DisableCallback' : [ 0x48, ['pointer', ['void']]], 'DisableContext' : [ 0x4c, ['pointer', ['void']]], 'AbsoluteSystemTime' : [ 0x50, ['unsigned char']], 'TypeFlags' : [ 0x51, ['unsigned char']], 'Plain' : [ 0x51, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IdleResilient' : [ 0x51, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'HighResolution' : [ 0x51, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'NoWake' : [ 0x51, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'NoWakeFinite' : [ 0x51, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'Unused' : [ 0x51, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned char')]], } ], '_VI_VERIFIER_ISSUE' : [ 0x10, { 'IssueType' : [ 0x0, ['unsigned long']], 'Address' : [ 0x4, ['pointer', ['void']]], 'Parameters' : [ 0x8, ['array', 2, ['unsigned long']]], } ], '_MMSUBSECTION_FLAGS' : [ 0x4, { 'SubsectionAccessed' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 6, native_type='unsigned short')]], 'StartingSector4132' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 16, native_type='unsigned short')]], 'SubsectionStatic' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'GlobalMemory' : [ 0x2, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'DirtyPages' : [ 0x2, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'OnDereferenceList' : [ 0x2, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'SectorEndOffset' : [ 0x2, ['BitField', dict(start_bit = 4, end_bit = 16, native_type='unsigned short')]], } ], '_EXCEPTION_POINTERS' : [ 0x8, { 'ExceptionRecord' : [ 0x0, ['pointer', ['_EXCEPTION_RECORD']]], 'ContextRecord' : [ 0x4, ['pointer', ['_CONTEXT']]], } ], '_KMUTANT' : [ 0x20, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'MutantListEntry' : [ 0x10, ['_LIST_ENTRY']], 'OwnerThread' : [ 0x18, ['pointer', ['_KTHREAD']]], 'Abandoned' : [ 0x1c, ['unsigned char']], 'ApcDisable' : [ 0x1d, ['unsigned char']], } ], '_OBJECT_REF_INFO' : [ 0x1c, { 'ObjectHeader' : [ 0x0, ['pointer', ['_OBJECT_HEADER']]], 'NextRef' : [ 0x4, ['pointer', ['void']]], 'ImageFileName' : [ 0x8, ['array', 16, ['unsigned char']]], 'NextPos' : [ 0x18, ['unsigned short']], 'MaxStacks' : [ 0x1a, ['unsigned short']], 'StackInfo' : [ 0x1c, ['array', 0, ['_OBJECT_REF_STACK_INFO']]], } ], '_HBIN' : [ 0x20, { 'Signature' : [ 0x0, ['unsigned long']], 'FileOffset' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], 'Reserved1' : [ 0xc, ['array', 2, ['unsigned long']]], 'TimeStamp' : [ 0x14, ['_LARGE_INTEGER']], 'Spare' : [ 0x1c, ['unsigned long']], } ], '_MI_IMAGE_SECURITY_REFERENCE' : [ 0xc, { 'DynamicRelocations' : [ 0x0, ['pointer', ['void']]], 'SecurityContext' : [ 0x4, ['_IMAGE_SECURITY_CONTEXT']], 'StrongImageReference' : [ 0x8, ['unsigned long']], } ], '_AUTHZBASEP_CLAIM_ATTRIBUTES_COLLECTION' : [ 0x130, { 'DeviceGroupsCount' : [ 0x0, ['unsigned long']], 'pDeviceGroups' : [ 0x4, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'RestrictedDeviceGroupsCount' : [ 0x8, ['unsigned long']], 'pRestrictedDeviceGroups' : [ 0xc, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'DeviceGroupsHash' : [ 0x10, ['_SID_AND_ATTRIBUTES_HASH']], 'RestrictedDeviceGroupsHash' : [ 0x98, ['_SID_AND_ATTRIBUTES_HASH']], 'pUserSecurityAttributes' : [ 0x120, ['pointer', ['_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION']]], 'pDeviceSecurityAttributes' : [ 0x124, ['pointer', ['_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION']]], 'pRestrictedUserSecurityAttributes' : [ 0x128, ['pointer', ['_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION']]], 'pRestrictedDeviceSecurityAttributes' : [ 0x12c, ['pointer', ['_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION']]], } ], '_HEAP_TAG_ENTRY' : [ 0x40, { 'Allocs' : [ 0x0, ['unsigned long']], 'Frees' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], 'TagIndex' : [ 0xc, ['unsigned short']], 'CreatorBackTraceIndex' : [ 0xe, ['unsigned short']], 'TagName' : [ 0x10, ['array', 24, ['wchar']]], } ], '_MMPTE_HIGHLOW' : [ 0x8, { 'LowPart' : [ 0x0, ['unsigned long']], 'HighPart' : [ 0x4, ['unsigned long']], } ], '_SECURITY_QUALITY_OF_SERVICE' : [ 0xc, { 'Length' : [ 0x0, ['unsigned long']], 'ImpersonationLevel' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'ContextTrackingMode' : [ 0x8, ['unsigned char']], 'EffectiveOnly' : [ 0x9, ['unsigned char']], } ], '_MMWSLE_FREE_ENTRY' : [ 0x4, { 'MustBeZero' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PreviousFree' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 12, native_type='unsigned long')]], 'NextFree' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], '_NT_TIB' : [ 0x1c, { 'ExceptionList' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'StackBase' : [ 0x4, ['pointer', ['void']]], 'StackLimit' : [ 0x8, ['pointer', ['void']]], 'SubSystemTib' : [ 0xc, ['pointer', ['void']]], 'FiberData' : [ 0x10, ['pointer', ['void']]], 'Version' : [ 0x10, ['unsigned long']], 'ArbitraryUserPointer' : [ 0x14, ['pointer', ['void']]], 'Self' : [ 0x18, ['pointer', ['_NT_TIB']]], } ], '_LEARNING_MODE_DATA' : [ 0x8, { 'Settings' : [ 0x0, ['unsigned long']], 'Enabled' : [ 0x4, ['unsigned char']], 'PermissiveModeEnabled' : [ 0x5, ['unsigned char']], } ], '_WHEA_REVISION' : [ 0x2, { 'MinorRevision' : [ 0x0, ['unsigned char']], 'MajorRevision' : [ 0x1, ['unsigned char']], 'AsUSHORT' : [ 0x0, ['unsigned short']], } ], '_EJOB' : [ 0x2f8, { 'Event' : [ 0x0, ['_KEVENT']], 'JobLinks' : [ 0x10, ['_LIST_ENTRY']], 'ProcessListHead' : [ 0x18, ['_LIST_ENTRY']], 'JobLock' : [ 0x20, ['_ERESOURCE']], 'TotalUserTime' : [ 0x58, ['_LARGE_INTEGER']], 'TotalKernelTime' : [ 0x60, ['_LARGE_INTEGER']], 'TotalCycleTime' : [ 0x68, ['_LARGE_INTEGER']], 'ThisPeriodTotalUserTime' : [ 0x70, ['_LARGE_INTEGER']], 'ThisPeriodTotalKernelTime' : [ 0x78, ['_LARGE_INTEGER']], 'TotalContextSwitches' : [ 0x80, ['unsigned long long']], 'TotalPageFaultCount' : [ 0x88, ['unsigned long']], 'TotalProcesses' : [ 0x8c, ['unsigned long']], 'ActiveProcesses' : [ 0x90, ['unsigned long']], 'TotalTerminatedProcesses' : [ 0x94, ['unsigned long']], 'PerProcessUserTimeLimit' : [ 0x98, ['_LARGE_INTEGER']], 'PerJobUserTimeLimit' : [ 0xa0, ['_LARGE_INTEGER']], 'MinimumWorkingSetSize' : [ 0xa8, ['unsigned long']], 'MaximumWorkingSetSize' : [ 0xac, ['unsigned long']], 'LimitFlags' : [ 0xb0, ['unsigned long']], 'ActiveProcessLimit' : [ 0xb4, ['unsigned long']], 'Affinity' : [ 0xb8, ['_KAFFINITY_EX']], 'AccessState' : [ 0xc4, ['pointer', ['_JOB_ACCESS_STATE']]], 'AccessStateQuotaReference' : [ 0xc8, ['pointer', ['void']]], 'UIRestrictionsClass' : [ 0xcc, ['unsigned long']], 'EndOfJobTimeAction' : [ 0xd0, ['unsigned long']], 'CompletionPort' : [ 0xd4, ['pointer', ['void']]], 'CompletionKey' : [ 0xd8, ['pointer', ['void']]], 'CompletionCount' : [ 0xe0, ['unsigned long long']], 'SessionId' : [ 0xe8, ['unsigned long']], 'SchedulingClass' : [ 0xec, ['unsigned long']], 'ReadOperationCount' : [ 0xf0, ['unsigned long long']], 'WriteOperationCount' : [ 0xf8, ['unsigned long long']], 'OtherOperationCount' : [ 0x100, ['unsigned long long']], 'ReadTransferCount' : [ 0x108, ['unsigned long long']], 'WriteTransferCount' : [ 0x110, ['unsigned long long']], 'OtherTransferCount' : [ 0x118, ['unsigned long long']], 'DiskIoInfo' : [ 0x120, ['_PROCESS_DISK_COUNTERS']], 'ProcessMemoryLimit' : [ 0x148, ['unsigned long']], 'JobMemoryLimit' : [ 0x14c, ['unsigned long']], 'JobTotalMemoryLimit' : [ 0x150, ['unsigned long']], 'PeakProcessMemoryUsed' : [ 0x154, ['unsigned long']], 'PeakJobMemoryUsed' : [ 0x158, ['unsigned long']], 'EffectiveAffinity' : [ 0x15c, ['_KAFFINITY_EX']], 'EffectivePerProcessUserTimeLimit' : [ 0x168, ['_LARGE_INTEGER']], 'EffectiveMinimumWorkingSetSize' : [ 0x170, ['unsigned long']], 'EffectiveMaximumWorkingSetSize' : [ 0x174, ['unsigned long']], 'EffectiveProcessMemoryLimit' : [ 0x178, ['unsigned long']], 'EffectiveProcessMemoryLimitJob' : [ 0x17c, ['pointer', ['_EJOB']]], 'EffectivePerProcessUserTimeLimitJob' : [ 0x180, ['pointer', ['_EJOB']]], 'EffectiveDiskIoRateLimitJob' : [ 0x184, ['pointer', ['_EJOB']]], 'EffectiveNetIoRateLimitJob' : [ 0x188, ['pointer', ['_EJOB']]], 'EffectiveHeapAttributionJob' : [ 0x18c, ['pointer', ['_EJOB']]], 'EffectiveLimitFlags' : [ 0x190, ['unsigned long']], 'EffectiveSchedulingClass' : [ 0x194, ['unsigned long']], 'EffectiveFreezeCount' : [ 0x198, ['unsigned long']], 'EffectiveBackgroundCount' : [ 0x19c, ['unsigned long']], 'EffectiveSwapCount' : [ 0x1a0, ['unsigned long']], 'EffectiveNotificationLimitCount' : [ 0x1a4, ['unsigned long']], 'EffectivePriorityClass' : [ 0x1a8, ['unsigned char']], 'PriorityClass' : [ 0x1a9, ['unsigned char']], 'NestingDepth' : [ 0x1aa, ['unsigned char']], 'Reserved1' : [ 0x1ab, ['array', 1, ['unsigned char']]], 'CompletionFilter' : [ 0x1ac, ['unsigned long']], 'WakeChannel' : [ 0x1b0, ['_WNF_STATE_NAME']], 'WakeInfo' : [ 0x1b0, ['_PS_WAKE_INFORMATION']], 'WakeFilter' : [ 0x1e8, ['_JOBOBJECT_WAKE_FILTER']], 'LowEdgeLatchFilter' : [ 0x1f0, ['unsigned long']], 'OwnedHighEdgeFilters' : [ 0x1f4, ['unsigned long']], 'NotificationLink' : [ 0x1f8, ['pointer', ['_EJOB']]], 'CurrentJobMemoryUsed' : [ 0x200, ['unsigned long long']], 'NotificationInfo' : [ 0x208, ['pointer', ['_JOB_NOTIFICATION_INFORMATION']]], 'NotificationInfoQuotaReference' : [ 0x20c, ['pointer', ['void']]], 'NotificationPacket' : [ 0x210, ['pointer', ['_IO_MINI_COMPLETION_PACKET_USER']]], 'CpuRateControl' : [ 0x214, ['pointer', ['_JOB_CPU_RATE_CONTROL']]], 'EffectiveSchedulingGroup' : [ 0x218, ['pointer', ['void']]], 'ReadyTime' : [ 0x220, ['unsigned long long']], 'MemoryLimitsLock' : [ 0x228, ['_EX_PUSH_LOCK']], 'SiblingJobLinks' : [ 0x22c, ['_LIST_ENTRY']], 'ChildJobListHead' : [ 0x234, ['_LIST_ENTRY']], 'ParentJob' : [ 0x23c, ['pointer', ['_EJOB']]], 'RootJob' : [ 0x240, ['pointer', ['_EJOB']]], 'IteratorListHead' : [ 0x244, ['_LIST_ENTRY']], 'AncestorCount' : [ 0x24c, ['unsigned long']], 'Ancestors' : [ 0x250, ['pointer', ['pointer', ['_EJOB']]]], 'SessionObject' : [ 0x250, ['pointer', ['void']]], 'Accounting' : [ 0x258, ['_EPROCESS_VALUES']], 'ShadowActiveProcessCount' : [ 0x2a8, ['unsigned long']], 'ActiveAuxiliaryProcessCount' : [ 0x2ac, ['unsigned long']], 'SequenceNumber' : [ 0x2b0, ['unsigned long']], 'TimerListLock' : [ 0x2b4, ['unsigned long']], 'TimerListHead' : [ 0x2b8, ['_LIST_ENTRY']], 'ContainerId' : [ 0x2c0, ['_GUID']], 'Container' : [ 0x2d0, ['pointer', ['_ESILO']]], 'PropertySet' : [ 0x2d4, ['_PS_PROPERTY_SET']], 'NetRateControl' : [ 0x2e0, ['pointer', ['_JOB_NET_RATE_CONTROL']]], 'IoRateControl' : [ 0x2e4, ['pointer', ['_JOB_IO_RATE_CONTROL']]], 'JobFlags' : [ 0x2e8, ['unsigned long']], 'CloseDone' : [ 0x2e8, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'MultiGroup' : [ 0x2e8, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'OutstandingNotification' : [ 0x2e8, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'NotificationInProgress' : [ 0x2e8, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'UILimits' : [ 0x2e8, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'CpuRateControlActive' : [ 0x2e8, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'OwnCpuRateControl' : [ 0x2e8, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'Terminating' : [ 0x2e8, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'WorkingSetLock' : [ 0x2e8, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'JobFrozen' : [ 0x2e8, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Background' : [ 0x2e8, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'WakeNotificationAllocated' : [ 0x2e8, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'WakeNotificationEnabled' : [ 0x2e8, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'WakeNotificationPending' : [ 0x2e8, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'LimitNotificationRequired' : [ 0x2e8, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'ZeroCountNotificationRequired' : [ 0x2e8, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'CycleTimeNotificationRequired' : [ 0x2e8, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'CycleTimeNotificationPending' : [ 0x2e8, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'TimersVirtualized' : [ 0x2e8, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'JobSwapped' : [ 0x2e8, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'ViolationDetected' : [ 0x2e8, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'EmptyJobNotified' : [ 0x2e8, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'NoSystemCharge' : [ 0x2e8, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'DropNoWakeCharges' : [ 0x2e8, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'NoWakeChargePolicyDecided' : [ 0x2e8, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'NetRateControlActive' : [ 0x2e8, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'OwnNetRateControl' : [ 0x2e8, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'IoRateControlActive' : [ 0x2e8, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'OwnIoRateControl' : [ 0x2e8, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'IsContainerRoot' : [ 0x2e8, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'SpareJobFlags' : [ 0x2e8, ['BitField', dict(start_bit = 30, end_bit = 32, native_type='unsigned long')]], 'EffectiveHighEdgeFilters' : [ 0x2ec, ['unsigned long']], 'EnergyValues' : [ 0x2f0, ['pointer', ['_PROCESS_ENERGY_VALUES']]], 'SharedCommitCharge' : [ 0x2f4, ['unsigned long']], } ], '_PPM_IDLE_STATES' : [ 0x140, { 'InterfaceVersion' : [ 0x0, ['unsigned char']], 'ForceIdle' : [ 0x1, ['unsigned char']], 'EstimateIdleDuration' : [ 0x2, ['unsigned char']], 'ExitLatencyTraceEnabled' : [ 0x3, ['unsigned char']], 'NonInterruptibleTransition' : [ 0x4, ['unsigned char']], 'UnaccountedTransition' : [ 0x5, ['unsigned char']], 'IdleDurationLimited' : [ 0x6, ['unsigned char']], 'ExitLatencyCountdown' : [ 0x8, ['unsigned long']], 'TargetState' : [ 0xc, ['unsigned long']], 'ActualState' : [ 0x10, ['unsigned long']], 'OldState' : [ 0x14, ['unsigned long']], 'OverrideIndex' : [ 0x18, ['unsigned long']], 'ProcessorIdleCount' : [ 0x1c, ['unsigned long']], 'Type' : [ 0x20, ['unsigned long']], 'ReasonFlags' : [ 0x24, ['unsigned short']], 'InitiateWakeStamp' : [ 0x28, ['unsigned long long']], 'PreviousStatus' : [ 0x30, ['long']], 'PreviousCancelReason' : [ 0x34, ['unsigned long']], 'PrimaryProcessorMask' : [ 0x38, ['_KAFFINITY_EX']], 'SecondaryProcessorMask' : [ 0x44, ['_KAFFINITY_EX']], 'IdlePrepare' : [ 0x50, ['pointer', ['void']]], 'IdlePreExecute' : [ 0x54, ['pointer', ['void']]], 'IdleExecute' : [ 0x58, ['pointer', ['void']]], 'IdlePreselect' : [ 0x5c, ['pointer', ['void']]], 'IdleTest' : [ 0x60, ['pointer', ['void']]], 'IdleAvailabilityCheck' : [ 0x64, ['pointer', ['void']]], 'IdleComplete' : [ 0x68, ['pointer', ['void']]], 'IdleCancel' : [ 0x6c, ['pointer', ['void']]], 'IdleIsHalted' : [ 0x70, ['pointer', ['void']]], 'IdleInitiateWake' : [ 0x74, ['pointer', ['void']]], 'PrepareInfo' : [ 0x78, ['_PROCESSOR_IDLE_PREPARE_INFO']], 'DeepIdleSnapshot' : [ 0xc8, ['_KAFFINITY_EX']], 'Tracing' : [ 0xd4, ['pointer', ['_PERFINFO_PPM_STATE_SELECTION']]], 'CoordinatedTracing' : [ 0xd8, ['pointer', ['_PERFINFO_PPM_STATE_SELECTION']]], 'ProcessorMenu' : [ 0xdc, ['_PPM_SELECTION_MENU']], 'CoordinatedMenu' : [ 0xe4, ['_PPM_SELECTION_MENU']], 'CoordinatedSelection' : [ 0xec, ['_PPM_COORDINATED_SELECTION']], 'State' : [ 0xfc, ['array', 1, ['_PPM_IDLE_STATE']]], } ], '_PPM_VETO_ACCOUNTING' : [ 0x14, { 'VetoPresent' : [ 0x0, ['long']], 'VetoListHead' : [ 0x4, ['_LIST_ENTRY']], 'PreallocatedVetoCount' : [ 0xc, ['unsigned long']], 'PreallocatedVetoList' : [ 0x10, ['pointer', ['_PPM_VETO_ENTRY']]], } ], '_PEB' : [ 0x250, { 'InheritedAddressSpace' : [ 0x0, ['unsigned char']], 'ReadImageFileExecOptions' : [ 0x1, ['unsigned char']], 'BeingDebugged' : [ 0x2, ['unsigned char']], 'BitField' : [ 0x3, ['unsigned char']], 'ImageUsesLargePages' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IsProtectedProcess' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'IsImageDynamicallyRelocated' : [ 0x3, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'SkipPatchingUser32Forwarders' : [ 0x3, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'IsPackagedProcess' : [ 0x3, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'IsAppContainer' : [ 0x3, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'IsProtectedProcessLight' : [ 0x3, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'SpareBits' : [ 0x3, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'Mutant' : [ 0x4, ['pointer', ['void']]], 'ImageBaseAddress' : [ 0x8, ['pointer', ['void']]], 'Ldr' : [ 0xc, ['pointer', ['_PEB_LDR_DATA']]], 'ProcessParameters' : [ 0x10, ['pointer', ['_RTL_USER_PROCESS_PARAMETERS']]], 'SubSystemData' : [ 0x14, ['pointer', ['void']]], 'ProcessHeap' : [ 0x18, ['pointer', ['void']]], 'FastPebLock' : [ 0x1c, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'AtlThunkSListPtr' : [ 0x20, ['pointer', ['void']]], 'IFEOKey' : [ 0x24, ['pointer', ['void']]], 'CrossProcessFlags' : [ 0x28, ['unsigned long']], 'ProcessInJob' : [ 0x28, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ProcessInitializing' : [ 0x28, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ProcessUsingVEH' : [ 0x28, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ProcessUsingVCH' : [ 0x28, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'ProcessUsingFTH' : [ 0x28, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'ReservedBits0' : [ 0x28, ['BitField', dict(start_bit = 5, end_bit = 32, native_type='unsigned long')]], 'KernelCallbackTable' : [ 0x2c, ['pointer', ['void']]], 'UserSharedInfoPtr' : [ 0x2c, ['pointer', ['void']]], 'SystemReserved' : [ 0x30, ['array', 1, ['unsigned long']]], 'AtlThunkSListPtr32' : [ 0x34, ['unsigned long']], 'ApiSetMap' : [ 0x38, ['pointer', ['void']]], 'TlsExpansionCounter' : [ 0x3c, ['unsigned long']], 'TlsBitmap' : [ 0x40, ['pointer', ['void']]], 'TlsBitmapBits' : [ 0x44, ['array', 2, ['unsigned long']]], 'ReadOnlySharedMemoryBase' : [ 0x4c, ['pointer', ['void']]], 'SparePvoid0' : [ 0x50, ['pointer', ['void']]], 'ReadOnlyStaticServerData' : [ 0x54, ['pointer', ['pointer', ['void']]]], 'AnsiCodePageData' : [ 0x58, ['pointer', ['void']]], 'OemCodePageData' : [ 0x5c, ['pointer', ['void']]], 'UnicodeCaseTableData' : [ 0x60, ['pointer', ['void']]], 'NumberOfProcessors' : [ 0x64, ['unsigned long']], 'NtGlobalFlag' : [ 0x68, ['unsigned long']], 'CriticalSectionTimeout' : [ 0x70, ['_LARGE_INTEGER']], 'HeapSegmentReserve' : [ 0x78, ['unsigned long']], 'HeapSegmentCommit' : [ 0x7c, ['unsigned long']], 'HeapDeCommitTotalFreeThreshold' : [ 0x80, ['unsigned long']], 'HeapDeCommitFreeBlockThreshold' : [ 0x84, ['unsigned long']], 'NumberOfHeaps' : [ 0x88, ['unsigned long']], 'MaximumNumberOfHeaps' : [ 0x8c, ['unsigned long']], 'ProcessHeaps' : [ 0x90, ['pointer', ['pointer', ['void']]]], 'GdiSharedHandleTable' : [ 0x94, ['pointer', ['void']]], 'ProcessStarterHelper' : [ 0x98, ['pointer', ['void']]], 'GdiDCAttributeList' : [ 0x9c, ['unsigned long']], 'LoaderLock' : [ 0xa0, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'OSMajorVersion' : [ 0xa4, ['unsigned long']], 'OSMinorVersion' : [ 0xa8, ['unsigned long']], 'OSBuildNumber' : [ 0xac, ['unsigned short']], 'OSCSDVersion' : [ 0xae, ['unsigned short']], 'OSPlatformId' : [ 0xb0, ['unsigned long']], 'ImageSubsystem' : [ 0xb4, ['unsigned long']], 'ImageSubsystemMajorVersion' : [ 0xb8, ['unsigned long']], 'ImageSubsystemMinorVersion' : [ 0xbc, ['unsigned long']], 'ActiveProcessAffinityMask' : [ 0xc0, ['unsigned long']], 'GdiHandleBuffer' : [ 0xc4, ['array', 34, ['unsigned long']]], 'PostProcessInitRoutine' : [ 0x14c, ['pointer', ['void']]], 'TlsExpansionBitmap' : [ 0x150, ['pointer', ['void']]], 'TlsExpansionBitmapBits' : [ 0x154, ['array', 32, ['unsigned long']]], 'SessionId' : [ 0x1d4, ['unsigned long']], 'AppCompatFlags' : [ 0x1d8, ['_ULARGE_INTEGER']], 'AppCompatFlagsUser' : [ 0x1e0, ['_ULARGE_INTEGER']], 'pShimData' : [ 0x1e8, ['pointer', ['void']]], 'AppCompatInfo' : [ 0x1ec, ['pointer', ['void']]], 'CSDVersion' : [ 0x1f0, ['_UNICODE_STRING']], 'ActivationContextData' : [ 0x1f8, ['pointer', ['_ACTIVATION_CONTEXT_DATA']]], 'ProcessAssemblyStorageMap' : [ 0x1fc, ['pointer', ['_ASSEMBLY_STORAGE_MAP']]], 'SystemDefaultActivationContextData' : [ 0x200, ['pointer', ['_ACTIVATION_CONTEXT_DATA']]], 'SystemAssemblyStorageMap' : [ 0x204, ['pointer', ['_ASSEMBLY_STORAGE_MAP']]], 'MinimumStackCommit' : [ 0x208, ['unsigned long']], 'FlsCallback' : [ 0x20c, ['pointer', ['_FLS_CALLBACK_INFO']]], 'FlsListHead' : [ 0x210, ['_LIST_ENTRY']], 'FlsBitmap' : [ 0x218, ['pointer', ['void']]], 'FlsBitmapBits' : [ 0x21c, ['array', 4, ['unsigned long']]], 'FlsHighIndex' : [ 0x22c, ['unsigned long']], 'WerRegistrationData' : [ 0x230, ['pointer', ['void']]], 'WerShipAssertPtr' : [ 0x234, ['pointer', ['void']]], 'pUnused' : [ 0x238, ['pointer', ['void']]], 'pImageHeaderHash' : [ 0x23c, ['pointer', ['void']]], 'TracingFlags' : [ 0x240, ['unsigned long']], 'HeapTracingEnabled' : [ 0x240, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'CritSecTracingEnabled' : [ 0x240, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'LibLoaderTracingEnabled' : [ 0x240, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'SpareTracingBits' : [ 0x240, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'CsrServerReadOnlySharedMemoryBase' : [ 0x248, ['unsigned long long']], } ], '_HEAP_UCR_DESCRIPTOR' : [ 0x18, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'SegmentEntry' : [ 0x8, ['_LIST_ENTRY']], 'Address' : [ 0x10, ['pointer', ['void']]], 'Size' : [ 0x14, ['unsigned long']], } ], '_ETW_REALTIME_CONSUMER' : [ 0x54, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'ProcessHandle' : [ 0x8, ['pointer', ['void']]], 'ProcessObject' : [ 0xc, ['pointer', ['_EPROCESS']]], 'NextNotDelivered' : [ 0x10, ['pointer', ['void']]], 'RealtimeConnectContext' : [ 0x14, ['pointer', ['void']]], 'DisconnectEvent' : [ 0x18, ['pointer', ['_KEVENT']]], 'DataAvailableEvent' : [ 0x1c, ['pointer', ['_KEVENT']]], 'UserBufferCount' : [ 0x20, ['pointer', ['unsigned long']]], 'UserBufferListHead' : [ 0x24, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'BuffersLost' : [ 0x28, ['unsigned long']], 'EmptyBuffersCount' : [ 0x2c, ['unsigned long']], 'LoggerId' : [ 0x30, ['unsigned short']], 'Flags' : [ 0x32, ['unsigned char']], 'ShutDownRequested' : [ 0x32, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'NewBuffersLost' : [ 0x32, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Disconnected' : [ 0x32, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Notified' : [ 0x32, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'ReservedBufferSpaceBitMap' : [ 0x34, ['_RTL_BITMAP']], 'ReservedBufferSpace' : [ 0x3c, ['pointer', ['unsigned char']]], 'ReservedBufferSpaceSize' : [ 0x40, ['unsigned long']], 'UserPagesAllocated' : [ 0x44, ['unsigned long']], 'UserPagesReused' : [ 0x48, ['unsigned long']], 'EventsLostCount' : [ 0x4c, ['pointer', ['unsigned long']]], 'BuffersLostCount' : [ 0x50, ['pointer', ['unsigned long']]], } ], '__unnamed_1ecb' : [ 0x4, { 'BaseMid' : [ 0x0, ['unsigned char']], 'Flags1' : [ 0x1, ['unsigned char']], 'Flags2' : [ 0x2, ['unsigned char']], 'BaseHi' : [ 0x3, ['unsigned char']], } ], '__unnamed_1ed0' : [ 0x4, { 'BaseMid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'Type' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 13, native_type='unsigned long')]], 'Dpl' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 15, native_type='unsigned long')]], 'Pres' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'LimitHi' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 20, native_type='unsigned long')]], 'Sys' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'Reserved_0' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'Default_Big' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'Granularity' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'BaseHi' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_1ed2' : [ 0x4, { 'Bytes' : [ 0x0, ['__unnamed_1ecb']], 'Bits' : [ 0x0, ['__unnamed_1ed0']], } ], '_KGDTENTRY' : [ 0x8, { 'LimitLow' : [ 0x0, ['unsigned short']], 'BaseLow' : [ 0x2, ['unsigned short']], 'HighWord' : [ 0x4, ['__unnamed_1ed2']], } ], '_POOL_DESCRIPTOR' : [ 0x1140, { 'PoolType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPoolBase', 1: 'PagedPool', 2: 'NonPagedPoolBaseMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolBaseCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolBaseCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 516: 'NonPagedPoolNxCacheAligned', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 512: 'NonPagedPoolNx', 544: 'NonPagedPoolSessionNx', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'PagedLock' : [ 0x4, ['_FAST_MUTEX']], 'NonPagedLock' : [ 0x4, ['unsigned long']], 'RunningAllocs' : [ 0x40, ['long']], 'RunningDeAllocs' : [ 0x44, ['long']], 'TotalBigPages' : [ 0x48, ['long']], 'ThreadsProcessingDeferrals' : [ 0x4c, ['long']], 'TotalBytes' : [ 0x50, ['unsigned long']], 'PoolIndex' : [ 0x80, ['unsigned long']], 'TotalPages' : [ 0xc0, ['long']], 'PendingFrees' : [ 0x100, ['_SINGLE_LIST_ENTRY']], 'PendingFreeDepth' : [ 0x104, ['long']], 'ListHeads' : [ 0x140, ['array', 512, ['_LIST_ENTRY']]], } ], '_TOKEN_MANDATORY_POLICY' : [ 0x4, { 'Policy' : [ 0x0, ['unsigned long']], } ], '_BLOB_COUNTERS' : [ 0x8, { 'CreatedObjects' : [ 0x0, ['unsigned long']], 'DeletedObjects' : [ 0x4, ['unsigned long']], } ], '_KGATE' : [ 0x10, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], } ], '_WHEA_ERROR_RECORD_HEADER' : [ 0x80, { 'Signature' : [ 0x0, ['unsigned long']], 'Revision' : [ 0x4, ['_WHEA_REVISION']], 'SignatureEnd' : [ 0x6, ['unsigned long']], 'SectionCount' : [ 0xa, ['unsigned short']], 'Severity' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSevRecoverable', 1: 'WheaErrSevFatal', 2: 'WheaErrSevCorrected', 3: 'WheaErrSevInformational'})]], 'ValidBits' : [ 0x10, ['_WHEA_ERROR_RECORD_HEADER_VALIDBITS']], 'Length' : [ 0x14, ['unsigned long']], 'Timestamp' : [ 0x18, ['_WHEA_TIMESTAMP']], 'PlatformId' : [ 0x20, ['_GUID']], 'PartitionId' : [ 0x30, ['_GUID']], 'CreatorId' : [ 0x40, ['_GUID']], 'NotifyType' : [ 0x50, ['_GUID']], 'RecordId' : [ 0x60, ['unsigned long long']], 'Flags' : [ 0x68, ['_WHEA_ERROR_RECORD_HEADER_FLAGS']], 'PersistenceInfo' : [ 0x6c, ['_WHEA_PERSISTENCE_INFO']], 'Reserved' : [ 0x74, ['array', 12, ['unsigned char']]], } ], '_ALPC_PROCESS_CONTEXT' : [ 0x10, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'ViewListHead' : [ 0x4, ['_LIST_ENTRY']], 'PagedPoolQuotaCache' : [ 0xc, ['unsigned long']], } ], '_DRIVER_EXTENSION' : [ 0x28, { 'DriverObject' : [ 0x0, ['pointer', ['_DRIVER_OBJECT']]], 'AddDevice' : [ 0x4, ['pointer', ['void']]], 'Count' : [ 0x8, ['unsigned long']], 'ServiceKeyName' : [ 0xc, ['_UNICODE_STRING']], 'ClientDriverExtension' : [ 0x14, ['pointer', ['_IO_CLIENT_EXTENSION']]], 'FsFilterCallbacks' : [ 0x18, ['pointer', ['_FS_FILTER_CALLBACKS']]], 'KseCallbacks' : [ 0x1c, ['pointer', ['void']]], 'DvCallbacks' : [ 0x20, ['pointer', ['void']]], 'VerifierContext' : [ 0x24, ['pointer', ['void']]], } ], '_PRIVILEGE_SET' : [ 0x14, { 'PrivilegeCount' : [ 0x0, ['unsigned long']], 'Control' : [ 0x4, ['unsigned long']], 'Privilege' : [ 0x8, ['array', 1, ['_LUID_AND_ATTRIBUTES']]], } ], '_WHEAP_WORK_QUEUE' : [ 0x44, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'ListLock' : [ 0x8, ['unsigned long']], 'ItemCount' : [ 0xc, ['long']], 'Dpc' : [ 0x10, ['_KDPC']], 'WorkItem' : [ 0x30, ['_WORK_QUEUE_ITEM']], 'WorkRoutine' : [ 0x40, ['pointer', ['void']]], } ], '_CM_NOTIFY_BLOCK' : [ 0x2c, { 'HiveList' : [ 0x0, ['_LIST_ENTRY']], 'PostList' : [ 0x8, ['_LIST_ENTRY']], 'KeyControlBlock' : [ 0x10, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'KeyBody' : [ 0x14, ['pointer', ['_CM_KEY_BODY']]], 'Filter' : [ 0x18, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'WatchTree' : [ 0x18, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'NotifyPending' : [ 0x18, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'SubjectContext' : [ 0x1c, ['_SECURITY_SUBJECT_CONTEXT']], } ], '_MI_EXTRA_IMAGE_INFORMATION' : [ 0x8, { 'SizeOfHeaders' : [ 0x0, ['unsigned long']], 'SizeOfImage' : [ 0x4, ['unsigned long']], } ], '_KINTERRUPT' : [ 0xb0, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'InterruptListEntry' : [ 0x4, ['_LIST_ENTRY']], 'ServiceRoutine' : [ 0xc, ['pointer', ['void']]], 'MessageServiceRoutine' : [ 0x10, ['pointer', ['void']]], 'MessageIndex' : [ 0x14, ['unsigned long']], 'ServiceContext' : [ 0x18, ['pointer', ['void']]], 'SpinLock' : [ 0x1c, ['unsigned long']], 'TickCount' : [ 0x20, ['unsigned long']], 'ActualLock' : [ 0x24, ['pointer', ['unsigned long']]], 'DispatchAddress' : [ 0x28, ['pointer', ['void']]], 'Vector' : [ 0x2c, ['unsigned long']], 'Irql' : [ 0x30, ['unsigned char']], 'SynchronizeIrql' : [ 0x31, ['unsigned char']], 'FloatingSave' : [ 0x32, ['unsigned char']], 'Connected' : [ 0x33, ['unsigned char']], 'Number' : [ 0x34, ['unsigned long']], 'ShareVector' : [ 0x38, ['unsigned char']], 'EmulateActiveBoth' : [ 0x39, ['unsigned char']], 'ActiveCount' : [ 0x3a, ['unsigned short']], 'InternalState' : [ 0x3c, ['long']], 'Mode' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'LevelSensitive', 1: 'Latched'})]], 'Polarity' : [ 0x44, ['Enumeration', dict(target = 'long', choices = {0: 'InterruptPolarityUnknown', 1: 'InterruptRisingEdge', 2: 'InterruptFallingEdge', 3: 'InterruptActiveBothTriggerLow', 4: 'InterruptActiveBothTriggerHigh'})]], 'ServiceCount' : [ 0x48, ['unsigned long']], 'DispatchCount' : [ 0x4c, ['unsigned long']], 'PassiveEvent' : [ 0x50, ['pointer', ['_KEVENT']]], 'DisconnectData' : [ 0x54, ['pointer', ['void']]], 'ServiceThread' : [ 0x58, ['pointer', ['_KTHREAD']]], 'ConnectionData' : [ 0x5c, ['pointer', ['_INTERRUPT_CONNECTION_DATA']]], 'IntTrackEntry' : [ 0x60, ['pointer', ['void']]], 'IsrDpcStats' : [ 0x68, ['_ISRDPCSTATS']], 'RedirectObject' : [ 0xa8, ['pointer', ['void']]], } ], '_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION' : [ 0x18, { 'SecurityAttributeCount' : [ 0x0, ['unsigned long']], 'SecurityAttributesList' : [ 0x4, ['_LIST_ENTRY']], 'WorkingSecurityAttributeCount' : [ 0xc, ['unsigned long']], 'WorkingSecurityAttributesList' : [ 0x10, ['_LIST_ENTRY']], } ], '_IMAGE_FILE_HEADER' : [ 0x14, { 'Machine' : [ 0x0, ['unsigned short']], 'NumberOfSections' : [ 0x2, ['unsigned short']], 'TimeDateStamp' : [ 0x4, ['unsigned long']], 'PointerToSymbolTable' : [ 0x8, ['unsigned long']], 'NumberOfSymbols' : [ 0xc, ['unsigned long']], 'SizeOfOptionalHeader' : [ 0x10, ['unsigned short']], 'Characteristics' : [ 0x12, ['unsigned short']], } ], '_MMEXTEND_INFO' : [ 0x10, { 'CommittedSize' : [ 0x0, ['unsigned long long']], 'ReferenceCount' : [ 0x8, ['unsigned long']], } ], '_STRING64' : [ 0x10, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x8, ['unsigned long long']], } ], '_HIVE_LIST_ENTRY' : [ 0x60, { 'FileName' : [ 0x0, ['pointer', ['unsigned short']]], 'BaseName' : [ 0x4, ['pointer', ['unsigned short']]], 'RegRootName' : [ 0x8, ['pointer', ['unsigned short']]], 'CmHive' : [ 0xc, ['pointer', ['_CMHIVE']]], 'HHiveFlags' : [ 0x10, ['unsigned long']], 'CmHiveFlags' : [ 0x14, ['unsigned long']], 'CmKcbCacheSize' : [ 0x18, ['unsigned long']], 'CmHive2' : [ 0x1c, ['pointer', ['_CMHIVE']]], 'HiveMounted' : [ 0x20, ['unsigned char']], 'ThreadFinished' : [ 0x21, ['unsigned char']], 'ThreadStarted' : [ 0x22, ['unsigned char']], 'Allocate' : [ 0x23, ['unsigned char']], 'WinPERequired' : [ 0x24, ['unsigned char']], 'StartEvent' : [ 0x28, ['_KEVENT']], 'FinishedEvent' : [ 0x38, ['_KEVENT']], 'MountLock' : [ 0x48, ['_KEVENT']], 'FilePath' : [ 0x58, ['_UNICODE_STRING']], } ], '_HMAP_DIRECTORY' : [ 0x1000, { 'Directory' : [ 0x0, ['array', 1024, ['pointer', ['_HMAP_TABLE']]]], } ], '_CONTEXT' : [ 0x2cc, { 'ContextFlags' : [ 0x0, ['unsigned long']], 'Dr0' : [ 0x4, ['unsigned long']], 'Dr1' : [ 0x8, ['unsigned long']], 'Dr2' : [ 0xc, ['unsigned long']], 'Dr3' : [ 0x10, ['unsigned long']], 'Dr6' : [ 0x14, ['unsigned long']], 'Dr7' : [ 0x18, ['unsigned long']], 'FloatSave' : [ 0x1c, ['_FLOATING_SAVE_AREA']], 'SegGs' : [ 0x8c, ['unsigned long']], 'SegFs' : [ 0x90, ['unsigned long']], 'SegEs' : [ 0x94, ['unsigned long']], 'SegDs' : [ 0x98, ['unsigned long']], 'Edi' : [ 0x9c, ['unsigned long']], 'Esi' : [ 0xa0, ['unsigned long']], 'Ebx' : [ 0xa4, ['unsigned long']], 'Edx' : [ 0xa8, ['unsigned long']], 'Ecx' : [ 0xac, ['unsigned long']], 'Eax' : [ 0xb0, ['unsigned long']], 'Ebp' : [ 0xb4, ['unsigned long']], 'Eip' : [ 0xb8, ['unsigned long']], 'SegCs' : [ 0xbc, ['unsigned long']], 'EFlags' : [ 0xc0, ['unsigned long']], 'Esp' : [ 0xc4, ['unsigned long']], 'SegSs' : [ 0xc8, ['unsigned long']], 'ExtendedRegisters' : [ 0xcc, ['array', 512, ['unsigned char']]], } ], '_ALPC_HANDLE_TABLE' : [ 0x10, { 'Handles' : [ 0x0, ['pointer', ['_ALPC_HANDLE_ENTRY']]], 'TotalHandles' : [ 0x4, ['unsigned long']], 'Flags' : [ 0x8, ['unsigned long']], 'Lock' : [ 0xc, ['_EX_PUSH_LOCK']], } ], '__unnamed_1f34' : [ 0x3a4, { 'XpfMceDescriptor' : [ 0x0, ['_WHEA_XPF_MCE_DESCRIPTOR']], 'XpfCmcDescriptor' : [ 0x0, ['_WHEA_XPF_CMC_DESCRIPTOR']], 'XpfNmiDescriptor' : [ 0x0, ['_WHEA_XPF_NMI_DESCRIPTOR']], 'IpfMcaDescriptor' : [ 0x0, ['_WHEA_IPF_MCA_DESCRIPTOR']], 'IpfCmcDescriptor' : [ 0x0, ['_WHEA_IPF_CMC_DESCRIPTOR']], 'IpfCpeDescriptor' : [ 0x0, ['_WHEA_IPF_CPE_DESCRIPTOR']], 'AerRootportDescriptor' : [ 0x0, ['_WHEA_AER_ROOTPORT_DESCRIPTOR']], 'AerEndpointDescriptor' : [ 0x0, ['_WHEA_AER_ENDPOINT_DESCRIPTOR']], 'AerBridgeDescriptor' : [ 0x0, ['_WHEA_AER_BRIDGE_DESCRIPTOR']], 'GenErrDescriptor' : [ 0x0, ['_WHEA_GENERIC_ERROR_DESCRIPTOR']], } ], '_WHEA_ERROR_SOURCE_DESCRIPTOR' : [ 0x3cc, { 'Length' : [ 0x0, ['unsigned long']], 'Version' : [ 0x4, ['unsigned long']], 'Type' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'WheaErrSrcTypeMCE', 1: 'WheaErrSrcTypeCMC', 2: 'WheaErrSrcTypeCPE', 3: 'WheaErrSrcTypeNMI', 4: 'WheaErrSrcTypePCIe', 5: 'WheaErrSrcTypeGeneric', 6: 'WheaErrSrcTypeINIT', 7: 'WheaErrSrcTypeBOOT', 8: 'WheaErrSrcTypeSCIGeneric', 9: 'WheaErrSrcTypeIPFMCA', 10: 'WheaErrSrcTypeIPFCMC', 11: 'WheaErrSrcTypeIPFCPE', 12: 'WheaErrSrcTypeMax'})]], 'State' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {1: 'WheaErrSrcStateStopped', 2: 'WheaErrSrcStateStarted'})]], 'MaxRawDataLength' : [ 0x10, ['unsigned long']], 'NumRecordsToPreallocate' : [ 0x14, ['unsigned long']], 'MaxSectionsPerRecord' : [ 0x18, ['unsigned long']], 'ErrorSourceId' : [ 0x1c, ['unsigned long']], 'PlatformErrorSourceId' : [ 0x20, ['unsigned long']], 'Flags' : [ 0x24, ['unsigned long']], 'Info' : [ 0x28, ['__unnamed_1f34']], } ], '_MMPTE_HARDWARE' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'Dirty1' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'Owner' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long long')]], 'Accessed' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long long')]], 'Dirty' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long long')]], 'LargePage' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long long')]], 'Global' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 38, native_type='unsigned long long')]], 'reserved1' : [ 0x0, ['BitField', dict(start_bit = 38, end_bit = 64, native_type='unsigned long long')]], } ], '_IO_COMPLETION_CONTEXT' : [ 0x8, { 'Port' : [ 0x0, ['pointer', ['void']]], 'Key' : [ 0x4, ['pointer', ['void']]], } ], '_EX_WORK_QUEUE' : [ 0x1b8, { 'WorkPriQueue' : [ 0x0, ['_KPRIQUEUE']], 'Node' : [ 0x19c, ['pointer', ['_ENODE']]], 'WorkItemsProcessed' : [ 0x1a0, ['unsigned long']], 'WorkItemsProcessedLastPass' : [ 0x1a4, ['unsigned long']], 'ThreadCount' : [ 0x1a8, ['long']], 'MinThreads' : [ 0x1ac, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='long')]], 'TryFailed' : [ 0x1ac, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'MaxThreads' : [ 0x1b0, ['long']], 'QueueIndex' : [ 0x1b4, ['Enumeration', dict(target = 'long', choices = {0: 'ExPoolUntrusted', 1: 'ExPoolTrusted', 8: 'ExPoolMax'})]], } ], '_IOV_FORCED_PENDING_TRACE' : [ 0x100, { 'Irp' : [ 0x0, ['pointer', ['_IRP']]], 'Thread' : [ 0x4, ['pointer', ['_ETHREAD']]], 'StackTrace' : [ 0x8, ['array', 62, ['pointer', ['void']]]], } ], '_IOP_IRP_EXTENSION_STATUS' : [ 0xc, { 'Flags' : [ 0x0, ['unsigned long']], 'ActivityId' : [ 0x4, ['unsigned long']], 'IoTracking' : [ 0x8, ['unsigned long']], } ], '_DBGKD_SET_CONTEXT' : [ 0x4, { 'ContextFlags' : [ 0x0, ['unsigned long']], } ], '_VI_POOL_ENTRY_INUSE' : [ 0x10, { 'VirtualAddress' : [ 0x0, ['pointer', ['void']]], 'CallingAddress' : [ 0x4, ['pointer', ['void']]], 'NumberOfBytes' : [ 0x8, ['unsigned long']], 'Tag' : [ 0xc, ['unsigned long']], } ], '_INTERFACE' : [ 0x10, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], } ], '_ACL' : [ 0x8, { 'AclRevision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'AclSize' : [ 0x2, ['unsigned short']], 'AceCount' : [ 0x4, ['unsigned short']], 'Sbz2' : [ 0x6, ['unsigned short']], } ], '_PS_PROPERTY_SET' : [ 0xc, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'Lock' : [ 0x8, ['unsigned long']], } ], '_LAZY_WRITER' : [ 0x50, { 'ScanDpc' : [ 0x0, ['_KDPC']], 'ScanTimer' : [ 0x20, ['_KTIMER']], 'ScanActive' : [ 0x48, ['unsigned char']], 'OtherWork' : [ 0x49, ['unsigned char']], 'PendingTeardownScan' : [ 0x4a, ['unsigned char']], 'PendingPeriodicScan' : [ 0x4b, ['unsigned char']], 'PendingLowMemoryScan' : [ 0x4c, ['unsigned char']], 'PendingPowerScan' : [ 0x4d, ['unsigned char']], 'PendingCoalescingFlushScan' : [ 0x4e, ['unsigned char']], } ], '_PI_BUS_EXTENSION' : [ 0x44, { 'Flags' : [ 0x0, ['unsigned long']], 'NumberCSNs' : [ 0x4, ['unsigned char']], 'ReadDataPort' : [ 0x8, ['pointer', ['unsigned char']]], 'DataPortMapped' : [ 0xc, ['unsigned char']], 'AddressPort' : [ 0x10, ['pointer', ['unsigned char']]], 'AddrPortMapped' : [ 0x14, ['unsigned char']], 'CommandPort' : [ 0x18, ['pointer', ['unsigned char']]], 'CmdPortMapped' : [ 0x1c, ['unsigned char']], 'NextSlotNumber' : [ 0x20, ['unsigned long']], 'DeviceList' : [ 0x24, ['_SINGLE_LIST_ENTRY']], 'CardList' : [ 0x28, ['_SINGLE_LIST_ENTRY']], 'PhysicalBusDevice' : [ 0x2c, ['pointer', ['_DEVICE_OBJECT']]], 'FunctionalBusDevice' : [ 0x30, ['pointer', ['_DEVICE_OBJECT']]], 'AttachedDevice' : [ 0x34, ['pointer', ['_DEVICE_OBJECT']]], 'BusNumber' : [ 0x38, ['unsigned long']], 'SystemPowerState' : [ 0x3c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DevicePowerState' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], } ], '_DEVICE_DESCRIPTION' : [ 0x40, { 'Version' : [ 0x0, ['unsigned long']], 'Master' : [ 0x4, ['unsigned char']], 'ScatterGather' : [ 0x5, ['unsigned char']], 'DemandMode' : [ 0x6, ['unsigned char']], 'AutoInitialize' : [ 0x7, ['unsigned char']], 'Dma32BitAddresses' : [ 0x8, ['unsigned char']], 'IgnoreCount' : [ 0x9, ['unsigned char']], 'Reserved1' : [ 0xa, ['unsigned char']], 'Dma64BitAddresses' : [ 0xb, ['unsigned char']], 'BusNumber' : [ 0xc, ['unsigned long']], 'DmaChannel' : [ 0x10, ['unsigned long']], 'InterfaceType' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'DmaWidth' : [ 0x18, ['Enumeration', dict(target = 'long', choices = {0: 'Width8Bits', 1: 'Width16Bits', 2: 'Width32Bits', 3: 'Width64Bits', 4: 'WidthNoWrap', 5: 'MaximumDmaWidth'})]], 'DmaSpeed' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'Compatible', 1: 'TypeA', 2: 'TypeB', 3: 'TypeC', 4: 'TypeF', 5: 'MaximumDmaSpeed'})]], 'MaximumLength' : [ 0x20, ['unsigned long']], 'DmaPort' : [ 0x24, ['unsigned long']], 'DmaAddressWidth' : [ 0x28, ['unsigned long']], 'DmaControllerInstance' : [ 0x2c, ['unsigned long']], 'DmaRequestLine' : [ 0x30, ['unsigned long']], 'DeviceAddress' : [ 0x38, ['_LARGE_INTEGER']], } ], '_SID_AND_ATTRIBUTES' : [ 0x8, { 'Sid' : [ 0x0, ['pointer', ['void']]], 'Attributes' : [ 0x4, ['unsigned long']], } ], '_SID_IDENTIFIER_AUTHORITY' : [ 0x6, { 'Value' : [ 0x0, ['array', 6, ['unsigned char']]], } ], '_PROCESS_DISK_COUNTERS' : [ 0x28, { 'BytesRead' : [ 0x0, ['unsigned long long']], 'BytesWritten' : [ 0x8, ['unsigned long long']], 'ReadOperationCount' : [ 0x10, ['unsigned long long']], 'WriteOperationCount' : [ 0x18, ['unsigned long long']], 'FlushOperationCount' : [ 0x20, ['unsigned long long']], } ], '_IO_WORKITEM' : [ 0x34, { 'WorkItem' : [ 0x0, ['_WORK_QUEUE_ITEM']], 'Routine' : [ 0x10, ['pointer', ['void']]], 'IoObject' : [ 0x14, ['pointer', ['void']]], 'Context' : [ 0x18, ['pointer', ['void']]], 'WorkingOnBehalfClient' : [ 0x1c, ['pointer', ['void']]], 'Type' : [ 0x20, ['unsigned long']], 'ActivityId' : [ 0x24, ['_GUID']], } ], '_MMVAD_FLAGS' : [ 0x4, { 'VadType' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 8, native_type='unsigned long')]], 'PreferredNode' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 14, native_type='unsigned long')]], 'NoChange' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'PrivateMemory' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'Teb' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'PrivateFixup' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'ManySubsections' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 31, native_type='unsigned long')]], 'DeleteInProgress' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_MMWSLE_HASH' : [ 0x4, { 'Index' : [ 0x0, ['unsigned long']], } ], '_JOBOBJECT_WAKE_FILTER' : [ 0x8, { 'HighEdgeFilter' : [ 0x0, ['unsigned long']], 'LowEdgeFilter' : [ 0x4, ['unsigned long']], } ], '_STRING32' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'MaximumLength' : [ 0x2, ['unsigned short']], 'Buffer' : [ 0x4, ['unsigned long']], } ], '_POP_FX_WORK_ORDER_WATCHDOG_INFO' : [ 0x50, { 'Timer' : [ 0x0, ['_KTIMER']], 'Dpc' : [ 0x28, ['_KDPC']], 'WorkOrder' : [ 0x48, ['pointer', ['_POP_FX_WORK_ORDER']]], } ], '_MI_VAD_EVENT_BLOCK' : [ 0x18, { 'Next' : [ 0x0, ['pointer', ['_MI_VAD_EVENT_BLOCK']]], 'WaitReason' : [ 0x4, ['unsigned long']], 'Gate' : [ 0x8, ['_KGATE']], 'SecureInfo' : [ 0x8, ['_MMADDRESS_LIST']], 'BitMap' : [ 0x8, ['_RTL_BITMAP']], 'InPageSupport' : [ 0x8, ['pointer', ['_MMINPAGE_SUPPORT']]], 'LargePage' : [ 0x8, ['pointer', ['_MI_LARGEPAGE_MEMORY_INFO']]], 'CreatingThread' : [ 0x8, ['pointer', ['_ETHREAD']]], } ], '_DBGKD_FILL_MEMORY' : [ 0x10, { 'Address' : [ 0x0, ['unsigned long long']], 'Length' : [ 0x8, ['unsigned long']], 'Flags' : [ 0xc, ['unsigned short']], 'PatternLength' : [ 0xe, ['unsigned short']], } ], '_HEAP_STOP_ON_VALUES' : [ 0x18, { 'AllocAddress' : [ 0x0, ['unsigned long']], 'AllocTag' : [ 0x4, ['_HEAP_STOP_ON_TAG']], 'ReAllocAddress' : [ 0x8, ['unsigned long']], 'ReAllocTag' : [ 0xc, ['_HEAP_STOP_ON_TAG']], 'FreeAddress' : [ 0x10, ['unsigned long']], 'FreeTag' : [ 0x14, ['_HEAP_STOP_ON_TAG']], } ], '_HEAP_PSEUDO_TAG_ENTRY' : [ 0xc, { 'Allocs' : [ 0x0, ['unsigned long']], 'Frees' : [ 0x4, ['unsigned long']], 'Size' : [ 0x8, ['unsigned long']], } ], '_CALL_HASH_ENTRY' : [ 0x14, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'CallersAddress' : [ 0x8, ['pointer', ['void']]], 'CallersCaller' : [ 0xc, ['pointer', ['void']]], 'CallCount' : [ 0x10, ['unsigned long']], } ], '_KTIMER2_COLLECTION' : [ 0x10, { 'Tree' : [ 0x0, ['_RTL_RB_TREE']], 'NextDueTime' : [ 0x8, ['unsigned long long']], } ], '_MIPFNBLINK' : [ 0x4, { 'Blink' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'TbFlushStamp' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 28, native_type='unsigned long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'PageBlinkDeleteBit' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'PageBlinkLockBit' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'ShareCount' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'PageShareCountDeleteBit' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'PageShareCountLockBit' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'EntireField' : [ 0x0, ['unsigned long']], 'Lock' : [ 0x0, ['long']], 'LockNotUsed' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'DeleteBit' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'LockBit' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_VF_TRACKER_STAMP' : [ 0x8, { 'Thread' : [ 0x0, ['pointer', ['void']]], 'Flags' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'OldIrql' : [ 0x5, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'NewIrql' : [ 0x6, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'Processor' : [ 0x7, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], } ], '_VI_TRACK_IRQL' : [ 0x20, { 'Thread' : [ 0x0, ['pointer', ['void']]], 'OldIrql' : [ 0x4, ['unsigned char']], 'NewIrql' : [ 0x5, ['unsigned char']], 'Processor' : [ 0x6, ['unsigned short']], 'TickCount' : [ 0x8, ['unsigned long']], 'StackTrace' : [ 0xc, ['array', 5, ['pointer', ['void']]]], } ], '_MMCLONE_HEADER' : [ 0xc, { 'NumberOfPtes' : [ 0x0, ['unsigned long']], 'NumberOfProcessReferences' : [ 0x4, ['unsigned long']], 'ClonePtes' : [ 0x8, ['pointer', ['_MMCLONE_BLOCK']]], } ], '_SESSION_LOWBOX_MAP' : [ 0x20, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'SessionId' : [ 0x8, ['unsigned long']], 'LowboxMap' : [ 0xc, ['_SEP_LOWBOX_NUMBER_MAPPING']], } ], '_PROCESSOR_PROFILE_CONTROL_AREA' : [ 0x60, { 'PebsDsSaveArea' : [ 0x0, ['_PEBS_DS_SAVE_AREA']], } ], '_PEB_LDR_DATA' : [ 0x30, { 'Length' : [ 0x0, ['unsigned long']], 'Initialized' : [ 0x4, ['unsigned char']], 'SsHandle' : [ 0x8, ['pointer', ['void']]], 'InLoadOrderModuleList' : [ 0xc, ['_LIST_ENTRY']], 'InMemoryOrderModuleList' : [ 0x14, ['_LIST_ENTRY']], 'InInitializationOrderModuleList' : [ 0x1c, ['_LIST_ENTRY']], 'EntryInProgress' : [ 0x24, ['pointer', ['void']]], 'ShutdownInProgress' : [ 0x28, ['unsigned char']], 'ShutdownThreadId' : [ 0x2c, ['pointer', ['void']]], } ], '_PNP_DEVICE_EVENT_ENTRY' : [ 0x84, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Argument' : [ 0x8, ['unsigned long']], 'CallerEvent' : [ 0xc, ['pointer', ['_KEVENT']]], 'Callback' : [ 0x10, ['pointer', ['void']]], 'Context' : [ 0x14, ['pointer', ['void']]], 'VetoType' : [ 0x18, ['pointer', ['Enumeration', dict(target = 'long', choices = {0: 'PNP_VetoTypeUnknown', 1: 'PNP_VetoLegacyDevice', 2: 'PNP_VetoPendingClose', 3: 'PNP_VetoWindowsApp', 4: 'PNP_VetoWindowsService', 5: 'PNP_VetoOutstandingOpen', 6: 'PNP_VetoDevice', 7: 'PNP_VetoDriver', 8: 'PNP_VetoIllegalDeviceRequest', 9: 'PNP_VetoInsufficientPower', 10: 'PNP_VetoNonDisableable', 11: 'PNP_VetoLegacyDriver', 12: 'PNP_VetoInsufficientRights'})]]], 'VetoName' : [ 0x1c, ['pointer', ['_UNICODE_STRING']]], 'RefCount' : [ 0x20, ['unsigned long']], 'Lock' : [ 0x24, ['unsigned long']], 'Cancel' : [ 0x28, ['unsigned char']], 'Parent' : [ 0x2c, ['pointer', ['_PNP_DEVICE_EVENT_ENTRY']]], 'ActivityId' : [ 0x30, ['_GUID']], 'Data' : [ 0x40, ['_PLUGPLAY_EVENT_BLOCK']], } ], '_HEAP_STOP_ON_TAG' : [ 0x4, { 'HeapAndTagIndex' : [ 0x0, ['unsigned long']], 'TagIndex' : [ 0x0, ['unsigned short']], 'HeapIndex' : [ 0x2, ['unsigned short']], } ], '_PS_WAKE_INFORMATION' : [ 0x38, { 'NotificationChannel' : [ 0x0, ['unsigned long long']], 'WakeCounters' : [ 0x8, ['array', 5, ['unsigned long long']]], 'NoWakeCounter' : [ 0x30, ['unsigned long long']], } ], '_RH_OP_CONTEXT' : [ 0x24, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'OplockRequestIrp' : [ 0x8, ['pointer', ['_IRP']]], 'OplockRequestFileObject' : [ 0xc, ['pointer', ['_FILE_OBJECT']]], 'OplockRequestProcess' : [ 0x10, ['pointer', ['_EPROCESS']]], 'OplockOwnerThread' : [ 0x14, ['pointer', ['_ETHREAD']]], 'Flags' : [ 0x18, ['unsigned long']], 'AtomicLinks' : [ 0x1c, ['_LIST_ENTRY']], } ], '_DBGKD_GET_CONTEXT' : [ 0x4, { 'Unused' : [ 0x0, ['unsigned long']], } ], '_TEB_ACTIVE_FRAME_CONTEXT' : [ 0x8, { 'Flags' : [ 0x0, ['unsigned long']], 'FrameName' : [ 0x4, ['pointer', ['unsigned char']]], } ], '_KWAIT_CHAIN' : [ 0x4, { 'Head' : [ 0x0, ['_SINGLE_LIST_ENTRY']], } ], '_ISRDPCSTATS' : [ 0x40, { 'IsrTime' : [ 0x0, ['unsigned long long']], 'IsrTimeStart' : [ 0x8, ['unsigned long long']], 'IsrCount' : [ 0x10, ['unsigned long long']], 'DpcTime' : [ 0x18, ['unsigned long long']], 'DpcTimeStart' : [ 0x20, ['unsigned long long']], 'DpcCount' : [ 0x28, ['unsigned long long']], 'IsrActive' : [ 0x30, ['unsigned char']], 'Reserved' : [ 0x31, ['array', 15, ['unsigned char']]], } ], '_MI_PARTITION_PAGE_LISTS' : [ 0x6c0, { 'FreePagesByColor' : [ 0x0, ['array', 2, ['pointer', ['_MMPFNLIST']]]], 'FreePageSlist' : [ 0x8, ['array', 2, ['pointer', ['_SLIST_HEADER']]]], 'ZeroedPageListHead' : [ 0x40, ['_MMPFNLIST']], 'FreePageListHead' : [ 0x80, ['_MMPFNLIST']], 'StandbyPageListHead' : [ 0xc0, ['_MMPFNLIST']], 'StandbyPageListByPriority' : [ 0x100, ['array', 8, ['_MMPFNLIST']]], 'ModifiedPageListNoReservation' : [ 0x1c0, ['_MMPFNLIST']], 'ModifiedPageListByReservation' : [ 0x200, ['array', 16, ['_MMPFNLIST']]], 'MappedPageListHead' : [ 0x340, ['array', 16, ['_MMPFNLIST']]], 'BadPageListHead' : [ 0x480, ['_MMPFNLIST']], 'PageLocationList' : [ 0x494, ['array', 8, ['pointer', ['_MMPFNLIST']]]], 'StandbyRepurposedByPriority' : [ 0x4b4, ['array', 8, ['unsigned long']]], 'MappedPageListHeadEvent' : [ 0x4d4, ['array', 16, ['_KEVENT']]], 'DecayClusterTimerHeads' : [ 0x5d4, ['array', 4, ['_MI_DECAY_TIMER_LINK']]], 'DecayHand' : [ 0x5e4, ['unsigned long']], 'LastDecayHandUpdateTime' : [ 0x5e8, ['unsigned long long']], 'LastChanceLdwContext' : [ 0x5f0, ['_MI_LDW_WORK_CONTEXT']], 'AvailableEventsLock' : [ 0x640, ['unsigned long']], 'AvailablePageWaitStates' : [ 0x644, ['array', 2, ['_MI_AVAILABLE_PAGE_WAIT_STATES']]], 'LowMemoryThreshold' : [ 0x66c, ['unsigned long']], 'HighMemoryThreshold' : [ 0x670, ['unsigned long']], 'TransitionPrivatePages' : [ 0x680, ['unsigned long']], 'RebuildLargePagesInitialized' : [ 0x684, ['unsigned char']], 'RebuildLargePagesItem' : [ 0x688, ['_MI_REBUILD_LARGE_PAGES']], } ], '_XSTATE_CONFIGURATION' : [ 0x330, { 'EnabledFeatures' : [ 0x0, ['unsigned long long']], 'EnabledVolatileFeatures' : [ 0x8, ['unsigned long long']], 'Size' : [ 0x10, ['unsigned long']], 'OptimizedSave' : [ 0x14, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'CompactionEnabled' : [ 0x14, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Features' : [ 0x18, ['array', 64, ['_XSTATE_FEATURE']]], 'EnabledSupervisorFeatures' : [ 0x218, ['unsigned long long']], 'AlignedFeatures' : [ 0x220, ['unsigned long long']], 'AllFeatureSize' : [ 0x228, ['unsigned long']], 'AllFeatures' : [ 0x22c, ['array', 64, ['unsigned long']]], } ], '_CM_KEY_CONTROL_BLOCK' : [ 0xa0, { 'RefCount' : [ 0x0, ['unsigned long']], 'ExtFlags' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'PrivateAlloc' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'Delete' : [ 0x4, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'HiveUnloaded' : [ 0x4, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'Decommissioned' : [ 0x4, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'LockTablePresent' : [ 0x4, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'TotalLevels' : [ 0x4, ['BitField', dict(start_bit = 21, end_bit = 31, native_type='unsigned long')]], 'DelayedDeref' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DelayedClose' : [ 0x8, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Parking' : [ 0x8, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'KeyHash' : [ 0xc, ['_CM_KEY_HASH']], 'ConvKey' : [ 0xc, ['unsigned long']], 'NextHash' : [ 0x10, ['pointer', ['_CM_KEY_HASH']]], 'KeyHive' : [ 0x14, ['pointer', ['_HHIVE']]], 'KeyCell' : [ 0x18, ['unsigned long']], 'KcbPushlock' : [ 0x1c, ['_EX_PUSH_LOCK']], 'Owner' : [ 0x20, ['pointer', ['_KTHREAD']]], 'SharedCount' : [ 0x20, ['long']], 'SlotHint' : [ 0x24, ['unsigned long']], 'ParentKcb' : [ 0x28, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'NameBlock' : [ 0x2c, ['pointer', ['_CM_NAME_CONTROL_BLOCK']]], 'CachedSecurity' : [ 0x30, ['pointer', ['_CM_KEY_SECURITY_CACHE']]], 'ValueCache' : [ 0x34, ['_CACHED_CHILD_LIST']], 'IndexHint' : [ 0x3c, ['pointer', ['_CM_INDEX_HINT_BLOCK']]], 'HashKey' : [ 0x3c, ['unsigned long']], 'SubKeyCount' : [ 0x3c, ['unsigned long']], 'KeyBodyListHead' : [ 0x40, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x40, ['_LIST_ENTRY']], 'KeyBodyArray' : [ 0x48, ['array', 4, ['pointer', ['_CM_KEY_BODY']]]], 'KcbLastWriteTime' : [ 0x58, ['_LARGE_INTEGER']], 'KcbMaxNameLen' : [ 0x60, ['unsigned short']], 'KcbMaxValueNameLen' : [ 0x62, ['unsigned short']], 'KcbMaxValueDataLen' : [ 0x64, ['unsigned long']], 'KcbUserFlags' : [ 0x68, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned long')]], 'KcbVirtControlFlags' : [ 0x68, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned long')]], 'KcbDebug' : [ 0x68, ['BitField', dict(start_bit = 8, end_bit = 16, native_type='unsigned long')]], 'Flags' : [ 0x68, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long')]], 'KCBUoWListHead' : [ 0x6c, ['_LIST_ENTRY']], 'DelayQueueEntry' : [ 0x74, ['_LIST_ENTRY']], 'Stolen' : [ 0x74, ['pointer', ['unsigned char']]], 'TransKCBOwner' : [ 0x7c, ['pointer', ['_CM_TRANS']]], 'KCBLock' : [ 0x80, ['_CM_INTENT_LOCK']], 'KeyLock' : [ 0x88, ['_CM_INTENT_LOCK']], 'TransValueCache' : [ 0x90, ['_CHILD_LIST']], 'TransValueListOwner' : [ 0x98, ['pointer', ['_CM_TRANS']]], 'FullKCBName' : [ 0x9c, ['pointer', ['_UNICODE_STRING']]], } ], '_KLOCK_ENTRY' : [ 0x30, { 'TreeNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'FreeListEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'EntryFlags' : [ 0xc, ['unsigned long']], 'EntryOffset' : [ 0xc, ['unsigned char']], 'ThreadLocalFlags' : [ 0xd, ['unsigned char']], 'WaitingBit' : [ 0xd, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'Spare0' : [ 0xd, ['BitField', dict(start_bit = 1, end_bit = 8, native_type='unsigned char')]], 'AcquiredByte' : [ 0xe, ['unsigned char']], 'AcquiredBit' : [ 0xe, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'CrossThreadFlags' : [ 0xf, ['unsigned char']], 'HeadNodeBit' : [ 0xf, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IoPriorityBit' : [ 0xf, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Spare1' : [ 0xf, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], 'StaticState' : [ 0xc, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'AllFlags' : [ 0xc, ['BitField', dict(start_bit = 8, end_bit = 32, native_type='unsigned long')]], 'LockState' : [ 0x10, ['_KLOCK_ENTRY_LOCK_STATE']], 'LockUnsafe' : [ 0x10, ['pointer', ['void']]], 'CrossThreadReleasableAndBusyByte' : [ 0x10, ['unsigned char']], 'Reserved' : [ 0x11, ['array', 2, ['unsigned char']]], 'InTreeByte' : [ 0x13, ['unsigned char']], 'SessionState' : [ 0x14, ['pointer', ['void']]], 'SessionId' : [ 0x14, ['unsigned long']], 'OwnerTree' : [ 0x18, ['_RTL_RB_TREE']], 'WaiterTree' : [ 0x20, ['_RTL_RB_TREE']], 'CpuPriorityKey' : [ 0x18, ['unsigned char']], 'EntryLock' : [ 0x28, ['unsigned long']], 'AllBoosts' : [ 0x2c, ['unsigned short']], 'IoBoost' : [ 0x2c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'CpuBoostsBitmap' : [ 0x2c, ['BitField', dict(start_bit = 1, end_bit = 16, native_type='unsigned short')]], 'IoNormalPriorityWaiterCount' : [ 0x2e, ['unsigned short']], } ], '_OBP_SYSTEM_DOS_DEVICE_STATE' : [ 0x6c, { 'GlobalDeviceMap' : [ 0x0, ['unsigned long']], 'LocalDeviceCount' : [ 0x4, ['array', 26, ['unsigned long']]], } ], '_MMPTE_SOFTWARE' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'PageFileLow' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 5, native_type='unsigned long long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'PageFileReserved' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long long')]], 'PageFileAllocated' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 32, native_type='unsigned long long')]], 'PageFileHigh' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 64, native_type='unsigned long long')]], } ], '__unnamed_1ffd' : [ 0x8, { 'IoStatus' : [ 0x0, ['_IO_STATUS_BLOCK']], } ], '_MMMOD_WRITER_MDL_ENTRY' : [ 0xa0, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'u' : [ 0x8, ['__unnamed_1ffd']], 'Irp' : [ 0x10, ['pointer', ['_IRP']]], 'u1' : [ 0x14, ['_MODWRITER_FLAGS']], 'StoreWriteRefCount' : [ 0x18, ['unsigned long']], 'StoreWriteCompletionApc' : [ 0x1c, ['_KAPC']], 'ByteCount' : [ 0x4c, ['unsigned long']], 'ChargedPages' : [ 0x50, ['unsigned long']], 'PagingFile' : [ 0x54, ['pointer', ['_MMPAGING_FILE']]], 'File' : [ 0x58, ['pointer', ['_FILE_OBJECT']]], 'ControlArea' : [ 0x5c, ['pointer', ['_CONTROL_AREA']]], 'FileResource' : [ 0x60, ['pointer', ['_ERESOURCE']]], 'WriteOffset' : [ 0x68, ['_LARGE_INTEGER']], 'IssueTime' : [ 0x70, ['_LARGE_INTEGER']], 'Partition' : [ 0x78, ['pointer', ['_MI_PARTITION']]], 'PointerMdl' : [ 0x7c, ['pointer', ['_MDL']]], 'Mdl' : [ 0x80, ['_MDL']], 'Page' : [ 0x9c, ['array', 1, ['unsigned long']]], } ], '_MI_PARTITION_COMMIT' : [ 0x20, { 'PeakCommitment' : [ 0x0, ['unsigned long']], 'TotalCommitLimitMaximum' : [ 0x4, ['unsigned long']], 'Popups' : [ 0x8, ['array', 2, ['long']]], 'LowCommitThreshold' : [ 0x10, ['unsigned long']], 'HighCommitThreshold' : [ 0x14, ['unsigned long']], 'EventLock' : [ 0x18, ['unsigned long']], 'SystemCommitReserve' : [ 0x1c, ['unsigned long']], } ], '_NT_TIB32' : [ 0x1c, { 'ExceptionList' : [ 0x0, ['unsigned long']], 'StackBase' : [ 0x4, ['unsigned long']], 'StackLimit' : [ 0x8, ['unsigned long']], 'SubSystemTib' : [ 0xc, ['unsigned long']], 'FiberData' : [ 0x10, ['unsigned long']], 'Version' : [ 0x10, ['unsigned long']], 'ArbitraryUserPointer' : [ 0x14, ['unsigned long']], 'Self' : [ 0x18, ['unsigned long']], } ], '_CM_RESOURCE_LIST' : [ 0x24, { 'Count' : [ 0x0, ['unsigned long']], 'List' : [ 0x4, ['array', 1, ['_CM_FULL_RESOURCE_DESCRIPTOR']]], } ], '_TOKEN_PRIVILEGES' : [ 0x10, { 'PrivilegeCount' : [ 0x0, ['unsigned long']], 'Privileges' : [ 0x4, ['array', 1, ['_LUID_AND_ATTRIBUTES']]], } ], '_POOL_TRACKER_TABLE' : [ 0x1c, { 'Key' : [ 0x0, ['long']], 'NonPagedAllocs' : [ 0x4, ['unsigned long']], 'NonPagedFrees' : [ 0x8, ['unsigned long']], 'NonPagedBytes' : [ 0xc, ['unsigned long']], 'PagedAllocs' : [ 0x10, ['unsigned long']], 'PagedFrees' : [ 0x14, ['unsigned long']], 'PagedBytes' : [ 0x18, ['unsigned long']], } ], '_CM_FULL_RESOURCE_DESCRIPTOR' : [ 0x20, { 'InterfaceType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'BusNumber' : [ 0x4, ['unsigned long']], 'PartialResourceList' : [ 0x8, ['_CM_PARTIAL_RESOURCE_LIST']], } ], '_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS' : [ 0x4, { 'Primary' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ContainmentWarning' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reset' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'ThresholdExceeded' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'ResourceNotAvailable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'LatentError' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_WMI_BUFFER_HEADER' : [ 0x48, { 'BufferSize' : [ 0x0, ['unsigned long']], 'SavedOffset' : [ 0x4, ['unsigned long']], 'CurrentOffset' : [ 0x8, ['unsigned long']], 'ReferenceCount' : [ 0xc, ['long']], 'TimeStamp' : [ 0x10, ['_LARGE_INTEGER']], 'SequenceNumber' : [ 0x18, ['long long']], 'ClockType' : [ 0x20, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long long')]], 'Frequency' : [ 0x20, ['BitField', dict(start_bit = 3, end_bit = 64, native_type='unsigned long long')]], 'SlistEntry' : [ 0x20, ['_SINGLE_LIST_ENTRY']], 'NextBuffer' : [ 0x20, ['pointer', ['_WMI_BUFFER_HEADER']]], 'ClientContext' : [ 0x28, ['_ETW_BUFFER_CONTEXT']], 'State' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'EtwBufferStateFree', 1: 'EtwBufferStateGeneralLogging', 2: 'EtwBufferStateCSwitch', 3: 'EtwBufferStateFlush', 4: 'EtwBufferStateMaximum'})]], 'Offset' : [ 0x30, ['unsigned long']], 'BufferFlag' : [ 0x34, ['unsigned short']], 'BufferType' : [ 0x36, ['unsigned short']], 'Padding1' : [ 0x38, ['array', 4, ['unsigned long']]], 'ReferenceTime' : [ 0x38, ['_ETW_REF_CLOCK']], 'GlobalEntry' : [ 0x38, ['_LIST_ENTRY']], 'Pointer0' : [ 0x38, ['pointer', ['void']]], 'Pointer1' : [ 0x3c, ['pointer', ['void']]], } ], '_NT_TIB64' : [ 0x38, { 'ExceptionList' : [ 0x0, ['unsigned long long']], 'StackBase' : [ 0x8, ['unsigned long long']], 'StackLimit' : [ 0x10, ['unsigned long long']], 'SubSystemTib' : [ 0x18, ['unsigned long long']], 'FiberData' : [ 0x20, ['unsigned long long']], 'Version' : [ 0x20, ['unsigned long']], 'ArbitraryUserPointer' : [ 0x28, ['unsigned long long']], 'Self' : [ 0x30, ['unsigned long long']], } ], '_POWER_SEQUENCE' : [ 0xc, { 'SequenceD1' : [ 0x0, ['unsigned long']], 'SequenceD2' : [ 0x4, ['unsigned long']], 'SequenceD3' : [ 0x8, ['unsigned long']], } ], '_EPROCESS_VALUES' : [ 0x50, { 'KernelTime' : [ 0x0, ['unsigned long long']], 'UserTime' : [ 0x8, ['unsigned long long']], 'CycleTime' : [ 0x10, ['unsigned long long']], 'ContextSwitches' : [ 0x18, ['unsigned long long']], 'ReadOperationCount' : [ 0x20, ['long long']], 'WriteOperationCount' : [ 0x28, ['long long']], 'OtherOperationCount' : [ 0x30, ['long long']], 'ReadTransferCount' : [ 0x38, ['long long']], 'WriteTransferCount' : [ 0x40, ['long long']], 'OtherTransferCount' : [ 0x48, ['long long']], } ], '_PROCESSOR_POWER_STATE' : [ 0x180, { 'IdleStates' : [ 0x0, ['pointer', ['_PPM_IDLE_STATES']]], 'IdleAccounting' : [ 0x4, ['pointer', ['_PROC_IDLE_ACCOUNTING']]], 'IdleTimeLast' : [ 0x8, ['unsigned long long']], 'IdleTimeTotal' : [ 0x10, ['unsigned long long']], 'IdleTimeEntry' : [ 0x18, ['unsigned long long']], 'IdleTimeExpiration' : [ 0x20, ['unsigned long long']], 'NonInterruptibleTransition' : [ 0x28, ['unsigned char']], 'PepWokenTransition' : [ 0x29, ['unsigned char']], 'Class' : [ 0x2a, ['unsigned char']], 'TargetIdleState' : [ 0x2c, ['unsigned long']], 'IdlePolicy' : [ 0x30, ['_PROC_IDLE_POLICY']], 'Synchronization' : [ 0x38, ['_PPM_IDLE_SYNCHRONIZATION_STATE']], 'PerfFeedback' : [ 0x40, ['_PROC_FEEDBACK']], 'Hypervisor' : [ 0xc8, ['Enumeration', dict(target = 'long', choices = {0: 'ProcHypervisorNone', 1: 'ProcHypervisorPresent', 2: 'ProcHypervisorPower', 3: 'ProcHypervisorHvCounters'})]], 'LastSysTime' : [ 0xcc, ['unsigned long']], 'WmiDispatchPtr' : [ 0xd0, ['unsigned long']], 'WmiInterfaceEnabled' : [ 0xd4, ['long']], 'FFHThrottleStateInfo' : [ 0xd8, ['_PPM_FFH_THROTTLE_STATE_INFO']], 'PerfActionDpc' : [ 0xf8, ['_KDPC']], 'PerfActionMask' : [ 0x118, ['long']], 'HvIdleCheck' : [ 0x120, ['_PROC_IDLE_SNAP']], 'PerfCheck' : [ 0x130, ['pointer', ['_PROC_PERF_CHECK']]], 'Domain' : [ 0x134, ['pointer', ['_PROC_PERF_DOMAIN']]], 'PerfConstraint' : [ 0x138, ['pointer', ['_PROC_PERF_CONSTRAINT']]], 'Concurrency' : [ 0x13c, ['pointer', ['_PPM_CONCURRENCY_ACCOUNTING']]], 'Load' : [ 0x140, ['pointer', ['_PROC_PERF_LOAD']]], 'PerfHistory' : [ 0x144, ['pointer', ['_PROC_PERF_HISTORY']]], 'GuaranteedPerformancePercent' : [ 0x148, ['unsigned char']], 'HvTargetState' : [ 0x149, ['unsigned char']], 'Parked' : [ 0x14a, ['unsigned char']], 'LatestPerformancePercent' : [ 0x14c, ['unsigned long']], 'AveragePerformancePercent' : [ 0x150, ['unsigned long']], 'LatestAffinitizedPercent' : [ 0x154, ['unsigned long']], 'RelativePerformance' : [ 0x158, ['unsigned long']], 'Utility' : [ 0x15c, ['unsigned long']], 'AffinitizedUtility' : [ 0x160, ['unsigned long']], 'SnapTimeLast' : [ 0x168, ['unsigned long long']], 'EnergyConsumed' : [ 0x168, ['unsigned long long']], 'ActiveTime' : [ 0x170, ['unsigned long long']], 'TotalTime' : [ 0x178, ['unsigned long long']], } ], '_OBJECT_REF_STACK_INFO' : [ 0xc, { 'Sequence' : [ 0x0, ['unsigned long']], 'Index' : [ 0x4, ['unsigned short']], 'NumTraces' : [ 0x6, ['unsigned short']], 'Tag' : [ 0x8, ['unsigned long']], } ], '_PPC_DBGKD_CONTROL_SET' : [ 0xc, { 'Continue' : [ 0x0, ['unsigned long']], 'CurrentSymbolStart' : [ 0x4, ['unsigned long']], 'CurrentSymbolEnd' : [ 0x8, ['unsigned long']], } ], '_MMPFNENTRY' : [ 0x2, { 'PageLocation' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'WriteInProgress' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Modified' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'ReadInProgress' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'CacheAttribute' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], 'Priority' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'OnProtectedStandby' : [ 0x1, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'InPageError' : [ 0x1, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'SystemChargedPage' : [ 0x1, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'RemovalRequested' : [ 0x1, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'ParityError' : [ 0x1, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], } ], '_THREAD_ENERGY_VALUES' : [ 0x40, { 'Cycles' : [ 0x0, ['array', 4, ['array', 2, ['unsigned long long']]]], } ], '_SEGMENT_OBJECT' : [ 0x28, { 'BaseAddress' : [ 0x0, ['pointer', ['void']]], 'TotalNumberOfPtes' : [ 0x4, ['unsigned long']], 'SizeOfSegment' : [ 0x8, ['_LARGE_INTEGER']], 'NonExtendedPtes' : [ 0x10, ['unsigned long']], 'ImageCommitment' : [ 0x14, ['unsigned long']], 'ControlArea' : [ 0x18, ['pointer', ['_CONTROL_AREA']]], 'Subsection' : [ 0x1c, ['pointer', ['_SUBSECTION']]], 'MmSectionFlags' : [ 0x20, ['pointer', ['_MMSECTION_FLAGS']]], 'MmSubSectionFlags' : [ 0x24, ['pointer', ['_MMSUBSECTION_FLAGS']]], } ], '_PCW_CALLBACK_INFORMATION' : [ 0x20, { 'AddCounter' : [ 0x0, ['_PCW_COUNTER_INFORMATION']], 'RemoveCounter' : [ 0x0, ['_PCW_COUNTER_INFORMATION']], 'EnumerateInstances' : [ 0x0, ['_PCW_MASK_INFORMATION']], 'CollectData' : [ 0x0, ['_PCW_MASK_INFORMATION']], } ], '_CC_ASYNC_READ_CONTEXT' : [ 0x14, { 'CompletionRoutine' : [ 0x0, ['pointer', ['void']]], 'Context' : [ 0x4, ['pointer', ['void']]], 'Mdl' : [ 0x8, ['pointer', ['_MDL']]], 'RequestorMode' : [ 0xc, ['unsigned char']], 'NestingLevel' : [ 0x10, ['unsigned long']], } ], '_KTSS' : [ 0x20ac, { 'Backlink' : [ 0x0, ['unsigned short']], 'Reserved0' : [ 0x2, ['unsigned short']], 'Esp0' : [ 0x4, ['unsigned long']], 'Ss0' : [ 0x8, ['unsigned short']], 'Reserved1' : [ 0xa, ['unsigned short']], 'NotUsed1' : [ 0xc, ['array', 4, ['unsigned long']]], 'CR3' : [ 0x1c, ['unsigned long']], 'Eip' : [ 0x20, ['unsigned long']], 'EFlags' : [ 0x24, ['unsigned long']], 'Eax' : [ 0x28, ['unsigned long']], 'Ecx' : [ 0x2c, ['unsigned long']], 'Edx' : [ 0x30, ['unsigned long']], 'Ebx' : [ 0x34, ['unsigned long']], 'Esp' : [ 0x38, ['unsigned long']], 'Ebp' : [ 0x3c, ['unsigned long']], 'Esi' : [ 0x40, ['unsigned long']], 'Edi' : [ 0x44, ['unsigned long']], 'Es' : [ 0x48, ['unsigned short']], 'Reserved2' : [ 0x4a, ['unsigned short']], 'Cs' : [ 0x4c, ['unsigned short']], 'Reserved3' : [ 0x4e, ['unsigned short']], 'Ss' : [ 0x50, ['unsigned short']], 'Reserved4' : [ 0x52, ['unsigned short']], 'Ds' : [ 0x54, ['unsigned short']], 'Reserved5' : [ 0x56, ['unsigned short']], 'Fs' : [ 0x58, ['unsigned short']], 'Reserved6' : [ 0x5a, ['unsigned short']], 'Gs' : [ 0x5c, ['unsigned short']], 'Reserved7' : [ 0x5e, ['unsigned short']], 'LDT' : [ 0x60, ['unsigned short']], 'Reserved8' : [ 0x62, ['unsigned short']], 'Flags' : [ 0x64, ['unsigned short']], 'IoMapBase' : [ 0x66, ['unsigned short']], 'IoMaps' : [ 0x68, ['array', 1, ['_KiIoAccessMap']]], 'IntDirectionMap' : [ 0x208c, ['array', 32, ['unsigned char']]], } ], '_TOKEN_SOURCE' : [ 0x10, { 'SourceName' : [ 0x0, ['array', 8, ['unsigned char']]], 'SourceIdentifier' : [ 0x8, ['_LUID']], } ], '_CMHIVE' : [ 0xf20, { 'Hive' : [ 0x0, ['_HHIVE']], 'FileHandles' : [ 0x6f0, ['array', 6, ['pointer', ['void']]]], 'NotifyList' : [ 0x708, ['_LIST_ENTRY']], 'HiveList' : [ 0x710, ['_LIST_ENTRY']], 'PreloadedHiveList' : [ 0x718, ['_LIST_ENTRY']], 'FailedUnloadList' : [ 0x720, ['_LIST_ENTRY']], 'HiveRundown' : [ 0x728, ['_EX_RUNDOWN_REF']], 'ParseCacheEntries' : [ 0x72c, ['_LIST_ENTRY']], 'KcbCacheTable' : [ 0x734, ['pointer', ['_CM_KEY_HASH_TABLE_ENTRY']]], 'KcbCacheTableSize' : [ 0x738, ['unsigned long']], 'DeletedKcbTable' : [ 0x73c, ['pointer', ['_CM_KEY_HASH_TABLE_ENTRY']]], 'DeletedKcbTableSize' : [ 0x740, ['unsigned long']], 'Identity' : [ 0x744, ['unsigned long']], 'HiveLock' : [ 0x748, ['pointer', ['_FAST_MUTEX']]], 'WriterLock' : [ 0x74c, ['pointer', ['_FAST_MUTEX']]], 'FlusherLock' : [ 0x750, ['pointer', ['_ERESOURCE']]], 'FlushDirtyVector' : [ 0x754, ['_RTL_BITMAP']], 'FlushDirtyVectorSize' : [ 0x75c, ['unsigned long']], 'FlushLogEntry' : [ 0x760, ['pointer', ['unsigned char']]], 'FlushLogEntrySize' : [ 0x764, ['unsigned long']], 'FlushHiveTruncated' : [ 0x768, ['unsigned long']], 'FlushBaseBlockDirty' : [ 0x76c, ['unsigned char']], 'CapturedUnreconciledVector' : [ 0x770, ['_RTL_BITMAP']], 'CapturedUnreconciledVectorSize' : [ 0x778, ['unsigned long']], 'UnreconciledOffsetArray' : [ 0x77c, ['pointer', ['CMP_OFFSET_ARRAY']]], 'UnreconciledOffsetArrayCount' : [ 0x780, ['unsigned long']], 'UnreconciledBaseBlock' : [ 0x784, ['pointer', ['_HBASE_BLOCK']]], 'SecurityLock' : [ 0x788, ['_EX_PUSH_LOCK']], 'UseCount' : [ 0x78c, ['unsigned long']], 'LastShrinkHiveSize' : [ 0x790, ['unsigned long']], 'ActualFileSize' : [ 0x798, ['_LARGE_INTEGER']], 'LogFileSizes' : [ 0x7a0, ['array', 2, ['_LARGE_INTEGER']]], 'FileFullPath' : [ 0x7b0, ['_UNICODE_STRING']], 'FileUserName' : [ 0x7b8, ['_UNICODE_STRING']], 'HiveRootPath' : [ 0x7c0, ['_UNICODE_STRING']], 'SecurityCount' : [ 0x7c8, ['unsigned long']], 'SecurityCacheSize' : [ 0x7cc, ['unsigned long']], 'SecurityHitHint' : [ 0x7d0, ['long']], 'SecurityCache' : [ 0x7d4, ['pointer', ['_CM_KEY_SECURITY_CACHE_ENTRY']]], 'SecurityHash' : [ 0x7d8, ['array', 64, ['_LIST_ENTRY']]], 'UnloadEventCount' : [ 0x9d8, ['unsigned long']], 'UnloadEventArray' : [ 0x9dc, ['pointer', ['pointer', ['_KEVENT']]]], 'RootKcb' : [ 0x9e0, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'Frozen' : [ 0x9e4, ['unsigned char']], 'UnloadWorkItem' : [ 0x9e8, ['pointer', ['_CM_WORKITEM']]], 'UnloadWorkItemHolder' : [ 0x9ec, ['_CM_WORKITEM']], 'GrowOnlyMode' : [ 0xa00, ['unsigned char']], 'GrowOffset' : [ 0xa04, ['unsigned long']], 'KcbConvertListHead' : [ 0xa08, ['_LIST_ENTRY']], 'CellRemapArray' : [ 0xa10, ['pointer', ['_CM_CELL_REMAP_BLOCK']]], 'DirtyVectorLog' : [ 0xa14, ['_CM_DIRTY_VECTOR_LOG']], 'Flags' : [ 0xc9c, ['unsigned long']], 'TrustClassEntry' : [ 0xca0, ['_LIST_ENTRY']], 'DirtyTime' : [ 0xca8, ['unsigned long long']], 'UnreconciledTime' : [ 0xcb0, ['unsigned long long']], 'CmRm' : [ 0xcb8, ['pointer', ['_CM_RM']]], 'CmRmInitFailPoint' : [ 0xcbc, ['unsigned long']], 'CmRmInitFailStatus' : [ 0xcc0, ['long']], 'CreatorOwner' : [ 0xcc4, ['pointer', ['_KTHREAD']]], 'RundownThread' : [ 0xcc8, ['pointer', ['_KTHREAD']]], 'LastWriteTime' : [ 0xcd0, ['_LARGE_INTEGER']], 'FlushQueue' : [ 0xcd8, ['_HIVE_WRITE_WAIT_QUEUE']], 'ReconcileQueue' : [ 0xce4, ['_HIVE_WRITE_WAIT_QUEUE']], 'FlushFlags' : [ 0xcf0, ['unsigned long']], 'FlushActive' : [ 0xcf0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReconcileActive' : [ 0xcf0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PrimaryFilePurged' : [ 0xcf0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'DiskFileBad' : [ 0xcf0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'PrimaryFileSizeBeforeLastFlush' : [ 0xcf4, ['unsigned long']], 'ReferenceCount' : [ 0xcf8, ['long']], 'UnloadHistoryIndex' : [ 0xcfc, ['long']], 'UnloadHistory' : [ 0xd00, ['array', 128, ['unsigned long']]], 'BootStart' : [ 0xf00, ['unsigned long']], 'UnaccessedStart' : [ 0xf04, ['unsigned long']], 'UnaccessedEnd' : [ 0xf08, ['unsigned long']], 'LoadedKeyCount' : [ 0xf0c, ['unsigned long']], 'HandleClosePending' : [ 0xf10, ['unsigned long']], 'HandleClosePendingEvent' : [ 0xf14, ['_EX_PUSH_LOCK']], 'FinalFlushSucceeded' : [ 0xf18, ['unsigned char']], 'FailedUnload' : [ 0xf19, ['unsigned char']], } ], '_DBGKD_QUERY_MEMORY' : [ 0x18, { 'Address' : [ 0x0, ['unsigned long long']], 'Reserved' : [ 0x8, ['unsigned long long']], 'AddressSpace' : [ 0x10, ['unsigned long']], 'Flags' : [ 0x14, ['unsigned long']], } ], '_KIDTENTRY' : [ 0x8, { 'Offset' : [ 0x0, ['unsigned short']], 'Selector' : [ 0x2, ['unsigned short']], 'Access' : [ 0x4, ['unsigned short']], 'ExtendedOffset' : [ 0x6, ['unsigned short']], } ], '_DIRTY_PAGE_THRESHOLDS' : [ 0x28, { 'DirtyPageThreshold' : [ 0x0, ['unsigned long']], 'DirtyPageThresholdTop' : [ 0x4, ['unsigned long']], 'DirtyPageThresholdBottom' : [ 0x8, ['unsigned long']], 'DirtyPageTarget' : [ 0xc, ['unsigned long']], 'AggregateAvailablePages' : [ 0x10, ['unsigned long long']], 'AggregateDirtyPages' : [ 0x18, ['unsigned long long']], 'AvailableHistory' : [ 0x20, ['unsigned long']], } ], 'DOCK_INTERFACE' : [ 0x18, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], 'ProfileDepartureSetMode' : [ 0x10, ['pointer', ['void']]], 'ProfileDepartureUpdate' : [ 0x14, ['pointer', ['void']]], } ], 'CMP_OFFSET_ARRAY' : [ 0xc, { 'FileOffset' : [ 0x0, ['unsigned long']], 'DataBuffer' : [ 0x4, ['pointer', ['void']]], 'DataLength' : [ 0x8, ['unsigned long']], } ], '_MMSUPPORT_FLAGS' : [ 0x4, { 'WorkingSetType' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'ForceCredits' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 6, native_type='unsigned char')]], 'MaximumWorkingSetHard' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'MinimumWorkingSetHard' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'SessionMaster' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'TrimmerState' : [ 0x1, ['BitField', dict(start_bit = 1, end_bit = 3, native_type='unsigned char')]], 'Reserved' : [ 0x1, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'PageStealers' : [ 0x1, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], 'MemoryPriority' : [ 0x2, ['unsigned char']], 'WsleDeleted' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'VmExiting' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'ExpansionFailed' : [ 0x3, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'SvmEnabled' : [ 0x3, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'ForceAge' : [ 0x3, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'NewMaximum' : [ 0x3, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'CommitReleaseState' : [ 0x3, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], } ], '_PPM_VETO_ENTRY' : [ 0x10, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'VetoReason' : [ 0x8, ['unsigned long']], 'ReferenceCount' : [ 0xc, ['unsigned long']], } ], '_IMAGE_OPTIONAL_HEADER' : [ 0xe0, { 'Magic' : [ 0x0, ['unsigned short']], 'MajorLinkerVersion' : [ 0x2, ['unsigned char']], 'MinorLinkerVersion' : [ 0x3, ['unsigned char']], 'SizeOfCode' : [ 0x4, ['unsigned long']], 'SizeOfInitializedData' : [ 0x8, ['unsigned long']], 'SizeOfUninitializedData' : [ 0xc, ['unsigned long']], 'AddressOfEntryPoint' : [ 0x10, ['unsigned long']], 'BaseOfCode' : [ 0x14, ['unsigned long']], 'BaseOfData' : [ 0x18, ['unsigned long']], 'ImageBase' : [ 0x1c, ['unsigned long']], 'SectionAlignment' : [ 0x20, ['unsigned long']], 'FileAlignment' : [ 0x24, ['unsigned long']], 'MajorOperatingSystemVersion' : [ 0x28, ['unsigned short']], 'MinorOperatingSystemVersion' : [ 0x2a, ['unsigned short']], 'MajorImageVersion' : [ 0x2c, ['unsigned short']], 'MinorImageVersion' : [ 0x2e, ['unsigned short']], 'MajorSubsystemVersion' : [ 0x30, ['unsigned short']], 'MinorSubsystemVersion' : [ 0x32, ['unsigned short']], 'Win32VersionValue' : [ 0x34, ['unsigned long']], 'SizeOfImage' : [ 0x38, ['unsigned long']], 'SizeOfHeaders' : [ 0x3c, ['unsigned long']], 'CheckSum' : [ 0x40, ['unsigned long']], 'Subsystem' : [ 0x44, ['unsigned short']], 'DllCharacteristics' : [ 0x46, ['unsigned short']], 'SizeOfStackReserve' : [ 0x48, ['unsigned long']], 'SizeOfStackCommit' : [ 0x4c, ['unsigned long']], 'SizeOfHeapReserve' : [ 0x50, ['unsigned long']], 'SizeOfHeapCommit' : [ 0x54, ['unsigned long']], 'LoaderFlags' : [ 0x58, ['unsigned long']], 'NumberOfRvaAndSizes' : [ 0x5c, ['unsigned long']], 'DataDirectory' : [ 0x60, ['array', 16, ['_IMAGE_DATA_DIRECTORY']]], } ], '_ALPC_COMPLETION_PACKET_LOOKASIDE' : [ 0x30, { 'Lock' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], 'ActiveCount' : [ 0x8, ['unsigned long']], 'PendingNullCount' : [ 0xc, ['unsigned long']], 'PendingCheckCompletionListCount' : [ 0x10, ['unsigned long']], 'PendingDelete' : [ 0x14, ['unsigned long']], 'FreeListHead' : [ 0x18, ['_SINGLE_LIST_ENTRY']], 'CompletionPort' : [ 0x1c, ['pointer', ['void']]], 'CompletionKey' : [ 0x20, ['pointer', ['void']]], 'Entry' : [ 0x24, ['array', 1, ['_ALPC_COMPLETION_PACKET_LOOKASIDE_ENTRY']]], } ], '_KSYSTEM_TIME' : [ 0xc, { 'LowPart' : [ 0x0, ['unsigned long']], 'High1Time' : [ 0x4, ['long']], 'High2Time' : [ 0x8, ['long']], } ], '_TERMINATION_PORT' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_TERMINATION_PORT']]], 'Port' : [ 0x4, ['pointer', ['void']]], } ], '_MEMORY_ALLOCATION_DESCRIPTOR' : [ 0x14, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'MemoryType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'LoaderExceptionBlock', 1: 'LoaderSystemBlock', 2: 'LoaderFree', 3: 'LoaderBad', 4: 'LoaderLoadedProgram', 5: 'LoaderFirmwareTemporary', 6: 'LoaderFirmwarePermanent', 7: 'LoaderOsloaderHeap', 8: 'LoaderOsloaderStack', 9: 'LoaderSystemCode', 10: 'LoaderHalCode', 11: 'LoaderBootDriver', 12: 'LoaderConsoleInDriver', 13: 'LoaderConsoleOutDriver', 14: 'LoaderStartupDpcStack', 15: 'LoaderStartupKernelStack', 16: 'LoaderStartupPanicStack', 17: 'LoaderStartupPcrPage', 18: 'LoaderStartupPdrPage', 19: 'LoaderRegistryData', 20: 'LoaderMemoryData', 21: 'LoaderNlsData', 22: 'LoaderSpecialMemory', 23: 'LoaderBBTMemory', 24: 'LoaderZero', 25: 'LoaderXIPRom', 26: 'LoaderHALCachedMemory', 27: 'LoaderLargePageFiller', 28: 'LoaderErrorLogMemory', 29: 'LoaderVsmMemory', 30: 'LoaderFirmwareCode', 31: 'LoaderFirmwareData', 32: 'LoaderFirmwareReserved', 33: 'LoaderMaximum'})]], 'BasePage' : [ 0xc, ['unsigned long']], 'PageCount' : [ 0x10, ['unsigned long']], } ], '_CM_INTENT_LOCK' : [ 0x8, { 'OwnerCount' : [ 0x0, ['unsigned long']], 'OwnerTable' : [ 0x4, ['pointer', ['pointer', ['_CM_KCB_UOW']]]], } ], '_PROC_IDLE_ACCOUNTING' : [ 0x400, { 'StateCount' : [ 0x0, ['unsigned long']], 'TotalTransitions' : [ 0x4, ['unsigned long']], 'ResetCount' : [ 0x8, ['unsigned long']], 'AbortCount' : [ 0xc, ['unsigned long']], 'StartTime' : [ 0x10, ['unsigned long long']], 'PriorIdleTime' : [ 0x18, ['unsigned long long']], 'TimeUnit' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'PpmIdleBucketTimeInQpc', 1: 'PpmIdleBucketTimeIn100ns', 2: 'PpmIdleBucketTimeMaximum'})]], 'State' : [ 0x28, ['array', 1, ['_PROC_IDLE_STATE_ACCOUNTING']]], } ], '_THERMAL_INFORMATION' : [ 0x4c, { 'ThermalStamp' : [ 0x0, ['unsigned long']], 'ThermalConstant1' : [ 0x4, ['unsigned long']], 'ThermalConstant2' : [ 0x8, ['unsigned long']], 'Processors' : [ 0xc, ['unsigned long']], 'SamplingPeriod' : [ 0x10, ['unsigned long']], 'CurrentTemperature' : [ 0x14, ['unsigned long']], 'PassiveTripPoint' : [ 0x18, ['unsigned long']], 'CriticalTripPoint' : [ 0x1c, ['unsigned long']], 'ActiveTripPointCount' : [ 0x20, ['unsigned char']], 'ActiveTripPoint' : [ 0x24, ['array', 10, ['unsigned long']]], } ], '_SEP_LOWBOX_NUMBER_MAPPING' : [ 0x14, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'Bitmap' : [ 0x4, ['_RTL_BITMAP']], 'HashTable' : [ 0xc, ['pointer', ['_RTL_DYNAMIC_HASH_TABLE']]], 'Active' : [ 0x10, ['unsigned char']], } ], '_MAPPED_FILE_SEGMENT' : [ 0x20, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'TotalNumberOfPtes' : [ 0x4, ['unsigned long']], 'SegmentFlags' : [ 0x8, ['_SEGMENT_FLAGS']], 'NumberOfCommittedPages' : [ 0xc, ['unsigned long']], 'SizeOfSegment' : [ 0x10, ['unsigned long long']], 'ExtendInfo' : [ 0x18, ['pointer', ['_MMEXTEND_INFO']]], 'BasedAddress' : [ 0x18, ['pointer', ['void']]], 'SegmentLock' : [ 0x1c, ['_EX_PUSH_LOCK']], } ], '_GDI_TEB_BATCH' : [ 0x4e0, { 'Offset' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='unsigned long')]], 'HasRenderingCommand' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'HDC' : [ 0x4, ['unsigned long']], 'Buffer' : [ 0x8, ['array', 310, ['unsigned long']]], } ], '_MM_DRIVER_VERIFIER_DATA' : [ 0x8c, { 'Level' : [ 0x0, ['unsigned long']], 'RaiseIrqls' : [ 0x4, ['unsigned long']], 'AcquireSpinLocks' : [ 0x8, ['unsigned long']], 'SynchronizeExecutions' : [ 0xc, ['unsigned long']], 'AllocationsAttempted' : [ 0x10, ['unsigned long']], 'AllocationsSucceeded' : [ 0x14, ['unsigned long']], 'AllocationsSucceededSpecialPool' : [ 0x18, ['unsigned long']], 'AllocationsWithNoTag' : [ 0x1c, ['unsigned long']], 'TrimRequests' : [ 0x20, ['unsigned long']], 'Trims' : [ 0x24, ['unsigned long']], 'AllocationsFailed' : [ 0x28, ['unsigned long']], 'AllocationsFailedDeliberately' : [ 0x2c, ['unsigned long']], 'Loads' : [ 0x30, ['unsigned long']], 'Unloads' : [ 0x34, ['unsigned long']], 'UnTrackedPool' : [ 0x38, ['unsigned long']], 'UserTrims' : [ 0x3c, ['unsigned long']], 'CurrentPagedPoolAllocations' : [ 0x40, ['unsigned long']], 'CurrentNonPagedPoolAllocations' : [ 0x44, ['unsigned long']], 'PeakPagedPoolAllocations' : [ 0x48, ['unsigned long']], 'PeakNonPagedPoolAllocations' : [ 0x4c, ['unsigned long']], 'PagedBytes' : [ 0x50, ['unsigned long']], 'NonPagedBytes' : [ 0x54, ['unsigned long']], 'PeakPagedBytes' : [ 0x58, ['unsigned long']], 'PeakNonPagedBytes' : [ 0x5c, ['unsigned long']], 'BurstAllocationsFailedDeliberately' : [ 0x60, ['unsigned long']], 'SessionTrims' : [ 0x64, ['unsigned long']], 'OptionChanges' : [ 0x68, ['unsigned long']], 'VerifyMode' : [ 0x6c, ['unsigned long']], 'PreviousBucketName' : [ 0x70, ['_UNICODE_STRING']], 'ExecutePoolTypes' : [ 0x78, ['unsigned long']], 'ExecutePageProtections' : [ 0x7c, ['unsigned long']], 'ExecutePageMappings' : [ 0x80, ['unsigned long']], 'ExecuteWriteSections' : [ 0x84, ['unsigned long']], 'SectionAlignmentFailures' : [ 0x88, ['unsigned long']], } ], '_VF_DRIVER_IO_CALLBACKS' : [ 0x80, { 'DriverInit' : [ 0x0, ['pointer', ['void']]], 'DriverStartIo' : [ 0x4, ['pointer', ['void']]], 'DriverUnload' : [ 0x8, ['pointer', ['void']]], 'AddDevice' : [ 0xc, ['pointer', ['void']]], 'MajorFunction' : [ 0x10, ['array', 28, ['pointer', ['void']]]], } ], '_HIVE_WRITE_WAIT_QUEUE' : [ 0xc, { 'ActiveThread' : [ 0x0, ['pointer', ['_ETHREAD']]], 'WaitList' : [ 0x4, ['pointer', ['_HIVE_WAIT_PACKET']]], 'OwnerBoosted' : [ 0x8, ['unsigned long']], } ], '_VI_FAULT_TRACE' : [ 0x24, { 'Thread' : [ 0x0, ['pointer', ['_ETHREAD']]], 'StackTrace' : [ 0x4, ['array', 8, ['pointer', ['void']]]], } ], '_TRIAGE_PNP_DEVICE_COMPLETION_QUEUE' : [ 0x8, { 'DispatchedList' : [ 0x0, ['_LIST_ENTRY']], } ], '_GENERIC_MAPPING' : [ 0x10, { 'GenericRead' : [ 0x0, ['unsigned long']], 'GenericWrite' : [ 0x4, ['unsigned long']], 'GenericExecute' : [ 0x8, ['unsigned long']], 'GenericAll' : [ 0xc, ['unsigned long']], } ], '_OBJECT_HANDLE_COUNT_DATABASE' : [ 0xc, { 'CountEntries' : [ 0x0, ['unsigned long']], 'HandleCountEntries' : [ 0x4, ['array', 1, ['_OBJECT_HANDLE_COUNT_ENTRY']]], } ], '_OWNER_ENTRY' : [ 0x8, { 'OwnerThread' : [ 0x0, ['unsigned long']], 'IoPriorityBoosted' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'OwnerReferenced' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'OwnerCount' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'TableSize' : [ 0x4, ['unsigned long']], } ], '_ETIMER' : [ 0xb8, { 'KeTimer' : [ 0x0, ['_KTIMER']], 'Lock' : [ 0x28, ['unsigned long']], 'TimerApc' : [ 0x2c, ['_KAPC']], 'TimerDpc' : [ 0x5c, ['_KDPC']], 'ActiveTimerListEntry' : [ 0x7c, ['_LIST_ENTRY']], 'Period' : [ 0x84, ['unsigned long']], 'TimerFlags' : [ 0x88, ['unsigned char']], 'ApcAssociated' : [ 0x88, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'FlushDpcs' : [ 0x88, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Paused' : [ 0x88, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Spare1' : [ 0x88, ['BitField', dict(start_bit = 3, end_bit = 8, native_type='unsigned char')]], 'DueTimeType' : [ 0x89, ['unsigned char']], 'Spare2' : [ 0x8a, ['unsigned short']], 'WakeReason' : [ 0x8c, ['pointer', ['_DIAGNOSTIC_CONTEXT']]], 'WakeTimerListEntry' : [ 0x90, ['_LIST_ENTRY']], 'VirtualizedTimerCookie' : [ 0x98, ['pointer', ['void']]], 'VirtualizedTimerLinks' : [ 0x9c, ['_LIST_ENTRY']], 'DueTime' : [ 0xa8, ['unsigned long long']], 'CoalescingWindow' : [ 0xb0, ['unsigned long']], } ], '_OBJECT_DIRECTORY_ENTRY' : [ 0xc, { 'ChainLink' : [ 0x0, ['pointer', ['_OBJECT_DIRECTORY_ENTRY']]], 'Object' : [ 0x4, ['pointer', ['void']]], 'HashValue' : [ 0x8, ['unsigned long']], } ], '_LOCK_TRACKER' : [ 0x4c, { 'LockTrackerNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'Mdl' : [ 0xc, ['pointer', ['_MDL']]], 'StartVa' : [ 0x10, ['pointer', ['void']]], 'Count' : [ 0x14, ['unsigned long']], 'Offset' : [ 0x18, ['unsigned long']], 'Length' : [ 0x1c, ['unsigned long']], 'Page' : [ 0x20, ['unsigned long']], 'StackTrace' : [ 0x24, ['array', 8, ['pointer', ['void']]]], 'Who' : [ 0x44, ['unsigned long']], 'Process' : [ 0x48, ['pointer', ['_EPROCESS']]], } ], '_POOL_BLOCK_HEAD' : [ 0x10, { 'Header' : [ 0x0, ['_POOL_HEADER']], 'List' : [ 0x8, ['_LIST_ENTRY']], } ], '_MI_CACHED_PTES' : [ 0x48, { 'Bins' : [ 0x0, ['array', 8, ['_MI_CACHED_PTE']]], 'CachedPteCount' : [ 0x40, ['long']], } ], '_EXHANDLE' : [ 0x4, { 'TagBits' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'Index' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'GenericHandleOverlay' : [ 0x0, ['pointer', ['void']]], 'Value' : [ 0x0, ['unsigned long']], } ], '__unnamed_20e1' : [ 0x4, { 'Flags' : [ 0x0, ['_MMSECURE_FLAGS']], 'FlagsLong' : [ 0x0, ['unsigned long']], 'StartVa' : [ 0x0, ['pointer', ['void']]], } ], '_MMADDRESS_LIST' : [ 0x8, { 'u1' : [ 0x0, ['__unnamed_20e1']], 'EndVa' : [ 0x4, ['pointer', ['void']]], } ], '_EX_PUSH_LOCK_AUTO_EXPAND_STATE' : [ 0x4, { 'Expanded' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Transitioning' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Pageable' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], } ], '_XSTATE_FEATURE' : [ 0x8, { 'Offset' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], } ], '_DBGKD_CONTEXT_EX' : [ 0xc, { 'Offset' : [ 0x0, ['unsigned long']], 'ByteCount' : [ 0x4, ['unsigned long']], 'BytesCopied' : [ 0x8, ['unsigned long']], } ], '_CM_DIRTY_VECTOR_LOG' : [ 0x288, { 'Next' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], 'Log' : [ 0x8, ['array', 16, ['_CM_DIRTY_VECTOR_LOG_ENTRY']]], } ], '_ARBITER_INSTANCE' : [ 0xa8, { 'Signature' : [ 0x0, ['unsigned long']], 'MutexEvent' : [ 0x4, ['pointer', ['_KEVENT']]], 'Name' : [ 0x8, ['pointer', ['unsigned short']]], 'OrderingName' : [ 0xc, ['pointer', ['unsigned short']]], 'ResourceType' : [ 0x10, ['long']], 'Allocation' : [ 0x14, ['pointer', ['_RTL_RANGE_LIST']]], 'PossibleAllocation' : [ 0x18, ['pointer', ['_RTL_RANGE_LIST']]], 'OrderingList' : [ 0x1c, ['_ARBITER_ORDERING_LIST']], 'ReservedList' : [ 0x24, ['_ARBITER_ORDERING_LIST']], 'ReferenceCount' : [ 0x2c, ['long']], 'Interface' : [ 0x30, ['pointer', ['_ARBITER_INTERFACE']]], 'AllocationStackMaxSize' : [ 0x34, ['unsigned long']], 'AllocationStack' : [ 0x38, ['pointer', ['_ARBITER_ALLOCATION_STATE']]], 'UnpackRequirement' : [ 0x3c, ['pointer', ['void']]], 'PackResource' : [ 0x40, ['pointer', ['void']]], 'UnpackResource' : [ 0x44, ['pointer', ['void']]], 'ScoreRequirement' : [ 0x48, ['pointer', ['void']]], 'TestAllocation' : [ 0x4c, ['pointer', ['void']]], 'RetestAllocation' : [ 0x50, ['pointer', ['void']]], 'CommitAllocation' : [ 0x54, ['pointer', ['void']]], 'RollbackAllocation' : [ 0x58, ['pointer', ['void']]], 'BootAllocation' : [ 0x5c, ['pointer', ['void']]], 'QueryArbitrate' : [ 0x60, ['pointer', ['void']]], 'QueryConflict' : [ 0x64, ['pointer', ['void']]], 'AddReserved' : [ 0x68, ['pointer', ['void']]], 'StartArbiter' : [ 0x6c, ['pointer', ['void']]], 'PreprocessEntry' : [ 0x70, ['pointer', ['void']]], 'AllocateEntry' : [ 0x74, ['pointer', ['void']]], 'GetNextAllocationRange' : [ 0x78, ['pointer', ['void']]], 'FindSuitableRange' : [ 0x7c, ['pointer', ['void']]], 'AddAllocation' : [ 0x80, ['pointer', ['void']]], 'BacktrackAllocation' : [ 0x84, ['pointer', ['void']]], 'OverrideConflict' : [ 0x88, ['pointer', ['void']]], 'InitializeRangeList' : [ 0x8c, ['pointer', ['void']]], 'TransactionInProgress' : [ 0x90, ['unsigned char']], 'TransactionEvent' : [ 0x94, ['pointer', ['_KEVENT']]], 'Extension' : [ 0x98, ['pointer', ['void']]], 'BusDeviceObject' : [ 0x9c, ['pointer', ['_DEVICE_OBJECT']]], 'ConflictCallbackContext' : [ 0xa0, ['pointer', ['void']]], 'ConflictCallback' : [ 0xa4, ['pointer', ['void']]], } ], '_MMVAD_FLAGS1' : [ 0x4, { 'CommitCharge' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='unsigned long')]], 'MemCommit' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_MI_SYSTEM_INFORMATION' : [ 0x3cc0, { 'Pools' : [ 0x0, ['_MI_POOL_STATE']], 'Sections' : [ 0x500, ['_MI_SECTION_STATE']], 'SystemImages' : [ 0x640, ['_MI_SYSTEM_IMAGE_STATE']], 'Sessions' : [ 0x6a4, ['_MI_SESSION_STATE']], 'Processes' : [ 0x16e0, ['_MI_PROCESS_STATE']], 'Hardware' : [ 0x1750, ['_MI_HARDWARE_STATE']], 'SystemVa' : [ 0x1800, ['_MI_SYSTEM_VA_STATE']], 'PageCombines' : [ 0x2cc0, ['_MI_COMBINE_STATE']], 'Partitions' : [ 0x2cd8, ['_MI_PARTITION_STATE']], 'Shutdowns' : [ 0x2d08, ['_MI_SHUTDOWN_STATE']], 'Errors' : [ 0x2d58, ['_MI_ERROR_STATE']], 'AccessLog' : [ 0x2e00, ['_MI_ACCESS_LOG_STATE']], 'Debugger' : [ 0x2e80, ['_MI_DEBUGGER_STATE']], 'Standby' : [ 0x2f40, ['_MI_STANDBY_STATE']], 'SystemPtes' : [ 0x2fc0, ['_MI_SYSTEM_PTE_STATE']], 'IoPages' : [ 0x3140, ['_MI_IO_PAGE_STATE']], 'PagingIo' : [ 0x3178, ['_MI_PAGING_IO_STATE']], 'CommonPages' : [ 0x31b0, ['_MI_COMMON_PAGE_STATE']], 'Trims' : [ 0x3200, ['_MI_SYSTEM_TRIM_STATE']], 'ResTrack' : [ 0x3240, ['_MI_RESAVAIL_TRACKER']], 'Cookie' : [ 0x3440, ['unsigned long']], 'ZeroingDisabled' : [ 0x3444, ['long']], 'BootRegistryRuns' : [ 0x3448, ['pointer', ['pointer', ['void']]]], 'FullyInitialized' : [ 0x344c, ['unsigned char']], 'SafeBooted' : [ 0x344d, ['unsigned char']], 'LargePfnBitMap' : [ 0x3450, ['_RTL_BITMAP']], 'PfnBitMap' : [ 0x3458, ['_RTL_BITMAP']], 'TraceLogging' : [ 0x3460, ['pointer', ['_TlgProvider_t']]], 'Vs' : [ 0x3480, ['_MI_VISIBLE_STATE']], } ], '_KDEVICE_QUEUE_ENTRY' : [ 0x10, { 'DeviceListEntry' : [ 0x0, ['_LIST_ENTRY']], 'SortKey' : [ 0x8, ['unsigned long']], 'Inserted' : [ 0xc, ['unsigned char']], } ], '_PPM_SELECTION_DEPENDENCY' : [ 0xc, { 'Processor' : [ 0x0, ['unsigned long']], 'Menu' : [ 0x4, ['_PPM_SELECTION_MENU']], } ], '__unnamed_215b' : [ 0x4, { 'UserData' : [ 0x0, ['unsigned long']], 'Next' : [ 0x0, ['unsigned long']], } ], '__unnamed_215d' : [ 0x4, { 'u' : [ 0x0, ['__unnamed_215b']], } ], '__unnamed_215f' : [ 0x4, { 'NewCell' : [ 0x0, ['__unnamed_215d']], } ], '_HCELL' : [ 0x8, { 'Size' : [ 0x0, ['long']], 'u' : [ 0x4, ['__unnamed_215f']], } ], '_MI_VISIBLE_STATE' : [ 0x840, { 'SpecialPool' : [ 0x0, ['_MI_SPECIAL_POOL']], 'SessionWsList' : [ 0x48, ['_LIST_ENTRY']], 'SessionIdBitmap' : [ 0x50, ['pointer', ['_RTL_BITMAP']]], 'PagedPoolInfo' : [ 0x54, ['_MM_PAGED_POOL_INFO']], 'MaximumNonPagedPoolInPages' : [ 0x70, ['unsigned long']], 'SizeOfPagedPoolInPages' : [ 0x74, ['unsigned long']], 'SystemPteInfo' : [ 0x78, ['_MI_SYSTEM_PTE_TYPE']], 'NonPagedPoolCommit' : [ 0xac, ['unsigned long']], 'BootCommit' : [ 0xb0, ['unsigned long']], 'MdlPagesAllocated' : [ 0xb4, ['unsigned long']], 'SystemPageTableCommit' : [ 0xb8, ['unsigned long']], 'SpecialPagesInUse' : [ 0xbc, ['unsigned long']], 'WsOverheadPages' : [ 0xc0, ['unsigned long']], 'VadBitmapPages' : [ 0xc4, ['unsigned long']], 'ProcessCommit' : [ 0xc8, ['unsigned long']], 'SharedCommit' : [ 0xcc, ['unsigned long']], 'DriverCommit' : [ 0xd0, ['long']], 'SystemWs' : [ 0x100, ['array', 3, ['_MMSUPPORT']]], 'MapCacheFailures' : [ 0x280, ['unsigned long']], 'LastUnloadedDriver' : [ 0x284, ['unsigned long']], 'UnloadedDrivers' : [ 0x288, ['pointer', ['_UNLOADED_DRIVERS']]], 'PagefileHashPages' : [ 0x28c, ['unsigned long']], 'PteHeader' : [ 0x290, ['_SYSPTES_HEADER']], 'SessionSpecialPool' : [ 0x31c, ['pointer', ['_MI_SPECIAL_POOL']]], 'SystemVaTypeCount' : [ 0x320, ['array', 15, ['unsigned long']]], 'SystemVaType' : [ 0x35c, ['array', 1024, ['unsigned char']]], 'SystemVaTypeCountFailures' : [ 0x75c, ['array', 15, ['unsigned long']]], 'SystemVaTypeCountLimit' : [ 0x798, ['array', 15, ['unsigned long']]], 'SystemVaTypeCountPeak' : [ 0x7d4, ['array', 15, ['unsigned long']]], 'SystemAvailableVa' : [ 0x810, ['unsigned long']], } ], '_WHEA_GENERIC_ERROR_DESCRIPTOR' : [ 0x34, { 'Type' : [ 0x0, ['unsigned short']], 'Reserved' : [ 0x2, ['unsigned char']], 'Enabled' : [ 0x3, ['unsigned char']], 'ErrStatusBlockLength' : [ 0x4, ['unsigned long']], 'RelatedErrorSourceId' : [ 0x8, ['unsigned long']], 'ErrStatusAddressSpaceID' : [ 0xc, ['unsigned char']], 'ErrStatusAddressBitWidth' : [ 0xd, ['unsigned char']], 'ErrStatusAddressBitOffset' : [ 0xe, ['unsigned char']], 'ErrStatusAddressAccessSize' : [ 0xf, ['unsigned char']], 'ErrStatusAddress' : [ 0x10, ['_LARGE_INTEGER']], 'Notify' : [ 0x18, ['_WHEA_NOTIFICATION_DESCRIPTOR']], } ], '_HMAP_TABLE' : [ 0x2800, { 'Table' : [ 0x0, ['array', 512, ['_HMAP_ENTRY']]], } ], '_SEP_LOWBOX_HANDLES_ENTRY' : [ 0x1c, { 'HashEntry' : [ 0x0, ['_RTL_DYNAMIC_HASH_TABLE_ENTRY']], 'ReferenceCount' : [ 0xc, ['long']], 'PackageSid' : [ 0x10, ['pointer', ['void']]], 'HandleCount' : [ 0x14, ['unsigned long']], 'Handles' : [ 0x18, ['pointer', ['pointer', ['void']]]], } ], '_PROC_PERF_CONSTRAINT' : [ 0x50, { 'Prcb' : [ 0x0, ['pointer', ['_KPRCB']]], 'PerfContext' : [ 0x4, ['unsigned long']], 'ProcCap' : [ 0x8, ['unsigned long']], 'ProcFloor' : [ 0xc, ['unsigned long']], 'PlatformCap' : [ 0x10, ['unsigned long']], 'ThermalCap' : [ 0x14, ['unsigned long']], 'LimitReasons' : [ 0x18, ['unsigned long']], 'PlatformCapStartTime' : [ 0x20, ['unsigned long long']], 'TargetPercent' : [ 0x28, ['unsigned long']], 'SelectedPercent' : [ 0x2c, ['unsigned long']], 'SelectedFrequency' : [ 0x30, ['unsigned long']], 'PreviousFrequency' : [ 0x34, ['unsigned long']], 'PreviousPercent' : [ 0x38, ['unsigned long']], 'LatestFrequencyPercent' : [ 0x3c, ['unsigned long']], 'SelectedState' : [ 0x40, ['unsigned long long']], 'Force' : [ 0x48, ['unsigned char']], } ], '__unnamed_217e' : [ 0x10, { 'CallerCompletion' : [ 0x0, ['pointer', ['void']]], 'CallerContext' : [ 0x4, ['pointer', ['void']]], 'CallerDevice' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'SystemWake' : [ 0xc, ['unsigned char']], } ], '__unnamed_2181' : [ 0x8, { 'NotifyDevice' : [ 0x0, ['pointer', ['_PO_DEVICE_NOTIFY']]], 'FxDeviceActivated' : [ 0x4, ['unsigned char']], } ], '_POP_IRP_DATA' : [ 0x90, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'Pdo' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'TargetDevice' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'CurrentDevice' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], 'WatchdogStart' : [ 0x18, ['unsigned long long']], 'WatchdogTimer' : [ 0x20, ['_KTIMER']], 'WatchdogDpc' : [ 0x48, ['_KDPC']], 'MinorFunction' : [ 0x68, ['unsigned char']], 'PowerStateType' : [ 0x6c, ['Enumeration', dict(target = 'long', choices = {0: 'SystemPowerState', 1: 'DevicePowerState'})]], 'PowerState' : [ 0x70, ['_POWER_STATE']], 'WatchdogEnabled' : [ 0x74, ['unsigned char']], 'FxDevice' : [ 0x78, ['pointer', ['_POP_FX_DEVICE']]], 'SystemTransition' : [ 0x7c, ['unsigned char']], 'NotifyPEP' : [ 0x7d, ['unsigned char']], 'Device' : [ 0x80, ['__unnamed_217e']], 'System' : [ 0x80, ['__unnamed_2181']], } ], '_MI_ERROR_STATE' : [ 0x98, { 'BadMemoryEventEntry' : [ 0x0, ['_MI_BAD_MEMORY_EVENT_ENTRY']], 'ProbeRaises' : [ 0x28, ['_MI_PROBE_RAISE_TRACKER']], 'ForcedCommits' : [ 0x64, ['_MI_FORCED_COMMITS']], 'WsleFailures' : [ 0x6c, ['array', 2, ['unsigned long']]], 'WsLinear' : [ 0x74, ['unsigned long']], 'PageHashErrors' : [ 0x78, ['unsigned long']], 'CheckZeroCount' : [ 0x7c, ['unsigned long']], 'ZeroedPageSingleBitErrorsDetected' : [ 0x80, ['long']], 'BadPagesDetected' : [ 0x84, ['long']], 'ScrubPasses' : [ 0x88, ['long']], 'ScrubBadPagesFound' : [ 0x8c, ['long']], 'PendingBadPages' : [ 0x90, ['unsigned char']], 'InitFailure' : [ 0x91, ['unsigned char']], 'StopBadMaps' : [ 0x92, ['unsigned char']], } ], '_IMAGE_DATA_DIRECTORY' : [ 0x8, { 'VirtualAddress' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], } ], '_DEVICE_CAPABILITIES' : [ 0x40, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'DeviceD1' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DeviceD2' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'LockSupported' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'EjectSupported' : [ 0x4, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Removable' : [ 0x4, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'DockDevice' : [ 0x4, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'UniqueID' : [ 0x4, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'SilentInstall' : [ 0x4, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'RawDeviceOK' : [ 0x4, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'SurpriseRemovalOK' : [ 0x4, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'WakeFromD0' : [ 0x4, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'WakeFromD1' : [ 0x4, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'WakeFromD2' : [ 0x4, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'WakeFromD3' : [ 0x4, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'HardwareDisabled' : [ 0x4, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'NonDynamic' : [ 0x4, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'WarmEjectSupported' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'NoDisplayInUI' : [ 0x4, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'Reserved1' : [ 0x4, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'WakeFromInterrupt' : [ 0x4, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'Reserved' : [ 0x4, ['BitField', dict(start_bit = 20, end_bit = 32, native_type='unsigned long')]], 'Address' : [ 0x8, ['unsigned long']], 'UINumber' : [ 0xc, ['unsigned long']], 'DeviceState' : [ 0x10, ['array', -28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]]], 'SystemWake' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DeviceWake' : [ 0x30, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'D1Latency' : [ 0x34, ['unsigned long']], 'D2Latency' : [ 0x38, ['unsigned long']], 'D3Latency' : [ 0x3c, ['unsigned long']], } ], '_MI_USER_VA_INFO' : [ 0xd20, { 'NumberOfCommittedPageTables' : [ 0x0, ['unsigned long']], 'VadBitMapHint' : [ 0x4, ['unsigned long']], 'LastAllocationSizeHint' : [ 0x8, ['unsigned long']], 'LastAllocationSize' : [ 0xc, ['unsigned long']], 'LowestBottomUpVadBit' : [ 0x10, ['unsigned long']], 'VadBitMapSize' : [ 0x14, ['unsigned long']], 'VadBitMapCommitment' : [ 0x18, ['unsigned long']], 'MaximumLastVadBit' : [ 0x1c, ['unsigned long']], 'VadsBeingDeleted' : [ 0x20, ['long']], 'PhysicalMappingCount' : [ 0x24, ['unsigned long']], 'LastVadDeletionEvent' : [ 0x28, ['pointer', ['_KEVENT']]], 'VadBitBuffer' : [ 0x2c, ['pointer', ['unsigned long']]], 'LowestBottomUpAllocationAddress' : [ 0x30, ['pointer', ['void']]], 'HighestTopDownAllocationAddress' : [ 0x34, ['pointer', ['void']]], 'FreeTebHint' : [ 0x38, ['pointer', ['void']]], 'NumaAware' : [ 0x3c, ['unsigned char']], 'CloneNestingLevel' : [ 0x40, ['unsigned long long']], 'PrivateFixupVadCount' : [ 0x48, ['unsigned long']], 'CfgBitMap' : [ 0x4c, ['array', 1, ['_MI_CFG_BITMAP_INFO']]], 'CommittedPageTableBufferForTopLevel' : [ 0x58, ['array', 48, ['unsigned long']]], 'CommittedPageTableBitmaps' : [ 0x118, ['array', 1, ['_RTL_BITMAP']]], 'UsedPageTableEntries' : [ 0x120, ['array', 1536, ['unsigned short']]], } ], '_PROC_FEEDBACK' : [ 0x88, { 'Lock' : [ 0x0, ['unsigned long']], 'CyclesLast' : [ 0x8, ['unsigned long long']], 'CyclesActive' : [ 0x10, ['unsigned long long']], 'Counters' : [ 0x18, ['array', 2, ['pointer', ['_PROC_FEEDBACK_COUNTER']]]], 'LastUpdateTime' : [ 0x20, ['unsigned long long']], 'UnscaledTime' : [ 0x28, ['unsigned long long']], 'UnaccountedTime' : [ 0x30, ['long long']], 'ScaledTime' : [ 0x38, ['array', 2, ['unsigned long long']]], 'UnaccountedKernelTime' : [ 0x48, ['unsigned long long']], 'PerformanceScaledKernelTime' : [ 0x50, ['unsigned long long']], 'UserTimeLast' : [ 0x58, ['unsigned long']], 'KernelTimeLast' : [ 0x5c, ['unsigned long']], 'IdleGenerationNumberLast' : [ 0x60, ['unsigned long long']], 'HvActiveTimeLast' : [ 0x68, ['unsigned long long']], 'StallCyclesLast' : [ 0x70, ['unsigned long long']], 'StallTime' : [ 0x78, ['unsigned long long']], 'KernelTimesIndex' : [ 0x80, ['unsigned char']], } ], '__unnamed_219b' : [ 0x18, { 'Length' : [ 0x0, ['unsigned long']], 'Alignment' : [ 0x4, ['unsigned long']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], } ], '__unnamed_219f' : [ 0x14, { 'MinimumVector' : [ 0x0, ['unsigned long']], 'MaximumVector' : [ 0x4, ['unsigned long']], 'AffinityPolicy' : [ 0x8, ['unsigned short']], 'Group' : [ 0xa, ['unsigned short']], 'PriorityPolicy' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'IrqPriorityUndefined', 1: 'IrqPriorityLow', 2: 'IrqPriorityNormal', 3: 'IrqPriorityHigh'})]], 'TargetedProcessors' : [ 0x10, ['unsigned long']], } ], '__unnamed_21a1' : [ 0x8, { 'MinimumChannel' : [ 0x0, ['unsigned long']], 'MaximumChannel' : [ 0x4, ['unsigned long']], } ], '__unnamed_21a3' : [ 0x10, { 'RequestLine' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'Channel' : [ 0x8, ['unsigned long']], 'TransferWidth' : [ 0xc, ['unsigned long']], } ], '__unnamed_21a5' : [ 0xc, { 'Data' : [ 0x0, ['array', 3, ['unsigned long']]], } ], '__unnamed_21a7' : [ 0x10, { 'Length' : [ 0x0, ['unsigned long']], 'MinBusNumber' : [ 0x4, ['unsigned long']], 'MaxBusNumber' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], } ], '__unnamed_21a9' : [ 0xc, { 'Priority' : [ 0x0, ['unsigned long']], 'Reserved1' : [ 0x4, ['unsigned long']], 'Reserved2' : [ 0x8, ['unsigned long']], } ], '__unnamed_21ab' : [ 0x18, { 'Length40' : [ 0x0, ['unsigned long']], 'Alignment40' : [ 0x4, ['unsigned long']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], } ], '__unnamed_21ad' : [ 0x18, { 'Length48' : [ 0x0, ['unsigned long']], 'Alignment48' : [ 0x4, ['unsigned long']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], } ], '__unnamed_21af' : [ 0x18, { 'Length64' : [ 0x0, ['unsigned long']], 'Alignment64' : [ 0x4, ['unsigned long']], 'MinimumAddress' : [ 0x8, ['_LARGE_INTEGER']], 'MaximumAddress' : [ 0x10, ['_LARGE_INTEGER']], } ], '__unnamed_21b1' : [ 0xc, { 'Class' : [ 0x0, ['unsigned char']], 'Type' : [ 0x1, ['unsigned char']], 'Reserved1' : [ 0x2, ['unsigned char']], 'Reserved2' : [ 0x3, ['unsigned char']], 'IdLowPart' : [ 0x4, ['unsigned long']], 'IdHighPart' : [ 0x8, ['unsigned long']], } ], '__unnamed_21b3' : [ 0x18, { 'Port' : [ 0x0, ['__unnamed_219b']], 'Memory' : [ 0x0, ['__unnamed_219b']], 'Interrupt' : [ 0x0, ['__unnamed_219f']], 'Dma' : [ 0x0, ['__unnamed_21a1']], 'DmaV3' : [ 0x0, ['__unnamed_21a3']], 'Generic' : [ 0x0, ['__unnamed_219b']], 'DevicePrivate' : [ 0x0, ['__unnamed_21a5']], 'BusNumber' : [ 0x0, ['__unnamed_21a7']], 'ConfigData' : [ 0x0, ['__unnamed_21a9']], 'Memory40' : [ 0x0, ['__unnamed_21ab']], 'Memory48' : [ 0x0, ['__unnamed_21ad']], 'Memory64' : [ 0x0, ['__unnamed_21af']], 'Connection' : [ 0x0, ['__unnamed_21b1']], } ], '_IO_RESOURCE_DESCRIPTOR' : [ 0x20, { 'Option' : [ 0x0, ['unsigned char']], 'Type' : [ 0x1, ['unsigned char']], 'ShareDisposition' : [ 0x2, ['unsigned char']], 'Spare1' : [ 0x3, ['unsigned char']], 'Flags' : [ 0x4, ['unsigned short']], 'Spare2' : [ 0x6, ['unsigned short']], 'u' : [ 0x8, ['__unnamed_21b3']], } ], '_POP_THERMAL_ZONE' : [ 0x2b8, { 'PolicyDevice' : [ 0x0, ['_POP_POLICY_DEVICE']], 'Link' : [ 0x0, ['_LIST_ENTRY']], 'DeviceType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PolicyDeviceSystemButton', 1: 'PolicyDeviceThermalZone', 2: 'PolicyDeviceBattery', 3: 'PolicyDeviceMemory', 4: 'PolicyInitiatePowerActionAPI', 5: 'PolicySetPowerStateAPI', 6: 'PolicyImmediateDozeS4', 7: 'PolicySystemIdle', 8: 'PolicyDeviceWakeAlarm', 9: 'PolicyDeviceFan', 10: 'PolicyCsBatterySaver', 11: 'PolicyDeviceMax'})]], 'Notification' : [ 0xc, ['pointer', ['void']]], 'Name' : [ 0x10, ['_UNICODE_STRING']], 'Device' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'Irp' : [ 0x1c, ['pointer', ['_IRP']]], 'State' : [ 0x20, ['unsigned char']], 'Flags' : [ 0x21, ['unsigned char']], 'Removing' : [ 0x22, ['unsigned char']], 'Mode' : [ 0x23, ['unsigned char']], 'PendingMode' : [ 0x24, ['unsigned char']], 'ActivePoint' : [ 0x25, ['unsigned char']], 'PendingActivePoint' : [ 0x26, ['unsigned char']], 'Critical' : [ 0x27, ['unsigned char']], 'ThermalStandby' : [ 0x28, ['unsigned char']], 'OverThrottled' : [ 0x29, ['unsigned char']], 'HighPrecisionThrottle' : [ 0x2c, ['long']], 'Throttle' : [ 0x30, ['long']], 'PendingThrottle' : [ 0x34, ['long']], 'ThrottleReasons' : [ 0x38, ['unsigned long']], 'LastTime' : [ 0x40, ['unsigned long long']], 'SampleRate' : [ 0x48, ['unsigned long']], 'LastTemp' : [ 0x4c, ['unsigned long']], 'PassiveTimer' : [ 0x50, ['_KTIMER']], 'PassiveDpc' : [ 0x78, ['_KDPC']], 'Info' : [ 0x98, ['_THERMAL_INFORMATION_EX']], 'InfoLastUpdateTime' : [ 0xf0, ['_LARGE_INTEGER']], 'Policy' : [ 0xf8, ['_THERMAL_POLICY']], 'PolicyDriver' : [ 0x110, ['unsigned char']], 'LastActiveStartTime' : [ 0x118, ['unsigned long long']], 'LastPassiveStartTime' : [ 0x120, ['unsigned long long']], 'WorkItem' : [ 0x128, ['_WORK_QUEUE_ITEM']], 'Lock' : [ 0x138, ['_POP_RW_LOCK']], 'ZoneStopped' : [ 0x140, ['_KEVENT']], 'TemperatureUpdated' : [ 0x150, ['_KEVENT']], 'InstanceId' : [ 0x160, ['unsigned long']], 'TelemetryTracker' : [ 0x168, ['_POP_THERMAL_TELEMETRY_TRACKER']], } ], '_MMPTE_LIST' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'OneEntry' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'filler0' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'filler1' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 32, native_type='unsigned long long')]], 'NextEntry' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 64, native_type='unsigned long long')]], } ], '_VI_POOL_PAGE_HEADER' : [ 0xc, { 'NextPage' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'VerifierEntry' : [ 0x4, ['pointer', ['void']]], 'Signature' : [ 0x8, ['unsigned long']], } ], '_MI_REBUILD_LARGE_PAGES' : [ 0x34, { 'Active' : [ 0x0, ['long']], 'Timer' : [ 0x4, ['array', 16, ['array', 1, ['_MI_REBUILD_LARGE_PAGE_COUNTDOWN']]]], 'WorkItem' : [ 0x24, ['_WORK_QUEUE_ITEM']], } ], '_HANDLE_TRACE_DEBUG_INFO' : [ 0x80, { 'RefCount' : [ 0x0, ['long']], 'TableSize' : [ 0x4, ['unsigned long']], 'BitMaskFlags' : [ 0x8, ['unsigned long']], 'CloseCompactionLock' : [ 0xc, ['_FAST_MUTEX']], 'CurrentStackIndex' : [ 0x2c, ['unsigned long']], 'TraceDb' : [ 0x30, ['array', 1, ['_HANDLE_TRACE_DB_ENTRY']]], } ], '_HHIVE' : [ 0x6f0, { 'Signature' : [ 0x0, ['unsigned long']], 'GetCellRoutine' : [ 0x4, ['pointer', ['void']]], 'ReleaseCellRoutine' : [ 0x8, ['pointer', ['void']]], 'Allocate' : [ 0xc, ['pointer', ['void']]], 'Free' : [ 0x10, ['pointer', ['void']]], 'FileWrite' : [ 0x14, ['pointer', ['void']]], 'FileRead' : [ 0x18, ['pointer', ['void']]], 'HiveLoadFailure' : [ 0x1c, ['pointer', ['void']]], 'BaseBlock' : [ 0x20, ['pointer', ['_HBASE_BLOCK']]], 'DirtyVector' : [ 0x24, ['_RTL_BITMAP']], 'DirtyCount' : [ 0x2c, ['unsigned long']], 'DirtyAlloc' : [ 0x30, ['unsigned long']], 'UnreconciledVector' : [ 0x34, ['_RTL_BITMAP']], 'UnreconciledCount' : [ 0x3c, ['unsigned long']], 'BaseBlockAlloc' : [ 0x40, ['unsigned long']], 'Cluster' : [ 0x44, ['unsigned long']], 'Flat' : [ 0x48, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'ReadOnly' : [ 0x48, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'SystemCacheBacked' : [ 0x48, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Reserved' : [ 0x48, ['BitField', dict(start_bit = 3, end_bit = 8, native_type='unsigned char')]], 'DirtyFlag' : [ 0x49, ['unsigned char']], 'HvBinHeadersUse' : [ 0x4c, ['unsigned long']], 'HvFreeCellsUse' : [ 0x50, ['unsigned long']], 'HvUsedCellsUse' : [ 0x54, ['unsigned long']], 'CmUsedCellsUse' : [ 0x58, ['unsigned long']], 'HiveFlags' : [ 0x5c, ['unsigned long']], 'CurrentLog' : [ 0x60, ['unsigned long']], 'CurrentLogSequence' : [ 0x64, ['unsigned long']], 'CurrentLogMinimumSequence' : [ 0x68, ['unsigned long']], 'CurrentLogOffset' : [ 0x6c, ['unsigned long']], 'MinimumLogSequence' : [ 0x70, ['unsigned long']], 'LogFileSizeCap' : [ 0x74, ['unsigned long']], 'LogDataPresent' : [ 0x78, ['array', 2, ['unsigned char']]], 'PrimaryFileValid' : [ 0x7a, ['unsigned char']], 'BaseBlockDirty' : [ 0x7b, ['unsigned char']], 'LastLogSwapTime' : [ 0x80, ['_LARGE_INTEGER']], 'FirstLogFile' : [ 0x88, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned short')]], 'SecondLogFile' : [ 0x88, ['BitField', dict(start_bit = 3, end_bit = 6, native_type='unsigned short')]], 'HeaderRecovered' : [ 0x88, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'LegacyRecoveryIndicated' : [ 0x88, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned short')]], 'RecoveryInformationReserved' : [ 0x88, ['BitField', dict(start_bit = 8, end_bit = 16, native_type='unsigned short')]], 'RecoveryInformation' : [ 0x88, ['unsigned short']], 'LogEntriesRecovered' : [ 0x8a, ['array', 2, ['unsigned char']]], 'RefreshCount' : [ 0x8c, ['unsigned long']], 'StorageTypeCount' : [ 0x90, ['unsigned long']], 'Version' : [ 0x94, ['unsigned long']], 'ViewMap' : [ 0x98, ['_HVIEW_MAP']], 'Storage' : [ 0x3b8, ['array', 2, ['_DUAL']]], } ], '_WHEA_XPF_NMI_DESCRIPTOR' : [ 0x3, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], } ], '_ETW_FILTER_HEADER' : [ 0x24, { 'FilterFlags' : [ 0x0, ['long']], 'PidFilter' : [ 0x4, ['pointer', ['_ETW_FILTER_PID']]], 'ExeFilter' : [ 0x8, ['pointer', ['_ETW_FILTER_STRING_TOKEN']]], 'PkgIdFilter' : [ 0xc, ['pointer', ['_ETW_FILTER_STRING_TOKEN']]], 'PkgAppIdFilter' : [ 0x10, ['pointer', ['_ETW_FILTER_STRING_TOKEN']]], 'StackWalkFilter' : [ 0x14, ['pointer', ['_ETW_PERFECT_HASH_FUNCTION']]], 'EventIdFilter' : [ 0x18, ['pointer', ['_ETW_PERFECT_HASH_FUNCTION']]], 'PayloadFilter' : [ 0x1c, ['pointer', ['_ETW_PAYLOAD_FILTER']]], 'ProviderSideFilter' : [ 0x20, ['pointer', ['_EVENT_FILTER_HEADER']]], } ], '_CM_WORKITEM' : [ 0x14, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Private' : [ 0x8, ['unsigned long']], 'WorkerRoutine' : [ 0xc, ['pointer', ['void']]], 'Parameter' : [ 0x10, ['pointer', ['void']]], } ], '_ETW_PAYLOAD_FILTER' : [ 0x58, { 'RefCount' : [ 0x0, ['long']], 'PayloadFilter' : [ 0x8, ['_AGGREGATED_PAYLOAD_FILTER']], } ], '_CM_TRANS' : [ 0x68, { 'TransactionListEntry' : [ 0x0, ['_LIST_ENTRY']], 'KCBUoWListHead' : [ 0x8, ['_LIST_ENTRY']], 'LazyCommitListEntry' : [ 0x10, ['_LIST_ENTRY']], 'KtmTrans' : [ 0x18, ['pointer', ['void']]], 'CmRm' : [ 0x1c, ['pointer', ['_CM_RM']]], 'KtmEnlistmentObject' : [ 0x20, ['pointer', ['_KENLISTMENT']]], 'KtmEnlistmentHandle' : [ 0x24, ['pointer', ['void']]], 'KtmUow' : [ 0x28, ['_GUID']], 'StartLsn' : [ 0x38, ['unsigned long long']], 'TransState' : [ 0x40, ['unsigned long']], 'HiveCount' : [ 0x44, ['unsigned long']], 'HiveArray' : [ 0x48, ['array', 7, ['pointer', ['_CMHIVE']]]], } ], '_WHEA_ERROR_RECORD_HEADER_VALIDBITS' : [ 0x4, { 'PlatformId' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Timestamp' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PartitionId' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_CM_PARTIAL_RESOURCE_LIST' : [ 0x18, { 'Version' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'Count' : [ 0x4, ['unsigned long']], 'PartialDescriptors' : [ 0x8, ['array', 1, ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '_RTL_RANGE_LIST' : [ 0x14, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'Flags' : [ 0x8, ['unsigned long']], 'Count' : [ 0xc, ['unsigned long']], 'Stamp' : [ 0x10, ['unsigned long']], } ], '_RTL_TIME_ZONE_INFORMATION' : [ 0xac, { 'Bias' : [ 0x0, ['long']], 'StandardName' : [ 0x4, ['array', 32, ['wchar']]], 'StandardStart' : [ 0x44, ['_TIME_FIELDS']], 'StandardBias' : [ 0x54, ['long']], 'DaylightName' : [ 0x58, ['array', 32, ['wchar']]], 'DaylightStart' : [ 0x98, ['_TIME_FIELDS']], 'DaylightBias' : [ 0xa8, ['long']], } ], '_POP_THERMAL_TELEMETRY_TRACKER' : [ 0x150, { 'AccountingDisabled' : [ 0x0, ['unsigned char']], 'LastPassiveUpdateTime' : [ 0x8, ['unsigned long long']], 'TotalPassiveTime' : [ 0x10, ['array', 20, ['unsigned long long']]], 'PassiveTimeSnap' : [ 0xb0, ['array', 20, ['unsigned long long']]], } ], '_OBJECT_CREATE_INFORMATION' : [ 0x2c, { 'Attributes' : [ 0x0, ['unsigned long']], 'RootDirectory' : [ 0x4, ['pointer', ['void']]], 'ProbeMode' : [ 0x8, ['unsigned char']], 'PagedPoolCharge' : [ 0xc, ['unsigned long']], 'NonPagedPoolCharge' : [ 0x10, ['unsigned long']], 'SecurityDescriptorCharge' : [ 0x14, ['unsigned long']], 'SecurityDescriptor' : [ 0x18, ['pointer', ['void']]], 'SecurityQos' : [ 0x1c, ['pointer', ['_SECURITY_QUALITY_OF_SERVICE']]], 'SecurityQualityOfService' : [ 0x20, ['_SECURITY_QUALITY_OF_SERVICE']], } ], '_HVIEW_MAP' : [ 0x320, { 'MappedLength' : [ 0x0, ['unsigned long']], 'Lock' : [ 0x4, ['_EX_PUSH_LOCK']], 'FileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], 'Directory' : [ 0xc, ['pointer', ['_HVIEW_MAP_DIRECTORY']]], 'PagesCharged' : [ 0x10, ['unsigned long']], 'PinLog' : [ 0x18, ['_HVIEW_MAP_PIN_LOG']], } ], '_POOL_HACKER' : [ 0x28, { 'Header' : [ 0x0, ['_POOL_HEADER']], 'Contents' : [ 0x8, ['array', 8, ['unsigned long']]], } ], '_TRACE_ENABLE_INFO' : [ 0x20, { 'IsEnabled' : [ 0x0, ['unsigned long']], 'Level' : [ 0x4, ['unsigned char']], 'Reserved1' : [ 0x5, ['unsigned char']], 'LoggerId' : [ 0x6, ['unsigned short']], 'EnableProperty' : [ 0x8, ['unsigned long']], 'Reserved2' : [ 0xc, ['unsigned long']], 'MatchAnyKeyword' : [ 0x10, ['unsigned long long']], 'MatchAllKeyword' : [ 0x18, ['unsigned long long']], } ], '_DISALLOWED_GUIDS' : [ 0x8, { 'Count' : [ 0x0, ['unsigned short']], 'Guids' : [ 0x4, ['pointer', ['_GUID']]], } ], '_HVIEW_MAP_DIRECTORY' : [ 0x200, { 'Tables' : [ 0x0, ['array', 128, ['pointer', ['_HVIEW_MAP_TABLE']]]], } ], '_PO_DIAG_STACK_RECORD' : [ 0x8, { 'StackDepth' : [ 0x0, ['unsigned long']], 'Stack' : [ 0x4, ['array', 1, ['pointer', ['void']]]], } ], '_SECTION_OBJECT_POINTERS' : [ 0xc, { 'DataSectionObject' : [ 0x0, ['pointer', ['void']]], 'SharedCacheMap' : [ 0x4, ['pointer', ['void']]], 'ImageSectionObject' : [ 0x8, ['pointer', ['void']]], } ], '_VF_BTS_DATA_MANAGEMENT_AREA' : [ 0x34, { 'BTSBufferBase' : [ 0x0, ['pointer', ['void']]], 'BTSIndex' : [ 0x4, ['pointer', ['void']]], 'BTSMax' : [ 0x8, ['pointer', ['void']]], 'BTSInterruptThreshold' : [ 0xc, ['pointer', ['void']]], 'PEBSBufferBase' : [ 0x10, ['pointer', ['void']]], 'PEBSIndex' : [ 0x14, ['pointer', ['void']]], 'PEBSMax' : [ 0x18, ['pointer', ['void']]], 'PEBSInterruptThreshold' : [ 0x1c, ['pointer', ['void']]], 'PEBSCounterReset' : [ 0x20, ['array', 2, ['pointer', ['void']]]], 'Reserved' : [ 0x28, ['array', 12, ['unsigned char']]], } ], '_FLOATING_SAVE_AREA' : [ 0x70, { 'ControlWord' : [ 0x0, ['unsigned long']], 'StatusWord' : [ 0x4, ['unsigned long']], 'TagWord' : [ 0x8, ['unsigned long']], 'ErrorOffset' : [ 0xc, ['unsigned long']], 'ErrorSelector' : [ 0x10, ['unsigned long']], 'DataOffset' : [ 0x14, ['unsigned long']], 'DataSelector' : [ 0x18, ['unsigned long']], 'RegisterArea' : [ 0x1c, ['array', 80, ['unsigned char']]], 'Spare0' : [ 0x6c, ['unsigned long']], } ], '_SEP_AUDIT_POLICY' : [ 0x1f, { 'AdtTokenPolicy' : [ 0x0, ['_TOKEN_AUDIT_POLICY']], 'PolicySetStatus' : [ 0x1e, ['unsigned char']], } ], '__unnamed_2233' : [ 0x4, { 'SnapSharedExportsFailed' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_2235' : [ 0x10, { 'AllSharedExportThunks' : [ 0x0, ['_VF_TARGET_ALL_SHARED_EXPORT_THUNKS']], 'Flags' : [ 0x0, ['__unnamed_2233']], } ], '_VF_TARGET_DRIVER' : [ 0x1c, { 'TreeNode' : [ 0x0, ['_VF_AVL_TREE_NODE']], 'u1' : [ 0x8, ['__unnamed_2235']], 'VerifiedData' : [ 0x18, ['pointer', ['_VF_TARGET_VERIFIED_DRIVER_DATA']]], } ], '_RTL_BITMAP' : [ 0x8, { 'SizeOfBitMap' : [ 0x0, ['unsigned long']], 'Buffer' : [ 0x4, ['pointer', ['unsigned long']]], } ], '__unnamed_2240' : [ 0x14, { 'ClassGuid' : [ 0x0, ['_GUID']], 'SymbolicLinkName' : [ 0x10, ['array', 1, ['wchar']]], } ], '__unnamed_2242' : [ 0x2, { 'DeviceId' : [ 0x0, ['array', 1, ['wchar']]], } ], '__unnamed_2244' : [ 0x8, { 'NotificationStructure' : [ 0x0, ['pointer', ['void']]], 'DeviceId' : [ 0x4, ['array', 1, ['wchar']]], } ], '__unnamed_2246' : [ 0x4, { 'Notification' : [ 0x0, ['pointer', ['void']]], } ], '__unnamed_2248' : [ 0x8, { 'NotificationCode' : [ 0x0, ['unsigned long']], 'NotificationData' : [ 0x4, ['unsigned long']], } ], '__unnamed_224a' : [ 0x8, { 'VetoType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PNP_VetoTypeUnknown', 1: 'PNP_VetoLegacyDevice', 2: 'PNP_VetoPendingClose', 3: 'PNP_VetoWindowsApp', 4: 'PNP_VetoWindowsService', 5: 'PNP_VetoOutstandingOpen', 6: 'PNP_VetoDevice', 7: 'PNP_VetoDriver', 8: 'PNP_VetoIllegalDeviceRequest', 9: 'PNP_VetoInsufficientPower', 10: 'PNP_VetoNonDisableable', 11: 'PNP_VetoLegacyDriver', 12: 'PNP_VetoInsufficientRights'})]], 'DeviceIdVetoNameBuffer' : [ 0x4, ['array', 1, ['wchar']]], } ], '__unnamed_224c' : [ 0x10, { 'BlockedDriverGuid' : [ 0x0, ['_GUID']], } ], '__unnamed_224e' : [ 0x2, { 'ParentId' : [ 0x0, ['array', 1, ['wchar']]], } ], '__unnamed_2250' : [ 0x20, { 'PowerSettingGuid' : [ 0x0, ['_GUID']], 'Flags' : [ 0x10, ['unsigned long']], 'SessionId' : [ 0x14, ['unsigned long']], 'DataLength' : [ 0x18, ['unsigned long']], 'Data' : [ 0x1c, ['array', 1, ['unsigned char']]], } ], '__unnamed_2252' : [ 0x20, { 'DeviceClass' : [ 0x0, ['__unnamed_2240']], 'TargetDevice' : [ 0x0, ['__unnamed_2242']], 'InstallDevice' : [ 0x0, ['__unnamed_2242']], 'CustomNotification' : [ 0x0, ['__unnamed_2244']], 'ProfileNotification' : [ 0x0, ['__unnamed_2246']], 'PowerNotification' : [ 0x0, ['__unnamed_2248']], 'VetoNotification' : [ 0x0, ['__unnamed_224a']], 'BlockedDriverNotification' : [ 0x0, ['__unnamed_224c']], 'InvalidIDNotification' : [ 0x0, ['__unnamed_224e']], 'PowerSettingNotification' : [ 0x0, ['__unnamed_2250']], 'PropertyChangeNotification' : [ 0x0, ['__unnamed_2242']], 'DeviceInstanceNotification' : [ 0x0, ['__unnamed_2242']], } ], '_PLUGPLAY_EVENT_BLOCK' : [ 0x44, { 'EventGuid' : [ 0x0, ['_GUID']], 'EventCategory' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'HardwareProfileChangeEvent', 1: 'TargetDeviceChangeEvent', 2: 'DeviceClassChangeEvent', 3: 'CustomDeviceEvent', 4: 'DeviceInstallEvent', 5: 'DeviceArrivalEvent', 6: 'VetoEvent', 7: 'BlockedDriverEvent', 8: 'InvalidIDEvent', 9: 'DevicePropertyChangeEvent', 10: 'DeviceInstanceRemovalEvent', 11: 'DeviceInstanceStartedEvent', 12: 'MaxPlugEventCategory'})]], 'Result' : [ 0x14, ['pointer', ['unsigned long']]], 'Flags' : [ 0x18, ['unsigned long']], 'TotalSize' : [ 0x1c, ['unsigned long']], 'DeviceObject' : [ 0x20, ['pointer', ['void']]], 'u' : [ 0x24, ['__unnamed_2252']], } ], '_VF_SUSPECT_DRIVER_ENTRY' : [ 0x18, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'Loads' : [ 0x8, ['unsigned long']], 'Unloads' : [ 0xc, ['unsigned long']], 'BaseName' : [ 0x10, ['_UNICODE_STRING']], } ], '_MMPTE_TIMESTAMP' : [ 0x8, { 'MustBeZero' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'PageFileLow' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 5, native_type='unsigned long long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long long')]], 'GlobalTimeStamp' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 64, native_type='unsigned long long')]], } ], '_SID_AND_ATTRIBUTES_HASH' : [ 0x88, { 'SidCount' : [ 0x0, ['unsigned long']], 'SidAttr' : [ 0x4, ['pointer', ['_SID_AND_ATTRIBUTES']]], 'Hash' : [ 0x8, ['array', 32, ['unsigned long']]], } ], '_XSTATE_CONTEXT' : [ 0x20, { 'Mask' : [ 0x0, ['unsigned long long']], 'Length' : [ 0x8, ['unsigned long']], 'Reserved1' : [ 0xc, ['unsigned long']], 'Area' : [ 0x10, ['pointer', ['_XSAVE_AREA']]], 'Reserved2' : [ 0x14, ['unsigned long']], 'Buffer' : [ 0x18, ['pointer', ['void']]], 'Reserved3' : [ 0x1c, ['unsigned long']], } ], '_PROCESSOR_IDLE_PREPARE_INFO' : [ 0x50, { 'Context' : [ 0x0, ['pointer', ['void']]], 'Constraints' : [ 0x8, ['_PROCESSOR_IDLE_CONSTRAINTS']], 'DependencyCount' : [ 0x38, ['unsigned long']], 'DependencyUsed' : [ 0x3c, ['unsigned long']], 'DependencyArray' : [ 0x40, ['pointer', ['_PROCESSOR_IDLE_DEPENDENCY']]], 'PlatformIdleStateIndex' : [ 0x44, ['unsigned long']], 'ProcessorIdleStateIndex' : [ 0x48, ['unsigned long']], 'IdleSelectFailureMask' : [ 0x4c, ['unsigned long']], } ], '_XSAVE_FORMAT' : [ 0x200, { 'ControlWord' : [ 0x0, ['unsigned short']], 'StatusWord' : [ 0x2, ['unsigned short']], 'TagWord' : [ 0x4, ['unsigned char']], 'Reserved1' : [ 0x5, ['unsigned char']], 'ErrorOpcode' : [ 0x6, ['unsigned short']], 'ErrorOffset' : [ 0x8, ['unsigned long']], 'ErrorSelector' : [ 0xc, ['unsigned short']], 'Reserved2' : [ 0xe, ['unsigned short']], 'DataOffset' : [ 0x10, ['unsigned long']], 'DataSelector' : [ 0x14, ['unsigned short']], 'Reserved3' : [ 0x16, ['unsigned short']], 'MxCsr' : [ 0x18, ['unsigned long']], 'MxCsr_Mask' : [ 0x1c, ['unsigned long']], 'FloatRegisters' : [ 0x20, ['array', 8, ['_M128A']]], 'XmmRegisters' : [ 0xa0, ['array', 8, ['_M128A']]], 'Reserved4' : [ 0x120, ['array', 224, ['unsigned char']]], } ], '__unnamed_226d' : [ 0x1, { 'AsUCHAR' : [ 0x0, ['unsigned char']], 'NoDomainAccounting' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IncreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 3, native_type='unsigned char')]], 'DecreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 5, native_type='unsigned char')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned char')]], } ], 'PROCESSOR_PERFSTATE_POLICY' : [ 0x1c, { 'Revision' : [ 0x0, ['unsigned long']], 'MaxThrottle' : [ 0x4, ['unsigned char']], 'MinThrottle' : [ 0x5, ['unsigned char']], 'BusyAdjThreshold' : [ 0x6, ['unsigned char']], 'Spare' : [ 0x7, ['unsigned char']], 'Flags' : [ 0x7, ['__unnamed_226d']], 'TimeCheck' : [ 0x8, ['unsigned long']], 'IncreaseTime' : [ 0xc, ['unsigned long']], 'DecreaseTime' : [ 0x10, ['unsigned long']], 'IncreasePercent' : [ 0x14, ['unsigned long']], 'DecreasePercent' : [ 0x18, ['unsigned long']], } ], '_BUS_EXTENSION_LIST' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['void']]], 'BusExtension' : [ 0x4, ['pointer', ['_PI_BUS_EXTENSION']]], } ], '_CACHED_CHILD_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'ValueList' : [ 0x4, ['unsigned long']], 'RealKcb' : [ 0x4, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], } ], '_KDEVICE_QUEUE' : [ 0x14, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'DeviceListHead' : [ 0x4, ['_LIST_ENTRY']], 'Lock' : [ 0xc, ['unsigned long']], 'Busy' : [ 0x10, ['unsigned char']], } ], '_SYSTEM_POWER_STATE_CONTEXT' : [ 0x4, { 'Reserved1' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long')]], 'TargetSystemState' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 12, native_type='unsigned long')]], 'EffectiveSystemState' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 16, native_type='unsigned long')]], 'CurrentSystemState' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 20, native_type='unsigned long')]], 'IgnoreHibernationPath' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'PseudoTransition' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'Reserved2' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 32, native_type='unsigned long')]], 'ContextAsUlong' : [ 0x0, ['unsigned long']], } ], '_MI_HARDWARE_STATE' : [ 0x78, { 'NodeMask' : [ 0x0, ['unsigned long']], 'NodeGraph' : [ 0x4, ['pointer', ['unsigned short']]], 'SystemNodeInformation' : [ 0x8, ['pointer', ['_MI_SYSTEM_NODE_INFORMATION']]], 'NumaLastRangeIndex' : [ 0xc, ['unsigned long']], 'NumaMemoryRanges' : [ 0x10, ['pointer', ['_HAL_NODE_RANGE']]], 'NumaTableCaptured' : [ 0x14, ['unsigned char']], 'NodeShift' : [ 0x15, ['unsigned char']], 'ChannelMemoryRanges' : [ 0x18, ['pointer', ['_HAL_CHANNEL_MEMORY_RANGES']]], 'ChannelShift' : [ 0x1c, ['unsigned char']], 'SecondLevelCacheSize' : [ 0x20, ['unsigned long']], 'FirstLevelCacheSize' : [ 0x24, ['unsigned long']], 'PhysicalAddressBits' : [ 0x28, ['unsigned long']], 'WriteCombiningPtes' : [ 0x2c, ['unsigned char']], 'AllMainMemoryMustBeCached' : [ 0x2d, ['unsigned char']], 'TotalPagesAllowed' : [ 0x30, ['unsigned long']], 'SecondaryColorMask' : [ 0x34, ['unsigned long']], 'SecondaryColors' : [ 0x38, ['unsigned long']], 'FlushTbForAttributeChange' : [ 0x3c, ['unsigned long']], 'FlushCacheForAttributeChange' : [ 0x40, ['unsigned long']], 'FlushCacheForPageAttributeChange' : [ 0x44, ['unsigned long']], 'CacheFlushPromoteThreshold' : [ 0x48, ['unsigned long']], 'FlushTbThreshold' : [ 0x4c, ['unsigned long']], 'ZeroCostCounts' : [ 0x50, ['array', 2, ['_MI_ZERO_COST_COUNTS']]], 'HighestPossiblePhysicalPage' : [ 0x70, ['unsigned long']], } ], '_PEBS_DS_SAVE_AREA' : [ 0x60, { 'BtsBufferBase' : [ 0x0, ['unsigned long long']], 'BtsIndex' : [ 0x8, ['unsigned long long']], 'BtsAbsoluteMaximum' : [ 0x10, ['unsigned long long']], 'BtsInterruptThreshold' : [ 0x18, ['unsigned long long']], 'PebsBufferBase' : [ 0x20, ['unsigned long long']], 'PebsIndex' : [ 0x28, ['unsigned long long']], 'PebsAbsoluteMaximum' : [ 0x30, ['unsigned long long']], 'PebsInterruptThreshold' : [ 0x38, ['unsigned long long']], 'PebsCounterReset0' : [ 0x40, ['unsigned long long']], 'PebsCounterReset1' : [ 0x48, ['unsigned long long']], 'PebsCounterReset2' : [ 0x50, ['unsigned long long']], 'PebsCounterReset3' : [ 0x58, ['unsigned long long']], } ], '_OBJECT_TYPE_INITIALIZER' : [ 0x58, { 'Length' : [ 0x0, ['unsigned short']], 'ObjectTypeFlags' : [ 0x2, ['unsigned char']], 'CaseInsensitive' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'UnnamedObjectsOnly' : [ 0x2, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'UseDefaultObject' : [ 0x2, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'SecurityRequired' : [ 0x2, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'MaintainHandleCount' : [ 0x2, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'MaintainTypeList' : [ 0x2, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'SupportsObjectCallbacks' : [ 0x2, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'CacheAligned' : [ 0x2, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'ObjectTypeCode' : [ 0x4, ['unsigned long']], 'InvalidAttributes' : [ 0x8, ['unsigned long']], 'GenericMapping' : [ 0xc, ['_GENERIC_MAPPING']], 'ValidAccessMask' : [ 0x1c, ['unsigned long']], 'RetainAccess' : [ 0x20, ['unsigned long']], 'PoolType' : [ 0x24, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPoolBase', 1: 'PagedPool', 2: 'NonPagedPoolBaseMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolBaseCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolBaseCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 516: 'NonPagedPoolNxCacheAligned', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 512: 'NonPagedPoolNx', 544: 'NonPagedPoolSessionNx', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'DefaultPagedPoolCharge' : [ 0x28, ['unsigned long']], 'DefaultNonPagedPoolCharge' : [ 0x2c, ['unsigned long']], 'DumpProcedure' : [ 0x30, ['pointer', ['void']]], 'OpenProcedure' : [ 0x34, ['pointer', ['void']]], 'CloseProcedure' : [ 0x38, ['pointer', ['void']]], 'DeleteProcedure' : [ 0x3c, ['pointer', ['void']]], 'ParseProcedure' : [ 0x40, ['pointer', ['void']]], 'SecurityProcedure' : [ 0x44, ['pointer', ['void']]], 'QueryNameProcedure' : [ 0x48, ['pointer', ['void']]], 'OkayToCloseProcedure' : [ 0x4c, ['pointer', ['void']]], 'WaitObjectFlagMask' : [ 0x50, ['unsigned long']], 'WaitObjectFlagOffset' : [ 0x54, ['unsigned short']], 'WaitObjectPointerOffset' : [ 0x56, ['unsigned short']], } ], '__unnamed_22b1' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'SubsectionFlags' : [ 0x0, ['_MMSUBSECTION_FLAGS']], } ], '__unnamed_22b3' : [ 0x4, { 'NumberOfChildViews' : [ 0x0, ['unsigned long']], } ], '_SUBSECTION' : [ 0x28, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'SubsectionBase' : [ 0x4, ['pointer', ['_MMPTE']]], 'NextSubsection' : [ 0x8, ['pointer', ['_SUBSECTION']]], 'FileExtents' : [ 0xc, ['pointer', ['_MI_FILE_EXTENTS']]], 'GlobalPerSessionHead' : [ 0xc, ['_RTL_AVL_TREE']], 'SessionDriverProtos' : [ 0xc, ['pointer', ['_MI_PER_SESSION_PROTOS']]], 'u' : [ 0x10, ['__unnamed_22b1']], 'StartingSector' : [ 0x14, ['unsigned long']], 'NumberOfFullSectors' : [ 0x18, ['unsigned long']], 'PtesInSubsection' : [ 0x1c, ['unsigned long']], 'u1' : [ 0x20, ['__unnamed_22b3']], 'UnusedPtes' : [ 0x24, ['unsigned long']], 'AlignmentNoAccessPtes' : [ 0x24, ['unsigned long']], } ], '__unnamed_22b8' : [ 0x4, { 'Long' : [ 0x0, ['unsigned long']], 'e1' : [ 0x0, ['_MI_DECAY_TIMER_LINKAGE']], } ], '_MI_DECAY_TIMER_LINK' : [ 0x4, { 'u1' : [ 0x0, ['__unnamed_22b8']], } ], '_TRIAGE_PNP_DEVICE_COMPLETION_REQUEST' : [ 0xc, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'DeviceNode' : [ 0x8, ['pointer', ['_TRIAGE_DEVICE_NODE']]], } ], 'tagSWITCH_CONTEXT_ATTRIBUTE' : [ 0x18, { 'ulContextUpdateCounter' : [ 0x0, ['unsigned long long']], 'fAllowContextUpdate' : [ 0x8, ['long']], 'fEnableTrace' : [ 0xc, ['long']], 'EtwHandle' : [ 0x10, ['unsigned long long']], } ], '_IO_CLIENT_EXTENSION' : [ 0x8, { 'NextExtension' : [ 0x0, ['pointer', ['_IO_CLIENT_EXTENSION']]], 'ClientIdentificationAddress' : [ 0x4, ['pointer', ['void']]], } ], '_ETW_BUFFER_CONTEXT' : [ 0x4, { 'ProcessorNumber' : [ 0x0, ['unsigned char']], 'Alignment' : [ 0x1, ['unsigned char']], 'ProcessorIndex' : [ 0x0, ['unsigned short']], 'LoggerId' : [ 0x2, ['unsigned short']], } ], '_HEAP_EXTENDED_ENTRY' : [ 0x8, { 'FunctionIndex' : [ 0x0, ['unsigned short']], 'ContextValue' : [ 0x2, ['unsigned short']], 'InterceptorValue' : [ 0x0, ['unsigned long']], 'UnusedBytesLength' : [ 0x4, ['unsigned short']], 'EntryOffset' : [ 0x6, ['unsigned char']], 'ExtendedBlockSignature' : [ 0x7, ['unsigned char']], } ], '_MI_SYSTEM_VA_STATE' : [ 0x14c0, { 'SystemTablesLock' : [ 0x0, ['unsigned long']], 'SystemVaBias' : [ 0x4, ['unsigned long']], 'SystemAvailableVaLow' : [ 0x8, ['unsigned long']], 'VirtualBias' : [ 0xc, ['unsigned long']], 'HyperSpaceEnd' : [ 0x10, ['pointer', ['void']]], 'HyperSpaceEndPte' : [ 0x14, ['pointer', ['_MMPTE']]], 'SystemRangeStart' : [ 0x18, ['pointer', ['void']]], 'SystemCachePdeCount' : [ 0x1c, ['array', 1024, ['unsigned char']]], 'SystemCacheReverseMaps' : [ 0x41c, ['array', 1024, ['pointer', ['void']]]], 'WorkingSetListHashStart' : [ 0x141c, ['pointer', ['_MMWSLE_HASH']]], 'WorkingSetListHashEnd' : [ 0x1420, ['pointer', ['_MMWSLE_HASH']]], 'WorkingSetListIndirectHashStart' : [ 0x1424, ['pointer', ['_MMWSLE_NONDIRECT_HASH']]], 'FreeSystemCacheVa' : [ 0x1428, ['_KEVENT']], 'SystemVaLock' : [ 0x1438, ['unsigned long']], 'DeleteKvaLock' : [ 0x143c, ['long']], 'FreeSystemCache' : [ 0x1440, ['_MI_PTE_CHAIN_HEAD']], 'SystemCacheViewLock' : [ 0x1458, ['unsigned long']], 'UnusableWsles' : [ 0x145c, ['array', 5, ['unsigned long']]], 'PossibleWsles' : [ 0x1470, ['array', 5, ['unsigned long']]], } ], '_DIRTY_PAGE_STATISTICS' : [ 0xc, { 'DirtyPages' : [ 0x0, ['unsigned long']], 'DirtyPagesLastScan' : [ 0x4, ['unsigned long']], 'DirtyPagesScheduledLastScan' : [ 0x8, ['unsigned long']], } ], '_DBGKD_WRITE_CUSTOM_BREAKPOINT' : [ 0x18, { 'BreakPointAddress' : [ 0x0, ['unsigned long long']], 'BreakPointInstruction' : [ 0x8, ['unsigned long long']], 'BreakPointHandle' : [ 0x10, ['unsigned long']], 'BreakPointInstructionSize' : [ 0x14, ['unsigned char']], 'BreakPointInstructionAlignment' : [ 0x15, ['unsigned char']], } ], '_PROC_IDLE_SNAP' : [ 0x10, { 'Time' : [ 0x0, ['unsigned long long']], 'Idle' : [ 0x8, ['unsigned long long']], } ], '_KERNEL_STACK_SEGMENT' : [ 0x10, { 'StackBase' : [ 0x0, ['unsigned long']], 'StackLimit' : [ 0x4, ['unsigned long']], 'KernelStack' : [ 0x8, ['unsigned long']], 'InitialStack' : [ 0xc, ['unsigned long']], } ], '_KEXECUTE_OPTIONS' : [ 0x1, { 'ExecuteDisable' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'ExecuteEnable' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'DisableThunkEmulation' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'Permanent' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'ExecuteDispatchEnable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'ImageDispatchEnable' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'DisableExceptionChainValidation' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'ExecuteOptions' : [ 0x0, ['unsigned char']], 'ExecuteOptionsNV' : [ 0x0, ['unsigned char']], } ], '_SEP_TOKEN_PRIVILEGES' : [ 0x18, { 'Present' : [ 0x0, ['unsigned long long']], 'Enabled' : [ 0x8, ['unsigned long long']], 'EnabledByDefault' : [ 0x10, ['unsigned long long']], } ], '_WHEA_XPF_MCE_DESCRIPTOR' : [ 0x398, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'NumberOfBanks' : [ 0x3, ['unsigned char']], 'Flags' : [ 0x4, ['_XPF_MCE_FLAGS']], 'MCG_Capability' : [ 0x8, ['unsigned long long']], 'MCG_GlobalControl' : [ 0x10, ['unsigned long long']], 'Banks' : [ 0x18, ['array', 32, ['_WHEA_XPF_MC_BANK_DESCRIPTOR']]], } ], '_MI_DEBUGGER_STATE' : [ 0x90, { 'TransientWrite' : [ 0x0, ['unsigned char']], 'CodePageEdited' : [ 0x1, ['unsigned char']], 'DebugPte' : [ 0x4, ['pointer', ['_MMPTE']]], 'PoisonedTb' : [ 0x8, ['unsigned long']], 'InDebugger' : [ 0xc, ['long']], 'Pfns' : [ 0x10, ['array', 32, ['pointer', ['void']]]], } ], '_MI_PROCESS_STATE' : [ 0x70, { 'ColorSeed' : [ 0x0, ['unsigned long']], 'CloneDereferenceEvent' : [ 0x4, ['_KEVENT']], 'CloneProtosSListHead' : [ 0x18, ['_SLIST_HEADER']], 'SystemDllBase' : [ 0x20, ['pointer', ['void']]], 'RotatingUniprocessorNumber' : [ 0x24, ['long']], 'CriticalSectionTimeout' : [ 0x28, ['_LARGE_INTEGER']], 'ProcessList' : [ 0x30, ['_LIST_ENTRY']], 'SharedUserDataPte' : [ 0x38, ['pointer', ['_MMPTE']]], 'FreePaeEntries' : [ 0x3c, ['unsigned long']], 'FirstFreePae' : [ 0x40, ['_PAE_ENTRY']], 'AllocatedPaePages' : [ 0x60, ['long']], 'PaeLock' : [ 0x64, ['unsigned long']], 'PaeEntrySList' : [ 0x68, ['_SLIST_HEADER']], } ], '_ARBITER_ALLOCATION_STATE' : [ 0x38, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'CurrentMinimum' : [ 0x10, ['unsigned long long']], 'CurrentMaximum' : [ 0x18, ['unsigned long long']], 'Entry' : [ 0x20, ['pointer', ['_ARBITER_LIST_ENTRY']]], 'CurrentAlternative' : [ 0x24, ['pointer', ['_ARBITER_ALTERNATIVE']]], 'AlternativeCount' : [ 0x28, ['unsigned long']], 'Alternatives' : [ 0x2c, ['pointer', ['_ARBITER_ALTERNATIVE']]], 'Flags' : [ 0x30, ['unsigned short']], 'RangeAttributes' : [ 0x32, ['unsigned char']], 'RangeAvailableAttributes' : [ 0x33, ['unsigned char']], 'WorkSpace' : [ 0x34, ['unsigned long']], } ], '_VACB_ARRAY_HEADER' : [ 0x10, { 'VacbArrayIndex' : [ 0x0, ['unsigned long']], 'MappingCount' : [ 0x4, ['unsigned long']], 'HighestMappedIndex' : [ 0x8, ['unsigned long']], 'Reserved' : [ 0xc, ['unsigned long']], } ], '_MMWSLENTRY' : [ 0x4, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Hashed' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Direct' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 9, native_type='unsigned long')]], 'Age' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 12, native_type='unsigned long')]], 'VirtualPageNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 32, native_type='unsigned long')]], } ], 'SYSTEM_POWER_CAPABILITIES' : [ 0x4c, { 'PowerButtonPresent' : [ 0x0, ['unsigned char']], 'SleepButtonPresent' : [ 0x1, ['unsigned char']], 'LidPresent' : [ 0x2, ['unsigned char']], 'SystemS1' : [ 0x3, ['unsigned char']], 'SystemS2' : [ 0x4, ['unsigned char']], 'SystemS3' : [ 0x5, ['unsigned char']], 'SystemS4' : [ 0x6, ['unsigned char']], 'SystemS5' : [ 0x7, ['unsigned char']], 'HiberFilePresent' : [ 0x8, ['unsigned char']], 'FullWake' : [ 0x9, ['unsigned char']], 'VideoDimPresent' : [ 0xa, ['unsigned char']], 'ApmPresent' : [ 0xb, ['unsigned char']], 'UpsPresent' : [ 0xc, ['unsigned char']], 'ThermalControl' : [ 0xd, ['unsigned char']], 'ProcessorThrottle' : [ 0xe, ['unsigned char']], 'ProcessorMinThrottle' : [ 0xf, ['unsigned char']], 'ProcessorMaxThrottle' : [ 0x10, ['unsigned char']], 'FastSystemS4' : [ 0x11, ['unsigned char']], 'Hiberboot' : [ 0x12, ['unsigned char']], 'WakeAlarmPresent' : [ 0x13, ['unsigned char']], 'AoAc' : [ 0x14, ['unsigned char']], 'DiskSpinDown' : [ 0x15, ['unsigned char']], 'HiberFileType' : [ 0x16, ['unsigned char']], 'AoAcConnectivitySupported' : [ 0x17, ['unsigned char']], 'spare3' : [ 0x18, ['array', 6, ['unsigned char']]], 'SystemBatteriesPresent' : [ 0x1e, ['unsigned char']], 'BatteriesAreShortTerm' : [ 0x1f, ['unsigned char']], 'BatteryScale' : [ 0x20, ['array', 3, ['BATTERY_REPORTING_SCALE']]], 'AcOnLineWake' : [ 0x38, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'SoftLidWake' : [ 0x3c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'RtcWake' : [ 0x40, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'MinDeviceWakeState' : [ 0x44, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DefaultLowLatencyWake' : [ 0x48, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], '_MI_REBUILD_LARGE_PAGE_COUNTDOWN' : [ 0x2, { 'SecondsLeft' : [ 0x0, ['unsigned char']], 'SecondsAssigned' : [ 0x1, ['unsigned char']], } ], '_DBGKD_SWITCH_PARTITION' : [ 0x4, { 'Partition' : [ 0x0, ['unsigned long']], } ], '_REQUEST_MAILBOX' : [ 0x20, { 'Next' : [ 0x0, ['pointer', ['_REQUEST_MAILBOX']]], 'RequestSummary' : [ 0x4, ['unsigned long']], 'RequestPacket' : [ 0x8, ['_KREQUEST_PACKET']], 'NodeTargetCountAddr' : [ 0x18, ['pointer', ['long']]], 'NodeTargetCount' : [ 0x1c, ['long']], } ], '_DBGKD_GET_VERSION32' : [ 0x28, { 'MajorVersion' : [ 0x0, ['unsigned short']], 'MinorVersion' : [ 0x2, ['unsigned short']], 'ProtocolVersion' : [ 0x4, ['unsigned short']], 'Flags' : [ 0x6, ['unsigned short']], 'KernBase' : [ 0x8, ['unsigned long']], 'PsLoadedModuleList' : [ 0xc, ['unsigned long']], 'MachineType' : [ 0x10, ['unsigned short']], 'ThCallbackStack' : [ 0x12, ['unsigned short']], 'NextCallback' : [ 0x14, ['unsigned short']], 'FramePointer' : [ 0x16, ['unsigned short']], 'KiCallUserMode' : [ 0x18, ['unsigned long']], 'KeUserCallbackDispatcher' : [ 0x1c, ['unsigned long']], 'BreakpointWithStatus' : [ 0x20, ['unsigned long']], 'DebuggerDataList' : [ 0x24, ['unsigned long']], } ], '_WHEA_XPF_CMC_DESCRIPTOR' : [ 0x3a4, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'NumberOfBanks' : [ 0x3, ['unsigned char']], 'Reserved' : [ 0x4, ['unsigned long']], 'Notify' : [ 0x8, ['_WHEA_NOTIFICATION_DESCRIPTOR']], 'Banks' : [ 0x24, ['array', 32, ['_WHEA_XPF_MC_BANK_DESCRIPTOR']]], } ], '_WHEA_TIMESTAMP' : [ 0x8, { 'Seconds' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long long')]], 'Minutes' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 16, native_type='unsigned long long')]], 'Hours' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 24, native_type='unsigned long long')]], 'Precise' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 25, end_bit = 32, native_type='unsigned long long')]], 'Day' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 40, native_type='unsigned long long')]], 'Month' : [ 0x0, ['BitField', dict(start_bit = 40, end_bit = 48, native_type='unsigned long long')]], 'Year' : [ 0x0, ['BitField', dict(start_bit = 48, end_bit = 56, native_type='unsigned long long')]], 'Century' : [ 0x0, ['BitField', dict(start_bit = 56, end_bit = 64, native_type='unsigned long long')]], 'AsLARGE_INTEGER' : [ 0x0, ['_LARGE_INTEGER']], } ], '_IO_IRP_EXT_TRACK_OFFSET_HEADER' : [ 0x8, { 'Validation' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'TrackedOffsetCallback' : [ 0x4, ['pointer', ['void']]], } ], '_VPB' : [ 0x58, { 'Type' : [ 0x0, ['short']], 'Size' : [ 0x2, ['short']], 'Flags' : [ 0x4, ['unsigned short']], 'VolumeLabelLength' : [ 0x6, ['unsigned short']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'RealDevice' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], 'SerialNumber' : [ 0x10, ['unsigned long']], 'ReferenceCount' : [ 0x14, ['unsigned long']], 'VolumeLabel' : [ 0x18, ['array', 32, ['wchar']]], } ], '_MI_SESSION_STATE' : [ 0x1038, { 'SystemSession' : [ 0x0, ['_MMSESSION']], 'CodePageEdited' : [ 0x14, ['unsigned char']], 'VaReferenceCount' : [ 0x18, ['array', 1024, ['long']]], 'DynamicPtesBitBuffer' : [ 0x1018, ['pointer', ['unsigned long']]], 'IdLock' : [ 0x101c, ['_EX_PUSH_LOCK']], 'DetachTimeStamp' : [ 0x1020, ['unsigned long']], 'LeaderProcess' : [ 0x1024, ['pointer', ['_EPROCESS']]], 'InitializeLock' : [ 0x1028, ['_EX_PUSH_LOCK']], 'WorkingSetList' : [ 0x102c, ['pointer', ['_MMWSL']]], 'WsHashStart' : [ 0x1030, ['pointer', ['_MMWSLE_HASH']]], 'WsHashEnd' : [ 0x1034, ['pointer', ['_MMWSLE_HASH']]], } ], '_CACHE_DESCRIPTOR' : [ 0xc, { 'Level' : [ 0x0, ['unsigned char']], 'Associativity' : [ 0x1, ['unsigned char']], 'LineSize' : [ 0x2, ['unsigned short']], 'Size' : [ 0x4, ['unsigned long']], 'Type' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'CacheUnified', 1: 'CacheInstruction', 2: 'CacheData', 3: 'CacheTrace'})]], } ], '_MMSESSION' : [ 0x14, { 'SystemSpaceViewLock' : [ 0x0, ['_EX_PUSH_LOCK']], 'SystemSpaceViewLockPointer' : [ 0x4, ['pointer', ['_EX_PUSH_LOCK']]], 'ViewRoot' : [ 0x8, ['_RTL_AVL_TREE']], 'ViewCount' : [ 0xc, ['unsigned long']], 'BitmapFailures' : [ 0x10, ['unsigned long']], } ], '_IOP_IRP_STACK_PROFILER' : [ 0x54, { 'Profile' : [ 0x0, ['array', 20, ['unsigned long']]], 'TotalIrps' : [ 0x50, ['unsigned long']], } ], '_FILE_BASIC_INFORMATION' : [ 0x28, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LastAccessTime' : [ 0x8, ['_LARGE_INTEGER']], 'LastWriteTime' : [ 0x10, ['_LARGE_INTEGER']], 'ChangeTime' : [ 0x18, ['_LARGE_INTEGER']], 'FileAttributes' : [ 0x20, ['unsigned long']], } ], '_SECURITY_SUBJECT_CONTEXT' : [ 0x10, { 'ClientToken' : [ 0x0, ['pointer', ['void']]], 'ImpersonationLevel' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'SecurityAnonymous', 1: 'SecurityIdentification', 2: 'SecurityImpersonation', 3: 'SecurityDelegation'})]], 'PrimaryToken' : [ 0x8, ['pointer', ['void']]], 'ProcessAuditId' : [ 0xc, ['pointer', ['void']]], } ], '_MI_DECAY_TIMER_LINKAGE' : [ 0x4, { 'Spare0' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PreviousDecayPfn' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 16, native_type='unsigned long')]], 'Spare1' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'NextDecayPfn' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 32, native_type='unsigned long')]], } ], '_EVENT_HEADER' : [ 0x50, { 'Size' : [ 0x0, ['unsigned short']], 'HeaderType' : [ 0x2, ['unsigned short']], 'Flags' : [ 0x4, ['unsigned short']], 'EventProperty' : [ 0x6, ['unsigned short']], 'ThreadId' : [ 0x8, ['unsigned long']], 'ProcessId' : [ 0xc, ['unsigned long']], 'TimeStamp' : [ 0x10, ['_LARGE_INTEGER']], 'ProviderId' : [ 0x18, ['_GUID']], 'EventDescriptor' : [ 0x28, ['_EVENT_DESCRIPTOR']], 'KernelTime' : [ 0x38, ['unsigned long']], 'UserTime' : [ 0x3c, ['unsigned long']], 'ProcessorTime' : [ 0x38, ['unsigned long long']], 'ActivityId' : [ 0x40, ['_GUID']], } ], '_KiIoAccessMap' : [ 0x2024, { 'DirectionMap' : [ 0x0, ['array', 32, ['unsigned char']]], 'IoMap' : [ 0x20, ['array', 8196, ['unsigned char']]], } ], '_PF_KERNEL_GLOBALS' : [ 0x40, { 'AccessBufferAgeThreshold' : [ 0x0, ['unsigned long long']], 'AccessBufferRef' : [ 0x8, ['_EX_RUNDOWN_REF']], 'AccessBufferExistsEvent' : [ 0xc, ['_KEVENT']], 'AccessBufferMax' : [ 0x1c, ['unsigned long']], 'AccessBufferList' : [ 0x20, ['_SLIST_HEADER']], 'StreamSequenceNumber' : [ 0x28, ['long']], 'Flags' : [ 0x2c, ['unsigned long']], 'ScenarioPrefetchCount' : [ 0x30, ['long']], } ], '_CM_KEY_HASH_TABLE_ENTRY' : [ 0xc, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'Owner' : [ 0x4, ['pointer', ['_KTHREAD']]], 'Entry' : [ 0x8, ['pointer', ['_CM_KEY_HASH']]], } ], '_ARBITER_QUERY_ARBITRATE_PARAMETERS' : [ 0x4, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], } ], '__unnamed_233a' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x0, ['_MI_PARTITION_FLAGS']], } ], '_MI_PARTITION_CORE' : [ 0xe8, { 'PartitionId' : [ 0x0, ['unsigned short']], 'u' : [ 0x4, ['__unnamed_233a']], 'ReferenceCount' : [ 0x8, ['unsigned long']], 'ParentPartition' : [ 0xc, ['pointer', ['_MI_PARTITION']]], 'ListEntry' : [ 0x10, ['_LIST_ENTRY']], 'NodeInformation' : [ 0x18, ['pointer', ['_MI_NODE_INFORMATION']]], 'MdlPhysicalMemoryBlock' : [ 0x1c, ['pointer', ['_MDL']]], 'MemoryNodeRuns' : [ 0x20, ['pointer', ['_PHYSICAL_MEMORY_DESCRIPTOR']]], 'Stats' : [ 0x24, ['_MI_PARTITION_STATISTICS']], 'MemoryRuns' : [ 0x74, ['pointer', ['_PHYSICAL_MEMORY_DESCRIPTOR']]], 'ExitEvent' : [ 0x78, ['_KEVENT']], 'SystemThreadHandles' : [ 0x88, ['array', 5, ['pointer', ['void']]]], 'PartitionObject' : [ 0x9c, ['pointer', ['void']]], 'PartitionObjectHandle' : [ 0xa0, ['pointer', ['void']]], 'DynamicMemoryPushLock' : [ 0xa4, ['_EX_PUSH_LOCK']], 'DynamicMemoryLock' : [ 0xa8, ['long']], 'TemporaryMemoryEvent' : [ 0xac, ['_KEVENT']], 'MemoryEvents' : [ 0xbc, ['array', 11, ['pointer', ['_KEVENT']]]], } ], '_MI_PARTITION_MODWRITES' : [ 0x1b0, { 'AttemptForCantExtend' : [ 0x0, ['_MMPAGE_FILE_EXPANSION']], 'PageFileContract' : [ 0x38, ['_MMPAGE_FILE_EXPANSION']], 'NumberOfMappedMdls' : [ 0x70, ['unsigned long']], 'NumberOfMappedMdlsInUse' : [ 0x74, ['long']], 'NumberOfMappedMdlsInUsePeak' : [ 0x78, ['unsigned long']], 'MappedFileHeader' : [ 0x7c, ['_MMMOD_WRITER_LISTHEAD']], 'NeedMappedMdl' : [ 0x94, ['unsigned char']], 'NeedPageFileMdl' : [ 0x95, ['unsigned char']], 'TransitionInserted' : [ 0x96, ['unsigned char']], 'LastModifiedWriteError' : [ 0x98, ['long']], 'LastMappedWriteError' : [ 0x9c, ['long']], 'MappedFileWriteSucceeded' : [ 0xa0, ['unsigned long']], 'MappedWriteBurstCount' : [ 0xa4, ['unsigned long']], 'LowPriorityModWritesOutstanding' : [ 0xa8, ['unsigned long']], 'BoostModWriteIoPriorityEvent' : [ 0xac, ['_KEVENT']], 'ModifiedWriterThreadPriority' : [ 0xbc, ['long']], 'ModifiedPagesLowPriorityGoal' : [ 0xc0, ['unsigned long']], 'ModifiedPageWriterEvent' : [ 0xc4, ['_KEVENT']], 'WriteAllPagefilePages' : [ 0xd4, ['long']], 'WriteAllMappedPages' : [ 0xd8, ['long']], 'MappedPageWriterEvent' : [ 0xdc, ['_KEVENT']], 'ModWriteData' : [ 0xf0, ['_MI_MODWRITE_DATA']], 'RescanPageFilesEvent' : [ 0x120, ['_KEVENT']], 'PagingFileHeader' : [ 0x130, ['_MMMOD_WRITER_LISTHEAD']], 'ModifiedPageWriterThread' : [ 0x148, ['pointer', ['_ETHREAD']]], 'ModifiedPageWriterRundown' : [ 0x14c, ['_EX_RUNDOWN_REF']], 'PagefileScanWorkItem' : [ 0x150, ['_WORK_QUEUE_ITEM']], 'PagefileScanCount' : [ 0x160, ['unsigned long']], 'ClusterWritesDisabled' : [ 0x164, ['array', 2, ['long']]], 'DelayMappedWrite' : [ 0x16c, ['unsigned char']], 'PagefileReservationsEnabled' : [ 0x170, ['unsigned long']], 'PageFileCreationLock' : [ 0x174, ['_EX_PUSH_LOCK']], 'TrimPagefileWorkItem' : [ 0x178, ['_WORK_QUEUE_ITEM']], 'LastTrimPagefileTime' : [ 0x188, ['unsigned long long']], 'WsSwapPagefileContractWorkItem' : [ 0x190, ['_WORK_QUEUE_ITEM']], 'WsSwapPageFileContractionInProgress' : [ 0x1a0, ['long']], 'WorkingSetSwapLock' : [ 0x1a4, ['_EX_PUSH_LOCK']], 'WorkingSetInswapLock' : [ 0x1a8, ['long']], } ], '_ARBITER_BOOT_ALLOCATION_PARAMETERS' : [ 0x4, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], } ], '_KPRIQUEUE' : [ 0x19c, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'EntryListHead' : [ 0x10, ['array', 32, ['_LIST_ENTRY']]], 'CurrentCount' : [ 0x110, ['array', 32, ['long']]], 'MaximumCount' : [ 0x190, ['unsigned long']], 'ThreadListHead' : [ 0x194, ['_LIST_ENTRY']], } ], '__unnamed_2354' : [ 0x4, { 'ChannelsHotCold' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '_MI_NODE_INFORMATION' : [ 0x68, { 'LargePageFreeCount' : [ 0x0, ['array', 2, ['unsigned long']]], 'LargePages' : [ 0x8, ['array', 2, ['array', 2, ['array', 1, ['_LIST_ENTRY']]]]], 'LargePagesCount' : [ 0x28, ['array', 2, ['array', 2, ['array', 1, ['unsigned long']]]]], 'FreeCount' : [ 0x38, ['array', 2, ['unsigned long']]], 'TotalPages' : [ 0x40, ['array', 1, ['unsigned long']]], 'TotalPagesEntireNode' : [ 0x44, ['unsigned long']], 'MmShiftedColor' : [ 0x48, ['unsigned long']], 'Color' : [ 0x4c, ['unsigned long']], 'ChannelFreeCount' : [ 0x50, ['array', 1, ['array', 2, ['unsigned long']]]], 'Flags' : [ 0x58, ['__unnamed_2354']], 'NodeLock' : [ 0x5c, ['_EX_PUSH_LOCK']], 'ChannelStatus' : [ 0x60, ['unsigned char']], 'ChannelOrdering' : [ 0x61, ['array', 1, ['unsigned char']]], 'LockedChannelOrdering' : [ 0x62, ['array', 1, ['unsigned char']]], 'PowerAttribute' : [ 0x63, ['array', 1, ['unsigned char']]], 'LargePageLock' : [ 0x64, ['unsigned long']], } ], '_EXCEPTION_REGISTRATION_RECORD' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'Handler' : [ 0x4, ['pointer', ['void']]], } ], '_WAITING_IRP' : [ 0x20, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'CompletionRoutine' : [ 0xc, ['pointer', ['void']]], 'Context' : [ 0x10, ['pointer', ['void']]], 'Event' : [ 0x14, ['pointer', ['_KEVENT']]], 'Information' : [ 0x18, ['unsigned long']], 'BreakAllRH' : [ 0x1c, ['unsigned char']], } ], '_ETW_FILTER_PID' : [ 0x24, { 'Count' : [ 0x0, ['unsigned long']], 'Pids' : [ 0x4, ['array', 8, ['unsigned long']]], } ], '_PPM_SELECTION_MENU' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'Entries' : [ 0x4, ['pointer', ['_PPM_SELECTION_MENU_ENTRY']]], } ], '_VF_TARGET_ALL_SHARED_EXPORT_THUNKS' : [ 0x10, { 'SharedExportThunks' : [ 0x0, ['pointer', ['_VERIFIER_SHARED_EXPORT_THUNK']]], 'PoolSharedExportThunks' : [ 0x4, ['pointer', ['_VERIFIER_SHARED_EXPORT_THUNK']]], 'OrderDependentSharedExportThunks' : [ 0x8, ['pointer', ['_VERIFIER_SHARED_EXPORT_THUNK']]], 'XdvSharedExportThunks' : [ 0xc, ['pointer', ['_VERIFIER_SHARED_EXPORT_THUNK']]], } ], '_KSCHEDULING_GROUP' : [ 0x140, { 'Policy' : [ 0x0, ['_KSCHEDULING_GROUP_POLICY']], 'RelativeWeight' : [ 0x8, ['unsigned long']], 'ChildMinRate' : [ 0xc, ['unsigned long']], 'ChildMinWeight' : [ 0x10, ['unsigned long']], 'ChildTotalWeight' : [ 0x14, ['unsigned long']], 'QueryHistoryTimeStamp' : [ 0x18, ['unsigned long long']], 'NotificationCycles' : [ 0x20, ['long long']], 'SchedulingGroupList' : [ 0x28, ['_LIST_ENTRY']], 'Sibling' : [ 0x28, ['_LIST_ENTRY']], 'NotificationDpc' : [ 0x30, ['pointer', ['_KDPC']]], 'ChildList' : [ 0x34, ['_LIST_ENTRY']], 'Parent' : [ 0x3c, ['pointer', ['_KSCHEDULING_GROUP']]], 'PerProcessor' : [ 0x40, ['array', 1, ['_KSCB']]], } ], '_ETW_REF_CLOCK' : [ 0x10, { 'StartTime' : [ 0x0, ['_LARGE_INTEGER']], 'StartPerfClock' : [ 0x8, ['_LARGE_INTEGER']], } ], '_OB_DUPLICATE_OBJECT_STATE' : [ 0x18, { 'SourceProcess' : [ 0x0, ['pointer', ['_EPROCESS']]], 'SourceHandle' : [ 0x4, ['pointer', ['void']]], 'Object' : [ 0x8, ['pointer', ['void']]], 'TargetAccess' : [ 0xc, ['unsigned long']], 'ObjectInfo' : [ 0x10, ['_HANDLE_TABLE_ENTRY_INFO']], 'HandleAttributes' : [ 0x14, ['unsigned long']], } ], '_MMPTE_SUBSECTION' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'Unused0' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 5, native_type='unsigned long long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Unused1' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 32, native_type='unsigned long long')]], 'SubsectionAddress' : [ 0x0, ['BitField', dict(start_bit = 32, end_bit = 64, native_type='unsigned long long')]], } ], '_POWER_STATE' : [ 0x4, { 'SystemState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'DeviceState' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], } ], '_MMWORKING_SET_EXPANSION_HEAD' : [ 0x8, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], } ], '_POP_IRP_WORKER_ENTRY' : [ 0x18, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Thread' : [ 0x8, ['pointer', ['_ETHREAD']]], 'Irp' : [ 0xc, ['pointer', ['_IRP']]], 'Device' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'Static' : [ 0x14, ['unsigned char']], } ], '_POP_POLICY_DEVICE' : [ 0x20, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'DeviceType' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PolicyDeviceSystemButton', 1: 'PolicyDeviceThermalZone', 2: 'PolicyDeviceBattery', 3: 'PolicyDeviceMemory', 4: 'PolicyInitiatePowerActionAPI', 5: 'PolicySetPowerStateAPI', 6: 'PolicyImmediateDozeS4', 7: 'PolicySystemIdle', 8: 'PolicyDeviceWakeAlarm', 9: 'PolicyDeviceFan', 10: 'PolicyCsBatterySaver', 11: 'PolicyDeviceMax'})]], 'Notification' : [ 0xc, ['pointer', ['void']]], 'Name' : [ 0x10, ['_UNICODE_STRING']], 'Device' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'Irp' : [ 0x1c, ['pointer', ['_IRP']]], } ], '_MI_SECTION_STATE' : [ 0x140, { 'SegmentListLock' : [ 0x0, ['long']], 'SectionObjectPointersLock' : [ 0x40, ['long']], 'SectionExtendLock' : [ 0x44, ['_EX_PUSH_LOCK']], 'SectionExtendSetLock' : [ 0x48, ['_EX_PUSH_LOCK']], 'SectionBasedRoot' : [ 0x4c, ['_RTL_AVL_TREE']], 'SectionBasedLock' : [ 0x50, ['_EX_PUSH_LOCK']], 'UnusedSubsectionPagedPool' : [ 0x54, ['unsigned long']], 'UnusedSegmentForceFree' : [ 0x58, ['unsigned long']], 'DataSectionProtectionMask' : [ 0x5c, ['unsigned long']], 'HighSectionBase' : [ 0x60, ['pointer', ['void']]], 'PhysicalSubsection' : [ 0x64, ['_MSUBSECTION']], 'PhysicalControlArea' : [ 0xa8, ['_CONTROL_AREA']], 'PageFileSectionHead' : [ 0xf8, ['_RTL_AVL_TREE']], 'PageFileSectionListSpinLock' : [ 0xfc, ['long']], 'ImageBias' : [ 0x100, ['unsigned long']], 'RelocateBitmapsLock' : [ 0x104, ['_EX_PUSH_LOCK']], 'ImageBitMap' : [ 0x108, ['_RTL_BITMAP']], 'ApiSetSection' : [ 0x110, ['pointer', ['void']]], 'ApiSetSchema' : [ 0x114, ['pointer', ['void']]], 'ApiSetSchemaSize' : [ 0x118, ['unsigned long']], 'LostDataFiles' : [ 0x11c, ['unsigned long']], 'LostDataPages' : [ 0x120, ['unsigned long']], 'ImageFailureReason' : [ 0x124, ['unsigned long']], 'CfgBitMapSection32' : [ 0x128, ['pointer', ['_SECTION']]], 'CfgBitMapControlArea32' : [ 0x12c, ['pointer', ['_CONTROL_AREA']]], 'ImageCfgFailure' : [ 0x130, ['unsigned long']], 'ImageValidationFailed' : [ 0x134, ['long']], } ], '_MI_PARTITION_FLAGS' : [ 0x4, { 'BeingDeleted' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ObjectInitialized' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], } ], '__unnamed_238b' : [ 0xc, { 'Start' : [ 0x0, ['_LARGE_INTEGER']], 'Length' : [ 0x8, ['unsigned long']], } ], '__unnamed_238d' : [ 0xc, { 'Level' : [ 0x0, ['unsigned short']], 'Group' : [ 0x2, ['unsigned short']], 'Vector' : [ 0x4, ['unsigned long']], 'Affinity' : [ 0x8, ['unsigned long']], } ], '__unnamed_238f' : [ 0xc, { 'Group' : [ 0x0, ['unsigned short']], 'MessageCount' : [ 0x2, ['unsigned short']], 'Vector' : [ 0x4, ['unsigned long']], 'Affinity' : [ 0x8, ['unsigned long']], } ], '__unnamed_2391' : [ 0xc, { 'Raw' : [ 0x0, ['__unnamed_238f']], 'Translated' : [ 0x0, ['__unnamed_238d']], } ], '__unnamed_2393' : [ 0xc, { 'Channel' : [ 0x0, ['unsigned long']], 'Port' : [ 0x4, ['unsigned long']], 'Reserved1' : [ 0x8, ['unsigned long']], } ], '__unnamed_2395' : [ 0xc, { 'Channel' : [ 0x0, ['unsigned long']], 'RequestLine' : [ 0x4, ['unsigned long']], 'TransferWidth' : [ 0x8, ['unsigned char']], 'Reserved1' : [ 0x9, ['unsigned char']], 'Reserved2' : [ 0xa, ['unsigned char']], 'Reserved3' : [ 0xb, ['unsigned char']], } ], '__unnamed_2397' : [ 0xc, { 'Start' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], 'Reserved' : [ 0x8, ['unsigned long']], } ], '__unnamed_2399' : [ 0xc, { 'DataSize' : [ 0x0, ['unsigned long']], 'Reserved1' : [ 0x4, ['unsigned long']], 'Reserved2' : [ 0x8, ['unsigned long']], } ], '__unnamed_239b' : [ 0xc, { 'Start' : [ 0x0, ['_LARGE_INTEGER']], 'Length40' : [ 0x8, ['unsigned long']], } ], '__unnamed_239d' : [ 0xc, { 'Start' : [ 0x0, ['_LARGE_INTEGER']], 'Length48' : [ 0x8, ['unsigned long']], } ], '__unnamed_239f' : [ 0xc, { 'Start' : [ 0x0, ['_LARGE_INTEGER']], 'Length64' : [ 0x8, ['unsigned long']], } ], '__unnamed_23a1' : [ 0xc, { 'Generic' : [ 0x0, ['__unnamed_238b']], 'Port' : [ 0x0, ['__unnamed_238b']], 'Interrupt' : [ 0x0, ['__unnamed_238d']], 'MessageInterrupt' : [ 0x0, ['__unnamed_2391']], 'Memory' : [ 0x0, ['__unnamed_238b']], 'Dma' : [ 0x0, ['__unnamed_2393']], 'DmaV3' : [ 0x0, ['__unnamed_2395']], 'DevicePrivate' : [ 0x0, ['__unnamed_21a5']], 'BusNumber' : [ 0x0, ['__unnamed_2397']], 'DeviceSpecificData' : [ 0x0, ['__unnamed_2399']], 'Memory40' : [ 0x0, ['__unnamed_239b']], 'Memory48' : [ 0x0, ['__unnamed_239d']], 'Memory64' : [ 0x0, ['__unnamed_239f']], 'Connection' : [ 0x0, ['__unnamed_21b1']], } ], '_CM_PARTIAL_RESOURCE_DESCRIPTOR' : [ 0x10, { 'Type' : [ 0x0, ['unsigned char']], 'ShareDisposition' : [ 0x1, ['unsigned char']], 'Flags' : [ 0x2, ['unsigned short']], 'u' : [ 0x4, ['__unnamed_23a1']], } ], '_OBJECT_HEADER_PADDING_INFO' : [ 0x4, { 'PaddingAmount' : [ 0x0, ['unsigned long']], } ], '__unnamed_23a9' : [ 0x4, { 'PhysicalAddress' : [ 0x0, ['unsigned long']], 'VirtualSize' : [ 0x0, ['unsigned long']], } ], '_IMAGE_SECTION_HEADER' : [ 0x28, { 'Name' : [ 0x0, ['array', 8, ['unsigned char']]], 'Misc' : [ 0x8, ['__unnamed_23a9']], 'VirtualAddress' : [ 0xc, ['unsigned long']], 'SizeOfRawData' : [ 0x10, ['unsigned long']], 'PointerToRawData' : [ 0x14, ['unsigned long']], 'PointerToRelocations' : [ 0x18, ['unsigned long']], 'PointerToLinenumbers' : [ 0x1c, ['unsigned long']], 'NumberOfRelocations' : [ 0x20, ['unsigned short']], 'NumberOfLinenumbers' : [ 0x22, ['unsigned short']], 'Characteristics' : [ 0x24, ['unsigned long']], } ], '_UNLOADED_DRIVERS' : [ 0x18, { 'Name' : [ 0x0, ['_UNICODE_STRING']], 'StartAddress' : [ 0x8, ['pointer', ['void']]], 'EndAddress' : [ 0xc, ['pointer', ['void']]], 'CurrentTime' : [ 0x10, ['_LARGE_INTEGER']], } ], '_ARBITER_ADD_RESERVED_PARAMETERS' : [ 0x4, { 'ReserveDevice' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], } ], '_MM_PAGED_POOL_INFO' : [ 0x1c, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'PagedPoolAllocationMap' : [ 0x4, ['_RTL_BITMAP']], 'FirstPteForPagedPool' : [ 0xc, ['pointer', ['_MMPTE']]], 'MaximumSize' : [ 0x10, ['unsigned long']], 'PagedPoolHint' : [ 0x14, ['unsigned long']], 'AllocatedPagedPool' : [ 0x18, ['unsigned long']], } ], '__unnamed_23b7' : [ 0x50, { 'CellData' : [ 0x0, ['_CELL_DATA']], 'List' : [ 0x0, ['array', 1, ['unsigned long']]], } ], '_CM_CACHED_VALUE_INDEX' : [ 0x54, { 'CellIndex' : [ 0x0, ['unsigned long']], 'Data' : [ 0x4, ['__unnamed_23b7']], } ], '_PPM_COORDINATED_SELECTION' : [ 0x10, { 'MaximumStates' : [ 0x0, ['unsigned long']], 'SelectedStates' : [ 0x4, ['unsigned long']], 'DefaultSelection' : [ 0x8, ['unsigned long']], 'Selection' : [ 0xc, ['pointer', ['unsigned long']]], } ], '_DBGKD_QUERY_SPECIAL_CALLS' : [ 0x4, { 'NumberOfSpecialCalls' : [ 0x0, ['unsigned long']], } ], '_PAE_ENTRY' : [ 0x20, { 'PteEntry' : [ 0x0, ['array', 4, ['_MMPTE']]], 'PaeEntry' : [ 0x0, ['_PAE_PAGEINFO']], 'NextPae' : [ 0x0, ['_SINGLE_LIST_ENTRY']], } ], '_MI_PAGE_COMBINING_SUPPORT' : [ 0xd8, { 'Partition' : [ 0x0, ['pointer', ['_MI_PARTITION']]], 'ArbitraryPfnMapList' : [ 0x4, ['_LIST_ENTRY']], 'FreeCombinePoolItem' : [ 0xc, ['_MI_COMBINE_WORKITEM']], 'CombiningThreadCount' : [ 0x20, ['unsigned long']], 'CombinePageFreeList' : [ 0x24, ['_LIST_ENTRY']], 'CombineFreeListLock' : [ 0x2c, ['unsigned long']], 'CombinePageListHeads' : [ 0x30, ['array', 16, ['_MI_COMBINE_PAGE_LISTHEAD']]], 'PageCombineStats' : [ 0xb0, ['_MI_PAGE_COMBINE_STATISTICS']], } ], '_VF_AVL_TREE_NODE' : [ 0x8, { 'p' : [ 0x0, ['pointer', ['void']]], 'RangeSize' : [ 0x4, ['unsigned long']], } ], '_POP_FX_DEVICE' : [ 0x188, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'IrpData' : [ 0xc, ['pointer', ['_POP_IRP_DATA']]], 'Status' : [ 0x10, ['_POP_FX_DEVICE_STATUS']], 'PowerReqCall' : [ 0x14, ['long']], 'PowerNotReqCall' : [ 0x18, ['long']], 'DevNode' : [ 0x1c, ['pointer', ['_DEVICE_NODE']]], 'DpmContext' : [ 0x20, ['pointer', ['PEPHANDLE__']]], 'Plugin' : [ 0x24, ['pointer', ['_POP_FX_PLUGIN']]], 'PluginHandle' : [ 0x28, ['pointer', ['PEPHANDLE__']]], 'AcpiPlugin' : [ 0x2c, ['pointer', ['_POP_FX_PLUGIN']]], 'AcpiPluginHandle' : [ 0x30, ['pointer', ['PEPHANDLE__']]], 'DeviceObject' : [ 0x34, ['pointer', ['_DEVICE_OBJECT']]], 'TargetDevice' : [ 0x38, ['pointer', ['_DEVICE_OBJECT']]], 'Callbacks' : [ 0x3c, ['_POP_FX_DRIVER_CALLBACKS']], 'DriverContext' : [ 0x58, ['pointer', ['void']]], 'AcpiLink' : [ 0x5c, ['_LIST_ENTRY']], 'DeviceId' : [ 0x64, ['_UNICODE_STRING']], 'RemoveLock' : [ 0x6c, ['_IO_REMOVE_LOCK']], 'AcpiRemoveLock' : [ 0x84, ['_IO_REMOVE_LOCK']], 'WorkOrder' : [ 0x9c, ['_POP_FX_WORK_ORDER']], 'IdleLock' : [ 0xb8, ['unsigned long']], 'IdleTimer' : [ 0xc0, ['_KTIMER']], 'IdleDpc' : [ 0xe8, ['_KDPC']], 'IdleTimeout' : [ 0x108, ['unsigned long long']], 'IdleStamp' : [ 0x110, ['unsigned long long']], 'NextIrpDeviceObject' : [ 0x118, ['array', 2, ['pointer', ['_DEVICE_OBJECT']]]], 'NextIrpPowerState' : [ 0x120, ['array', 2, ['_POWER_STATE']]], 'NextIrpCallerCompletion' : [ 0x128, ['array', 2, ['pointer', ['void']]]], 'NextIrpCallerContext' : [ 0x130, ['array', 2, ['pointer', ['void']]]], 'IrpCompleteEvent' : [ 0x138, ['_KEVENT']], 'PowerOnDumpDeviceCallback' : [ 0x148, ['pointer', ['void']]], 'Accounting' : [ 0x150, ['_POP_FX_ACCOUNTING']], 'Flags' : [ 0x178, ['unsigned long']], 'ComponentCount' : [ 0x17c, ['unsigned long']], 'Components' : [ 0x180, ['pointer', ['pointer', ['_POP_FX_COMPONENT']]]], } ], '_PEP_ACPI_RESOURCE_FLAGS' : [ 0x4, { 'AsULong' : [ 0x0, ['unsigned long']], 'Shared' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Wake' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ResourceUsage' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'SlaveMode' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'AddressingMode' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'SharedMode' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_23e3' : [ 0x8, { 'IdleTime' : [ 0x0, ['unsigned long']], 'NonIdleTime' : [ 0x4, ['unsigned long']], } ], '__unnamed_23e5' : [ 0x8, { 'Disk' : [ 0x0, ['__unnamed_23e3']], } ], '_DEVICE_OBJECT_POWER_EXTENSION' : [ 0x44, { 'IdleCount' : [ 0x0, ['unsigned long']], 'BusyCount' : [ 0x4, ['unsigned long']], 'BusyReference' : [ 0x8, ['unsigned long']], 'TotalBusyCount' : [ 0xc, ['unsigned long']], 'ConservationIdleTime' : [ 0x10, ['unsigned long']], 'PerformanceIdleTime' : [ 0x14, ['unsigned long']], 'DeviceObject' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'IdleList' : [ 0x1c, ['_LIST_ENTRY']], 'IdleType' : [ 0x24, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceIdleNormal', 1: 'DeviceIdleDisk'})]], 'IdleState' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'CurrentState' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerDeviceUnspecified', 1: 'PowerDeviceD0', 2: 'PowerDeviceD1', 3: 'PowerDeviceD2', 4: 'PowerDeviceD3', 5: 'PowerDeviceMaximum'})]], 'CoolingExtension' : [ 0x30, ['pointer', ['_POP_COOLING_EXTENSION']]], 'Volume' : [ 0x34, ['_LIST_ENTRY']], 'Specific' : [ 0x3c, ['__unnamed_23e5']], } ], '_ARBITER_RETEST_ALLOCATION_PARAMETERS' : [ 0xc, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'AllocateFromCount' : [ 0x4, ['unsigned long']], 'AllocateFrom' : [ 0x8, ['pointer', ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '_PROCESSOR_NUMBER' : [ 0x4, { 'Group' : [ 0x0, ['unsigned short']], 'Number' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], } ], '_MI_COMBINE_STATE' : [ 0x18, { 'ActiveSpinLock' : [ 0x0, ['long']], 'CombiningThreadCount' : [ 0x4, ['unsigned long']], 'ActiveThreadTree' : [ 0x8, ['_RTL_AVL_TREE']], 'ZeroPageHashValue' : [ 0x10, ['unsigned long long']], } ], '_MMDEREFERENCE_SEGMENT_HEADER' : [ 0x1c, { 'Semaphore' : [ 0x0, ['_KSEMAPHORE']], 'ListHead' : [ 0x14, ['_LIST_ENTRY']], } ], '_MI_TRIAGE_DUMP_DATA' : [ 0x30, { 'BadPageCount' : [ 0x0, ['unsigned long']], 'BadPagesDetected' : [ 0x4, ['long']], 'ZeroedPageSingleBitErrorsDetected' : [ 0x8, ['long']], 'ScrubPasses' : [ 0xc, ['long']], 'ScrubBadPagesFound' : [ 0x10, ['long']], 'PageHashErrors' : [ 0x14, ['unsigned long']], 'FeatureBits' : [ 0x18, ['unsigned long long']], 'TimeZoneId' : [ 0x20, ['unsigned long']], 'ExceptionChainTerminator' : [ 0x24, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'ExceptionChainTerminatorRecord' : [ 0x28, ['_EXCEPTION_REGISTRATION_RECORD']], } ], '_WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS' : [ 0x1, { 'FRUId' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'FRUText' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], 'AsUCHAR' : [ 0x0, ['unsigned char']], } ], '_FS_FILTER_CALLBACKS' : [ 0x38, { 'SizeOfFsFilterCallbacks' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'PreAcquireForSectionSynchronization' : [ 0x8, ['pointer', ['void']]], 'PostAcquireForSectionSynchronization' : [ 0xc, ['pointer', ['void']]], 'PreReleaseForSectionSynchronization' : [ 0x10, ['pointer', ['void']]], 'PostReleaseForSectionSynchronization' : [ 0x14, ['pointer', ['void']]], 'PreAcquireForCcFlush' : [ 0x18, ['pointer', ['void']]], 'PostAcquireForCcFlush' : [ 0x1c, ['pointer', ['void']]], 'PreReleaseForCcFlush' : [ 0x20, ['pointer', ['void']]], 'PostReleaseForCcFlush' : [ 0x24, ['pointer', ['void']]], 'PreAcquireForModifiedPageWriter' : [ 0x28, ['pointer', ['void']]], 'PostAcquireForModifiedPageWriter' : [ 0x2c, ['pointer', ['void']]], 'PreReleaseForModifiedPageWriter' : [ 0x30, ['pointer', ['void']]], 'PostReleaseForModifiedPageWriter' : [ 0x34, ['pointer', ['void']]], } ], '_KENLISTMENT' : [ 0x168, { 'cookie' : [ 0x0, ['unsigned long']], 'NamespaceLink' : [ 0x4, ['_KTMOBJECT_NAMESPACE_LINK']], 'EnlistmentId' : [ 0x18, ['_GUID']], 'Mutex' : [ 0x28, ['_KMUTANT']], 'NextSameTx' : [ 0x48, ['_LIST_ENTRY']], 'NextSameRm' : [ 0x50, ['_LIST_ENTRY']], 'ResourceManager' : [ 0x58, ['pointer', ['_KRESOURCEMANAGER']]], 'Transaction' : [ 0x5c, ['pointer', ['_KTRANSACTION']]], 'State' : [ 0x60, ['Enumeration', dict(target = 'long', choices = {0: 'KEnlistmentUninitialized', 256: 'KEnlistmentActive', 258: 'KEnlistmentPrepared', 259: 'KEnlistmentInDoubt', 260: 'KEnlistmentCommitted', 261: 'KEnlistmentCommittedNotify', 262: 'KEnlistmentCommitRequested', 257: 'KEnlistmentPreparing', 264: 'KEnlistmentDelegated', 265: 'KEnlistmentDelegatedDisconnected', 266: 'KEnlistmentPrePreparing', 263: 'KEnlistmentAborted', 268: 'KEnlistmentRecovering', 269: 'KEnlistmentAborting', 270: 'KEnlistmentReadOnly', 271: 'KEnlistmentOutcomeUnavailable', 272: 'KEnlistmentOffline', 273: 'KEnlistmentPrePrepared', 274: 'KEnlistmentInitialized', 267: 'KEnlistmentForgotten'})]], 'Flags' : [ 0x64, ['unsigned long']], 'NotificationMask' : [ 0x68, ['unsigned long']], 'Key' : [ 0x6c, ['pointer', ['void']]], 'KeyRefCount' : [ 0x70, ['unsigned long']], 'RecoveryInformation' : [ 0x74, ['pointer', ['void']]], 'RecoveryInformationLength' : [ 0x78, ['unsigned long']], 'DynamicNameInformation' : [ 0x7c, ['pointer', ['void']]], 'DynamicNameInformationLength' : [ 0x80, ['unsigned long']], 'FinalNotification' : [ 0x84, ['pointer', ['_KTMNOTIFICATION_PACKET']]], 'SupSubEnlistment' : [ 0x88, ['pointer', ['_KENLISTMENT']]], 'SupSubEnlHandle' : [ 0x8c, ['pointer', ['void']]], 'SubordinateTxHandle' : [ 0x90, ['pointer', ['void']]], 'CrmEnlistmentEnId' : [ 0x94, ['_GUID']], 'CrmEnlistmentTmId' : [ 0xa4, ['_GUID']], 'CrmEnlistmentRmId' : [ 0xb4, ['_GUID']], 'NextHistory' : [ 0xc4, ['unsigned long']], 'History' : [ 0xc8, ['array', 20, ['_KENLISTMENT_HISTORY']]], } ], '_ARBITER_INTERFACE' : [ 0x18, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], 'ArbiterHandler' : [ 0x10, ['pointer', ['void']]], 'Flags' : [ 0x14, ['unsigned long']], } ], '_DELAY_ACK_FO' : [ 0xc, { 'Links' : [ 0x0, ['_LIST_ENTRY']], 'OriginalFileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], } ], '_IA64_DBGKD_CONTROL_SET' : [ 0x14, { 'Continue' : [ 0x0, ['unsigned long']], 'CurrentSymbolStart' : [ 0x4, ['unsigned long long']], 'CurrentSymbolEnd' : [ 0xc, ['unsigned long long']], } ], '_DEVICE_RELATIONS' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'Objects' : [ 0x4, ['array', 1, ['pointer', ['_DEVICE_OBJECT']]]], } ], '_IMAGE_ROM_OPTIONAL_HEADER' : [ 0x38, { 'Magic' : [ 0x0, ['unsigned short']], 'MajorLinkerVersion' : [ 0x2, ['unsigned char']], 'MinorLinkerVersion' : [ 0x3, ['unsigned char']], 'SizeOfCode' : [ 0x4, ['unsigned long']], 'SizeOfInitializedData' : [ 0x8, ['unsigned long']], 'SizeOfUninitializedData' : [ 0xc, ['unsigned long']], 'AddressOfEntryPoint' : [ 0x10, ['unsigned long']], 'BaseOfCode' : [ 0x14, ['unsigned long']], 'BaseOfData' : [ 0x18, ['unsigned long']], 'BaseOfBss' : [ 0x1c, ['unsigned long']], 'GprMask' : [ 0x20, ['unsigned long']], 'CprMask' : [ 0x24, ['array', 4, ['unsigned long']]], 'GpValue' : [ 0x34, ['unsigned long']], } ], '_MI_BAD_MEMORY_EVENT_ENTRY' : [ 0x28, { 'BugCheckCode' : [ 0x0, ['unsigned long']], 'Active' : [ 0x4, ['long']], 'Data' : [ 0x8, ['unsigned long']], 'PhysicalAddress' : [ 0x10, ['_LARGE_INTEGER']], 'WorkItem' : [ 0x18, ['_WORK_QUEUE_ITEM']], } ], '_ALPC_COMPLETION_LIST_HEADER' : [ 0x180, { 'StartMagic' : [ 0x0, ['unsigned long long']], 'TotalSize' : [ 0x8, ['unsigned long']], 'ListOffset' : [ 0xc, ['unsigned long']], 'ListSize' : [ 0x10, ['unsigned long']], 'BitmapOffset' : [ 0x14, ['unsigned long']], 'BitmapSize' : [ 0x18, ['unsigned long']], 'DataOffset' : [ 0x1c, ['unsigned long']], 'DataSize' : [ 0x20, ['unsigned long']], 'AttributeFlags' : [ 0x24, ['unsigned long']], 'AttributeSize' : [ 0x28, ['unsigned long']], 'State' : [ 0x40, ['_ALPC_COMPLETION_LIST_STATE']], 'LastMessageId' : [ 0x48, ['unsigned long']], 'LastCallbackId' : [ 0x4c, ['unsigned long']], 'PostCount' : [ 0x80, ['unsigned long']], 'ReturnCount' : [ 0xc0, ['unsigned long']], 'LogSequenceNumber' : [ 0x100, ['unsigned long']], 'UserLock' : [ 0x140, ['_RTL_SRWLOCK']], 'EndMagic' : [ 0x148, ['unsigned long long']], } ], '_IMAGE_DEBUG_DIRECTORY' : [ 0x1c, { 'Characteristics' : [ 0x0, ['unsigned long']], 'TimeDateStamp' : [ 0x4, ['unsigned long']], 'MajorVersion' : [ 0x8, ['unsigned short']], 'MinorVersion' : [ 0xa, ['unsigned short']], 'Type' : [ 0xc, ['unsigned long']], 'SizeOfData' : [ 0x10, ['unsigned long']], 'AddressOfRawData' : [ 0x14, ['unsigned long']], 'PointerToRawData' : [ 0x18, ['unsigned long']], } ], '_WHEA_AER_ENDPOINT_DESCRIPTOR' : [ 0x20, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], 'BusNumber' : [ 0x4, ['unsigned long']], 'Slot' : [ 0x8, ['_WHEA_PCI_SLOT_NUMBER']], 'DeviceControl' : [ 0xc, ['unsigned short']], 'Flags' : [ 0xe, ['_AER_ENDPOINT_DESCRIPTOR_FLAGS']], 'UncorrectableErrorMask' : [ 0x10, ['unsigned long']], 'UncorrectableErrorSeverity' : [ 0x14, ['unsigned long']], 'CorrectableErrorMask' : [ 0x18, ['unsigned long']], 'AdvancedCapsAndControl' : [ 0x1c, ['unsigned long']], } ], '_MI_SYSTEM_TRIM_STATE' : [ 0x40, { 'ExpansionLock' : [ 0x0, ['unsigned long']], 'TrimInProgressCount' : [ 0x4, ['long']], 'PeriodicWorkingSetEvent' : [ 0x8, ['_KEVENT']], 'TrimAllPageFaultCount' : [ 0x18, ['array', 3, ['unsigned long']]], } ], '_ETW_WMITRACE_WORK' : [ 0xf0, { 'LoggerId' : [ 0x0, ['unsigned long']], 'SpareUlong' : [ 0x4, ['unsigned long']], 'LoggerName' : [ 0x8, ['array', 65, ['unsigned char']]], 'FileName' : [ 0x49, ['array', 129, ['unsigned char']]], 'MaximumFileSize' : [ 0xcc, ['unsigned long']], 'MinBuffers' : [ 0xd0, ['unsigned long']], 'MaxBuffers' : [ 0xd4, ['unsigned long']], 'BufferSize' : [ 0xd8, ['unsigned long']], 'Mode' : [ 0xdc, ['unsigned long']], 'FlushTimer' : [ 0xe0, ['unsigned long']], 'MatchAny' : [ 0x8, ['unsigned long long']], 'MatchAll' : [ 0x10, ['unsigned long long']], 'EnableProperty' : [ 0x18, ['unsigned long']], 'Guid' : [ 0x1c, ['_GUID']], 'Level' : [ 0x2c, ['unsigned char']], 'Status' : [ 0xe8, ['long']], } ], '_MI_ZERO_COST_COUNTS' : [ 0x10, { 'NativeSum' : [ 0x0, ['unsigned long long']], 'CachedSum' : [ 0x8, ['unsigned long long']], } ], '_CHILD_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'List' : [ 0x4, ['unsigned long']], } ], '_MI_PARTITION_STATISTICS' : [ 0x50, { 'DeleteYield' : [ 0x0, ['unsigned long']], 'DeleteBad' : [ 0x4, ['unsigned long']], 'DeleteTrulyBad' : [ 0x8, ['unsigned long']], 'DeleteLargePage' : [ 0xc, ['unsigned long']], 'DeleteLargePageRetry' : [ 0x10, ['unsigned long']], 'DeleteZeroFree' : [ 0x14, ['unsigned long']], 'DeleteTransition' : [ 0x18, ['unsigned long']], 'DeleteStandbyReferenced' : [ 0x1c, ['unsigned long']], 'DeleteStandbyRelinkFailed' : [ 0x20, ['unsigned long']], 'DeleteStandbySharedPagefile' : [ 0x24, ['unsigned long']], 'DeleteStandbySharedFile' : [ 0x28, ['unsigned long']], 'DeleteModifiedReferenced' : [ 0x2c, ['unsigned long']], 'DeleteModified' : [ 0x30, ['unsigned long']], 'DeleteModifiedNoWrite' : [ 0x34, ['unsigned long']], 'DeleteModifiedSharedPagefile' : [ 0x38, ['unsigned long']], 'DeleteModifiedSharedFile' : [ 0x3c, ['unsigned long']], 'DeleteActiveSharedPagefile1' : [ 0x40, ['unsigned long']], 'DeleteActiveSharedPagefile2' : [ 0x44, ['unsigned long']], 'DeleteActiveSharedFile' : [ 0x48, ['unsigned long']], 'DeleteWriteDelay' : [ 0x4c, ['unsigned long']], } ], '_IO_RESOURCE_LIST' : [ 0x28, { 'Version' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'Count' : [ 0x4, ['unsigned long']], 'Descriptors' : [ 0x8, ['array', 1, ['_IO_RESOURCE_DESCRIPTOR']]], } ], '_ARMCE_DBGKD_CONTROL_SET' : [ 0xc, { 'Continue' : [ 0x0, ['unsigned long']], 'CurrentSymbolStart' : [ 0x4, ['unsigned long']], 'CurrentSymbolEnd' : [ 0x8, ['unsigned long']], } ], '_MI_RESAVAIL_TRACKER' : [ 0x200, { 'AllocateKernelStack' : [ 0x0, ['unsigned long']], 'AllocateGrowKernelStack' : [ 0x4, ['unsigned long']], 'FreeKernelStack' : [ 0x8, ['unsigned long']], 'FreeKernelStackError' : [ 0xc, ['unsigned long']], 'FreeGrowKernelStackError' : [ 0x10, ['unsigned long']], 'AllocateCreateProcess' : [ 0x14, ['unsigned long']], 'FreeCreateProcessError' : [ 0x18, ['unsigned long']], 'FreeDeleteProcess' : [ 0x1c, ['unsigned long']], 'FreeCleanProcess' : [ 0x20, ['unsigned long']], 'FreeCleanProcessError' : [ 0x24, ['unsigned long']], 'AllocateAddProcessWsMetaPage' : [ 0x28, ['unsigned long']], 'AllocateWsIncrease' : [ 0x2c, ['unsigned long']], 'FreeWsIncreaseError' : [ 0x30, ['unsigned long']], 'FreeWsIncreaseErrorMax' : [ 0x34, ['unsigned long']], 'FreeWsDecrease' : [ 0x38, ['unsigned long']], 'AllocateWorkingSetPage' : [ 0x3c, ['unsigned long']], 'FreeWorkingSetPageError' : [ 0x40, ['unsigned long']], 'FreeDeletePteRange' : [ 0x44, ['unsigned long']], 'AllocatePageTablesForProcessMetadata' : [ 0x48, ['unsigned long']], 'FreePageTablesForProcessMetadataError2' : [ 0x4c, ['unsigned long']], 'AllocatePageTablesForSystem' : [ 0x50, ['unsigned long']], 'FreePageTablesExcess' : [ 0x54, ['unsigned long']], 'FreeSystemVaPageTables' : [ 0x58, ['unsigned long']], 'FreeSessionVaPageTables' : [ 0x5c, ['unsigned long']], 'AllocateCreateSession' : [ 0x60, ['unsigned long']], 'FreeSessionWsDereference' : [ 0x64, ['unsigned long']], 'FreeSessionDereference' : [ 0x68, ['unsigned long']], 'AllocateLockedSessionImage' : [ 0x6c, ['unsigned long']], 'FreeLockedSessionImage' : [ 0x70, ['unsigned long']], 'FreeSessionImageConversion' : [ 0x74, ['unsigned long']], 'AllocateWsAdjustPageTable' : [ 0x78, ['unsigned long']], 'FreeWsAdjustPageTable' : [ 0x7c, ['unsigned long']], 'FreeWsAdjustPageTableError' : [ 0x80, ['unsigned long']], 'AllocateNoLowMemory' : [ 0x84, ['unsigned long']], 'AllocatePagedPoolLockedDown' : [ 0x88, ['unsigned long']], 'FreePagedPoolLockedDown' : [ 0x8c, ['unsigned long']], 'AllocateSystemBitmaps' : [ 0x90, ['unsigned long']], 'FreeSystemBitmapsError' : [ 0x94, ['unsigned long']], 'AllocateForMdl' : [ 0x98, ['unsigned long']], 'FreeFromMdl' : [ 0x9c, ['unsigned long']], 'AllocateForMdlPartition' : [ 0xa0, ['unsigned long']], 'FreeFromMdlPartition' : [ 0xa4, ['unsigned long']], 'FreeMdlExcess' : [ 0xa8, ['unsigned long']], 'AllocateExpansionNonPagedPool' : [ 0xac, ['unsigned long']], 'FreeExpansionNonPagedPool' : [ 0xb0, ['unsigned long']], 'AllocateVad' : [ 0xb4, ['unsigned long']], 'RemoveVad' : [ 0xb8, ['unsigned long']], 'FreeVad' : [ 0xbc, ['unsigned long']], 'AllocateContiguous' : [ 0xc0, ['unsigned long']], 'FreeContiguousPages' : [ 0xc4, ['unsigned long']], 'FreeContiguousError' : [ 0xc8, ['unsigned long']], 'FreeLargePageMemory' : [ 0xcc, ['unsigned long']], 'AllocateSystemWsles' : [ 0xd0, ['unsigned long']], 'FreeSystemWsles' : [ 0xd4, ['unsigned long']], 'AllocateSystemInitWs' : [ 0xd8, ['unsigned long']], 'AllocateSessionInitWs' : [ 0xdc, ['unsigned long']], 'FreeSessionInitWsError' : [ 0xe0, ['unsigned long']], 'AllocateSystemImage' : [ 0xe4, ['unsigned long']], 'AllocateSystemImageLoad' : [ 0xe8, ['unsigned long']], 'AllocateSessionSharedImage' : [ 0xec, ['unsigned long']], 'FreeSystemImageInitCode' : [ 0xf0, ['unsigned long']], 'FreeSystemImageLargePageConversion' : [ 0xf4, ['unsigned long']], 'FreeSystemImageError' : [ 0xf8, ['unsigned long']], 'FreeSystemImageLoadExcess' : [ 0xfc, ['unsigned long']], 'FreeUnloadSystemImage' : [ 0x100, ['unsigned long']], 'FreeReloadBootImageLarge' : [ 0x104, ['unsigned long']], 'FreeIndependent' : [ 0x108, ['unsigned long']], 'AllocateHotAdd' : [ 0x10c, ['unsigned long']], 'AllocateHotRemove' : [ 0x110, ['unsigned long']], 'FreeHotAdd' : [ 0x114, ['unsigned long']], 'FreeHotAddEcc' : [ 0x118, ['unsigned long']], 'FreeHotAddError' : [ 0x11c, ['unsigned long']], 'FreeHotAddUnmap' : [ 0x120, ['unsigned long']], 'AllocateBoot' : [ 0x124, ['unsigned long']], 'FreeLoaderBlock' : [ 0x128, ['unsigned long']], 'AllocateNonPagedSpecialPool' : [ 0x12c, ['unsigned long']], 'FreeNonPagedSpecialPoolError' : [ 0x130, ['unsigned long']], 'FreeNonPagedSpecialPool' : [ 0x134, ['unsigned long']], 'AllocateSharedSegmentPage' : [ 0x138, ['unsigned long']], 'FreeSharedSegmentPage' : [ 0x13c, ['unsigned long']], 'AllocateZeroPage' : [ 0x140, ['unsigned long']], 'FreeZeroPage' : [ 0x144, ['unsigned long']], 'AllocateForPo' : [ 0x148, ['unsigned long']], 'AllocateForPoForce' : [ 0x14c, ['unsigned long']], 'FreeForPo' : [ 0x150, ['unsigned long']], 'AllocateThreadHardFaultBehavior' : [ 0x154, ['unsigned long']], 'FreeThreadHardFaultBehavior' : [ 0x158, ['unsigned long']], 'ObtainFaultCharges' : [ 0x15c, ['unsigned long']], 'FreeFaultCharges' : [ 0x160, ['unsigned long']], 'AllocateStoreCharges' : [ 0x164, ['unsigned long']], 'FreeStoreCharges' : [ 0x168, ['unsigned long']], 'ObtainLockedPageCharge' : [ 0x180, ['unsigned long']], 'FreeLockedPageCharge' : [ 0x1c0, ['unsigned long']], 'AllocateStore' : [ 0x1c4, ['unsigned long']], 'FreeStore' : [ 0x1c8, ['unsigned long']], 'AllocateSystemImageProtos' : [ 0x1cc, ['unsigned long']], 'FreeSystemImageProtos' : [ 0x1d0, ['unsigned long']], 'AllocateModWriterCharge' : [ 0x1d4, ['unsigned long']], 'FreeModWriterCharge' : [ 0x1d8, ['unsigned long']], 'AllocateMappedWriterCharge' : [ 0x1dc, ['unsigned long']], 'FreeMappedWriterCharge' : [ 0x1e0, ['unsigned long']], 'AllocateRegistryCharges' : [ 0x1e4, ['unsigned long']], 'FreeRegistryCharges' : [ 0x1e8, ['unsigned long']], } ], '_WHEA_ERROR_RECORD_HEADER_FLAGS' : [ 0x4, { 'Recovered' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PreviousError' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Simulated' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_XSAVE_AREA_HEADER' : [ 0x40, { 'Mask' : [ 0x0, ['unsigned long long']], 'CompactionMask' : [ 0x8, ['unsigned long long']], 'Reserved2' : [ 0x10, ['array', 6, ['unsigned long long']]], } ], '_RTL_CRITICAL_SECTION' : [ 0x18, { 'DebugInfo' : [ 0x0, ['pointer', ['_RTL_CRITICAL_SECTION_DEBUG']]], 'LockCount' : [ 0x4, ['long']], 'RecursionCount' : [ 0x8, ['long']], 'OwningThread' : [ 0xc, ['pointer', ['void']]], 'LockSemaphore' : [ 0x10, ['pointer', ['void']]], 'SpinCount' : [ 0x14, ['unsigned long']], } ], '_PNP_DEVICE_COMPLETION_REQUEST' : [ 0x24, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'DeviceNode' : [ 0x8, ['pointer', ['_DEVICE_NODE']]], 'Context' : [ 0xc, ['pointer', ['void']]], 'CompletionState' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {768: 'DeviceNodeUnspecified', 769: 'DeviceNodeUninitialized', 770: 'DeviceNodeInitialized', 771: 'DeviceNodeDriversAdded', 772: 'DeviceNodeResourcesAssigned', 773: 'DeviceNodeStartPending', 774: 'DeviceNodeStartCompletion', 775: 'DeviceNodeStartPostWork', 776: 'DeviceNodeStarted', 777: 'DeviceNodeQueryStopped', 778: 'DeviceNodeStopped', 779: 'DeviceNodeRestartCompletion', 780: 'DeviceNodeEnumeratePending', 781: 'DeviceNodeEnumerateCompletion', 782: 'DeviceNodeAwaitingQueuedDeletion', 783: 'DeviceNodeAwaitingQueuedRemoval', 784: 'DeviceNodeQueryRemoved', 785: 'DeviceNodeRemovePendingCloses', 786: 'DeviceNodeRemoved', 787: 'DeviceNodeDeletePendingCloses', 788: 'DeviceNodeDeleted', 789: 'MaxDeviceNodeState'})]], 'IrpPended' : [ 0x14, ['unsigned long']], 'Status' : [ 0x18, ['long']], 'Information' : [ 0x1c, ['pointer', ['void']]], 'ReferenceCount' : [ 0x20, ['long']], } ], '_MI_COMBINE_PAGE_LISTHEAD' : [ 0x8, { 'Table' : [ 0x0, ['_RTL_AVL_TREE']], 'Lock' : [ 0x4, ['long']], } ], '_PHYSICAL_MEMORY_DESCRIPTOR' : [ 0x10, { 'NumberOfRuns' : [ 0x0, ['unsigned long']], 'NumberOfPages' : [ 0x4, ['unsigned long']], 'Run' : [ 0x8, ['array', 1, ['_PHYSICAL_MEMORY_RUN']]], } ], '__unnamed_2459' : [ 0x8, { 'Start' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], } ], '__unnamed_245b' : [ 0x8, { 'RangeCount' : [ 0x0, ['unsigned long']], 'SetBitCount' : [ 0x4, ['unsigned long']], } ], '__unnamed_245d' : [ 0x8, { 'Context1' : [ 0x0, ['unsigned long']], 'Context2' : [ 0x4, ['unsigned long']], } ], '__unnamed_245f' : [ 0x8, { 'DirtyVectorModifiedContext' : [ 0x0, ['__unnamed_2459']], 'DirtyDataCaptureContext' : [ 0x0, ['__unnamed_245b']], 'Raw' : [ 0x0, ['__unnamed_245d']], } ], '_CM_DIRTY_VECTOR_LOG_ENTRY' : [ 0x28, { 'Thread' : [ 0x0, ['pointer', ['_ETHREAD']]], 'Operation' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'DirtyVectorModified', 1: 'DirtyDataCaptureStart', 2: 'DirtyDataCaptureEnd'})]], 'Data' : [ 0x8, ['__unnamed_245f']], 'Stack' : [ 0x10, ['array', 6, ['pointer', ['void']]]], } ], '_KTRAP_FRAME' : [ 0x8c, { 'DbgEbp' : [ 0x0, ['unsigned long']], 'DbgEip' : [ 0x4, ['unsigned long']], 'DbgArgMark' : [ 0x8, ['unsigned long']], 'TempSegCs' : [ 0xc, ['unsigned short']], 'Logging' : [ 0xe, ['unsigned char']], 'FrameType' : [ 0xf, ['unsigned char']], 'TempEsp' : [ 0x10, ['unsigned long']], 'Dr0' : [ 0x14, ['unsigned long']], 'Dr1' : [ 0x18, ['unsigned long']], 'Dr2' : [ 0x1c, ['unsigned long']], 'Dr3' : [ 0x20, ['unsigned long']], 'Dr6' : [ 0x24, ['unsigned long']], 'Dr7' : [ 0x28, ['unsigned long']], 'SegGs' : [ 0x2c, ['unsigned long']], 'SegEs' : [ 0x30, ['unsigned long']], 'SegDs' : [ 0x34, ['unsigned long']], 'Edx' : [ 0x38, ['unsigned long']], 'Ecx' : [ 0x3c, ['unsigned long']], 'Eax' : [ 0x40, ['unsigned long']], 'PreviousPreviousMode' : [ 0x44, ['unsigned char']], 'EntropyQueueDpc' : [ 0x45, ['unsigned char']], 'Reserved' : [ 0x46, ['array', 2, ['unsigned char']]], 'MxCsr' : [ 0x48, ['unsigned long']], 'ExceptionList' : [ 0x4c, ['pointer', ['_EXCEPTION_REGISTRATION_RECORD']]], 'SegFs' : [ 0x50, ['unsigned long']], 'Edi' : [ 0x54, ['unsigned long']], 'Esi' : [ 0x58, ['unsigned long']], 'Ebx' : [ 0x5c, ['unsigned long']], 'Ebp' : [ 0x60, ['unsigned long']], 'ErrCode' : [ 0x64, ['unsigned long']], 'Eip' : [ 0x68, ['unsigned long']], 'SegCs' : [ 0x6c, ['unsigned long']], 'EFlags' : [ 0x70, ['unsigned long']], 'HardwareEsp' : [ 0x74, ['unsigned long']], 'HardwareSegSs' : [ 0x78, ['unsigned long']], 'V86Es' : [ 0x7c, ['unsigned long']], 'V86Ds' : [ 0x80, ['unsigned long']], 'V86Fs' : [ 0x84, ['unsigned long']], 'V86Gs' : [ 0x88, ['unsigned long']], } ], '_MI_SYSTEM_NODE_INFORMATION' : [ 0xb0, { 'PagedPoolSListHead' : [ 0x0, ['_SLIST_HEADER']], 'NonPagedPoolSListHead' : [ 0x8, ['array', 3, ['_SLIST_HEADER']]], 'NonPagedPoolSListHeadNx' : [ 0x20, ['array', 3, ['_SLIST_HEADER']]], 'CachedKernelStacks' : [ 0x38, ['array', 2, ['_CACHED_KSTACK_LIST']]], 'NonPagedPoolLowestPage' : [ 0x68, ['unsigned long']], 'NonPagedPoolHighestPage' : [ 0x6c, ['unsigned long']], 'AllocatedNonPagedPool' : [ 0x70, ['unsigned long']], 'PartialLargePoolRegions' : [ 0x74, ['unsigned long']], 'PagesInPartialLargePoolRegions' : [ 0x78, ['unsigned long']], 'CachedNonPagedPoolCount' : [ 0x7c, ['unsigned long']], 'NonPagedPoolSpinLock' : [ 0x80, ['unsigned long']], 'CachedNonPagedPool' : [ 0x84, ['pointer', ['_MMPFN']]], 'NonPagedPoolFirstVa' : [ 0x88, ['pointer', ['void']]], 'NonPagedPoolLastVa' : [ 0x8c, ['pointer', ['void']]], 'NonPagedBitMap' : [ 0x90, ['array', 3, ['_RTL_BITMAP']]], 'NonPagedHint' : [ 0xa8, ['array', 2, ['unsigned long']]], } ], '_KLOCK_ENTRY_LOCK_STATE' : [ 0x8, { 'CrossThreadReleasable' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Busy' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 31, native_type='unsigned long')]], 'InTree' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'LockState' : [ 0x0, ['pointer', ['void']]], 'SessionState' : [ 0x4, ['pointer', ['void']]], 'SessionId' : [ 0x4, ['unsigned long']], } ], '__unnamed_2471' : [ 0x4, { 'FlushCompleting' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='long')]], 'FlushInProgress' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='long')]], 'Long' : [ 0x0, ['long']], } ], '_MI_PARTITION_STORES' : [ 0x50, { 'WriteAllStoreHintedPages' : [ 0x0, ['__unnamed_2471']], 'VirtualPageFileNumber' : [ 0x4, ['unsigned long']], 'Registered' : [ 0x8, ['unsigned long']], 'ReadClusterSizeMax' : [ 0xc, ['unsigned long']], 'EvictFlushRequestCount' : [ 0x10, ['unsigned long']], 'ModifiedWriteDisableCount' : [ 0x14, ['unsigned long']], 'WriteIssueFailures' : [ 0x18, ['unsigned long']], 'EvictionThread' : [ 0x1c, ['pointer', ['_ETHREAD']]], 'EvictEvent' : [ 0x20, ['_KEVENT']], 'EvictFlushCompleteEvent' : [ 0x30, ['_KEVENT']], 'WriteSupportSListHead' : [ 0x40, ['_SLIST_HEADER']], 'EvictFlushLock' : [ 0x48, ['long']], 'ModifiedWriteFailedBitmap' : [ 0x4c, ['pointer', ['_RTL_BITMAP']]], } ], '_EVENT_FILTER_HEADER' : [ 0x18, { 'Id' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['array', 5, ['unsigned char']]], 'InstanceId' : [ 0x8, ['unsigned long long']], 'Size' : [ 0x10, ['unsigned long']], 'NextOffset' : [ 0x14, ['unsigned long']], } ], '_WAIT_CONTEXT_BLOCK' : [ 0x28, { 'WaitQueueEntry' : [ 0x0, ['_KDEVICE_QUEUE_ENTRY']], 'DmaWaitEntry' : [ 0x0, ['_LIST_ENTRY']], 'NumberOfChannels' : [ 0x8, ['unsigned long']], 'SyncCallback' : [ 0xc, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DmaContext' : [ 0xc, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reserved' : [ 0xc, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'DeviceRoutine' : [ 0x10, ['pointer', ['void']]], 'DeviceContext' : [ 0x14, ['pointer', ['void']]], 'NumberOfMapRegisters' : [ 0x18, ['unsigned long']], 'DeviceObject' : [ 0x1c, ['pointer', ['void']]], 'CurrentIrp' : [ 0x20, ['pointer', ['void']]], 'BufferChainingDpc' : [ 0x24, ['pointer', ['_KDPC']]], } ], '_SECTION_OBJECT' : [ 0x18, { 'StartingVa' : [ 0x0, ['pointer', ['void']]], 'EndingVa' : [ 0x4, ['pointer', ['void']]], 'Parent' : [ 0x8, ['pointer', ['void']]], 'LeftChild' : [ 0xc, ['pointer', ['void']]], 'RightChild' : [ 0x10, ['pointer', ['void']]], 'Segment' : [ 0x14, ['pointer', ['_SEGMENT_OBJECT']]], } ], '_CM_NAME_CONTROL_BLOCK' : [ 0x10, { 'Compressed' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'RefCount' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], 'NameHash' : [ 0x4, ['_CM_NAME_HASH']], 'ConvKey' : [ 0x4, ['unsigned long']], 'NextHash' : [ 0x8, ['pointer', ['_CM_KEY_HASH']]], 'NameLength' : [ 0xc, ['unsigned short']], 'Name' : [ 0xe, ['array', 1, ['wchar']]], } ], '_u' : [ 0x50, { 'KeyNode' : [ 0x0, ['_CM_KEY_NODE']], 'KeyValue' : [ 0x0, ['_CM_KEY_VALUE']], 'KeySecurity' : [ 0x0, ['_CM_KEY_SECURITY']], 'KeyIndex' : [ 0x0, ['_CM_KEY_INDEX']], 'ValueData' : [ 0x0, ['_CM_BIG_DATA']], 'KeyList' : [ 0x0, ['array', 1, ['unsigned long']]], 'KeyString' : [ 0x0, ['array', 1, ['wchar']]], } ], '_HBASE_BLOCK' : [ 0x1000, { 'Signature' : [ 0x0, ['unsigned long']], 'Sequence1' : [ 0x4, ['unsigned long']], 'Sequence2' : [ 0x8, ['unsigned long']], 'TimeStamp' : [ 0xc, ['_LARGE_INTEGER']], 'Major' : [ 0x14, ['unsigned long']], 'Minor' : [ 0x18, ['unsigned long']], 'Type' : [ 0x1c, ['unsigned long']], 'Format' : [ 0x20, ['unsigned long']], 'RootCell' : [ 0x24, ['unsigned long']], 'Length' : [ 0x28, ['unsigned long']], 'Cluster' : [ 0x2c, ['unsigned long']], 'FileName' : [ 0x30, ['array', 64, ['unsigned char']]], 'RmId' : [ 0x70, ['_GUID']], 'LogId' : [ 0x80, ['_GUID']], 'Flags' : [ 0x90, ['unsigned long']], 'TmId' : [ 0x94, ['_GUID']], 'GuidSignature' : [ 0xa4, ['unsigned long']], 'LastReorganizeTime' : [ 0xa8, ['unsigned long long']], 'Reserved1' : [ 0xb0, ['array', 83, ['unsigned long']]], 'CheckSum' : [ 0x1fc, ['unsigned long']], 'Reserved2' : [ 0x200, ['array', 882, ['unsigned long']]], 'ThawTmId' : [ 0xfc8, ['_GUID']], 'ThawRmId' : [ 0xfd8, ['_GUID']], 'ThawLogId' : [ 0xfe8, ['_GUID']], 'BootType' : [ 0xff8, ['unsigned long']], 'BootRecover' : [ 0xffc, ['unsigned long']], } ], '_GENERAL_LOOKASIDE_POOL' : [ 0x48, { 'ListHead' : [ 0x0, ['_SLIST_HEADER']], 'SingleListHead' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Depth' : [ 0x8, ['unsigned short']], 'MaximumDepth' : [ 0xa, ['unsigned short']], 'TotalAllocates' : [ 0xc, ['unsigned long']], 'AllocateMisses' : [ 0x10, ['unsigned long']], 'AllocateHits' : [ 0x10, ['unsigned long']], 'TotalFrees' : [ 0x14, ['unsigned long']], 'FreeMisses' : [ 0x18, ['unsigned long']], 'FreeHits' : [ 0x18, ['unsigned long']], 'Type' : [ 0x1c, ['Enumeration', dict(target = 'long', choices = {0: 'NonPagedPoolBase', 1: 'PagedPool', 2: 'NonPagedPoolBaseMustSucceed', 3: 'DontUseThisType', 4: 'NonPagedPoolBaseCacheAligned', 5: 'PagedPoolCacheAligned', 6: 'NonPagedPoolBaseCacheAlignedMustS', 7: 'MaxPoolType', 34: 'NonPagedPoolMustSucceedSession', 516: 'NonPagedPoolNxCacheAligned', 35: 'DontUseThisTypeSession', 32: 'NonPagedPoolSession', 512: 'NonPagedPoolNx', 544: 'NonPagedPoolSessionNx', 36: 'NonPagedPoolCacheAlignedSession', 33: 'PagedPoolSession', 38: 'NonPagedPoolCacheAlignedMustSSession', 37: 'PagedPoolCacheAlignedSession'})]], 'Tag' : [ 0x20, ['unsigned long']], 'Size' : [ 0x24, ['unsigned long']], 'AllocateEx' : [ 0x28, ['pointer', ['void']]], 'Allocate' : [ 0x28, ['pointer', ['void']]], 'FreeEx' : [ 0x2c, ['pointer', ['void']]], 'Free' : [ 0x2c, ['pointer', ['void']]], 'ListEntry' : [ 0x30, ['_LIST_ENTRY']], 'LastTotalAllocates' : [ 0x38, ['unsigned long']], 'LastAllocateMisses' : [ 0x3c, ['unsigned long']], 'LastAllocateHits' : [ 0x3c, ['unsigned long']], 'Future' : [ 0x40, ['array', 2, ['unsigned long']]], } ], '_RTL_DYNAMIC_HASH_TABLE_ENTRY' : [ 0xc, { 'Linkage' : [ 0x0, ['_LIST_ENTRY']], 'Signature' : [ 0x8, ['unsigned long']], } ], '_ETW_LAST_ENABLE_INFO' : [ 0x10, { 'EnableFlags' : [ 0x0, ['_LARGE_INTEGER']], 'LoggerId' : [ 0x8, ['unsigned short']], 'Level' : [ 0xa, ['unsigned char']], 'Enabled' : [ 0xb, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'InternalFlag' : [ 0xb, ['BitField', dict(start_bit = 1, end_bit = 8, native_type='unsigned char')]], } ], '_M128A' : [ 0x10, { 'Low' : [ 0x0, ['unsigned long long']], 'High' : [ 0x8, ['long long']], } ], '_HEAP_LOOKASIDE' : [ 0x30, { 'ListHead' : [ 0x0, ['_SLIST_HEADER']], 'Depth' : [ 0x8, ['unsigned short']], 'MaximumDepth' : [ 0xa, ['unsigned short']], 'TotalAllocates' : [ 0xc, ['unsigned long']], 'AllocateMisses' : [ 0x10, ['unsigned long']], 'TotalFrees' : [ 0x14, ['unsigned long']], 'FreeMisses' : [ 0x18, ['unsigned long']], 'LastTotalAllocates' : [ 0x1c, ['unsigned long']], 'LastAllocateMisses' : [ 0x20, ['unsigned long']], 'Counters' : [ 0x24, ['array', 2, ['unsigned long']]], } ], '_KTIMER' : [ 0x28, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'DueTime' : [ 0x10, ['_ULARGE_INTEGER']], 'TimerListEntry' : [ 0x18, ['_LIST_ENTRY']], 'Dpc' : [ 0x20, ['pointer', ['_KDPC']]], 'Period' : [ 0x24, ['unsigned long']], } ], '_RTL_ATOM_TABLE' : [ 0x1c, { 'Signature' : [ 0x0, ['unsigned long']], 'ReferenceCount' : [ 0x4, ['long']], 'PushLock' : [ 0x8, ['_EX_PUSH_LOCK']], 'ExHandleTable' : [ 0xc, ['pointer', ['_HANDLE_TABLE']]], 'Flags' : [ 0x10, ['unsigned long']], 'NumberOfBuckets' : [ 0x14, ['unsigned long']], 'Buckets' : [ 0x18, ['array', 1, ['pointer', ['_RTL_ATOM_TABLE_ENTRY']]]], } ], '__unnamed_24ad' : [ 0x18, { 'RequestedTime' : [ 0x0, ['unsigned long long']], 'ProgrammedTime' : [ 0x8, ['unsigned long long']], 'TimerInfo' : [ 0x10, ['pointer', ['_DIAGNOSTIC_BUFFER']]], } ], '_POP_POWER_ACTION' : [ 0x100, { 'Updates' : [ 0x0, ['unsigned char']], 'State' : [ 0x1, ['unsigned char']], 'Shutdown' : [ 0x2, ['unsigned char']], 'Action' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject', 8: 'PowerActionDisplayOff'})]], 'LightestState' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'Flags' : [ 0xc, ['unsigned long']], 'Status' : [ 0x10, ['long']], 'DeviceType' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'PolicyDeviceSystemButton', 1: 'PolicyDeviceThermalZone', 2: 'PolicyDeviceBattery', 3: 'PolicyDeviceMemory', 4: 'PolicyInitiatePowerActionAPI', 5: 'PolicySetPowerStateAPI', 6: 'PolicyImmediateDozeS4', 7: 'PolicySystemIdle', 8: 'PolicyDeviceWakeAlarm', 9: 'PolicyDeviceFan', 10: 'PolicyCsBatterySaver', 11: 'PolicyDeviceMax'})]], 'DeviceTypeFlags' : [ 0x18, ['unsigned long']], 'IrpMinor' : [ 0x1c, ['unsigned char']], 'Waking' : [ 0x1d, ['unsigned char']], 'SystemState' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'NextSystemState' : [ 0x24, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'EffectiveSystemState' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'CurrentSystemState' : [ 0x2c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'ShutdownBugCode' : [ 0x30, ['pointer', ['_POP_SHUTDOWN_BUG_CHECK']]], 'DevState' : [ 0x34, ['pointer', ['_POP_DEVICE_SYS_STATE']]], 'HiberContext' : [ 0x38, ['pointer', ['_POP_HIBER_CONTEXT']]], 'WakeTime' : [ 0x40, ['unsigned long long']], 'SleepTime' : [ 0x48, ['unsigned long long']], 'WakeAlarmSignaled' : [ 0x50, ['Enumeration', dict(target = 'long', choices = {0: 'PoAc', 1: 'PoDc', 2: 'PoHot', 3: 'PoConditionMaximum'})]], 'WakeAlarm' : [ 0x58, ['array', 3, ['__unnamed_24ad']]], 'WakeAlarmPaused' : [ 0xa0, ['unsigned char']], 'WakeAlarmLastTime' : [ 0xa8, ['unsigned long long']], 'FilteredCapabilities' : [ 0xb0, ['SYSTEM_POWER_CAPABILITIES']], } ], '_CM_KEY_VALUE' : [ 0x18, { 'Signature' : [ 0x0, ['unsigned short']], 'NameLength' : [ 0x2, ['unsigned short']], 'DataLength' : [ 0x4, ['unsigned long']], 'Data' : [ 0x8, ['unsigned long']], 'Type' : [ 0xc, ['unsigned long']], 'Flags' : [ 0x10, ['unsigned short']], 'Spare' : [ 0x12, ['unsigned short']], 'Name' : [ 0x14, ['array', 1, ['wchar']]], } ], '_CM_KEY_HASH' : [ 0x10, { 'ConvKey' : [ 0x0, ['unsigned long']], 'NextHash' : [ 0x4, ['pointer', ['_CM_KEY_HASH']]], 'KeyHive' : [ 0x8, ['pointer', ['_HHIVE']]], 'KeyCell' : [ 0xc, ['unsigned long']], } ], '_WHEA_IPF_CMC_DESCRIPTOR' : [ 0x4, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], } ], '_PROCESSOR_IDLE_DEPENDENCY' : [ 0x8, { 'ProcessorIndex' : [ 0x0, ['unsigned long']], 'ExpectedState' : [ 0x4, ['unsigned char']], 'AllowDeeperStates' : [ 0x5, ['unsigned char']], 'LooseDependency' : [ 0x6, ['unsigned char']], } ], '_AMD64_DBGKD_CONTROL_SET' : [ 0x1c, { 'TraceFlag' : [ 0x0, ['unsigned long']], 'Dr7' : [ 0x4, ['unsigned long long']], 'CurrentSymbolStart' : [ 0xc, ['unsigned long long']], 'CurrentSymbolEnd' : [ 0x14, ['unsigned long long']], } ], '_KAPC_STATE' : [ 0x18, { 'ApcListHead' : [ 0x0, ['array', 2, ['_LIST_ENTRY']]], 'Process' : [ 0x10, ['pointer', ['_KPROCESS']]], 'InProgressFlags' : [ 0x14, ['unsigned char']], 'KernelApcInProgress' : [ 0x14, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'SpecialApcInProgress' : [ 0x14, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'KernelApcPending' : [ 0x15, ['unsigned char']], 'UserApcPending' : [ 0x16, ['unsigned char']], } ], '_PO_DEVICE_NOTIFY' : [ 0x3c, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'PowerChildren' : [ 0x8, ['_LIST_ENTRY']], 'PowerParents' : [ 0x10, ['_LIST_ENTRY']], 'TargetDevice' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'OrderLevel' : [ 0x1c, ['unsigned char']], 'DeviceObject' : [ 0x20, ['pointer', ['_DEVICE_OBJECT']]], 'DeviceName' : [ 0x24, ['pointer', ['unsigned short']]], 'DriverName' : [ 0x28, ['pointer', ['unsigned short']]], 'ChildCount' : [ 0x2c, ['unsigned long']], 'ActiveChild' : [ 0x30, ['unsigned long']], 'ParentCount' : [ 0x34, ['unsigned long']], 'ActiveParent' : [ 0x38, ['unsigned long']], } ], '_CM_KEY_SECURITY_CACHE_ENTRY' : [ 0x8, { 'Cell' : [ 0x0, ['unsigned long']], 'CachedSecurity' : [ 0x4, ['pointer', ['_CM_KEY_SECURITY_CACHE']]], } ], '_FS_FILTER_CALLBACK_DATA' : [ 0x24, { 'SizeOfFsFilterCallbackData' : [ 0x0, ['unsigned long']], 'Operation' : [ 0x4, ['unsigned char']], 'Reserved' : [ 0x5, ['unsigned char']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'FileObject' : [ 0xc, ['pointer', ['_FILE_OBJECT']]], 'Parameters' : [ 0x10, ['_FS_FILTER_PARAMETERS']], } ], '_GDI_TEB_BATCH32' : [ 0x4e0, { 'Offset' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='unsigned long')]], 'HasRenderingCommand' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'HDC' : [ 0x4, ['unsigned long']], 'Buffer' : [ 0x8, ['array', 310, ['unsigned long']]], } ], '_WHEA_AER_ROOTPORT_DESCRIPTOR' : [ 0x24, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], 'BusNumber' : [ 0x4, ['unsigned long']], 'Slot' : [ 0x8, ['_WHEA_PCI_SLOT_NUMBER']], 'DeviceControl' : [ 0xc, ['unsigned short']], 'Flags' : [ 0xe, ['_AER_ROOTPORT_DESCRIPTOR_FLAGS']], 'UncorrectableErrorMask' : [ 0x10, ['unsigned long']], 'UncorrectableErrorSeverity' : [ 0x14, ['unsigned long']], 'CorrectableErrorMask' : [ 0x18, ['unsigned long']], 'AdvancedCapsAndControl' : [ 0x1c, ['unsigned long']], 'RootErrorCommand' : [ 0x20, ['unsigned long']], } ], '_PROC_IDLE_STATE_ACCOUNTING' : [ 0x3d8, { 'TotalTime' : [ 0x0, ['unsigned long long']], 'CancelCount' : [ 0x8, ['unsigned long']], 'FailureCount' : [ 0xc, ['unsigned long']], 'SuccessCount' : [ 0x10, ['unsigned long']], 'InvalidBucketIndex' : [ 0x14, ['unsigned long']], 'MinTime' : [ 0x18, ['unsigned long long']], 'MaxTime' : [ 0x20, ['unsigned long long']], 'SelectionStatistics' : [ 0x28, ['_PPM_SELECTION_STATISTICS']], 'IdleTimeBuckets' : [ 0x98, ['array', 26, ['_PROC_IDLE_STATE_BUCKET']]], } ], '_IMAGE_SECURITY_CONTEXT' : [ 0x4, { 'PageHashes' : [ 0x0, ['pointer', ['void']]], 'Value' : [ 0x0, ['unsigned long']], 'SecurityBeingCreated' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'SecurityMandatory' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'PageHashPointer' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], } ], '_KENLISTMENT_HISTORY' : [ 0x8, { 'Notification' : [ 0x0, ['unsigned long']], 'NewState' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'KEnlistmentUninitialized', 256: 'KEnlistmentActive', 258: 'KEnlistmentPrepared', 259: 'KEnlistmentInDoubt', 260: 'KEnlistmentCommitted', 261: 'KEnlistmentCommittedNotify', 262: 'KEnlistmentCommitRequested', 257: 'KEnlistmentPreparing', 264: 'KEnlistmentDelegated', 265: 'KEnlistmentDelegatedDisconnected', 266: 'KEnlistmentPrePreparing', 263: 'KEnlistmentAborted', 268: 'KEnlistmentRecovering', 269: 'KEnlistmentAborting', 270: 'KEnlistmentReadOnly', 271: 'KEnlistmentOutcomeUnavailable', 272: 'KEnlistmentOffline', 273: 'KEnlistmentPrePrepared', 274: 'KEnlistmentInitialized', 267: 'KEnlistmentForgotten'})]], } ], '_FAST_IO_DISPATCH' : [ 0x70, { 'SizeOfFastIoDispatch' : [ 0x0, ['unsigned long']], 'FastIoCheckIfPossible' : [ 0x4, ['pointer', ['void']]], 'FastIoRead' : [ 0x8, ['pointer', ['void']]], 'FastIoWrite' : [ 0xc, ['pointer', ['void']]], 'FastIoQueryBasicInfo' : [ 0x10, ['pointer', ['void']]], 'FastIoQueryStandardInfo' : [ 0x14, ['pointer', ['void']]], 'FastIoLock' : [ 0x18, ['pointer', ['void']]], 'FastIoUnlockSingle' : [ 0x1c, ['pointer', ['void']]], 'FastIoUnlockAll' : [ 0x20, ['pointer', ['void']]], 'FastIoUnlockAllByKey' : [ 0x24, ['pointer', ['void']]], 'FastIoDeviceControl' : [ 0x28, ['pointer', ['void']]], 'AcquireFileForNtCreateSection' : [ 0x2c, ['pointer', ['void']]], 'ReleaseFileForNtCreateSection' : [ 0x30, ['pointer', ['void']]], 'FastIoDetachDevice' : [ 0x34, ['pointer', ['void']]], 'FastIoQueryNetworkOpenInfo' : [ 0x38, ['pointer', ['void']]], 'AcquireForModWrite' : [ 0x3c, ['pointer', ['void']]], 'MdlRead' : [ 0x40, ['pointer', ['void']]], 'MdlReadComplete' : [ 0x44, ['pointer', ['void']]], 'PrepareMdlWrite' : [ 0x48, ['pointer', ['void']]], 'MdlWriteComplete' : [ 0x4c, ['pointer', ['void']]], 'FastIoReadCompressed' : [ 0x50, ['pointer', ['void']]], 'FastIoWriteCompressed' : [ 0x54, ['pointer', ['void']]], 'MdlReadCompleteCompressed' : [ 0x58, ['pointer', ['void']]], 'MdlWriteCompleteCompressed' : [ 0x5c, ['pointer', ['void']]], 'FastIoQueryOpen' : [ 0x60, ['pointer', ['void']]], 'ReleaseForModWrite' : [ 0x64, ['pointer', ['void']]], 'AcquireForCcFlush' : [ 0x68, ['pointer', ['void']]], 'ReleaseForCcFlush' : [ 0x6c, ['pointer', ['void']]], } ], '_PERFINFO_PPM_STATE_SELECTION' : [ 0xc, { 'SelectedState' : [ 0x0, ['unsigned long']], 'VetoedStates' : [ 0x4, ['unsigned long']], 'VetoReason' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '_CM_CELL_REMAP_BLOCK' : [ 0x8, { 'OldCell' : [ 0x0, ['unsigned long']], 'NewCell' : [ 0x4, ['unsigned long']], } ], '_PI_RESOURCE_ARBITER_ENTRY' : [ 0x38, { 'DeviceArbiterList' : [ 0x0, ['_LIST_ENTRY']], 'ResourceType' : [ 0x8, ['unsigned char']], 'ArbiterInterface' : [ 0xc, ['pointer', ['_ARBITER_INTERFACE']]], 'DeviceNode' : [ 0x10, ['pointer', ['_DEVICE_NODE']]], 'ResourceList' : [ 0x14, ['_LIST_ENTRY']], 'BestResourceList' : [ 0x1c, ['_LIST_ENTRY']], 'BestConfig' : [ 0x24, ['_LIST_ENTRY']], 'ActiveArbiterList' : [ 0x2c, ['_LIST_ENTRY']], 'State' : [ 0x34, ['unsigned char']], 'ResourcesChanged' : [ 0x35, ['unsigned char']], } ], '_SECURITY_DESCRIPTOR' : [ 0x14, { 'Revision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'Control' : [ 0x2, ['unsigned short']], 'Owner' : [ 0x4, ['pointer', ['void']]], 'Group' : [ 0x8, ['pointer', ['void']]], 'Sacl' : [ 0xc, ['pointer', ['_ACL']]], 'Dacl' : [ 0x10, ['pointer', ['_ACL']]], } ], '_MODWRITER_FLAGS' : [ 0x4, { 'KeepForever' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Networked' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'IoPriority' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 5, native_type='unsigned long')]], 'ModifiedStoreWrite' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], } ], '_MI_PTE_CHAIN_HEAD' : [ 0x18, { 'Flink' : [ 0x0, ['_MMPTE']], 'Blink' : [ 0x8, ['_MMPTE']], 'PteBase' : [ 0x10, ['pointer', ['_MMPTE']]], } ], '_PPM_SELECTION_MENU_ENTRY' : [ 0x10, { 'StrictDependency' : [ 0x0, ['unsigned char']], 'InitiatingState' : [ 0x1, ['unsigned char']], 'DependentState' : [ 0x2, ['unsigned char']], 'StateIndex' : [ 0x4, ['unsigned long']], 'Dependencies' : [ 0x8, ['unsigned long']], 'DependencyList' : [ 0xc, ['pointer', ['_PPM_SELECTION_DEPENDENCY']]], } ], '_MI_PAGING_FILE_SPACE_BITMAPS' : [ 0x14, { 'RefCount' : [ 0x0, ['unsigned long']], 'Anchor' : [ 0x0, ['pointer', ['_MI_PAGING_FILE_SPACE_BITMAPS']]], 'AllocationBitmap' : [ 0x4, ['_RTL_BITMAP']], 'ReservationBitmap' : [ 0xc, ['_RTL_BITMAP']], 'EvictedBitmap' : [ 0xc, ['_RTL_BITMAP']], } ], '_KQUEUE' : [ 0x28, { 'Header' : [ 0x0, ['_DISPATCHER_HEADER']], 'EntryListHead' : [ 0x10, ['_LIST_ENTRY']], 'CurrentCount' : [ 0x18, ['unsigned long']], 'MaximumCount' : [ 0x1c, ['unsigned long']], 'ThreadListHead' : [ 0x20, ['_LIST_ENTRY']], } ], '_MI_COMBINE_WORKITEM' : [ 0x14, { 'NextEntry' : [ 0x0, ['pointer', ['void']]], 'WorkItem' : [ 0x4, ['_WORK_QUEUE_ITEM']], } ], '_RTL_USER_PROCESS_PARAMETERS' : [ 0x2a4, { 'MaximumLength' : [ 0x0, ['unsigned long']], 'Length' : [ 0x4, ['unsigned long']], 'Flags' : [ 0x8, ['unsigned long']], 'DebugFlags' : [ 0xc, ['unsigned long']], 'ConsoleHandle' : [ 0x10, ['pointer', ['void']]], 'ConsoleFlags' : [ 0x14, ['unsigned long']], 'StandardInput' : [ 0x18, ['pointer', ['void']]], 'StandardOutput' : [ 0x1c, ['pointer', ['void']]], 'StandardError' : [ 0x20, ['pointer', ['void']]], 'CurrentDirectory' : [ 0x24, ['_CURDIR']], 'DllPath' : [ 0x30, ['_UNICODE_STRING']], 'ImagePathName' : [ 0x38, ['_UNICODE_STRING']], 'CommandLine' : [ 0x40, ['_UNICODE_STRING']], 'Environment' : [ 0x48, ['pointer', ['void']]], 'StartingX' : [ 0x4c, ['unsigned long']], 'StartingY' : [ 0x50, ['unsigned long']], 'CountX' : [ 0x54, ['unsigned long']], 'CountY' : [ 0x58, ['unsigned long']], 'CountCharsX' : [ 0x5c, ['unsigned long']], 'CountCharsY' : [ 0x60, ['unsigned long']], 'FillAttribute' : [ 0x64, ['unsigned long']], 'WindowFlags' : [ 0x68, ['unsigned long']], 'ShowWindowFlags' : [ 0x6c, ['unsigned long']], 'WindowTitle' : [ 0x70, ['_UNICODE_STRING']], 'DesktopInfo' : [ 0x78, ['_UNICODE_STRING']], 'ShellInfo' : [ 0x80, ['_UNICODE_STRING']], 'RuntimeData' : [ 0x88, ['_UNICODE_STRING']], 'CurrentDirectores' : [ 0x90, ['array', 32, ['_RTL_DRIVE_LETTER_CURDIR']]], 'EnvironmentSize' : [ 0x290, ['unsigned long']], 'EnvironmentVersion' : [ 0x294, ['unsigned long']], 'PackageDependencyData' : [ 0x298, ['pointer', ['void']]], 'ProcessGroupId' : [ 0x29c, ['unsigned long']], 'LoaderThreads' : [ 0x2a0, ['unsigned long']], } ], '_PHYSICAL_MEMORY_RUN' : [ 0x8, { 'BasePage' : [ 0x0, ['unsigned long']], 'PageCount' : [ 0x4, ['unsigned long']], } ], '_RTL_SRWLOCK' : [ 0x4, { 'Locked' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Waiting' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Waking' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'MultipleShared' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Shared' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 32, native_type='unsigned long')]], 'Value' : [ 0x0, ['unsigned long']], 'Ptr' : [ 0x0, ['pointer', ['void']]], } ], '_KTMOBJECT_NAMESPACE_LINK' : [ 0x14, { 'Links' : [ 0x0, ['_RTL_BALANCED_LINKS']], 'Expired' : [ 0x10, ['unsigned char']], } ], '_CACHE_MANAGER_CALLBACKS' : [ 0x10, { 'AcquireForLazyWrite' : [ 0x0, ['pointer', ['void']]], 'ReleaseFromLazyWrite' : [ 0x4, ['pointer', ['void']]], 'AcquireForReadAhead' : [ 0x8, ['pointer', ['void']]], 'ReleaseFromReadAhead' : [ 0xc, ['pointer', ['void']]], } ], '_PROC_PERF_LOAD' : [ 0x2, { 'BusyPercentage' : [ 0x0, ['unsigned char']], 'FrequencyPercentage' : [ 0x1, ['unsigned char']], } ], '_RTL_RANGE' : [ 0x20, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'UserData' : [ 0x10, ['pointer', ['void']]], 'Owner' : [ 0x14, ['pointer', ['void']]], 'Attributes' : [ 0x18, ['unsigned char']], 'Flags' : [ 0x19, ['unsigned char']], } ], '_LOCK_HEADER' : [ 0x10, { 'LockTree' : [ 0x0, ['_RTL_AVL_TREE']], 'Count' : [ 0x4, ['unsigned long']], 'Lock' : [ 0x8, ['unsigned long']], 'Valid' : [ 0xc, ['unsigned long']], } ], '_WHEA_IPF_MCA_DESCRIPTOR' : [ 0x4, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], } ], '_SYSTEM_POWER_POLICY' : [ 0xe8, { 'Revision' : [ 0x0, ['unsigned long']], 'PowerButton' : [ 0x4, ['POWER_ACTION_POLICY']], 'SleepButton' : [ 0x10, ['POWER_ACTION_POLICY']], 'LidClose' : [ 0x1c, ['POWER_ACTION_POLICY']], 'LidOpenWake' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'Reserved' : [ 0x2c, ['unsigned long']], 'Idle' : [ 0x30, ['POWER_ACTION_POLICY']], 'IdleTimeout' : [ 0x3c, ['unsigned long']], 'IdleSensitivity' : [ 0x40, ['unsigned char']], 'DynamicThrottle' : [ 0x41, ['unsigned char']], 'Spare2' : [ 0x42, ['array', 2, ['unsigned char']]], 'MinSleep' : [ 0x44, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'MaxSleep' : [ 0x48, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'ReducedLatencySleep' : [ 0x4c, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'WinLogonFlags' : [ 0x50, ['unsigned long']], 'Spare3' : [ 0x54, ['unsigned long']], 'DozeS4Timeout' : [ 0x58, ['unsigned long']], 'BroadcastCapacityResolution' : [ 0x5c, ['unsigned long']], 'DischargePolicy' : [ 0x60, ['array', 4, ['SYSTEM_POWER_LEVEL']]], 'VideoTimeout' : [ 0xc0, ['unsigned long']], 'VideoDimDisplay' : [ 0xc4, ['unsigned char']], 'VideoReserved' : [ 0xc8, ['array', 3, ['unsigned long']]], 'SpindownTimeout' : [ 0xd4, ['unsigned long']], 'OptimizeForPower' : [ 0xd8, ['unsigned char']], 'FanThrottleTolerance' : [ 0xd9, ['unsigned char']], 'ForcedThrottle' : [ 0xda, ['unsigned char']], 'MinThrottle' : [ 0xdb, ['unsigned char']], 'OverThrottled' : [ 0xdc, ['POWER_ACTION_POLICY']], } ], '_POOL_HEADER' : [ 0x8, { 'PreviousSize' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned short')]], 'PoolIndex' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 16, native_type='unsigned short')]], 'BlockSize' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 9, native_type='unsigned short')]], 'PoolType' : [ 0x2, ['BitField', dict(start_bit = 9, end_bit = 16, native_type='unsigned short')]], 'Ulong1' : [ 0x0, ['unsigned long']], 'PoolTag' : [ 0x4, ['unsigned long']], 'AllocatorBackTraceIndex' : [ 0x4, ['unsigned short']], 'PoolTagHash' : [ 0x6, ['unsigned short']], } ], '_PS_PROTECTION' : [ 0x1, { 'Level' : [ 0x0, ['unsigned char']], 'Type' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'Audit' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Signer' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], } ], '_MSUBSECTION' : [ 0x44, { 'Core' : [ 0x0, ['_SUBSECTION']], 'SubsectionNode' : [ 0x28, ['_RTL_BALANCED_NODE']], 'DereferenceList' : [ 0x34, ['_LIST_ENTRY']], 'NumberOfMappedViews' : [ 0x3c, ['unsigned long']], 'NumberOfPfnReferences' : [ 0x40, ['unsigned long']], } ], '_SE_AUDIT_PROCESS_CREATION_INFO' : [ 0x4, { 'ImageFileName' : [ 0x0, ['pointer', ['_OBJECT_NAME_INFORMATION']]], } ], '_HEAP_ENTRY_EXTRA' : [ 0x8, { 'AllocatorBackTraceIndex' : [ 0x0, ['unsigned short']], 'TagIndex' : [ 0x2, ['unsigned short']], 'Settable' : [ 0x4, ['unsigned long']], 'ZeroInit' : [ 0x0, ['unsigned long long']], } ], '_VF_POOL_TRACE' : [ 0x40, { 'Address' : [ 0x0, ['pointer', ['void']]], 'Size' : [ 0x4, ['unsigned long']], 'Thread' : [ 0x8, ['pointer', ['_ETHREAD']]], 'StackTrace' : [ 0xc, ['array', 13, ['pointer', ['void']]]], } ], '__unnamed_256a' : [ 0x4, { 'LongFlags' : [ 0x0, ['unsigned long']], 'Flags' : [ 0x0, ['_MM_SESSION_SPACE_FLAGS']], } ], '_MM_SESSION_SPACE' : [ 0x2000, { 'ReferenceCount' : [ 0x0, ['long']], 'u' : [ 0x4, ['__unnamed_256a']], 'SessionId' : [ 0x8, ['unsigned long']], 'ProcessReferenceToSession' : [ 0xc, ['long']], 'ProcessList' : [ 0x10, ['_LIST_ENTRY']], 'SessionPageDirectoryIndex' : [ 0x18, ['unsigned long']], 'NonPagablePages' : [ 0x1c, ['unsigned long']], 'CommittedPages' : [ 0x20, ['unsigned long']], 'PagedPoolStart' : [ 0x24, ['pointer', ['void']]], 'PagedPoolEnd' : [ 0x28, ['pointer', ['void']]], 'SessionObject' : [ 0x2c, ['pointer', ['void']]], 'SessionObjectHandle' : [ 0x30, ['pointer', ['void']]], 'SessionPoolAllocationFailures' : [ 0x34, ['array', 4, ['unsigned long']]], 'ImageTree' : [ 0x44, ['_RTL_AVL_TREE']], 'LocaleId' : [ 0x48, ['unsigned long']], 'AttachCount' : [ 0x4c, ['unsigned long']], 'AttachGate' : [ 0x50, ['_KGATE']], 'WsListEntry' : [ 0x60, ['_LIST_ENTRY']], 'Lookaside' : [ 0x80, ['array', 24, ['_GENERAL_LOOKASIDE']]], 'Session' : [ 0xc80, ['_MMSESSION']], 'PagedPoolInfo' : [ 0xc94, ['_MM_PAGED_POOL_INFO']], 'Vm' : [ 0xcb0, ['_MMSUPPORT']], 'Wsle' : [ 0xd30, ['pointer', ['_MMWSLE']]], 'DriverUnload' : [ 0xd34, ['_MI_SESSION_DRIVER_UNLOAD']], 'PagedPool' : [ 0xd40, ['_POOL_DESCRIPTOR']], 'PageTables' : [ 0x1e80, ['pointer', ['_MMPTE']]], 'PagedPoolBitBuffer' : [ 0x1e84, ['array', 32, ['unsigned long']]], 'SpecialPool' : [ 0x1f08, ['_MI_SPECIAL_POOL']], 'SessionPteLock' : [ 0x1f50, ['_EX_PUSH_LOCK']], 'PoolBigEntriesInUse' : [ 0x1f54, ['long']], 'PagedPoolPdeCount' : [ 0x1f58, ['unsigned long']], 'SpecialPoolPdeCount' : [ 0x1f5c, ['unsigned long']], 'DynamicSessionPdeCount' : [ 0x1f60, ['unsigned long']], 'SystemPteInfo' : [ 0x1f64, ['_MI_SYSTEM_PTE_TYPE']], 'PoolTrackTableExpansion' : [ 0x1f98, ['pointer', ['void']]], 'PoolTrackTableExpansionSize' : [ 0x1f9c, ['unsigned long']], 'PoolTrackBigPages' : [ 0x1fa0, ['pointer', ['void']]], 'PoolTrackBigPagesSize' : [ 0x1fa4, ['unsigned long']], 'IoState' : [ 0x1fa8, ['Enumeration', dict(target = 'long', choices = {1: 'IoSessionStateCreated', 2: 'IoSessionStateInitialized', 3: 'IoSessionStateConnected', 4: 'IoSessionStateDisconnected', 5: 'IoSessionStateDisconnectedLoggedOn', 6: 'IoSessionStateLoggedOn', 7: 'IoSessionStateLoggedOff', 8: 'IoSessionStateTerminated', 9: 'IoSessionStateMax'})]], 'IoStateSequence' : [ 0x1fac, ['unsigned long']], 'IoNotificationEvent' : [ 0x1fb0, ['_KEVENT']], 'ServerSilo' : [ 0x1fc0, ['pointer', ['_ESILO']]], 'CreateTime' : [ 0x1fc8, ['unsigned long long']], } ], '_MMPAGE_FILE_EXPANSION' : [ 0x38, { 'Segment' : [ 0x0, ['pointer', ['_SEGMENT']]], 'DereferenceList' : [ 0x4, ['_LIST_ENTRY']], 'Partition' : [ 0xc, ['pointer', ['_MI_PARTITION']]], 'RequestedExpansionSize' : [ 0x10, ['unsigned long']], 'ActualExpansion' : [ 0x14, ['unsigned long']], 'Event' : [ 0x18, ['_KEVENT']], 'InProgress' : [ 0x28, ['long']], 'u' : [ 0x2c, ['_MMPAGE_FILE_EXPANSION_FLAGS']], 'ActiveEntry' : [ 0x30, ['pointer', ['pointer', ['void']]]], 'AttemptForCantExtend' : [ 0x34, ['unsigned char']], 'PageFileContract' : [ 0x35, ['unsigned char']], } ], '_WHEA_XPF_MC_BANK_DESCRIPTOR' : [ 0x1c, { 'BankNumber' : [ 0x0, ['unsigned char']], 'ClearOnInitialization' : [ 0x1, ['unsigned char']], 'StatusDataFormat' : [ 0x2, ['unsigned char']], 'Flags' : [ 0x3, ['_XPF_MC_BANK_FLAGS']], 'ControlMsr' : [ 0x4, ['unsigned long']], 'StatusMsr' : [ 0x8, ['unsigned long']], 'AddressMsr' : [ 0xc, ['unsigned long']], 'MiscMsr' : [ 0x10, ['unsigned long']], 'ControlData' : [ 0x14, ['unsigned long long']], } ], '__unnamed_257b' : [ 0x4, { 'LongFlags2' : [ 0x0, ['unsigned long']], 'VadFlags2' : [ 0x0, ['_MMVAD_FLAGS2']], } ], '__unnamed_257e' : [ 0x4, { 'SequentialVa' : [ 0x0, ['_MI_VAD_SEQUENTIAL_INFO']], 'ExtendedInfo' : [ 0x0, ['pointer', ['_MMEXTEND_INFO']]], } ], '_MMVAD' : [ 0x4c, { 'Core' : [ 0x0, ['_MMVAD_SHORT']], 'u2' : [ 0x28, ['__unnamed_257b']], 'Subsection' : [ 0x2c, ['pointer', ['_SUBSECTION']]], 'FirstPrototypePte' : [ 0x30, ['pointer', ['_MMPTE']]], 'LastContiguousPte' : [ 0x34, ['pointer', ['_MMPTE']]], 'ViewLinks' : [ 0x38, ['_LIST_ENTRY']], 'VadsProcess' : [ 0x40, ['pointer', ['_EPROCESS']]], 'u4' : [ 0x44, ['__unnamed_257e']], 'FileObject' : [ 0x48, ['pointer', ['_FILE_OBJECT']]], } ], '_SEP_SID_VALUES_BLOCK' : [ 0x10, { 'BlockLength' : [ 0x0, ['unsigned long']], 'ReferenceCount' : [ 0x4, ['long']], 'SidCount' : [ 0x8, ['unsigned long']], 'SidValuesStart' : [ 0xc, ['unsigned long']], } ], '_MI_PARTITION_STATE' : [ 0x30, { 'PartitionLock' : [ 0x0, ['unsigned long']], 'PartitionIdLock' : [ 0x4, ['_EX_PUSH_LOCK']], 'InitialPartitionIdBits' : [ 0x8, ['unsigned long long']], 'PartitionList' : [ 0x10, ['_LIST_ENTRY']], 'PartitionIdBitmap' : [ 0x18, ['pointer', ['_RTL_BITMAP']]], 'InitialPartitionIdBitmap' : [ 0x1c, ['_RTL_BITMAP']], 'TempPartitionPointers' : [ 0x24, ['array', 1, ['pointer', ['_MI_PARTITION']]]], 'Partition' : [ 0x28, ['pointer', ['pointer', ['_MI_PARTITION']]]], 'TotalPagesInChildPartitions' : [ 0x2c, ['unsigned long']], } ], '_MMMOD_WRITER_LISTHEAD' : [ 0x18, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'Gate' : [ 0x8, ['_KGATE']], 'Event' : [ 0x8, ['_KEVENT']], } ], '_CM_RM' : [ 0x58, { 'RmListEntry' : [ 0x0, ['_LIST_ENTRY']], 'TransactionListHead' : [ 0x8, ['_LIST_ENTRY']], 'TmHandle' : [ 0x10, ['pointer', ['void']]], 'Tm' : [ 0x14, ['pointer', ['void']]], 'RmHandle' : [ 0x18, ['pointer', ['void']]], 'KtmRm' : [ 0x1c, ['pointer', ['void']]], 'RefCount' : [ 0x20, ['unsigned long']], 'ContainerNum' : [ 0x24, ['unsigned long']], 'ContainerSize' : [ 0x28, ['unsigned long long']], 'CmHive' : [ 0x30, ['pointer', ['_CMHIVE']]], 'LogFileObject' : [ 0x34, ['pointer', ['void']]], 'MarshallingContext' : [ 0x38, ['pointer', ['void']]], 'RmFlags' : [ 0x3c, ['unsigned long']], 'LogStartStatus1' : [ 0x40, ['long']], 'LogStartStatus2' : [ 0x44, ['long']], 'BaseLsn' : [ 0x48, ['unsigned long long']], 'RmLock' : [ 0x50, ['pointer', ['_ERESOURCE']]], } ], '_NONOPAQUE_OPLOCK' : [ 0x50, { 'IrpExclusiveOplock' : [ 0x0, ['pointer', ['_IRP']]], 'FileObject' : [ 0x4, ['pointer', ['_FILE_OBJECT']]], 'ExclusiveOplockOwner' : [ 0x8, ['pointer', ['_EPROCESS']]], 'ExclusiveOplockOwnerThread' : [ 0xc, ['pointer', ['_ETHREAD']]], 'WaiterPriority' : [ 0x10, ['unsigned char']], 'IrpOplocksR' : [ 0x14, ['_LIST_ENTRY']], 'IrpOplocksRH' : [ 0x1c, ['_LIST_ENTRY']], 'RHBreakQueue' : [ 0x24, ['_LIST_ENTRY']], 'WaitingIrps' : [ 0x2c, ['_LIST_ENTRY']], 'DelayAckFileObjectQueue' : [ 0x34, ['_LIST_ENTRY']], 'AtomicQueue' : [ 0x3c, ['_LIST_ENTRY']], 'DeleterParentKey' : [ 0x44, ['pointer', ['_GUID']]], 'OplockState' : [ 0x48, ['unsigned long']], 'FastMutex' : [ 0x4c, ['pointer', ['_FAST_MUTEX']]], } ], '_MI_LARGEPAGE_MEMORY_INFO' : [ 0x10, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'ColoredPageInfoBase' : [ 0x8, ['pointer', ['_COLORED_PAGE_INFO']]], 'PagesNeedZeroing' : [ 0xc, ['unsigned long']], } ], '_OBJECT_HANDLE_COUNT_ENTRY' : [ 0x8, { 'Process' : [ 0x0, ['pointer', ['_EPROCESS']]], 'HandleCount' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'LockCount' : [ 0x4, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], } ], '_PROCESS_ENERGY_VALUES' : [ 0x90, { 'Cycles' : [ 0x0, ['array', 4, ['array', 2, ['unsigned long long']]]], 'DiskEnergy' : [ 0x40, ['unsigned long long']], 'NetworkTailEnergy' : [ 0x48, ['unsigned long long']], 'MBBTailEnergy' : [ 0x50, ['unsigned long long']], 'NetworkTxRxBytes' : [ 0x58, ['unsigned long long']], 'MBBTxRxBytes' : [ 0x60, ['unsigned long long']], 'Foreground' : [ 0x68, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'WindowInformation' : [ 0x68, ['unsigned long']], 'PixelArea' : [ 0x6c, ['unsigned long']], 'PixelReportTimestamp' : [ 0x70, ['long long']], 'PixelTime' : [ 0x78, ['unsigned long long']], 'ForegroundReportTimestamp' : [ 0x80, ['long long']], 'ForegroundTime' : [ 0x88, ['unsigned long long']], } ], '_CLIENT_ID' : [ 0x8, { 'UniqueProcess' : [ 0x0, ['pointer', ['void']]], 'UniqueThread' : [ 0x4, ['pointer', ['void']]], } ], '_WHEA_MEMORY_ERROR_SECTION' : [ 0x49, { 'ValidBits' : [ 0x0, ['_WHEA_MEMORY_ERROR_SECTION_VALIDBITS']], 'ErrorStatus' : [ 0x8, ['_WHEA_ERROR_STATUS']], 'PhysicalAddress' : [ 0x10, ['unsigned long long']], 'PhysicalAddressMask' : [ 0x18, ['unsigned long long']], 'Node' : [ 0x20, ['unsigned short']], 'Card' : [ 0x22, ['unsigned short']], 'Module' : [ 0x24, ['unsigned short']], 'Bank' : [ 0x26, ['unsigned short']], 'Device' : [ 0x28, ['unsigned short']], 'Row' : [ 0x2a, ['unsigned short']], 'Column' : [ 0x2c, ['unsigned short']], 'BitPosition' : [ 0x2e, ['unsigned short']], 'RequesterId' : [ 0x30, ['unsigned long long']], 'ResponderId' : [ 0x38, ['unsigned long long']], 'TargetId' : [ 0x40, ['unsigned long long']], 'ErrorType' : [ 0x48, ['unsigned char']], } ], '_MI_COMMON_PAGE_STATE' : [ 0x2c, { 'PageOfOnesPfn' : [ 0x0, ['pointer', ['_MMPFN']]], 'PageOfOnes' : [ 0x4, ['unsigned long']], 'DummyPagePfn' : [ 0x8, ['pointer', ['_MMPFN']]], 'DummyPage' : [ 0xc, ['unsigned long']], 'PageOfZeroes' : [ 0x10, ['unsigned long']], 'ZeroMapping' : [ 0x14, ['pointer', ['void']]], 'OnesMapping' : [ 0x18, ['pointer', ['void']]], 'BitmapGapFrames' : [ 0x1c, ['array', 2, ['unsigned long']]], 'PfnGapFrames' : [ 0x24, ['array', 2, ['unsigned long']]], } ], '_KWAIT_STATUS_REGISTER' : [ 0x1, { 'Flags' : [ 0x0, ['unsigned char']], 'State' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'Affinity' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Priority' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'Apc' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'UserApc' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'Alert' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], } ], '_VI_DEADLOCK_RESOURCE' : [ 0x80, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'VfDeadlockUnknown', 1: 'VfDeadlockMutex', 2: 'VfDeadlockMutexAbandoned', 3: 'VfDeadlockFastMutex', 4: 'VfDeadlockFastMutexUnsafe', 5: 'VfDeadlockSpinLock', 6: 'VfDeadlockInStackQueuedSpinLock', 7: 'VfDeadlockUnusedSpinLock', 8: 'VfDeadlockEresource', 9: 'VfDeadlockTypeMaximum'})]], 'NodeCount' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'RecursionCount' : [ 0x4, ['BitField', dict(start_bit = 16, end_bit = 32, native_type='unsigned long')]], 'ResourceAddress' : [ 0x8, ['pointer', ['void']]], 'ThreadOwner' : [ 0xc, ['pointer', ['_VI_DEADLOCK_THREAD']]], 'ResourceList' : [ 0x10, ['_LIST_ENTRY']], 'HashChainList' : [ 0x18, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x18, ['_LIST_ENTRY']], 'StackTrace' : [ 0x20, ['array', 8, ['pointer', ['void']]]], 'LastAcquireTrace' : [ 0x40, ['array', 8, ['pointer', ['void']]]], 'LastReleaseTrace' : [ 0x60, ['array', 8, ['pointer', ['void']]]], } ], '__unnamed_25a9' : [ 0x4, { 'ReferenceCount' : [ 0x0, ['unsigned long']], 'NumberOfPtesToFree' : [ 0x0, ['unsigned long']], } ], '_MI_PER_SESSION_PROTOS' : [ 0x18, { 'SessionProtoNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'FreeList' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'DriverAddress' : [ 0x0, ['pointer', ['void']]], 'SessionId' : [ 0xc, ['unsigned long']], 'Subsection' : [ 0xc, ['pointer', ['_SUBSECTION']]], 'SubsectionBase' : [ 0x10, ['pointer', ['_MMPTE']]], 'u2' : [ 0x14, ['__unnamed_25a9']], } ], '_DBGKD_GET_SET_BUS_DATA' : [ 0x14, { 'BusDataType' : [ 0x0, ['unsigned long']], 'BusNumber' : [ 0x4, ['unsigned long']], 'SlotNumber' : [ 0x8, ['unsigned long']], 'Offset' : [ 0xc, ['unsigned long']], 'Length' : [ 0x10, ['unsigned long']], } ], '_MMSECTION_FLAGS' : [ 0x4, { 'BeingDeleted' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'BeingCreated' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'BeingPurged' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'NoModifiedWriting' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'FailAllIo' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Image' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Based' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'File' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'AttemptingDelete' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'PrefetchCreated' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'PhysicalMemory' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'Reserve' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'Commit' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'NoChange' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'WasPurged' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'UserReference' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'GlobalMemory' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'DeleteOnClose' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'FilePointerNull' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'PreferredNode' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 26, native_type='unsigned long')]], 'GlobalOnlyPerSession' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'UserWritable' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'SystemVaAllocated' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'PreferredFsCompressionBoundary' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'UsingFileExtents' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_SECURITY_CLIENT_CONTEXT' : [ 0x3c, { 'SecurityQos' : [ 0x0, ['_SECURITY_QUALITY_OF_SERVICE']], 'ClientToken' : [ 0xc, ['pointer', ['void']]], 'DirectlyAccessClientToken' : [ 0x10, ['unsigned char']], 'DirectAccessEffectiveOnly' : [ 0x11, ['unsigned char']], 'ServerIsRemote' : [ 0x12, ['unsigned char']], 'ClientTokenControl' : [ 0x14, ['_TOKEN_CONTROL']], } ], '_MI_REVERSE_VIEW_MAP' : [ 0x18, { 'ViewLinks' : [ 0x0, ['_LIST_ENTRY']], 'SystemCacheVa' : [ 0x8, ['pointer', ['void']]], 'SessionViewVa' : [ 0x8, ['pointer', ['void']]], 'VadsProcess' : [ 0x8, ['pointer', ['_EPROCESS']]], 'Type' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned long')]], 'Subsection' : [ 0xc, ['pointer', ['_SUBSECTION']]], 'SubsectionType' : [ 0xc, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'SectionOffset' : [ 0x10, ['unsigned long long']], } ], '_IO_SECURITY_CONTEXT' : [ 0x10, { 'SecurityQos' : [ 0x0, ['pointer', ['_SECURITY_QUALITY_OF_SERVICE']]], 'AccessState' : [ 0x4, ['pointer', ['_ACCESS_STATE']]], 'DesiredAccess' : [ 0x8, ['unsigned long']], 'FullCreateOptions' : [ 0xc, ['unsigned long']], } ], '__unnamed_25c2' : [ 0x20, { 'Mdl' : [ 0x0, ['_MDL']], 'Page' : [ 0x1c, ['array', 1, ['unsigned long']]], } ], '_MI_PAGEFILE_TRACES' : [ 0x50, { 'Status' : [ 0x0, ['long']], 'PartitionId' : [ 0x4, ['unsigned short']], 'Priority' : [ 0x6, ['unsigned char']], 'IrpPriority' : [ 0x7, ['unsigned char']], 'ReservationWrite' : [ 0x8, ['unsigned char']], 'CurrentTime' : [ 0x10, ['_LARGE_INTEGER']], 'AvailablePages' : [ 0x18, ['unsigned long']], 'ModifiedPagesTotal' : [ 0x1c, ['unsigned long']], 'ModifiedPagefilePages' : [ 0x20, ['unsigned long']], 'ModifiedNoWritePages' : [ 0x24, ['unsigned long']], 'ModifiedPagefileNoReservationPages' : [ 0x28, ['unsigned long']], 'MdlHack' : [ 0x2c, ['__unnamed_25c2']], } ], '_PROC_PERF_DOMAIN' : [ 0xb8, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Master' : [ 0x8, ['pointer', ['_KPRCB']]], 'Members' : [ 0xc, ['_KAFFINITY_EX']], 'ProcessorCount' : [ 0x18, ['unsigned long']], 'Class' : [ 0x1c, ['unsigned char']], 'Spare' : [ 0x1d, ['array', 3, ['unsigned char']]], 'Processors' : [ 0x20, ['pointer', ['_PROC_PERF_CONSTRAINT']]], 'GetFFHThrottleState' : [ 0x24, ['pointer', ['void']]], 'TimeWindowHandler' : [ 0x28, ['pointer', ['void']]], 'BoostPolicyHandler' : [ 0x2c, ['pointer', ['void']]], 'BoostModeHandler' : [ 0x30, ['pointer', ['void']]], 'EnergyPerfPreferenceHandler' : [ 0x34, ['pointer', ['void']]], 'AutonomousActivityWindowHandler' : [ 0x38, ['pointer', ['void']]], 'AutonomousModeHandler' : [ 0x3c, ['pointer', ['void']]], 'ReinitializeHandler' : [ 0x40, ['pointer', ['void']]], 'PerfSelectionHandler' : [ 0x44, ['pointer', ['void']]], 'PerfControlHandler' : [ 0x48, ['pointer', ['void']]], 'MaxFrequency' : [ 0x4c, ['unsigned long']], 'NominalFrequency' : [ 0x50, ['unsigned long']], 'MaxPercent' : [ 0x54, ['unsigned long']], 'MinPerfPercent' : [ 0x58, ['unsigned long']], 'MinThrottlePercent' : [ 0x5c, ['unsigned long']], 'MinimumRelativePerformance' : [ 0x60, ['unsigned long long']], 'NominalRelativePerformance' : [ 0x68, ['unsigned long long']], 'Coordination' : [ 0x70, ['unsigned char']], 'HardPlatformCap' : [ 0x71, ['unsigned char']], 'AffinitizeControl' : [ 0x72, ['unsigned char']], 'EfficientThrottle' : [ 0x73, ['unsigned char']], 'AutonomousMode' : [ 0x74, ['unsigned char']], 'SelectedPercent' : [ 0x78, ['unsigned long']], 'SelectedFrequency' : [ 0x7c, ['unsigned long']], 'DesiredPercent' : [ 0x80, ['unsigned long']], 'MaxPolicyPercent' : [ 0x84, ['unsigned long']], 'MinPolicyPercent' : [ 0x88, ['unsigned long']], 'ConstrainedMaxPercent' : [ 0x8c, ['unsigned long']], 'ConstrainedMinPercent' : [ 0x90, ['unsigned long']], 'GuaranteedPercent' : [ 0x94, ['unsigned long']], 'TolerancePercent' : [ 0x98, ['unsigned long']], 'SelectedState' : [ 0xa0, ['unsigned long long']], 'PerfChangeTime' : [ 0xa8, ['unsigned long long']], 'PerfChangeIntervalCount' : [ 0xb0, ['unsigned long']], 'Force' : [ 0xb4, ['unsigned char']], 'ProvideGuidance' : [ 0xb5, ['unsigned char']], } ], '_X86_DBGKD_CONTROL_SET' : [ 0x10, { 'TraceFlag' : [ 0x0, ['unsigned long']], 'Dr7' : [ 0x4, ['unsigned long']], 'CurrentSymbolStart' : [ 0x8, ['unsigned long']], 'CurrentSymbolEnd' : [ 0xc, ['unsigned long']], } ], '_HVIEW_MAP_TABLE' : [ 0x600, { 'Entries' : [ 0x0, ['array', 64, ['_HVIEW_MAP_ENTRY']]], } ], '_HANDLE_TRACE_DB_ENTRY' : [ 0x50, { 'ClientId' : [ 0x0, ['_CLIENT_ID']], 'Handle' : [ 0x8, ['pointer', ['void']]], 'Type' : [ 0xc, ['unsigned long']], 'StackTrace' : [ 0x10, ['array', 16, ['pointer', ['void']]]], } ], '_WHEA_IPF_CPE_DESCRIPTOR' : [ 0x4, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], } ], '_DUMMY_FILE_OBJECT' : [ 0xa0, { 'ObjectHeader' : [ 0x0, ['_OBJECT_HEADER']], 'FileObjectBody' : [ 0x20, ['array', 128, ['unsigned char']]], } ], '_TRIAGE_9F_PNP' : [ 0xc, { 'Signature' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'CompletionQueue' : [ 0x4, ['pointer', ['_TRIAGE_PNP_DEVICE_COMPLETION_QUEUE']]], 'DelayedWorkQueue' : [ 0x8, ['pointer', ['_TRIAGE_EX_WORK_QUEUE']]], } ], '_RELATION_LIST' : [ 0x8, { 'DeviceObjectList' : [ 0x0, ['pointer', ['_DEVICE_OBJECT_LIST']]], 'Sorted' : [ 0x4, ['unsigned char']], } ], '_IO_TIMER' : [ 0x18, { 'Type' : [ 0x0, ['short']], 'TimerFlag' : [ 0x2, ['short']], 'TimerList' : [ 0x4, ['_LIST_ENTRY']], 'TimerRoutine' : [ 0xc, ['pointer', ['void']]], 'Context' : [ 0x10, ['pointer', ['void']]], 'DeviceObject' : [ 0x14, ['pointer', ['_DEVICE_OBJECT']]], } ], '_MI_STANDBY_STATE' : [ 0x80, { 'TransitionSharedPages' : [ 0x0, ['unsigned long']], 'TransitionSharedPagesPeak' : [ 0x4, ['array', 3, ['unsigned long']]], 'FirstDecayPage' : [ 0x10, ['unsigned long']], 'PfnDecayFreeSList' : [ 0x18, ['_SLIST_HEADER']], 'PfnRepurposeLog' : [ 0x20, ['pointer', ['_MM_PAGE_ACCESS_INFO_HEADER']]], 'AllocatePfnRepurposeDpc' : [ 0x24, ['_KDPC']], } ], '_MI_ACCESS_LOG_STATE' : [ 0x80, { 'CcAccessLog' : [ 0x0, ['pointer', ['_MM_PAGE_ACCESS_INFO_HEADER']]], 'Enabled' : [ 0x4, ['unsigned long']], 'DisableAccessLogging' : [ 0x8, ['_WORK_QUEUE_ITEM']], 'MinLoggingPriority' : [ 0x18, ['unsigned long']], 'AccessLoggingLock' : [ 0x40, ['unsigned long']], } ], '_ETW_BUFFER_QUEUE' : [ 0xc, { 'QueueHead' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'QueueTail' : [ 0x4, ['pointer', ['_SINGLE_LIST_ENTRY']]], 'QueueEntry' : [ 0x8, ['_SINGLE_LIST_ENTRY']], } ], '_ARBITER_TEST_ALLOCATION_PARAMETERS' : [ 0xc, { 'ArbitrationList' : [ 0x0, ['pointer', ['_LIST_ENTRY']]], 'AllocateFromCount' : [ 0x4, ['unsigned long']], 'AllocateFrom' : [ 0x8, ['pointer', ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], } ], '_MI_SPECIAL_POOL' : [ 0x48, { 'Lock' : [ 0x0, ['unsigned long']], 'Paged' : [ 0x8, ['_MI_PTE_CHAIN_HEAD']], 'NonPaged' : [ 0x20, ['_MI_PTE_CHAIN_HEAD']], 'PagesInUse' : [ 0x38, ['unsigned long']], 'SpecialPoolPdes' : [ 0x3c, ['_RTL_BITMAP']], } ], '_LOGGED_STREAM_CALLBACK_V2' : [ 0x4, { 'LogHandleContext' : [ 0x0, ['pointer', ['_LOG_HANDLE_CONTEXT']]], } ], '_ARBITER_QUERY_CONFLICT_PARAMETERS' : [ 0x10, { 'PhysicalDeviceObject' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], 'ConflictingResource' : [ 0x4, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'ConflictCount' : [ 0x8, ['pointer', ['unsigned long']]], 'Conflicts' : [ 0xc, ['pointer', ['pointer', ['_ARBITER_CONFLICT_INFO']]]], } ], '_POP_CURRENT_BROADCAST' : [ 0x10, { 'InProgress' : [ 0x0, ['unsigned char']], 'SystemContext' : [ 0x4, ['_SYSTEM_POWER_STATE_CONTEXT']], 'PowerAction' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject', 8: 'PowerActionDisplayOff'})]], 'DeviceState' : [ 0xc, ['pointer', ['_POP_DEVICE_SYS_STATE']]], } ], 'PEPHANDLE__' : [ 0x4, { 'unused' : [ 0x0, ['long']], } ], '_PNP_DEVICE_EVENT_LIST' : [ 0x4c, { 'Status' : [ 0x0, ['long']], 'EventQueueMutex' : [ 0x4, ['_KMUTANT']], 'Lock' : [ 0x24, ['_FAST_MUTEX']], 'List' : [ 0x44, ['_LIST_ENTRY']], } ], '_IOV_IRP_TRACE' : [ 0x40, { 'Irp' : [ 0x0, ['pointer', ['_IRP']]], 'Thread' : [ 0x4, ['pointer', ['_KTHREAD']]], 'KernelApcDisable' : [ 0x8, ['short']], 'SpecialApcDisable' : [ 0xa, ['short']], 'CombinedApcDisable' : [ 0x8, ['unsigned long']], 'Irql' : [ 0xc, ['unsigned char']], 'StackTrace' : [ 0x10, ['array', 12, ['pointer', ['void']]]], } ], '_MAILSLOT_CREATE_PARAMETERS' : [ 0x18, { 'MailslotQuota' : [ 0x0, ['unsigned long']], 'MaximumMessageSize' : [ 0x4, ['unsigned long']], 'ReadTimeout' : [ 0x8, ['_LARGE_INTEGER']], 'TimeoutSpecified' : [ 0x10, ['unsigned char']], } ], '_PO_IRP_MANAGER' : [ 0x10, { 'DeviceIrpQueue' : [ 0x0, ['_PO_IRP_QUEUE']], 'SystemIrpQueue' : [ 0x8, ['_PO_IRP_QUEUE']], } ], '_SEP_LOWBOX_HANDLES_TABLE' : [ 0x8, { 'Lock' : [ 0x0, ['_EX_PUSH_LOCK']], 'HashTable' : [ 0x4, ['pointer', ['_RTL_DYNAMIC_HASH_TABLE']]], } ], '_PPM_FFH_THROTTLE_STATE_INFO' : [ 0x20, { 'EnableLogging' : [ 0x0, ['unsigned char']], 'MismatchCount' : [ 0x4, ['unsigned long']], 'Initialized' : [ 0x8, ['unsigned char']], 'LastValue' : [ 0x10, ['unsigned long long']], 'LastLogTickCount' : [ 0x18, ['_LARGE_INTEGER']], } ], '_PROC_IDLE_POLICY' : [ 0x5, { 'PromotePercent' : [ 0x0, ['unsigned char']], 'DemotePercent' : [ 0x1, ['unsigned char']], 'PromotePercentBase' : [ 0x2, ['unsigned char']], 'DemotePercentBase' : [ 0x3, ['unsigned char']], 'AllowScaling' : [ 0x4, ['unsigned char']], } ], '_CLIENT_ID64' : [ 0x10, { 'UniqueProcess' : [ 0x0, ['unsigned long long']], 'UniqueThread' : [ 0x8, ['unsigned long long']], } ], '__unnamed_2624' : [ 0x4, { 'PercentLevel' : [ 0x0, ['unsigned long']], } ], '__unnamed_2626' : [ 0x4, { 'Type' : [ 0x0, ['unsigned long']], } ], '_POP_ACTION_TRIGGER' : [ 0x10, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PolicyDeviceSystemButton', 1: 'PolicyDeviceThermalZone', 2: 'PolicyDeviceBattery', 3: 'PolicyDeviceMemory', 4: 'PolicyInitiatePowerActionAPI', 5: 'PolicySetPowerStateAPI', 6: 'PolicyImmediateDozeS4', 7: 'PolicySystemIdle', 8: 'PolicyDeviceWakeAlarm', 9: 'PolicyDeviceFan', 10: 'PolicyCsBatterySaver', 11: 'PolicyDeviceMax'})]], 'Flags' : [ 0x4, ['unsigned long']], 'Wait' : [ 0x8, ['pointer', ['_POP_TRIGGER_WAIT']]], 'Battery' : [ 0xc, ['__unnamed_2624']], 'Button' : [ 0xc, ['__unnamed_2626']], } ], '_KDPC_DATA' : [ 0x18, { 'DpcList' : [ 0x0, ['_KDPC_LIST']], 'DpcLock' : [ 0x8, ['unsigned long']], 'DpcQueueDepth' : [ 0xc, ['long']], 'DpcCount' : [ 0x10, ['unsigned long']], 'ActiveDpc' : [ 0x14, ['pointer', ['_KDPC']]], } ], '_NAMED_PIPE_CREATE_PARAMETERS' : [ 0x28, { 'NamedPipeType' : [ 0x0, ['unsigned long']], 'ReadMode' : [ 0x4, ['unsigned long']], 'CompletionMode' : [ 0x8, ['unsigned long']], 'MaximumInstances' : [ 0xc, ['unsigned long']], 'InboundQuota' : [ 0x10, ['unsigned long']], 'OutboundQuota' : [ 0x14, ['unsigned long']], 'DefaultTimeout' : [ 0x18, ['_LARGE_INTEGER']], 'TimeoutSpecified' : [ 0x20, ['unsigned char']], } ], '_CM_BIG_DATA' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned short']], 'Count' : [ 0x2, ['unsigned short']], 'List' : [ 0x4, ['unsigned long']], } ], '_KSCB' : [ 0xf8, { 'GenerationCycles' : [ 0x0, ['unsigned long long']], 'MinQuotaCycleTarget' : [ 0x8, ['unsigned long long']], 'MaxQuotaCycleTarget' : [ 0x10, ['unsigned long long']], 'RankCycleTarget' : [ 0x18, ['unsigned long long']], 'LongTermCycles' : [ 0x20, ['unsigned long long']], 'LastReportedCycles' : [ 0x28, ['unsigned long long']], 'OverQuotaHistory' : [ 0x30, ['unsigned long long']], 'ReadyTime' : [ 0x38, ['unsigned long long']], 'InsertTime' : [ 0x40, ['unsigned long long']], 'PerProcessorList' : [ 0x48, ['_LIST_ENTRY']], 'QueueNode' : [ 0x50, ['_RTL_BALANCED_NODE']], 'Inserted' : [ 0x5c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'MaxOverQuota' : [ 0x5c, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'MinOverQuota' : [ 0x5c, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'RankBias' : [ 0x5c, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'SoftCap' : [ 0x5c, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'Spare1' : [ 0x5c, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned char')]], 'Depth' : [ 0x5d, ['unsigned char']], 'ReadySummary' : [ 0x5e, ['unsigned short']], 'Rank' : [ 0x60, ['unsigned long']], 'ReadyListHead' : [ 0x64, ['array', 16, ['_LIST_ENTRY']]], 'ChildScbQueue' : [ 0xe4, ['_RTL_RB_TREE']], 'Parent' : [ 0xec, ['pointer', ['_KSCB']]], 'Root' : [ 0xf0, ['pointer', ['_KSCB']]], } ], '__unnamed_2635' : [ 0x8, { 'UserData' : [ 0x0, ['pointer', ['void']]], 'Owner' : [ 0x4, ['pointer', ['void']]], } ], '__unnamed_2636' : [ 0x8, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], } ], '_RTLP_RANGE_LIST_ENTRY' : [ 0x28, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], 'Allocated' : [ 0x10, ['__unnamed_2635']], 'Merged' : [ 0x10, ['__unnamed_2636']], 'Attributes' : [ 0x18, ['unsigned char']], 'PublicFlags' : [ 0x19, ['unsigned char']], 'PrivateFlags' : [ 0x1a, ['unsigned short']], 'ListEntry' : [ 0x1c, ['_LIST_ENTRY']], } ], '_ALPC_COMPLETION_PACKET_LOOKASIDE_ENTRY' : [ 0xc, { 'ListEntry' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'Packet' : [ 0x4, ['pointer', ['_IO_MINI_COMPLETION_PACKET_USER']]], 'Lookaside' : [ 0x8, ['pointer', ['_ALPC_COMPLETION_PACKET_LOOKASIDE']]], } ], '_PROC_PERF_HISTORY' : [ 0x24, { 'Count' : [ 0x0, ['unsigned long']], 'Slot' : [ 0x4, ['unsigned long']], 'UtilityTotal' : [ 0x8, ['unsigned long']], 'AffinitizedUtilityTotal' : [ 0xc, ['unsigned long']], 'FrequencyTotal' : [ 0x10, ['unsigned long']], 'TaggedPercentTotal' : [ 0x14, ['array', 2, ['unsigned long']]], 'HistoryList' : [ 0x1c, ['array', 1, ['_PROC_PERF_HISTORY_ENTRY']]], } ], '_MI_PARTITION_ZEROING' : [ 0x2c, { 'PageEvent' : [ 0x0, ['_KEVENT']], 'ThreadActive' : [ 0x10, ['unsigned char']], 'ZeroFreePageSlistMinimum' : [ 0x14, ['long']], 'FirstReservedZeroingPte' : [ 0x18, ['pointer', ['_MMPTE']]], 'RebalanceZeroFreeWorkItem' : [ 0x1c, ['_WORK_QUEUE_ITEM']], } ], '__unnamed_2643' : [ 0x2, { 'AsUSHORT' : [ 0x0, ['unsigned short']], 'AllowScaling' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'Disabled' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 16, native_type='unsigned short')]], } ], 'PROCESSOR_IDLESTATE_POLICY' : [ 0x20, { 'Revision' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['__unnamed_2643']], 'PolicyCount' : [ 0x4, ['unsigned long']], 'Policy' : [ 0x8, ['array', 3, ['PROCESSOR_IDLESTATE_INFO']]], } ], '_ACTIVATION_CONTEXT_STACK' : [ 0x18, { 'ActiveFrame' : [ 0x0, ['pointer', ['_RTL_ACTIVATION_CONTEXT_STACK_FRAME']]], 'FrameListCache' : [ 0x4, ['_LIST_ENTRY']], 'Flags' : [ 0xc, ['unsigned long']], 'NextCookieSequenceNumber' : [ 0x10, ['unsigned long']], 'StackId' : [ 0x14, ['unsigned long']], } ], '_RTL_DRIVE_LETTER_CURDIR' : [ 0x10, { 'Flags' : [ 0x0, ['unsigned short']], 'Length' : [ 0x2, ['unsigned short']], 'TimeStamp' : [ 0x4, ['unsigned long']], 'DosPath' : [ 0x8, ['_STRING']], } ], '_PPM_IDLE_SYNCHRONIZATION_STATE' : [ 0x4, { 'AsLong' : [ 0x0, ['long']], 'RefCount' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='long')]], 'State' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], } ], '_PPM_CONCURRENCY_ACCOUNTING' : [ 0x28, { 'Lock' : [ 0x0, ['unsigned long']], 'Processors' : [ 0x4, ['unsigned long']], 'ActiveProcessors' : [ 0x8, ['unsigned long']], 'LastUpdateTime' : [ 0x10, ['unsigned long long']], 'TotalTime' : [ 0x18, ['unsigned long long']], 'AccumulatedTime' : [ 0x20, ['array', 1, ['unsigned long long']]], } ], '_DIAGNOSTIC_CONTEXT' : [ 0x10, { 'CallerType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'KernelRequester', 1: 'UserProcessRequester', 2: 'UserSharedServiceRequester'})]], 'Process' : [ 0x4, ['pointer', ['_EPROCESS']]], 'ServiceTag' : [ 0x8, ['unsigned long']], 'DeviceObject' : [ 0x4, ['pointer', ['_DEVICE_OBJECT']]], 'ReasonSize' : [ 0xc, ['unsigned long']], } ], '__unnamed_265c' : [ 0x4, { 'MissedEtwRegistration' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_265e' : [ 0x4, { 'Flags' : [ 0x0, ['__unnamed_265c']], 'Whole' : [ 0x0, ['unsigned long']], } ], '_VF_TARGET_VERIFIED_DRIVER_DATA' : [ 0xa8, { 'SuspectDriverEntry' : [ 0x0, ['pointer', ['_VF_SUSPECT_DRIVER_ENTRY']]], 'WMICallback' : [ 0x4, ['pointer', ['void']]], 'EtwHandlesListHead' : [ 0x8, ['_LIST_ENTRY']], 'u1' : [ 0x10, ['__unnamed_265e']], 'Signature' : [ 0x14, ['unsigned long']], 'PoolPageHeaders' : [ 0x18, ['_SLIST_HEADER']], 'PoolTrackers' : [ 0x20, ['_SLIST_HEADER']], 'CurrentPagedPoolAllocations' : [ 0x28, ['unsigned long']], 'CurrentNonPagedPoolAllocations' : [ 0x2c, ['unsigned long']], 'PeakPagedPoolAllocations' : [ 0x30, ['unsigned long']], 'PeakNonPagedPoolAllocations' : [ 0x34, ['unsigned long']], 'PagedBytes' : [ 0x38, ['unsigned long']], 'NonPagedBytes' : [ 0x3c, ['unsigned long']], 'PeakPagedBytes' : [ 0x40, ['unsigned long']], 'PeakNonPagedBytes' : [ 0x44, ['unsigned long']], 'RaiseIrqls' : [ 0x48, ['unsigned long']], 'AcquireSpinLocks' : [ 0x4c, ['unsigned long']], 'SynchronizeExecutions' : [ 0x50, ['unsigned long']], 'AllocationsWithNoTag' : [ 0x54, ['unsigned long']], 'AllocationsFailed' : [ 0x58, ['unsigned long']], 'AllocationsFailedDeliberately' : [ 0x5c, ['unsigned long']], 'LockedBytes' : [ 0x60, ['unsigned long']], 'PeakLockedBytes' : [ 0x64, ['unsigned long']], 'MappedLockedBytes' : [ 0x68, ['unsigned long']], 'PeakMappedLockedBytes' : [ 0x6c, ['unsigned long']], 'MappedIoSpaceBytes' : [ 0x70, ['unsigned long']], 'PeakMappedIoSpaceBytes' : [ 0x74, ['unsigned long']], 'PagesForMdlBytes' : [ 0x78, ['unsigned long']], 'PeakPagesForMdlBytes' : [ 0x7c, ['unsigned long']], 'ContiguousMemoryBytes' : [ 0x80, ['unsigned long']], 'PeakContiguousMemoryBytes' : [ 0x84, ['unsigned long']], 'ContiguousMemoryListHead' : [ 0x88, ['_LIST_ENTRY']], 'ExecutePoolTypes' : [ 0x90, ['unsigned long']], 'ExecutePageProtections' : [ 0x94, ['unsigned long']], 'ExecutePageMappings' : [ 0x98, ['unsigned long']], 'ExecuteWriteSections' : [ 0x9c, ['unsigned long']], 'SectionAlignmentFailures' : [ 0xa0, ['unsigned long']], } ], '_TRIAGE_DEVICE_NODE' : [ 0x2c, { 'Sibling' : [ 0x0, ['pointer', ['_TRIAGE_DEVICE_NODE']]], 'Child' : [ 0x4, ['pointer', ['_TRIAGE_DEVICE_NODE']]], 'Parent' : [ 0x8, ['pointer', ['_TRIAGE_DEVICE_NODE']]], 'LastChild' : [ 0xc, ['pointer', ['_TRIAGE_DEVICE_NODE']]], 'PhysicalDeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'InstancePath' : [ 0x14, ['_UNICODE_STRING']], 'ServiceName' : [ 0x1c, ['_UNICODE_STRING']], 'PendingIrp' : [ 0x24, ['pointer', ['_IRP']]], 'FxDevice' : [ 0x28, ['pointer', ['_TRIAGE_POP_FX_DEVICE']]], } ], '_PRIVATE_CACHE_MAP' : [ 0x68, { 'NodeTypeCode' : [ 0x0, ['short']], 'Flags' : [ 0x0, ['_PRIVATE_CACHE_MAP_FLAGS']], 'ReadAheadMask' : [ 0x4, ['unsigned long']], 'FileObject' : [ 0x8, ['pointer', ['_FILE_OBJECT']]], 'FileOffset1' : [ 0x10, ['_LARGE_INTEGER']], 'BeyondLastByte1' : [ 0x18, ['_LARGE_INTEGER']], 'FileOffset2' : [ 0x20, ['_LARGE_INTEGER']], 'BeyondLastByte2' : [ 0x28, ['_LARGE_INTEGER']], 'SequentialReadCount' : [ 0x30, ['unsigned long']], 'ReadAheadLength' : [ 0x34, ['unsigned long']], 'ReadAheadOffset' : [ 0x38, ['_LARGE_INTEGER']], 'ReadAheadBeyondLastByte' : [ 0x40, ['_LARGE_INTEGER']], 'PrevReadAheadBeyondLastByte' : [ 0x48, ['unsigned long long']], 'ReadAheadSpinLock' : [ 0x50, ['unsigned long']], 'PipelinedReadAheadRequestSize' : [ 0x54, ['unsigned long']], 'ReadAheadGrowth' : [ 0x58, ['unsigned long']], 'PrivateLinks' : [ 0x5c, ['_LIST_ENTRY']], 'ReadAheadWorkItem' : [ 0x64, ['pointer', ['void']]], } ], '_CM_KEY_NODE' : [ 0x50, { 'Signature' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'LastWriteTime' : [ 0x4, ['_LARGE_INTEGER']], 'AccessBits' : [ 0xc, ['unsigned long']], 'Parent' : [ 0x10, ['unsigned long']], 'SubKeyCounts' : [ 0x14, ['array', 2, ['unsigned long']]], 'SubKeyLists' : [ 0x1c, ['array', 2, ['unsigned long']]], 'ValueList' : [ 0x24, ['_CHILD_LIST']], 'ChildHiveReference' : [ 0x1c, ['_CM_KEY_REFERENCE']], 'Security' : [ 0x2c, ['unsigned long']], 'Class' : [ 0x30, ['unsigned long']], 'MaxNameLen' : [ 0x34, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'UserFlags' : [ 0x34, ['BitField', dict(start_bit = 16, end_bit = 20, native_type='unsigned long')]], 'VirtControlFlags' : [ 0x34, ['BitField', dict(start_bit = 20, end_bit = 24, native_type='unsigned long')]], 'Debug' : [ 0x34, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], 'MaxClassLen' : [ 0x38, ['unsigned long']], 'MaxValueNameLen' : [ 0x3c, ['unsigned long']], 'MaxValueDataLen' : [ 0x40, ['unsigned long']], 'WorkVar' : [ 0x44, ['unsigned long']], 'NameLength' : [ 0x48, ['unsigned short']], 'ClassLength' : [ 0x4a, ['unsigned short']], 'Name' : [ 0x4c, ['array', 1, ['wchar']]], } ], '_AER_ROOTPORT_DESCRIPTOR_FLAGS' : [ 0x2, { 'UncorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'UncorrectableErrorSeverityRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'CorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'AdvancedCapsAndControlRW' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'RootErrorCommandRW' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 16, native_type='unsigned short')]], 'AsUSHORT' : [ 0x0, ['unsigned short']], } ], '_MI_SYSTEM_IMAGE_STATE' : [ 0x64, { 'FixupLock' : [ 0x0, ['long']], 'FixupList' : [ 0x4, ['_LIST_ENTRY']], 'LoadLock' : [ 0xc, ['_KMUTANT']], 'FirstLoadEver' : [ 0x2c, ['unsigned char']], 'LargePageAll' : [ 0x2d, ['unsigned char']], 'LastPage' : [ 0x30, ['unsigned long']], 'LargePageList' : [ 0x34, ['_LIST_ENTRY']], 'BeingDeleted' : [ 0x3c, ['pointer', ['_KLDR_DATA_TABLE_ENTRY']]], 'MappingRangesPushLock' : [ 0x40, ['_EX_PUSH_LOCK']], 'MappingRanges' : [ 0x44, ['array', 2, ['pointer', ['_MI_DRIVER_VA']]]], 'PageCount' : [ 0x4c, ['unsigned long']], 'PageCounts' : [ 0x50, ['_MM_SYSTEM_PAGE_COUNTS']], 'CollidedLock' : [ 0x60, ['_EX_PUSH_LOCK']], } ], '_PTE_TRACKER' : [ 0x44, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Mdl' : [ 0x8, ['pointer', ['_MDL']]], 'Count' : [ 0xc, ['unsigned long']], 'SystemVa' : [ 0x10, ['pointer', ['void']]], 'StartVa' : [ 0x14, ['pointer', ['void']]], 'Offset' : [ 0x18, ['unsigned long']], 'Length' : [ 0x1c, ['unsigned long']], 'Page' : [ 0x20, ['unsigned long']], 'IoMapping' : [ 0x24, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Matched' : [ 0x24, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'CacheAttribute' : [ 0x24, ['BitField', dict(start_bit = 2, end_bit = 4, native_type='unsigned long')]], 'GuardPte' : [ 0x24, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Spare' : [ 0x24, ['BitField', dict(start_bit = 5, end_bit = 32, native_type='unsigned long')]], 'StackTrace' : [ 0x28, ['array', 7, ['pointer', ['void']]]], } ], '_HV_GET_CELL_CONTEXT' : [ 0x4, { 'Cell' : [ 0x0, ['unsigned long']], 'IsInTempBin' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '_KTHREAD_COUNTERS' : [ 0x1a8, { 'WaitReasonBitMap' : [ 0x0, ['unsigned long long']], 'UserData' : [ 0x8, ['pointer', ['_THREAD_PERFORMANCE_DATA']]], 'Flags' : [ 0xc, ['unsigned long']], 'ContextSwitches' : [ 0x10, ['unsigned long']], 'CycleTimeBias' : [ 0x18, ['unsigned long long']], 'HardwareCounters' : [ 0x20, ['unsigned long long']], 'HwCounter' : [ 0x28, ['array', 16, ['_COUNTER_READING']]], } ], '_SHARED_CACHE_MAP_LIST_CURSOR' : [ 0xc, { 'SharedCacheMapLinks' : [ 0x0, ['_LIST_ENTRY']], 'Flags' : [ 0x8, ['unsigned long']], } ], '__unnamed_268b' : [ 0x2, { 'SignatureLevel' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 4, native_type='unsigned short')]], 'SignatureType' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 7, native_type='unsigned short')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 16, native_type='unsigned short')]], 'EntireField' : [ 0x0, ['unsigned short']], } ], '_KLDR_DATA_TABLE_ENTRY' : [ 0x5c, { 'InLoadOrderLinks' : [ 0x0, ['_LIST_ENTRY']], 'ExceptionTable' : [ 0x8, ['pointer', ['void']]], 'ExceptionTableSize' : [ 0xc, ['unsigned long']], 'GpValue' : [ 0x10, ['pointer', ['void']]], 'NonPagedDebugInfo' : [ 0x14, ['pointer', ['_NON_PAGED_DEBUG_INFO']]], 'DllBase' : [ 0x18, ['pointer', ['void']]], 'EntryPoint' : [ 0x1c, ['pointer', ['void']]], 'SizeOfImage' : [ 0x20, ['unsigned long']], 'FullDllName' : [ 0x24, ['_UNICODE_STRING']], 'BaseDllName' : [ 0x2c, ['_UNICODE_STRING']], 'Flags' : [ 0x34, ['unsigned long']], 'LoadCount' : [ 0x38, ['unsigned short']], 'u1' : [ 0x3a, ['__unnamed_268b']], 'SectionPointer' : [ 0x3c, ['pointer', ['void']]], 'CheckSum' : [ 0x40, ['unsigned long']], 'CoverageSectionSize' : [ 0x44, ['unsigned long']], 'CoverageSection' : [ 0x48, ['pointer', ['void']]], 'LoadedImports' : [ 0x4c, ['pointer', ['void']]], 'Spare' : [ 0x50, ['pointer', ['void']]], 'SizeOfImageNotRounded' : [ 0x54, ['unsigned long']], 'TimeDateStamp' : [ 0x58, ['unsigned long']], } ], '_DBGKD_GET_VERSION64' : [ 0x28, { 'MajorVersion' : [ 0x0, ['unsigned short']], 'MinorVersion' : [ 0x2, ['unsigned short']], 'ProtocolVersion' : [ 0x4, ['unsigned char']], 'KdSecondaryVersion' : [ 0x5, ['unsigned char']], 'Flags' : [ 0x6, ['unsigned short']], 'MachineType' : [ 0x8, ['unsigned short']], 'MaxPacketType' : [ 0xa, ['unsigned char']], 'MaxStateChange' : [ 0xb, ['unsigned char']], 'MaxManipulate' : [ 0xc, ['unsigned char']], 'Simulation' : [ 0xd, ['unsigned char']], 'Unused' : [ 0xe, ['array', 1, ['unsigned short']]], 'KernBase' : [ 0x10, ['unsigned long long']], 'PsLoadedModuleList' : [ 0x18, ['unsigned long long']], 'DebuggerDataList' : [ 0x20, ['unsigned long long']], } ], '_PROC_FEEDBACK_COUNTER' : [ 0x28, { 'InstantaneousRead' : [ 0x0, ['pointer', ['void']]], 'DifferentialRead' : [ 0x0, ['pointer', ['void']]], 'LastActualCount' : [ 0x8, ['unsigned long long']], 'LastReferenceCount' : [ 0x10, ['unsigned long long']], 'CachedValue' : [ 0x18, ['unsigned long']], 'Affinitized' : [ 0x20, ['unsigned char']], 'Differential' : [ 0x21, ['unsigned char']], 'Scaling' : [ 0x22, ['unsigned char']], 'Context' : [ 0x24, ['unsigned long']], } ], '_PPM_COORDINATED_SYNCHRONIZATION' : [ 0x4, { 'AsLong' : [ 0x0, ['long']], 'EnterProcessor' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 14, native_type='unsigned long')]], 'ExitProcessor' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 28, native_type='unsigned long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 30, native_type='unsigned long')]], 'Entered' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_MI_PAGING_IO_STATE' : [ 0x38, { 'PageFileHead' : [ 0x0, ['_RTL_AVL_TREE']], 'PageFileHeadSpinLock' : [ 0x4, ['long']], 'PrefetchSeekThreshold' : [ 0x8, ['long']], 'InPageSupportSListHead' : [ 0x10, ['array', 2, ['_SLIST_HEADER']]], 'InPageSupportSListMinimum' : [ 0x20, ['array', 2, ['unsigned char']]], 'InPageSinglePages' : [ 0x24, ['unsigned long']], 'DelayPageFaults' : [ 0x28, ['long']], 'FileCompressionBoundary' : [ 0x2c, ['unsigned long']], 'MdlsAdjusted' : [ 0x30, ['unsigned char']], } ], '_PROCESSOR_PLATFORM_STATE_RESIDENCIES' : [ 0x18, { 'Count' : [ 0x0, ['unsigned long']], 'States' : [ 0x8, ['array', 1, ['_PROCESSOR_PLATFORM_STATE_RESIDENCY']]], } ], '_MI_FORCED_COMMITS' : [ 0x8, { 'Regular' : [ 0x0, ['unsigned long']], 'Wrap' : [ 0x4, ['unsigned long']], } ], '_MI_FILE_EXTENTS' : [ 0x4, { 'WaitList' : [ 0x0, ['pointer', ['_MI_FILE_EXTENTS_WAIT_BLOCK']]], } ], '_HMAP_ENTRY' : [ 0x14, { 'BlockOffset' : [ 0x0, ['unsigned long']], 'PermanentBinAddress' : [ 0x4, ['unsigned long']], 'TemporaryBinAddress' : [ 0x8, ['unsigned long']], 'TemporaryBinRundown' : [ 0xc, ['_EX_RUNDOWN_REF']], 'MemAlloc' : [ 0x10, ['unsigned long']], } ], '_RTL_ATOM_TABLE_ENTRY' : [ 0x1c, { 'HashLink' : [ 0x0, ['pointer', ['_RTL_ATOM_TABLE_ENTRY']]], 'HandleIndex' : [ 0x4, ['unsigned short']], 'Atom' : [ 0x6, ['unsigned short']], 'Reference' : [ 0x8, ['_RTL_ATOM_TABLE_REFERENCE']], 'NameLength' : [ 0x18, ['unsigned char']], 'Name' : [ 0x1a, ['array', 1, ['wchar']]], } ], '_PLATFORM_IDLE_ACCOUNTING' : [ 0x3f8, { 'ResetCount' : [ 0x0, ['unsigned long']], 'StateCount' : [ 0x4, ['unsigned long']], 'TimeUnit' : [ 0x8, ['Enumeration', dict(target = 'long', choices = {0: 'PpmIdleBucketTimeInQpc', 1: 'PpmIdleBucketTimeIn100ns', 2: 'PpmIdleBucketTimeMaximum'})]], 'StartTime' : [ 0x10, ['unsigned long long']], 'State' : [ 0x18, ['array', 1, ['_PLATFORM_IDLE_STATE_ACCOUNTING']]], } ], '_TXN_PARAMETER_BLOCK' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'TxFsContext' : [ 0x2, ['unsigned short']], 'TransactionObject' : [ 0x4, ['pointer', ['void']]], } ], '_DUAL' : [ 0x19c, { 'Length' : [ 0x0, ['unsigned long']], 'Map' : [ 0x4, ['pointer', ['_HMAP_DIRECTORY']]], 'SmallDir' : [ 0x8, ['pointer', ['_HMAP_TABLE']]], 'Guard' : [ 0xc, ['unsigned long']], 'FreeDisplay' : [ 0x10, ['array', 24, ['_FREE_DISPLAY']]], 'FreeBins' : [ 0x190, ['_LIST_ENTRY']], 'FreeSummary' : [ 0x198, ['unsigned long']], } ], '_MI_VAD_SEQUENTIAL_INFO' : [ 0x4, { 'Length' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 11, native_type='unsigned long')]], 'Vpn' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_26be' : [ 0x4, { 'ImagePteOffset' : [ 0x0, ['unsigned long']], 'TossPage' : [ 0x0, ['unsigned long']], } ], '__unnamed_26c1' : [ 0x4, { 'e1' : [ 0x0, ['_MMINPAGE_FLAGS']], 'LongFlags' : [ 0x0, ['unsigned long']], } ], '_MMINPAGE_SUPPORT' : [ 0xf8, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'ListHead' : [ 0x8, ['_LIST_ENTRY']], 'Event' : [ 0x10, ['_KEVENT']], 'CollidedEvent' : [ 0x20, ['_KEVENT']], 'IoStatus' : [ 0x30, ['_IO_STATUS_BLOCK']], 'ReadOffset' : [ 0x38, ['_LARGE_INTEGER']], 'ApcState' : [ 0x40, ['_KAPC_STATE']], 'Thread' : [ 0x58, ['pointer', ['_ETHREAD']]], 'LockedProtoPfn' : [ 0x5c, ['pointer', ['_MMPFN']]], 'PteContents' : [ 0x60, ['_MMPTE']], 'WaitCount' : [ 0x68, ['long']], 'ByteCount' : [ 0x6c, ['unsigned long']], 'u3' : [ 0x70, ['__unnamed_26be']], 'u1' : [ 0x74, ['__unnamed_26c1']], 'FilePointer' : [ 0x78, ['pointer', ['_FILE_OBJECT']]], 'ControlArea' : [ 0x7c, ['pointer', ['_CONTROL_AREA']]], 'Subsection' : [ 0x7c, ['pointer', ['_SUBSECTION']]], 'Autoboost' : [ 0x80, ['pointer', ['void']]], 'FaultingAddress' : [ 0x84, ['pointer', ['void']]], 'PointerPte' : [ 0x88, ['pointer', ['_MMPTE']]], 'BasePte' : [ 0x8c, ['pointer', ['_MMPTE']]], 'Pfn' : [ 0x90, ['pointer', ['_MMPFN']]], 'PrefetchMdl' : [ 0x94, ['pointer', ['_MDL']]], 'Mdl' : [ 0x98, ['_MDL']], 'Page' : [ 0xb4, ['array', 16, ['unsigned long']]], 'FlowThrough' : [ 0xb4, ['_MMINPAGE_SUPPORT_FLOW_THROUGH']], } ], '_HAL_NODE_RANGE' : [ 0x8, { 'PageFrameIndex' : [ 0x0, ['unsigned long']], 'Node' : [ 0x4, ['unsigned long']], } ], '_MMCLONE_BLOCK' : [ 0x10, { 'ProtoPte' : [ 0x0, ['_MMPTE']], 'CloneCommitCount' : [ 0x8, ['unsigned long']], 'u1' : [ 0x8, ['_MI_CLONE_BLOCK_FLAGS']], 'CloneRefCount' : [ 0xc, ['unsigned long']], } ], '_PNP_DEVICE_ACTION_ENTRY' : [ 0x30, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'DeviceObject' : [ 0x8, ['pointer', ['_DEVICE_OBJECT']]], 'RequestType' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'AssignResources', 1: 'ClearDeviceProblem', 2: 'ClearProblem', 3: 'ClearEjectProblem', 4: 'HaltDevice', 5: 'QueryPowerRelations', 6: 'Rebalance', 7: 'ReenumerateBootDevices', 8: 'ReenumerateDeviceOnly', 9: 'ReenumerateDeviceTree', 10: 'ReenumerateRootDevices', 11: 'RequeryDeviceState', 12: 'ResetDevice', 13: 'ResourceRequirementsChanged', 14: 'RestartEnumeration', 15: 'SetDeviceProblem', 16: 'StartDevice', 17: 'StartSystemDevicesPass0', 18: 'StartSystemDevicesPass1', 19: 'NotifyTransportRelationsChange', 20: 'NotifyEjectionRelationsChange', 21: 'ConfigureDevice', 22: 'ConfigureDeviceClass', 23: 'ConfigureDeviceExtensions', 24: 'ConfigureDeviceReset'})]], 'ReorderingBarrier' : [ 0x10, ['unsigned char']], 'RequestArgument' : [ 0x14, ['unsigned long']], 'CompletionEvent' : [ 0x18, ['pointer', ['_KEVENT']]], 'CompletionStatus' : [ 0x1c, ['pointer', ['long']]], 'ActivityId' : [ 0x20, ['_GUID']], } ], '_SEP_LOWBOX_NUMBER_ENTRY' : [ 0x1c, { 'HashEntry' : [ 0x0, ['_RTL_DYNAMIC_HASH_TABLE_ENTRY']], 'ReferenceCount' : [ 0xc, ['long']], 'PackageSid' : [ 0x10, ['pointer', ['void']]], 'LowboxNumber' : [ 0x14, ['unsigned long']], 'AtomTable' : [ 0x18, ['pointer', ['void']]], } ], '_MI_LDW_WORK_CONTEXT' : [ 0x20, { 'WorkItem' : [ 0x0, ['_WORK_QUEUE_ITEM']], 'FileObject' : [ 0x10, ['pointer', ['_FILE_OBJECT']]], 'ErrorStatus' : [ 0x14, ['long']], 'Active' : [ 0x18, ['long']], 'FreeWhenDone' : [ 0x1c, ['unsigned char']], } ], '_MI_CFG_BITMAP_INFO' : [ 0xc, { 'BaseAddress' : [ 0x0, ['pointer', ['void']]], 'RegionSize' : [ 0x4, ['unsigned long']], 'BitmapVad' : [ 0x8, ['pointer', ['_MMVAD']]], } ], '_COUNTER_READING' : [ 0x18, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PMCCounter', 1: 'MaxHardwareCounterType'})]], 'Index' : [ 0x4, ['unsigned long']], 'Start' : [ 0x8, ['unsigned long long']], 'Total' : [ 0x10, ['unsigned long long']], } ], '_MI_SHUTDOWN_STATE' : [ 0x4c, { 'StandbyListDiscard' : [ 0x0, ['unsigned long']], 'CrashDumpInitialized' : [ 0x4, ['unsigned char']], 'ConnectedStandbyActive' : [ 0x5, ['unsigned char']], 'SystemShutdown' : [ 0x8, ['unsigned long']], 'ShutdownFlushInProgress' : [ 0xc, ['long']], 'ResumeItem' : [ 0x10, ['_MI_RESUME_WORKITEM']], 'FreeListDiscard' : [ 0x30, ['unsigned char']], 'MirrorHoldsPfn' : [ 0x34, ['pointer', ['_ETHREAD']]], 'MirroringActive' : [ 0x38, ['unsigned long']], 'MirrorBitMap' : [ 0x3c, ['pointer', ['_RTL_BITMAP']]], 'MirrorBitMapInterlocked' : [ 0x40, ['pointer', ['_RTL_BITMAP']]], 'MirrorListLocks' : [ 0x44, ['pointer', ['void']]], 'CrashDumpPte' : [ 0x48, ['pointer', ['_MMPTE']]], } ], '_SECTION_IMAGE_INFORMATION' : [ 0x30, { 'TransferAddress' : [ 0x0, ['pointer', ['void']]], 'ZeroBits' : [ 0x4, ['unsigned long']], 'MaximumStackSize' : [ 0x8, ['unsigned long']], 'CommittedStackSize' : [ 0xc, ['unsigned long']], 'SubSystemType' : [ 0x10, ['unsigned long']], 'SubSystemMinorVersion' : [ 0x14, ['unsigned short']], 'SubSystemMajorVersion' : [ 0x16, ['unsigned short']], 'SubSystemVersion' : [ 0x14, ['unsigned long']], 'MajorOperatingSystemVersion' : [ 0x18, ['unsigned short']], 'MinorOperatingSystemVersion' : [ 0x1a, ['unsigned short']], 'OperatingSystemVersion' : [ 0x18, ['unsigned long']], 'ImageCharacteristics' : [ 0x1c, ['unsigned short']], 'DllCharacteristics' : [ 0x1e, ['unsigned short']], 'Machine' : [ 0x20, ['unsigned short']], 'ImageContainsCode' : [ 0x22, ['unsigned char']], 'ImageFlags' : [ 0x23, ['unsigned char']], 'ComPlusNativeReady' : [ 0x23, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'ComPlusILOnly' : [ 0x23, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'ImageDynamicallyRelocated' : [ 0x23, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'ImageMappedFlat' : [ 0x23, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'BaseBelow4gb' : [ 0x23, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'ComPlusPrefer32bit' : [ 0x23, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'Reserved' : [ 0x23, ['BitField', dict(start_bit = 6, end_bit = 8, native_type='unsigned char')]], 'LoaderFlags' : [ 0x24, ['unsigned long']], 'ImageFileSize' : [ 0x28, ['unsigned long']], 'CheckSum' : [ 0x2c, ['unsigned long']], } ], '_ETW_REG_ENTRY' : [ 0x3c, { 'RegList' : [ 0x0, ['_LIST_ENTRY']], 'GroupRegList' : [ 0x8, ['_LIST_ENTRY']], 'GuidEntry' : [ 0x10, ['pointer', ['_ETW_GUID_ENTRY']]], 'GroupEntry' : [ 0x14, ['pointer', ['_ETW_GUID_ENTRY']]], 'ReplyQueue' : [ 0x18, ['pointer', ['_ETW_REPLY_QUEUE']]], 'ReplySlot' : [ 0x18, ['array', 4, ['pointer', ['_ETW_QUEUE_ENTRY']]]], 'Caller' : [ 0x18, ['pointer', ['void']]], 'SessionId' : [ 0x1c, ['unsigned long']], 'Process' : [ 0x28, ['pointer', ['_EPROCESS']]], 'CallbackContext' : [ 0x28, ['pointer', ['void']]], 'Callback' : [ 0x2c, ['pointer', ['void']]], 'Index' : [ 0x30, ['unsigned short']], 'Flags' : [ 0x32, ['unsigned char']], 'DbgKernelRegistration' : [ 0x32, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'DbgUserRegistration' : [ 0x32, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'DbgReplyRegistration' : [ 0x32, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'DbgClassicRegistration' : [ 0x32, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'DbgSessionSpaceRegistration' : [ 0x32, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'DbgModernRegistration' : [ 0x32, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'DbgClosed' : [ 0x32, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'DbgInserted' : [ 0x32, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'EnableMask' : [ 0x33, ['unsigned char']], 'GroupEnableMask' : [ 0x34, ['unsigned char']], 'UseDescriptorType' : [ 0x35, ['unsigned char']], 'Traits' : [ 0x38, ['pointer', ['_ETW_PROVIDER_TRAITS']]], } ], '_LPCP_PORT_OBJECT' : [ 0xa4, { 'ConnectionPort' : [ 0x0, ['pointer', ['_LPCP_PORT_OBJECT']]], 'ConnectedPort' : [ 0x4, ['pointer', ['_LPCP_PORT_OBJECT']]], 'MsgQueue' : [ 0x8, ['_LPCP_PORT_QUEUE']], 'Creator' : [ 0x18, ['_CLIENT_ID']], 'ClientSectionBase' : [ 0x20, ['pointer', ['void']]], 'ServerSectionBase' : [ 0x24, ['pointer', ['void']]], 'PortContext' : [ 0x28, ['pointer', ['void']]], 'ClientThread' : [ 0x2c, ['pointer', ['_ETHREAD']]], 'SecurityQos' : [ 0x30, ['_SECURITY_QUALITY_OF_SERVICE']], 'StaticSecurity' : [ 0x3c, ['_SECURITY_CLIENT_CONTEXT']], 'LpcReplyChainHead' : [ 0x78, ['_LIST_ENTRY']], 'LpcDataInfoChainHead' : [ 0x80, ['_LIST_ENTRY']], 'ServerProcess' : [ 0x88, ['pointer', ['_EPROCESS']]], 'MappingProcess' : [ 0x88, ['pointer', ['_EPROCESS']]], 'MaxMessageLength' : [ 0x8c, ['unsigned short']], 'MaxConnectionInfoLength' : [ 0x8e, ['unsigned short']], 'Flags' : [ 0x90, ['unsigned long']], 'WaitEvent' : [ 0x94, ['_KEVENT']], } ], '_HVIEW_MAP_PIN_LOG' : [ 0x308, { 'Next' : [ 0x0, ['unsigned long']], 'Size' : [ 0x4, ['unsigned long']], 'Entries' : [ 0x8, ['array', 16, ['_HVIEW_MAP_PIN_LOG_ENTRY']]], } ], '_ARBITER_LIST_ENTRY' : [ 0x38, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'AlternativeCount' : [ 0x8, ['unsigned long']], 'Alternatives' : [ 0xc, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'PhysicalDeviceObject' : [ 0x10, ['pointer', ['_DEVICE_OBJECT']]], 'RequestSource' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'ArbiterRequestLegacyReported', 1: 'ArbiterRequestHalReported', 2: 'ArbiterRequestLegacyAssigned', 3: 'ArbiterRequestPnpDetected', 4: 'ArbiterRequestPnpEnumerated', -1: 'ArbiterRequestUndefined'})]], 'Flags' : [ 0x18, ['unsigned long']], 'WorkSpace' : [ 0x1c, ['long']], 'InterfaceType' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'Internal', 1: 'Isa', 2: 'Eisa', 3: 'MicroChannel', 4: 'TurboChannel', 5: 'PCIBus', 6: 'VMEBus', 7: 'NuBus', 8: 'PCMCIABus', 9: 'CBus', 10: 'MPIBus', 11: 'MPSABus', 12: 'ProcessorInternal', 13: 'InternalPowerBus', 14: 'PNPISABus', 15: 'PNPBus', 16: 'Vmcs', 17: 'ACPIBus', 18: 'MaximumInterfaceType', -1: 'InterfaceTypeUndefined'})]], 'SlotNumber' : [ 0x24, ['unsigned long']], 'BusNumber' : [ 0x28, ['unsigned long']], 'Assignment' : [ 0x2c, ['pointer', ['_CM_PARTIAL_RESOURCE_DESCRIPTOR']]], 'SelectedAlternative' : [ 0x30, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'Result' : [ 0x34, ['Enumeration', dict(target = 'long', choices = {0: 'ArbiterResultSuccess', 1: 'ArbiterResultExternalConflict', 2: 'ArbiterResultNullRequest', -1: 'ArbiterResultUndefined'})]], } ], '_MI_PROBE_RAISE_TRACKER' : [ 0x3c, { 'UserRangeInKernel' : [ 0x0, ['unsigned long']], 'FaultFailed' : [ 0x4, ['unsigned long']], 'WriteFaultFailed' : [ 0x8, ['unsigned long']], 'LargePageFailed' : [ 0xc, ['unsigned long']], 'UserAccessToKernelPte' : [ 0x10, ['unsigned long']], 'BadPageLocation' : [ 0x14, ['unsigned long']], 'InsufficientCharge' : [ 0x18, ['unsigned long']], 'PageTableCharge' : [ 0x1c, ['unsigned long']], 'NoPhysicalMapping' : [ 0x20, ['unsigned long']], 'NoIoReference' : [ 0x24, ['unsigned long']], 'ProbeFailed' : [ 0x28, ['unsigned long']], 'PteIsZero' : [ 0x2c, ['unsigned long']], 'StrongCodeWrite' : [ 0x30, ['unsigned long']], 'ReducedCloneCommitChargeFailed' : [ 0x34, ['unsigned long']], 'CopyOnWriteAtDispatchNoPages' : [ 0x38, ['unsigned long']], } ], '_ETW_PROVIDER_TRAITS' : [ 0x14, { 'Node' : [ 0x0, ['_RTL_BALANCED_NODE']], 'ReferenceCount' : [ 0xc, ['unsigned long']], 'Traits' : [ 0x10, ['array', 1, ['unsigned char']]], } ], '_INTERRUPT_CONNECTION_DATA' : [ 0x50, { 'Count' : [ 0x0, ['unsigned long']], 'Vectors' : [ 0x8, ['array', 1, ['_INTERRUPT_VECTOR_DATA']]], } ], '_MI_CLONE_BLOCK_FLAGS' : [ 0x4, { 'ActualCloneCommit' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 27, native_type='unsigned long')]], 'CloneProtection' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 32, native_type='unsigned long')]], } ], '_LDR_DATA_TABLE_ENTRY' : [ 0xa0, { 'InLoadOrderLinks' : [ 0x0, ['_LIST_ENTRY']], 'InMemoryOrderLinks' : [ 0x8, ['_LIST_ENTRY']], 'InInitializationOrderLinks' : [ 0x10, ['_LIST_ENTRY']], 'DllBase' : [ 0x18, ['pointer', ['void']]], 'EntryPoint' : [ 0x1c, ['pointer', ['void']]], 'SizeOfImage' : [ 0x20, ['unsigned long']], 'FullDllName' : [ 0x24, ['_UNICODE_STRING']], 'BaseDllName' : [ 0x2c, ['_UNICODE_STRING']], 'FlagGroup' : [ 0x34, ['array', 4, ['unsigned char']]], 'Flags' : [ 0x34, ['unsigned long']], 'PackagedBinary' : [ 0x34, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'MarkedForRemoval' : [ 0x34, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ImageDll' : [ 0x34, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'LoadNotificationsSent' : [ 0x34, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'TelemetryEntryProcessed' : [ 0x34, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'ProcessStaticImport' : [ 0x34, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'InLegacyLists' : [ 0x34, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'InIndexes' : [ 0x34, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'ShimDll' : [ 0x34, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'InExceptionTable' : [ 0x34, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'ReservedFlags1' : [ 0x34, ['BitField', dict(start_bit = 10, end_bit = 12, native_type='unsigned long')]], 'LoadInProgress' : [ 0x34, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'LoadConfigProcessed' : [ 0x34, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'EntryProcessed' : [ 0x34, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'ProtectDelayLoad' : [ 0x34, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'ReservedFlags3' : [ 0x34, ['BitField', dict(start_bit = 16, end_bit = 18, native_type='unsigned long')]], 'DontCallForThreads' : [ 0x34, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'ProcessAttachCalled' : [ 0x34, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'ProcessAttachFailed' : [ 0x34, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'CorDeferredValidate' : [ 0x34, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'CorImage' : [ 0x34, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'DontRelocate' : [ 0x34, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'CorILOnly' : [ 0x34, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'ReservedFlags5' : [ 0x34, ['BitField', dict(start_bit = 25, end_bit = 28, native_type='unsigned long')]], 'Redirected' : [ 0x34, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'ReservedFlags6' : [ 0x34, ['BitField', dict(start_bit = 29, end_bit = 31, native_type='unsigned long')]], 'CompatDatabaseProcessed' : [ 0x34, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'ObsoleteLoadCount' : [ 0x38, ['unsigned short']], 'TlsIndex' : [ 0x3a, ['unsigned short']], 'HashLinks' : [ 0x3c, ['_LIST_ENTRY']], 'TimeDateStamp' : [ 0x44, ['unsigned long']], 'EntryPointActivationContext' : [ 0x48, ['pointer', ['_ACTIVATION_CONTEXT']]], 'Lock' : [ 0x4c, ['pointer', ['void']]], 'DdagNode' : [ 0x50, ['pointer', ['_LDR_DDAG_NODE']]], 'NodeModuleLink' : [ 0x54, ['_LIST_ENTRY']], 'LoadContext' : [ 0x5c, ['pointer', ['_LDRP_LOAD_CONTEXT']]], 'ParentDllBase' : [ 0x60, ['pointer', ['void']]], 'SwitchBackContext' : [ 0x64, ['pointer', ['void']]], 'BaseAddressIndexNode' : [ 0x68, ['_RTL_BALANCED_NODE']], 'MappingInfoIndexNode' : [ 0x74, ['_RTL_BALANCED_NODE']], 'OriginalBase' : [ 0x80, ['unsigned long']], 'LoadTime' : [ 0x88, ['_LARGE_INTEGER']], 'BaseNameHashValue' : [ 0x90, ['unsigned long']], 'LoadReason' : [ 0x94, ['Enumeration', dict(target = 'long', choices = {0: 'LoadReasonStaticDependency', 1: 'LoadReasonStaticForwarderDependency', 2: 'LoadReasonDynamicForwarderDependency', 3: 'LoadReasonDelayloadDependency', 4: 'LoadReasonDynamicLoad', 5: 'LoadReasonAsImageLoad', 6: 'LoadReasonAsDataLoad', -1: 'LoadReasonUnknown'})]], 'ImplicitPathOptions' : [ 0x98, ['unsigned long']], 'ReferenceCount' : [ 0x9c, ['unsigned long']], } ], '_CACHED_KSTACK_LIST' : [ 0x18, { 'SListHead' : [ 0x0, ['_SLIST_HEADER']], 'MinimumFree' : [ 0x8, ['long']], 'Misses' : [ 0xc, ['unsigned long']], 'MissesLast' : [ 0x10, ['unsigned long']], 'AllStacksInUse' : [ 0x14, ['unsigned long']], } ], '_MMINPAGE_FLAGS' : [ 0x4, { 'InjectRetry' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'CrossThreadPadding' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 8, native_type='unsigned char')]], 'PrefetchSystemVmType' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 2, native_type='unsigned char')]], 'VaPrefetchReadBlock' : [ 0x1, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'CollidedFlowThrough' : [ 0x1, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'ForceCollisions' : [ 0x1, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'InPageExpanded' : [ 0x1, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'IssuedAtLowPriority' : [ 0x1, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'FaultFromStore' : [ 0x1, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'PagePriority' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned char')]], 'PerformRelocations' : [ 0x2, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'ClusteredPagePriority' : [ 0x2, ['BitField', dict(start_bit = 4, end_bit = 7, native_type='unsigned char')]], 'MakeClusterValid' : [ 0x2, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], 'ZeroLastPage' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'UserFault' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'StandbyProtectionNeeded' : [ 0x3, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'PteChanged' : [ 0x3, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'PageFileFault' : [ 0x3, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned char')]], 'PageFilePageHashActive' : [ 0x3, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned char')]], 'CoalescedIo' : [ 0x3, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned char')]], 'VmLockNotNeeded' : [ 0x3, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned char')]], } ], '_MI_DRIVER_VA' : [ 0x14, { 'Next' : [ 0x0, ['pointer', ['_MI_DRIVER_VA']]], 'PointerPte' : [ 0x4, ['pointer', ['_MMPTE']]], 'BitMap' : [ 0x8, ['_RTL_BITMAP']], 'Hint' : [ 0x10, ['unsigned long']], } ], '_LDR_DDAG_NODE' : [ 0x2c, { 'Modules' : [ 0x0, ['_LIST_ENTRY']], 'ServiceTagList' : [ 0x8, ['pointer', ['_LDR_SERVICE_TAG_RECORD']]], 'LoadCount' : [ 0xc, ['unsigned long']], 'LoadWhileUnloadingCount' : [ 0x10, ['unsigned long']], 'LowestLink' : [ 0x14, ['unsigned long']], 'Dependencies' : [ 0x18, ['_LDRP_CSLIST']], 'IncomingDependencies' : [ 0x1c, ['_LDRP_CSLIST']], 'State' : [ 0x20, ['Enumeration', dict(target = 'long', choices = {0: 'LdrModulesPlaceHolder', 1: 'LdrModulesMapping', 2: 'LdrModulesMapped', 3: 'LdrModulesWaitingForDependencies', 4: 'LdrModulesSnapping', 5: 'LdrModulesSnapped', 6: 'LdrModulesCondensed', 7: 'LdrModulesReadyToInit', 8: 'LdrModulesInitializing', 9: 'LdrModulesReadyToRun', '\xfb': 'LdrModulesMerged', '\xfd': 'LdrModulesSnapError', '\xfc': 'LdrModulesInitError', -1: 'LdrModulesUnloading', '\xfe': 'LdrModulesUnloaded'})]], 'CondenseLink' : [ 0x24, ['_SINGLE_LIST_ENTRY']], 'PreorderNumber' : [ 0x28, ['unsigned long']], } ], '_POP_DEVICE_SYS_STATE' : [ 0x104, { 'IrpMinor' : [ 0x0, ['unsigned char']], 'SystemState' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], 'SpinLock' : [ 0x8, ['unsigned long']], 'Thread' : [ 0xc, ['pointer', ['_KTHREAD']]], 'AbortEvent' : [ 0x10, ['pointer', ['_KEVENT']]], 'ReadySemaphore' : [ 0x14, ['pointer', ['_KSEMAPHORE']]], 'FinishedSemaphore' : [ 0x18, ['pointer', ['_KSEMAPHORE']]], 'Order' : [ 0x1c, ['_PO_DEVICE_NOTIFY_ORDER']], 'Pending' : [ 0xec, ['_LIST_ENTRY']], 'Status' : [ 0xf4, ['long']], 'FailedDevice' : [ 0xf8, ['pointer', ['_DEVICE_OBJECT']]], 'Waking' : [ 0xfc, ['unsigned char']], 'Cancelled' : [ 0xfd, ['unsigned char']], 'IgnoreErrors' : [ 0xfe, ['unsigned char']], 'IgnoreNotImplemented' : [ 0xff, ['unsigned char']], 'TimeRefreshLockAcquired' : [ 0x100, ['unsigned char']], } ], '_KHETERO_PROCESSOR_SET' : [ 0x8, { 'PreferredMask' : [ 0x0, ['unsigned long']], 'AvailableMask' : [ 0x4, ['unsigned long']], } ], '_VF_KE_CRITICAL_REGION_TRACE' : [ 0x20, { 'Thread' : [ 0x0, ['pointer', ['_ETHREAD']]], 'StackTrace' : [ 0x4, ['array', 7, ['pointer', ['void']]]], } ], '_LOGGED_STREAM_CALLBACK_V1' : [ 0x8, { 'LogHandle' : [ 0x0, ['pointer', ['void']]], 'FlushToLsnRoutine' : [ 0x4, ['pointer', ['void']]], } ], '_DIAGNOSTIC_BUFFER' : [ 0x18, { 'Size' : [ 0x0, ['unsigned long']], 'CallerType' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'KernelRequester', 1: 'UserProcessRequester', 2: 'UserSharedServiceRequester'})]], 'ProcessImageNameOffset' : [ 0x8, ['unsigned long']], 'ProcessId' : [ 0xc, ['unsigned long']], 'ServiceTag' : [ 0x10, ['unsigned long']], 'DeviceDescriptionOffset' : [ 0x8, ['unsigned long']], 'DevicePathOffset' : [ 0xc, ['unsigned long']], 'ReasonOffset' : [ 0x14, ['unsigned long']], } ], '_CLIENT_ID32' : [ 0x8, { 'UniqueProcess' : [ 0x0, ['unsigned long']], 'UniqueThread' : [ 0x4, ['unsigned long']], } ], '_CM_KEY_INDEX' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned short']], 'Count' : [ 0x2, ['unsigned short']], 'List' : [ 0x4, ['array', 1, ['unsigned long']]], } ], '_VI_DEADLOCK_THREAD' : [ 0x20, { 'Thread' : [ 0x0, ['pointer', ['_KTHREAD']]], 'CurrentSpinNode' : [ 0x4, ['pointer', ['_VI_DEADLOCK_NODE']]], 'CurrentOtherNode' : [ 0x8, ['pointer', ['_VI_DEADLOCK_NODE']]], 'ListEntry' : [ 0xc, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0xc, ['_LIST_ENTRY']], 'NodeCount' : [ 0x14, ['unsigned long']], 'PagingCount' : [ 0x18, ['unsigned long']], 'ThreadUsesEresources' : [ 0x1c, ['unsigned char']], } ], '_PPM_IDLE_STATE' : [ 0x40, { 'DomainMembers' : [ 0x0, ['_KAFFINITY_EX']], 'Name' : [ 0xc, ['_UNICODE_STRING']], 'Latency' : [ 0x14, ['unsigned long']], 'BreakEvenDuration' : [ 0x18, ['unsigned long']], 'Power' : [ 0x1c, ['unsigned long']], 'StateFlags' : [ 0x20, ['unsigned long']], 'VetoAccounting' : [ 0x24, ['_PPM_VETO_ACCOUNTING']], 'StateType' : [ 0x38, ['unsigned char']], 'InterruptsEnabled' : [ 0x39, ['unsigned char']], 'Interruptible' : [ 0x3a, ['unsigned char']], 'ContextRetained' : [ 0x3b, ['unsigned char']], 'CacheCoherent' : [ 0x3c, ['unsigned char']], 'WakesSpuriously' : [ 0x3d, ['unsigned char']], 'PlatformOnly' : [ 0x3e, ['unsigned char']], 'NoCState' : [ 0x3f, ['unsigned char']], } ], '_KRESOURCEMANAGER' : [ 0x154, { 'NotificationAvailable' : [ 0x0, ['_KEVENT']], 'cookie' : [ 0x10, ['unsigned long']], 'State' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'KResourceManagerUninitialized', 1: 'KResourceManagerOffline', 2: 'KResourceManagerOnline'})]], 'Flags' : [ 0x18, ['unsigned long']], 'Mutex' : [ 0x1c, ['_KMUTANT']], 'NamespaceLink' : [ 0x3c, ['_KTMOBJECT_NAMESPACE_LINK']], 'RmId' : [ 0x50, ['_GUID']], 'NotificationQueue' : [ 0x60, ['_KQUEUE']], 'NotificationMutex' : [ 0x88, ['_KMUTANT']], 'EnlistmentHead' : [ 0xa8, ['_LIST_ENTRY']], 'EnlistmentCount' : [ 0xb0, ['unsigned long']], 'NotificationRoutine' : [ 0xb4, ['pointer', ['void']]], 'Key' : [ 0xb8, ['pointer', ['void']]], 'ProtocolListHead' : [ 0xbc, ['_LIST_ENTRY']], 'PendingPropReqListHead' : [ 0xc4, ['_LIST_ENTRY']], 'CRMListEntry' : [ 0xcc, ['_LIST_ENTRY']], 'Tm' : [ 0xd4, ['pointer', ['_KTM']]], 'Description' : [ 0xd8, ['_UNICODE_STRING']], 'Enlistments' : [ 0xe0, ['_KTMOBJECT_NAMESPACE']], 'CompletionBinding' : [ 0x140, ['_KRESOURCEMANAGER_COMPLETION_BINDING']], } ], '_MI_SYSTEM_PTE_STATE' : [ 0x180, { 'DeadPteTrackerSListHead' : [ 0x0, ['_SLIST_HEADER']], 'PteTrackerLock' : [ 0x8, ['unsigned long']], 'MdlTrackerLookaside' : [ 0x40, ['_NPAGED_LOOKASIDE_LIST']], 'PteTrackingBitmap' : [ 0x100, ['_RTL_BITMAP']], 'CachedPteHeads' : [ 0x108, ['pointer', ['_MI_CACHED_PTES']]], 'SystemViewPteInfo' : [ 0x10c, ['_MI_SYSTEM_PTE_TYPE']], 'KernelStackPages' : [ 0x140, ['unsigned char']], 'QueuedStacks' : [ 0x148, ['_SLIST_HEADER']], 'StackGrowthFailures' : [ 0x150, ['unsigned long']], 'TrackPtesAborted' : [ 0x154, ['unsigned char']], 'AdjustCounter' : [ 0x155, ['unsigned char']], 'QueuedStacksWorkItem' : [ 0x158, ['_MI_QUEUED_DEADSTACK_WORKITEM']], } ], '_HANDLE_TABLE_FREE_LIST' : [ 0x34, { 'FreeListLock' : [ 0x0, ['_EX_PUSH_LOCK']], 'FirstFreeHandleEntry' : [ 0x4, ['pointer', ['_HANDLE_TABLE_ENTRY']]], 'LastFreeHandleEntry' : [ 0x8, ['pointer', ['_HANDLE_TABLE_ENTRY']]], 'HandleCount' : [ 0xc, ['long']], 'HighWaterMark' : [ 0x10, ['unsigned long']], 'Reserved' : [ 0x14, ['array', 8, ['unsigned long']]], } ], '_WHEAP_ERROR_RECORD_WRAPPER_FLAGS' : [ 0x4, { 'Preallocated' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'FromPersistentStore' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PlatformPfaControl' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'PlatformDirectedOffline' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_AGGREGATED_PAYLOAD_FILTER' : [ 0x50, { 'MagicValue' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 12, native_type='unsigned short')]], 'DescriptorVersion' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 16, native_type='unsigned short')]], 'Size' : [ 0x2, ['unsigned short']], 'PredicateCount' : [ 0x4, ['unsigned short']], 'Reserved' : [ 0x6, ['unsigned short']], 'HashedEventIdBitmap' : [ 0x8, ['unsigned long long']], 'ProviderGuid' : [ 0x10, ['_GUID']], 'EachEventTableOffset' : [ 0x20, ['unsigned short']], 'EachEventTableLength' : [ 0x22, ['unsigned short']], 'PayloadDecoderTableOffset' : [ 0x24, ['unsigned short']], 'PayloadDecoderTableLength' : [ 0x26, ['unsigned short']], 'EventFilterTableOffset' : [ 0x28, ['unsigned short']], 'EventFilterTableLength' : [ 0x2a, ['unsigned short']], 'UNICODEStringTableOffset' : [ 0x2c, ['unsigned short']], 'UNICODEStringTableLength' : [ 0x2e, ['unsigned short']], 'ANSIStringTableOffset' : [ 0x30, ['unsigned short']], 'ANSIStringTableLength' : [ 0x32, ['unsigned short']], 'PredicateTable' : [ 0x38, ['array', 1, ['_EVENT_PAYLOAD_PREDICATE']]], } ], '_GDI_TEB_BATCH64' : [ 0x4e8, { 'Offset' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 31, native_type='unsigned long')]], 'HasRenderingCommand' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'HDC' : [ 0x8, ['unsigned long long']], 'Buffer' : [ 0x10, ['array', 310, ['unsigned long']]], } ], '_PPM_POLICY_SETTINGS_MASK' : [ 0x8, { 'Value' : [ 0x0, ['unsigned long long']], 'PerfDecreaseTime' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'PerfIncreaseTime' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PerfDecreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'PerfIncreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'PerfDecreaseThreshold' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'PerfIncreaseThreshold' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'PerfMinPolicy' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'PerfMaxPolicy' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'PerfTimeCheck' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'PerfBoostPolicy' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'PerfBoostMode' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long')]], 'AllowThrottling' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long')]], 'PerfHistoryCount' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long')]], 'ParkingPerfState' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long')]], 'LatencyHintPerf' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long')]], 'LatencyHintUnpark' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 16, native_type='unsigned long')]], 'CoreParkingMinCores' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'CoreParkingMaxCores' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'CoreParkingDecreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long')]], 'CoreParkingIncreasePolicy' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long')]], 'CoreParkingDecreaseTime' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long')]], 'CoreParkingIncreaseTime' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'CoreParkingOverUtilizationThreshold' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long')]], 'CoreParkingDistributeUtility' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 24, native_type='unsigned long')]], 'CoreParkingConcurrencyThreshold' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'CoreParkingHeadroomThreshold' : [ 0x0, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'CoreParkingDistributionThreshold' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'IdleAllowScaling' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'IdleDisable' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'IdleTimeCheck' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'IdleDemoteThreshold' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'IdlePromoteThreshold' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'HeteroDecreaseTime' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'HeteroIncreaseTime' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'HeteroDecreaseThreshold' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'HeteroIncreaseThreshold' : [ 0x4, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'Class0FloorPerformance' : [ 0x4, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'Class1InitialPerformance' : [ 0x4, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'EnergyPerfPreference' : [ 0x4, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'AutonomousActivityWindow' : [ 0x4, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'AutonomousMode' : [ 0x4, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long')]], 'DutyCycling' : [ 0x4, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long')]], 'Spare' : [ 0x4, ['BitField', dict(start_bit = 10, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_275e' : [ 0x4, { 'NodeSize' : [ 0x0, ['unsigned long']], 'UseLookaside' : [ 0x0, ['unsigned long']], } ], '_VF_AVL_TREE' : [ 0x14, { 'NodeRangeSize' : [ 0x0, ['unsigned long']], 'NodeCount' : [ 0x4, ['unsigned long']], 'Tables' : [ 0x8, ['pointer', ['_VF_AVL_TABLE']]], 'TablesNo' : [ 0xc, ['unsigned long']], 'u1' : [ 0x10, ['__unnamed_275e']], } ], '_FILE_NETWORK_OPEN_INFORMATION' : [ 0x38, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LastAccessTime' : [ 0x8, ['_LARGE_INTEGER']], 'LastWriteTime' : [ 0x10, ['_LARGE_INTEGER']], 'ChangeTime' : [ 0x18, ['_LARGE_INTEGER']], 'AllocationSize' : [ 0x20, ['_LARGE_INTEGER']], 'EndOfFile' : [ 0x28, ['_LARGE_INTEGER']], 'FileAttributes' : [ 0x30, ['unsigned long']], } ], '_POP_FX_ACCOUNTING' : [ 0x28, { 'Lock' : [ 0x0, ['unsigned long']], 'Active' : [ 0x4, ['unsigned char']], 'DripsRequiredState' : [ 0x8, ['unsigned long']], 'Level' : [ 0xc, ['long']], 'ActiveStamp' : [ 0x10, ['long long']], 'CsActiveTime' : [ 0x18, ['unsigned long long']], 'CriticalActiveTime' : [ 0x20, ['long long']], } ], '_MI_RESUME_WORKITEM' : [ 0x20, { 'ResumeCompleteEvent' : [ 0x0, ['_KEVENT']], 'WorkItem' : [ 0x10, ['_WORK_QUEUE_ITEM']], } ], '_WHEA_MEMORY_ERROR_SECTION_VALIDBITS' : [ 0x8, { 'ErrorStatus' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'PhysicalAddress' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'PhysicalAddressMask' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'Node' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long long')]], 'Card' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long long')]], 'Module' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long long')]], 'Bank' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long long')]], 'Device' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long long')]], 'Row' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 9, native_type='unsigned long long')]], 'Column' : [ 0x0, ['BitField', dict(start_bit = 9, end_bit = 10, native_type='unsigned long long')]], 'BitPosition' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'RequesterId' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'ResponderId' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 13, native_type='unsigned long long')]], 'TargetId' : [ 0x0, ['BitField', dict(start_bit = 13, end_bit = 14, native_type='unsigned long long')]], 'ErrorType' : [ 0x0, ['BitField', dict(start_bit = 14, end_bit = 15, native_type='unsigned long long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 15, end_bit = 64, native_type='unsigned long long')]], 'ValidBits' : [ 0x0, ['unsigned long long']], } ], '_POP_TRIGGER_WAIT' : [ 0x20, { 'Event' : [ 0x0, ['_KEVENT']], 'Status' : [ 0x10, ['long']], 'Link' : [ 0x14, ['_LIST_ENTRY']], 'Trigger' : [ 0x1c, ['pointer', ['_POP_ACTION_TRIGGER']]], } ], '_AER_ENDPOINT_DESCRIPTOR_FLAGS' : [ 0x2, { 'UncorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'UncorrectableErrorSeverityRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'CorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'AdvancedCapsAndControlRW' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 16, native_type='unsigned short')]], 'AsUSHORT' : [ 0x0, ['unsigned short']], } ], '_TRIAGE_EX_WORK_QUEUE' : [ 0x19c, { 'WorkPriQueue' : [ 0x0, ['_KPRIQUEUE']], } ], '_HEAP_FREE_ENTRY_EXTRA' : [ 0x4, { 'TagIndex' : [ 0x0, ['unsigned short']], 'FreeBackTraceIndex' : [ 0x2, ['unsigned short']], } ], '_PROC_PERF_HISTORY_ENTRY' : [ 0x8, { 'Utility' : [ 0x0, ['unsigned short']], 'AffinitizedUtility' : [ 0x2, ['unsigned short']], 'Frequency' : [ 0x4, ['unsigned char']], 'TaggedPercent' : [ 0x5, ['array', 2, ['unsigned char']]], } ], '_POP_FX_COMPONENT' : [ 0xc0, { 'Id' : [ 0x0, ['_GUID']], 'Index' : [ 0x10, ['unsigned long']], 'WorkOrder' : [ 0x14, ['_POP_FX_WORK_ORDER']], 'Device' : [ 0x30, ['pointer', ['_POP_FX_DEVICE']]], 'Flags' : [ 0x34, ['_POP_FX_COMPONENT_FLAGS']], 'Resident' : [ 0x3c, ['long']], 'ActiveEvent' : [ 0x40, ['_KEVENT']], 'IdleLock' : [ 0x50, ['unsigned long']], 'IdleConditionComplete' : [ 0x54, ['long']], 'IdleStateComplete' : [ 0x58, ['long']], 'IdleStamp' : [ 0x60, ['unsigned long long']], 'CurrentIdleState' : [ 0x68, ['unsigned long']], 'IdleStateCount' : [ 0x6c, ['unsigned long']], 'IdleStates' : [ 0x70, ['pointer', ['_POP_FX_IDLE_STATE']]], 'DeepestWakeableIdleState' : [ 0x74, ['unsigned long']], 'ProviderCount' : [ 0x78, ['unsigned long']], 'Providers' : [ 0x7c, ['pointer', ['_POP_FX_PROVIDER']]], 'IdleProviderCount' : [ 0x80, ['unsigned long']], 'DependentCount' : [ 0x84, ['unsigned long']], 'Dependents' : [ 0x88, ['pointer', ['_POP_FX_DEPENDENT']]], 'Accounting' : [ 0x90, ['_POP_FX_ACCOUNTING']], 'Performance' : [ 0xb8, ['pointer', ['_POP_FX_PERF_INFO']]], } ], '_PEP_CRASHDUMP_INFORMATION' : [ 0x8, { 'DeviceHandle' : [ 0x0, ['pointer', ['PEPHANDLE__']]], 'DeviceContext' : [ 0x4, ['pointer', ['void']]], } ], '_POP_FX_DRIVER_CALLBACKS' : [ 0x1c, { 'ComponentActive' : [ 0x0, ['pointer', ['void']]], 'ComponentIdle' : [ 0x4, ['pointer', ['void']]], 'ComponentIdleState' : [ 0x8, ['pointer', ['void']]], 'DevicePowerRequired' : [ 0xc, ['pointer', ['void']]], 'DevicePowerNotRequired' : [ 0x10, ['pointer', ['void']]], 'PowerControl' : [ 0x14, ['pointer', ['void']]], 'ComponentCriticalTransition' : [ 0x18, ['pointer', ['void']]], } ], '_PROVIDER_BINARY_ENTRY' : [ 0x2c, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'ConsumersNotified' : [ 0x8, ['unsigned char']], 'Spare' : [ 0x9, ['array', 3, ['unsigned char']]], 'DebugIdSize' : [ 0xc, ['unsigned long']], 'DebugId' : [ 0x10, ['_CVDD']], } ], '_VI_DEADLOCK_GLOBALS' : [ 0x40f0, { 'TimeAcquire' : [ 0x0, ['long long']], 'TimeRelease' : [ 0x8, ['long long']], 'ResourceDatabase' : [ 0x10, ['pointer', ['_LIST_ENTRY']]], 'ResourceDatabaseCount' : [ 0x14, ['unsigned long']], 'ResourceAddressRange' : [ 0x18, ['array', 1023, ['_VF_ADDRESS_RANGE']]], 'ThreadDatabase' : [ 0x2010, ['pointer', ['_LIST_ENTRY']]], 'ThreadDatabaseCount' : [ 0x2014, ['unsigned long']], 'ThreadAddressRange' : [ 0x2018, ['array', 1023, ['_VF_ADDRESS_RANGE']]], 'AllocationFailures' : [ 0x4010, ['unsigned long']], 'NodesTrimmedBasedOnAge' : [ 0x4014, ['unsigned long']], 'NodesTrimmedBasedOnCount' : [ 0x4018, ['unsigned long']], 'NodesSearched' : [ 0x401c, ['unsigned long']], 'MaxNodesSearched' : [ 0x4020, ['unsigned long']], 'SequenceNumber' : [ 0x4024, ['unsigned long']], 'RecursionDepthLimit' : [ 0x4028, ['unsigned long']], 'SearchedNodesLimit' : [ 0x402c, ['unsigned long']], 'DepthLimitHits' : [ 0x4030, ['unsigned long']], 'SearchLimitHits' : [ 0x4034, ['unsigned long']], 'StackLimitHits' : [ 0x4038, ['unsigned long']], 'ABC_ACB_Skipped' : [ 0x403c, ['unsigned long']], 'OutOfOrderReleases' : [ 0x4040, ['unsigned long']], 'NodesReleasedOutOfOrder' : [ 0x4044, ['unsigned long']], 'TotalReleases' : [ 0x4048, ['unsigned long']], 'RootNodesDeleted' : [ 0x404c, ['unsigned long']], 'ForgetHistoryCounter' : [ 0x4050, ['unsigned long']], 'Instigator' : [ 0x4054, ['pointer', ['void']]], 'NumberOfParticipants' : [ 0x4058, ['unsigned long']], 'Participant' : [ 0x405c, ['array', 32, ['pointer', ['_VI_DEADLOCK_NODE']]]], 'ChildrenCountWatermark' : [ 0x40dc, ['long']], 'StackType' : [ 0x40e0, ['Enumeration', dict(target = 'long', choices = {0: 'BugcheckStackLimits', 1: 'DPCStackLimits', 2: 'ExpandedStackLimits', 3: 'NormalStackLimits', 4: 'Win32kStackLimits', 5: 'SwapBusyStackLimits', 6: 'IsrStackLimits', 7: 'MaximumStackLimits'})]], 'StackLowLimit' : [ 0x40e4, ['unsigned long']], 'StackHighLimit' : [ 0x40e8, ['unsigned long']], } ], '_KTM' : [ 0x238, { 'cookie' : [ 0x0, ['unsigned long']], 'Mutex' : [ 0x4, ['_KMUTANT']], 'State' : [ 0x24, ['Enumeration', dict(target = 'long', choices = {0: 'KKtmUninitialized', 1: 'KKtmInitialized', 2: 'KKtmRecovering', 3: 'KKtmOnline', 4: 'KKtmRecoveryFailed', 5: 'KKtmOffline'})]], 'NamespaceLink' : [ 0x28, ['_KTMOBJECT_NAMESPACE_LINK']], 'TmIdentity' : [ 0x3c, ['_GUID']], 'Flags' : [ 0x4c, ['unsigned long']], 'VolatileFlags' : [ 0x50, ['unsigned long']], 'LogFileName' : [ 0x54, ['_UNICODE_STRING']], 'LogFileObject' : [ 0x5c, ['pointer', ['_FILE_OBJECT']]], 'MarshallingContext' : [ 0x60, ['pointer', ['void']]], 'LogManagementContext' : [ 0x64, ['pointer', ['void']]], 'Transactions' : [ 0x68, ['_KTMOBJECT_NAMESPACE']], 'ResourceManagers' : [ 0xc8, ['_KTMOBJECT_NAMESPACE']], 'LsnOrderedMutex' : [ 0x128, ['_KMUTANT']], 'LsnOrderedList' : [ 0x148, ['_LIST_ENTRY']], 'CommitVirtualClock' : [ 0x150, ['_LARGE_INTEGER']], 'CommitVirtualClockMutex' : [ 0x158, ['_FAST_MUTEX']], 'BaseLsn' : [ 0x178, ['_CLS_LSN']], 'CurrentReadLsn' : [ 0x180, ['_CLS_LSN']], 'LastRecoveredLsn' : [ 0x188, ['_CLS_LSN']], 'TmRmHandle' : [ 0x190, ['pointer', ['void']]], 'TmRm' : [ 0x194, ['pointer', ['_KRESOURCEMANAGER']]], 'LogFullNotifyEvent' : [ 0x198, ['_KEVENT']], 'CheckpointWorkItem' : [ 0x1a8, ['_WORK_QUEUE_ITEM']], 'CheckpointTargetLsn' : [ 0x1b8, ['_CLS_LSN']], 'LogFullCompletedWorkItem' : [ 0x1c0, ['_WORK_QUEUE_ITEM']], 'LogWriteResource' : [ 0x1d0, ['_ERESOURCE']], 'LogFlags' : [ 0x208, ['unsigned long']], 'LogFullStatus' : [ 0x20c, ['long']], 'RecoveryStatus' : [ 0x210, ['long']], 'LastCheckBaseLsn' : [ 0x218, ['_CLS_LSN']], 'RestartOrderedList' : [ 0x220, ['_LIST_ENTRY']], 'OfflineWorkItem' : [ 0x228, ['_WORK_QUEUE_ITEM']], } ], '_MM_SYSTEM_PAGE_COUNTS' : [ 0x10, { 'SystemCodePage' : [ 0x0, ['unsigned long']], 'SystemDriverPage' : [ 0x4, ['unsigned long']], 'TotalSystemCodePages' : [ 0x8, ['long']], 'TotalSystemDriverPages' : [ 0xc, ['long']], } ], '_MI_MODWRITE_DATA' : [ 0x30, { 'PagesLoad' : [ 0x0, ['long']], 'PagesAverage' : [ 0x4, ['unsigned long']], 'AverageAvailablePages' : [ 0x8, ['unsigned long']], 'PagesWritten' : [ 0xc, ['unsigned long']], 'WritesIssued' : [ 0x10, ['unsigned long']], 'IgnoredReservationsCount' : [ 0x14, ['unsigned long']], 'FreedReservationsCount' : [ 0x18, ['unsigned long']], 'WriteBurstCount' : [ 0x1c, ['unsigned long']], 'IgnoreReservationsStartTime' : [ 0x20, ['unsigned long long']], 'ReservationClusterInfo' : [ 0x28, ['_MI_RESERVATION_CLUSTER_INFO']], 'IgnoreReservations' : [ 0x2c, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'Spare' : [ 0x2c, ['BitField', dict(start_bit = 1, end_bit = 16, native_type='unsigned short')]], 'Spare1' : [ 0x2e, ['unsigned short']], } ], '_VF_BTS_RECORD' : [ 0xc, { 'JumpedFrom' : [ 0x0, ['pointer', ['void']]], 'JumpedTo' : [ 0x4, ['pointer', ['void']]], 'Unused1' : [ 0x8, ['BitField', dict(start_bit = 0, end_bit = 3, native_type='unsigned long')]], 'Predicted' : [ 0x8, ['BitField', dict(start_bit = 3, end_bit = 7, native_type='unsigned long')]], 'Unused2' : [ 0x8, ['BitField', dict(start_bit = 7, end_bit = 32, native_type='unsigned long')]], } ], '_PLATFORM_IDLE_STATE_ACCOUNTING' : [ 0x3e0, { 'CancelCount' : [ 0x0, ['unsigned long']], 'FailureCount' : [ 0x4, ['unsigned long']], 'SuccessCount' : [ 0x8, ['unsigned long']], 'MaxTime' : [ 0x10, ['unsigned long long']], 'MinTime' : [ 0x18, ['unsigned long long']], 'TotalTime' : [ 0x20, ['unsigned long long']], 'InvalidBucketIndex' : [ 0x28, ['unsigned long']], 'SelectionStatistics' : [ 0x30, ['_PPM_SELECTION_STATISTICS']], 'IdleTimeBuckets' : [ 0xa0, ['array', 26, ['_PROC_IDLE_STATE_BUCKET']]], } ], '_KTRANSACTION' : [ 0x1e0, { 'OutcomeEvent' : [ 0x0, ['_KEVENT']], 'cookie' : [ 0x10, ['unsigned long']], 'Mutex' : [ 0x14, ['_KMUTANT']], 'TreeTx' : [ 0x34, ['pointer', ['_KTRANSACTION']]], 'GlobalNamespaceLink' : [ 0x38, ['_KTMOBJECT_NAMESPACE_LINK']], 'TmNamespaceLink' : [ 0x4c, ['_KTMOBJECT_NAMESPACE_LINK']], 'UOW' : [ 0x60, ['_GUID']], 'State' : [ 0x70, ['Enumeration', dict(target = 'long', choices = {0: 'KTransactionUninitialized', 1: 'KTransactionActive', 2: 'KTransactionPreparing', 3: 'KTransactionPrepared', 4: 'KTransactionInDoubt', 5: 'KTransactionCommitted', 6: 'KTransactionAborted', 7: 'KTransactionDelegated', 8: 'KTransactionPrePreparing', 9: 'KTransactionForgotten', 10: 'KTransactionRecovering', 11: 'KTransactionPrePrepared'})]], 'Flags' : [ 0x74, ['unsigned long']], 'EnlistmentHead' : [ 0x78, ['_LIST_ENTRY']], 'EnlistmentCount' : [ 0x80, ['unsigned long']], 'RecoverableEnlistmentCount' : [ 0x84, ['unsigned long']], 'PrePrepareRequiredEnlistmentCount' : [ 0x88, ['unsigned long']], 'PrepareRequiredEnlistmentCount' : [ 0x8c, ['unsigned long']], 'OutcomeRequiredEnlistmentCount' : [ 0x90, ['unsigned long']], 'PendingResponses' : [ 0x94, ['unsigned long']], 'SuperiorEnlistment' : [ 0x98, ['pointer', ['_KENLISTMENT']]], 'LastLsn' : [ 0xa0, ['_CLS_LSN']], 'PromotedEntry' : [ 0xa8, ['_LIST_ENTRY']], 'PromoterTransaction' : [ 0xb0, ['pointer', ['_KTRANSACTION']]], 'PromotePropagation' : [ 0xb4, ['pointer', ['void']]], 'IsolationLevel' : [ 0xb8, ['unsigned long']], 'IsolationFlags' : [ 0xbc, ['unsigned long']], 'Timeout' : [ 0xc0, ['_LARGE_INTEGER']], 'Description' : [ 0xc8, ['_UNICODE_STRING']], 'RollbackThread' : [ 0xd0, ['pointer', ['_KTHREAD']]], 'RollbackWorkItem' : [ 0xd4, ['_WORK_QUEUE_ITEM']], 'RollbackDpc' : [ 0xe4, ['_KDPC']], 'RollbackTimer' : [ 0x108, ['_KTIMER']], 'LsnOrderedEntry' : [ 0x130, ['_LIST_ENTRY']], 'Outcome' : [ 0x138, ['Enumeration', dict(target = 'long', choices = {0: 'KTxOutcomeUninitialized', 1: 'KTxOutcomeUndetermined', 2: 'KTxOutcomeCommitted', 3: 'KTxOutcomeAborted', 4: 'KTxOutcomeUnavailable'})]], 'Tm' : [ 0x13c, ['pointer', ['_KTM']]], 'CommitReservation' : [ 0x140, ['long long']], 'TransactionHistory' : [ 0x148, ['array', 10, ['_KTRANSACTION_HISTORY']]], 'TransactionHistoryCount' : [ 0x198, ['unsigned long']], 'DTCPrivateInformation' : [ 0x19c, ['pointer', ['void']]], 'DTCPrivateInformationLength' : [ 0x1a0, ['unsigned long']], 'DTCPrivateInformationMutex' : [ 0x1a4, ['_KMUTANT']], 'PromotedTxSelfHandle' : [ 0x1c4, ['pointer', ['void']]], 'PendingPromotionCount' : [ 0x1c8, ['unsigned long']], 'PromotionCompletedEvent' : [ 0x1cc, ['_KEVENT']], } ], '_PRIVATE_CACHE_MAP_FLAGS' : [ 0x4, { 'DontUse' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long')]], 'ReadAheadActive' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long')]], 'ReadAheadEnabled' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long')]], 'PagePriority' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 21, native_type='unsigned long')]], 'PipelineReadAheads' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long')]], 'Available' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 32, native_type='unsigned long')]], } ], '_CM_KCB_UOW' : [ 0x38, { 'TransactionListEntry' : [ 0x0, ['_LIST_ENTRY']], 'KCBLock' : [ 0x8, ['pointer', ['_CM_INTENT_LOCK']]], 'KeyLock' : [ 0xc, ['pointer', ['_CM_INTENT_LOCK']]], 'KCBListEntry' : [ 0x10, ['_LIST_ENTRY']], 'KeyControlBlock' : [ 0x18, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'Transaction' : [ 0x1c, ['pointer', ['_CM_TRANS']]], 'UoWState' : [ 0x20, ['unsigned long']], 'ActionType' : [ 0x24, ['Enumeration', dict(target = 'long', choices = {0: 'UoWAddThisKey', 1: 'UoWAddChildKey', 2: 'UoWDeleteThisKey', 3: 'UoWDeleteChildKey', 4: 'UoWSetValueNew', 5: 'UoWSetValueExisting', 6: 'UoWDeleteValue', 7: 'UoWSetKeyUserFlags', 8: 'UoWSetLastWriteTime', 9: 'UoWSetSecurityDescriptor', 10: 'UoWRenameSubKey', 11: 'UoWRenameOldSubKey', 12: 'UoWRenameNewSubKey', 13: 'UoWIsolation', 14: 'UoWInvalid'})]], 'StorageType' : [ 0x28, ['Enumeration', dict(target = 'long', choices = {0: 'Stable', 1: 'Volatile', 2: 'InvalidStorage'})]], 'ChildKCB' : [ 0x30, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'VolatileKeyCell' : [ 0x30, ['unsigned long']], 'OldValueCell' : [ 0x30, ['unsigned long']], 'NewValueCell' : [ 0x34, ['unsigned long']], 'UserFlags' : [ 0x30, ['unsigned long']], 'LastWriteTime' : [ 0x30, ['_LARGE_INTEGER']], 'TxSecurityCell' : [ 0x30, ['unsigned long']], 'OldChildKCB' : [ 0x30, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'NewChildKCB' : [ 0x34, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'OtherChildKCB' : [ 0x30, ['pointer', ['_CM_KEY_CONTROL_BLOCK']]], 'ThisVolatileKeyCell' : [ 0x34, ['unsigned long']], } ], '_KPROCESSOR_STATE' : [ 0x320, { 'ContextFrame' : [ 0x0, ['_CONTEXT']], 'SpecialRegisters' : [ 0x2cc, ['_KSPECIAL_REGISTERS']], } ], '_MMPTE_TRANSITION' : [ 0x8, { 'Valid' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long long')]], 'Write' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long long')]], 'WriteThrough' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long long')]], 'CacheDisable' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long long')]], 'Protection' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 10, native_type='unsigned long long')]], 'Prototype' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 11, native_type='unsigned long long')]], 'Transition' : [ 0x0, ['BitField', dict(start_bit = 11, end_bit = 12, native_type='unsigned long long')]], 'PageFrameNumber' : [ 0x0, ['BitField', dict(start_bit = 12, end_bit = 38, native_type='unsigned long long')]], 'Unused' : [ 0x0, ['BitField', dict(start_bit = 38, end_bit = 64, native_type='unsigned long long')]], } ], '_PROCESSOR_IDLE_CONSTRAINTS' : [ 0x30, { 'TotalTime' : [ 0x0, ['unsigned long long']], 'IdleTime' : [ 0x8, ['unsigned long long']], 'ExpectedIdleDuration' : [ 0x10, ['unsigned long long']], 'MaxIdleDuration' : [ 0x18, ['unsigned long long']], 'OverrideState' : [ 0x20, ['unsigned long']], 'TimeCheck' : [ 0x24, ['unsigned long']], 'PromotePercent' : [ 0x28, ['unsigned char']], 'DemotePercent' : [ 0x29, ['unsigned char']], 'Parked' : [ 0x2a, ['unsigned char']], 'Interruptible' : [ 0x2b, ['unsigned char']], 'PlatformIdle' : [ 0x2c, ['unsigned char']], 'ExpectedWakeReason' : [ 0x2d, ['unsigned char']], } ], '_KREQUEST_PACKET' : [ 0x10, { 'CurrentPacket' : [ 0x0, ['array', 3, ['pointer', ['void']]]], 'WorkerRoutine' : [ 0xc, ['pointer', ['void']]], } ], '_VF_WATCHDOG_IRP' : [ 0x14, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'DueTickCount' : [ 0xc, ['unsigned long']], 'Inserted' : [ 0x10, ['unsigned char']], 'TrackedStackLocation' : [ 0x11, ['unsigned char']], 'CancelTimeoutTicks' : [ 0x12, ['unsigned short']], } ], '_MMVAD_FLAGS2' : [ 0x4, { 'FileOffset' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'Large' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 25, native_type='unsigned long')]], 'TrimBehind' : [ 0x0, ['BitField', dict(start_bit = 25, end_bit = 26, native_type='unsigned long')]], 'Inherit' : [ 0x0, ['BitField', dict(start_bit = 26, end_bit = 27, native_type='unsigned long')]], 'CopyOnWrite' : [ 0x0, ['BitField', dict(start_bit = 27, end_bit = 28, native_type='unsigned long')]], 'NoValidationNeeded' : [ 0x0, ['BitField', dict(start_bit = 28, end_bit = 29, native_type='unsigned long')]], 'PrivateDemandZero' : [ 0x0, ['BitField', dict(start_bit = 29, end_bit = 30, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 32, native_type='unsigned long')]], } ], '_flags' : [ 0x1, { 'Removable' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'GroupAssigned' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'GroupCommitted' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned char')]], 'GroupAssignmentFixed' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned char')]], 'Fill' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 8, native_type='unsigned char')]], } ], '__unnamed_27d9' : [ 0x8, { 'Head' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long long')]], 'Tail' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 48, native_type='unsigned long long')]], 'ActiveThreadCount' : [ 0x0, ['BitField', dict(start_bit = 48, end_bit = 64, native_type='unsigned long long')]], } ], '__unnamed_27db' : [ 0x8, { 's1' : [ 0x0, ['__unnamed_27d9']], 'Value' : [ 0x0, ['long long']], } ], '_ALPC_COMPLETION_LIST_STATE' : [ 0x8, { 'u1' : [ 0x0, ['__unnamed_27db']], } ], '_CM_KEY_SECURITY_CACHE' : [ 0x2c, { 'Cell' : [ 0x0, ['unsigned long']], 'ConvKey' : [ 0x4, ['unsigned long']], 'List' : [ 0x8, ['_LIST_ENTRY']], 'DescriptorLength' : [ 0x10, ['unsigned long']], 'RealRefCount' : [ 0x14, ['unsigned long']], 'Descriptor' : [ 0x18, ['_SECURITY_DESCRIPTOR_RELATIVE']], } ], '_CM_NAME_HASH' : [ 0xc, { 'ConvKey' : [ 0x0, ['unsigned long']], 'NextHash' : [ 0x4, ['pointer', ['_CM_NAME_HASH']]], 'NameLength' : [ 0x8, ['unsigned short']], 'Name' : [ 0xa, ['array', 1, ['wchar']]], } ], '_PROC_IDLE_STATE_BUCKET' : [ 0x20, { 'TotalTime' : [ 0x0, ['unsigned long long']], 'MinTime' : [ 0x8, ['unsigned long long']], 'MaxTime' : [ 0x10, ['unsigned long long']], 'Count' : [ 0x18, ['unsigned long']], } ], '_PO_IRP_QUEUE' : [ 0x8, { 'CurrentIrp' : [ 0x0, ['pointer', ['_IRP']]], 'PendingIrpList' : [ 0x4, ['pointer', ['_IRP']]], } ], '_MMSECURE_FLAGS' : [ 0x4, { 'ReadOnly' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReadWrite' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'SecNoChange' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'NoDelete' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'RequiresPteReversal' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'ExclusiveSecure' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'Spare' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 12, native_type='unsigned long')]], } ], '__unnamed_27f0' : [ 0x4, { 'Active' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'OnlyTryAcquireUsed' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'ReleasedOutOfOrder' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'SequenceNumber' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 32, native_type='unsigned long')]], 'Whole' : [ 0x0, ['unsigned long']], } ], '_VI_DEADLOCK_NODE' : [ 0x6c, { 'Parent' : [ 0x0, ['pointer', ['_VI_DEADLOCK_NODE']]], 'ChildrenList' : [ 0x4, ['_LIST_ENTRY']], 'SiblingsList' : [ 0xc, ['_LIST_ENTRY']], 'ResourceList' : [ 0x14, ['_LIST_ENTRY']], 'FreeListEntry' : [ 0x14, ['_LIST_ENTRY']], 'Root' : [ 0x1c, ['pointer', ['_VI_DEADLOCK_RESOURCE']]], 'ThreadEntry' : [ 0x20, ['pointer', ['_VI_DEADLOCK_THREAD']]], 'u1' : [ 0x24, ['__unnamed_27f0']], 'ChildrenCount' : [ 0x28, ['long']], 'StackTrace' : [ 0x2c, ['array', 8, ['pointer', ['void']]]], 'ParentStackTrace' : [ 0x4c, ['array', 8, ['pointer', ['void']]]], } ], 'PROCESSOR_IDLESTATE_INFO' : [ 0x8, { 'TimeCheck' : [ 0x0, ['unsigned long']], 'DemotePercent' : [ 0x4, ['unsigned char']], 'PromotePercent' : [ 0x5, ['unsigned char']], 'Spare' : [ 0x6, ['array', 2, ['unsigned char']]], } ], '_KTMOBJECT_NAMESPACE' : [ 0x60, { 'Table' : [ 0x0, ['_RTL_AVL_TABLE']], 'Mutex' : [ 0x38, ['_KMUTANT']], 'LinksOffset' : [ 0x58, ['unsigned short']], 'GuidOffset' : [ 0x5a, ['unsigned short']], 'Expired' : [ 0x5c, ['unsigned char']], } ], '_LPCP_PORT_QUEUE' : [ 0x10, { 'NonPagedPortQueue' : [ 0x0, ['pointer', ['_LPCP_NONPAGED_PORT_QUEUE']]], 'Semaphore' : [ 0x4, ['pointer', ['_KSEMAPHORE']]], 'ReceiveHead' : [ 0x8, ['_LIST_ENTRY']], } ], '_CM_KEY_REFERENCE' : [ 0x8, { 'KeyCell' : [ 0x0, ['unsigned long']], 'KeyHive' : [ 0x4, ['pointer', ['_HHIVE']]], } ], 'SYSTEM_POWER_LEVEL' : [ 0x18, { 'Enable' : [ 0x0, ['unsigned char']], 'Spare' : [ 0x1, ['array', 3, ['unsigned char']]], 'BatteryLevel' : [ 0x4, ['unsigned long']], 'PowerPolicy' : [ 0x8, ['POWER_ACTION_POLICY']], 'MinSystemState' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'PowerSystemUnspecified', 1: 'PowerSystemWorking', 2: 'PowerSystemSleeping1', 3: 'PowerSystemSleeping2', 4: 'PowerSystemSleeping3', 5: 'PowerSystemHibernate', 6: 'PowerSystemShutdown', 7: 'PowerSystemMaximum'})]], } ], '_HVIEW_MAP_ENTRY' : [ 0x18, { 'ViewStart' : [ 0x0, ['pointer', ['void']]], 'IsPinned' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Bcb' : [ 0x4, ['pointer', ['void']]], 'PinnedPages' : [ 0x8, ['unsigned long long']], 'Size' : [ 0x10, ['unsigned long']], } ], '_OBJECT_DUMP_CONTROL' : [ 0x8, { 'Stream' : [ 0x0, ['pointer', ['void']]], 'Detail' : [ 0x4, ['unsigned long']], } ], '_POP_COOLING_EXTENSION' : [ 0x48, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'RequestListHead' : [ 0x8, ['_LIST_ENTRY']], 'Lock' : [ 0x10, ['_POP_RW_LOCK']], 'DeviceObject' : [ 0x18, ['pointer', ['_DEVICE_OBJECT']]], 'NotificationEntry' : [ 0x1c, ['pointer', ['void']]], 'Enabled' : [ 0x20, ['unsigned char']], 'ActiveEngaged' : [ 0x21, ['unsigned char']], 'ThrottleLimit' : [ 0x22, ['unsigned char']], 'UpdatingToCurrent' : [ 0x23, ['unsigned char']], 'RemovalFlushEvent' : [ 0x24, ['pointer', ['_KEVENT']]], 'PnpFlushEvent' : [ 0x28, ['pointer', ['_KEVENT']]], 'Interface' : [ 0x2c, ['_THERMAL_COOLING_INTERFACE']], } ], '_EVENT_PAYLOAD_PREDICATE' : [ 0x18, { 'FieldIndex' : [ 0x0, ['unsigned short']], 'CompareOp' : [ 0x2, ['unsigned short']], 'Value' : [ 0x8, ['array', 2, ['unsigned long long']]], } ], '_EVENT_HEADER_EXTENDED_DATA_ITEM' : [ 0x10, { 'Reserved1' : [ 0x0, ['unsigned short']], 'ExtType' : [ 0x2, ['unsigned short']], 'Linkage' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'Reserved2' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 16, native_type='unsigned short')]], 'DataSize' : [ 0x6, ['unsigned short']], 'DataPtr' : [ 0x8, ['unsigned long long']], } ], '_CM_INDEX' : [ 0x8, { 'Cell' : [ 0x0, ['unsigned long']], 'NameHint' : [ 0x4, ['array', 4, ['unsigned char']]], 'HashKey' : [ 0x4, ['unsigned long']], } ], '_VF_ADDRESS_RANGE' : [ 0x8, { 'Start' : [ 0x0, ['pointer', ['unsigned char']]], 'End' : [ 0x4, ['pointer', ['unsigned char']]], } ], '_OBJECT_SYMBOLIC_LINK' : [ 0x18, { 'CreationTime' : [ 0x0, ['_LARGE_INTEGER']], 'LinkTarget' : [ 0x8, ['_UNICODE_STRING']], 'DosDeviceDriveIndex' : [ 0x10, ['unsigned long']], 'Flags' : [ 0x14, ['unsigned long']], } ], '_LPCP_NONPAGED_PORT_QUEUE' : [ 0x18, { 'Semaphore' : [ 0x0, ['_KSEMAPHORE']], 'BackPointer' : [ 0x14, ['pointer', ['_LPCP_PORT_OBJECT']]], } ], '_THERMAL_POLICY' : [ 0x18, { 'Version' : [ 0x0, ['unsigned long']], 'WaitForUpdate' : [ 0x4, ['unsigned char']], 'Hibernate' : [ 0x5, ['unsigned char']], 'Critical' : [ 0x6, ['unsigned char']], 'ThermalStandby' : [ 0x7, ['unsigned char']], 'ActivationReasons' : [ 0x8, ['unsigned long']], 'PassiveLimit' : [ 0xc, ['unsigned long']], 'ActiveLevel' : [ 0x10, ['unsigned long']], 'OverThrottled' : [ 0x14, ['unsigned char']], } ], '_KRESOURCEMANAGER_COMPLETION_BINDING' : [ 0x14, { 'NotificationListHead' : [ 0x0, ['_LIST_ENTRY']], 'Port' : [ 0x8, ['pointer', ['void']]], 'Key' : [ 0xc, ['unsigned long']], 'BindingProcess' : [ 0x10, ['pointer', ['_EPROCESS']]], } ], '_VF_TRACKER' : [ 0x10, { 'TrackerFlags' : [ 0x0, ['unsigned long']], 'TrackerSize' : [ 0x4, ['unsigned long']], 'TrackerIndex' : [ 0x8, ['unsigned long']], 'TraceDepth' : [ 0xc, ['unsigned long']], } ], '_CALL_PERFORMANCE_DATA' : [ 0x204, { 'SpinLock' : [ 0x0, ['unsigned long']], 'HashTable' : [ 0x4, ['array', 64, ['_LIST_ENTRY']]], } ], '_ARBITER_ALTERNATIVE' : [ 0x38, { 'Minimum' : [ 0x0, ['unsigned long long']], 'Maximum' : [ 0x8, ['unsigned long long']], 'Length' : [ 0x10, ['unsigned long long']], 'Alignment' : [ 0x18, ['unsigned long long']], 'Priority' : [ 0x20, ['long']], 'Flags' : [ 0x24, ['unsigned long']], 'Descriptor' : [ 0x28, ['pointer', ['_IO_RESOURCE_DESCRIPTOR']]], 'Reserved' : [ 0x2c, ['array', 3, ['unsigned long']]], } ], '_MI_AVAILABLE_PAGE_WAIT_STATES' : [ 0x14, { 'Event' : [ 0x0, ['_KEVENT']], 'EventSets' : [ 0x10, ['unsigned long']], } ], '_WHEA_ERROR_STATUS' : [ 0x8, { 'ErrorStatus' : [ 0x0, ['unsigned long long']], 'Reserved1' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned long long')]], 'ErrorType' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 16, native_type='unsigned long long')]], 'Address' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 17, native_type='unsigned long long')]], 'Control' : [ 0x0, ['BitField', dict(start_bit = 17, end_bit = 18, native_type='unsigned long long')]], 'Data' : [ 0x0, ['BitField', dict(start_bit = 18, end_bit = 19, native_type='unsigned long long')]], 'Responder' : [ 0x0, ['BitField', dict(start_bit = 19, end_bit = 20, native_type='unsigned long long')]], 'Requester' : [ 0x0, ['BitField', dict(start_bit = 20, end_bit = 21, native_type='unsigned long long')]], 'FirstError' : [ 0x0, ['BitField', dict(start_bit = 21, end_bit = 22, native_type='unsigned long long')]], 'Overflow' : [ 0x0, ['BitField', dict(start_bit = 22, end_bit = 23, native_type='unsigned long long')]], 'Reserved2' : [ 0x0, ['BitField', dict(start_bit = 23, end_bit = 64, native_type='unsigned long long')]], } ], '_WHEA_PERSISTENCE_INFO' : [ 0x8, { 'Signature' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 16, native_type='unsigned long long')]], 'Length' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 40, native_type='unsigned long long')]], 'Identifier' : [ 0x0, ['BitField', dict(start_bit = 40, end_bit = 56, native_type='unsigned long long')]], 'Attributes' : [ 0x0, ['BitField', dict(start_bit = 56, end_bit = 58, native_type='unsigned long long')]], 'DoNotLog' : [ 0x0, ['BitField', dict(start_bit = 58, end_bit = 59, native_type='unsigned long long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 59, end_bit = 64, native_type='unsigned long long')]], 'AsULONGLONG' : [ 0x0, ['unsigned long long']], } ], '_COLORED_PAGE_INFO' : [ 0x10, { 'BeingZeroed' : [ 0x0, ['long']], 'Processor' : [ 0x4, ['unsigned long']], 'PagesQueued' : [ 0x8, ['unsigned long']], 'PfnAllocation' : [ 0xc, ['pointer', ['_MMPFN']]], } ], '_TRIAGE_9F_POWER' : [ 0x10, { 'Signature' : [ 0x0, ['unsigned short']], 'Revision' : [ 0x2, ['unsigned short']], 'IrpList' : [ 0x4, ['pointer', ['_LIST_ENTRY']]], 'ThreadList' : [ 0x8, ['pointer', ['_LIST_ENTRY']]], 'DelayedWorkQueue' : [ 0xc, ['pointer', ['_TRIAGE_EX_WORK_QUEUE']]], } ], '_MI_POOL_STATE' : [ 0x4e0, { 'MaximumNonPagedPoolThreshold' : [ 0x0, ['unsigned long']], 'NonPagedPoolSListMaximum' : [ 0x4, ['array', 3, ['unsigned long']]], 'AllocatedNonPagedPool' : [ 0x10, ['unsigned long']], 'BadPoolHead' : [ 0x14, ['_SINGLE_LIST_ENTRY']], 'PoolFailures' : [ 0x18, ['array', 3, ['array', 3, ['unsigned long']]]], 'PoolFailureReasons' : [ 0x3c, ['array', 11, ['unsigned long']]], 'LowPagedPoolThreshold' : [ 0x68, ['unsigned long']], 'HighPagedPoolThreshold' : [ 0x6c, ['unsigned long']], 'SpecialPoolPdesMax' : [ 0x70, ['long']], 'NonPagedPoolNodes' : [ 0x74, ['array', 1024, ['unsigned char']]], 'PagedProtoPoolInfo' : [ 0x474, ['_MM_PAGED_POOL_INFO']], 'PagedPoolSListMaximum' : [ 0x490, ['unsigned long']], 'PreemptiveTrims' : [ 0x494, ['array', 4, ['unsigned long']]], 'SpecialPagesInUsePeak' : [ 0x4a4, ['unsigned long']], 'SpecialPoolRejected' : [ 0x4a8, ['array', 9, ['unsigned long']]], 'SpecialPagesNonPaged' : [ 0x4cc, ['unsigned long']], 'SpecialPoolPdes' : [ 0x4d0, ['long']], 'SessionSpecialPoolPdesMax' : [ 0x4d4, ['unsigned long']], 'TotalPagedPoolQuota' : [ 0x4d8, ['unsigned long']], 'TotalNonPagedPoolQuota' : [ 0x4dc, ['unsigned long']], } ], '_STACK_TABLE' : [ 0x8040, { 'NumStackTraces' : [ 0x0, ['unsigned short']], 'TraceCapacity' : [ 0x2, ['unsigned short']], 'StackTrace' : [ 0x4, ['array', 16, ['pointer', ['_OBJECT_REF_TRACE']]]], 'StackTableHash' : [ 0x44, ['array', 16381, ['unsigned short']]], } ], '_POP_POWER_SETTING_VALUES' : [ 0x13c, { 'StructureSize' : [ 0x0, ['unsigned long']], 'PopPolicy' : [ 0x4, ['_SYSTEM_POWER_POLICY']], 'CurrentAcDcPowerState' : [ 0xec, ['Enumeration', dict(target = 'long', choices = {0: 'PoAc', 1: 'PoDc', 2: 'PoHot', 3: 'PoConditionMaximum'})]], 'AwayModeEnabled' : [ 0xf0, ['unsigned char']], 'AwayModeEngaged' : [ 0xf1, ['unsigned char']], 'AwayModePolicyAllowed' : [ 0xf2, ['unsigned char']], 'AwayModeIgnoreUserPresent' : [ 0xf4, ['long']], 'AwayModeIgnoreAction' : [ 0xf8, ['long']], 'DisableFastS4' : [ 0xfc, ['unsigned char']], 'DisableStandbyStates' : [ 0xfd, ['unsigned char']], 'UnattendSleepTimeout' : [ 0x100, ['unsigned long']], 'DiskIgnoreTime' : [ 0x104, ['unsigned long']], 'DeviceIdlePolicy' : [ 0x108, ['unsigned long']], 'VideoDimTimeout' : [ 0x10c, ['unsigned long']], 'VideoNormalBrightness' : [ 0x110, ['unsigned long']], 'VideoDimBrightness' : [ 0x114, ['unsigned long']], 'AlsOffset' : [ 0x118, ['unsigned long']], 'AlsEnabled' : [ 0x11c, ['unsigned long']], 'EsBrightness' : [ 0x120, ['unsigned long']], 'SwitchShutdownForced' : [ 0x124, ['unsigned char']], 'SystemCoolingPolicy' : [ 0x128, ['unsigned long']], 'MediaBufferingEngaged' : [ 0x12c, ['unsigned char']], 'OffloadedAudio' : [ 0x12d, ['unsigned char']], 'NonOffloadedAudio' : [ 0x12e, ['unsigned char']], 'FullscreenVideoPlayback' : [ 0x12f, ['unsigned char']], 'EsBatteryThreshold' : [ 0x130, ['unsigned long']], 'EsUserAwaySetting' : [ 0x134, ['unsigned char']], 'WiFiInStandby' : [ 0x138, ['unsigned long']], } ], '_CM_INDEX_HINT_BLOCK' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'HashKey' : [ 0x4, ['array', 1, ['unsigned long']]], } ], '_TOKEN_CONTROL' : [ 0x28, { 'TokenId' : [ 0x0, ['_LUID']], 'AuthenticationId' : [ 0x8, ['_LUID']], 'ModifiedId' : [ 0x10, ['_LUID']], 'TokenSource' : [ 0x18, ['_TOKEN_SOURCE']], } ], '_DEFERRED_WRITE' : [ 0x24, { 'NodeTypeCode' : [ 0x0, ['short']], 'NodeByteSize' : [ 0x2, ['short']], 'FileObject' : [ 0x4, ['pointer', ['_FILE_OBJECT']]], 'BytesToWrite' : [ 0x8, ['unsigned long']], 'DeferredWriteLinks' : [ 0xc, ['_LIST_ENTRY']], 'Event' : [ 0x14, ['pointer', ['_KEVENT']]], 'PostRoutine' : [ 0x18, ['pointer', ['void']]], 'Context1' : [ 0x1c, ['pointer', ['void']]], 'Context2' : [ 0x20, ['pointer', ['void']]], } ], '__unnamed_285f' : [ 0x4, { 'DeviceNumber' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 5, native_type='unsigned long')]], 'FunctionNumber' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 8, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_2861' : [ 0x4, { 'bits' : [ 0x0, ['__unnamed_285f']], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_WHEA_PCI_SLOT_NUMBER' : [ 0x4, { 'u' : [ 0x0, ['__unnamed_2861']], } ], '_MI_IO_PAGE_STATE' : [ 0x34, { 'IoPfnLock' : [ 0x0, ['unsigned long']], 'IoPfnRoot' : [ 0x4, ['array', 3, ['_RTL_AVL_TREE']]], 'UnusedCachedMaps' : [ 0x10, ['_LIST_ENTRY']], 'OldestCacheFlushTimeStamp' : [ 0x18, ['unsigned long']], 'IoCacheStats' : [ 0x1c, ['_MI_IO_CACHE_STATS']], } ], '_ARBITER_ORDERING_LIST' : [ 0x8, { 'Count' : [ 0x0, ['unsigned short']], 'Maximum' : [ 0x2, ['unsigned short']], 'Orderings' : [ 0x4, ['pointer', ['_ARBITER_ORDERING']]], } ], '_VF_AVL_TABLE' : [ 0x80, { 'RtlTable' : [ 0x0, ['_RTL_AVL_TABLE']], 'ReservedNode' : [ 0x38, ['pointer', ['_VF_AVL_TREE_NODE']]], 'NodeToFree' : [ 0x3c, ['pointer', ['void']]], 'Lock' : [ 0x40, ['long']], } ], '_XPF_MC_BANK_FLAGS' : [ 0x1, { 'ClearOnInitializationRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'ControlDataRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], 'AsUCHAR' : [ 0x0, ['unsigned char']], } ], '_TOKEN_AUDIT_POLICY' : [ 0x1e, { 'PerUserPolicy' : [ 0x0, ['array', 30, ['unsigned char']]], } ], '_TRIAGE_POP_FX_DEVICE' : [ 0x20, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'IrpData' : [ 0xc, ['pointer', ['_TRIAGE_POP_IRP_DATA']]], 'Status' : [ 0x10, ['long']], 'PowerReqCall' : [ 0x14, ['long']], 'PowerNotReqCall' : [ 0x18, ['long']], 'DeviceNode' : [ 0x1c, ['pointer', ['_TRIAGE_DEVICE_NODE']]], } ], '__unnamed_2879' : [ 0x8, { 'EndingOffset' : [ 0x0, ['pointer', ['_LARGE_INTEGER']]], 'ResourceToRelease' : [ 0x4, ['pointer', ['pointer', ['_ERESOURCE']]]], } ], '__unnamed_287b' : [ 0x4, { 'ResourceToRelease' : [ 0x0, ['pointer', ['_ERESOURCE']]], } ], '__unnamed_2881' : [ 0xc, { 'SyncType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'SyncTypeOther', 1: 'SyncTypeCreateSection'})]], 'PageProtection' : [ 0x4, ['unsigned long']], 'OutputInformation' : [ 0x8, ['pointer', ['_FS_FILTER_SECTION_SYNC_OUTPUT']]], } ], '__unnamed_2885' : [ 0x8, { 'NotificationType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'NotifyTypeCreate', 1: 'NotifyTypeRetired'})]], 'SafeToRecurse' : [ 0x4, ['unsigned char']], } ], '__unnamed_2887' : [ 0x14, { 'Argument1' : [ 0x0, ['pointer', ['void']]], 'Argument2' : [ 0x4, ['pointer', ['void']]], 'Argument3' : [ 0x8, ['pointer', ['void']]], 'Argument4' : [ 0xc, ['pointer', ['void']]], 'Argument5' : [ 0x10, ['pointer', ['void']]], } ], '_FS_FILTER_PARAMETERS' : [ 0x14, { 'AcquireForModifiedPageWriter' : [ 0x0, ['__unnamed_2879']], 'ReleaseForModifiedPageWriter' : [ 0x0, ['__unnamed_287b']], 'AcquireForSectionSynchronization' : [ 0x0, ['__unnamed_2881']], 'NotifyStreamFileObject' : [ 0x0, ['__unnamed_2885']], 'Others' : [ 0x0, ['__unnamed_2887']], } ], '_MI_SESSION_DRIVER_UNLOAD' : [ 0x4, { 'Function' : [ 0x0, ['pointer', ['void']]], 'FunctionValue' : [ 0x0, ['unsigned long']], } ], '_PPM_SELECTION_STATISTICS' : [ 0x70, { 'SelectedCount' : [ 0x0, ['unsigned long long']], 'VetoCount' : [ 0x8, ['unsigned long long']], 'PreVetoCount' : [ 0x10, ['unsigned long long']], 'WrongProcessorCount' : [ 0x18, ['unsigned long long']], 'LatencyCount' : [ 0x20, ['unsigned long long']], 'IdleDurationCount' : [ 0x28, ['unsigned long long']], 'DeviceDependencyCount' : [ 0x30, ['unsigned long long']], 'ProcessorDependencyCount' : [ 0x38, ['unsigned long long']], 'PlatformOnlyCount' : [ 0x40, ['unsigned long long']], 'InterruptibleCount' : [ 0x48, ['unsigned long long']], 'LegacyOverrideCount' : [ 0x50, ['unsigned long long']], 'CstateCheckCount' : [ 0x58, ['unsigned long long']], 'NoCStateCount' : [ 0x60, ['unsigned long long']], 'CoordinatedDependencyCount' : [ 0x68, ['unsigned long long']], } ], '_LDR_SERVICE_TAG_RECORD' : [ 0x8, { 'Next' : [ 0x0, ['pointer', ['_LDR_SERVICE_TAG_RECORD']]], 'ServiceTag' : [ 0x4, ['unsigned long']], } ], '_COMPRESSED_DATA_INFO' : [ 0xc, { 'CompressionFormatAndEngine' : [ 0x0, ['unsigned short']], 'CompressionUnitShift' : [ 0x2, ['unsigned char']], 'ChunkShift' : [ 0x3, ['unsigned char']], 'ClusterShift' : [ 0x4, ['unsigned char']], 'Reserved' : [ 0x5, ['unsigned char']], 'NumberOfChunks' : [ 0x6, ['unsigned short']], 'CompressedChunkSizes' : [ 0x8, ['array', 1, ['unsigned long']]], } ], '_MI_PAGE_COMBINE_STATISTICS' : [ 0x28, { 'PagesScannedActive' : [ 0x0, ['unsigned long long']], 'PagesScannedStandby' : [ 0x8, ['unsigned long long']], 'PagesCombined' : [ 0x10, ['unsigned long long']], 'CombineScanCount' : [ 0x18, ['unsigned long']], 'CombinedBlocksInUse' : [ 0x1c, ['long']], 'SumCombinedBlocksReferenceCount' : [ 0x20, ['long']], } ], '__unnamed_2895' : [ 0x4, { 'ControlArea' : [ 0x0, ['pointer', ['_CONTROL_AREA']]], 'FileObject' : [ 0x0, ['pointer', ['_FILE_OBJECT']]], 'RemoteImageFileObject' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'RemoteDataFileObject' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], } ], '_SECTION' : [ 0x28, { 'SectionNode' : [ 0x0, ['_RTL_BALANCED_NODE']], 'StartingVpn' : [ 0xc, ['unsigned long']], 'EndingVpn' : [ 0x10, ['unsigned long']], 'u1' : [ 0x14, ['__unnamed_2895']], 'SizeOfSection' : [ 0x18, ['unsigned long long']], 'u' : [ 0x20, ['__unnamed_1678']], 'InitialPageProtection' : [ 0x24, ['BitField', dict(start_bit = 0, end_bit = 12, native_type='unsigned long')]], 'SessionId' : [ 0x24, ['BitField', dict(start_bit = 12, end_bit = 31, native_type='unsigned long')]], 'NoValidationNeeded' : [ 0x24, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '_THERMAL_COOLING_INTERFACE' : [ 0x1c, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'Context' : [ 0x4, ['pointer', ['void']]], 'InterfaceReference' : [ 0x8, ['pointer', ['void']]], 'InterfaceDereference' : [ 0xc, ['pointer', ['void']]], 'Flags' : [ 0x10, ['unsigned long']], 'ActiveCooling' : [ 0x14, ['pointer', ['void']]], 'PassiveCooling' : [ 0x18, ['pointer', ['void']]], } ], '_HIVE_WAIT_PACKET' : [ 0x18, { 'WakeEvent' : [ 0x0, ['_KEVENT']], 'Status' : [ 0x10, ['long']], 'Next' : [ 0x14, ['pointer', ['_HIVE_WAIT_PACKET']]], } ], '_PROC_PERF_CHECK' : [ 0xc0, { 'LastActive' : [ 0x0, ['unsigned long long']], 'LastTime' : [ 0x8, ['unsigned long long']], 'LastStall' : [ 0x10, ['unsigned long long']], 'Snap' : [ 0x18, ['_PROC_PERF_CHECK_SNAP']], 'TempSnap' : [ 0x68, ['_PROC_PERF_CHECK_SNAP']], 'TaggedThreadPercent' : [ 0xb8, ['array', 2, ['unsigned char']]], 'Class0FloorPerfSelection' : [ 0xba, ['unsigned char']], 'Class1MinimumPerfSelection' : [ 0xbb, ['unsigned char']], } ], '__unnamed_28a5' : [ 0x4, { 'PollInterval' : [ 0x0, ['unsigned long']], } ], '__unnamed_28a7' : [ 0x18, { 'PollInterval' : [ 0x0, ['unsigned long']], 'Vector' : [ 0x4, ['unsigned long']], 'SwitchToPollingThreshold' : [ 0x8, ['unsigned long']], 'SwitchToPollingWindow' : [ 0xc, ['unsigned long']], 'ErrorThreshold' : [ 0x10, ['unsigned long']], 'ErrorThresholdWindow' : [ 0x14, ['unsigned long']], } ], '__unnamed_28a9' : [ 0x18, { 'Polled' : [ 0x0, ['__unnamed_28a5']], 'Interrupt' : [ 0x0, ['__unnamed_28a7']], 'LocalInterrupt' : [ 0x0, ['__unnamed_28a7']], 'Sci' : [ 0x0, ['__unnamed_28a7']], 'Nmi' : [ 0x0, ['__unnamed_28a7']], } ], '_WHEA_NOTIFICATION_DESCRIPTOR' : [ 0x1c, { 'Type' : [ 0x0, ['unsigned char']], 'Length' : [ 0x1, ['unsigned char']], 'Flags' : [ 0x2, ['_WHEA_NOTIFICATION_FLAGS']], 'u' : [ 0x4, ['__unnamed_28a9']], } ], '_POP_HIBER_CONTEXT' : [ 0x140, { 'Reset' : [ 0x0, ['unsigned char']], 'HiberFlags' : [ 0x1, ['unsigned char']], 'WroteHiberFile' : [ 0x2, ['unsigned char']], 'VerifyKernelPhaseOnResume' : [ 0x3, ['unsigned char']], 'KernelPhaseVerificationActive' : [ 0x4, ['unsigned char']], 'InitializationFinished' : [ 0x5, ['unsigned char']], 'NextTableLockHeld' : [ 0x8, ['long']], 'BootPhaseFinishedBarrier' : [ 0xc, ['long']], 'KernelResumeFinishedBarrier' : [ 0x10, ['long']], 'HvCaptureReadyBarrier' : [ 0x14, ['long']], 'HvCaptureCompletedBarrier' : [ 0x18, ['long']], 'MapFrozen' : [ 0x1c, ['unsigned char']], 'DiscardMap' : [ 0x20, ['_RTL_BITMAP']], 'KernelPhaseMap' : [ 0x20, ['_RTL_BITMAP']], 'BootPhaseMap' : [ 0x28, ['_RTL_BITMAP']], 'ClonedRanges' : [ 0x30, ['_LIST_ENTRY']], 'ClonedRangeCount' : [ 0x38, ['unsigned long']], 'ClonedPageCount' : [ 0x40, ['unsigned long long']], 'CurrentMap' : [ 0x48, ['pointer', ['_RTL_BITMAP']]], 'NextCloneRange' : [ 0x4c, ['pointer', ['_LIST_ENTRY']]], 'NextPreserve' : [ 0x50, ['unsigned long']], 'LoaderMdl' : [ 0x54, ['pointer', ['_MDL']]], 'AllocatedMdl' : [ 0x58, ['pointer', ['_MDL']]], 'PagesOut' : [ 0x60, ['unsigned long long']], 'IoPages' : [ 0x68, ['pointer', ['void']]], 'IoPagesCount' : [ 0x6c, ['unsigned long']], 'CurrentMcb' : [ 0x70, ['pointer', ['void']]], 'DumpStack' : [ 0x74, ['pointer', ['_DUMP_STACK_CONTEXT']]], 'WakeState' : [ 0x78, ['pointer', ['_KPROCESSOR_STATE']]], 'IoProgress' : [ 0x7c, ['unsigned long']], 'Status' : [ 0x80, ['long']], 'GraphicsProc' : [ 0x84, ['unsigned long']], 'MemoryImage' : [ 0x88, ['pointer', ['PO_MEMORY_IMAGE']]], 'PerformanceStats' : [ 0x8c, ['pointer', ['unsigned long']]], 'BootLoaderLogMdl' : [ 0x90, ['pointer', ['_MDL']]], 'SiLogOffset' : [ 0x94, ['unsigned long']], 'FirmwareRuntimeInformationMdl' : [ 0x98, ['pointer', ['_MDL']]], 'FirmwareRuntimeInformationVa' : [ 0x9c, ['pointer', ['void']]], 'ResumeContext' : [ 0xa0, ['pointer', ['void']]], 'ResumeContextPages' : [ 0xa4, ['unsigned long']], 'ProcessorCount' : [ 0xa8, ['unsigned long']], 'ProcessorContext' : [ 0xac, ['pointer', ['_POP_PER_PROCESSOR_CONTEXT']]], 'ProdConsBuffer' : [ 0xb0, ['pointer', ['unsigned char']]], 'ProdConsSize' : [ 0xb4, ['unsigned long']], 'MaxDataPages' : [ 0xb8, ['unsigned long']], 'ExtraBuffer' : [ 0xbc, ['pointer', ['void']]], 'ExtraBufferSize' : [ 0xc0, ['unsigned long']], 'ExtraMapVa' : [ 0xc4, ['pointer', ['void']]], 'BitlockerKeyPFN' : [ 0xc8, ['unsigned long']], 'IoInfo' : [ 0xd0, ['_POP_IO_INFO']], 'IoChecksums' : [ 0x130, ['pointer', ['unsigned short']]], 'IoChecksumsSize' : [ 0x134, ['unsigned long']], 'HardwareConfigurationSignature' : [ 0x138, ['unsigned long']], } ], '_OBJECT_REF_TRACE' : [ 0x40, { 'StackTrace' : [ 0x0, ['array', 16, ['pointer', ['void']]]], } ], '_CVDD' : [ 0x1c, { 'Signature' : [ 0x0, ['unsigned long']], 'NB10' : [ 0x0, ['_NB10']], 'RsDs' : [ 0x0, ['_RSDS']], } ], '_OBJECT_NAME_INFORMATION' : [ 0x8, { 'Name' : [ 0x0, ['_UNICODE_STRING']], } ], '_WHEA_AER_BRIDGE_DESCRIPTOR' : [ 0x2c, { 'Type' : [ 0x0, ['unsigned short']], 'Enabled' : [ 0x2, ['unsigned char']], 'Reserved' : [ 0x3, ['unsigned char']], 'BusNumber' : [ 0x4, ['unsigned long']], 'Slot' : [ 0x8, ['_WHEA_PCI_SLOT_NUMBER']], 'DeviceControl' : [ 0xc, ['unsigned short']], 'Flags' : [ 0xe, ['_AER_BRIDGE_DESCRIPTOR_FLAGS']], 'UncorrectableErrorMask' : [ 0x10, ['unsigned long']], 'UncorrectableErrorSeverity' : [ 0x14, ['unsigned long']], 'CorrectableErrorMask' : [ 0x18, ['unsigned long']], 'AdvancedCapsAndControl' : [ 0x1c, ['unsigned long']], 'SecondaryUncorrectableErrorMask' : [ 0x20, ['unsigned long']], 'SecondaryUncorrectableErrorSev' : [ 0x24, ['unsigned long']], 'SecondaryCapsAndControl' : [ 0x28, ['unsigned long']], } ], '_POP_FX_PERF_INFO' : [ 0x60, { 'Component' : [ 0x0, ['pointer', ['_POP_FX_COMPONENT']]], 'CompletedEvent' : [ 0x4, ['_KEVENT']], 'ComponentPerfState' : [ 0x14, ['pointer', ['void']]], 'Flags' : [ 0x18, ['_POP_FX_PERF_FLAGS']], 'LastChange' : [ 0x1c, ['pointer', ['_PO_FX_PERF_STATE_CHANGE']]], 'LastChangeCount' : [ 0x20, ['unsigned long']], 'LastChangeStamp' : [ 0x28, ['unsigned long long']], 'LastChangeNominal' : [ 0x30, ['unsigned char']], 'PepRegistered' : [ 0x31, ['unsigned char']], 'QueryOnIdleStates' : [ 0x32, ['unsigned char']], 'RequestDriverContext' : [ 0x34, ['pointer', ['void']]], 'WorkOrder' : [ 0x38, ['_POP_FX_WORK_ORDER']], 'SetsCount' : [ 0x54, ['unsigned long']], 'Sets' : [ 0x58, ['pointer', ['_POP_FX_PERF_SET']]], } ], '_HAL_CHANNEL_MEMORY_RANGES' : [ 0xc, { 'PageFrameIndex' : [ 0x0, ['unsigned long']], 'MpnId' : [ 0x4, ['unsigned short']], 'Node' : [ 0x6, ['unsigned short']], 'Channel' : [ 0x8, ['unsigned short']], 'IsPowerManageable' : [ 0xa, ['unsigned char']], 'DeepPowerState' : [ 0xb, ['unsigned char']], } ], '_PCW_COUNTER_INFORMATION' : [ 0x10, { 'CounterMask' : [ 0x0, ['unsigned long long']], 'InstanceMask' : [ 0x8, ['pointer', ['_UNICODE_STRING']]], } ], '_DUMP_STACK_CONTEXT' : [ 0x100, { 'Init' : [ 0x0, ['_DUMP_INITIALIZATION_CONTEXT']], 'PartitionOffset' : [ 0xc0, ['_LARGE_INTEGER']], 'DumpPointers' : [ 0xc8, ['pointer', ['void']]], 'PointersLength' : [ 0xcc, ['unsigned long']], 'ModulePrefix' : [ 0xd0, ['pointer', ['unsigned short']]], 'DriverList' : [ 0xd4, ['_LIST_ENTRY']], 'InitMsg' : [ 0xdc, ['_STRING']], 'ProgMsg' : [ 0xe4, ['_STRING']], 'DoneMsg' : [ 0xec, ['_STRING']], 'FileObject' : [ 0xf4, ['pointer', ['void']]], 'UsageType' : [ 0xf8, ['Enumeration', dict(target = 'long', choices = {0: 'DeviceUsageTypeUndefined', 1: 'DeviceUsageTypePaging', 2: 'DeviceUsageTypeHibernation', 3: 'DeviceUsageTypeDumpFile', 4: 'DeviceUsageTypeBoot', 5: 'DeviceUsageTypePostDisplay'})]], } ], '_PAE_PAGEINFO' : [ 0x10, { 'ListHead' : [ 0x0, ['_LIST_ENTRY']], 'PageFrameNumber' : [ 0x8, ['unsigned long']], 'EntriesInUse' : [ 0xc, ['unsigned long']], } ], '_FILE_STANDARD_INFORMATION' : [ 0x18, { 'AllocationSize' : [ 0x0, ['_LARGE_INTEGER']], 'EndOfFile' : [ 0x8, ['_LARGE_INTEGER']], 'NumberOfLinks' : [ 0x10, ['unsigned long']], 'DeletePending' : [ 0x14, ['unsigned char']], 'Directory' : [ 0x15, ['unsigned char']], } ], '_ETW_FILTER_STRING_TOKEN' : [ 0xc, { 'Count' : [ 0x0, ['unsigned short']], 'Tokens' : [ 0x4, ['array', 1, ['_ETW_FILTER_STRING_TOKEN_ELEMENT']]], } ], '_POP_SHUTDOWN_BUG_CHECK' : [ 0x24, { 'InitiatingThread' : [ 0x0, ['pointer', ['_ETHREAD']]], 'InitiatingProcess' : [ 0x4, ['pointer', ['_EPROCESS']]], 'ThreadId' : [ 0x8, ['pointer', ['void']]], 'ProcessId' : [ 0xc, ['pointer', ['void']]], 'Code' : [ 0x10, ['unsigned long']], 'Parameter1' : [ 0x14, ['unsigned long']], 'Parameter2' : [ 0x18, ['unsigned long']], 'Parameter3' : [ 0x1c, ['unsigned long']], 'Parameter4' : [ 0x20, ['unsigned long']], } ], '_NB10' : [ 0x14, { 'Signature' : [ 0x0, ['unsigned long']], 'Offset' : [ 0x4, ['unsigned long']], 'TimeStamp' : [ 0x8, ['unsigned long']], 'Age' : [ 0xc, ['unsigned long']], 'PdbName' : [ 0x10, ['array', 1, ['unsigned char']]], } ], '_PCW_MASK_INFORMATION' : [ 0x20, { 'CounterMask' : [ 0x0, ['unsigned long long']], 'InstanceMask' : [ 0x8, ['pointer', ['_UNICODE_STRING']]], 'InstanceId' : [ 0xc, ['unsigned long']], 'CollectMultiple' : [ 0x10, ['unsigned char']], 'Buffer' : [ 0x14, ['pointer', ['_PCW_BUFFER']]], 'CancelEvent' : [ 0x18, ['pointer', ['_KEVENT']]], } ], '_SECURITY_DESCRIPTOR_RELATIVE' : [ 0x14, { 'Revision' : [ 0x0, ['unsigned char']], 'Sbz1' : [ 0x1, ['unsigned char']], 'Control' : [ 0x2, ['unsigned short']], 'Owner' : [ 0x4, ['unsigned long']], 'Group' : [ 0x8, ['unsigned long']], 'Sacl' : [ 0xc, ['unsigned long']], 'Dacl' : [ 0x10, ['unsigned long']], } ], '_FS_FILTER_SECTION_SYNC_OUTPUT' : [ 0x10, { 'StructureSize' : [ 0x0, ['unsigned long']], 'SizeReturned' : [ 0x4, ['unsigned long']], 'Flags' : [ 0x8, ['unsigned long']], 'DesiredReadAlignment' : [ 0xc, ['unsigned long']], } ], '_HVIEW_MAP_PIN_LOG_ENTRY' : [ 0x30, { 'ViewOffset' : [ 0x0, ['unsigned long']], 'Pinned' : [ 0x4, ['unsigned char']], 'PinMask' : [ 0x8, ['unsigned long long']], 'Thread' : [ 0x10, ['pointer', ['_KTHREAD']]], 'Stack' : [ 0x14, ['array', 6, ['pointer', ['void']]]], } ], '__unnamed_28e9' : [ 0x10, { 'TestAllocation' : [ 0x0, ['_ARBITER_TEST_ALLOCATION_PARAMETERS']], 'RetestAllocation' : [ 0x0, ['_ARBITER_RETEST_ALLOCATION_PARAMETERS']], 'BootAllocation' : [ 0x0, ['_ARBITER_BOOT_ALLOCATION_PARAMETERS']], 'QueryAllocatedResources' : [ 0x0, ['_ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS']], 'QueryConflict' : [ 0x0, ['_ARBITER_QUERY_CONFLICT_PARAMETERS']], 'QueryArbitrate' : [ 0x0, ['_ARBITER_QUERY_ARBITRATE_PARAMETERS']], 'AddReserved' : [ 0x0, ['_ARBITER_ADD_RESERVED_PARAMETERS']], } ], '_ARBITER_PARAMETERS' : [ 0x10, { 'Parameters' : [ 0x0, ['__unnamed_28e9']], } ], '__unnamed_28ed' : [ 0x8, { 'idxRecord' : [ 0x0, ['unsigned long']], 'cidContainer' : [ 0x4, ['unsigned long']], } ], '_CLS_LSN' : [ 0x8, { 'offset' : [ 0x0, ['__unnamed_28ed']], 'ullOffset' : [ 0x0, ['unsigned long long']], } ], '_MI_FILE_EXTENTS_WAIT_BLOCK' : [ 0x14, { 'Next' : [ 0x0, ['pointer', ['_MI_FILE_EXTENTS_WAIT_BLOCK']]], 'Gate' : [ 0x4, ['_KGATE']], } ], 'POWER_ACTION_POLICY' : [ 0xc, { 'Action' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'PowerActionNone', 1: 'PowerActionReserved', 2: 'PowerActionSleep', 3: 'PowerActionHibernate', 4: 'PowerActionShutdown', 5: 'PowerActionShutdownReset', 6: 'PowerActionShutdownOff', 7: 'PowerActionWarmEject', 8: 'PowerActionDisplayOff'})]], 'Flags' : [ 0x4, ['unsigned long']], 'EventCode' : [ 0x8, ['unsigned long']], } ], '_KSCHEDULING_GROUP_POLICY' : [ 0x8, { 'Value' : [ 0x0, ['unsigned long']], 'Weight' : [ 0x0, ['unsigned short']], 'MinRate' : [ 0x0, ['unsigned short']], 'MaxRate' : [ 0x2, ['unsigned short']], 'AllFlags' : [ 0x4, ['unsigned long']], 'Type' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Disabled' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Spare1' : [ 0x4, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], } ], '_RSDS' : [ 0x1c, { 'Signature' : [ 0x0, ['unsigned long']], 'Guid' : [ 0x4, ['_GUID']], 'Age' : [ 0x14, ['unsigned long']], 'PdbName' : [ 0x18, ['array', 1, ['unsigned char']]], } ], 'PO_MEMORY_IMAGE' : [ 0x310, { 'Signature' : [ 0x0, ['unsigned long']], 'ImageType' : [ 0x4, ['unsigned long']], 'CheckSum' : [ 0x8, ['unsigned long']], 'LengthSelf' : [ 0xc, ['unsigned long']], 'PageSelf' : [ 0x10, ['unsigned long']], 'PageSize' : [ 0x14, ['unsigned long']], 'SystemTime' : [ 0x18, ['_LARGE_INTEGER']], 'InterruptTime' : [ 0x20, ['unsigned long long']], 'FeatureFlags' : [ 0x28, ['unsigned long long']], 'HiberFlags' : [ 0x30, ['unsigned char']], 'spare' : [ 0x31, ['array', 3, ['unsigned char']]], 'NoHiberPtes' : [ 0x34, ['unsigned long']], 'HiberVa' : [ 0x38, ['unsigned long']], 'NoFreePages' : [ 0x3c, ['unsigned long']], 'FreeMapCheck' : [ 0x40, ['unsigned long']], 'WakeCheck' : [ 0x44, ['unsigned long']], 'NumPagesForLoader' : [ 0x48, ['unsigned long long']], 'FirstBootRestorePage' : [ 0x50, ['unsigned long']], 'FirstKernelRestorePage' : [ 0x54, ['unsigned long']], 'FirstChecksumRestorePage' : [ 0x58, ['unsigned long']], 'NoChecksumEntries' : [ 0x60, ['unsigned long long']], 'PerfInfo' : [ 0x68, ['_PO_HIBER_PERF']], 'FirmwareRuntimeInformationPages' : [ 0x248, ['unsigned long']], 'FirmwareRuntimeInformation' : [ 0x24c, ['array', 1, ['unsigned long']]], 'SiLogOffset' : [ 0x250, ['unsigned long']], 'NoBootLoaderLogPages' : [ 0x254, ['unsigned long']], 'BootLoaderLogPages' : [ 0x258, ['array', 24, ['unsigned long']]], 'NotUsed' : [ 0x2b8, ['unsigned long']], 'ResumeContextCheck' : [ 0x2bc, ['unsigned long']], 'ResumeContextPages' : [ 0x2c0, ['unsigned long']], 'Hiberboot' : [ 0x2c4, ['unsigned char']], 'HvCr3' : [ 0x2c8, ['unsigned long long']], 'HvEntryPoint' : [ 0x2d0, ['unsigned long long']], 'HvReservedTransitionAddress' : [ 0x2d8, ['unsigned long long']], 'HvReservedTransitionAddressSize' : [ 0x2e0, ['unsigned long long']], 'BootFlags' : [ 0x2e8, ['unsigned long long']], 'HalEntryPointPhysical' : [ 0x2f0, ['unsigned long long']], 'HighestPhysicalPage' : [ 0x2f8, ['unsigned long']], 'BitlockerKeyPfns' : [ 0x2fc, ['array', 4, ['unsigned long']]], 'HardwareSignature' : [ 0x30c, ['unsigned long']], } ], 'BATTERY_REPORTING_SCALE' : [ 0x8, { 'Granularity' : [ 0x0, ['unsigned long']], 'Capacity' : [ 0x4, ['unsigned long']], } ], '_RTL_ATOM_TABLE_REFERENCE' : [ 0x10, { 'LowBoxList' : [ 0x0, ['_LIST_ENTRY']], 'LowBoxID' : [ 0x8, ['unsigned long']], 'ReferenceCount' : [ 0xc, ['unsigned short']], 'Flags' : [ 0xe, ['unsigned short']], } ], '_CURDIR' : [ 0xc, { 'DosPath' : [ 0x0, ['_UNICODE_STRING']], 'Handle' : [ 0x8, ['pointer', ['void']]], } ], '_PO_HIBER_PERF' : [ 0x1e0, { 'HiberIoTicks' : [ 0x0, ['unsigned long long']], 'HiberIoCpuTicks' : [ 0x8, ['unsigned long long']], 'HiberInitTicks' : [ 0x10, ['unsigned long long']], 'HiberHiberFileTicks' : [ 0x18, ['unsigned long long']], 'HiberCompressTicks' : [ 0x20, ['unsigned long long']], 'HiberSharedBufferTicks' : [ 0x28, ['unsigned long long']], 'HiberChecksumTicks' : [ 0x30, ['unsigned long long']], 'HiberChecksumIoTicks' : [ 0x38, ['unsigned long long']], 'TotalHibernateTime' : [ 0x40, ['_LARGE_INTEGER']], 'POSTTime' : [ 0x48, ['unsigned long']], 'ResumeBootMgrTime' : [ 0x4c, ['unsigned long']], 'BootmgrUserInputTime' : [ 0x50, ['unsigned long']], 'ResumeAppTicks' : [ 0x58, ['unsigned long long']], 'ResumeAppStartTimestamp' : [ 0x60, ['unsigned long long']], 'ResumeLibraryInitTicks' : [ 0x68, ['unsigned long long']], 'ResumeInitTicks' : [ 0x70, ['unsigned long long']], 'ResumeRestoreImageStartTimestamp' : [ 0x78, ['unsigned long long']], 'ResumeHiberFileTicks' : [ 0x80, ['unsigned long long']], 'ResumeIoTicks' : [ 0x88, ['unsigned long long']], 'ResumeDecompressTicks' : [ 0x90, ['unsigned long long']], 'ResumeAllocateTicks' : [ 0x98, ['unsigned long long']], 'ResumeUserInOutTicks' : [ 0xa0, ['unsigned long long']], 'ResumeMapTicks' : [ 0xa8, ['unsigned long long']], 'ResumeUnmapTicks' : [ 0xb0, ['unsigned long long']], 'ResumeChecksumTicks' : [ 0xb8, ['unsigned long long']], 'ResumeChecksumIoTicks' : [ 0xc0, ['unsigned long long']], 'ResumeKernelSwitchTimestamp' : [ 0xc8, ['unsigned long long']], 'WriteLogDataTimestamp' : [ 0xd0, ['unsigned long long']], 'KernelReturnFromHandler' : [ 0xd8, ['unsigned long long']], 'TimeStampCounterAtSwitchTime' : [ 0xe0, ['unsigned long long']], 'HalTscOffset' : [ 0xe8, ['unsigned long long']], 'HvlTscOffset' : [ 0xf0, ['unsigned long long']], 'SleeperThreadEnd' : [ 0xf8, ['unsigned long long']], 'KernelReturnSystemPowerStateTimestamp' : [ 0x100, ['unsigned long long']], 'IoBoundedness' : [ 0x108, ['unsigned long long']], 'KernelDecompressTicks' : [ 0x110, ['unsigned long long']], 'KernelIoTicks' : [ 0x118, ['unsigned long long']], 'KernelCopyTicks' : [ 0x120, ['unsigned long long']], 'ReadCheckCount' : [ 0x128, ['unsigned long long']], 'KernelInitTicks' : [ 0x130, ['unsigned long long']], 'KernelResumeHiberFileTicks' : [ 0x138, ['unsigned long long']], 'KernelIoCpuTicks' : [ 0x140, ['unsigned long long']], 'KernelSharedBufferTicks' : [ 0x148, ['unsigned long long']], 'KernelAnimationTicks' : [ 0x150, ['unsigned long long']], 'KernelChecksumTicks' : [ 0x158, ['unsigned long long']], 'KernelChecksumIoTicks' : [ 0x160, ['unsigned long long']], 'AnimationStart' : [ 0x168, ['_LARGE_INTEGER']], 'AnimationStop' : [ 0x170, ['_LARGE_INTEGER']], 'DeviceResumeTime' : [ 0x178, ['unsigned long']], 'SecurePagesProcessed' : [ 0x180, ['unsigned long long']], 'BootPagesProcessed' : [ 0x188, ['unsigned long long']], 'KernelPagesProcessed' : [ 0x190, ['unsigned long long']], 'BootBytesWritten' : [ 0x198, ['unsigned long long']], 'KernelBytesWritten' : [ 0x1a0, ['unsigned long long']], 'BootPagesWritten' : [ 0x1a8, ['unsigned long long']], 'KernelPagesWritten' : [ 0x1b0, ['unsigned long long']], 'BytesWritten' : [ 0x1b8, ['unsigned long long']], 'PagesWritten' : [ 0x1c0, ['unsigned long']], 'FileRuns' : [ 0x1c4, ['unsigned long']], 'NoMultiStageResumeReason' : [ 0x1c8, ['unsigned long']], 'MaxHuffRatio' : [ 0x1cc, ['unsigned long']], 'AdjustedTotalResumeTime' : [ 0x1d0, ['unsigned long long']], 'ResumeCompleteTimestamp' : [ 0x1d8, ['unsigned long long']], } ], '_MI_QUEUED_DEADSTACK_WORKITEM' : [ 0x14, { 'WorkItem' : [ 0x0, ['_WORK_QUEUE_ITEM']], 'Active' : [ 0x10, ['long']], } ], '_POP_FX_PROVIDER' : [ 0x8, { 'Index' : [ 0x0, ['unsigned long']], 'Activating' : [ 0x4, ['unsigned char']], } ], '_RTL_BALANCED_LINKS' : [ 0x10, { 'Parent' : [ 0x0, ['pointer', ['_RTL_BALANCED_LINKS']]], 'LeftChild' : [ 0x4, ['pointer', ['_RTL_BALANCED_LINKS']]], 'RightChild' : [ 0x8, ['pointer', ['_RTL_BALANCED_LINKS']]], 'Balance' : [ 0xc, ['unsigned char']], 'Reserved' : [ 0xd, ['array', 3, ['unsigned char']]], } ], '_FREE_DISPLAY' : [ 0x10, { 'RealVectorSize' : [ 0x0, ['unsigned long']], 'Hint' : [ 0x4, ['unsigned long']], 'Display' : [ 0x8, ['_RTL_BITMAP']], } ], '_MMINPAGE_SUPPORT_FLOW_THROUGH' : [ 0x1c, { 'Page' : [ 0x0, ['array', 1, ['unsigned long']]], 'InitialInPageSupport' : [ 0x4, ['pointer', ['_MMINPAGE_SUPPORT']]], 'PagingFile' : [ 0x8, ['pointer', ['_MMPAGING_FILE']]], 'PageFileOffset' : [ 0xc, ['unsigned long']], 'Node' : [ 0x10, ['_RTL_BALANCED_NODE']], } ], '_POP_PER_PROCESSOR_CONTEXT' : [ 0x70, { 'UncompressedData' : [ 0x0, ['pointer', ['unsigned char']]], 'MappingVa' : [ 0x4, ['pointer', ['void']]], 'XpressEncodeWorkspace' : [ 0x8, ['pointer', ['void']]], 'CompressedDataBuffer' : [ 0xc, ['pointer', ['unsigned char']]], 'CopyTicks' : [ 0x10, ['unsigned long long']], 'CompressTicks' : [ 0x18, ['unsigned long long']], 'BytesCopied' : [ 0x20, ['unsigned long long']], 'PagesProcessed' : [ 0x28, ['unsigned long long']], 'DecompressTicks' : [ 0x30, ['unsigned long long']], 'ResumeCopyTicks' : [ 0x38, ['unsigned long long']], 'SharedBufferTicks' : [ 0x40, ['unsigned long long']], 'DecompressTicksByMethod' : [ 0x48, ['array', 2, ['unsigned long long']]], 'DecompressSizeByMethod' : [ 0x58, ['array', 2, ['unsigned long long']]], 'CompressCount' : [ 0x68, ['unsigned long']], 'HuffCompressCount' : [ 0x6c, ['unsigned long']], } ], '_IO_REMOVE_LOCK' : [ 0x18, { 'Common' : [ 0x0, ['_IO_REMOVE_LOCK_COMMON_BLOCK']], } ], '_POP_IO_INFO' : [ 0x60, { 'DumpMdl' : [ 0x0, ['pointer', ['_MDL']]], 'IoStatus' : [ 0x4, ['Enumeration', dict(target = 'long', choices = {0: 'IoReady', 1: 'IoPending', 2: 'IoDone'})]], 'IoStartCount' : [ 0x8, ['unsigned long long']], 'IoBytesCompleted' : [ 0x10, ['unsigned long long']], 'IoBytesInProgress' : [ 0x18, ['unsigned long long']], 'RequestSize' : [ 0x20, ['unsigned long long']], 'IoLocation' : [ 0x28, ['_LARGE_INTEGER']], 'FileOffset' : [ 0x30, ['unsigned long long']], 'Buffer' : [ 0x38, ['pointer', ['void']]], 'AsyncCapable' : [ 0x3c, ['unsigned char']], 'BytesToRead' : [ 0x40, ['unsigned long long']], 'Pages' : [ 0x48, ['unsigned long']], 'HighestChecksumIndex' : [ 0x50, ['unsigned long long']], 'PreviousChecksum' : [ 0x58, ['unsigned short']], } ], '_LDRP_CSLIST' : [ 0x4, { 'Tail' : [ 0x0, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_NON_PAGED_DEBUG_INFO' : [ 0x20, { 'Signature' : [ 0x0, ['unsigned short']], 'Flags' : [ 0x2, ['unsigned short']], 'Size' : [ 0x4, ['unsigned long']], 'Machine' : [ 0x8, ['unsigned short']], 'Characteristics' : [ 0xa, ['unsigned short']], 'TimeDateStamp' : [ 0xc, ['unsigned long']], 'CheckSum' : [ 0x10, ['unsigned long']], 'SizeOfImage' : [ 0x14, ['unsigned long']], 'ImageBase' : [ 0x18, ['unsigned long long']], } ], '_POP_FX_PERF_SET' : [ 0x20, { 'PerfSet' : [ 0x0, ['pointer', ['_PO_FX_COMPONENT_PERF_SET']]], 'CurrentPerf' : [ 0x8, ['unsigned long long']], 'CurrentPerfStamp' : [ 0x10, ['unsigned long long']], 'CurrentPerfNominal' : [ 0x18, ['unsigned char']], } ], '_AER_BRIDGE_DESCRIPTOR_FLAGS' : [ 0x2, { 'UncorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'UncorrectableErrorSeverityRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'CorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'AdvancedCapsAndControlRW' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'SecondaryUncorrectableErrorMaskRW' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'SecondaryUncorrectableErrorSevRW' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned short')]], 'SecondaryCapsAndControlRW' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned short')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 16, native_type='unsigned short')]], 'AsUSHORT' : [ 0x0, ['unsigned short']], } ], '_MM_SESSION_SPACE_FLAGS' : [ 0x4, { 'Initialized' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'DeletePending' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'PoolInitialized' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned long')]], 'DynamicVaInitialized' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned long')]], 'WsInitialized' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned long')]], 'PoolDestroyed' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'ObjectInitialized' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'LeakedPoolDeliberately' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Filler' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 32, native_type='unsigned long')]], } ], '_RTL_CRITICAL_SECTION_DEBUG' : [ 0x20, { 'Type' : [ 0x0, ['unsigned short']], 'CreatorBackTraceIndex' : [ 0x2, ['unsigned short']], 'CriticalSection' : [ 0x4, ['pointer', ['_RTL_CRITICAL_SECTION']]], 'ProcessLocksList' : [ 0x8, ['_LIST_ENTRY']], 'EntryCount' : [ 0x10, ['unsigned long']], 'ContentionCount' : [ 0x14, ['unsigned long']], 'Flags' : [ 0x18, ['unsigned long']], 'CreatorBackTraceIndexHigh' : [ 0x1c, ['unsigned short']], 'SpareUSHORT' : [ 0x1e, ['unsigned short']], } ], '__unnamed_292a' : [ 0x8, { 'Gsiv' : [ 0x0, ['unsigned long']], 'WakeInterrupt' : [ 0x4, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'ReservedFlags' : [ 0x4, ['BitField', dict(start_bit = 1, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_292c' : [ 0x10, { 'Address' : [ 0x0, ['_LARGE_INTEGER']], 'DataPayload' : [ 0x8, ['unsigned long']], } ], '__unnamed_292f' : [ 0x8, { 'IntrInfo' : [ 0x0, ['_INTERRUPT_HT_INTR_INFO']], } ], '__unnamed_2933' : [ 0x4, { 'DestinationMode' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {1: 'ApicDestinationModePhysical', 2: 'ApicDestinationModeLogicalFlat', 3: 'ApicDestinationModeLogicalClustered', 4: 'ApicDestinationModeUnknown'})]], } ], '_INTERRUPT_VECTOR_DATA' : [ 0x48, { 'Type' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {0: 'InterruptTypeControllerInput', 1: 'InterruptTypeXapicMessage', 2: 'InterruptTypeHypertransport', 3: 'InterruptTypeMessageRequest'})]], 'Vector' : [ 0x4, ['unsigned long']], 'Irql' : [ 0x8, ['unsigned char']], 'Polarity' : [ 0xc, ['Enumeration', dict(target = 'long', choices = {0: 'InterruptPolarityUnknown', 1: 'InterruptRisingEdge', 2: 'InterruptFallingEdge', 3: 'InterruptActiveBothTriggerLow', 4: 'InterruptActiveBothTriggerHigh'})]], 'Mode' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'LevelSensitive', 1: 'Latched'})]], 'TargetProcessors' : [ 0x14, ['_GROUP_AFFINITY']], 'IntRemapInfo' : [ 0x20, ['_INTERRUPT_REMAPPING_INFO']], 'ControllerInput' : [ 0x30, ['__unnamed_292a']], 'XapicMessage' : [ 0x38, ['__unnamed_292c']], 'Hypertransport' : [ 0x38, ['__unnamed_292f']], 'GenericMessage' : [ 0x38, ['__unnamed_292c']], 'MessageRequest' : [ 0x38, ['__unnamed_2933']], } ], '_MMPAGE_FILE_EXPANSION_FLAGS' : [ 0x4, { 'PageFileNumber' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'Spare1' : [ 0x1, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'Spare2' : [ 0x2, ['BitField', dict(start_bit = 0, end_bit = 8, native_type='unsigned char')]], 'IgnoreCurrentCommit' : [ 0x3, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned char')]], 'IncreaseMinimumSize' : [ 0x3, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned char')]], 'Spare3' : [ 0x3, ['BitField', dict(start_bit = 2, end_bit = 8, native_type='unsigned char')]], } ], '_POP_FX_DEPENDENT' : [ 0x8, { 'Index' : [ 0x0, ['unsigned long']], 'ProviderIndex' : [ 0x4, ['unsigned long']], } ], '__unnamed_2941' : [ 0x8, { 'Count' : [ 0x0, ['unsigned long']], 'States' : [ 0x4, ['pointer', ['_PO_FX_PERF_STATE']]], } ], '__unnamed_2943' : [ 0x10, { 'Minimum' : [ 0x0, ['unsigned long long']], 'Maximum' : [ 0x8, ['unsigned long long']], } ], '_PO_FX_COMPONENT_PERF_SET' : [ 0x28, { 'Name' : [ 0x0, ['_UNICODE_STRING']], 'Flags' : [ 0x8, ['unsigned long long']], 'Unit' : [ 0x10, ['Enumeration', dict(target = 'long', choices = {0: 'PoFxPerfStateUnitOther', 1: 'PoFxPerfStateUnitFrequency', 2: 'PoFxPerfStateUnitBandwidth', 3: 'PoFxPerfStateUnitMaximum'})]], 'Type' : [ 0x14, ['Enumeration', dict(target = 'long', choices = {0: 'PoFxPerfStateTypeDiscrete', 1: 'PoFxPerfStateTypeRange', 2: 'PoFxPerfStateTypeMaximum'})]], 'Discrete' : [ 0x18, ['__unnamed_2941']], 'Range' : [ 0x18, ['__unnamed_2943']], } ], '_XPF_MCE_FLAGS' : [ 0x4, { 'MCG_CapabilityRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'MCG_GlobalControlRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 32, native_type='unsigned long')]], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '__unnamed_2954' : [ 0x8, { 'Signature' : [ 0x0, ['unsigned long']], 'CheckSum' : [ 0x4, ['unsigned long']], } ], '__unnamed_2956' : [ 0x10, { 'DiskId' : [ 0x0, ['_GUID']], } ], '__unnamed_2958' : [ 0x10, { 'Mbr' : [ 0x0, ['__unnamed_2954']], 'Gpt' : [ 0x0, ['__unnamed_2956']], } ], '_DUMP_INITIALIZATION_CONTEXT' : [ 0xc0, { 'Length' : [ 0x0, ['unsigned long']], 'Reserved' : [ 0x4, ['unsigned long']], 'MemoryBlock' : [ 0x8, ['pointer', ['void']]], 'CommonBuffer' : [ 0xc, ['array', 2, ['pointer', ['void']]]], 'PhysicalAddress' : [ 0x18, ['array', 2, ['_LARGE_INTEGER']]], 'StallRoutine' : [ 0x28, ['pointer', ['void']]], 'OpenRoutine' : [ 0x2c, ['pointer', ['void']]], 'WriteRoutine' : [ 0x30, ['pointer', ['void']]], 'FinishRoutine' : [ 0x34, ['pointer', ['void']]], 'AdapterObject' : [ 0x38, ['pointer', ['_ADAPTER_OBJECT']]], 'MappedRegisterBase' : [ 0x3c, ['pointer', ['void']]], 'PortConfiguration' : [ 0x40, ['pointer', ['void']]], 'CrashDump' : [ 0x44, ['unsigned char']], 'MarkMemoryOnly' : [ 0x45, ['unsigned char']], 'HiberResume' : [ 0x46, ['unsigned char']], 'Reserved1' : [ 0x47, ['unsigned char']], 'MaximumTransferSize' : [ 0x48, ['unsigned long']], 'CommonBufferSize' : [ 0x4c, ['unsigned long']], 'TargetAddress' : [ 0x50, ['pointer', ['void']]], 'WritePendingRoutine' : [ 0x54, ['pointer', ['void']]], 'PartitionStyle' : [ 0x58, ['unsigned long']], 'DiskInfo' : [ 0x5c, ['__unnamed_2958']], 'ReadRoutine' : [ 0x6c, ['pointer', ['void']]], 'GetDriveTelemetryRoutine' : [ 0x70, ['pointer', ['void']]], 'LogSectionTruncateSize' : [ 0x74, ['unsigned long']], 'Parameters' : [ 0x78, ['array', 16, ['unsigned long']]], 'GetTransferSizesRoutine' : [ 0xb8, ['pointer', ['void']]], 'DumpNotifyRoutine' : [ 0xbc, ['pointer', ['void']]], } ], '_MI_IO_CACHE_STATS' : [ 0x18, { 'UnusedBlocks' : [ 0x0, ['unsigned long']], 'ActiveCacheMatch' : [ 0x4, ['unsigned long']], 'ActiveCacheOverride' : [ 0x8, ['unsigned long']], 'UnmappedCacheFlush' : [ 0xc, ['unsigned long']], 'UnmappedCacheMatch' : [ 0x10, ['unsigned long']], 'UnmappedCacheConflict' : [ 0x14, ['unsigned long']], } ], '_PROCESSOR_PLATFORM_STATE_RESIDENCY' : [ 0x10, { 'Residency' : [ 0x0, ['unsigned long long']], 'TransitionCount' : [ 0x8, ['unsigned long long']], } ], '_ETW_QUEUE_ENTRY' : [ 0x20, { 'ListEntry' : [ 0x0, ['_LIST_ENTRY']], 'DataBlock' : [ 0x8, ['pointer', ['_ETWP_NOTIFICATION_HEADER']]], 'RegEntry' : [ 0xc, ['pointer', ['_ETW_REG_ENTRY']]], 'ReplyObject' : [ 0x10, ['pointer', ['_ETW_REG_ENTRY']]], 'WakeReference' : [ 0x14, ['pointer', ['void']]], 'RegIndex' : [ 0x18, ['unsigned short']], 'ReplyIndex' : [ 0x1a, ['unsigned short']], 'Flags' : [ 0x1c, ['unsigned long']], } ], '_MI_RESERVATION_CLUSTER_INFO' : [ 0x4, { 'ClusterSize' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 10, native_type='unsigned long')]], 'SequenceNumber' : [ 0x0, ['BitField', dict(start_bit = 10, end_bit = 32, native_type='unsigned long')]], 'EntireInfo' : [ 0x0, ['long']], } ], '_TRIAGE_POP_IRP_DATA' : [ 0x10, { 'Link' : [ 0x0, ['_LIST_ENTRY']], 'Irp' : [ 0x8, ['pointer', ['_IRP']]], 'Pdo' : [ 0xc, ['pointer', ['_DEVICE_OBJECT']]], } ], '_KDPC_LIST' : [ 0x8, { 'ListHead' : [ 0x0, ['_SINGLE_LIST_ENTRY']], 'LastEntry' : [ 0x4, ['pointer', ['_SINGLE_LIST_ENTRY']]], } ], '_CM_KEY_SECURITY' : [ 0x28, { 'Signature' : [ 0x0, ['unsigned short']], 'Reserved' : [ 0x2, ['unsigned short']], 'Flink' : [ 0x4, ['unsigned long']], 'Blink' : [ 0x8, ['unsigned long']], 'ReferenceCount' : [ 0xc, ['unsigned long']], 'DescriptorLength' : [ 0x10, ['unsigned long']], 'Descriptor' : [ 0x14, ['_SECURITY_DESCRIPTOR_RELATIVE']], } ], '_PO_DEVICE_NOTIFY_ORDER' : [ 0xd0, { 'Locked' : [ 0x0, ['unsigned char']], 'WarmEjectPdoPointer' : [ 0x4, ['pointer', ['pointer', ['_DEVICE_OBJECT']]]], 'OrderLevel' : [ 0x8, ['array', 5, ['_PO_NOTIFY_ORDER_LEVEL']]], } ], '_IO_REMOVE_LOCK_COMMON_BLOCK' : [ 0x18, { 'Removed' : [ 0x0, ['unsigned char']], 'Reserved' : [ 0x1, ['array', 3, ['unsigned char']]], 'IoCount' : [ 0x4, ['long']], 'RemoveEvent' : [ 0x8, ['_KEVENT']], } ], '_POP_FX_IDLE_STATE' : [ 0x18, { 'TransitionLatency' : [ 0x0, ['unsigned long long']], 'ResidencyRequirement' : [ 0x8, ['unsigned long long']], 'NominalPower' : [ 0x10, ['unsigned long']], } ], '_WHEA_NOTIFICATION_FLAGS' : [ 0x2, { 'PollIntervalRW' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned short')]], 'SwitchToPollingThresholdRW' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned short')]], 'SwitchToPollingWindowRW' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 3, native_type='unsigned short')]], 'ErrorThresholdRW' : [ 0x0, ['BitField', dict(start_bit = 3, end_bit = 4, native_type='unsigned short')]], 'ErrorThresholdWindowRW' : [ 0x0, ['BitField', dict(start_bit = 4, end_bit = 5, native_type='unsigned short')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 16, native_type='unsigned short')]], 'AsUSHORT' : [ 0x0, ['unsigned short']], } ], '_ARBITER_CONFLICT_INFO' : [ 0x18, { 'OwningObject' : [ 0x0, ['pointer', ['_DEVICE_OBJECT']]], 'Start' : [ 0x8, ['unsigned long long']], 'End' : [ 0x10, ['unsigned long long']], } ], '_PO_NOTIFY_ORDER_LEVEL' : [ 0x28, { 'DeviceCount' : [ 0x0, ['unsigned long']], 'ActiveCount' : [ 0x4, ['unsigned long']], 'WaitSleep' : [ 0x8, ['_LIST_ENTRY']], 'ReadySleep' : [ 0x10, ['_LIST_ENTRY']], 'ReadyS0' : [ 0x18, ['_LIST_ENTRY']], 'WaitS0' : [ 0x20, ['_LIST_ENTRY']], } ], '_ETWP_NOTIFICATION_HEADER' : [ 0x48, { 'NotificationType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {1: 'EtwNotificationTypeNoReply', 2: 'EtwNotificationTypeLegacyEnable', 3: 'EtwNotificationTypeEnable', 4: 'EtwNotificationTypePrivateLogger', 5: 'EtwNotificationTypePerflib', 6: 'EtwNotificationTypeAudio', 7: 'EtwNotificationTypeSession', 8: 'EtwNotificationTypeReserved', 9: 'EtwNotificationTypeCredentialUI', 10: 'EtwNotificationTypeInProcSession', 11: 'EtwNotificationTypeMax'})]], 'NotificationSize' : [ 0x4, ['unsigned long']], 'RefCount' : [ 0x8, ['long']], 'ReplyRequested' : [ 0xc, ['unsigned char']], 'ReplyIndex' : [ 0x10, ['unsigned long']], 'Timeout' : [ 0x10, ['unsigned long']], 'ReplyCount' : [ 0x14, ['unsigned long']], 'NotifyeeCount' : [ 0x14, ['unsigned long']], 'ReplyHandle' : [ 0x18, ['unsigned long long']], 'ReplyObject' : [ 0x18, ['pointer', ['void']]], 'RegIndex' : [ 0x18, ['unsigned long']], 'TargetPID' : [ 0x20, ['unsigned long']], 'SourcePID' : [ 0x24, ['unsigned long']], 'DestinationGuid' : [ 0x28, ['_GUID']], 'SourceGuid' : [ 0x38, ['_GUID']], } ], '__unnamed_298b' : [ 0x4, { 'Mask' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 1, native_type='unsigned long')]], 'Polarity' : [ 0x0, ['BitField', dict(start_bit = 1, end_bit = 2, native_type='unsigned long')]], 'MessageType' : [ 0x0, ['BitField', dict(start_bit = 2, end_bit = 5, native_type='unsigned long')]], 'RequestEOI' : [ 0x0, ['BitField', dict(start_bit = 5, end_bit = 6, native_type='unsigned long')]], 'DestinationMode' : [ 0x0, ['BitField', dict(start_bit = 6, end_bit = 7, native_type='unsigned long')]], 'MessageType3' : [ 0x0, ['BitField', dict(start_bit = 7, end_bit = 8, native_type='unsigned long')]], 'Destination' : [ 0x0, ['BitField', dict(start_bit = 8, end_bit = 16, native_type='unsigned long')]], 'Vector' : [ 0x0, ['BitField', dict(start_bit = 16, end_bit = 24, native_type='unsigned long')]], 'ExtendedAddress' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_298d' : [ 0x4, { 'bits' : [ 0x0, ['__unnamed_298b']], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '__unnamed_2990' : [ 0x4, { 'ExtendedDestination' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 24, native_type='unsigned long')]], 'Reserved' : [ 0x0, ['BitField', dict(start_bit = 24, end_bit = 30, native_type='unsigned long')]], 'PassPW' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'WaitingForEOI' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], } ], '__unnamed_2992' : [ 0x4, { 'bits' : [ 0x0, ['__unnamed_2990']], 'AsULONG' : [ 0x0, ['unsigned long']], } ], '_INTERRUPT_HT_INTR_INFO' : [ 0x8, { 'LowPart' : [ 0x0, ['__unnamed_298d']], 'HighPart' : [ 0x4, ['__unnamed_2992']], } ], '_THREAD_PERFORMANCE_DATA' : [ 0x1c0, { 'Size' : [ 0x0, ['unsigned short']], 'Version' : [ 0x2, ['unsigned short']], 'ProcessorNumber' : [ 0x4, ['_PROCESSOR_NUMBER']], 'ContextSwitches' : [ 0x8, ['unsigned long']], 'HwCountersCount' : [ 0xc, ['unsigned long']], 'UpdateCount' : [ 0x10, ['unsigned long long']], 'WaitReasonBitMap' : [ 0x18, ['unsigned long long']], 'HardwareCounters' : [ 0x20, ['unsigned long long']], 'CycleTime' : [ 0x28, ['_COUNTER_READING']], 'HwCounters' : [ 0x40, ['array', 16, ['_COUNTER_READING']]], } ], '_ETW_REPLY_QUEUE' : [ 0x2c, { 'Queue' : [ 0x0, ['_KQUEUE']], 'EventsLost' : [ 0x28, ['long']], } ], '_PROC_PERF_CHECK_SNAP' : [ 0x50, { 'Time' : [ 0x0, ['unsigned long long']], 'Active' : [ 0x8, ['unsigned long long']], 'Stall' : [ 0x10, ['unsigned long long']], 'FrequencyScaledActive' : [ 0x18, ['unsigned long long']], 'PerformanceScaledActive' : [ 0x20, ['unsigned long long']], 'PerformanceScaledKernelActive' : [ 0x28, ['unsigned long long']], 'CyclesActive' : [ 0x30, ['unsigned long long']], 'CyclesAffinitized' : [ 0x38, ['unsigned long long']], 'TaggedThreadCycles' : [ 0x40, ['array', 2, ['unsigned long long']]], } ], '_ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS' : [ 0x4, { 'AllocatedResources' : [ 0x0, ['pointer', ['pointer', ['_CM_PARTIAL_RESOURCE_LIST']]]], } ], '_PO_FX_PERF_STATE_CHANGE' : [ 0x10, { 'Set' : [ 0x0, ['unsigned long']], 'StateIndex' : [ 0x8, ['unsigned long']], 'StateValue' : [ 0x8, ['unsigned long long']], } ], '__unnamed_29a2' : [ 0x8, { 'MessageAddressLow' : [ 0x0, ['unsigned long']], 'MessageData' : [ 0x4, ['unsigned short']], 'Reserved' : [ 0x6, ['unsigned short']], } ], '__unnamed_29a4' : [ 0x8, { 'RemappedFormat' : [ 0x0, ['_ULARGE_INTEGER']], 'Msi' : [ 0x0, ['__unnamed_29a2']], } ], '_INTERRUPT_REMAPPING_INFO' : [ 0x10, { 'IrtIndex' : [ 0x0, ['BitField', dict(start_bit = 0, end_bit = 30, native_type='unsigned long')]], 'FlagHalInternal' : [ 0x0, ['BitField', dict(start_bit = 30, end_bit = 31, native_type='unsigned long')]], 'FlagTranslated' : [ 0x0, ['BitField', dict(start_bit = 31, end_bit = 32, native_type='unsigned long')]], 'u' : [ 0x8, ['__unnamed_29a4']], } ], '_KSPECIAL_REGISTERS' : [ 0x54, { 'Cr0' : [ 0x0, ['unsigned long']], 'Cr2' : [ 0x4, ['unsigned long']], 'Cr3' : [ 0x8, ['unsigned long']], 'Cr4' : [ 0xc, ['unsigned long']], 'KernelDr0' : [ 0x10, ['unsigned long']], 'KernelDr1' : [ 0x14, ['unsigned long']], 'KernelDr2' : [ 0x18, ['unsigned long']], 'KernelDr3' : [ 0x1c, ['unsigned long']], 'KernelDr6' : [ 0x20, ['unsigned long']], 'KernelDr7' : [ 0x24, ['unsigned long']], 'Gdtr' : [ 0x28, ['_DESCRIPTOR']], 'Idtr' : [ 0x30, ['_DESCRIPTOR']], 'Tr' : [ 0x38, ['unsigned short']], 'Ldtr' : [ 0x3a, ['unsigned short']], 'Xcr0' : [ 0x3c, ['unsigned long long']], 'ExceptionList' : [ 0x44, ['unsigned long']], 'Reserved' : [ 0x48, ['array', 3, ['unsigned long']]], } ], '_RTL_ACTIVATION_CONTEXT_STACK_FRAME' : [ 0xc, { 'Previous' : [ 0x0, ['pointer', ['_RTL_ACTIVATION_CONTEXT_STACK_FRAME']]], 'ActivationContext' : [ 0x4, ['pointer', ['_ACTIVATION_CONTEXT']]], 'Flags' : [ 0x8, ['unsigned long']], } ], '_ETW_FILTER_STRING_TOKEN_ELEMENT' : [ 0x8, { 'Length' : [ 0x0, ['unsigned short']], 'String' : [ 0x4, ['pointer', ['unsigned short']]], } ], '_ARBITER_ORDERING' : [ 0x10, { 'Start' : [ 0x0, ['unsigned long long']], 'End' : [ 0x8, ['unsigned long long']], } ], '_RTL_AVL_TABLE' : [ 0x38, { 'BalancedRoot' : [ 0x0, ['_RTL_BALANCED_LINKS']], 'OrderedPointer' : [ 0x10, ['pointer', ['void']]], 'WhichOrderedElement' : [ 0x14, ['unsigned long']], 'NumberGenericTableElements' : [ 0x18, ['unsigned long']], 'DepthOfTree' : [ 0x1c, ['unsigned long']], 'RestartKey' : [ 0x20, ['pointer', ['_RTL_BALANCED_LINKS']]], 'DeleteCount' : [ 0x24, ['unsigned long']], 'CompareRoutine' : [ 0x28, ['pointer', ['void']]], 'AllocateRoutine' : [ 0x2c, ['pointer', ['void']]], 'FreeRoutine' : [ 0x30, ['pointer', ['void']]], 'TableContext' : [ 0x34, ['pointer', ['void']]], } ], '_KTRANSACTION_HISTORY' : [ 0x8, { 'RecordType' : [ 0x0, ['Enumeration', dict(target = 'long', choices = {1: 'KTMOH_CommitTransaction_Result', 2: 'KTMOH_RollbackTransaction_Result'})]], 'Payload' : [ 0x4, ['unsigned long']], } ], '_PO_FX_PERF_STATE' : [ 0x10, { 'Value' : [ 0x0, ['unsigned long long']], 'Context' : [ 0x8, ['pointer', ['void']]], } ], '_DESCRIPTOR' : [ 0x8, { 'Pad' : [ 0x0, ['unsigned short']], 'Limit' : [ 0x2, ['unsigned short']], 'Base' : [ 0x4, ['unsigned long']], } ], }
gpl-2.0
google/clusterfuzz
src/appengine/handlers/testcase_detail/redo.py
1
1598
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Handler for redoing.""" from flask import request from base import tasks from handlers import base_handler from handlers.testcase_detail import show from libs import handler from libs import helpers class Handler(base_handler.Handler): """Handler that redo tasks.""" @staticmethod def redo(testcase, testcase_tasks, user_email): """Redo tasks.""" try: tasks.redo_testcase(testcase, testcase_tasks, user_email) except tasks.InvalidRedoTask as error: raise helpers.EarlyExitException(str(error), 400) helpers.log('Redo testcase %d: %s' % (testcase.key.id(), testcase_tasks), helpers.MODIFY_OPERATION) @handler.post(handler.JSON, handler.JSON) @handler.require_csrf_token @handler.check_testcase_access def post(self, testcase): """Queue redo tasks.""" testcase_tasks = request.get('tasks') user_email = helpers.get_user_email() self.redo(testcase, testcase_tasks, user_email) return self.render_json(show.get_testcase_detail(testcase))
apache-2.0
gazoo74/linux
Documentation/networking/cxacru-cf.py
14668
1626
#!/usr/bin/env python # Copyright 2009 Simon Arlott # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Usage: cxacru-cf.py < cxacru-cf.bin # Output: values string suitable for the sysfs adsl_config attribute # # Warning: cxacru-cf.bin with MD5 hash cdbac2689969d5ed5d4850f117702110 # contains mis-aligned values which will stop the modem from being able # to make a connection. If the first and last two bytes are removed then # the values become valid, but the modulation will be forced to ANSI # T1.413 only which may not be appropriate. # # The original binary format is a packed list of le32 values. import sys import struct i = 0 while True: buf = sys.stdin.read(4) if len(buf) == 0: break elif len(buf) != 4: sys.stdout.write("\n") sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf))) sys.exit(1) if i > 0: sys.stdout.write(" ") sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I", buf)[0])) i += 1 sys.stdout.write("\n")
gpl-2.0
lecaoquochung/ddnb.django
django/core/signing.py
82
6692
""" Functions for creating and restoring url-safe signed JSON objects. The format used looks like this: >>> signing.dumps("hello") 'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk' There are two components here, separated by a ':'. The first component is a URLsafe base64 encoded JSON of the object passed to dumps(). The second component is a base64 encoded hmac/SHA1 hash of "$first_component:$secret" signing.loads(s) checks the signature and returns the deserialized object. If the signature fails, a BadSignature exception is raised. >>> signing.loads("ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk") u'hello' >>> signing.loads("ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk-modified") ... BadSignature: Signature failed: ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk-modified You can optionally compress the JSON prior to base64 encoding it to save space, using the compress=True argument. This checks if compression actually helps and only applies compression if the result is a shorter string: >>> signing.dumps(range(1, 20), compress=True) '.eJwFwcERACAIwLCF-rCiILN47r-GyZVJsNgkxaFxoDgxcOHGxMKD_T7vhAml:1QaUaL:BA0thEZrp4FQVXIXuOvYJtLJSrQ' The fact that the string is compressed is signalled by the prefixed '.' at the start of the base64 JSON. There are 65 url-safe characters: the 64 used by url-safe base64 and the ':'. These functions make use of all of them. """ from __future__ import unicode_literals import base64 import json import time import zlib from django.conf import settings from django.utils import baseconv from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.encoding import force_bytes, force_str, force_text from django.utils.module_loading import import_string class BadSignature(Exception): """ Signature does not match """ pass class SignatureExpired(BadSignature): """ Signature timestamp is older than required max_age """ pass def b64_encode(s): return base64.urlsafe_b64encode(s).strip(b'=') def b64_decode(s): pad = b'=' * (-len(s) % 4) return base64.urlsafe_b64decode(s + pad) def base64_hmac(salt, value, key): return b64_encode(salted_hmac(salt, value, key).digest()) def get_cookie_signer(salt='django.core.signing.get_cookie_signer'): Signer = import_string(settings.SIGNING_BACKEND) key = force_bytes(settings.SECRET_KEY) return Signer(b'django.http.cookies' + key, salt=salt) class JSONSerializer(object): """ Simple wrapper around json to be used in signing.dumps and signing.loads. """ def dumps(self, obj): return json.dumps(obj, separators=(',', ':')).encode('latin-1') def loads(self, data): return json.loads(data.decode('latin-1')) def dumps(obj, key=None, salt='django.core.signing', serializer=JSONSerializer, compress=False): """ Returns URL-safe, sha1 signed base64 compressed JSON string. If key is None, settings.SECRET_KEY is used instead. If compress is True (not the default) checks if compressing using zlib can save some space. Prepends a '.' to signify compression. This is included in the signature, to protect against zip bombs. Salt can be used to namespace the hash, so that a signed string is only valid for a given namespace. Leaving this at the default value or re-using a salt value across different parts of your application without good cause is a security risk. The serializer is expected to return a bytestring. """ data = serializer().dumps(obj) # Flag for if it's been compressed or not is_compressed = False if compress: # Avoid zlib dependency unless compress is being used compressed = zlib.compress(data) if len(compressed) < (len(data) - 1): data = compressed is_compressed = True base64d = b64_encode(data) if is_compressed: base64d = b'.' + base64d return TimestampSigner(key, salt=salt).sign(base64d) def loads(s, key=None, salt='django.core.signing', serializer=JSONSerializer, max_age=None): """ Reverse of dumps(), raises BadSignature if signature fails. The serializer is expected to accept a bytestring. """ # TimestampSigner.unsign always returns unicode but base64 and zlib # compression operate on bytes. base64d = force_bytes(TimestampSigner(key, salt=salt).unsign(s, max_age=max_age)) decompress = False if base64d[:1] == b'.': # It's compressed; uncompress it first base64d = base64d[1:] decompress = True data = b64_decode(base64d) if decompress: data = zlib.decompress(data) return serializer().loads(data) class Signer(object): def __init__(self, key=None, sep=':', salt=None): # Use of native strings in all versions of Python self.sep = force_str(sep) self.key = key or settings.SECRET_KEY self.salt = force_str(salt or '%s.%s' % (self.__class__.__module__, self.__class__.__name__)) def signature(self, value): signature = base64_hmac(self.salt + 'signer', value, self.key) # Convert the signature from bytes to str only on Python 3 return force_str(signature) def sign(self, value): value = force_str(value) return str('%s%s%s') % (value, self.sep, self.signature(value)) def unsign(self, signed_value): signed_value = force_str(signed_value) if self.sep not in signed_value: raise BadSignature('No "%s" found in value' % self.sep) value, sig = signed_value.rsplit(self.sep, 1) if constant_time_compare(sig, self.signature(value)): return force_text(value) raise BadSignature('Signature "%s" does not match' % sig) class TimestampSigner(Signer): def timestamp(self): return baseconv.base62.encode(int(time.time())) def sign(self, value): value = force_str(value) value = str('%s%s%s') % (value, self.sep, self.timestamp()) return super(TimestampSigner, self).sign(value) def unsign(self, value, max_age=None): """ Retrieve original value and check it wasn't signed more than max_age seconds ago. """ result = super(TimestampSigner, self).unsign(value) value, timestamp = result.rsplit(self.sep, 1) timestamp = baseconv.base62.decode(timestamp) if max_age is not None: # Check timestamp is not older than max_age age = time.time() - timestamp if age > max_age: raise SignatureExpired( 'Signature age %s > %s seconds' % (age, max_age)) return value
bsd-3-clause
beckdaniel/GPy
GPy/likelihoods/binomial.py
7
4599
# Copyright (c) 2012-2014 The GPy authors (see AUTHORS.txt) # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from ..util.univariate_Gaussian import std_norm_pdf, std_norm_cdf from . import link_functions from .likelihood import Likelihood from scipy import special class Binomial(Likelihood): """ Binomial likelihood .. math:: p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}} .. Note:: Y takes values in either {-1, 1} or {0, 1}. link function should have the domain [0, 1], e.g. probit (default) or Heaviside .. See also:: likelihood.py, for the parent class """ def __init__(self, gp_link=None): if gp_link is None: gp_link = link_functions.Probit() super(Binomial, self).__init__(gp_link, 'Binomial') def conditional_mean(self, gp, Y_metadata): return self.gp_link(gp)*Y_metadata['trials'] def pdf_link(self, inv_link_f, y, Y_metadata): """ Likelihood function given inverse link of f. .. math:: p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}} :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata must contain 'trials' :returns: likelihood evaluated for this point :rtype: float .. Note: Each y_i must be in {0, 1} """ return np.exp(self.logpdf_link(inv_link_f, y, Y_metadata)) def logpdf_link(self, inv_link_f, y, Y_metadata=None): """ Log Likelihood function given inverse link of f. .. math:: \\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i}) :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata must contain 'trials' :returns: log likelihood evaluated at points inverse link of f. :rtype: float """ N = Y_metadata['trials'] nchoosey = special.gammaln(N+1) - special.gammaln(y+1) - special.gammaln(N-y+1) return nchoosey + y*np.log(inv_link_f) + (N-y)*np.log(1.-inv_link_f) def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None): """ Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f. :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata must contain 'trials' :returns: gradient of log likelihood evaluated at points inverse link of f. :rtype: Nx1 array """ N = Y_metadata['trials'] return y/inv_link_f - (N-y)/(1-inv_link_f) def d2logpdf_dlink2(self, inv_link_f, y, Y_metadata=None): """ Hessian at y, given inv_link_f, w.r.t inv_link_f the hessian will be 0 unless i == j i.e. second derivative logpdf at y given inverse link of f_i and inverse link of f_j w.r.t inverse link of f_i and inverse link of f_j. .. math:: \\frac{d^{2}\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)^{2}} = \\frac{-y_{i}}{\\lambda(f)^{2}} - \\frac{(1-y_{i})}{(1-\\lambda(f))^{2}} :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata not used in binomial :returns: Diagonal of log hessian matrix (second derivative of log likelihood evaluated at points inverse link of f. :rtype: Nx1 array .. Note:: Will return diagonal of hessian, since every where else it is 0, as the likelihood factorizes over cases (the distribution for y_i depends only on inverse link of f_i not on inverse link of f_(j!=i) """ N = Y_metadata['trials'] return -y/np.square(inv_link_f) - (N-y)/np.square(1-inv_link_f) def samples(self, gp, Y_metadata=None): """ Returns a set of samples of observations based on a given value of the latent variable. :param gp: latent variable """ orig_shape = gp.shape gp = gp.flatten() N = Y_metadata['trials'] Ysim = np.random.binomial(N, self.gp_link.transf(gp)) return Ysim.reshape(orig_shape) def exact_inference_gradients(self, dL_dKdiag,Y_metadata=None): pass
bsd-3-clause
Messaoud-Boudjada/dipy
dipy/tracking/tests/test_propagation.py
9
7292
import os import numpy as np import numpy.testing from dipy.data import get_data, get_sphere from dipy.core.gradients import gradient_table from dipy.reconst.gqi import GeneralizedQSamplingModel from dipy.reconst.dti import TensorModel, quantize_evecs from dipy.tracking import utils from dipy.tracking.eudx import EuDX from dipy.tracking.propspeed import ndarray_offset, eudx_both_directions from dipy.tracking.metrics import length from dipy.tracking.propspeed import map_coordinates_trilinear_iso import nibabel as ni from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises, assert_almost_equal from numpy.testing import (assert_array_equal, assert_array_almost_equal, run_module_suite) def stepped_1d(arr_1d): # Make a version of `arr_1d` which is not contiguous return np.vstack((arr_1d, arr_1d)).ravel(order='F')[::2] def test_offset(): # Test ndarray_offset function for dt in (np.int32, np.float64): index = np.array([1, 1], dtype=np.intp) A = np.array([[1,0,0],[0,2,0],[0,0,3]], dtype=dt) strides = np.array(A.strides, np.intp) i_size = A.dtype.itemsize assert_equal(ndarray_offset(index, strides, 2, i_size), 4) assert_equal(A.ravel()[4], A[1,1]) # Index and strides arrays must be C-continuous. Test this is enforced # by using non-contiguous versions of the input arrays. assert_raises(ValueError, ndarray_offset, stepped_1d(index), strides, 2, i_size) assert_raises(ValueError, ndarray_offset, index, stepped_1d(strides), 2, i_size) def test_trilinear_interp_cubic_voxels(): A=np.ones((17,17,17)) B=np.zeros(3) strides=np.array(A.strides, np.intp) A[7,7,7]=2 points=np.array([[0,0,0],[7.,7.5,7.],[3.5,3.5,3.5]]) map_coordinates_trilinear_iso(A,points,strides,3,B) assert_array_almost_equal(B,np.array([ 1. , 1.5, 1. ])) # All of the input array, points array, strides array and output array must # be C-contiguous. Check by passing in versions that aren't C contiguous assert_raises(ValueError, map_coordinates_trilinear_iso, A.copy(order='F'), points, strides, 3, B) assert_raises(ValueError, map_coordinates_trilinear_iso, A, points.copy(order='F'), strides, 3, B) assert_raises(ValueError, map_coordinates_trilinear_iso, A, points, stepped_1d(strides), 3, B) assert_raises(ValueError, map_coordinates_trilinear_iso, A, points, strides, 3, stepped_1d(B)) def test_eudx_further(): """ Cause we love testin.. ;-) """ fimg,fbvals,fbvecs=get_data('small_101D') img=ni.load(fimg) affine=img.get_affine() data=img.get_data() gtab = gradient_table(fbvals, fbvecs) tensor_model = TensorModel(gtab) ten = tensor_model.fit(data) x,y,z=data.shape[:3] seeds=np.zeros((10**4,3)) for i in range(10**4): rx=(x-1)*np.random.rand() ry=(y-1)*np.random.rand() rz=(z-1)*np.random.rand() seeds[i]=np.ascontiguousarray(np.array([rx,ry,rz]),dtype=np.float64) sphere = get_sphere('symmetric724') ind = quantize_evecs(ten.evecs) eu=EuDX(a=ten.fa, ind=ind, seeds=seeds, odf_vertices=sphere.vertices, a_low=.2) T=[e for e in eu] #check that there are no negative elements for t in T: assert_equal(np.sum(t.ravel()<0),0) # Test eudx with affine def random_affine(seeds): affine = np.eye(4) affine[:3, :] = np.random.random((3, 4)) seeds = np.dot(seeds, affine[:3, :3].T) seeds += affine[:3, 3] return affine, seeds # Make two random affines and move seeds affine1, seeds1 = random_affine(seeds) affine2, seeds2 = random_affine(seeds) # Make tracks using different affines eu1 = EuDX(a=ten.fa, ind=ind, odf_vertices=sphere.vertices, seeds=seeds1, a_low=.2, affine=affine1) eu2 = EuDX(a=ten.fa, ind=ind, odf_vertices=sphere.vertices, seeds=seeds2, a_low=.2, affine=affine2) # Move from eu2 affine2 to affine1 eu2_to_eu1 = utils.move_streamlines(eu2, output_space=affine1, input_space=affine2) # Check that the tracks are the same for sl1, sl2 in zip(eu1, eu2_to_eu1): assert_array_almost_equal(sl1, sl2) def test_eudx_bad_seed(): """Test passing a bad seed to eudx""" fimg, fbvals, fbvecs = get_data('small_101D') img = ni.load(fimg) affine = img.get_affine() data = img.get_data() gtab = gradient_table(fbvals, fbvecs) tensor_model = TensorModel(gtab) ten = tensor_model.fit(data) ind = quantize_evecs(ten.evecs) sphere = get_sphere('symmetric724') seed = [1000000., 1000000., 1000000.] eu = EuDX(a=ten.fa, ind=ind, seeds=[seed], odf_vertices=sphere.vertices, a_low=.2) assert_raises(ValueError, list, eu) print(data.shape) seed = [1., 5., 8.] eu = EuDX(a=ten.fa, ind=ind, seeds=[seed], odf_vertices=sphere.vertices, a_low=.2) track = list(eu) seed = [-1., 1000000., 1000000.] eu = EuDX(a=ten.fa, ind=ind, seeds=[seed], odf_vertices=sphere.vertices, a_low=.2) assert_raises(ValueError, list, eu) def test_eudx_boundaries(): """ This test checks that the tracking will exclude seeds in both directions. Here we create a volume of shape (50, 60, 40) and we will add 2 seeds exactly at the volume's boundaries (49, 0, 0) and (0, 0, 0). Those should not generate any streamlines as EuDX does not interpolate on the boundary voxels. We also add 3 seeds not in the boundaries which should generate streamlines without a problem. """ fa = np.ones((50, 60, 40)) ind = np.zeros(fa.shape) sphere = get_sphere('repulsion724') seed = [49., 0, 0] seed2 = [0., 0, 0] seed3 = [48., 0, 0] seed4 = [1., 0, 0] seed5 = [5., 5, 5] eu = EuDX(a=fa, ind=ind, seeds=[seed, seed2, seed3, seed4, seed5], odf_vertices=sphere.vertices, a_low=.2, total_weight=0.) track = list(eu) assert_equal(len(track), 3) def test_eudx_both_directions_errors(): # Test error conditions for both directions function sphere = get_sphere('symmetric724') seed = np.zeros(3, np.float64) qa = np.zeros((4, 5, 6, 7), np.float64) ind = qa.copy() # All of seed, qa, ind, odf_vertices must be C-contiguous. Check by # passing in versions that aren't C contiguous assert_raises(ValueError, eudx_both_directions, stepped_1d(seed), 0, qa, ind, sphere.vertices, 0.5, 0.1, 1., 1., 2) assert_raises(ValueError, eudx_both_directions, seed, 0, qa[..., ::2], ind, sphere.vertices, 0.5, 0.1, 1., 1., 2) assert_raises(ValueError, eudx_both_directions, seed, 0, qa, ind[..., ::2], sphere.vertices, 0.5, 0.1, 1., 1., 2) assert_raises(ValueError, eudx_both_directions, seed, 0, qa, ind, sphere.vertices[::2], 0.5, 0.1, 1., 1., 2) if __name__ == '__main__': run_module_suite()
bsd-3-clause
julien6387/supvisors
supvisors/utils.py
2
5877
#!/usr/bin/python # -*- coding: utf-8 -*- # ====================================================================== # Copyright 2016 Julien LE CLEACH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ====================================================================== from math import sqrt from time import gmtime, localtime, strftime, time class InternalEventHeaders: """ Enumeration class for the headers in messages between Listener and MainLoop. """ TICK, PROCESS, STATISTICS = range(3) class RemoteCommEvents: """ Strings used for remote communication between the Supvisors main loop and the listener. """ SUPVISORS_AUTH = u'auth' SUPVISORS_EVENT = u'event' SUPVISORS_INFO = u'info' class EventHeaders: """ Strings used as headers in messages between EventPublisher and Supvisors' Client. """ SUPVISORS = u'supvisors' ADDRESS = u'address' APPLICATION = u'application' PROCESS_EVENT = u'event' PROCESS_STATUS = u'process' # for deferred XML-RPC requests class DeferredRequestHeaders: """ Enumeration class for the headers of deferred XML-RPC messages sent to MainLoop.""" CHECK_ADDRESS, ISOLATE_ADDRESSES, START_PROCESS, STOP_PROCESS, RESTART, SHUTDOWN = range(6) def enumeration_tools(cls): """ Decorator for enumeration classes. Add class attributes and methods for conversion between string and enum, for listing enumeration values and strings. """ def to_string(cls, value): """ Convert the enum value into a string. """ return cls.enum_map[value] def from_string(cls, str_enum): """ Convert a string into an enum value. """ return cls.string_map[str_enum] def values(cls): """ Return all enum values. """ return cls.enum_map.keys() def strings(cls): """ Return all enum values as string. """ return cls.string_map.keys() setattr(cls, 'string_map', {x: y for x, y in cls.__dict__.items() if not x.startswith('_')}) setattr(cls, 'enum_map', {y: x for x, y in cls.string_map.items()}) setattr(cls, 'to_string', classmethod(to_string)) setattr(cls, 'from_string', classmethod(from_string)) setattr(cls, 'values', classmethod(values)) setattr(cls, 'strings', classmethod(strings)) return cls def supvisors_shortcuts(instance, lst): """ Used to set shortcuts in object attributes against supvisors attributes. """ for attr in lst: setattr(instance, attr, getattr(instance.supvisors, attr)) def simple_localtime(now=None): """ Returns the local time as a string, without the date. """ if now is None: now = time() return strftime("%H:%M:%S", localtime(now)) def simple_gmtime(now=None): """ Returns the UTC time as a string, without the date. """ if now is None: now = time() return strftime("%H:%M:%S", gmtime(now)) # Keys of information kept from Supervisor __Payload_Keys = ('name', 'group', 'state', 'start', 'stop', 'now', 'pid', 'description', 'spawnerr') def extract_process_info(info): """ Returns a subset of Supervisor process information. """ payload = {key: info[key] for key in __Payload_Keys} # expand information with 'expected' (deduced from spawnerr) payload['expected'] = not info['spawnerr'] return payload # simple functions def mean(x): return sum(x) / float(len(x)) def srate(x, y): return 100.0 * x / y - 100.0 if y else float('inf') def stddev(lst, avg): return sqrt(sum((x - avg) ** 2 for x in lst) / len(lst)) # linear regression def get_linear_regression(xdata, ydata): """ Calculate the coefficients of the linear equation corresponding to the linear regression of a series of points. """ try: import numpy return tuple(numpy.polyfit(xdata, ydata, 1)) except ImportError: # numpy not available # try something approximate and simple datasize = len(xdata) sum_x = float(sum(xdata)) sum_y = float(sum(ydata)) sum_xx = float(sum(map(lambda x: x * x, xdata))) sum_products = float(sum([xdata[i] * ydata[i] for i in range(datasize)])) a = (sum_products - sum_x * sum_y / datasize) / (sum_xx - (sum_x * sum_x) / datasize) b = (sum_y - a * sum_x) / datasize return a, b def get_simple_linear_regression(lst): """ Calculate the coefficients of the linear equation corresponding to the linear regression of a series of values. """ # in Supvisors, Y data is periodic datasize = len(lst) return get_linear_regression([i for i in range(datasize)], lst) # get statistics from data def get_stats(lst): """ Calculate the following statistics from a series of points: - the mean value, - the instant rate between the two last values, - the coefficients of the linear regression, - the standard deviation. """ rate, a, b, dev = (None,) * 4 # calculate mean value avg = mean(lst) if len(lst) > 1: # calculate instant rate value between last 2 values rate = srate(lst[-1], lst[-2]) # calculate slope value from linear regression of values a, b = get_simple_linear_regression(lst) # calculate standard deviation dev = stddev(lst, avg) return avg, rate, (a, b), dev
apache-2.0
pdellaert/ansible
lib/ansible/modules/network/vyos/_vyos_l3_interface.py
23
8638
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Ansible by Red Hat, inc # # This file is part of Ansible by Red Hat # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['deprecated'], 'supported_by': 'network'} DOCUMENTATION = """ --- module: vyos_l3_interface version_added: "2.4" author: "Ricardo Carrillo Cruz (@rcarrillocruz)" short_description: Manage L3 interfaces on VyOS network devices description: - This module provides declarative management of L3 interfaces on VyOS network devices. deprecated: removed_in: '2.13' alternative: vyos_l3_interfaces why: Updated modules released with more functionality. notes: - Tested against VYOS 1.1.7 options: name: description: - Name of the L3 interface. ipv4: description: - IPv4 of the L3 interface. ipv6: description: - IPv6 of the L3 interface. aggregate: description: List of L3 interfaces definitions state: description: - State of the L3 interface configuration. default: present choices: ['present', 'absent'] extends_documentation_fragment: vyos """ EXAMPLES = """ - name: Set eth0 IPv4 address vyos_l3_interface: name: eth0 ipv4: 192.168.0.1/24 - name: Remove eth0 IPv4 address vyos_l3_interface: name: eth0 state: absent - name: Set IP addresses on aggregate vyos_l3_interface: aggregate: - { name: eth1, ipv4: 192.168.2.10/24 } - { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } - name: Remove IP addresses on aggregate vyos_l3_interface: aggregate: - { name: eth1, ipv4: 192.168.2.10/24 } - { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } state: absent """ RETURN = """ commands: description: The list of configuration mode commands to send to the device returned: always, except for the platforms that use Netconf transport to manage the device. type: list sample: - set interfaces ethernet eth0 address '192.168.0.1/24' """ import socket import re from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.common.utils import is_masklen, validate_ip_address from ansible.module_utils.network.common.utils import remove_default_spec from ansible.module_utils.network.vyos.vyos import load_config, run_commands from ansible.module_utils.network.vyos.vyos import vyos_argument_spec def is_ipv4(value): if value: address = value.split('/') if is_masklen(address[1]) and validate_ip_address(address[0]): return True return False def is_ipv6(value): if value: address = value.split('/') if 0 <= int(address[1]) <= 128: try: socket.inet_pton(socket.AF_INET6, address[0]) except socket.error: return False return True return False def search_obj_in_list(name, lst): for o in lst: if o['name'] == name: return o return None def map_obj_to_commands(updates, module): commands = list() want, have = updates for w in want: name = w['name'] ipv4 = w['ipv4'] ipv6 = w['ipv6'] state = w['state'] obj_in_have = search_obj_in_list(name, have) if state == 'absent' and obj_in_have: if not ipv4 and not ipv6 and (obj_in_have['ipv4'] or obj_in_have['ipv6']): if name == "lo": commands.append('delete interfaces loopback lo address') else: commands.append('delete interfaces ethernet ' + name + ' address') else: if ipv4 and ipv4 in obj_in_have['ipv4']: if name == "lo": commands.append('delete interfaces loopback lo address ' + ipv4) else: commands.append('delete interfaces ethernet ' + name + ' address ' + ipv4) if ipv6 and ipv6 in obj_in_have['ipv6']: if name == "lo": commands.append('delete interfaces loopback lo address ' + ipv6) else: commands.append('delete interfaces ethernet ' + name + ' address ' + ipv6) elif (state == 'present' and obj_in_have): if ipv4 and ipv4 not in obj_in_have['ipv4']: if name == "lo": commands.append('set interfaces loopback lo address ' + ipv4) else: commands.append('set interfaces ethernet ' + name + ' address ' + ipv4) if ipv6 and ipv6 not in obj_in_have['ipv6']: if name == "lo": commands.append('set interfaces loopback lo address ' + ipv6) else: commands.append('set interfaces ethernet ' + name + ' address ' + ipv6) return commands def map_config_to_obj(module): obj = [] output = run_commands(module, ['show interfaces']) lines = re.split(r'\n[e|l]', output[0])[1:] if len(lines) > 0: for line in lines: splitted_line = line.split() if len(splitted_line) > 0: ipv4 = [] ipv6 = [] if splitted_line[0].lower().startswith('th'): name = 'e' + splitted_line[0].lower() elif splitted_line[0].lower().startswith('o'): name = 'l' + splitted_line[0].lower() for i in splitted_line[1:]: if (('.' in i or ':' in i) and '/' in i): value = i.split(r'\n')[0] if is_ipv4(value): ipv4.append(value) elif is_ipv6(value): ipv6.append(value) obj.append({'name': name, 'ipv4': ipv4, 'ipv6': ipv6}) return obj def map_params_to_obj(module): obj = [] aggregate = module.params.get('aggregate') if aggregate: for item in aggregate: for key in item: if item.get(key) is None: item[key] = module.params[key] obj.append(item.copy()) else: obj.append({ 'name': module.params['name'], 'ipv4': module.params['ipv4'], 'ipv6': module.params['ipv6'], 'state': module.params['state'] }) return obj def main(): """ main entry point for module execution """ element_spec = dict( name=dict(), ipv4=dict(), ipv6=dict(), state=dict(default='present', choices=['present', 'absent']) ) aggregate_spec = deepcopy(element_spec) aggregate_spec['name'] = dict(required=True) # remove default in aggregate spec, to handle common arguments remove_default_spec(aggregate_spec) argument_spec = dict( aggregate=dict(type='list', elements='dict', options=aggregate_spec), ) argument_spec.update(element_spec) argument_spec.update(vyos_argument_spec) required_one_of = [['name', 'aggregate']] mutually_exclusive = [['name', 'aggregate']] module = AnsibleModule(argument_spec=argument_spec, required_one_of=required_one_of, mutually_exclusive=mutually_exclusive, supports_check_mode=True) warnings = list() result = {'changed': False} if warnings: result['warnings'] = warnings want = map_params_to_obj(module) have = map_config_to_obj(module) commands = map_obj_to_commands((want, have), module) result['commands'] = commands if commands: commit = not module.check_mode load_config(module, commands, commit=commit) result['changed'] = True module.exit_json(**result) if __name__ == '__main__': main()
gpl-3.0
amancevice/stanhope
stanhope/stanhope/tables.py
1
9826
""" StanhopeFramers Tables """ import io import subprocess import pandas from stanhope import utils pandas.set_option('display.max_rows', 999) pandas.set_option('display.width', 999) pandas.set_option('display.max_colwidth', 999) class Table(object): def __init__(self, *tables): self.tables = tables or (type(self).__name__,) self.frame = None @staticmethod def read(table): cmd = ['mdb-export', '/data/StanhopeFramers.mdb', table] out = subprocess.check_output(cmd) return io.BytesIO(out) def load(self): frame = pandas.DataFrame() for table in self.tables: page = pandas.read_csv(self.read(table), **self.READ_CSV) # page['Table'] = table frame = frame.append(page) self.frame = frame return frame class Customers(Table): READ_CSV = { 'converters': { 'Customer Number': utils.upper, 'Credit': utils.boolean, 'Tax Exempt': utils.boolean, 'Deceased': utils.boolean}, 'parse_dates': [ 'Date', 'Last Order', 'Last Update']} def accounts(self): frame = self.frame.copy() # Add Legacy ID frame['Legacy ID'] = \ frame[['Customer Number']].apply(utils.legacy_id, axis=1) # Copy legacy record frame['Legacy Record'] = frame.drop('Legacy ID', axis=1)\ .apply(utils.legacy_record, axis=1) # Drop unused columns frame.drop(['Address', 'City', 'Date', 'Deceased', 'Email', 'Last Order', 'Last Update', 'State', 'Telephone', 'Zip'], axis=1, inplace=True) # Rename columns frame.rename(inplace=True, columns={'Customer Number': 'Legacy Customer Number', 'Name': 'Account', 'Comment': 'Comments'}) # Set account name frame.loc[:, 'Account'] = \ frame['Account'].apply(utils.replace_newline)\ .combine_first(frame['Legacy Customer Number']) frame['Primary Contact'] = frame['Account'] # Massage fields frame.loc[~frame['Category'].isnull(), 'Category'] = \ frame.loc[~frame['Category'].isnull(), 'Category'].apply( utils.account_category) frame.loc[~frame['Source'].isnull(), 'Source'] = \ frame.loc[~frame['Source'].isnull(), 'Source'].apply(utils.source) frame.loc[:, 'Comments'] = \ frame['Comments'].apply(lambda x: utils.replace_newline(x, '\n')) # Return return frame def contacts(self): frame = self.frame.copy() # Add Legacy ID frame['Legacy ID'] = \ frame[['Customer Number']].apply(utils.legacy_id, axis=1) # Drop unused columns frame.drop(['Category', 'Comment', 'Credit', 'Date', 'Last Order', 'Last Update', 'Source', 'Tax Exempt'], axis=1, inplace=True) # Rename columns frame.rename(inplace=True, columns={'Customer Number': 'Account Link', 'Name': 'Contact', 'Deceased': 'Removed'}) # Massage fields frame.loc[:, 'Contact'] = \ frame['Contact'].apply(utils.replace_newline)\ .combine_first(frame['Account Link']) frame.loc[:, 'Contact'] = frame['Contact'].apply(utils.replace_newline) frame.loc[:, 'Address'] = frame['Address'].apply(utils.replace_newline) frame.loc[:, 'City'] = frame['City'].apply(utils.replace_newline) frame.loc[:, 'State'] = frame['State'].apply(utils.replace_newline) frame.loc[:, 'Zip'] = frame['Zip'].apply(utils.replace_newline) frame.loc[:, 'Telephone'] = \ frame['Telephone'].apply(utils.replace_newline) # Return return frame class FrameOrders(Table): READ_CSV = { 'converters': {'CustomerNo': utils.upper, 'OrderNo': utils.upper}, 'parse_dates': ['DateCompleted', 'DueDate', 'OrderDate']} def orders(self): frame = self.frame.copy() # Add Legacy ID frame['Legacy ID'] = \ frame[['CustomerNo', 'OrderNo', 'OrderDate']]\ .apply(utils.legacy_id, axis=1) # Copy legacy record frame['Legacy Record'] = frame.drop('Legacy ID', axis=1)\ .apply(utils.legacy_record, axis=1) # Set status frame.loc[frame['SalesType'] == 'VOID', 'Status'] = 'V' # Drop unused columns frame.drop(['Artist', 'BinNo', 'Comments', 'DateCompleted', 'Fitting', 'Frame Height', 'Frame Width', 'FrameMfg', 'FrameNo', 'Glazing', 'Joining', 'Mat', 'MatColor', 'MatMfg', 'Matting', 'MattingSize', 'ProductionComments', 'Qty', 'SalesCatgy', 'SalesType', 'TotalSale'], axis=1, inplace=True) # Rename columns frame.rename(inplace=True, columns={'OrderNo': 'Order Number', 'OrderDate': 'Order Date', 'DueDate': 'Due Date', 'CustomerNo': 'Account Link', 'Status': 'Order Status', 'Location': 'Order Location', 'SalesPers': 'Salesperson Link', 'Delivery': 'Delivery Location', 'Cust-Client': 'Client'}) # Massage fields frame.loc[:, 'Delivery Location'] = \ frame['Delivery Location'].apply(utils.delivery_location) frame.loc[:, 'Discount'] = frame['Discount'].apply(utils.discount) frame.loc[:, 'Order Location'] = \ frame['Order Location'].apply(utils.order_location) frame.loc[:, 'Order Status'] = \ frame['Order Status'].apply(utils.status) frame.loc[:, 'Salesperson Link'] = \ frame['Salesperson Link'].apply(utils.salesperson) frame.loc[:, 'Delivery Location'] = \ frame['Delivery Location'].combine_first(frame['Order Location']) # Return return frame def treatments(self): frame = self.frame.copy() # Add Legacy ID frame['Legacy ID'] = \ frame[['CustomerNo', 'OrderNo', 'OrderDate']]\ .apply(utils.legacy_id, axis=1) # Add Legacy Order ID frame['Order Link'] = frame['Legacy ID'] # Drop unused columns frame.drop(['Cust-Client', 'CustomerNo', 'DateCompleted', 'Delivery', 'Discount', 'DueDate', 'Fitting', 'Location', 'Matting', 'OrderDate', 'OrderNo', 'SalesCatgy', 'SalesPers', 'Status'], axis=1, inplace=True) # Rename fields frame.rename(inplace=True, columns={'BinNo': 'Bin Number', 'Comments': 'Description', 'FrameNo': 'Frame Style', 'FrameMfg': 'Frame Manufacturer', 'Joining': 'Frame Join', 'Mat': 'Matting / Mounting', 'MatColor': 'Mat Color', 'MatMfg': 'Mat Manufacturer', 'MattingSize': 'Mat Size', 'ProductionComments': 'Production Comments', 'Qty': 'Quantity', 'SalesType': 'Treatment', 'TotalSale': 'Price'}) # Massage fields frame.loc[:, 'Frame Join'] = frame['Frame Join'].apply(utils.join) frame.loc[:, 'Mat Manufacturer'] = \ frame['Mat Manufacturer'].apply(utils.matmfg) frame.loc[:, 'Frame Manufacturer'] = \ frame['Frame Manufacturer'].apply(utils.framemfg) frame.loc[:, 'Matting / Mounting'] = \ frame['Matting / Mounting'].apply(utils.mat) frame.loc[:, 'Glazing'] = \ frame['Glazing'].apply(utils.glazing) frame.loc[:, 'Treatment'] = frame['Treatment'].apply(utils.sales_type) # Add dimensions frame['Frame Width Inches'] = \ frame['Frame Width'].apply(utils.inches) frame['Frame Width Fraction'] = \ frame['Frame Width'].apply(utils.fraction) frame['Frame Height Inches'] = \ frame['Frame Height'].apply(utils.inches) frame['Frame Height Fraction'] = \ frame['Frame Height'].apply(utils.fraction) frame.drop(['Frame Width', 'Frame Height'], axis=1, inplace=True) # Return return frame
mit
rmboggs/django
tests/template_tests/syntax_tests/test_regroup.py
367
3984
from datetime import date from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class RegroupTagTests(SimpleTestCase): @setup({'regroup01': '' '{% regroup data by bar as grouped %}' '{% for group in grouped %}' '{{ group.grouper }}:' '{% for item in group.list %}' '{{ item.foo }}' '{% endfor %},' '{% endfor %}'}) def test_regroup01(self): output = self.engine.render_to_string('regroup01', { 'data': [{'foo': 'c', 'bar': 1}, {'foo': 'd', 'bar': 1}, {'foo': 'a', 'bar': 2}, {'foo': 'b', 'bar': 2}, {'foo': 'x', 'bar': 3}], }) self.assertEqual(output, '1:cd,2:ab,3:x,') @setup({'regroup02': '' '{% regroup data by bar as grouped %}' '{% for group in grouped %}' '{{ group.grouper }}:' '{% for item in group.list %}' '{{ item.foo }}' '{% endfor %}' '{% endfor %}'}) def test_regroup02(self): """ Test for silent failure when target variable isn't found """ output = self.engine.render_to_string('regroup02', {}) self.assertEqual(output, '') @setup({'regroup03': '' '{% regroup data by at|date:"m" as grouped %}' '{% for group in grouped %}' '{{ group.grouper }}:' '{% for item in group.list %}' '{{ item.at|date:"d" }}' '{% endfor %},' '{% endfor %}'}) def test_regroup03(self): """ Regression tests for #17675 The date template filter has expects_localtime = True """ output = self.engine.render_to_string('regroup03', { 'data': [{'at': date(2012, 2, 14)}, {'at': date(2012, 2, 28)}, {'at': date(2012, 7, 4)}], }) self.assertEqual(output, '02:1428,07:04,') @setup({'regroup04': '' '{% regroup data by bar|join:"" as grouped %}' '{% for group in grouped %}' '{{ group.grouper }}:' '{% for item in group.list %}' '{{ item.foo|first }}' '{% endfor %},' '{% endfor %}'}) def test_regroup04(self): """ The join template filter has needs_autoescape = True """ output = self.engine.render_to_string('regroup04', { 'data': [{'foo': 'x', 'bar': ['ab', 'c']}, {'foo': 'y', 'bar': ['a', 'bc']}, {'foo': 'z', 'bar': ['a', 'd']}], }) self.assertEqual(output, 'abc:xy,ad:z,') # Test syntax errors @setup({'regroup05': '{% regroup data by bar as %}'}) def test_regroup05(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('regroup05') @setup({'regroup06': '{% regroup data by bar thisaintright grouped %}'}) def test_regroup06(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('regroup06') @setup({'regroup07': '{% regroup data thisaintright bar as grouped %}'}) def test_regroup07(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('regroup07') @setup({'regroup08': '{% regroup data by bar as grouped toomanyargs %}'}) def test_regroup08(self): with self.assertRaises(TemplateSyntaxError): self.engine.get_template('regroup08')
bsd-3-clause
tensorflow/probability
tensorflow_probability/python/optimizer/linesearch/__init__.py
1
1076
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ """Line-search optimizers package.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow_probability.python.internal import all_util from tensorflow_probability.python.optimizer.linesearch.hager_zhang import hager_zhang _allowed_symbols = [ 'hager_zhang', ] all_util.remove_undocumented(__name__, _allowed_symbols)
apache-2.0
LanderU/ardupilot
Tools/autotest/pysim/fdpexpect.py
88
2560
"""This is like pexpect, but will work on any file descriptor that you pass it. So you are responsible for opening and close the file descriptor. $Id: fdpexpect.py 505 2007-12-26 21:33:50Z noah $ """ from __future__ import print_function import os from pexpect import ExceptionPexpect, spawn __all__ = ['fdspawn'] class fdspawn(spawn): """This is like pexpect.spawn but allows you to supply your own open file descriptor. For example, you could use it to read through a file looking for patterns, or to control a modem or serial device. """ def __init__(self, fd, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None): """This takes a file descriptor (an int) or an object that support the fileno() method (returning an int). All Python file-like objects support fileno(). """ # TODO: Add better handling of trying to use fdspawn in place of spawn # TODO: (overload to allow fdspawn to also handle commands as spawn does. if not isinstance(fd, int) and hasattr(fd, 'fileno'): fd = fd.fileno() if not isinstance(fd, int): raise ExceptionPexpect( "The fd argument is not an int. If this is a command string then maybe you want to use pexpect.spawn.") try: # make sure fd is a valid file descriptor os.fstat(fd) except OSError: raise ExceptionPexpect("The fd argument is not a valid file descriptor.") self.args = None self.command = None spawn.__init__(self, None, args, timeout, maxread, searchwindowsize, logfile) self.child_fd = fd self.own_fd = False self.closed = False self.name = '<file descriptor %d>' % fd def __del__(self): return def close(self): if self.child_fd == -1: return if self.own_fd: self.close(self) else: self.flush() os.close(self.child_fd) self.child_fd = -1 self.closed = True def isalive(self): """This checks if the file descriptor is still valid. If os.fstat() does not raise an exception then we assume it is alive. """ if self.child_fd == -1: return False try: os.fstat(self.child_fd) return True except: return False def terminate(self, force=False): raise ExceptionPexpect('This method is not valid for file descriptors.') def kill(self, sig): return
gpl-3.0
bingshuika/hearthbreaker-new
jsonschema/_format.py
65
6881
import datetime import re import socket from jsonschema.compat import str_types from jsonschema.exceptions import FormatError class FormatChecker(object): """ A ``format`` property checker. JSON Schema does not mandate that the ``format`` property actually do any validation. If validation is desired however, instances of this class can be hooked into validators to enable format validation. :class:`FormatChecker` objects always return ``True`` when asked about formats that they do not know how to validate. To check a custom format using a function that takes an instance and returns a ``bool``, use the :meth:`FormatChecker.checks` or :meth:`FormatChecker.cls_checks` decorators. :argument iterable formats: the known formats to validate. This argument can be used to limit which formats will be used during validation. """ checkers = {} def __init__(self, formats=None): if formats is None: self.checkers = self.checkers.copy() else: self.checkers = dict((k, self.checkers[k]) for k in formats) def checks(self, format, raises=()): """ Register a decorated function as validating a new format. :argument str format: the format that the decorated function will check :argument Exception raises: the exception(s) raised by the decorated function when an invalid instance is found. The exception object will be accessible as the :attr:`ValidationError.cause` attribute of the resulting validation error. """ def _checks(func): self.checkers[format] = (func, raises) return func return _checks cls_checks = classmethod(checks) def check(self, instance, format): """ Check whether the instance conforms to the given format. :argument instance: the instance to check :type: any primitive type (str, number, bool) :argument str format: the format that instance should conform to :raises: :exc:`FormatError` if instance does not conform to format """ if format not in self.checkers: return func, raises = self.checkers[format] result, cause = None, None try: result = func(instance) except raises as e: cause = e if not result: raise FormatError( "%r is not a %r" % (instance, format), cause=cause, ) def conforms(self, instance, format): """ Check whether the instance conforms to the given format. :argument instance: the instance to check :type: any primitive type (str, number, bool) :argument str format: the format that instance should conform to :rtype: bool """ try: self.check(instance, format) except FormatError: return False else: return True _draft_checkers = {"draft3": [], "draft4": []} def _checks_drafts(both=None, draft3=None, draft4=None, raises=()): draft3 = draft3 or both draft4 = draft4 or both def wrap(func): if draft3: _draft_checkers["draft3"].append(draft3) func = FormatChecker.cls_checks(draft3, raises)(func) if draft4: _draft_checkers["draft4"].append(draft4) func = FormatChecker.cls_checks(draft4, raises)(func) return func return wrap @_checks_drafts("email") def is_email(instance): if not isinstance(instance, str_types): return True return "@" in instance _ipv4_re = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") @_checks_drafts(draft3="ip-address", draft4="ipv4") def is_ipv4(instance): if not isinstance(instance, str_types): return True if not _ipv4_re.match(instance): return False return all(0 <= int(component) <= 255 for component in instance.split(".")) if hasattr(socket, "inet_pton"): @_checks_drafts("ipv6", raises=socket.error) def is_ipv6(instance): if not isinstance(instance, str_types): return True return socket.inet_pton(socket.AF_INET6, instance) _host_name_re = re.compile(r"^[A-Za-z0-9][A-Za-z0-9\.\-]{1,255}$") @_checks_drafts(draft3="host-name", draft4="hostname") def is_host_name(instance): if not isinstance(instance, str_types): return True if not _host_name_re.match(instance): return False components = instance.split(".") for component in components: if len(component) > 63: return False return True try: import rfc3987 except ImportError: pass else: @_checks_drafts("uri", raises=ValueError) def is_uri(instance): if not isinstance(instance, str_types): return True return rfc3987.parse(instance, rule="URI") try: import strict_rfc3339 except ImportError: try: import isodate except ImportError: pass else: @_checks_drafts("date-time", raises=(ValueError, isodate.ISO8601Error)) def is_date(instance): if not isinstance(instance, str_types): return True return isodate.parse_datetime(instance) else: @_checks_drafts("date-time") def is_date(instance): if not isinstance(instance, str_types): return True return strict_rfc3339.validate_rfc3339(instance) @_checks_drafts("regex", raises=re.error) def is_regex(instance): if not isinstance(instance, str_types): return True return re.compile(instance) @_checks_drafts(draft3="date", raises=ValueError) def is_date(instance): if not isinstance(instance, str_types): return True return datetime.datetime.strptime(instance, "%Y-%m-%d") @_checks_drafts(draft3="time", raises=ValueError) def is_time(instance): if not isinstance(instance, str_types): return True return datetime.datetime.strptime(instance, "%H:%M:%S") try: import webcolors except ImportError: pass else: def is_css_color_code(instance): return webcolors.normalize_hex(instance) @_checks_drafts(draft3="color", raises=(ValueError, TypeError)) def is_css21_color(instance): if ( not isinstance(instance, str_types) or instance.lower() in webcolors.css21_names_to_hex ): return True return is_css_color_code(instance) def is_css3_color(instance): if instance.lower() in webcolors.css3_names_to_hex: return True return is_css_color_code(instance) draft3_format_checker = FormatChecker(_draft_checkers["draft3"]) draft4_format_checker = FormatChecker(_draft_checkers["draft4"])
mit
secnot/django-param-field
param_field/tests/test_parser.py
1
20865
from django.test import TestCase from pyparsing import ParseBaseException, ParseException, ParseFatalException from decimal import Decimal from collections import OrderedDict from param_field.parser import parse_fields from param_field.params import * from param_field.conf import settings class TestParserBase(TestCase): def test_empty_string(self): p = parse_fields("") self.assertIsInstance(p, OrderedDict) self.assertEqual(len(p), 0) p = parse_fields(" \n") self.assertIsInstance(p, OrderedDict) self.assertEqual(len(p), 0) def test_param_type(self): # Test supported types parse_fields("width1:Dimmension") parse_fields("width2:Integer") parse_fields("width3:Decimal") parse_fields("width4:Text") parse_fields("widht5:TextArea") parse_fields("width6:Bool") parse_fields("width7:File", file_support=True) parse_fields("width8:Image", file_support=True) # Test file_support must be enabled for File and Image with self.assertRaises(ParseException): parse_fields("width: File") with self.assertRaises(ParseException): parse_fields("widht: Image") # Test unknown type with self.assertRaises(ParseException): parse_fields("width:CarNumber") # Test Type case sensitive with self.assertRaises(ParseException): parse_fields("width:dimmension") with self.assertRaises(ParseException): parse_fields("width:integer") with self.assertRaises(ParseException): parse_fields("width:decimal") with self.assertRaises(ParseException): parse_fields("width:text") with self.assertRaises(ParseException): parse_fields("width:textarea") with self.assertRaises(ParseException): parse_fields("width:bool") with self.assertRaises(ParseException): parse_fields("width:file", file_support=True) with self.assertRaises(ParseException): parse_fields("width:image", file_support=True) def test_correct_param_used(self): """Test correct param object is used for each type""" d = parse_fields('para: Integer') self.assertIsInstance(d['para'], IntegerParam) d = parse_fields('para: Decimal') self.assertIsInstance(d['para'], DecimalParam) d = parse_fields('para: Dimmension') self.assertIsInstance(d['para'], DimmensionParam) d = parse_fields('para: Text') self.assertIsInstance(d['para'], TextParam) d = parse_fields('para: Bool') self.assertIsInstance(d['para'], BoolParam) d = parse_fields('para: File', file_support=True) self.assertIsInstance(d['para'], FileParam) d = parse_fields('para: Image', file_support=True) self.assertIsInstance(d['para'], ImageParam) def test_valid_names(self): parse_fields("the_name: Bool") # Can't start with number or underscore with self.assertRaises(ParseException): parse_fields("1_name: Bool") with self.assertRaises(ParseException): parse_fields("_name: Bool") # Only lowercase allowed with self.assertRaises(ParseException): parse_fields("The_name: Bool") # spaces not allowed with self.assertRaises(ParseException): parse_fields("the name: Bool") # Other symbols not allowed for s in [".-,;{}[]!=?¿|@·$%&/()*<>'¡"]: with self.assertRaises(ParseException): parse_fields("name_{}:Bool".format(s)) with self.assertRaises(ParseException): parse_fields("{}:Bool".format(s)) # Test min and max lengths parse_fields("a: Bool") parse_fields("{}: Bool".format("a"*settings.PARAM_NAME_MAX_LENGTH)) with self.assertRaises(ParseException): parse_fields(": Bool") with self.assertRaises(ParseException): parse_fields("{}: Bool".format("a"*(settings.PARAM_NAME_MAX_LENGTH+1))) def test_string_parsing(self): """Test string quotes format""" # Only double quotes allowed for strings parse_fields('name:Text-> default:"name"') with self.assertRaises(ParseException): parse_fields("name:Text-> default:'name'") # Test string escape character p=parse_fields('''name:Text-> default:"name \\"string\\""''') self.assertEqual(p['name'].default, 'name "string"') p=parse_fields('''name:Text-> default:"asdf\\n123\\""''') self.assertEqual(p['name'].default, 'asdf\n123"') original = TextParam(default='asdf\\\nasd\n"') parse = parse_fields('name:'+original.to_str()) self.assertEqual(parse['name'].default, original.default) # Parse string with spaces inside p = parse_fields('name: Text-> default:" the default string "') self.assertEqual(p['name'].default, ' the default string ') # Length Limit p = parse_fields('name: Text-> default:"{}"'\ .format("a"*settings.PARAM_TEXT_MAX_LENGTH)) with self.assertRaises(ParseBaseException): parse_fields('name: Text-> default:"{}"'\ .format("a"*(settings.PARAM_TEXT_MAX_LENGTH+1))) def test_boolean_parsing(self): """Test wich boolean strings are accepted""" # Control group p = parse_fields('enable:Bool->default:True') self.assertIsInstance(p['enable'].default, bool) self.assertEqual(p['enable'].default, True) p = parse_fields('enable:Bool->default:False') self.assertIsInstance(p['enable'].default, bool) self.assertEqual(p['enable'].default, False) # Invalid boolean values with self.assertRaises(ParseException): parse_fields('enable:Bool->default:false') with self.assertRaises(ParseException): parse_fields('enable:Bool->default:true') with self.assertRaises(ParseException): parse_fields('enable:Bool->default:f') with self.assertRaises(ParseException): parse_fields('enable:Bool->default:t') with self.assertRaises(ParseException): parse_fields('enable:Bool->default:#t') with self.assertRaises(ParseException): parse_fields('enable:Bool->default:#f') with self.assertRaises(ValueError): parse_fields('enable:Bool->default:1') with self.assertRaises(ValueError): parse_fields('enable:Bool->default:0') with self.assertRaises(ValueError): parse_fields('enable:Bool->default:"True"') with self.assertRaises(ValueError): parse_fields('enable:Bool->default:"False"') with self.assertRaises(ValueError): parse_fields('enable:Bool->default:33.5') def test_integer_parsing(self): """Test valid integer values""" # Control group p = parse_fields('holes: Integer->default:0') self.assertEqual(p['holes'].default, 0) p = parse_fields('holes: Integer->default:-0') self.assertEqual(p['holes'].default, 0) p = parse_fields('holes: Integer->default:-0000001') self.assertEqual(p['holes'].default, -1) p = parse_fields('holes: Integer->default:2') self.assertEqual(p['holes'].default, 2) p = parse_fields('holes: Integer->default:-1') self.assertEqual(p['holes'].default, -1) # max/min limits p = parse_fields('holes: Integer->default:{}'.format(settings.PARAM_INT_MAX)) self.assertEqual(p['holes'].default, settings.PARAM_INT_MAX) p = parse_fields('holes: Integer->default:{}'.format(settings.PARAM_INT_MIN)) self.assertEqual(p['holes'].default, settings.PARAM_INT_MIN) with self.assertRaises(ParseBaseException): parse_fields('holes: Integer->default:{}'.format(settings.PARAM_INT_MAX+1)) with self.assertRaises(ParseBaseException): parse_fields('holes: Integer->default:{}'.format(settings.PARAM_INT_MIN-1)) # Try overflow integer long_long_int = "9"+"9"*10000 with self.assertRaises(ParseBaseException): parse_fields('holes: Integer->default:{}'.format(long_long_int)) def test_decimal_parsing(self): """Test valid decimal values""" # Control group p = parse_fields('width: Decimal->default:0.0') self.assertEqual(p['width'].default, Decimal('0.0')) self.assertEqual(p['width'].default, 0) p = parse_fields('width: Decimal->default:-0.0') self.assertEqual(p['width'].default, Decimal('0.0')) self.assertEqual(p['width'].default, 0) p = parse_fields('width: Decimal->default:-0000000001.0') self.assertEqual(p['width'].default, Decimal('-1.0')) self.assertEqual(p['width'].default, -1) # Not decimal with self.assertRaises(Exception): parse_fields('width: Decimal->default:33,4') with self.assertRaises(Exception): parse_fields('width: Decimal->default:33e2') with self.assertRaises(Exception): parse_fields('width: Decimal->default:33') # max/min limits p = parse_fields('width: Decimal->default:{}'.format(settings.PARAM_DECIMAL_MAX)) self.assertEqual(p['width'].default, settings.PARAM_DECIMAL_MAX) p = parse_fields('width: Decimal->default:{}'.format(settings.PARAM_DECIMAL_MIN)) self.assertEqual(p['width'].default, settings.PARAM_DECIMAL_MIN) with self.assertRaises(ParseBaseException): parse_fields('width: Decimal->default:{}'.format(settings.PARAM_DECIMAL_MAX+1)) with self.assertRaises(ParseBaseException): parse_fields('width: Decimal->default:{}'.format(settings.PARAM_DECIMAL_MIN-1)) # max_digits and max_decimals p = parse_fields('width: Decimal->max_digits: 4 default:999.9') with self.assertRaises(Exception): p = parse_fields('width: Decimal->max_digits: 4 default:9999.9') p = parse_fields('width: Decimal->max_decimals: 2 default:999.99') with self.assertRaises(Exception): p = parse_fields('width: Decimal->max_decimals: 1 default:9.999') # Try overflow decimal long_long_decimal = "9"*10000+'.'+"9"*10000 with self.assertRaises(ParseBaseException): parse_fields('width: Decimal-> default:{}'.format(long_long_decimal)) def test_empty_choices_list(self): """Choices list must contain at least one element""" parse_fields("name:Integer-> choices:[1]") with self.assertRaises(ParseException): parse_fields("name:Integer-> choices:[]") def test_errors_second_line(self): """Test parse errors""" with self.assertRaises(ParseException): parse_fields("number:Integer VALID:Bool") with self.assertRaises(ParseException): parse_fields("number:Integer-> default:12 hidden:Bool") with self.assertRaises(ParseException): parse_fields("number:Integer a:Bool hidden:33") with self.assertRaises(ParseException): parse_fields("number:Integer a:Bool 2:DecimalParam") def test_allowed_properties(self): # Test valid properties with correct parameter and value type. parse_fields('number:Integer->max:12 min:1 default:5 required:True hidden:True') parse_fields('number:Integer->even:True odd:True required:False hidden:False') parse_fields('number:Integer->default:33 choices:[22, 33, 44] required:False hidden:True') parse_fields('number:Text->max_length:44 min_length:1 required:False') parse_fields('activate:Bool->default:False hidden:False required:True') parse_fields('name:Text->help_text:"adfasd" label:"text input" required:False') parse_fields('length:Decimal->max:9999.9 min:9.99 default:100.0 max_decimals:2 max_digits:10 required:True default:44.9') # Test properties case sensitive. with self.assertRaises(ParseException): parse_fields("number:Integer-> mAx:12") with self.assertRaises(ParseException): parse_fields("input:Text-> max_length:14 Min_length:2") # Test properties not supported by parameter with self.assertRaises(ValueError): parse_fields("number:Integer-> max_length:12") with self.assertRaises(ValueError): parse_fields("number:Integer-> min_length:12") with self.assertRaises(ValueError): parse_fields("number:Integer-> max_digits:2") with self.assertRaises(ValueError): parse_fields("number:Integer-> max_decimals: 2") with self.assertRaises(ValueError): parse_fields("number:Decimal-> odd:True") with self.assertRaises(ValueError): parse_fields("number:Decimal-> even:True") with self.assertRaises(ValueError): parse_fields("number:Decimal-> max_length:12") with self.assertRaises(ValueError): parse_fields("number:Decimal-> min_length:12") with self.assertRaises(ValueError): parse_fields("number:Dimmension-> odd:True") with self.assertRaises(ValueError): parse_fields("number:Dimmension-> even:True") with self.assertRaises(ValueError): parse_fields("number:Dimmension-> max_length:12") with self.assertRaises(ValueError): parse_fields("number:Dimmension-> min_length:12") with self.assertRaises(ValueError): parse_fields("comment:Text-> odd:True") with self.assertRaises(ValueError): parse_fields("comment:Text-> even:True") with self.assertRaises(ValueError): parse_fields("comment:Text-> min:2") with self.assertRaises(ValueError): parse_fields("comment:Text-> max:5") with self.assertRaises(ValueError): parse_fields("number:Text-> max_digits:2") with self.assertRaises(ValueError): parse_fields("number:Text-> max_decimals:2") with self.assertRaises(ValueError): parse_fields("activate:Bool-> odd:True") with self.assertRaises(ValueError): parse_fields("activate:Bool-> even:True") with self.assertRaises(ValueError): parse_fields("activate:Bool-> min:1") with self.assertRaises(ValueError): parse_fields("activate:Bool-> max:2") with self.assertRaises(ValueError): parse_fields("activate:Bool-> min_length:1") with self.assertRaises(ValueError): parse_fields("activate:Bool-> max_length:3") with self.assertRaises(ValueError): parse_fields("activate:Bool-> max_digits:2") with self.assertRaises(ValueError): parse_fields("activate:Bool-> max_decimals:2") # Test invalid properties with self.assertRaises(ParseException): parse_fields("activate:Bool-> purse:3") with self.assertRaises(ParseException): parse_fields("number:Decimal-> car:3") # Test no properties are required parse_fields("activate:Bool") def test_properties_initialized(self): """Test properties are passed to param __init__ and initialized""" p = parse_fields('number:Integer->max:12 min:1 default:5 hidden:True') self.assertEqual(p['number'].max, 12) self.assertEqual(p['number'].min, 1) self.assertEqual(p['number'].default, 5) self.assertEqual(p['number'].hidden, True) p = parse_fields('number:Integer->even:True odd:True required:False') self.assertEqual(p['number'].even, True) self.assertEqual(p['number'].odd, True) self.assertEqual(p['number'].required, False) p = parse_fields('number:Integer->choices:[3, 4, 5, 6]') self.assertEqual(p['number'].choices[0], 3) self.assertEqual(p['number'].choices[1], 4) self.assertEqual(p['number'].choices[2], 5) self.assertEqual(p['number'].choices[3], 6) p = parse_fields('name:Text-> min_length:1 max_length:4') self.assertEqual(p['name'].min_length, 1) self.assertEqual(p['name'].max_length, 4) p = parse_fields('name:Text-> default:"324"') self.assertEqual(p['name'].default, '324') p = parse_fields('active:Bool-> label:"the real" help_text:"helpy"') self.assertEqual(p['active'].label, "the real") self.assertEqual(p['active'].help_text, "helpy") p = parse_fields('width:Decimal-> required: True max_digits: 10 max_decimals: 3 min:99.93') self.assertEqual(p['width'].max_digits, 10) self.assertEqual(p['width'].max_decimals, 3) self.assertEqual(p['width'].required, True) self.assertEqual(p['width'].min, Decimal('99.93')) p = parse_fields('width:Dimmension-> default:12.1 hidden:True') self.assertEqual(p['width'].hidden, True) self.assertEqual(p['width'].default, Decimal('12.1')) p = parse_fields('custom_file:File-> required:False', file_support=True) self.assertEqual(p['custom_file'].required, False) def test_properties_defaults(self): """Test properties default values""" p = parse_fields('par:Bool') self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].default, None) self.assertEqual(p['par'].hidden, False) self.assertEqual(p['par'].required, True) p = parse_fields('par:Text') self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].default, None) self.assertEqual(p['par'].choices, None) self.assertEqual(p['par'].max_length, settings.PARAM_TEXT_MAX_LENGTH) self.assertEqual(p['par'].min_length, 0) self.assertEqual(p['par'].hidden, False) self.assertEqual(p['par'].required, True) p = parse_fields('par:Integer') self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].default, None) self.assertEqual(p['par'].choices, None) self.assertEqual(p['par'].max, settings.PARAM_INT_MAX) self.assertEqual(p['par'].min, settings.PARAM_INT_MIN) self.assertEqual(p['par'].even, False) self.assertEqual(p['par'].odd, False) self.assertEqual(p['par'].hidden, False) self.assertEqual(p['par'].required, True) p = parse_fields('par:Decimal') self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].default, None) self.assertEqual(p['par'].choices, None) self.assertEqual(p['par'].max, settings.PARAM_DECIMAL_MAX) self.assertEqual(p['par'].min, settings.PARAM_DECIMAL_MIN) self.assertEqual(p['par'].max_digits, settings.PARAM_DECIMAL_MAX_DIGITS) self.assertEqual(p['par'].max_decimals, settings.PARAM_DECIMAL_MAX_DECIMALS) self.assertEqual(p['par'].hidden, False) self.assertEqual(p['par'].required, True) p = parse_fields('par:Dimmension') self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].default, None) self.assertEqual(p['par'].choices, None) self.assertEqual(p['par'].max, settings.PARAM_DIMMENSION_MAX) self.assertEqual(p['par'].min, Decimal('0.0')) self.assertEqual(p['par'].max_digits, settings.PARAM_DIMMENSION_MAX_DIGITS) self.assertEqual(p['par'].max_decimals, settings.PARAM_DIMMENSION_MAX_DECIMALS) self.assertEqual(p['par'].hidden, False) self.assertEqual(p['par'].required, True) p = parse_fields('par:File', file_support=True) self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].required, True) p = parse_fields('par:Image', file_support=True) self.assertEqual(p['par'].label, '') self.assertEqual(p['par'].help_text, '') self.assertEqual(p['par'].required, True) def test_param_limits(self): # Test max name length p = parse_fields('{}: Bool'.format("a"*settings.PARAM_NAME_MAX_LENGTH)) with self.assertRaises(ParseException): p = parse_fields('{}: Bool'.format("a"*settings.PARAM_NAME_MAX_LENGTH+"b"))
lgpl-3.0
sam-tsai/django
tests/requests/tests.py
73
33786
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import time from datetime import datetime, timedelta from io import BytesIO from itertools import chain from django.core.exceptions import SuspiciousOperation from django.core.handlers.wsgi import LimitedStream, WSGIRequest from django.http import ( HttpRequest, HttpResponse, RawPostDataException, UnreadablePostError, parse_cookie, ) from django.test import RequestFactory, SimpleTestCase, override_settings from django.test.client import FakePayload from django.test.utils import str_prefix from django.utils import six from django.utils.encoding import force_str from django.utils.http import cookie_date, urlencode from django.utils.six.moves import http_cookies from django.utils.six.moves.urllib.parse import urlencode as original_urlencode from django.utils.timezone import utc class RequestsTests(SimpleTestCase): def test_httprequest(self): request = HttpRequest() self.assertEqual(list(request.GET.keys()), []) self.assertEqual(list(request.POST.keys()), []) self.assertEqual(list(request.COOKIES.keys()), []) self.assertEqual(list(request.META.keys()), []) # .GET and .POST should be QueryDicts self.assertEqual(request.GET.urlencode(), '') self.assertEqual(request.POST.urlencode(), '') # and FILES should be MultiValueDict self.assertEqual(request.FILES.getlist('foo'), []) def test_httprequest_full_path(self): request = HttpRequest() request.path = request.path_info = '/;some/?awful/=path/foo:bar/' request.META['QUERY_STRING'] = ';some=query&+query=string' expected = '/%3Bsome/%3Fawful/%3Dpath/foo:bar/?;some=query&+query=string' self.assertEqual(request.get_full_path(), expected) def test_httprequest_full_path_with_query_string_and_fragment(self): request = HttpRequest() request.path = request.path_info = '/foo#bar' request.META['QUERY_STRING'] = 'baz#quux' self.assertEqual(request.get_full_path(), '/foo%23bar?baz#quux') def test_httprequest_repr(self): request = HttpRequest() request.path = '/somepath/' request.method = 'GET' request.GET = {'get-key': 'get-value'} request.POST = {'post-key': 'post-value'} request.COOKIES = {'post-key': 'post-value'} request.META = {'post-key': 'post-value'} self.assertEqual(repr(request), str_prefix("<HttpRequest: GET '/somepath/'>")) def test_httprequest_repr_invalid_method_and_path(self): request = HttpRequest() self.assertEqual(repr(request), str_prefix("<HttpRequest>")) request = HttpRequest() request.method = "GET" self.assertEqual(repr(request), str_prefix("<HttpRequest>")) request = HttpRequest() request.path = "" self.assertEqual(repr(request), str_prefix("<HttpRequest>")) def test_wsgirequest(self): request = WSGIRequest({'PATH_INFO': 'bogus', 'REQUEST_METHOD': 'bogus', 'wsgi.input': BytesIO(b'')}) self.assertEqual(list(request.GET.keys()), []) self.assertEqual(list(request.POST.keys()), []) self.assertEqual(list(request.COOKIES.keys()), []) self.assertEqual(set(request.META.keys()), {'PATH_INFO', 'REQUEST_METHOD', 'SCRIPT_NAME', 'wsgi.input'}) self.assertEqual(request.META['PATH_INFO'], 'bogus') self.assertEqual(request.META['REQUEST_METHOD'], 'bogus') self.assertEqual(request.META['SCRIPT_NAME'], '') def test_wsgirequest_with_script_name(self): """ Ensure that the request's path is correctly assembled, regardless of whether or not the SCRIPT_NAME has a trailing slash. Refs #20169. """ # With trailing slash request = WSGIRequest({'PATH_INFO': '/somepath/', 'SCRIPT_NAME': '/PREFIX/', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, '/PREFIX/somepath/') # Without trailing slash request = WSGIRequest({'PATH_INFO': '/somepath/', 'SCRIPT_NAME': '/PREFIX', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, '/PREFIX/somepath/') def test_wsgirequest_with_force_script_name(self): """ Ensure that the FORCE_SCRIPT_NAME setting takes precedence over the request's SCRIPT_NAME environment parameter. Refs #20169. """ with override_settings(FORCE_SCRIPT_NAME='/FORCED_PREFIX/'): request = WSGIRequest({'PATH_INFO': '/somepath/', 'SCRIPT_NAME': '/PREFIX/', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, '/FORCED_PREFIX/somepath/') def test_wsgirequest_path_with_force_script_name_trailing_slash(self): """ Ensure that the request's path is correctly assembled, regardless of whether or not the FORCE_SCRIPT_NAME setting has a trailing slash. Refs #20169. """ # With trailing slash with override_settings(FORCE_SCRIPT_NAME='/FORCED_PREFIX/'): request = WSGIRequest({'PATH_INFO': '/somepath/', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, '/FORCED_PREFIX/somepath/') # Without trailing slash with override_settings(FORCE_SCRIPT_NAME='/FORCED_PREFIX'): request = WSGIRequest({'PATH_INFO': '/somepath/', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, '/FORCED_PREFIX/somepath/') def test_wsgirequest_repr(self): request = WSGIRequest({'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(repr(request), str_prefix("<WSGIRequest: GET '/'>")) request = WSGIRequest({'PATH_INFO': '/somepath/', 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) request.GET = {'get-key': 'get-value'} request.POST = {'post-key': 'post-value'} request.COOKIES = {'post-key': 'post-value'} request.META = {'post-key': 'post-value'} self.assertEqual(repr(request), str_prefix("<WSGIRequest: GET '/somepath/'>")) def test_wsgirequest_path_info(self): def wsgi_str(path_info): path_info = path_info.encode('utf-8') # Actual URL sent by the browser (bytestring) if six.PY3: path_info = path_info.decode('iso-8859-1') # Value in the WSGI environ dict (native string) return path_info # Regression for #19468 request = WSGIRequest({'PATH_INFO': wsgi_str("/سلام/"), 'REQUEST_METHOD': 'get', 'wsgi.input': BytesIO(b'')}) self.assertEqual(request.path, "/سلام/") def test_parse_cookie(self): self.assertEqual(parse_cookie('invalid@key=true'), {}) def test_httprequest_location(self): request = HttpRequest() self.assertEqual(request.build_absolute_uri(location="https://www.example.com/asdf"), 'https://www.example.com/asdf') request.get_host = lambda: 'www.example.com' request.path = '' self.assertEqual(request.build_absolute_uri(location="/path/with:colons"), 'http://www.example.com/path/with:colons') def test_near_expiration(self): "Cookie will expire when an near expiration time is provided" response = HttpResponse() # There is a timing weakness in this test; The # expected result for max-age requires that there be # a very slight difference between the evaluated expiration # time, and the time evaluated in set_cookie(). If this # difference doesn't exist, the cookie time will be # 1 second larger. To avoid the problem, put in a quick sleep, # which guarantees that there will be a time difference. expires = datetime.utcnow() + timedelta(seconds=10) time.sleep(0.001) response.set_cookie('datetime', expires=expires) datetime_cookie = response.cookies['datetime'] self.assertEqual(datetime_cookie['max-age'], 10) def test_aware_expiration(self): "Cookie accepts an aware datetime as expiration time" response = HttpResponse() expires = (datetime.utcnow() + timedelta(seconds=10)).replace(tzinfo=utc) time.sleep(0.001) response.set_cookie('datetime', expires=expires) datetime_cookie = response.cookies['datetime'] self.assertEqual(datetime_cookie['max-age'], 10) def test_far_expiration(self): "Cookie will expire when an distant expiration time is provided" response = HttpResponse() response.set_cookie('datetime', expires=datetime(2028, 1, 1, 4, 5, 6)) datetime_cookie = response.cookies['datetime'] self.assertIn( datetime_cookie['expires'], # Slight time dependency; refs #23450 ('Sat, 01-Jan-2028 04:05:06 GMT', 'Sat, 01-Jan-2028 04:05:07 GMT') ) def test_max_age_expiration(self): "Cookie will expire if max_age is provided" response = HttpResponse() response.set_cookie('max_age', max_age=10) max_age_cookie = response.cookies['max_age'] self.assertEqual(max_age_cookie['max-age'], 10) self.assertEqual(max_age_cookie['expires'], cookie_date(time.time() + 10)) def test_httponly_cookie(self): response = HttpResponse() response.set_cookie('example', httponly=True) example_cookie = response.cookies['example'] # A compat cookie may be in use -- check that it has worked # both as an output string, and using the cookie attributes self.assertIn('; %s' % http_cookies.Morsel._reserved['httponly'], str(example_cookie)) self.assertTrue(example_cookie['httponly']) def test_unicode_cookie(self): "Verify HttpResponse.set_cookie() works with unicode data." response = HttpResponse() cookie_value = '清風' response.set_cookie('test', cookie_value) self.assertEqual(force_str(cookie_value), response.cookies['test'].value) def test_limited_stream(self): # Read all of a limited stream stream = LimitedStream(BytesIO(b'test'), 2) self.assertEqual(stream.read(), b'te') # Reading again returns nothing. self.assertEqual(stream.read(), b'') # Read a number of characters greater than the stream has to offer stream = LimitedStream(BytesIO(b'test'), 2) self.assertEqual(stream.read(5), b'te') # Reading again returns nothing. self.assertEqual(stream.readline(5), b'') # Read sequentially from a stream stream = LimitedStream(BytesIO(b'12345678'), 8) self.assertEqual(stream.read(5), b'12345') self.assertEqual(stream.read(5), b'678') # Reading again returns nothing. self.assertEqual(stream.readline(5), b'') # Read lines from a stream stream = LimitedStream(BytesIO(b'1234\n5678\nabcd\nefgh\nijkl'), 24) # Read a full line, unconditionally self.assertEqual(stream.readline(), b'1234\n') # Read a number of characters less than a line self.assertEqual(stream.readline(2), b'56') # Read the rest of the partial line self.assertEqual(stream.readline(), b'78\n') # Read a full line, with a character limit greater than the line length self.assertEqual(stream.readline(6), b'abcd\n') # Read the next line, deliberately terminated at the line end self.assertEqual(stream.readline(4), b'efgh') # Read the next line... just the line end self.assertEqual(stream.readline(), b'\n') # Read everything else. self.assertEqual(stream.readline(), b'ijkl') # Regression for #15018 # If a stream contains a newline, but the provided length # is less than the number of provided characters, the newline # doesn't reset the available character count stream = LimitedStream(BytesIO(b'1234\nabcdef'), 9) self.assertEqual(stream.readline(10), b'1234\n') self.assertEqual(stream.readline(3), b'abc') # Now expire the available characters self.assertEqual(stream.readline(3), b'd') # Reading again returns nothing. self.assertEqual(stream.readline(2), b'') # Same test, but with read, not readline. stream = LimitedStream(BytesIO(b'1234\nabcdef'), 9) self.assertEqual(stream.read(6), b'1234\na') self.assertEqual(stream.read(2), b'bc') self.assertEqual(stream.read(2), b'd') self.assertEqual(stream.read(2), b'') self.assertEqual(stream.read(), b'') def test_stream(self): payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(request.read(), b'name=value') def test_read_after_value(self): """ Reading from request is allowed after accessing request contents as POST or body. """ payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(request.POST, {'name': ['value']}) self.assertEqual(request.body, b'name=value') self.assertEqual(request.read(), b'name=value') def test_value_after_read(self): """ Construction of POST or body is not allowed after reading from request. """ payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(request.read(2), b'na') self.assertRaises(RawPostDataException, lambda: request.body) self.assertEqual(request.POST, {}) def test_non_ascii_POST(self): payload = FakePayload(urlencode({'key': 'España'})) request = WSGIRequest({ 'REQUEST_METHOD': 'POST', 'CONTENT_LENGTH': len(payload), 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'wsgi.input': payload, }) self.assertEqual(request.POST, {'key': ['España']}) def test_alternate_charset_POST(self): """ Test a POST with non-utf-8 payload encoding. """ payload = FakePayload(original_urlencode({'key': 'España'.encode('latin-1')})) request = WSGIRequest({ 'REQUEST_METHOD': 'POST', 'CONTENT_LENGTH': len(payload), 'CONTENT_TYPE': 'application/x-www-form-urlencoded; charset=iso-8859-1', 'wsgi.input': payload, }) self.assertEqual(request.POST, {'key': ['España']}) def test_body_after_POST_multipart_form_data(self): """ Reading body after parsing multipart/form-data is not allowed """ # Because multipart is used for large amounts of data i.e. file uploads, # we don't want the data held in memory twice, and we don't want to # silence the error by setting body = '' either. payload = FakePayload("\r\n".join([ '--boundary', 'Content-Disposition: form-data; name="name"', '', 'value', '--boundary--' ''])) request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'multipart/form-data; boundary=boundary', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(request.POST, {'name': ['value']}) self.assertRaises(RawPostDataException, lambda: request.body) def test_body_after_POST_multipart_related(self): """ Reading body after parsing multipart that isn't form-data is allowed """ # Ticket #9054 # There are cases in which the multipart data is related instead of # being a binary upload, in which case it should still be accessible # via body. payload_data = b"\r\n".join([ b'--boundary', b'Content-ID: id; name="name"', b'', b'value', b'--boundary--' b'']) payload = FakePayload(payload_data) request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'multipart/related; boundary=boundary', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(request.POST, {}) self.assertEqual(request.body, payload_data) def test_POST_multipart_with_content_length_zero(self): """ Multipart POST requests with Content-Length >= 0 are valid and need to be handled. """ # According to: # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 # Every request.POST with Content-Length >= 0 is a valid request, # this test ensures that we handle Content-Length == 0. payload = FakePayload("\r\n".join([ '--boundary', 'Content-Disposition: form-data; name="name"', '', 'value', '--boundary--' ''])) request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'multipart/form-data; boundary=boundary', 'CONTENT_LENGTH': 0, 'wsgi.input': payload}) self.assertEqual(request.POST, {}) def test_POST_binary_only(self): payload = b'\r\n\x01\x00\x00\x00ab\x00\x00\xcd\xcc,@' environ = {'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/octet-stream', 'CONTENT_LENGTH': len(payload), 'wsgi.input': BytesIO(payload)} request = WSGIRequest(environ) self.assertEqual(request.POST, {}) self.assertEqual(request.FILES, {}) self.assertEqual(request.body, payload) # Same test without specifying content-type environ.update({'CONTENT_TYPE': '', 'wsgi.input': BytesIO(payload)}) request = WSGIRequest(environ) self.assertEqual(request.POST, {}) self.assertEqual(request.FILES, {}) self.assertEqual(request.body, payload) def test_read_by_lines(self): payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) self.assertEqual(list(request), [b'name=value']) def test_POST_after_body_read(self): """ POST should be populated even if body is read first """ payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) request.body # evaluate self.assertEqual(request.POST, {'name': ['value']}) def test_POST_after_body_read_and_stream_read(self): """ POST should be populated even if body is read first, and then the stream is read second. """ payload = FakePayload('name=value') request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) request.body # evaluate self.assertEqual(request.read(1), b'n') self.assertEqual(request.POST, {'name': ['value']}) def test_POST_after_body_read_and_stream_read_multipart(self): """ POST should be populated even if body is read first, and then the stream is read second. Using multipart/form-data instead of urlencoded. """ payload = FakePayload("\r\n".join([ '--boundary', 'Content-Disposition: form-data; name="name"', '', 'value', '--boundary--' ''])) request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'multipart/form-data; boundary=boundary', 'CONTENT_LENGTH': len(payload), 'wsgi.input': payload}) request.body # evaluate # Consume enough data to mess up the parsing: self.assertEqual(request.read(13), b'--boundary\r\nC') self.assertEqual(request.POST, {'name': ['value']}) def test_POST_connection_error(self): """ If wsgi.input.read() raises an exception while trying to read() the POST, the exception should be identifiable (not a generic IOError). """ class ExplodingBytesIO(BytesIO): def read(self, len=0): raise IOError("kaboom!") payload = b'name=value' request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': len(payload), 'wsgi.input': ExplodingBytesIO(payload)}) with self.assertRaises(UnreadablePostError): request.body def test_FILES_connection_error(self): """ If wsgi.input.read() raises an exception while trying to read() the FILES, the exception should be identifiable (not a generic IOError). """ class ExplodingBytesIO(BytesIO): def read(self, len=0): raise IOError("kaboom!") payload = b'x' request = WSGIRequest({'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'multipart/form-data; boundary=foo_', 'CONTENT_LENGTH': len(payload), 'wsgi.input': ExplodingBytesIO(payload)}) with self.assertRaises(UnreadablePostError): request.FILES class HostValidationTests(SimpleTestCase): poisoned_hosts = [ '[email protected]', 'example.com:[email protected]', 'example.com:[email protected]:80', 'example.com:80/badpath', 'example.com: recovermypassword.com', ] @override_settings( USE_X_FORWARDED_HOST=False, ALLOWED_HOSTS=[ 'forward.com', 'example.com', 'internal.com', '12.34.56.78', '[2001:19f0:feee::dead:beef:cafe]', 'xn--4ca9at.com', '.multitenant.com', 'INSENSITIVE.com', ]) def test_http_get_host(self): # Check if X_FORWARDED_HOST is provided. request = HttpRequest() request.META = { 'HTTP_X_FORWARDED_HOST': 'forward.com', 'HTTP_HOST': 'example.com', 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } # X_FORWARDED_HOST is ignored. self.assertEqual(request.get_host(), 'example.com') # Check if X_FORWARDED_HOST isn't provided. request = HttpRequest() request.META = { 'HTTP_HOST': 'example.com', 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } self.assertEqual(request.get_host(), 'example.com') # Check if HTTP_HOST isn't provided. request = HttpRequest() request.META = { 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } self.assertEqual(request.get_host(), 'internal.com') # Check if HTTP_HOST isn't provided, and we're on a nonstandard port request = HttpRequest() request.META = { 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 8042, } self.assertEqual(request.get_host(), 'internal.com:8042') legit_hosts = [ 'example.com', 'example.com:80', '12.34.56.78', '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', 'xn--4ca9at.com', # Punnycode for öäü.com 'anything.multitenant.com', 'multitenant.com', 'insensitive.com', 'example.com.', 'example.com.:80', ] for host in legit_hosts: request = HttpRequest() request.META = { 'HTTP_HOST': host, } request.get_host() # Poisoned host headers are rejected as suspicious for host in chain(self.poisoned_hosts, ['other.com', 'example.com..']): with self.assertRaises(SuspiciousOperation): request = HttpRequest() request.META = { 'HTTP_HOST': host, } request.get_host() @override_settings(USE_X_FORWARDED_HOST=True, ALLOWED_HOSTS=['*']) def test_http_get_host_with_x_forwarded_host(self): # Check if X_FORWARDED_HOST is provided. request = HttpRequest() request.META = { 'HTTP_X_FORWARDED_HOST': 'forward.com', 'HTTP_HOST': 'example.com', 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } # X_FORWARDED_HOST is obeyed. self.assertEqual(request.get_host(), 'forward.com') # Check if X_FORWARDED_HOST isn't provided. request = HttpRequest() request.META = { 'HTTP_HOST': 'example.com', 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } self.assertEqual(request.get_host(), 'example.com') # Check if HTTP_HOST isn't provided. request = HttpRequest() request.META = { 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 80, } self.assertEqual(request.get_host(), 'internal.com') # Check if HTTP_HOST isn't provided, and we're on a nonstandard port request = HttpRequest() request.META = { 'SERVER_NAME': 'internal.com', 'SERVER_PORT': 8042, } self.assertEqual(request.get_host(), 'internal.com:8042') # Poisoned host headers are rejected as suspicious legit_hosts = [ 'example.com', 'example.com:80', '12.34.56.78', '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', 'xn--4ca9at.com', # Punnycode for öäü.com ] for host in legit_hosts: request = HttpRequest() request.META = { 'HTTP_HOST': host, } request.get_host() for host in self.poisoned_hosts: with self.assertRaises(SuspiciousOperation): request = HttpRequest() request.META = { 'HTTP_HOST': host, } request.get_host() @override_settings(USE_X_FORWARDED_PORT=False) def test_get_port(self): request = HttpRequest() request.META = { 'SERVER_PORT': '8080', 'HTTP_X_FORWARDED_PORT': '80', } # Shouldn't use the X-Forwarded-Port header self.assertEqual(request.get_port(), '8080') request = HttpRequest() request.META = { 'SERVER_PORT': '8080', } self.assertEqual(request.get_port(), '8080') @override_settings(USE_X_FORWARDED_PORT=True) def test_get_port_with_x_forwarded_port(self): request = HttpRequest() request.META = { 'SERVER_PORT': '8080', 'HTTP_X_FORWARDED_PORT': '80', } # Should use the X-Forwarded-Port header self.assertEqual(request.get_port(), '80') request = HttpRequest() request.META = { 'SERVER_PORT': '8080', } self.assertEqual(request.get_port(), '8080') @override_settings(DEBUG=True, ALLOWED_HOSTS=[]) def test_host_validation_disabled_in_debug_mode(self): """If ALLOWED_HOSTS is empty and DEBUG is True, all hosts pass.""" request = HttpRequest() request.META = { 'HTTP_HOST': 'example.com', } self.assertEqual(request.get_host(), 'example.com') # Invalid hostnames would normally raise a SuspiciousOperation, # but we have DEBUG=True, so this check is disabled. request = HttpRequest() request.META = { 'HTTP_HOST': "invalid_hostname.com", } self.assertEqual(request.get_host(), "invalid_hostname.com") @override_settings(ALLOWED_HOSTS=[]) def test_get_host_suggestion_of_allowed_host(self): """get_host() makes helpful suggestions if a valid-looking host is not in ALLOWED_HOSTS.""" msg_invalid_host = "Invalid HTTP_HOST header: %r." msg_suggestion = msg_invalid_host + " You may need to add %r to ALLOWED_HOSTS." msg_suggestion2 = msg_invalid_host + " The domain name provided is not valid according to RFC 1034/1035" for host in [ # Valid-looking hosts 'example.com', '12.34.56.78', '[2001:19f0:feee::dead:beef:cafe]', 'xn--4ca9at.com', # Punnycode for öäü.com ]: request = HttpRequest() request.META = {'HTTP_HOST': host} self.assertRaisesMessage( SuspiciousOperation, msg_suggestion % (host, host), request.get_host ) for domain, port in [ # Valid-looking hosts with a port number ('example.com', 80), ('12.34.56.78', 443), ('[2001:19f0:feee::dead:beef:cafe]', 8080), ]: host = '%s:%s' % (domain, port) request = HttpRequest() request.META = {'HTTP_HOST': host} self.assertRaisesMessage( SuspiciousOperation, msg_suggestion % (host, domain), request.get_host ) for host in self.poisoned_hosts: request = HttpRequest() request.META = {'HTTP_HOST': host} self.assertRaisesMessage( SuspiciousOperation, msg_invalid_host % host, request.get_host ) request = HttpRequest() request.META = {'HTTP_HOST': "invalid_hostname.com"} self.assertRaisesMessage( SuspiciousOperation, msg_suggestion2 % "invalid_hostname.com", request.get_host ) class BuildAbsoluteURITestCase(SimpleTestCase): """ Regression tests for ticket #18314. """ def setUp(self): self.factory = RequestFactory() def test_build_absolute_uri_no_location(self): """ Ensures that ``request.build_absolute_uri()`` returns the proper value when the ``location`` argument is not provided, and ``request.path`` begins with //. """ # //// is needed to create a request with a path beginning with // request = self.factory.get('////absolute-uri') self.assertEqual( request.build_absolute_uri(), 'http://testserver//absolute-uri' ) def test_build_absolute_uri_absolute_location(self): """ Ensures that ``request.build_absolute_uri()`` returns the proper value when an absolute URL ``location`` argument is provided, and ``request.path`` begins with //. """ # //// is needed to create a request with a path beginning with // request = self.factory.get('////absolute-uri') self.assertEqual( request.build_absolute_uri(location='http://example.com/?foo=bar'), 'http://example.com/?foo=bar' ) def test_build_absolute_uri_schema_relative_location(self): """ Ensures that ``request.build_absolute_uri()`` returns the proper value when a schema-relative URL ``location`` argument is provided, and ``request.path`` begins with //. """ # //// is needed to create a request with a path beginning with // request = self.factory.get('////absolute-uri') self.assertEqual( request.build_absolute_uri(location='//example.com/?foo=bar'), 'http://example.com/?foo=bar' ) def test_build_absolute_uri_relative_location(self): """ Ensures that ``request.build_absolute_uri()`` returns the proper value when a relative URL ``location`` argument is provided, and ``request.path`` begins with //. """ # //// is needed to create a request with a path beginning with // request = self.factory.get('////absolute-uri') self.assertEqual( request.build_absolute_uri(location='/foo/bar/'), 'http://testserver/foo/bar/' )
bsd-3-clause
psynteract/psynteract-os
setup.py
1
5181
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() def plugin_files(name): return [ 'plugins/{0}/info.yaml'.format(name), 'plugins/{0}/{0}.py'.format(name), 'plugins/{0}/{0}.md'.format(name), 'plugins/{0}/{0}.png'.format(name), 'plugins/{0}/{0}_large.png'.format(name), ] setup( name='psynteract-os', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html version='0.8.0', description='Psynteract OpenSesame Integration', long_description=long_description, # The project's main homepage. url='https://github.com/psynteract/psynteract-os', # Author details author='Felix Henninger & Pascal Kieslich', author_email='[email protected]', # Choose your license license='GPLv3', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ # How mature is this project? Common values are # 3 - Alpha # 4 - Beta # 5 - Production/Stable 'Development Status :: 5 - Production/Stable', # Indicate who your project is intended for 'Intended Audience :: Science/Research', 'Topic :: Scientific/Engineering', # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', ], # What does your project relate to? keywords='psychology economics experiment strategy interaction', # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). #packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Alternatively, if you want to distribute just a my_module.py, uncomment # this: # py_modules=["my_module"], # List run-time dependencies here. These will be installed by pip when # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html install_requires=[ 'psynteract' ], dependency_links = [ 'https://github.com/psynteract/psynteract-py/releases/download/v0.7.0/psynteract-0.7.0.tar.gz#egg=psynteract-0.7.0' ], # List additional groups of dependencies here (e.g. development # dependencies). You can install these using the following syntax, # for example: # $ pip install -e .[dev,test] #extras_require={ # 'dev': ['check-manifest'], # 'test': ['coverage'], #}, # If there are data files included in your packages that need to be # installed, specify them here. If using Python 2.6 or less, then these # have to be included in MANIFEST.in as well. #package_data={ # 'sample': ['package_data.dat'], #}, # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa # In this case, 'data_file' will be installed into '<sys.prefix>/my_data' #data_files=[('my_data', ['data/data_file'])], # To provide executable scripts, use entry points in preference to the # "scripts" keyword. Entry points provide cross-platform support and allow # pip to create the appropriate form of executable for the target platform. #entry_points={ # 'console_scripts': [ # 'sample=sample:main', # ], #}, data_files = [ ('share/opensesame_extensions/psynteract_extension', [ 'extensions/psynteract_extension/info.yaml', 'extensions/psynteract_extension/psynteract_extension.py', ]), ('share/opensesame_plugins/psynteract_communicate', plugin_files('psynteract_communicate')), ('share/opensesame_plugins/psynteract_connect', plugin_files('psynteract_connect')), ('share/opensesame_plugins/psynteract_get', plugin_files('psynteract_get')), ('share/opensesame_plugins/psynteract_push', plugin_files('psynteract_push')), ('share/opensesame_plugins/psynteract_reassign', plugin_files('psynteract_reassign')), ('share/opensesame_plugins/psynteract_wait', plugin_files('psynteract_wait')), ] )
gpl-3.0
noba3/KoTos
addons/plugin.video.screen_yahoo_com/default.py
1
20315
#!/usr/bin/python # -*- coding: utf-8 -*- import socket import urllib import urllib2 import cookielib import xbmcplugin import xbmcaddon import xbmcgui import json import sys import os import re addon = xbmcaddon.Addon() socket.setdefaulttimeout(60) pluginhandle = int(sys.argv[1]) addonID = addon.getAddonInfo('id') cj = cookielib.MozillaCookieJar() icon = xbmc.translatePath('special://home/addons/'+addonID+'/icon.png') cookieFile = xbmc.translatePath("special://profile/addon_data/"+addonID+"/cookies") channelFavsFile = xbmc.translatePath("special://profile/addon_data/"+addonID+"/"+addonID+".favorites") opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) userAgent = "Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0" opener.addheaders = [('User-agent', userAgent)] while (not os.path.exists(xbmc.translatePath("special://profile/addon_data/"+addonID+"/settings.xml"))): addon.openSettings() if os.path.exists(cookieFile): cj.load(cookieFile) useThumbAsFanart = addon.getSetting("useThumbAsFanart") == "true" forceView = addon.getSetting("forceView") == "true" viewID = str(addon.getSetting("viewIDNew")) site1 = addon.getSetting("site1") == "true" site2 = addon.getSetting("site2") == "true" site3 = addon.getSetting("site3") == "true" site4 = addon.getSetting("site4") == "true" site5 = addon.getSetting("site5") == "true" site6 = addon.getSetting("site6") == "true" site7 = addon.getSetting("site7") == "true" site8 = addon.getSetting("site8") == "true" site9 = addon.getSetting("site9") == "true" site10 = addon.getSetting("site10") == "true" site11 = addon.getSetting("site11") == "true" maxVideoQuality = addon.getSetting("maxVideoQuality") maxVideoQuality = [1096, 1628, 3192, 4192][int(maxVideoQuality)] itemsPerPage = addon.getSetting("itemsPerPage") itemsPerPage = ["25", "50", "75", "100"][int(itemsPerPage)] urlMainUS = "http://screen.yahoo.com" urlMainUK = "http://uk.screen.yahoo.com" urlMainDE = "http://de.screen.yahoo.com" urlMainIN = "http://in.screen.yahoo.com" urlMainCA = "http://ca.screen.yahoo.com" urlMainIT = "http://it.screen.yahoo.com" urlMainES = "http://es.screen.yahoo.com" urlMainMX = "http://mx.screen.yahoo.com" urlMainBR = "http://br.screen.yahoo.com" urlMainFR = "http://fr.screen.yahoo.com" urlMainESUS = "http://es-us.screen.yahoo.com" def index(): if site1: addDir(translation(30003), urlMainUS, "listChannelsUS", icon, "en-US") if site2: addDir(translation(30004), urlMainUK, "listChannels", icon, "en-GB") if site3: addDir(translation(30005), urlMainDE, "listChannels", icon, "de-DE") if site4: addDir(translation(30006), urlMainCA, "listChannels", icon, "en-CA") if site5: addDir(translation(30007), urlMainFR, "listChannels", icon, "fr-FR") if site6: addDir(translation(30008), urlMainIT, "listChannels", icon, "it-IT") if site7: addDir(translation(30009), urlMainMX, "listChannels", icon, "es-MX") if site8: addDir(translation(30010), urlMainIN, "listChannels", icon, "en-IN") if site9: addDir(translation(30011), urlMainBR, "listChannels", icon, "pt-BR") if site10: addDir(translation(30012), urlMainES, "listChannels", icon, "es-ES") if site11: addDir(translation(30013), urlMainESUS, "listChannels", icon, "es-US") xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listChannelsUS(urlMain, language): addDir("Search", urlMain, "search", "", language) content = opener.open(urlMainUS).read() match = re.compile('root.App.Cache.data.channels = (.+?);', re.DOTALL).findall(content) content = json.loads(match[0]) for item in content['items']: title = item["name"] id = item["url_alias"] url = urlMainUS+"/ajax/resource/channel/id/"+id+";count="+itemsPerPage+";start=0" addChannelDir(title, url, 'listVideosUS', '', language) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listChannels(urlMain, language): if urlMain==urlMainDE: addDir("Alle Sendungen", urlMainDE+"/shows-a-z/", 'listShowsDE', '', language) addDir("Search", urlMain, "search", "", language) content = opener.open(urlMain).read() cj.save(cookieFile) match = re.compile('<li class="navitem.*?"><a href="(.+?)".+?<span>(.+?)</span>', re.DOTALL).findall(content) notWorkingUrls = ["http://de.screen.yahoo.com/shows-a-z/", "http://de.screen.yahoo.com/comedians/", "http://de.screen.yahoo.com/serien/", "http://de.screen.yahoo.com/bbc-dokus/", "http://in.screen.yahoo.com/explore"] for url, title in match: if urlMain not in url: url = urlMain+url if url not in notWorkingUrls: addChannelDir(cleanTitle(title), url, 'listVideosMain', '', language) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listVideosMain(urlMain, language): content = opener.open(urlMain).read() cj.save(cookieFile) content2 = content[:content.find('<div class="CAN_ad">')] matchTitles = re.compile('class="yom-mod yom-bcarousel ymg-carousel rapid-nf" id="(.+?)">.+?<h3>(.+?)</h3>', re.DOTALL).findall(content2) if len(matchTitles) == 0: match = re.compile('"modId":".+?".+?content_id=(.+?)&', re.DOTALL).findall(content) match2 = re.compile('"modId":".+?".+?list_id=(.+?)&', re.DOTALL).findall(content) url = "" if match: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-collection/?content_id="+match[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" elif match2: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-list/?list_id="+match2[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" if url: listVideos(url, language) if len(matchTitles) == 1: match = re.compile('"modId":"'+matchTitles[0][0]+'".+?content_id=(.+?)&', re.DOTALL).findall(content) match2 = re.compile('"modId":"'+matchTitles[0][0]+'".+?list_id=(.+?)&', re.DOTALL).findall(content) url = "" if match: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-collection/?content_id="+match[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" elif match2: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-list/?list_id="+match2[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" if url: listVideos(url, language) elif len(matchTitles) > 1: for id, title in matchTitles: try: if "<a href" in title: title = title[title.find(">")+1:] title = title[:title.find("<")] match = re.compile('"modId":"'+id+'".+?content_id=(.+?)&', re.DOTALL).findall(content) match2 = re.compile('"modId":"'+id+'".+?list_id=(.+?)&', re.DOTALL).findall(content) url = "" if match: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-collection/?content_id="+match[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" elif match2: url = urlMain[:urlMain.find(".screen")]+".screen.yahoo.com/_xhr/carousel/bcarousel-mixed-list/?list_id="+match2[0]+"&thumb_ratio=16x9&pyoff=0&title_lines_max=2&show_cite=&show_date=&show_provider=&show_author=&show_duration=&show_subtitle=&show_provider_links=&apply_filter=&filters=%255B%255D&template=tile&num_cols=5&num_rows=10&start_initial=1&max_items=48&pages_per_batch=2&sec=&module=MediaBCarouselMixedLPCA&spaceid=&mod_units=16&renderer_key=&start=0" if url and "VEVO" not in title: addDir(cleanTitle(title), url, 'listVideos', "", language) except: pass xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listVideos(urlMain, language): content = opener.open(urlMain).read() if not '<li class="bcarousel-item"' in content: content = opener.open(urlMain).read() spl = content.split('<li class="bcarousel-item"') for i in range(1, len(spl), 1): entry = spl[i] match = re.compile('alt="(.+?)"', re.DOTALL).findall(entry) title = cleanTitle(match[0]) match = re.compile('data-id="(.+?)"', re.DOTALL).findall(entry) id = match[0] match = re.compile('src="(.+?)"', re.DOTALL).findall(entry) thumb = match[0] thumb = thumb[thumb.rfind('http'):] if "icon-play-small" in entry: addLink(title, id, 'playVideo', thumb, language) else: match = re.compile('href="(.+?)"', re.DOTALL).findall(entry) addDir(title, match[0], 'listVideosMain', thumb, language) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listVideosUS(url, language): xbmcplugin.setContent(pluginhandle, "episodes") content = opener.open(url).read() content = json.loads(content) for video in content['videos']: title = video['title'].encode('utf-8') desc = video['description'].encode('utf-8') date = video['provider_publish_time'] date = date[:date.find('T')] duration = video['duration'] views = str(video['view_count']) desc = views+" Views\n"+desc id = video['id'] thumb = video['thumbnails'][0]['url'] addLink(title, id, 'playVideo', thumb, language, desc, duration, date) if len(content['videos']) == 50: currentIndex = url[url.rfind("=")+1:] nextIndex = str(int(currentIndex)+int(itemsPerPage)) nextUrl = url[:url.rfind("=")+1]+nextIndex addDir(translation(30001), nextUrl, 'listVideosUS', "", language) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listShowsDE(urlMain, language): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) content = opener.open(urlMain).read() content = content[content.find('<div class="yom-mod yom-heading-generic"'):] content = content[:content.find('<div class="yom-mod yom-scrollflow"')] match = re.compile('<a href="(.+?)"><span>(.+?)<', re.DOTALL).findall(content) for url, title in match: addDir(title, url, 'listVideosMain', "", language) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def listSearchVideos(url, language): content = opener.open(url).read() if '"results":[]' in content: content = opener.open(url).read() content = content.replace("\u003C", "<").replace("\u003E", ">").replace("\u0022", "\"").replace("\u0027", "'").replace("\ufffd", "").replace("\\", "").replace("/r", "") spl = content.split('<a href') for i in range(1, len(spl), 1): entry = spl[i] match = re.compile('data-rurl="(.+?)"', re.DOTALL).findall(entry) url = match[0] match = re.compile('<span class="note dur">(.+?)</span>', re.DOTALL).findall(entry) duration = match[0] if duration.startswith("00:"): duration = 1 match = re.compile('"d":"(.+?)"', re.DOTALL).findall(entry) desc = cleanTitle(match[0]).replace("<b>", "").replace("</b>", "") match = re.compile('<s class="splay"></s></span>(.+?)<', re.DOTALL).findall(entry) title = cleanTitle(match[0]) match = re.compile('src="(.+?)"', re.DOTALL).findall(entry) thumb = match[0] addSearchLink(title, url, 'playVideoSearch', thumb, language, desc, duration) xbmcplugin.endOfDirectory(pluginhandle) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewID+')') def search(urlMain, language): keyboard = xbmc.Keyboard('', translation(30002)) keyboard.doModal() if keyboard.isConfirmed() and keyboard.getText(): search_string = keyboard.getText().replace(" ", "%23") listSearchVideos(urlMain.replace("screen.yahoo.com", "video.search.yahoo.com")+"/search/?fr=screen&o=js&p="+search_string, language) def playVideo(id, language): content = opener.open("http://video.query.yahoo.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.media.video.streams%20WHERE%20id%3D%22"+id+"%22%20AND%20format%3D%22mp4%2Cflv%22%20AND%20protocol%3D%22http%22%20AND%20rt%3D%22flash%22%20AND%20plrs%3D%22%22%20AND%20acctid%3D%22%22%20AND%20plidl%3D%22%22%20AND%20pspid%3D%22%22%20AND%20offnetwork%3D%22false%22%20AND%20site%3D%22ivy%22%20AND%20lang%3D%22"+language+"%22%20AND%20region%3D%22"+language.split("-")[1]+"%22%20AND%20override%3D%22none%22%3B&env=prod&format=json").read() if '"geo restricted"' in content: xbmc.executebuiltin('XBMC.Notification(Info:,'+str(translation(30014))+',5000)') else: content = json.loads(content) url = "" for stream in content['query']['results']['mediaObj'][0]['streams']: br = stream['bitrate'] if br <= maxVideoQuality: url = stream['host']+stream['path'] if url: listitem = xbmcgui.ListItem(path=url) xbmcplugin.setResolvedUrl(pluginhandle, True, listitem) def playVideoSearch(url, language): content = opener.open(url).read() match = re.compile('root.App.Cache.context.videoCache.curChannel = \\{".+?":"(.+?)"', re.DOTALL).findall(content) match2 = re.compile('CONTENT_ID = "(.+?)"', re.DOTALL).findall(content) if match: playVideo(match[0], language) elif match2: playVideo(match2[0], language) def queueVideo(url, name): playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) listitem = xbmcgui.ListItem(name) playlist.add(url, listitem) def translation(id): return addon.getLocalizedString(id).encode('utf-8') def cleanTitle(title): title = title.replace("u0026", "&").replace("&lt;", "<").replace("&gt;", ">").replace("&amp;", "&").replace("&#39;", "'").replace("&quot;", "\"").replace("&szlig;", "ß").replace("&ndash;", "-") title = title.replace("&Auml;", "Ä").replace("&Uuml;", "Ü").replace("&Ouml;", "Ö").replace("&auml;", "ä").replace("&uuml;", "ü").replace("&ouml;", "ö") title = title.replace("\\'", "'").strip() return title def parameters_string_to_dict(parameters): paramDict = {} if parameters: paramPairs = parameters[1:].split("&") for paramsPair in paramPairs: paramSplits = paramsPair.split('=') if (len(paramSplits)) == 2: paramDict[paramSplits[0]] = paramSplits[1] return paramDict def addLink(name, url, mode, iconimage, language="", desc="", duration="", date=""): u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&language="+str(language) ok = True liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": desc, "Aired": date, "Episode": 1}) liz.setProperty('IsPlayable', 'true') if duration: liz.addStreamInfo('video', {'duration': duration}) if useThumbAsFanart: liz.setProperty("fanart_image", iconimage) entries = [] entries.append((translation(30043), 'RunPlugin(plugin://'+addonID+'/?mode=queueVideo&url='+urllib.quote_plus(u)+'&name='+urllib.quote_plus(name)+')',)) liz.addContextMenuItems(entries) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz) return ok def addSearchLink(name, url, mode, iconimage, language="", desc="", duration="", date=""): u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&language="+str(language) ok = True liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": desc, "Aired": date, "Duration": duration}) liz.setProperty('IsPlayable', 'true') entries = [] entries.append((translation(30043), 'RunPlugin(plugin://'+addonID+'/?mode=queueVideo&url='+urllib.quote_plus(u)+'&name='+urllib.quote_plus(name)+')',)) liz.addContextMenuItems(entries) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz) return ok def addDir(name, url, mode, iconimage, language=""): u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&language="+str(language) ok = True liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name}) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) return ok def addChannelDir(name, url, mode, iconimage, language=""): u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&language="+str(language) ok = True liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name}) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) return ok def addChannelFavDir(name, url, mode, iconimage, language=""): u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&language="+str(language) ok = True liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz.setInfo(type="Video", infoLabels={"Title": name}) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True) return ok params = parameters_string_to_dict(sys.argv[2]) mode = urllib.unquote_plus(params.get('mode', '')) url = urllib.unquote_plus(params.get('url', '')) name = urllib.unquote_plus(params.get('name', '')) language = urllib.unquote_plus(params.get('language', '')) if mode == 'listVideosUS': listVideosUS(url, language) elif mode == 'listChannelsUS': listChannelsUS(url, language) elif mode == 'listShowsDE': listShowsDE(url, language) elif mode == 'listChannels': listChannels(url, language) elif mode == 'listVideosMain': listVideosMain(url, language) elif mode == 'listVideos': listVideos(url, language) elif mode == 'listSearchVideos': listSearchVideos(url, language) elif mode == 'playVideo': playVideo(url, language) elif mode == 'playVideoSearch': playVideoSearch(url, language) elif mode == "queueVideo": queueVideo(url, name) elif mode == 'search': search(url, language) else: index()
gpl-2.0
PLyczkowski/Sticky-Keymap
2.74/python/lib/site-packages/requests/packages/urllib3/request.py
853
5751
try: from urllib.parse import urlencode except ImportError: from urllib import urlencode from .filepost import encode_multipart_formdata __all__ = ['RequestMethods'] class RequestMethods(object): """ Convenience mixin for classes who implement a :meth:`urlopen` method, such as :class:`~urllib3.connectionpool.HTTPConnectionPool` and :class:`~urllib3.poolmanager.PoolManager`. Provides behavior for making common types of HTTP request methods and decides which type of request field encoding to use. Specifically, :meth:`.request_encode_url` is for sending requests whose fields are encoded in the URL (such as GET, HEAD, DELETE). :meth:`.request_encode_body` is for sending requests whose fields are encoded in the *body* of the request using multipart or www-form-urlencoded (such as for POST, PUT, PATCH). :meth:`.request` is for making any kind of request, it will look up the appropriate encoding format and use one of the above two methods to make the request. Initializer parameters: :param headers: Headers to include with all requests, unless other headers are given explicitly. """ _encode_url_methods = set(['DELETE', 'GET', 'HEAD', 'OPTIONS']) def __init__(self, headers=None): self.headers = headers or {} def urlopen(self, method, url, body=None, headers=None, encode_multipart=True, multipart_boundary=None, **kw): # Abstract raise NotImplemented("Classes extending RequestMethods must implement " "their own ``urlopen`` method.") def request(self, method, url, fields=None, headers=None, **urlopen_kw): """ Make a request using :meth:`urlopen` with the appropriate encoding of ``fields`` based on the ``method`` used. This is a convenience method that requires the least amount of manual effort. It can be used in most situations, while still having the option to drop down to more specific methods when necessary, such as :meth:`request_encode_url`, :meth:`request_encode_body`, or even the lowest level :meth:`urlopen`. """ method = method.upper() if method in self._encode_url_methods: return self.request_encode_url(method, url, fields=fields, headers=headers, **urlopen_kw) else: return self.request_encode_body(method, url, fields=fields, headers=headers, **urlopen_kw) def request_encode_url(self, method, url, fields=None, **urlopen_kw): """ Make a request using :meth:`urlopen` with the ``fields`` encoded in the url. This is useful for request methods like GET, HEAD, DELETE, etc. """ if fields: url += '?' + urlencode(fields) return self.urlopen(method, url, **urlopen_kw) def request_encode_body(self, method, url, fields=None, headers=None, encode_multipart=True, multipart_boundary=None, **urlopen_kw): """ Make a request using :meth:`urlopen` with the ``fields`` encoded in the body. This is useful for request methods like POST, PUT, PATCH, etc. When ``encode_multipart=True`` (default), then :meth:`urllib3.filepost.encode_multipart_formdata` is used to encode the payload with the appropriate content type. Otherwise :meth:`urllib.urlencode` is used with the 'application/x-www-form-urlencoded' content type. Multipart encoding must be used when posting files, and it's reasonably safe to use it in other times too. However, it may break request signing, such as with OAuth. Supports an optional ``fields`` parameter of key/value strings AND key/filetuple. A filetuple is a (filename, data, MIME type) tuple where the MIME type is optional. For example:: fields = { 'foo': 'bar', 'fakefile': ('foofile.txt', 'contents of foofile'), 'realfile': ('barfile.txt', open('realfile').read()), 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), 'nonamefile': 'contents of nonamefile field', } When uploading a file, providing a filename (the first parameter of the tuple) is optional but recommended to best mimick behavior of browsers. Note that if ``headers`` are supplied, the 'Content-Type' header will be overwritten because it depends on the dynamic random boundary string which is used to compose the body of the request. The random boundary string can be explicitly set with the ``multipart_boundary`` parameter. """ if headers is None: headers = self.headers extra_kw = {'headers': {}} if fields: if 'body' in urlopen_kw: raise TypeError('request got values for both \'fields\' and \'body\', can only specify one.') if encode_multipart: body, content_type = encode_multipart_formdata(fields, boundary=multipart_boundary) else: body, content_type = urlencode(fields), 'application/x-www-form-urlencoded' extra_kw['body'] = body extra_kw['headers'] = {'Content-Type': content_type} extra_kw['headers'].update(headers) extra_kw.update(urlopen_kw) return self.urlopen(method, url, **extra_kw)
gpl-2.0
cnsoft/kbengine-cocos2dx
demo/res/scripts/data/d_spaces_spawns.py
1
2275
# -*- coding: utf-8 -*- datas={ 1: [ ], 2: [ (1001, (-102.9299, 191.0, -150.922),(0.0,0.0,0.0), 1), (1002, (-105.0, 191.0, -150.922),(0.0,0.0,0.0), 1), (1003, (-132.9299, 191.0, -150.922),(0.0,0.0,0.0), 1), (1003, (-137.833725, 170.639648, -202.246201),(0.0,0.0,0.0), 1), (1003, (-146.968063, 161.339844, -231.600098),(0.0,0.0,0.0), 1), (1003, (-94.462944, 180.093750, -195.883881),(0.0,0.0,0.0), 1), (1003, (-103.794640, 177.567383, -220.648834),(0.0,0.0,0.0), 1), (1003, (-83.443954, 178.699219, -239.645569),(0.0,0.0,0.0), 1), (1003, (-72.320412, 181.892578, -219.838470),(0.0,0.0,0.0), 1), (1004, (-69.049957, 179.322266, -175.957031),(0.0,0.0,0.0), 1), (1004, (-60.296272, 181.892578, -220.473770),(0.0,0.0,0.0), 1), (1004, (-44.794971, 184.611328, -200.343048),(0.0,0.0,0.0), 1), (1004, (-41.807720, 183.460938, -160.731979),(0.0,0.0,0.0), 1), (1004, (-61.230453, 181.336914, -144.657440),(0.0,0.0,0.0), 1), (1004, (-71.636917, 181.903320, -140.565033),(0.0,0.0,0.0), 1), (1004, (-73.323441, 180.928711, -160.713318),(0.0,0.0,0.0), 1), (1004, (-53.436718, 183.460938, -125.980476),(0.0,0.0,0.0), 1), (1004, (-64.340378, 186.237305, -121.070831),(0.0,0.0,0.0), 1), ], 3: [ (1001, (-102.9299, 1.2, -150.922),(0.0,0.0,0.0), 1), (1002, (-105.0, 1.2, -150.922),(0.0,0.0,0.0), 1), (1003, (-132.9299, 1.2, -150.922),(0.0,0.0,0.0), 1), (1003, (-137.833725, 1.2, -202.246201),(0.0,0.0,0.0), 1), (1003, (-146.968063, 1.2, -231.600098),(0.0,0.0,0.0), 1), (1003, (-94.462944, 1.2, -195.883881),(0.0,0.0,0.0), 1), (1003, (-103.794640, 1.2, -220.648834),(0.0,0.0,0.0), 1), (1003, (-83.443954, 1.2, -239.645569),(0.0,0.0,0.0), 1), (1003, (-72.320412, 1.2, -219.838470),(0.0,0.0,0.0), 1), (1004, (-69.049957, 1.2, -175.957031),(0.0,0.0,0.0), 1), (1004, (-60.296272, 1.2, -220.473770),(0.0,0.0,0.0), 1), (1004, (-44.794971, 1.2, -200.343048),(0.0,0.0,0.0), 1), (1004, (-41.807720, 1.2, -160.731979),(0.0,0.0,0.0), 1), (1004, (-61.230453, 1.2, -144.657440),(0.0,0.0,0.0), 1), (1004, (-71.636917, 1.2, -140.565033),(0.0,0.0,0.0), 1), (1004, (-73.323441, 1.2, -160.713318),(0.0,0.0,0.0), 1), (1004, (-53.436718, 1.2, -125.980476),(0.0,0.0,0.0), 1), (1004, (-64.340378, 1.2, -121.070831),(0.0,0.0,0.0), 1), ] }
lgpl-3.0
ianscrivener/microservices-infrastructure
plugins/callbacks/profile_tasks.py
41
2464
# The MIT License (MIT) # # Copyright (c) 2014 Jharrod LaFon # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import time class CallbackModule(object): """ A plugin for timing tasks """ def __init__(self): self.stats = {} self.current = None def playbook_on_task_start(self, name, is_conditional): """ Logs the start of each task """ if self.current is not None: # Record the running time of the last executed task self.stats[self.current] = time.time() - self.stats[self.current] # Record the start time of the current task self.current = name self.stats[self.current] = time.time() def playbook_on_stats(self, stats): """ Prints the timings """ # Record the timing of the very last task if self.current is not None: self.stats[self.current] = time.time() - self.stats[self.current] # Sort the tasks by their running time results = sorted( self.stats.items(), key=lambda value: value[1], reverse=True, ) # Just keep the top 10 results = results[:10] # Print the timings for name, elapsed in results: print( "{0:-<70}{1:->9}".format( '{0} '.format(name), ' {0:.02f}s'.format(elapsed), ) )
apache-2.0
TheoRettisch/p2pool-giarcoin
p2pool/util/memoize.py
281
1737
import itertools class LRUDict(object): def __init__(self, n): self.n = n self.inner = {} self.counter = itertools.count() def get(self, key, default=None): if key in self.inner: x, value = self.inner[key] self.inner[key] = self.counter.next(), value return value return default def __setitem__(self, key, value): self.inner[key] = self.counter.next(), value while len(self.inner) > self.n: self.inner.pop(min(self.inner, key=lambda k: self.inner[k][0])) _nothing = object() def memoize_with_backing(backing, has_inverses=set()): def a(f): def b(*args): res = backing.get((f, args), _nothing) if res is not _nothing: return res res = f(*args) backing[(f, args)] = res for inverse in has_inverses: backing[(inverse, args[:-1] + (res,))] = args[-1] return res return b return a def memoize(f): return memoize_with_backing({})(f) class cdict(dict): def __init__(self, func): dict.__init__(self) self._func = func def __missing__(self, key): value = self._func(key) self[key] = value return value def fast_memoize_single_arg(func): return cdict(func).__getitem__ class cdict2(dict): def __init__(self, func): dict.__init__(self) self._func = func def __missing__(self, key): value = self._func(*key) self[key] = value return value def fast_memoize_multiple_args(func): f = cdict2(func).__getitem__ return lambda *args: f(args)
gpl-3.0
JRepoInd/Repo_Indi
plugin.video.tvondesizonexl/xoze/snapvideo/Playwire.py
3
1736
''' Created on Nov 21, 2012 @author: ajju ''' from xoze.snapvideo import VideoHost, Video, STREAM_QUAL_HD_720 from xoze.utils import http import logging import re try: import json except ImportError: import simplejson as json VIDEO_HOSTING_NAME = 'PLAYWIRE' def getVideoHost(): video_host = VideoHost() video_host.set_icon('http://cdn.intergi.com/playwire/playwire-logo-subhed.png') video_host.set_name(VIDEO_HOSTING_NAME) return video_host def retrieveVideoInfo(video_id): video = Video() video.set_video_host(getVideoHost()) video.set_id(video_id) try: video_link = 'http://config.playwire.com/' + str(video_id) + '.json' html = http.HttpClient().get_html_content(url=video_link) jsonObj = json.loads(html) logging.getLogger().debug(jsonObj) img_link = str(jsonObj['poster']) video_link = str(jsonObj['src']) logging.debug('get video info: ' + video_link) video_info = re.compile('config.playwire.com/(.+?)/videos/v2/(.+?)/manifest.f4m').findall(video_link)[0] logging.getLogger().debug('video_serial_no ' + str(video_info)) video_link = 'http://cdn.phoenix.intergi.com/' + video_info[0] + '/videos/' + video_info[1] + '/video-sd.mp4?hosting_id=' + video_info[0] logging.getLogger().debug('video_link ' + str(video_link)) video.set_stopped(False) video.set_thumb_image(img_link) video.set_name("PLAYWIRE Video") if re.search(r'\Artmp', video_link): video.add_stream_link(STREAM_QUAL_HD_720, video_link) else: video.add_stream_link(STREAM_QUAL_HD_720, video_link) except: video.set_stopped(True) return video
gpl-2.0
metacloud/python-openstackclient
openstackclient/compute/v2/agent.py
2
4860
# Copyright 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # """Agent action implementations""" import logging import six from cliff import command from cliff import lister from cliff import show from openstackclient.common import utils class CreateAgent(show.ShowOne): """Create agent command""" log = logging.getLogger(__name__ + ".CreateAgent") def get_parser(self, prog_name): parser = super(CreateAgent, self).get_parser(prog_name) parser.add_argument( "os", metavar="<os>", help="Type of OS") parser.add_argument( "architecture", metavar="<architecture>", help="Type of architecture") parser.add_argument( "version", metavar="<version>", help="Version") parser.add_argument( "url", metavar="<url>", help="URL") parser.add_argument( "md5hash", metavar="<md5hash>", help="MD5 hash") parser.add_argument( "hypervisor", metavar="<hypervisor>", help="Type of hypervisor", default="xen") return parser def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) compute_client = self.app.client_manager.compute args = ( parsed_args.os, parsed_args.architecture, parsed_args.version, parsed_args.url, parsed_args.md5hash, parsed_args.hypervisor ) agent = compute_client.agents.create(*args)._info.copy() return zip(*sorted(six.iteritems(agent))) class DeleteAgent(command.Command): """Delete agent command""" log = logging.getLogger(__name__ + ".DeleteAgent") def get_parser(self, prog_name): parser = super(DeleteAgent, self).get_parser(prog_name) parser.add_argument( "id", metavar="<id>", help="ID of agent to delete") return parser def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) compute_client = self.app.client_manager.compute compute_client.agents.delete(parsed_args.id) return class ListAgent(lister.Lister): """List agent command""" log = logging.getLogger(__name__ + ".ListAgent") def get_parser(self, prog_name): parser = super(ListAgent, self).get_parser(prog_name) parser.add_argument( "--hypervisor", metavar="<hypervisor>", help="Type of hypervisor") return parser def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) compute_client = self.app.client_manager.compute columns = ( "Agent ID", "Hypervisor", "OS", "Architecture", "Version", "Md5Hash", "URL" ) data = compute_client.agents.list(parsed_args.hypervisor) return (columns, (utils.get_item_properties( s, columns, ) for s in data)) class SetAgent(show.ShowOne): """Set agent command""" log = logging.getLogger(__name__ + ".SetAgent") def get_parser(self, prog_name): parser = super(SetAgent, self).get_parser(prog_name) parser.add_argument( "id", metavar="<id>", help="ID of the agent") parser.add_argument( "version", metavar="<version>", help="Version of the agent") parser.add_argument( "url", metavar="<url>", help="URL") parser.add_argument( "md5hash", metavar="<md5hash>", help="MD5 hash") return parser def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) compute_client = self.app.client_manager.compute args = ( parsed_args.id, parsed_args.version, parsed_args.url, parsed_args.md5hash ) agent = compute_client.agents.update(*args)._info.copy() return zip(*sorted(six.iteritems(agent)))
apache-2.0
flynx/pli
pli/persistance/sql/shelve.py
1
2359
#======================================================================= __version__ = '''0.0.01''' __sub_version__ = '''20070108034250''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- import pli.pattern.mixin.mapping as mapping #-----------------------------------------------------------SQLShelve--- ##!!! # XXX should this be live??? class SQLShelve(mapping.Mapping): ''' ''' # TODO make this create a new dict for the id if one is not # present.... (might be a good idea to use some other id # method...) # one alternative id method is to create a root dict that will # contain names of all the dicts used and their coresponding # id's... def __init__(self, interface, name): ''' ''' self._interface = interface self._name = name # if such a name does not exist... try: self._data = interface.get(name) except KeyError: d = self._data = {} interface.write(name, d) ##!!! sanity check: if the name refereneces a non-dict or non-dict-like... ##!!! def __getitem__(self, name): ''' ''' if name in self._data: return self._interface.get(self._data[name]) raise KeyError, name ##!!! make this safe... def __setitem__(self, name, value): ''' ''' interface = self._interface data = self._data try: # insert the object... oid = interface.write(value) # update the keys dict... data[name] = oid interface.write(data) except: ## ##!!! rollback... ## interface.__sql_reader__.sql.connection.rollback() raise 'oops!' # commit... # XXX make this prittier! interface.__sql_reader__.sql.connection.commit() ##!!! REWRITE: might be a tad cleaner... def __delitem__(self, name): ''' ''' ## return self._interface.delete(self._data.pop(name)) interface = self._interface data = self._data try: data.pop(name) interface.write(data) except: ## ##!!! rollback... ## interface.__sql_reader__.sql.connection.rollback() raise 'oops!' # commit... # XXX make this prittier! interface.__sql_reader__.sql.connection.commit() def __iter__(self): ''' ''' for name in self._data.keys(): yield name #======================================================================= # vim:set ts=4 sw=4 nowrap :
bsd-3-clause
crmccreary/openerp_server
openerp/addons/caldav/wizard/calendar_event_export.py
9
2386
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from osv import fields, osv from tools.translate import _ import netsvc import pooler import time import tools import wizard import base64 class calendar_event_export(osv.osv_memory): """ Export Calendar Event. """ def default_get(self, cr, uid, fields, context=None): """ Get Default value for Name field. """ if context is None: context = {} else: context= context.copy() context['uid'] = uid model = context.get('model', 'basic.calendar') model_obj = self.pool.get(model) res = super(calendar_event_export, self).default_get( cr, uid, fields, context=context) name = 'OpenERP %s.ics' % (model_obj._description) if 'name' in fields: res.update({'name': name}) if 'file_path' in fields: calendar = model_obj.export_cal(cr, uid, context['active_ids'], context=context) res.update({'file_path': base64.encodestring(calendar)}) return res _name = "calendar.event.export" _description = "Event Export" _columns = { 'file_path':fields.binary('Save ICS file', filters='*.ics', readonly=True), 'name':fields.char('File name', size=34, required=True, help='Save in .ics format') } calendar_event_export() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
wraiden/spacewalk
backend/server/test/unit-test/test_rhnLib_timestamp.py
8
2404
#!/usr/bin/python # # Copyright (c) 2008--2016 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 # along with this software; if not, see # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. # # Red Hat trademarks are not licensed under GPLv2. No permission is # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. # # # # import sys import time import unittest from spacewalk.common import rhnLib class Tests(unittest.TestCase): def _test_timestamp_1(self): # Start with some timestamp, and verify that # timestamp(strftime(t)) is # t t = 85345 increment = 123456 while t < time.time() + increment: is_eq, t1, tstr, t2 = self._test(t) #self.assertEqual(t, t2, "%s %s %s %s" % (t, t2, ttuple, tstr)) if not is_eq: print("%s %s %s" % (t1, t2, tstr)) t = t + increment def _str(self, t): tformat = "%Y-%m-%d %H:%M:%S" ttuple = time.localtime(t) return time.strftime(tformat, ttuple) def _test(self, t, dstshift=0): t = int(t) tstr = self._str(t) t2 = int(rhnLib.timestamp(tstr)) return (t + dstshift == t2), t, tstr, t2 def _test_timestamp_2(self): y = 1969 while y < 2015: y = y + 1 # Guess that year's time switch tlist = [y, 10, 31, 1, 41, 37, 0, 0, -1] t = time.mktime(tlist) tlist = list(time.localtime(t)) # Last Sat of October tlist[2] = tlist[2] - (1 + tlist[6]) % 7 t = int(time.mktime(tlist)) is_eq, t1, tstr, t2 = self._test(t) if not is_eq: print("%s %s %s" % (t, t2, tstr)) def test_timestamp_3(self): t = 57739297 dstshift = (time.localtime(t)[8] - time.daylight) * 3600 is_eq, t1, tstr, t2 = self._test(t, dstshift) self.failUnless(is_eq, "Failed: %s, %s" % (t1, t2)) def _test_timestamp_4(self): return self.test_timestamp_3() if __name__ == '__main__': sys.exit(unittest.main() or 0)
gpl-2.0
anryko/ansible
lib/ansible/modules/storage/hpe3par/ss_3par_cpg.py
35
9416
#!/usr/bin/python # Copyright: (c) 2018, Hewlett Packard Enterprise Development LP # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- short_description: Manage HPE StoreServ 3PAR CPG author: - Farhan Nomani (@farhan7500) - Gautham P Hegde (@gautamphegde) description: - Create and delete CPG on HPE 3PAR. module: ss_3par_cpg options: cpg_name: description: - Name of the CPG. type: str required: true disk_type: choices: - FC - NL - SSD description: - Specifies that physical disks must have the specified device type. type: str domain: description: - Specifies the name of the domain in which the object will reside. type: str growth_increment: description: - Specifies the growth increment(in MiB, GiB or TiB) the amount of logical disk storage created on each auto-grow operation. type: str growth_limit: description: - Specifies that the autogrow operation is limited to the specified storage amount that sets the growth limit(in MiB, GiB or TiB). type: str growth_warning: description: - Specifies that the threshold(in MiB, GiB or TiB) of used logical disk space when exceeded results in a warning alert. type: str high_availability: choices: - PORT - CAGE - MAG description: - Specifies that the layout must support the failure of one port pair, one cage, or one magazine. type: str raid_type: choices: - R0 - R1 - R5 - R6 description: - Specifies the RAID type for the logical disk. type: str set_size: description: - Specifies the set size in the number of chunklets. type: int state: choices: - present - absent description: - Whether the specified CPG should exist or not. required: true type: str secure: description: - Specifies whether the certificate needs to be validated while communicating. type: bool default: no extends_documentation_fragment: hpe3par version_added: '2.8' ''' EXAMPLES = r''' - name: Create CPG sample_cpg ss_3par_cpg: storage_system_ip: 10.10.10.1 storage_system_username: username storage_system_password: password state: present cpg_name: sample_cpg domain: sample_domain growth_increment: 32000 MiB growth_limit: 64000 MiB growth_warning: 48000 MiB raid_type: R6 set_size: 8 high_availability: MAG disk_type: FC secure: no - name: Delete CPG sample_cpg ss_3par_cpg: storage_system_ip: 10.10.10.1 storage_system_username: username storage_system_password: password state: absent cpg_name: sample_cpg secure: no ''' RETURN = r''' ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.storage.hpe3par import hpe3par try: from hpe3par_sdk import client from hpe3parclient import exceptions HAS_3PARCLIENT = True except ImportError: HAS_3PARCLIENT = False def validate_set_size(raid_type, set_size): if raid_type: set_size_array = client.HPE3ParClient.RAID_MAP[raid_type]['set_sizes'] if set_size in set_size_array: return True return False def cpg_ldlayout_map(ldlayout_dict): if ldlayout_dict['RAIDType'] is not None and ldlayout_dict['RAIDType']: ldlayout_dict['RAIDType'] = client.HPE3ParClient.RAID_MAP[ ldlayout_dict['RAIDType']]['raid_value'] if ldlayout_dict['HA'] is not None and ldlayout_dict['HA']: ldlayout_dict['HA'] = getattr( client.HPE3ParClient, ldlayout_dict['HA']) return ldlayout_dict def create_cpg( client_obj, cpg_name, domain, growth_increment, growth_limit, growth_warning, raid_type, set_size, high_availability, disk_type): try: if not validate_set_size(raid_type, set_size): return (False, False, "Set size %s not part of RAID set %s" % (set_size, raid_type)) if not client_obj.cpgExists(cpg_name): disk_patterns = [] if disk_type: disk_type = getattr(client.HPE3ParClient, disk_type) disk_patterns = [{'diskType': disk_type}] ld_layout = { 'RAIDType': raid_type, 'setSize': set_size, 'HA': high_availability, 'diskPatterns': disk_patterns} ld_layout = cpg_ldlayout_map(ld_layout) if growth_increment is not None: growth_increment = hpe3par.convert_to_binary_multiple( growth_increment) if growth_limit is not None: growth_limit = hpe3par.convert_to_binary_multiple( growth_limit) if growth_warning is not None: growth_warning = hpe3par.convert_to_binary_multiple( growth_warning) optional = { 'domain': domain, 'growthIncrementMiB': growth_increment, 'growthLimitMiB': growth_limit, 'usedLDWarningAlertMiB': growth_warning, 'LDLayout': ld_layout} client_obj.createCPG(cpg_name, optional) else: return (True, False, "CPG already present") except exceptions.ClientException as e: return (False, False, "CPG creation failed | %s" % (e)) return (True, True, "Created CPG %s successfully." % cpg_name) def delete_cpg( client_obj, cpg_name): try: if client_obj.cpgExists(cpg_name): client_obj.deleteCPG(cpg_name) else: return (True, False, "CPG does not exist") except exceptions.ClientException as e: return (False, False, "CPG delete failed | %s" % e) return (True, True, "Deleted CPG %s successfully." % cpg_name) def main(): module = AnsibleModule(argument_spec=hpe3par.cpg_argument_spec(), required_together=[['raid_type', 'set_size']]) if not HAS_3PARCLIENT: module.fail_json(msg='the python hpe3par_sdk library is required (https://pypi.org/project/hpe3par_sdk)') if len(module.params["cpg_name"]) < 1 or len(module.params["cpg_name"]) > 31: module.fail_json(msg="CPG name must be at least 1 character and not more than 31 characters") storage_system_ip = module.params["storage_system_ip"] storage_system_username = module.params["storage_system_username"] storage_system_password = module.params["storage_system_password"] cpg_name = module.params["cpg_name"] domain = module.params["domain"] growth_increment = module.params["growth_increment"] growth_limit = module.params["growth_limit"] growth_warning = module.params["growth_warning"] raid_type = module.params["raid_type"] set_size = module.params["set_size"] high_availability = module.params["high_availability"] disk_type = module.params["disk_type"] secure = module.params["secure"] wsapi_url = 'https://%s:8080/api/v1' % storage_system_ip try: client_obj = client.HPE3ParClient(wsapi_url, secure) except exceptions.SSLCertFailed: module.fail_json(msg="SSL Certificate Failed") except exceptions.ConnectionError: module.fail_json(msg="Connection Error") except exceptions.UnsupportedVersion: module.fail_json(msg="Unsupported WSAPI version") except Exception as e: module.fail_json(msg="Initializing client failed. %s" % e) if storage_system_username is None or storage_system_password is None: module.fail_json(msg="Storage system username or password is None") if cpg_name is None: module.fail_json(msg="CPG Name is None") # States if module.params["state"] == "present": try: client_obj.login(storage_system_username, storage_system_password) return_status, changed, msg = create_cpg( client_obj, cpg_name, domain, growth_increment, growth_limit, growth_warning, raid_type, set_size, high_availability, disk_type ) except Exception as e: module.fail_json(msg="CPG create failed | %s" % e) finally: client_obj.logout() elif module.params["state"] == "absent": try: client_obj.login(storage_system_username, storage_system_password) return_status, changed, msg = delete_cpg( client_obj, cpg_name ) except Exception as e: module.fail_json(msg="CPG create failed | %s" % e) finally: client_obj.logout() if return_status: module.exit_json(changed=changed, msg=msg) else: module.fail_json(msg=msg) if __name__ == '__main__': main()
gpl-3.0
TheMOOCAgency/edx-platform
common/djangoapps/student/management/commands/create_random_users.py
20
1874
""" A script to create some dummy users """ import uuid from django.core.management.base import BaseCommand from student.models import CourseEnrollment from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey from student.forms import AccountCreationForm from student.views import _do_create_account def make_random_form(): """ Generate unique user data for dummy users. """ identification = uuid.uuid4().hex[:8] return AccountCreationForm( data={ 'username': 'user_{id}'.format(id=identification), 'email': 'email_{id}@example.com'.format(id=identification), 'password': '12345', 'name': 'User {id}'.format(id=identification), }, tos_required=False ) def create(num, course_key): """Create num users, enrolling them in course_key if it's not None""" for __ in range(num): (user, _, _) = _do_create_account(make_random_form()) if course_key is not None: CourseEnrollment.enroll(user, course_key) class Command(BaseCommand): help = """Create N new users, with random parameters. Usage: create_random_users.py N [course_id_to_enroll_in]. Examples: create_random_users.py 1 create_random_users.py 10 MITx/6.002x/2012_Fall create_random_users.py 100 HarvardX/CS50x/2012 """ def handle(self, *args, **options): if len(args) < 1 or len(args) > 2: print Command.help return num = int(args[0]) if len(args) == 2: try: course_key = CourseKey.from_string(args[1]) except InvalidKeyError: course_key = SlashSeparatedCourseKey.from_deprecated_string(args[1]) else: course_key = None create(num, course_key)
agpl-3.0
diox/olympia
src/olympia/devhub/views.py
2
70834
import datetime import os import time from uuid import UUID, uuid4 from django import forms as django_forms, http from django.conf import settings from django.core.exceptions import PermissionDenied from django.core.files.storage import default_storage as storage from django.db import transaction from django.db.models import Count from django.http import JsonResponse from django.shortcuts import get_object_or_404, redirect from django.template import loader from django.urls import reverse from django.utils.translation import gettext, gettext_lazy as _ from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt import waffle from csp.decorators import csp_update from django_statsd.clients import statsd import olympia.core.logger from olympia import amo, core from olympia.access import acl from olympia.accounts.utils import redirect_for_login, _is_safe_url from olympia.accounts.views import API_TOKEN_COOKIE, logout_user from olympia.activity.models import ActivityLog, VersionLog from olympia.activity.utils import log_and_notify from olympia.addons.models import ( Addon, AddonReviewerFlags, AddonUser, AddonUserPendingConfirmation, ) from olympia.addons.views import BaseFilter from olympia.addons.utils import RestrictionChecker from olympia.amo import messages, utils as amo_utils from olympia.amo.decorators import json_view, login_required, post_required from olympia.amo.templatetags.jinja_helpers import absolutify, urlparams from olympia.amo.reverse import get_url_prefix from olympia.amo.utils import MenuItem, escape_all, render, send_mail from olympia.api.models import APIKey, APIKeyConfirmation from olympia.devhub.decorators import dev_required, no_admin_disabled from olympia.devhub.models import BlogPost, RssKey from olympia.devhub.utils import ( add_dynamic_theme_tag, extract_theme_properties, wizard_unsupported_properties, ) from olympia.files.models import File, FileUpload from olympia.files.utils import parse_addon from olympia.reviewers.forms import PublicWhiteboardForm from olympia.reviewers.models import Whiteboard from olympia.reviewers.templatetags.code_manager import code_manager_url from olympia.reviewers.templatetags.jinja_helpers import get_position from olympia.reviewers.utils import ReviewHelper from olympia.users.models import DeveloperAgreementRestriction from olympia.versions.models import Version from olympia.versions.utils import get_next_version_number from olympia.zadmin.models import get_config from . import feeds, forms, signals, tasks log = olympia.core.logger.getLogger('z.devhub') # We use a session cookie to make sure people see the dev agreement. MDN_BASE = 'https://developer.mozilla.org/en-US/Add-ons' def get_fileupload_by_uuid_or_404(value): try: UUID(value) except ValueError: raise http.Http404() return get_object_or_404(FileUpload, uuid=value) class AddonFilter(BaseFilter): opts = ( ('updated', _('Updated')), ('name', _('Name')), ('created', _('Created')), ('popular', _('Downloads')), ('rating', _('Rating')), ) class ThemeFilter(BaseFilter): opts = ( ('created', _('Created')), ('name', _('Name')), ('popular', _('Downloads')), ('rating', _('Rating')), ) def addon_listing(request, theme=False): """Set up the queryset and filtering for addon listing for Dashboard.""" if theme: qs = request.user.addons.filter(type=amo.ADDON_STATICTHEME) filter_cls = ThemeFilter default = 'created' else: qs = request.user.addons.exclude(type=amo.ADDON_STATICTHEME) filter_cls = AddonFilter default = 'updated' filter_ = filter_cls(request, qs, 'sort', default) return filter_.qs, filter_ @csp_update( CONNECT_SRC=settings.MOZILLA_NEWLETTER_URL, FORM_ACTION=settings.MOZILLA_NEWLETTER_URL, ) def index(request): ctx = {} if request.user.is_authenticated: recent_addons = request.user.addons.all().order_by('-modified')[:3] ctx['recent_addons'] = [] for addon in recent_addons: ctx['recent_addons'].append( {'addon': addon, 'position': get_position(addon)} ) return render(request, 'devhub/index.html', ctx) @login_required def dashboard(request, theme=False): addon_items = _get_items(None, request.user.addons.all())[:4] data = dict( rss=_get_rss_feed(request), blog_posts=_get_posts(), timestamp=int(time.time()), addon_tab=not theme, theme=theme, addon_items=addon_items, ) if data['addon_tab']: addons, data['filter'] = addon_listing(request) data['addons'] = amo_utils.paginate(request, addons, per_page=10) if theme: themes, data['filter'] = addon_listing(request, theme=True) data['themes'] = amo_utils.paginate(request, themes, per_page=10) if 'filter' in data: data['sorting'] = data['filter'].field data['sort_opts'] = data['filter'].opts return render(request, 'devhub/addons/dashboard.html', data) @dev_required def ajax_compat_status(request, addon_id, addon): if not (addon.accepts_compatible_apps() and addon.current_version): raise http.Http404() return render(request, 'devhub/addons/ajax_compat_status.html', dict(addon=addon)) @dev_required def ajax_compat_error(request, addon_id, addon): if not (addon.accepts_compatible_apps() and addon.current_version): raise http.Http404() return render(request, 'devhub/addons/ajax_compat_error.html', dict(addon=addon)) @dev_required def ajax_compat_update(request, addon_id, addon, version_id): if not addon.accepts_compatible_apps(): raise http.Http404() version = get_object_or_404(addon.versions.all(), pk=version_id) compat_form = forms.CompatFormSet( request.POST or None, queryset=version.apps.all().select_related('min', 'max'), form_kwargs={'version': version}, ) if request.method == 'POST' and compat_form.is_valid(): for compat in compat_form.save(commit=False): compat.version = version compat.save() for compat in compat_form.deleted_objects: compat.delete() for form in compat_form.forms: if isinstance(form, forms.CompatForm) and 'max' in form.changed_data: _log_max_version_change(addon, version, form.instance) return render( request, 'devhub/addons/ajax_compat_update.html', dict(addon=addon, version=version, compat_form=compat_form), ) def _get_addons(request, addons, addon_id, action): """Create a list of ``MenuItem``s for the activity feed.""" items = [] a = MenuItem() a.selected = not addon_id (a.text, a.url) = (gettext('All My Add-ons'), reverse('devhub.feed_all')) if action: a.url += '?action=' + action items.append(a) for addon in addons: item = MenuItem() try: item.selected = addon_id and addon.id == int(addon_id) except ValueError: pass # We won't get here... EVER url = reverse('devhub.feed', args=[addon.slug]) if action: url += '?action=' + action item.text, item.url = addon.name, url items.append(item) return items def _get_posts(limit=5): return BlogPost.objects.order_by('-date_posted')[0:limit] def _get_activities(request, action): url = request.get_full_path() choices = (None, 'updates', 'status', 'collections', 'reviews') text = { None: gettext('All Activity'), 'updates': gettext('Add-on Updates'), 'status': gettext('Add-on Status'), 'collections': gettext('User Collections'), 'reviews': gettext('User Reviews'), } items = [] for c in choices: i = MenuItem() i.text = text[c] i.url, i.selected = urlparams(url, page=None, action=c), (action == c) items.append(i) return items def _get_items(action, addons): if not isinstance(addons, (list, tuple)): # MySQL 8.0.21 (and maybe higher) doesn't optimize the join with # double # subquery the ActivityLog.objects.for_addons(addons) below # would generate if addons is not transformed into a list first. Since # some people have a lot of add-ons, we only take the last 100. addons = list( addons.all().order_by('-modified').values_list('pk', flat=True)[:100] ) filters = { 'updates': (amo.LOG.ADD_VERSION, amo.LOG.ADD_FILE_TO_VERSION), 'status': ( amo.LOG.USER_DISABLE, amo.LOG.USER_ENABLE, amo.LOG.CHANGE_STATUS, amo.LOG.APPROVE_VERSION, ), 'collections': ( amo.LOG.ADD_TO_COLLECTION, amo.LOG.REMOVE_FROM_COLLECTION, ), 'reviews': (amo.LOG.ADD_RATING,), } filter_ = filters.get(action) items = ActivityLog.objects.for_addons(addons).exclude( action__in=amo.LOG_HIDE_DEVELOPER ) if filter_: items = items.filter(action__in=[i.id for i in filter_]) return items def _get_rss_feed(request): key, _ = RssKey.objects.get_or_create(user=request.user) return urlparams(reverse('devhub.feed_all'), privaterss=key.key.hex) def feed(request, addon_id=None): if request.GET.get('privaterss'): return feeds.ActivityFeedRSS()(request) addon_selected = None if not request.user.is_authenticated: return redirect_for_login(request) else: addons_all = request.user.addons.all() if addon_id: addon = get_object_or_404(Addon.objects.id_or_slug(addon_id)) try: key = RssKey.objects.get(addon=addon) except RssKey.DoesNotExist: key = RssKey.objects.create(addon=addon) addon_selected = addon.id rssurl = urlparams( reverse('devhub.feed', args=[addon_id]), privaterss=key.key.hex ) if not acl.check_addon_ownership( request, addon, dev=True, ignore_disabled=True ): raise PermissionDenied addons = [addon] else: rssurl = _get_rss_feed(request) addon = None addons = addons_all action = request.GET.get('action') items = _get_items(action, addons) activities = _get_activities(request, action) addon_items = _get_addons(request, addons_all, addon_selected, action) pager = amo_utils.paginate(request, items, 20) data = dict( addons=addon_items, pager=pager, activities=activities, rss=rssurl, addon=addon ) return render(request, 'devhub/addons/activity.html', data) @dev_required def edit(request, addon_id, addon): try: whiteboard = Whiteboard.objects.get(pk=addon.pk) except Whiteboard.DoesNotExist: whiteboard = Whiteboard(pk=addon.pk) previews = ( addon.current_version.previews.all() if addon.current_version and addon.has_per_version_previews else addon.previews.all() ) header_preview = previews.first() if addon.type == amo.ADDON_STATICTHEME else None data = { 'page': 'edit', 'addon': addon, 'whiteboard': whiteboard, 'editable': False, 'show_listed_fields': addon.has_listed_versions(), 'valid_slug': addon.slug, 'tags': addon.tags.not_denied().values_list('tag_text', flat=True), 'previews': previews, 'header_preview': header_preview, 'supported_image_types': amo.SUPPORTED_IMAGE_TYPES, } return render(request, 'devhub/addons/edit.html', data) @dev_required(owner_for_post=True) @post_required def delete(request, addon_id, addon): # Database deletes only allowed for free or incomplete addons. if not addon.can_be_deleted(): msg = gettext('Add-on cannot be deleted. Disable this add-on instead.') messages.error(request, msg) return redirect(addon.get_dev_url('versions')) any_theme = addon.type == amo.ADDON_STATICTHEME form = forms.DeleteForm(request.POST, addon=addon) if form.is_valid(): reason = form.cleaned_data.get('reason', '') addon.delete(msg='Removed via devhub', reason=reason) messages.success( request, gettext('Theme deleted.') if any_theme else gettext('Add-on deleted.'), ) return redirect('devhub.%s' % ('themes' if any_theme else 'addons')) else: messages.error( request, gettext('URL name was incorrect. Theme was not deleted.') if any_theme else gettext('URL name was incorrect. Add-on was not deleted.'), ) return redirect(addon.get_dev_url('versions')) @dev_required @post_required def enable(request, addon_id, addon): addon.update(disabled_by_user=False) ActivityLog.create(amo.LOG.USER_ENABLE, addon) return redirect(addon.get_dev_url('versions')) @dev_required(owner_for_post=True) @post_required def cancel(request, addon_id, addon): if addon.status == amo.STATUS_NOMINATED: addon.update(status=amo.STATUS_NULL) ActivityLog.create(amo.LOG.CHANGE_STATUS, addon, addon.status) latest_version = addon.find_latest_version(channel=amo.RELEASE_CHANNEL_LISTED) if latest_version: for file_ in latest_version.files.filter(status=amo.STATUS_AWAITING_REVIEW): file_.update(status=amo.STATUS_DISABLED) return redirect(addon.get_dev_url('versions')) @dev_required @post_required def disable(request, addon_id, addon): # Also set the latest listed version to STATUS_DISABLED if it was # AWAITING_REVIEW, to not waste reviewers time. latest_version = addon.find_latest_version(channel=amo.RELEASE_CHANNEL_LISTED) if latest_version: latest_version.files.filter(status=amo.STATUS_AWAITING_REVIEW).update( status=amo.STATUS_DISABLED ) addon.update_version() addon.update_status() addon.update(disabled_by_user=True) ActivityLog.create(amo.LOG.USER_DISABLE, addon) return redirect(addon.get_dev_url('versions')) # Can't use @dev_required, as the user is not a developer yet. Can't use # @addon_view_factory either, because it requires a developer for unlisted # add-ons. So we just @login_required and retrieve the addon ourselves in the # function. @login_required def invitation(request, addon_id): addon = get_object_or_404(Addon.objects.id_or_slug(addon_id)) try: invitation = AddonUserPendingConfirmation.objects.get( addon=addon, user=request.user ) except AddonUserPendingConfirmation.DoesNotExist: # To be nice in case the user accidentally visited this page after # having accepted an invite, redirect to the add-on base edit page. # If they are an author, they will have access, otherwise will get the # appropriate error. return redirect(addon.get_dev_url()) if request.method == 'POST': value = request.POST.get('accept') if value == 'yes': # There is a potential race condition on the position, but it's # difficult to find a sensible value anyway. Should a position # conflict happen, owners can easily fix it themselves. last_position = ( AddonUser.objects.filter(addon=invitation.addon) .order_by('position') .values_list('position', flat=True) .last() or 0 ) AddonUser.unfiltered.update_or_create( addon=invitation.addon, user=invitation.user, defaults={ 'role': invitation.role, 'listed': invitation.listed, 'position': last_position + 1, }, ) messages.success(request, gettext('Invitation accepted.')) redirect_url = addon.get_dev_url() else: messages.success(request, gettext('Invitation declined.')) redirect_url = reverse('devhub.addons') # Regardless of whether or not the invitation was accepted or not, # it's now obsolete. invitation.delete() return redirect(redirect_url) ctx = { 'addon': addon, 'invitation': invitation, } return render(request, 'devhub/addons/invitation.html', ctx) @dev_required(owner_for_post=True) def ownership(request, addon_id, addon): fs = [] ctx = {'addon': addon} post_data = request.POST if request.method == 'POST' else None # Authors. user_form = forms.AuthorFormSet( post_data, prefix='user_form', queryset=AddonUser.objects.filter(addon=addon).order_by('position'), form_kwargs={'addon': addon}, ) fs.append(user_form) ctx['user_form'] = user_form # Authors pending confirmation (owner can still remove them before they # accept). authors_pending_confirmation_form = forms.AuthorWaitingConfirmationFormSet( post_data, prefix='authors_pending_confirmation', queryset=AddonUserPendingConfirmation.objects.filter(addon=addon).order_by( 'id' ), form_kwargs={'addon': addon}, ) fs.append(authors_pending_confirmation_form) ctx['authors_pending_confirmation_form'] = authors_pending_confirmation_form # Versions. license_form = forms.LicenseForm(post_data, version=addon.current_version) ctx.update(license_form.get_context()) if ctx['license_form']: # if addon has a version fs.append(ctx['license_form']) # Policy. if addon.type != amo.ADDON_STATICTHEME: policy_form = forms.PolicyForm(post_data, addon=addon) ctx['policy_form'] = policy_form fs.append(policy_form) else: policy_form = None def mail_user_changes(author, title, template_part, recipients, extra_context=None): from olympia.amo.utils import send_mail context_data = { 'author': author, 'addon': addon, 'DOMAIN': settings.DOMAIN, } if extra_context: context_data.update(extra_context) template = loader.get_template( 'users/emails/{part}.ltxt'.format(part=template_part) ) send_mail( title, template.render(context_data), None, recipients, use_deny_list=False ) def process_author_changes(source_form, existing_authors_emails): addon_users_to_process = source_form.save(commit=False) for addon_user in addon_users_to_process: action = None addon_user.addon = addon if not addon_user.pk: action = amo.LOG.ADD_USER_WITH_ROLE mail_user_changes( author=addon_user, title=gettext('An author has been added to your add-on'), template_part='author_added', recipients=existing_authors_emails, ) mail_user_changes( author=addon_user, title=gettext('Author invitation for {addon_name}').format( addon_name=str(addon.name) ), template_part='author_added_confirmation', recipients=[addon_user.user.email], extra_context={ 'author_confirmation_link': absolutify( reverse('devhub.addons.invitation', args=(addon.slug,)) ) }, ) messages.success( request, gettext('A confirmation email has been sent to {email}').format( email=addon_user.user.email ), ) elif addon_user.role != addon_user._original_role: action = amo.LOG.CHANGE_USER_WITH_ROLE title = gettext('An author role has been changed on your add-on') recipients = list( set(existing_authors_emails + [addon_user.user.email]) ) mail_user_changes( author=addon_user, title=title, template_part='author_changed', recipients=recipients, ) addon_user.save() if action: ActivityLog.create( action, addon_user.user, str(addon_user.get_role_display()), addon ) for addon_user in source_form.deleted_objects: recipients = list(set(existing_authors_emails + [addon_user.user.email])) ActivityLog.create( amo.LOG.REMOVE_USER_WITH_ROLE, addon_user.user, str(addon_user.get_role_display()), addon, ) mail_user_changes( author=addon_user, title=gettext('An author has been removed from your add-on'), template_part='author_removed', recipients=recipients, ) addon_user.delete() if request.method == 'POST' and all([form.is_valid() for form in fs]): if license_form in fs: license_form.save() if policy_form and policy_form in fs: policy_form.save() messages.success(request, gettext('Changes successfully saved.')) existing_authors_emails = list(addon.authors.values_list('email', flat=True)) process_author_changes( authors_pending_confirmation_form, existing_authors_emails ) process_author_changes(user_form, existing_authors_emails) return redirect(addon.get_dev_url('owner')) return render(request, 'devhub/addons/owner.html', ctx) @login_required def validate_addon(request): return render( request, 'devhub/validate_addon.html', { 'title': gettext('Validate Add-on'), 'new_addon_form': forms.DistributionChoiceForm(), }, ) def handle_upload( filedata, request, channel, addon=None, is_standalone=False, submit=False, source=amo.UPLOAD_SOURCE_DEVHUB, ): automated_signing = channel == amo.RELEASE_CHANNEL_UNLISTED user = request.user if request.user.is_authenticated else None max_ip_length = FileUpload._meta.get_field('ip_address').max_length upload = FileUpload.from_post( filedata, filedata.name, filedata.size, addon=addon, automated_signing=automated_signing, ip_address=(core.get_remote_addr() or '')[:max_ip_length], source=source, user=user, ) # The following log statement is used by foxsec-pipeline. log.info('FileUpload created: %s' % upload.uuid.hex) if submit: tasks.validate_and_submit(addon, upload, channel=channel) else: tasks.validate(upload, listed=(channel == amo.RELEASE_CHANNEL_LISTED)) return upload @login_required @post_required def upload(request, channel='listed', addon=None, is_standalone=False): channel = amo.CHANNEL_CHOICES_LOOKUP[channel] filedata = request.FILES['upload'] upload = handle_upload( filedata=filedata, request=request, addon=addon, is_standalone=is_standalone, channel=channel, ) if addon: return redirect('devhub.upload_detail_for_version', addon.slug, upload.uuid.hex) elif is_standalone: return redirect('devhub.standalone_upload_detail', upload.uuid.hex) else: return redirect('devhub.upload_detail', upload.uuid.hex, 'json') @post_required @dev_required def upload_for_version(request, addon_id, addon, channel): return upload(request, channel=channel, addon=addon) @login_required @json_view def standalone_upload_detail(request, uuid): upload = get_fileupload_by_uuid_or_404(uuid) url = reverse('devhub.standalone_upload_detail', args=[uuid]) return upload_validation_context(request, upload, url=url) @dev_required(submitting=True) @json_view def upload_detail_for_version(request, addon_id, addon, uuid): try: upload = get_fileupload_by_uuid_or_404(uuid) response = json_upload_detail(request, upload, addon_slug=addon.slug) statsd.incr('devhub.upload_detail_for_addon.success') return response except Exception as exc: statsd.incr('devhub.upload_detail_for_addon.error') log.error('Error checking upload status: {} {}'.format(type(exc), exc)) raise @dev_required(allow_reviewers_for_read=True) def file_validation(request, addon_id, addon, file_id): file_ = get_object_or_404(File, version__addon=addon, id=file_id) validate_url = reverse('devhub.json_file_validation', args=[addon.slug, file_.id]) file_url = code_manager_url( 'browse', addon_id=addon.pk, version_id=file_.version.pk ) context = { 'validate_url': validate_url, 'file_url': file_url, 'file': file_, 'filename': file_.filename, 'timestamp': file_.created, 'addon': addon, 'automated_signing': file_.automated_signing, } if file_.has_been_validated: context['validation_data'] = file_.validation.processed_validation return render(request, 'devhub/validation.html', context) @csrf_exempt # This allows read-only access to deleted add-ons for reviewers # but not developers. @dev_required(allow_reviewers_for_read=True, qs=Addon.unfiltered.all) def json_file_validation(request, addon_id, addon, file_id): file = get_object_or_404(File, version__addon=addon, id=file_id) try: result = file.validation except File.validation.RelatedObjectDoesNotExist: raise http.Http404 return JsonResponse( { 'validation': result.processed_validation, 'error': None, } ) @json_view def json_upload_detail(request, upload, addon_slug=None): addon = None if addon_slug: addon = get_object_or_404(Addon.objects, slug=addon_slug) result = upload_validation_context(request, upload, addon=addon) if result['validation']: try: pkg = parse_addon(upload, addon=addon, user=request.user) except django_forms.ValidationError as exc: # Don't add custom validation errors if we already # failed validation (This can happen because validation does # call `parse_addon` too.) if result['validation'].get('errors', 0): return result # This doesn't guard against client-side tinkering, and is purely # to display those non-linter errors nicely in the frontend. What # does prevent clients from bypassing those is the fact that we # always call parse_addon() before calling from_upload(), so # ValidationError would be raised before proceeding. for i, msg in enumerate(exc.messages): # Simulate a validation error so the UI displays # it as such result['validation']['messages'].insert( i, { 'type': 'error', 'message': escape_all(msg), 'tier': 1, 'fatal': True, }, ) if result['validation']['ending_tier'] < 1: result['validation']['ending_tier'] = 1 result['validation']['errors'] += 1 return json_view.error(result) else: result['addon_type'] = pkg.get('type', '') return result def upload_validation_context(request, upload, addon=None, url=None): if not url: if addon: url = reverse( 'devhub.upload_detail_for_version', args=[addon.slug, upload.uuid.hex] ) else: url = reverse('devhub.upload_detail', args=[upload.uuid.hex, 'json']) full_report_url = reverse('devhub.upload_detail', args=[upload.uuid.hex]) validation = upload.processed_validation or '' return { 'upload': upload.uuid.hex, 'validation': validation, 'error': None, 'url': url, 'full_report_url': full_report_url, } def upload_detail(request, uuid, format='html'): upload = get_fileupload_by_uuid_or_404(uuid) if upload.user_id and not request.user.is_authenticated: return redirect_for_login(request) if format == 'json' or request.is_ajax(): try: response = json_upload_detail(request, upload) statsd.incr('devhub.upload_detail.success') return response except Exception as exc: statsd.incr('devhub.upload_detail.error') log.error('Error checking upload status: {} {}'.format(type(exc), exc)) raise validate_url = reverse('devhub.standalone_upload_detail', args=[upload.uuid.hex]) context = { 'validate_url': validate_url, 'filename': upload.pretty_name, 'automated_signing': upload.automated_signing, 'timestamp': upload.created, } if upload.validation: context['validation_data'] = upload.processed_validation return render(request, 'devhub/validation.html', context) @dev_required def addons_section(request, addon_id, addon, section, editable=False): show_listed = addon.has_listed_versions() static_theme = addon.type == amo.ADDON_STATICTHEME models = {} content_waffle = waffle.switch_is_active('content-optimization') if show_listed: models.update( { 'describe': ( forms.DescribeForm if not content_waffle else forms.DescribeFormContentOptimization ), 'additional_details': forms.AdditionalDetailsForm, 'technical': forms.AddonFormTechnical, } ) if not static_theme: models.update({'media': forms.AddonFormMedia}) else: models.update( { 'describe': ( forms.DescribeFormUnlisted if not content_waffle else forms.DescribeFormUnlistedContentOptimization ), 'additional_details': forms.AdditionalDetailsFormUnlisted, 'technical': forms.AddonFormTechnicalUnlisted, } ) if section not in models: raise http.Http404() tags, previews, restricted_tags = [], [], [] cat_form = dependency_form = whiteboard_form = None whiteboard = None if section == 'describe' and show_listed: category_form_class = ( forms.SingleCategoryForm if static_theme else forms.CategoryFormSet ) cat_form = category_form_class( request.POST or None, addon=addon, request=request ) elif section == 'additional_details' and show_listed: tags = addon.tags.not_denied().values_list('tag_text', flat=True) restricted_tags = addon.tags.filter(restricted=True) elif section == 'media': previews = forms.PreviewFormSet( request.POST or None, prefix='files', queryset=addon.previews.all() ) if section == 'technical': try: whiteboard = Whiteboard.objects.get(pk=addon.pk) except Whiteboard.DoesNotExist: whiteboard = Whiteboard(pk=addon.pk) whiteboard_form = PublicWhiteboardForm( request.POST or None, instance=whiteboard, prefix='whiteboard' ) # Get the slug before the form alters it to the form data. valid_slug = addon.slug if editable: if request.method == 'POST': form = models[section]( request.POST, request.FILES, instance=addon, request=request ) if form.is_valid() and (not previews or previews.is_valid()): addon = form.save(addon) if previews: for preview in previews.forms: preview.save(addon) editable = False if section == 'media': ActivityLog.create(amo.LOG.CHANGE_ICON, addon) else: ActivityLog.create(amo.LOG.EDIT_PROPERTIES, addon) valid_slug = addon.slug if cat_form: if cat_form.is_valid(): cat_form.save() else: editable = True if dependency_form: if dependency_form.is_valid(): dependency_form.save() else: editable = True if whiteboard_form: if whiteboard_form.is_valid(): whiteboard_form.save() else: editable = True else: form = models[section](instance=addon, request=request) else: form = False data = { 'addon': addon, 'whiteboard': whiteboard, 'show_listed_fields': show_listed, 'form': form, 'editable': editable, 'tags': tags, 'restricted_tags': restricted_tags, 'cat_form': cat_form, 'preview_form': previews, 'dependency_form': dependency_form, 'whiteboard_form': whiteboard_form, 'valid_slug': valid_slug, 'supported_image_types': amo.SUPPORTED_IMAGE_TYPES, } return render(request, 'devhub/addons/edit/%s.html' % section, data) @never_cache @dev_required @json_view def image_status(request, addon_id, addon): # Default icon needs no checking. if not addon.icon_type: icons = True else: icons = storage.exists( os.path.join(addon.get_icon_dir(), '%s-32.png' % addon.id) ) previews = all(storage.exists(p.thumbnail_path) for p in addon.previews.all()) return {'overall': icons and previews, 'icons': icons, 'previews': previews} @dev_required @json_view def upload_image(request, addon_id, addon, upload_type): errors = [] upload_hash = '' if 'upload_image' in request.FILES: upload_preview = request.FILES['upload_image'] upload_preview.seek(0) upload_hash = uuid4().hex loc = os.path.join(settings.TMP_PATH, upload_type, upload_hash) with storage.open(loc, 'wb') as fd: for chunk in upload_preview: fd.write(chunk) is_icon = upload_type == 'icon' is_preview = upload_type == 'preview' image_check = amo_utils.ImageCheck(upload_preview) is_animated = image_check.is_animated() # will also cache .is_image() if ( upload_preview.content_type not in amo.IMG_TYPES or not image_check.is_image() ): if is_icon: errors.append(gettext('Icons must be either PNG or JPG.')) else: errors.append(gettext('Images must be either PNG or JPG.')) if is_animated: if is_icon: errors.append(gettext('Icons cannot be animated.')) else: errors.append(gettext('Images cannot be animated.')) if is_icon: max_size = settings.MAX_ICON_UPLOAD_SIZE else: max_size = None if max_size and upload_preview.size > max_size: if is_icon: errors.append( gettext('Please use images smaller than %dMB.') % (max_size // 1024 // 1024) ) content_waffle = waffle.switch_is_active('content-optimization') if image_check.is_image() and content_waffle and is_preview: min_size = amo.ADDON_PREVIEW_SIZES.get('min') # * 100 to get a nice integer to compare against rather than 1.3333 required_ratio = min_size[0] * 100 // min_size[1] actual_size = image_check.size actual_ratio = actual_size[0] * 100 // actual_size[1] if actual_size[0] < min_size[0] or actual_size[1] < min_size[1]: # L10n: {0} is an image width (in pixels), {1} is a height. errors.append( gettext( 'Image must be at least {0} pixels wide and {1} pixels tall.' ).format(min_size[0], min_size[1]) ) if actual_ratio != required_ratio: errors.append(gettext('Image dimensions must be in the ratio 4:3.')) if image_check.is_image() and content_waffle and is_icon: standard_size = amo.ADDON_ICON_SIZES[-1] icon_size = image_check.size if icon_size[0] < standard_size or icon_size[1] < standard_size: # L10n: {0} is an image width/height (in pixels). errors.append( gettext('Icon must be at least {0} pixels wide and tall.').format( standard_size ) ) if icon_size[0] != icon_size[1]: errors.append(gettext('Icon must be square (same width and height).')) if errors and is_preview and os.path.exists(loc): # Delete the temporary preview file in case of error. os.unlink(loc) else: errors.append(gettext('There was an error uploading your preview.')) if errors: upload_hash = '' return {'upload_hash': upload_hash, 'errors': errors} @dev_required def version_edit(request, addon_id, addon, version_id): version = get_object_or_404(addon.versions.all(), pk=version_id) static_theme = addon.type == amo.ADDON_STATICTHEME version_form = ( forms.VersionForm( request.POST or None, request.FILES or None, instance=version, ) if not static_theme else None ) data = {} if version_form: data['version_form'] = version_form is_admin = acl.action_allowed(request, amo.permissions.REVIEWS_ADMIN) if not static_theme and addon.accepts_compatible_apps(): qs = version.apps.all().select_related('min', 'max') compat_form = forms.CompatFormSet( request.POST or None, queryset=qs, form_kwargs={'version': version} ) data['compat_form'] = compat_form if request.method == 'POST' and all([form.is_valid() for form in data.values()]): if 'compat_form' in data: for compat in data['compat_form'].save(commit=False): compat.version = version compat.save() for compat in data['compat_form'].deleted_objects: compat.delete() for form in data['compat_form'].forms: if isinstance(form, forms.CompatForm) and 'max' in form.changed_data: _log_max_version_change(addon, version, form.instance) if 'version_form' in data: data['version_form'].save() if 'approval_notes' in version_form.changed_data: ActivityLog.create( amo.LOG.APPROVAL_NOTES_CHANGED, addon, version, request.user ) if ( 'source' in version_form.changed_data and version_form.cleaned_data['source'] ): AddonReviewerFlags.objects.update_or_create( addon=addon, defaults={'needs_admin_code_review': True} ) # Add Activity Log, notifying staff, relevant reviewers and # other authors of the add-on. log_and_notify( amo.LOG.SOURCE_CODE_UPLOADED, None, request.user, version ) messages.success(request, gettext('Changes successfully saved.')) return redirect('devhub.versions.edit', addon.slug, version_id) data.update( { 'addon': addon, 'version': version, 'is_admin': is_admin, 'choices': File.STATUS_CHOICES, 'files': version.files.all(), } ) return render(request, 'devhub/versions/edit.html', data) def _log_max_version_change(addon, version, appversion): details = { 'version': version.version, 'target': appversion.version.version, 'application': appversion.application, } ActivityLog.create(amo.LOG.MAX_APPVERSION_UPDATED, addon, version, details=details) @dev_required @post_required @transaction.atomic def version_delete(request, addon_id, addon): version_id = request.POST.get('version_id') version = get_object_or_404(addon.versions.all(), pk=version_id) if not version.can_be_disabled_and_deleted(): # Developers shouldn't be able to delete/disable the current version # of a promoted approved add-on. group = addon.promoted_group() msg = gettext( 'The latest approved version of this %s addon cannot ' 'be deleted or disabled because the previous version was not ' 'approved for %s promotion. ' 'Please contact AMO Admins if you need help with this.' ) % (group.name, group.name) messages.error(request, msg) elif 'disable_version' in request.POST: messages.success(request, gettext('Version %s disabled.') % version.version) version.is_user_disabled = True # Will update the files/activity log. version.addon.update_status() else: messages.success(request, gettext('Version %s deleted.') % version.version) version.delete() # Will also activity log. return redirect(addon.get_dev_url('versions')) @dev_required @post_required @transaction.atomic def version_reenable(request, addon_id, addon): version_id = request.POST.get('version_id') version = get_object_or_404(addon.versions.all(), pk=version_id) messages.success(request, gettext('Version %s re-enabled.') % version.version) version.is_user_disabled = False # Will update the files/activity log. version.addon.update_status() return redirect(addon.get_dev_url('versions')) def check_validation_override(request, form, addon, version): if version and form.cleaned_data.get('admin_override_validation'): helper = ReviewHelper(request=request, addon=addon, version=version) helper.set_data( { 'operating_systems': '', 'applications': '', 'comments': gettext( 'This upload has failed validation, and may ' 'lack complete validation results. Please ' 'take due care when reviewing it.' ), } ) helper.actions['super']['method']() @dev_required def version_list(request, addon_id, addon): qs = addon.versions.order_by('-created') versions = amo_utils.paginate(request, qs) is_admin = acl.action_allowed(request, amo.permissions.REVIEWS_ADMIN) token = request.COOKIES.get(API_TOKEN_COOKIE, None) data = {'addon': addon, 'versions': versions, 'token': token, 'is_admin': is_admin} return render(request, 'devhub/versions/list.html', data) @dev_required def version_bounce(request, addon_id, addon, version): # Use filter since there could be dupes. vs = addon.versions.filter(version=version).order_by('-created').first() if vs: return redirect('devhub.versions.edit', addon.slug, vs.id) else: raise http.Http404() @json_view @dev_required def version_stats(request, addon_id, addon): qs = addon.versions.all() reviews = qs.annotate(review_count=Count('ratings')).values( 'id', 'version', 'review_count' ) data = {v['id']: v for v in reviews} files = qs.annotate(file_count=Count('files')).values_list('id', 'file_count') for id_, file_count in files: # For backwards compatibility data[id_]['files'] = file_count data[id_]['reviews'] = data[id_].pop('review_count') return data @login_required def submit_addon(request): return render_agreement( request=request, template='devhub/addons/submit/start.html', next_step='devhub.submit.distribution', ) @dev_required def submit_version_agreement(request, addon_id, addon): return render_agreement( request=request, template='devhub/addons/submit/start.html', next_step=reverse('devhub.submit.version', args=(addon.slug,)), submit_page='version', ) @transaction.atomic def _submit_distribution(request, addon, next_view): # Accept GET for the first load so we can preselect the channel, but only # when there is no addon or the add-on is not "invisible". if request.method == 'POST': data = request.POST elif 'channel' in request.GET and (not addon or not addon.disabled_by_user): data = request.GET else: data = None form = forms.DistributionChoiceForm(data, addon=addon) if request.method == 'POST' and form.is_valid(): data = form.cleaned_data args = [addon.slug] if addon else [] args.append(data['channel']) return redirect(next_view, *args) return render( request, 'devhub/addons/submit/distribute.html', { 'addon': addon, 'distribution_form': form, 'submit_notification_warning': get_config('submit_notification_warning'), 'submit_page': 'version' if addon else 'addon', }, ) @login_required def submit_addon_distribution(request): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.agreement') return _submit_distribution(request, None, 'devhub.submit.upload') @dev_required(submitting=True) def submit_version_distribution(request, addon_id, addon): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.version.agreement', addon.slug) return _submit_distribution(request, addon, 'devhub.submit.version.upload') WIZARD_COLOR_FIELDS = [ ( 'frame', _('Header area background'), _( 'The color of the header area background, displayed in the part of ' 'the header not covered or visible through the header image. Manifest ' 'field: frame.' ), 'rgba(229,230,232,1)', ), ( 'tab_background_text', _('Header area text and icons'), _( 'The color of the text and icons in the header area, except the ' 'active tab. Manifest field: tab_background_text.' ), 'rgba(0,0,0,1)', ), ( 'toolbar', _('Toolbar area background'), _( 'The background color for the navigation bar, the bookmarks bar, and ' 'the active tab. Manifest field: toolbar.' ), False, ), ( 'bookmark_text', _('Toolbar area text and icons'), _( 'The color of the text and icons in the toolbar and the active tab. ' 'Manifest field: bookmark_text.' ), False, ), ( 'toolbar_field', _('Toolbar field area background'), _( 'The background color for fields in the toolbar, such as the URL bar. ' 'Manifest field: toolbar_field.' ), False, ), ( 'toolbar_field_text', _('Toolbar field area text'), _( 'The color of text in fields in the toolbar, such as the URL bar. ' 'Manifest field: toolbar_field_text.' ), False, ), ('', '', '', False), # empty field ( 'tab_line', _('Tab highlight'), _( 'The highlight color of the active tab. Implemented as a border around the ' 'tab on Firefox 89+ and a line above the tab on older Firefoxes. ' 'Manifest field: tab_line.' ), False, ), ] @transaction.atomic def _submit_upload(request, addon, channel, next_view, wizard=False): """If this is a new addon upload `addon` will be None. next_view is the view that will be redirected to. """ if addon and addon.disabled_by_user and channel == amo.RELEASE_CHANNEL_LISTED: # Listed versions can not be submitted while the add-on is set to # "invisible" (disabled_by_user). return redirect('devhub.submit.version.distribution', addon.slug) form = forms.NewUploadForm( request.POST or None, request.FILES or None, addon=addon, request=request ) if request.method == 'POST' and form.is_valid(): data = form.cleaned_data if addon: version = Version.from_upload( upload=data['upload'], addon=addon, selected_apps=data['compatible_apps'], channel=channel, parsed_data=data['parsed_data'], ) url_args = [addon.slug, version.id] else: addon = Addon.from_upload( upload=data['upload'], channel=channel, selected_apps=data['compatible_apps'], parsed_data=data['parsed_data'], user=request.user, ) version = addon.find_latest_version(channel=channel) url_args = [addon.slug] check_validation_override(request, form, addon, version) if ( addon.status == amo.STATUS_NULL and addon.has_complete_metadata() and channel == amo.RELEASE_CHANNEL_LISTED ): addon.update(status=amo.STATUS_NOMINATED) add_dynamic_theme_tag(version) return redirect(next_view, *url_args) is_admin = acl.action_allowed(request, amo.permissions.REVIEWS_ADMIN) if addon: channel_choice_text = ( forms.DistributionChoiceForm().LISTED_LABEL if channel == amo.RELEASE_CHANNEL_LISTED else forms.DistributionChoiceForm().UNLISTED_LABEL ) else: channel_choice_text = '' # We only need this for Version upload. submit_page = 'version' if addon else 'addon' template = ( 'devhub/addons/submit/upload.html' if not wizard else 'devhub/addons/submit/wizard.html' ) existing_properties = ( extract_theme_properties(addon, channel) if wizard and addon else {} ) unsupported_properties = ( wizard_unsupported_properties( existing_properties, [field for field, _, _, _ in WIZARD_COLOR_FIELDS if field], ) if existing_properties else [] ) return render( request, template, { 'new_addon_form': form, 'is_admin': is_admin, 'addon': addon, 'submit_notification_warning': get_config('submit_notification_warning'), 'submit_page': submit_page, 'channel': channel, 'channel_choice_text': channel_choice_text, 'existing_properties': existing_properties, 'colors': WIZARD_COLOR_FIELDS, 'unsupported_properties': unsupported_properties, 'version_number': get_next_version_number(addon) if wizard else None, }, ) @login_required def submit_addon_upload(request, channel): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.agreement') channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel] return _submit_upload(request, None, channel_id, 'devhub.submit.source') @dev_required(submitting=True) @no_admin_disabled def submit_version_upload(request, addon_id, addon, channel): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.version.agreement', addon.slug) channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel] return _submit_upload(request, addon, channel_id, 'devhub.submit.version.source') @dev_required @no_admin_disabled def submit_version_auto(request, addon_id, addon): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.version.agreement', addon.slug) # Choose the channel we need from the last upload, unless that channel # would be listed and addon is set to "Invisible". last_version = addon.find_latest_version(None, exclude=()) if not last_version or ( last_version.channel == amo.RELEASE_CHANNEL_LISTED and addon.disabled_by_user ): return redirect('devhub.submit.version.distribution', addon.slug) channel = last_version.channel return _submit_upload(request, addon, channel, 'devhub.submit.version.source') @login_required def submit_addon_theme_wizard(request, channel): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.agreement') channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel] return _submit_upload( request, None, channel_id, 'devhub.submit.source', wizard=True ) @dev_required @no_admin_disabled def submit_version_theme_wizard(request, addon_id, addon, channel): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect('devhub.submit.version.agreement', addon.slug) channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel] return _submit_upload( request, addon, channel_id, 'devhub.submit.version.source', wizard=True ) def _submit_source(request, addon, version, next_view): redirect_args = [addon.slug, version.pk] if version else [addon.slug] if addon.type != amo.ADDON_EXTENSION: return redirect(next_view, *redirect_args) latest_version = version or addon.find_latest_version(channel=None) form = forms.SourceForm( request.POST or None, request.FILES or None, instance=latest_version, request=request, ) if request.method == 'POST' and form.is_valid(): if form.cleaned_data.get('source'): AddonReviewerFlags.objects.update_or_create( addon=addon, defaults={'needs_admin_code_review': True} ) activity_log = ActivityLog.objects.create( action=amo.LOG.SOURCE_CODE_UPLOADED.id, user=request.user, details={ 'comments': ( 'This version has been automatically ' 'flagged for admin review, as it had source ' 'files attached when submitted.' ) }, ) VersionLog.objects.create( version_id=latest_version.id, activity_log=activity_log ) form.save() return redirect(next_view, *redirect_args) context = { 'form': form, 'addon': addon, 'version': version, 'submit_page': 'version' if version else 'addon', } return render(request, 'devhub/addons/submit/source.html', context) @dev_required(submitting=True) def submit_addon_source(request, addon_id, addon): return _submit_source(request, addon, None, 'devhub.submit.details') @dev_required(submitting=True) def submit_version_source(request, addon_id, addon, version_id): version = get_object_or_404(addon.versions.all(), id=version_id) return _submit_source(request, addon, version, 'devhub.submit.version.details') def _submit_details(request, addon, version): static_theme = addon.type == amo.ADDON_STATICTHEME if version: skip_details_step = version.channel == amo.RELEASE_CHANNEL_UNLISTED or ( static_theme and addon.has_complete_metadata() ) if skip_details_step: # Nothing to do here. return redirect('devhub.submit.version.finish', addon.slug, version.pk) latest_version = version else: # Figure out the latest version early in order to pass the same # instance to each form that needs it (otherwise they might overwrite # each other). latest_version = addon.find_latest_version(channel=amo.RELEASE_CHANNEL_LISTED) if not latest_version: # No listed version ? Then nothing to do in the listed submission # flow. return redirect('devhub.submit.finish', addon.slug) forms_list = [] context = { 'addon': addon, 'version': version, 'sources_provided': latest_version.sources_provided, 'submit_page': 'version' if version else 'addon', } post_data = request.POST if request.method == 'POST' else None show_all_fields = not version or not addon.has_complete_metadata() if show_all_fields: if waffle.switch_is_active('content-optimization'): describe_form = forms.DescribeFormContentOptimization( post_data, instance=addon, request=request, version=version, should_auto_crop=True, ) else: describe_form = forms.DescribeForm( post_data, instance=addon, request=request, version=version ) cat_form_class = ( forms.CategoryFormSet if not static_theme else forms.SingleCategoryForm ) cat_form = cat_form_class(post_data, addon=addon, request=request) policy_form = forms.PolicyForm(post_data, addon=addon) license_form = forms.LicenseForm( post_data, version=latest_version, prefix='license' ) context.update(license_form.get_context()) context.update(form=describe_form, cat_form=cat_form, policy_form=policy_form) forms_list.extend( [describe_form, cat_form, policy_form, context['license_form']] ) if not static_theme: # Static themes don't need this form reviewer_form = forms.VersionForm(post_data, instance=latest_version) context.update(reviewer_form=reviewer_form) forms_list.append(reviewer_form) if request.method == 'POST' and all(form.is_valid() for form in forms_list): if show_all_fields: addon = describe_form.save() cat_form.save() policy_form.save() license_form.save(log=False) if not static_theme: reviewer_form.save() if addon.status == amo.STATUS_NULL: addon.update(status=amo.STATUS_NOMINATED) signals.submission_done.send(sender=addon) elif not static_theme: reviewer_form.save() if not version: return redirect('devhub.submit.finish', addon.slug) else: return redirect('devhub.submit.version.finish', addon.slug, version.id) template = 'devhub/addons/submit/%s' % ( 'describe.html' if show_all_fields else 'describe_minimal.html' ) return render(request, template, context) @dev_required(submitting=True) def submit_addon_details(request, addon_id, addon): return _submit_details(request, addon, None) @dev_required(submitting=True) def submit_version_details(request, addon_id, addon, version_id): version = get_object_or_404(addon.versions.all(), id=version_id) return _submit_details(request, addon, version) def _submit_finish(request, addon, version): uploaded_version = version or addon.versions.latest() try: author = addon.authors.all()[0] except IndexError: # This should never happen. author = None if ( not version and author and uploaded_version.channel == amo.RELEASE_CHANNEL_LISTED and not Version.objects.exclude(pk=uploaded_version.pk) .filter(addon__authors=author, channel=amo.RELEASE_CHANNEL_LISTED) .exclude(addon__status=amo.STATUS_NULL) .exists() ): # If that's the first time this developer has submitted an listed addon # (no other listed Version by this author exists) send them a welcome # email. # We can use locale-prefixed URLs because the submitter probably # speaks the same language by the time he/she reads the email. context = { 'addon_name': str(addon.name), 'app': str(amo.FIREFOX.pretty), 'detail_url': absolutify(addon.get_url_path()), 'version_url': absolutify(addon.get_dev_url('versions')), 'edit_url': absolutify(addon.get_dev_url('edit')), } tasks.send_welcome_email.delay(addon.id, [author.email], context) submit_page = 'version' if version else 'addon' return render( request, 'devhub/addons/submit/done.html', { 'addon': addon, 'uploaded_version': uploaded_version, 'submit_page': submit_page, 'preview': uploaded_version.previews.first(), }, ) @dev_required(submitting=True) def submit_addon_finish(request, addon_id, addon): # Bounce to the details step if incomplete if not addon.has_complete_metadata() and addon.find_latest_version( channel=amo.RELEASE_CHANNEL_LISTED ): return redirect('devhub.submit.details', addon.slug) # Bounce to the versions page if they don't have any versions. if not addon.versions.exists(): return redirect('devhub.submit.version', addon.slug) return _submit_finish(request, addon, None) @dev_required def submit_version_finish(request, addon_id, addon, version_id): version = get_object_or_404(addon.versions.all(), id=version_id) return _submit_finish(request, addon, version) @dev_required @post_required def remove_locale(request, addon_id, addon): POST = request.POST if 'locale' in POST and POST['locale'] != addon.default_locale: addon.remove_locale(POST['locale']) return http.HttpResponse() return http.HttpResponseBadRequest() @dev_required @post_required def request_review(request, addon_id, addon): if not addon.can_request_review(): return http.HttpResponseBadRequest() latest_version = addon.find_latest_version(amo.RELEASE_CHANNEL_LISTED, exclude=()) if latest_version: for f in latest_version.files.filter(status=amo.STATUS_DISABLED): f.update(status=amo.STATUS_AWAITING_REVIEW) # Clear the nomination date so it gets set again in Addon.watch_status. latest_version.update(nomination=None) if addon.has_complete_metadata(): addon.update(status=amo.STATUS_NOMINATED) messages.success(request, gettext('Review requested.')) else: messages.success(request, _('You must provide further details to proceed.')) ActivityLog.create(amo.LOG.CHANGE_STATUS, addon, addon.status) return redirect(addon.get_dev_url('versions')) def docs(request, doc_name=None): mdn_docs = { None: '', 'getting-started': '', 'reference': '', 'how-to': '', 'how-to/getting-started': '', 'how-to/extension-development': '#Extensions', 'how-to/other-addons': '#Other_types_of_add-ons', 'how-to/thunderbird-mobile': '#Application-specific', 'how-to/theme-development': '#Themes', 'themes': '/Themes/Background', 'themes/faq': '/Themes/Background/FAQ', 'policies': '/AMO/Policy', 'policies/reviews': '/AMO/Policy/Reviews', 'policies/contact': '/AMO/Policy/Contact', 'policies/agreement': '/AMO/Policy/Agreement', } if doc_name in mdn_docs: return redirect(MDN_BASE + mdn_docs[doc_name], permanent=True) raise http.Http404() @login_required def api_key_agreement(request): return render_agreement( request=request, template='devhub/api/agreement.html', next_step='devhub.api_key', ) def render_agreement(request, template, next_step, **extra_context): form = forms.AgreementForm( request.POST if request.method == 'POST' else None, request=request ) if request.method == 'POST' and form.is_valid(): # Developer has validated the form: let's update its profile and # redirect to next step. Note that the form is supposed to always be # invalid if submission is not allowed for this request. data = { 'read_dev_agreement': datetime.datetime.now(), } if 'display_name' in form.cleaned_data: data['display_name'] = form.cleaned_data['display_name'] request.user.update(**data) return redirect(next_step) elif not RestrictionChecker(request=request).is_submission_allowed(): # Developer has either posted an invalid form or just landed on the # page but haven't read the agreement yet, or isn't allowed to submit # for some other reason (denied ip/email): show the form (with # potential errors highlighted) context = { 'agreement_form': form, 'agreement_message': str(DeveloperAgreementRestriction.error_message), } context.update(extra_context) return render(request, template, context) else: # The developer has already read the agreement, we should just redirect # to the next step. response = redirect(next_step) return response @login_required @transaction.atomic def api_key(request): if not RestrictionChecker(request=request).is_submission_allowed(): return redirect(reverse('devhub.api_key_agreement')) try: credentials = APIKey.get_jwt_key(user=request.user) except APIKey.DoesNotExist: credentials = None try: confirmation = APIKeyConfirmation.objects.get(user=request.user) except APIKeyConfirmation.DoesNotExist: confirmation = None if request.method == 'POST': has_confirmed_or_is_confirming = confirmation and ( confirmation.confirmed_once or confirmation.is_token_valid(request.POST.get('confirmation_token')) ) # Revoking credentials happens regardless of action, if there were # credentials in the first place. if credentials and request.POST.get('action') in ('revoke', 'generate'): credentials.update(is_active=None) log.info( 'revoking JWT key for user: {}, {}'.format(request.user.id, credentials) ) send_key_revoked_email(request.user.email, credentials.key) msg = gettext('Your old credentials were revoked and are no longer valid.') messages.success(request, msg) # If trying to generate with no confirmation instance, we don't # generate the keys immediately but instead send you an email to # confirm the generation of the key. This should only happen once per # user, unless the instance is deleted by admins to reset the process # for that user. if confirmation is None and request.POST.get('action') == 'generate': confirmation = APIKeyConfirmation.objects.create( user=request.user, token=APIKeyConfirmation.generate_token() ) confirmation.send_confirmation_email() # If you have a confirmation instance, you need to either have it # confirmed once already or have the valid token proving you received # the email. elif ( has_confirmed_or_is_confirming and request.POST.get('action') == 'generate' ): confirmation.update(confirmed_once=True) new_credentials = APIKey.new_jwt_credentials(request.user) log.info('new JWT key created: {}'.format(new_credentials)) send_key_change_email(request.user.email, new_credentials.key) else: # If we land here, either confirmation token is invalid, or action # is invalid, or state is outdated (like user trying to revoke but # there are already no credentials). # We can just pass and let the redirect happen. pass # In any case, redirect after POST. return redirect(reverse('devhub.api_key')) context_data = { 'title': gettext('Manage API Keys'), 'credentials': credentials, 'confirmation': confirmation, 'token': request.GET.get('token'), # For confirmation step. } return render(request, 'devhub/api/key.html', context_data) def send_key_change_email(to_email, key): template = loader.get_template('devhub/emails/new-key-email.ltxt') url = absolutify(reverse('devhub.api_key')) send_mail( gettext('New API key created'), template.render({'key': key, 'url': url}), from_email=settings.DEFAULT_FROM_EMAIL, recipient_list=[to_email], ) def send_key_revoked_email(to_email, key): template = loader.get_template('devhub/emails/revoked-key-email.ltxt') url = absolutify(reverse('devhub.api_key')) send_mail( gettext('API key revoked'), template.render({'key': key, 'url': url}), from_email=settings.DEFAULT_FROM_EMAIL, recipient_list=[to_email], ) @dev_required @json_view def theme_background_image(request, addon_id, addon, channel): channel_id = amo.CHANNEL_CHOICES_LOOKUP[channel] version = addon.find_latest_version(channel_id) return version.get_background_images_encoded(header_only=True) if version else {} def logout(request): user = request.user if not user.is_anonymous: log.info('User (%s) logged out' % user) if 'to' in request.GET and not _is_safe_url(request.GET['to'], request): log.info('Unsafe redirect to %s' % request.GET['to']) gets = request.GET.copy() gets['to'] = settings.LOGIN_REDIRECT_URL request.GET = gets next_url = request.GET.get('to') if not next_url: next_url = settings.LOGOUT_REDIRECT_URL prefixer = get_url_prefix() if prefixer: next_url = prefixer.fix(next_url) response = http.HttpResponseRedirect(next_url) logout_user(request, response) return response
bsd-3-clause
dave-billin/overo-ui-moos-auv
contrib/python/generate-manifest-2.6.py
19
14802
#!/usr/bin/env python # generate Python Manifest for the OpenEmbedded build system # (C) 2002-2010 Michael 'Mickey' Lauer <[email protected]> # (C) 2007 Jeremy Laine # licensed under MIT, see COPYING.MIT import os import sys import time VERSION = "2.6.6" __author__ = "Michael 'Mickey' Lauer <[email protected]>" __version__ = "20110222" class MakefileMaker: def __init__( self, outfile ): """initialize""" self.packages = {} self.targetPrefix = "${libdir}/python%s/" % VERSION[:3] self.output = outfile self.out( """ # WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file. # Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <[email protected]> # Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy """ % ( sys.argv[0], __version__ ) ) # # helper functions # def out( self, data ): """print a line to the output file""" self.output.write( "%s\n" % data ) def setPrefix( self, targetPrefix ): """set a file prefix for addPackage files""" self.targetPrefix = targetPrefix def doProlog( self ): self.out( """ """ ) self.out( "" ) def addPackage( self, name, description, dependencies, filenames ): """add a package to the Makefile""" if type( filenames ) == type( "" ): filenames = filenames.split() fullFilenames = [] for filename in filenames: if filename[0] != "$": fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) ) else: fullFilenames.append( filename ) self.packages[name] = description, dependencies, fullFilenames def doBody( self ): """generate body of Makefile""" global VERSION # # generate provides line # provideLine = 'PROVIDES+="' for name in sorted(self.packages): provideLine += "%s " % name provideLine += '"' self.out( provideLine ) self.out( "" ) # # generate package line # packageLine = 'PACKAGES="${PN}-core-dbg ' for name in sorted(self.packages): if name != '${PN}-core-dbg': packageLine += "%s " % name packageLine += '${PN}-modules"' self.out( packageLine ) self.out( "" ) # # generate package variables # for name, data in sorted(self.packages.iteritems()): desc, deps, files = data # # write out the description, revision and dependencies # self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) ) self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) ) line = 'FILES_%s="' % name # # check which directories to make in the temporary directory # dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead. for target in files: dirset[os.path.dirname( target )] = True # # generate which files to copy for the target (-dfR because whole directories are also allowed) # for target in files: line += "%s " % target line += '"' self.out( line ) self.out( "" ) self.out( 'DESCRIPTION_${PN}-modules="All Python modules"' ) line = 'RDEPENDS_${PN}-modules="' for name, data in sorted(self.packages.iteritems()): if name not in ['${PN}-core-dbg', '${PN}-dev']: line += "%s " % name self.out( "%s \"" % line ) self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' ) def doEpilog( self ): self.out( """""" ) self.out( "" ) def make( self ): self.doProlog() self.doBody() self.doEpilog() if __name__ == "__main__": if len( sys.argv ) > 1: os.popen( "rm -f ./%s" % sys.argv[1] ) outfile = file( sys.argv[1], "w" ) else: outfile = sys.stdout m = MakefileMaker( outfile ) # Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies! # Parameters: revision, name, description, dependencies, filenames # m.addPackage( "${PN}-core", "Python Interpreter and core modules (needed!)", "", "__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " + "genericpath.* getopt.* linecache.* new.* " + "os.* posixpath.* struct.* " + "warnings.* site.* stat.* " + "UserDict.* UserList.* UserString.* " + "lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " + "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python*" ) m.addPackage( "${PN}-core-dbg", "Python core module debug information", "${PN}-core", "config/.debug lib-dynload/.debug ${bindir}/.debug ${libdir}/.debug" ) m.addPackage( "${PN}-dev", "Python Development Package", "${PN}-core", "${includedir} ${libdir}/libpython2.6.so" ) # package m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter", "${bindir}/idle idlelib" ) # package m.addPackage( "${PN}-pydoc", "Python Interactive Help Support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re", "${bindir}/pydoc pydoc.*" ) m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime", "${bindir}/smtpd.*" ) m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core", "wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so" ) m.addPackage( "${PN}-bsddb", "Python Berkeley Database Bindings", "${PN}-core", "bsddb lib-dynload/_bsddb.so" ) # package m.addPackage( "${PN}-codecs", "Python Codecs, Encodings & i18n Support", "${PN}-core ${PN}-lang", "codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" ) m.addPackage( "${PN}-compile", "Python Bytecode Compilation Support", "${PN}-core", "py_compile.* compileall.*" ) m.addPackage( "${PN}-compiler", "Python Compiler Support", "${PN}-core", "compiler" ) # package m.addPackage( "${PN}-compression", "Python High Level Compression Support", "${PN}-core ${PN}-zlib", "gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" ) m.addPackage( "${PN}-crypt", "Python Basic Cryptographic and Hashing Support", "${PN}-core", "hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" ) m.addPackage( "${PN}-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold", "lib-dynload/_csv.so csv.* optparse.* textwrap.*" ) m.addPackage( "${PN}-curses", "Python Curses Support", "${PN}-core", "curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module m.addPackage( "${PN}-ctypes", "Python C Types Support", "${PN}-core", "ctypes lib-dynload/_ctypes.so" ) # directory + low level module m.addPackage( "${PN}-datetime", "Python Calendar and Time support", "${PN}-core ${PN}-codecs", "_strptime.* calendar.* lib-dynload/datetime.so" ) m.addPackage( "${PN}-db", "Python File-Based Database Support", "${PN}-core", "anydbm.* dumbdbm.* whichdb.* " ) m.addPackage( "${PN}-debugger", "Python Debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint", "bdb.* pdb.*" ) m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects.", "${PN}-lang ${PN}-re", "difflib.*" ) m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core", "config distutils" ) # package m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings.", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib", "doctest.*" ) # FIXME consider adding to some higher level package m.addPackage( "${PN}-elementtree", "Python elementree", "${PN}-core", "lib-dynload/_elementtree.so" ) m.addPackage( "${PN}-email", "Python Email Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient", "imaplib.* email" ) # package m.addPackage( "${PN}-fcntl", "Python's fcntl Interface", "${PN}-core", "lib-dynload/fcntl.so" ) m.addPackage( "${PN}-hotshot", "Python Hotshot Profiler", "${PN}-core", "hotshot lib-dynload/_hotshot.so" ) m.addPackage( "${PN}-html", "Python HTML Processing", "${PN}-core", "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* " ) m.addPackage( "${PN}-gdbm", "Python GNU Database Support", "${PN}-core", "lib-dynload/gdbm.so" ) m.addPackage( "${PN}-image", "Python Graphical Image Handling", "${PN}-core", "colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" ) m.addPackage( "${PN}-io", "Python Low-Level I/O", "${PN}-core ${PN}-math", "lib-dynload/_socket.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " + "pipes.* socket.* ssl.* tempfile.* StringIO.* " ) m.addPackage( "${PN}-json", "Python JSON Support", "${PN}-core ${PN}-math ${PN}-re", "json" ) # package m.addPackage( "${PN}-lang", "Python Low-Level Language Support", "${PN}-core", "lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " + "lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " + "atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " + "tokenize.* traceback.* weakref.*" ) m.addPackage( "${PN}-logging", "Python Logging Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold", "logging" ) # package m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime", "mailbox.*" ) m.addPackage( "${PN}-math", "Python Math Support", "${PN}-core", "lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" ) m.addPackage( "${PN}-mime", "Python MIME Handling APIs", "${PN}-core ${PN}-io", "mimetools.* uu.* quopri.* rfc822.*" ) m.addPackage( "${PN}-mmap", "Python Memory-Mapped-File Support", "${PN}-core ${PN}-io", "lib-dynload/mmap.so " ) m.addPackage( "${PN}-multiprocessing", "Python Multiprocessing Support", "${PN}-core ${PN}-io ${PN}-lang", "lib-dynload/_multiprocessing.so multiprocessing" ) # package m.addPackage( "${PN}-netclient", "Python Internet Protocol Clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime", "*Cookie*.* " + "base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" ) m.addPackage( "${PN}-netserver", "Python Internet Protocol Servers", "${PN}-core ${PN}-netclient", "cgi.* *HTTPServer.* SocketServer.*" ) m.addPackage( "${PN}-numbers", "Python Number APIs", "${PN}-core ${PN}-lang ${PN}-re", "decimal.* numbers.*" ) m.addPackage( "${PN}-pickle", "Python Persistence Support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re", "pickle.* shelve.* lib-dynload/cPickle.so" ) m.addPackage( "${PN}-pkgutil", "Python Package Extension Utility Support", "${PN}-core", "pkgutil.*") m.addPackage( "${PN}-pprint", "Python Pretty-Print Support", "${PN}-core", "pprint.*" ) m.addPackage( "${PN}-profile", "Python Basic Profiling Support", "${PN}-core ${PN}-textutils", "profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" ) m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core", "re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin m.addPackage( "${PN}-readline", "Python Readline Support", "${PN}-core", "lib-dynload/readline.so rlcompleter.*" ) m.addPackage( "${PN}-resource", "Python Resource Control Interface", "${PN}-core", "lib-dynload/resource.so" ) m.addPackage( "${PN}-shell", "Python Shell-Like Functionality", "${PN}-core ${PN}-re", "cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" ) m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient", "robotparser.*") m.addPackage( "${PN}-subprocess", "Python Subprocess Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle", "subprocess.*" ) m.addPackage( "${PN}-sqlite3", "Python Sqlite3 Database Support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib", "lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" ) m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 Database Support Tests", "${PN}-core ${PN}-sqlite3", "sqlite3/test" ) m.addPackage( "${PN}-stringold", "Python String APIs [deprecated]", "${PN}-core ${PN}-re", "lib-dynload/strop.so string.*" ) m.addPackage( "${PN}-syslog", "Python Syslog Interface", "${PN}-core", "lib-dynload/syslog.so" ) m.addPackage( "${PN}-terminal", "Python Terminal Controlling Support", "${PN}-core ${PN}-io", "pty.* tty.*" ) m.addPackage( "${PN}-tests", "Python Tests", "${PN}-core", "test" ) # package m.addPackage( "${PN}-threading", "Python Threading & Synchronization Support", "${PN}-core ${PN}-lang", "_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" ) m.addPackage( "${PN}-tkinter", "Python Tcl/Tk Bindings", "${PN}-core", "lib-dynload/_tkinter.so lib-tk" ) # package m.addPackage( "${PN}-unittest", "Python Unit Testing Framework", "${PN}-core ${PN}-stringold ${PN}-lang", "unittest.*" ) m.addPackage( "${PN}-unixadmin", "Python Unix Administration Support", "${PN}-core", "lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" ) m.addPackage( "${PN}-xml", "Python basic XML support.", "${PN}-core ${PN}-elementtree ${PN}-re", "lib-dynload/pyexpat.so xml xmllib.*" ) # package m.addPackage( "${PN}-xmlrpc", "Python XMLRPC Support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang", "xmlrpclib.* SimpleXMLRPCServer.*" ) m.addPackage( "${PN}-zlib", "Python zlib Support.", "${PN}-core", "lib-dynload/zlib.so" ) m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime", "mailbox.*" ) m.make()
mit
datalytica/esky
esky/patch.py
4
51684
# Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd. # All rights reserved; available under the terms of the BSD License. """ esky.patch: directory diffing and patching support for esky. This module forms the basis of esky's differential update support. It defines a compact protocol to encode the differences between two directories, and functions to calculate and apply patches based on this protocol. It exposes the following functions: write_patch(srcpath,tgtpath,stream): calculate the differences between directories (or files) "srcpath" and "tgtpath", and write a patch to transform the format into the latter to the file-like object "stream". apply_patch(tgtpath,stream): read a patch from the file-like object "stream" and apply it to the directory (or file) at "tgtpath". For directories, the patch is applied *in-situ*. If you want to guard against patches that fail to apply, patch a copy then copy it back over the original. This module can also be executed as a script (e.g. "python -m esky.patch ...") to calculate or apply patches from the command-line: python -m esky.patch diff <source> <target> <patch> generate a patch to transform <source> into <target>, and write it into file <patch> (or stdout if not specified). python -m esky.patch patch <source> <patch> transform <source> by applying the patches in the file <patch> (or stdin if not specified. The modifications are made in-place. To patch or diff zipfiles as though they were a directory, pass the "-z" or "--zipped" option on the command-line, e.g: python -m esky.patch --zipped diff <source>.zip <target>.zip <patch> To "deep unzip" the zipfiles so that any leading directories are ignored, use the "-Z" or "--deep-zipped" option instead: python -m esky.patch -Z diff <source>.zip <target>.zip <patch> This can be useful for generating differential esky updates by hand, when you already have the corresponding zip files. """ from __future__ import with_statement try: bytes = bytes except NameError: bytes = str import os import sys import bz2 import time import shutil import hashlib import optparse import zipfile import tempfile if sys.version_info[0] < 3: try: from cStringIO import StringIO as BytesIO except ImportError: from StringIO import StringIO as BytesIO else: from io import BytesIO # Try to get code for working with bsdiff4-format patches. # # We have three options: # * use the cleaned-up bsdiff4 module by Ilan Schnell. # * use the original cx-bsdiff module by Anthony Tuininga. # * use a pure-python patch-only version. # # We define each one if we can, so it's available for testing purposes. # We then set the main "bsdiff4" name equal to the best option. # # TODO: move this into a support module, it clutters up reading # of the code in this file # try: import bsdiff4 as bsdiff4_native except ImportError: bsdiff4_native = None try: import bsdiff as _cx_bsdiff except ImportError: bsdiff4_cx = None else: # This wrapper code basically takes care of the bsdiff patch format, # translating to/from the raw control information for the algorithm. class bsdiff4_cx(object): @staticmethod def diff(source,target): (tcontrol,bdiff,bextra) = _cx_bsdiff.Diff(source,target) # Write control tuples as series of offts bcontrol = BytesIO() for c in tcontrol: for x in c: bcontrol.write(_encode_offt(x)) del tcontrol bcontrol = bcontrol.getvalue() # Compress each block bcontrol = bz2.compress(bcontrol) bdiff = bz2.compress(bdiff) bextra = bz2.compress(bextra) # Final structure is: # (header)(len bcontrol)(len bdiff)(len target)(bcontrol)\ # (bdiff)(bextra) return "".join(( "BSDIFF40", _encode_offt(len(bcontrol)), _encode_offt(len(bdiff)), _encode_offt(len(target)), bcontrol, bdiff, bextra, )) @staticmethod def patch(source,patch): # Read the length headers l_bcontrol = _decode_offt(patch[8:16]) l_bdiff = _decode_offt(patch[16:24]) l_target = _decode_offt(patch[24:32]) # Read the three data blocks e_bcontrol = 32 + l_bcontrol e_bdiff = e_bcontrol + l_bdiff bcontrol = bz2.decompress(patch[32:e_bcontrol]) bdiff = bz2.decompress(patch[e_bcontrol:e_bdiff]) bextra = bz2.decompress(patch[e_bdiff:]) # Decode the control tuples tcontrol = [] for i in xrange(0,len(bcontrol),24): tcontrol.append(( _decode_offt(bcontrol[i:i+8]), _decode_offt(bcontrol[i+8:i+16]), _decode_offt(bcontrol[i+16:i+24]), )) # Actually do the patching. return _cx_bsdiff.Patch(source,l_target,tcontrol,bdiff,bextra) class bsdiff4_py(object): """Pure-python version of bsdiff4 module that can only patch, not diff. By providing a pure-python fallback, we don't force frozen apps to bundle the bsdiff module in order to make use of patches. Besides, the patch-applying algorithm is very simple. """ # Expose a diff method if we have one from another module, to # make it easier to test this class. if bsdiff4_native is not None: @staticmethod def diff(source,target): return bsdiff4_native.diff(source,target) elif bsdiff4_cx is not None: @staticmethod def diff(source,target): return bsdiff4_cx.diff(source,target) else: diff = None @staticmethod def patch(source,patch): # Read the length headers l_bcontrol = _decode_offt(patch[8:16]) l_bdiff = _decode_offt(patch[16:24]) l_target = _decode_offt(patch[24:32]) # Read the three data blocks e_bcontrol = 32 + l_bcontrol e_bdiff = e_bcontrol + l_bdiff bcontrol = bz2.decompress(patch[32:e_bcontrol]) bdiff = bz2.decompress(patch[e_bcontrol:e_bdiff]) bextra = bz2.decompress(patch[e_bdiff:]) # Decode the control tuples tcontrol = [] for i in xrange(0,len(bcontrol),24): tcontrol.append(( _decode_offt(bcontrol[i:i+8]), _decode_offt(bcontrol[i+8:i+16]), _decode_offt(bcontrol[i+16:i+24]), )) # Actually do the patching. # This is the bdiff4 patch algorithm in slow, pure python. source = BytesIO(source) result = BytesIO() bdiff = BytesIO(bdiff) bextra = BytesIO(bextra) for (x,y,z) in tcontrol: diff_data = bdiff.read(x) orig_data = source.read(x) if sys.version_info[0] < 3: for i in xrange(len(diff_data)): result.write(chr((ord(diff_data[i])+ord(orig_data[i]))%256)) else: for i in xrange(len(diff_data)): result.write(bytes([(diff_data[i]+orig_data[i])%256])) result.write(bextra.read(y)) source.seek(z,os.SEEK_CUR) return result.getvalue() if bsdiff4_native is not None: bsdiff4 = bsdiff4_native elif bsdiff4_cx is not None: bsdiff4 = bsdiff4_cx else: bsdiff4 = bsdiff4_py # Default size of blocks to use when diffing a file. 4M seems reasonable. # Setting this higher generates smaller patches at the cost of higher # memory use (and bsdiff is a memory hog at the best of times...) DIFF_WINDOW_SIZE = 1024 * 1024 * 4 # Highest patch version that can be processed by this module. HIGHEST_VERSION = 1 # Header bytes included in the patch file PATCH_HEADER = "ESKYPTCH".encode("ascii") from esky.errors import Error from esky.util import extract_zipfile, create_zipfile, deep_extract_zipfile,\ zipfile_common_prefix_dir, really_rmtree, really_rename __all__ = ["PatchError","DiffError","main","write_patch","apply_patch", "Differ","Patcher"] class PatchError(Error): """Error raised when a patch fails to apply.""" pass class DiffError(Error): """Error raised when a diff can't be generated.""" pass # Commands used in the directory patching protocol. Each of these is # encoded as a vint in the patch stream; unless we get really out of # control and have more than 127 commands, this means one byte per command. # # It's very important that you don't reorder these commands. Their order # in this list determines what byte each command is assigned, so doing # anything but adding to the end will break all existing patches! # _COMMANDS = [ "END", # END(): stop processing current context "SET_PATH", # SET_PATH(path): set current target path "JOIN_PATH", # JOIN_PATH(path): join path to the current target "POP_PATH", # POP_PATH(h): pop one level off current target "POP_JOIN_PATH", # POP_JOIN_PATH(path): pop the current path, then join "VERIFY_MD5", # VERIFY_MD5(dgst): check md5 digest of current target "REMOVE", # REMOVE(): remove the current target "MAKEDIR", # MAKEDIR(): make directory at current target "COPY_FROM", # COPY_FROM(path): copy item at path to current target "MOVE_FROM", # MOVE_FROM(path): move item at path to current target "PF_COPY", # PF_COPY(n): patch file; copy n bytes from input "PF_SKIP", # PF_SKIP(n): patch file; skip n bytes from input "PF_INS_RAW", # PF_INS_RAW(bytes): patch file; insert raw bytes "PF_INS_BZ2", # PF_INS_BZ2(bytes): patch file; insert unbzip'd bytes "PF_BSDIFF4", # PF_BSDIFF4(n,p): patch file; bsdiff4 from n input bytes "PF_REC_ZIP", # PF_REC_ZIP(m,cs): patch file; recurse into zipfile "CHMOD", # CHMOD(mode): set mode of current target ] # Make commands available as global variables for i,cmd in enumerate(_COMMANDS): globals()[cmd] = i def apply_patch(target,stream,**kwds): """Apply patch commands from the given stream to the given target. 'target' must be the path of a file or directory, and 'stream' an object supporting the read() method. Patch protocol commands will be read from the stream and applied in sequence to the target. """ Patcher(target,stream,**kwds).patch() def write_patch(source,target,stream,**kwds): """Generate patch commands to transform source into target. 'source' and 'target' must be paths to a file or directory, and 'stream' an object supporting the write() method. Patch protocol commands to transform 'source' into 'target' will be generated and written sequentially to the stream. """ Differ(stream,**kwds).diff(source,target) def _read_vint(stream): """Read a vint-encoded integer from the given stream.""" b = stream.read(1) if not b: raise EOFError b = ord(b) if b < 128: return b x = e = 0 while b >= 128: x += (b - 128) << e e += 7 b = stream.read(1) if not b: raise EOFError b = ord(b) x += (b << e) return x if sys.version_info[0] > 2: def _write_vint(stream,x): """Write a vint-encoded integer to the given stream.""" while x >= 128: b = x & 127 stream.write(bytes([b | 128])) x = x >> 7 stream.write(bytes([x])) else: def _write_vint(stream,x): """Write a vint-encoded integer to the given stream.""" while x >= 128: b = x & 127 stream.write(chr(b | 128)) x = x >> 7 stream.write(chr(x)) def _read_zipfile_metadata(stream): """Read zipfile metadata from the given stream. The result is a zipfile.ZipFile object where all members are zero length. """ return zipfile.ZipFile(stream,"r") def _write_zipfile_metadata(stream,zfin): """Write zipfile metadata to the given stream. For simplicity, the metadata is represented as a zipfile with the same members as the given zipfile, but where they all have zero length. """ zfout = zipfile.ZipFile(stream,"w") try: for zinfo in zfin.infolist(): zfout.writestr(zinfo,"") finally: zfout.close() def paths_differ(path1,path2): """Check whether two paths differ.""" if os.path.isdir(path1): if not os.path.isdir(path2): return True for nm in os.listdir(path1): if paths_differ(os.path.join(path1,nm),os.path.join(path2,nm)): return True for nm in os.listdir(path2): if not os.path.exists(os.path.join(path1,nm)): return True elif os.path.isfile(path1): if not os.path.isfile(path2): return True if os.stat(path1).st_size != os.stat(path2).st_size: return True with open(path1,"rb") as f1: with open(path2,"rb") as f2: data1 = f1.read(1024*16) data2 = f2.read(1024*16) while data1: if data1 != data2: return True data1 = f1.read(1024*16) data2 = f2.read(1024*16) if data1 != data2: return True elif os.path.exists(path2): return True return False def calculate_digest(target,hash=hashlib.md5): """Calculate the digest of the given path. If the target is a file, its digest is calculated as normal. If it is a directory, it is calculated from the names and digests of its contents. """ d = hash() if os.path.isdir(target): for nm in sorted(os.listdir(target)): d.update(nm.encode("utf8")) d.update(calculate_digest(os.path.join(target,nm))) else: with open(target,"rb") as f: data = f.read(1024*16) while data: d.update(data) data = f.read(1024*16) return d.digest() class Patcher(object): """Class interpreting our patch protocol. Instances of this class can be used to apply a sequence of patch commands to a target file or directory. You can think of it as a little automaton that edits a directory in-situ. """ def __init__(self,target,commands,dry_run=False): target = os.path.abspath(target) self.target = target self.new_target = None self.commands = commands self.root_dir = self.target self.infile = None self.outfile = None self.dry_run = dry_run self._workdir = tempfile.mkdtemp() self._context_stack = [] def __del__(self): if self.infile: self.infile.close() if self.outfile: self.outfile.close() if self._workdir and shutil: really_rmtree(self._workdir) def _read(self,size): """Read the given number of bytes from the command stream.""" return self.commands.read(size) def _read_int(self): """Read an integer from the command stream.""" i = _read_vint(self.commands) if self.dry_run: print " ", i return i def _read_command(self): """Read the next command to be processed.""" cmd = _read_vint(self.commands) if self.dry_run: print _COMMANDS[cmd] return cmd def _read_bytes(self): """Read a bytestring from the command stream.""" l = _read_vint(self.commands) bytes = self.commands.read(l) if len(bytes) != l: raise PatchError("corrupted bytestring") if self.dry_run: print " [%s bytes]" % (len(bytes),) return bytes def _read_path(self): """Read a unicode path from the given stream.""" l = _read_vint(self.commands) bytes = self.commands.read(l) if len(bytes) != l: raise PatchError("corrupted path") path = bytes.decode("utf-8") if self.dry_run: print " ", path return path def _check_begin_patch(self): """Begin patching the current file, if not already. This method is called by all file-patching commands; if there is no file open for patching then the current target is opened. """ if not self.outfile and not self.dry_run: if os.path.exists(self.target) and not os.path.isfile(self.target): really_rmtree(self.target) self.new_target = self.target + ".new" while os.path.exists(self.new_target): self.new_target += ".new" if os.path.exists(self.target): self.infile = open(self.target,"rb") else: self.infile = BytesIO("".encode("ascii")) self.outfile = open(self.new_target,"wb") if os.path.isfile(self.target): mod = os.stat(self.target).st_mode os.chmod(self.new_target,mod) def _check_end_patch(self): """Finish patching the current file, if there is one. This method is called by all non-file-patching commands; if there is a file open for patching then it is closed and committed. """ if self.outfile and not self.dry_run: self.infile.close() self.infile = None self.outfile.close() self.outfile = None if os.path.exists(self.target): os.unlink(self.target) if sys.platform == "win32": time.sleep(0.01) really_rename(self.new_target,self.target) self.new_target = None def _check_path(self,path=None): """Check that we're not traversing outside the root.""" if path is None: path = self.target if path != self.root_dir: if not path.startswith(self.root_dir + os.sep): raise PatchError("traversed outside root_dir") def _blank_state(self): """Save current state, then blank it out. The previous state is returned. """ state = self._save_state() self.infile = None self.outfile = None self.new_target = None return state def _save_state(self): """Return the current state, for later restoration.""" return (self.target,self.root_dir,self.infile,self.outfile,self.new_target) def _restore_state(self,state): """Restore the object to a previously-saved state.""" (self.target,self.root_dir,self.infile,self.outfile,self.new_target) = state def patch(self): """Interpret and apply patch commands to the target. This is a simple command loop that dispatches to the _do_<CMD> methods defined below. It keeps processing until one of them raises EOFError. """ header = self._read(len(PATCH_HEADER)) if header != PATCH_HEADER: raise PatchError("not an esky patch file [%s]" % (header,)) version = self._read_int() if version > HIGHEST_VERSION: raise PatchError("esky patch version %d not supported"%(version,)) try: while True: cmd = self._read_command() getattr(self,"_do_" + _COMMANDS[cmd])() except EOFError: self._check_end_patch() finally: if self.infile: self.infile.close() self.infile = None if self.outfile: self.outfile.close() self.outfile = None def _do_END(self): """Execute the END command. If there are entries on the context stack, this pops and executes the topmost entry. Otherwise, it exits the main command loop. """ self._check_end_patch() if self._context_stack: self._context_stack.pop()() else: raise EOFError def _do_SET_PATH(self): """Execute the SET_PATH command. This reads a path from the command stream, and sets the current target path to that path. """ self._check_end_patch() path = self._read_path() if path: self.target = os.path.join(self.root_dir,path) else: self.target = self.root_dir self._check_path() def _do_JOIN_PATH(self): """Execute the JOIN_PATH command. This reads a path from the command stream, and joins it to the current target path. """ self._check_end_patch() path = self._read_path() self.target = os.path.join(self.target,path) self._check_path() def _do_POP_PATH(self): """Execute the POP_PATH command. This pops one name component from the current target path. It is an error to attempt to pop past the root directory. """ self._check_end_patch() while self.target.endswith(os.sep): self.target = self.target[:-1] self.target = os.path.dirname(self.target) self._check_path() def _do_POP_JOIN_PATH(self): """Execute the POP_JOIN_PATH command. This pops one name component from the current target path, then joins the path read from the command stream. """ self._do_POP_PATH() self._do_JOIN_PATH() def _do_VERIFY_MD5(self): """Execute the VERIFY_MD5 command. This reads 16 bytes from the command stream, and compares them to the calculated digest for the current target path. If they differ, a PatchError is raised. """ self._check_end_patch() digest = self._read(16) assert len(digest) == 16 if not self.dry_run: if digest != calculate_digest(self.target,hashlib.md5): raise PatchError("incorrect MD5 digest for %s" % (self.target,)) def _do_MAKEDIR(self): """Execute the MAKEDIR command. This makes a directory at the current target path. It automatically removes any existing entry at that path, as well as creating any intermediate directories. """ self._check_end_patch() if not self.dry_run: if os.path.isdir(self.target): really_rmtree(self.target) elif os.path.exists(self.target): os.unlink(self.target) os.makedirs(self.target) def _do_REMOVE(self): """Execute the REMOVE command. This forcibly removes the file or directory at the current target path. """ self._check_end_patch() if not self.dry_run: if os.path.isdir(self.target): really_rmtree(self.target) elif os.path.exists(self.target): os.unlink(self.target) def _do_COPY_FROM(self): """Execute the COPY_FROM command. This reads a path from the command stream, and copies whatever is at that path to the current target path. The source path is interpreted relative to the directory containing the current path; this caters for the common case of copying a file within the same directory. """ self._check_end_patch() source_path = os.path.join(os.path.dirname(self.target),self._read_path()) self._check_path(source_path) if not self.dry_run: if os.path.exists(self.target): if os.path.isdir(self.target): really_rmtree(self.target) else: os.unlink(self.target) if os.path.isfile(source_path): shutil.copy2(source_path,self.target) else: shutil.copytree(source_path,self.target) def _do_MOVE_FROM(self): """Execute the MOVE_FROM command. This reads a path from the command stream, and moves whatever is at that path to the current target path. The source path is interpreted relative to the directory containing the current path; this caters for the common case of moving a file within the same directory. """ self._check_end_patch() source_path = os.path.join(os.path.dirname(self.target),self._read_path()) self._check_path(source_path) if not self.dry_run: if os.path.exists(self.target): if os.path.isdir(self.target): really_rmtree(self.target) else: os.unlink(self.target) if sys.platform == "win32": time.sleep(0.01) really_rename(source_path,self.target) def _do_PF_COPY(self): """Execute the PF_COPY command. This generates new data for the file currently being patched. It reads an integer from the command stream, then copies that many bytes directory from the source file into the target file. """ self._check_begin_patch() n = self._read_int() if not self.dry_run: self.outfile.write(self.infile.read(n)) def _do_PF_SKIP(self): """Execute the PF_SKIP command. This reads an integer from the command stream, then moves the source file pointer by that amount without changing the target file. """ self._check_begin_patch() n = self._read_int() if not self.dry_run: self.infile.read(n) def _do_PF_INS_RAW(self): """Execute the PF_INS_RAW command. This generates new data for the file currently being patched. It reads a bytestring from the command stream and writes it directly into the target file. """ self._check_begin_patch() data = self._read_bytes() if not self.dry_run: self.outfile.write(data) def _do_PF_INS_BZ2(self): """Execute the PF_INS_BZ2 command. This generates new data for the file currently being patched. It reads a bytestring from the command stream, decompresses it using bz2 and and write the result into the target file. """ self._check_begin_patch() data = bz2.decompress(self._read_bytes()) if not self.dry_run: self.outfile.write(data) def _do_PF_BSDIFF4(self): """Execute the PF_BSDIFF4 command. This reads an integer N and a BSDIFF4-format patch bytestring from the command stream. It then reads N bytes from the source file, applies the patch to these bytes, and writes the result into the target file. """ self._check_begin_patch() n = self._read_int() # Restore the standard bsdiff header bytes patch = "BSDIFF40".encode("ascii") + self._read_bytes() if not self.dry_run: source = self.infile.read(n) if len(source) != n: raise PatchError("insufficient source data in %s" % (self.target,)) self.outfile.write(bsdiff4.patch(source,patch)) def _do_PF_REC_ZIP(self): """Execute the PF_REC_ZIP command. This patches the current target by treating it as a zipfile and recursing into it. It extracts the source file to a temp directory, then reads commands and applies them to that directory. This command expects two END-terminated blocks of sub-commands. The first block patches the zipfile metadata, and the second patches the actual contents of the zipfile. """ self._check_begin_patch() if not self.dry_run: workdir = os.path.join(self._workdir,str(len(self._context_stack))) os.mkdir(workdir) t_temp = os.path.join(workdir,"contents") m_temp = os.path.join(workdir,"meta") z_temp = os.path.join(workdir,"result.zip") cur_state = self._blank_state() zfmeta = [None] # stupid lack of mutable closure variables... # First we process a set of commands to generate the zipfile metadata. def end_metadata(): if not self.dry_run: zfmeta[0] = _read_zipfile_metadata(m_temp) self.target = t_temp # Then we process a set of commands to patch the actual contents. def end_contents(): self._restore_state(cur_state) if not self.dry_run: create_zipfile(t_temp,z_temp,members=zfmeta[0].infolist()) with open(z_temp,"rb") as f: data = f.read(1024*16) while data: self.outfile.write(data) data = f.read(1024*16) zfmeta[0].close() really_rmtree(workdir) self._context_stack.append(end_contents) self._context_stack.append(end_metadata) if not self.dry_run: # Begin by writing the current zipfile metadata to a temp file. # This will be patched, then end_metadata() will be called. with open(m_temp,"wb") as f: zf = zipfile.ZipFile(self.target) try: _write_zipfile_metadata(f,zf) finally: zf.close() extract_zipfile(self.target,t_temp) self.root_dir = workdir self.target = m_temp def _do_CHMOD(self): """Execute the CHMOD command. This reads an integer from the command stream, and sets the mode of the current target to that integer. """ self._check_end_patch() mod = self._read_int() if not self.dry_run: os.chmod(self.target,mod) class Differ(object): """Class generating our patch protocol. Instances of this class can be used to generate a sequence of patch commands to transform one file/directory into another. """ def __init__(self,outfile,diff_window_size=None): if not diff_window_size: diff_window_size = DIFF_WINDOW_SIZE self.diff_window_size = diff_window_size self.outfile = outfile self._pending_pop_path = 0 def _write(self,data): self.outfile.write(data) def _write_int(self,i): _write_vint(self.outfile,i) def _write_command(self,cmd): """Write the given command to the stream. This does some simple optimisations to collapse sequences of commands into a single command - current only around path manipulation. """ # Gather up POP_PATH instructions, we may be able to eliminate them. if cmd == POP_PATH: self._pending_pop_path += 1 # If POP_PATH is followed by something else, try to eliminate. elif self._pending_pop_path: # POP_PATH,JOIN_PATH => POP_JOIN_PATH if cmd == JOIN_PATH: for _ in xrange(self._pending_pop_path - 1): _write_vint(self.outfile,POP_PATH) _write_vint(self.outfile,POP_JOIN_PATH) # POP_PATH,SET_PATH => SET_PATH elif cmd == SET_PATH: _write_vint(self.outfile,SET_PATH) # Otherwise, write out all the POP_PATH instructions. else: for _ in xrange(self._pending_pop_path): _write_vint(self.outfile,POP_PATH) _write_vint(self.outfile,cmd) self._pending_pop_path = 0 else: _write_vint(self.outfile,cmd) def _write_bytes(self,bytes): _write_vint(self.outfile,len(bytes)) self._write(bytes) def _write_path(self,path): self._write_bytes(path.encode("utf8")) def diff(self,source,target): """Generate patch commands to transform source into target. 'source' and 'target' must be paths to a file or directory. Patch protocol commands to transform 'source' into 'target' will be generated and written sequentially to the output file. """ source = os.path.abspath(source) target = os.path.abspath(target) self._write(PATCH_HEADER) self._write_int(HIGHEST_VERSION) self._diff(source,target) self._write_command(SET_PATH) self._write_bytes("".encode("ascii")) self._write_command(VERIFY_MD5) self._write(calculate_digest(target,hashlib.md5)) def _diff(self,source,target): """Recursively generate patch commands to transform source into target. This is the workhorse for the diff() method - it recursively generates the patch commands for a given (source,target) pair. The main diff() method adds some header and footer commands. """ if os.path.isdir(target): self._diff_dir(source,target) elif os.path.isfile(target): self._diff_file(source,target) else: # We can't deal with any other objects for the moment. # Could eventually add support for e.g. symlinks. raise DiffError("unknown filesystem object: " + target) def _diff_dir(self,source,target): """Generate patch commands for when the target is a directory.""" # If it's not already a directoy, make it one. if not os.path.isdir(source): self._write_command(MAKEDIR) # For each new item try to find a sibling to copy/move from. # This might generate a few spurious COPY_FROM and REMOVE commands, # but in return we get a better chance of diffing against something. nm_sibnm_map = {} sibnm_nm_map = {} for nm in os.listdir(target): s_nm = os.path.join(source,nm) if not os.path.exists(s_nm): sibnm = self._find_similar_sibling(source,target,nm) if sibnm is not None: nm_sibnm_map[nm] = sibnm try: sibnm_nm_map[sibnm].append(nm) except KeyError: sibnm_nm_map[sibnm] = [nm] # Now generate COPY or MOVE commands for all those new items. # Doing them all in a batch means we gracefully cope with # several tagrgets coming from the same source. for nm, sibnm in nm_sibnm_map.iteritems(): s_nm = os.path.join(source,sibnm) self._write_command(JOIN_PATH) self._write_path(nm) if os.path.exists(os.path.join(target,sibnm)): self._write_command(COPY_FROM) elif len(sibnm_nm_map[sibnm]) > 1: self._write_command(COPY_FROM) else: self._write_command(MOVE_FROM) self._write_path(sibnm) sibnm_nm_map[sibnm].remove(nm) self._write_command(POP_PATH) # Every target item now has a source. Diff against it. for nm in os.listdir(target): try: s_nm = os.path.join(source,nm_sibnm_map[nm]) except KeyError: s_nm = os.path.join(source,nm) t_nm = os.path.join(target,nm) # Recursively diff against the selected source. if paths_differ(s_nm,t_nm): self._write_command(JOIN_PATH) self._write_path(nm) self._diff(s_nm,t_nm) self._write_command(POP_PATH) # Clean up .pyc files, as they can be generated automatically # and cause digest verification to fail. if nm.endswith(".py"): if not os.path.exists(t_nm+"c"): self._write_command(JOIN_PATH) self._write_path(nm+"c") self._write_command(REMOVE) self._write_command(POP_PATH) if not os.path.exists(t_nm+"o"): self._write_command(JOIN_PATH) self._write_path(nm+"o") self._write_command(REMOVE) self._write_command(POP_PATH) # Remove anything that's no longer in the target dir if os.path.isdir(source): for nm in os.listdir(source): if not os.path.exists(os.path.join(target,nm)): if nm not in sibnm_nm_map: self._write_command(JOIN_PATH) self._write_path(nm) self._write_command(REMOVE) self._write_command(POP_PATH) # Adjust mode if necessary t_mod = os.stat(target).st_mode if os.path.isdir(source): s_mod = os.stat(source).st_mode if s_mod != t_mod: self._write_command(CHMOD) self._write_int(t_mod) else: self._write_command(CHMOD) self._write_int(t_mod) def _diff_file(self,source,target): """Generate patch commands for when the target is a file.""" if paths_differ(source,target): if not os.path.isfile(source): self._diff_binary_file(source,target) elif target.endswith(".zip") and source.endswith(".zip"): self._diff_dotzip_file(source,target) else: self._diff_binary_file(source,target) # Adjust mode if necessary t_mod = os.stat(target).st_mode if os.path.isfile(source): s_mod = os.stat(source).st_mode if s_mod != t_mod: self._write_command(CHMOD) self._write_int(t_mod) else: self._write_command(CHMOD) self._write_int(t_mod) def _open_and_check_zipfile(self,path): """Open the given path as a zipfile, and check its suitability. Returns either the ZipFile object, or None if we can't diff it as a zipfile. """ try: zf = zipfile.ZipFile(path,"r") except (zipfile.BadZipfile,zipfile.LargeZipFile): return None else: # Diffing empty zipfiles is kinda pointless if not zf.filelist: zf.close() return None # Can't currently handle zipfiles with comments if zf.comment: zf.close() return None # Can't currently handle zipfiles with prepended data if zf.filelist[0].header_offset != 0: zf.close() return None # Hooray! Looks like something we can use. return zf def _diff_dotzip_file(self,source,target): s_zf = self._open_and_check_zipfile(source) if s_zf is None: self._diff_binary_file(source,target) else: t_zf = self._open_and_check_zipfile(target) if t_zf is None: s_zf.close() self._diff_binary_file(source,target) else: try: self._write_command(PF_REC_ZIP) with _tempdir() as workdir: # Write commands to transform source metadata file # into target metadata file. s_meta = os.path.join(workdir,"s_meta") with open(s_meta,"wb") as f: _write_zipfile_metadata(f,s_zf) t_meta = os.path.join(workdir,"t_meta") with open(t_meta,"wb") as f: _write_zipfile_metadata(f,t_zf) self._diff_binary_file(s_meta,t_meta) self._write_command(END) # Write commands to transform source contents # directory into target contents directory. s_workdir = os.path.join(workdir,"source") t_workdir = os.path.join(workdir,"target") extract_zipfile(source,s_workdir) extract_zipfile(target,t_workdir) self._diff(s_workdir,t_workdir) self._write_command(END) finally: t_zf.close() s_zf.close() def _diff_binary_file(self,source,target): """Diff a generic binary file. This is the per-file diffing method used when we don't know enough about the file to do anything fancier. It's basically a windowed bsdiff. """ spos = 0 with open(target,"rb") as tfile: if os.path.isfile(source): sfile = open(source,"rb") else: sfile = None try: # Process the file in diff_window_size blocks. This # will produce slightly bigger patches but we avoid # running out of memory for large files. tdata = tfile.read(self.diff_window_size) if not tdata: # The file is empty, do a raw insert of zero bytes. self._write_command(PF_INS_RAW) self._write_bytes("".encode("ascii")) else: while tdata: sdata = b"" if sfile is not None: sdata = sfile.read(self.diff_window_size) # Look for a shared prefix. i = 0; maxi = min(len(tdata),len(sdata)) while i < maxi and tdata[i] == sdata[i]: i += 1 # Copy it in directly, unless it's tiny. if i > 8: skipbytes = sfile.tell() - len(sdata) - spos if skipbytes > 0: self._write_command(PF_SKIP) self._write_int(skipbytes) spos += skipbytes self._write_command(PF_COPY) self._write_int(i) tdata = tdata[i:]; sdata = sdata[i:] spos += i # Write the rest of the block as a diff if tdata: spos += self._write_file_patch(sdata,tdata) tdata = tfile.read(self.diff_window_size) finally: if sfile is not None: sfile.close() def _find_similar_sibling(self,source,target,nm): """Find a sibling of an entry against which we can calculate a diff. Given two directories 'source' and 'target' and an entry from the target directory 'nm', this function finds an entry from the source directory that we can diff against to produce 'nm'. The idea here is to detect files or directories that have been moved, and avoid generating huge patches by diffing against the original. We use some pretty simple heuristics but it can make a big difference. """ t_nm = os.path.join(target,nm) if os.path.isfile(t_nm): # For files, I haven't decided on a good heuristic yet... return None elif os.path.isdir(t_nm): # For directories, decide similarity based on the number of # entry names they have in common. This is very simple but should # work well for the use cases we're facing in esky. if not os.path.isdir(source): return None t_names = set(os.listdir(t_nm)) best = (2,None) for sibnm in os.listdir(source): if not os.path.isdir(os.path.join(source,sibnm)): continue if os.path.exists(os.path.join(target,sibnm)): continue sib_names = set(os.listdir(os.path.join(source,sibnm))) cur = (len(sib_names & t_names),sibnm) if cur > best: best = cur return best[1] else: return None def _write_file_patch(self,sdata,tdata): """Write a series of PF_* commands to generate tdata from sdata. This function tries the various PF_* commands to find the one which can generate tdata from sdata with the smallest command size. Usually that will be BSDIFF4, but you never know :-) """ options = [] # We could just include the raw data options.append((0,PF_INS_RAW,tdata)) # We could bzip2 the raw data options.append((0,PF_INS_BZ2,bz2.compress(tdata))) # We could bsdiff4 the data, if we have an appropriate module if bsdiff4.diff is not None: patch_data = bsdiff4.diff(sdata,tdata) # remove the 8 header bytes, we know it's BSDIFF4 format options.append((len(sdata),PF_BSDIFF4,len(sdata),patch_data[8:])) # Find the option with the smallest data and use that. options = [(len(cmd[-1]),cmd) for cmd in options] options.sort() best_option = options[0][1] self._write_command(best_option[1]) for arg in best_option[2:]: if isinstance(arg,(str,unicode,bytes)): self._write_bytes(arg) else: self._write_int(arg) return best_option[0] class _tempdir(object): def __init__(self): self.path = tempfile.mkdtemp() def __enter__(self): return self.path def __exit__(self,*args): really_rmtree(self.path) def _decode_offt(bytes): """Decode an off_t value from a string. This decodes a signed integer into 8 bytes. I'd prefer some sort of signed vint representation, but this is the format used by bsdiff4. """ if sys.version_info[0] < 3: bytes = map(ord,bytes) x = bytes[7] & 0x7F for b in xrange(6,-1,-1): x = x * 256 + bytes[b] if bytes[7] & 0x80: x = -x return x def _encode_offt(x): """Encode an off_t value as a string. This encodes a signed integer into 8 bytes. I'd prefer some sort of signed vint representation, but this is the format used by bsdiff4. """ if x < 0: x = -x sign = 0x80 else: sign = 0 bs = [0]*8 bs[0] = x % 256 for b in xrange(7): x = (x - bs[b]) / 256 bs[b+1] = x % 256 bs[7] |= sign if sys.version_info[0] < 3: return "".join(map(chr,bs)) else: return bytes(bs) def main(args): """Command-line diffing and patching for esky.""" parser = optparse.OptionParser() parser.add_option("-z","--zipped",action="store_true",dest="zipped", help="work with zipped source/target dirs") parser.add_option("-Z","--deep-zipped",action="store_true", dest="deep_zipped", help="work with deep zipped source/target dirs") parser.add_option("","--diff-window",dest="diff_window",metavar="N", help="set the window size for diffing files") parser.add_option("","--dry-run",dest="dry_run",action="store_true", help="print commands instead of executing them") (opts,args) = parser.parse_args(args) if opts.deep_zipped: opts.zipped = True if opts.zipped: workdir = tempfile.mkdtemp() if opts.diff_window: scale = 1 if opts.diff_window[-1].lower() == "k": scale = 1024 opts.diff_window = opts.diff_window[:-1] elif opts.diff_window[-1].lower() == "m": scale = 1024 * 1024 opts.diff_window = opts.diff_window[:-1] elif opts.diff_window[-1].lower() == "g": scale = 1024 * 1024 * 1024 opts.diff_window = opts.diff_window[:-1] opts.diff_window = int(float(opts.diff_window)*scale) stream = None try: cmd = args[0] if cmd == "diff": # Generate a diff between two files/directories. # If --zipped is specified, the source and/or target is unzipped # to a temporary directory before processing. source = args[1] target = args[2] if len(args) > 3: stream = open(args[3],"wb") else: stream = sys.stdout if opts.zipped: if os.path.isfile(source): source_zip = source source = os.path.join(workdir,"source") if opts.deep_zipped: deep_extract_zipfile(source_zip,source) else: extract_zipfile(source_zip,source) if os.path.isfile(target): target_zip = target target = os.path.join(workdir,"target") if opts.deep_zipped: deep_extract_zipfile(target_zip,target) else: extract_zipfile(target_zip,target) write_patch(source,target,stream,diff_window_size=opts.diff_window) elif cmd == "patch": # Patch a file or directory. # If --zipped is specified, the target is unzipped to a temporary # directory before processing, then overwritten with a zipfile # containing the new directory contents. target = args[1] if len(args) > 2: stream = open(args[2],"rb") else: stream = sys.stdin target_zip = None if opts.zipped: if os.path.isfile(target): target_zip = target target = os.path.join(workdir,"target") if opts.deep_zipped: deep_extract_zipfile(target_zip,target) else: extract_zipfile(target_zip,target) apply_patch(target,stream,dry_run=opts.dry_run) if opts.zipped and target_zip is not None: target_dir = os.path.dirname(target_zip) (fd,target_temp) = tempfile.mkstemp(dir=target_dir) os.close(fd) if opts.deep_zipped: prefix = zipfile_common_prefix_dir(target_zip) def name_filter(nm): return prefix + nm create_zipfile(target,target_temp,name_filter) else: create_zipfile(target,target_temp) if sys.platform == "win32": os.unlink(target_zip) time.sleep(0.01) really_rename(target_temp,target_zip) else: raise ValueError("invalid command: " + cmd) finally: if stream is not None: if stream not in (sys.stdin,sys.stdout,): stream.close() if opts.zipped: really_rmtree(workdir) if __name__ == "__main__": main(sys.argv[1:])
bsd-3-clause
nextgis/osm_adm
ru_classifier/oktmo/mosclassific.py
1
4088
#!/usr/bin/env python # -*- coding: utf-8 -*- from urllib2 import Request, urlopen, HTTPError import re from BeautifulSoup import BeautifulSoup import sys reload(sys) sys.setdefaultencoding("utf-8") from sys import stderr import time UA = 'Mozilla/5.0 (compatible; MSIE 5.5; Windows NT)' def _fetch_page(url): print >> stderr, '[F] %s' % url # банят по User-Agent-у, поэтому добавим туда время req = Request(url, headers={ 'User-Agent' : UA + "(%d)" % time.time()}) page = None while not page: try: page = urlopen(req) soup = BeautifulSoup(page) except HTTPError: print >> stderr, "[F] - не получилось: ждем 5 минут" time.sleep(300) return soup def fetch_level1(): # загрузка кодов первого уровня (а-ля субъекты) # генератор ( code, raw ) page = _fetch_page('http://www.mosclassific.ru/mClass/oktmo_view.php') for o in page.find('select', attrs={'name' : 'type'}).findAll('option'): yield (o.attrs[0][1], o.find(text=True)) def fetch_level2(level1): # элементы второго уровня # генератор ( code, raw ) page = _fetch_page('http://www.mosclassific.ru/mClass/oktmo_view.php?type=%s' % level1) for o in page.find('select', attrs={'name' : 'zone'}).findAll('option'): yield (level1 + o.attrs[0][1], o.find(text=True)) def fetch_list(level1, level2): # лимита в 64k должно хватить каждому # генератор ( code, raw ) page = _fetch_page('http://www.mosclassific.ru/mClass/oktmo_view.php?type=%s&zone=%s&filter=65535' % (level1, level2)) for tr in page.findAll('tr'): # print tr tds = tr.findAll('td', text=True) if len(tds) <> 2: continue (code, raw) = tds if not code.startswith(level1 + level2): continue yield (code, raw) def fetch_detail(code): # детальные зaписи # генерирует (okato_code, settlement_name) settlement_names = [] okato_codes = [] page = _fetch_page('http://www.mosclassific.ru/mClass/oktmo_viewd.php?id=%s' % code) for tr in page.findAll('tr'): tds = tr.findAll('td') if len(tds) <> 2: continue if tds[0].text == "Наименование НП по законодательству:": settlement_names = tds[1].findAll(text=True) if tds[0].text == "Код ОКАТО населенного пункта:": okato_codes = tds[1].findAll(text=True) if len(settlement_names) == 0 or len(okato_codes) == 0: print >> stderr, '[W] %s - нет информации о населенных пунктах или кодах ОКАТО' % code if len(settlement_names) <> len(okato_codes): print >> stderr, '[W] %s - разное количество наименований и кодов НП' % code # чтобы не плодить ошибок выводим только коды ОКАТО for o in okato_codes: yield (o, ) else: for ind in range(0, len(okato_codes)): yield (okato_codes[ind], settlement_names[ind]) def fill(v): while len(v) < 8: v = v + '0' return v def _print(t, indent=0): l = list(t) l[0] = fill(l[0]) print "\t".join(l) def fetch(): for l1 in fetch_level1(): _print(l1) for ol in fetch_detail(fill(l1[0])): _print(ol) print '' for l2 in fetch_level2(l1[0]): _print(l2) for ol in fetch_detail(fill(l2[0])): _print(ol) print '' for i in fetch_list(l1[0], l2[0][-1]): _print(i) if not i[0].endswith('00') or i[0].endswith('000'): # с двумя последними нулями - группировочные позиции, в них нет НП for okato_link in fetch_detail(i[0]): _print(okato_link) # time.sleep(0.5) # пустая строка - конец ОКАТО кодов print '';
gpl-2.0
cfg2015/EPT-2015-2
openerp/service/db.py
230
13586
# -*- coding: utf-8 -*- import json import logging import os import shutil import tempfile import threading import traceback import zipfile from functools import wraps from contextlib import closing import psycopg2 import openerp from openerp import SUPERUSER_ID from openerp.exceptions import Warning import openerp.release import openerp.sql_db import openerp.tools import security _logger = logging.getLogger(__name__) class DatabaseExists(Warning): pass # This should be moved to openerp.modules.db, along side initialize(). def _initialize_db(id, db_name, demo, lang, user_password): try: db = openerp.sql_db.db_connect(db_name) with closing(db.cursor()) as cr: # TODO this should be removed as it is done by RegistryManager.new(). openerp.modules.db.initialize(cr) openerp.tools.config['lang'] = lang cr.commit() registry = openerp.modules.registry.RegistryManager.new( db_name, demo, None, update_module=True) with closing(db.cursor()) as cr: if lang: modobj = registry['ir.module.module'] mids = modobj.search(cr, SUPERUSER_ID, [('state', '=', 'installed')]) modobj.update_translations(cr, SUPERUSER_ID, mids, lang) # update admin's password and lang values = {'password': user_password, 'lang': lang} registry['res.users'].write(cr, SUPERUSER_ID, [SUPERUSER_ID], values) cr.execute('SELECT login, password FROM res_users ORDER BY login') cr.commit() except Exception, e: _logger.exception('CREATE DATABASE failed:') def dispatch(method, params): if method in ['create', 'get_progress', 'drop', 'dump', 'restore', 'rename', 'change_admin_password', 'migrate_databases', 'create_database', 'duplicate_database']: passwd = params[0] params = params[1:] security.check_super(passwd) elif method in ['db_exist', 'list', 'list_lang', 'server_version']: # params = params # No security check for these methods pass else: raise KeyError("Method not found: %s" % method) fn = globals()['exp_' + method] return fn(*params) def _create_empty_database(name): db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: chosen_template = openerp.tools.config['db_template'] cr.execute("SELECT datname FROM pg_database WHERE datname = %s", (name,)) if cr.fetchall(): raise DatabaseExists("database %r already exists!" % (name,)) else: cr.autocommit(True) # avoid transaction block cr.execute("""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "%s" """ % (name, chosen_template)) def exp_create_database(db_name, demo, lang, user_password='admin'): """ Similar to exp_create but blocking.""" _logger.info('Create database `%s`.', db_name) _create_empty_database(db_name) _initialize_db(id, db_name, demo, lang, user_password) return True def exp_duplicate_database(db_original_name, db_name): _logger.info('Duplicate database `%s` to `%s`.', db_original_name, db_name) openerp.sql_db.close_db(db_original_name) db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: cr.autocommit(True) # avoid transaction block _drop_conn(cr, db_original_name) cr.execute("""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "%s" """ % (db_name, db_original_name)) from_fs = openerp.tools.config.filestore(db_original_name) to_fs = openerp.tools.config.filestore(db_name) if os.path.exists(from_fs) and not os.path.exists(to_fs): shutil.copytree(from_fs, to_fs) return True def _drop_conn(cr, db_name): # Try to terminate all other connections that might prevent # dropping the database try: # PostgreSQL 9.2 renamed pg_stat_activity.procpid to pid: # http://www.postgresql.org/docs/9.2/static/release-9-2.html#AEN110389 pid_col = 'pid' if cr._cnx.server_version >= 90200 else 'procpid' cr.execute("""SELECT pg_terminate_backend(%(pid_col)s) FROM pg_stat_activity WHERE datname = %%s AND %(pid_col)s != pg_backend_pid()""" % {'pid_col': pid_col}, (db_name,)) except Exception: pass def exp_drop(db_name): if db_name not in exp_list(True): return False openerp.modules.registry.RegistryManager.delete(db_name) openerp.sql_db.close_db(db_name) db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: cr.autocommit(True) # avoid transaction block _drop_conn(cr, db_name) try: cr.execute('DROP DATABASE "%s"' % db_name) except Exception, e: _logger.error('DROP DB: %s failed:\n%s', db_name, e) raise Exception("Couldn't drop database %s: %s" % (db_name, e)) else: _logger.info('DROP DB: %s', db_name) fs = openerp.tools.config.filestore(db_name) if os.path.exists(fs): shutil.rmtree(fs) return True def exp_dump(db_name): with tempfile.TemporaryFile() as t: dump_db(db_name, t) t.seek(0) return t.read().encode('base64') def dump_db_manifest(cr): pg_version = "%d.%d" % divmod(cr._obj.connection.server_version / 100, 100) cr.execute("SELECT name, latest_version FROM ir_module_module WHERE state = 'installed'") modules = dict(cr.fetchall()) manifest = { 'odoo_dump': '1', 'db_name': cr.dbname, 'version': openerp.release.version, 'version_info': openerp.release.version_info, 'major_version': openerp.release.major_version, 'pg_version': pg_version, 'modules': modules, } return manifest def dump_db(db_name, stream, backup_format='zip'): """Dump database `db` into file-like object `stream` if stream is None return a file object with the dump """ _logger.info('DUMP DB: %s format %s', db_name, backup_format) cmd = ['pg_dump', '--no-owner'] if openerp.tools.config['db_user']: cmd.append('--username=' + openerp.tools.config['db_user']) if openerp.tools.config['db_host']: cmd.append('--host=' + openerp.tools.config['db_host']) if openerp.tools.config['db_port']: cmd.append('--port=' + str(openerp.tools.config['db_port'])) cmd.append(db_name) if backup_format == 'zip': with openerp.tools.osutil.tempdir() as dump_dir: filestore = openerp.tools.config.filestore(db_name) if os.path.exists(filestore): shutil.copytree(filestore, os.path.join(dump_dir, 'filestore')) with open(os.path.join(dump_dir, 'manifest.json'), 'w') as fh: db = openerp.sql_db.db_connect(db_name) with db.cursor() as cr: json.dump(dump_db_manifest(cr), fh, indent=4) cmd.insert(-1, '--file=' + os.path.join(dump_dir, 'dump.sql')) openerp.tools.exec_pg_command(*cmd) if stream: openerp.tools.osutil.zip_dir(dump_dir, stream, include_dir=False, fnct_sort=lambda file_name: file_name != 'dump.sql') else: t=tempfile.TemporaryFile() openerp.tools.osutil.zip_dir(dump_dir, t, include_dir=False, fnct_sort=lambda file_name: file_name != 'dump.sql') t.seek(0) return t else: cmd.insert(-1, '--format=c') stdin, stdout = openerp.tools.exec_pg_command_pipe(*cmd) if stream: shutil.copyfileobj(stdout, stream) else: return stdout def exp_restore(db_name, data, copy=False): data_file = tempfile.NamedTemporaryFile(delete=False) try: data_file.write(data.decode('base64')) data_file.close() restore_db(db_name, data_file.name, copy=copy) finally: os.unlink(data_file.name) return True def restore_db(db, dump_file, copy=False): assert isinstance(db, basestring) if exp_db_exist(db): _logger.warning('RESTORE DB: %s already exists', db) raise Exception("Database already exists") _create_empty_database(db) filestore_path = None with openerp.tools.osutil.tempdir() as dump_dir: if zipfile.is_zipfile(dump_file): # v8 format with zipfile.ZipFile(dump_file, 'r') as z: # only extract known members! filestore = [m for m in z.namelist() if m.startswith('filestore/')] z.extractall(dump_dir, ['dump.sql'] + filestore) if filestore: filestore_path = os.path.join(dump_dir, 'filestore') pg_cmd = 'psql' pg_args = ['-q', '-f', os.path.join(dump_dir, 'dump.sql')] else: # <= 7.0 format (raw pg_dump output) pg_cmd = 'pg_restore' pg_args = ['--no-owner', dump_file] args = [] if openerp.tools.config['db_user']: args.append('--username=' + openerp.tools.config['db_user']) if openerp.tools.config['db_host']: args.append('--host=' + openerp.tools.config['db_host']) if openerp.tools.config['db_port']: args.append('--port=' + str(openerp.tools.config['db_port'])) args.append('--dbname=' + db) pg_args = args + pg_args if openerp.tools.exec_pg_command(pg_cmd, *pg_args): raise Exception("Couldn't restore database") registry = openerp.modules.registry.RegistryManager.new(db) with registry.cursor() as cr: if copy: # if it's a copy of a database, force generation of a new dbuuid registry['ir.config_parameter'].init(cr, force=True) if filestore_path: filestore_dest = registry['ir.attachment']._filestore(cr, SUPERUSER_ID) shutil.move(filestore_path, filestore_dest) if openerp.tools.config['unaccent']: try: with cr.savepoint(): cr.execute("CREATE EXTENSION unaccent") except psycopg2.Error: pass _logger.info('RESTORE DB: %s', db) def exp_rename(old_name, new_name): openerp.modules.registry.RegistryManager.delete(old_name) openerp.sql_db.close_db(old_name) db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: cr.autocommit(True) # avoid transaction block _drop_conn(cr, old_name) try: cr.execute('ALTER DATABASE "%s" RENAME TO "%s"' % (old_name, new_name)) _logger.info('RENAME DB: %s -> %s', old_name, new_name) except Exception, e: _logger.error('RENAME DB: %s -> %s failed:\n%s', old_name, new_name, e) raise Exception("Couldn't rename database %s to %s: %s" % (old_name, new_name, e)) old_fs = openerp.tools.config.filestore(old_name) new_fs = openerp.tools.config.filestore(new_name) if os.path.exists(old_fs) and not os.path.exists(new_fs): shutil.move(old_fs, new_fs) return True @openerp.tools.mute_logger('openerp.sql_db') def exp_db_exist(db_name): ## Not True: in fact, check if connection to database is possible. The database may exists return bool(openerp.sql_db.db_connect(db_name)) def exp_list(document=False): if not openerp.tools.config['list_db'] and not document: raise openerp.exceptions.AccessDenied() chosen_template = openerp.tools.config['db_template'] templates_list = tuple(set(['template0', 'template1', 'postgres', chosen_template])) db = openerp.sql_db.db_connect('postgres') with closing(db.cursor()) as cr: try: db_user = openerp.tools.config["db_user"] if not db_user and os.name == 'posix': import pwd db_user = pwd.getpwuid(os.getuid())[0] if not db_user: cr.execute("select usename from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (openerp.tools.config["db_name"],)) res = cr.fetchone() db_user = res and str(res[0]) if db_user: cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in %s order by datname", (db_user, templates_list)) else: cr.execute("select datname from pg_database where datname not in %s order by datname", (templates_list,)) res = [openerp.tools.ustr(name) for (name,) in cr.fetchall()] except Exception: res = [] res.sort() return res def exp_change_admin_password(new_password): openerp.tools.config['admin_passwd'] = new_password openerp.tools.config.save() return True def exp_list_lang(): return openerp.tools.scan_languages() def exp_server_version(): """ Return the version of the server Used by the client to verify the compatibility with its own version """ return openerp.release.version def exp_migrate_databases(databases): for db in databases: _logger.info('migrate database %s', db) openerp.tools.config['update']['base'] = True openerp.modules.registry.RegistryManager.new(db, force_demo=False, update_module=True) return True
agpl-3.0
chemelnucfin/tensorflow
tensorflow/python/training/optimizer.py
1
49527
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Base class for optimizers.""" # pylint: disable=g-bad-name from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc import six from tensorflow.python.distribute import distribute_lib from tensorflow.python.distribute import distribution_strategy_context as distribute_ctx from tensorflow.python.distribute import reduce_util as ds_reduce_util from tensorflow.python.eager import backprop from tensorflow.python.eager import context from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import gradients from tensorflow.python.ops import math_ops from tensorflow.python.ops import resource_variable_ops from tensorflow.python.ops import state_ops from tensorflow.python.ops import variable_scope from tensorflow.python.ops import variables from tensorflow.python.training import slot_creator from tensorflow.python.training.tracking import base as trackable from tensorflow.python.util import nest from tensorflow.python.util.tf_export import tf_export def get_filtered_grad_fn(grad_fn): # `distributed_context.join()` requires that its arguments are parallel # across threads, and in particular that `grads_and_vars` has the same # variables in the same order. # When computing gradients in eager mode with multiple threads, you # can get extra variables with a gradient of `None`. This happens when # those variables are accessed in another thread during the gradient # computation. To get a consistent set of variables, we filter out # those with `None` gradients. def filtered_grad_fn(*args, **kwargs): return [(g, v) for g, v in grad_fn(*args, **kwargs) if g is not None] return filtered_grad_fn def _deduplicate_indexed_slices(values, indices): """Sums `values` associated with any non-unique `indices`. Args: values: A `Tensor` with rank >= 1. indices: A one-dimensional integer `Tensor`, indexing into the first dimension of `values` (as in an IndexedSlices object). Returns: A tuple of (`summed_values`, `unique_indices`) where `unique_indices` is a de-duplicated version of `indices` and `summed_values` contains the sum of `values` slices associated with each unique index. """ unique_indices, new_index_positions = array_ops.unique(indices) summed_values = math_ops.unsorted_segment_sum( values, new_index_positions, array_ops.shape(unique_indices)[0]) return (summed_values, unique_indices) def _var_key(var): # TODO(ashankar): Consolidate handling for eager and graph if hasattr(var, "op"): return (var.op.graph, var.op.name) return var._unique_id # pylint: disable=protected-access @six.add_metaclass(abc.ABCMeta) class _OptimizableVariable(object): """Interface for abstracting over variables in the optimizers.""" @abc.abstractmethod def target(self): """Returns the optimization target for this variable.""" raise NotImplementedError("Calling an abstract method.") @abc.abstractmethod def update_op(self, optimizer, g): """Returns the update ops for updating the variable.""" raise NotImplementedError("Calling an abstract method.") class _RefVariableProcessor(_OptimizableVariable): """Processor for Variable.""" def __init__(self, v): self._v = v def __str__(self): return "<_RefVariableProcessor(%s)>" % self._v def target(self): return self._v._ref() # pylint: disable=protected-access def update_op(self, optimizer, g): if isinstance(g, ops.Tensor): update_op = optimizer._apply_dense(g, self._v) # pylint: disable=protected-access if self._v.constraint is not None: with ops.control_dependencies([update_op]): return self._v.assign(self._v.constraint(self._v)) else: return update_op else: assert isinstance(g, ops.IndexedSlices), ("Gradient ", g, " is neither a " "tensor nor IndexedSlices.") if self._v.constraint is not None: raise RuntimeError( "Cannot use a constraint function on a sparse variable.") # pylint: disable=protected-access return optimizer._apply_sparse_duplicate_indices(g, self._v) class _DenseReadResourceVariableProcessor(_OptimizableVariable): """Processor for dense ResourceVariables.""" def __init__(self, v): self._v = v def target(self): return self._v def update_op(self, optimizer, g): # pylint: disable=protected-access update_op = optimizer._resource_apply_dense(g, self._v.op.inputs[0]) if self._v.constraint is not None: with ops.control_dependencies([update_op]): return self._v.assign(self._v.constraint(self._v)) else: return update_op class _DenseResourceVariableProcessor(_OptimizableVariable): """Processor for dense ResourceVariables.""" def __init__(self, v): self._v = v def target(self): return self._v def update_op(self, optimizer, g): # pylint: disable=protected-access if isinstance(g, ops.IndexedSlices): if self._v.constraint is not None: raise RuntimeError( "Cannot use a constraint function on a sparse variable.") return optimizer._resource_apply_sparse_duplicate_indices( g.values, self._v, g.indices) update_op = optimizer._resource_apply_dense(g, self._v) if self._v.constraint is not None: with ops.control_dependencies([update_op]): return self._v.assign(self._v.constraint(self._v)) else: return update_op class _TensorProcessor(_OptimizableVariable): """Processor for ordinary Tensors. Even though a Tensor can't really be updated, sometimes it is useful to compute the gradients with respect to a Tensor using the optimizer. Updating the Tensor is, of course, unsupported. """ def __init__(self, v): self._v = v def target(self): return self._v def update_op(self, optimizer, g): raise NotImplementedError("Trying to update a Tensor ", self._v) def _get_processor(v): """The processor of v.""" if context.executing_eagerly(): if isinstance(v, ops.Tensor): return _TensorProcessor(v) else: return _DenseResourceVariableProcessor(v) if resource_variable_ops.is_resource_variable(v) and not v._in_graph_mode: # pylint: disable=protected-access # True if and only if `v` was initialized eagerly. return _DenseResourceVariableProcessor(v) if v.op.type == "VarHandleOp": return _DenseResourceVariableProcessor(v) if isinstance(v, variables.Variable): return _RefVariableProcessor(v) if isinstance(v, ops.Tensor): return _TensorProcessor(v) raise NotImplementedError("Trying to optimize unsupported type ", v) @tf_export(v1=["train.Optimizer"]) class Optimizer( # Optimizers inherit from Trackable rather than AutoTrackable # since they do most of their dependency management themselves (slot # variables are special-cased, and non-slot variables are keyed to graphs). trackable.Trackable): """Base class for optimizers. This class defines the API to add Ops to train a model. You never use this class directly, but instead instantiate one of its subclasses such as `GradientDescentOptimizer`, `AdagradOptimizer`, or `MomentumOptimizer`. ### Usage ```python # Create an optimizer with the desired parameters. opt = GradientDescentOptimizer(learning_rate=0.1) # Add Ops to the graph to minimize a cost by updating a list of variables. # "cost" is a Tensor, and the list of variables contains tf.Variable # objects. opt_op = opt.minimize(cost, var_list=<list of variables>) ``` In the training program you will just have to run the returned Op. ```python # Execute opt_op to do one step of training: opt_op.run() ``` ### Processing gradients before applying them. Calling `minimize()` takes care of both computing the gradients and applying them to the variables. If you want to process the gradients before applying them you can instead use the optimizer in three steps: 1. Compute the gradients with `compute_gradients()`. 2. Process the gradients as you wish. 3. Apply the processed gradients with `apply_gradients()`. Example: ```python # Create an optimizer. opt = GradientDescentOptimizer(learning_rate=0.1) # Compute the gradients for a list of variables. grads_and_vars = opt.compute_gradients(loss, <list of variables>) # grads_and_vars is a list of tuples (gradient, variable). Do whatever you # need to the 'gradient' part, for example cap them, etc. capped_grads_and_vars = [(MyCapper(gv[0]), gv[1]) for gv in grads_and_vars] # Ask the optimizer to apply the capped gradients. opt.apply_gradients(capped_grads_and_vars) ``` ### Gating Gradients Both `minimize()` and `compute_gradients()` accept a `gate_gradients` argument that controls the degree of parallelism during the application of the gradients. The possible values are: `GATE_NONE`, `GATE_OP`, and `GATE_GRAPH`. <b>`GATE_NONE`</b>: Compute and apply gradients in parallel. This provides the maximum parallelism in execution, at the cost of some non-reproducibility in the results. For example the two gradients of `matmul` depend on the input values: With `GATE_NONE` one of the gradients could be applied to one of the inputs _before_ the other gradient is computed resulting in non-reproducible results. <b>`GATE_OP`</b>: For each Op, make sure all gradients are computed before they are used. This prevents race conditions for Ops that generate gradients for multiple inputs where the gradients depend on the inputs. <b>`GATE_GRAPH`</b>: Make sure all gradients for all variables are computed before any one of them is used. This provides the least parallelism but can be useful if you want to process all gradients before applying any of them. ### Slots Some optimizer subclasses, such as `MomentumOptimizer` and `AdagradOptimizer` allocate and manage additional variables associated with the variables to train. These are called <i>Slots</i>. Slots have names and you can ask the optimizer for the names of the slots that it uses. Once you have a slot name you can ask the optimizer for the variable it created to hold the slot value. This can be useful if you want to log debug a training algorithm, report stats about the slots, etc. """ # Values for gate_gradients. GATE_NONE = 0 GATE_OP = 1 GATE_GRAPH = 2 def __init__(self, use_locking, name): """Create a new Optimizer. This must be called by the constructors of subclasses. Args: use_locking: Bool. If True apply use locks to prevent concurrent updates to variables. name: A non-empty string. The name to use for accumulators created for the optimizer. Raises: ValueError: If name is malformed. """ if not name: raise ValueError("Must specify the optimizer name") self._use_locking = use_locking self._name = name # Dictionary of slots. # {slot_name : # {_var_key(variable_to_train): slot_for_the_variable, ... }, # ... } self._slots = {} self._non_slot_dict = {} # For implementing Trackable. Stores information about how to restore # slot variables which have not yet been created # (trackable._CheckpointPosition objects). # {slot_name : # {_var_key(variable_to_train): [checkpoint_position, ... ], ... }, # ... } self._deferred_slot_restorations = {} # TODO(isaprykin): When using a DistributionStrategy, and when an # optimizer is created in each replica, it might be dangerous to # rely on some Optimizer methods. When such methods are called on a # per-replica optimizer, an exception needs to be thrown. We do # allow creation per-replica optimizers however, because the # compute_gradients()->apply_gradients() sequence is safe. def get_name(self): return self._name def minimize(self, loss, global_step=None, var_list=None, gate_gradients=GATE_OP, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None): """Add operations to minimize `loss` by updating `var_list`. This method simply combines calls `compute_gradients()` and `apply_gradients()`. If you want to process the gradient before applying them call `compute_gradients()` and `apply_gradients()` explicitly instead of using this function. Args: loss: A `Tensor` containing the value to minimize. global_step: Optional `Variable` to increment by one after the variables have been updated. var_list: Optional list or tuple of `Variable` objects to update to minimize `loss`. Defaults to the list of variables collected in the graph under the key `GraphKeys.TRAINABLE_VARIABLES`. gate_gradients: How to gate the computation of gradients. Can be `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. aggregation_method: Specifies the method used to combine gradient terms. Valid values are defined in the class `AggregationMethod`. colocate_gradients_with_ops: If True, try colocating gradients with the corresponding op. name: Optional name for the returned operation. grad_loss: Optional. A `Tensor` holding the gradient computed for `loss`. Returns: An Operation that updates the variables in `var_list`. If `global_step` was not `None`, that operation also increments `global_step`. Raises: ValueError: If some of the variables are not `Variable` objects. @compatibility(eager) When eager execution is enabled, `loss` should be a Python function that takes no arguments and computes the value to be minimized. Minimization (and gradient computation) is done with respect to the elements of `var_list` if not None, else with respect to any trainable variables created during the execution of the `loss` function. `gate_gradients`, `aggregation_method`, `colocate_gradients_with_ops` and `grad_loss` are ignored when eager execution is enabled. @end_compatibility """ grads_and_vars = self.compute_gradients( loss, var_list=var_list, gate_gradients=gate_gradients, aggregation_method=aggregation_method, colocate_gradients_with_ops=colocate_gradients_with_ops, grad_loss=grad_loss) vars_with_grad = [v for g, v in grads_and_vars if g is not None] if not vars_with_grad: raise ValueError( "No gradients provided for any variable, check your graph for ops" " that do not support gradients, between variables %s and loss %s." % ([str(v) for _, v in grads_and_vars], loss)) return self.apply_gradients(grads_and_vars, global_step=global_step, name=name) def compute_gradients(self, loss, var_list=None, gate_gradients=GATE_OP, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None): """Compute gradients of `loss` for the variables in `var_list`. This is the first part of `minimize()`. It returns a list of (gradient, variable) pairs where "gradient" is the gradient for "variable". Note that "gradient" can be a `Tensor`, an `IndexedSlices`, or `None` if there is no gradient for the given variable. Args: loss: A Tensor containing the value to minimize or a callable taking no arguments which returns the value to minimize. When eager execution is enabled it must be a callable. var_list: Optional list or tuple of `tf.Variable` to update to minimize `loss`. Defaults to the list of variables collected in the graph under the key `GraphKeys.TRAINABLE_VARIABLES`. gate_gradients: How to gate the computation of gradients. Can be `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. aggregation_method: Specifies the method used to combine gradient terms. Valid values are defined in the class `AggregationMethod`. colocate_gradients_with_ops: If True, try colocating gradients with the corresponding op. grad_loss: Optional. A `Tensor` holding the gradient computed for `loss`. Returns: A list of (gradient, variable) pairs. Variable is always present, but gradient can be `None`. Raises: TypeError: If `var_list` contains anything else than `Variable` objects. ValueError: If some arguments are invalid. RuntimeError: If called with eager execution enabled and `loss` is not callable. @compatibility(eager) When eager execution is enabled, `gate_gradients`, `aggregation_method`, and `colocate_gradients_with_ops` are ignored. @end_compatibility """ if callable(loss): with backprop.GradientTape() as tape: if var_list is not None: tape.watch(var_list) loss_value = loss() # Scale loss if using a "mean" loss reduction and multiple replicas. # Have to be careful to call distribute_lib.get_loss_reduction() # *after* loss() is evaluated, so we know what loss reduction it uses. # TODO(josh11b): Test that we handle weight decay in a reasonable way. loss_value = self._scale_loss(loss_value) if var_list is None: var_list = tape.watched_variables() # TODO(jhseu): Figure out why GradientTape's gradients don't require loss # to be executed. with ops.control_dependencies([loss_value]): grads = tape.gradient(loss_value, var_list, grad_loss) return list(zip(grads, var_list)) # Non-callable/Tensor loss case if context.executing_eagerly(): raise RuntimeError( "`loss` passed to Optimizer.compute_gradients should " "be a function when eager execution is enabled.") # Scale loss if using a "mean" loss reduction and multiple replicas. loss = self._scale_loss(loss) if gate_gradients not in [Optimizer.GATE_NONE, Optimizer.GATE_OP, Optimizer.GATE_GRAPH]: raise ValueError("gate_gradients must be one of: Optimizer.GATE_NONE, " "Optimizer.GATE_OP, Optimizer.GATE_GRAPH. Not %s" % gate_gradients) self._assert_valid_dtypes([loss]) if grad_loss is not None: self._assert_valid_dtypes([grad_loss]) if var_list is None: var_list = ( variables.trainable_variables() + ops.get_collection(ops.GraphKeys.TRAINABLE_RESOURCE_VARIABLES)) else: var_list = nest.flatten(var_list) # pylint: disable=protected-access var_list += ops.get_collection(ops.GraphKeys._STREAMING_MODEL_PORTS) # pylint: enable=protected-access processors = [_get_processor(v) for v in var_list] if not var_list: raise ValueError("No variables to optimize.") var_refs = [p.target() for p in processors] grads = gradients.gradients( loss, var_refs, grad_ys=grad_loss, gate_gradients=(gate_gradients == Optimizer.GATE_OP), aggregation_method=aggregation_method, colocate_gradients_with_ops=colocate_gradients_with_ops) if gate_gradients == Optimizer.GATE_GRAPH: grads = control_flow_ops.tuple(grads) grads_and_vars = list(zip(grads, var_list)) self._assert_valid_dtypes( [v for g, v in grads_and_vars if g is not None and v.dtype != dtypes.resource]) return grads_and_vars @staticmethod def _scale_loss(loss_value): ops.get_default_graph()._is_loss_scaled_by_optimizer = False # pylint: disable=protected-access if distribute_lib.get_loss_reduction() == ds_reduce_util.ReduceOp.MEAN: num_replicas = distribute_ctx.get_strategy().num_replicas_in_sync if num_replicas > 1: loss_value *= (1. / num_replicas) ops.get_default_graph()._is_loss_scaled_by_optimizer = True # pylint: disable=protected-access return loss_value def apply_gradients(self, grads_and_vars, global_step=None, name=None): """Apply gradients to variables. This is the second part of `minimize()`. It returns an `Operation` that applies gradients. Args: grads_and_vars: List of (gradient, variable) pairs as returned by `compute_gradients()`. global_step: Optional `Variable` to increment by one after the variables have been updated. name: Optional name for the returned operation. Default to the name passed to the `Optimizer` constructor. Returns: An `Operation` that applies the specified gradients. If `global_step` was not None, that operation also increments `global_step`. Raises: TypeError: If `grads_and_vars` is malformed. ValueError: If none of the variables have gradients. RuntimeError: If you should use `_distributed_apply()` instead. """ # This is a default implementation of apply_gradients() that can be shared # by most optimizers. It relies on the subclass implementing the following # methods: _create_slots(), _prepare(), _apply_dense(), and _apply_sparse(). # TODO(isaprykin): Get rid of `has_strategy()` check by # always calling _distributed_apply(), using the default distribution # as needed. if distribute_ctx.has_strategy(): # Handle DistributionStrategy case. if distribute_ctx.in_cross_replica_context(): raise RuntimeError("Use `_distributed_apply()` instead of " "`apply_gradients()` in a cross-replica context.") grads_and_vars = get_filtered_grad_fn(lambda: grads_and_vars)() return distribute_ctx.get_replica_context().merge_call( self._distributed_apply, args=(grads_and_vars, global_step, name)) # No DistributionStrategy case. grads_and_vars = tuple(grads_and_vars) # Make sure repeat iteration works. if not grads_and_vars: raise ValueError("No variables provided.") converted_grads_and_vars = [] for g, v in grads_and_vars: if g is not None: try: # Convert the grad to Tensor or IndexedSlices if necessary. g = ops.convert_to_tensor_or_indexed_slices(g) except TypeError: raise TypeError( "Gradient must be convertible to a Tensor" " or IndexedSlices, or None: %s" % g) if not isinstance(g, (ops.Tensor, ops.IndexedSlices)): raise TypeError( "Gradient must be a Tensor, IndexedSlices, or None: %s" % g) p = _get_processor(v) converted_grads_and_vars.append((g, v, p)) converted_grads_and_vars = tuple(converted_grads_and_vars) var_list = [v for g, v, _ in converted_grads_and_vars if g is not None] if not var_list: raise ValueError("No gradients provided for any variable: %s." % ([str(v) for _, v, _ in converted_grads_and_vars],)) with ops.init_scope(): self._create_slots(var_list) update_ops = [] with ops.name_scope(name, self._name) as name: self._prepare() for grad, var, processor in converted_grads_and_vars: if grad is None: continue # We colocate all ops created in _apply_dense or _apply_sparse # on the same device as the variable. # TODO(apassos): figure out how to get the variable name here. if (context.executing_eagerly() or isinstance(var, resource_variable_ops.BaseResourceVariable) and not var._in_graph_mode): # pylint: disable=protected-access scope_name = "" else: scope_name = var.op.name with ops.name_scope("update_" + scope_name), ops.colocate_with(var): update_ops.append(processor.update_op(self, grad)) if global_step is None: apply_updates = self._finish(update_ops, name) else: with ops.control_dependencies([self._finish(update_ops, "update")]): with ops.colocate_with(global_step): if isinstance( global_step, resource_variable_ops.BaseResourceVariable): # TODO(apassos): the implicit read in assign_add is slow; consider # making it less so. apply_updates = resource_variable_ops.assign_add_variable_op( global_step.handle, ops.convert_to_tensor(1, dtype=global_step.dtype), name=name) else: apply_updates = state_ops.assign_add(global_step, 1, name=name) if not context.executing_eagerly(): if isinstance(apply_updates, ops.Tensor): apply_updates = apply_updates.op train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP) if apply_updates not in train_op: train_op.append(apply_updates) return apply_updates def _distributed_apply(self, distribution, grads_and_vars, global_step=None, name=None): """A version of `apply_gradients` for cross-replica context. This is a version of `apply_gradients()` for when you are using a `DistributionStrategy` and are in a cross-replica context. If in a replica context, use `apply_gradients()` as normal. Args: distribution: A `DistributionStrategy` object. grads_and_vars: List of (gradient, variable) pairs as returned by `compute_gradients()`, and then aggregated across replicas. global_step: Optional (mirrored) `Variable` to increment by one after the variables have been updated. name: Optional name for the returned operation. Default to the name passed to the `Optimizer` constructor. Returns: An `Operation` that applies the specified gradients across all replicas. If `global_step` was not None, that operation also increments `global_step` """ reduced_grads = distribution.extended.batch_reduce_to( ds_reduce_util.ReduceOp.SUM, grads_and_vars) var_list = [v for _, v in grads_and_vars] grads_and_vars = zip(reduced_grads, var_list) # Note that this is called in a cross-replica context. with ops.init_scope(): self._create_slots(var_list) def update(v, g): """Apply gradients to a replica variable.""" assert v is not None try: # Convert the grad to Tensor or IndexedSlices if necessary. g = ops.convert_to_tensor_or_indexed_slices(g) except TypeError: raise TypeError("Gradient must be convertible to a Tensor" " or IndexedSlices, or None: %s" % g) if not isinstance(g, (ops.Tensor, ops.IndexedSlices)): raise TypeError( "Gradient must be a Tensor, IndexedSlices, or None: %s" % g) p = _get_processor(v) if context.executing_eagerly() or ( resource_variable_ops.is_resource_variable(v) and not v._in_graph_mode): # pylint: disable=protected-access scope_name = v.name.split(":")[0] else: scope_name = v.op.name # device_policy is set because non-mirrored tensors will be read in # `update_op`. `_resource_apply_dense`, `lr_t`, `beta1_t` and `beta2_t` # is an example. with ops.name_scope("update_" + scope_name): return p.update_op(self, g) with ops.name_scope(name, self._name) as name: self._prepare() update_ops = [ op for grad, var in grads_and_vars for op in distribution.extended.update( var, update, args=(grad,), group=False) ] def finish(self, update_ops): return self._finish(update_ops, "update") non_slot_devices = distribution.extended.non_slot_devices(var_list) finish_updates = distribution.extended.update_non_slot( non_slot_devices, finish, args=(self, update_ops), group=False) if global_step is None: apply_updates = distribution.group(finish_updates, name=name) else: with ops.control_dependencies(finish_updates): apply_updates = distribution.extended.update( global_step, state_ops.assign_add, args=(1,), kwargs={"name": name}) if not context.executing_eagerly(): if isinstance(apply_updates, ops.Tensor): apply_updates = apply_updates.op train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP) if apply_updates not in train_op: train_op.append(apply_updates) return apply_updates def get_slot(self, var, name): """Return a slot named `name` created for `var` by the Optimizer. Some `Optimizer` subclasses use additional variables. For example `Momentum` and `Adagrad` use variables to accumulate updates. This method gives access to these `Variable` objects if for some reason you need them. Use `get_slot_names()` to get the list of slot names created by the `Optimizer`. Args: var: A variable passed to `minimize()` or `apply_gradients()`. name: A string. Returns: The `Variable` for the slot if it was created, `None` otherwise. """ # pylint: disable=protected-access named_slots = self._slots.get(name, None) if not named_slots: return None if hasattr(var, "_distributed_container"): # NOTE: If this isn't patched, then there is no `handle` in # `_resource_apply_dense`. distributed_container = var._distributed_container() assert distributed_container is not None if ops.executing_eagerly_outside_functions(): key = distributed_container._unique_id else: key = (distributed_container.graph, distributed_container._shared_name) # pylint: enable=protected-access mirrored_slot = named_slots.get(key, None) if mirrored_slot is None: return None return mirrored_slot.get(device=var.device) return named_slots.get(_var_key(var), None) def get_slot_names(self): """Return a list of the names of slots created by the `Optimizer`. See `get_slot()`. Returns: A list of strings. """ return sorted(self._slots.keys()) def variables(self): """A list of variables which encode the current state of `Optimizer`. Includes slot variables and additional global variables created by the optimizer in the current default graph. Returns: A list of variables. """ current_graph = ops.get_default_graph() def _from_current_graph(variable): if variable._in_graph_mode: # pylint: disable=protected-access return variable.op.graph is current_graph else: # No variable.op in eager mode. We don't expect lots of eager graphs, # but behavior should be consistent with graph mode. return variable._graph_key == current_graph._graph_key # pylint: disable=protected-access optimizer_variables = [v for v in self._non_slot_variables() if _from_current_graph(v)] for _, variable_dict in self._slots.items(): for _, slot_for_variable in variable_dict.items(): if _from_current_graph(slot_for_variable): optimizer_variables.append(slot_for_variable) # Sort variables by name so that the return is deterministic. return sorted(optimizer_variables, key=lambda v: v.name) def _create_non_slot_variable(self, initial_value, name, colocate_with): """Add an extra variable, not associated with a slot.""" # Recommendation: Use OptimizerV2 if your optimizer uses non-slot variables. eager = context.executing_eagerly() graph = None if eager else colocate_with.graph key = (name, graph) v = self._non_slot_dict.get(key, None) if v is None: self._maybe_initialize_trackable() distribution_strategy = distribute_ctx.get_strategy() with distribution_strategy.extended.colocate_vars_with(colocate_with): if eager: restored_initial_value = self._preload_simple_restoration( name=name, shape=None) if restored_initial_value is not None: initial_value = restored_initial_value v = variable_scope.variable( initial_value, name=name, trainable=False, use_resource=resource_variable_ops.is_resource_variable( colocate_with)) # Restore this variable by name if necessary, but don't add a # Trackable dependency. Optimizers return the current graph's # non-slot variables from _checkpoint_dependencies explicitly rather # than unconditionally adding dependencies (since there may be multiple # non-slot variables with the same name in different graphs, trying to # save all of them would result in errors). self._handle_deferred_dependencies(name=name, trackable=v) self._non_slot_dict[key] = v return v @property def _checkpoint_dependencies(self): """From Trackable. Gather graph-specific non-slot variables to save.""" current_graph_non_slot_variables = [] current_graph_key = ops.get_default_graph()._graph_key # pylint: disable=protected-access for (name, _), variable_object in sorted(self._non_slot_dict.items(), # Avoid comparing graphs key=lambda item: item[0][0]): if variable_object._graph_key == current_graph_key: # pylint: disable=protected-access current_graph_non_slot_variables.append( trackable.TrackableReference( name=name, ref=variable_object)) return (super(Optimizer, self)._checkpoint_dependencies + current_graph_non_slot_variables) def _lookup_dependency(self, name): """From Trackable. Find a non-slot variable in the current graph.""" unconditional = super(Optimizer, self)._lookup_dependency(name) if unconditional is not None: return unconditional graph = None if context.executing_eagerly() else ops.get_default_graph() return self._get_non_slot_variable(name, graph=graph) def _get_non_slot_variable(self, name, graph=None): non_slot = self._non_slot_dict.get((name, graph), None) if hasattr(non_slot, "_distributed_container"): # This is a mirrored non-slot. In order to enable code like `_finish` # to assign to a non-slot, return the current context replica. return non_slot.get() else: return non_slot def _non_slot_variables(self): """Additional variables created by the `Optimizer`. Returns: A list or tuple of variables. """ return self._non_slot_dict.values() def _assert_valid_dtypes(self, tensors): """Asserts tensors are all valid types (see `_valid_dtypes`). Args: tensors: Tensors to check. Raises: ValueError: If any tensor is not a valid type. """ valid_dtypes = self._valid_dtypes() for t in tensors: dtype = t.dtype.base_dtype if dtype not in valid_dtypes: raise ValueError( "Invalid type %r for %s, expected: %s." % ( dtype, t.name, [v for v in valid_dtypes])) # -------------- # Methods to be implemented by subclasses if they want to use the # inherited implementation of apply_gradients() or compute_gradients(). # -------------- def _valid_dtypes(self): """Valid types for loss, variables and gradients. Subclasses should override to allow other float types. Returns: Valid types for loss, variables and gradients. """ return set( [dtypes.float16, dtypes.bfloat16, dtypes.float32, dtypes.float64]) def _create_slots(self, var_list): """Create all slots needed by the variables. Args: var_list: A list of `Variable` objects. """ # No slots needed by default pass def _prepare(self): """Create all needed tensors before applying gradients. This is called with the name_scope using the "name" that users have chosen for the application of gradients. """ pass def _apply_dense(self, grad, var): """Add ops to apply dense gradients to `var`. Args: grad: A `Tensor`. var: A `Variable` object. Returns: An `Operation`. """ raise NotImplementedError() def _resource_apply_dense(self, grad, handle): """Add ops to apply dense gradients to the variable `handle`. Args: grad: a `Tensor` representing the gradient. handle: a `Tensor` of dtype `resource` which points to the variable to be updated. Returns: An `Operation` which updates the value of the variable. """ raise NotImplementedError() def _resource_apply_sparse_duplicate_indices(self, grad, handle, indices): """Add ops to apply sparse gradients to `handle`, with repeated indices. Optimizers which override this method must deal with repeated indices. See the docstring of `_apply_sparse_duplicate_indices` for details. By default the correct behavior, to sum non-unique indices and their associated gradients, is enforced by first pre-processing `grad` and `indices` and passing them on to `_resource_apply_sparse`. Optimizers which deal correctly with duplicate indices may instead override this method to avoid the overhead of summing. Args: grad: a `Tensor` representing the gradient for the affected indices. handle: a `Tensor` of dtype `resource` which points to the variable to be updated. indices: a `Tensor` of integral type representing the indices for which the gradient is nonzero. Indices may be repeated. Returns: An `Operation` which updates the value of the variable. """ summed_grad, unique_indices = _deduplicate_indexed_slices( values=grad, indices=indices) return self._resource_apply_sparse(summed_grad, handle, unique_indices) def _resource_apply_sparse(self, grad, handle, indices): """Add ops to apply sparse gradients to the variable `handle`. Similar to `_apply_sparse`, the `indices` argument to this method has been de-duplicated. Optimizers which deal correctly with non-unique indices may instead override `_resource_apply_sparse_duplicate_indices` to avoid this overhead. Args: grad: a `Tensor` representing the gradient for the affected indices. handle: a `Tensor` of dtype `resource` which points to the variable to be updated. indices: a `Tensor` of integral type representing the indices for which the gradient is nonzero. Indices are unique. Returns: An `Operation` which updates the value of the variable. """ raise NotImplementedError() def _apply_sparse_duplicate_indices(self, grad, var): """Add ops to apply sparse gradients to `var`, with repeated sparse indices. Optimizers which override this method must deal with IndexedSlices objects such as the following: IndexedSlicesValue(values=[1, 1], indices=[0, 0], dense_shape=[1]) The correct interpretation is: IndexedSlicesValue(values=[2], indices=[0], dense_shape=[1]) Many optimizers deal incorrectly with repeated indices when updating based on sparse gradients (e.g. summing squares rather than squaring the sum, or applying momentum terms multiple times). Adding first is always the correct behavior, so this is enforced here by reconstructing the IndexedSlices to have only unique indices, then calling _apply_sparse. Optimizers which deal correctly with repeated indices may instead override this method to avoid the overhead of summing indices. Args: grad: `IndexedSlices`. var: A `Variable` object. Returns: An `Operation`. """ summed_values, unique_indices = _deduplicate_indexed_slices( values=grad.values, indices=grad.indices) gradient_no_duplicate_indices = ops.IndexedSlices( indices=unique_indices, values=summed_values, dense_shape=grad.dense_shape) return self._apply_sparse(gradient_no_duplicate_indices, var) def _apply_sparse(self, grad, var): """Add ops to apply sparse gradients to `var`. The IndexedSlices object passed to `grad` in this function is by default pre-processed in `_apply_sparse_duplicate_indices` to remove duplicate indices (see its docstring for details). Optimizers which can tolerate or have correct special cases for duplicate sparse indices may override `_apply_sparse_duplicate_indices` instead of this function, avoiding that overhead. Args: grad: `IndexedSlices`, with no repeated indices. var: A `Variable` object. Returns: An `Operation`. """ raise NotImplementedError() def _finish(self, update_ops, name_scope): """Do what is needed to finish the update. This is called with the `name_scope` using the "name" that users have chosen for the application of gradients. Args: update_ops: List of `Operation` objects to update variables. This list contains the values returned by the `_apply_dense()` and `_apply_sparse()` calls. name_scope: String. Name to use for the returned operation. Returns: The operation to apply updates. """ return control_flow_ops.group(*update_ops, name=name_scope) # -------------- # Utility methods for subclasses. # -------------- def _slot_dict(self, slot_name): """Returns a dict for caching slots created under the given name. Args: slot_name: Name for the slot. Returns: A dict that maps primary `Variable` objects to the slot created for that variable, under the given slot name. """ named_slots = self._slots.get(slot_name, None) if named_slots is None: named_slots = {} self._slots[slot_name] = named_slots return named_slots def _get_or_make_slot(self, var, val, slot_name, op_name): """Find or create a slot for a variable. Args: var: A `Variable` object. val: A `Tensor`. The initial value of the slot. slot_name: Name for the slot. op_name: Name to use when scoping the Variable that needs to be created for the slot. Returns: A `Variable` object. """ named_slots = self._slot_dict(slot_name) if _var_key(var) not in named_slots: new_slot_variable = slot_creator.create_slot(var, val, op_name) self._restore_slot_variable( slot_name=slot_name, variable=var, slot_variable=new_slot_variable) named_slots[_var_key(var)] = new_slot_variable return named_slots[_var_key(var)] def _get_or_make_slot_with_initializer(self, var, initializer, shape, dtype, slot_name, op_name): """Find or create a slot for a variable, using an Initializer. Args: var: A `Variable` object. initializer: An `Initializer`. The initial value of the slot. shape: Shape of the initial value of the slot. dtype: Type of the value of the slot. slot_name: Name for the slot. op_name: Name to use when scoping the Variable that needs to be created for the slot. Returns: A `Variable` object. """ named_slots = self._slot_dict(slot_name) if _var_key(var) not in named_slots: new_slot_variable = slot_creator.create_slot_with_initializer( var, initializer, shape, dtype, op_name) self._restore_slot_variable( slot_name=slot_name, variable=var, slot_variable=new_slot_variable) named_slots[_var_key(var)] = new_slot_variable return named_slots[_var_key(var)] def _zeros_slot(self, var, slot_name, op_name): """Find or create a slot initialized with 0.0. Args: var: A `Variable` object. slot_name: Name for the slot. op_name: Name to use when scoping the Variable that needs to be created for the slot. Returns: A `Variable` object. """ named_slots = self._slot_dict(slot_name) if _var_key(var) not in named_slots: new_slot_variable = slot_creator.create_zeros_slot(var, op_name) self._restore_slot_variable( slot_name=slot_name, variable=var, slot_variable=new_slot_variable) named_slots[_var_key(var)] = new_slot_variable return named_slots[_var_key(var)] # -------------- # For implementing the Trackable interface. # -------------- def _restore_slot_variable(self, slot_name, variable, slot_variable): """Restore a newly created slot variable's value.""" variable_key = _var_key(variable) deferred_restorations = self._deferred_slot_restorations.get( slot_name, {}).pop(variable_key, []) # Iterate over restores, highest restore UID first to minimize the number # of assignments. deferred_restorations.sort(key=lambda position: position.restore_uid, reverse=True) for checkpoint_position in deferred_restorations: checkpoint_position.restore(slot_variable) def _create_or_restore_slot_variable( self, slot_variable_position, slot_name, variable): """Restore a slot variable's value, possibly creating it. Called when a variable which has an associated slot variable is created or restored. When executing eagerly, we create the slot variable with a restoring initializer. No new variables are created when graph building. Instead, _restore_slot_variable catches these after normal creation and adds restore ops to the graph. This method is nonetheless important when graph building for the case when a slot variable has already been created but `variable` has just been added to a dependency graph (causing us to realize that the slot variable needs to be restored). Args: slot_variable_position: A `trackable._CheckpointPosition` object indicating the slot variable `Trackable` object to be restored. slot_name: The name of this `Optimizer`'s slot to restore into. variable: The variable object this slot is being created for. """ named_slots = self._slot_dict(slot_name) variable_key = _var_key(variable) slot_variable = named_slots.get(variable_key, None) if (slot_variable is None and context.executing_eagerly() and slot_variable_position.is_simple_variable() # Defer slot variable creation if there is an active variable creator # scope. Generally we'd like to eagerly create/restore slot variables # when possible, but this may mean that scopes intended to catch # `variable` also catch its eagerly created slot variable # unintentionally (specifically make_template would add a dependency on # a slot variable if not for this case). Deferring is mostly harmless # (aside from double initialization), and makes variable creator scopes # behave the same way they do when graph building. and not ops.get_default_graph()._variable_creator_stack): # pylint: disable=protected-access initializer = trackable.CheckpointInitialValue( checkpoint_position=slot_variable_position) slot_variable = self._get_or_make_slot( var=variable, val=initializer, slot_name=slot_name, op_name=self._name) # Slot variables are not owned by any one object (because we don't want to # save the slot variable if the optimizer is saved without the non-slot # variable, or if the non-slot variable is saved without the optimizer; # it's a dependency hypergraph with edges of the form (optimizer, non-slot # variable, variable)). So we don't _track_ slot variables anywhere, and # instead special-case this dependency and otherwise pretend it's a normal # graph. if slot_variable is not None: # If we've either made this slot variable, or if we've pulled out an # existing slot variable, we should restore it. slot_variable_position.restore(slot_variable) else: # We didn't make the slot variable. Defer restoring until it gets created # normally. We keep a list rather than the one with the highest restore # UID in case slot variables have their own dependencies, in which case # those could differ between restores. self._deferred_slot_restorations.setdefault( slot_name, {}).setdefault(variable_key, []).append( slot_variable_position) def _call_if_callable(self, param): """Call the function if param is callable.""" return param() if callable(param) else param
apache-2.0
telwertowski/Books-Mac-OS-X
Versions/Books_3.0b6/Library of Congress Importer.app/Contents/Resources/PyZ3950/charneg.py
30
4232
#!/usr/bin/env python assert (0) # XXX shouldn't use, absorbed into z3950_2001.py #from PyZ3950 import asn1 import asn1 InitialSet=asn1.SEQUENCE ([('g0',None,asn1.TYPE(asn1.IMPLICIT(0,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1), ('g1',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1), ('g2',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1), ('g3',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1), ('c0',None,asn1.TYPE(asn1.IMPLICIT(4,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),0), ('c1',None,asn1.TYPE(asn1.IMPLICIT(5,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1)]) PrivateCharacterSet=asn1.CHOICE ([('viaOid',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF (asn1.OBJECT_IDENTIFIER))), ('externallySpecified',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),asn1.EXTERNAL)), ('previouslyAgreedUpon',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),asn1.NULL))]) LeftAndRight=asn1.SEQUENCE ([('gLeft',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),0), ('gRight',None,asn1.TYPE(asn1.IMPLICIT(4,cls=asn1.CONTEXT_FLAG),asn1.INTEGER),1)]) Iso10646=asn1.SEQUENCE ([('collections',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG),asn1.OBJECT_IDENTIFIER),1), ('encodingLevel',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),asn1.OID),0)]) LanguageCode=asn1.GeneralString Environment=asn1.CHOICE ([('sevenBit',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG),asn1.NULL)), ('eightBit',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),asn1.NULL))]) Iso2022=asn1.CHOICE ([('originProposal',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE ([('proposedEnvironment',None,asn1.TYPE(asn1.EXPLICIT(0,cls=asn1.CONTEXT_FLAG),Environment),1), ('proposedSets',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF (asn1.INTEGER)),0), ('proposedInitialSets',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF (InitialSet)),0), ('proposedLeftAndRight',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),LeftAndRight),0)]))), ('targetResponse',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE ([('selectedEnvironment',None,asn1.TYPE(asn1.EXPLICIT(0,cls=asn1.CONTEXT_FLAG),Environment),0), ('selectedSets',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF (asn1.INTEGER)),0), ('selectedinitialSet',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),InitialSet),0), ('selectedLeftAndRight',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),LeftAndRight),0)])))]) TargetResponse=asn1.SEQUENCE ([('selectedCharSets',None,asn1.TYPE(asn1.EXPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.CHOICE ([('iso2022',None,asn1.TYPE(asn1.EXPLICIT(1,cls=asn1.CONTEXT_FLAG),Iso2022)), ('iso10646',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),Iso10646)), ('private',None,asn1.TYPE(asn1.EXPLICIT(3,cls=asn1.CONTEXT_FLAG),PrivateCharacterSet)), ('none',None,asn1.TYPE(asn1.IMPLICIT(4,cls=asn1.CONTEXT_FLAG),asn1.NULL))])),1), ('selectedLanguage',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),LanguageCode),1), ('recordsInSelectedCharSets',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),asn1.BOOLEAN),1)]) OriginProposal=asn1.SEQUENCE ([('proposedCharSets',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF ( asn1.CHOICE ([('iso2022',None,asn1.TYPE(asn1.EXPLICIT(1,cls=asn1.CONTEXT_FLAG),Iso2022)), ('iso10646',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),Iso10646)), ('private',None,asn1.TYPE(asn1.EXPLICIT(3,cls=asn1.CONTEXT_FLAG),PrivateCharacterSet))]))),1), ('proposedlanguages',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG), asn1.SEQUENCE_OF (LanguageCode)),1), ('recordsInSelectedCharSets',None,asn1.TYPE(asn1.IMPLICIT(3,cls=asn1.CONTEXT_FLAG),asn1.BOOLEAN),1)]) CharSetandLanguageNegotiation=asn1.CHOICE ([('proposal',None,asn1.TYPE(asn1.IMPLICIT(1,cls=asn1.CONTEXT_FLAG),OriginProposal)), ('response',None,asn1.TYPE(asn1.IMPLICIT(2,cls=asn1.CONTEXT_FLAG),TargetResponse))])
mit
gautam1858/tensorflow
tensorflow/python/autograph/lang/directives.py
31
2230
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Directives are special no-op functions that serve as compilation markers. They provide static information like type hints, compilation and TensorFlow overrides. These serve as annotations in the compiled code, allowing the user some control over the compilation process. They have no functional role at runtime. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function UNSPECIFIED = object() def set_element_type(entity, dtype, shape=UNSPECIFIED): """Indicates that the entity is expected hold items of specified type/shape. The staged TensorFlow ops will reflect and assert this data type. Ignored otherwise. Args: entity: The entity to annotate. dtype: TensorFlow dtype value to assert for entity. shape: Optional shape to assert for entity. """ del entity del dtype del shape def set_loop_options( parallel_iterations=UNSPECIFIED, back_prop=UNSPECIFIED, swap_memory=UNSPECIFIED, maximum_iterations=UNSPECIFIED): """Specifies additional arguments to be passed to the enclosing while_loop. The parameters apply to and only to the immediately enclosing loop. It only has effect if the loop is staged as a TF while_loop; otherwise the parameters have no effect. Args: parallel_iterations: See tf.while_loop. back_prop: See tf.while_loop. swap_memory: See tf.while_loop. maximum_iterations: See tf.while_loop. """ del parallel_iterations del back_prop del swap_memory del maximum_iterations
apache-2.0
isc-projects/forge
tests/protosupport/v6/srv_msg.py
1
45127
# Copyright (C) 2012-2020 Internet Systems Consortium. # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Author: Wlodzimierz Wencel # # This file contains a number of common steps that are general and may be used # By a lot of feature files. # import codecs import random import os import logging from scapy.sendrecv import sr from scapy.layers import dhcp6 from scapy.layers.inet6 import IPv6, UDP from scapy.config import conf from scapy.volatile import RandMAC from scapy.all import Raw import scapy from forge_cfg import world from terrain import client_id, ia_id, ia_pd log = logging.getLogger('forge') # option codes for options and sub-options for dhcp v6 OPTIONS = {"client-id": 1, "server-id": 2, "IA_NA": 3, "IN_TA": 4, "IA_address": 5, "preference": 7, "elapsedtime": 8, "relay-msg": 9, "unicast": 12, "status-code": 13, "rapid_commit": 14, "vendor-class": 16, "vendor-specific-info": 17, "interface-id": 18, "sip-server-dns": 21, "sip-server-addr": 22, "dns-servers": 23, "domain-search": 24, "IA_PD": 25, "IA-Prefix": 26, "nis-servers": 27, "nisp-servers": 28, "nis-domain-name": 29, "nisp-domain-name": 30, "sntp-servers": 31, "information-refresh-time": 32, "bcmcs-server-dns": 33, "remote-id": 37, "subscriber-id": 38, "fqdn": 39, "client-arch-type": 61, "erp-local-domain-name": 65, "client-link-layer-addr": 79} ## ====================================================================== ## ================ PREPARE MESSAGE OPTIONS BLOCK START ================= decode_hex = codecs.getdecoder("hex_codec") def client_requests_option(opt_type): """ Add RequestOption to message. """ if not hasattr(world, 'oro'): # There was no ORO at all, create new one world.oro = dhcp6.DHCP6OptOptReq() # Scapy creates ORO with 23, 24 options request. Let's get rid of them world.oro.reqopts = [] # don't request anything by default world.oro.reqopts.append(int(opt_type)) def client_send_msg(msgname, iface, addr): """ Sends specified message with defined options. Parameters: msg ('<msg> message'): name of the message. """ # iface and addr not used for v6 for now. # Remove previous message waiting to be sent, just in case this is a # REQUEST after we received ADVERTISE. We don't want to send SOLICIT # the second time. world.climsg = [] if msgname == "SOLICIT": msg = build_msg(dhcp6.DHCP6_Solicit()) elif msgname == "REQUEST": msg = build_msg(dhcp6.DHCP6_Request()) elif msgname == "CONFIRM": msg = build_msg(dhcp6.DHCP6_Confirm()) elif msgname == "RENEW": msg = build_msg(dhcp6.DHCP6_Renew()) elif msgname == "REBIND": msg = build_msg(dhcp6.DHCP6_Rebind()) elif msgname == "DECLINE": msg = build_msg(dhcp6.DHCP6_Decline()) elif msgname == "RELEASE": msg = build_msg(dhcp6.DHCP6_Release()) elif msgname == "INFOREQUEST": msg = build_msg(dhcp6.DHCP6_InfoRequest()) else: assert False, "Invalid message type: %s" % msgname assert msg, "Message preparation failed" if msg: world.climsg.append(msg) log.debug("Message %s will be sent over %s interface." % (msgname, world.cfg["iface"])) def client_sets_value(value_name, new_value): if value_name in world.cfg["values"]: if isinstance(world.cfg["values"][value_name], str): world.cfg["values"][value_name] = str(new_value) elif isinstance(world.cfg["values"][value_name], int): world.cfg["values"][value_name] = int(new_value) else: world.cfg["values"][value_name] = new_value else: assert value_name in world.cfg["values"], "Unknown value name : %s" % value_name def unicast_addres(addr_type): """ Turn off sending on All_DHCP_Relay_Agents_and_Servers, and use UNICAST address. """ if addr_type: world.cfg["address_v6"] = world.f_cfg.srv_ipv6_addr_global else: world.cfg["address_v6"] = world.f_cfg.srv_ipv6_addr_link_local def client_does_include(sender_type, opt_type, value): """ Include options to message. This function refers to @step in lettuce """ assert sender_type in ["Client", "RelayAgent", "Relay-Supplied-Option"], "Two sender type accepted: Client or" \ " RelayAgent, your choice is: " \ + sender_type world.sender_type = sender_type # value variable not used in v6 # If you want to use options of received message to include it, # please use 'Client copies (\S+) option from received message.' step. if world.cfg["values"]["DUID"] is not None: world.cfg["values"]["cli_duid"] = convert_DUID(world.cfg["values"]["DUID"]) if opt_type == "client-id": add_client_option(dhcp6.DHCP6OptClientId(duid=world.cfg["values"]["cli_duid"])) if opt_type == "wrong-client-id": #used for backwards compatibility add_client_option(dhcp6.DHCP6OptClientId(duid=dhcp6.DUID_LLT(timeval=int(time.time()), lladdr=RandMAC()))) elif opt_type == "empty-client-id": add_client_option(dhcp6.DHCP6OptClientId()) elif opt_type == "wrong-server-id": #used for backwards compatibility add_client_option(dhcp6.DHCP6OptServerId(duid=convert_DUID(world.cfg["values"]["server_id"]))) elif opt_type == "server-id": add_client_option(dhcp6.DHCP6OptServerId(duid=convert_DUID(world.cfg["values"]["server_id"]))) elif opt_type == "empty-server-id": add_client_option(dhcp6.DHCP6OptServerId()) elif opt_type == "preference": add_client_option(dhcp6.DHCP6OptPref(prefval=world.cfg["values"]["prefval"])) elif opt_type == "rapid-commit": add_client_option(dhcp6.DHCP6OptRapidCommit()) elif opt_type in ["time", "elapsedtime"]: add_client_option(dhcp6.DHCP6OptElapsedTime(elapsedtime=world.cfg["values"]["elapsedtime"])) elif opt_type == "relay-msg": add_client_option(dhcp6.DHCP6OptRelayMsg(message=dhcp6.DHCP6_Solicit())) elif opt_type == "server-unicast": add_client_option(dhcp6.DHCP6OptServerUnicast(srvaddr=world.cfg["values"]["srvaddr"])) elif opt_type == "status-code": add_client_option(dhcp6.DHCP6OptStatusCode(statuscode=world.cfg["values"]["statuscode"], statusmsg=world.cfg["values"]["statusmsg"])) elif opt_type == "interface-id": add_client_option(dhcp6.DHCP6OptIfaceId(ifaceid=world.cfg["values"]["ifaceid"])) elif opt_type == "reconfigure": add_client_option(dhcp6.DHCP6OptReconfMsg(msgtype=world.cfg["values"]["reconfigure_msg_type"])) elif opt_type == "reconfigure-accept": add_client_option(dhcp6.DHCP6OptReconfAccept()) elif opt_type == "option-request": # later we can make it adjustable add_client_option(dhcp6.DHCP6OptOptReq(reqopts=world.cfg["values"]["reqopts"])) elif opt_type == "IA-PD": if len(world.iapd) > 0: add_client_option(dhcp6.DHCP6OptIA_PD(iaid=int(world.cfg["values"]["ia_pd"]), T1=world.cfg["values"]["T1"], T2=world.cfg["values"]["T2"], iapdopt=world.iapd)) world.iapd = [] else: add_client_option(dhcp6.DHCP6OptIA_PD(iaid=int(world.cfg["values"]["ia_pd"]), T1=world.cfg["values"]["T1"], T2=world.cfg["values"]["T2"])) elif opt_type == "IA-NA": if len(world.iaad) > 0: add_client_option(dhcp6.DHCP6OptIA_NA(iaid=int(world.cfg["values"]["ia_id"]), T1=world.cfg["values"]["T1"], T2=world.cfg["values"]["T2"], ianaopts=world.iaad)) world.iaad = [] else: add_client_option(dhcp6.DHCP6OptIA_NA(iaid=int(world.cfg["values"]["ia_id"]), T1=world.cfg["values"]["T1"], T2=world.cfg["values"]["T2"])) elif opt_type == "IA_Prefix": world.iapd.append(dhcp6.DHCP6OptIAPrefix(preflft=world.cfg["values"]["preflft"], validlft=world.cfg["values"]["validlft"], plen=world.cfg["values"]["plen"], prefix=world.cfg["values"]["prefix"])) elif opt_type == "IA_Address": world.iaad.append(dhcp6.DHCP6OptIAAddress(addr=world.cfg["values"]["IA_Address"], preflft=world.cfg["values"]["preflft"], validlft=world.cfg["values"]["validlft"])) elif opt_type == "user-class": if world.cfg["values"]["user_class_data"] == "": add_client_option(dhcp6.DHCP6OptUserClass()) else: add_client_option(dhcp6.DHCP6OptUserClass(userclassdata=dhcp6.USER_CLASS_DATA(data=str(world.cfg["values"]["user_class_data"])))) elif opt_type == "vendor-class": if world.cfg["values"]["vendor_class_data"] == "": add_client_option(dhcp6.DHCP6OptVendorClass(enterprisenum=world.cfg["values"]["enterprisenum"])) else: add_client_option(dhcp6.DHCP6OptVendorClass(enterprisenum=world.cfg["values"]["enterprisenum"], vcdata=dhcp6.VENDOR_CLASS_DATA( data=world.cfg["values"]["vendor_class_data"]))) elif opt_type == "vendor-specific-info": # convert data for world.vendor with code == 1 (option request) # that is the only one option that needs converting. vendor_option_request_convert() # build VENDOR_CPECIDIC_OPTIONs depending on world.vendor: vso_tmp = [] for each in world.vendor: vso_tmp.append(dhcp6.VENDOR_SPECIFIC_OPTION(optcode=each[0], optdata=each[1])) add_client_option(dhcp6.DHCP6OptVendorSpecificInfo(enterprisenum=world.cfg["values"]["enterprisenum"], vso=vso_tmp)) # clear vendor list world.vendor = [] elif opt_type == "fqdn": if world.cfg["values"]["FQDN_flags"] is None: assert False, "Please define FQDN flags first." converted_fqdn = world.cfg["values"]["FQDN_domain_name"] add_client_option(dhcp6.DHCP6OptClientFQDN(flags=str(world.cfg["values"]["FQDN_flags"]), fqdn=converted_fqdn)) elif opt_type == "client-link-layer-addr": add_client_option(dhcp6.DHCP6OptClientLinkLayerAddr(lltype=world.cfg["values"]["address_type"], clladdr=world.cfg["values"]["link_local_mac_addr"])) elif opt_type == "remote-id": add_client_option(dhcp6.DHCP6OptRemoteID(enterprisenum=world.cfg["values"]["enterprisenum"], remoteid=decode_hex(world.cfg["values"]["remote_id"].replace(':', ''))[0])) # remoteid=world.cfg["values"]["remote_id"].replace(':', '').decode('hex'))) elif opt_type == "subscriber-id": # add_client_option(dhcp6.DHCP6OptSubscriberID(subscriberid=world.cfg["values"]["subscriber_id"]. # replace(':', '').decode('hex'))) add_client_option(dhcp6.DHCP6OptSubscriberID(subscriberid=decode_hex(world.cfg["values"]["subscriber_id"].replace(':', ''))[0])) elif opt_type == "interface-id": add_client_option(dhcp6.DHCP6OptIfaceId(ifaceid=world.cfg["values"]["ifaceid"])) elif opt_type == "nii": add_client_option(dhcp6.DHCP6OptClientNetworkInterId(iitype=world.cfg["values"]["iitype"], iimajor=world.cfg["values"]["iimajor"], iiminor=world.cfg["values"]["iiminor"])) elif opt_type == "client-arch-type": add_client_option(dhcp6.DHCP6OptClientArchType(archtypes=world.cfg["values"]["archtypes"])) elif opt_type == "erp-local-domain-name": add_client_option(dhcp6.DHCP6OptERPDomain(erpdomain=[world.cfg["values"]["erpdomain"]])) elif opt_type == "rsoo": add_client_option(dhcp6.DHCP6OptRelaySuppliedOpt(relaysupplied=world.rsoo)) elif opt_type == "time-elapsed": add_client_option(dhcp6.DHCP6OptElapsedTime(elapsedtime=world.cfg["values"]["elapsedtime"])) else: assert "unsupported option: " + opt_type def change_message_field(message_filed, value, value_type): convert_type = {"int": int, "string": str, "str": str, "unicode": str} convert = convert_type[value_type] world.message_fields.append([str(message_filed), convert(value)]) def apply_message_fields_changes(): for field_details in world.message_fields: try: setattr(world.climsg[0], field_details[0], field_details[1]) except: assert False, "Message does not contain field: %s " % str(field_details[0]) def add_vendor_suboption(code, data): # if code == 1 we need check if we added code=1 before # if we do, we need append only data not whole suboption if code == 1 and len(world.vendor) > 0: for each in world.vendor: if each[0] == 1: each[1].append(int(data)) # if world.vendor is empty and code == 1 add # code =1 and data as int (required to further conversion) elif code == 1: world.vendor.append([code, [int(data)]]) # every other option just add else: world.vendor.append([code, str(data)]) def generate_new(opt): """ Generate new client id with random MAC address. """ if opt == 'client': client_id(RandMAC()) ia_id() elif opt == 'Client_ID': client_id(RandMAC()) elif opt == 'IA': ia_id() elif opt == 'IA_PD': ia_pd() else: assert False, opt + " generation unsupported" ## ================ PREPARE MESSAGE OPTIONS BLOCK END =================== ## ============================================================ ## ================ BUILD MESSAGE BLOCK START ================= def add_client_option(option): if world.sender_type == "Client": world.cliopts.append(option) elif world.sender_type == "RelayAgent": world.relayopts.append(option) elif world.sender_type == "Relay-Supplied-Option": world.rsoo.append(option) else: assert False, "Something went wrong with sender_type in add_client_option- you should never seen this error" def add_option_to_msg(msg, option): # this is request_option option msg /= option return msg def client_add_saved_option(erase, count="all"): """ Add saved option to message, and erase. """ if count == "all": for each_key in list(world.savedmsg.keys()): for every_opt in world.savedmsg[each_key]: world.cliopts.append(every_opt) if erase: world.savedmsg = {} else: if count not in world.savedmsg: assert False, "There is no set no. {count} in saved options".format(**locals()) for each in world.savedmsg[count]: world.cliopts.append(each) if erase: world.savedmsg[count] = [] def vendor_option_request_convert(): data_tmp = '' for each in world.vendor: if each[0] == 1: for number in each[1]: data_tmp += '\00' + str(chr(number)) each[1] = data_tmp else: # each[1] = each[1].replace(':', '').decode('hex') each[1] = decode_hex(each[1].replace(':', ''))[0] def convert_DUID_hwaddr(duid, threshold): tmp = duid[threshold:] hwaddr = ':'.join(tmp[i:i+2] for i in range(0, len(tmp), 2)) return hwaddr def convert_DUID(duid): """ We can use two types of DUID: DUID_LLT link layer address + time (e.g. 00:01:00:01:52:7b:a8:f0:08:00:27:58:f1:e8 ) DUID_LL link layer address (e.g. 00:03:00:01:ff:ff:ff:ff:ff:01 ) third DUID based on vendor is not supported (also not planned to be ever supported) In case of using DUID_LLT: 00:01:00:01:52:7b:a8:f0:08:00:27:58:f1:e8 00:01 - duid type, it need to be 0001 for DUID_LLT 00:01 - hardware type, make it always 0001 52:7b:a8:f0 - converted time value 08:00:27:58:f1:e8 - link layer address In case of using DUID_LL: 00:03:00:01:ff:ff:ff:ff:ff:01 00:03 - duid type, it need to be 0003 for DUID_LL 00:01 - hardware type, make it always 0001 ff:ff:ff:ff:ff:01 - link layer address You can use two forms for each DUID type, with ":" and without. For example 00:01:00:01:52:7b:a8:f0:08:00:27:58:f1:e8 it's same as: 00010001527ba8f008002758f1e8 and 00:03:00:01:ff:ff:ff:ff:ff:01 it's same as: 00030001ffffffffff01 Other configurations will cause to fail test. """ if isinstance(duid, (dhcp6.DUID_LLT, dhcp6.DUID_LL, dhcp6.DUID_EN)): return duid duid = duid.replace(":", "") if duid[:8] == "00030001": return dhcp6.DUID_LL(lladdr=convert_DUID_hwaddr(duid, 8)) elif duid[:8] == "00010001": return dhcp6.DUID_LLT(timeval=int(duid[8:16], 16), lladdr=convert_DUID_hwaddr(duid, 16)) else: assert False, "DUID value is not valid! DUID: " + duid def build_raw(msg, append): if msg == "": world.climsg.append(build_msg("") / Raw(load=append)) else: client_send_msg(msg, None, None) world.climsg[0] = world.climsg[0] / Raw(load=append) def build_msg(msg): msg = IPv6(dst=world.cfg["address_v6"], src=world.cfg["cli_link_local"])/UDP(sport=world.cfg["source_port"], dport=world.cfg["destination_port"])/msg # get back to multicast address. world.cfg["address_v6"] = "ff02::1:2" # transaction id if world.cfg["values"]["tr_id"] is None: msg.trid = random.randint(0, 256*256*256) else: msg.trid = int(world.cfg["values"]["tr_id"]) world.cfg["values"]["tr_id"] = msg.trid # add option request if any try: if len(world.oro.reqopts) > 0: msg = add_option_to_msg(msg, world.oro) except: pass # add all rest options to message. world.cliopts = world.cliopts[::-1] while world.cliopts: msg /= world.cliopts.pop() # for each_option in world.cliopts: # msg /= each_option # # world.cliopts = [] return msg def create_relay_forward(level=1): """ Encapsulate message in relay-forward message. """ assert level > 0 # set flag for adding client option client-id which is added by default world.cfg["relay"] = True # we pretend to be relay-server so we need to listen on 547 port world.cfg["source_port"] = 547 # get only DHCPv6 part of the message msg = world.climsg.pop().getlayer(2) # message encapsulation for lvl in range(level): # all three values: linkaddr, peeraddr and hopcount must be filled relay_msg = dhcp6.DHCP6_RelayForward(hopcount=lvl, linkaddr=world.cfg["values"]["linkaddr"], peeraddr=world.cfg["values"]["peeraddr"]) for each_option in world.relayopts: relay_msg /= each_option relay_msg /= dhcp6.DHCP6OptRelayMsg(message=msg) msg = relay_msg # build full message full_msg = IPv6(dst=world.cfg["address_v6"], src=world.cfg["cli_link_local"]) full_msg /= UDP(sport=world.cfg["source_port"], dport=world.cfg["destination_port"]) full_msg /= msg # in case if unicast used, get back to multicast address. world.cfg["address_v6"] = "ff02::1:2" world.climsg.append(full_msg) world.relayopts = [] world.cfg["source_port"] = 546 # we should be able to change relay ports from test itself world.cfg["relay"] = False ## ================ BUILD MESSAGE BLOCK END =================== ## =================================================================== ## ================ SEND/RECEIVE MESSAGE BLOCK START ================= def send_wait_for_message(condition_type, presence, exp_message): """ Block until the given message is (not) received. Parameter: new: (' new', optional): Only check the output printed since last time this step was used for this process. process_name ('<name> stderr'): Name of the process to check the output of. message ('message <message>'): Output (part) to wait for. """ world.cliopts = [] # clear options, always build new message, also possible make it in client_send_msg may_flag = False #debug.recv=[] if str(condition_type) in "MUST": pass elif str(condition_type) in "MAY": may_flag = True # we needs to get it operational # problem: break test with success. (for now we can break test only with fail) else: assert False, "Invalid expected behavior: %s." % str(condition_type) # Uncomment this to get debug.recv filled with all received messages conf.debug_match = True # checkIPsrc must be False so scapy can correctly match response to request conf.checkIPsrc = False apply_message_fields_changes() timeout = world.cfg["wait_interval"] if "HA" in os.environ.get('PYTEST_CURRENT_TEST').split("/"): timeout *= world.f_cfg.ha_packet_wait_interval_factor ans, unans = sr(world.climsg, iface=world.cfg["iface"], timeout=timeout, nofilter=1, verbose=world.scapy_verbose) if world.f_cfg.show_packets_from in ['both', 'client']: world.climsg[0].show() expected_type_found = False received_names = "" world.srvmsg = [] for x in ans: a, b = x world.srvmsg.append(b) if world.f_cfg.show_packets_from in ['both', 'server']: b.show() if not world.loops["active"]: log.info("Received packet type=%s" % get_msg_type(b)) received_names = get_msg_type(b) + " " + received_names if get_msg_type(b) == exp_message: expected_type_found = True if exp_message is not None: for x in unans: log.error(("Unanswered packet type=%s" % dhcp6.dhcp6_cls_by_type[x.msgtype])) if not world.loops["active"]: log.debug("Received traffic (answered/unanswered): %d/%d packet(s)." % (len(ans), len(unans))) if may_flag: if len(world.srvmsg) != 0: assert True, "Response received." if len(world.srvmsg) == 0: assert True, "Response not received." # stop the test... ?? elif presence: assert len(world.srvmsg) != 0, "No response received." assert expected_type_found, "Expected message " + exp_message + " not received (got " + received_names + ")" elif not presence: assert len(world.srvmsg) == 0, "Response received, not expected" return world.srvmsg def get_last_response(): assert len(world.srvmsg), "No response received." msg = world.srvmsg[len(world.srvmsg) - 1].copy() return msg ## ================ SEND/RECEIVE MESSAGE BLOCK END =================== ## ======================================================================= ## ================ PARSING RECEIVED MESSAGE BLOCK START ================= def get_msg_type(msg): msg_types = {"ADVERTISE": dhcp6.DHCP6_Advertise, "REQUEST": dhcp6.DHCP6_Request, "REPLY": dhcp6.DHCP6_Reply, "RELAYREPLY": dhcp6.DHCP6_RelayReply} # 0th is IPv6, 1st is UDP, 2nd should be DHCP6 for msg_name in list(msg_types.keys()): if type(msg.getlayer(2)) == msg_types[msg_name]: return msg_name return "UNKNOWN-TYPE" def client_save_option(option_name, count=0): assert option_name in OPTIONS, "Unsupported option name " + option_name opt_code = OPTIONS.get(option_name) opt = get_option(get_last_response(), opt_code) assert opt, "Received message does not contain option " + option_name opt.payload = scapy.packet.NoPayload() if count not in world.savedmsg: world.savedmsg[count] = [opt] else: world.savedmsg[count].append(opt) def client_copy_option(option_name): """ Copy option from received message """ assert world.srvmsg assert option_name in OPTIONS, "Unsupported option name " + option_name opt_code = OPTIONS.get(option_name) # find and copy option opt = get_option(world.srvmsg[0], opt_code) assert opt, "Received message does not contain option " + option_name # payload need to be 'None' otherwise we copy all options from one we are # looking for till the end of the message # it would be nice to remove 'status code' sub-option # before sending it back to server opt.payload = scapy.packet.NoPayload() add_client_option(opt) def get_option(msg, opt_code): # We need to iterate over all options and see # if there's one we're looking for # message needs to be copied, otherwise we changing original message # what makes sometimes multiple copy impossible. tmp_msg = msg.copy() # clear all opts/subopts world.opts = [] world.subopts = [] tmp = None # TODO: get rid of x and tmp_msg if len(world.rlymsg) == 0: # relay message is already cropped to exact layer x = tmp_msg.getlayer(3) # 0th is IPv6, 1st is UDP, 2nd is DHCP6, 3rd is the first option else: x = tmp_msg # check all message, for expected option and all suboptions in IA_NA/IA_PD check_suboptions = ["ianaopts", "iapdopt", "vso", "userclassdata", "vcdata" ] while x: if x.optcode == int(opt_code): tmp = x.copy() # del tmp.payload world.opts.append(x) for each in check_suboptions: if x.fields.get(each): tmp2 = x.copy() del tmp2.payload world.subopts.append([x.optcode, tmp2]) # add Status Code to suboptions even if it is option in main message # TODO check if it is still needed! if x.optcode == 13: world.subopts.append([0, x]) x = x.payload return tmp def unknown_option_to_str(data_type, opt): if data_type == "uint8": assert len(opt.data) == 1, "Received option " + opt.optcode + " contains " + len(opt.data) + \ " bytes, but expected exactly 1" return str(ord(opt.data[0:1])) else: assert False, "Parsing of option format " + str(data_type) + " not implemented." def _get_opt_descr(opt_code): try: opt = dhcp6.dhcp6opts_by_code[int(opt_code)] except KeyError: opt = 'unknown' opt_descr = "%s[%s]" % (opt, opt_code) return opt_descr def response_check_include_option(must_include, opt_code): """ Checking presence of expected option. """ assert len(world.srvmsg) != 0, "No response received." # if opt_code is actually a opt name then convert it to code if isinstance(opt_code, str) and not opt_code.isdigit(): opt_code = OPTIONS[opt_code] opt = get_option(world.srvmsg[0], opt_code) opt_descr = _get_opt_descr(opt_code) if must_include: assert opt, "Expected option {opt_descr} not present in the message.".format(**locals()) else: assert opt is None, "Unexpected option {opt_descr} found in the message.".format(**locals()) return opt # Returns text representation of the option, interpreted as specified by data_type def get_subopt_from_option(exp_opt_code, exp_subopt_code): result = [] received = '' list_fields = ["ianaopts", "iapdopt", "vso", "userclassdata", "vcdata"] # firstly we go through all options that can include sub-options for opt_code, opt_data in world.subopts: # we need to be sure that option 13 is in 25 or 3 # otherwise sub-option 13 from option 3 could be taken # as sub-option from option 25. And that's important! if opt_code != exp_opt_code: continue # now we need to find specific sub-option list: for list_field in list_fields: # if we found list - we need to check every option on that list subopts = opt_data.fields.get(list_field) if not subopts: continue for option_in_the_list in subopts: # if on selected list there is option we are looking for, return it! if option_in_the_list.optcode == exp_subopt_code: result.append(option_in_the_list) received = str(option_in_the_list.optcode) return result, received def get_suboption(opt_code, subopt_code): # if opt_code is actually a opt name then convert it to code if isinstance(opt_code, str) and not opt_code.isdigit(): opt_code = OPTIONS[opt_code] if isinstance(subopt_code, str) and not subopt_code.isdigit(): subopt_code = OPTIONS[subopt_code] opt, _ = get_subopt_from_option(opt_code, subopt_code) return opt def extract_duid(option): if option.type == 1: # DUID_LLT return "0001000" + str(option.hwtype) + str(hex(option.timeval))[2:] + str(option.lladdr).replace(":", "") elif option.type == 2: # DUID_EN return "0002" + str(option.enterprisenum) + str(option.id.decode()) elif option.type == 3: # DUID_LL return "0003000" + str(option.hwtype) + str(option.lladdr).replace(":", "") def response_check_include_suboption(opt_code, expect, expected_value): # if opt_code is actually a opt name then convert it to code if isinstance(opt_code, str): opt_code = OPTIONS[opt_code] if isinstance(expected_value, str): if not expected_value.isdigit(): expected_value = OPTIONS[expected_value] x, receive_tmp = get_subopt_from_option(int(opt_code), int(expected_value)) opt_descr = _get_opt_descr(opt_code) subopt_descr = _get_opt_descr(expected_value) if expect: assert len(x) > 0, "Expected sub-option {subopt_descr} not present in the option {opt_descr}".format(**locals()) else: assert len(x) == 0, "NOT expected sub-option {subopt_descr} is present in the option {opt_descr}".format(**locals()) return x, receive_tmp values_equivalent = {7: "prefval", 13: "statuscode", 21: "sipdomains", 22: "sipservers", 23: "dnsservers", 24: "dnsdomains", 27: "nisservers", 28: "nispservers", 29: "nisdomain", 30: "nispdomain", 31: "sntpservers", 32: "reftime"} def response_check_suboption_content(subopt_code, opt_code, expect, data_type, expected_value): # if opt_code is actually a opt name then convert it to code if isinstance(opt_code, str): opt_code = OPTIONS[opt_code] if isinstance(subopt_code, str): if not subopt_code.isdigit(): subopt_code = OPTIONS[subopt_code] #first check if subotion exists and get suboption opt_code = int(opt_code) if opt_code == 17: data_type = "optdata" data_type = str(data_type) expected_value = str(expected_value) received = [] opts, receive_tmp = response_check_include_suboption(opt_code, True, subopt_code) assert int(subopt_code) == int(receive_tmp), "You should never see this error, if so, please report that bug a" # that is duplicated code but lets leave it for now for opt in opts: tmp_field = opt.fields.get(data_type) if tmp_field is None: if opt_code not in [17]: data_type = values_equivalent.get(opt_code) tmp_field = opt.fields.get(data_type) if type(tmp_field) is list: received.append(",".join(tmp_field)) else: if isinstance(tmp_field, bytes): received.append(tmp_field.decode('utf-8')) else: received.append(str(tmp_field)) opt_descr = _get_opt_descr(opt_code) if expect: assert expected_value in received, ("Invalid {opt_descr} option, received {data_type}: ".format(**locals()) + ",".join(received) + ", but expected " + str(expected_value)) else: assert expected_value not in received, ("Received value of {data_type}: ".format(**locals()) + ",".join(received) + " should not be equal to value from client - " + str(expected_value)) def convert_relayed_message(relayed_option): world.rlymsg.append(relayed_option) world.srvmsg.pop() world.srvmsg.append(relayed_option.message) def response_check_option_content(opt_code, expect, data_type, expected_value): # if opt_code is actually a opt name then convert it to code if isinstance(opt_code, str) and not opt_code.isdigit(): opt_code = OPTIONS[opt_code] opt_code = int(opt_code) data_type = str(data_type) expected_value = str(expected_value) initial_data_type = data_type # without any msg received, fail test assert len(world.srvmsg) != 0, "No response received." # get that one option, also fill world.opts (for multiple options same type, e.g. IA_NA) # and world.subopts for suboptions for e.g. IA Address or StatusCodes x = get_option(world.srvmsg[0], opt_code) received = [] opt_descr = _get_opt_descr(opt_code) assert x, "Expected option {opt_descr} not present in the message.".format(**locals()) # test all collected options,: # couple tweaks to make checking smoother if opt_code == 9: convert_relayed_message(x) else: if data_type == "iapd": data_type = "iaid" if data_type == "duid": expected_value = expected_value.replace(":", "") received.append(extract_duid(x.duid)) else: for each in x: tmp_field = each.fields.get(data_type) if tmp_field is None: data_type = values_equivalent.get(opt_code) tmp_field = each.fields.get(data_type) if type(tmp_field) is list: received.append(",".join(tmp_field)) else: if isinstance(tmp_field, bytes): received.append(tmp_field.decode('utf-8')) else: received.append(str(tmp_field)) # test if expected option/suboption/value is in all collected options/suboptions/values if received[0] == 'None': assert False, "Within option " + opt_descr + " there is no " + initial_data_type\ + " value. Probably that is test error" if expect: assert expected_value in received, "Invalid " + opt_descr + " option, received "\ + data_type + ": " + ",".join(received) + ", but expected " \ + str(expected_value) else: assert expected_value not in received, "Received value of " + data_type + ": " + ",".join(received) +\ " should not be equal to value from client - " + str(expected_value) def save_value_from_option(value_name, option_name): assert world.srvmsg get_option(world.srvmsg[0], option_name) if len(world.opts) == 0: temp = world.subopts[0][1].payload world.savedvalue = getattr(temp, value_name) world.subopts = [] else: world.savedvalue = getattr(world.opts[0], value_name) world.opts = [] world.subopts = [] def compare_values(value_name, option_name): assert world.srvmsg get_option(world.srvmsg[0], option_name) if len(world.opts) == 0: subopt = world.subopts[0][1].payload to_cmp = getattr(subopt, value_name) assert world.savedvalue == to_cmp, \ "Compared values %s and %s do not match" % (world.savedvalue, to_cmp) world.subopts = [] else: to_cmp = getattr(world.opts[0], value_name) assert world.savedvalue == to_cmp, \ "Compared values %s and %s do not match" % (world.savedvalue, to_cmp) world.opts = [] world.subopts = [] def get_all_leases(decode_duid=True): assert world.srvmsg msg = get_last_response() if len(world.rlymsg) == 0: # relay message is already cropped to exact layer msg = msg.getlayer(3) # 0th is IPv6, 1st is UDP, 2nd is DHCP6, 3rd is the first option current_duid = "" all_addr = [] while msg: if msg.optcode == 1: if decode_duid: txt_duid = extract_duid(msg.duid) current_duid = ":".join([txt_duid[i:i+2] for i in range(0, len(txt_duid), 2)]) else: current_duid = msg.duid.copy() elif msg.optcode == 3: for ia_id in msg.ianaopts: if ia_id.optcode == 5: all_addr.append({"duid": current_duid, "idid": msg.iaid, "valid_lifetime": ia_id.validlft, "pref_lifetime":ia_id.preflft, "address": ia_id.addr, "prefix_len": 0}) elif msg.optcode == 25: for ia_pd in msg.iapdopt: if ia_pd.optcode == 26: all_addr.append({"duid": current_duid, "idid": msg.iaid, "valid_lifetime": ia_pd.validlft, "pref_lifetime":ia_pd.preflft, "address": ia_pd.prefix, "prefix_len": ia_pd.plen}) msg = msg.payload return all_addr def response_get_content(*args): # only v4! pass ## ================ PARSING RECEIVED MESSAGE BLOCK END =================== ## ======================================================================= ## ==================== TESTING IN LOOPS BLOCK START ===================== def loops_config_sld(): world.loops["save_leases_details"] = True def values_for_loops(value_name, file_flag, values): value_name = str(value_name) if value_name == "client-id": world.loops[value_name] = [] for each in str(values).split(" "): world.cfg["values"]["DUID"] = each world.loops[value_name].append(convert_DUID()) def loops(message_type_1, message_type_2, repeat): import importlib testsetup = importlib.import_module("misc") repeat = int(repeat) testsetup.set_world() testsetup.test_procedure() if repeat < 1000: x_range = 10 elif 1000 <= repeat < 10000: x_range = 250 else: x_range = 1000 world.loops["active"] = True world.scapy_verbose = 0 if message_type_1 == "SOLICIT" and message_type_2 == "ADVERTISE": # short two message exchange without saving leases. for x in range(repeat): generate_new("client") client_does_include("Client", "client-id", None) client_does_include("Client", "IA-NA", None) client_send_msg(message_type_1, None, None) send_wait_for_message("MAY", True, message_type_2) elif message_type_1 == "SOLICIT" and message_type_2 == "REPLY": # first save server-id option client_does_include("Client", "client-id", None) client_does_include("Client", "IA-NA", None) client_send_msg(message_type_1, None, None) send_wait_for_message("MAY", True, "ADVERTISE") client_save_option("server-id") # long 4 message exchange with saving leases. for x in range(repeat): if x % x_range == 0: log.info("Message exchange no. %d", x) generate_new("client") client_does_include("Client", "client-id", None) client_does_include("Client", "IA-NA", None) client_send_msg(message_type_1, None, None) send_wait_for_message("MAY", True, "ADVERTISE") try: client_add_saved_option(False) client_copy_option("IA_NA") except AssertionError: pass client_does_include("Client", "client-id", None) client_send_msg("REQUEST", None, None) send_wait_for_message("MAY", True, message_type_2) elif message_type_1 == "REQUEST" and message_type_2 == "REPLY": # first save server-id option client_send_msg("SOLICIT", None, None) send_wait_for_message("MAY", True, "ADVERTISE") client_save_option("server-id") # long 4 message exchange with saving leases. for x in range(repeat): if x % x_range == 0: log.info("Message exchane no. %d", x) generate_new("client") client_add_saved_option(False) client_send_msg("REQUEST", None, None) send_wait_for_message("MAY", True, message_type_2) response_check_option_content(13, 3, "NOT", "statuscode", "2") elif message_type_1 == "RELEASE" and message_type_2 == "REPLY": # first save server-id option client_send_msg("SOLICIT", None, None) send_wait_for_message("MAY", True, "ADVERTISE") client_save_option("server-id") # long 4 message exchange with saving leases. for x in range(repeat): if x % x_range == 0: log.info("Message exchane no. %d", x) client_add_saved_option(False) client_send_msg("REQUEST", None, None) send_wait_for_message("MAY", True, message_type_2) client_add_saved_option(False) client_copy_option("IA_NA") client_send_msg("RELEASE", None, None) send_wait_for_message("MAY", True, message_type_2) #dhcpmsg.generate_new("client") elif message_type_1 == "RENEW" and message_type_2 == "REPLY": # first save server-id option client_send_msg("SOLICIT", None, None) send_wait_for_message("MAY", True, "ADVERTISE") client_save_option("server-id") # long 4 message exchange with saving leases. for x in range(repeat): if x % x_range == 0: log.info("Message exchane no. %d", x) client_add_saved_option(False) client_send_msg("REQUEST", None, None) send_wait_for_message("MAY", True, message_type_2) client_add_saved_option(False) client_copy_option("IA_NA") client_send_msg("RENEW", None, None) send_wait_for_message("MAY", True, message_type_2) else: pass for x in range(len(world.savedmsg)): world.savedmsg[x] = [] def save_info(): pass
isc
YuMatsuzawa/HadoopEclipseProject
contrib/hod/hodlib/Common/tcp.py
182
5299
#Licensed to the Apache Software Foundation (ASF) under one #or more contributor license agreements. See the NOTICE file #distributed with this work for additional information #regarding copyright ownership. The ASF licenses this file #to you under the Apache License, Version 2.0 (the #"License"); you may not use this file except in compliance #with the License. You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 #Unless required by applicable law or agreed to in writing, software #distributed under the License is distributed on an "AS IS" BASIS, #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #See the License for the specific language governing permissions and #limitations under the License. # $Id:tcp.py 6172 2007-05-22 20:26:54Z zim $ # #------------------------------------------------------------------------------ """ TCP related classes. """ import socket, re, string reAddress = re.compile(":") reMayBeIp = re.compile("^\d+\.\d+\.\d+\.\d+$") reValidPort = re.compile("^\d+$") class Error(Exception): def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) def __repr__(self): return self.message class tcpError(Error): def __init__(self, message): Error.__init__(self, message) class tcpSocket: def __init__(self, address, timeout=30, autoflush=0): """Constructs a tcpSocket object. address - standard tcp address (HOST:PORT) timeout - socket timeout""" self.address = address self.__autoFlush = autoflush self.__remoteSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__remoteSock.settimeout(timeout) self.host = None self.port = None splitAddress = address if isinstance(address, (tuple, list)): self.host = address[0] self.port = int(address[1]) else: splitAddress = get_address_tuple(address) if not splitAddress[0]: self.host = 'localhost' else: self.host = splitAddress[0] self.port = int(splitAddress[1]) self.__fileObjectOut = '' self.__fileObjectIn = '' def __repr__(self): return self.address def __iter__(self): return self def next(self): sockLine = self.read() if not sockLine: raise StopIteration return sockLine def open(self): """Attempts to open a socket to the specified address.""" socketAddress = (self.host, self.port) try: self.__remoteSock.connect(socketAddress) if self.__autoFlush: self.__fileObjectOut = self.__remoteSock.makefile('wb', 0) else: self.__fileObjectOut = self.__remoteSock.makefile('wb') self.__fileObjectIn = self.__remoteSock.makefile('rb', 0) except: raise tcpError, "connection failure: %s" % self.address def flush(self): """Flushes write buffer.""" self.__fileObjectOut.flush() def close(self): """Attempts to close and open socket connection""" try: self.__remoteSock.close() self.__fileObjectOut.close() self.__fileObjectIn.close() except socket.error, exceptionObject: exceptionMessage = "close failure %s %s" % (self.address, exceptionObject.__str__()) raise tcpError, exceptionMessage def verify(self): """Verifies that a given IP address/host and port are valid. This method will not attempt to open a socket to the specified address. """ isValidAddress = False if reMayBeIp.match(self.host): if check_ip_address(self.host): if reValidPort.match(str(self.port)): isValidAddress = True else: if reValidPort.match(str(self.port)): isValidAddress = True return(isValidAddress) def read(self): """Reads a line off of the active socket.""" return self.__fileObjectIn.readline() def write(self, string): """Writes a string to the active socket.""" print >> self.__fileObjectOut, string def check_net_address(address): valid = True pieces = string.split(address, '.') if len(pieces) != 4: valid = False else: for piece in pieces: if int(piece) < 0 or int(piece) > 255: valid = False return valid def check_ip_address(address): valid = True pieces = string.split(address, '.') if len(pieces) != 4: valid = False else: if int(pieces[0]) < 1 or int(pieces[0]) > 254: valid = False for i in range(1,4): if int(pieces[i]) < 0 or int(pieces[i]) > 255: valid = False return valid def get_address_tuple(address): """ Returns an address tuple for TCP address. address - TCP address of the form host:port returns address tuple (host, port) """ addressList = reAddress.split(address) addressTuple = (addressList[0], int(addressList[1])) return addressTuple
apache-2.0
mshavlovsky/mannord
mannord/tests/testHits.py
1
3423
#!/usr/bin/python import unittest from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from mannord import (ItemMixin, UserMixin, ActionMixin) import mannord.hits as hits import mannord as mnrd Base = declarative_base() class TestHITS(unittest.TestCase): def test_hits_basic(self): g = hits.Graph() g.add_link('u1', 'it1', 1) g.add_link('u1', 'it2', 1) g.add_link('u2', 'it2', 1) g.hubs_and_authorities(10) u1 = g.get_user('u1') u2 = g.get_user('u2') it1 = g.get_item('it1') it2 = g.get_item('it2') self.assertTrue(u1.hub_weight > u2.hub_weight) self.assertTrue(it1.auth_weight < it2.auth_weight) def test_hits(self): g = hits.Graph() g.add_link('u1', 'it1', 1) g.add_link('u1', 'it2', 1) g.add_link('u2', 'it2', 1) g.add_link('u2', 'it3', 1) g.add_link('u3', 'it1', 1) g.add_link('u3', 'it2', 1) g.add_link('u3', 'it3', 1) g.hubs_and_authorities(10) n_users = g.get_n_top_users(3, 'u2') self.assertTrue(n_users[0] == 'u3') self.assertTrue(n_users[1] == 'u1') self.assertTrue(len(n_users) == 2) n_items = g.get_n_top_items(10) self.assertTrue(len(n_items) == 3) self.assertTrue(n_items[0] == 'it2') def test_hits_db(self): engine = create_engine('sqlite:///:memory:') #engine = create_engine("mysql://root:@localhost/mannord_test") Session = sessionmaker() session = Session() mnrd.bind_engine(engine, Session, Base) mnrd.bootstrap(Base, create_all=True) ModeratedAnnotation = ItemMixin.cls ModerationUser = UserMixin.cls # Creates users and annotations user1 = ModerationUser('user1') user2 = ModerationUser('user2') user3 = ModerationUser('user3') user4 = ModerationUser('user4') user5 = ModerationUser('user5') session.add_all([user1, user2, user3, user4, user5]) session.flush() annot1 = ModeratedAnnotation('www.example1.com', 'annot1', user1) annot2 = ModeratedAnnotation('www.example1.com', 'annot2', user2) annot3 = ModeratedAnnotation('www.example1.com', 'annot3', user3) annot4 = ModeratedAnnotation('www.example2.com', 'annot4', user1) annot5 = ModeratedAnnotation('www.example2.com', 'annot5', user1) annot6 = ModeratedAnnotation('www.example2.com', 'annot6', user3) annot7 = ModeratedAnnotation('www.example3.com', 'annot7', user2) annot8 = ModeratedAnnotation('www.example3.com', 'annot8', user2) annot9 = ModeratedAnnotation('www.example3.com', 'annot9', user3) annot10 = ModeratedAnnotation('www.example3.com', 'annot10', user4) annot11 = ModeratedAnnotation('www.example4.com', 'annot11', user5) session.add_all([annot1, annot2, annot3, annot4, annot5, annot6, annot7, annot8, annot9, annot10, annot11]) mnrd.raise_ham_flag(annot1, user3, session) session.flush() n_items = mnrd.suggest_n_users_to_review(annot8,4, session) self.assertTrue(n_items[0] == user3.id) self.assertTrue(n_items[2] == user4.id) self.assertTrue(len(n_items) == 3) if __name__ == '__main__': unittest.main()
bsd-2-clause
dataxu/ansible
test/units/plugins/lookup/test_password.py
71
18937
# -*- coding: utf-8 -*- # (c) 2015, Toshio Kuratomi <[email protected]> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import passlib from passlib.handlers import pbkdf2 from units.mock.loader import DictDataLoader from ansible.compat.tests import unittest from ansible.compat.tests.mock import mock_open, patch from ansible.errors import AnsibleError from ansible.module_utils.six import text_type from ansible.module_utils.six.moves import builtins from ansible.plugins.loader import PluginLoader from ansible.plugins.lookup import password from ansible.utils import encrypt DEFAULT_CHARS = sorted([u'ascii_letters', u'digits', u".,:-_"]) DEFAULT_CANDIDATE_CHARS = u'.,:-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' # Currently there isn't a new-style old_style_params_data = ( # Simple case dict( term=u'/path/to/file', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), # Special characters in path dict( term=u'/path/with/embedded spaces and/file', filename=u'/path/with/embedded spaces and/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/with/equals/cn=com.ansible', filename=u'/path/with/equals/cn=com.ansible', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/with/unicode/くらとみ/file', filename=u'/path/with/unicode/くらとみ/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), # Mix several special chars dict( term=u'/path/with/utf 8 and spaces/くらとみ/file', filename=u'/path/with/utf 8 and spaces/くらとみ/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/with/encoding=unicode/くらとみ/file', filename=u'/path/with/encoding=unicode/くらとみ/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/with/encoding=unicode/くらとみ/and spaces file', filename=u'/path/with/encoding=unicode/くらとみ/and spaces file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), # Simple parameters dict( term=u'/path/to/file length=42', filename=u'/path/to/file', params=dict(length=42, encrypt=None, chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/to/file encrypt=pbkdf2_sha256', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt='pbkdf2_sha256', chars=DEFAULT_CHARS), candidate_chars=DEFAULT_CANDIDATE_CHARS, ), dict( term=u'/path/to/file chars=abcdefghijklmnop', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'abcdefghijklmnop']), candidate_chars=u'abcdefghijklmnop', ), dict( term=u'/path/to/file chars=digits,abc,def', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'digits', u'abc', u'def'])), candidate_chars=u'abcdef0123456789', ), # Including comma in chars dict( term=u'/path/to/file chars=abcdefghijklmnop,,digits', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'abcdefghijklmnop', u',', u'digits'])), candidate_chars=u',abcdefghijklmnop0123456789', ), dict( term=u'/path/to/file chars=,,', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u',']), candidate_chars=u',', ), # Including = in chars dict( term=u'/path/to/file chars=digits,=,,', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'digits', u'=', u','])), candidate_chars=u',=0123456789', ), dict( term=u'/path/to/file chars=digits,abc=def', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'digits', u'abc=def'])), candidate_chars=u'abc=def0123456789', ), # Including unicode in chars dict( term=u'/path/to/file chars=digits,くらとみ,,', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'digits', u'くらとみ', u','])), candidate_chars=u',0123456789くらとみ', ), # Including only unicode in chars dict( term=u'/path/to/file chars=くらとみ', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'くらとみ'])), candidate_chars=u'くらとみ', ), # Include ':' in path dict( term=u'/path/to/file_with:colon chars=ascii_letters,digits', filename=u'/path/to/file_with:colon', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=sorted([u'ascii_letters', u'digits'])), candidate_chars=u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ), # Including special chars in both path and chars # Special characters in path dict( term=u'/path/with/embedded spaces and/file chars=abc=def', filename=u'/path/with/embedded spaces and/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'abc=def']), candidate_chars=u'abc=def', ), dict( term=u'/path/with/equals/cn=com.ansible chars=abc=def', filename=u'/path/with/equals/cn=com.ansible', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'abc=def']), candidate_chars=u'abc=def', ), dict( term=u'/path/with/unicode/くらとみ/file chars=くらとみ', filename=u'/path/with/unicode/くらとみ/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'くらとみ']), candidate_chars=u'くらとみ', ), ) class TestParseParameters(unittest.TestCase): def test(self): for testcase in old_style_params_data: filename, params = password._parse_parameters(testcase['term']) params['chars'].sort() self.assertEqual(filename, testcase['filename']) self.assertEqual(params, testcase['params']) def test_unrecognized_value(self): testcase = dict(term=u'/path/to/file chars=くらとみi sdfsdf', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'くらとみ']), candidate_chars=u'くらとみ') self.assertRaises(AnsibleError, password._parse_parameters, testcase['term']) def test_invalid_params(self): testcase = dict(term=u'/path/to/file chars=くらとみi somethign_invalid=123', filename=u'/path/to/file', params=dict(length=password.DEFAULT_LENGTH, encrypt=None, chars=[u'くらとみ']), candidate_chars=u'くらとみ') self.assertRaises(AnsibleError, password._parse_parameters, testcase['term']) class TestReadPasswordFile(unittest.TestCase): def setUp(self): self.os_path_exists = password.os.path.exists def tearDown(self): password.os.path.exists = self.os_path_exists def test_no_password_file(self): password.os.path.exists = lambda x: False self.assertEqual(password._read_password_file(b'/nonexistent'), None) def test_with_password_file(self): password.os.path.exists = lambda x: True with patch.object(builtins, 'open', mock_open(read_data=b'Testing\n')) as m: self.assertEqual(password._read_password_file(b'/etc/motd'), u'Testing') class TestGenCandidateChars(unittest.TestCase): def _assert_gen_candidate_chars(self, testcase): expected_candidate_chars = testcase['candidate_chars'] params = testcase['params'] chars_spec = params['chars'] res = password._gen_candidate_chars(chars_spec) self.assertEquals(res, expected_candidate_chars) def test_gen_candidate_chars(self): for testcase in old_style_params_data: self._assert_gen_candidate_chars(testcase) class TestRandomPassword(unittest.TestCase): def _assert_valid_chars(self, res, chars): for res_char in res: self.assertIn(res_char, chars) def test_default(self): res = password.random_password() self.assertEquals(len(res), password.DEFAULT_LENGTH) self.assertTrue(isinstance(res, text_type)) self._assert_valid_chars(res, DEFAULT_CANDIDATE_CHARS) def test_zero_length(self): res = password.random_password(length=0) self.assertEquals(len(res), 0) self.assertTrue(isinstance(res, text_type)) self._assert_valid_chars(res, u',') def test_just_a_common(self): res = password.random_password(length=1, chars=u',') self.assertEquals(len(res), 1) self.assertEquals(res, u',') def test_free_will(self): # A Rush and Spinal Tap reference twofer res = password.random_password(length=11, chars=u'a') self.assertEquals(len(res), 11) self.assertEquals(res, 'aaaaaaaaaaa') self._assert_valid_chars(res, u'a') def test_unicode(self): res = password.random_password(length=11, chars=u'くらとみ') self._assert_valid_chars(res, u'くらとみ') self.assertEquals(len(res), 11) def test_gen_password(self): for testcase in old_style_params_data: params = testcase['params'] candidate_chars = testcase['candidate_chars'] params_chars_spec = password._gen_candidate_chars(params['chars']) password_string = password.random_password(length=params['length'], chars=params_chars_spec) self.assertEquals(len(password_string), params['length'], msg='generated password=%s has length (%s) instead of expected length (%s)' % (password_string, len(password_string), params['length'])) for char in password_string: self.assertIn(char, candidate_chars, msg='%s not found in %s from chars spect %s' % (char, candidate_chars, params['chars'])) class TestRandomSalt(unittest.TestCase): def test(self): res = password._random_salt() expected_salt_candidate_chars = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./' self.assertEquals(len(res), 8) for res_char in res: self.assertIn(res_char, expected_salt_candidate_chars) class TestParseContent(unittest.TestCase): def test_empty_password_file(self): plaintext_password, salt = password._parse_content(u'') self.assertEquals(plaintext_password, u'') self.assertEquals(salt, None) def test(self): expected_content = u'12345678' file_content = expected_content plaintext_password, salt = password._parse_content(file_content) self.assertEquals(plaintext_password, expected_content) self.assertEquals(salt, None) def test_with_salt(self): expected_content = u'12345678 salt=87654321' file_content = expected_content plaintext_password, salt = password._parse_content(file_content) self.assertEquals(plaintext_password, u'12345678') self.assertEquals(salt, u'87654321') class TestFormatContent(unittest.TestCase): def test_no_encrypt(self): self.assertEqual( password._format_content(password=u'hunter42', salt=u'87654321', encrypt=False), u'hunter42 salt=87654321') def test_no_encrypt_no_salt(self): self.assertEqual( password._format_content(password=u'hunter42', salt=None, encrypt=False), u'hunter42') def test_encrypt(self): self.assertEqual( password._format_content(password=u'hunter42', salt=u'87654321', encrypt='pbkdf2_sha256'), u'hunter42 salt=87654321') def test_encrypt_no_salt(self): self.assertRaises(AssertionError, password._format_content, u'hunter42', None, 'pbkdf2_sha256') class TestWritePasswordFile(unittest.TestCase): def setUp(self): self.makedirs_safe = password.makedirs_safe self.os_chmod = password.os.chmod password.makedirs_safe = lambda path, mode: None password.os.chmod = lambda path, mode: None def tearDown(self): password.makedirs_safe = self.makedirs_safe password.os.chmod = self.os_chmod def test_content_written(self): with patch.object(builtins, 'open', mock_open()) as m: password._write_password_file(b'/this/is/a/test/caf\xc3\xa9', u'Testing Café') m.assert_called_once_with(b'/this/is/a/test/caf\xc3\xa9', 'wb') m().write.assert_called_once_with(u'Testing Café\n'.encode('utf-8')) class TestLookupModule(unittest.TestCase): def setUp(self): self.fake_loader = DictDataLoader({'/path/to/somewhere': 'sdfsdf'}) self.password_lookup = password.LookupModule(loader=self.fake_loader) self.os_path_exists = password.os.path.exists # Different releases of passlib default to a different number of rounds self.sha256 = passlib.registry.get_crypt_handler('pbkdf2_sha256') sha256_for_tests = pbkdf2.create_pbkdf2_hash("sha256", 32, 20000) passlib.registry.register_crypt_handler(sha256_for_tests, force=True) def tearDown(self): password.os.path.exists = self.os_path_exists passlib.registry.register_crypt_handler(self.sha256, force=True) @patch.object(PluginLoader, '_get_paths') @patch('ansible.plugins.lookup.password._write_password_file') def test_no_encrypt(self, mock_get_paths, mock_write_file): mock_get_paths.return_value = ['/path/one', '/path/two', '/path/three'] results = self.password_lookup.run([u'/path/to/somewhere'], None) # FIXME: assert something useful for result in results: self.assertEquals(len(result), password.DEFAULT_LENGTH) self.assertIsInstance(result, text_type) @patch.object(PluginLoader, '_get_paths') @patch('ansible.plugins.lookup.password._write_password_file') def test_encrypt(self, mock_get_paths, mock_write_file): mock_get_paths.return_value = ['/path/one', '/path/two', '/path/three'] results = self.password_lookup.run([u'/path/to/somewhere encrypt=pbkdf2_sha256'], None) # pbkdf2 format plus hash expected_password_length = 76 for result in results: self.assertEquals(len(result), expected_password_length) # result should have 5 parts split by '$' str_parts = result.split('$', 5) # verify the result is parseable by the passlib crypt_parts = passlib.hash.pbkdf2_sha256.parsehash(result) # verify it used the right algo type self.assertEquals(str_parts[1], 'pbkdf2-sha256') self.assertEquals(len(str_parts), 5) # verify the string and parsehash agree on the number of rounds self.assertEquals(int(str_parts[2]), crypt_parts['rounds']) self.assertIsInstance(result, text_type) @patch.object(PluginLoader, '_get_paths') @patch('ansible.plugins.lookup.password._write_password_file') def test_password_already_created_encrypt(self, mock_get_paths, mock_write_file): mock_get_paths.return_value = ['/path/one', '/path/two', '/path/three'] password.os.path.exists = lambda x: True with patch.object(builtins, 'open', mock_open(read_data=b'hunter42 salt=87654321\n')) as m: results = self.password_lookup.run([u'/path/to/somewhere chars=anything encrypt=pbkdf2_sha256'], None) for result in results: self.assertEqual(result, u'$pbkdf2-sha256$20000$ODc2NTQzMjE$Uikde0cv0BKaRaAXMrUQB.zvG4GmnjClwjghwIRf2gU') @patch.object(PluginLoader, '_get_paths') @patch('ansible.plugins.lookup.password._write_password_file') def test_password_already_created_no_encrypt(self, mock_get_paths, mock_write_file): mock_get_paths.return_value = ['/path/one', '/path/two', '/path/three'] password.os.path.exists = lambda x: True with patch.object(builtins, 'open', mock_open(read_data=b'hunter42 salt=87654321\n')) as m: results = self.password_lookup.run([u'/path/to/somewhere chars=anything'], None) for result in results: self.assertEqual(result, u'hunter42') @patch.object(PluginLoader, '_get_paths') @patch('ansible.plugins.lookup.password._write_password_file') def test_only_a(self, mock_get_paths, mock_write_file): mock_get_paths.return_value = ['/path/one', '/path/two', '/path/three'] results = self.password_lookup.run([u'/path/to/somewhere chars=a'], None) for result in results: self.assertEquals(result, u'a' * password.DEFAULT_LENGTH)
gpl-3.0
Technocaveman/There-is-no-Third-Step
node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/perldoc.py
364
2175
# -*- coding: utf-8 -*- """ pygments.styles.perldoc ~~~~~~~~~~~~~~~~~~~~~~~ Style similar to the style used in the `perldoc`_ code blocks. .. _perldoc: http://perldoc.perl.org/ :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace class PerldocStyle(Style): """ Style similar to the style used in the perldoc code blocks. """ background_color = '#eeeedd' default_style = '' styles = { Whitespace: '#bbbbbb', Comment: '#228B22', Comment.Preproc: '#1e889b', Comment.Special: '#8B008B bold', String: '#CD5555', String.Heredoc: '#1c7e71 italic', String.Regex: '#B452CD', String.Other: '#cb6c20', String.Regex: '#1c7e71', Number: '#B452CD', Operator.Word: '#8B008B', Keyword: '#8B008B bold', Keyword.Type: '#a7a7a7', Name.Class: '#008b45 bold', Name.Exception: '#008b45 bold', Name.Function: '#008b45', Name.Namespace: '#008b45 underline', Name.Variable: '#00688B', Name.Constant: '#00688B', Name.Decorator: '#707a7c', Name.Tag: '#8B008B bold', Name.Attribute: '#658b00', Name.Builtin: '#658b00', Generic.Heading: 'bold #000080', Generic.Subheading: 'bold #800080', Generic.Deleted: '#aa0000', Generic.Inserted: '#00aa00', Generic.Error: '#aa0000', Generic.Emph: 'italic', Generic.Strong: 'bold', Generic.Prompt: '#555555', Generic.Output: '#888888', Generic.Traceback: '#aa0000', Error: 'bg:#e3d2d2 #a61717' }
mit
ahmadiga/min_edx
common/djangoapps/third_party_auth/tests/specs/test_google.py
67
1132
"""Integration tests for Google providers.""" from third_party_auth.tests.specs import base class GoogleOauth2IntegrationTest(base.Oauth2IntegrationTest): """Integration tests for provider.GoogleOauth2.""" def setUp(self): super(GoogleOauth2IntegrationTest, self).setUp() self.provider = self.configure_google_provider( enabled=True, key='google_oauth2_key', secret='google_oauth2_secret', ) TOKEN_RESPONSE_DATA = { 'access_token': 'access_token_value', 'expires_in': 'expires_in_value', 'id_token': 'id_token_value', 'token_type': 'token_type_value', } USER_RESPONSE_DATA = { 'email': '[email protected]', 'family_name': 'family_name_value', 'given_name': 'given_name_value', 'id': 'id_value', 'link': 'link_value', 'locale': 'locale_value', 'name': 'name_value', 'picture': 'picture_value', 'verified_email': 'verified_email_value', } def get_username(self): return self.get_response_data().get('email').split('@')[0]
agpl-3.0
mvaled/OpenUpgrade
addons/membership/membership.py
128
27626
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import time from openerp.osv import fields, osv import openerp.addons.decimal_precision as dp from openerp.tools.translate import _ STATE = [ ('none', 'Non Member'), ('canceled', 'Cancelled Member'), ('old', 'Old Member'), ('waiting', 'Waiting Member'), ('invoiced', 'Invoiced Member'), ('free', 'Free Member'), ('paid', 'Paid Member'), ] STATE_PRIOR = { 'none': 0, 'canceled': 1, 'old': 2, 'waiting': 3, 'invoiced': 4, 'free': 6, 'paid': 7 } class membership_line(osv.osv): '''Member line''' def _get_partners(self, cr, uid, ids, context=None): list_membership_line = [] member_line_obj = self.pool.get('membership.membership_line') for partner in self.pool.get('res.partner').browse(cr, uid, ids, context=context): if partner.member_lines: list_membership_line += member_line_obj.search(cr, uid, [('id', 'in', [ l.id for l in partner.member_lines])], context=context) return list_membership_line def _get_membership_lines(self, cr, uid, ids, context=None): list_membership_line = [] member_line_obj = self.pool.get('membership.membership_line') for invoice in self.pool.get('account.invoice').browse(cr, uid, ids, context=context): if invoice.invoice_line: list_membership_line += member_line_obj.search(cr, uid, [('account_invoice_line', 'in', [ l.id for l in invoice.invoice_line])], context=context) return list_membership_line def _check_membership_date(self, cr, uid, ids, context=None): """Check if membership product is not in the past @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Membership Line IDs @param context: A standard dictionary for contextual values """ cr.execute(''' SELECT MIN(ml.date_to - ai.date_invoice) FROM membership_membership_line ml JOIN account_invoice_line ail ON ( ml.account_invoice_line = ail.id ) JOIN account_invoice ai ON ( ai.id = ail.invoice_id) WHERE ml.id IN %s''', (tuple(ids),)) res = cr.fetchall() for r in res: if r[0] and r[0] < 0: return False return True def _state(self, cr, uid, ids, name, args, context=None): """Compute the state lines @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Membership Line IDs @param name: Field Name @param context: A standard dictionary for contextual values @param return: Dictionary of state Value """ res = {} inv_obj = self.pool.get('account.invoice') for line in self.browse(cr, uid, ids, context=context): cr.execute(''' SELECT i.state, i.id FROM account_invoice i WHERE i.id = ( SELECT l.invoice_id FROM account_invoice_line l WHERE l.id = ( SELECT ml.account_invoice_line FROM membership_membership_line ml WHERE ml.id = %s ) ) ''', (line.id,)) fetched = cr.fetchone() if not fetched: res[line.id] = 'canceled' continue istate = fetched[0] state = 'none' if (istate == 'draft') | (istate == 'proforma'): state = 'waiting' elif istate == 'open': state = 'invoiced' elif istate == 'paid': state = 'paid' inv = inv_obj.browse(cr, uid, fetched[1], context=context) for payment in inv.payment_ids: if payment.invoice and payment.invoice.type == 'out_refund': state = 'canceled' elif istate == 'cancel': state = 'canceled' res[line.id] = state return res _description = __doc__ _name = 'membership.membership_line' _columns = { 'partner': fields.many2one('res.partner', 'Partner', ondelete='cascade', select=1), 'membership_id': fields.many2one('product.product', string="Membership", required=True), 'date_from': fields.date('From', readonly=True), 'date_to': fields.date('To', readonly=True), 'date_cancel': fields.date('Cancel date'), 'date': fields.date('Join Date', help="Date on which member has joined the membership"), 'member_price': fields.float('Membership Fee', digits_compute= dp.get_precision('Product Price'), required=True, help='Amount for the membership'), 'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True), 'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True), 'state': fields.function(_state, string='Membership Status', type='selection', selection=STATE, store = { 'account.invoice': (_get_membership_lines, ['state'], 10), 'res.partner': (_get_partners, ['membership_state'], 12), }, help="""It indicates the membership status. -Non Member: A member who has not applied for any membership. -Cancelled Member: A member who has cancelled his membership. -Old Member: A member whose membership date has expired. -Waiting Member: A member who has applied for the membership and whose invoice is going to be created. -Invoiced Member: A member whose invoice has been created. -Paid Member: A member who has paid the membership amount."""), 'company_id': fields.related('account_invoice_line', 'invoice_id', 'company_id', type="many2one", relation="res.company", string="Company", readonly=True, store=True) } _rec_name = 'partner' _order = 'id desc' _constraints = [ (_check_membership_date, 'Error, this membership product is out of date', []) ] class Partner(osv.osv): '''Partner''' _inherit = 'res.partner' def _get_partner_id(self, cr, uid, ids, context=None): member_line_obj = self.pool.get('membership.membership_line') res_obj = self.pool.get('res.partner') data_inv = member_line_obj.browse(cr, uid, ids, context=context) list_partner = [] for data in data_inv: list_partner.append(data.partner.id) ids2 = list_partner while ids2: ids2 = res_obj.search(cr, uid, [('associate_member', 'in', ids2)], context=context) list_partner += ids2 return list_partner def _get_invoice_partner(self, cr, uid, ids, context=None): inv_obj = self.pool.get('account.invoice') res_obj = self.pool.get('res.partner') data_inv = inv_obj.browse(cr, uid, ids, context=context) list_partner = [] for data in data_inv: list_partner.append(data.partner_id.id) ids2 = list_partner while ids2: ids2 = res_obj.search(cr, uid, [('associate_member', 'in', ids2)], context=context) list_partner += ids2 return list_partner def _membership_state(self, cr, uid, ids, name, args, context=None): """This Function return Membership State For Given Partner. @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Partner IDs @param name: Field Name @param context: A standard dictionary for contextual values @param return: Dictionary of Membership state Value """ res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr, uid, id, context=context) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'canceled' continue if partner_data.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 inv = mline.account_invoice_line.invoice_id for payment in inv.payment_ids: if payment.invoice.type == 'out_refund': s = 2 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from <= mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context=context) res[id] = res_state[partner_data.associate_member.id] return res def _membership_date(self, cr, uid, ids, name, args, context=None): """Return date of membership""" name = name[0] res = {} member_line_obj = self.pool.get('membership.membership_line') for partner in self.browse(cr, uid, ids, context=context): if partner.associate_member: partner_id = partner.associate_member.id else: partner_id = partner.id res[partner.id] = { 'membership_start': False, 'membership_stop': False, 'membership_cancel': False } if name == 'membership_start': line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)], limit=1, order='date_from', context=context) if line_id: res[partner.id]['membership_start'] = member_line_obj.read(cr, uid, [line_id[0]], ['date_from'], context=context)[0]['date_from'] if name == 'membership_stop': line_id1 = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)], limit=1, order='date_to desc', context=context) if line_id1: res[partner.id]['membership_stop'] = member_line_obj.read(cr, uid, [line_id1[0]], ['date_to'], context=context)[0]['date_to'] if name == 'membership_cancel': if partner.membership_state == 'canceled': line_id2 = member_line_obj.search(cr, uid, [('partner', '=', partner.id)], limit=1, order='date_cancel', context=context) if line_id2: res[partner.id]['membership_cancel'] = member_line_obj.read(cr, uid, [line_id2[0]], ['date_cancel'], context=context)[0]['date_cancel'] return res def _get_partners(self, cr, uid, ids, context=None): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member', 'in', ids2)], context=context) ids += ids2 return ids def __get_membership_state(self, *args, **kwargs): return self._membership_state(*args, **kwargs) _columns = { 'associate_member': fields.many2one('res.partner', 'Associate Member',help="A member with whom you want to associate your membership.It will consider the membership state of the associated member."), 'member_lines': fields.one2many('membership.membership_line', 'partner', 'Membership'), 'free_member': fields.boolean('Free Member', help = "Select if you want to give free membership."), 'membership_amount': fields.float( 'Membership Amount', digits=(16, 2), help = 'The price negotiated by the partner'), 'membership_state': fields.function( __get_membership_state, string = 'Current Membership Status', type = 'selection', selection = STATE, store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (_get_partners, ['free_member', 'membership_state', 'associate_member'], 10) }, help='It indicates the membership state.\n' '-Non Member: A partner who has not applied for any membership.\n' '-Cancelled Member: A member who has cancelled his membership.\n' '-Old Member: A member whose membership date has expired.\n' '-Waiting Member: A member who has applied for the membership and whose invoice is going to be created.\n' '-Invoiced Member: A member whose invoice has been created.\n' '-Paying member: A member who has paid the membership fee.'), 'membership_start': fields.function( _membership_date, multi = 'membeship_start', string = 'Membership Start Date', type = 'date', store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10, ), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date from which membership becomes active."), 'membership_stop': fields.function( _membership_date, string = 'Membership End Date', type='date', multi='membership_stop', store = { 'account.invoice': (_get_invoice_partner, ['state'], 10), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date until which membership remains active."), 'membership_cancel': fields.function( _membership_date, string = 'Cancel Membership Date', type='date', multi='membership_cancel', store = { 'account.invoice': (_get_invoice_partner, ['state'], 11), 'membership.membership_line': (_get_partner_id, ['state'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10) }, help="Date on which membership has been cancelled"), } _defaults = { 'free_member': False, 'membership_cancel': False, } def _check_recursion(self, cr, uid, ids, context=None): """Check Recursive for Associated Members. """ level = 100 while len(ids): cr.execute('SELECT DISTINCT associate_member FROM res_partner WHERE id IN %s', (tuple(ids),)) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True _constraints = [ (_check_recursion, 'Error ! You cannot create recursive associated members.', ['associate_member']) ] def create_membership_invoice(self, cr, uid, ids, product_id=None, datas=None, context=None): """ Create Customer Invoice of Membership for partners. @param datas: datas has dictionary value which consist Id of Membership product and Cost Amount of Membership. datas = {'membership_product_id': None, 'amount': None} """ invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoice_tax_obj = self.pool.get('account.invoice.tax') product_id = product_id or datas.get('membership_product_id', False) amount = datas.get('amount', 0.0) invoice_list = [] if type(ids) in (int, long,): ids = [ids] for partner in self.browse(cr, uid, ids, context=context): account_id = partner.property_account_receivable and partner.property_account_receivable.id or False fpos_id = partner.property_account_position and partner.property_account_position.id or False addr = self.address_get(cr, uid, [partner.id], ['invoice']) if partner.free_member: raise osv.except_osv(_('Error!'), _("Partner is a free Member.")) if not addr.get('invoice', False): raise osv.except_osv(_('Error!'), _("Partner doesn't have an address to make the invoice.")) quantity = 1 line_value = { 'product_id': product_id, } line_dict = invoice_line_obj.product_id_change(cr, uid, {}, product_id, False, quantity, '', 'out_invoice', partner.id, fpos_id, price_unit=amount, context=context) line_value.update(line_dict['value']) line_value['price_unit'] = amount if line_value.get('invoice_line_tax_id', False): tax_tab = [(6, 0, line_value['invoice_line_tax_id'])] line_value['invoice_line_tax_id'] = tax_tab invoice_id = invoice_obj.create(cr, uid, { 'partner_id': partner.id, 'account_id': account_id, 'fiscal_position': fpos_id or False }, context=context) line_value['invoice_id'] = invoice_id invoice_line_id = invoice_line_obj.create(cr, uid, line_value, context=context) invoice_obj.write(cr, uid, invoice_id, {'invoice_line': [(6, 0, [invoice_line_id])]}, context=context) invoice_list.append(invoice_id) if line_value['invoice_line_tax_id']: tax_value = invoice_tax_obj.compute(cr, uid, invoice_id).values() for tax in tax_value: invoice_tax_obj.create(cr, uid, tax, context=context) #recompute the membership_state of those partners self.pool.get('res.partner').write(cr, uid, ids, {}) return invoice_list class Product(osv.osv): def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): model_obj = self.pool.get('ir.model.data') if context is None: context = {} if ('product' in context) and (context['product']=='membership_product'): model_data_ids_form = model_obj.search(cr, user, [('model','=','ir.ui.view'), ('name', 'in', ['membership_products_form', 'membership_products_tree'])], context=context) resource_id_form = model_obj.read(cr, user, model_data_ids_form, fields=['res_id', 'name'], context=context) dict_model = {} for i in resource_id_form: dict_model[i['name']] = i['res_id'] if view_type == 'form': view_id = dict_model['membership_products_form'] else: view_id = dict_model['membership_products_tree'] return super(Product,self).fields_view_get(cr, user, view_id, view_type, context, toolbar, submenu) '''Product''' _inherit = 'product.template' _columns = { 'membership': fields.boolean('Membership', help='Check if the product is eligible for membership.'), 'membership_date_from': fields.date('Membership Start Date', help='Date from which membership becomes active.'), 'membership_date_to': fields.date('Membership End Date', help='Date until which membership remains active.'), } _sql_constraints = [('membership_date_greater','check(membership_date_to >= membership_date_from)','Error ! Ending Date cannot be set before Beginning Date.')] _defaults = { 'membership': False, } class Invoice(osv.osv): '''Invoice''' _inherit = 'account.invoice' def action_cancel(self, cr, uid, ids, context=None): '''Create a 'date_cancel' on the membership_line object''' member_line_obj = self.pool.get('membership.membership_line') today = time.strftime('%Y-%m-%d') for invoice in self.browse(cr, uid, ids, context=context): mlines = member_line_obj.search(cr, uid, [('account_invoice_line', 'in', [l.id for l in invoice.invoice_line])]) member_line_obj.write(cr, uid, mlines, {'date_cancel': today}) return super(Invoice, self).action_cancel(cr, uid, ids, context=context) class account_invoice_line(osv.osv): _inherit='account.invoice.line' def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ member_line_obj = self.pool.get('membership.membership_line') res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) for line in self.browse(cr, uid, ids, context=context): if line.invoice_id.type == 'out_invoice': ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', line.id)], context=context) if line.product_id and line.product_id.membership and not ml_ids: # Product line has changed to a membership product date_from = line.product_id.membership_date_from date_to = line.product_id.membership_date_to if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to: date_from = line.invoice_id.date_invoice member_line_obj.create(cr, uid, { 'partner': line.invoice_id.partner_id.id, 'membership_id': line.product_id.id, 'member_price': line.price_unit, 'date': time.strftime('%Y-%m-%d'), 'date_from': date_from, 'date_to': date_to, 'account_invoice_line': line.id, }, context=context) if line.product_id and not line.product_id.membership and ml_ids: # Product line has changed to a non membership product member_line_obj.unlink(cr, uid, ml_ids, context=context) return res def unlink(self, cr, uid, ids, context=None): """Remove Membership Line Record for Account Invoice Line """ member_line_obj = self.pool.get('membership.membership_line') for id in ids: ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', id)], context=context) member_line_obj.unlink(cr, uid, ml_ids, context=context) return super(account_invoice_line, self).unlink(cr, uid, ids, context=context) def create(self, cr, uid, vals, context=None): """Overrides orm create method """ member_line_obj = self.pool.get('membership.membership_line') result = super(account_invoice_line, self).create(cr, uid, vals, context=context) line = self.browse(cr, uid, result, context=context) if line.invoice_id.type == 'out_invoice': ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', line.id)], context=context) if line.product_id and line.product_id.membership and not ml_ids: # Product line is a membership product date_from = line.product_id.membership_date_from date_to = line.product_id.membership_date_to if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to: date_from = line.invoice_id.date_invoice member_line_obj.create(cr, uid, { 'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False, 'membership_id': line.product_id.id, 'member_price': line.price_unit, 'date': time.strftime('%Y-%m-%d'), 'date_from': date_from, 'date_to': date_to, 'account_invoice_line': line.id, }, context=context) return result # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
pinkeshbadjatiya/listenbrainz-server
listenstore/listenstore/listen.py
1
2104
# coding=utf-8 from __future__ import division, absolute_import, print_function, unicode_literals import ujson from datetime import datetime import calendar class Listen(object): """ Represents a listen object """ def __init__(self, user_id=None, timestamp=None, artist_msid=None, album_msid=None, recording_msid=None, data=None): self.user_id = user_id self.timestamp = timestamp self.ts_since_epoch = calendar.timegm(self.timestamp.utctimetuple()) if self.timestamp else None self.artist_msid = artist_msid self.album_msid = album_msid self.recording_msid = recording_msid if data is None: self.data = {'additional_info': {}} else: self.data = data @classmethod def from_json(cls, j): """Factory to make Listen() objects from a dict""" return cls( user_id=j['user_id'] , timestamp=datetime.utcfromtimestamp(float(j['listened_at'])) , artist_msid=j['track_metadata']['additional_info'].get('artist_msid') , album_msid=j['track_metadata']['additional_info'].get('album_msid') , recording_msid=j.get('recording_msid') , data=j.get('track_metadata') ) def to_json(self): return { 'user_id': self.user_id, 'timestamp': self.timestamp, 'track_metadata': self.data, 'recording_msid': self.recording_msid } def validate(self): return (self.user_id is not None and self.timestamp is not None and self.artist_msid is not None and self.recording_msid is not None and self.data is not None) @property def date(self): return self.timestamp def __repr__(self): return unicode(self).encode("utf-8") def __unicode__(self): return u"<Listen: user_id: %s, time: %s, artist_msid: %s, album_msid: %s, recording_msid: %s>" % \ (self.user_id, self.ts_since_epoch, self.artist_msid, self.album_msid, self.recording_msid)
gpl-2.0
n6151h/pyconau2016
zkpylons/tests/functional/test_fulfilment_type.py
3
2256
from .crud_helper import CrudHelper from .fixtures import FulfilmentStatusFactory, FulfilmentTypeFactory class TestFulfilmentType(CrudHelper): def test_new(self, app, db_session): statie = [FulfilmentStatusFactory() for i in range(10)] db_session.commit() data = { "name" : "Jhonny", "initial_status" : statie[5].id, 'status' : [statie[0].id, statie[3].id, statie[8].id] } CrudHelper.test_new(self, app, db_session, data=data) def test_view(self, app, db_session): statie = [FulfilmentStatusFactory() for i in range(3)] target = FulfilmentTypeFactory(status=statie) db_session.commit() expected = [target.name, statie[0].name, statie[1].name, statie[2].name] CrudHelper.test_view(self, app, db_session, target=target, expected=expected) def test_edit(self, app, db_session): statie = [FulfilmentStatusFactory() for i in range(10)] target = FulfilmentTypeFactory(initial_status=statie[2], status=statie) db_session.commit() initial_values = { "name" : target.name, "initial_status" : str(statie[2].id), } new_status = [statie[0].id, statie[3].id, statie[8].id] new_values = { "name" : "Jhonny", "initial_status" : statie[7].id, } def extra_form_check(form): assert 'fulfilment_type.status' in form.fields assert len(form['fulfilment_type.status'].value) == len(statie) assert form['fulfilment_type.status'].value.sort() == [str(s.id) for s in statie].sort() def extra_form_set(form): form['fulfilment_type.status'] = new_status def extra_data_check(new): new_stat_ids = [t.id for t in new.status] assert len(new_stat_ids) == len(new_status) for id in new_status: assert id in new_stat_ids CrudHelper.test_edit(self, app, db_session, initial_values=initial_values, new_values=new_values, extra_form_check=extra_form_check, extra_form_set=extra_form_set, extra_data_check=extra_data_check, target=target)
gpl-2.0
elucify/robotframework-selenium2library
src/Selenium2Library/keywords/_logging.py
65
1206
import os import sys from robot.variables import GLOBAL_VARIABLES from robot.api import logger from keywordgroup import KeywordGroup class _LoggingKeywords(KeywordGroup): # Private def _debug(self, message): logger.debug(message) def _get_log_dir(self): logfile = GLOBAL_VARIABLES['${LOG FILE}'] if logfile != 'NONE': return os.path.dirname(logfile) return GLOBAL_VARIABLES['${OUTPUTDIR}'] def _html(self, message): logger.info(message, True, False) def _info(self, message): logger.info(message) def _log(self, message, level='INFO'): level = level.upper() if (level == 'INFO'): self._info(message) elif (level == 'DEBUG'): self._debug(message) elif (level == 'WARN'): self._warn(message) elif (level == 'HTML'): self._html(message) def _log_list(self, items, what='item'): msg = ['Altogether %d %s%s.' % (len(items), what, ['s',''][len(items)==1])] for index, item in enumerate(items): msg.append('%d: %s' % (index+1, item)) self._info('\n'.join(msg)) return items def _warn(self, message): logger.warn(message)
apache-2.0
antonyc/django-rest-framework
tests/conftest.py
84
1809
def pytest_configure(): from django.conf import settings settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}, SITE_ID=1, SECRET_KEY='not very secret in tests', USE_I18N=True, USE_L10N=True, STATIC_URL='/static/', ROOT_URLCONF='tests.urls', TEMPLATE_LOADERS=( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ), MIDDLEWARE_CLASSES=( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ), INSTALLED_APPS=( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.staticfiles', 'rest_framework', 'rest_framework.authtoken', 'tests', ), PASSWORD_HASHERS=( 'django.contrib.auth.hashers.MD5PasswordHasher', ), ) # guardian is optional try: import guardian # NOQA except ImportError: pass else: settings.ANONYMOUS_USER_ID = -1 settings.AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend', ) settings.INSTALLED_APPS += ( 'guardian', ) try: import django django.setup() except AttributeError: pass
bsd-2-clause
atuljain/odoo
addons/membership/wizard/__init__.py
432
1071
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import membership_invoice # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
anetasie/sherpa
sherpa/ui/__init__.py
4
1720
# # Copyright (C) 2007, 2018 Smithsonian Astrophysical Observatory # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # import sherpa.all import sherpa.ui.utils from sherpa.utils import calc_mlr, calc_ftest, rebin, histogram1d, \ histogram2d, gamma, lgam, igamc, igam, incbet, multinormal_pdf, \ multit_pdf from sherpa.data import Data1D, Data1DInt, Data2D, Data2DInt from sherpa.logposterior import Prior # We build up __all__ as we go along __all__ = ['calc_mlr', 'calc_ftest', 'Data1D', 'Data1DInt', 'Data2D', 'Data2DInt', 'rebin', 'histogram1d', 'histogram2d', 'gamma', 'lgam', 'igamc', 'igam', 'incbet', 'Prior', 'multinormal_pdf', 'multit_pdf'] _session = utils.Session() _session._add_model_types(sherpa.models.basic) _session._add_model_types(sherpa.models.template) # To get PSFModel in list of models -- doesn't inherit from ArithmeticModel _session._add_model_types(sherpa.instrument, baselist=(sherpa.models.Model,)) __all__.extend(_session._export_names(globals())) __all__ = tuple(__all__)
gpl-3.0
artwr/airflow
airflow/contrib/auth/backends/ldap_auth.py
1
11630
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from future.utils import native import flask_login from flask_login import login_required, current_user, logout_user # noqa: F401 from flask import flash from wtforms import Form, PasswordField, StringField from wtforms.validators import InputRequired from ldap3 import Server, Connection, Tls, set_config_parameter, LEVEL, SUBTREE import ssl from flask import url_for, redirect from airflow import models from airflow import configuration from airflow.configuration import AirflowConfigException from airflow.utils.db import provide_session import traceback import re from airflow.utils.log.logging_mixin import LoggingMixin login_manager = flask_login.LoginManager() login_manager.login_view = 'airflow.login' # Calls login() below login_manager.login_message = None log = LoggingMixin().log class AuthenticationError(Exception): pass class LdapException(Exception): pass def get_ldap_connection(dn=None, password=None): try: cacert = configuration.conf.get("ldap", "cacert") except AirflowConfigException: pass try: ignore_malformed_schema = configuration.conf.get("ldap", "ignore_malformed_schema") except AirflowConfigException: pass if ignore_malformed_schema: set_config_parameter('IGNORE_MALFORMED_SCHEMA', ignore_malformed_schema) tls_configuration = Tls(validate=ssl.CERT_REQUIRED, ca_certs_file=cacert) server = Server(configuration.conf.get("ldap", "uri"), use_ssl=True, tls=tls_configuration) conn = Connection(server, native(dn), native(password)) if not conn.bind(): log.error("Cannot bind to ldap server: %s ", conn.last_error) raise AuthenticationError("Cannot bind to ldap server") return conn def group_contains_user(conn, search_base, group_filter, user_name_attr, username): search_filter = '(&({0}))'.format(group_filter) if not conn.search(native(search_base), native(search_filter), attributes=[native(user_name_attr)]): log.warning("Unable to find group for %s %s", search_base, search_filter) else: for entry in conn.entries: if username.lower() in map(lambda attr: attr.lower(), getattr(entry, user_name_attr).values): return True return False def groups_user(conn, search_base, user_filter, user_name_att, username): search_filter = "(&({0})({1}={2}))".format(user_filter, user_name_att, username) try: memberof_attr = configuration.conf.get("ldap", "group_member_attr") except Exception: memberof_attr = "memberOf" res = conn.search(native(search_base), native(search_filter), attributes=[native(memberof_attr)]) if not res: log.info("Cannot find user %s", username) raise AuthenticationError("Invalid username or password") if conn.response and memberof_attr not in conn.response[0]["attributes"]: log.warning("""Missing attribute "%s" when looked-up in Ldap database. The user does not seem to be a member of a group and therefore won't see any dag if the option filter_by_owner=True and owner_mode=ldapgroup are set""", memberof_attr) return [] user_groups = conn.response[0]["attributes"][memberof_attr] regex = re.compile("cn=([^,]*).*", re.IGNORECASE) groups_list = [] try: groups_list = [regex.search(i).group(1) for i in user_groups] except IndexError: log.warning("Parsing error when retrieving the user's group(s)." " Check if the user belongs to at least one group" " or if the user's groups name do not contain special characters") return groups_list class LdapUser(models.User): def __init__(self, user): self.user = user self.ldap_groups = [] # Load and cache superuser and data_profiler settings. conn = get_ldap_connection(configuration.conf.get("ldap", "bind_user"), configuration.conf.get("ldap", "bind_password")) superuser_filter = None data_profiler_filter = None try: superuser_filter = configuration.conf.get("ldap", "superuser_filter") except AirflowConfigException: pass if not superuser_filter: self.superuser = True log.debug("Missing configuration for superuser settings or empty. Skipping.") else: self.superuser = group_contains_user(conn, configuration.conf.get("ldap", "basedn"), superuser_filter, configuration.conf.get("ldap", "user_name_attr"), user.username) try: data_profiler_filter = configuration.conf.get("ldap", "data_profiler_filter") except AirflowConfigException: pass if not data_profiler_filter: self.data_profiler = True log.debug("Missing configuration for data profiler settings or empty. " "Skipping.") else: self.data_profiler = group_contains_user( conn, configuration.conf.get("ldap", "basedn"), data_profiler_filter, configuration.conf.get("ldap", "user_name_attr"), user.username ) # Load the ldap group(s) a user belongs to try: self.ldap_groups = groups_user( conn, configuration.conf.get("ldap", "basedn"), configuration.conf.get("ldap", "user_filter"), configuration.conf.get("ldap", "user_name_attr"), user.username ) except AirflowConfigException: log.debug("Missing configuration for ldap settings. Skipping") @staticmethod def try_login(username, password): conn = get_ldap_connection(configuration.conf.get("ldap", "bind_user"), configuration.conf.get("ldap", "bind_password")) search_filter = "(&({0})({1}={2}))".format( configuration.conf.get("ldap", "user_filter"), configuration.conf.get("ldap", "user_name_attr"), username ) search_scope = LEVEL if configuration.conf.has_option("ldap", "search_scope"): if configuration.conf.get("ldap", "search_scope") == "SUBTREE": search_scope = SUBTREE else: search_scope = LEVEL # todo: BASE or ONELEVEL? res = conn.search(native(configuration.conf.get("ldap", "basedn")), native(search_filter), search_scope=native(search_scope)) # todo: use list or result? if not res: log.info("Cannot find user %s", username) raise AuthenticationError("Invalid username or password") entry = conn.response[0] conn.unbind() if 'dn' not in entry: # The search filter for the user did not return any values, so an # invalid user was used for credentials. raise AuthenticationError("Invalid username or password") try: conn = get_ldap_connection(entry['dn'], password) except KeyError: log.error(""" Unable to parse LDAP structure. If you're using Active Directory and not specifying an OU, you must set search_scope=SUBTREE in airflow.cfg. %s """ % traceback.format_exc()) raise LdapException( "Could not parse LDAP structure. " "Try setting search_scope in airflow.cfg, or check logs" ) if not conn: log.info("Password incorrect for user %s", username) raise AuthenticationError("Invalid username or password") @property def is_active(self): """Required by flask_login""" return True @property def is_authenticated(self): """Required by flask_login""" return True @property def is_anonymous(self): """Required by flask_login""" return False def get_id(self): """Returns the current user id as required by flask_login""" return self.user.get_id() def data_profiling(self): """Provides access to data profiling tools""" return self.data_profiler def is_superuser(self): """Access all the things""" return self.superuser @login_manager.user_loader @provide_session def load_user(userid, session=None): log.debug("Loading user %s", userid) if not userid or userid == 'None': return None user = session.query(models.User).filter(models.User.id == int(userid)).first() return LdapUser(user) @provide_session def login(self, request, session=None): if current_user.is_authenticated: flash("You are already logged in") return redirect(url_for('admin.index')) username = None password = None form = LoginForm(request.form) if request.method == 'POST' and form.validate(): username = request.form.get("username") password = request.form.get("password") if not username or not password: return self.render('airflow/login.html', title="Airflow - Login", form=form) try: LdapUser.try_login(username, password) log.info("User %s successfully authenticated", username) user = session.query(models.User).filter( models.User.username == username).first() if not user: user = models.User( username=username, is_superuser=False) session.add(user) session.commit() session.merge(user) flask_login.login_user(LdapUser(user)) session.commit() return redirect(request.args.get("next") or url_for("admin.index")) except (LdapException, AuthenticationError) as e: if type(e) == LdapException: flash(e, "error") else: flash("Incorrect login details") return self.render('airflow/login.html', title="Airflow - Login", form=form) class LoginForm(Form): username = StringField('Username', [InputRequired()]) password = PasswordField('Password', [InputRequired()])
apache-2.0
mashaoze/esp-idf
examples/protocols/mqtt/ws/mqtt_ws_example_test.py
2
6064
import re import os import sys import time import socket import imp use_mqtt_client_sketch = False try: imp.find_module('paho') import paho.mqtt.client as mqtt # Make things with supposed existing module except ImportError: use_mqtt_client_sketch = True pass global g_recv_topic global g_recv_data g_recv_data="" # This is only a workaround for running mqtt client with 'hardcoded' data using plain socket interface def mqtt_client_sketch(): global g_recv_topic global g_recv_data http_connect = bytearray([ 0x47, 0x45, 0x54, 0x20, 0x2f, 0x77, 0x73, 0x20, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, 0x6f, 0x74, 0x2e, 0x65, 0x63, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x3a, 0x38, 0x30, 0x0d, 0x0a, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x3a, 0x20, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x0d, 0x0a, 0x53, 0x65, 0x63, 0x2d, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x31, 0x33, 0x0d, 0x0a, 0x53, 0x65, 0x63, 0x2d, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x3a, 0x20, 0x6d, 0x71, 0x74, 0x74, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x0d, 0x0a, 0x53, 0x65, 0x63, 0x2d, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2d, 0x4b, 0x65, 0x79, 0x3a, 0x20, 0x6c, 0x35, 0x61, 0x50, 0x41, 0x64, 0x6d, 0x4a, 0x52, 0x65, 0x32, 0x79, 0x55, 0x42, 0x79, 0x68, 0x37, 0x35, 0x72, 0x58, 0x68, 0x51, 0x3d, 0x3d, 0x0d, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x69, 0x6f, 0x74, 0x2e, 0x65, 0x63, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x3a, 0x38, 0x30, 0x0d, 0x0a, 0x0d, 0x0a]) connect_msg = bytearray([0x82, 0x8e, 0x82, 0x1a, 0xe6, 0x22, 0x92, 0x16, 0xe6, 0x26, 0xcf, 0x4b, 0xb2, 0x76, 0x86, 0x18, 0xe6, 0x1e, 0x82, 0x1a]) send_qos0_msg = bytearray([ 0x82, 0x9c, 0x44, 0x78, 0xdf, 0x8e, 0x74, 0x62, 0xdf, 0x85, 0x6b, 0x0c, 0xb0, 0xfe, 0x2d, 0x1b, 0xf0, 0xff, 0x2b, 0x0b, 0xef, 0xea, 0x25, 0x0c, 0xbe, 0xd1, 0x30, 0x17, 0x80, 0xeb, 0x37, 0x08, 0xec, 0xbc ]) subscribe_qos0 = bytearray([ 0x82, 0x92, 0x8e, 0x31, 0x8c, 0x4a, 0x0c, 0x21, 0x8c, 0x4b, 0x8e, 0x3a, 0xa3, 0x3e, 0xe1, 0x41, 0xe5, 0x29, 0xa1, 0x40, 0xe3, 0x39, 0xbe, 0x31] ) cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) cli.settimeout(30) cli.connect(("iot.eclipse.org", 80)) cli.send(http_connect) cli.send(connect_msg) data = cli.recv(1024) print("Connect ack received {}".format(data)) cli.send(subscribe_qos0) data = cli.recv(1024) print("Subscibe ack received {}".format(data)) start = time.time() while (time.time() - start) <= 20: data = cli.recv(1024) print("Data received {}".format(data[-17:])) if data[-15:] == "/topic/qos0data": g_recv_topic = data[-15:][:11] g_recv_data = data[-4:] cli.send(send_qos0_msg) data = cli.recv(1024) print("data ack received {}".format(data)) break cli.close() # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) client.subscribe("/topic/qos0") # The callback for when a PUBLISH message is received from the server. def on_message(client, userdata, msg): global g_recv_topic global g_recv_data if g_recv_data == "" and msg.payload == "data": client.publish("/topic/qos0", "data_to_esp32") g_recv_topic = msg.topic g_recv_data = msg.payload print(msg.topic+" "+str(msg.payload)) # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, # we need to set environment variable `TEST_FW_PATH`, # then get and insert `TEST_FW_PATH` to sys path before import FW module test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import TinyFW import IDF @IDF.idf_example_test(env_tag="Example_WIFI") def test_examples_protocol_mqtt_ws(env, extra_data): global g_recv_topic global g_recv_data """ steps: | 1. join AP and connects to ws broker 2. Test connects a client to the same broker 3. Test evaluates it received correct qos0 message 4. Test ESP32 client received correct qos0 message """ dut1 = env.get_dut("mqtt_websocket", "examples/protocols/mqtt/ws") # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_websocket.bin") bin_size = os.path.getsize(binary_file) IDF.log_performance("mqtt_websocket_bin_size", "{}KB".format(bin_size//1024)) IDF.check_performance("mqtt_websocket_size", bin_size//1024) # 1. start test dut1.start_app() # 2. Test connects to a broker if use_mqtt_client_sketch: mqtt_client_sketch() else: client = mqtt.Client(transport="websockets") client.on_connect = on_connect client.on_message = on_message client.ws_set_options(path="/ws", headers=None) print "Connecting..." client.connect("iot.eclipse.org", 80, 60) print "...done" print "Start Looping..." start = time.time() while (time.time() - start) <= 20: client.loop() print "...done" # 3. check the message received back from the server if g_recv_topic == "/topic/qos0" and g_recv_data == "data" : print("PASS: Received correct message") else: print("Failure!") raise ValueError('Wrong data received topic: {}, data:{}'.format(g_recv_topic, g_recv_data)) # 4. check that the esp32 client received data sent by this python client dut1.expect(re.compile(r"DATA=data_to_esp32"), timeout=30) if __name__ == '__main__': test_examples_protocol_mqtt_ws()
apache-2.0
kevinr/750book-web
750book-web-env/lib/python2.7/site-packages/django/template/loader.py
64
8040
# Wrapper for loading templates from storage of some sort (e.g. filesystem, database). # # This uses the TEMPLATE_LOADERS setting, which is a list of loaders to use. # Each loader is expected to have this interface: # # callable(name, dirs=[]) # # name is the template name. # dirs is an optional list of directories to search instead of TEMPLATE_DIRS. # # The loader should return a tuple of (template_source, path). The path returned # might be shown to the user for debugging purposes, so it should identify where # the template was loaded from. # # A loader may return an already-compiled template instead of the actual # template source. In that case the path returned should be None, since the # path information is associated with the template during the compilation, # which has already been done. # # Each loader should have an "is_usable" attribute set. This is a boolean that # specifies whether the loader can be used in this Python installation. Each # loader is responsible for setting this when it's initialized. # # For example, the eggs loader (which is capable of loading templates from # Python eggs) sets is_usable to False if the "pkg_resources" module isn't # installed, because pkg_resources is necessary to read eggs. from django.core.exceptions import ImproperlyConfigured from django.template import Origin, Template, Context, TemplateDoesNotExist, add_to_builtins from django.utils.importlib import import_module from django.conf import settings template_source_loaders = None class BaseLoader(object): is_usable = False def __init__(self, *args, **kwargs): pass def __call__(self, template_name, template_dirs=None): return self.load_template(template_name, template_dirs) def load_template(self, template_name, template_dirs=None): source, display_name = self.load_template_source(template_name, template_dirs) origin = make_origin(display_name, self.load_template_source, template_name, template_dirs) try: template = get_template_from_string(source, origin, template_name) return template, None except TemplateDoesNotExist: # If compiling the template we found raises TemplateDoesNotExist, back off to # returning the source and display name for the template we were asked to load. # This allows for correct identification (later) of the actual template that does # not exist. return source, display_name def load_template_source(self, template_name, template_dirs=None): """ Returns a tuple containing the source and origin for the given template name. """ raise NotImplementedError def reset(self): """ Resets any state maintained by the loader instance (e.g., cached templates or cached loader modules). """ pass class LoaderOrigin(Origin): def __init__(self, display_name, loader, name, dirs): super(LoaderOrigin, self).__init__(display_name) self.loader, self.loadname, self.dirs = loader, name, dirs def reload(self): return self.loader(self.loadname, self.dirs)[0] def make_origin(display_name, loader, name, dirs): if settings.TEMPLATE_DEBUG and display_name: return LoaderOrigin(display_name, loader, name, dirs) else: return None def find_template_loader(loader): if isinstance(loader, (tuple, list)): loader, args = loader[0], loader[1:] else: args = [] if isinstance(loader, basestring): module, attr = loader.rsplit('.', 1) try: mod = import_module(module) except ImportError, e: raise ImproperlyConfigured('Error importing template source loader %s: "%s"' % (loader, e)) try: TemplateLoader = getattr(mod, attr) except AttributeError, e: raise ImproperlyConfigured('Error importing template source loader %s: "%s"' % (loader, e)) if hasattr(TemplateLoader, 'load_template_source'): func = TemplateLoader(*args) else: # Try loading module the old way - string is full path to callable if args: raise ImproperlyConfigured("Error importing template source loader %s - can't pass arguments to function-based loader." % loader) func = TemplateLoader if not func.is_usable: import warnings warnings.warn("Your TEMPLATE_LOADERS setting includes %r, but your Python installation doesn't support that type of template loading. Consider removing that line from TEMPLATE_LOADERS." % loader) return None else: return func else: raise ImproperlyConfigured('Loader does not define a "load_template" callable template source loader') def find_template(name, dirs=None): # Calculate template_source_loaders the first time the function is executed # because putting this logic in the module-level namespace may cause # circular import errors. See Django ticket #1292. global template_source_loaders if template_source_loaders is None: loaders = [] for loader_name in settings.TEMPLATE_LOADERS: loader = find_template_loader(loader_name) if loader is not None: loaders.append(loader) template_source_loaders = tuple(loaders) for loader in template_source_loaders: try: source, display_name = loader(name, dirs) return (source, make_origin(display_name, loader, name, dirs)) except TemplateDoesNotExist: pass raise TemplateDoesNotExist(name) def find_template_source(name, dirs=None): # For backward compatibility import warnings warnings.warn( "`django.template.loaders.find_template_source` is deprecated; use `django.template.loaders.find_template` instead.", PendingDeprecationWarning ) template, origin = find_template(name, dirs) if hasattr(template, 'render'): raise Exception("Found a compiled template that is incompatible with the deprecated `django.template.loaders.find_template_source` function.") return template, origin def get_template(template_name): """ Returns a compiled Template object for the given template name, handling template inheritance recursively. """ template, origin = find_template(template_name) if not hasattr(template, 'render'): # template needs to be compiled template = get_template_from_string(template, origin, template_name) return template def get_template_from_string(source, origin=None, name=None): """ Returns a compiled Template object for the given template code, handling template inheritance recursively. """ return Template(source, origin, name) def render_to_string(template_name, dictionary=None, context_instance=None): """ Loads the given template_name and renders it with the given dictionary as context. The template_name may be a string to load a single template using get_template, or it may be a tuple to use select_template to find one of the templates in the list. Returns a string. """ dictionary = dictionary or {} if isinstance(template_name, (list, tuple)): t = select_template(template_name) else: t = get_template(template_name) if context_instance: context_instance.update(dictionary) else: context_instance = Context(dictionary) return t.render(context_instance) def select_template(template_name_list): "Given a list of template names, returns the first that can be loaded." for template_name in template_name_list: try: return get_template(template_name) except TemplateDoesNotExist: continue # If we get here, none of the templates could be loaded raise TemplateDoesNotExist(', '.join(template_name_list)) add_to_builtins('django.template.loader_tags')
mit
encukou/freeipa
ipaclient/remote_plugins/2_164/join.py
8
1490
# # Copyright (C) 2016 FreeIPA Contributors see COPYING for license # # pylint: disable=unused-import import six from . import Command, Method, Object from ipalib import api, parameters, output from ipalib.parameters import DefaultFrom from ipalib.plugable import Registry from ipalib.text import _ from ipapython.dn import DN from ipapython.dnsutil import DNSName if six.PY3: unicode = str __doc__ = _(""" Joining an IPA domain """) register = Registry() @register() class join(Command): __doc__ = _("Join an IPA domain") takes_args = ( parameters.Str( 'cn', cli_name='hostname', doc=_(u'The hostname to register as'), default_from=DefaultFrom(lambda : None), # FIXME: # lambda: unicode(installutils.get_fqdn()) autofill=True, ), ) takes_options = ( parameters.Str( 'realm', doc=_(u'The IPA realm'), default_from=DefaultFrom(lambda: api.env.realm), autofill=True, ), parameters.Str( 'nshardwareplatform', required=False, cli_name='platform', doc=_(u'Hardware platform of the host (e.g. Lenovo T61)'), ), parameters.Str( 'nsosversion', required=False, cli_name='os', doc=_(u'Operating System and version of the host (e.g. Fedora 9)'), ), ) has_output = ( )
gpl-3.0
marionleborgne/nupic
tests/unit/nupic/data/functionsource_test.py
15
3217
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- """ Unit tests for functionsource. """ import pickle import unittest from nupic.data import FunctionSource def dataFunction(stat): ret = {"reset": 0, "sequence": 0, "data": 0} if stat is not None: val = stat.get("val", 0) + 1 ret["val"] = stat["val"] = val return ret class FunctionSourceTest(unittest.TestCase): def testDefaultArgs(self): fs = FunctionSource(dataFunction, state=None, resetFieldName=None, sequenceIdFieldName=None) self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) def testResetField(self): fs = FunctionSource(dataFunction, state=None, resetFieldName="reset", sequenceIdFieldName=None) self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) def testSequenceField(self): fs = FunctionSource(dataFunction, state=None, resetFieldName=None, sequenceIdFieldName="sequence") self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) def testResetAndSequenceFields(self): fs = FunctionSource(dataFunction, state=None, resetFieldName="reset", sequenceIdFieldName="sequence") self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) def testState(self): state = dict(val=100) fs = FunctionSource(dataFunction, state=state, resetFieldName="reset", sequenceIdFieldName="sequence") self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) r = fs.getNextRecordDict() r = fs.getNextRecordDict() self.assertEqual(103, state["val"]) def testPickle(self): state = dict(val=100) fs = FunctionSource(dataFunction, state=state, resetFieldName="reset", sequenceIdFieldName="sequence") self.assertIsNotNone(fs) r = fs.getNextRecordDict() self.assertIsNotNone(r) pkl = pickle.dumps(fs) self.assertIsNotNone(pkl) fs2 = pickle.loads(pkl) self.assertIsNotNone(fs2) r = fs2.getNextRecordDict() r = fs2.getNextRecordDict() self.assertEqual(103, fs2.state["val"]) if __name__ == "__main__": unittest.main()
agpl-3.0
HunseopJeong/WATT
tools/WebIDLBinder/third_party/ply/example/GardenSnake/GardenSnake.py
166
19213
# GardenSnake - a parser generator demonstration program # # This implements a modified version of a subset of Python: # - only 'def', 'return' and 'if' statements # - 'if' only has 'then' clause (no elif nor else) # - single-quoted strings only, content in raw format # - numbers are decimal.Decimal instances (not integers or floats) # - no print statment; use the built-in 'print' function # - only < > == + - / * implemented (and unary + -) # - assignment and tuple assignment work # - no generators of any sort # - no ... well, no quite a lot # Why? I'm thinking about a new indentation-based configuration # language for a project and wanted to figure out how to do it. Once # I got that working I needed a way to test it out. My original AST # was dumb so I decided to target Python's AST and compile it into # Python code. Plus, it's pretty cool that it only took a day or so # from sitting down with Ply to having working code. # This uses David Beazley's Ply from http://www.dabeaz.com/ply/ # This work is hereby released into the Public Domain. To view a copy of # the public domain dedication, visit # http://creativecommons.org/licenses/publicdomain/ or send a letter to # Creative Commons, 543 Howard Street, 5th Floor, San Francisco, # California, 94105, USA. # # Portions of this work are derived from Python's Grammar definition # and may be covered under the Python copyright and license # # Andrew Dalke / Dalke Scientific Software, LLC # 30 August 2006 / Cape Town, South Africa # Changelog: # 30 August - added link to CC license; removed the "swapcase" encoding # Modifications for inclusion in PLY distribution import sys sys.path.insert(0,"../..") from ply import * ##### Lexer ###### #import lex import decimal tokens = ( 'DEF', 'IF', 'NAME', 'NUMBER', # Python decimals 'STRING', # single quoted strings only; syntax of raw strings 'LPAR', 'RPAR', 'COLON', 'EQ', 'ASSIGN', 'LT', 'GT', 'PLUS', 'MINUS', 'MULT', 'DIV', 'RETURN', 'WS', 'NEWLINE', 'COMMA', 'SEMICOLON', 'INDENT', 'DEDENT', 'ENDMARKER', ) #t_NUMBER = r'\d+' # taken from decmial.py but without the leading sign def t_NUMBER(t): r"""(\d+(\.\d*)?|\.\d+)([eE][-+]? \d+)?""" t.value = decimal.Decimal(t.value) return t def t_STRING(t): r"'([^\\']+|\\'|\\\\)*'" # I think this is right ... t.value=t.value[1:-1].decode("string-escape") # .swapcase() # for fun return t t_COLON = r':' t_EQ = r'==' t_ASSIGN = r'=' t_LT = r'<' t_GT = r'>' t_PLUS = r'\+' t_MINUS = r'-' t_MULT = r'\*' t_DIV = r'/' t_COMMA = r',' t_SEMICOLON = r';' # Ply nicely documented how to do this. RESERVED = { "def": "DEF", "if": "IF", "return": "RETURN", } def t_NAME(t): r'[a-zA-Z_][a-zA-Z0-9_]*' t.type = RESERVED.get(t.value, "NAME") return t # Putting this before t_WS let it consume lines with only comments in # them so the latter code never sees the WS part. Not consuming the # newline. Needed for "if 1: #comment" def t_comment(t): r"[ ]*\043[^\n]*" # \043 is '#' pass # Whitespace def t_WS(t): r' [ ]+ ' if t.lexer.at_line_start and t.lexer.paren_count == 0: return t # Don't generate newline tokens when inside of parenthesis, eg # a = (1, # 2, 3) def t_newline(t): r'\n+' t.lexer.lineno += len(t.value) t.type = "NEWLINE" if t.lexer.paren_count == 0: return t def t_LPAR(t): r'\(' t.lexer.paren_count += 1 return t def t_RPAR(t): r'\)' # check for underflow? should be the job of the parser t.lexer.paren_count -= 1 return t def t_error(t): raise SyntaxError("Unknown symbol %r" % (t.value[0],)) print "Skipping", repr(t.value[0]) t.lexer.skip(1) ## I implemented INDENT / DEDENT generation as a post-processing filter # The original lex token stream contains WS and NEWLINE characters. # WS will only occur before any other tokens on a line. # I have three filters. One tags tokens by adding two attributes. # "must_indent" is True if the token must be indented from the # previous code. The other is "at_line_start" which is True for WS # and the first non-WS/non-NEWLINE on a line. It flags the check so # see if the new line has changed indication level. # Python's syntax has three INDENT states # 0) no colon hence no need to indent # 1) "if 1: go()" - simple statements have a COLON but no need for an indent # 2) "if 1:\n go()" - complex statements have a COLON NEWLINE and must indent NO_INDENT = 0 MAY_INDENT = 1 MUST_INDENT = 2 # only care about whitespace at the start of a line def track_tokens_filter(lexer, tokens): lexer.at_line_start = at_line_start = True indent = NO_INDENT saw_colon = False for token in tokens: token.at_line_start = at_line_start if token.type == "COLON": at_line_start = False indent = MAY_INDENT token.must_indent = False elif token.type == "NEWLINE": at_line_start = True if indent == MAY_INDENT: indent = MUST_INDENT token.must_indent = False elif token.type == "WS": assert token.at_line_start == True at_line_start = True token.must_indent = False else: # A real token; only indent after COLON NEWLINE if indent == MUST_INDENT: token.must_indent = True else: token.must_indent = False at_line_start = False indent = NO_INDENT yield token lexer.at_line_start = at_line_start def _new_token(type, lineno): tok = lex.LexToken() tok.type = type tok.value = None tok.lineno = lineno return tok # Synthesize a DEDENT tag def DEDENT(lineno): return _new_token("DEDENT", lineno) # Synthesize an INDENT tag def INDENT(lineno): return _new_token("INDENT", lineno) # Track the indentation level and emit the right INDENT / DEDENT events. def indentation_filter(tokens): # A stack of indentation levels; will never pop item 0 levels = [0] token = None depth = 0 prev_was_ws = False for token in tokens: ## if 1: ## print "Process", token, ## if token.at_line_start: ## print "at_line_start", ## if token.must_indent: ## print "must_indent", ## print # WS only occurs at the start of the line # There may be WS followed by NEWLINE so # only track the depth here. Don't indent/dedent # until there's something real. if token.type == "WS": assert depth == 0 depth = len(token.value) prev_was_ws = True # WS tokens are never passed to the parser continue if token.type == "NEWLINE": depth = 0 if prev_was_ws or token.at_line_start: # ignore blank lines continue # pass the other cases on through yield token continue # then it must be a real token (not WS, not NEWLINE) # which can affect the indentation level prev_was_ws = False if token.must_indent: # The current depth must be larger than the previous level if not (depth > levels[-1]): raise IndentationError("expected an indented block") levels.append(depth) yield INDENT(token.lineno) elif token.at_line_start: # Must be on the same level or one of the previous levels if depth == levels[-1]: # At the same level pass elif depth > levels[-1]: raise IndentationError("indentation increase but not in new block") else: # Back up; but only if it matches a previous level try: i = levels.index(depth) except ValueError: raise IndentationError("inconsistent indentation") for _ in range(i+1, len(levels)): yield DEDENT(token.lineno) levels.pop() yield token ### Finished processing ### # Must dedent any remaining levels if len(levels) > 1: assert token is not None for _ in range(1, len(levels)): yield DEDENT(token.lineno) # The top-level filter adds an ENDMARKER, if requested. # Python's grammar uses it. def filter(lexer, add_endmarker = True): token = None tokens = iter(lexer.token, None) tokens = track_tokens_filter(lexer, tokens) for token in indentation_filter(tokens): yield token if add_endmarker: lineno = 1 if token is not None: lineno = token.lineno yield _new_token("ENDMARKER", lineno) # Combine Ply and my filters into a new lexer class IndentLexer(object): def __init__(self, debug=0, optimize=0, lextab='lextab', reflags=0): self.lexer = lex.lex(debug=debug, optimize=optimize, lextab=lextab, reflags=reflags) self.token_stream = None def input(self, s, add_endmarker=True): self.lexer.paren_count = 0 self.lexer.input(s) self.token_stream = filter(self.lexer, add_endmarker) def token(self): try: return self.token_stream.next() except StopIteration: return None ########## Parser (tokens -> AST) ###### # also part of Ply #import yacc # I use the Python AST from compiler import ast # Helper function def Assign(left, right): names = [] if isinstance(left, ast.Name): # Single assignment on left return ast.Assign([ast.AssName(left.name, 'OP_ASSIGN')], right) elif isinstance(left, ast.Tuple): # List of things - make sure they are Name nodes names = [] for child in left.getChildren(): if not isinstance(child, ast.Name): raise SyntaxError("that assignment not supported") names.append(child.name) ass_list = [ast.AssName(name, 'OP_ASSIGN') for name in names] return ast.Assign([ast.AssTuple(ass_list)], right) else: raise SyntaxError("Can't do that yet") # The grammar comments come from Python's Grammar/Grammar file ## NB: compound_stmt in single_input is followed by extra NEWLINE! # file_input: (NEWLINE | stmt)* ENDMARKER def p_file_input_end(p): """file_input_end : file_input ENDMARKER""" p[0] = ast.Stmt(p[1]) def p_file_input(p): """file_input : file_input NEWLINE | file_input stmt | NEWLINE | stmt""" if isinstance(p[len(p)-1], basestring): if len(p) == 3: p[0] = p[1] else: p[0] = [] # p == 2 --> only a blank line else: if len(p) == 3: p[0] = p[1] + p[2] else: p[0] = p[1] # funcdef: [decorators] 'def' NAME parameters ':' suite # ignoring decorators def p_funcdef(p): "funcdef : DEF NAME parameters COLON suite" p[0] = ast.Function(None, p[2], tuple(p[3]), (), 0, None, p[5]) # parameters: '(' [varargslist] ')' def p_parameters(p): """parameters : LPAR RPAR | LPAR varargslist RPAR""" if len(p) == 3: p[0] = [] else: p[0] = p[2] # varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) | # highly simplified def p_varargslist(p): """varargslist : varargslist COMMA NAME | NAME""" if len(p) == 4: p[0] = p[1] + p[3] else: p[0] = [p[1]] # stmt: simple_stmt | compound_stmt def p_stmt_simple(p): """stmt : simple_stmt""" # simple_stmt is a list p[0] = p[1] def p_stmt_compound(p): """stmt : compound_stmt""" p[0] = [p[1]] # simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE def p_simple_stmt(p): """simple_stmt : small_stmts NEWLINE | small_stmts SEMICOLON NEWLINE""" p[0] = p[1] def p_small_stmts(p): """small_stmts : small_stmts SEMICOLON small_stmt | small_stmt""" if len(p) == 4: p[0] = p[1] + [p[3]] else: p[0] = [p[1]] # small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | # import_stmt | global_stmt | exec_stmt | assert_stmt def p_small_stmt(p): """small_stmt : flow_stmt | expr_stmt""" p[0] = p[1] # expr_stmt: testlist (augassign (yield_expr|testlist) | # ('=' (yield_expr|testlist))*) # augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | # '<<=' | '>>=' | '**=' | '//=') def p_expr_stmt(p): """expr_stmt : testlist ASSIGN testlist | testlist """ if len(p) == 2: # a list of expressions p[0] = ast.Discard(p[1]) else: p[0] = Assign(p[1], p[3]) def p_flow_stmt(p): "flow_stmt : return_stmt" p[0] = p[1] # return_stmt: 'return' [testlist] def p_return_stmt(p): "return_stmt : RETURN testlist" p[0] = ast.Return(p[2]) def p_compound_stmt(p): """compound_stmt : if_stmt | funcdef""" p[0] = p[1] def p_if_stmt(p): 'if_stmt : IF test COLON suite' p[0] = ast.If([(p[2], p[4])], None) def p_suite(p): """suite : simple_stmt | NEWLINE INDENT stmts DEDENT""" if len(p) == 2: p[0] = ast.Stmt(p[1]) else: p[0] = ast.Stmt(p[3]) def p_stmts(p): """stmts : stmts stmt | stmt""" if len(p) == 3: p[0] = p[1] + p[2] else: p[0] = p[1] ## No using Python's approach because Ply supports precedence # comparison: expr (comp_op expr)* # arith_expr: term (('+'|'-') term)* # term: factor (('*'|'/'|'%'|'//') factor)* # factor: ('+'|'-'|'~') factor | power # comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' def make_lt_compare((left, right)): return ast.Compare(left, [('<', right),]) def make_gt_compare((left, right)): return ast.Compare(left, [('>', right),]) def make_eq_compare((left, right)): return ast.Compare(left, [('==', right),]) binary_ops = { "+": ast.Add, "-": ast.Sub, "*": ast.Mul, "/": ast.Div, "<": make_lt_compare, ">": make_gt_compare, "==": make_eq_compare, } unary_ops = { "+": ast.UnaryAdd, "-": ast.UnarySub, } precedence = ( ("left", "EQ", "GT", "LT"), ("left", "PLUS", "MINUS"), ("left", "MULT", "DIV"), ) def p_comparison(p): """comparison : comparison PLUS comparison | comparison MINUS comparison | comparison MULT comparison | comparison DIV comparison | comparison LT comparison | comparison EQ comparison | comparison GT comparison | PLUS comparison | MINUS comparison | power""" if len(p) == 4: p[0] = binary_ops[p[2]]((p[1], p[3])) elif len(p) == 3: p[0] = unary_ops[p[1]](p[2]) else: p[0] = p[1] # power: atom trailer* ['**' factor] # trailers enables function calls. I only allow one level of calls # so this is 'trailer' def p_power(p): """power : atom | atom trailer""" if len(p) == 2: p[0] = p[1] else: if p[2][0] == "CALL": p[0] = ast.CallFunc(p[1], p[2][1], None, None) else: raise AssertionError("not implemented") def p_atom_name(p): """atom : NAME""" p[0] = ast.Name(p[1]) def p_atom_number(p): """atom : NUMBER | STRING""" p[0] = ast.Const(p[1]) def p_atom_tuple(p): """atom : LPAR testlist RPAR""" p[0] = p[2] # trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME def p_trailer(p): "trailer : LPAR arglist RPAR" p[0] = ("CALL", p[2]) # testlist: test (',' test)* [','] # Contains shift/reduce error def p_testlist(p): """testlist : testlist_multi COMMA | testlist_multi """ if len(p) == 2: p[0] = p[1] else: # May need to promote singleton to tuple if isinstance(p[1], list): p[0] = p[1] else: p[0] = [p[1]] # Convert into a tuple? if isinstance(p[0], list): p[0] = ast.Tuple(p[0]) def p_testlist_multi(p): """testlist_multi : testlist_multi COMMA test | test""" if len(p) == 2: # singleton p[0] = p[1] else: if isinstance(p[1], list): p[0] = p[1] + [p[3]] else: # singleton -> tuple p[0] = [p[1], p[3]] # test: or_test ['if' or_test 'else' test] | lambdef # as I don't support 'and', 'or', and 'not' this works down to 'comparison' def p_test(p): "test : comparison" p[0] = p[1] # arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) # XXX INCOMPLETE: this doesn't allow the trailing comma def p_arglist(p): """arglist : arglist COMMA argument | argument""" if len(p) == 4: p[0] = p[1] + [p[3]] else: p[0] = [p[1]] # argument: test [gen_for] | test '=' test # Really [keyword '='] test def p_argument(p): "argument : test" p[0] = p[1] def p_error(p): #print "Error!", repr(p) raise SyntaxError(p) class GardenSnakeParser(object): def __init__(self, lexer = None): if lexer is None: lexer = IndentLexer() self.lexer = lexer self.parser = yacc.yacc(start="file_input_end") def parse(self, code): self.lexer.input(code) result = self.parser.parse(lexer = self.lexer) return ast.Module(None, result) ###### Code generation ###### from compiler import misc, syntax, pycodegen class GardenSnakeCompiler(object): def __init__(self): self.parser = GardenSnakeParser() def compile(self, code, filename="<string>"): tree = self.parser.parse(code) #print tree misc.set_filename(filename, tree) syntax.check(tree) gen = pycodegen.ModuleCodeGenerator(tree) code = gen.getCode() return code ####### Test code ####### compile = GardenSnakeCompiler().compile code = r""" print('LET\'S TRY THIS \\OUT') #Comment here def x(a): print('called with',a) if a == 1: return 2 if a*2 > 10: return 999 / 4 # Another comment here return a+2*3 ints = (1, 2, 3, 4, 5) print('mutiline-expression', ints) t = 4+1/3*2+6*(9-5+1) print('predence test; should be 34+2/3:', t, t==(34+2/3)) print('numbers', 1,2,3,4,5) if 1: 8 a=9 print(x(a)) print(x(1)) print(x(2)) print(x(8),'3') print('this is decimal', 1/5) print('BIG DECIMAL', 1.234567891234567e12345) """ # Set up the GardenSnake run-time environment def print_(*args): print "-->", " ".join(map(str,args)) globals()["print"] = print_ compiled_code = compile(code) exec compiled_code in globals() print "Done"
apache-2.0
MisterTea/HyperNEAT
boost_1_57_0/libs/python/test/implicit.py
12
1024
# Copyright David Abrahams 2004. Distributed under the Boost # Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ''' >>> from implicit_ext import * >>> x_value(X(42)) 42 >>> x_value(42) 42 >>> x = make_x(X(42)) >>> x.value() 42 >>> try: make_x('fool') ... except TypeError: pass ... else: print 'no error' >>> print x_value.__doc__.splitlines()[1] x_value( (X)arg1) -> int : >>> print make_x.__doc__.splitlines()[1] make_x( (object)arg1) -> X : >>> print X.value.__doc__.splitlines()[1] value( (X)arg1) -> int : >>> print X.set.__doc__.splitlines()[1] set( (X)arg1, (object)arg2) -> None : ''' def run(args = None): import sys import doctest if args is not None: sys.argv = args return doctest.testmod(sys.modules.get(__name__)) if __name__ == '__main__': print "running..." import sys status = run()[0] if (status == 0): print "Done." sys.exit(status)
bsd-3-clause
OSSESAC/odoopubarquiluz
addons/survey/wizard/survey_browse_answer.py
54
2742
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, osv class survey_browse_answer(osv.osv_memory): _name = 'survey.browse.answer' _columns = { 'survey_id': fields.many2one('survey', "Survey", required="1"), 'response_id': fields.many2one("survey.response", "Survey Answers", help="If this field is empty, all answers of the selected survey will be print."), } def action_next(self, cr, uid, ids, context=None): """ Open Browse Response wizard. if you select only survey_id then this wizard open with all response_ids and if you select survey_id and response_id then open the particular response of the survey. """ if context is None: context = {} record = self.read(cr, uid, ids, []) record = record and record[0] or {} if record['response_id']: res_id = [(record.get('response_id') and record['response_id'][0])] else: sur_response_obj = self.pool.get('survey.response') res_id = sur_response_obj.search(cr, uid, [('survey_id', '=', record['survey_id'][0])]) context.update({'active' : True,'survey_id' : record['survey_id'][0], 'response_id' : res_id, 'response_no' : 0}) search_obj = self.pool.get('ir.ui.view') search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')]) return { 'view_type': 'form', "view_mode": 'form', 'res_model': 'survey.question.wiz', 'type': 'ir.actions.act_window', 'target': 'new', 'search_view_id':search_id[0], 'context' : context } survey_browse_answer() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
agpl-3.0
stacywsmith/ansible
test/units/modules/network/vyos/test_vyos_command.py
59
4088
# (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json from ansible.compat.tests.mock import patch from ansible.modules.network.vyos import vyos_command from .vyos_module import TestVyosModule, load_fixture, set_module_args class TestVyosCommandModule(TestVyosModule): module = vyos_command def setUp(self): self.mock_run_commands = patch('ansible.modules.network.vyos.vyos_command.run_commands') self.run_commands = self.mock_run_commands.start() def tearDown(self): self.mock_run_commands.stop() def load_fixtures(self, commands=None): def load_from_file(*args, **kwargs): module, commands = args output = list() for item in commands: try: obj = json.loads(item) command = obj['command'] except ValueError: command = item filename = str(command).replace(' ', '_') output.append(load_fixture(filename)) return output self.run_commands.side_effect = load_from_file def test_vyos_command_simple(self): set_module_args(dict(commands=['show version'])) result = self.execute_module() self.assertEqual(len(result['stdout']), 1) self.assertTrue(result['stdout'][0].startswith('Version: VyOS')) def test_vyos_command_multiple(self): set_module_args(dict(commands=['show version', 'show version'])) result = self.execute_module() self.assertEqual(len(result['stdout']), 2) self.assertTrue(result['stdout'][0].startswith('Version: VyOS')) def test_vyos_command_wait_for(self): wait_for = 'result[0] contains "VyOS maintainers"' set_module_args(dict(commands=['show version'], wait_for=wait_for)) self.execute_module() def test_vyos_command_wait_for_fails(self): wait_for = 'result[0] contains "test string"' set_module_args(dict(commands=['show version'], wait_for=wait_for)) self.execute_module(failed=True) self.assertEqual(self.run_commands.call_count, 10) def test_vyos_command_retries(self): wait_for = 'result[0] contains "test string"' set_module_args(dict(commands=['show version'], wait_for=wait_for, retries=2)) self.execute_module(failed=True) self.assertEqual(self.run_commands.call_count, 2) def test_vyos_command_match_any(self): wait_for = ['result[0] contains "VyOS maintainers"', 'result[0] contains "test string"'] set_module_args(dict(commands=['show version'], wait_for=wait_for, match='any')) self.execute_module() def test_vyos_command_match_all(self): wait_for = ['result[0] contains "VyOS maintainers"', 'result[0] contains "[email protected]"'] set_module_args(dict(commands=['show version'], wait_for=wait_for, match='all')) self.execute_module() def test_vyos_command_match_all_failure(self): wait_for = ['result[0] contains "VyOS maintainers"', 'result[0] contains "test string"'] commands = ['show version', 'show version'] set_module_args(dict(commands=commands, wait_for=wait_for, match='all')) self.execute_module(failed=True)
gpl-3.0