pywin32-checkins Mailing List for Python for Windows Extensions (Page 87)
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: Roger U. <ru...@us...> - 2007-08-07 06:38:27
|
Update of /cvsroot/pywin32/pywin32/com/win32com/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10941/com/win32com/server Modified Files: util.py Log Message: Return values from FileStream's IStream methods Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/util.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** util.py 26 May 2004 09:41:18 -0000 1.5 --- util.py 7 Aug 2007 06:38:11 -0000 1.6 *************** *** 201,204 **** --- 201,205 ---- def Write(self, data): self.file.write(data) + return len(data) def Clone(self): *************** *** 206,214 **** def CopyTo(self, dest, cb): ! dest.Write(file.read(cb)) def Seek(self, offset, origin): # how convient that the 'origin' values are the same as the CRT :) self.file.seek(offset, origin) def _wrap(self, ob): --- 207,219 ---- def CopyTo(self, dest, cb): ! data=self.file.read(cb) ! cbread=len(data) ! dest.Write(data) ## ??? Write does not currently return the length ??? ! return cbread, cbread def Seek(self, offset, origin): # how convient that the 'origin' values are the same as the CRT :) self.file.seek(offset, origin) + return self.file.tell() def _wrap(self, ob): |
From: Roger U. <ru...@us...> - 2007-08-02 07:08:17
|
Update of /cvsroot/pywin32/pywin32/win32/Demos/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25511/win32/Demos/security Added Files: GetTokenInformation.py Log Message: Dumps access token information --- NEW FILE: GetTokenInformation.py --- """ Lists various types of information about current user's access token, including UAC status on Vista """ import pywintypes, win32api, win32security import win32con, winerror from security_enums import TOKEN_GROUP_ATTRIBUTES, TOKEN_PRIVILEGE_ATTRIBUTES, \ SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, TOKEN_ELEVATION_TYPE def dump_token(th): token_type=win32security.GetTokenInformation(th, win32security.TokenType) print 'TokenType:', token_type, TOKEN_TYPE.lookup_name(token_type) if token_type==win32security.TokenImpersonation: imp_lvl=win32security.GetTokenInformation(th, win32security.TokenImpersonationLevel) print 'TokenImpersonationLevel:', imp_lvl, SECURITY_IMPERSONATION_LEVEL.lookup_name(imp_lvl) print 'TokenSessionId:', win32security.GetTokenInformation(th, win32security.TokenSessionId) privs=win32security.GetTokenInformation(th,win32security.TokenPrivileges) print 'TokenPrivileges:' for priv_luid, priv_flags in privs: flag_names, unk=TOKEN_PRIVILEGE_ATTRIBUTES.lookup_flags(priv_flags) flag_desc = ' '.join(flag_names) if (unk): flag_desc += '(' + str(unk) + ')' priv_name=win32security.LookupPrivilegeName('',priv_luid) priv_desc=win32security.LookupPrivilegeDisplayName('',priv_name) print '\t', priv_name, priv_desc, priv_flags, flag_desc print 'TokenGroups:' groups=win32security.GetTokenInformation(th,win32security.TokenGroups) for group_sid, group_attr in groups: flag_names, unk=TOKEN_GROUP_ATTRIBUTES.lookup_flags(group_attr) flag_desc = ' '.join(flag_names) if (unk): flag_desc += '(' + str(unk) + ')' if group_attr & TOKEN_GROUP_ATTRIBUTES.SE_GROUP_LOGON_ID: sid_desc = 'Logon sid' else: sid_desc=win32security.LookupAccountSid('',group_sid) print '\t',group_sid, sid_desc, group_attr, flag_desc ## Vista token information types, will throw (87, 'GetTokenInformation', 'The parameter is incorrect.') on earier OS try: is_elevated=win32security.GetTokenInformation(th, win32security.TokenElevation) print 'TokenElevation:', is_elevated except pywintypes.error, details: if details[0] != winerror.ERROR_INVALID_PARAMETER: raise return None print 'TokenHasRestrictions:', win32security.GetTokenInformation(th, win32security.TokenHasRestrictions) print 'TokenMandatoryPolicy', win32security.GetTokenInformation(th, win32security.TokenMandatoryPolicy) print 'TokenVirtualizationAllowed:', win32security.GetTokenInformation(th, win32security.TokenVirtualizationAllowed) print 'TokenVirtualizationEnabled:', win32security.GetTokenInformation(th, win32security.TokenVirtualizationEnabled) elevation_type = win32security.GetTokenInformation(th, win32security.TokenElevationType) print 'TokenElevationType:', elevation_type, TOKEN_ELEVATION_TYPE.lookup_name(elevation_type) if elevation_type<>win32security.TokenElevationTypeDefault: lt=win32security.GetTokenInformation(th, win32security.TokenLinkedToken) print 'TokenLinkedToken:', lt else: lt=None return lt ph = win32api.GetCurrentProcess() th = win32security.OpenProcessToken(ph,win32con.MAXIMUM_ALLOWED) lt = dump_token(th) if lt: print '\n\nlinked token info:' dump_token(lt) |
From: Roger U. <ru...@us...> - 2007-08-02 07:04:16
|
Update of /cvsroot/pywin32/pywin32/win32/Demos/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23996/win32/Demos/security Modified Files: security_enums.py Log Message: Add lookup functionality to Enum class, and some new sets of constants Index: security_enums.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/security/security_enums.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** security_enums.py 10 Mar 2003 01:18:15 -0000 1.1 --- security_enums.py 2 Aug 2007 07:04:16 -0000 1.2 *************** *** 1,23 **** ! import win32security class Enum: ! def __init__(self,*consts): ! for const in consts: ! setattr(self,const,getattr(win32security,const)) TOKEN_INFORMATION_CLASS = Enum( ! 'TokenDefaultDacl', 'TokenGroups', ! 'TokenGroupsAndPrivileges', ! 'TokenImpersonationLevel', 'TokenOwner', 'TokenPrimaryGroup', ! 'TokenPrivileges', ! 'TokenRestrictedSids', ! 'TokenSandBoxInert', ! 'TokenSessionId', 'TokenSource', 'TokenStatistics', ! 'TokenType', ! 'TokenUser') TOKEN_TYPE = Enum( --- 1,67 ---- ! import win32security, ntsecuritycon, winnt ! class Enum: ! def __init__(self, *const_names): ! """Accepts variable number of constant names that can be found in either ! win32security, ntsecuritycon, or winnt.""" ! for const_name in const_names: ! try: ! const_val=getattr(win32security,const_name) ! except AttributeError: ! try: ! const_val=getattr(ntsecuritycon, const_name) ! except AttributeError: ! try: ! const_val=getattr(winnt, const_name) ! except AttributeError: ! raise AttributeError, 'Constant "%s" not found in win32security, ntsecuritycon, or winnt.' %const_name ! setattr(self, const_name, const_val) ! ! def lookup_name(self, const_val): ! """Looks up the name of a particular value.""" ! for k,v in self.__dict__.items(): ! if v==const_val: ! return k ! raise AttributeError, 'Value %s not found in enum' %const_val ! ! def lookup_flags(self, flags): ! """Returns the names of all recognized flags in input, and any flags not found in the enum.""" ! flag_names=[] ! unknown_flags=flags ! for k,v in self.__dict__.items(): ! if flags & v == v: ! flag_names.append(k) ! unknown_flags = unknown_flags & ~v ! return flag_names, unknown_flags TOKEN_INFORMATION_CLASS = Enum( ! 'TokenUser', 'TokenGroups', ! 'TokenPrivileges', 'TokenOwner', 'TokenPrimaryGroup', ! 'TokenDefaultDacl', 'TokenSource', + 'TokenType', + 'TokenImpersonationLevel', 'TokenStatistics', ! 'TokenRestrictedSids', ! 'TokenSessionId', ! 'TokenGroupsAndPrivileges', ! 'TokenSessionReference', ! 'TokenSandBoxInert', ! 'TokenAuditPolicy', ! 'TokenOrigin', ! 'TokenElevationType', ! 'TokenLinkedToken', ! 'TokenElevation', ! 'TokenHasRestrictions', ! 'TokenAccessInformation', ! 'TokenVirtualizationAllowed', ! 'TokenVirtualizationEnabled', ! 'TokenIntegrityLevel', ! 'TokenUIAccess', ! 'TokenMandatoryPolicy', ! 'TokenLogonSid') TOKEN_TYPE = Enum( *************** *** 25,28 **** --- 69,77 ---- 'TokenImpersonation') + TOKEN_ELEVATION_TYPE = Enum( + 'TokenElevationTypeDefault', + 'TokenElevationTypeFull', + 'TokenElevationTypeLimited') + POLICY_AUDIT_EVENT_TYPE = Enum( 'AuditCategorySystem', *************** *** 83,92 **** # AceType in ACE_HEADER - not a real enum ACE_TYPE = Enum( 'ACCESS_ALLOWED_ACE_TYPE', - 'ACCESS_ALLOWED_OBJECT_ACE_TYPE', 'ACCESS_DENIED_ACE_TYPE', - 'ACCESS_DENIED_OBJECT_ACE_TYPE', 'SYSTEM_AUDIT_ACE_TYPE', ! 'SYSTEM_AUDIT_OBJECT_ACE_TYPE') #bit flags for AceFlags - not a real enum --- 132,161 ---- # AceType in ACE_HEADER - not a real enum ACE_TYPE = Enum( + 'ACCESS_MIN_MS_ACE_TYPE', 'ACCESS_ALLOWED_ACE_TYPE', 'ACCESS_DENIED_ACE_TYPE', 'SYSTEM_AUDIT_ACE_TYPE', ! 'SYSTEM_ALARM_ACE_TYPE', ! 'ACCESS_MAX_MS_V2_ACE_TYPE', ! 'ACCESS_ALLOWED_COMPOUND_ACE_TYPE', ! 'ACCESS_MAX_MS_V3_ACE_TYPE', ! 'ACCESS_MIN_MS_OBJECT_ACE_TYPE', ! 'ACCESS_ALLOWED_OBJECT_ACE_TYPE', ! 'ACCESS_DENIED_OBJECT_ACE_TYPE', ! 'SYSTEM_AUDIT_OBJECT_ACE_TYPE', ! 'SYSTEM_ALARM_OBJECT_ACE_TYPE', ! 'ACCESS_MAX_MS_OBJECT_ACE_TYPE', ! 'ACCESS_MAX_MS_V4_ACE_TYPE', ! 'ACCESS_MAX_MS_ACE_TYPE', ! 'ACCESS_ALLOWED_CALLBACK_ACE_TYPE', ! 'ACCESS_DENIED_CALLBACK_ACE_TYPE', ! 'ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE', ! 'ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE', ! 'SYSTEM_AUDIT_CALLBACK_ACE_TYPE', ! 'SYSTEM_ALARM_CALLBACK_ACE_TYPE', ! 'SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE', ! 'SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE', ! 'SYSTEM_MANDATORY_LABEL_ACE_TYPE', ! 'ACCESS_MAX_MS_V5_ACE_TYPE') #bit flags for AceFlags - not a real enum *************** *** 138,142 **** 'SidTypeInvalid', 'SidTypeUnknown', ! 'SidTypeComputer') ## bit flags, not a real enum --- 207,212 ---- 'SidTypeInvalid', 'SidTypeUnknown', ! 'SidTypeComputer', ! 'SidTypeLabel') ## bit flags, not a real enum *************** *** 227,228 **** --- 297,316 ---- 'SE_PRIVILEGE_USED_FOR_ACCESS') + # Group flags used with TokenGroups + TOKEN_GROUP_ATTRIBUTES = Enum( + 'SE_GROUP_MANDATORY', + 'SE_GROUP_ENABLED_BY_DEFAULT', + 'SE_GROUP_ENABLED', + 'SE_GROUP_OWNER', + 'SE_GROUP_USE_FOR_DENY_ONLY', + 'SE_GROUP_INTEGRITY', + 'SE_GROUP_INTEGRITY_ENABLED', + 'SE_GROUP_LOGON_ID', + 'SE_GROUP_RESOURCE') + + # Privilege flags returned by TokenPrivileges + TOKEN_PRIVILEGE_ATTRIBUTES = Enum( + 'SE_PRIVILEGE_ENABLED_BY_DEFAULT', + 'SE_PRIVILEGE_ENABLED', + 'SE_PRIVILEGE_REMOVED', + 'SE_PRIVILEGE_USED_FOR_ACCESS') |
From: Roger U. <ru...@us...> - 2007-08-02 07:01:20
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22896/win32/Lib Modified Files: ntsecuritycon.py Log Message: Add a couple of SID types Index: ntsecuritycon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/ntsecuritycon.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ntsecuritycon.py 23 Jul 2007 05:11:08 -0000 1.7 --- ntsecuritycon.py 2 Aug 2007 07:01:18 -0000 1.8 *************** *** 287,290 **** --- 287,292 ---- SidTypeInvalid = 7 SidTypeUnknown = 8 + SidTypeComputer = 9 + SidTypeLabel = 10 # Token types |
From: Roger U. <ru...@us...> - 2007-08-02 04:35:13
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32119/win32/src Modified Files: win32security.i Log Message: Add IsTokenRestricted Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** win32security.i 1 Aug 2007 19:14:09 -0000 1.42 --- win32security.i 2 Aug 2007 04:35:14 -0000 1.43 *************** *** 72,75 **** --- 72,77 ---- typedef BOOL (WINAPI *ImpersonateAnonymousTokenfunc)(HANDLE); static ImpersonateAnonymousTokenfunc pfnImpersonateAnonymousToken=NULL; + typedef BOOL (WINAPI *IsTokenRestrictedfunc)(HANDLE); + static IsTokenRestrictedfunc pfnIsTokenRestricted = NULL; typedef PSecurityFunctionTableW (SEC_ENTRY *InitSecurityInterfacefunc)(void); *************** *** 835,838 **** --- 837,841 ---- loadapifunc("ConvertStringSecurityDescriptorToSecurityDescriptorW", advapi32_dll); pfnImpersonateAnonymousToken=(ImpersonateAnonymousTokenfunc)loadapifunc("ImpersonateAnonymousToken", advapi32_dll); + pfnIsTokenRestricted=(IsTokenRestrictedfunc)loadapifunc("IsTokenRestricted", advapi32_dll); // Load InitSecurityInterface, which returns a table of pointers to the SSPI functions so they don't all have to be *************** *** 988,994 **** ); - // @pyswig |ImpersonateAnonymousToken|Cause a thread to act in the security context of an anonymous token %native(ImpersonateAnonymousToken) PyImpersonateAnonymousToken; %{ static PyObject * PyImpersonateAnonymousToken(PyObject *self, PyObject *args) { --- 991,998 ---- ); %native(ImpersonateAnonymousToken) PyImpersonateAnonymousToken; + %native(IsTokenRestricted) PyIsTokenRestricted; %{ + // @pyswig |ImpersonateAnonymousToken|Cause a thread to act in the security context of an anonymous token static PyObject * PyImpersonateAnonymousToken(PyObject *self, PyObject *args) { *************** *** 1005,1008 **** --- 1009,1026 ---- return Py_None; } + + // @pyswig bool|IsTokenRestricted|Checks if a token contains restricted sids + static PyObject * PyIsTokenRestricted(PyObject *self, PyObject *args) + { + HANDLE th; // @pyparm <o PyHANDLE>|TokenHandle||Handle to an access token + PyObject *obth; + CHECK_PFN(IsTokenRestricted); + if (!PyArg_ParseTuple(args, "O:IsTokenRestricted", &obth)) + return NULL; + if (!PyWinObject_AsHANDLE(obth, &th)) + return NULL; + BOOL ret=(*pfnIsTokenRestricted)(th); + return PyBool_FromLong(ret); + } %} |
From: Roger U. <ru...@us...> - 2007-08-02 04:31:39
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30980/win32/src Modified Files: PyWinTypes.h Log Message: Fix warning in ifdef Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** PyWinTypes.h 13 Jul 2007 02:59:33 -0000 1.46 --- PyWinTypes.h 2 Aug 2007 04:31:40 -0000 1.47 *************** *** 168,172 **** // Its not clear how to resolve this, but while VS2003 is the default // compiler, that is what must work. ! #if 0 and _MSC_VER >= 1400 inline BOOL PyWinObject_AsWCHAR(PyObject *stringObject, unsigned short **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL) { --- 168,172 ---- // Its not clear how to resolve this, but while VS2003 is the default // compiler, that is what must work. ! #if 0 // and _MSC_VER >= 1400 inline BOOL PyWinObject_AsWCHAR(PyObject *stringObject, unsigned short **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL) { |
From: Roger U. <ru...@us...> - 2007-08-01 19:14:08
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15017/win32/src Modified Files: win32security.i Log Message: Add SE_PRIVILEGE_REMOVED Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** win32security.i 25 Jul 2007 04:50:10 -0000 1.41 --- win32security.i 1 Aug 2007 19:14:09 -0000 1.42 *************** *** 4117,4120 **** --- 4117,4121 ---- #define SE_PRIVILEGE_ENABLED_BY_DEFAULT SE_PRIVILEGE_ENABLED_BY_DEFAULT #define SE_PRIVILEGE_ENABLED SE_PRIVILEGE_ENABLED + #define SE_PRIVILEGE_REMOVED SE_PRIVILEGE_REMOVED #define SE_PRIVILEGE_USED_FOR_ACCESS SE_PRIVILEGE_USED_FOR_ACCESS |
From: Roger U. <ru...@us...> - 2007-07-25 04:50:12
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8698/win32/src Modified Files: win32security.i Log Message: Add some new types to SetTokenInformation, and more new constants Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** win32security.i 19 Jul 2007 06:31:20 -0000 1.40 --- win32security.i 25 Jul 2007 04:50:10 -0000 1.41 *************** *** 708,711 **** --- 708,799 ---- PyModule_AddIntConstant(m,"SE_GROUP_INTEGRITY", SE_GROUP_INTEGRITY); PyModule_AddIntConstant(m,"SE_GROUP_INTEGRITY_ENABLED", SE_GROUP_INTEGRITY_ENABLED); + + // Access mask used with integrity level ACE's (SYSTEM_MANDATORY_LABEL_ACE_TYPE) + PyModule_AddIntConstant(m,"SYSTEM_MANDATORY_LABEL_NO_WRITE_UP", SYSTEM_MANDATORY_LABEL_NO_WRITE_UP); + PyModule_AddIntConstant(m,"SYSTEM_MANDATORY_LABEL_NO_READ_UP", SYSTEM_MANDATORY_LABEL_NO_READ_UP); + PyModule_AddIntConstant(m,"SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP", SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP); + PyModule_AddIntConstant(m,"SYSTEM_MANDATORY_LABEL_VALID_MASK", SYSTEM_MANDATORY_LABEL_VALID_MASK); + #endif + + // WELL_KNOWN_SID_TYPE used with CreateWellKnownSid + PyModule_AddIntConstant(m,"WinNullSid", WinNullSid); + PyModule_AddIntConstant(m,"WinWorldSid", WinWorldSid); + PyModule_AddIntConstant(m,"WinLocalSid", WinLocalSid); + PyModule_AddIntConstant(m,"WinCreatorOwnerSid", WinCreatorOwnerSid); + PyModule_AddIntConstant(m,"WinCreatorGroupSid", WinCreatorGroupSid); + PyModule_AddIntConstant(m,"WinCreatorOwnerServerSid", WinCreatorOwnerServerSid); + PyModule_AddIntConstant(m,"WinCreatorGroupServerSid", WinCreatorGroupServerSid); + PyModule_AddIntConstant(m,"WinNtAuthoritySid", WinNtAuthoritySid); + PyModule_AddIntConstant(m,"WinDialupSid", WinDialupSid); + PyModule_AddIntConstant(m,"WinNetworkSid", WinNetworkSid); + PyModule_AddIntConstant(m,"WinBatchSid", WinBatchSid); + PyModule_AddIntConstant(m,"WinInteractiveSid", WinInteractiveSid); + PyModule_AddIntConstant(m,"WinServiceSid", WinServiceSid); + PyModule_AddIntConstant(m,"WinAnonymousSid", WinAnonymousSid); + PyModule_AddIntConstant(m,"WinProxySid", WinProxySid); + PyModule_AddIntConstant(m,"WinEnterpriseControllersSid", WinEnterpriseControllersSid); + PyModule_AddIntConstant(m,"WinSelfSid", WinSelfSid); + PyModule_AddIntConstant(m,"WinAuthenticatedUserSid", WinAuthenticatedUserSid); + PyModule_AddIntConstant(m,"WinRestrictedCodeSid", WinRestrictedCodeSid); + PyModule_AddIntConstant(m,"WinTerminalServerSid", WinTerminalServerSid); + PyModule_AddIntConstant(m,"WinRemoteLogonIdSid", WinRemoteLogonIdSid); + PyModule_AddIntConstant(m,"WinLogonIdsSid", WinLogonIdsSid); + PyModule_AddIntConstant(m,"WinLocalSystemSid", WinLocalSystemSid); + PyModule_AddIntConstant(m,"WinLocalServiceSid", WinLocalServiceSid); + PyModule_AddIntConstant(m,"WinNetworkServiceSid", WinNetworkServiceSid); + PyModule_AddIntConstant(m,"WinBuiltinDomainSid", WinBuiltinDomainSid); + PyModule_AddIntConstant(m,"WinBuiltinAdministratorsSid", WinBuiltinAdministratorsSid); + PyModule_AddIntConstant(m,"WinBuiltinUsersSid", WinBuiltinUsersSid); + PyModule_AddIntConstant(m,"WinBuiltinGuestsSid", WinBuiltinGuestsSid); + PyModule_AddIntConstant(m,"WinBuiltinPowerUsersSid", WinBuiltinPowerUsersSid); + PyModule_AddIntConstant(m,"WinBuiltinAccountOperatorsSid", WinBuiltinAccountOperatorsSid); + PyModule_AddIntConstant(m,"WinBuiltinSystemOperatorsSid", WinBuiltinSystemOperatorsSid); + PyModule_AddIntConstant(m,"WinBuiltinPrintOperatorsSid", WinBuiltinPrintOperatorsSid); + PyModule_AddIntConstant(m,"WinBuiltinBackupOperatorsSid", WinBuiltinBackupOperatorsSid); + PyModule_AddIntConstant(m,"WinBuiltinReplicatorSid", WinBuiltinReplicatorSid); + PyModule_AddIntConstant(m,"WinBuiltinPreWindows2000CompatibleAccessSid", WinBuiltinPreWindows2000CompatibleAccessSid); + PyModule_AddIntConstant(m,"WinBuiltinRemoteDesktopUsersSid", WinBuiltinRemoteDesktopUsersSid); + PyModule_AddIntConstant(m,"WinBuiltinNetworkConfigurationOperatorsSid", WinBuiltinNetworkConfigurationOperatorsSid); + PyModule_AddIntConstant(m,"WinAccountAdministratorSid", WinAccountAdministratorSid); + PyModule_AddIntConstant(m,"WinAccountGuestSid", WinAccountGuestSid); + PyModule_AddIntConstant(m,"WinAccountKrbtgtSid", WinAccountKrbtgtSid); + PyModule_AddIntConstant(m,"WinAccountDomainAdminsSid", WinAccountDomainAdminsSid); + PyModule_AddIntConstant(m,"WinAccountDomainUsersSid", WinAccountDomainUsersSid); + PyModule_AddIntConstant(m,"WinAccountDomainGuestsSid", WinAccountDomainGuestsSid); + PyModule_AddIntConstant(m,"WinAccountComputersSid", WinAccountComputersSid); + PyModule_AddIntConstant(m,"WinAccountControllersSid", WinAccountControllersSid); + PyModule_AddIntConstant(m,"WinAccountCertAdminsSid", WinAccountCertAdminsSid); + PyModule_AddIntConstant(m,"WinAccountSchemaAdminsSid", WinAccountSchemaAdminsSid); + PyModule_AddIntConstant(m,"WinAccountEnterpriseAdminsSid", WinAccountEnterpriseAdminsSid); + PyModule_AddIntConstant(m,"WinAccountPolicyAdminsSid", WinAccountPolicyAdminsSid); + PyModule_AddIntConstant(m,"WinAccountRasAndIasServersSid", WinAccountRasAndIasServersSid); + PyModule_AddIntConstant(m,"WinNTLMAuthenticationSid", WinNTLMAuthenticationSid); + PyModule_AddIntConstant(m,"WinDigestAuthenticationSid", WinDigestAuthenticationSid); + PyModule_AddIntConstant(m,"WinSChannelAuthenticationSid", WinSChannelAuthenticationSid); + PyModule_AddIntConstant(m,"WinThisOrganizationSid", WinThisOrganizationSid); + PyModule_AddIntConstant(m,"WinOtherOrganizationSid", WinOtherOrganizationSid); + PyModule_AddIntConstant(m,"WinBuiltinIncomingForestTrustBuildersSid", WinBuiltinIncomingForestTrustBuildersSid); + PyModule_AddIntConstant(m,"WinBuiltinPerfMonitoringUsersSid", WinBuiltinPerfMonitoringUsersSid); + PyModule_AddIntConstant(m,"WinBuiltinPerfLoggingUsersSid", WinBuiltinPerfLoggingUsersSid); + // These require recent SDK + #ifdef _WIN32_WINNT_LONGHORN + PyModule_AddIntConstant(m,"WinBuiltinAuthorizationAccessSid", WinBuiltinAuthorizationAccessSid); + PyModule_AddIntConstant(m,"WinBuiltinTerminalServerLicenseServersSid", WinBuiltinTerminalServerLicenseServersSid); + PyModule_AddIntConstant(m,"WinBuiltinDCOMUsersSid", WinBuiltinDCOMUsersSid); + PyModule_AddIntConstant(m,"WinBuiltinIUsersSid", WinBuiltinIUsersSid); + PyModule_AddIntConstant(m,"WinIUserSid", WinIUserSid); + PyModule_AddIntConstant(m,"WinBuiltinCryptoOperatorsSid", WinBuiltinCryptoOperatorsSid); + PyModule_AddIntConstant(m,"WinUntrustedLabelSid", WinUntrustedLabelSid); + PyModule_AddIntConstant(m,"WinLowLabelSid", WinLowLabelSid); + PyModule_AddIntConstant(m,"WinMediumLabelSid", WinMediumLabelSid); + PyModule_AddIntConstant(m,"WinHighLabelSid", WinHighLabelSid); + PyModule_AddIntConstant(m,"WinSystemLabelSid", WinSystemLabelSid); + PyModule_AddIntConstant(m,"WinWriteRestrictedCodeSid", WinWriteRestrictedCodeSid); + PyModule_AddIntConstant(m,"WinCreatorOwnerRightsSid", WinCreatorOwnerRightsSid); + PyModule_AddIntConstant(m,"WinCacheablePrincipalsGroupSid", WinCacheablePrincipalsGroupSid); + PyModule_AddIntConstant(m,"WinNonCacheablePrincipalsGroupSid", WinNonCacheablePrincipalsGroupSid); + PyModule_AddIntConstant(m,"WinEnterpriseReadonlyControllersSid", WinEnterpriseReadonlyControllersSid); + PyModule_AddIntConstant(m,"WinAccountReadonlyControllersSid", WinAccountReadonlyControllersSid); + PyModule_AddIntConstant(m,"WinBuiltinEventLogReadersGroup", WinBuiltinEventLogReadersGroup); #endif *************** *** 2088,2111 **** %} ! // @pyswig object|SetTokenInformation|Set a specified type of information in an access token %native(SetTokenInformation) PySetTokenInformation; %{ static PyObject *PySetTokenInformation(PyObject *self, PyObject *args) { - TOKEN_DEFAULT_DACL tdd; - TOKEN_OWNER towner; - TOKEN_PRIMARY_GROUP tpg; - DWORD sessionid=0; PyObject *obth; HANDLE th; PyObject *obinfo; ! int bufsize = 0; void *buf = NULL; TOKEN_INFORMATION_CLASS typ; if (!PyArg_ParseTuple(args, "OiO:SetTokenInformation", ! &obth, // @pyparm <o PyHANDLE>|handle||Handle to an access token to be modified ! (long *)&typ, // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves. ! &obinfo)) // @pyparm <o PyACL>|obinfo||PyACL, PySID, or int depending on type parm return NULL; --- 2176,2195 ---- %} ! // @pyswig |SetTokenInformation|Set a specified type of information in an access token %native(SetTokenInformation) PySetTokenInformation; %{ static PyObject *PySetTokenInformation(PyObject *self, PyObject *args) { PyObject *obth; HANDLE th; PyObject *obinfo; ! DWORD bufsize = 0; void *buf = NULL; TOKEN_INFORMATION_CLASS typ; if (!PyArg_ParseTuple(args, "OiO:SetTokenInformation", ! &obth, // @pyparm <o PyHANDLE>|TokenHandle||Handle to an access token to be modified ! &typ, // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information to be modfied ! &obinfo)) // @pyparm object|TokenInformation||Type is dependent on TokenInformationClass return NULL; *************** *** 2113,2153 **** return NULL; switch (typ) { ! case TokenOwner: { ! if (!PyWinObject_AsSID(obinfo, &towner.Owner, FALSE)) return NULL; - buf = (void *)&towner; - bufsize = sizeof(TOKEN_OWNER); break; } ! case TokenPrimaryGroup: { ! if (!PyWinObject_AsSID(obinfo, &tpg.PrimaryGroup, FALSE)) return NULL; - buf = (void *)&tpg; - bufsize = sizeof(TOKEN_PRIMARY_GROUP); break; } ! case TokenDefaultDacl: { ! if (!PyWinObject_AsACL(obinfo, &tdd.DefaultDacl, TRUE)) return NULL; - buf = (void *)&tdd; - bufsize = sizeof(TOKEN_DEFAULT_DACL); break; } ! case TokenSessionId: { ! sessionid = PyLong_AsUnsignedLong(obinfo); ! buf = (void *)&sessionid; bufsize = sizeof(DWORD); break; ! } default: ! PyErr_SetString(PyExc_TypeError, "Invalid TokenInformationClass parm"); ! return NULL; } if (!SetTokenInformation(th,typ,buf,bufsize)){ PyWin_SetAPIError("SetTokenInformation"); return NULL; } Py_INCREF(Py_None); return Py_None; --- 2197,2279 ---- return NULL; + // @flagh TokenInformationClass|Type of input expected switch (typ) { ! case TokenOwner: { // @flag TokenOwner|<o PySID> to be used as owner of created objects ! bufsize=sizeof(TOKEN_OWNER); ! buf=malloc(bufsize); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); ! if (!PyWinObject_AsSID(obinfo, &((PTOKEN_OWNER)buf)->Owner, FALSE)) return NULL; break; } ! case TokenPrimaryGroup: { // @flag TokenPrimaryGroup|<o PySID> ! bufsize=sizeof(TOKEN_PRIMARY_GROUP); ! buf=malloc(bufsize); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); ! if (!PyWinObject_AsSID(obinfo, &((PTOKEN_PRIMARY_GROUP)buf)->PrimaryGroup, FALSE)) return NULL; break; } ! case TokenDefaultDacl: { // @flag TokenDefaultDacl|<o PyACL> - Default permissions for created objects ! bufsize=sizeof(TOKEN_DEFAULT_DACL); ! buf=malloc(bufsize); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); ! if (!PyWinObject_AsACL(obinfo, &((PTOKEN_DEFAULT_DACL)buf)->DefaultDacl, TRUE)) return NULL; break; } ! case TokenSessionId: // @flag TokenSessionId|Int - Terminal services session id ! #ifdef _WIN32_WINNT_LONGHORN // Vista info types related to UAC ! case TokenVirtualizationEnabled: // @flag TokenVirtualizationEnabled|Boolean ! case TokenVirtualizationAllowed: // @flag TokenVirtualizationAllowed|Boolean ! #endif bufsize = sizeof(DWORD); + buf=malloc(bufsize); + if (buf==NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); + *(DWORD *)buf=PyLong_AsUnsignedLong(obinfo); + if (*(DWORD *)buf == (DWORD)-1 && PyErr_Occurred()){ + // PyLong_AsUnsignedLong returns stupid "bad argument to internal function" error when it fails + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, "Information must be an int >= 0"); + return NULL; + } break; ! #ifdef _WIN32_WINNT_LONGHORN ! case TokenIntegrityLevel: // @flag TokenIntegrityLevel|<o PySID_AND_ATTRIBUTES> containing an integrity SID and SE_GROUP_INTEGRITY flag ! bufsize=sizeof(TOKEN_MANDATORY_LABEL); ! buf=malloc(bufsize); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); ! if (!PyWinObject_AsSID_AND_ATTRIBUTES(obinfo, &((PTOKEN_MANDATORY_LABEL)buf)->Label)) ! return NULL; ! break; ! case TokenMandatoryPolicy: // @flag TokenMandatoryPolicy|Int. one of TOKEN_MANDATORY_POLICY_* values ! bufsize = sizeof(TOKEN_MANDATORY_POLICY); ! buf=malloc(bufsize); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); ! ((PTOKEN_MANDATORY_POLICY)buf)->Policy=PyLong_AsUnsignedLong(obinfo); ! if (((PTOKEN_MANDATORY_POLICY)buf)->Policy == (DWORD)-1 && PyErr_Occurred()){ ! // PyLong_AsUnsignedLong returns stupid "bad argument to internal function" error when it fails ! PyErr_Clear(); ! PyErr_SetString(PyExc_TypeError, "Information must be an int >= 0"); ! return NULL; ! } ! break; ! #endif default: ! return PyErr_Format(PyExc_NotImplementedError, "TokenInformationClass %d is not yet supported", typ); } if (!SetTokenInformation(th,typ,buf,bufsize)){ + free(buf); PyWin_SetAPIError("SetTokenInformation"); return NULL; } + free(buf); Py_INCREF(Py_None); return Py_None; *************** *** 3780,3784 **** #define GROUP_SECURITY_INFORMATION GROUP_SECURITY_INFORMATION // Indicates the primary group identifier of the object is being referenced. #define DACL_SECURITY_INFORMATION DACL_SECURITY_INFORMATION // Indicates the discretionary ACL of the object is being referenced. ! #define SACL_SECURITY_INFORMATION SACL_SECURITY_INFORMATION // Indicates the system ACL of the object is being referenced. #define PROTECTED_DACL_SECURITY_INFORMATION PROTECTED_DACL_SECURITY_INFORMATION #define PROTECTED_SACL_SECURITY_INFORMATION PROTECTED_SACL_SECURITY_INFORMATION --- 3906,3911 ---- #define GROUP_SECURITY_INFORMATION GROUP_SECURITY_INFORMATION // Indicates the primary group identifier of the object is being referenced. #define DACL_SECURITY_INFORMATION DACL_SECURITY_INFORMATION // Indicates the discretionary ACL of the object is being referenced. ! #define SACL_SECURITY_INFORMATION SACL_SECURITY_INFORMATION // Indicates the system ACL of the object is being referenced. ! #define LABEL_SECURITY_INFORMATION 0x00000010 #define PROTECTED_DACL_SECURITY_INFORMATION PROTECTED_DACL_SECURITY_INFORMATION #define PROTECTED_SACL_SECURITY_INFORMATION PROTECTED_SACL_SECURITY_INFORMATION *************** *** 4032,4096 **** #define DS_SPN_REPLACE_SPN_OP DS_SPN_REPLACE_SPN_OP #define DS_SPN_DELETE_SPN_OP DS_SPN_DELETE_SPN_OP - - // WELL_KNOWN_SID_TYPE used with CreateWellKnownSid - #define WinNullSid WinNullSid - #define WinWorldSid WinWorldSid - #define WinLocalSid WinLocalSid - #define WinCreatorOwnerSid WinCreatorOwnerSid - #define WinCreatorGroupSid WinCreatorGroupSid - #define WinCreatorOwnerServerSid WinCreatorOwnerServerSid - #define WinCreatorGroupServerSid WinCreatorGroupServerSid - #define WinNtAuthoritySid WinNtAuthoritySid - #define WinDialupSid WinDialupSid - #define WinNetworkSid WinNetworkSid - #define WinBatchSid WinBatchSid - #define WinInteractiveSid WinInteractiveSid - #define WinServiceSid WinServiceSid - #define WinAnonymousSid WinAnonymousSid - #define WinProxySid WinProxySid - #define WinEnterpriseControllersSid WinEnterpriseControllersSid - #define WinSelfSid WinSelfSid - #define WinAuthenticatedUserSid WinAuthenticatedUserSid - #define WinRestrictedCodeSid WinRestrictedCodeSid - #define WinTerminalServerSid WinTerminalServerSid - #define WinRemoteLogonIdSid WinRemoteLogonIdSid - #define WinLogonIdsSid WinLogonIdsSid - #define WinLocalSystemSid WinLocalSystemSid - #define WinLocalServiceSid WinLocalServiceSid - #define WinNetworkServiceSid WinNetworkServiceSid - #define WinBuiltinDomainSid WinBuiltinDomainSid - #define WinBuiltinAdministratorsSid WinBuiltinAdministratorsSid - #define WinBuiltinUsersSid WinBuiltinUsersSid - #define WinBuiltinGuestsSid WinBuiltinGuestsSid - #define WinBuiltinPowerUsersSid WinBuiltinPowerUsersSid - #define WinBuiltinAccountOperatorsSid WinBuiltinAccountOperatorsSid - #define WinBuiltinSystemOperatorsSid WinBuiltinSystemOperatorsSid - #define WinBuiltinPrintOperatorsSid WinBuiltinPrintOperatorsSid - #define WinBuiltinBackupOperatorsSid WinBuiltinBackupOperatorsSid - #define WinBuiltinReplicatorSid WinBuiltinReplicatorSid - #define WinBuiltinPreWindows2000CompatibleAccessSid WinBuiltinPreWindows2000CompatibleAccessSid - #define WinBuiltinRemoteDesktopUsersSid WinBuiltinRemoteDesktopUsersSid - #define WinBuiltinNetworkConfigurationOperatorsSid WinBuiltinNetworkConfigurationOperatorsSid - #define WinAccountAdministratorSid WinAccountAdministratorSid - #define WinAccountGuestSid WinAccountGuestSid - #define WinAccountKrbtgtSid WinAccountKrbtgtSid - #define WinAccountDomainAdminsSid WinAccountDomainAdminsSid - #define WinAccountDomainUsersSid WinAccountDomainUsersSid - #define WinAccountDomainGuestsSid WinAccountDomainGuestsSid - #define WinAccountComputersSid WinAccountComputersSid - #define WinAccountControllersSid WinAccountControllersSid - #define WinAccountCertAdminsSid WinAccountCertAdminsSid - #define WinAccountSchemaAdminsSid WinAccountSchemaAdminsSid - #define WinAccountEnterpriseAdminsSid WinAccountEnterpriseAdminsSid - #define WinAccountPolicyAdminsSid WinAccountPolicyAdminsSid - #define WinAccountRasAndIasServersSid WinAccountRasAndIasServersSid - #define WinNTLMAuthenticationSid WinNTLMAuthenticationSid - #define WinDigestAuthenticationSid WinDigestAuthenticationSid - #define WinSChannelAuthenticationSid WinSChannelAuthenticationSid - #define WinThisOrganizationSid WinThisOrganizationSid - #define WinOtherOrganizationSid WinOtherOrganizationSid - #define WinBuiltinIncomingForestTrustBuildersSid WinBuiltinIncomingForestTrustBuildersSid - #define WinBuiltinPerfMonitoringUsersSid WinBuiltinPerfMonitoringUsersSid - #define WinBuiltinPerfLoggingUsersSid WinBuiltinPerfLoggingUsersSid - // #define WinBuiltinAuthorizationAccessSid WinBuiltinAuthorizationAccessSid - // #define WinBuiltinTerminalServerLicenseServersSid WinBuiltinTerminalServerLicenseServersSid --- 4159,4160 ---- |
From: Roger U. <ru...@us...> - 2007-07-24 02:58:08
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8628/com/win32comext/shell/src Modified Files: PyIEmptyVolumeCacheCallBack.cpp Log Message: Autoduck fix Index: PyIEmptyVolumeCacheCallBack.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIEmptyVolumeCacheCallBack.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIEmptyVolumeCacheCallBack.cpp 20 May 2007 12:52:28 -0000 1.2 --- PyIEmptyVolumeCacheCallBack.cpp 24 Jul 2007 02:58:09 -0000 1.3 *************** *** 12,16 **** // @doc - This file contains autoduck documentation - // @object PyIEmptyVolumeCacheCallBack|Callback used by <o PyIEmptyVolumeCacheCallBack> // --------------------------------------------------- // --- 12,15 ---- *************** *** 103,107 **** } ! // @object PyIEmptyVolumeCacheCallBack|Description of the interface static struct PyMethodDef PyIEmptyVolumeCacheCallBack_methods[] = { --- 102,106 ---- } ! // @object PyIEmptyVolumeCacheCallBack|Callback used by <o PyIEmptyVolumeCacheCallBack> static struct PyMethodDef PyIEmptyVolumeCacheCallBack_methods[] = { |
From: Mark H. <mha...@us...> - 2007-07-23 08:34:04
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9344 Modified Files: win32process.i Log Message: Add win32process.IsWow64Process() Index: win32process.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** win32process.i 3 Jun 2007 14:53:07 -0000 1.29 --- win32process.i 23 Jul 2007 08:34:04 -0000 1.30 *************** *** 67,70 **** --- 67,72 ---- typedef DWORD (WINAPI *SetProcessAffinityMaskfunc)(HANDLE, DWORD_PTR); static SetProcessAffinityMaskfunc pfnSetProcessAffinityMask = NULL; + typedef BOOL (WINAPI *IsWow64Processfunc)(HANDLE, PBOOL); + static IsWow64Processfunc pfnIsWow64Process = NULL; #endif *************** *** 1497,1500 **** --- 1499,1529 ---- %} + // @pyswig bool|IsWow64Process|Determines whether the specified process is running under WOW64. + // @rdesc If this function is not provided by the operating system, the + // return value is False (ie, a NotImplemented exception will never be thrown). + // However, if the function exists but fails, a win32process.error exception + // is thrown as normal. + %native(IsWow64Process) PyIsWow64Process; + %{ + PyObject *PyIsWow64Process(PyObject *self, PyObject *args) + { + if (pfnIsWow64Process==NULL) + return PyBool_FromLong(FALSE); + PyObject *obhprocess; + HANDLE hprocess; + // @pyparm <o PyHANDLE>|Process||Handle to a process as returned by + // <om win32api.OpenProcess>, <om win32api.GetCurrentProcess>, etc + if (!PyArg_ParseTuple(args, "O:IsWow64Process", &obhprocess)) + return NULL; + BOOL ret; + if (!PyWinObject_AsHANDLE(obhprocess, &hprocess)) + return NULL; + BOOL ok = (*pfnIsWow64Process)(hprocess, &ret); + if (!ok) + return PyWin_SetAPIError("IsWow64Process"); + return PyBool_FromLong(ret); + } + %} + #endif // MS_WINCE *************** *** 1535,1538 **** --- 1564,1568 ---- pfnSetProcessAffinityMask=(SetProcessAffinityMaskfunc)GetProcAddress(hmodule,"SetProcessAffinityMask"); pfnGetProcessId=(GetProcessIdfunc)GetProcAddress(hmodule, "GetProcessId"); + pfnIsWow64Process=(IsWow64Processfunc)GetProcAddress(hmodule, "IsWow64Process"); } |
From: Roger U. <ru...@us...> - 2007-07-23 05:16:04
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32413/win32/src Modified Files: PyACL.cpp PySecurityObjects.h PyWinTypesmodule.cpp Log Message: Add AddMandatoryAce, and support for SYSTEM_MANDATORY_LABEL_ACE_TYPE Index: PySecurityObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySecurityObjects.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PySecurityObjects.h 24 May 2007 06:01:05 -0000 1.12 --- PySecurityObjects.h 23 Jul 2007 05:16:05 -0000 1.13 *************** *** 14,17 **** --- 14,18 ---- extern addaceexfunc addaccessallowedaceex; extern addaceexfunc addaccessdeniedaceex; + extern addaceexfunc addmandatoryace; extern addobjectacefunc addaccessallowedobjectace; extern addobjectacefunc addaccessdeniedobjectace; *************** *** 188,191 **** --- 189,193 ---- static PyObject *AddAccessDeniedAce(PyObject *self, PyObject *args); static PyObject *AddAccessDeniedAceEx(PyObject *self, PyObject *args); + static PyObject *AddMandatoryAce(PyObject *self, PyObject *args); static PyObject *AddAccessDeniedObjectAce(PyObject *self, PyObject *args); static PyObject *AddAuditAccessAce(PyObject *self, PyObject *args); Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PyWinTypesmodule.cpp 13 Jul 2007 03:00:57 -0000 1.31 --- PyWinTypesmodule.cpp 23 Jul 2007 05:16:05 -0000 1.32 *************** *** 888,891 **** --- 888,894 ---- if (fp) addaccessallowedaceex=(addaceexfunc)(fp); + fp=GetProcAddress(hmodule,"AddMandatoryAce"); + if (fp) + addmandatoryace=(addaceexfunc)(fp); fp=GetProcAddress(hmodule,"AddAccessAllowedObjectAce"); if (fp) Index: PyACL.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyACL.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyACL.cpp 24 May 2007 06:01:05 -0000 1.16 --- PyACL.cpp 23 Jul 2007 05:16:05 -0000 1.17 *************** *** 16,19 **** --- 16,20 ---- addaceexfunc addaccessallowedaceex=NULL; addaceexfunc addaccessdeniedaceex=NULL; + addaceexfunc addmandatoryace=NULL; addobjectacefunc addaccessallowedobjectace=NULL; addobjectacefunc addaccessdeniedobjectace=NULL; *************** *** 560,563 **** --- 561,580 ---- } + // @pymethod |PyACL|AddMandatoryAce|Adds a mandatory integrity level ACE to a SACL + PyObject *PyACL::AddMandatoryAce(PyObject *self, PyObject *args) + { + DWORD access,revision,aceflags; + PyObject *obSID; + // @pyparm int|AceRevision||ACL_REVISION or ACL_REVISION_DS + // @pyparm int|AceFlags||Combination of ACE inheritance flags (CONTAINER_INHERIT_ACE,INHERIT_ONLY_ACE,INHERITED_ACE,NO_PROPAGATE_INHERIT_ACE, and OBJECT_INHERIT_ACE) + // @pyparm int|MandatoryPolicy||Access policy for processes with lower integrity level, combination of SYSTEM_MANDATORY_LABEL_* flags + // @pyparm <o PySID>|LabelSid||Integrity level SID. This can be created using CreateWellKnownSid with Win*LabelSid. + // <nl>Also can be constructed manually using SECURITY_MANDATORY_LABEL_AUTHORITY and a SECURITY_MANDATORY_*_RID + if (!PyArg_ParseTuple(args, "kkkO:AddMandatoryAce", &revision, &aceflags, &access, &obSID)) + return NULL; + return addaceex(addmandatoryace, "AddMandatoryAce", (PyACL *) self, + revision, aceflags, access, obSID); + } + PyObject * addobjectace(addobjectacefunc addfunc, CHAR *funcname, PyACL *This, DWORD revision, DWORD aceflags, DWORD access, *************** *** 923,927 **** case ACCESS_ALLOWED_ACE_TYPE: case ACCESS_DENIED_ACE_TYPE: ! case SYSTEM_AUDIT_ACE_TYPE:{ ACCESS_ALLOWED_ACE *pAce=(ACCESS_ALLOWED_ACE *)p; return Py_BuildValue("(ll)lN", pAceHeader->AceType, pAceHeader->AceFlags, pAce->Mask, PyWinObject_FromSID((PSID)(&pAce->SidStart))); --- 940,948 ---- case ACCESS_ALLOWED_ACE_TYPE: case ACCESS_DENIED_ACE_TYPE: ! case SYSTEM_AUDIT_ACE_TYPE: ! #ifdef _WIN32_WINNT_LONGHORN ! case SYSTEM_MANDATORY_LABEL_ACE_TYPE: ! #endif ! { ACCESS_ALLOWED_ACE *pAce=(ACCESS_ALLOWED_ACE *)p; return Py_BuildValue("(ll)lN", pAceHeader->AceType, pAceHeader->AceFlags, pAce->Mask, PyWinObject_FromSID((PSID)(&pAce->SidStart))); *************** *** 1094,1097 **** --- 1115,1119 ---- {"AddAccessDeniedAce", PyACL::AddAccessDeniedAce, 1}, // @pymeth AddAccessDeniedAce|Adds an access-denied ACE to an ACL object. {"AddAccessDeniedAceEx", PyACL::AddAccessDeniedAceEx, 1}, // @pymeth AddAccessDeniedAceEx|Adds an access-denied ACE to an ACL object + {"AddMandatoryAce", PyACL::AddMandatoryAce, 1}, // @pymeth AddMandatoryAce|Adds a mandatory integrity level ACE to a SACL {"AddAccessDeniedObjectAce", PyACL::AddAccessDeniedObjectAce, 1}, // @pymeth AddAccessAllowedObjectAce|Adds an ACCESS_DENIED_OBJECT_ACE to the ACL {"AddAuditAccessAce", PyACL::AddAuditAccessAce, 1}, // @pymeth AddAuditAccessAce|Adds an audit entry to a system access control list (SACL) |
From: Roger U. <ru...@us...> - 2007-07-23 05:11:07
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30515/win32/Lib Modified Files: ntsecuritycon.py winnt.py Log Message: Add some more new security constants Index: winnt.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winnt.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** winnt.py 19 Jul 2007 06:49:43 -0000 1.6 --- winnt.py 23 Jul 2007 05:11:08 -0000 1.7 *************** *** 595,598 **** --- 595,600 ---- DACL_SECURITY_INFORMATION = (0X00000004) SACL_SECURITY_INFORMATION = (0X00000008) + LABEL_SECURITY_INFORMATION = 0x00000010 + IMAGE_DOS_SIGNATURE = 23117 IMAGE_OS2_SIGNATURE = 17742 Index: ntsecuritycon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/ntsecuritycon.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ntsecuritycon.py 19 Jul 2007 06:49:43 -0000 1.6 --- ntsecuritycon.py 23 Jul 2007 05:11:08 -0000 1.7 *************** *** 45,48 **** --- 45,49 ---- SECURITY_CREATOR_SID_AUTHORITY = (0,0,0,0,0,3) SECURITY_NON_UNIQUE_AUTHORITY = (0,0,0,0,0,4) + SECURITY_RESOURCE_MANAGER_AUTHORITY = (0,0,0,0,0,9) SECURITY_NULL_RID = 0 *************** *** 55,59 **** SECURITY_CREATOR_OWNER_SERVER_RID = 2 SECURITY_CREATOR_GROUP_SERVER_RID = 3 ! # NT well-known SIDs --- 56,60 ---- SECURITY_CREATOR_OWNER_SERVER_RID = 2 SECURITY_CREATOR_GROUP_SERVER_RID = 3 ! SECURITY_CREATOR_OWNER_RIGHTS_RID = 4 # NT well-known SIDs *************** *** 122,126 **** DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 573 ! SYSTEM_LUID = (999, 0) # Group attributes --- 123,140 ---- DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 573 ! SECURITY_MANDATORY_LABEL_AUTHORITY = (0,0,0,0,0,16) ! SECURITY_MANDATORY_UNTRUSTED_RID = 0x00000000 ! SECURITY_MANDATORY_LOW_RID = 0x00001000 ! SECURITY_MANDATORY_MEDIUM_RID = 0x00002000 ! SECURITY_MANDATORY_HIGH_RID = 0x00003000 ! SECURITY_MANDATORY_SYSTEM_RID = 0x00004000 ! SECURITY_MANDATORY_PROTECTED_PROCESS_RID = 0x00005000 ! SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID ! ! SYSTEM_LUID = (999, 0) ! ANONYMOUS_LOGON_LUID = (998, 0) ! LOCALSERVICE_LUID = (997, 0) ! NETWORKSERVICE_LUID = (996, 0) ! IUSER_LUID = (995, 0) # Group attributes *************** *** 130,133 **** --- 144,151 ---- SE_GROUP_ENABLED = 4 SE_GROUP_OWNER = 8 + SE_GROUP_USE_FOR_DENY_ONLY = 16 + SE_GROUP_INTEGRITY = 32 + SE_GROUP_INTEGRITY_ENABLED = 64 + SE_GROUP_RESOURCE = 536870912 SE_GROUP_LOGON_ID = -1073741824 |
From: Mark H. <mha...@us...> - 2007-07-20 02:00:49
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30561 Modified Files: winerror.py Log Message: Lots of new constants from the Vista SDK Index: winerror.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winerror.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** winerror.py 7 Oct 2005 11:05:46 -0000 1.4 --- winerror.py 20 Jul 2007 02:00:49 -0000 1.5 *************** *** 10,17 **** --- 10,22 ---- # up to here... + FACILITY_WINRM = 51 + FACILITY_WINDOWSUPDATE = 36 + FACILITY_WINDOWS_DEFENDER = 80 FACILITY_WINDOWS_CE = 24 FACILITY_WINDOWS = 8 FACILITY_URT = 19 FACILITY_UMI = 22 [...1255 lines suppressed...] + ERROR_DS_DOMAIN_RENAME_IN_PROGRESS = 8612 + ERROR_DS_EXISTING_AD_CHILD_NC = 8613 + ERROR_DS_REPL_LIFETIME_EXCEEDED = 8614 + ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER = 8615 + ERROR_DS_LDAP_SEND_QUEUE_FULL = 8616 + ERROR_DS_DRA_OUT_SCHEDULE_WINDOW = 8617 + ERROR_DS_POLICY_NOT_KNOWN = 8618 + ERROR_NO_SITE_SETTINGS_OBJECT = 8619 + ERROR_NO_SECRETS = 8620 + ERROR_NO_WRITABLE_DC_FOUND = 8621 + ERROR_DS_NO_SERVER_OBJECT = 8622 + ERROR_DS_NO_NTDSA_OBJECT = 8623 + ERROR_DS_NON_ASQ_SEARCH = 8624 + ERROR_DS_AUDIT_FAILURE = 8625 + ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE = 8626 + ERROR_DS_INVALID_SEARCH_FLAG_TUPLE = 8627 + ERROR_DS_HIERARCHY_TABLE_TOO_DEEP = 8628 + SEVERITY_SUCCESS = 0 SEVERITY_ERROR = 1 |
From: Roger U. <ru...@us...> - 2007-07-19 06:49:43
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11131/win32/Lib Modified Files: ntsecuritycon.py winnt.py Log Message: Update a few sets of constants (ACE types, RID's, TOKEN_INFORMATION_CLASS, etc) Index: winnt.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winnt.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** winnt.py 26 Feb 2007 17:07:19 -0000 1.5 --- winnt.py 19 Jul 2007 06:49:43 -0000 1.6 *************** *** 437,440 **** --- 437,442 ---- ACL_REVISION4 = (4) MAX_ACL_REVISION = ACL_REVISION4 + + ## ACE types ACCESS_MIN_MS_ACE_TYPE = (0) ACCESS_ALLOWED_ACE_TYPE = (0) *************** *** 453,456 **** --- 455,470 ---- ACCESS_MAX_MS_V4_ACE_TYPE = (8) ACCESS_MAX_MS_ACE_TYPE = (8) + ACCESS_ALLOWED_CALLBACK_ACE_TYPE = 9 + ACCESS_DENIED_CALLBACK_ACE_TYPE = 10 + ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = 11 + ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = 12 + SYSTEM_AUDIT_CALLBACK_ACE_TYPE = 13 + SYSTEM_ALARM_CALLBACK_ACE_TYPE = 14 + SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = 15 + SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = 16 + SYSTEM_MANDATORY_LABEL_ACE_TYPE = 17 + ACCESS_MAX_MS_V5_ACE_TYPE = 17 + + ## ACE inheritance flags OBJECT_INHERIT_ACE = (1) CONTAINER_INHERIT_ACE = (2) *************** *** 459,462 **** --- 473,478 ---- INHERITED_ACE = (16) VALID_INHERIT_FLAGS = (31) + + SUCCESSFUL_ACCESS_ACE_FLAG = (64) FAILED_ACCESS_ACE_FLAG = (128) *************** *** 540,547 **** --- 556,565 ---- TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE) TOKEN_SOURCE_LENGTH = 8 + # Token types TokenPrimary = 1 TokenImpersonation = 2 + # TOKEN_INFORMATION_CLASS, used with Get/SetTokenInformation TokenUser = 1 TokenGroups = 2 *************** *** 554,558 **** TokenImpersonationLevel = 9 TokenStatistics = 10 ! OWNER_SECURITY_INFORMATION = (0X00000001) --- 572,593 ---- TokenImpersonationLevel = 9 TokenStatistics = 10 ! TokenRestrictedSids = 11 ! TokenSessionId = 12 ! TokenGroupsAndPrivileges = 13 ! TokenSessionReference = 14 ! TokenSandBoxInert = 15 ! TokenAuditPolicy = 16 ! TokenOrigin = 17 ! TokenElevationType = 18 ! TokenLinkedToken = 19 ! TokenElevation = 20 ! TokenHasRestrictions = 21 ! TokenAccessInformation = 22 ! TokenVirtualizationAllowed = 23 ! TokenVirtualizationEnabled = 24 ! TokenIntegrityLevel = 25 ! TokenUIAccess = 26 ! TokenMandatoryPolicy = 27 ! TokenLogonSid = 28 OWNER_SECURITY_INFORMATION = (0X00000001) Index: ntsecuritycon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/ntsecuritycon.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ntsecuritycon.py 12 Feb 2006 09:36:52 -0000 1.5 --- ntsecuritycon.py 19 Jul 2007 06:49:43 -0000 1.6 *************** *** 81,109 **** DOMAIN_USER_RID_ADMIN = 500 DOMAIN_USER_RID_GUEST = 501 ! ! # well-known groups ... - DOMAIN_GROUP_RID_ADMINS = 512 DOMAIN_GROUP_RID_USERS = 513 DOMAIN_GROUP_RID_GUESTS = 514 ! ! ! # well-known aliases ... - DOMAIN_ALIAS_RID_ADMINS = 544 DOMAIN_ALIAS_RID_USERS = 545 DOMAIN_ALIAS_RID_GUESTS = 546 DOMAIN_ALIAS_RID_POWER_USERS = 547 - DOMAIN_ALIAS_RID_ACCOUNT_OPS = 548 DOMAIN_ALIAS_RID_SYSTEM_OPS = 549 DOMAIN_ALIAS_RID_PRINT_OPS = 550 DOMAIN_ALIAS_RID_BACKUP_OPS = 551 - DOMAIN_ALIAS_RID_REPLICATOR = 552 SYSTEM_LUID = (999, 0) --- 81,124 ---- DOMAIN_USER_RID_ADMIN = 500 DOMAIN_USER_RID_GUEST = 501 ! DOMAIN_USER_RID_KRBTGT = 502 ! DOMAIN_USER_RID_MAX = 999 # well-known groups ... DOMAIN_GROUP_RID_ADMINS = 512 DOMAIN_GROUP_RID_USERS = 513 DOMAIN_GROUP_RID_GUESTS = 514 ! DOMAIN_GROUP_RID_COMPUTERS = 515 ! DOMAIN_GROUP_RID_CONTROLLERS = 516 ! DOMAIN_GROUP_RID_CERT_ADMINS = 517 ! DOMAIN_GROUP_RID_SCHEMA_ADMINS = 518 ! DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = 519 ! DOMAIN_GROUP_RID_POLICY_ADMINS = 520 ! DOMAIN_GROUP_RID_READONLY_CONTROLLERS = 521 # well-known aliases ... DOMAIN_ALIAS_RID_ADMINS = 544 DOMAIN_ALIAS_RID_USERS = 545 DOMAIN_ALIAS_RID_GUESTS = 546 DOMAIN_ALIAS_RID_POWER_USERS = 547 DOMAIN_ALIAS_RID_ACCOUNT_OPS = 548 DOMAIN_ALIAS_RID_SYSTEM_OPS = 549 DOMAIN_ALIAS_RID_PRINT_OPS = 550 DOMAIN_ALIAS_RID_BACKUP_OPS = 551 DOMAIN_ALIAS_RID_REPLICATOR = 552 + DOMAIN_ALIAS_RID_RAS_SERVERS = 553 + DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 554 + DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 555 + DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 556 + DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 557 + DOMAIN_ALIAS_RID_MONITORING_USERS = 558 + DOMAIN_ALIAS_RID_LOGGING_USERS = 559 + DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 560 + DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 561 + DOMAIN_ALIAS_RID_DCOM_USERS = 562 + DOMAIN_ALIAS_RID_IUSERS = 568 + DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = 569 + DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = 571 + DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = 572 + DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 573 SYSTEM_LUID = (999, 0) *************** *** 121,129 **** # (None yet defined.) ! ACCESS_ALLOWED_ACE_TYPE = 0 ! ACCESS_DENIED_ACE_TYPE = 1 ! SYSTEM_AUDIT_ACE_TYPE = 2 ! SYSTEM_ALARM_ACE_TYPE = 3 ! # The following are the inherit flags that go into the AceFlags field --- 136,166 ---- # (None yet defined.) ! # ACE types ! ACCESS_MIN_MS_ACE_TYPE = (0) ! ACCESS_ALLOWED_ACE_TYPE = (0) ! ACCESS_DENIED_ACE_TYPE = (1) ! SYSTEM_AUDIT_ACE_TYPE = (2) ! SYSTEM_ALARM_ACE_TYPE = (3) ! ACCESS_MAX_MS_V2_ACE_TYPE = (3) ! ACCESS_ALLOWED_COMPOUND_ACE_TYPE = (4) ! ACCESS_MAX_MS_V3_ACE_TYPE = (4) ! ACCESS_MIN_MS_OBJECT_ACE_TYPE = (5) ! ACCESS_ALLOWED_OBJECT_ACE_TYPE = (5) ! ACCESS_DENIED_OBJECT_ACE_TYPE = (6) ! SYSTEM_AUDIT_OBJECT_ACE_TYPE = (7) ! SYSTEM_ALARM_OBJECT_ACE_TYPE = (8) ! ACCESS_MAX_MS_OBJECT_ACE_TYPE = (8) ! ACCESS_MAX_MS_V4_ACE_TYPE = (8) ! ACCESS_MAX_MS_ACE_TYPE = (8) ! ACCESS_ALLOWED_CALLBACK_ACE_TYPE = 9 ! ACCESS_DENIED_CALLBACK_ACE_TYPE = 10 ! ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = 11 ! ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = 12 ! SYSTEM_AUDIT_CALLBACK_ACE_TYPE = 13 ! SYSTEM_ALARM_CALLBACK_ACE_TYPE = 14 ! SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = 15 ! SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = 16 ! SYSTEM_MANDATORY_LABEL_ACE_TYPE = 17 ! ACCESS_MAX_MS_V5_ACE_TYPE = 17 # The following are the inherit flags that go into the AceFlags field *************** *** 237,240 **** --- 274,278 ---- TokenImpersonation = 2 + # TOKEN_INFORMATION_CLASS, used with Get/SetTokenInformation TokenUser = 1 TokenGroups = 2 *************** *** 247,250 **** --- 285,306 ---- TokenImpersonationLevel = 9 TokenStatistics = 10 + TokenRestrictedSids = 11 + TokenSessionId = 12 + TokenGroupsAndPrivileges = 13 + TokenSessionReference = 14 + TokenSandBoxInert = 15 + TokenAuditPolicy = 16 + TokenOrigin = 17 + TokenElevationType = 18 + TokenLinkedToken = 19 + TokenElevation = 20 + TokenHasRestrictions = 21 + TokenAccessInformation = 22 + TokenVirtualizationAllowed = 23 + TokenVirtualizationEnabled = 24 + TokenIntegrityLevel = 25 + TokenUIAccess = 26 + TokenMandatoryPolicy = 27 + TokenLogonSid = 28 # DirectoryService related constants. |
From: Roger U. <ru...@us...> - 2007-07-19 06:31:20
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4266/win32/src Modified Files: win32security.i Log Message: In GetTokenInformation, support new types for Vista UAC Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** win32security.i 3 Jun 2007 14:53:07 -0000 1.39 --- win32security.i 19 Jul 2007 06:31:20 -0000 1.40 *************** *** 649,653 **** ADD_UNICODE_CONSTANT(SE_IMPERSONATE_NAME); ADD_UNICODE_CONSTANT(SE_CREATE_GLOBAL_NAME); ! /* ADD_UNICODE_CONSTANT(SE_TRUSTED_CREDMAN_ACCESS_NAME); ADD_UNICODE_CONSTANT(SE_RELABEL_NAME); --- 649,654 ---- ADD_UNICODE_CONSTANT(SE_IMPERSONATE_NAME); ADD_UNICODE_CONSTANT(SE_CREATE_GLOBAL_NAME); ! // Requires Vista SDK ! #ifdef _WIN32_WINNT_LONGHORN ADD_UNICODE_CONSTANT(SE_TRUSTED_CREDMAN_ACCESS_NAME); ADD_UNICODE_CONSTANT(SE_RELABEL_NAME); *************** *** 655,662 **** ADD_UNICODE_CONSTANT(SE_TIME_ZONE_NAME); ADD_UNICODE_CONSTANT(SE_CREATE_SYMBOLIC_LINK_NAME); ! */ PyDict_SetItemString(d,"MSV1_0_PACKAGE_NAME",PyString_FromString(MSV1_0_PACKAGE_NAME)); PyDict_SetItemString(d,"MICROSOFT_KERBEROS_NAME_A",PyString_FromString(MICROSOFT_KERBEROS_NAME_A)); advapi32_dll=loadmodule(_T("Advapi32.dll")); secur32_dll =loadmodule(_T("Secur32.dll")); --- 656,713 ---- ADD_UNICODE_CONSTANT(SE_TIME_ZONE_NAME); ADD_UNICODE_CONSTANT(SE_CREATE_SYMBOLIC_LINK_NAME); ! #endif ! PyDict_SetItemString(d,"MSV1_0_PACKAGE_NAME",PyString_FromString(MSV1_0_PACKAGE_NAME)); PyDict_SetItemString(d,"MICROSOFT_KERBEROS_NAME_A",PyString_FromString(MICROSOFT_KERBEROS_NAME_A)); + // TOKEN_INFORMATION_CLASS, used with Get/SetTokenInformation + PyModule_AddIntConstant(m,"TokenUser", TokenUser); + PyModule_AddIntConstant(m,"TokenGroups", TokenGroups); + PyModule_AddIntConstant(m,"TokenPrivileges", TokenPrivileges); + PyModule_AddIntConstant(m,"TokenOwner", TokenOwner); + PyModule_AddIntConstant(m,"TokenPrimaryGroup", TokenPrimaryGroup); + PyModule_AddIntConstant(m,"TokenDefaultDacl", TokenDefaultDacl); + PyModule_AddIntConstant(m,"TokenSource", TokenSource); + PyModule_AddIntConstant(m,"TokenType", TokenType); + PyModule_AddIntConstant(m,"TokenImpersonationLevel", TokenImpersonationLevel); + PyModule_AddIntConstant(m,"TokenStatistics", TokenStatistics); + PyModule_AddIntConstant(m,"TokenRestrictedSids", TokenRestrictedSids); + PyModule_AddIntConstant(m,"TokenSessionId", TokenSessionId); + PyModule_AddIntConstant(m,"TokenGroupsAndPrivileges", TokenGroupsAndPrivileges); + PyModule_AddIntConstant(m,"TokenSessionReference", TokenSessionReference); + PyModule_AddIntConstant(m,"TokenSandBoxInert", TokenSandBoxInert); + PyModule_AddIntConstant(m,"TokenAuditPolicy", TokenAuditPolicy); + PyModule_AddIntConstant(m,"TokenOrigin", TokenOrigin); + // ??? These are defined in Vista platform SDK, but they aren't conditionally defined. + // This symbol is defined in the Vista SDK, but not in earlier ones. + // There's probably a better way to determine which SDK is in use. ??? + #ifdef _WIN32_WINNT_LONGHORN + PyModule_AddIntConstant(m,"TokenElevationType", TokenElevationType); + PyModule_AddIntConstant(m,"TokenLinkedToken", TokenLinkedToken); + PyModule_AddIntConstant(m,"TokenElevation", TokenElevation); + PyModule_AddIntConstant(m,"TokenHasRestrictions", TokenHasRestrictions); + PyModule_AddIntConstant(m,"TokenAccessInformation", TokenAccessInformation); + PyModule_AddIntConstant(m,"TokenVirtualizationAllowed", TokenVirtualizationAllowed); + PyModule_AddIntConstant(m,"TokenVirtualizationEnabled", TokenVirtualizationEnabled); + PyModule_AddIntConstant(m,"TokenIntegrityLevel", TokenIntegrityLevel); + PyModule_AddIntConstant(m,"TokenUIAccess", TokenUIAccess); + PyModule_AddIntConstant(m,"TokenMandatoryPolicy", TokenMandatoryPolicy); + PyModule_AddIntConstant(m,"TokenLogonSid", TokenLogonSid); + + // TOKEN_ELEVATION_TYPE enum + PyModule_AddIntConstant(m,"TokenElevationTypeDefault",TokenElevationTypeDefault); + PyModule_AddIntConstant(m,"TokenElevationTypeFull",TokenElevationTypeFull); + PyModule_AddIntConstant(m,"TokenElevationTypeLimited",TokenElevationTypeLimited); + + // TOKEN_MANDATORY_POLICY enum + PyModule_AddIntConstant(m,"TOKEN_MANDATORY_POLICY_OFF",TOKEN_MANDATORY_POLICY_OFF); + PyModule_AddIntConstant(m,"TOKEN_MANDATORY_POLICY_NO_WRITE_UP",TOKEN_MANDATORY_POLICY_NO_WRITE_UP); + PyModule_AddIntConstant(m,"TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN",TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN); + PyModule_AddIntConstant(m,"TOKEN_MANDATORY_POLICY_VALID_MASK",TOKEN_MANDATORY_POLICY_VALID_MASK); + + PyModule_AddIntConstant(m,"SE_GROUP_INTEGRITY", SE_GROUP_INTEGRITY); + PyModule_AddIntConstant(m,"SE_GROUP_INTEGRITY_ENABLED", SE_GROUP_INTEGRITY_ENABLED); + #endif + advapi32_dll=loadmodule(_T("Advapi32.dll")); secur32_dll =loadmodule(_T("Secur32.dll")); *************** *** 1574,1585 **** { PyObject *obHandle; ! int bufSize = 0; DWORD retLength = 0; DWORD dwordbuf; ! void *buf = NULL; TOKEN_INFORMATION_CLASS typ; if (!PyArg_ParseTuple(args, "Ol:GetTokenInformation", ! &obHandle, // @pyparm <o PyHANDLE>|handle||The handle to query the information for. ! (long *)&typ)) // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves. return NULL; HANDLE handle; --- 1625,1636 ---- { PyObject *obHandle; ! DWORD bufSize = 0; DWORD retLength = 0; DWORD dwordbuf; ! TOKEN_INFORMATION_CLASS typ; if (!PyArg_ParseTuple(args, "Ol:GetTokenInformation", ! &obHandle, // @pyparm <o PyHANDLE>|TokenHandle||Handle to an access token. ! &typ)) // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves. return NULL; HANDLE handle; *************** *** 1587,1622 **** return NULL; ! PyObject *ret = NULL; ! // null buffer call doesn't seem to work for these two (both return DWORDS, not structs), special case them ! if ((typ==TokenSessionId) || (typ == TokenSandBoxInert)){ ! bufSize = sizeof(DWORD); ! if (!GetTokenInformation(handle, typ, &dwordbuf, bufSize, &retLength)) { ! PyWin_SetAPIError("GetTokenInformation"); ! goto done; ! } } - else{ - // first call with NULL in the TokenInformation buffer pointer should return the required size - GetTokenInformation(handle, typ, buf, bufSize, &retLength); - if (retLength == 0){ - PyWin_SetAPIError("GetTokenInformation - size call"); - goto done; - } - - bufSize = retLength; - buf = malloc(retLength); - if (buf==NULL) { - PyErr_SetString(PyExc_MemoryError, "Allocating buffer for token info"); - return NULL; - } ! if (!GetTokenInformation(handle, typ, buf, bufSize, &retLength)) { ! PyWin_SetAPIError("GetTokenInformation"); ! goto done; ! } } - // @rdesc The following types are supported - // @flagh TokenInformationClass|Return type switch (typ) { case TokenUser: { --- 1638,1677 ---- return NULL; ! // null buffer call doesn't seem to work for info types that return a DWORD instead of a struct, special case them ! switch (typ) { ! // @rdesc The following types are supported ! // @flagh TokenInformationClass|Return type ! case TokenSessionId: // @flag TokenSessionId|int - Terminal Services session id ! case TokenSandBoxInert: // @flag TokenSandBoxInert|Boolean ! case TokenType: // @flag TokenType|Value from TOKEN_TYPE enum (TokenPrimary,TokenImpersonation) ! case TokenImpersonationLevel: // @flag TokenImpersonationLevel|Value from SECURITY_IMPERSONATION_LEVEL enum ! #ifdef _WIN32_WINNT_LONGHORN // Vista info types related to UAC ! case TokenVirtualizationEnabled: // @flag TokenVirtualizationEnabled|Boolean ! case TokenVirtualizationAllowed: // @flag TokenVirtualizationAllowed|Boolean ! case TokenHasRestrictions: // @flag TokenHasRestrictions|Boolean ! case TokenElevationType: // @flag TokenElevationType|int - TokenElevation* value indicating what type of token is linked to ! case TokenUIAccess: // @flag TokenUIAccess|Boolean ! #endif ! bufSize = sizeof(DWORD); ! if (!GetTokenInformation(handle, typ, &dwordbuf, bufSize, &retLength)) ! return PyWin_SetAPIError("GetTokenInformation"); ! return PyLong_FromUnsignedLong(dwordbuf); } ! PyObject *ret = NULL; ! void *buf = NULL; ! // first call with NULL in the TokenInformation buffer pointer should return the required size ! GetTokenInformation(handle, typ, buf, bufSize, &retLength); ! if (retLength == 0) ! return PyWin_SetAPIError("GetTokenInformation"); ! bufSize = retLength; ! buf = malloc(retLength); ! if (buf==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate buffer for token info (%d bytes)", retLength); ! if (!GetTokenInformation(handle, typ, buf, bufSize, &retLength)) { ! PyWin_SetAPIError("GetTokenInformation"); ! goto done; } switch (typ) { case TokenUser: { *************** *** 1675,1703 **** break; } - case TokenType: { - // @flag TokenType|int - // - returns TokenPrimary or TokenImpersonation - TOKEN_TYPE *tt = (TOKEN_TYPE *)buf; - ret=Py_BuildValue("i",*tt); - break; - } - case TokenImpersonationLevel: { - // @flag TokenImpersonationLevel|int - // - returns a value from SECURITY_IMPERSONATION_LEVEL enum - SECURITY_IMPERSONATION_LEVEL *sil = (SECURITY_IMPERSONATION_LEVEL *)buf; - ret=Py_BuildValue("i",*sil); - break; - } - case TokenSandBoxInert: { - // ??? I get "The parameter is incorrect" error for this one, maybe only valid for impersonation token ??? - ret = Py_BuildValue("l",dwordbuf); - break; - } - case TokenSessionId: { - // @flag TokenSessionId|int - // Terminal Services session id - ret = Py_BuildValue("l",dwordbuf); - break; - } case TokenStatistics: { // @flag TokenStatistics|dict --- 1730,1733 ---- *************** *** 1717,1723 **** break; } ! default: ! PyErr_SetString(PyExc_TypeError, "The TokenInformationClass param is not supported yet"); break; } done: --- 1747,1814 ---- break; } ! case TokenOrigin: { ! // @flag TokenOrigin|LUID identifying the logon session ! TOKEN_ORIGIN *torg = (TOKEN_ORIGIN *)buf; ! LARGE_INTEGER luid; ! luid.HighPart=torg->OriginatingLogonSession.HighPart; ! luid.LowPart=torg->OriginatingLogonSession.LowPart; ! ret = PyWinObject_FromLARGE_INTEGER(luid); ! break; ! } ! ! #ifdef _WIN32_WINNT_LONGHORN ! // Vista-specific types require recent platform SDK ! case TokenLinkedToken: { ! // @flag TokenLinkedToken|<o PyHANDLE> - Returns handle to the access token to which token is linked ! TOKEN_LINKED_TOKEN *tlt=(TOKEN_LINKED_TOKEN *)buf; ! ret = PyWinObject_FromHANDLE(tlt->LinkedToken); ! break; ! } ! case TokenLogonSid: ! // @flag TokenLogonSid|<o PySID> ! ret=PyWinObject_FromSID((PSID)buf); ! break; ! case TokenElevation: { ! // @flag TokenElevation|Boolean ! TOKEN_ELEVATION *te=(TOKEN_ELEVATION *)buf; ! ret=PyLong_FromUnsignedLong(te->TokenIsElevated); break; + } + case TokenIntegrityLevel: { + // @flag TokenIntegrityLevel|(<o PySID>, int) + TOKEN_MANDATORY_LABEL *tml=(TOKEN_MANDATORY_LABEL *)buf; + // Need to create function for SID_AND_ATTRIBUTES, used several places now + ret = Py_BuildValue("Nk", + PyWinObject_FromSID(tml->Label.Sid), + tml->Label.Attributes); + break; + } + case TokenMandatoryPolicy: { + // @flag TokenMandatoryPolicy|int (TOKEN_MANDATORY_POLICY_* flag) + TOKEN_MANDATORY_POLICY *tmp=(TOKEN_MANDATORY_POLICY *)buf; + ret=PyLong_FromUnsignedLong(tmp->Policy); + break; + } + /* + case TokenAccessInformation: + typedef struct _TOKEN_ACCESS_INFORMATION { + PSID_AND_ATTRIBUTES_HASH SidHash; + PSID_AND_ATTRIBUTES_HASH RestrictedSidHash; + PTOKEN_PRIVILEGES Privileges; + LUID AuthenticationId; + TOKEN_TYPE TokenType; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + TOKEN_MANDATORY_POLICY MandatoryPolicy; + DWORD Flags; + } TOKEN_ACCESS_INFORMATION + typedef struct _SID_AND_ATTRIBUTES_HASH { + DWORD SidCount; + PSID_AND_ATTRIBUTES SidAttr; + SID_HASH_ENTRY Hash[SID_HASH_SIZE]; + } SID_AND_ATTRIBUTES_HASH + */ + #endif + default: + PyErr_Format(PyExc_NotImplementedError, "TokenInformationClass %d is not supported yet", typ); } done: *************** *** 3711,3730 **** #define SidTypeComputer SidTypeComputer // Indicates a computer SID - // TokenInformationClass constatns - #define TokenDefaultDacl TokenDefaultDacl - #define TokenGroups TokenGroups - #define TokenGroupsAndPrivileges TokenGroupsAndPrivileges - #define TokenImpersonationLevel TokenImpersonationLevel - #define TokenOwner TokenOwner - #define TokenPrimaryGroup TokenPrimaryGroup - #define TokenPrivileges TokenPrivileges - #define TokenRestrictedSids TokenRestrictedSids - #define TokenSandBoxInert TokenSandBoxInert - #define TokenSessionId TokenSessionId - #define TokenSource TokenSource - #define TokenStatistics TokenStatistics - #define TokenType TokenType - #define TokenUser TokenUser - // TOKEN_TYPE constants #define TokenPrimary TokenPrimary --- 3802,3805 ---- |
From: Roger U. <ru...@us...> - 2007-07-18 19:03:00
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2291/win32/src Modified Files: win32tsmodule.cpp Log Message: Add support for WTSClientAddress and WTSClientDisplay Index: win32tsmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32tsmodule.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** win32tsmodule.cpp 3 Jun 2007 14:53:07 -0000 1.3 --- win32tsmodule.cpp 18 Jul 2007 19:03:00 -0000 1.4 *************** *** 385,393 **** ret=PyInt_FromLong(*(INT *)buf); break; default: PyErr_Format(PyExc_NotImplementedError, "InfoClass %d not yet supported", WTSInfoClass); ! } ! // WTSClientAddress WTS_CLIENT_ADDRESS. ! // WTSClientDisplay WTS_CLIENT_DISPLAY cleanup: if (buf) --- 385,428 ---- ret=PyInt_FromLong(*(INT *)buf); break; + case WTSClientDisplay:{ // @flag WTSClientDisplay|Dict containing client's display settings + WTS_CLIENT_DISPLAY *wcd=(WTS_CLIENT_DISPLAY *)buf; + ret=Py_BuildValue("{s:k, s:k, s:k}", + "HorizontalResolution", wcd->HorizontalResolution, + "VerticalResolution", wcd->VerticalResolution, + "ColorDepth", wcd->ColorDepth); + break; + } + case WTSClientAddress:{ // @flag WTSClientAddress|Dict containing type and value of client's IP address (None if console session) + PyObject *obaddress; + size_t address_cnt, address_ind; + WTS_CLIENT_ADDRESS *wca=(WTS_CLIENT_ADDRESS *)buf; + // ??? According to MSDN, buffer may be NULL for console session. (but I don't see it in practice) ??? + if (wca==NULL){ + Py_INCREF(Py_None); + ret=Py_None; + break; + } + address_cnt=ARRAYSIZE(wca->Address); + obaddress=PyTuple_New(address_cnt); + if (obaddress!=NULL) + for (address_ind=0; address_ind < address_cnt; address_ind++){ + PyObject *obaddress_element=PyInt_FromLong(wca->Address[address_ind]); + if (obaddress_element==NULL){ + Py_DECREF(obaddress); + obaddress=NULL; + break; + } + PyTuple_SET_ITEM(obaddress, address_ind, obaddress_element); + } + if (obaddress!=NULL) + ret=Py_BuildValue("{s:k, s:N}", + "AddressFamily", wca->AddressFamily, + "Address", obaddress); + break; + } default: PyErr_Format(PyExc_NotImplementedError, "InfoClass %d not yet supported", WTSInfoClass); ! } ! cleanup: if (buf) |
From: Mark H. <mha...@us...> - 2007-07-18 08:50:25
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26676 Modified Files: setup.py pywin32_postinstall.py Log Message: get things working with a (slightly patched) bdist_msi Index: pywin32_postinstall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pywin32_postinstall.py 1 Jul 2007 20:05:21 -0000 1.19 --- pywin32_postinstall.py 18 Jul 2007 08:50:25 -0000 1.20 *************** *** 6,9 **** --- 6,22 ---- import _winreg + # Send output somewhere so it can be found if necessary... + import tempfile + tee_f = open(os.path.join(tempfile.gettempdir(), 'pywin32_postinstall.log'), "w") + class Tee: + def __init__(self, file): + self.f = file + def write(self, what): + self.f.write(what) + tee_f.write(what) + + sys.stderr = Tee(sys.stderr) + sys.stdout = Tee(sys.stdout) + com_modules = [ # module_name, class_names *************** *** 30,34 **** --- 43,49 ---- # the Wise installer also creates. file_created + is_bdist_wininst = True except NameError: + is_bdist_wininst = False # we know what it is not - but not what it is :) def file_created(file): pass *************** *** 45,48 **** --- 60,104 ---- return _winreg.HKEY_CURRENT_USER + try: + create_shortcut + except NameError: + # Create a function with the same signature as create_shortcut provided + # by bdist_wininst + def create_shortcut(path, description, filename, + arguments="", workdir="", iconpath="", iconindex=0): + import pythoncom + from win32com.shell import shell, shellcon + + ilink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, + pythoncom.CLSCTX_INPROC_SERVER, + shell.IID_IShellLink) + ilink.SetPath(path) + ilink.SetDescription(description) + if arguments: + ilink.SetArguments(arguments) + if workdir: + ilink.SetWorkingDirectory(workdir) + if iconpath or iconindex: + ilink.SetIconLocation(iconpath, iconindex) + # now save it. + ipf = ilink.QueryInterface(pythoncom.IID_IPersistFile) + ipf.Save(filename, 0) + + # Support the same list of "path names" as bdist_wininst. + def get_special_folder_path(path_name): + import pythoncom + from win32com.shell import shell, shellcon + + for maybe in """ + CSIDL_COMMON_STARTMENU CSIDL_STARTMENU CSIDL_COMMON_APPDATA + CSIDL_LOCAL_APPDATA CSIDL_APPDATA CSIDL_COMMON_DESKTOPDIRECTORY + CSIDL_DESKTOPDIRECTORY CSIDL_COMMON_STARTUP CSIDL_STARTUP + CSIDL_COMMON_PROGRAMS CSIDL_PROGRAMS CSIDL_PROGRAM_FILES_COMMON + CSIDL_PROGRAM_FILES CSIDL_FONTS""".split(): + if maybe == path_name: + csidl = getattr(shellcon, maybe) + return shell.SHGetSpecialFolderPath(0, csidl, False) + raise ValueError, "%s is an unknown path ID" % (path_name,) + def CopyTo(desc, src, dest): import win32api, win32con *************** *** 126,131 **** func(klass, **flags) ! def RegisterPythonwin(): ! """ Add Pythonwin to context menu for python scripts. ??? Should probably also add Edit command for pys files also. Also need to remove these keys on uninstall, but there's no function --- 182,187 ---- func(klass, **flags) ! def RegisterPythonwin(register=True): ! """ Add (or remove) Pythonwin to context menu for python scripts. ??? Should probably also add Edit command for pys files also. Also need to remove these keys on uninstall, but there's no function *************** *** 140,154 **** pythonwin_edit_command=pythonwin_exe + ' /edit "%1"' ! ## Since _winreg only uses the character Api functions, this can fail if Python ! ## is installed to a path containing non-ascii characters ! pw_key = _winreg.CreateKey(classes_root, 'Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Pythonwin.exe') ! _winreg.SetValueEx(pw_key, None, 0, _winreg.REG_SZ, pythonwin_exe) ! pw_key.Close() ! pw_key = _winreg.CreateKey(classes_root, 'Software\\Classes\\Python.File\\shell\\Edit with Pythonwin\\command') ! _winreg.SetValueEx(pw_key, None, 0, _winreg.REG_SZ, pythonwin_edit_command) ! pw_key.Close() ! pw_key = _winreg.CreateKey(classes_root, 'Software\\Classes\\Python.NoConFile\\shell\\Edit with Pythonwin\\command') ! _winreg.SetValueEx(pw_key, None, 0, _winreg.REG_SZ, pythonwin_edit_command) ! pw_key.Close() def install(): --- 196,245 ---- pythonwin_edit_command=pythonwin_exe + ' /edit "%1"' ! keys_vals = [ ! ('Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Pythonwin.exe', '', pythonwin_exe), ! ('Software\\Classes\\Python.File\\shell\\Edit with Pythonwin', 'command', pythonwin_edit_command), ! ('Software\\Classes\\Python.NoConFile\\shell\\Edit with Pythonwin', 'command', pythonwin_edit_command), ! ] ! ! try: ! if register: ! for key, sub_key, val in keys_vals: ! ## Since _winreg only uses the character Api functions, this can fail if Python ! ## is installed to a path containing non-ascii characters ! hkey = _winreg.CreateKey(classes_root, key) ! if sub_key: ! hkey = _winreg.CreateKey(hkey, sub_key) ! _winreg.SetValueEx(hkey, None, 0, _winreg.REG_SZ, val) ! hkey.Close() ! else: ! for key, sub_key, val in keys_vals: ! try: ! _winreg.DeleteKey(classes_root, key) ! except OSError, why: ! if why.errno != 2: # file not found ! raise ! finally: ! # tell windows about the change ! from win32com.shell import shell, shellcon ! shell.SHChangeNotify(shellcon.SHCNE_ASSOCCHANGED, shellcon.SHCNF_IDLIST, None, None) ! ! def get_shortcuts_folder(): ! if get_root_hkey()==_winreg.HKEY_LOCAL_MACHINE: ! try: ! fldr = get_special_folder_path("CSIDL_COMMON_PROGRAMS") ! except OSError: ! # No CSIDL_COMMON_PROGRAMS on this platform ! fldr = get_special_folder_path("CSIDL_PROGRAMS") ! else: ! # non-admin install - always goes in this user's start menu. ! fldr = get_special_folder_path("CSIDL_PROGRAMS") ! ! try: ! install_group = _winreg.QueryValue(get_root_hkey(), ! root_key_name + "\\InstallPath\\InstallGroup") ! except OSError: ! vi = sys.version_info ! install_group = "Python %d.%d" % (vi[0], vi[1]) ! return os.path.join(fldr, install_group) def install(): *************** *** 268,272 **** traceback.print_exc() else: ! print 'Pythonwin has been registered in context menu' # Create the win32com\gen_py directory. --- 359,364 ---- traceback.print_exc() else: ! if verbose: ! print 'Pythonwin has been registered in context menu' # Create the win32com\gen_py directory. *************** *** 279,311 **** try: ! create_shortcut ! except NameError: ! # todo: create shortcut with win32all ! pass ! else: ! try: ! # use bdist_wininst builtins to create a shortcut. ! # CSIDL_COMMON_PROGRAMS only available works on NT/2000/XP, and ! # will fail there if the user has no admin rights. ! if get_root_hkey()==_winreg.HKEY_LOCAL_MACHINE: ! try: ! fldr = get_special_folder_path("CSIDL_COMMON_PROGRAMS") ! except OSError: ! # No CSIDL_COMMON_PROGRAMS on this platform ! fldr = get_special_folder_path("CSIDL_PROGRAMS") ! else: ! # non-admin install - always goes in this user's start menu. ! fldr = get_special_folder_path("CSIDL_PROGRAMS") ! ! try: ! install_group = _winreg.QueryValue(get_root_hkey(), ! root_key_name + "\\InstallPath\\InstallGroup") ! except OSError: ! vi = sys.version_info ! install_group = "Python %d.%d" % (vi[0], vi[1]) ! fldr = os.path.join(fldr, install_group) ! if not os.path.isdir(fldr): ! os.mkdir(fldr) ! dst = os.path.join(fldr, "PythonWin.lnk") create_shortcut(os.path.join(lib_dir, "Pythonwin\\Pythonwin.exe"), --- 371,381 ---- try: ! # create shortcuts ! # CSIDL_COMMON_PROGRAMS only available works on NT/2000/XP, and ! # will fail there if the user has no admin rights. ! fldr = get_shortcuts_folder() ! # If the group doesn't exist, then we don't make shortcuts - its ! # possible that this isn't a "normal" install. ! if os.path.isdir(fldr): dst = os.path.join(fldr, "PythonWin.lnk") create_shortcut(os.path.join(lib_dir, "Pythonwin\\Pythonwin.exe"), *************** *** 321,327 **** if verbose: print "Shortcut to documentation created" ! except Exception, details: ! if verbose: ! print details # Check the MFC dll exists - it is doesn't, point them at it --- 391,396 ---- if verbose: print "Shortcut to documentation created" ! except Exception, details: ! print details # Check the MFC dll exists - it is doesn't, point them at it *************** *** 353,356 **** --- 422,496 ---- print "The pywin32 extensions were successfully installed." + def uninstall(): + import distutils.sysconfig + lib_dir = distutils.sysconfig.get_python_lib(plat_specific=1) + # First ensure our system modules are loaded from pywin32_system, so + # we can remove the ones we copied... + LoadSystemModule(lib_dir, "pywintypes") + LoadSystemModule(lib_dir, "pythoncom") + + try: + RegisterCOMObjects(False) + except Exception, why: + print "Failed to unregister COM objects:", why + + try: + RegisterPythonwin(False) + except Exception, why: + print "Failed to unregister Pythonwin:", why + else: + if verbose: + print 'Unregistered Pythonwin' + + try: + # remove gen_py directory. + gen_dir = os.path.join(lib_dir, "win32com", "gen_py") + if os.path.isdir(gen_dir): + shutil.rmtree(gen_dir) + if verbose: + print "Removed directory", gen_dir + + # Remove pythonwin compiled "config" files. + pywin_dir = os.path.join(lib_dir, "Pythonwin", "pywin") + for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")): + os.remove(fname) + except Exception, why: + print "Failed to remove misc files:", why + + try: + fldr = get_shortcuts_folder() + for link in ("PythonWin.lnk", "Python for Windows Documentation.lnk"): + fqlink = os.path.join(fldr, link) + if os.path.isfile(fqlink): + os.remove(fqlink) + if verbose: + print "Removed", link + except Exception, why: + print "Failed to remove shortcuts:", why + # Now remove the system32 files. + files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*")) + # Try the system32 directory first - if that fails due to "access denied", + # it implies a non-admin user, and we use sys.prefix + try: + import win32api + for dest_dir in [win32api.GetSystemDirectory(), sys.prefix]: + # and copy some files over there + worked = 0 + for fname in files: + base = os.path.basename(fname) + dst = os.path.join(dest_dir, base) + if os.path.isfile(dst): + try: + os.remove(dst) + worked = 1 + if verbose: + print "Removed file %s" % (dst) + except Exception: + print "FAILED to remove", dst + if worked: + break + except Exception, why: + print "FAILED to remove system files:", why + def usage(): msg = \ *************** *** 405,411 **** verbose = 0 elif arg == "-remove": ! # Nothing to do here - we can't unregister much, as we have ! # already been uninstalled. ! pass else: print "Unknown option:", arg --- 545,553 ---- verbose = 0 elif arg == "-remove": ! # bdist_msi calls us before uninstall, so we can undo what we ! # previously did. Sadly, bdist_wininst calls us *after*, so ! # we can't do much at all. ! if not is_bdist_wininst: ! uninstall() else: print "Unknown option:", arg Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** setup.py 13 Jul 2007 03:06:57 -0000 1.61 --- setup.py 18 Jul 2007 08:50:24 -0000 1.62 *************** *** 1,3 **** ! build_id="210.1" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) --- 1,3 ---- ! build_id="210.5" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) *************** *** 94,107 **** import _winreg ! from distutils.core import setup, Extension, Command ! from distutils.command.install_lib import install_lib ! from distutils.command.build_ext import build_ext ! from distutils.command.build import build ! from distutils.command.install_data import install_data ! from distutils.dep_util import newer_group, newer ! from distutils import dir_util, file_util ! from distutils.sysconfig import get_python_lib ! from distutils.filelist import FileList ! from distutils.errors import DistutilsExecError # when cross-compiling on a 32bit platform, the variable CPU reflects --- 94,103 ---- import _winreg ! # Python version compatibility hacks ! try: ! True; False ! except NameError: ! True=0==0 ! False=1==0 # when cross-compiling on a 32bit platform, the variable CPU reflects *************** *** 125,128 **** --- 121,159 ---- is_32bit = not is_64bit + # More x64 hacks - all 64bit windows builds have sys.platform=='win32', and + # this is used for the "platform" part of the file and directory names. + # (eg, pywin32-210.1.win32-py2.5.msi) - but this is bad for us - we do + # want a distinction. + # so we monkey-patch distutils :( We must do this before the main distutils + # imports, which generall does 'from distutils.util import get_platform' + def hacked_get_platform(): + """getplaform monkey-patched by pywin32 setup""" + if is_32bit: + return sys.platform + else: + return get_build_architecture().lower() + + import distutils.util + distutils.util.get_platform = hacked_get_platform + + # The rest of our imports. + from distutils.core import setup, Extension, Command + from distutils.command.install import install + from distutils.command.install_lib import install_lib + from distutils.command.build_ext import build_ext + from distutils.command.build import build + from distutils.command.install_data import install_data + try: + from distutils.command.bdist_msi import bdist_msi + except ImportError: + # py23 and earlier + bdist_msi = None + from distutils.dep_util import newer_group, newer + from distutils import dir_util, file_util + from distutils.sysconfig import get_python_lib + from distutils.filelist import FileList + from distutils.errors import DistutilsExecError + import distutils.util + build_id_patch = build_id if not "." in build_id_patch: *************** *** 132,141 **** print "Building pywin32", pywin32_version - # Python 2.2 has no True/False - try: - True; False - except NameError: - True=0==0 - False=1==0 # nor distutils.log try: --- 163,166 ---- *************** *** 1007,1010 **** --- 1032,1066 ---- return new_sources + class my_install(install): + def run(self): + install.run(self) + # Custom script we run at the end of installing - this is the same script + # run by bdist_wininst + # This child process won't be able to install the system DLLs until our + # process has terminated (as distutils imports win32api!), so we must use + # some 'no wait' executor - spawn seems fine! We pass the PID of this + # process so the child will wait for us. + # XXX - hmm - a closer look at distutils shows it only uses win32api + # if _winreg fails - and this never should. Need to revisit this! + if not self.dry_run and not self.skip_build: + # What executable to use? This one I guess. + filename = os.path.join(os.path.dirname(this_file), "pywin32_postinstall.py") + if not os.path.isfile(filename): + raise RuntimeError, "Can't find '%s'" % (filename,) + print "Executing post install script..." + os.spawnl(os.P_NOWAIT, sys.executable, + sys.executable, filename, + "-quiet", "-wait", str(os.getpid()), "-install") + + if bdist_msi: + class my_bdist_msi(bdist_msi): + def get_installer_filename(self, fullname): + # base class hard-codes 'win32' + plat = distutils.util.get_platform() + installer_name = os.path.join(self.dist_dir, + "%s.%s-py%s.msi" % + (fullname, plat, self.target_version)) + return installer_name + # As per get_source_files, we need special handling so .mc file is # processed first. It appears there was an intention to fix distutils *************** *** 1626,1629 **** --- 1682,1693 ---- dll_base_address += 0x30000 + cmdclass = { 'install': my_install, + 'build': my_build, + 'build_ext': my_build_ext, + 'install_data': my_install_data, + } + if bdist_msi: + cmdclass['bdist_msi'] = my_bdist_msi + dist = setup(name="pywin32", version=str(build_id), *************** *** 1637,1645 **** url="http://sourceforge.net/projects/pywin32/", license="PSA", ! cmdclass = { #'install_lib': my_install_lib, ! 'build': my_build, ! 'build_ext': my_build_ext, ! 'install_data': my_install_data, ! }, options = {"bdist_wininst": {"install_script": "pywin32_postinstall.py", --- 1701,1705 ---- url="http://sourceforge.net/projects/pywin32/", license="PSA", ! cmdclass = cmdclass, options = {"bdist_wininst": {"install_script": "pywin32_postinstall.py", *************** *** 1732,1753 **** else: print "All extension modules %s OK" % (what_string,) - - # Custom script we run at the end of installing - this is the same script - # run by bdist_wininst, but the standard 'install' command doesn't seem - # to have such a concept. - # This child process won't be able to install the system DLLs until our - # process has terminated (as distutils imports win32api!), so we must use - # some 'no wait' executor - spawn seems fine! We pass the PID of this - # process so the child will wait for us. - # XXX - hmm - a closer look at distutils shows it only uses win32api - # if _winreg fails - and this never should. Need to revisit this! - if not dist.dry_run and dist.command_obj.has_key('install') \ - and not dist.command_obj.has_key('bdist_wininst'): - # What executable to use? This one I guess. - filename = os.path.join(os.path.dirname(this_file), "pywin32_postinstall.py") - if not os.path.isfile(filename): - raise RuntimeError, "Can't find '%s'" % (filename,) - print "Executing post install script..." - os.spawnl(os.P_NOWAIT, sys.executable, - sys.executable, filename, - "-quiet", "-wait", str(os.getpid()), "-install") --- 1792,1793 ---- |
From: Mark H. <mha...@us...> - 2007-07-18 08:46:23
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24935 Modified Files: shell.cpp Log Message: SHChangeNotify: allow both items to be None with SHCNF_IDLIST Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** shell.cpp 4 Jul 2007 01:46:55 -0000 1.58 --- shell.cpp 18 Jul 2007 08:46:24 -0000 1.59 *************** *** 1428,1432 **** switch (datatype){ case SHCNF_IDLIST: ! bsuccess=PyObject_AsPIDL(ob1, (ITEMIDLIST **)&p1, FALSE) && PyObject_AsPIDL(ob2, (ITEMIDLIST **)&p2, TRUE); break; --- 1428,1433 ---- switch (datatype){ case SHCNF_IDLIST: ! // SHCNE_ASSOCCHANGED wants both to be NULL! ! bsuccess=PyObject_AsPIDL(ob1, (ITEMIDLIST **)&p1, TRUE) && PyObject_AsPIDL(ob2, (ITEMIDLIST **)&p2, TRUE); break; |
From: Mark H. <mha...@us...> - 2007-07-13 03:06:57
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11601 Modified Files: setup.py Log Message: Various changes so things build for x64 using VS2005 (which is done via cross-compilation on a 32bit environment) Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** setup.py 3 Jun 2007 14:37:53 -0000 1.60 --- setup.py 13 Jul 2007 03:06:57 -0000 1.61 *************** *** 47,56 **** python setup.py -q build --debug install ! To build 64bit versions of this, you must manually setup your compiler and SDK environment ! variables, then set the environment variables 'DISTUTILS_USE_SDK' and 'MSSdk' to any value ! before running setup. This will prevent distutils trying to sniff out the correct directories, which ! it generally fails to do these days... """ # Originally by Thomas Heller, started in 2000 or so. from distutils.core import setup, Extension, Command --- 47,96 ---- python setup.py -q build --debug install ! To build 64bit versions of this: ! ! * Using VS2003 - these instructions are for cross-compiling on a 32bit ! environment. You must install the platform SDK with 64bit versions of ! the tools, then setup your environment with a command similar to: ! ! {sdk_dir}\SetEnv.Cmd /X64 /RETAIL ! ! then: ! ! set DISTUTILS_USE_SDK=1 ! ! Next, point at the directx SDK - eg: ! ! set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft DirectX SDK (December 2006)\Include ! set LIB=%LIB%;C:\Program Files\Microsoft DirectX SDK (December 2006)\Lib\x64 ! ! Now it starts getting wierd - we need to execute python.exe (32bit) to ! do the disutils build, but this build needs to find 64bit version of ! python.lib etc. The work-around for this is: ! ! * Extract a new Python source tree into a new directory ! * Build this tree using the 64bit instructions. ! * Set PYTHONHOME=c:\path_to_64bit_python ! * Execute: c:\path_to_32bit_python\python.exe setup.py build ! * un-set PYTHONHOME (set PYTHONHOME=) ! * Execute: c:\path_to_32bit_python\python.exe setup.py bdist_msi ! ! (Note that these instructions will have clobbered your 32bit build of ! Python - not the install, just the copy in the 'build' directory. Its ! probably a good idea to clobber the build directory when switching ! platforms so things don't get confused) ! ! ! * Using VS2005 natively in a 64bit environment: you must manually setup your ! compiler and SDK environment variables, then set the environment variables ! 'DISTUTILS_USE_SDK' and 'MSSdk' to any value before running setup. This ! will prevent distutils trying to sniff out the correct directories, which ! it generally fails to do these days... ! """ # Originally by Thomas Heller, started in 2000 or so. + import os, string, sys + import types, glob + import re + import _winreg from distutils.core import setup, Extension, Command *************** *** 64,82 **** from distutils.filelist import FileList from distutils.errors import DistutilsExecError ! try: ! from distutils.msvccompiler import get_build_architecture ! except ImportError: ! def get_build_architecture(): ! return "Intel" ARCHITECTURES_64 = ("Itanium", "AMD64") is_64bit = get_build_architecture() in ARCHITECTURES_64 is_32bit = not is_64bit - import types, glob - import os, string, sys - import re - import _winreg - build_id_patch = build_id if not "." in build_id_patch: --- 104,128 ---- from distutils.filelist import FileList from distutils.errors import DistutilsExecError ! ! # when cross-compiling on a 32bit platform, the variable CPU reflects ! # the *target*. Distutil's get_build_architecture() still reports 'Intel' ! # in this environment - so we trust the CPU variable. ! def get_build_architecture(): ! try: ! return os.environ["CPU"] ! except KeyError: ! # not set - trust distutils ! try: ! from distutils.msvccompiler import get_build_architecture as gba ! except ImportError: ! # ack - early Python ! return "Intel" ! return gba() ARCHITECTURES_64 = ("Itanium", "AMD64") + is_64bit = get_build_architecture() in ARCHITECTURES_64 is_32bit = not is_64bit build_id_patch = build_id if not "." in build_id_patch: *************** *** 234,237 **** --- 280,288 ---- 'win32/src'] + include_dirs libraries=libraries.split() + # VC2003 on x64 requires this library be explicitly linked... + if is_64bit and msvccompiler.get_build_version() < 8.0: + libraries.append('bufferoverflowU') + + extra_compile_args = (extra_compile_args or [])[:] # take copy if export_symbol_file: *************** *** 245,248 **** --- 296,302 ---- if is_64bit: extra_link_args.append("/MACHINE:%s" % get_build_architecture()) + # pyconfig.h checks for _M_X64, but it seems the SDK cross-compiler + # doesn't define it (no such problems with VS2005) + extra_compile_args.append('/D_M_X64') else: extra_link_args.append("/MACHINE:ix86") *************** *** 414,418 **** # distutils thinks it knows better, and resets those vars. # Note: sdk_dir is a global. ! if sdk_dir: extra = os.path.join(sdk_dir, 'include') if extra not in self.include_dirs and os.path.isdir(extra): --- 468,476 ---- # distutils thinks it knows better, and resets those vars. # Note: sdk_dir is a global. ! if 'DISTUTILS_USE_SDK' in os.environ: ! # theoretically, this means the environment is already setup ! # appropriately - so there is no need to go sniffing! ! pass ! elif sdk_dir: extra = os.path.join(sdk_dir, 'include') if extra not in self.include_dirs and os.path.isdir(extra): *************** *** 531,534 **** --- 589,594 ---- makeargs.append("SUB_DIR_O=%s" % build_temp) makeargs.append("SUB_DIR_BIN=%s" % build_temp) + if is_64bit and msvccompiler.get_build_version() < 8.0: + makeargs.append("LINK=bufferoverflowU.lib") cwd = os.getcwd() *************** *** 728,740 **** self.current_extension = ext ! if not self.mingw32 and ext.pch_header: ! ext.extra_compile_args = ext.extra_compile_args or [] ! if is_32bit: ! ext.extra_compile_args.append("/YX"+ext.pch_header) ! # if we are a verbose build, allow 64bit warnings ! if self.distribution.verbose: ext.extra_compile_args.append("/Wp64") - pch_name = os.path.join(self.build_temp, ext.name) + ".pch" - ext.extra_compile_args.append("/Fp"+pch_name) # some source files are compiled for different extensions --- 788,803 ---- self.current_extension = ext ! if not self.mingw32: ! if ext.pch_header: ! ext.extra_compile_args = ext.extra_compile_args or [] ! if is_32bit: ! ext.extra_compile_args.append("/YX"+ext.pch_header) ! pch_name = os.path.join(self.build_temp, ext.name) + ".pch" ! ext.extra_compile_args.append("/Fp"+pch_name) ! ! # if we are a verbose build, allow 64bit warnings (but not ! # when using VC6 - it doesn't understand that option. ! if self.distribution.verbose and sys.version_info > (2,4): ext.extra_compile_args.append("/Wp64") # some source files are compiled for different extensions *************** *** 772,775 **** --- 835,854 ---- ext.extra_compile_args.append("/EHsc") + # Try and find the MFC source code, so we can reach inside for + # some of the ActiveX support we need. We need to do this late, so + # the environment is setup correctly. + # Only used by the win32uiole extensions, but we pass it to all + # extensions just to make our life easier + found_mfc = False + for incl in os.environ.get("INCLUDE", "").split(os.pathsep): + # first is a "standard" MSVC install, second is the Vista SDK. + for candidate in ("..\src\occimpl.h", "..\..\src\mfc\occimpl.h"): + check = os.path.join(incl, candidate) + if os.path.isfile(check): + ext.extra_compile_args.append('/DMFC_OCC_IMPL_H=\\"%s\\"' % candidate) + break + if found_mfc: + break + self.swig_cpp = True try: *************** *** 1447,1450 **** --- 1526,1533 ---- flist.exclude_pattern("*.pyc") flist.exclude_pattern("*.pyo") + # files with a leading dot upset bdist_msi, and '.*' doesn't + # work - it matches from the start of the string and we have + # dir names. So any '\.' gets the boot. + flist.exclude_pattern(re.compile(".*\\\\\."), is_regex=1) if not flist.files: raise RuntimeError, "No files match '%s'" % file *************** *** 1564,1567 **** --- 1647,1653 ---- "title": "pywin32-%s" % (build_id,), }, + "bdist_msi": + {"install_script": "pywin32_postinstall.py", + }, }, |
From: Mark H. <mha...@us...> - 2007-07-13 03:04:51
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11118 Modified Files: win32win.cpp Log Message: In debug builds, assert there are no lingering exceptions which could theoretically cause the wrong behaviour Index: win32win.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** win32win.cpp 4 Jun 2007 04:50:39 -0000 1.17 --- win32win.cpp 13 Jul 2007 03:04:50 -0000 1.18 *************** *** 2196,2199 **** --- 2196,2200 ---- if (!pWnd) return NULL; + assert(!PyErr_Occurred()); // lingering exception? int message; WPARAM wp = 0; |
From: Mark H. <mha...@us...> - 2007-07-13 03:04:03
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10730 Modified Files: win32uiole.cpp Log Message: Use a #define to locate the MFC source code install (it is in a different relative location when MFC is in the platform SDK) Index: win32uiole.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uiole.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** win32uiole.cpp 24 May 2007 12:50:50 -0000 1.7 --- win32uiole.cpp 13 Jul 2007 03:04:04 -0000 1.8 *************** *** 22,26 **** // includes, which it is by default) #else ! #include "..\src\occimpl.h" #endif /* _MFC_VER */ --- 22,29 ---- // includes, which it is by default) #else ! #ifndef MFC_OCC_IMPL_H ! # error(MFC_OCC_IMPL_H must be set to the location of the MFC source code) ! #endif ! #include MFC_OCC_IMPL_H #endif /* _MFC_VER */ |
From: Mark H. <mha...@us...> - 2007-07-13 03:03:56
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10679 Modified Files: win32util.cpp Log Message: Indicate the type of the object causing the TypeError to be raised. Index: win32util.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32util.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32util.cpp 3 Jun 2007 13:23:45 -0000 1.10 --- win32util.cpp 13 Jul 2007 03:03:27 -0000 1.11 *************** *** 416,420 **** return FALSE; if (ob != Py_None) { ! if (!PyString_Check(ob)) RETURN_TYPE_ERR("The text item must be a string or None"); pItem->mask |= LVIF_TEXT; pItem->pszText = PyString_AsString(ob); --- 416,423 ---- return FALSE; if (ob != Py_None) { ! if (!PyString_Check(ob)) { ! PyErr_Format(PyExc_TypeError, "The text item must be a string or None (got %s)", ob->ob_type->tp_name); ! return FALSE; ! } pItem->mask |= LVIF_TEXT; pItem->pszText = PyString_AsString(ob); *************** *** 513,517 **** return FALSE; if (ob != Py_None) { ! if (!PyString_Check(ob)) RETURN_TYPE_ERR("The text item must be a string or None"); pItem->mask |= LVCF_TEXT; pItem->pszText = PyString_AsString(ob); --- 516,523 ---- return FALSE; if (ob != Py_None) { ! if (!PyString_Check(ob)) { ! PyErr_Format(PyExc_TypeError, "The text item must be a string or None (got %s)", ob->ob_type->tp_name); ! return FALSE; ! } pItem->mask |= LVCF_TEXT; pItem->pszText = PyString_AsString(ob); *************** *** 644,648 **** if (ob != Py_None) { // @tupleitem 3|string|text|Item text ! if (!PyString_Check(ob)) RETURN_TYPE_ERR("The text item must be a string or None"); pItem->mask |= TVIF_TEXT; pItem->pszText = PyString_AsString(ob); --- 650,657 ---- if (ob != Py_None) { // @tupleitem 3|string|text|Item text ! if (!PyString_Check(ob)) { ! PyErr_Format(PyExc_TypeError, "The text item must be a string or None (got %s)", ob->ob_type->tp_name); ! return FALSE; ! } pItem->mask |= TVIF_TEXT; pItem->pszText = PyString_AsString(ob); *************** *** 786,790 **** if (ob !=Py_None) { // @pyparm string|pszText||Item text ! if (!PyString_Check(ob)) RETURN_TYPE_ERR("The text item must be a string or None"); pItem->pszText = PyString_AsString(ob); if (PyErr_Occurred()) return FALSE; --- 795,802 ---- if (ob !=Py_None) { // @pyparm string|pszText||Item text ! if (!PyString_Check(ob)) { ! PyErr_Format(PyExc_TypeError, "The text item must be a string or None (got %s)", ob->ob_type->tp_name); ! return FALSE; ! } pItem->pszText = PyString_AsString(ob); if (PyErr_Occurred()) return FALSE; *************** *** 845,850 **** PyObject *obFont = PyTuple_GET_ITEM(args, 7); if (obFont != Py_None) { ! if (!PyString_Check(obFont)) ! RETURN_TYPE_ERR("Font name must be None or a string"); strncpy(pFmt->szFaceName, PyString_AsString(obFont), sizeof(pFmt->szFaceName)); } --- 857,864 ---- PyObject *obFont = PyTuple_GET_ITEM(args, 7); if (obFont != Py_None) { ! if (!PyString_Check(obFont)) { ! PyErr_Format(PyExc_TypeError, "Font name must be None or a string (got %s)", obFont->ob_type->tp_name); ! return FALSE; ! } strncpy(pFmt->szFaceName, PyString_AsString(obFont), sizeof(pFmt->szFaceName)); } |
From: Mark H. <mha...@us...> - 2007-07-13 03:02:51
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10252 Modified Files: win32uimodule.cpp Log Message: Allow us to build when MFC has no Ctrl3d support (ie, when _AFX_NO_CTL3D_SUPPORT is defined), such as in the early Vista SDKs Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** win32uimodule.cpp 3 Jun 2007 12:35:58 -0000 1.34 --- win32uimodule.cpp 13 Jul 2007 03:02:50 -0000 1.35 *************** *** 956,960 **** --- 956,965 ---- if (!pApp) return NULL; GUI_BGN_SAVE; + #ifdef _AFX_NO_CTL3D_SUPPORT + // This is defined for _WIN64 in earlier SDKs. + int rc = 0; + #else int rc = pApp->Enable3dControls(); + #endif GUI_END_SAVE; |
From: Mark H. <mha...@us...> - 2007-07-13 03:00:57
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9412 Modified Files: PyWinTypesmodule.cpp Log Message: Report the type of the object that couldn't be converted to a WPARAM, and add some comments about the current impl. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PyWinTypesmodule.cpp 3 Jun 2007 12:32:09 -0000 1.30 --- PyWinTypesmodule.cpp 13 Jul 2007 03:00:57 -0000 1.31 *************** *** 545,548 **** --- 545,549 ---- BOOL PyWinLong_AsVoidPtr(PyObject *ob, void **pptr) { + assert(!PyErr_Occurred()); // lingering exception? #ifdef _WIN64 *pptr=(void *)PyLong_AsLongLong(ob); *************** *** 615,626 **** // Conversion for WPARAM and LPARAM ! /* ??? WPARAM is defined as UINT_PTR, and LPARAM is defined as LONG_PTR. ! Make separate functions to avoid cast ??? */ BOOL PyWinObject_AsPARAM(PyObject *ob, WPARAM *pparam) { if (ob==NULL || ob==Py_None){ *pparam=NULL; return TRUE; } #ifdef UNICODE #define TCHAR_DESC "Unicode" --- 616,630 ---- // Conversion for WPARAM and LPARAM ! // (WPARAM is defined as UINT_PTR, and LPARAM is defined as LONG_PTR - see ! // pywintypes.h for inline functions to resolve this) BOOL PyWinObject_AsPARAM(PyObject *ob, WPARAM *pparam) { + assert(!PyErr_Occurred()); // lingering exception? if (ob==NULL || ob==Py_None){ *pparam=NULL; return TRUE; } + // XXX - why this UNICODE block? Can't we just do both anyway? Maybe + // just via the buffer interface? #ifdef UNICODE #define TCHAR_DESC "Unicode" *************** *** 630,634 **** } #else ! #define TCHAR_DESC "String" if (PyString_Check(ob)){ *pparam = (WPARAM)PyString_AS_STRING(ob); --- 634,638 ---- } #else ! #define TCHAR_DESC "String" if (PyString_Check(ob)){ *pparam = (WPARAM)PyString_AS_STRING(ob); *************** *** 636,647 **** } #endif - if (PyWinLong_AsVoidPtr(ob, (void **)pparam)) - return TRUE; - - PyErr_Clear(); PyBufferProcs *pb = ob->ob_type->tp_as_buffer; if (pb != NULL && pb->bf_getreadbuffer) return pb->bf_getreadbuffer(ob,0,(VOID **)pparam)!=-1; ! PyErr_SetString(PyExc_TypeError, "WPARAM must be a " TCHAR_DESC ", int, or buffer object"); return FALSE; } --- 640,654 ---- } #endif PyBufferProcs *pb = ob->ob_type->tp_as_buffer; if (pb != NULL && pb->bf_getreadbuffer) return pb->bf_getreadbuffer(ob,0,(VOID **)pparam)!=-1; ! ! if (PyWinLong_AsVoidPtr(ob, (void **)pparam)) ! return TRUE; ! ! if (!PyErr_Occurred()) ! PyErr_Format(PyExc_TypeError, ! "WPARAM must be a " TCHAR_DESC ", int, or buffer object (got %s)", ! ob->ob_type->tp_name); return FALSE; } |
From: Mark H. <mha...@us...> - 2007-07-13 03:00:17
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8982 Modified Files: dbi.cpp Log Message: Use PyWinObject_Astime_t for time_t conversion. That makes this module depend on pywintypes, but that should be fine. Index: dbi.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/dbi.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbi.cpp 24 May 2007 06:01:05 -0000 1.9 --- dbi.cpp 13 Jul 2007 03:00:16 -0000 1.10 *************** *** 12,17 **** #include <time.h> ! #include "Python.h" ! #include "intobject.h" /* Python 1.5.2 doesn't have PyObject_New --- 12,16 ---- #include <time.h> ! #include "pywintypes.h" /* Python 1.5.2 doesn't have PyObject_New *************** *** 26,32 **** #include "dbi.h" ! #ifdef _WIN64 ! # define ctime _ctime32 ! #endif typedef struct --- 25,31 ---- #include "dbi.h" ! //#ifdef _WIN64 ! //# define ctime _ctime32 ! //#endif typedef struct *************** *** 95,100 **** static PyObject *dateStr(PyObject *o) { ! long l = PyInt_AsLong(dbiValue(o)); ! return PyString_FromStringAndSize(ctime(&l), 24); /* less \n */ } --- 94,101 ---- static PyObject *dateStr(PyObject *o) { ! time_t t; ! if (!PyWinObject_Astime_t(dbiValue(o), &t)) ! return NULL; ! return PyString_FromStringAndSize(ctime(&t), 24); /* less \n */ } |