pywin32-checkins Mailing List for Python for Windows Extensions (Page 7)
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: <pyw...@li...> - 2012-01-02 02:05:17
|
changeset a341ce8e7989 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=a341ce8e7989 summary: allow win32ui object attributes to appear in autocomplete list changeset 95c5dde755c2 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=95c5dde755c2 summary: add more LOGON32_* contants - from Dieter Verfaillie via 3439279 changeset 9b3d4f355d25 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=9b3d4f355d25 summary: add history for pythonwin search&replace dialog. #3468280 diffstat: CHANGES.txt | 3 +++ Pythonwin/pywin/scintilla/find.py | 38 +++++++++++++++++++++++++++++++------- Pythonwin/pywin/scintilla/view.py | 8 ++++++++ win32/Lib/win32con.py | 6 ++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diffs (143 lines): diff -r 95b4f896b100 -r 9b3d4f355d25 CHANGES.txt --- a/CHANGES.txt Mon Jan 02 12:40:31 2012 +1100 +++ b/CHANGES.txt Mon Jan 02 13:03:39 2012 +1100 @@ -6,6 +6,9 @@ Since build 216: ---------------- +* The Pythonwin editor now remembers previous searches made in this session. + (patch #3468280 from kxroberto). + * The LOGFONT struct implementation (win32util) was extended to support the full LOGFONT struct as published by Microsoft. This includes changes to win32util.LogFontToDict and win32util.DictToLogFont. (Feature request diff -r 95b4f896b100 -r 9b3d4f355d25 Pythonwin/pywin/scintilla/find.py --- a/Pythonwin/pywin/scintilla/find.py Mon Jan 02 12:40:31 2012 +1100 +++ b/Pythonwin/pywin/scintilla/find.py Mon Jan 02 13:03:39 2012 +1100 @@ -31,6 +31,7 @@ curDialog = None lastSearch = defaultSearch = SearchParams() +searchHistory = [] def ShowFindDialog(): _ShowDialog(FindDialog) @@ -143,6 +144,17 @@ if lastSearch.remember: defaultSearch = lastSearch + + # track search history + try: + ix = searchHistory.index(searchParams.findText) + except ValueError: + if len(searchHistory) > 50: + searchHistory[50:] = [] + else: + del searchHistory[ix] + searchHistory.insert(0, searchParams.findText) + return rc def _ReplaceIt(control): @@ -181,8 +193,13 @@ self.editFindText.SetWindowText(sel) if (defaultSearch.remember): defaultSearch.findText = sel + for hist in searchHistory: + self.editFindText.AddString(hist) - self.editFindText.SetSel(0, -2) + if hasattr(self.editFindText, 'SetEditSel'): + self.editFindText.SetEditSel(0, -2) + else: + self.editFindText.SetSel(0, -2) self.editFindText.SetFocus() self.butMatchWords.SetCheck(defaultSearch.matchWords) self.butMatchCase.SetCheck(defaultSearch.matchCase) @@ -209,8 +226,9 @@ if not self.editFindText.GetWindowText(): win32api.MessageBeep() return - if self.DoFindNext() != FOUND_NOTHING and not self.butKeepDialogOpen.GetCheck(): - self.DestroyWindow() + if self.DoFindNext() != FOUND_NOTHING: + if not self.butKeepDialogOpen.GetCheck(): + self.DestroyWindow() class FindDialog(FindReplaceDialog): def _GetDialogTemplate(self): @@ -219,7 +237,8 @@ dt = [ ["Find", (0, 2, 240, 75), style, None, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], - ["Edit", "", 102, (50, 7, 120, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], + ["ComboBox", "", 102, (50, 7, 120, 120), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | + win32con.WS_VSCROLL |win32con.CBS_DROPDOWN |win32con.CBS_AUTOHSCROLL], ["Button", "Match &whole word only", 105, (5, 23, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], ["Button", "Match &case", 107, (5, 33, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], ["Button", "Keep &dialog open", 115, (5, 43, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], @@ -237,9 +256,11 @@ dt = [ ["Replace", (0, 2, 240, 95), style, 0, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], - ["Edit", "", 102, (60, 7, 110, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], + ["ComboBox", "", 102, (60, 7, 110, 120), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | + win32con.WS_VSCROLL |win32con.CBS_DROPDOWN |win32con.CBS_AUTOHSCROLL], ["Static", "Re&place with:", 103, (5, 25, 50, 10), visible], - ["Edit", "", 104, (60, 24, 110, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], + ["ComboBox", "", 104, (60, 24, 110, 120), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | + win32con.WS_VSCROLL |win32con.CBS_DROPDOWN |win32con.CBS_AUTOHSCROLL], ["Button", "Match &whole word only", 105, (5, 42, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], ["Button", "Match &case", 107, (5, 52, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], ["Button", "Keep &dialog open", 115, (5, 62, 100, 10), visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP], @@ -261,7 +282,10 @@ self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) self.editReplaceText = self.GetDlgItem(104) self.editReplaceText.SetWindowText(lastSearch.replaceText) - self.editReplaceText.SetSel(0, -2) + if hasattr(self.editReplaceText, 'SetEditSel'): + self.editReplaceText.SetEditSel(0, -2) + else: + self.editReplaceText.SetSel(0, -2) self.butReplace = self.GetDlgItem(110) self.butReplaceAll = self.GetDlgItem(111) self.CheckButtonStates() diff -r 95b4f896b100 -r 9b3d4f355d25 Pythonwin/pywin/scintilla/view.py --- a/Pythonwin/pywin/scintilla/view.py Mon Jan 02 12:40:31 2012 +1100 +++ b/Pythonwin/pywin/scintilla/view.py Mon Jan 02 13:03:39 2012 +1100 @@ -406,6 +406,14 @@ items_dict = {} if ob is not None: try: # Catch unexpected errors when fetching attribute names from the object + # extra attributes of win32ui objects + if hasattr(ob, "_obj_"): + try: + items_dict.update(list2dict(dir(ob._obj_))) + except AttributeError: + pass # object has no __dict__ + + # normal attributes try: items_dict.update(list2dict(dir(ob))) except AttributeError: diff -r 95b4f896b100 -r 9b3d4f355d25 win32/Lib/win32con.py --- a/win32/Lib/win32con.py Mon Jan 02 12:40:31 2012 +1100 +++ b/win32/Lib/win32con.py Mon Jan 02 13:03:39 2012 +1100 @@ -4696,10 +4696,16 @@ MOVEFILE_DELAY_UNTIL_REBOOT = 4 MAX_COMPUTERNAME_LENGTH = 15 LOGON32_LOGON_INTERACTIVE = 2 +LOGON32_LOGON_NETWORK = 3 LOGON32_LOGON_BATCH = 4 LOGON32_LOGON_SERVICE = 5 +LOGON32_LOGON_UNLOCK = 7 +LOGON32_LOGON_NETWORK_CLEARTEXT = 8 +LOGON32_LOGON_NEW_CREDENTIALS = 9 LOGON32_PROVIDER_DEFAULT = 0 LOGON32_PROVIDER_WINNT35 = 1 +LOGON32_PROVIDER_WINNT40 = 2 +LOGON32_PROVIDER_WINNT50 = 3 VER_PLATFORM_WIN32s = 0 VER_PLATFORM_WIN32_WINDOWS = 1 VER_PLATFORM_WIN32_NT = 2 |
|
From: <pyw...@li...> - 2012-01-02 01:41:56
|
changeset 95b4f896b100 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=95b4f896b100 summary: fix some refcount edge cases, from kxroberto via #3440738 diffstat: Pythonwin/win32assoc.cpp | 6 ++++-- Pythonwin/win32cmd.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diffs (46 lines): diff -r dbbfddbcc824 -r 95b4f896b100 Pythonwin/win32assoc.cpp --- a/Pythonwin/win32assoc.cpp Sun Jan 01 14:01:21 2012 -0500 +++ b/Pythonwin/win32assoc.cpp Mon Jan 02 12:40:31 2012 +1100 @@ -225,14 +225,16 @@ // decref of the instance may trigger instance delete, // which may trigger AttachObject(None), which will // attempt to decref etc. - // So set the instance to NULL _before_ we decref it! + // So set the instance to NULL _before_ we decref it, and only + // do the decref after we've incref'd the new object - if it is the + // same object we may otherwise transition it via a refcount of 0. PyObject *old = pAssoc->virtualInst; pAssoc->virtualInst = NULL; - XDODECREF(old); if (ob!=Py_None) { pAssoc->virtualInst = ob; DOINCREF(ob); } + XDODECREF(old); RETURN_NONE; } diff -r dbbfddbcc824 -r 95b4f896b100 Pythonwin/win32cmd.cpp --- a/Pythonwin/win32cmd.cpp Sun Jan 01 14:01:21 2012 -0500 +++ b/Pythonwin/win32cmd.cpp Mon Jan 02 12:40:31 2012 +1100 @@ -208,8 +208,10 @@ RETURN_ERR("The parameter must be a callable object or None"); void *oldMethod = NULL; - // note I maybe decref, then maybe incref. I assume object wont be destroyed - // (ie, ref go to zero) between the 2 calls!) + // note I maybe decref, then maybe incref. To ensure the object will + // not be destroyed (ie, ref go to zero) between the 2 calls), I + // add a temporary reference first. + DOINCREF(hookedObject); if (pList->Lookup(message, oldMethod)) { pList->RemoveKey(message); // oldMethod is returned - don't drop its reference. @@ -220,6 +222,7 @@ pList->SetAt(message,method); Py_INCREF(hookedObject); } + DODECREF(hookedObject); // remove temp reference added above. if (oldMethod) return (PyObject *)oldMethod; else |
|
From: <pyw...@li...> - 2012-01-01 19:04:11
|
changeset dbbfddbcc824 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=dbbfddbcc824 summary: Fix crash in PyWinObject_AsTV_ITEM (bug #3462537) diffstat: Pythonwin/win32util.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 45a594f4e6b0 -r dbbfddbcc824 Pythonwin/win32util.cpp --- a/Pythonwin/win32util.cpp Tue Nov 15 08:51:58 2011 -0500 +++ b/Pythonwin/win32util.cpp Sun Jan 01 14:01:21 2012 -0500 @@ -642,7 +642,7 @@ ob=PyTuple_GET_ITEM(args, 0); if (ob != Py_None) { // @tupleitem 0|int|hItem|Item handle - if (!PyWinObject_AsHANDLE(ob, (HANDLE *)pItem->hItem)) + if (!PyWinObject_AsHANDLE(ob, (HANDLE *)&pItem->hItem)) return FALSE; pItem->mask |= TVIF_HANDLE; } |
|
From: <pyw...@li...> - 2011-11-15 13:52:12
|
changeset 45a594f4e6b0 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=45a594f4e6b0 summary: Updated tests in win32timezone to pass under Python 3 and with the newer, UTC-named, timezone definitions diffstat: win32/Lib/win32timezone.py | 58 +++++++++++++++++++++++----------------------- 1 files changed, 29 insertions(+), 29 deletions(-) diffs (203 lines): diff -r bd38bb2a66c4 -r 45a594f4e6b0 win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Wed Mar 09 00:07:01 2011 +0100 +++ b/win32/Lib/win32timezone.py Tue Nov 15 08:51:58 2011 -0500 @@ -59,11 +59,11 @@ >>> est = win32timezone.TimeZoneInfo('Eastern Standard Time') >>> str(est.displayName) -'(GMT-05:00) Eastern Time (US & Canada)' +'(UTC-05:00) Eastern Time (US & Canada)' >>> gmt = win32timezone.TimeZoneInfo('GMT Standard Time', True) >>> str(gmt.displayName) -'(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' +'(UTC) Dublin, Edinburgh, Lisbon, London' To get the complete list of available time zone keys, >>> zones = win32timezone.TimeZoneInfo.get_all_time_zones() @@ -147,7 +147,7 @@ True This test helps ensure language support for unicode characters ->>> x = TIME_ZONE_INFORMATION(0, 'fran\xc3\xa7ais'.decode('utf-8')) +>>> x = TIME_ZONE_INFORMATION(0, 'français') """ from __future__ import generators @@ -215,12 +215,12 @@ _fields_ = [ ('year', int), ('month', int), - ('day_of_week', int), - ('day', int), - ('hour', int), - ('minute', int), - ('second', int), - ('millisecond', int), + ('day_of_week', int), + ('day', int), + ('hour', int), + ('minute', int), + ('second', int), + ('millisecond', int), ] class TIME_ZONE_INFORMATION(_SimpleStruct): @@ -245,7 +245,7 @@ """ A time zone definition class based on the win32 DYNAMIC_TIME_ZONE_INFORMATION structure. - + Describes a bias against UTC (bias), and two dates at which a separate additional bias applies (standard_bias and daylight_bias). """ @@ -268,13 +268,13 @@ return except TypeError: pass - + try: self.__init_from_bytes(*args, **kwargs) return except TypeError: pass - + raise TypeError("Invalid arguments for %s" % self.__class__) def __init_from_bytes(self, bytes, standard_name='', daylight_name='', key_name='', daylight_disabled=False): @@ -458,7 +458,7 @@ # 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.standard_bias @@ -487,7 +487,7 @@ try: dstStart = self.GetDSTStartTime(dt.year) dstEnd = self.GetDSTEndTime(dt.year) - + if dstStart < dstEnd: inDaylightSavings = dstStart <= dt.replace(tzinfo=None) < dstEnd else: @@ -508,7 +508,7 @@ def GetDSTEndTime(self, year): "Given a year, determines the time when daylight savings ends." return self.getWinInfo(year).locate_standard_start(year) - + def __cmp__(self, other): return cmp(self.__dict__, other.__dict__) @@ -532,7 +532,7 @@ >>> now_UTC = now_UTC.replace(tzinfo = TimeZoneInfo('GMT Standard Time', True)) - Now one can compare the results of the two offset aware values + Now one can compare the results of the two offset aware values >>> (now_UTC - now_local) < datetime.timedelta(seconds = 5) True """ @@ -551,7 +551,7 @@ Same as TimeZoneInfo('GMT Standard Time', True) but caches the result for performance. - + >>> isinstance(TimeZoneInfo.utc(), TimeZoneInfo) True """ @@ -572,7 +572,7 @@ def _get_time_zone_key_names(): "Returns the names of the (registry keys of the) time zones" return TimeZoneInfo._get_time_zone_key().subkeys() - + @staticmethod def _get_indexed_time_zone_keys(index_key='Index'): """ @@ -615,18 +615,18 @@ dict.__init__(self) self.key = key self.__load_values() - + @classmethod def open(cls, *args, **kargs): return _RegKeyDict(_winreg.OpenKeyEx(*args, **kargs)) - + def subkey(self, name): return _RegKeyDict(_winreg.OpenKeyEx(self.key, name)) - + def __load_values(self): pairs = [(n, v) for (n, v, t) in self._enumerate_reg_values(self.key)] self.update(pairs) - + def subkeys(self): return self._enumerate_reg_keys(self.key) @@ -637,7 +637,7 @@ @staticmethod def _enumerate_reg_keys(key): return _RegKeyDict._enumerate_reg(key, _winreg.EnumKey) - + @staticmethod def _enumerate_reg(key, func): "Enumerates an open registry key as an iterable generator" @@ -645,8 +645,8 @@ for index in count(): yield func(key, index) except WindowsError: pass - - + + # for backward compatibility def deprecated(func, name='Unknown'): """This is a decorator which can be used to mark functions @@ -694,7 +694,7 @@ 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): @@ -704,7 +704,7 @@ key = filename.lower() return self.__cache.setdefault(key, win32api.LoadLibrary(key)) -DLLCache = DLLHandleCache() +DLLCache = DLLHandleCache() def resolveMUITimeZone(spec): """Resolve a multilingual user interface resource for the time zone name @@ -716,7 +716,7 @@ >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] >>> type(result) is expectedResultType True - + spec should be of the format @path,-stringID[;comment] see http://msdn2.microsoft.com/en-us/library/ms725481.aspx for details """ @@ -773,7 +773,7 @@ >>> r.bounds() (0, 6) - + """ def __init__(self, source, keySortComparator = ascending, keyMatchComparator = operator.le): dict.__init__(self, source) |
|
From: <pyw...@li...> - 2011-11-06 04:56:29
|
changeset bd38bb2a66c4 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=bd38bb2a66c4 summary: Corrected invalid FILE_ATTRIBUTE_ENCRYPTED attribute. diffstat: win32/Lib/winnt.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (21 lines): diff -r 2113b637ed40 -r bd38bb2a66c4 win32/Lib/winnt.py --- a/win32/Lib/winnt.py Sat Nov 05 16:21:59 2011 +1100 +++ b/win32/Lib/winnt.py Wed Mar 09 00:07:01 2011 +0100 @@ -308,13 +308,16 @@ FILE_ATTRIBUTE_SYSTEM = 4 FILE_ATTRIBUTE_DIRECTORY = 16 FILE_ATTRIBUTE_ARCHIVE = 32 -FILE_ATTRIBUTE_ENCRYPTED = 64 +FILE_ATTRIBUTE_DEVICE = 64 FILE_ATTRIBUTE_NORMAL = 128 FILE_ATTRIBUTE_TEMPORARY = 256 FILE_ATTRIBUTE_SPARSE_FILE = 512 FILE_ATTRIBUTE_REPARSE_POINT = 1024 FILE_ATTRIBUTE_COMPRESSED = 2048 FILE_ATTRIBUTE_OFFLINE = 4096 +FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192 +FILE_ATTRIBUTE_ENCRYPTED = 16384 +FILE_ATTRIBUTE_VIRTUAL = 65536 FILE_NOTIFY_CHANGE_FILE_NAME = 1 FILE_NOTIFY_CHANGE_DIR_NAME = 2 FILE_NOTIFY_CHANGE_ATTRIBUTES = 4 |
|
From: <pyw...@li...> - 2011-11-05 05:23:21
|
changeset 2113b637ed40 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=2113b637ed40 summary: full LOGFONT support in win32ui, from Kris Hardy diffstat: CHANGES.txt | 4 ++++ Pythonwin/win32font.cpp | 18 ++++++++++++------ Pythonwin/win32util.cpp | 49 +++++++++++++++++++++++++++++++------------------ 3 files changed, 47 insertions(+), 24 deletions(-) diffs (127 lines): diff -r 86f428f44fca -r 2113b637ed40 CHANGES.txt --- a/CHANGES.txt Sat Nov 05 14:41:55 2011 +1100 +++ b/CHANGES.txt Sat Nov 05 16:21:59 2011 +1100 @@ -6,6 +6,10 @@ Since build 216: ---------------- +* The LOGFONT struct implementation (win32util) was extended to support the + full LOGFONT struct as published by Microsoft. This includes changes to + win32util.LogFontToDict and win32util.DictToLogFont. (Feature request + 3433757 by Kris Hardy) * Remove some duplicated menu code from pythonwin which should avoid having py2exe pulling in most of the pythonwin framework in some cases diff -r 86f428f44fca -r 2113b637ed40 Pythonwin/win32font.cpp --- a/Pythonwin/win32font.cpp Sat Nov 05 14:41:55 2011 +1100 +++ b/Pythonwin/win32font.cpp Sat Nov 05 16:21:59 2011 +1100 @@ -27,14 +27,20 @@ PyObject *font_props; PyObject *pydc = NULL; // @pyparm dict|properties||A dictionary containing the font // properties. Valid dictionary keys are:<nl> - // name<nl> - // width<nl> - // height<nl> - // weight<nl> - // italic<nl> + // height<nl> + // width<nl> + // escapement<nl> + // orientation<nl> + // weight<nl> + // italic<nl> // underline<nl> + // strike out<nl> + // charset<nl> + // out precision<nl> + // clip precision<nl> + // quality<nl> // pitch and family<nl> - // charset + // name if (!PyArg_ParseTuple (args, "O|O", &font_props, &pydc) || !PyDict_Check (font_props)) diff -r 86f428f44fca -r 2113b637ed40 Pythonwin/win32util.cpp --- a/Pythonwin/win32util.cpp Sat Nov 05 14:41:55 2011 +1100 +++ b/Pythonwin/win32util.cpp Sat Nov 05 16:21:59 2011 +1100 @@ -240,38 +240,48 @@ // Font conversion utilities // // -static char *szFontQuality = "quality"; -static char *szFontName = "name"; +static char *szFontHeight = "height"; +static char *szFontWidth = "width"; +static char *szFontEscapement = "escapement"; +static char *szFontOrientation = "orientation"; static char *szFontWeight = "weight"; -static char *szFontWidth = "width"; -static char *szFontHeight = "height"; static char *szFontItalic = "italic"; static char *szFontUnderline = "underline"; +static char *szFontStrikeOut = "strike out"; +static char *szFontCharSet = "charset"; +static char *szFontOutPrecision = "out precision"; +static char *szFontClipPrecision = "clip precision"; +static char *szFontQuality = "quality"; static char *szFontPitch = "pitch and family"; -static char *szFontCharSet = "charset"; +static char *szFontName = "name"; PyObject *LogFontToDict(const LOGFONT &lf) { - // ??? This is missing a lot of members ??? - return Py_BuildValue("{s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N}", - szFontQuality, PyInt_FromLong(lf.lfQuality), - szFontName, PyWinObject_FromTCHAR(lf.lfFaceName), + return Py_BuildValue("{s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N}", szFontHeight, PyInt_FromLong(lf.lfHeight), szFontWidth, PyInt_FromLong(lf.lfWidth), + szFontEscapement, PyInt_FromLong(lf.lfEscapement), + szFontOrientation, PyInt_FromLong(lf.lfOrientation), szFontWeight, PyInt_FromLong(lf.lfWeight), + szFontItalic, PyBool_FromLong(lf.lfItalic), + szFontUnderline, PyBool_FromLong(lf.lfUnderline), + szFontStrikeOut, PyBool_FromLong(lf.lfStrikeOut), + szFontCharSet, PyInt_FromLong(lf.lfCharSet), + szFontOutPrecision, PyInt_FromLong(lf.lfOutPrecision), + szFontClipPrecision, PyInt_FromLong(lf.lfClipPrecision), + szFontQuality, PyInt_FromLong(lf.lfQuality), szFontPitch, PyInt_FromLong(lf.lfPitchAndFamily), - szFontCharSet, PyInt_FromLong(lf.lfCharSet), - szFontUnderline, PyBool_FromLong(lf.lfUnderline), - szFontItalic, PyBool_FromLong(lf.lfItalic)); + szFontName, PyWinObject_FromTCHAR(lf.lfFaceName)); } BOOL DictToLogFont(PyObject *font_props, LOGFONT *pLF) { ZeroMemory (pLF, sizeof(LOGFONT)); static char *keywords[]={ - szFontQuality, szFontName, szFontHeight, szFontWidth, szFontWeight, - szFontPitch, szFontCharSet, szFontUnderline, szFontItalic, NULL - }; + szFontHeight, szFontWidth, szFontEscapement, szFontOrientation, + szFontWeight, szFontItalic, szFontUnderline, szFontStrikeOut, + szFontCharSet, szFontOutPrecision, szFontClipPrecision, + szFontQuality, szFontPitch, szFontName, NULL}; // font default values pLF->lfCharSet = DEFAULT_CHARSET; // dont use ANSI_CHARSET to support Japanese charset. @@ -288,9 +298,12 @@ if (!dummy_tuple) return FALSE; - if (!PyArg_ParseTupleAndKeywords(dummy_tuple, font_props, "|bOlllbbbb:LOGFONT", keywords, - &pLF->lfQuality, &obFontName, &pLF->lfHeight, &pLF->lfWidth, &pLF->lfWeight, - &pLF->lfPitchAndFamily, &pLF->lfCharSet, &pLF->lfUnderline, &pLF->lfItalic)){ + if (!PyArg_ParseTupleAndKeywords(dummy_tuple, font_props, + "|lllllbbbbbbbbO:LOGFONT", keywords, &pLF->lfHeight, &pLF->lfWidth, + &pLF->lfEscapement, &pLF->lfOrientation, &pLF->lfWeight, + &pLF->lfItalic, &pLF->lfUnderline, &pLF->lfStrikeOut, + &pLF->lfCharSet, &pLF->lfOutPrecision, &pLF->lfClipPrecision, + &pLF->lfQuality, &pLF->lfPitchAndFamily, &obFontName)){ Py_DECREF(dummy_tuple); return FALSE; } |
|
From: <pyw...@li...> - 2011-11-05 03:42:52
|
changeset 86f428f44fca in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=86f428f44fca summary: remove duplicated menu code which pulls in extra deps with py2exe etc diffstat: CHANGES.txt | 7 ++++++- Pythonwin/pywin/mfc/docview.py | 8 +------- 2 files changed, 7 insertions(+), 8 deletions(-) diffs (43 lines): diff -r bda8b9f07486 -r 86f428f44fca CHANGES.txt --- a/CHANGES.txt Sat Oct 22 18:08:01 2011 +1100 +++ b/CHANGES.txt Sat Nov 05 14:41:55 2011 +1100 @@ -6,6 +6,11 @@ Since build 216: ---------------- + +* Remove some duplicated menu code from pythonwin which should avoid + having py2exe pulling in most of the pythonwin framework in some cases + (patch 3433527 from kxroberto.) + * A new win32com.client.VARIANT object can be used for advanced control over the parameter types passed to some COM methods. See the documentation in win32com/HTML/variant.html (also included in the help file) @@ -18,7 +23,7 @@ * Pythonwin now warns, but allows you to continue, when saving a file with an invalid encoding line (bug 3139486) -* Fix win32com.client.WithEvents on py3k (bug bug 3199843) +* Fix win32com.client.WithEvents on py3k (bug 3199843) * When passing integers/unsigned integers to COM objects which did not fit into 32bits, OverflowErrors were silently discarded and -1 was silently diff -r bda8b9f07486 -r 86f428f44fca Pythonwin/pywin/mfc/docview.py --- a/Pythonwin/pywin/mfc/docview.py Sat Oct 22 18:08:01 2011 +1100 +++ b/Pythonwin/pywin/mfc/docview.py Sat Nov 05 14:41:55 2011 +1100 @@ -69,14 +69,8 @@ self.MakeFrame=MakeFrame self.MakeView=MakeView self._SetupSharedMenu_() -# todo - _SetupSharedMenu should be moved to a framework class. def _SetupSharedMenu_(self): - sharedMenu = self.GetSharedMenu() - from pywin.framework import toolmenu - toolmenu.SetToolsMenu(sharedMenu) - from pywin.framework import help - help.SetHelpMenuOtherHelp(sharedMenu) - + pass # to be overridden by each "app" def _CreateDocTemplate(self, resourceId): return win32ui.CreateDocTemplate(resourceId) def __del__(self): |
|
From: <pyw...@li...> - 2011-10-22 07:08:56
|
changeset bda8b9f07486 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=bda8b9f07486 summary: more 64bit fixes diffstat: win32/Lib/win32gui_struct.py | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diffs (90 lines): diff -r 8ef9f05f12af -r bda8b9f07486 win32/Lib/win32gui_struct.py --- a/win32/Lib/win32gui_struct.py Thu Oct 13 11:42:49 2011 +1100 +++ b/win32/Lib/win32gui_struct.py Sat Oct 22 18:08:01 2011 +1100 @@ -48,6 +48,14 @@ def _MakeResult(names_str, values): return values +_nmhdr_fmt = "PPi" +if is64bit: + # When the item past the NMHDR gets aligned (eg, when it is a struct) + # we need this many bytes padding. + _nmhdr_align_padding = "xxxx" +else: + _nmhdr_align_padding = "" + # Encode a string suitable for passing in a win32gui related structure # If win32gui is built with UNICODE defined (ie, py3k), then functions # like InsertMenuItem are actually calling InsertMenuItemW etc, so all @@ -91,12 +99,13 @@ return _MakeResult("WMNOTIFY hwndFrom idFrom code", struct.unpack(format, buf)) def UnpackNMITEMACTIVATE(lparam): + format = _nmhdr_fmt + _nmhdr_align_padding if is64bit: # the struct module doesn't handle this correctly as some of the items # are actually structs in structs, which get individually aligned. - format = "PPixxxxiiiiiiixxxxP" + format = format + "iiiiiiixxxxP" else: - format = "PPiiiiiiiiP" + format = format + "iiiiiiiP" buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) return _MakeResult("NMITEMACTIVATE hwndFrom idFrom code iItem iSubItem uNewState uOldState uChanged actionx actiony lParam", struct.unpack(format, buf)) @@ -410,7 +419,13 @@ # Unpack the lparm from a "TVNOTIFY" message def UnpackTVNOTIFY(lparam): - format = "Piii40s40s" + item_size = struct.calcsize(_tvitem_fmt) + format = _nmhdr_fmt + _nmhdr_align_padding + if is64bit: + format = format + "ixxxx" + else: + format = format + "i" + format = format + "%ds%ds" % (item_size, item_size) buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, action, buf_old, buf_new \ = struct.unpack(format, buf) @@ -420,7 +435,8 @@ (hwndFrom, id, code, action, item_old, item_new)) def UnpackTVDISPINFO(lparam): - format = "Pii40s" + item_size = struct.calcsize(_tvitem_fmt) + format = "PPi%ds" % (item_size,) buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, buf_item = struct.unpack(format, buf) item = UnpackTVITEM(buf_item) @@ -489,7 +505,8 @@ # Unpack an "LVNOTIFY" message def UnpackLVDISPINFO(lparam): - format = "Pii40s" + item_size = struct.calcsize(_lvitem_fmt) + format = _nmhdr_fmt + _nmhdr_align_padding + ("%ds" % (item_size,)) buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, buf_item = struct.unpack(format, buf) item = UnpackLVITEM(buf_item) @@ -497,7 +514,10 @@ (hwndFrom, id, code, item)) def UnpackLVNOTIFY(lparam): - format = "Pii7iP" + format = _nmhdr_fmt + _nmhdr_align_padding + "7i" + if is64bit: + format = format + "xxxx" # point needs padding. + format = format + "P" buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, item, subitem, newstate, oldstate, \ changed, pt_x, pt_y, lparam = struct.unpack(format, buf) @@ -621,7 +641,7 @@ text_addr, _ = text_buffer.buffer_info() text_len = len(text) - format = "iiPPiiiiiii" + format = "iiPPiiPiiii" buf = struct.pack(format, mask, cxy, text_addr, hbm, text_len, fmt, param, image, order, 0, 0) |
|
From: <pyw...@li...> - 2011-10-13 00:43:43
|
changeset 8ef9f05f12af in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=8ef9f05f12af summary: minor typo in new variant docs diffstat: com/win32com/HTML/variant.html | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 36b16bcc5c9a -r 8ef9f05f12af com/win32com/HTML/variant.html --- a/com/win32com/HTML/variant.html Wed Oct 12 12:12:12 2011 +1100 +++ b/com/win32com/HTML/variant.html Thu Oct 13 11:42:49 2011 +1100 @@ -80,7 +80,7 @@ </pre> However, if makepy support is not available the method does not work as -expected. For the next example we will use <code>DumpDispatch</code> to +expected. For the next example we will use <code>DumbDispatch</code> to simulate the object not having a type-library. <pre> |
|
From: <pyw...@li...> - 2011-10-12 01:15:46
|
changeset b9780b123a70 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=b9780b123a70 summary: minor doc tweak changeset 4074de7baf6f in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=4074de7baf6f summary: fix win32pipe builds with the new unified swig changeset 0c3b3be90017 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=0c3b3be90017 summary: refactor testPyComTest to avoid duplicated code and ensure better test coverage changeset 36b16bcc5c9a in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=36b16bcc5c9a summary: Add VARIANT object so explicit variant types can be specified in some contexts diffstat: AutoDuck/pywin32-document.xml | 2 +- CHANGES.txt | 3 + com/win32com/HTML/docindex.html | 1 + com/win32com/HTML/variant.html | 162 ++++++++++++ com/win32com/client/__init__.py | 23 + com/win32com/readme.htm | 6 + com/win32com/src/PyIDispatch.cpp | 45 ++- com/win32com/src/include/PythonCOM.h | 1 + com/win32com/src/oleargs.cpp | 107 ++++++++- com/win32com/test/testPyComTest.py | 438 ++++++++++++++++++++-------------- win32/src/win32pipe.i | 14 +- 11 files changed, 593 insertions(+), 209 deletions(-) diffs (truncated from 1124 to 300 lines): diff -r d812236c54bc -r 36b16bcc5c9a AutoDuck/pywin32-document.xml --- a/AutoDuck/pywin32-document.xml Tue Oct 11 17:06:16 2011 +1100 +++ b/AutoDuck/pywin32-document.xml Wed Oct 12 12:12:12 2011 +1100 @@ -19,7 +19,7 @@ </category> <category id="com" label="Python COM"> <overviews> - <item name="Quick-Starts to Python and COM" href="com/win32com/HTML/docindex.html"/> + <item name="win32com documentation index" href="com/win32com/HTML/docindex.html"/> <item name="win32com readme" href="com/win32com/readme.htm"/> <item name="ADSI Python" href="com/help/adsi.html"/> <item name="Active Directory" href="com/help/active_directory.html"/> diff -r d812236c54bc -r 36b16bcc5c9a CHANGES.txt --- a/CHANGES.txt Tue Oct 11 17:06:16 2011 +1100 +++ b/CHANGES.txt Wed Oct 12 12:12:12 2011 +1100 @@ -6,6 +6,9 @@ Since build 216: ---------------- +* A new win32com.client.VARIANT object can be used for advanced control over + the parameter types passed to some COM methods. See the documentation in + win32com/HTML/variant.html (also included in the help file) * The win32com.adsi and win32com.mapi packages have been upgraded to work on Python 3.x and as a result, there is a slight risk that regressions to diff -r d812236c54bc -r 36b16bcc5c9a com/win32com/HTML/docindex.html --- a/com/win32com/HTML/docindex.html Tue Oct 11 17:06:16 2011 +1100 +++ b/com/win32com/HTML/docindex.html Wed Oct 12 12:12:12 2011 +1100 @@ -13,6 +13,7 @@ <P><A HREF="QuickStartClientCom.html">A Quick Start to Client Side COM</A> (including makepy)</P> <P><A HREF="QuickStartServerCom.html">A Quick Start to Server Side COM</A></P> <P><A HREF="GeneratedSupport.html">Information on generated Python files (ie, what makepy generates)</A></P> +<P><A HREF="variant.html">An advanced VARIANT object which can give more control over parameter types</A></P> <P><A HREF="package.html">A brief description of the win32com package structure</A></P> <P><A HREF="PythonCOM.html">Python COM Implementation documentation</A></P> <P><A HREF="misc.html">Misc stuff I dont know where to put anywhere else</A></P> diff -r d812236c54bc -r 36b16bcc5c9a com/win32com/HTML/variant.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32com/HTML/variant.html Wed Oct 12 12:12:12 2011 +1100 @@ -0,0 +1,162 @@ +<HTML> +<HEAD> + <TITLE>win32com.client.VARIANT</TITLE> +</HEAD> +<BODY> + +<H2>Introduction</H2> +<p> +win32com attempts to provide a seamless COM interface and hide many COM +implementation details, including the use of COM VARIANT structures. This +means that in most cases, you just call a COM object using normal Python +objects as parameters and get back normal Python objects as results. +</p> + +<p> +However, in some cases this doesn't work very well, particularly when using +"dynamic" (aka late-bound) objects, or when using "makepy" (aka early-bound) +objects which only declare a parameter is a VARIANT. +</p> + +<p> +The <code>win32com.client.VARIANT</code> object is designed to overcome these +problems. +</p> + +<h2>Drawbacks</h2> +The primary issue with this approach is that the programmer must learn more +about COM VARIANTs than otherwise - they need to know concepts such as +variants being <em>byref</em>, holding arrays, or that some may hold 32bit +unsigned integers while others hold 64bit signed ints, and they need to +understand this in the context of a single method call. In short, this is +a relatively advanced feature. The good news though is that use of these +objects should never cause your program to hard-crash - the worst you should +expect are Python or COM exceptions being thrown. + +<h2>The VARIANT object</h2> + +The VARIANT object lives in <code>win32com.client</code>. The constructor +takes 2 parameters - the 'variant type' and the value. The 'variant type' is +an integer and can be one or more of the <code>pythoncom.VT_*</code> values, +possibly or'd together. + +<p>For example, to create a VARIANT object which defines a byref array of +32bit integers, you could use: + +<pre> +>>> from win32com.client import VARIANT +>>> import pythoncom +>>> v = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_ARRAY | pythoncom.VT_I4, +... [1,2,3,4]) +>>> v +win32com.client.VARIANT(24579, [1, 2, 3, 4]) +>>> +</pre> + +This variable can then be used whereever a COM VARIANT is expected. + +<h2>Example usage with dynamic objects.</h2> + +For this example we will use the COM object used for win32com testing, +<code>PyCOMTest.PyCOMTest</code>. This object defines a method which is +defined in IDL as: +<pre> +HRESULT DoubleInOutString([in,out] BSTR *str); +</pre> + +As you can see, it takes a single string parameter which is also used as +an "out" parameter - the single parameter will be updated after the call. +The implementation of the method simply "doubles" the string. + +<p>If the object has a type-library, this method works fine with makepy +generated support. For example: + +<pre> +>>> from win32com.client.gencache import EnsureDispatch +>>> ob = EnsureDispatch("PyCOMTest.PyCOMTest") +>>> ob.DoubleInOutString("Hello") +u'HelloHello' +>>> +</pre> + +However, if makepy support is not available the method does not work as +expected. For the next example we will use <code>DumpDispatch</code> to +simulate the object not having a type-library. + +<pre> +>>> import win32com.client.dynamic +>>> ob = win32com.client.dynamic.DumbDispatch("PyCOMTest.PyCOMTest") +>>> ob.DoubleInOutString("Hello") +>>> +</pre> + +As you can see, no result came back from the function. This is because +win32com has no type information available to use, so doesn't know the +parameter should be passed as a <code>byref</code> parameter. To work +around this, we can use the <code>VARIANT</code> object. + +<p>The following example explicitly creates a VARIANT object with a +variant type of a byref string and a value 'Hello'. After making the +call with this VARIANT the value is updated. + +<pre> +>>> import win32com.client.dynamic +>>> from win32com.client import VARIANT +>>> import pythoncom +>>> ob = win32com.client.dynamic.DumbDispatch("PyCOMTest.PyCOMTest") +>>> variant = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_BSTR, "Hello") +>>> variant.value # check the value before the call. +'Hello' +>>> ob.DoubleInOutString(variant) +>>> variant.value +u'HelloHello' +>>> +</pre> + +<h2>Usage with generated objects</h2> + +In most cases, objects with makepy support (ie, 'generated' objects) don't +need to use the VARIANT object - the type information means win32com can guess +the right thing to pass. However, in some cases the VARIANT object can still +be useful. + +Imagine a poorly specified object with IDL like: + +<pre> +HRESULT DoSomething([in] VARIANT value); +</pre> + +But also imagine that the object has a limitation that if the parameter is an +integer, it must be a 32bit unsigned value - any other integer representation +will fail. + +<p>If you just pass a regular Python integer to this function, it will +generally be passed as a 32bit signed integer and given the limitation above, +will fail. The VARIANT object allows you to work around the limitation - just +create a variant object <code>VARIANT(pythoncom.VT_UI4, int_value)</code> and +pass that - the function will then be called with the explicit type you +specified and will succeed. + +<p>Note that you can not use a VARIANT object to override the types described +in a type library. If a makepy generated class specifies that a VT_UI2 is +expected, attempting to pass a VARIANT object will fail. In this case you +would need to hack around the problem. For example, imagine <code>ob</code> +was a COM object which a method called <code>foo</code> and you wanted to +override the type declaration for <code>foo</code> by passing a VARIANT. +You could do something like: + +<pre> +>>> import win32com.client.dynamic +>>> from win32com.client import VARIANT +>>> import pythoncom +>>> dumbob = win32com.client.dynamic.DumbDispatch(ob) +>>> variant = VARIANT(pythoncom.VT_BYREF | pythoncom.VT_BSTR, "Hello") +>>> dumbob.foo(variant) +</pre> + +The code above converts the makepy supported <code>ob</code> into a +'dumb' (ie, non-makepy supported) version of the object, which will then +allow you to use VARIANT objects for the problematic methods. + +</BODY> +</HTML> diff -r d812236c54bc -r 36b16bcc5c9a com/win32com/client/__init__.py --- a/com/win32com/client/__init__.py Tue Oct 11 17:06:16 2011 +1100 +++ b/com/win32com/client/__init__.py Wed Oct 12 12:12:12 2011 +1100 @@ -514,3 +514,26 @@ except AttributeError: pass self.__dict__[attr] = value + +# A very simple VARIANT class. Only to be used with poorly-implemented COM +# objects. If an object accepts an arg which is a simple "VARIANT", but still +# is very pickly about the actual variant type (eg, isn't happy with a VT_I4, +# which it would get from a Python integer), you can use this to force a +# particular VT. +class VARIANT(object): + def __init__(self, vt, value): + self.varianttype = vt + self._value = value + + # 'value' is a property so when set by pythoncom it gets any magic wrapping + # which normally happens for result objects + def _get_value(self): + return self._value + def _set_value(self, newval): + self._value = _get_good_object_(newval) + def _del_value(self): + del self._value + value = property(_get_value, _set_value, _del_value) + + def __repr__(self): + return "win32com.client.VARIANT(%r, %r)" % (self.varianttype, self._value) diff -r d812236c54bc -r 36b16bcc5c9a com/win32com/readme.htm --- a/com/win32com/readme.htm Tue Oct 11 17:06:16 2011 +1100 +++ b/com/win32com/readme.htm Wed Oct 12 12:12:12 2011 +1100 @@ -18,6 +18,12 @@ scripts (and a new <a href="test/readme.txt">readme.txt</a>). Although these are used for testing, they do show a variety of COM techniques.</p> +<h3>VARIANT objects</h3> +<p>win32com.client now has explicit VARIANT objects which can be used in +situations where you need more control over the argument types passed when +calling COM methods. See the <a href="html/variant.html">documentation on +this object</a> + <a name="currency"><h3>Important Currency changes</h3></a> <p> In all builds prior to 204, a COM currency value was returned as a tuple of diff -r d812236c54bc -r 36b16bcc5c9a com/win32com/src/PyIDispatch.cpp --- a/com/win32com/src/PyIDispatch.cpp Tue Oct 11 17:06:16 2011 +1100 +++ b/com/win32com/src/PyIDispatch.cpp Wed Oct 12 12:12:12 2011 +1100 @@ -140,7 +140,7 @@ // Convert a PyTuple object into a DISPPARAM structure. // numArgs specifies which of the LAST args in the tuple are valid. // To convert all args, pass len(args) -static BOOL PyCom_MakeUntypedDISPPARAMS( PyObject *args, int numArgs, WORD wFlags, DISPPARAMS *pParm) +static BOOL PyCom_MakeUntypedDISPPARAMS( PyObject *args, int numArgs, WORD wFlags, DISPPARAMS *pParm, PythonOleArgHelper **ppHelpers) { int argc = PyObject_Length(args); DISPID dispidNamed = DISPID_PROPERTYPUT; @@ -152,16 +152,19 @@ if ( pParm->cArgs ) { pParm->rgvarg = new VARIANTARG[pParm->cArgs]; + PythonOleArgHelper *pHelpers = *ppHelpers = new PythonOleArgHelper[pParm->cArgs]; for ( UINT i = 0; i < pParm->cArgs; ++i ) { VariantInit(&pParm->rgvarg[i]); // args in reverse order. - if ( !PyCom_VariantFromPyObject(PyTuple_GET_ITEM(args, argc-i-1), &pParm->rgvarg[i]) ) + if (!pHelpers[i].MakeObjToVariant(PyTuple_GET_ITEM(args, argc-i-1), &pParm->rgvarg[i], NULL) ) { if ( !PyErr_Occurred() ) PyErr_Format(PyExc_TypeError, "Bad argument"); while ( i-- > 0 ) VariantClear(&pParm->rgvarg[i]); + delete [] pParm->rgvarg; + delete [] pHelpers; return FALSE; } } @@ -173,12 +176,29 @@ pParm->rgdispidNamedArgs[0] = DISPID_PROPERTYPUT; pParm->cNamedArgs = 1; } + } else { + *ppHelpers = NULL; } return TRUE; } -static void PyCom_FreeUntypedDISPPARAMS( DISPPARAMS *pParm ) +static BOOL PyCom_FinishUntypedDISPPARAMS( DISPPARAMS *pParm, PythonOleArgHelper *pHelpers ) { + BOOL ok = TRUE; + if (pHelpers) { + for ( UINT i = 0; i < pParm->cArgs; ++i ) { + // Do magic so PyVariant objects get updated if appropriate. + if (pHelpers[i].m_bIsOut && pHelpers[i].m_pyVariant) { + PyObject *tmp = pHelpers[i].MakeVariantToObj(pParm->rgvarg+(pParm->cArgs-i-1)); |
|
From: <pyw...@li...> - 2011-10-11 06:07:35
|
changeset ba46bcfb6b56 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=ba46bcfb6b56 summary: add new test method GetVariantAndType and add some missing return values changeset d812236c54bc in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=d812236c54bc summary: fix broken link in .chm docs diffstat: AutoDuck/pywin32-document.xml | 2 +- com/TestSources/PyCOMTest/PyCOMImpl.cpp | 13 +++++++++++++ com/TestSources/PyCOMTest/PyCOMImpl.h | 1 + com/TestSources/PyCOMTest/PyCOMTest.idl | 1 + 4 files changed, 16 insertions(+), 1 deletions(-) diffs (78 lines): diff -r 760405084d20 -r d812236c54bc AutoDuck/pywin32-document.xml --- a/AutoDuck/pywin32-document.xml Sun Sep 25 15:39:15 2011 +1000 +++ b/AutoDuck/pywin32-document.xml Tue Oct 11 17:06:16 2011 +1100 @@ -23,7 +23,7 @@ <item name="win32com readme" href="com/win32com/readme.htm"/> <item name="ADSI Python" href="com/help/adsi.html"/> <item name="Active Directory" href="com/help/active_directory.html"/> - <item name="Important notes about COM currency support changes" href="html/com/win32com/readme.htm#currency"/> + <item name="Important notes about COM currency support changes" href="com/win32com/readme.htm#currency"/> </overviews> </category> <category id="pythonwin" label="Pythonwin and win32ui"> diff -r 760405084d20 -r d812236c54bc com/TestSources/PyCOMTest/PyCOMImpl.cpp --- a/com/TestSources/PyCOMTest/PyCOMImpl.cpp Sun Sep 25 15:39:15 2011 +1000 +++ b/com/TestSources/PyCOMTest/PyCOMImpl.cpp Tue Oct 11 17:06:16 2011 +1100 @@ -211,6 +211,7 @@ if (!outvar) return E_POINTER; *outvar = invar; + return S_OK; } STDMETHODIMP CPyCOMTest::GetSetUnsignedInt(unsigned int invar, unsigned int *outvar) @@ -218,6 +219,7 @@ if (!outvar) return E_POINTER; *outvar = invar; + return S_OK; } STDMETHODIMP CPyCOMTest::GetSetLong(long invar, long *outvar) @@ -225,6 +227,7 @@ if (!outvar) return E_POINTER; *outvar = invar; + return S_OK; } STDMETHODIMP CPyCOMTest::GetSetUnsignedLong(unsigned long invar, unsigned long *outvar) @@ -232,6 +235,16 @@ if (!outvar) return E_POINTER; *outvar = invar; + return S_OK; +} + +STDMETHODIMP CPyCOMTest::GetVariantAndType(VARIANT var, unsigned short *vt, VARIANT *vout) +{ + if (!vt || !vout) + return E_POINTER; + VariantClear(vout); + *vt = V_VT(&var); + return VariantCopy(vout, &var); } STDMETHODIMP CPyCOMTest::TestByRefVariant(VARIANT *v) diff -r 760405084d20 -r d812236c54bc com/TestSources/PyCOMTest/PyCOMImpl.h --- a/com/TestSources/PyCOMTest/PyCOMImpl.h Sun Sep 25 15:39:15 2011 +1000 +++ b/com/TestSources/PyCOMTest/PyCOMImpl.h Tue Oct 11 17:06:16 2011 +1100 @@ -70,6 +70,7 @@ STDMETHOD(GetSetUnsignedInt)(unsigned int invar, unsigned int *outvar); STDMETHOD(GetSetLong)(long invar, long *outvar); STDMETHOD(GetSetUnsignedLong)(unsigned long invar, unsigned long *outvar); + STDMETHOD(GetVariantAndType)(VARIANT vin, unsigned short *vt, VARIANT *vout); STDMETHOD(TestByRefVariant)(VARIANT *v); STDMETHOD(TestByRefString)(BSTR *v); STDMETHOD(TakeByRefTypedDispatch)(IPyCOMTest **inout); diff -r 760405084d20 -r d812236c54bc com/TestSources/PyCOMTest/PyCOMTest.idl --- a/com/TestSources/PyCOMTest/PyCOMTest.idl Sun Sep 25 15:39:15 2011 +1000 +++ b/com/TestSources/PyCOMTest/PyCOMTest.idl Tue Oct 11 17:06:16 2011 +1100 @@ -205,6 +205,7 @@ HRESULT GetSetUnsignedInt([in] unsigned int invar, [out, retval] unsigned int *outunk); HRESULT GetSetLong([in] long invar, [out, retval] long *outunk); HRESULT GetSetUnsignedLong([in] unsigned long invar, [out, retval] unsigned long *outunk); + HRESULT GetVariantAndType([in] VARIANT vin, [out] unsigned short *vt, [out] VARIANT *vout); HRESULT TestByRefVariant([in, out] VARIANT *v); HRESULT TestByRefString([in, out] BSTR *v); HRESULT TakeByRefTypedDispatch([in, out] IPyCOMTest **inout); |
|
From: <pyw...@li...> - 2011-09-25 05:40:09
|
changeset c6311e6fabc6 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=c6311e6fabc6 summary: ignore more files changeset 777c9e594f3d in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=777c9e594f3d summary: fix processorArchitecture so common-control functions work in 64bit builds changeset 760405084d20 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=760405084d20 summary: build winxpgui with a static CRT so it loads correctly without the redistibutables in the cwd diffstat: .hgignore | 76 ++++++++++++++++++++++++++------------------ setup.py | 22 +++++++++++- win32/src/winxpgui.manifest | 4 +- 3 files changed, 65 insertions(+), 37 deletions(-) diffs (162 lines): diff -r c324bf81d7b9 -r 760405084d20 .hgignore --- a/.hgignore Thu Sep 08 12:05:33 2011 +1000 +++ b/.hgignore Sun Sep 25 15:39:15 2011 +1000 @@ -1,32 +1,44 @@ -# use glob syntax. -syntax: glob - -MANIFEST -build -dist -*.exe -*.zip -*.dbg -*.exp -*.ncb -*.opt -*.plg -*.chm -*.chw -Pythonwin/Scintilla/win32/*.pdb -PyWin32.kpf - -# SWIG generated files. -com/win32comext/adsi/src/*.cpp -com/win32comext/adsi/src/*.h -com/win32comext/mapi/src/*.cpp -com/win32comext/mapi/src/*.h -win32/src/*_swig.cpp - - -# Generated from message files -win32/src/PerfMon/PyPerfMsgs.h -win32/src/PythonServiceMessages.h -win32/src/win32service_messages.h -win32/src/win32evtlog_messages.h -isapi/src/pyISAPI_messages.h \ No newline at end of file +# use glob syntax. +syntax: glob + +MANIFEST +build +dist +*.exe +*.zip +*.dbg +*.exp +*.ncb +*.opt +*.plg +*.chm +*.chw +*.pyc +*.pyo +Pythonwin/Scintilla/win32/*.pdb +PyWin32.kpf + +# COM test bits +com\TestSources\Build +com\TestSources\PyCOMTest\PyCOMTest.h +com\TestSources\PyCOMTest\PyCOMTest.sln +com\TestSources\PyCOMTest\PyCOMTest.suo +com\TestSources\PyCOMTest\PyCOMTest.tlb +com\TestSources\PyCOMTest\PyCOMTest.vcproj* +com\TestSources\PyCOMTest\PyCOMTest_i.c + + +# SWIG generated files. +com/win32comext/adsi/src/*.cpp +com/win32comext/adsi/src/*.h +com/win32comext/mapi/src/*.cpp +com/win32comext/mapi/src/*.h +win32/src/*_swig.cpp + + +# Generated from message files +win32/src/PerfMon/PyPerfMsgs.h +win32/src/PythonServiceMessages.h +win32/src/win32service_messages.h +win32/src/win32evtlog_messages.h +isapi/src/pyISAPI_messages.h diff -r c324bf81d7b9 -r 760405084d20 setup.py --- a/setup.py Thu Sep 08 12:05:33 2011 +1000 +++ b/setup.py Sun Sep 25 15:39:15 2011 +1000 @@ -116,6 +116,10 @@ print msg % args log = Log() +# some modules need a static CRT to avoid problems caused by them having a +# manifest. +static_crt_modules = ["winxpgui"] + from distutils.dep_util import newer_group, newer from distutils import dir_util, file_util @@ -248,6 +252,9 @@ return if _want_assembly_hack and is_link: # remove /MANIFESTFILE:... and add MANIFEST:NO + # (but note that for winxpgui, which specifies a manifest via a + # .rc file, this is ignored by the linker - the manifest specified + # in the .rc file is still added) for i in range(len(cmd)): if cmd[i].startswith("/MANIFESTFILE:"): cmd[i] = "/MANIFEST:NO" @@ -271,9 +278,7 @@ self._want_assembly_with_crt = os.path.basename(output_filename).startswith("PyISAPI_loader.dll") or \ os.path.basename(output_filename).startswith("perfmondata.dll") self._want_assembly_hack = not(target_desc==self.EXECUTABLE or self._want_assembly_with_crt or - os.path.basename(output_filename).startswith("winxpgui") or - os.path.basename(output_filename).startswith("_winxptheme") or - os.path.basename(output_filename).startswith("win32ui")) + os.path.splitext(os.path.basename(output_filename))[0]=="win32ui") try: return self._orig_link(target_desc, objects, output_filename, *args, **kw) finally: @@ -1214,6 +1219,12 @@ if sys.version_info < (2,3): # 2.3+ - Wrong dir, numbered name self.build_temp = os.path.join(self.build_temp, ext.name) + want_static_crt = sys.version_info > (2,6) and ext.name in static_crt_modules + if want_static_crt: + self.compiler.compile_options.remove('/MD') + self.compiler.compile_options.append('/MT') + self.compiler.compile_options_debug.remove('/MDd') + self.compiler.compile_options_debug.append('/MTd') try: build_ext.build_extension(self, ext) @@ -1250,6 +1261,11 @@ self.copy_file(src, dst)#, update=1) finally: self.build_temp = old_build_temp + if want_static_crt: + self.compiler.compile_options.remove('/MT') + self.compiler.compile_options.append('/MD') + self.compiler.compile_options_debug.remove('/MTd') + self.compiler.compile_options_debug.append('/MDd') def get_ext_filename(self, name): # The pywintypes and pythoncom extensions have special names diff -r c324bf81d7b9 -r 760405084d20 win32/src/winxpgui.manifest --- a/win32/src/winxpgui.manifest Thu Sep 08 12:05:33 2011 +1000 +++ b/win32/src/winxpgui.manifest Sun Sep 25 15:39:15 2011 +1000 @@ -3,7 +3,7 @@ manifestVersion="1.0"> <assemblyIdentity version="0.64.1.0" - processorArchitecture="x86" + processorArchitecture="*" name="Controls" type="win32" /> @@ -14,7 +14,7 @@ type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" - processorArchitecture="X86" + processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> |
|
From: <pyw...@li...> - 2011-09-08 02:07:25
|
changeset c45701ca8b4a in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=c45701ca8b4a summary: add simple test for win32com.client.CastTo changeset 47f22d76cbf9 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=47f22d76cbf9 summary: fix some 64bit issues in win32com.shell changeset c324bf81d7b9 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=c324bf81d7b9 summary: fix various structure size issues on 64bits diffstat: com/win32com/test/testPyComTest.py | 12 ++- com/win32comext/shell/src/PyIShellBrowser.cpp | 4 +- com/win32comext/shell/src/PyIShellFolder.cpp | 8 +- com/win32comext/shell/src/PyIShellView.cpp | 2 +- win32/Demos/win32gui_dialog.py | 10 +- win32/Lib/win32gui_struct.py | 115 ++++++++++++++++--------- 6 files changed, 96 insertions(+), 55 deletions(-) diffs (truncated from 397 to 300 lines): diff -r 1452829d69ec -r c324bf81d7b9 com/win32com/test/testPyComTest.py --- a/com/win32com/test/testPyComTest.py Thu Aug 25 14:48:47 2011 -0400 +++ b/com/win32com/test/testPyComTest.py Thu Sep 08 12:05:33 2011 +1000 @@ -4,10 +4,11 @@ import sys; sys.coinit_flags=0 # Must be free-threaded! import win32api, pythoncom, time import pywintypes -import os, win32com, win32com.client.connect +import os +import win32com +import win32com.client.connect from win32com.test.util import CheckClean -from win32com.client import constants, DispatchBaseClass -import win32com +from win32com.client import constants, DispatchBaseClass, CastTo from win32com.test.util import RegisterPythonServer from pywin32_testutil import str2memory import datetime @@ -421,6 +422,11 @@ if o.ParamProp(0) != 1: raise RuntimeError(o.paramProp(0)) + # Make sure CastTo works - even though it is only casting it to itself! + o2 = CastTo(o, "IPyCOMTest") + if o != o2: + raise error("CastTo should have returned the same object") + # Do the connection point thing... # Create a connection object. progress("Testing connection points") diff -r 1452829d69ec -r c324bf81d7b9 com/win32comext/shell/src/PyIShellBrowser.cpp --- a/com/win32comext/shell/src/PyIShellBrowser.cpp Thu Aug 25 14:48:47 2011 -0400 +++ b/com/win32comext/shell/src/PyIShellBrowser.cpp Thu Sep 08 12:05:33 2011 +1000 @@ -519,9 +519,9 @@ { PY_GATEWAY_METHOD; PyObject *result; - HRESULT hr=InvokeViaPolicy("SendControlMsg", &result, "iiil", id, uMsg, wParam, lParam); + HRESULT hr=InvokeViaPolicy("SendControlMsg", &result, "iiNN", id, uMsg, PyWinObject_FromPARAM(wParam), PyWinObject_FromPARAM(lParam)); if (PyInt_Check(result) || PyLong_Check(result)) - *pret = PyInt_AsLong(result); + PyWinLong_AsULONG_PTR(result, (ULONG_PTR *)pret); Py_DECREF(result); return hr; } diff -r 1452829d69ec -r c324bf81d7b9 com/win32comext/shell/src/PyIShellFolder.cpp --- a/com/win32comext/shell/src/PyIShellFolder.cpp Thu Aug 25 14:48:47 2011 -0400 +++ b/com/win32comext/shell/src/PyIShellFolder.cpp Thu Sep 08 12:05:33 2011 +1000 @@ -201,10 +201,14 @@ PyObject *obpidl1; PyObject *obpidl2; PyObject *ret=NULL; - long lparam; + PyObject *oblparam; + LPARAM lparam; ITEMIDLIST *pidl1=NULL; ITEMIDLIST *pidl2=NULL; - if ( !PyArg_ParseTuple(args, "kOO:CompareIDs", &lparam, &obpidl1, &obpidl2) ) + if ( !PyArg_ParseTuple(args, "OOO:CompareIDs", &oblparam, &obpidl1, &obpidl2) ) + return NULL; + + if (!PyWinObject_AsPARAM(oblparam, &lparam)) return NULL; if (PyObject_AsPIDL(obpidl1, &pidl1) && diff -r 1452829d69ec -r c324bf81d7b9 com/win32comext/shell/src/PyIShellView.cpp --- a/com/win32comext/shell/src/PyIShellView.cpp Thu Aug 25 14:48:47 2011 -0400 +++ b/com/win32comext/shell/src/PyIShellView.cpp Thu Sep 08 12:05:33 2011 +1000 @@ -428,7 +428,7 @@ PyObject *obpfn = Py_None; Py_INCREF(Py_None); if (obpfn==NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("AddPropertySheetPages"); - HRESULT hr=InvokeViaPolicy("AddPropertySheetPages", NULL, "lOl", dwReserved, obpfn, lparam); + HRESULT hr=InvokeViaPolicy("AddPropertySheetPages", NULL, "lON", dwReserved, obpfn, PyWinObject_FromPARAM(lparam)); Py_DECREF(obpfn); return hr; } diff -r 1452829d69ec -r c324bf81d7b9 win32/Demos/win32gui_dialog.py --- a/win32/Demos/win32gui_dialog.py Thu Aug 25 14:48:47 2011 -0400 +++ b/win32/Demos/win32gui_dialog.py Thu Sep 08 12:05:33 2011 +1000 @@ -19,6 +19,7 @@ import win32gui else: import winxpgui as win32gui +import win32gui_struct import win32api import win32con, winerror import struct, array @@ -300,12 +301,9 @@ print "OnSearchFinished" def OnNotify(self, hwnd, msg, wparam, lparam): - format = "PPiiiiiiiiP" - buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) - hwndFrom, idFrom, code, iItem, iSubItem, uNewState, uOldState, uChanged, actionx, actiony, lParam \ - = struct.unpack(format, buf) - if code == commctrl.NM_DBLCLK: - print "Double click on item", iItem+1 + info = win32gui_struct.UnpackNMITEMACTIVATE(lparam) + if info.code == commctrl.NM_DBLCLK: + print "Double click on item", info.iItem+1 return 1 def OnCommand(self, hwnd, msg, wparam, lparam): diff -r 1452829d69ec -r c324bf81d7b9 win32/Lib/win32gui_struct.py --- a/win32/Lib/win32gui_struct.py Thu Aug 25 14:48:47 2011 -0400 +++ b/win32/Lib/win32gui_struct.py Thu Sep 08 12:05:33 2011 +1000 @@ -35,6 +35,19 @@ import commctrl import pywintypes +is64bit = "64 bit" in sys.version + +try: + from collections import namedtuple + def _MakeResult(names_str, values): + names = names_str.split() + nt = namedtuple(names[0], names[1:]) + return nt(*values) +except ImportError: + # no namedtuple support - just return the values as a normal tuple. + def _MakeResult(names_str, values): + return values + # Encode a string suitable for passing in a win32gui related structure # If win32gui is built with UNICODE defined (ie, py3k), then functions # like InsertMenuItem are actually calling InsertMenuItemW etc, so all @@ -73,11 +86,21 @@ # Generic WM_NOTIFY unpacking def UnpackWMNOTIFY(lparam): - format = "iii" + format = "PPi" buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) - hwndFrom, idFrom, code = struct.unpack(format, buf) - return hwndFrom, idFrom, code - + return _MakeResult("WMNOTIFY hwndFrom idFrom code", struct.unpack(format, buf)) + +def UnpackNMITEMACTIVATE(lparam): + if is64bit: + # the struct module doesn't handle this correctly as some of the items + # are actually structs in structs, which get individually aligned. + format = "PPixxxxiiiiiiixxxxP" + else: + format = "PPiiiiiiiiP" + buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) + return _MakeResult("NMITEMACTIVATE hwndFrom idFrom code iItem iSubItem uNewState uOldState uChanged actionx actiony lParam", + struct.unpack(format, buf)) + # MENUITEMINFO struct # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuStructures/MENUITEMINFO.asp # We use the struct module to pack and unpack strings as MENUITEMINFO @@ -180,8 +203,10 @@ text = win32gui.PyGetString(lptext, cch) else: text = None - return fType, fState, wID, hSubMenu, hbmpChecked, hbmpUnchecked, \ - dwItemData, text, hbmpItem + return _MakeResult("MENUITEMINFO fType fState wID hSubMenu hbmpChecked " + "hbmpUnchecked dwItemData text hbmpItem", + (fType, fState, wID, hSubMenu, hbmpChecked, hbmpUnchecked, \ + dwItemData, text, hbmpItem)) def EmptyMENUITEMINFO(mask = None, text_buf_size=512): # text_buf_size is number of *characters* - not necessarily no of bytes. @@ -261,7 +286,8 @@ if fMask & win32con.MIM_BACKGROUND==0: hbrBack = None if fMask & win32con.MIM_HELPID==0: dwContextHelpID = None if fMask & win32con.MIM_MENUDATA==0: dwMenuData = None - return dwStyle, cyMax, hbrBack, dwContextHelpID, dwMenuData + return _MakeResult("MENUINFO dwStyle cyMax hbrBack dwContextHelpID dwMenuData", + (dwStyle, cyMax, hbrBack, dwContextHelpID, dwMenuData)) def EmptyMENUINFO(mask = None): if mask is None: @@ -291,6 +317,7 @@ # XXX - from the SpamBayes project. It may not quite work correctly yet - I # XXX - intend checking them later - but having them is better than not at all! +_tvitem_fmt = "iPiiPiiiiP" # Helpers for the ugly win32 structure packing/unpacking # XXX - Note that functions using _GetMaskAndVal run 3x faster if they are # 'inlined' into the function - see PackLVITEM. If the profiler points at @@ -307,7 +334,7 @@ def PackTVINSERTSTRUCT(parent, insertAfter, tvitem): tvitem_buf, extra = PackTVITEM(*tvitem) tvitem_buf = tvitem_buf.tostring() - format = "ii%ds" % len(tvitem_buf) + format = "PP%ds" % len(tvitem_buf) return struct.pack(format, parent, insertAfter, tvitem_buf), extra def PackTVITEM(hitem, state, stateMask, text, image, selimage, citems, param): @@ -329,8 +356,7 @@ text_len = len(text) extra.append(text_buffer) text_addr, _ = text_buffer.buffer_info() - format = "iiiiiiiiii" - buf = struct.pack(format, + buf = struct.pack(_tvitem_fmt, mask, hitem, state, stateMask, text_addr, text_len, # text @@ -351,8 +377,7 @@ text_addr, _ = text_buffer.buffer_info() else: text_addr = text_buf_size = 0 - format = "iiiiiiiiii" - buf = struct.pack(format, + buf = struct.pack(_tvitem_fmt, mask, hitem, 0, 0, text_addr, text_buf_size, # text @@ -363,7 +388,7 @@ def UnpackTVITEM(buffer): item_mask, item_hItem, item_state, item_stateMask, \ item_textptr, item_cchText, item_image, item_selimage, \ - item_cChildren, item_param = struct.unpack("10i", buffer) + item_cChildren, item_param = struct.unpack(_tvitem_fmt, buffer) # ensure only items listed by the mask are valid (except we assume the # handle is always valid - some notifications (eg, TVN_ENDLABELEDIT) set a # mask that doesn't include the handle, but the docs explicity say it is.) @@ -378,29 +403,34 @@ text = win32gui.PyGetString(item_textptr) else: text = None - return item_hItem, item_state, item_stateMask, \ - text, item_image, item_selimage, \ - item_cChildren, item_param + return _MakeResult("TVITEM item_hItem item_state item_stateMask " + "text item_image item_selimage item_cChildren item_param", + (item_hItem, item_state, item_stateMask, text, + item_image, item_selimage, item_cChildren, item_param)) # Unpack the lparm from a "TVNOTIFY" message def UnpackTVNOTIFY(lparam): - format = "iiii40s40s" + format = "Piii40s40s" buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, action, buf_old, buf_new \ = struct.unpack(format, buf) item_old = UnpackTVITEM(buf_old) item_new = UnpackTVITEM(buf_new) - return hwndFrom, id, code, action, item_old, item_new + return _MakeResult("TVNOTIFY hwndFrom id code action item_old item_new", + (hwndFrom, id, code, action, item_old, item_new)) def UnpackTVDISPINFO(lparam): - format = "iii40s" + format = "Pii40s" buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, buf_item = struct.unpack(format, buf) item = UnpackTVITEM(buf_item) - return hwndFrom, id, code, item + return _MakeResult("TVDISPINFO hwndFrom id code item", + (hwndFrom, id, code, item)) # # List view items +_lvitem_fmt = "iiiiiPiiPi" + def PackLVITEM(item=None, subItem=None, state=None, stateMask=None, text=None, image=None, param=None, indent=None): extra = [] # objects we must keep references to mask = 0 @@ -429,8 +459,7 @@ text_len = len(text) extra.append(text_buffer) text_addr, _ = text_buffer.buffer_info() - format = "iiiiiiiiii" - buf = struct.pack(format, + buf = struct.pack(_lvitem_fmt, mask, item, subItem, state, stateMask, text_addr, text_len, # text @@ -441,7 +470,7 @@ item_mask, item_item, item_subItem, \ item_state, item_stateMask, \ item_textptr, item_cchText, item_image, \ - item_param, item_indent = struct.unpack("10i", buffer) + item_param, item_indent = struct.unpack(_lvitem_fmt, buffer) # ensure only items listed by the mask are valid if not (item_mask & commctrl.LVIF_TEXT): item_textptr = item_cchText = None if not (item_mask & commctrl.LVIF_IMAGE): item_image = None @@ -453,24 +482,29 @@ text = win32gui.PyGetString(item_textptr) else: text = None - return item_item, item_subItem, item_state, item_stateMask, \ - text, item_image, item_param, item_indent + return _MakeResult("LVITEM item_item item_subItem item_state " + "item_stateMask text item_image item_param item_indent", + (item_item, item_subItem, item_state, item_stateMask, + text, item_image, item_param, item_indent)) # Unpack an "LVNOTIFY" message def UnpackLVDISPINFO(lparam): - format = "iii40s" + format = "Pii40s" buf = win32gui.PyGetMemory(lparam, struct.calcsize(format)) hwndFrom, id, code, buf_item = struct.unpack(format, buf) |
|
From: <pyw...@li...> - 2011-08-25 18:50:24
|
changeset 1452829d69ec in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=1452829d69ec summary: Add SHOpenFolderAndSelectItems (feature req# 3396444) diffstat: com/win32comext/shell/src/shell.cpp | 49 ++++++++++++++++++++++++++++++++++-- 1 files changed, 46 insertions(+), 3 deletions(-) diffs (94 lines): diff -r 0cde6078b159 -r 1452829d69ec com/win32comext/shell/src/shell.cpp --- a/com/win32comext/shell/src/shell.cpp Sat Aug 13 11:05:08 2011 +1000 +++ b/com/win32comext/shell/src/shell.cpp Thu Aug 25 14:48:47 2011 -0400 @@ -159,6 +159,8 @@ typedef HRESULT (WINAPI *PFNSHCreateShellItem)(PCIDLIST_ABSOLUTE, IShellFolder *, PCUITEMID_CHILD, IShellItem **); static PFNSHCreateShellItem pfnSHCreateShellItem = NULL; +typedef HRESULT (WINAPI *PFNSHOpenFolderAndSelectItems)(PCIDLIST_ABSOLUTE,UINT,PCUITEMID_CHILD_ARRAY,DWORD); +static PFNSHOpenFolderAndSelectItems pfnSHOpenFolderAndSelectItems = NULL; void PyShell_FreeMem(void *p) { @@ -323,6 +325,7 @@ PyErr_NoMemory(); return FALSE; } + ZeroMemory(ppidl, n * sizeof(ITEMIDLIST *)); for (int i=0;i<n;i++) { PyObject *ob = PySequence_GetItem(obSeq, i); if (!ob || !PyObject_AsPIDL(ob, (ITEMIDLIST **)&ppidl[i], FALSE )) { @@ -3186,9 +3189,6 @@ return ret; } - - - // @pymethod <o PyIShellItem>|shell|SHCreateShellItem|Creates an IShellItem interface from a PIDL static PyObject *PySHCreateShellItem(PyObject *self, PyObject *args) { @@ -3240,6 +3240,47 @@ return ret; } +// @pymethod |shell|SHOpenFolderAndSelectItems|Displays a shell folder with items pre-selected +static PyObject *PySHOpenFolderAndSelectItems(PyObject *self, PyObject *args, PyObject *kwargs) +{ + // @comm This function is only available on XP and later. + // COM exception with E_NOTIMPL will be thrown if the function can't be located. + if (pfnSHOpenFolderAndSelectItems==NULL) + return PyCom_BuildPyException(E_NOTIMPL); + static char *keywords[] = {"Folder", "Items", "Flags", NULL}; + DWORD flags; + PyObject *obfolder, *obitems, *ret=NULL; + // @pyparm <o PyIDL>|Folder||An absolute item id list identifying a shell folder + // @pyparm (<o PyIDL>,...)|Items||A sequence of relative item ids identifying items in the folder + // @pyparm int|Flags|0|Combination of OFASI_* flags (not used on XP) + + if(!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|k:SHOpenFolderAndSelectItems", keywords, + &obfolder, &obitems, &flags)) + return NULL; + ITEMIDLIST *folder = NULL; + const ITEMIDLIST **items = NULL; + UINT item_cnt; + HRESULT hr; + if (PyObject_AsPIDL(obfolder, &folder, FALSE) + &&PyObject_AsPIDLArray(obitems, &item_cnt, &items)){ + PY_INTERFACE_PRECALL; + hr = (*pfnSHOpenFolderAndSelectItems)(folder, item_cnt, items, flags); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + PyCom_BuildPyException(hr); + else{ + Py_INCREF(Py_None); + ret=Py_None; + } + } + + if (folder) + PyObject_FreePIDL(folder); + if (items) + PyObject_FreePIDLArray(item_cnt, items); + return ret; +} + /* List of module functions */ // @module shell|A module wrapping Windows Shell functions and interfaces @@ -3298,6 +3339,7 @@ { "SHGetViewStatePropertyBag", PySHGetViewStatePropertyBag, METH_VARARGS}, // @pymeth SHGetViewStatePropertyBag|Retrieves an interface for a folder's view state { "SHILCreateFromPath", PySHILCreateFromPath, METH_VARARGS}, // @pymeth SHILCreateFromPath|Returns the PIDL and attributes of a path { "SHCreateShellItem", PySHCreateShellItem, METH_VARARGS}, // @pymeth SHCreateShellItem|Creates an IShellItem interface from a PIDL + { "SHOpenFolderAndSelectItems", (PyCFunction)PySHOpenFolderAndSelectItems, METH_VARARGS|METH_KEYWORDS}, // @pymeth SHOpenFolderAndSelectItems|Displays a shell folder with items pre-selected { NULL, NULL }, }; @@ -3431,6 +3473,7 @@ pfnSHCreateItemWithParent =(PFNSHCreateItemWithParent)GetProcAddress(shell32, "SHCreateItemWithParent"); pfnSHGetIDListFromObject =(PFNSHGetIDListFromObject)GetProcAddress(shell32, "SHGetIDListFromObject"); pfnSHCreateShellItem =(PFNSHCreateShellItem)GetProcAddress(shell32, "SHCreateShellItem"); + pfnSHOpenFolderAndSelectItems = (PFNSHOpenFolderAndSelectItems)GetProcAddress(shell32, "SHOpenFolderAndSelectItems"); } // SHGetFolderPath comes from shfolder.dll on older systems if (pfnSHGetFolderPath==NULL){ |
|
From: <pyw...@li...> - 2011-08-13 01:05:50
|
changeset 0cde6078b159 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=0cde6078b159 summary: fix error message for errors parsing a SERVICE_FAILURE_ACTIONS diffstat: win32/src/win32service.i | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 5984338a157e -r 0cde6078b159 win32/src/win32service.i --- a/win32/src/win32service.i Sun Jul 24 16:44:55 2011 -0400 +++ b/win32/src/win32service.i Sat Aug 13 11:05:08 2011 +1000 @@ -1584,7 +1584,7 @@ BOOL PyWinObject_AsSERVICE_FAILURE_ACTIONS(PyObject *obinfo, LPSERVICE_FAILURE_ACTIONSW psfa) { static char *sfa_keys[]={"ResetPeriod","RebootMsg","Command","Actions",0}; - static char *err="SERVICE_FAILURE_ACTIONS must be a dictionary containing {'ResetPeriod':int,'RebootMsg':unicode,'lpCommand':unicode,'Actions':sequence of 2 tuples(int,int)"; + static char *err="SERVICE_FAILURE_ACTIONS must be a dictionary containing {'ResetPeriod':int,'RebootMsg':unicode,'Command':unicode,'Actions':sequence of 2 tuples(int,int)"; PyObject *dummy_tuple, *obActions, *obRebootMsg, *obCommand; BOOL ret; ZeroMemory(psfa, sizeof(SERVICE_FAILURE_ACTIONSW)); |
|
From: <pyw...@li...> - 2011-07-24 20:46:18
|
changeset 5984338a157e in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=5984338a157e summary: Fix endless traceback when doing print preview with debugging toolbar visible diffstat: Pythonwin/pywin/framework/dbgcommands.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diffs (22 lines): diff -r b483552a9fc0 -r 5984338a157e Pythonwin/pywin/framework/dbgcommands.py --- a/Pythonwin/pywin/framework/dbgcommands.py Sat Jul 23 11:59:21 2011 -0400 +++ b/Pythonwin/pywin/framework/dbgcommands.py Sun Jul 24 16:44:55 2011 -0400 @@ -6,7 +6,8 @@ import win32ui, win32con import scriptutils import warnings - +from pywin.scintilla.control import CScintillaEditInterface + IdToBarNames = { win32ui.IDC_DBG_STACK : ("Stack",0), win32ui.IDC_DBG_BREAKPOINTS : ("Breakpoints",0), @@ -137,7 +138,7 @@ def OnUpdateAddBreakpoints(self, cmdui): doc, view = scriptutils.GetActiveEditorDocument() - if doc is None: + if doc is None or not isinstance(view, CScintillaEditInterface): enabled = 0 else: enabled = 1 |
|
From: <pyw...@li...> - 2011-07-23 16:00:54
|
changeset b483552a9fc0 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=b483552a9fc0 summary: Some recent additions and bug fixes diffstat: CHANGES.txt | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (15 lines): diff -r 8ef820c1829a -r b483552a9fc0 CHANGES.txt --- a/CHANGES.txt Sat Jul 23 11:41:34 2011 -0400 +++ b/CHANGES.txt Sat Jul 23 11:59:21 2011 -0400 @@ -41,6 +41,11 @@ * win32evtlog - Added some of the new event log functions introduced in Vista/Windows 7 +* win32service - Added EnumServicesStatusEx, and support startup type "delayed" + for Python services + +* win32net - Fix a problem with NetFileEnum on 64-bit (bug #3376041) + Since build 215: ---------------- * New loader module for COM objects to avoid some CRT manifest issues. |
|
From: <pyw...@li...> - 2011-07-23 15:42:36
|
changeset 8ef820c1829a in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=8ef820c1829a summary: Initialize resumeHandle in NetFileEnum (bug #3376041) diffstat: win32/src/win32net/win32netfile.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 22114c9a25d5 -r 8ef820c1829a win32/src/win32net/win32netfile.cpp --- a/win32/src/win32net/win32netfile.cpp Sat Jul 16 14:40:15 2011 -0400 +++ b/win32/src/win32net/win32netfile.cpp Sat Jul 23 11:41:34 2011 -0400 @@ -34,7 +34,7 @@ DWORD buff_len = 0xFFFFFFFF; DWORD dwEntriesRead= 0; DWORD dwTotalEntries = 0; - DWORD_PTR resumeHandle; + DWORD_PTR resumeHandle = 0; DWORD i; NET_API_STATUS nStatus; |
|
From: <pyw...@li...> - 2011-07-16 18:41:33
|
changeset 22114c9a25d5 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=22114c9a25d5 summary: Fix format of debug print (bug #2808783) diffstat: setup.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r cf92dfed72c8 -r 22114c9a25d5 setup.py --- a/setup.py Thu Jul 14 21:22:17 2011 -0400 +++ b/setup.py Sat Jul 16 14:40:15 2011 -0400 @@ -158,7 +158,7 @@ sdkdir = os.environ.get("MSSdk") if sdkdir: if DEBUG: - print "PSDK: try %MSSdk%: '%s'" % sdkdir + print "PSDK: try %%MSSdk%%: '%s'" % sdkdir if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir # 2. The "Install Dir" value in the |
|
From: <pyw...@li...> - 2011-07-16 07:07:54
|
changeset cf92dfed72c8 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=cf92dfed72c8 summary: In GetRootKey, return HKCU when installed per-user diffstat: win32/Lib/regutil.py | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diffs (51 lines): diff -r 39838376f973 -r cf92dfed72c8 win32/Lib/regutil.py --- a/win32/Lib/regutil.py Tue Jul 12 01:50:52 2011 -0400 +++ b/win32/Lib/regutil.py Thu Jul 14 21:22:17 2011 -0400 @@ -12,14 +12,25 @@ RegistryIDPyFile = "Python.File" # The registry "file type" of a .py file RegistryIDPycFile = "Python.CompiledFile" # The registry "file type" of a .pyc file +def BuildDefaultPythonKey(): + """Builds a string containing the path to the current registry key. + + The Python registry key contains the Python version. This function + uses the version of the DLL used by the current process to get the + registry key currently in use. + """ + return "Software\\Python\\PythonCore\\" + sys.winver + def GetRootKey(): """Retrieves the Registry root in use by Python. """ -# Win32s no longer supported/released. -# if win32ui.IsWin32s(): -# return win32con.HKEY_CLASSES_ROOT -# else: - return win32con.HKEY_LOCAL_MACHINE + keyname = BuildDefaultPythonKey() + try: + k = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyname) + k.close() + return win32con.HKEY_CURRENT_USER + except win32api.error: + return win32con.HKEY_LOCAL_MACHINE def GetRegistryDefaultValue(subkey, rootkey = None): """A helper to return the default value for a key in the registry. @@ -39,16 +50,6 @@ raise TypeError("Value must be string or integer - was passed " + repr(value)) win32api.RegSetValue(rootkey, subKey, typeId ,value) - -def BuildDefaultPythonKey(): - """Builds a string containing the path to the current registry key. - - The Python registry key contains the Python version. This function - uses the version of the DLL used by the current process to get the - registry key currently in use. - """ - - return "Software\\Python\\PythonCore\\" + sys.winver def GetAppPathsKey(): return "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths" |
|
From: <pyw...@li...> - 2011-07-12 05:53:28
|
changeset 39838376f973 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=39838376f973 summary: Add startup type 'delayed' diffstat: win32/Lib/win32serviceutil.py | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diffs (124 lines): diff -r 7f3c50215fa5 -r 39838376f973 win32/Lib/win32serviceutil.py --- a/win32/Lib/win32serviceutil.py Mon Jul 11 13:58:28 2011 -0400 +++ b/win32/Lib/win32serviceutil.py Tue Jul 12 01:50:52 2011 -0400 @@ -7,8 +7,7 @@ # registry etc. import win32service, win32api, win32con, winerror -import sys, pywintypes, os - +import sys, pywintypes, os, warnings error = RuntimeError def LocatePythonServiceExe(exeName = None): @@ -141,7 +140,8 @@ else: return exeName -def InstallService(pythonClassString, serviceName, displayName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, perfMonIni = None, perfMonDll = None, exeArgs = None, description = None): +def InstallService(pythonClassString, serviceName, displayName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, perfMonIni = None, perfMonDll = None, exeArgs = None, + description = None, delayedstart = None): # Handle the default arguments. if startType is None: startType = win32service.SERVICE_DEMAND_START @@ -173,6 +173,13 @@ win32service.ChangeServiceConfig2(hs,win32service.SERVICE_CONFIG_DESCRIPTION,description) except NotImplementedError: pass ## ChangeServiceConfig2 and description do not exist on NT + if delayedstart is not None: + try: + win32service.ChangeServiceConfig2(hs,win32service.SERVICE_CONFIG_DELAYED_AUTO_START_INFO, delayedstart) + except (win32service.error, NotImplementedError): + ## delayed start only exists on Vista and later - warn only when trying to set delayed to True + if delayedstart: + warnings.warn('Delayed Start not available on this system') win32service.CloseServiceHandle(hs) finally: win32service.CloseServiceHandle(hscm) @@ -181,7 +188,10 @@ if perfMonIni is not None: InstallPerfmonForService(serviceName, perfMonIni, perfMonDll) -def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None, exeArgs = None, description = None): +def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, bRunInteractive = 0, + serviceDeps = None, userName = None, password = None, + exeName = None, displayName = None, perfMonIni = None, perfMonDll = None, + exeArgs = None, description = None, delayedstart = None): # Before doing anything, remove any perfmon counters. try: import perfmon @@ -221,7 +231,15 @@ win32service.ChangeServiceConfig2(hs,win32service.SERVICE_CONFIG_DESCRIPTION,description) except NotImplementedError: pass ## ChangeServiceConfig2 and description do not exist on NT - + if delayedstart is not None: + try: + win32service.ChangeServiceConfig2(hs,win32service.SERVICE_CONFIG_DELAYED_AUTO_START_INFO, delayedstart) + except (win32service.error, NotImplementedError): + ## Delayed start only exists on Vista and later. On Nt, will raise NotImplementedError since ChangeServiceConfig2 + ## doensn't exist. On Win2k and XP, will fail with ERROR_INVALID_LEVEL + ## Warn only if trying to set delayed to True + if delayedstart: + warnings.warn('Delayed Start not available on this system') finally: win32service.CloseServiceHandle(hs) finally: @@ -492,7 +510,7 @@ print "Options for 'install' and 'update' commands only:" print " --username domain\\username : The Username the service is to run under" print " --password password : The password for the username" - print " --startup [manual|auto|disabled] : How the service starts, default = manual" + print " --startup [manual|auto|disabled|delayed] : How the service starts, default = manual" print " --interactive : Allow the service to interact with the desktop." print " --perfmonini file: .ini file to use for registering performance monitor data" print " --perfmondll file: .dll file to use when querying the service for" @@ -536,6 +554,7 @@ password = None perfMonIni = perfMonDll = None startup = None + delayedstart = None interactive = None waitSecs = 0 for opt, val in opts: @@ -550,11 +569,19 @@ elif opt=='--interactive': interactive = 1 elif opt=='--startup': - map = {"manual": win32service.SERVICE_DEMAND_START, "auto" : win32service.SERVICE_AUTO_START, "disabled": win32service.SERVICE_DISABLED} + map = {"manual": win32service.SERVICE_DEMAND_START, + "auto" : win32service.SERVICE_AUTO_START, + "delayed": win32service.SERVICE_AUTO_START, ## ChangeServiceConfig2 called later + "disabled": win32service.SERVICE_DISABLED} try: startup = map[val.lower()] except KeyError: print "'%s' is not a valid startup option" % val + if val.lower() == "delayed": + delayedstart = True + elif val.lower() == "auto": + delayedstart = False + ## else no change elif opt=='--wait': try: waitSecs = int(val) @@ -635,7 +662,8 @@ # but is unlikely to work, as the Python code controlling it failed. Therefore # we remove the service if the first bit works, but the second doesnt! try: - InstallService(serviceClassString, serviceName, serviceDisplayName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, perfMonIni=perfMonIni,perfMonDll=perfMonDll,exeArgs=exeArgs,description=description) + InstallService(serviceClassString, serviceName, serviceDisplayName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, perfMonIni=perfMonIni,perfMonDll=perfMonDll,exeArgs=exeArgs, + description=description, delayedstart=delayedstart) if customOptionHandler: customOptionHandler(*(opts,)) print "Service installed" @@ -678,7 +706,8 @@ description=None print "Changing service configuration" try: - ChangeServiceConfig(serviceClassString, serviceName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, displayName = serviceDisplayName, perfMonIni=perfMonIni,perfMonDll=perfMonDll,exeArgs=exeArgs,description=description) + ChangeServiceConfig(serviceClassString, serviceName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, displayName = serviceDisplayName, perfMonIni=perfMonIni,perfMonDll=perfMonDll,exeArgs=exeArgs, + description=description, delayedstart=delayedstart) if customOptionHandler: customOptionHandler(*(opts,)) print "Service updated" |
|
From: <pyw...@li...> - 2011-07-11 18:00:03
|
changeset 7f3c50215fa5 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=7f3c50215fa5 summary: Add EnumServicesStatusEx diffstat: win32/src/win32service.i | 123 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 123 insertions(+), 0 deletions(-) diffs (157 lines): diff -r 067097188a61 -r 7f3c50215fa5 win32/src/win32service.i --- a/win32/src/win32service.i Sat Jun 25 11:09:04 2011 -0400 +++ b/win32/src/win32service.i Mon Jul 11 13:58:28 2011 -0400 @@ -17,9 +17,30 @@ ChangeServiceConfig2func fpChangeServiceConfig2=NULL; typedef BOOL (WINAPI *QueryServiceConfig2func)(SC_HANDLE,DWORD,LPBYTE,DWORD,LPDWORD); QueryServiceConfig2func fpQueryServiceConfig2=NULL; +typedef BOOL (WINAPI *EnumServicesStatusExfunc)(SC_HANDLE,SC_ENUM_TYPE,DWORD,DWORD, + LPBYTE,DWORD,LPDWORD,LPDWORD,LPDWORD,LPCTSTR); +EnumServicesStatusExfunc fpEnumServicesStatusEx=NULL; // according to msdn, 256 is limit for service names and service display names #define MAX_SERVICE_NAME_LEN 256 + +// Automatically freed WCHAR that can be used anywhere WCHAR * is required +class TmpWCHAR +{ +public: + WCHAR *tmp; + TmpWCHAR() { tmp=NULL; } + TmpWCHAR(WCHAR *t) { tmp=t; } + WCHAR * operator= (WCHAR *t){ + PyWinObject_FreeWCHAR(tmp); + tmp=t; + return t; + } + WCHAR ** operator& () {return &tmp;} + boolean operator== (WCHAR *t) { return tmp==t; } + operator WCHAR *() { return tmp; } + ~TmpWCHAR() { PyWinObject_FreeWCHAR(tmp); } +}; %} %init %{ @@ -49,6 +70,9 @@ fp=GetProcAddress(hmod,"QueryServiceConfig2W"); if (fp!=NULL) fpQueryServiceConfig2=(QueryServiceConfig2func)fp; + fp=GetProcAddress(hmod,"EnumServicesStatusExW"); + if (fp!=NULL) + fpEnumServicesStatusEx=(EnumServicesStatusExfunc)fp; } %} @@ -887,6 +911,102 @@ } %} +// @pyswig (dict,...)|EnumServicesStatusEx|Lists the status of services that meet the specified criteria +// @rdesc Returns a sequence of dicts, whose contents depend on information level requested. +// Currently, only information level supported is SC_ENUM_PROCESS_INFO (returns ENUM_SERVICE_STATUS_PROCESS). +// @pyseeapi EnumServicesStatusEx +%native (EnumServicesStatusEx) MyEnumServicesStatusEx; +%{ +static PyObject *MyEnumServicesStatusEx(PyObject *self, PyObject *args) +{ + // @pyparm <o PySC_HANDLE>|SCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> + // @pyparm int|ServiceType|SERVICE_WIN32|Types of services to enumerate (SERVICE_DRIVER and/or SERVICE_WIN32) + // @pyparm int|ServiceState|SERVICE_STATE_ALL|Limits to services in specified state + // @pyparm str|GroupName|None|Name of group - use None for all, or '' for services that don't belong to a group + // @pyparm int|InfoLevel|SC_ENUM_PROCESS_INFO|Currently SC_ENUM_PROCESS_INFO is only level defined + SC_HANDLE hscm; + PyObject *obgrp = Py_None, *ret = NULL; + DWORD service_type = SERVICE_WIN32, service_state = SERVICE_STATE_ALL; + TmpWCHAR grp; + DWORD lvl = SC_ENUM_PROCESS_INFO; + BYTE *buf=NULL; + DWORD buf_size=0, buf_needed, nbr_returned; + DWORD resume_handle =0, err=0; + BOOL bsuccess; + + if (fpEnumServicesStatusEx == NULL){ + PyErr_SetString(PyExc_NotImplementedError, "EnumServicesStatusEx does not exist on this platform"); + return NULL; + } + if (!PyArg_ParseTuple(args, "O&|kkOk:EnumServicesStatusEx", + PyWinObject_AsHANDLE, &hscm, + &service_type, &service_state, + &obgrp, &lvl)) + return NULL; + if (lvl != SC_ENUM_PROCESS_INFO){ + PyErr_SetString(PyExc_NotImplementedError, "Unsupported information level"); + return NULL; + } + if (!PyWinObject_AsWCHAR(obgrp, &grp, TRUE)) + return NULL; + ret = PyList_New(0); + if (ret==NULL) + return NULL; + while (true){ + Py_BEGIN_ALLOW_THREADS + bsuccess = (*fpEnumServicesStatusEx)(hscm, (SC_ENUM_TYPE)lvl, service_type, service_state, + buf, buf_size, &buf_needed, &nbr_returned, &resume_handle, grp); + Py_END_ALLOW_THREADS + if (!bsuccess){ + err=GetLastError(); + if (err != ERROR_MORE_DATA){ + PyWin_SetAPIError("EnumServicesStatusEx", err); + Py_DECREF(ret); + ret = NULL; + break; + } + } + // Function can return false with ERROR_MORE_DATA after retrieving some statuses + for (DWORD i=0; i<nbr_returned; i++){ + ENUM_SERVICE_STATUS_PROCESS *essp = (ENUM_SERVICE_STATUS_PROCESS *)buf; + TmpPyObject stat = Py_BuildValue("{s:N, s:N, s:k, s:k, s:k, s:k, s:k, s:k, s:k, s:k, s:k}", + "ServiceName", PyWinObject_FromTCHAR(essp[i].lpServiceName), + "DisplayName", PyWinObject_FromTCHAR(essp[i].lpDisplayName), + "ServiceType", essp[i].ServiceStatusProcess.dwServiceType, + "CurrentState", essp[i].ServiceStatusProcess.dwCurrentState, + "ControlsAccepted", essp[i].ServiceStatusProcess.dwControlsAccepted, + "Win32ExitCode", essp[i].ServiceStatusProcess.dwWin32ExitCode, + "ServiceSpecificExitCode", essp[i].ServiceStatusProcess.dwServiceSpecificExitCode, + "CheckPoint", essp[i].ServiceStatusProcess.dwCheckPoint, + "WaitHint", essp[i].ServiceStatusProcess.dwWaitHint, + "ProcessId", essp[i].ServiceStatusProcess.dwProcessId, + "ServiceFlags", essp[i].ServiceStatusProcess.dwServiceFlags); + if (stat == NULL || PyList_Append(ret, stat) == -1){ + Py_DECREF(ret); + ret=NULL; + break; + } + } + if (bsuccess || ret == NULL) + break; + if (buf) + free(buf); + buf=(BYTE *)malloc(buf_needed); + if (buf == NULL){ + PyErr_NoMemory(); + Py_DECREF(ret); + ret = NULL; + break; + } + buf_size = buf_needed; + } + + if (buf) + free(buf); + return ret; +} +%} + // @pyswig (tuple,...)|EnumDependentServices|Lists services that depend on a service // @rdesc Returns a sequence of tuples representing ENUM_SERVICE_STATUS structs: (ServiceName, DisplayName, <o SERVICE_STATUS>) %native (EnumDependentServices) MyEnumDependentServices; @@ -1849,6 +1969,9 @@ #define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO #define SERVICE_CONFIG_SERVICE_SID_INFO SERVICE_CONFIG_SERVICE_SID_INFO +// Info level for EnumServicesStatusEx +#define SC_ENUM_PROCESS_INFO SC_ENUM_PROCESS_INFO + // Used with SERVICE_CONFIG_SERVICE_SID_INFO #define SERVICE_SID_TYPE_NONE SERVICE_SID_TYPE_NONE #define SERVICE_SID_TYPE_RESTRICTED SERVICE_SID_TYPE_RESTRICTED |
|
From: <pyw...@li...> - 2011-06-25 18:42:30
|
changeset 067097188a61 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=067097188a61 summary: In DispatchBaseClass.__init__, use isinstance to determine type of base object diffstat: com/win32com/client/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 427c3e914293 -r 067097188a61 com/win32com/client/__init__.py --- a/com/win32com/client/__init__.py Fri Jun 24 02:57:51 2011 -0400 +++ b/com/win32com/client/__init__.py Sat Jun 25 11:09:04 2011 -0400 @@ -421,7 +421,7 @@ def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) - elif type(self) == type(oobj): # An instance + elif isinstance(oobj, DispatchBaseClass): try: oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) # Must be a valid COM instance except pythoncom.com_error, details: |
|
From: <pyw...@li...> - 2011-06-24 07:04:00
|
changeset 427c3e914293 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=427c3e914293 summary: Call PyType_Ready for Cursor_Type and Connection_Type diffstat: win32/src/odbc.cpp | 108 +++++++++++++++++++++++++++--------------------------- 1 files changed, 54 insertions(+), 54 deletions(-) diffs (176 lines): diff -r ade1cd374722 -r 427c3e914293 win32/src/odbc.cpp --- a/win32/src/odbc.cpp Tue Jun 21 22:23:45 2011 -0400 +++ b/win32/src/odbc.cpp Fri Jun 24 02:57:51 2011 -0400 @@ -1168,7 +1168,7 @@ PyObject *sitem = PyObject_Str(item); if (sitem==NULL) rv = 0; - else if PyString_Check(sitem) + else if (PyString_Check(sitem)) rv = ibindString(cur, iCol, sitem); else if PyUnicode_Check(sitem) rv = ibindUnicode(cur, iCol, sitem); @@ -1595,51 +1595,46 @@ return NULL; while (ob) { - SQLLEN cbRequired; - RETCODE rc; - SQLLEN cbRead = 0; - /* Use SQLGetData to retrieve data for blob (or long varchar) type columns. */ - if (ob->bGetData) - { - /* Initialize memory (offsets, etc.) - (use bind_area for buffer, and dynamically allocate in the loop below) */ - cbRequired = ob->vsize; - ob->rcode = 0; - cbRead = 0; /* Count of bytes read (running total and offset into buffer). */ - - /* Loop until SQLGetData tells us that there are no more chunks - of the blob to retrieve. */ - do - { - /* Check to see if bind_area is big enough - if cbRequired > vsize - re-allocate bind_area to cbRequired - set ob->vsize = cbRequired */ - if (cbRequired > ob->vsize) - { - void *pTemp = ob->bind_area; + if (ob->bGetData) + { + /* Use SQLGetData to retrieve data for blob (or long varchar) type columns. + Loop until return code indicates all remaining data fit into buffer. + */ + RETCODE rc; + SQLLEN cbRead = 0; + ob->rcode = 0; + do + { + /* Increase buffer size by cursor chunk size on second and subsequent calls + If not for the SQL Anywhere 5.0 problem (driver version + 5.05.041867), we could probably grow by 50% each time + or the remaining size (as determined by ob->rcode). + Regarding above note, caller can now use cursor.setoutputsize + to work around any such bug in a driver */ + if (ob->rcode){ + void *pTemp = ob->bind_area; + ob->vsize += cur->max_width; /* Some BLOBs can be huge, be paranoid about allowing other threads to run. */ Py_BEGIN_ALLOW_THREADS - ob->bind_area = realloc (ob->bind_area, cbRequired); + ob->bind_area = realloc (ob->bind_area, ob->vsize); Py_END_ALLOW_THREADS if (ob->bind_area == NULL){ PyErr_NoMemory(); + ob->vsize -= cur->max_width; ob->bind_area = pTemp; Py_DECREF(row); return NULL; } - ob->vsize = cbRequired; } - /* rc = GetData( ... , bind_area + offset, vsize - offset, &rcode ) */ Py_BEGIN_ALLOW_THREADS - rc = SQLGetData(cur->hstmt, - ob->pos, - ob->vtype, - (char *)ob->bind_area + cbRead, - ob->vsize - cbRead, - &ob->rcode); + rc = SQLGetData(cur->hstmt, + ob->pos, + ob->vtype, + (char *)ob->bind_area + cbRead, + ob->vsize - cbRead, + &ob->rcode); Py_END_ALLOW_THREADS if (unsuccessful(rc)) { @@ -1647,35 +1642,31 @@ cursorError(cur, _T("SQLGetData")); return NULL; } - /* Returned length is total length remaining including current read. - If length is not known, returns SQL_NO_TOTAL */ - if ((ob->rcode != SQL_NO_TOTAL) && (ob->rcode <= cur->max_width)) + /* Return code can be a negative status code: + SQL_NO_TOTAL if length is not known, SQL_NULL_DATA if nothing to retreive + Otherwise will be total bytes remaining including current read. + */ + if (ob->rcode >= 0 && ob->rcode <= ob->vsize - cbRead) { - /* If we get here, then this should be the last iteration through the loop. */ - cbRead += ob->rcode; + /* If we get here, then this should be the last iteration through the loop. */ + ob->rcode += cbRead; } else { - /* Grow buffer by cursor chunk size for each read. - If not for the SQL Anywhere 5.0 problem (driver version - 5.05.041867), we could probably grow by 50% each time - or the remaining size (as determined by ob->rcode). - Regarding above note, caller can now use cursor.setoutputsize - to work around any such bug in a driver */ - cbRequired += cur->max_width; + cbRead = ob->vsize; /* We want to ignore the intermediate NULL characters SQLGetData() gives us. (silly, silly) */ if (ob->vtype == SQL_C_CHAR) - cbRead = ob->vsize - 1; + cbRead--; else if (ob->vtype == SQL_C_WCHAR) - cbRead = ob->vsize - sizeof(WCHAR); - else - cbRead = ob->vsize; - } + /* Buffer is not guaranteed to be an exact multiple of sizeof(WCHAR), + leaving an extra byte and throwing the next get off by 1. */ + cbRead -= sizeof(WCHAR) + ob->vsize%sizeof(WCHAR); + } - } while (rc == SQL_SUCCESS_WITH_INFO); - } + } while (rc == SQL_SUCCESS_WITH_INFO); + } PyObject *v; if (ob->rcode == SQL_NULL_DATA) @@ -1696,7 +1687,7 @@ { v = ob->copy_fcn( ob->bind_area, - cbRead); + ob->rcode); } if (!v) { @@ -1749,7 +1740,11 @@ } else { - PyList_Append(list, entry); + if (PyList_Append(list, entry) == -1){ + Py_DECREF(list); + Py_DECREF(entry); + return NULL; + } Py_DECREF(entry); } } @@ -1995,6 +1990,11 @@ PYWIN_MODULE_INIT_PREPARE(odbc, globalMethods, "A Python wrapper around the ODBC API."); + if (PyType_Ready(&Cursor_Type) == -1) + PYWIN_MODULE_INIT_RETURN_ERROR; + if (PyType_Ready(&Connection_Type) == -1) + PYWIN_MODULE_INIT_RETURN_ERROR; + // Sql dates are now returned as python's datetime object. // C Api for datetime didn't exist in 2.3, stick to dynamic semantics for now. datetime_module=PyImport_ImportModule("datetime"); |
|
From: <pyw...@li...> - 2011-06-22 02:37:02
|
changeset ade1cd374722 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=ade1cd374722 summary: Remove some more project files diffstat: setup.py | 8 +- win32/_win32 projects.dsp | 80 -------------------------- win32/mmapfile.dsp | 102 ---------------------------------- win32/odbc.dsp | 103 ---------------------------------- win32/timer.dsp | 102 ---------------------------------- win32/win32api.dsp | 102 ---------------------------------- win32/win32clipboard.dsp | 109 ------------------------------------ win32/win32net.dsp | 130 ------------------------------------------- win32/win32pipe.dsp | 137 --------------------------------------------- 9 files changed, 4 insertions(+), 869 deletions(-) diffs (truncated from 923 to 300 lines): diff -r c59fea6e83fb -r ade1cd374722 setup.py --- a/setup.py Tue Jun 21 18:05:52 2011 -0400 +++ b/setup.py Tue Jun 21 22:23:45 2011 -0400 @@ -1579,10 +1579,10 @@ for info in ( # (name, libraries, UNICODE, WINVER, sources) - ("mmapfile", "", None), - ("odbc", "odbc32 odbccp32", None), + ("mmapfile", "", None, None, "win32/src/mmapfilemodule.cpp"), + ("odbc", "odbc32 odbccp32", None, None, "win32/src/odbc.cpp"), ("perfmon", "", True), - ("timer", "user32", None), + ("timer", "user32", None, None, "win32/src/timermodule.cpp"), ("win2kras", "rasapi32", None, 0x0500), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), ("win32crypt", "Crypt32", None, 0x0500, 'win32/src/win32crypt.i'), @@ -1591,7 +1591,7 @@ win32/src/win32file_comm.cpp """), ("win32event", "user32", None, None, "win32/src/win32event.i"), - ("win32clipboard", "gdi32 user32 shell32", None), + ("win32clipboard", "gdi32 user32 shell32", None, None, "win32/src/win32clipboardmodule.cpp"), # win32gui handled below ("win32job", "user32", True, 0x0500, 'win32/src/win32job.i'), diff -r c59fea6e83fb -r ade1cd374722 win32/_win32 projects.dsp --- a/win32/_win32 projects.dsp Tue Jun 21 18:05:52 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -# Microsoft Developer Studio Project File - Name="_win32 projects" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) External Target" 0x0106 - -CFG=_win32 projects - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "_win32 projects.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_win32 projects.mak" CFG="_win32 projects - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_win32 projects - Win32 Release" (based on "Win32 (x86) External Target") -!MESSAGE "_win32 projects - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Python/win32", IOAAAAAA" -# PROP Scc_LocalPath "." - -!IF "$(CFG)" == "_win32 projects - Win32 Release" - -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp" -# PROP BASE Cmd_Line "NMAKE /f "_win32 projects.mak"" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "_win32 projects.exe" -# PROP BASE Bsc_Name "_win32 projects.bsc" -# PROP BASE Target_Dir "" -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp" -# PROP Cmd_Line "" -# PROP Rebuild_Opt "" -# PROP Target_File "_win32 projects.exe" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ELSEIF "$(CFG)" == "_win32 projects - Win32 Debug" - -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp" -# PROP BASE Cmd_Line "NMAKE /f "_win32 projects.mak"" -# PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "_win32 projects.exe" -# PROP BASE Bsc_Name "_win32 projects.bsc" -# PROP BASE Target_Dir "" -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build" -# PROP Cmd_Line "" -# PROP Rebuild_Opt "" -# PROP Bsc_Name "" -# PROP Target_Dir "" - -!ENDIF - -# Begin Target - -# Name "_win32 projects - Win32 Release" -# Name "_win32 projects - Win32 Debug" - -!IF "$(CFG)" == "_win32 projects - Win32 Release" - -!ELSEIF "$(CFG)" == "_win32 projects - Win32 Debug" - -!ENDIF - -# End Target -# End Project diff -r c59fea6e83fb -r ade1cd374722 win32/mmapfile.dsp --- a/win32/mmapfile.dsp Tue Jun 21 18:05:52 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mmapfile" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=mmapfile - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mmapfile.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mmapfile.mak" CFG="mmapfile - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mmapfile - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "mmapfile - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Python/win32", NNAAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mmapfile - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\mmapfile\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\mmapfile\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "NDEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e250000" /subsystem:windows /dll /debug /machine:I386 /out:"Build/mmapfile.pyd" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "mmapfile - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\mmapfile\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\mmapfile\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "_DEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e250000" /subsystem:windows /dll /debug /machine:I386 /out:"Build\mmapfile_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mmapfile - Win32 Release" -# Name "mmapfile - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\mmapfilemodule.cpp -# End Source File -# End Group -# End Target -# End Project diff -r c59fea6e83fb -r ade1cd374722 win32/odbc.dsp --- a/win32/odbc.dsp Tue Jun 21 18:05:52 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="odbc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=odbc - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "odbc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "odbc.mak" CFG="odbc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "odbc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "odbc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Python/win32", RNAAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "odbc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\odbc\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\odbc\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "NDEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1e710000" /subsystem:windows /dll /debug /machine:I386 /out:"Build\odbc.pyd" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "odbc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\odbc\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\odbc\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "_DEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe |