pywin32-checkins Mailing List for Python for Windows Extensions (Page 59)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2008-11-11 00:18:00
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22357/win32/src Modified Files: win32gui.i Log Message: Release GIL when calling RegisterDeviceNotification and EnumPropsExW Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** win32gui.i 30 Jun 2008 12:53:08 -0000 1.118 --- win32gui.i 11 Nov 2008 00:17:55 -0000 1.119 *************** *** 7380,7385 **** callback_objects[0]=callback; callback_objects[1]=callback_data; ! ! if (!EnumPropsExW(hwnd, PyEnumPropsExCallback, (LPARAM)callback_objects)){ if (!PyErr_Occurred()) PyWin_SetAPIError("EnumPropsEx"); --- 7380,7388 ---- callback_objects[0]=callback; callback_objects[1]=callback_data; ! BOOL ok; ! Py_BEGIN_ALLOW_THREADS ! ok = EnumPropsExW(hwnd, PyEnumPropsExCallback, (LPARAM)callback_objects); ! Py_END_ALLOW_THREADS ! if (!ok){ if (!PyErr_Occurred()) PyWin_SetAPIError("EnumPropsEx"); *************** *** 7423,7427 **** (int)struct_bytes, (int)nbytes); // @pyseeapi RegisterDeviceNotification ! HDEVNOTIFY not = RegisterDeviceNotification(handle, (void *)filter, flags); if (not == NULL) return PyWin_SetAPIError("RegisterDeviceNotification"); --- 7426,7433 ---- (int)struct_bytes, (int)nbytes); // @pyseeapi RegisterDeviceNotification ! HDEVNOTIFY not; ! Py_BEGIN_ALLOW_THREADS ! not = RegisterDeviceNotification(handle, (void *)filter, flags); ! Py_END_ALLOW_THREADS if (not == NULL) return PyWin_SetAPIError("RegisterDeviceNotification"); |
From: Mark H. <mha...@us...> - 2008-11-11 00:01:18
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21257 Modified Files: Tag: py3k win32timezone.py Log Message: >From Jason, via [1869586] - win32timezone.GetSortedTimeZoneNames() doesn't work on NT4|6 Index: win32timezone.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** win32timezone.py 10 Nov 2008 23:53:12 -0000 1.9.2.1 --- win32timezone.py 11 Nov 2008 00:01:14 -0000 1.9.2.2 *************** *** 13,17 **** Written by Jason R. Coombs (ja...@ja...). ! Copyright © 2003-2007. All Rights Reserved. --- 13,17 ---- Written by Jason R. Coombs (ja...@ja...). ! Copyright © 2003-2008. All Rights Reserved. *************** *** 23,27 **** >>> import win32timezone, datetime ! >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') >>> now = datetime.datetime.now(tzi) --- 23,27 ---- >>> import win32timezone, datetime ! >>> assert 'Mountain Standard Time' in win32timezone.TimeZoneInfo.get_sorted_time_zone_names() >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') >>> now = datetime.datetime.now(tzi) *************** *** 66,69 **** --- 66,75 ---- u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' + To get the complete list of available time zone keys, + >>> zones = win32timezone.TimeZoneInfo.get_all_time_zones() + + If you want to get them in an order that's sorted longitudinally + >>> zones = win32timezone.TimeZoneInfo.get_sorted_time_zones() + TimeZoneInfo now supports being pickled and comparison >>> import pickle *************** *** 122,126 **** __date__ = '$Date$'[10:-2] ! import os, _winreg, struct, datetime, win32api, re, sys, operator import logging --- 128,140 ---- __date__ = '$Date$'[10:-2] ! import os ! import _winreg ! import struct ! import datetime ! import win32api ! import re ! import sys ! import operator ! import warnings import logging *************** *** 212,216 **** # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(GetIndexedTimeZoneNames('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. --- 226,230 ---- # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(self._get_indexed_time_zone_keys('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. *************** *** 330,333 **** --- 344,399 ---- return cmp(self.__dict__, other.__dict__) + # helper methods for accessing the timezone info from the registry + def _get_time_zone_key(subkey=None): + "Return the registry key that stores time zone details" + key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) + if subkey: + key = _winreg.OpenKeyEx(key, subkey) + return key + _get_time_zone_key = staticmethod(_get_time_zone_key) + + def _get_time_zone_key_names(): + "Returns the names of the (registry keys of the) time zones" + return _RegKeyEnumerator(TimeZoneInfo._get_time_zone_key()) + _get_time_zone_key_names = staticmethod(_get_time_zone_key_names) + + def _get_indexed_time_zone_keys(index_key='Index'): + """ + Get the names of the registry keys indexed by a value in that key. + """ + key_names = tuple(TimeZoneInfo._get_time_zone_key_names()) + def get_index_value(key_name): + key = TimeZoneInfo._get_time_zone_key(key_name) + value, type = _winreg.QueryValueEx(key, index_key) + return value + values = map(get_index_value, key_names) + return zip(values, key_names) + _get_indexed_time_zone_keys = staticmethod(_get_indexed_time_zone_keys) + + def get_sorted_time_zone_names(): + "Return a list of time zone names that can be used to initialize TimeZoneInfo instances" + tzs = TimeZoneInfo.get_sorted_time_zones() + get_standard_name = lambda tzi: tzi.standardName + return map(get_standard_name, tzs) + get_sorted_time_zone_names = staticmethod(get_sorted_time_zone_names) + + def get_all_time_zones(): + return map(TimeZoneInfo, TimeZoneInfo._get_time_zone_key_names()) + get_all_time_zones = staticmethod(get_all_time_zones) + + def get_sorted_time_zones(key=None): + """ + Return the time zones sorted by some key. + key must be a function that takes a TimeZoneInfo object and returns + a value suitable for sorting on. + The key defaults to the bias (descending), as is done in Windows + (see http://blogs.msdn.com/michkap/archive/2006/12/22/1350684.aspx) + """ + key = key or (lambda tzi: -tzi.staticInfo.bias) + zones = TimeZoneInfo.get_all_time_zones() + zones.sort(key=key) + return zones + get_sorted_time_zones = staticmethod(get_sorted_time_zones) + def _RegKeyEnumerator(key): return _RegEnumerator(key, _winreg.EnumKey) *************** *** 350,374 **** return dict(map(lambda (name,value,type): (name,value), values)) ! def GetTimeZoneNames(): ! "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) ! return _RegKeyEnumerator(key) ! ! def GetIndexedTimeZoneNames(index_key = 'Index'): ! """Returns the names of the time zones as defined in the registry, but ! includes an index by which they may be sorted. Default index is "Index" ! by which they may be sorted longitudinally.""" ! for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join(TimeZoneInfo.tzRegKey, timeZoneName) ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) ! tzIndex, type = _winreg.QueryValueEx(key, index_key) ! yield (tzIndex, timeZoneName) ! def GetSortedTimeZoneNames(): ! """ Uses GetIndexedTimeZoneNames to return the time zone names sorted ! longitudinally.""" ! tzs = list(GetIndexedTimeZoneNames()) ! tzs.sort() ! return zip(*tzs)[1] def GetLocalTimeZone(): --- 416,437 ---- return dict(map(lambda (name,value,type): (name,value), values)) ! # for backward compatibility ! def deprecated(func, name='Unknown'): ! """This is a decorator which can be used to mark functions ! as deprecated. It will result in a warning being emmitted ! when the function is used.""" ! def newFunc(*args, **kwargs): ! warnings.warn("Call to deprecated function %s." % name, ! category=DeprecationWarning) ! return func(*args, **kwargs) ! newFunc.__name__ = func.__name__ ! newFunc.__doc__ = func.__doc__ ! newFunc.__dict__.update(func.__dict__) ! return newFunc ! GetTimeZoneNames = deprecated(TimeZoneInfo._get_time_zone_key_names, 'GetTimeZoneNames') ! GetIndexedTimeZoneNames = deprecated(TimeZoneInfo._get_indexed_time_zone_keys, 'GetIndexedTimeZoneNames') ! GetSortedTimeZoneNames = deprecated(TimeZoneInfo.get_sorted_time_zone_names, 'GetSortedTimeZoneNames') ! # end backward compatibility def GetLocalTimeZone(): *************** *** 409,417 **** (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a string with extraneous characters.""" ! try: ! return name[:name.index('\x00')] ! except ValueError: ! #null character not found ! return name def GetTZCapabilities(): --- 472,478 ---- (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a string with extraneous characters.""" ! # remove anything after and including the first null character. ! value, garbage = name.split('\x00',1) ! return value def GetTZCapabilities(): |
From: Mark H. <mha...@us...> - 2008-11-11 00:00:07
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21106 Modified Files: win32timezone.py Log Message: >From Jason, via [1869586] - win32timezone.GetSortedTimeZoneNames() doesn't work on NT4|6 Index: win32timezone.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32timezone.py 10 Nov 2008 23:51:44 -0000 1.10 --- win32timezone.py 10 Nov 2008 23:59:59 -0000 1.11 *************** *** 13,17 **** Written by Jason R. Coombs (ja...@ja...). ! Copyright © 2003-2007. All Rights Reserved. --- 13,17 ---- Written by Jason R. Coombs (ja...@ja...). ! Copyright © 2003-2008. All Rights Reserved. *************** *** 23,27 **** >>> import win32timezone, datetime ! >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') >>> now = datetime.datetime.now(tzi) --- 23,27 ---- >>> import win32timezone, datetime ! >>> assert 'Mountain Standard Time' in win32timezone.TimeZoneInfo.get_sorted_time_zone_names() >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') >>> now = datetime.datetime.now(tzi) *************** *** 66,69 **** --- 66,75 ---- u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' + To get the complete list of available time zone keys, + >>> zones = win32timezone.TimeZoneInfo.get_all_time_zones() + + If you want to get them in an order that's sorted longitudinally + >>> zones = win32timezone.TimeZoneInfo.get_sorted_time_zones() + TimeZoneInfo now supports being pickled and comparison >>> import pickle *************** *** 122,126 **** __date__ = '$Date$'[10:-2] ! import os, _winreg, struct, datetime, win32api, re, sys, operator import logging --- 128,140 ---- __date__ = '$Date$'[10:-2] ! import os ! import _winreg ! import struct ! import datetime ! import win32api ! import re ! import sys ! import operator ! import warnings import logging *************** *** 212,216 **** # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(GetIndexedTimeZoneNames('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. --- 226,230 ---- # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(self._get_indexed_time_zone_keys('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. *************** *** 330,333 **** --- 344,399 ---- return cmp(self.__dict__, other.__dict__) + # helper methods for accessing the timezone info from the registry + def _get_time_zone_key(subkey=None): + "Return the registry key that stores time zone details" + key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) + if subkey: + key = _winreg.OpenKeyEx(key, subkey) + return key + _get_time_zone_key = staticmethod(_get_time_zone_key) + + def _get_time_zone_key_names(): + "Returns the names of the (registry keys of the) time zones" + return _RegKeyEnumerator(TimeZoneInfo._get_time_zone_key()) + _get_time_zone_key_names = staticmethod(_get_time_zone_key_names) + + def _get_indexed_time_zone_keys(index_key='Index'): + """ + Get the names of the registry keys indexed by a value in that key. + """ + key_names = tuple(TimeZoneInfo._get_time_zone_key_names()) + def get_index_value(key_name): + key = TimeZoneInfo._get_time_zone_key(key_name) + value, type = _winreg.QueryValueEx(key, index_key) + return value + values = map(get_index_value, key_names) + return zip(values, key_names) + _get_indexed_time_zone_keys = staticmethod(_get_indexed_time_zone_keys) + + def get_sorted_time_zone_names(): + "Return a list of time zone names that can be used to initialize TimeZoneInfo instances" + tzs = TimeZoneInfo.get_sorted_time_zones() + get_standard_name = lambda tzi: tzi.standardName + return map(get_standard_name, tzs) + get_sorted_time_zone_names = staticmethod(get_sorted_time_zone_names) + + def get_all_time_zones(): + return map(TimeZoneInfo, TimeZoneInfo._get_time_zone_key_names()) + get_all_time_zones = staticmethod(get_all_time_zones) + + def get_sorted_time_zones(key=None): + """ + Return the time zones sorted by some key. + key must be a function that takes a TimeZoneInfo object and returns + a value suitable for sorting on. + The key defaults to the bias (descending), as is done in Windows + (see http://blogs.msdn.com/michkap/archive/2006/12/22/1350684.aspx) + """ + key = key or (lambda tzi: -tzi.staticInfo.bias) + zones = TimeZoneInfo.get_all_time_zones() + zones.sort(key=key) + return zones + get_sorted_time_zones = staticmethod(get_sorted_time_zones) + def _RegKeyEnumerator(key): return _RegEnumerator(key, _winreg.EnumKey) *************** *** 350,374 **** return dict(map(lambda (name,value,type): (name,value), values)) ! def GetTimeZoneNames(): ! "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) ! return _RegKeyEnumerator(key) ! ! def GetIndexedTimeZoneNames(index_key = 'Index'): ! """Returns the names of the time zones as defined in the registry, but ! includes an index by which they may be sorted. Default index is "Index" ! by which they may be sorted longitudinally.""" ! for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join(TimeZoneInfo.tzRegKey, timeZoneName) ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) ! tzIndex, type = _winreg.QueryValueEx(key, index_key) ! yield (tzIndex, timeZoneName) ! def GetSortedTimeZoneNames(): ! """ Uses GetIndexedTimeZoneNames to return the time zone names sorted ! longitudinally.""" ! tzs = list(GetIndexedTimeZoneNames()) ! tzs.sort() ! return zip(*tzs)[1] def GetLocalTimeZone(): --- 416,437 ---- return dict(map(lambda (name,value,type): (name,value), values)) ! # for backward compatibility ! def deprecated(func, name='Unknown'): ! """This is a decorator which can be used to mark functions ! as deprecated. It will result in a warning being emmitted ! when the function is used.""" ! def newFunc(*args, **kwargs): ! warnings.warn("Call to deprecated function %s." % name, ! category=DeprecationWarning) ! return func(*args, **kwargs) ! newFunc.__name__ = func.__name__ ! newFunc.__doc__ = func.__doc__ ! newFunc.__dict__.update(func.__dict__) ! return newFunc ! GetTimeZoneNames = deprecated(TimeZoneInfo._get_time_zone_key_names, 'GetTimeZoneNames') ! GetIndexedTimeZoneNames = deprecated(TimeZoneInfo._get_indexed_time_zone_keys, 'GetIndexedTimeZoneNames') ! GetSortedTimeZoneNames = deprecated(TimeZoneInfo.get_sorted_time_zone_names, 'GetSortedTimeZoneNames') ! # end backward compatibility def GetLocalTimeZone(): *************** *** 409,417 **** (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a string with extraneous characters.""" ! try: ! return name[:name.index('\x00')] ! except ValueError: ! #null character not found ! return name def GetTZCapabilities(): --- 472,478 ---- (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a string with extraneous characters.""" ! # remove anything after and including the first null character. ! value, garbage = name.split('\x00',1) ! return value def GetTZCapabilities(): |
From: Mark H. <mha...@us...> - 2008-11-10 23:53:24
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20790 Modified Files: Tag: py3k win32timezone.py Log Message: Patch from Jason: remove spaces per pep8 Index: win32timezone.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** win32timezone.py 11 Apr 2008 03:15:15 -0000 1.9 --- win32timezone.py 10 Nov 2008 23:53:12 -0000 1.9.2.1 *************** *** 24,34 **** >>> import win32timezone, datetime >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() ! >>> tzi = win32timezone.TimeZoneInfo( 'Mountain Standard Time' ) ! >>> now = datetime.datetime.now( tzi ) The now object is now a time-zone aware object, and daylight savings- aware methods may be called on it. ! >>> now.utcoffset() in ( datetime.timedelta(-1, 61200), datetime.timedelta(-1, 64800) ) True --- 24,34 ---- >>> import win32timezone, datetime >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() ! >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') ! >>> now = datetime.datetime.now(tzi) The now object is now a time-zone aware object, and daylight savings- aware methods may be called on it. ! >>> now.utcoffset() in (datetime.timedelta(-1, 61200), datetime.timedelta(-1, 64800)) True *************** *** 36,47 **** generated, unless standard time is always used) ! >>> now = datetime.datetime.now( TimeZoneInfo( 'Mountain Standard Time', True ) ) >>> now.utcoffset() datetime.timedelta(-1, 61200) ! >>> aug2 = datetime.datetime( 2003, 8, 2, tzinfo = tzi ) >>> tuple(aug2.utctimetuple()) (2003, 8, 2, 6, 0, 0, 5, 214, 0) ! >>> nov2 = datetime.datetime( 2003, 11, 25, tzinfo = tzi ) >>> tuple(nov2.utctimetuple()) (2003, 11, 25, 7, 0, 0, 1, 329, 0) --- 36,47 ---- generated, unless standard time is always used) ! >>> now = datetime.datetime.now(TimeZoneInfo('Mountain Standard Time', True)) >>> now.utcoffset() datetime.timedelta(-1, 61200) ! >>> aug2 = datetime.datetime(2003, 8, 2, tzinfo = tzi) >>> tuple(aug2.utctimetuple()) (2003, 8, 2, 6, 0, 0, 5, 214, 0) ! >>> nov2 = datetime.datetime(2003, 11, 25, tzinfo = tzi) >>> tuple(nov2.utctimetuple()) (2003, 11, 25, 7, 0, 0, 1, 329, 0) *************** *** 51,55 **** >>> aug2.isoformat() '2003-08-02T00:00:00-06:00' ! >>> aug2est = aug2.astimezone( win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) ) >>> aug2est.isoformat() '2003-08-02T02:00:00-04:00' --- 51,55 ---- >>> aug2.isoformat() '2003-08-02T00:00:00-06:00' ! >>> aug2est = aug2.astimezone(win32timezone.TimeZoneInfo('Eastern Standard Time')) >>> aug2est.isoformat() '2003-08-02T02:00:00-04:00' *************** *** 58,66 **** registry. ! >>> est = win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) >>> est.displayName u'(GMT-05:00) Eastern Time (US & Canada)' ! >>> gmt = win32timezone.TimeZoneInfo( 'GMT Standard Time', True ) >>> gmt.displayName u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' --- 58,66 ---- registry. ! >>> est = win32timezone.TimeZoneInfo('Eastern Standard Time') >>> est.displayName u'(GMT-05:00) Eastern Time (US & Canada)' ! >>> gmt = win32timezone.TimeZoneInfo('GMT Standard Time', True) >>> gmt.displayName u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' *************** *** 68,90 **** TimeZoneInfo now supports being pickled and comparison >>> import pickle ! >>> tz = win32timezone.TimeZoneInfo( 'China Standard Time' ) ! >>> tz == pickle.loads( pickle.dumps( tz ) ) True ! >>> aest = win32timezone.TimeZoneInfo( 'AUS Eastern Standard Time' ) ! >>> est = win32timezone.TimeZoneInfo( 'E. Australia Standard Time' ) ! >>> dt = datetime.datetime( 2006, 11, 11, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2006-11-11 00:00:00' ! >>> dt = datetime.datetime( 2007, 1, 12, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2007-01-12 00:00:00' ! >>> dt = datetime.datetime( 2007, 6, 13, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2007-06-13 01:00:00' --- 68,90 ---- TimeZoneInfo now supports being pickled and comparison >>> import pickle ! >>> tz = win32timezone.TimeZoneInfo('China Standard Time') ! >>> tz == pickle.loads(pickle.dumps(tz)) True ! >>> aest = win32timezone.TimeZoneInfo('AUS Eastern Standard Time') ! >>> est = win32timezone.TimeZoneInfo('E. Australia Standard Time') ! >>> dt = datetime.datetime(2006, 11, 11, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2006-11-11 00:00:00' ! >>> dt = datetime.datetime(2007, 1, 12, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2007-01-12 00:00:00' ! >>> dt = datetime.datetime(2007, 6, 13, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2007-06-13 01:00:00' *************** *** 95,99 **** except for Vista and its succssors, which have dynamic time zone support. ! #>>> nov2 = datetime.datetime( 2003, 11, 2, tzinfo = tzi ) #>>> nov2.utctimetuple() (2003, 11, 2, 7, 0, 0, 6, 306, 0) --- 95,99 ---- except for Vista and its succssors, which have dynamic time zone support. ! #>>> nov2 = datetime.datetime(2003, 11, 2, tzinfo = tzi) #>>> nov2.utctimetuple() (2003, 11, 2, 7, 0, 0, 6, 306, 0) *************** *** 101,105 **** Note that is the correct response beginning in 2007 This test will fail in Windows versions prior to Vista ! #>>> nov2 = datetime.datetime( 2007, 11, 2, tzinfo = tzi ) #>>> nov2.utctimetuple() (2007, 11, 2, 6, 0, 0, 4, 306, 0) --- 101,105 ---- Note that is the correct response beginning in 2007 This test will fail in Windows versions prior to Vista ! #>>> nov2 = datetime.datetime(2007, 11, 2, tzinfo = tzi) #>>> nov2.utctimetuple() (2007, 11, 2, 6, 0, 0, 4, 306, 0) *************** *** 108,116 **** zone data. >>> caps = GetTZCapabilities() ! >>> isinstance( caps, dict ) True ! >>> caps.has_key( 'MissingTZPatch' ) True ! >>> caps.has_key( 'DynamicTZSupport' ) True """ --- 108,116 ---- zone data. >>> caps = GetTZCapabilities() ! >>> isinstance(caps, dict) True ! >>> caps.has_key('MissingTZPatch') True ! >>> caps.has_key('DynamicTZSupport') True """ *************** *** 125,160 **** import logging ! log = logging.getLogger( __file__ ) ! class WinTZI( object ): format = '3l8h8h' ! def __init__( self, key, name = None ): ! if( not name and len( key ) == struct.calcsize( self.format ) ): ! self.__init_from_bytes__( key ) else: ! self.__init_from_reg_key__( key, name ) ! def __init_from_reg_key__( self, key, name = None ): if not name: ! key, name = os.path.split( key ) ! value, type = _winreg.QueryValueEx( key, name ) ! self.__init_from_bytes__( value ) ! def __init_from_bytes__( self, bytes ): ! components = struct.unpack( self.format, bytes ) ! makeMinuteTimeDelta = lambda x: datetime.timedelta( minutes = x ) self.bias, self.standardBiasOffset, self.daylightBiasOffset = \ ! map( makeMinuteTimeDelta, components[:3] ) # daylightEnd and daylightStart are 8-tuples representing a Win32 SYSTEMTIME structure self.daylightEnd, self.daylightStart = components[3:11], components[11:19] ! def LocateStartDay( self, year ): ! return self._LocateDay( year, self.daylightStart ) ! def LocateEndDay( self, year ): ! return self._LocateDay( year, self.daylightEnd ) ! def _LocateDay( self, year, win32SystemTime ): """ Takes a SYSTEMTIME structure as retrieved from a TIME_ZONE_INFORMATION --- 125,160 ---- import logging ! log = logging.getLogger(__file__) ! class WinTZI(object): format = '3l8h8h' ! def __init__(self, key, name = None): ! if(not name and len(key) == struct.calcsize(self.format)): ! self.__init_from_bytes__(key) else: ! self.__init_from_reg_key__(key, name) ! def __init_from_reg_key__(self, key, name = None): if not name: ! key, name = os.path.split(key) ! value, type = _winreg.QueryValueEx(key, name) ! self.__init_from_bytes__(value) ! def __init_from_bytes__(self, bytes): ! components = struct.unpack(self.format, bytes) ! makeMinuteTimeDelta = lambda x: datetime.timedelta(minutes = x) self.bias, self.standardBiasOffset, self.daylightBiasOffset = \ ! map(makeMinuteTimeDelta, components[:3]) # daylightEnd and daylightStart are 8-tuples representing a Win32 SYSTEMTIME structure self.daylightEnd, self.daylightStart = components[3:11], components[11:19] ! def LocateStartDay(self, year): ! return self._LocateDay(year, self.daylightStart) ! def LocateEndDay(self, year): ! return self._LocateDay(year, self.daylightEnd) ! def _LocateDay(self, year, win32SystemTime): """ Takes a SYSTEMTIME structure as retrieved from a TIME_ZONE_INFORMATION *************** *** 167,181 **** and TIME_ZONE_INFORMATION structures. """ ! month = win32SystemTime[ 1 ] # MS stores Sunday as 0, Python datetime stores Monday as zero ! targetWeekday = ( win32SystemTime[ 2 ] + 6 ) % 7 # win32SystemTime[3] is the week of the month, so the following # is the first day of that week ! day = ( win32SystemTime[ 3 ] - 1 ) * 7 + 1 hour, min, sec, msec = win32SystemTime[4:] ! result = datetime.datetime( year, month, day, hour, min, sec, msec ) # now the result is the correct week, but not necessarily the correct day of the week daysToGo = targetWeekday - result.weekday() ! result += datetime.timedelta( daysToGo ) # if we selected a day in the month following the target month, # move back a week or two. --- 167,181 ---- and TIME_ZONE_INFORMATION structures. """ ! month = win32SystemTime[1] # MS stores Sunday as 0, Python datetime stores Monday as zero ! targetWeekday = (win32SystemTime[2] + 6) % 7 # win32SystemTime[3] is the week of the month, so the following # is the first day of that week ! day = (win32SystemTime[3] - 1) * 7 + 1 hour, min, sec, msec = win32SystemTime[4:] ! result = datetime.datetime(year, month, day, hour, min, sec, msec) # now the result is the correct week, but not necessarily the correct day of the week daysToGo = targetWeekday - result.weekday() ! result += datetime.timedelta(daysToGo) # if we selected a day in the month following the target month, # move back a week or two. *************** *** 184,198 **** # pushed the result into the next month. while result.month == month + 1: ! result -= datetime.timedelta( weeks = 1 ) return result ! def __cmp__( self, other ): ! return cmp( self.__dict__, other.__dict__ ) ! class TimeZoneInfo( datetime.tzinfo ): """ Main class for handling win32 time zones. Usage: ! TimeZoneInfo( <Time Zone Standard Name>, [<Fix Standard Time>] ) If <Fix Standard Time> evaluates to True, daylight savings time is calculated in the same way as standard time. --- 184,198 ---- # pushed the result into the next month. while result.month == month + 1: ! result -= datetime.timedelta(weeks = 1) return result ! def __cmp__(self, other): ! return cmp(self.__dict__, other.__dict__) ! class TimeZoneInfo(datetime.tzinfo): """ Main class for handling win32 time zones. Usage: ! TimeZoneInfo(<Time Zone Standard Name>, [<Fix Standard Time>]) If <Fix Standard Time> evaluates to True, daylight savings time is calculated in the same way as standard time. *************** *** 202,299 **** tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__( self, timeZoneName, fixedStandardTime=False ): self.timeZoneName = timeZoneName key = self._FindTimeZoneKey() ! self._LoadInfoFromKey( key ) self.fixedStandardTime = fixedStandardTime ! def _FindTimeZoneKey( self ): """Find the registry key for the time zone name (self.timeZoneName).""" # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict( GetIndexedTimeZoneNames( 'Std' ) ) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. ! timeZoneName = zoneNames.get( self.timeZoneName, self.timeZoneName ) ! tzRegKeyPath = os.path.join( self.tzRegKey, timeZoneName ) try: ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath ) except: raise ValueError, 'Timezone Name %s not found.' % timeZoneName return key ! def __getinitargs__( self ): ! return ( self.timeZoneName, ) ! def _LoadInfoFromKey( self, key ): """Loads the information from an opened time zone registry key into relevant fields of this TZI object""" ! self.displayName = _winreg.QueryValueEx( key, "Display" )[0] ! self.standardName = _winreg.QueryValueEx( key, "Std" )[0] ! self.daylightName = _winreg.QueryValueEx( key, "Dlt" )[0] ! self.staticInfo = WinTZI( key, "TZI" ) ! self._LoadDynamicInfoFromKey( key ) ! def _LoadDynamicInfoFromKey( self, key ): try: ! dkey = _winreg.OpenKeyEx( key, 'Dynamic DST' ) except WindowsError: return ! info = _RegKeyDict( dkey ) del info['FirstEntry'] del info['LastEntry'] ! years = map( int, info.keys() ) ! values = map( WinTZI, info.values() ) # create a range mapping that searches by descending year and matches # if the target year is greater or equal. ! self.dynamicInfo = RangeMap( zip( years, values ), descending, operator.ge ) ! def __repr__( self ): ! result = '%s( %s' % ( self.__class__.__name__, repr( self.timeZoneName ) ) if self.fixedStandardTime: result += ', True' ! result += ' )' return result ! def __str__( self ): return self.displayName ! def tzname( self, dt ): ! winInfo = self.getWinInfo( dt ) ! if self.dst( dt ) == winInfo.daylightBiasOffset: result = self.daylightName ! elif self.dst( dt ) == winInfo.standardBiasOffset: result = self.standardName return result ! def getWinInfo( self, targetYear ): ! if not hasattr( self, 'dynamicInfo' ) or not self.dynamicInfo: return self.staticInfo # Find the greatest year entry in self.dynamicInfo which is for # a year greater than or equal to our targetYear. If not found, # default to the earliest year. ! return self.dynamicInfo.get( targetYear, self.dynamicInfo[ RangeItemLast() ] ) ! def _getStandardBias( self, dt ): ! winInfo = self.getWinInfo( dt.year ) return winInfo.bias + winInfo.standardBiasOffset ! def _getDaylightBias( self, dt ): ! winInfo = self.getWinInfo( dt.year ) return winInfo.bias + winInfo.daylightBiasOffset ! def utcoffset( self, dt ): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return ! winInfo = self.getWinInfo( dt.year ) ! return -( winInfo.bias + self.dst( dt ) ) ! def dst( self, dt ): "Calculates the daylight savings offset according to the datetime.tzinfo spec" if dt is None: return assert dt.tzinfo is self ! winInfo = self.getWinInfo( dt.year ) ! if not self.fixedStandardTime and self._inDaylightSavings( dt ): result = winInfo.daylightBiasOffset else: --- 202,299 ---- tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__(self, timeZoneName, fixedStandardTime=False): self.timeZoneName = timeZoneName key = self._FindTimeZoneKey() ! self._LoadInfoFromKey(key) self.fixedStandardTime = fixedStandardTime ! def _FindTimeZoneKey(self): """Find the registry key for the time zone name (self.timeZoneName).""" # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(GetIndexedTimeZoneNames('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. ! timeZoneName = zoneNames.get(self.timeZoneName, self.timeZoneName) ! tzRegKeyPath = os.path.join(self.tzRegKey, timeZoneName) try: ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) except: raise ValueError, 'Timezone Name %s not found.' % timeZoneName return key ! def __getinitargs__(self): ! return (self.timeZoneName,) ! def _LoadInfoFromKey(self, key): """Loads the information from an opened time zone registry key into relevant fields of this TZI object""" ! self.displayName = _winreg.QueryValueEx(key, "Display")[0] ! self.standardName = _winreg.QueryValueEx(key, "Std")[0] ! self.daylightName = _winreg.QueryValueEx(key, "Dlt")[0] ! self.staticInfo = WinTZI(key, "TZI") ! self._LoadDynamicInfoFromKey(key) ! def _LoadDynamicInfoFromKey(self, key): try: ! dkey = _winreg.OpenKeyEx(key, 'Dynamic DST') except WindowsError: return ! info = _RegKeyDict(dkey) del info['FirstEntry'] del info['LastEntry'] ! years = map(int, info.keys()) ! values = map(WinTZI, info.values()) # create a range mapping that searches by descending year and matches # if the target year is greater or equal. ! self.dynamicInfo = RangeMap(zip(years, values), descending, operator.ge) ! def __repr__(self): ! result = '%s(%s' % (self.__class__.__name__, repr(self.timeZoneName)) if self.fixedStandardTime: result += ', True' ! result += ')' return result ! def __str__(self): return self.displayName ! def tzname(self, dt): ! winInfo = self.getWinInfo(dt) ! if self.dst(dt) == winInfo.daylightBiasOffset: result = self.daylightName ! elif self.dst(dt) == winInfo.standardBiasOffset: result = self.standardName return result ! def getWinInfo(self, targetYear): ! if not hasattr(self, 'dynamicInfo') or not self.dynamicInfo: return self.staticInfo # Find the greatest year entry in self.dynamicInfo which is for # a year greater than or equal to our targetYear. If not found, # default to the earliest year. ! return self.dynamicInfo.get(targetYear, self.dynamicInfo[RangeItemLast()]) ! def _getStandardBias(self, dt): ! winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.standardBiasOffset ! def _getDaylightBias(self, dt): ! winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.daylightBiasOffset ! def utcoffset(self, dt): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return ! winInfo = self.getWinInfo(dt.year) ! return -(winInfo.bias + self.dst(dt)) ! def dst(self, dt): "Calculates the daylight savings offset according to the datetime.tzinfo spec" if dt is None: return assert dt.tzinfo is self ! winInfo = self.getWinInfo(dt.year) ! if not self.fixedStandardTime and self._inDaylightSavings(dt): result = winInfo.daylightBiasOffset else: *************** *** 301,315 **** return result ! def _inDaylightSavings( self, dt ): try: ! dstStart = self.GetDSTStartTime( dt.year ) ! dstEnd = self.GetDSTEndTime( dt.year ) if dstStart < dstEnd: ! inDaylightSavings = dstStart <= dt.replace( tzinfo=None ) < dstEnd else: # in the southern hemisphere, daylight savings time # typically ends before it begins in a given year. ! inDaylightSavings = not ( dstEnd < dt.replace( tzinfo=None ) <= dstStart ) except ValueError: # there was an error parsing the time zone, which is normal when a --- 301,315 ---- return result ! def _inDaylightSavings(self, dt): try: ! dstStart = self.GetDSTStartTime(dt.year) ! dstEnd = self.GetDSTEndTime(dt.year) if dstStart < dstEnd: ! inDaylightSavings = dstStart <= dt.replace(tzinfo=None) < dstEnd else: # in the southern hemisphere, daylight savings time # typically ends before it begins in a given year. ! inDaylightSavings = not (dstEnd < dt.replace(tzinfo=None) <= dstStart) except ValueError: # there was an error parsing the time zone, which is normal when a *************** *** 319,376 **** return inDaylightSavings ! def GetDSTStartTime( self, year ): "Given a year, determines the time when daylight savings time starts" ! return self.getWinInfo( year ).LocateStartDay( year ) ! def GetDSTEndTime( self, year ): "Given a year, determines the time when daylight savings ends." ! return self.getWinInfo( year ).LocateEndDay( year ) ! def __cmp__( self, other ): ! return cmp( self.__dict__, other.__dict__ ) ! def _RegKeyEnumerator( key ): ! return _RegEnumerator( key, _winreg.EnumKey ) ! def _RegValueEnumerator( key ): ! return _RegEnumerator( key, _winreg.EnumValue ) ! def _RegEnumerator( key, func ): "Enumerates an open registry key as an iterable generator" index = 0 try: while 1: ! yield func( key, index ) index += 1 except WindowsError: pass ! def _RegKeyDict( key ): ! values = _RegValueEnumerator( key ) ! values = tuple( values ) ! return dict( map( lambda (name,value,type): (name,value), values ) ) ! def GetTimeZoneNames( ): "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey ) ! return _RegKeyEnumerator( key ) ! def GetIndexedTimeZoneNames( index_key = 'Index' ): """Returns the names of the time zones as defined in the registry, but includes an index by which they may be sorted. Default index is "Index" by which they may be sorted longitudinally.""" for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join( TimeZoneInfo.tzRegKey, timeZoneName ) ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath ) ! tzIndex, type = _winreg.QueryValueEx( key, index_key ) ! yield ( tzIndex, timeZoneName ) ! def GetSortedTimeZoneNames( ): """ Uses GetIndexedTimeZoneNames to return the time zone names sorted longitudinally.""" ! tzs = list( GetIndexedTimeZoneNames() ) tzs.sort() ! return zip( *tzs )[1] ! def GetLocalTimeZone( ): """Returns the local time zone as defined by the operating system in the registry. --- 319,376 ---- return inDaylightSavings ! def GetDSTStartTime(self, year): "Given a year, determines the time when daylight savings time starts" ! return self.getWinInfo(year).LocateStartDay(year) ! def GetDSTEndTime(self, year): "Given a year, determines the time when daylight savings ends." ! return self.getWinInfo(year).LocateEndDay(year) ! def __cmp__(self, other): ! return cmp(self.__dict__, other.__dict__) ! def _RegKeyEnumerator(key): ! return _RegEnumerator(key, _winreg.EnumKey) ! def _RegValueEnumerator(key): ! return _RegEnumerator(key, _winreg.EnumValue) ! def _RegEnumerator(key, func): "Enumerates an open registry key as an iterable generator" index = 0 try: while 1: ! yield func(key, index) index += 1 except WindowsError: pass ! def _RegKeyDict(key): ! values = _RegValueEnumerator(key) ! values = tuple(values) ! return dict(map(lambda (name,value,type): (name,value), values)) ! def GetTimeZoneNames(): "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) ! return _RegKeyEnumerator(key) ! def GetIndexedTimeZoneNames(index_key = 'Index'): """Returns the names of the time zones as defined in the registry, but includes an index by which they may be sorted. Default index is "Index" by which they may be sorted longitudinally.""" for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join(TimeZoneInfo.tzRegKey, timeZoneName) ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) ! tzIndex, type = _winreg.QueryValueEx(key, index_key) ! yield (tzIndex, timeZoneName) ! def GetSortedTimeZoneNames(): """ Uses GetIndexedTimeZoneNames to return the time zone names sorted longitudinally.""" ! tzs = list(GetIndexedTimeZoneNames()) tzs.sort() ! return zip(*tzs)[1] ! def GetLocalTimeZone(): """Returns the local time zone as defined by the operating system in the registry. *************** *** 378,397 **** customized. It should have been selected from the Windows interface. >>> localTZ = GetLocalTimeZone() ! >>> nowLoc = datetime.datetime.now( localTZ ) ! >>> nowUTC = datetime.datetime.utcnow( ) ! >>> ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) Traceback (most recent call last): ... TypeError: can't subtract offset-naive and offset-aware datetimes ! >>> nowUTC = nowUTC.replace( tzinfo = TimeZoneInfo( 'GMT Standard Time', True ) ) Now one can compare the results of the two offset aware values ! >>> ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) True """ tzRegKey = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation' ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKey ) ! local = _RegKeyDict( key ) # if the user has not checked "Automatically adjust clock for daylight # saving changes" in the Date and Time Properties control, the standard --- 378,397 ---- customized. It should have been selected from the Windows interface. >>> localTZ = GetLocalTimeZone() ! >>> nowLoc = datetime.datetime.now(localTZ) ! >>> nowUTC = datetime.datetime.utcnow() ! >>> (nowUTC - nowLoc) < datetime.timedelta(seconds = 5) Traceback (most recent call last): ... TypeError: can't subtract offset-naive and offset-aware datetimes ! >>> nowUTC = nowUTC.replace(tzinfo = TimeZoneInfo('GMT Standard Time', True)) Now one can compare the results of the two offset aware values ! >>> (nowUTC - nowLoc) < datetime.timedelta(seconds = 5) True """ tzRegKey = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation' ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKey) ! local = _RegKeyDict(key) # if the user has not checked "Automatically adjust clock for daylight # saving changes" in the Date and Time Properties control, the standard *************** *** 400,409 **** fixStandardTime = local['StandardName'] == local['DaylightName'] and \ local['StandardBias'] == local['DaylightBias'] ! keyName = [ 'StandardName', 'TimeZoneKeyName' ][ sys.getwindowsversion() >= (6,) ] ! standardName = local[ keyName ] ! standardName = __TimeZoneKeyNameWorkaround( standardName ) ! return TimeZoneInfo( standardName, fixStandardTime ) ! def __TimeZoneKeyNameWorkaround( name ): """It may be a bug in Vista, but in standard Windows Vista install (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a --- 400,409 ---- fixStandardTime = local['StandardName'] == local['DaylightName'] and \ local['StandardBias'] == local['DaylightBias'] ! keyName = ['StandardName', 'TimeZoneKeyName'][sys.getwindowsversion() >= (6,)] ! standardName = local[keyName] ! standardName = __TimeZoneKeyNameWorkaround(standardName) ! return TimeZoneInfo(standardName, fixStandardTime) ! def __TimeZoneKeyNameWorkaround(name): """It may be a bug in Vista, but in standard Windows Vista install (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a *************** *** 420,445 **** Note Dynamic Time Zone support is not available on any platform at this time; this is a limitation of this library, not the platform.""" ! tzi = TimeZoneInfo( 'Mountain Standard Time' ) ! MissingTZPatch = datetime.datetime( 2007,11,2,tzinfo=tzi ).utctimetuple() != (2007,11,2,6,0,0,4,306,0) ! DynamicTZSupport = not MissingTZPatch and datetime.datetime( 2003,11,2,tzinfo=tzi).utctimetuple() == (2003,11,2,7,0,0,6,306,0) del tzi return vars() ! class DLLHandleCache( object ): ! def __init__( self ): self.__cache = {} ! def __getitem__( self, filename ): key = filename.lower() ! return self.__cache.setdefault( key, win32api.LoadLibrary( key ) ) DLLCache = DLLHandleCache() ! def resolveMUITimeZone( spec ): """Resolve a multilingual user interface resource for the time zone name ! >>> result = resolveMUITimeZone( '@tzres.dll,-110' ) >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] ! >>> type( result ) is expectedResultType True --- 420,445 ---- Note Dynamic Time Zone support is not available on any platform at this time; this is a limitation of this library, not the platform.""" ! tzi = TimeZoneInfo('Mountain Standard Time') ! MissingTZPatch = datetime.datetime(2007,11,2,tzinfo=tzi).utctimetuple() != (2007,11,2,6,0,0,4,306,0) ! DynamicTZSupport = not MissingTZPatch and datetime.datetime(2003,11,2,tzinfo=tzi).utctimetuple() == (2003,11,2,7,0,0,6,306,0) del tzi return vars() ! class DLLHandleCache(object): ! def __init__(self): self.__cache = {} ! def __getitem__(self, filename): key = filename.lower() ! return self.__cache.setdefault(key, win32api.LoadLibrary(key)) DLLCache = DLLHandleCache() ! def resolveMUITimeZone(spec): """Resolve a multilingual user interface resource for the time zone name ! >>> result = resolveMUITimeZone('@tzres.dll,-110') >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] ! >>> type(result) is expectedResultType True *************** *** 447,457 **** see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ ! pattern = re.compile( '@(?P<dllname>.*),-(?P<index>\d+)(?:;(?P<comment>.*))?' ) ! matcher = pattern.match( spec ) assert matcher, 'Could not parse MUI spec' try: ! handle = DLLCache[ matcher.groupdict()[ 'dllname' ] ] ! result = win32api.LoadString( handle, int( matcher.groupdict()[ 'index' ] ) ) except win32api.error, e: result = None --- 447,457 ---- see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ ! pattern = re.compile('@(?P<dllname>.*),-(?P<index>\d+)(?:;(?P<comment>.*))?') ! matcher = pattern.match(spec) assert matcher, 'Could not parse MUI spec' try: ! handle = DLLCache[matcher.groupdict()['dllname']] ! result = win32api.LoadString(handle, int(matcher.groupdict()['index'])) except win32api.error, e: result = None *************** *** 461,468 **** ascending = cmp ! def descending( a, b ): ! return -ascending( a, b ) ! class RangeMap( dict ): """A dictionary-like object that uses the keys as bounds for a range. Inclusion of the value for that range is determined by the --- 461,468 ---- ascending = cmp ! def descending(a, b): ! return -ascending(a, b) ! class RangeMap(dict): """A dictionary-like object that uses the keys as bounds for a range. Inclusion of the value for that range is determined by the *************** *** 473,477 **** Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b' ! >>> r = RangeMap( { 3: 'a', 6: 'b' } ) # boy, that was easy >>> r[1], r[2], r[3], r[4], r[5], r[6] ('a', 'a', 'a', 'b', 'b', 'b') --- 473,477 ---- Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b' ! >>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy >>> r[1], r[2], r[3], r[4], r[5], r[6] ('a', 'a', 'a', 'b', 'b', 'b') *************** *** 484,488 **** One can close the open-end of the RangeMap by using RangeValueUndefined ! >>> r = RangeMap( { 0: RangeValueUndefined(), 3: 'a', 6: 'b' } ) >>> r[0] Traceback (most recent call last): --- 484,488 ---- One can close the open-end of the RangeMap by using RangeValueUndefined ! >>> r = RangeMap({0: RangeValueUndefined(), 3: 'a', 6: 'b'}) >>> r[0] Traceback (most recent call last): *************** *** 491,495 **** One can get the first or last elements in the range by using RangeItem ! >>> last_item = RangeItem( -1 ) >>> r[last_item] 'b' --- 491,495 ---- One can get the first or last elements in the range by using RangeItem ! >>> last_item = RangeItem(-1) >>> r[last_item] 'b' *************** *** 502,542 **** """ ! def __init__( self, source, keySortComparator = ascending, keyMatchComparator = operator.le ): ! dict.__init__( self, source ) self.sort = keySortComparator self.match = keyMatchComparator ! def __getitem__( self, item ): sortedKeys = self.keys() ! sortedKeys.sort( self.sort ) ! if isinstance( item, RangeItem ): ! result = self.__getitem__( sortedKeys[ item ] ) else: ! key = self._find_first_match_( sortedKeys, item ) ! result = dict.__getitem__( self, key ) ! if isinstance( result, RangeValueUndefined ): raise KeyError, key return result ! def _find_first_match_( self, keys, item ): ! is_match = lambda k: self.match( item, k ) # use of ifilter here would be more efficent ! matches = filter( is_match, keys ) if matches: return matches[0] ! raise KeyError( item ) ! def bounds( self ): sortedKeys = self.keys() ! sortedKeys.sort( self.sort ) ! return sortedKeys[ RangeItemFirst() ], sortedKeys[ RangeItemLast() ] ! class RangeValueUndefined( object ): pass ! class RangeItem( int ): ! def __new__( cls, value ): ! return int.__new__( cls, value ) ! class RangeItemFirst( RangeItem ): ! def __new__( cls ): ! return RangeItem.__new__( cls, 0 ) ! class RangeItemLast( RangeItem ): ! def __new__( cls ): ! return RangeItem.__new__( cls, -1 ) --- 502,542 ---- """ ! def __init__(self, source, keySortComparator = ascending, keyMatchComparator = operator.le): ! dict.__init__(self, source) self.sort = keySortComparator self.match = keyMatchComparator ! def __getitem__(self, item): sortedKeys = self.keys() ! sortedKeys.sort(self.sort) ! if isinstance(item, RangeItem): ! result = self.__getitem__(sortedKeys[item]) else: ! key = self._find_first_match_(sortedKeys, item) ! result = dict.__getitem__(self, key) ! if isinstance(result, RangeValueUndefined): raise KeyError, key return result ! def _find_first_match_(self, keys, item): ! is_match = lambda k: self.match(item, k) # use of ifilter here would be more efficent ! matches = filter(is_match, keys) if matches: return matches[0] ! raise KeyError(item) ! def bounds(self): sortedKeys = self.keys() ! sortedKeys.sort(self.sort) ! return sortedKeys[RangeItemFirst()], sortedKeys[RangeItemLast()] ! class RangeValueUndefined(object): pass ! class RangeItem(int): ! def __new__(cls, value): ! return int.__new__(cls, value) ! class RangeItemFirst(RangeItem): ! def __new__(cls): ! return RangeItem.__new__(cls, 0) ! class RangeItemLast(RangeItem): ! def __new__(cls): ! return RangeItem.__new__(cls, -1) |
From: Mark H. <mha...@us...> - 2008-11-10 23:51:50
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20743 Modified Files: win32timezone.py Log Message: Patch from Jason: remote spaces per pep8 Index: win32timezone.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32timezone.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** win32timezone.py 11 Apr 2008 03:15:15 -0000 1.9 --- win32timezone.py 10 Nov 2008 23:51:44 -0000 1.10 *************** *** 24,34 **** >>> import win32timezone, datetime >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() ! >>> tzi = win32timezone.TimeZoneInfo( 'Mountain Standard Time' ) ! >>> now = datetime.datetime.now( tzi ) The now object is now a time-zone aware object, and daylight savings- aware methods may be called on it. ! >>> now.utcoffset() in ( datetime.timedelta(-1, 61200), datetime.timedelta(-1, 64800) ) True --- 24,34 ---- >>> import win32timezone, datetime >>> assert 'Mountain Standard Time' in win32timezone.GetTimeZoneNames() ! >>> tzi = win32timezone.TimeZoneInfo('Mountain Standard Time') ! >>> now = datetime.datetime.now(tzi) The now object is now a time-zone aware object, and daylight savings- aware methods may be called on it. ! >>> now.utcoffset() in (datetime.timedelta(-1, 61200), datetime.timedelta(-1, 64800)) True *************** *** 36,47 **** generated, unless standard time is always used) ! >>> now = datetime.datetime.now( TimeZoneInfo( 'Mountain Standard Time', True ) ) >>> now.utcoffset() datetime.timedelta(-1, 61200) ! >>> aug2 = datetime.datetime( 2003, 8, 2, tzinfo = tzi ) >>> tuple(aug2.utctimetuple()) (2003, 8, 2, 6, 0, 0, 5, 214, 0) ! >>> nov2 = datetime.datetime( 2003, 11, 25, tzinfo = tzi ) >>> tuple(nov2.utctimetuple()) (2003, 11, 25, 7, 0, 0, 1, 329, 0) --- 36,47 ---- generated, unless standard time is always used) ! >>> now = datetime.datetime.now(TimeZoneInfo('Mountain Standard Time', True)) >>> now.utcoffset() datetime.timedelta(-1, 61200) ! >>> aug2 = datetime.datetime(2003, 8, 2, tzinfo = tzi) >>> tuple(aug2.utctimetuple()) (2003, 8, 2, 6, 0, 0, 5, 214, 0) ! >>> nov2 = datetime.datetime(2003, 11, 25, tzinfo = tzi) >>> tuple(nov2.utctimetuple()) (2003, 11, 25, 7, 0, 0, 1, 329, 0) *************** *** 51,55 **** >>> aug2.isoformat() '2003-08-02T00:00:00-06:00' ! >>> aug2est = aug2.astimezone( win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) ) >>> aug2est.isoformat() '2003-08-02T02:00:00-04:00' --- 51,55 ---- >>> aug2.isoformat() '2003-08-02T00:00:00-06:00' ! >>> aug2est = aug2.astimezone(win32timezone.TimeZoneInfo('Eastern Standard Time')) >>> aug2est.isoformat() '2003-08-02T02:00:00-04:00' *************** *** 58,66 **** registry. ! >>> est = win32timezone.TimeZoneInfo( 'Eastern Standard Time' ) >>> est.displayName u'(GMT-05:00) Eastern Time (US & Canada)' ! >>> gmt = win32timezone.TimeZoneInfo( 'GMT Standard Time', True ) >>> gmt.displayName u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' --- 58,66 ---- registry. ! >>> est = win32timezone.TimeZoneInfo('Eastern Standard Time') >>> est.displayName u'(GMT-05:00) Eastern Time (US & Canada)' ! >>> gmt = win32timezone.TimeZoneInfo('GMT Standard Time', True) >>> gmt.displayName u'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' *************** *** 68,90 **** TimeZoneInfo now supports being pickled and comparison >>> import pickle ! >>> tz = win32timezone.TimeZoneInfo( 'China Standard Time' ) ! >>> tz == pickle.loads( pickle.dumps( tz ) ) True ! >>> aest = win32timezone.TimeZoneInfo( 'AUS Eastern Standard Time' ) ! >>> est = win32timezone.TimeZoneInfo( 'E. Australia Standard Time' ) ! >>> dt = datetime.datetime( 2006, 11, 11, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2006-11-11 00:00:00' ! >>> dt = datetime.datetime( 2007, 1, 12, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2007-01-12 00:00:00' ! >>> dt = datetime.datetime( 2007, 6, 13, 1, 0, 0, tzinfo = aest ) ! >>> estdt = dt.astimezone( est ) ! >>> estdt.strftime( '%Y-%m-%d %H:%M:%S' ) '2007-06-13 01:00:00' --- 68,90 ---- TimeZoneInfo now supports being pickled and comparison >>> import pickle ! >>> tz = win32timezone.TimeZoneInfo('China Standard Time') ! >>> tz == pickle.loads(pickle.dumps(tz)) True ! >>> aest = win32timezone.TimeZoneInfo('AUS Eastern Standard Time') ! >>> est = win32timezone.TimeZoneInfo('E. Australia Standard Time') ! >>> dt = datetime.datetime(2006, 11, 11, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2006-11-11 00:00:00' ! >>> dt = datetime.datetime(2007, 1, 12, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2007-01-12 00:00:00' ! >>> dt = datetime.datetime(2007, 6, 13, 1, 0, 0, tzinfo = aest) ! >>> estdt = dt.astimezone(est) ! >>> estdt.strftime('%Y-%m-%d %H:%M:%S') '2007-06-13 01:00:00' *************** *** 95,99 **** except for Vista and its succssors, which have dynamic time zone support. ! #>>> nov2 = datetime.datetime( 2003, 11, 2, tzinfo = tzi ) #>>> nov2.utctimetuple() (2003, 11, 2, 7, 0, 0, 6, 306, 0) --- 95,99 ---- except for Vista and its succssors, which have dynamic time zone support. ! #>>> nov2 = datetime.datetime(2003, 11, 2, tzinfo = tzi) #>>> nov2.utctimetuple() (2003, 11, 2, 7, 0, 0, 6, 306, 0) *************** *** 101,105 **** Note that is the correct response beginning in 2007 This test will fail in Windows versions prior to Vista ! #>>> nov2 = datetime.datetime( 2007, 11, 2, tzinfo = tzi ) #>>> nov2.utctimetuple() (2007, 11, 2, 6, 0, 0, 4, 306, 0) --- 101,105 ---- Note that is the correct response beginning in 2007 This test will fail in Windows versions prior to Vista ! #>>> nov2 = datetime.datetime(2007, 11, 2, tzinfo = tzi) #>>> nov2.utctimetuple() (2007, 11, 2, 6, 0, 0, 4, 306, 0) *************** *** 108,116 **** zone data. >>> caps = GetTZCapabilities() ! >>> isinstance( caps, dict ) True ! >>> caps.has_key( 'MissingTZPatch' ) True ! >>> caps.has_key( 'DynamicTZSupport' ) True """ --- 108,116 ---- zone data. >>> caps = GetTZCapabilities() ! >>> isinstance(caps, dict) True ! >>> caps.has_key('MissingTZPatch') True ! >>> caps.has_key('DynamicTZSupport') True """ *************** *** 125,160 **** import logging ! log = logging.getLogger( __file__ ) ! class WinTZI( object ): format = '3l8h8h' ! def __init__( self, key, name = None ): ! if( not name and len( key ) == struct.calcsize( self.format ) ): ! self.__init_from_bytes__( key ) else: ! self.__init_from_reg_key__( key, name ) ! def __init_from_reg_key__( self, key, name = None ): if not name: ! key, name = os.path.split( key ) ! value, type = _winreg.QueryValueEx( key, name ) ! self.__init_from_bytes__( value ) ! def __init_from_bytes__( self, bytes ): ! components = struct.unpack( self.format, bytes ) ! makeMinuteTimeDelta = lambda x: datetime.timedelta( minutes = x ) self.bias, self.standardBiasOffset, self.daylightBiasOffset = \ ! map( makeMinuteTimeDelta, components[:3] ) # daylightEnd and daylightStart are 8-tuples representing a Win32 SYSTEMTIME structure self.daylightEnd, self.daylightStart = components[3:11], components[11:19] ! def LocateStartDay( self, year ): ! return self._LocateDay( year, self.daylightStart ) ! def LocateEndDay( self, year ): ! return self._LocateDay( year, self.daylightEnd ) ! def _LocateDay( self, year, win32SystemTime ): """ Takes a SYSTEMTIME structure as retrieved from a TIME_ZONE_INFORMATION --- 125,160 ---- import logging ! log = logging.getLogger(__file__) ! class WinTZI(object): format = '3l8h8h' ! def __init__(self, key, name = None): ! if(not name and len(key) == struct.calcsize(self.format)): ! self.__init_from_bytes__(key) else: ! self.__init_from_reg_key__(key, name) ! def __init_from_reg_key__(self, key, name = None): if not name: ! key, name = os.path.split(key) ! value, type = _winreg.QueryValueEx(key, name) ! self.__init_from_bytes__(value) ! def __init_from_bytes__(self, bytes): ! components = struct.unpack(self.format, bytes) ! makeMinuteTimeDelta = lambda x: datetime.timedelta(minutes = x) self.bias, self.standardBiasOffset, self.daylightBiasOffset = \ ! map(makeMinuteTimeDelta, components[:3]) # daylightEnd and daylightStart are 8-tuples representing a Win32 SYSTEMTIME structure self.daylightEnd, self.daylightStart = components[3:11], components[11:19] ! def LocateStartDay(self, year): ! return self._LocateDay(year, self.daylightStart) ! def LocateEndDay(self, year): ! return self._LocateDay(year, self.daylightEnd) ! def _LocateDay(self, year, win32SystemTime): """ Takes a SYSTEMTIME structure as retrieved from a TIME_ZONE_INFORMATION *************** *** 167,181 **** and TIME_ZONE_INFORMATION structures. """ ! month = win32SystemTime[ 1 ] # MS stores Sunday as 0, Python datetime stores Monday as zero ! targetWeekday = ( win32SystemTime[ 2 ] + 6 ) % 7 # win32SystemTime[3] is the week of the month, so the following # is the first day of that week ! day = ( win32SystemTime[ 3 ] - 1 ) * 7 + 1 hour, min, sec, msec = win32SystemTime[4:] ! result = datetime.datetime( year, month, day, hour, min, sec, msec ) # now the result is the correct week, but not necessarily the correct day of the week daysToGo = targetWeekday - result.weekday() ! result += datetime.timedelta( daysToGo ) # if we selected a day in the month following the target month, # move back a week or two. --- 167,181 ---- and TIME_ZONE_INFORMATION structures. """ ! month = win32SystemTime[1] # MS stores Sunday as 0, Python datetime stores Monday as zero ! targetWeekday = (win32SystemTime[2] + 6) % 7 # win32SystemTime[3] is the week of the month, so the following # is the first day of that week ! day = (win32SystemTime[3] - 1) * 7 + 1 hour, min, sec, msec = win32SystemTime[4:] ! result = datetime.datetime(year, month, day, hour, min, sec, msec) # now the result is the correct week, but not necessarily the correct day of the week daysToGo = targetWeekday - result.weekday() ! result += datetime.timedelta(daysToGo) # if we selected a day in the month following the target month, # move back a week or two. *************** *** 184,198 **** # pushed the result into the next month. while result.month == month + 1: ! result -= datetime.timedelta( weeks = 1 ) return result ! def __cmp__( self, other ): ! return cmp( self.__dict__, other.__dict__ ) ! class TimeZoneInfo( datetime.tzinfo ): """ Main class for handling win32 time zones. Usage: ! TimeZoneInfo( <Time Zone Standard Name>, [<Fix Standard Time>] ) If <Fix Standard Time> evaluates to True, daylight savings time is calculated in the same way as standard time. --- 184,198 ---- # pushed the result into the next month. while result.month == month + 1: ! result -= datetime.timedelta(weeks = 1) return result ! def __cmp__(self, other): ! return cmp(self.__dict__, other.__dict__) ! class TimeZoneInfo(datetime.tzinfo): """ Main class for handling win32 time zones. Usage: ! TimeZoneInfo(<Time Zone Standard Name>, [<Fix Standard Time>]) If <Fix Standard Time> evaluates to True, daylight savings time is calculated in the same way as standard time. *************** *** 202,299 **** tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__( self, timeZoneName, fixedStandardTime=False ): self.timeZoneName = timeZoneName key = self._FindTimeZoneKey() ! self._LoadInfoFromKey( key ) self.fixedStandardTime = fixedStandardTime ! def _FindTimeZoneKey( self ): """Find the registry key for the time zone name (self.timeZoneName).""" # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict( GetIndexedTimeZoneNames( 'Std' ) ) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. ! timeZoneName = zoneNames.get( self.timeZoneName, self.timeZoneName ) ! tzRegKeyPath = os.path.join( self.tzRegKey, timeZoneName ) try: ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath ) except: raise ValueError, 'Timezone Name %s not found.' % timeZoneName return key ! def __getinitargs__( self ): ! return ( self.timeZoneName, ) ! def _LoadInfoFromKey( self, key ): """Loads the information from an opened time zone registry key into relevant fields of this TZI object""" ! self.displayName = _winreg.QueryValueEx( key, "Display" )[0] ! self.standardName = _winreg.QueryValueEx( key, "Std" )[0] ! self.daylightName = _winreg.QueryValueEx( key, "Dlt" )[0] ! self.staticInfo = WinTZI( key, "TZI" ) ! self._LoadDynamicInfoFromKey( key ) ! def _LoadDynamicInfoFromKey( self, key ): try: ! dkey = _winreg.OpenKeyEx( key, 'Dynamic DST' ) except WindowsError: return ! info = _RegKeyDict( dkey ) del info['FirstEntry'] del info['LastEntry'] ! years = map( int, info.keys() ) ! values = map( WinTZI, info.values() ) # create a range mapping that searches by descending year and matches # if the target year is greater or equal. ! self.dynamicInfo = RangeMap( zip( years, values ), descending, operator.ge ) ! def __repr__( self ): ! result = '%s( %s' % ( self.__class__.__name__, repr( self.timeZoneName ) ) if self.fixedStandardTime: result += ', True' ! result += ' )' return result ! def __str__( self ): return self.displayName ! def tzname( self, dt ): ! winInfo = self.getWinInfo( dt ) ! if self.dst( dt ) == winInfo.daylightBiasOffset: result = self.daylightName ! elif self.dst( dt ) == winInfo.standardBiasOffset: result = self.standardName return result ! def getWinInfo( self, targetYear ): ! if not hasattr( self, 'dynamicInfo' ) or not self.dynamicInfo: return self.staticInfo # Find the greatest year entry in self.dynamicInfo which is for # a year greater than or equal to our targetYear. If not found, # default to the earliest year. ! return self.dynamicInfo.get( targetYear, self.dynamicInfo[ RangeItemLast() ] ) ! def _getStandardBias( self, dt ): ! winInfo = self.getWinInfo( dt.year ) return winInfo.bias + winInfo.standardBiasOffset ! def _getDaylightBias( self, dt ): ! winInfo = self.getWinInfo( dt.year ) return winInfo.bias + winInfo.daylightBiasOffset ! def utcoffset( self, dt ): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return ! winInfo = self.getWinInfo( dt.year ) ! return -( winInfo.bias + self.dst( dt ) ) ! def dst( self, dt ): "Calculates the daylight savings offset according to the datetime.tzinfo spec" if dt is None: return assert dt.tzinfo is self ! winInfo = self.getWinInfo( dt.year ) ! if not self.fixedStandardTime and self._inDaylightSavings( dt ): result = winInfo.daylightBiasOffset else: --- 202,299 ---- tzRegKey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' ! def __init__(self, timeZoneName, fixedStandardTime=False): self.timeZoneName = timeZoneName key = self._FindTimeZoneKey() ! self._LoadInfoFromKey(key) self.fixedStandardTime = fixedStandardTime ! def _FindTimeZoneKey(self): """Find the registry key for the time zone name (self.timeZoneName).""" # for multi-language compatability, match the time zone name in the # "Std" key of the time zone key. ! zoneNames = dict(GetIndexedTimeZoneNames('Std')) # Also match the time zone key name itself, to be compatible with # English-based hard-coded time zones. ! timeZoneName = zoneNames.get(self.timeZoneName, self.timeZoneName) ! tzRegKeyPath = os.path.join(self.tzRegKey, timeZoneName) try: ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) except: raise ValueError, 'Timezone Name %s not found.' % timeZoneName return key ! def __getinitargs__(self): ! return (self.timeZoneName,) ! def _LoadInfoFromKey(self, key): """Loads the information from an opened time zone registry key into relevant fields of this TZI object""" ! self.displayName = _winreg.QueryValueEx(key, "Display")[0] ! self.standardName = _winreg.QueryValueEx(key, "Std")[0] ! self.daylightName = _winreg.QueryValueEx(key, "Dlt")[0] ! self.staticInfo = WinTZI(key, "TZI") ! self._LoadDynamicInfoFromKey(key) ! def _LoadDynamicInfoFromKey(self, key): try: ! dkey = _winreg.OpenKeyEx(key, 'Dynamic DST') except WindowsError: return ! info = _RegKeyDict(dkey) del info['FirstEntry'] del info['LastEntry'] ! years = map(int, info.keys()) ! values = map(WinTZI, info.values()) # create a range mapping that searches by descending year and matches # if the target year is greater or equal. ! self.dynamicInfo = RangeMap(zip(years, values), descending, operator.ge) ! def __repr__(self): ! result = '%s(%s' % (self.__class__.__name__, repr(self.timeZoneName)) if self.fixedStandardTime: result += ', True' ! result += ')' return result ! def __str__(self): return self.displayName ! def tzname(self, dt): ! winInfo = self.getWinInfo(dt) ! if self.dst(dt) == winInfo.daylightBiasOffset: result = self.daylightName ! elif self.dst(dt) == winInfo.standardBiasOffset: result = self.standardName return result ! def getWinInfo(self, targetYear): ! if not hasattr(self, 'dynamicInfo') or not self.dynamicInfo: return self.staticInfo # Find the greatest year entry in self.dynamicInfo which is for # a year greater than or equal to our targetYear. If not found, # default to the earliest year. ! return self.dynamicInfo.get(targetYear, self.dynamicInfo[RangeItemLast()]) ! def _getStandardBias(self, dt): ! winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.standardBiasOffset ! def _getDaylightBias(self, dt): ! winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.daylightBiasOffset ! def utcoffset(self, dt): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return ! winInfo = self.getWinInfo(dt.year) ! return -(winInfo.bias + self.dst(dt)) ! def dst(self, dt): "Calculates the daylight savings offset according to the datetime.tzinfo spec" if dt is None: return assert dt.tzinfo is self ! winInfo = self.getWinInfo(dt.year) ! if not self.fixedStandardTime and self._inDaylightSavings(dt): result = winInfo.daylightBiasOffset else: *************** *** 301,315 **** return result ! def _inDaylightSavings( self, dt ): try: ! dstStart = self.GetDSTStartTime( dt.year ) ! dstEnd = self.GetDSTEndTime( dt.year ) if dstStart < dstEnd: ! inDaylightSavings = dstStart <= dt.replace( tzinfo=None ) < dstEnd else: # in the southern hemisphere, daylight savings time # typically ends before it begins in a given year. ! inDaylightSavings = not ( dstEnd < dt.replace( tzinfo=None ) <= dstStart ) except ValueError: # there was an error parsing the time zone, which is normal when a --- 301,315 ---- return result ! def _inDaylightSavings(self, dt): try: ! dstStart = self.GetDSTStartTime(dt.year) ! dstEnd = self.GetDSTEndTime(dt.year) if dstStart < dstEnd: ! inDaylightSavings = dstStart <= dt.replace(tzinfo=None) < dstEnd else: # in the southern hemisphere, daylight savings time # typically ends before it begins in a given year. ! inDaylightSavings = not (dstEnd < dt.replace(tzinfo=None) <= dstStart) except ValueError: # there was an error parsing the time zone, which is normal when a *************** *** 319,376 **** return inDaylightSavings ! def GetDSTStartTime( self, year ): "Given a year, determines the time when daylight savings time starts" ! return self.getWinInfo( year ).LocateStartDay( year ) ! def GetDSTEndTime( self, year ): "Given a year, determines the time when daylight savings ends." ! return self.getWinInfo( year ).LocateEndDay( year ) ! def __cmp__( self, other ): ! return cmp( self.__dict__, other.__dict__ ) ! def _RegKeyEnumerator( key ): ! return _RegEnumerator( key, _winreg.EnumKey ) ! def _RegValueEnumerator( key ): ! return _RegEnumerator( key, _winreg.EnumValue ) ! def _RegEnumerator( key, func ): "Enumerates an open registry key as an iterable generator" index = 0 try: while 1: ! yield func( key, index ) index += 1 except WindowsError: pass ! def _RegKeyDict( key ): ! values = _RegValueEnumerator( key ) ! values = tuple( values ) ! return dict( map( lambda (name,value,type): (name,value), values ) ) ! def GetTimeZoneNames( ): "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey ) ! return _RegKeyEnumerator( key ) ! def GetIndexedTimeZoneNames( index_key = 'Index' ): """Returns the names of the time zones as defined in the registry, but includes an index by which they may be sorted. Default index is "Index" by which they may be sorted longitudinally.""" for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join( TimeZoneInfo.tzRegKey, timeZoneName ) ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath ) ! tzIndex, type = _winreg.QueryValueEx( key, index_key ) ! yield ( tzIndex, timeZoneName ) ! def GetSortedTimeZoneNames( ): """ Uses GetIndexedTimeZoneNames to return the time zone names sorted longitudinally.""" ! tzs = list( GetIndexedTimeZoneNames() ) tzs.sort() ! return zip( *tzs )[1] ! def GetLocalTimeZone( ): """Returns the local time zone as defined by the operating system in the registry. --- 319,376 ---- return inDaylightSavings ! def GetDSTStartTime(self, year): "Given a year, determines the time when daylight savings time starts" ! return self.getWinInfo(year).LocateStartDay(year) ! def GetDSTEndTime(self, year): "Given a year, determines the time when daylight savings ends." ! return self.getWinInfo(year).LocateEndDay(year) ! def __cmp__(self, other): ! return cmp(self.__dict__, other.__dict__) ! def _RegKeyEnumerator(key): ! return _RegEnumerator(key, _winreg.EnumKey) ! def _RegValueEnumerator(key): ! return _RegEnumerator(key, _winreg.EnumValue) ! def _RegEnumerator(key, func): "Enumerates an open registry key as an iterable generator" index = 0 try: while 1: ! yield func(key, index) index += 1 except WindowsError: pass ! def _RegKeyDict(key): ! values = _RegValueEnumerator(key) ! values = tuple(values) ! return dict(map(lambda (name,value,type): (name,value), values)) ! def GetTimeZoneNames(): "Returns the names of the time zones as defined in the registry" ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, TimeZoneInfo.tzRegKey) ! return _RegKeyEnumerator(key) ! def GetIndexedTimeZoneNames(index_key = 'Index'): """Returns the names of the time zones as defined in the registry, but includes an index by which they may be sorted. Default index is "Index" by which they may be sorted longitudinally.""" for timeZoneName in GetTimeZoneNames(): ! tzRegKeyPath = os.path.join(TimeZoneInfo.tzRegKey, timeZoneName) ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKeyPath) ! tzIndex, type = _winreg.QueryValueEx(key, index_key) ! yield (tzIndex, timeZoneName) ! def GetSortedTimeZoneNames(): """ Uses GetIndexedTimeZoneNames to return the time zone names sorted longitudinally.""" ! tzs = list(GetIndexedTimeZoneNames()) tzs.sort() ! return zip(*tzs)[1] ! def GetLocalTimeZone(): """Returns the local time zone as defined by the operating system in the registry. *************** *** 378,397 **** customized. It should have been selected from the Windows interface. >>> localTZ = GetLocalTimeZone() ! >>> nowLoc = datetime.datetime.now( localTZ ) ! >>> nowUTC = datetime.datetime.utcnow( ) ! >>> ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) Traceback (most recent call last): ... TypeError: can't subtract offset-naive and offset-aware datetimes ! >>> nowUTC = nowUTC.replace( tzinfo = TimeZoneInfo( 'GMT Standard Time', True ) ) Now one can compare the results of the two offset aware values ! >>> ( nowUTC - nowLoc ) < datetime.timedelta( seconds = 5 ) True """ tzRegKey = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation' ! key = _winreg.OpenKeyEx( _winreg.HKEY_LOCAL_MACHINE, tzRegKey ) ! local = _RegKeyDict( key ) # if the user has not checked "Automatically adjust clock for daylight # saving changes" in the Date and Time Properties control, the standard --- 378,397 ---- customized. It should have been selected from the Windows interface. >>> localTZ = GetLocalTimeZone() ! >>> nowLoc = datetime.datetime.now(localTZ) ! >>> nowUTC = datetime.datetime.utcnow() ! >>> (nowUTC - nowLoc) < datetime.timedelta(seconds = 5) Traceback (most recent call last): ... TypeError: can't subtract offset-naive and offset-aware datetimes ! >>> nowUTC = nowUTC.replace(tzinfo = TimeZoneInfo('GMT Standard Time', True)) Now one can compare the results of the two offset aware values ! >>> (nowUTC - nowLoc) < datetime.timedelta(seconds = 5) True """ tzRegKey = r'SYSTEM\CurrentControlSet\Control\TimeZoneInformation' ! key = _winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE, tzRegKey) ! local = _RegKeyDict(key) # if the user has not checked "Automatically adjust clock for daylight # saving changes" in the Date and Time Properties control, the standard *************** *** 400,409 **** fixStandardTime = local['StandardName'] == local['DaylightName'] and \ local['StandardBias'] == local['DaylightBias'] ! keyName = [ 'StandardName', 'TimeZoneKeyName' ][ sys.getwindowsversion() >= (6,) ] ! standardName = local[ keyName ] ! standardName = __TimeZoneKeyNameWorkaround( standardName ) ! return TimeZoneInfo( standardName, fixStandardTime ) ! def __TimeZoneKeyNameWorkaround( name ): """It may be a bug in Vista, but in standard Windows Vista install (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a --- 400,409 ---- fixStandardTime = local['StandardName'] == local['DaylightName'] and \ local['StandardBias'] == local['DaylightBias'] ! keyName = ['StandardName', 'TimeZoneKeyName'][sys.getwindowsversion() >= (6,)] ! standardName = local[keyName] ! standardName = __TimeZoneKeyNameWorkaround(standardName) ! return TimeZoneInfo(standardName, fixStandardTime) ! def __TimeZoneKeyNameWorkaround(name): """It may be a bug in Vista, but in standard Windows Vista install (both 32-bit and 64-bit), it appears the TimeZoneKeyName returns a *************** *** 420,445 **** Note Dynamic Time Zone support is not available on any platform at this time; this is a limitation of this library, not the platform.""" ! tzi = TimeZoneInfo( 'Mountain Standard Time' ) ! MissingTZPatch = datetime.datetime( 2007,11,2,tzinfo=tzi ).utctimetuple() != (2007,11,2,6,0,0,4,306,0) ! DynamicTZSupport = not MissingTZPatch and datetime.datetime( 2003,11,2,tzinfo=tzi).utctimetuple() == (2003,11,2,7,0,0,6,306,0) del tzi return vars() ! class DLLHandleCache( object ): ! def __init__( self ): self.__cache = {} ! def __getitem__( self, filename ): key = filename.lower() ! return self.__cache.setdefault( key, win32api.LoadLibrary( key ) ) DLLCache = DLLHandleCache() ! def resolveMUITimeZone( spec ): """Resolve a multilingual user interface resource for the time zone name ! >>> result = resolveMUITimeZone( '@tzres.dll,-110' ) >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] ! >>> type( result ) is expectedResultType True --- 420,445 ---- Note Dynamic Time Zone support is not available on any platform at this time; this is a limitation of this library, not the platform.""" ! tzi = TimeZoneInfo('Mountain Standard Time') ! MissingTZPatch = datetime.datetime(2007,11,2,tzinfo=tzi).utctimetuple() != (2007,11,2,6,0,0,4,306,0) ! DynamicTZSupport = not MissingTZPatch and datetime.datetime(2003,11,2,tzinfo=tzi).utctimetuple() == (2003,11,2,7,0,0,6,306,0) del tzi return vars() ! class DLLHandleCache(object): ! def __init__(self): self.__cache = {} ! def __getitem__(self, filename): key = filename.lower() ! return self.__cache.setdefault(key, win32api.LoadLibrary(key)) DLLCache = DLLHandleCache() ! def resolveMUITimeZone(spec): """Resolve a multilingual user interface resource for the time zone name ! >>> result = resolveMUITimeZone('@tzres.dll,-110') >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] ! >>> type(result) is expectedResultType True *************** *** 447,457 **** see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ ! pattern = re.compile( '@(?P<dllname>.*),-(?P<index>\d+)(?:;(?P<comment>.*))?' ) ! matcher = pattern.match( spec ) assert matcher, 'Could not parse MUI spec' try: ! handle = DLLCache[ matcher.groupdict()[ 'dllname' ] ] ! result = win32api.LoadString( handle, int( matcher.groupdict()[ 'index' ] ) ) except win32api.error, e: result = None --- 447,457 ---- see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ ! pattern = re.compile('@(?P<dllname>.*),-(?P<index>\d+)(?:;(?P<comment>.*))?') ! matcher = pattern.match(spec) assert matcher, 'Could not parse MUI spec' try: ! handle = DLLCache[matcher.groupdict()['dllname']] ! result = win32api.LoadString(handle, int(matcher.groupdict()['index'])) except win32api.error, e: result = None *************** *** 461,468 **** ascending = cmp ! def descending( a, b ): ! return -ascending( a, b ) ! class RangeMap( dict ): """A dictionary-like object that uses the keys as bounds for a range. Inclusion of the value for that range is determined by the --- 461,468 ---- ascending = cmp ! def descending(a, b): ! return -ascending(a, b) ! class RangeMap(dict): """A dictionary-like object that uses the keys as bounds for a range. Inclusion of the value for that range is determined by the *************** *** 473,477 **** Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b' ! >>> r = RangeMap( { 3: 'a', 6: 'b' } ) # boy, that was easy >>> r[1], r[2], r[3], r[4], r[5], r[6] ('a', 'a', 'a', 'b', 'b', 'b') --- 473,477 ---- Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b' ! >>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy >>> r[1], r[2], r[3], r[4], r[5], r[6] ('a', 'a', 'a', 'b', 'b', 'b') *************** *** 484,488 **** One can close the open-end of the RangeMap by using RangeValueUndefined ! >>> r = RangeMap( { 0: RangeValueUndefined(), 3: 'a', 6: 'b' } ) >>> r[0] Traceback (most recent call last): --- 484,488 ---- One can close the open-end of the RangeMap by using RangeValueUndefined ! >>> r = RangeMap({0: RangeValueUndefined(), 3: 'a', 6: 'b'}) >>> r[0] Traceback (most recent call last): *************** *** 491,495 **** One can get the first or last elements in the range by using RangeItem ! >>> last_item = RangeItem( -1 ) >>> r[last_item] 'b' --- 491,495 ---- One can get the first or last elements in the range by using RangeItem ! >>> last_item = RangeItem(-1) >>> r[last_item] 'b' *************** *** 502,542 **** """ ! def __init__( self, source, keySortComparator = ascending, keyMatchComparator = operator.le ): ! dict.__init__( self, source ) self.sort = keySortComparator self.match = keyMatchComparator ! def __getitem__( self, item ): sortedKeys = self.keys() ! sortedKeys.sort( self.sort ) ! if isinstance( item, RangeItem ): ! result = self.__getitem__( sortedKeys[ item ] ) else: ! key = self._find_first_match_( sortedKeys, item ) ! result = dict.__getitem__( self, key ) ! if isinstance( result, RangeValueUndefined ): raise KeyError, key return result ! def _find_first_match_( self, keys, item ): ! is_match = lambda k: self.match( item, k ) # use of ifilter here would be more efficent ! matches = filter( is_match, keys ) if matches: return matches[0] ! raise KeyError( item ) ! def bounds( self ): sortedKeys = self.keys() ! sortedKeys.sort( self.sort ) ! return sortedKeys[ RangeItemFirst() ], sortedKeys[ RangeItemLast() ] ! class RangeValueUndefined( object ): pass ! class RangeItem( int ): ! def __new__( cls, value ): ! return int.__new__( cls, value ) ! class RangeItemFirst( RangeItem ): ! def __new__( cls ): ! return RangeItem.__new__( cls, 0 ) ! class RangeItemLast( RangeItem ): ! def __new__( cls ): ! return RangeItem.__new__( cls, -1 ) --- 502,542 ---- """ ! def __init__(self, source, keySortComparator = ascending, keyMatchComparator = operator.le): ! dict.__init__(self, source) self.sort = keySortComparator self.match = keyMatchComparator ! def __getitem__(self, item): sortedKeys = self.keys() ! sortedKeys.sort(self.sort) ! if isinstance(item, RangeItem): ! result = self.__getitem__(sortedKeys[item]) else: ! key = self._find_first_match_(sortedKeys, item) ! result = dict.__getitem__(self, key) ! if isinstance(result, RangeValueUndefined): raise KeyError, key return result ! def _find_first_match_(self, keys, item): ! is_match = lambda k: self.match(item, k) # use of ifilter here would be more efficent ! matches = filter(is_match, keys) if matches: return matches[0] ! raise KeyError(item) ! def bounds(self): sortedKeys = self.keys() ! sortedKeys.sort(self.sort) ! return sortedKeys[RangeItemFirst()], sortedKeys[RangeItemLast()] ! class RangeValueUndefined(object): pass ! class RangeItem(int): ! def __new__(cls, value): ! return int.__new__(cls, value) ! class RangeItemFirst(RangeItem): ! def __new__(cls): ! return RangeItem.__new__(cls, 0) ! class RangeItemLast(RangeItem): ! def __new__(cls): ! return RangeItem.__new__(cls, -1) |
From: Mark H. <mha...@us...> - 2008-11-10 03:20:03
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23699/src Modified Files: Tag: py3k PyIInternetSecurityManager.cpp Log Message: Correct pointer indirection fetching a GUID in IInternetSecurityManager Index: PyIInternetSecurityManager.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/PyIInternetSecurityManager.cpp,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** PyIInternetSecurityManager.cpp 2 Nov 2008 12:55:54 -0000 1.1.2.2 --- PyIInternetSecurityManager.cpp 10 Nov 2008 03:19:56 -0000 1.1.2.3 *************** *** 363,367 **** Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) ! obContext = PyWinObject_FromIID(*((IID *)*pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); --- 363,367 ---- Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) ! obContext = PyWinObject_FromIID(*((IID *)pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); |
From: Mark H. <mha...@us...> - 2008-11-10 03:19:29
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23500/src Modified Files: PyIInternetSecurityManager.cpp Log Message: Correct pointer indirection fetching a GUID in IInternetSecurityManager Index: PyIInternetSecurityManager.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/PyIInternetSecurityManager.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIInternetSecurityManager.cpp 2 Nov 2008 12:50:01 -0000 1.1 --- PyIInternetSecurityManager.cpp 10 Nov 2008 03:19:21 -0000 1.2 *************** *** 363,367 **** Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) ! obContext = PyWinObject_FromIID(*((IID *)*pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); --- 363,367 ---- Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) ! obContext = PyWinObject_FromIID(*((IID *)pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); |
From: Mark H. <mha...@us...> - 2008-11-02 13:00:44
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23675/com/win32comext/internet/src Modified Files: Tag: py3k internet.cpp Log Message: remove accidental function prototypes! Index: internet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet.cpp,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** internet.cpp 2 Nov 2008 12:55:54 -0000 1.4.2.2 --- internet.cpp 2 Nov 2008 13:00:38 -0000 1.4.2.3 *************** *** 219,227 **** } - STDAPI CoInternetCreateSecurityManager(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); - - STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); - - /* List of module functions */ // @module internet|A module, encapsulating the ActiveX Internet interfaces --- 219,222 ---- |
From: Mark H. <mha...@us...> - 2008-11-02 13:00:05
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23515/com/win32comext/internet/src Modified Files: internet.cpp Log Message: remove accidental function prototypes! Index: internet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** internet.cpp 2 Nov 2008 12:50:01 -0000 1.5 --- internet.cpp 2 Nov 2008 12:59:59 -0000 1.6 *************** *** 219,227 **** } - STDAPI CoInternetCreateSecurityManager(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); - - STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); - - /* List of module functions */ // @module internet|A module, encapsulating the ActiveX Internet interfaces --- 219,222 ---- |
From: Mark H. <mha...@us...> - 2008-11-02 12:56:02
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23269/com/win32comext/internet/src Modified Files: Tag: py3k internet.cpp Added Files: Tag: py3k PyIDocHostUIHandler.cpp PyIDocHostUIHandler.h PyIHTMLOMWindowServices.cpp PyIHTMLOMWindowServices.h PyIInternetSecurityManager.cpp PyIInternetSecurityManager.h Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. --- NEW FILE: PyIHTMLOMWindowServices.cpp --- // This file implements the IHTMLOMWindowServices Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "MsHtmHst.h" #include "PyIHTMLOMWindowServices.h" // @doc - This file contains autoduck documentation // Gateway Implementation STDMETHODIMP PyGHTMLOMWindowServices::moveTo( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("moveTo", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::moveBy( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("moveBy", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::resizeTo( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("resizeTo", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::resizeBy( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("resizeBy", NULL, "ll", x, y); } Index: internet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** internet.cpp 29 Aug 2008 08:32:58 -0000 1.4.2.1 --- internet.cpp 2 Nov 2008 12:55:54 -0000 1.4.2.2 *************** *** 14,20 **** --- 14,23 ---- #include "internet_pch.h" + #include "MsHtmHst.h" #include "stddef.h" // for offsetof #include "PythonCOMRegister.h" // For simpler registration of IIDs etc. + #include "PyIDocHostUIHandler.h" + #include "PyIHTMLOMWindowServices.h" #include "PyIInternetProtocolRoot.h" #include "PyIInternetProtocol.h" *************** *** 23,26 **** --- 26,30 ---- #include "PyIInternetPriority.h" #include "PyIInternetBindInfo.h" + #include "PyIInternetSecurityManager.h" // Check a function pointer that is supplied by a specific IE version (ie, *************** *** 34,37 **** --- 38,46 ---- static CoInternetIsFeatureEnabled_func pfnCoInternetIsFeatureEnabled=NULL; + typedef HRESULT (WINAPI *CoInternetCreateSecurityManager_func)(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); + static CoInternetCreateSecurityManager_func pfnCoInternetCreateSecurityManager=NULL; + + // STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); + HMODULE loadmodule(TCHAR *dllname) { *************** *** 185,188 **** --- 194,226 ---- } + // @pymethod <o PyIInternetSecurityManager>|internet|CoInternetCreateSecurityManager| + static PyObject *PyCoInternetCreateSecurityManager(PyObject *self, PyObject *args) + { + CHECK_IE_PFN(CoInternetCreateSecurityManager); + PyObject *obprov; + DWORD reserved; + if (!PyArg_ParseTuple(args, "Oi", + &obprov, // &pyparm <o PyIServiceProvider>|serviceProvider|| + &reserved)) // @pyparm int|reserved|| + return NULL; + IServiceProvider *prov; + if (!PyCom_InterfaceFromPyInstanceOrObject(obprov, IID_IServiceProvider, (void **)&prov, TRUE /* bNoneOK */)) + return NULL; + HRESULT hr; + IInternetSecurityManager *sm = 0; + PY_INTERFACE_PRECALL; + hr = (*pfnCoInternetCreateSecurityManager)(prov, &sm, reserved); + prov->Release(); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown(sm, IID_IInternetSecurityManager, FALSE); + + } + + STDAPI CoInternetCreateSecurityManager(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); + + STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); + /* List of module functions */ *************** *** 190,193 **** --- 228,232 ---- static struct PyMethodDef internet_functions[]= { + { "CoInternetCreateSecurityManager", PyCoInternetCreateSecurityManager}, // @pymeth CoInternetCreateSecurityManager| { "CoInternetIsFeatureEnabled", PyCoInternetIsFeatureEnabled}, // @pymeth CoInternetIsFeatureEnabled| { "CoInternetSetFeatureEnabled", PyCoInternetSetFeatureEnabled}, // @pymeth CoInternetSetFeatureEnabled| *************** *** 211,214 **** --- 250,255 ---- static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { + PYCOM_INTERFACE_FULL (DocHostUIHandler), + PYCOM_INTERFACE_SERVER_ONLY(HTMLOMWindowServices), PYCOM_INTERFACE_FULL (InternetProtocolRoot), PYCOM_INTERFACE_FULL (InternetProtocol), *************** *** 217,220 **** --- 258,262 ---- PYCOM_INTERFACE_FULL (InternetPriority), PYCOM_INTERFACE_FULL (InternetBindInfo), + PYCOM_INTERFACE_FULL (InternetSecurityManager), }; *************** *** 261,264 **** --- 303,307 ---- pfnCoInternetSetFeatureEnabled=(CoInternetSetFeatureEnabled_func)loadapifunc("CoInternetSetFeatureEnabled", urlmon_dll); pfnCoInternetIsFeatureEnabled=(CoInternetIsFeatureEnabled_func)loadapifunc("CoInternetIsFeatureEnabled", urlmon_dll); + pfnCoInternetCreateSecurityManager=(CoInternetCreateSecurityManager_func)loadapifunc("CoInternetCreateSecurityManager", urlmon_dll); ADD_CONSTANT(FEATURE_OBJECT_CACHING); // @const internet|FEATURE_OBJECT_CACHING| --- NEW FILE: PyIDocHostUIHandler.h --- // This file declares the IDocHostUIHandler Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIDocHostUIHandler : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIDocHostUIHandler); static IDocHostUIHandler *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *ShowContextMenu(PyObject *self, PyObject *args); static PyObject *GetHostInfo(PyObject *self, PyObject *args); static PyObject *ShowUI(PyObject *self, PyObject *args); static PyObject *HideUI(PyObject *self, PyObject *args); static PyObject *UpdateUI(PyObject *self, PyObject *args); static PyObject *EnableModeless(PyObject *self, PyObject *args); static PyObject *OnDocWindowActivate(PyObject *self, PyObject *args); static PyObject *OnFrameWindowActivate(PyObject *self, PyObject *args); static PyObject *ResizeBorder(PyObject *self, PyObject *args); static PyObject *TranslateAccelerator(PyObject *self, PyObject *args); static PyObject *GetOptionKeyPath(PyObject *self, PyObject *args); static PyObject *GetDropTarget(PyObject *self, PyObject *args); static PyObject *GetExternal(PyObject *self, PyObject *args); static PyObject *TranslateUrl(PyObject *self, PyObject *args); static PyObject *FilterDataObject(PyObject *self, PyObject *args); protected: PyIDocHostUIHandler(IUnknown *pdisp); ~PyIDocHostUIHandler(); }; // --------------------------------------------------- // // Gateway Declaration class PyGDocHostUIHandler : public PyGatewayBase, public IDocHostUIHandler { protected: PyGDocHostUIHandler(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGDocHostUIHandler, IDocHostUIHandler, IID_IDocHostUIHandler, PyGatewayBase) // IDocHostUIHandler STDMETHOD(ShowContextMenu)( DWORD dwID, POINT * ppt, IUnknown * pcmdtReserved, IDispatch * pdispReserved); STDMETHOD(GetHostInfo)( DOCHOSTUIINFO * pInfo); STDMETHOD(ShowUI)( DWORD dwID, IOleInPlaceActiveObject * pActiveObject, IOleCommandTarget * pCommandTarget, IOleInPlaceFrame * pFrame, IOleInPlaceUIWindow * pDoc); STDMETHOD(HideUI)( void); STDMETHOD(UpdateUI)( void); STDMETHOD(EnableModeless)( BOOL fEnable); STDMETHOD(OnDocWindowActivate)( BOOL fActivate); STDMETHOD(OnFrameWindowActivate)( BOOL fActivate); STDMETHOD(ResizeBorder)( LPCRECT prcBorder, IOleInPlaceUIWindow * pUIWindow, BOOL fRameWindow); STDMETHOD(TranslateAccelerator)( LPMSG lpMsg, const GUID * pguidCmdGroup, DWORD nCmdID); STDMETHOD(GetOptionKeyPath)( LPOLESTR * pchKey, DWORD dw); STDMETHOD(GetDropTarget)( IDropTarget * pDropTarget, IDropTarget ** ppDropTarget); STDMETHOD(GetExternal)( IDispatch ** ppDispatch); STDMETHOD(TranslateUrl)( DWORD dwTranslate, OLECHAR * pchURLIn, OLECHAR ** ppchURLOut); STDMETHOD(FilterDataObject)( IDataObject * pDO, IDataObject ** ppDORet); }; --- NEW FILE: PyIHTMLOMWindowServices.h --- // This file declares the IHTMLOMWindowServices Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Gateway Declaration class PyGHTMLOMWindowServices : public PyGatewayBase, public IHTMLOMWindowServices { protected: PyGHTMLOMWindowServices(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGHTMLOMWindowServices, IHTMLOMWindowServices, IID_IHTMLOMWindowServices, PyGatewayBase) // IHTMLOMWindowServices STDMETHOD(moveTo)( LONG x, LONG y); STDMETHOD(moveBy)( LONG x, LONG y); STDMETHOD(resizeTo)( LONG x, LONG y); STDMETHOD(resizeBy)( LONG x, LONG y); }; --- NEW FILE: PyIInternetSecurityManager.h --- // This file declares the IInternetSecurityManager Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration #include "internet_pch.h" class PyIInternetSecurityManager : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIInternetSecurityManager); static IInternetSecurityManager *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *SetSecuritySite(PyObject *self, PyObject *args); static PyObject *GetSecuritySite(PyObject *self, PyObject *args); static PyObject *MapUrlToZone(PyObject *self, PyObject *args); static PyObject *GetSecurityId(PyObject *self, PyObject *args); static PyObject *ProcessUrlAction(PyObject *self, PyObject *args); static PyObject *QueryCustomPolicy(PyObject *self, PyObject *args); static PyObject *SetZoneMapping(PyObject *self, PyObject *args); static PyObject *GetZoneMappings(PyObject *self, PyObject *args); protected: PyIInternetSecurityManager(IUnknown *pdisp); ~PyIInternetSecurityManager(); }; // --------------------------------------------------- // // Gateway Declaration class PyGInternetSecurityManager : public PyGatewayBase, public IInternetSecurityManager { protected: PyGInternetSecurityManager(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGInternetSecurityManager, IInternetSecurityManager, IID_IInternetSecurityManager, PyGatewayBase) // IInternetSecurityManager STDMETHOD(SetSecuritySite)( IInternetSecurityMgrSite * pSite); STDMETHOD(GetSecuritySite)( IInternetSecurityMgrSite ** ppSite); STDMETHOD(MapUrlToZone)( LPCWSTR pwszUrl, DWORD * pdwZone, DWORD dwFlags); STDMETHOD(GetSecurityId)( LPCWSTR pwszUrl, BYTE * pbSecurityId, DWORD * pcbSecurityId, DWORD_PTR dwReserved); STDMETHOD(ProcessUrlAction)( LPCWSTR pwszUrl, DWORD dwAction, BYTE * pPolicy, DWORD cbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved); STDMETHOD(QueryCustomPolicy)( LPCWSTR pwszUrl, REFGUID guidKey, BYTE ** ppPolicy, DWORD * pcbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwReserved); STDMETHOD(SetZoneMapping)( DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags); STDMETHOD(GetZoneMappings)( DWORD dwZone, IEnumString ** ppenumString, DWORD dwFlags); }; --- NEW FILE: PyIDocHostUIHandler.cpp --- // This file implements the IDocHostUIHandler Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "MsHtmHst.h" #include "PyIDocHostUIHandler.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIDocHostUIHandler::PyIDocHostUIHandler(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIDocHostUIHandler::~PyIDocHostUIHandler() { } /* static */ IDocHostUIHandler *PyIDocHostUIHandler::GetI(PyObject *self) { return (IDocHostUIHandler *)PyIUnknown::GetI(self); } // @pymethod |PyIDocHostUIHandler|ShowContextMenu|Description of ShowContextMenu. PyObject *PyIDocHostUIHandler::ShowContextMenu(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwID||Description for dwID POINT pt; // @pyparm (int, int)|pt||Description for ppt // @pyparm <o PyIUnknown>|pcmdtReserved||Description for pcmdtReserved // @pyparm <o PyIDispatch>|pdispReserved||Description for pdispReserved PyObject *obpcmdtReserved; PyObject *obpdispReserved; DWORD dwID; IUnknown * pcmdtReserved; IDispatch * pdispReserved; if ( !PyArg_ParseTuple(args, "l(ii)OO:ShowContextMenu", &dwID, &pt.x, &pt.y, &obpcmdtReserved, &obpdispReserved) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyInstanceOrObject(obpcmdtReserved, IID_IUnknown, (void **)&pcmdtReserved, TRUE /* bNoneOK */)) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpdispReserved, IID_IDispatch, (void **)&pdispReserved, TRUE /* bNoneOK */)) { if (pcmdtReserved) pcmdtReserved->Release(); return NULL; } HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ShowContextMenu( dwID, &pt, pcmdtReserved, pdispReserved ); if (pcmdtReserved) pcmdtReserved->Release(); if (pdispReserved) pdispReserved->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|GetHostInfo|Description of GetHostInfo. PyObject *PyIDocHostUIHandler::GetHostInfo(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; DOCHOSTUIINFO info; memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); if ( !PyArg_ParseTuple(args, ":GetHostInfo")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetHostInfo(&info); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler); return Py_BuildValue("iiNN", info.dwFlags, info.dwDoubleClick, MakeOLECHARToObj(info.pchHostCss), MakeOLECHARToObj(info.pchHostNS)); } // @pymethod |PyIDocHostUIHandler|ShowUI|Description of ShowUI. PyObject *PyIDocHostUIHandler::ShowUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwID||Description for dwID // @pyparm <o PyIOleInPlaceActiveObject>|pActiveObject||Description for pActiveObject // @pyparm <o PyIOleCommandTarget>|pCommandTarget||Description for pCommandTarget // @pyparm <o PyIOleInPlaceFrame>|pFrame||Description for pFrame // @pyparm <o PyIOleInPlaceUIWindow>|pDoc||Description for pDoc PyObject *obpActiveObject; PyObject *obpCommandTarget; PyObject *obpFrame; PyObject *obpDoc; DWORD dwID; if ( !PyArg_ParseTuple(args, "lOOOO:ShowUI", &dwID, &obpActiveObject, &obpCommandTarget, &obpFrame, &obpDoc) ) return NULL; IOleInPlaceActiveObject * pActiveObject; IOleCommandTarget * pCommandTarget; IOleInPlaceFrame * pFrame; IOleInPlaceUIWindow * pDoc; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpActiveObject, IID_IOleInPlaceActiveObject, (void **)&pActiveObject, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpCommandTarget, IID_IOleCommandTarget, (void **)&pCommandTarget, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpFrame, IID_IOleInPlaceFrame, (void **)&pFrame, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDoc, IID_IOleInPlaceUIWindow, (void **)&pDoc, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ShowUI( dwID, pActiveObject, pCommandTarget, pFrame, pDoc ); if (pActiveObject) pActiveObject->Release(); if (pCommandTarget) pCommandTarget->Release(); if (pFrame) pFrame->Release(); if (pDoc) pDoc->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|HideUI|Description of HideUI. PyObject *PyIDocHostUIHandler::HideUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":HideUI") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->HideUI( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|UpdateUI|Description of UpdateUI. PyObject *PyIDocHostUIHandler::UpdateUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":UpdateUI") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->UpdateUI( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|EnableModeless|Description of EnableModeless. PyObject *PyIDocHostUIHandler::EnableModeless(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fEnable||Description for fEnable BOOL fEnable; if ( !PyArg_ParseTuple(args, "i:EnableModeless", &fEnable) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->EnableModeless( fEnable ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|OnDocWindowActivate|Description of OnDocWindowActivate. PyObject *PyIDocHostUIHandler::OnDocWindowActivate(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fActivate||Description for fActivate BOOL fActivate; if ( !PyArg_ParseTuple(args, "i:OnDocWindowActivate", &fActivate) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->OnDocWindowActivate( fActivate ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|OnFrameWindowActivate|Description of OnFrameWindowActivate. PyObject *PyIDocHostUIHandler::OnFrameWindowActivate(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fActivate||Description for fActivate BOOL fActivate; if ( !PyArg_ParseTuple(args, "i:OnFrameWindowActivate", &fActivate) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->OnFrameWindowActivate( fActivate ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|ResizeBorder|Description of ResizeBorder. PyObject *PyIDocHostUIHandler::ResizeBorder(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; RECT border; // @pyparm (int, int, int, int)|prcBorder||Description for prcBorder // @pyparm <o PyIOleInPlaceUIWindow>|pUIWindow||Description for pUIWindow // @pyparm int|fRameWindow||Description for fRameWindow PyObject *obpUIWindow; IOleInPlaceUIWindow * pUIWindow; BOOL fRameWindow; if ( !PyArg_ParseTuple(args, "(iiii)Oi:ResizeBorder", &border.left, &border.top, &border.right, &border.bottom, &obpUIWindow, &fRameWindow) ) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpUIWindow, IID_IOleInPlaceUIWindow, (void **)&pUIWindow, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ResizeBorder(&border, pUIWindow, fRameWindow ); if (pUIWindow) pUIWindow->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|TranslateAccelerator|Description of TranslateAccelerator. PyObject *PyIDocHostUIHandler::TranslateAccelerator(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; MSG msg; PyObject *oblpMsg; // @pyparm <o PyLPMSG>|lpMsg||Description for lpMsg // @pyparm <o PyIID>|pguidCmdGroup||Description for pguidCmdGroup // @pyparm int|nCmdID||Description for nCmdID PyObject *obpguidCmdGroup; IID guidCmdGroup; DWORD nCmdID; if ( !PyArg_ParseTuple(args, "OOl:TranslateAccelerator", &oblpMsg, &obpguidCmdGroup, &nCmdID) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsMSG(oblpMsg, &msg)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obpguidCmdGroup, &guidCmdGroup)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->TranslateAccelerator(&msg, &guidCmdGroup, nCmdID ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|GetOptionKeyPath|Description of GetOptionKeyPath. PyObject *PyIDocHostUIHandler::GetOptionKeyPath(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dw||Description for dw LPOLESTR pchKey; DWORD dw; if ( !PyArg_ParseTuple(args, "l:GetOptionKeyPath", &dw) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetOptionKeyPath( &pchKey, dw ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); PyObject *pyretval = MakeOLECHARToObj(pchKey); CoTaskMemFree(pchKey); return pyretval; } // @pymethod |PyIDocHostUIHandler|GetDropTarget|Description of GetDropTarget. PyObject *PyIDocHostUIHandler::GetDropTarget(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm <o PyIDropTarget>|pDropTarget||Description for pDropTarget PyObject *obpDropTarget; IDropTarget * pDropTarget; IDropTarget * ppDropTarget; if ( !PyArg_ParseTuple(args, "O:GetDropTarget", &obpDropTarget) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDropTarget, IID_IDropTarget, (void **)&pDropTarget, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetDropTarget( pDropTarget, &ppDropTarget ); if (pDropTarget) pDropTarget->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDropTarget, IID_IDropTarget, FALSE); } // @pymethod |PyIDocHostUIHandler|GetExternal|Description of GetExternal. PyObject *PyIDocHostUIHandler::GetExternal(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; IDispatch * ppDispatch; if ( !PyArg_ParseTuple(args, ":GetExternal") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetExternal( &ppDispatch ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDispatch, IID_IDispatch, FALSE); } // @pymethod |PyIDocHostUIHandler|TranslateUrl|Description of TranslateUrl. PyObject *PyIDocHostUIHandler::TranslateUrl(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwTranslate||Description for dwTranslate // @pyparm <o unicode>|pchURLIn||Description for pchURLIn PyObject *obpchURLIn; DWORD dwTranslate; OLECHAR *pchURLIn; OLECHAR *pchURLOut = 0; if ( !PyArg_ParseTuple(args, "lO:TranslateUrl", &dwTranslate, &obpchURLIn) ) return NULL; if (!PyWinObject_AsWCHAR(obpchURLIn, &pchURLIn)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->TranslateUrl( dwTranslate, pchURLIn, &pchURLOut); PyWinObject_FreeWCHAR(pchURLIn); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); PyObject *pyretval = MakeOLECHARToObj(pchURLOut); CoTaskMemFree(pchURLOut); return pyretval; } // @pymethod |PyIDocHostUIHandler|FilterDataObject|Description of FilterDataObject. PyObject *PyIDocHostUIHandler::FilterDataObject(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm <o PyIDataObject>|pDO||Description for pDO PyObject *obpDO; IDataObject * pDO; IDataObject * ppDORet; if ( !PyArg_ParseTuple(args, "O:FilterDataObject", &obpDO) ) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpDO, IID_IDataObject, (void **)&pDO, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->FilterDataObject( pDO, &ppDORet ); if (pDO) pDO->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDORet, IID_IDataObject, FALSE); } // @object PyIDocHostUIHandler|Description of the interface static struct PyMethodDef PyIDocHostUIHandler_methods[] = { { "ShowContextMenu", PyIDocHostUIHandler::ShowContextMenu, 1 }, // @pymeth ShowContextMenu|Description of ShowContextMenu { "GetHostInfo", PyIDocHostUIHandler::GetHostInfo, 1 }, // @pymeth GetHostInfo|Description of GetHostInfo { "ShowUI", PyIDocHostUIHandler::ShowUI, 1 }, // @pymeth ShowUI|Description of ShowUI { "HideUI", PyIDocHostUIHandler::HideUI, 1 }, // @pymeth HideUI|Description of HideUI { "UpdateUI", PyIDocHostUIHandler::UpdateUI, 1 }, // @pymeth UpdateUI|Description of UpdateUI { "EnableModeless", PyIDocHostUIHandler::EnableModeless, 1 }, // @pymeth EnableModeless|Description of EnableModeless { "OnDocWindowActivate", PyIDocHostUIHandler::OnDocWindowActivate, 1 }, // @pymeth OnDocWindowActivate|Description of OnDocWindowActivate { "OnFrameWindowActivate", PyIDocHostUIHandler::OnFrameWindowActivate, 1 }, // @pymeth OnFrameWindowActivate|Description of OnFrameWindowActivate { "ResizeBorder", PyIDocHostUIHandler::ResizeBorder, 1 }, // @pymeth ResizeBorder|Description of ResizeBorder { "TranslateAccelerator", PyIDocHostUIHandler::TranslateAccelerator, 1 }, // @pymeth TranslateAccelerator|Description of TranslateAccelerator { "GetOptionKeyPath", PyIDocHostUIHandler::GetOptionKeyPath, 1 }, // @pymeth GetOptionKeyPath|Description of GetOptionKeyPath { "GetDropTarget", PyIDocHostUIHandler::GetDropTarget, 1 }, // @pymeth GetDropTarget|Description of GetDropTarget { "GetExternal", PyIDocHostUIHandler::GetExternal, 1 }, // @pymeth GetExternal|Description of GetExternal { "TranslateUrl", PyIDocHostUIHandler::TranslateUrl, 1 }, // @pymeth TranslateUrl|Description of TranslateUrl { "FilterDataObject", PyIDocHostUIHandler::FilterDataObject, 1 }, // @pymeth FilterDataObject|Description of FilterDataObject { NULL } }; PyComTypeObject PyIDocHostUIHandler::type("PyIDocHostUIHandler", &PyIUnknown::type, sizeof(PyIDocHostUIHandler), PyIDocHostUIHandler_methods, GET_PYCOM_CTOR(PyIDocHostUIHandler)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGDocHostUIHandler::ShowContextMenu( /* [in] */ DWORD dwID, /* [in] */ POINT * ppt, /* [in] */ IUnknown * pcmdtReserved, /* [in] */ IDispatch * pdispReserved) { PY_GATEWAY_METHOD; return InvokeViaPolicy("ShowContextMenu", NULL, "l(ii)NO", dwID, ppt->x, ppt->y, PyCom_PyObjectFromIUnknown(pcmdtReserved, IID_IUnknown, TRUE), PyCom_PyObjectFromIUnknown(pdispReserved, IID_IDispatch, TRUE)); } STDMETHODIMP PyGDocHostUIHandler::GetHostInfo( /* [out][in] */ DOCHOSTUIINFO * pInfo) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetHostInfo", &result, ""); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obhostcss, *obhostns; if (!PyArg_ParseTuple(result, "iiOO", &pInfo->dwFlags, &pInfo->dwDoubleClick, &obhostcss, &obhostns) || !PyWinObject_AsTaskAllocatedWCHAR(obhostcss, &pInfo->pchHostCss, TRUE, NULL) || !PyWinObject_AsTaskAllocatedWCHAR(obhostns, &pInfo->pchHostNS, TRUE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetHostInfo"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::ShowUI( /* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject * pActiveObject, /* [in] */ IOleCommandTarget * pCommandTarget, /* [in] */ IOleInPlaceFrame * pFrame, /* [in] */ IOleInPlaceUIWindow * pDoc) { PY_GATEWAY_METHOD; PyObject *obpActiveObject; PyObject *obpCommandTarget; PyObject *obpFrame; PyObject *obpDoc; obpActiveObject = PyCom_PyObjectFromIUnknown(pActiveObject, IID_IOleInPlaceActiveObject, TRUE); obpCommandTarget = PyCom_PyObjectFromIUnknown(pCommandTarget, IID_IOleCommandTarget, TRUE); obpFrame = PyCom_PyObjectFromIUnknown(pFrame, IID_IOleInPlaceFrame, TRUE); obpDoc = PyCom_PyObjectFromIUnknown(pDoc, IID_IOleInPlaceUIWindow, TRUE); HRESULT hr=InvokeViaPolicy("ShowUI", NULL, "lOOOO", dwID, obpActiveObject, obpCommandTarget, obpFrame, obpDoc); Py_XDECREF(obpActiveObject); Py_XDECREF(obpCommandTarget); Py_XDECREF(obpFrame); Py_XDECREF(obpDoc); return hr; } STDMETHODIMP PyGDocHostUIHandler::HideUI( void) { PY_GATEWAY_METHOD; return InvokeViaPolicy("HideUI", NULL); } STDMETHODIMP PyGDocHostUIHandler::UpdateUI( void) { PY_GATEWAY_METHOD; return InvokeViaPolicy("UpdateUI", NULL); } STDMETHODIMP PyGDocHostUIHandler::EnableModeless( /* [in] */ BOOL fEnable) { PY_GATEWAY_METHOD; return InvokeViaPolicy("EnableModeless", NULL, "i", fEnable); } STDMETHODIMP PyGDocHostUIHandler::OnDocWindowActivate( /* [in] */ BOOL fActivate) { PY_GATEWAY_METHOD; return InvokeViaPolicy("OnDocWindowActivate", NULL, "i", fActivate); } STDMETHODIMP PyGDocHostUIHandler::OnFrameWindowActivate( /* [in] */ BOOL fActivate) { PY_GATEWAY_METHOD; return InvokeViaPolicy("OnFrameWindowActivate", NULL, "i", fActivate); } STDMETHODIMP PyGDocHostUIHandler::ResizeBorder( /* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow * pUIWindow, /* [in] */ BOOL fRameWindow) { PY_GATEWAY_METHOD; return InvokeViaPolicy("ResizeBorder", NULL, "(iiii)Ni", prcBorder->left, prcBorder->top, prcBorder->right, prcBorder->bottom, PyCom_PyObjectFromIUnknown(pUIWindow, IID_IOleInPlaceUIWindow, TRUE), fRameWindow); } STDMETHODIMP PyGDocHostUIHandler::TranslateAccelerator( /* [in] */ LPMSG lpMsg, /* [in] */ const GUID * pguidCmdGroup, /* [in] */ DWORD nCmdID) { PY_GATEWAY_METHOD; return InvokeViaPolicy("TranslateAccelerator", NULL, "NNl", PyWinObject_FromMSG(lpMsg), PyWinObject_FromIID(*pguidCmdGroup), nCmdID); } STDMETHODIMP PyGDocHostUIHandler::GetOptionKeyPath( /* [out] */ LPOLESTR * pchKey, /* [in] */ DWORD dw) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetOptionKeyPath", &result, "l", dw); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsTaskAllocatedWCHAR(result, pchKey, FALSE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetOptionKeyPath"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::GetDropTarget( /* [in] */ IDropTarget * pDropTarget, /* [out] */ IDropTarget ** ppDropTarget) { PY_GATEWAY_METHOD; if (ppDropTarget==NULL) return E_POINTER; PyObject *obpDropTarget; obpDropTarget = PyCom_PyObjectFromIUnknown(pDropTarget, IID_IDropTarget, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetDropTarget", &result, "O", obpDropTarget); Py_XDECREF(obpDropTarget); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDropTarget, (void **)ppDropTarget, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetDropTarget"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::GetExternal( /* [out] */ IDispatch ** ppDispatch) { PY_GATEWAY_METHOD; if (ppDispatch==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetExternal", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDispatch, (void **)ppDispatch, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetExternal"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::TranslateUrl( /* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR * pchURLIn, /* [out] */ OLECHAR ** ppchURLOut) { PY_GATEWAY_METHOD; if (ppchURLOut==NULL) return E_POINTER; PyObject *obpchURLIn; obpchURLIn = MakeOLECHARToObj(pchURLIn); PyObject *result; HRESULT hr=InvokeViaPolicy("TranslateUrl", &result, "lO", dwTranslate, obpchURLIn); Py_XDECREF(obpchURLIn); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsTaskAllocatedWCHAR(result, ppchURLOut, FALSE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("TranslateUrl"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::FilterDataObject( /* [in] */ IDataObject * pDO, /* [out] */ IDataObject ** ppDORet) { PY_GATEWAY_METHOD; if (ppDORet==NULL) return E_POINTER; PyObject *obpDO; obpDO = PyCom_PyObjectFromIUnknown(pDO, IID_IDataObject, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("FilterDataObject", &result, "O", obpDO); Py_XDECREF(obpDO); if (FAILED(hr)) return hr; if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDataObject, (void **)ppDORet, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("FilterDataObject"); Py_DECREF(result); return hr; } --- NEW FILE: PyIInternetSecurityManager.cpp --- // This file implements the IInternetSecurityManager Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "PyIInternetSecurityManager.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIInternetSecurityManager::PyIInternetSecurityManager(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIInternetSecurityManager::~PyIInternetSecurityManager() { } /* static */ IInternetSecurityManager *PyIInternetSecurityManager::GetI(PyObject *self) { return (IInternetSecurityManager *)PyIUnknown::GetI(self); } // @pymethod |PyIInternetSecurityManager|SetSecuritySite|Description of SetSecuritySite. PyObject *PyIInternetSecurityManager::SetSecuritySite(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o PyIInternetSecurityMgrSite>|pSite||Description for pSite PyObject *obpSite; IInternetSecurityMgrSite * pSite; if (!PyArg_ParseTuple(args, "O:SetSecuritySite", &obpSite)) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpSite, IID_IInternetSecurityMgrSite, (void **)&pSite, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->SetSecuritySite( pSite ); if (pSite) pSite->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIInternetSecurityManager|GetSecuritySite|Description of GetSecuritySite. PyObject *PyIInternetSecurityManager::GetSecuritySite(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; IInternetSecurityMgrSite * ppSite; if ( !PyArg_ParseTuple(args, ":GetSecuritySite") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetSecuritySite(&ppSite); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyCom_PyObjectFromIUnknown(ppSite, IID_IInternetSecurityMgrSite, FALSE); } // @pymethod |PyIInternetSecurityManager|MapUrlToZone|Description of MapUrlToZone. PyObject *PyIInternetSecurityManager::MapUrlToZone(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|dwFlags||Description for dwFlags PyObject *obpwszUrl; LPWSTR pwszUrl; DWORD pdwZone; DWORD dwFlags; if (!PyArg_ParseTuple(args, "Ol:MapUrlToZone", &obpwszUrl, &dwFlags)) return NULL; if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->MapUrlToZone( pwszUrl, &pdwZone, dwFlags ); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyInt_FromLong(pdwZone); } // @pymethod |PyIInternetSecurityManager|GetSecurityId|Description of GetSecurityId. PyObject *PyIInternetSecurityManager::GetSecurityId(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|pcbSecurityId||Description for pcbSecurityId DWORD_PTR dwReserved = 0; PyObject *obdwReserved = Py_None; // ACK - 'reserved' docs appears to indicate its actually a string. // so ignore it for now. PyObject *obpwszUrl; LPWSTR pwszUrl; if ( !PyArg_ParseTuple(args, "O:GetSecurityId", &obpwszUrl) ) return NULL; if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) return NULL; BYTE buf[1024]; // big enough? DWORD cbSecurityId = sizeof(buf); HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetSecurityId( pwszUrl, buf, &cbSecurityId, 0); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyString_FromStringAndSize((char *)buf, cbSecurityId); } // @pymethod |PyIInternetSecurityManager|ProcessUrlAction|Description of ProcessUrlAction. PyObject *PyIInternetSecurityManager::ProcessUrlAction(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|dwAction||Description for dwAction // @pyparm int|dwFlags||Description for dwFlags PyObject *obpwszUrl; LPWSTR pwszUrl; DWORD dwAction; PyObject *obContext; DWORD dwFlags; if ( !PyArg_ParseTuple(args, "OlOl:ProcessUrlAction", &obpwszUrl, &dwAction, &obContext, &dwFlags) ) return NULL; BOOL bPythonIsHappy = TRUE; IID context; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsIID(obContext, &context)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; DWORD dwPolicy = 0; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->ProcessUrlAction( pwszUrl, dwAction, (BYTE *)&dwPolicy, sizeof(dwPolicy), (BYTE *)&context, sizeof(context), dwFlags, 0); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager); return Py_BuildValue("ll", hr, dwPolicy); } /*** // @pymethod |PyIInternetSecurityManager|QueryCustomPolicy|Description of QueryCustomPolicy. PyObject *PyIInternetSecurityManager::QueryCustomPolicy(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm <o PyIID>|guidKey||Description for guidKey // @pyparm int|pContext||Description for pContext // @pyparm int|cbContext||Description for cbContext // @pyparm int|dwReserved||Description for dwReserved PyObject *obpwszUrl; PyObject *obguidKey; LPWSTR pwszUrl; IID guidKey; BYTE ppPolicy; DWORD pcbPolicy; BYTE pContext; DWORD cbContext; DWORD dwReserved; if ( !PyArg_ParseTuple(args, "OOill:QueryCustomPolicy", &obpwszUrl, &obguidKey, &pContext, &cbContext, &dwReserved) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obguidKey, &guidKey)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->QueryCustomPolicy( pwszUrl, guidKey, ?? (-2)ppPolicy, &pcbPolicy, &pContext, cbContext, dwReserved ); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); PyObject *pyretval = Py_BuildValue("il", ppPolicy, pcbPolicy); return pyretval; } ***/ // @pymethod |PyIInternetSecurityManager|SetZoneMapping|Description of SetZoneMapping. PyObject *PyIInternetSecurityManager::SetZoneMapping(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm int|dwZone||Description for dwZone // @pyparm <o unicode>|lpszPattern||Description for lpszPattern // @pyparm int|dwFlags||Description for dwFlags PyObject *oblpszPattern; DWORD dwZone; LPWSTR lpszPattern; DWORD dwFlags; if (!PyArg_ParseTuple(args, "lOl:SetZoneMapping", &dwZone, &oblpszPattern, &dwFlags)) return NULL; if (!PyWinObject_AsBstr(oblpszPattern, &lpszPattern)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->SetZoneMapping( dwZone, lpszPattern, dwFlags ); SysFreeString(lpszPattern); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIInternetSecurityManager|GetZoneMappings|Description of GetZoneMappings. PyObject *PyIInternetSecurityManager::GetZoneMappings(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm int|dwZone||Description for dwZone // @pyparm int|dwFlags||Description for dwFlags DWORD dwZone; IEnumString * ppenumString; DWORD dwFlags; if ( !PyArg_ParseTuple(args, "ll:GetZoneMappings", &dwZone, &dwFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetZoneMappings( dwZone, &ppenumString, dwFlags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyCom_PyObjectFromIUnknown(ppenumString, IID_IEnumString, FALSE); } // @object PyIInternetSecurityManager|Description of the interface static struct PyMethodDef PyIInternetSecurityManager_methods[] = { { "SetSecuritySite", PyIInternetSecurityManager::SetSecuritySite, 1 }, // @pymeth SetSecuritySite|Description of SetSecuritySite { "GetSecuritySite", PyIInternetSecurityManager::GetSecuritySite, 1 }, // @pymeth GetSecuritySite|Description of GetSecuritySite { "MapUrlToZone", PyIInternetSecurityManager::MapUrlToZone, 1 }, // @pymeth MapUrlToZone|Description of MapUrlToZone { "GetSecurityId", PyIInternetSecurityManager::GetSecurityId, 1 }, // @pymeth GetSecurityId|Description of GetSecurityId { "ProcessUrlAction", PyIInternetSecurityManager::ProcessUrlAction, 1 }, // @pymeth ProcessUrlAction|Description of ProcessUrlAction // { "QueryCustomPolicy", PyIInternetSecurityManager::QueryCustomPolicy, 1 }, { "SetZoneMapping", PyIInternetSecurityManager::SetZoneMapping, 1 }, // @pymeth SetZoneMapping|Description of SetZoneMapping { "GetZoneMappings", PyIInternetSecurityManager::GetZoneMappings, 1 }, // @pymeth GetZoneMappings|Description of GetZoneMappings { NULL } }; PyComTypeObject PyIInternetSecurityManager::type("PyIInternetSecurityManager", &PyIUnknown::type, sizeof(PyIInternetSecurityManager), PyIInternetSecurityManager_methods, GET_PYCOM_CTOR(PyIInternetSecurityManager)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGInternetSecurityManager::SetSecuritySite( /* [unique][in] */ IInternetSecurityMgrSite * pSite) { PY_GATEWAY_METHOD; PyObject *obpSite; obpSite = PyCom_PyObjectFromIUnknown(pSite, IID_IInternetSecurityMgrSite, TRUE); HRESULT hr=InvokeViaPolicy("SetSecuritySite", NULL, "O", obpSite); Py_XDECREF(obpSite); return hr; } STDMETHODIMP PyGInternetSecurityManager::GetSecuritySite( /* [out] */ IInternetSecurityMgrSite ** ppSite) { PY_GATEWAY_METHOD; if (ppSite==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetSecuritySite", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IInternetSecurityMgrSite, (void **)ppSite, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecuritySite"); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::MapUrlToZone( /* [in] */ LPCWSTR pwszUrl, /* [out] */ DWORD * pdwZone, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; PyObject *obpwszUrl; obpwszUrl = MakeOLECHARToObj(pwszUrl); PyObject *result; HRESULT hr=InvokeViaPolicy("MapUrlToZone", &result, "Ol", obpwszUrl, dwFlags); Py_XDECREF(obpwszUrl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "l" , pdwZone)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("MapUrlToZone"); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::GetSecurityId( /* [in] */ LPCWSTR pwszUrl, /* [size_is][out] */ BYTE * pbSecurityId, /* [out][in] */ DWORD * pcbSecurityId, /* [in] */ DWORD_PTR dwReserved) { PY_GATEWAY_METHOD; PyObject *obdwReserved = PyWinObject_FromDWORD_PTR(dwReserved); if (obdwReserved==NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId"); PyObject *obpwszUrl; obpwszUrl = MakeOLECHARToObj(pwszUrl); PyObject *result; HRESULT hr=InvokeViaPolicy("GetSecurityId", &result, "OlO", obpwszUrl, *pcbSecurityId, obdwReserved); Py_XDECREF(obpwszUrl); Py_DECREF(obdwReserved); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params void *buf; DWORD buf_len; if (!PyWinObject_AsReadBuffer(result, &buf, &buf_len)) { Py_DECREF(result); return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId"); } *pcbSecurityId = min(buf_len, *pcbSecurityId); memcpy(pbSecurityId, buf, *pcbSecurityId); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::ProcessUrlAction( /* [in] */ LPCWSTR pwszUrl, /* [in] */ DWORD dwAction, /* [size_is][out] */ BYTE * pPolicy, /* [in] */ DWORD cbPolicy, /* [in] */ BYTE * pContext, /* [in] */ DWORD cbContext, /* [in] */ DWORD dwFlags, /* [in] */ DWORD dwReserved) { PY_GATEWAY_METHOD; PyObject *obpwszUrl; PyObject *obContext; obpwszUrl = MakeOLECHARToObj(pwszUrl); if (cbContext==0 || pContext==NULL) { obContext = Py_None; Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) obContext = PyWinObject_FromIID(*((IID *)*pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); obContext = Py_None; Py_INCREF(Py_None); } PyObject *result; HRESULT hr=InvokeViaPolicy("ProcessUrlAction", &result, "OlOll", obpwszUrl, dwAction, obContext, dwFlags, dwReserved); Py_XDECREF(obpwszUrl); Py_XDECREF(obContext); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (cbPolicy==sizeof(DWORD)) { *((DWORD *)pPolicy) = PyInt_AsLong(result); if (*((DWORD *)pPolicy)==-1) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("ProcessUrlAction"); } else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for policy - what is that?", cbPolicy); hr = E_UNEXPECTED; } return hr; } STDMETHODIMP PyGInternetSecurityManager::QueryCustomPolicy( /* [in] */ LPCWSTR pwszUrl, /* [in] */ REFGUID guidKey, /* [size_is][size_is][out] */ BYTE ** ppPolicy, /* [out] */ DWORD * pcbPolicy, /* [in] */ BYTE * pContext, /* [in] */ DWORD cbContext, /* [in] */ DWORD dwReserved) { return INET_E_DEFAULT_ACTION; /*** PY_GATEWAY_METHOD; if (ppPolicy==NULL) return E_POINTER; PyObject *obpwszUrl; PyObject *obguidKey; obpwszUrl = MakeOLECHARToObj(pwszUrl); obguidKey = PyWinObject_FromIID(guidKey); PyObject *result; HRESULT hr=InvokeViaPolicy("QueryCustomPolicy", &result, "OOill", obpwszUrl, obguidKey, pContext, cbContext, dwReserved); Py_XDECREF(obpwszUrl); Py_XDECREF(obguidKey); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_ParseTuple(result, "il" , *ppPolicy, pcbPolicy)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("QueryCustomPolicy"); Py_DECREF(result); return hr; ***/ } STDMETHODIMP PyGInternetSecurityManager::SetZoneMapping( /* [in] */ DWORD dwZone, /* [in] */ LPCWSTR lpszPattern, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; return InvokeViaPolicy("SetZoneMapping", NULL, "lNl", dwZone, MakeOLECHARToObj(lpszPattern), dwFlags); } STDMETHODIMP PyGInternetSecurityManager::GetZoneMappings( /* [in] */ DWORD dwZone, /* [out] */ IEnumString ** ppenumString, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; if (ppenumString==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetZoneMappings", &result, "ll", dwZone, dwFlags); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obppenumString; if (!PyArg_Parse(result, "O" , &obppenumString)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings"); if (!PyCom_InterfaceFromPyInstanceOrObject(obppenumString, IID_IEnumString, (void **)ppenumString, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings"); Py_DECREF(result); return hr; } |
From: Mark H. <mha...@us...> - 2008-11-02 12:56:01
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23269 Modified Files: Tag: py3k CHANGES.txt Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.26.2.2 retrieving revision 1.26.2.3 diff -C2 -d -r1.26.2.2 -r1.26.2.3 *** CHANGES.txt 2 Nov 2008 12:14:41 -0000 1.26.2.2 --- CHANGES.txt 2 Nov 2008 12:55:54 -0000 1.26.2.3 *************** *** 9,15 **** ---------------- ! * win32com.axcontrol gets support for interfaces OleControlSite, ! OleInPlaceActiveObject, OleInPlaceFrame and OleInPlaceUIWindow interfaces ! and OleTranslateAccelerator function. * MsgWaitForMultipleObjectsEx() would crash in all cases. Fix from --- 9,19 ---- ---------------- ! * win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices ! and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager ! function. ! ! * win32com.axcontrol gets support for IOleControlSite, ! IOleInPlaceActiveObject, IOleInPlaceFrame and IOleInPlaceUIWindow ! interfaces, and OleTranslateAccelerator function. * MsgWaitForMultipleObjectsEx() would crash in all cases. Fix from |
From: Mark H. <mha...@us...> - 2008-11-02 12:56:01
|
Update of /cvsroot/pywin32/pywin32/com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23269/com Modified Files: Tag: py3k internet.dsp Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. Index: internet.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/internet.dsp,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** internet.dsp 27 Oct 2001 06:37:55 -0000 1.6 --- internet.dsp 2 Nov 2008 12:55:54 -0000 1.6.4.1 *************** *** 99,102 **** --- 99,110 ---- # Begin Source File + SOURCE=.\win32comext\internet\src\PyIDocHostUIHandler.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\internet\src\PyIHTMLOMWindowServices.cpp + # End Source File + # Begin Source File + SOURCE=.\win32comext\internet\src\PyIInternetBindInfo.cpp # End Source File *************** *** 122,125 **** --- 130,137 ---- # End Source File # End Group + + SOURCE=.\win32comext\internet\src\PyIInternetSecurityManager.cpp + # End Source File + # End Group # Begin Group "Header Files" |
From: Mark H. <mha...@us...> - 2008-11-02 12:56:01
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23269/com/win32comext/internet Added Files: Tag: py3k inetcon.py Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. --- NEW FILE: inetcon.py --- INET_E_USE_DEFAULT_PROTOCOLHANDLER = -2146697199 # _HRESULT_TYPEDEF_(0x800C0011L) INET_E_USE_DEFAULT_SETTING = -2146697198 # _HRESULT_TYPEDEF_(0x800C0012L) INET_E_DEFAULT_ACTION = INET_E_USE_DEFAULT_PROTOCOLHANDLER INET_E_QUERYOPTION_UNKNOWN = -2146697197 # _HRESULT_TYPEDEF_(0x800C0013L) INET_E_REDIRECTING = -2146697196 #_HRESULT_TYPEDEF_(0x800C0014L) INET_E_INVALID_URL = -2146697214 # _HRESULT_TYPEDEF_(0x800C0002L) INET_E_NO_SESSION = -2146697213 # _HRESULT_TYPEDEF_(0x800C0003L) INET_E_CANNOT_CONNECT = -2146697212 # _HRESULT_TYPEDEF_(0x800C0004L) INET_E_RESOURCE_NOT_FOUND = -2146697211 # _HRESULT_TYPEDEF_(0x800C0005L) INET_E_OBJECT_NOT_FOUND = -2146697210 # _HRESULT_TYPEDEF_(0x800C0006L) INET_E_DATA_NOT_AVAILABLE = -2146697209 # _HRESULT_TYPEDEF_(0x800C0007L) INET_E_DOWNLOAD_FAILURE = -2146697208 # _HRESULT_TYPEDEF_(0x800C0008L) INET_E_AUTHENTICATION_REQUIRED = -2146697207 # _HRESULT_TYPEDEF_(0x800C0009L) INET_E_NO_VALID_MEDIA = -2146697206 # _HRESULT_TYPEDEF_(0x800C000AL) INET_E_CONNECTION_TIMEOUT = -2146697205 # _HRESULT_TYPEDEF_(0x800C000BL) INET_E_INVALID_REQUEST = -2146697204 # _HRESULT_TYPEDEF_(0x800C000CL) INET_E_UNKNOWN_PROTOCOL = -2146697203 # _HRESULT_TYPEDEF_(0x800C000DL) INET_E_SECURITY_PROBLEM = -2146697202 # _HRESULT_TYPEDEF_(0x800C000EL) INET_E_CANNOT_LOAD_DATA = -2146697201 # _HRESULT_TYPEDEF_(0x800C000FL) INET_E_CANNOT_INSTANTIATE_OBJECT = -2146697200 # _HRESULT_TYPEDEF_(0x800C0010L) INET_E_INVALID_CERTIFICATE = -2146697191 # _HRESULT_TYPEDEF_(0x800C0019L) INET_E_REDIRECT_FAILED = -2146697196 # _HRESULT_TYPEDEF_(0x800C0014L) INET_E_REDIRECT_TO_DIR = -2146697195 # _HRESULT_TYPEDEF_(0x800C0015L) INET_E_CANNOT_LOCK_REQUEST = -2146697194 # _HRESULT_TYPEDEF_(0x800C0016L) INET_E_USE_EXTEND_BINDING = -2146697193 # _HRESULT_TYPEDEF_(0x800C0017L) INET_E_TERMINATED_BIND = -2146697192 # _HRESULT_TYPEDEF_(0x800C0018L) INET_E_CODE_DOWNLOAD_DECLINED = -2146696960 #_HRESULT_TYPEDEF_(0x800C0100L) INET_E_RESULT_DISPATCHED = -2146696704 # _HRESULT_TYPEDEF_(0x800C0200L) INET_E_CANNOT_REPLACE_SFP_FILE = -2146696448 # _HRESULT_TYPEDEF_(0x800C0300L) INET_E_CODE_INSTALL_SUPPRESSED = -2146696192 # _HRESULT_TYPEDEF_(0x800C0400L) INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY = -2146695936 # _HRESULT_TYPEDEF_(0x800C0500L) # Generated by h2py from UrlMon.h MKSYS_URLMONIKER = 6 URL_MK_LEGACY = 0 URL_MK_UNIFORM = 1 URL_MK_NO_CANONICALIZE = 2 FIEF_FLAG_FORCE_JITUI = 0x1 FIEF_FLAG_PEEK = 0x2 FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK = 0x4 FMFD_DEFAULT = 0x00000000 FMFD_URLASFILENAME = 0x00000001 FMFD_ENABLEMIMESNIFFING = 0x00000002 FMFD_IGNOREMIMETEXTPLAIN = 0x00000004 URLMON_OPTION_USERAGENT = 0x10000001 URLMON_OPTION_USERAGENT_REFRESH = 0x10000002 URLMON_OPTION_URL_ENCODING = 0x10000004 URLMON_OPTION_USE_BINDSTRINGCREDS = 0x10000008 URLMON_OPTION_USE_BROWSERAPPSDOCUMENTS = 0x10000010 CF_NULL = 0 Uri_CREATE_ALLOW_RELATIVE = 0x00000001 Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME = 0x00000002 Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME = 0x00000004 Uri_CREATE_NOFRAG = 0x00000008 Uri_CREATE_NO_CANONICALIZE = 0x00000010 Uri_CREATE_CANONICALIZE = 0x00000100 Uri_CREATE_FILE_USE_DOS_PATH = 0x00000020 Uri_CREATE_DECODE_EXTRA_INFO = 0x00000040 Uri_CREATE_NO_DECODE_EXTRA_INFO = 0x00000080 Uri_CREATE_CRACK_UNKNOWN_SCHEMES = 0x00000200 Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES = 0x00000400 Uri_CREATE_PRE_PROCESS_HTML_URI = 0x00000800 Uri_CREATE_NO_PRE_PROCESS_HTML_URI = 0x00001000 Uri_CREATE_IE_SETTINGS = 0x00002000 Uri_CREATE_NO_IE_SETTINGS = 0x00004000 Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS = 0x00008000 Uri_DISPLAY_NO_FRAGMENT = 0x00000001 Uri_PUNYCODE_IDN_HOST = 0x00000002 Uri_DISPLAY_IDN_HOST = 0x00000004 Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 = 0x00000001 Uri_ENCODING_USER_INFO_AND_PATH_IS_CP = 0x00000002 Uri_ENCODING_HOST_IS_IDN = 0x00000004 Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 = 0x00000008 Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP = 0x00000010 Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 = 0x00000020 Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP = 0x00000040 Uri_ENCODING_RFC = (Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8) UriBuilder_USE_ORIGINAL_FLAGS = 0x00000001 WININETINFO_OPTION_LOCK_HANDLE = 65534 URLOSTRM_USECACHEDCOPY_ONLY = 0x1 URLOSTRM_USECACHEDCOPY = 0x2 URLOSTRM_GETNEWESTVERSION = 0x3 SET_FEATURE_ON_THREAD = 0x00000001 SET_FEATURE_ON_PROCESS = 0x00000002 SET_FEATURE_IN_REGISTRY = 0x00000004 SET_FEATURE_ON_THREAD_LOCALMACHINE = 0x00000008 SET_FEATURE_ON_THREAD_INTRANET = 0x00000010 SET_FEATURE_ON_THREAD_TRUSTED = 0x00000020 SET_FEATURE_ON_THREAD_INTERNET = 0x00000040 SET_FEATURE_ON_THREAD_RESTRICTED = 0x00000080 GET_FEATURE_FROM_THREAD = 0x00000001 GET_FEATURE_FROM_PROCESS = 0x00000002 GET_FEATURE_FROM_REGISTRY = 0x00000004 GET_FEATURE_FROM_THREAD_LOCALMACHINE = 0x00000008 GET_FEATURE_FROM_THREAD_INTRANET = 0x00000010 GET_FEATURE_FROM_THREAD_TRUSTED = 0x00000020 GET_FEATURE_FROM_THREAD_INTERNET = 0x00000040 GET_FEATURE_FROM_THREAD_RESTRICTED = 0x00000080 PROTOCOLFLAG_NO_PICS_CHECK = 0x00000001 MUTZ_NOSAVEDFILECHECK = 0x00000001 MUTZ_ISFILE = 0x00000002 MUTZ_ACCEPT_WILDCARD_SCHEME = 0x00000080 MUTZ_ENFORCERESTRICTED = 0x00000100 MUTZ_RESERVED = 0x00000200 MUTZ_REQUIRESAVEDFILECHECK = 0x00000400 MUTZ_DONT_UNESCAPE = 0x00000800 MUTZ_DONT_USE_CACHE = 0x00001000 MUTZ_FORCE_INTRANET_FLAGS = 0x00002000 MUTZ_IGNORE_ZONE_MAPPINGS = 0x00004000 MAX_SIZE_SECURITY_ID = 512 URLACTION_MIN = 0x00001000 URLACTION_DOWNLOAD_MIN = 0x00001000 URLACTION_DOWNLOAD_SIGNED_ACTIVEX = 0x00001001 URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX = 0x00001004 URLACTION_DOWNLOAD_CURR_MAX = 0x00001004 URLACTION_DOWNLOAD_MAX = 0x000011FF URLACTION_ACTIVEX_MIN = 0x00001200 URLACTION_ACTIVEX_RUN = 0x00001200 URLPOLICY_ACTIVEX_CHECK_LIST = 0x00010000 URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY = 0x00001201 URLACTION_ACTIVEX_OVERRIDE_DATA_SAFETY = 0x00001202 URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY = 0x00001203 URLACTION_SCRIPT_OVERRIDE_SAFETY = 0x00001401 URLACTION_ACTIVEX_CONFIRM_NOOBJECTSAFETY = 0x00001204 URLACTION_ACTIVEX_TREATASUNTRUSTED = 0x00001205 URLACTION_ACTIVEX_NO_WEBOC_SCRIPT = 0x00001206 URLACTION_ACTIVEX_OVERRIDE_REPURPOSEDETECTION = 0x00001207 URLACTION_ACTIVEX_OVERRIDE_OPTIN = 0x00001208 URLACTION_ACTIVEX_SCRIPTLET_RUN = 0x00001209 URLACTION_ACTIVEX_DYNSRC_VIDEO_AND_ANIMATION = 0x0000120A URLACTION_ACTIVEX_CURR_MAX = 0x0000120A URLACTION_ACTIVEX_MAX = 0x000013ff URLACTION_SCRIPT_MIN = 0x00001400 URLACTION_SCRIPT_RUN = 0x00001400 URLACTION_SCRIPT_JAVA_USE = 0x00001402 URLACTION_SCRIPT_SAFE_ACTIVEX = 0x00001405 URLACTION_CROSS_DOMAIN_DATA = 0x00001406 URLACTION_SCRIPT_PASTE = 0x00001407 URLACTION_ALLOW_XDOMAIN_SUBFRAME_RESIZE = 0x00001408 URLACTION_SCRIPT_CURR_MAX = 0x00001408 URLACTION_SCRIPT_MAX = 0x000015ff URLACTION_HTML_MIN = 0x00001600 URLACTION_HTML_SUBMIT_FORMS = 0x00001601 URLACTION_HTML_SUBMIT_FORMS_FROM = 0x00001602 URLACTION_HTML_SUBMIT_FORMS_TO = 0x00001603 URLACTION_HTML_FONT_DOWNLOAD = 0x00001604 URLACTION_HTML_JAVA_RUN = 0x00001605 URLACTION_HTML_USERDATA_SAVE = 0x00001606 URLACTION_HTML_SUBFRAME_NAVIGATE = 0x00001607 URLACTION_HTML_META_REFRESH = 0x00001608 URLACTION_HTML_MIXED_CONTENT = 0x00001609 URLACTION_HTML_INCLUDE_FILE_PATH = 0x0000160A URLACTION_HTML_MAX = 0x000017ff URLACTION_SHELL_MIN = 0x00001800 URLACTION_SHELL_INSTALL_DTITEMS = 0x00001800 URLACTION_SHELL_MOVE_OR_COPY = 0x00001802 URLACTION_SHELL_FILE_DOWNLOAD = 0x00001803 URLACTION_SHELL_VERB = 0x00001804 URLACTION_SHELL_WEBVIEW_VERB = 0x00001805 URLACTION_SHELL_SHELLEXECUTE = 0x00001806 URLACTION_SHELL_EXECUTE_HIGHRISK = 0x00001806 URLACTION_SHELL_EXECUTE_MODRISK = 0x00001807 URLACTION_SHELL_EXECUTE_LOWRISK = 0x00001808 URLACTION_SHELL_POPUPMGR = 0x00001809 URLACTION_SHELL_RTF_OBJECTS_LOAD = 0x0000180A URLACTION_SHELL_ENHANCED_DRAGDROP_SECURITY = 0x0000180B URLACTION_SHELL_EXTENSIONSECURITY = 0x0000180C URLACTION_SHELL_SECURE_DRAGSOURCE = 0x0000180D URLACTION_SHELL_CURR_MAX = 0x0000180D URLACTION_SHELL_MAX = 0x000019ff URLACTION_NETWORK_MIN = 0x00001A00 URLACTION_CREDENTIALS_USE = 0x00001A00 URLPOLICY_CREDENTIALS_SILENT_LOGON_OK = 0x00000000 URLPOLICY_CREDENTIALS_MUST_PROMPT_USER = 0x00010000 URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT = 0x00020000 URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY = 0x00030000 URLACTION_AUTHENTICATE_CLIENT = 0x00001A01 URLPOLICY_AUTHENTICATE_CLEARTEXT_OK = 0x00000000 URLPOLICY_AUTHENTICATE_CHALLENGE_RESPONSE = 0x00010000 URLPOLICY_AUTHENTICATE_MUTUAL_ONLY = 0x00030000 URLACTION_COOKIES = 0x00001A02 URLACTION_COOKIES_SESSION = 0x00001A03 URLACTION_CLIENT_CERT_PROMPT = 0x00001A04 URLACTION_COOKIES_THIRD_PARTY = 0x00001A05 URLACTION_COOKIES_SESSION_THIRD_PARTY = 0x00001A06 URLACTION_COOKIES_ENABLED = 0x00001A10 URLACTION_NETWORK_CURR_MAX = 0x00001A10 URLACTION_NETWORK_MAX = 0x00001Bff URLACTION_JAVA_MIN = 0x00001C00 URLACTION_JAVA_PERMISSIONS = 0x00001C00 URLPOLICY_JAVA_PROHIBIT = 0x00000000 URLPOLICY_JAVA_HIGH = 0x00010000 URLPOLICY_JAVA_MEDIUM = 0x00020000 URLPOLICY_JAVA_LOW = 0x00030000 URLPOLICY_JAVA_CUSTOM = 0x00800000 URLACTION_JAVA_CURR_MAX = 0x00001C00 URLACTION_JAVA_MAX = 0x00001Cff URLACTION_INFODELIVERY_MIN = 0x00001D00 URLACTION_INFODELIVERY_NO_ADDING_CHANNELS = 0x00001D00 URLACTION_INFODELIVERY_NO_EDITING_CHANNELS = 0x00001D01 URLACTION_INFODELIVERY_NO_REMOVING_CHANNELS = 0x00001D02 URLACTION_INFODELIVERY_NO_ADDING_SUBSCRIPTIONS = 0x00001D03 URLACTION_INFODELIVERY_NO_EDITING_SUBSCRIPTIONS = 0x00001D04 URLACTION_INFODELIVERY_NO_REMOVING_SUBSCRIPTIONS = 0x00001D05 URLACTION_INFODELIVERY_NO_CHANNEL_LOGGING = 0x00001D06 URLACTION_INFODELIVERY_CURR_MAX = 0x00001D06 URLACTION_INFODELIVERY_MAX = 0x00001Dff URLACTION_CHANNEL_SOFTDIST_MIN = 0x00001E00 URLACTION_CHANNEL_SOFTDIST_PERMISSIONS = 0x00001E05 URLPOLICY_CHANNEL_SOFTDIST_PROHIBIT = 0x00010000 URLPOLICY_CHANNEL_SOFTDIST_PRECACHE = 0x00020000 URLPOLICY_CHANNEL_SOFTDIST_AUTOINSTALL = 0x00030000 URLACTION_CHANNEL_SOFTDIST_MAX = 0x00001Eff URLACTION_BEHAVIOR_MIN = 0x00002000 URLACTION_BEHAVIOR_RUN = 0x00002000 URLPOLICY_BEHAVIOR_CHECK_LIST = 0x00010000 URLACTION_FEATURE_MIN = 0x00002100 URLACTION_FEATURE_MIME_SNIFFING = 0x00002100 URLACTION_FEATURE_ZONE_ELEVATION = 0x00002101 URLACTION_FEATURE_WINDOW_RESTRICTIONS = 0x00002102 URLACTION_FEATURE_SCRIPT_STATUS_BAR = 0x00002103 URLACTION_FEATURE_FORCE_ADDR_AND_STATUS = 0x00002104 URLACTION_FEATURE_BLOCK_INPUT_PROMPTS = 0x00002105 URLACTION_AUTOMATIC_DOWNLOAD_UI_MIN = 0x00002200 URLACTION_AUTOMATIC_DOWNLOAD_UI = 0x00002200 URLACTION_AUTOMATIC_ACTIVEX_UI = 0x00002201 URLACTION_ALLOW_RESTRICTEDPROTOCOLS = 0x00002300 URLACTION_ALLOW_APEVALUATION = 0x00002301 URLACTION_WINDOWS_BROWSER_APPLICATIONS = 0x00002400 URLACTION_XPS_DOCUMENTS = 0x00002401 URLACTION_LOOSE_XAML = 0x00002402 URLACTION_LOWRIGHTS = 0x00002500 URLACTION_WINFX_SETUP = 0x00002600 URLPOLICY_ALLOW = 0x00 URLPOLICY_QUERY = 0x01 URLPOLICY_DISALLOW = 0x03 URLPOLICY_NOTIFY_ON_ALLOW = 0x10 URLPOLICY_NOTIFY_ON_DISALLOW = 0x20 URLPOLICY_LOG_ON_ALLOW = 0x40 URLPOLICY_LOG_ON_DISALLOW = 0x80 URLPOLICY_MASK_PERMISSIONS = 0x0f URLPOLICY_DONTCHECKDLGBOX = 0x100 URLZONE_ESC_FLAG = 0x100 SECURITY_IE_STATE_GREEN = 0x00000000 SECURITY_IE_STATE_RED = 0x00000001 SOFTDIST_FLAG_USAGE_EMAIL = 0x00000001 SOFTDIST_FLAG_USAGE_PRECACHE = 0x00000002 SOFTDIST_FLAG_USAGE_AUTOINSTALL = 0x00000004 SOFTDIST_FLAG_DELETE_SUBSCRIPTION = 0x00000008 SOFTDIST_ADSTATE_NONE = 0x00000000 SOFTDIST_ADSTATE_AVAILABLE = 0x00000001 SOFTDIST_ADSTATE_DOWNLOADED = 0x00000002 SOFTDIST_ADSTATE_INSTALLED = 0x00000003 CONFIRMSAFETYACTION_LOADOBJECT = 0x00000001 |
From: Mark H. <mha...@us...> - 2008-11-02 12:50:06
|
Update of /cvsroot/pywin32/pywin32/com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22835/com Modified Files: internet.dsp Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. Index: internet.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/internet.dsp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** internet.dsp 27 Oct 2001 06:37:55 -0000 1.6 --- internet.dsp 2 Nov 2008 12:50:01 -0000 1.7 *************** *** 99,102 **** --- 99,110 ---- # Begin Source File + SOURCE=.\win32comext\internet\src\PyIDocHostUIHandler.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\internet\src\PyIHTMLOMWindowServices.cpp + # End Source File + # Begin Source File + SOURCE=.\win32comext\internet\src\PyIInternetBindInfo.cpp # End Source File *************** *** 122,125 **** --- 130,137 ---- # End Source File # End Group + + SOURCE=.\win32comext\internet\src\PyIInternetSecurityManager.cpp + # End Source File + # End Group # Begin Group "Header Files" |
From: Mark H. <mha...@us...> - 2008-11-02 12:50:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22835/com/win32comext/internet/src Modified Files: internet.cpp Added Files: PyIDocHostUIHandler.cpp PyIDocHostUIHandler.h PyIHTMLOMWindowServices.cpp PyIHTMLOMWindowServices.h PyIInternetSecurityManager.cpp PyIInternetSecurityManager.h Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. --- NEW FILE: PyIHTMLOMWindowServices.cpp --- // This file implements the IHTMLOMWindowServices Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "MsHtmHst.h" #include "PyIHTMLOMWindowServices.h" // @doc - This file contains autoduck documentation // Gateway Implementation STDMETHODIMP PyGHTMLOMWindowServices::moveTo( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("moveTo", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::moveBy( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("moveBy", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::resizeTo( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("resizeTo", NULL, "ll", x, y); } STDMETHODIMP PyGHTMLOMWindowServices::resizeBy( /* [in] */ LONG x, /* [in] */ LONG y) { PY_GATEWAY_METHOD; return InvokeViaPolicy("resizeBy", NULL, "ll", x, y); } Index: internet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** internet.cpp 22 Oct 2007 04:35:24 -0000 1.4 --- internet.cpp 2 Nov 2008 12:50:01 -0000 1.5 *************** *** 14,20 **** --- 14,23 ---- #include "internet_pch.h" + #include "MsHtmHst.h" #include "stddef.h" // for offsetof #include "PythonCOMRegister.h" // For simpler registration of IIDs etc. + #include "PyIDocHostUIHandler.h" + #include "PyIHTMLOMWindowServices.h" #include "PyIInternetProtocolRoot.h" #include "PyIInternetProtocol.h" *************** *** 23,26 **** --- 26,30 ---- #include "PyIInternetPriority.h" #include "PyIInternetBindInfo.h" + #include "PyIInternetSecurityManager.h" // Check a function pointer that is supplied by a specific IE version (ie, *************** *** 34,37 **** --- 38,46 ---- static CoInternetIsFeatureEnabled_func pfnCoInternetIsFeatureEnabled=NULL; + typedef HRESULT (WINAPI *CoInternetCreateSecurityManager_func)(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); + static CoInternetCreateSecurityManager_func pfnCoInternetCreateSecurityManager=NULL; + + // STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); + HMODULE loadmodule(TCHAR *dllname) { *************** *** 185,188 **** --- 194,226 ---- } + // @pymethod <o PyIInternetSecurityManager>|internet|CoInternetCreateSecurityManager| + static PyObject *PyCoInternetCreateSecurityManager(PyObject *self, PyObject *args) + { + CHECK_IE_PFN(CoInternetCreateSecurityManager); + PyObject *obprov; + DWORD reserved; + if (!PyArg_ParseTuple(args, "Oi", + &obprov, // &pyparm <o PyIServiceProvider>|serviceProvider|| + &reserved)) // @pyparm int|reserved|| + return NULL; + IServiceProvider *prov; + if (!PyCom_InterfaceFromPyInstanceOrObject(obprov, IID_IServiceProvider, (void **)&prov, TRUE /* bNoneOK */)) + return NULL; + HRESULT hr; + IInternetSecurityManager *sm = 0; + PY_INTERFACE_PRECALL; + hr = (*pfnCoInternetCreateSecurityManager)(prov, &sm, reserved); + prov->Release(); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown(sm, IID_IInternetSecurityManager, FALSE); + + } + + STDAPI CoInternetCreateSecurityManager(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved); + + STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved); + /* List of module functions */ *************** *** 190,193 **** --- 228,232 ---- static struct PyMethodDef internet_methods[]= { + { "CoInternetCreateSecurityManager", PyCoInternetCreateSecurityManager}, // @pymeth CoInternetCreateSecurityManager| { "CoInternetIsFeatureEnabled", PyCoInternetIsFeatureEnabled}, // @pymeth CoInternetIsFeatureEnabled| { "CoInternetSetFeatureEnabled", PyCoInternetSetFeatureEnabled}, // @pymeth CoInternetSetFeatureEnabled| *************** *** 211,214 **** --- 250,255 ---- static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { + PYCOM_INTERFACE_FULL (DocHostUIHandler), + PYCOM_INTERFACE_SERVER_ONLY(HTMLOMWindowServices), PYCOM_INTERFACE_FULL (InternetProtocolRoot), PYCOM_INTERFACE_FULL (InternetProtocol), *************** *** 217,220 **** --- 258,262 ---- PYCOM_INTERFACE_FULL (InternetPriority), PYCOM_INTERFACE_FULL (InternetBindInfo), + PYCOM_INTERFACE_FULL (InternetSecurityManager), }; *************** *** 239,242 **** --- 281,285 ---- pfnCoInternetSetFeatureEnabled=(CoInternetSetFeatureEnabled_func)loadapifunc("CoInternetSetFeatureEnabled", urlmon_dll); pfnCoInternetIsFeatureEnabled=(CoInternetIsFeatureEnabled_func)loadapifunc("CoInternetIsFeatureEnabled", urlmon_dll); + pfnCoInternetCreateSecurityManager=(CoInternetCreateSecurityManager_func)loadapifunc("CoInternetCreateSecurityManager", urlmon_dll); ADD_CONSTANT(FEATURE_OBJECT_CACHING); // @const internet|FEATURE_OBJECT_CACHING| --- NEW FILE: PyIDocHostUIHandler.h --- // This file declares the IDocHostUIHandler Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIDocHostUIHandler : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIDocHostUIHandler); static IDocHostUIHandler *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *ShowContextMenu(PyObject *self, PyObject *args); static PyObject *GetHostInfo(PyObject *self, PyObject *args); static PyObject *ShowUI(PyObject *self, PyObject *args); static PyObject *HideUI(PyObject *self, PyObject *args); static PyObject *UpdateUI(PyObject *self, PyObject *args); static PyObject *EnableModeless(PyObject *self, PyObject *args); static PyObject *OnDocWindowActivate(PyObject *self, PyObject *args); static PyObject *OnFrameWindowActivate(PyObject *self, PyObject *args); static PyObject *ResizeBorder(PyObject *self, PyObject *args); static PyObject *TranslateAccelerator(PyObject *self, PyObject *args); static PyObject *GetOptionKeyPath(PyObject *self, PyObject *args); static PyObject *GetDropTarget(PyObject *self, PyObject *args); static PyObject *GetExternal(PyObject *self, PyObject *args); static PyObject *TranslateUrl(PyObject *self, PyObject *args); static PyObject *FilterDataObject(PyObject *self, PyObject *args); protected: PyIDocHostUIHandler(IUnknown *pdisp); ~PyIDocHostUIHandler(); }; // --------------------------------------------------- // // Gateway Declaration class PyGDocHostUIHandler : public PyGatewayBase, public IDocHostUIHandler { protected: PyGDocHostUIHandler(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGDocHostUIHandler, IDocHostUIHandler, IID_IDocHostUIHandler, PyGatewayBase) // IDocHostUIHandler STDMETHOD(ShowContextMenu)( DWORD dwID, POINT * ppt, IUnknown * pcmdtReserved, IDispatch * pdispReserved); STDMETHOD(GetHostInfo)( DOCHOSTUIINFO * pInfo); STDMETHOD(ShowUI)( DWORD dwID, IOleInPlaceActiveObject * pActiveObject, IOleCommandTarget * pCommandTarget, IOleInPlaceFrame * pFrame, IOleInPlaceUIWindow * pDoc); STDMETHOD(HideUI)( void); STDMETHOD(UpdateUI)( void); STDMETHOD(EnableModeless)( BOOL fEnable); STDMETHOD(OnDocWindowActivate)( BOOL fActivate); STDMETHOD(OnFrameWindowActivate)( BOOL fActivate); STDMETHOD(ResizeBorder)( LPCRECT prcBorder, IOleInPlaceUIWindow * pUIWindow, BOOL fRameWindow); STDMETHOD(TranslateAccelerator)( LPMSG lpMsg, const GUID * pguidCmdGroup, DWORD nCmdID); STDMETHOD(GetOptionKeyPath)( LPOLESTR * pchKey, DWORD dw); STDMETHOD(GetDropTarget)( IDropTarget * pDropTarget, IDropTarget ** ppDropTarget); STDMETHOD(GetExternal)( IDispatch ** ppDispatch); STDMETHOD(TranslateUrl)( DWORD dwTranslate, OLECHAR * pchURLIn, OLECHAR ** ppchURLOut); STDMETHOD(FilterDataObject)( IDataObject * pDO, IDataObject ** ppDORet); }; --- NEW FILE: PyIHTMLOMWindowServices.h --- // This file declares the IHTMLOMWindowServices Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Gateway Declaration class PyGHTMLOMWindowServices : public PyGatewayBase, public IHTMLOMWindowServices { protected: PyGHTMLOMWindowServices(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGHTMLOMWindowServices, IHTMLOMWindowServices, IID_IHTMLOMWindowServices, PyGatewayBase) // IHTMLOMWindowServices STDMETHOD(moveTo)( LONG x, LONG y); STDMETHOD(moveBy)( LONG x, LONG y); STDMETHOD(resizeTo)( LONG x, LONG y); STDMETHOD(resizeBy)( LONG x, LONG y); }; --- NEW FILE: PyIInternetSecurityManager.h --- // This file declares the IInternetSecurityManager Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration #include "internet_pch.h" class PyIInternetSecurityManager : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIInternetSecurityManager); static IInternetSecurityManager *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *SetSecuritySite(PyObject *self, PyObject *args); static PyObject *GetSecuritySite(PyObject *self, PyObject *args); static PyObject *MapUrlToZone(PyObject *self, PyObject *args); static PyObject *GetSecurityId(PyObject *self, PyObject *args); static PyObject *ProcessUrlAction(PyObject *self, PyObject *args); static PyObject *QueryCustomPolicy(PyObject *self, PyObject *args); static PyObject *SetZoneMapping(PyObject *self, PyObject *args); static PyObject *GetZoneMappings(PyObject *self, PyObject *args); protected: PyIInternetSecurityManager(IUnknown *pdisp); ~PyIInternetSecurityManager(); }; // --------------------------------------------------- // // Gateway Declaration class PyGInternetSecurityManager : public PyGatewayBase, public IInternetSecurityManager { protected: PyGInternetSecurityManager(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGInternetSecurityManager, IInternetSecurityManager, IID_IInternetSecurityManager, PyGatewayBase) // IInternetSecurityManager STDMETHOD(SetSecuritySite)( IInternetSecurityMgrSite * pSite); STDMETHOD(GetSecuritySite)( IInternetSecurityMgrSite ** ppSite); STDMETHOD(MapUrlToZone)( LPCWSTR pwszUrl, DWORD * pdwZone, DWORD dwFlags); STDMETHOD(GetSecurityId)( LPCWSTR pwszUrl, BYTE * pbSecurityId, DWORD * pcbSecurityId, DWORD_PTR dwReserved); STDMETHOD(ProcessUrlAction)( LPCWSTR pwszUrl, DWORD dwAction, BYTE * pPolicy, DWORD cbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved); STDMETHOD(QueryCustomPolicy)( LPCWSTR pwszUrl, REFGUID guidKey, BYTE ** ppPolicy, DWORD * pcbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwReserved); STDMETHOD(SetZoneMapping)( DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags); STDMETHOD(GetZoneMappings)( DWORD dwZone, IEnumString ** ppenumString, DWORD dwFlags); }; --- NEW FILE: PyIDocHostUIHandler.cpp --- // This file implements the IDocHostUIHandler Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "MsHtmHst.h" #include "PyIDocHostUIHandler.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIDocHostUIHandler::PyIDocHostUIHandler(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIDocHostUIHandler::~PyIDocHostUIHandler() { } /* static */ IDocHostUIHandler *PyIDocHostUIHandler::GetI(PyObject *self) { return (IDocHostUIHandler *)PyIUnknown::GetI(self); } // @pymethod |PyIDocHostUIHandler|ShowContextMenu|Description of ShowContextMenu. PyObject *PyIDocHostUIHandler::ShowContextMenu(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwID||Description for dwID POINT pt; // @pyparm (int, int)|pt||Description for ppt // @pyparm <o PyIUnknown>|pcmdtReserved||Description for pcmdtReserved // @pyparm <o PyIDispatch>|pdispReserved||Description for pdispReserved PyObject *obpcmdtReserved; PyObject *obpdispReserved; DWORD dwID; IUnknown * pcmdtReserved; IDispatch * pdispReserved; if ( !PyArg_ParseTuple(args, "l(ii)OO:ShowContextMenu", &dwID, &pt.x, &pt.y, &obpcmdtReserved, &obpdispReserved) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyInstanceOrObject(obpcmdtReserved, IID_IUnknown, (void **)&pcmdtReserved, TRUE /* bNoneOK */)) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpdispReserved, IID_IDispatch, (void **)&pdispReserved, TRUE /* bNoneOK */)) { if (pcmdtReserved) pcmdtReserved->Release(); return NULL; } HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ShowContextMenu( dwID, &pt, pcmdtReserved, pdispReserved ); if (pcmdtReserved) pcmdtReserved->Release(); if (pdispReserved) pdispReserved->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|GetHostInfo|Description of GetHostInfo. PyObject *PyIDocHostUIHandler::GetHostInfo(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; DOCHOSTUIINFO info; memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); if ( !PyArg_ParseTuple(args, ":GetHostInfo")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetHostInfo(&info); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler); return Py_BuildValue("iiNN", info.dwFlags, info.dwDoubleClick, MakeOLECHARToObj(info.pchHostCss), MakeOLECHARToObj(info.pchHostNS)); } // @pymethod |PyIDocHostUIHandler|ShowUI|Description of ShowUI. PyObject *PyIDocHostUIHandler::ShowUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwID||Description for dwID // @pyparm <o PyIOleInPlaceActiveObject>|pActiveObject||Description for pActiveObject // @pyparm <o PyIOleCommandTarget>|pCommandTarget||Description for pCommandTarget // @pyparm <o PyIOleInPlaceFrame>|pFrame||Description for pFrame // @pyparm <o PyIOleInPlaceUIWindow>|pDoc||Description for pDoc PyObject *obpActiveObject; PyObject *obpCommandTarget; PyObject *obpFrame; PyObject *obpDoc; DWORD dwID; if ( !PyArg_ParseTuple(args, "lOOOO:ShowUI", &dwID, &obpActiveObject, &obpCommandTarget, &obpFrame, &obpDoc) ) return NULL; IOleInPlaceActiveObject * pActiveObject; IOleCommandTarget * pCommandTarget; IOleInPlaceFrame * pFrame; IOleInPlaceUIWindow * pDoc; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpActiveObject, IID_IOleInPlaceActiveObject, (void **)&pActiveObject, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpCommandTarget, IID_IOleCommandTarget, (void **)&pCommandTarget, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpFrame, IID_IOleInPlaceFrame, (void **)&pFrame, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDoc, IID_IOleInPlaceUIWindow, (void **)&pDoc, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ShowUI( dwID, pActiveObject, pCommandTarget, pFrame, pDoc ); if (pActiveObject) pActiveObject->Release(); if (pCommandTarget) pCommandTarget->Release(); if (pFrame) pFrame->Release(); if (pDoc) pDoc->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|HideUI|Description of HideUI. PyObject *PyIDocHostUIHandler::HideUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":HideUI") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->HideUI( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|UpdateUI|Description of UpdateUI. PyObject *PyIDocHostUIHandler::UpdateUI(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":UpdateUI") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->UpdateUI( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|EnableModeless|Description of EnableModeless. PyObject *PyIDocHostUIHandler::EnableModeless(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fEnable||Description for fEnable BOOL fEnable; if ( !PyArg_ParseTuple(args, "i:EnableModeless", &fEnable) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->EnableModeless( fEnable ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|OnDocWindowActivate|Description of OnDocWindowActivate. PyObject *PyIDocHostUIHandler::OnDocWindowActivate(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fActivate||Description for fActivate BOOL fActivate; if ( !PyArg_ParseTuple(args, "i:OnDocWindowActivate", &fActivate) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->OnDocWindowActivate( fActivate ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|OnFrameWindowActivate|Description of OnFrameWindowActivate. PyObject *PyIDocHostUIHandler::OnFrameWindowActivate(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fActivate||Description for fActivate BOOL fActivate; if ( !PyArg_ParseTuple(args, "i:OnFrameWindowActivate", &fActivate) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->OnFrameWindowActivate( fActivate ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|ResizeBorder|Description of ResizeBorder. PyObject *PyIDocHostUIHandler::ResizeBorder(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; RECT border; // @pyparm (int, int, int, int)|prcBorder||Description for prcBorder // @pyparm <o PyIOleInPlaceUIWindow>|pUIWindow||Description for pUIWindow // @pyparm int|fRameWindow||Description for fRameWindow PyObject *obpUIWindow; IOleInPlaceUIWindow * pUIWindow; BOOL fRameWindow; if ( !PyArg_ParseTuple(args, "(iiii)Oi:ResizeBorder", &border.left, &border.top, &border.right, &border.bottom, &obpUIWindow, &fRameWindow) ) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpUIWindow, IID_IOleInPlaceUIWindow, (void **)&pUIWindow, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->ResizeBorder(&border, pUIWindow, fRameWindow ); if (pUIWindow) pUIWindow->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|TranslateAccelerator|Description of TranslateAccelerator. PyObject *PyIDocHostUIHandler::TranslateAccelerator(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; MSG msg; PyObject *oblpMsg; // @pyparm <o PyLPMSG>|lpMsg||Description for lpMsg // @pyparm <o PyIID>|pguidCmdGroup||Description for pguidCmdGroup // @pyparm int|nCmdID||Description for nCmdID PyObject *obpguidCmdGroup; IID guidCmdGroup; DWORD nCmdID; if ( !PyArg_ParseTuple(args, "OOl:TranslateAccelerator", &oblpMsg, &obpguidCmdGroup, &nCmdID) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsMSG(oblpMsg, &msg)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obpguidCmdGroup, &guidCmdGroup)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->TranslateAccelerator(&msg, &guidCmdGroup, nCmdID ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); } // @pymethod |PyIDocHostUIHandler|GetOptionKeyPath|Description of GetOptionKeyPath. PyObject *PyIDocHostUIHandler::GetOptionKeyPath(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dw||Description for dw LPOLESTR pchKey; DWORD dw; if ( !PyArg_ParseTuple(args, "l:GetOptionKeyPath", &dw) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetOptionKeyPath( &pchKey, dw ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); PyObject *pyretval = MakeOLECHARToObj(pchKey); CoTaskMemFree(pchKey); return pyretval; } // @pymethod |PyIDocHostUIHandler|GetDropTarget|Description of GetDropTarget. PyObject *PyIDocHostUIHandler::GetDropTarget(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm <o PyIDropTarget>|pDropTarget||Description for pDropTarget PyObject *obpDropTarget; IDropTarget * pDropTarget; IDropTarget * ppDropTarget; if ( !PyArg_ParseTuple(args, "O:GetDropTarget", &obpDropTarget) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDropTarget, IID_IDropTarget, (void **)&pDropTarget, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetDropTarget( pDropTarget, &ppDropTarget ); if (pDropTarget) pDropTarget->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDropTarget, IID_IDropTarget, FALSE); } // @pymethod |PyIDocHostUIHandler|GetExternal|Description of GetExternal. PyObject *PyIDocHostUIHandler::GetExternal(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; IDispatch * ppDispatch; if ( !PyArg_ParseTuple(args, ":GetExternal") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->GetExternal( &ppDispatch ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDispatch, IID_IDispatch, FALSE); } // @pymethod |PyIDocHostUIHandler|TranslateUrl|Description of TranslateUrl. PyObject *PyIDocHostUIHandler::TranslateUrl(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|dwTranslate||Description for dwTranslate // @pyparm <o unicode>|pchURLIn||Description for pchURLIn PyObject *obpchURLIn; DWORD dwTranslate; OLECHAR *pchURLIn; OLECHAR *pchURLOut = 0; if ( !PyArg_ParseTuple(args, "lO:TranslateUrl", &dwTranslate, &obpchURLIn) ) return NULL; if (!PyWinObject_AsWCHAR(obpchURLIn, &pchURLIn)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->TranslateUrl( dwTranslate, pchURLIn, &pchURLOut); PyWinObject_FreeWCHAR(pchURLIn); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); PyObject *pyretval = MakeOLECHARToObj(pchURLOut); CoTaskMemFree(pchURLOut); return pyretval; } // @pymethod |PyIDocHostUIHandler|FilterDataObject|Description of FilterDataObject. PyObject *PyIDocHostUIHandler::FilterDataObject(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm <o PyIDataObject>|pDO||Description for pDO PyObject *obpDO; IDataObject * pDO; IDataObject * ppDORet; if ( !PyArg_ParseTuple(args, "O:FilterDataObject", &obpDO) ) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpDO, IID_IDataObject, (void **)&pDO, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->FilterDataObject( pDO, &ppDORet ); if (pDO) pDO->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyCom_PyObjectFromIUnknown(ppDORet, IID_IDataObject, FALSE); } // @object PyIDocHostUIHandler|Description of the interface static struct PyMethodDef PyIDocHostUIHandler_methods[] = { { "ShowContextMenu", PyIDocHostUIHandler::ShowContextMenu, 1 }, // @pymeth ShowContextMenu|Description of ShowContextMenu { "GetHostInfo", PyIDocHostUIHandler::GetHostInfo, 1 }, // @pymeth GetHostInfo|Description of GetHostInfo { "ShowUI", PyIDocHostUIHandler::ShowUI, 1 }, // @pymeth ShowUI|Description of ShowUI { "HideUI", PyIDocHostUIHandler::HideUI, 1 }, // @pymeth HideUI|Description of HideUI { "UpdateUI", PyIDocHostUIHandler::UpdateUI, 1 }, // @pymeth UpdateUI|Description of UpdateUI { "EnableModeless", PyIDocHostUIHandler::EnableModeless, 1 }, // @pymeth EnableModeless|Description of EnableModeless { "OnDocWindowActivate", PyIDocHostUIHandler::OnDocWindowActivate, 1 }, // @pymeth OnDocWindowActivate|Description of OnDocWindowActivate { "OnFrameWindowActivate", PyIDocHostUIHandler::OnFrameWindowActivate, 1 }, // @pymeth OnFrameWindowActivate|Description of OnFrameWindowActivate { "ResizeBorder", PyIDocHostUIHandler::ResizeBorder, 1 }, // @pymeth ResizeBorder|Description of ResizeBorder { "TranslateAccelerator", PyIDocHostUIHandler::TranslateAccelerator, 1 }, // @pymeth TranslateAccelerator|Description of TranslateAccelerator { "GetOptionKeyPath", PyIDocHostUIHandler::GetOptionKeyPath, 1 }, // @pymeth GetOptionKeyPath|Description of GetOptionKeyPath { "GetDropTarget", PyIDocHostUIHandler::GetDropTarget, 1 }, // @pymeth GetDropTarget|Description of GetDropTarget { "GetExternal", PyIDocHostUIHandler::GetExternal, 1 }, // @pymeth GetExternal|Description of GetExternal { "TranslateUrl", PyIDocHostUIHandler::TranslateUrl, 1 }, // @pymeth TranslateUrl|Description of TranslateUrl { "FilterDataObject", PyIDocHostUIHandler::FilterDataObject, 1 }, // @pymeth FilterDataObject|Description of FilterDataObject { NULL } }; PyComTypeObject PyIDocHostUIHandler::type("PyIDocHostUIHandler", &PyIUnknown::type, sizeof(PyIDocHostUIHandler), PyIDocHostUIHandler_methods, GET_PYCOM_CTOR(PyIDocHostUIHandler)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGDocHostUIHandler::ShowContextMenu( /* [in] */ DWORD dwID, /* [in] */ POINT * ppt, /* [in] */ IUnknown * pcmdtReserved, /* [in] */ IDispatch * pdispReserved) { PY_GATEWAY_METHOD; return InvokeViaPolicy("ShowContextMenu", NULL, "l(ii)NO", dwID, ppt->x, ppt->y, PyCom_PyObjectFromIUnknown(pcmdtReserved, IID_IUnknown, TRUE), PyCom_PyObjectFromIUnknown(pdispReserved, IID_IDispatch, TRUE)); } STDMETHODIMP PyGDocHostUIHandler::GetHostInfo( /* [out][in] */ DOCHOSTUIINFO * pInfo) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetHostInfo", &result, ""); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obhostcss, *obhostns; if (!PyArg_ParseTuple(result, "iiOO", &pInfo->dwFlags, &pInfo->dwDoubleClick, &obhostcss, &obhostns) || !PyWinObject_AsTaskAllocatedWCHAR(obhostcss, &pInfo->pchHostCss, TRUE, NULL) || !PyWinObject_AsTaskAllocatedWCHAR(obhostns, &pInfo->pchHostNS, TRUE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetHostInfo"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::ShowUI( /* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject * pActiveObject, /* [in] */ IOleCommandTarget * pCommandTarget, /* [in] */ IOleInPlaceFrame * pFrame, /* [in] */ IOleInPlaceUIWindow * pDoc) { PY_GATEWAY_METHOD; PyObject *obpActiveObject; PyObject *obpCommandTarget; PyObject *obpFrame; PyObject *obpDoc; obpActiveObject = PyCom_PyObjectFromIUnknown(pActiveObject, IID_IOleInPlaceActiveObject, TRUE); obpCommandTarget = PyCom_PyObjectFromIUnknown(pCommandTarget, IID_IOleCommandTarget, TRUE); obpFrame = PyCom_PyObjectFromIUnknown(pFrame, IID_IOleInPlaceFrame, TRUE); obpDoc = PyCom_PyObjectFromIUnknown(pDoc, IID_IOleInPlaceUIWindow, TRUE); HRESULT hr=InvokeViaPolicy("ShowUI", NULL, "lOOOO", dwID, obpActiveObject, obpCommandTarget, obpFrame, obpDoc); Py_XDECREF(obpActiveObject); Py_XDECREF(obpCommandTarget); Py_XDECREF(obpFrame); Py_XDECREF(obpDoc); return hr; } STDMETHODIMP PyGDocHostUIHandler::HideUI( void) { PY_GATEWAY_METHOD; return InvokeViaPolicy("HideUI", NULL); } STDMETHODIMP PyGDocHostUIHandler::UpdateUI( void) { PY_GATEWAY_METHOD; return InvokeViaPolicy("UpdateUI", NULL); } STDMETHODIMP PyGDocHostUIHandler::EnableModeless( /* [in] */ BOOL fEnable) { PY_GATEWAY_METHOD; return InvokeViaPolicy("EnableModeless", NULL, "i", fEnable); } STDMETHODIMP PyGDocHostUIHandler::OnDocWindowActivate( /* [in] */ BOOL fActivate) { PY_GATEWAY_METHOD; return InvokeViaPolicy("OnDocWindowActivate", NULL, "i", fActivate); } STDMETHODIMP PyGDocHostUIHandler::OnFrameWindowActivate( /* [in] */ BOOL fActivate) { PY_GATEWAY_METHOD; return InvokeViaPolicy("OnFrameWindowActivate", NULL, "i", fActivate); } STDMETHODIMP PyGDocHostUIHandler::ResizeBorder( /* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow * pUIWindow, /* [in] */ BOOL fRameWindow) { PY_GATEWAY_METHOD; return InvokeViaPolicy("ResizeBorder", NULL, "(iiii)Ni", prcBorder->left, prcBorder->top, prcBorder->right, prcBorder->bottom, PyCom_PyObjectFromIUnknown(pUIWindow, IID_IOleInPlaceUIWindow, TRUE), fRameWindow); } STDMETHODIMP PyGDocHostUIHandler::TranslateAccelerator( /* [in] */ LPMSG lpMsg, /* [in] */ const GUID * pguidCmdGroup, /* [in] */ DWORD nCmdID) { PY_GATEWAY_METHOD; return InvokeViaPolicy("TranslateAccelerator", NULL, "NNl", PyWinObject_FromMSG(lpMsg), PyWinObject_FromIID(*pguidCmdGroup), nCmdID); } STDMETHODIMP PyGDocHostUIHandler::GetOptionKeyPath( /* [out] */ LPOLESTR * pchKey, /* [in] */ DWORD dw) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetOptionKeyPath", &result, "l", dw); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsTaskAllocatedWCHAR(result, pchKey, FALSE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetOptionKeyPath"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::GetDropTarget( /* [in] */ IDropTarget * pDropTarget, /* [out] */ IDropTarget ** ppDropTarget) { PY_GATEWAY_METHOD; if (ppDropTarget==NULL) return E_POINTER; PyObject *obpDropTarget; obpDropTarget = PyCom_PyObjectFromIUnknown(pDropTarget, IID_IDropTarget, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetDropTarget", &result, "O", obpDropTarget); Py_XDECREF(obpDropTarget); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDropTarget, (void **)ppDropTarget, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetDropTarget"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::GetExternal( /* [out] */ IDispatch ** ppDispatch) { PY_GATEWAY_METHOD; if (ppDispatch==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetExternal", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDispatch, (void **)ppDispatch, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetExternal"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::TranslateUrl( /* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR * pchURLIn, /* [out] */ OLECHAR ** ppchURLOut) { PY_GATEWAY_METHOD; if (ppchURLOut==NULL) return E_POINTER; PyObject *obpchURLIn; obpchURLIn = MakeOLECHARToObj(pchURLIn); PyObject *result; HRESULT hr=InvokeViaPolicy("TranslateUrl", &result, "lO", dwTranslate, obpchURLIn); Py_XDECREF(obpchURLIn); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsTaskAllocatedWCHAR(result, ppchURLOut, FALSE, NULL)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("TranslateUrl"); Py_DECREF(result); return hr; } STDMETHODIMP PyGDocHostUIHandler::FilterDataObject( /* [in] */ IDataObject * pDO, /* [out] */ IDataObject ** ppDORet) { PY_GATEWAY_METHOD; if (ppDORet==NULL) return E_POINTER; PyObject *obpDO; obpDO = PyCom_PyObjectFromIUnknown(pDO, IID_IDataObject, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("FilterDataObject", &result, "O", obpDO); Py_XDECREF(obpDO); if (FAILED(hr)) return hr; if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDataObject, (void **)ppDORet, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("FilterDataObject"); Py_DECREF(result); return hr; } --- NEW FILE: PyIInternetSecurityManager.cpp --- // This file implements the IInternetSecurityManager Interface and Gateway for Python. // Generated by makegw.py #include "internet_pch.h" #include "PyIInternetSecurityManager.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIInternetSecurityManager::PyIInternetSecurityManager(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIInternetSecurityManager::~PyIInternetSecurityManager() { } /* static */ IInternetSecurityManager *PyIInternetSecurityManager::GetI(PyObject *self) { return (IInternetSecurityManager *)PyIUnknown::GetI(self); } // @pymethod |PyIInternetSecurityManager|SetSecuritySite|Description of SetSecuritySite. PyObject *PyIInternetSecurityManager::SetSecuritySite(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o PyIInternetSecurityMgrSite>|pSite||Description for pSite PyObject *obpSite; IInternetSecurityMgrSite * pSite; if (!PyArg_ParseTuple(args, "O:SetSecuritySite", &obpSite)) return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obpSite, IID_IInternetSecurityMgrSite, (void **)&pSite, TRUE /* bNoneOK */)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->SetSecuritySite( pSite ); if (pSite) pSite->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIInternetSecurityManager|GetSecuritySite|Description of GetSecuritySite. PyObject *PyIInternetSecurityManager::GetSecuritySite(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; IInternetSecurityMgrSite * ppSite; if ( !PyArg_ParseTuple(args, ":GetSecuritySite") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetSecuritySite(&ppSite); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyCom_PyObjectFromIUnknown(ppSite, IID_IInternetSecurityMgrSite, FALSE); } // @pymethod |PyIInternetSecurityManager|MapUrlToZone|Description of MapUrlToZone. PyObject *PyIInternetSecurityManager::MapUrlToZone(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|dwFlags||Description for dwFlags PyObject *obpwszUrl; LPWSTR pwszUrl; DWORD pdwZone; DWORD dwFlags; if (!PyArg_ParseTuple(args, "Ol:MapUrlToZone", &obpwszUrl, &dwFlags)) return NULL; if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->MapUrlToZone( pwszUrl, &pdwZone, dwFlags ); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyInt_FromLong(pdwZone); } // @pymethod |PyIInternetSecurityManager|GetSecurityId|Description of GetSecurityId. PyObject *PyIInternetSecurityManager::GetSecurityId(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|pcbSecurityId||Description for pcbSecurityId DWORD_PTR dwReserved = 0; PyObject *obdwReserved = Py_None; // ACK - 'reserved' docs appears to indicate its actually a string. // so ignore it for now. PyObject *obpwszUrl; LPWSTR pwszUrl; if ( !PyArg_ParseTuple(args, "O:GetSecurityId", &obpwszUrl) ) return NULL; if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) return NULL; BYTE buf[1024]; // big enough? DWORD cbSecurityId = sizeof(buf); HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetSecurityId( pwszUrl, buf, &cbSecurityId, 0); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyString_FromStringAndSize((char *)buf, cbSecurityId); } // @pymethod |PyIInternetSecurityManager|ProcessUrlAction|Description of ProcessUrlAction. PyObject *PyIInternetSecurityManager::ProcessUrlAction(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm int|dwAction||Description for dwAction // @pyparm int|dwFlags||Description for dwFlags PyObject *obpwszUrl; LPWSTR pwszUrl; DWORD dwAction; PyObject *obContext; DWORD dwFlags; if ( !PyArg_ParseTuple(args, "OlOl:ProcessUrlAction", &obpwszUrl, &dwAction, &obContext, &dwFlags) ) return NULL; BOOL bPythonIsHappy = TRUE; IID context; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsIID(obContext, &context)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; DWORD dwPolicy = 0; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->ProcessUrlAction( pwszUrl, dwAction, (BYTE *)&dwPolicy, sizeof(dwPolicy), (BYTE *)&context, sizeof(context), dwFlags, 0); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager); return Py_BuildValue("ll", hr, dwPolicy); } /*** // @pymethod |PyIInternetSecurityManager|QueryCustomPolicy|Description of QueryCustomPolicy. PyObject *PyIInternetSecurityManager::QueryCustomPolicy(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm <o unicode>|pwszUrl||Description for pwszUrl // @pyparm <o PyIID>|guidKey||Description for guidKey // @pyparm int|pContext||Description for pContext // @pyparm int|cbContext||Description for cbContext // @pyparm int|dwReserved||Description for dwReserved PyObject *obpwszUrl; PyObject *obguidKey; LPWSTR pwszUrl; IID guidKey; BYTE ppPolicy; DWORD pcbPolicy; BYTE pContext; DWORD cbContext; DWORD dwReserved; if ( !PyArg_ParseTuple(args, "OOill:QueryCustomPolicy", &obpwszUrl, &obguidKey, &pContext, &cbContext, &dwReserved) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obguidKey, &guidKey)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->QueryCustomPolicy( pwszUrl, guidKey, ?? (-2)ppPolicy, &pcbPolicy, &pContext, cbContext, dwReserved ); SysFreeString(pwszUrl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); PyObject *pyretval = Py_BuildValue("il", ppPolicy, pcbPolicy); return pyretval; } ***/ // @pymethod |PyIInternetSecurityManager|SetZoneMapping|Description of SetZoneMapping. PyObject *PyIInternetSecurityManager::SetZoneMapping(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm int|dwZone||Description for dwZone // @pyparm <o unicode>|lpszPattern||Description for lpszPattern // @pyparm int|dwFlags||Description for dwFlags PyObject *oblpszPattern; DWORD dwZone; LPWSTR lpszPattern; DWORD dwFlags; if (!PyArg_ParseTuple(args, "lOl:SetZoneMapping", &dwZone, &oblpszPattern, &dwFlags)) return NULL; if (!PyWinObject_AsBstr(oblpszPattern, &lpszPattern)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->SetZoneMapping( dwZone, lpszPattern, dwFlags ); SysFreeString(lpszPattern); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIInternetSecurityManager|GetZoneMappings|Description of GetZoneMappings. PyObject *PyIInternetSecurityManager::GetZoneMappings(PyObject *self, PyObject *args) { IInternetSecurityManager *pIISM = GetI(self); if ( pIISM == NULL ) return NULL; // @pyparm int|dwZone||Description for dwZone // @pyparm int|dwFlags||Description for dwFlags DWORD dwZone; IEnumString * ppenumString; DWORD dwFlags; if ( !PyArg_ParseTuple(args, "ll:GetZoneMappings", &dwZone, &dwFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIISM->GetZoneMappings( dwZone, &ppenumString, dwFlags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager ); return PyCom_PyObjectFromIUnknown(ppenumString, IID_IEnumString, FALSE); } // @object PyIInternetSecurityManager|Description of the interface static struct PyMethodDef PyIInternetSecurityManager_methods[] = { { "SetSecuritySite", PyIInternetSecurityManager::SetSecuritySite, 1 }, // @pymeth SetSecuritySite|Description of SetSecuritySite { "GetSecuritySite", PyIInternetSecurityManager::GetSecuritySite, 1 }, // @pymeth GetSecuritySite|Description of GetSecuritySite { "MapUrlToZone", PyIInternetSecurityManager::MapUrlToZone, 1 }, // @pymeth MapUrlToZone|Description of MapUrlToZone { "GetSecurityId", PyIInternetSecurityManager::GetSecurityId, 1 }, // @pymeth GetSecurityId|Description of GetSecurityId { "ProcessUrlAction", PyIInternetSecurityManager::ProcessUrlAction, 1 }, // @pymeth ProcessUrlAction|Description of ProcessUrlAction // { "QueryCustomPolicy", PyIInternetSecurityManager::QueryCustomPolicy, 1 }, { "SetZoneMapping", PyIInternetSecurityManager::SetZoneMapping, 1 }, // @pymeth SetZoneMapping|Description of SetZoneMapping { "GetZoneMappings", PyIInternetSecurityManager::GetZoneMappings, 1 }, // @pymeth GetZoneMappings|Description of GetZoneMappings { NULL } }; PyComTypeObject PyIInternetSecurityManager::type("PyIInternetSecurityManager", &PyIUnknown::type, sizeof(PyIInternetSecurityManager), PyIInternetSecurityManager_methods, GET_PYCOM_CTOR(PyIInternetSecurityManager)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGInternetSecurityManager::SetSecuritySite( /* [unique][in] */ IInternetSecurityMgrSite * pSite) { PY_GATEWAY_METHOD; PyObject *obpSite; obpSite = PyCom_PyObjectFromIUnknown(pSite, IID_IInternetSecurityMgrSite, TRUE); HRESULT hr=InvokeViaPolicy("SetSecuritySite", NULL, "O", obpSite); Py_XDECREF(obpSite); return hr; } STDMETHODIMP PyGInternetSecurityManager::GetSecuritySite( /* [out] */ IInternetSecurityMgrSite ** ppSite) { PY_GATEWAY_METHOD; if (ppSite==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetSecuritySite", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IInternetSecurityMgrSite, (void **)ppSite, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecuritySite"); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::MapUrlToZone( /* [in] */ LPCWSTR pwszUrl, /* [out] */ DWORD * pdwZone, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; PyObject *obpwszUrl; obpwszUrl = MakeOLECHARToObj(pwszUrl); PyObject *result; HRESULT hr=InvokeViaPolicy("MapUrlToZone", &result, "Ol", obpwszUrl, dwFlags); Py_XDECREF(obpwszUrl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "l" , pdwZone)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("MapUrlToZone"); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::GetSecurityId( /* [in] */ LPCWSTR pwszUrl, /* [size_is][out] */ BYTE * pbSecurityId, /* [out][in] */ DWORD * pcbSecurityId, /* [in] */ DWORD_PTR dwReserved) { PY_GATEWAY_METHOD; PyObject *obdwReserved = PyWinObject_FromDWORD_PTR(dwReserved); if (obdwReserved==NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId"); PyObject *obpwszUrl; obpwszUrl = MakeOLECHARToObj(pwszUrl); PyObject *result; HRESULT hr=InvokeViaPolicy("GetSecurityId", &result, "OlO", obpwszUrl, *pcbSecurityId, obdwReserved); Py_XDECREF(obpwszUrl); Py_DECREF(obdwReserved); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params void *buf; DWORD buf_len; if (!PyWinObject_AsReadBuffer(result, &buf, &buf_len)) { Py_DECREF(result); return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId"); } *pcbSecurityId = min(buf_len, *pcbSecurityId); memcpy(pbSecurityId, buf, *pcbSecurityId); Py_DECREF(result); return hr; } STDMETHODIMP PyGInternetSecurityManager::ProcessUrlAction( /* [in] */ LPCWSTR pwszUrl, /* [in] */ DWORD dwAction, /* [size_is][out] */ BYTE * pPolicy, /* [in] */ DWORD cbPolicy, /* [in] */ BYTE * pContext, /* [in] */ DWORD cbContext, /* [in] */ DWORD dwFlags, /* [in] */ DWORD dwReserved) { PY_GATEWAY_METHOD; PyObject *obpwszUrl; PyObject *obContext; obpwszUrl = MakeOLECHARToObj(pwszUrl); if (cbContext==0 || pContext==NULL) { obContext = Py_None; Py_INCREF(Py_None); } else if (cbContext==sizeof(GUID)) obContext = PyWinObject_FromIID(*((IID *)*pContext)); else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext); obContext = Py_None; Py_INCREF(Py_None); } PyObject *result; HRESULT hr=InvokeViaPolicy("ProcessUrlAction", &result, "OlOll", obpwszUrl, dwAction, obContext, dwFlags, dwReserved); Py_XDECREF(obpwszUrl); Py_XDECREF(obContext); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (cbPolicy==sizeof(DWORD)) { *((DWORD *)pPolicy) = PyInt_AsLong(result); if (*((DWORD *)pPolicy)==-1) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("ProcessUrlAction"); } else { PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for policy - what is that?", cbPolicy); hr = E_UNEXPECTED; } return hr; } STDMETHODIMP PyGInternetSecurityManager::QueryCustomPolicy( /* [in] */ LPCWSTR pwszUrl, /* [in] */ REFGUID guidKey, /* [size_is][size_is][out] */ BYTE ** ppPolicy, /* [out] */ DWORD * pcbPolicy, /* [in] */ BYTE * pContext, /* [in] */ DWORD cbContext, /* [in] */ DWORD dwReserved) { return INET_E_DEFAULT_ACTION; /*** PY_GATEWAY_METHOD; if (ppPolicy==NULL) return E_POINTER; PyObject *obpwszUrl; PyObject *obguidKey; obpwszUrl = MakeOLECHARToObj(pwszUrl); obguidKey = PyWinObject_FromIID(guidKey); PyObject *result; HRESULT hr=InvokeViaPolicy("QueryCustomPolicy", &result, "OOill", obpwszUrl, obguidKey, pContext, cbContext, dwReserved); Py_XDECREF(obpwszUrl); Py_XDECREF(obguidKey); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_ParseTuple(result, "il" , *ppPolicy, pcbPolicy)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("QueryCustomPolicy"); Py_DECREF(result); return hr; ***/ } STDMETHODIMP PyGInternetSecurityManager::SetZoneMapping( /* [in] */ DWORD dwZone, /* [in] */ LPCWSTR lpszPattern, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; return InvokeViaPolicy("SetZoneMapping", NULL, "lNl", dwZone, MakeOLECHARToObj(lpszPattern), dwFlags); } STDMETHODIMP PyGInternetSecurityManager::GetZoneMappings( /* [in] */ DWORD dwZone, /* [out] */ IEnumString ** ppenumString, /* [in] */ DWORD dwFlags) { PY_GATEWAY_METHOD; if (ppenumString==NULL) return E_POINTER; PyObject *result; HRESULT hr=InvokeViaPolicy("GetZoneMappings", &result, "ll", dwZone, dwFlags); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obppenumString; if (!PyArg_Parse(result, "O" , &obppenumString)) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings"); if (!PyCom_InterfaceFromPyInstanceOrObject(obppenumString, IID_IEnumString, (void **)ppenumString, TRUE /* bNoneOK */)) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings"); Py_DECREF(result); return hr; } |
From: Mark H. <mha...@us...> - 2008-11-02 12:50:05
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22835/com/win32comext/internet Added Files: inetcon.py Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. --- NEW FILE: inetcon.py --- INET_E_USE_DEFAULT_PROTOCOLHANDLER = -2146697199 # _HRESULT_TYPEDEF_(0x800C0011L) INET_E_USE_DEFAULT_SETTING = -2146697198 # _HRESULT_TYPEDEF_(0x800C0012L) INET_E_DEFAULT_ACTION = INET_E_USE_DEFAULT_PROTOCOLHANDLER INET_E_QUERYOPTION_UNKNOWN = -2146697197 # _HRESULT_TYPEDEF_(0x800C0013L) INET_E_REDIRECTING = -2146697196 #_HRESULT_TYPEDEF_(0x800C0014L) INET_E_INVALID_URL = -2146697214 # _HRESULT_TYPEDEF_(0x800C0002L) INET_E_NO_SESSION = -2146697213 # _HRESULT_TYPEDEF_(0x800C0003L) INET_E_CANNOT_CONNECT = -2146697212 # _HRESULT_TYPEDEF_(0x800C0004L) INET_E_RESOURCE_NOT_FOUND = -2146697211 # _HRESULT_TYPEDEF_(0x800C0005L) INET_E_OBJECT_NOT_FOUND = -2146697210 # _HRESULT_TYPEDEF_(0x800C0006L) INET_E_DATA_NOT_AVAILABLE = -2146697209 # _HRESULT_TYPEDEF_(0x800C0007L) INET_E_DOWNLOAD_FAILURE = -2146697208 # _HRESULT_TYPEDEF_(0x800C0008L) INET_E_AUTHENTICATION_REQUIRED = -2146697207 # _HRESULT_TYPEDEF_(0x800C0009L) INET_E_NO_VALID_MEDIA = -2146697206 # _HRESULT_TYPEDEF_(0x800C000AL) INET_E_CONNECTION_TIMEOUT = -2146697205 # _HRESULT_TYPEDEF_(0x800C000BL) INET_E_INVALID_REQUEST = -2146697204 # _HRESULT_TYPEDEF_(0x800C000CL) INET_E_UNKNOWN_PROTOCOL = -2146697203 # _HRESULT_TYPEDEF_(0x800C000DL) INET_E_SECURITY_PROBLEM = -2146697202 # _HRESULT_TYPEDEF_(0x800C000EL) INET_E_CANNOT_LOAD_DATA = -2146697201 # _HRESULT_TYPEDEF_(0x800C000FL) INET_E_CANNOT_INSTANTIATE_OBJECT = -2146697200 # _HRESULT_TYPEDEF_(0x800C0010L) INET_E_INVALID_CERTIFICATE = -2146697191 # _HRESULT_TYPEDEF_(0x800C0019L) INET_E_REDIRECT_FAILED = -2146697196 # _HRESULT_TYPEDEF_(0x800C0014L) INET_E_REDIRECT_TO_DIR = -2146697195 # _HRESULT_TYPEDEF_(0x800C0015L) INET_E_CANNOT_LOCK_REQUEST = -2146697194 # _HRESULT_TYPEDEF_(0x800C0016L) INET_E_USE_EXTEND_BINDING = -2146697193 # _HRESULT_TYPEDEF_(0x800C0017L) INET_E_TERMINATED_BIND = -2146697192 # _HRESULT_TYPEDEF_(0x800C0018L) INET_E_CODE_DOWNLOAD_DECLINED = -2146696960 #_HRESULT_TYPEDEF_(0x800C0100L) INET_E_RESULT_DISPATCHED = -2146696704 # _HRESULT_TYPEDEF_(0x800C0200L) INET_E_CANNOT_REPLACE_SFP_FILE = -2146696448 # _HRESULT_TYPEDEF_(0x800C0300L) INET_E_CODE_INSTALL_SUPPRESSED = -2146696192 # _HRESULT_TYPEDEF_(0x800C0400L) INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY = -2146695936 # _HRESULT_TYPEDEF_(0x800C0500L) # Generated by h2py from UrlMon.h MKSYS_URLMONIKER = 6 URL_MK_LEGACY = 0 URL_MK_UNIFORM = 1 URL_MK_NO_CANONICALIZE = 2 FIEF_FLAG_FORCE_JITUI = 0x1 FIEF_FLAG_PEEK = 0x2 FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK = 0x4 FMFD_DEFAULT = 0x00000000 FMFD_URLASFILENAME = 0x00000001 FMFD_ENABLEMIMESNIFFING = 0x00000002 FMFD_IGNOREMIMETEXTPLAIN = 0x00000004 URLMON_OPTION_USERAGENT = 0x10000001 URLMON_OPTION_USERAGENT_REFRESH = 0x10000002 URLMON_OPTION_URL_ENCODING = 0x10000004 URLMON_OPTION_USE_BINDSTRINGCREDS = 0x10000008 URLMON_OPTION_USE_BROWSERAPPSDOCUMENTS = 0x10000010 CF_NULL = 0 Uri_CREATE_ALLOW_RELATIVE = 0x00000001 Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME = 0x00000002 Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME = 0x00000004 Uri_CREATE_NOFRAG = 0x00000008 Uri_CREATE_NO_CANONICALIZE = 0x00000010 Uri_CREATE_CANONICALIZE = 0x00000100 Uri_CREATE_FILE_USE_DOS_PATH = 0x00000020 Uri_CREATE_DECODE_EXTRA_INFO = 0x00000040 Uri_CREATE_NO_DECODE_EXTRA_INFO = 0x00000080 Uri_CREATE_CRACK_UNKNOWN_SCHEMES = 0x00000200 Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES = 0x00000400 Uri_CREATE_PRE_PROCESS_HTML_URI = 0x00000800 Uri_CREATE_NO_PRE_PROCESS_HTML_URI = 0x00001000 Uri_CREATE_IE_SETTINGS = 0x00002000 Uri_CREATE_NO_IE_SETTINGS = 0x00004000 Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS = 0x00008000 Uri_DISPLAY_NO_FRAGMENT = 0x00000001 Uri_PUNYCODE_IDN_HOST = 0x00000002 Uri_DISPLAY_IDN_HOST = 0x00000004 Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 = 0x00000001 Uri_ENCODING_USER_INFO_AND_PATH_IS_CP = 0x00000002 Uri_ENCODING_HOST_IS_IDN = 0x00000004 Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 = 0x00000008 Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP = 0x00000010 Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 = 0x00000020 Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP = 0x00000040 Uri_ENCODING_RFC = (Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8) UriBuilder_USE_ORIGINAL_FLAGS = 0x00000001 WININETINFO_OPTION_LOCK_HANDLE = 65534 URLOSTRM_USECACHEDCOPY_ONLY = 0x1 URLOSTRM_USECACHEDCOPY = 0x2 URLOSTRM_GETNEWESTVERSION = 0x3 SET_FEATURE_ON_THREAD = 0x00000001 SET_FEATURE_ON_PROCESS = 0x00000002 SET_FEATURE_IN_REGISTRY = 0x00000004 SET_FEATURE_ON_THREAD_LOCALMACHINE = 0x00000008 SET_FEATURE_ON_THREAD_INTRANET = 0x00000010 SET_FEATURE_ON_THREAD_TRUSTED = 0x00000020 SET_FEATURE_ON_THREAD_INTERNET = 0x00000040 SET_FEATURE_ON_THREAD_RESTRICTED = 0x00000080 GET_FEATURE_FROM_THREAD = 0x00000001 GET_FEATURE_FROM_PROCESS = 0x00000002 GET_FEATURE_FROM_REGISTRY = 0x00000004 GET_FEATURE_FROM_THREAD_LOCALMACHINE = 0x00000008 GET_FEATURE_FROM_THREAD_INTRANET = 0x00000010 GET_FEATURE_FROM_THREAD_TRUSTED = 0x00000020 GET_FEATURE_FROM_THREAD_INTERNET = 0x00000040 GET_FEATURE_FROM_THREAD_RESTRICTED = 0x00000080 PROTOCOLFLAG_NO_PICS_CHECK = 0x00000001 MUTZ_NOSAVEDFILECHECK = 0x00000001 MUTZ_ISFILE = 0x00000002 MUTZ_ACCEPT_WILDCARD_SCHEME = 0x00000080 MUTZ_ENFORCERESTRICTED = 0x00000100 MUTZ_RESERVED = 0x00000200 MUTZ_REQUIRESAVEDFILECHECK = 0x00000400 MUTZ_DONT_UNESCAPE = 0x00000800 MUTZ_DONT_USE_CACHE = 0x00001000 MUTZ_FORCE_INTRANET_FLAGS = 0x00002000 MUTZ_IGNORE_ZONE_MAPPINGS = 0x00004000 MAX_SIZE_SECURITY_ID = 512 URLACTION_MIN = 0x00001000 URLACTION_DOWNLOAD_MIN = 0x00001000 URLACTION_DOWNLOAD_SIGNED_ACTIVEX = 0x00001001 URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX = 0x00001004 URLACTION_DOWNLOAD_CURR_MAX = 0x00001004 URLACTION_DOWNLOAD_MAX = 0x000011FF URLACTION_ACTIVEX_MIN = 0x00001200 URLACTION_ACTIVEX_RUN = 0x00001200 URLPOLICY_ACTIVEX_CHECK_LIST = 0x00010000 URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY = 0x00001201 URLACTION_ACTIVEX_OVERRIDE_DATA_SAFETY = 0x00001202 URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY = 0x00001203 URLACTION_SCRIPT_OVERRIDE_SAFETY = 0x00001401 URLACTION_ACTIVEX_CONFIRM_NOOBJECTSAFETY = 0x00001204 URLACTION_ACTIVEX_TREATASUNTRUSTED = 0x00001205 URLACTION_ACTIVEX_NO_WEBOC_SCRIPT = 0x00001206 URLACTION_ACTIVEX_OVERRIDE_REPURPOSEDETECTION = 0x00001207 URLACTION_ACTIVEX_OVERRIDE_OPTIN = 0x00001208 URLACTION_ACTIVEX_SCRIPTLET_RUN = 0x00001209 URLACTION_ACTIVEX_DYNSRC_VIDEO_AND_ANIMATION = 0x0000120A URLACTION_ACTIVEX_CURR_MAX = 0x0000120A URLACTION_ACTIVEX_MAX = 0x000013ff URLACTION_SCRIPT_MIN = 0x00001400 URLACTION_SCRIPT_RUN = 0x00001400 URLACTION_SCRIPT_JAVA_USE = 0x00001402 URLACTION_SCRIPT_SAFE_ACTIVEX = 0x00001405 URLACTION_CROSS_DOMAIN_DATA = 0x00001406 URLACTION_SCRIPT_PASTE = 0x00001407 URLACTION_ALLOW_XDOMAIN_SUBFRAME_RESIZE = 0x00001408 URLACTION_SCRIPT_CURR_MAX = 0x00001408 URLACTION_SCRIPT_MAX = 0x000015ff URLACTION_HTML_MIN = 0x00001600 URLACTION_HTML_SUBMIT_FORMS = 0x00001601 URLACTION_HTML_SUBMIT_FORMS_FROM = 0x00001602 URLACTION_HTML_SUBMIT_FORMS_TO = 0x00001603 URLACTION_HTML_FONT_DOWNLOAD = 0x00001604 URLACTION_HTML_JAVA_RUN = 0x00001605 URLACTION_HTML_USERDATA_SAVE = 0x00001606 URLACTION_HTML_SUBFRAME_NAVIGATE = 0x00001607 URLACTION_HTML_META_REFRESH = 0x00001608 URLACTION_HTML_MIXED_CONTENT = 0x00001609 URLACTION_HTML_INCLUDE_FILE_PATH = 0x0000160A URLACTION_HTML_MAX = 0x000017ff URLACTION_SHELL_MIN = 0x00001800 URLACTION_SHELL_INSTALL_DTITEMS = 0x00001800 URLACTION_SHELL_MOVE_OR_COPY = 0x00001802 URLACTION_SHELL_FILE_DOWNLOAD = 0x00001803 URLACTION_SHELL_VERB = 0x00001804 URLACTION_SHELL_WEBVIEW_VERB = 0x00001805 URLACTION_SHELL_SHELLEXECUTE = 0x00001806 URLACTION_SHELL_EXECUTE_HIGHRISK = 0x00001806 URLACTION_SHELL_EXECUTE_MODRISK = 0x00001807 URLACTION_SHELL_EXECUTE_LOWRISK = 0x00001808 URLACTION_SHELL_POPUPMGR = 0x00001809 URLACTION_SHELL_RTF_OBJECTS_LOAD = 0x0000180A URLACTION_SHELL_ENHANCED_DRAGDROP_SECURITY = 0x0000180B URLACTION_SHELL_EXTENSIONSECURITY = 0x0000180C URLACTION_SHELL_SECURE_DRAGSOURCE = 0x0000180D URLACTION_SHELL_CURR_MAX = 0x0000180D URLACTION_SHELL_MAX = 0x000019ff URLACTION_NETWORK_MIN = 0x00001A00 URLACTION_CREDENTIALS_USE = 0x00001A00 URLPOLICY_CREDENTIALS_SILENT_LOGON_OK = 0x00000000 URLPOLICY_CREDENTIALS_MUST_PROMPT_USER = 0x00010000 URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT = 0x00020000 URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY = 0x00030000 URLACTION_AUTHENTICATE_CLIENT = 0x00001A01 URLPOLICY_AUTHENTICATE_CLEARTEXT_OK = 0x00000000 URLPOLICY_AUTHENTICATE_CHALLENGE_RESPONSE = 0x00010000 URLPOLICY_AUTHENTICATE_MUTUAL_ONLY = 0x00030000 URLACTION_COOKIES = 0x00001A02 URLACTION_COOKIES_SESSION = 0x00001A03 URLACTION_CLIENT_CERT_PROMPT = 0x00001A04 URLACTION_COOKIES_THIRD_PARTY = 0x00001A05 URLACTION_COOKIES_SESSION_THIRD_PARTY = 0x00001A06 URLACTION_COOKIES_ENABLED = 0x00001A10 URLACTION_NETWORK_CURR_MAX = 0x00001A10 URLACTION_NETWORK_MAX = 0x00001Bff URLACTION_JAVA_MIN = 0x00001C00 URLACTION_JAVA_PERMISSIONS = 0x00001C00 URLPOLICY_JAVA_PROHIBIT = 0x00000000 URLPOLICY_JAVA_HIGH = 0x00010000 URLPOLICY_JAVA_MEDIUM = 0x00020000 URLPOLICY_JAVA_LOW = 0x00030000 URLPOLICY_JAVA_CUSTOM = 0x00800000 URLACTION_JAVA_CURR_MAX = 0x00001C00 URLACTION_JAVA_MAX = 0x00001Cff URLACTION_INFODELIVERY_MIN = 0x00001D00 URLACTION_INFODELIVERY_NO_ADDING_CHANNELS = 0x00001D00 URLACTION_INFODELIVERY_NO_EDITING_CHANNELS = 0x00001D01 URLACTION_INFODELIVERY_NO_REMOVING_CHANNELS = 0x00001D02 URLACTION_INFODELIVERY_NO_ADDING_SUBSCRIPTIONS = 0x00001D03 URLACTION_INFODELIVERY_NO_EDITING_SUBSCRIPTIONS = 0x00001D04 URLACTION_INFODELIVERY_NO_REMOVING_SUBSCRIPTIONS = 0x00001D05 URLACTION_INFODELIVERY_NO_CHANNEL_LOGGING = 0x00001D06 URLACTION_INFODELIVERY_CURR_MAX = 0x00001D06 URLACTION_INFODELIVERY_MAX = 0x00001Dff URLACTION_CHANNEL_SOFTDIST_MIN = 0x00001E00 URLACTION_CHANNEL_SOFTDIST_PERMISSIONS = 0x00001E05 URLPOLICY_CHANNEL_SOFTDIST_PROHIBIT = 0x00010000 URLPOLICY_CHANNEL_SOFTDIST_PRECACHE = 0x00020000 URLPOLICY_CHANNEL_SOFTDIST_AUTOINSTALL = 0x00030000 URLACTION_CHANNEL_SOFTDIST_MAX = 0x00001Eff URLACTION_BEHAVIOR_MIN = 0x00002000 URLACTION_BEHAVIOR_RUN = 0x00002000 URLPOLICY_BEHAVIOR_CHECK_LIST = 0x00010000 URLACTION_FEATURE_MIN = 0x00002100 URLACTION_FEATURE_MIME_SNIFFING = 0x00002100 URLACTION_FEATURE_ZONE_ELEVATION = 0x00002101 URLACTION_FEATURE_WINDOW_RESTRICTIONS = 0x00002102 URLACTION_FEATURE_SCRIPT_STATUS_BAR = 0x00002103 URLACTION_FEATURE_FORCE_ADDR_AND_STATUS = 0x00002104 URLACTION_FEATURE_BLOCK_INPUT_PROMPTS = 0x00002105 URLACTION_AUTOMATIC_DOWNLOAD_UI_MIN = 0x00002200 URLACTION_AUTOMATIC_DOWNLOAD_UI = 0x00002200 URLACTION_AUTOMATIC_ACTIVEX_UI = 0x00002201 URLACTION_ALLOW_RESTRICTEDPROTOCOLS = 0x00002300 URLACTION_ALLOW_APEVALUATION = 0x00002301 URLACTION_WINDOWS_BROWSER_APPLICATIONS = 0x00002400 URLACTION_XPS_DOCUMENTS = 0x00002401 URLACTION_LOOSE_XAML = 0x00002402 URLACTION_LOWRIGHTS = 0x00002500 URLACTION_WINFX_SETUP = 0x00002600 URLPOLICY_ALLOW = 0x00 URLPOLICY_QUERY = 0x01 URLPOLICY_DISALLOW = 0x03 URLPOLICY_NOTIFY_ON_ALLOW = 0x10 URLPOLICY_NOTIFY_ON_DISALLOW = 0x20 URLPOLICY_LOG_ON_ALLOW = 0x40 URLPOLICY_LOG_ON_DISALLOW = 0x80 URLPOLICY_MASK_PERMISSIONS = 0x0f URLPOLICY_DONTCHECKDLGBOX = 0x100 URLZONE_ESC_FLAG = 0x100 SECURITY_IE_STATE_GREEN = 0x00000000 SECURITY_IE_STATE_RED = 0x00000001 SOFTDIST_FLAG_USAGE_EMAIL = 0x00000001 SOFTDIST_FLAG_USAGE_PRECACHE = 0x00000002 SOFTDIST_FLAG_USAGE_AUTOINSTALL = 0x00000004 SOFTDIST_FLAG_DELETE_SUBSCRIPTION = 0x00000008 SOFTDIST_ADSTATE_NONE = 0x00000000 SOFTDIST_ADSTATE_AVAILABLE = 0x00000001 SOFTDIST_ADSTATE_DOWNLOADED = 0x00000002 SOFTDIST_ADSTATE_INSTALLED = 0x00000003 CONFIRMSAFETYACTION_LOADOBJECT = 0x00000001 |
From: Mark H. <mha...@us...> - 2008-11-02 12:50:05
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22835 Modified Files: CHANGES.txt Log Message: win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager function. Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CHANGES.txt 2 Nov 2008 11:47:47 -0000 1.30 --- CHANGES.txt 2 Nov 2008 12:50:01 -0000 1.31 *************** *** 9,15 **** ---------------- ! * win32com.axcontrol gets support for interfaces OleControlSite, ! OleInPlaceActiveObject, OleInPlaceFrame and OleInPlaceUIWindow interfaces ! and OleTranslateAccelerator function. * MsgWaitForMultipleObjectsEx() would crash in all cases. Fix from --- 9,19 ---- ---------------- ! * win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices ! and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager ! function. ! ! * win32com.axcontrol gets support for IOleControlSite, ! IOleInPlaceActiveObject, IOleInPlaceFrame and IOleInPlaceUIWindow ! interfaces, and OleTranslateAccelerator function. * MsgWaitForMultipleObjectsEx() would crash in all cases. Fix from |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:53
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22520/com/win32comext/shell/src Modified Files: Tag: py3k PyIShellBrowser.cpp shell.cpp Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: PyIShellBrowser.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellBrowser.cpp,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** PyIShellBrowser.cpp 18 Aug 2008 13:04:10 -0000 1.10 --- PyIShellBrowser.cpp 2 Nov 2008 12:43:47 -0000 1.10.2.1 *************** *** 9,15 **** // --------------------------------------------------- // - extern BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths); - PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *p); - extern BOOL PyObject_AsTBBUTTONs( PyObject *ob, TBBUTTON **ppButtons, UINT *nButtons ); extern void PyObject_FreeTBBUTTONs(TBBUTTON *); --- 9,12 ---- *************** *** 32,36 **** } ! // @pymethod <o PyLPOLEMENUGROUPWIDTHS>|PyIShellBrowser|InsertMenusSB|Updates a composite menu with container's options PyObject *PyIShellBrowser::InsertMenusSB(PyObject *self, PyObject *args) { --- 29,33 ---- } ! // @pymethod <o PyOLEMENUGROUPWIDTHS>|PyIShellBrowser|InsertMenusSB|Updates a composite menu with container's options PyObject *PyIShellBrowser::InsertMenusSB(PyObject *self, PyObject *args) { *************** *** 43,47 **** if ( !PyArg_ParseTuple(args, "OO:InsertMenusSB", &obhmenuShared, // @pyparm <o PyHANDLE>|hmenuShared||Newly created menu that contains no items ! &obMenuWidths)) // @pyparm <o PyLPOLEMENUGROUPWIDTHS>|lpMenuWidths||Tuple of 6 ints. Items 0,2,and 4 are updated when the tuple is returned. return NULL; if (!PyWinObject_AsHANDLE(obhmenuShared, (HANDLE *)&hmenuShared)) --- 40,44 ---- if ( !PyArg_ParseTuple(args, "OO:InsertMenusSB", &obhmenuShared, // @pyparm <o PyHANDLE>|hmenuShared||Newly created menu that contains no items ! &obMenuWidths)) // @pyparm <o PyOLEMENUGROUPWIDTHS>|lpMenuWidths||Tuple of 6 ints. Items 0,2,and 4 are updated when the tuple is returned. return NULL; if (!PyWinObject_AsHANDLE(obhmenuShared, (HANDLE *)&hmenuShared)) Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.68.2.2 retrieving revision 1.68.2.3 diff -C2 -d -r1.68.2.2 -r1.68.2.3 *** shell.cpp 13 Sep 2008 15:48:31 -0000 1.68.2.2 --- shell.cpp 2 Nov 2008 12:43:47 -0000 1.68.2.3 *************** *** 892,916 **** } - // @object PyLPOLEMENUGROUPWIDTHS|Tuple containing 6 ints indicating nbr of options in each menu group - BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths) - { - return PyArg_ParseTuple(oblpMenuWidths, "iiiiii", - &pWidths->width[0], &pWidths->width[1], - &pWidths->width[2], &pWidths->width[3], - &pWidths->width[4], &pWidths->width[5]) != NULL; - } - - PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *pWidths) - { - if (!pWidths) { - Py_INCREF(Py_None); - return Py_None; - } - return Py_BuildValue("(iiiiii)", - pWidths->width[0], pWidths->width[1], - pWidths->width[2], pWidths->width[3], - pWidths->width[4], pWidths->width[5]); - } - static BOOL MakeDoubleTerminatedStringList(PyObject *ob, TCHAR **ret) { --- 892,895 ---- |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:52
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22520/com/win32com/src/include Modified Files: Tag: py3k PyComTypeObjects.h PythonCOM.h Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: PyComTypeObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyComTypeObjects.h,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** PyComTypeObjects.h 29 Aug 2008 08:27:38 -0000 1.5.2.1 --- PyComTypeObjects.h 2 Nov 2008 12:43:47 -0000 1.5.2.2 *************** *** 1,4 **** ! // Out public converters. PyObject *PyObject_FromFUNCDESC(FUNCDESC *desc); PyObject *PyObject_FromTYPEATTR(TYPEATTR *desc); --- 1,4 ---- ! // Our public converters. PyObject *PyObject_FromFUNCDESC(FUNCDESC *desc); PyObject *PyObject_FromTYPEATTR(TYPEATTR *desc); Index: PythonCOM.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v retrieving revision 1.27.2.2 retrieving revision 1.27.2.3 diff -C2 -d -r1.27.2.2 -r1.27.2.3 *** PythonCOM.h 13 Sep 2008 04:26:18 -0000 1.27.2.2 --- PythonCOM.h 2 Nov 2008 12:43:47 -0000 1.27.2.3 *************** *** 284,287 **** --- 284,291 ---- PYCOM_EXPORT BOOL PyObject_AsCurrency(PyObject *ob, CURRENCY *pcy); + // OLEMENUGROUPWIDTHS are used by axcontrol, shell, etc + PYCOM_EXPORT BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths); + PYCOM_EXPORT PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths); + /* Functions for Initializing COM, and also letting the core know about it! */ |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:52
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22520/com/win32com/src Modified Files: Tag: py3k MiscTypes.cpp Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: MiscTypes.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v retrieving revision 1.8.4.1 retrieving revision 1.8.4.2 diff -C2 -d -r1.8.4.1 -r1.8.4.2 *** MiscTypes.cpp 29 Aug 2008 08:27:37 -0000 1.8.4.1 --- MiscTypes.cpp 2 Nov 2008 12:43:47 -0000 1.8.4.2 *************** *** 1,3 **** --- 1,4 ---- // MiscTypes.cpp - misc Python types. + // @doc #include "stdafx.h" #include "PythonCOM.h" *************** *** 285,287 **** --- 286,310 ---- }; + // These aren't really types, but may be some day :) + // @object PyOLEMENUGROUPWIDTHS|Tuple containing 6 ints indicating nbr of options in each menu group + BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths) + { + return PyArg_ParseTuple(oblpMenuWidths, "iiiiii", + &pWidths->width[0], &pWidths->width[1], + &pWidths->width[2], &pWidths->width[3], + &pWidths->width[4], &pWidths->width[5]) != NULL; + } + + PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths) + { + if (!pWidths) { + Py_INCREF(Py_None); + return Py_None; + } + return Py_BuildValue("(iiiiii)", + pWidths->width[0], pWidths->width[1], + pWidths->width[2], pWidths->width[3], + pWidths->width[4], pWidths->width[5]); + } + //////////////////////////////// |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:05
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22442/com/win32com/src/include Modified Files: PyComTypeObjects.h PythonCOM.h Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: PyComTypeObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyComTypeObjects.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyComTypeObjects.h 24 May 2007 06:01:04 -0000 1.5 --- PyComTypeObjects.h 2 Nov 2008 12:42:58 -0000 1.6 *************** *** 1,4 **** ! // Out public converters. PyObject *PyObject_FromFUNCDESC(FUNCDESC *desc); PyObject *PyObject_FromTYPEATTR(TYPEATTR *desc); --- 1,4 ---- ! // Our public converters. PyObject *PyObject_FromFUNCDESC(FUNCDESC *desc); PyObject *PyObject_FromTYPEATTR(TYPEATTR *desc); Index: PythonCOM.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PythonCOM.h 8 Apr 2008 11:51:26 -0000 1.27 --- PythonCOM.h 2 Nov 2008 12:42:58 -0000 1.28 *************** *** 287,290 **** --- 287,294 ---- PYCOM_EXPORT BOOL PyObject_AsCurrency(PyObject *ob, CURRENCY *pcy); + // OLEMENUGROUPWIDTHS are used by axcontrol, shell, etc + PYCOM_EXPORT BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths); + PYCOM_EXPORT PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths); + /* Functions for Initializing COM, and also letting the core know about it! */ |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:05
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22442/com/win32com/src Modified Files: MiscTypes.cpp Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: MiscTypes.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MiscTypes.cpp 14 Mar 2006 12:12:44 -0000 1.8 --- MiscTypes.cpp 2 Nov 2008 12:42:58 -0000 1.9 *************** *** 1,3 **** --- 1,4 ---- // MiscTypes.cpp - misc Python types. + // @doc #include "stdafx.h" #include "PythonCOM.h" *************** *** 293,295 **** --- 294,318 ---- }; + // These aren't really types, but may be some day :) + // @object PyOLEMENUGROUPWIDTHS|Tuple containing 6 ints indicating nbr of options in each menu group + BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths) + { + return PyArg_ParseTuple(oblpMenuWidths, "iiiiii", + &pWidths->width[0], &pWidths->width[1], + &pWidths->width[2], &pWidths->width[3], + &pWidths->width[4], &pWidths->width[5]) != NULL; + } + + PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths) + { + if (!pWidths) { + Py_INCREF(Py_None); + return Py_None; + } + return Py_BuildValue("(iiiiii)", + pWidths->width[0], pWidths->width[1], + pWidths->width[2], pWidths->width[3], + pWidths->width[4], pWidths->width[5]); + } + //////////////////////////////// |
From: Mark H. <mha...@us...> - 2008-11-02 12:43:05
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22442/com/win32comext/shell/src Modified Files: PyIShellBrowser.cpp shell.cpp Log Message: Move OLEMENUGROUPWIDTHS from win32com.shell to pythoncom Index: PyIShellBrowser.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellBrowser.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyIShellBrowser.cpp 18 Aug 2008 13:04:10 -0000 1.10 --- PyIShellBrowser.cpp 2 Nov 2008 12:42:58 -0000 1.11 *************** *** 9,15 **** // --------------------------------------------------- // - extern BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths); - PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *p); - extern BOOL PyObject_AsTBBUTTONs( PyObject *ob, TBBUTTON **ppButtons, UINT *nButtons ); extern void PyObject_FreeTBBUTTONs(TBBUTTON *); --- 9,12 ---- *************** *** 32,36 **** } ! // @pymethod <o PyLPOLEMENUGROUPWIDTHS>|PyIShellBrowser|InsertMenusSB|Updates a composite menu with container's options PyObject *PyIShellBrowser::InsertMenusSB(PyObject *self, PyObject *args) { --- 29,33 ---- } ! // @pymethod <o PyOLEMENUGROUPWIDTHS>|PyIShellBrowser|InsertMenusSB|Updates a composite menu with container's options PyObject *PyIShellBrowser::InsertMenusSB(PyObject *self, PyObject *args) { *************** *** 43,47 **** if ( !PyArg_ParseTuple(args, "OO:InsertMenusSB", &obhmenuShared, // @pyparm <o PyHANDLE>|hmenuShared||Newly created menu that contains no items ! &obMenuWidths)) // @pyparm <o PyLPOLEMENUGROUPWIDTHS>|lpMenuWidths||Tuple of 6 ints. Items 0,2,and 4 are updated when the tuple is returned. return NULL; if (!PyWinObject_AsHANDLE(obhmenuShared, (HANDLE *)&hmenuShared)) --- 40,44 ---- if ( !PyArg_ParseTuple(args, "OO:InsertMenusSB", &obhmenuShared, // @pyparm <o PyHANDLE>|hmenuShared||Newly created menu that contains no items ! &obMenuWidths)) // @pyparm <o PyOLEMENUGROUPWIDTHS>|lpMenuWidths||Tuple of 6 ints. Items 0,2,and 4 are updated when the tuple is returned. return NULL; if (!PyWinObject_AsHANDLE(obhmenuShared, (HANDLE *)&hmenuShared)) Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** shell.cpp 18 Aug 2008 13:01:43 -0000 1.68 --- shell.cpp 2 Nov 2008 12:42:58 -0000 1.69 *************** *** 892,916 **** } - // @object PyLPOLEMENUGROUPWIDTHS|Tuple containing 6 ints indicating nbr of options in each menu group - BOOL PyObject_AsOLEMENUGROUPWIDTHS( PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths) - { - return PyArg_ParseTuple(oblpMenuWidths, "iiiiii", - &pWidths->width[0], &pWidths->width[1], - &pWidths->width[2], &pWidths->width[3], - &pWidths->width[4], &pWidths->width[5]) != NULL; - } - - PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *pWidths) - { - if (!pWidths) { - Py_INCREF(Py_None); - return Py_None; - } - return Py_BuildValue("(iiiiii)", - pWidths->width[0], pWidths->width[1], - pWidths->width[2], pWidths->width[3], - pWidths->width[4], pWidths->width[5]); - } - static BOOL MakeDoubleTerminatedStringList(PyObject *ob, TCHAR **ret) { --- 892,895 ---- |
From: Mark H. <mha...@us...> - 2008-11-02 12:14:48
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19534 Modified Files: Tag: py3k CHANGES.txt Log Message: Merge missing change notes from trunk Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.2 diff -C2 -d -r1.26.2.1 -r1.26.2.2 *** CHANGES.txt 2 Nov 2008 11:52:02 -0000 1.26.2.1 --- CHANGES.txt 2 Nov 2008 12:14:41 -0000 1.26.2.2 *************** *** 13,16 **** --- 13,23 ---- and OleTranslateAccelerator function. + * MsgWaitForMultipleObjectsEx() would crash in all cases. Fix from + Ziga Seilnacht via [2141368]. + + * pywintypes.error and com_error get support for attributes as + well as indexing (ie, exc.winerror can now be used in place of exc[0].) + See the help file for details on the attribute names. + * MAPI gets support for IMAPIAdviseSink |
From: Mark H. <mha...@us...> - 2008-11-02 11:52:08
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17542 Modified Files: Tag: py3k setup.py CHANGES.txt Log Message: win32com.axcontrol gets support for interfaces OleControlSite, OleInPlaceActiveObject, OleInPlaceFrame and OleInPlaceUIWindow interfaces and OleTranslateAccelerator function. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.81.2.3 retrieving revision 1.81.2.4 diff -C2 -d -r1.81.2.3 -r1.81.2.4 *** setup.py 1 Oct 2008 13:08:17 -0000 1.81.2.3 --- setup.py 2 Nov 2008 11:52:02 -0000 1.81.2.4 *************** *** 1535,1540 **** WinExt_win32com('axcontrol', pch_header="axcontrol_pch.h", sources=(""" ! %(axcontrol)s/AXControl.cpp %(axcontrol)s/PyIOleControl.cpp %(axcontrol)s/PyIOleInPlaceSiteEx.cpp %(axcontrol)s/PyISpecifyPropertyPages.cpp %(axcontrol)s/PyIObjectWithSite.cpp %(axcontrol)s/PyIOleInPlaceObject.cpp %(axcontrol)s/PyIOleInPlaceSiteWindowless.cpp %(axcontrol)s/PyIViewObject.cpp --- 1535,1543 ---- WinExt_win32com('axcontrol', pch_header="axcontrol_pch.h", sources=(""" ! %(axcontrol)s/AXControl.cpp ! %(axcontrol)s/PyIOleControl.cpp %(axcontrol)s/PyIOleControlSite.cpp ! %(axcontrol)s/PyIOleInPlaceActiveObject.cpp %(axcontrol)s/PyIOleInPlaceSiteEx.cpp %(axcontrol)s/PyISpecifyPropertyPages.cpp + %(axcontrol)s/PyIOleInPlaceUIWindow.cpp %(axcontrol)s/PyIOleInPlaceFrame.cpp %(axcontrol)s/PyIObjectWithSite.cpp %(axcontrol)s/PyIOleInPlaceObject.cpp %(axcontrol)s/PyIOleInPlaceSiteWindowless.cpp %(axcontrol)s/PyIViewObject.cpp Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -C2 -d -r1.26 -r1.26.2.1 *** CHANGES.txt 10 Aug 2008 13:13:20 -0000 1.26 --- CHANGES.txt 2 Nov 2008 11:52:02 -0000 1.26.2.1 *************** *** 9,12 **** --- 9,16 ---- ---------------- + * win32com.axcontrol gets support for interfaces OleControlSite, + OleInPlaceActiveObject, OleInPlaceFrame and OleInPlaceUIWindow interfaces + and OleTranslateAccelerator function. + * MAPI gets support for IMAPIAdviseSink |