Skip to content

Commit 2850ae8

Browse files
committed
Remove considerations for Windows 2000 and Windows Vista
1 parent fb13fc0 commit 2850ae8

30 files changed

+66
-235
lines changed

com/help/active_directory.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ <h2><a name="getobj">Getting Active Directory Objects</a></h2>
8383

8484
<h3><a name="discovery">Discovery</a></h3>
8585
<p>
86-
A tool that can be of a great help is ADSIedit which is in the Windows
87-
2000 support tools on the Windows 2000 server cdrom. It gives you the
88-
raw ldap view of active directory.</p>
86+
A tool that can be of a great help is the ADSI Edit MMC snap-in, aka <b>ADSIEdit.msc</b>. See
87+
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=45520"
88+
>Remote Server Administration Tools for Windows 10</a> for installation instructions.
89+
It gives you the raw ldap view of active directory.
90+
Note that it is not available for the Home edition of Windows.</p>
8991
<code>
9092
def discover():
9193
Here is a function that helps you determine the active directory ldap strings that you can actually use.

com/win32com/server/register.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,9 @@ def UseCommandLine(*classes, **flags):
646646
else:
647647
RegisterClasses(*classes, **flags)
648648
except win32api.error as exc:
649-
# If we are on xp+ and have "access denied", retry using
650-
# ShellExecuteEx with 'runas' verb to force elevation (vista) and/or
651-
# admin login dialog (vista/xp)
652-
if (
653-
flags["unattended"]
654-
or exc.winerror != winerror.ERROR_ACCESS_DENIED
655-
or sys.getwindowsversion()[0] < 5
656-
):
649+
# If we have "access denied", retry using
650+
# ShellExecuteEx with 'runas' verb to force elevation
651+
if flags["unattended"] or exc.winerror != winerror.ERROR_ACCESS_DENIED:
657652
raise
658653
ReExecuteElevated(flags)
659654

com/win32com/src/PythonCOM.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ extern LONG _PyCom_GetGatewayCount(void);
9292
typedef HRESULT(STDAPICALLTYPE *CreateURLMonikerExfunc)(LPMONIKER, LPCWSTR, LPMONIKER *, DWORD);
9393
static CreateURLMonikerExfunc pfnCreateURLMonikerEx = NULL;
9494

95-
// Win2k or later
9695
typedef HRESULT(STDAPICALLTYPE *CoWaitForMultipleHandlesfunc)(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles,
9796
LPHANDLE pHandles, LPDWORD lpdwindex);
9897
static CoWaitForMultipleHandlesfunc pfnCoWaitForMultipleHandles = NULL;
@@ -104,7 +103,6 @@ typedef HRESULT(STDAPICALLTYPE *CoSetCancelObjectfunc)(IUnknown *);
104103
static CoSetCancelObjectfunc pfnCoSetCancelObject = NULL;
105104

106105
// typedefs for the function pointers are in OleAcc.h
107-
// WinXP or later
108106
LPFNOBJECTFROMLRESULT pfnObjectFromLresult = NULL;
109107

110108
typedef HRESULT(STDAPICALLTYPE *CoCreateInstanceExfunc)(REFCLSID, IUnknown *, DWORD, COSERVERINFO *, ULONG, MULTI_QI *);

com/win32comext/propsys/src/propsys.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// $Id$
33

44
// Implements wrappers for the Property System functions and interfaces.
5-
// These interfaces are present on Windows Vista and later, but can also
6-
// be installed on XP with Desktop Search 3.
7-
// However, this module doeen't dynamically load any libraries or functions,
8-
// so it will fail to import if the components are not installed.
95

106
// This source file contains autoduck documentation.
117
// @doc
@@ -41,7 +37,6 @@
4137
#define CHECK_PFN(fname) \
4238
if (pfn##fname == NULL) \
4339
return PyErr_Format(PyExc_NotImplementedError, "%s is not available on this platform", #fname);
44-
// Not available on Vista or earlier
4540
typedef HRESULT(WINAPI *PFNSHGetPropertyStoreForWindow)(HWND, REFIID, void **);
4641
static PFNSHGetPropertyStoreForWindow pfnSHGetPropertyStoreForWindow = NULL;
4742

@@ -546,7 +541,7 @@ static PyObject *PySHSetDefaultProperties(PyObject *self, PyObject *args)
546541
}
547542

548543
/* List of module functions */
549-
// @module propsys|A module, encapsulating the Vista Property System interfaces
544+
// @module propsys|A module, encapsulating the Property System interfaces
550545
static struct PyMethodDef propsys_methods[] = {
551546
// { "SHGetPropertyStoreFromIDList", PySHGetPropertyStoreFromIDList, 1 }, // @pymeth
552547
// SHGetPropertyStoreFromIDList|Retrieves the property store from an absolute ID list
@@ -618,10 +613,7 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = {
618613
/* Module initialisation */
619614
PYWIN_MODULE_INIT_FUNC(propsys)
620615
{
621-
PYWIN_MODULE_INIT_PREPARE(propsys, propsys_methods,
622-
"A module, encapsulating the Property System interfaces."
623-
"Available on Windows Vista and later, but can also be used"
624-
"on XP if Desktop Search 3 is installed.");
616+
PYWIN_MODULE_INIT_PREPARE(propsys, propsys_methods, "A module, encapsulating the Property System interfaces.");
625617

626618
if (PyDict_SetItemString(dict, "error", PyWinExc_COMError) == -1)
627619
PYWIN_MODULE_INIT_RETURN_ERROR;

com/win32comext/shell/demos/explorer_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# A sample of using Vista's IExplorerBrowser interfaces...
1+
# A sample of using IExplorerBrowser interfaces...
22
# Currently doesn't quite work:
33
# * CPU sits at 100% while running.
44

com/win32comext/shell/demos/servers/folder_view.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
# than our own.
66
# XXX - sadly, it doesn't work quite like the original sample. Oh well,
77
# another day...
8+
import errno
89
import os
910
import pickle
1011
import random
11-
import sys
12+
import struct
13+
import winreg
1214

1315
import commctrl
1416
import pythoncom
@@ -796,12 +798,6 @@ def get_schema_fname():
796798

797799

798800
def DllRegisterServer():
799-
import winreg
800-
801-
if sys.getwindowsversion()[0] < 6:
802-
print("This sample only works on Vista")
803-
sys.exit(1)
804-
805801
key = winreg.CreateKey(
806802
winreg.HKEY_LOCAL_MACHINE,
807803
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
@@ -816,7 +812,6 @@ def DllRegisterServer():
816812
attr = (
817813
shellcon.SFGAO_FOLDER | shellcon.SFGAO_HASSUBFOLDER | shellcon.SFGAO_BROWSABLE
818814
)
819-
import struct
820815

821816
s = struct.pack("i", attr)
822817
winreg.SetValueEx(key, "Attributes", 0, winreg.REG_BINARY, s)
@@ -832,7 +827,6 @@ def DllRegisterServer():
832827

833828

834829
def DllUnregisterServer():
835-
import winreg
836830

837831
paths = [
838832
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\"
@@ -845,8 +839,6 @@ def DllUnregisterServer():
845839
try:
846840
winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE, path)
847841
except OSError as details:
848-
import errno
849-
850842
if details.errno != errno.ENOENT:
851843
print(f"FAILED to remove {path}: {details}")
852844

com/win32comext/shell/src/PyIFileOperation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ PyObject *PyIFileOperation::GetAnyOperationsAborted(PyObject *self, PyObject *ar
629629
// performed by the shell as a unit. Serves as a replacement for <om shell.SHFileOperation>.
630630
// <nl>No changes are actually made until PerformOperations is called.
631631
// <nl>Progress can be monitored by implementing <o PyGFileOperationProgressSink>.
632-
// <nl>Requires Vista or later.
633632
static struct PyMethodDef PyIFileOperation_methods[] = {
634633
{"Advise", PyIFileOperation::Advise, 1}, // @pymeth Advise|Connects an event sink to receive updates
635634
{"Unadvise", PyIFileOperation::Unadvise, 1}, // @pymeth Unadvise|Disconnects a progress sink

com/win32comext/shell/src/PyIKnownFolder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ PyObject *PyIKnownFolder::GetFolderDefinition(PyObject *self, PyObject *args)
211211

212212
// @object PyIKnownFolder|Interface representing a known folder that serves
213213
// as a replacement for the numeric CSIDL definitions and API functions.
214-
// Requires Vista or later.
215214
static struct PyMethodDef PyIKnownFolder_methods[] = {
216215
{"GetId", PyIKnownFolder::GetId, 1}, // @pymeth GetId|Returns the id of the folder
217216
{"GetCategory", PyIKnownFolder::GetCategory,

com/win32comext/shell/src/PyIShellFolder2.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ PyObject *PyIShellFolder2::GetDetailsOf(PyObject *self, PyObject *args)
165165
}
166166

167167
// @pymethod <o SHCOLUMNID>|PyIShellFolder2|MapColumnToSCID|Returns the unique identifier (FMTID, pid) of a column
168-
// @rdesc On XP and earlier, this is the Column Id as provided by <o PyIColumnProvider>.
169-
// For Vista and later, this is the Property Key used with the property system interfaces.
168+
// @rdesc This is the Property Key used with the property system interfaces.
170169
PyObject *PyIShellFolder2::MapColumnToSCID(PyObject *self, PyObject *args)
171170
{
172171
IShellFolder2 *pISF2 = GetI(self);

com/win32comext/shell/src/shell.cpp

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,6 @@ static PyObject *PySHGetFolderPath(PyObject *self, PyObject *args)
14221422
}
14231423

14241424
// @pymethod |shell|SHSetFolderPath|Sets the location of one of the special folders
1425-
// @comm This function is only available on Windows 2000 or later
14261425
static PyObject *PySHSetFolderPath(PyObject *self, PyObject *args)
14271426
{
14281427
int csidl;
@@ -2631,11 +2630,6 @@ static PyObject *PyAssocCreate(PyObject *self, PyObject *args)
26312630
// interface.
26322631
static PyObject *PyAssocCreateForClasses(PyObject *self, PyObject *args)
26332632
{
2634-
// @comm This function is only available on Vista and later; a
2635-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2636-
if (pfnAssocCreateForClasses == NULL)
2637-
return PyCom_BuildPyException(E_NOTIMPL);
2638-
26392633
PyObject *ret = NULL;
26402634
PyObject *obClasses, *obiid;
26412635
if (!PyArg_ParseTuple(args, "OO:AssocCreateForClasses", &obClasses, &obiid))
@@ -2803,11 +2797,6 @@ done: {
28032797
// defaults can be further configured via the IDefaultExtractIconInit interface.
28042798
static PyObject *PySHCreateDefaultExtractIcon(PyObject *self, PyObject *args)
28052799
{
2806-
// @comm This function is only available on Vista and later; a
2807-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2808-
if (pfnSHCreateDefaultExtractIcon == NULL)
2809-
return PyCom_BuildPyException(E_NOTIMPL);
2810-
28112800
// be lazy - don't take IID as a param!
28122801
if (!PyArg_ParseTuple(args, ":SHCreateDefaultExtractIcon"))
28132802
return NULL;
@@ -2825,11 +2814,6 @@ static PyObject *PySHCreateDefaultExtractIcon(PyObject *self, PyObject *args)
28252814
// @pymethod <o PyIUnknown>|shell|SHCreateDataObject|
28262815
static PyObject *PySHCreateDataObject(PyObject *self, PyObject *args)
28272816
{
2828-
// @comm This function is only available on Vista and later; a
2829-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2830-
if (pfnSHCreateDataObject == NULL)
2831-
return PyCom_BuildPyException(E_NOTIMPL);
2832-
28332817
PyObject *ret = NULL;
28342818
PyObject *obParent;
28352819
PyObject *obChildren;
@@ -2879,11 +2863,6 @@ static PyObject *PySHCreateDataObject(PyObject *self, PyObject *args)
28792863
// @pymethod <o PyIUnknown>|shell|SHCreateDefaultContextMenu|
28802864
static PyObject *PySHCreateDefaultContextMenu(PyObject *self, PyObject *args)
28812865
{
2882-
// @comm This function is only available on Vista and later; a
2883-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2884-
if (pfnSHCreateDefaultContextMenu == NULL)
2885-
return PyCom_BuildPyException(E_NOTIMPL);
2886-
28872866
PyObject *ret = NULL;
28882867
PyObject *obdcm, *obiid;
28892868
IID iid = IID_IContextMenu;
@@ -2917,10 +2896,6 @@ static PyObject *PySHCreateDefaultContextMenu(PyObject *self, PyObject *args)
29172896
// @pymethod str|shell|SHGetNameFromIDList|Retrieves the display name of an item from an ID list.
29182897
static PyObject *PySHGetNameFromIDList(PyObject *self, PyObject *args)
29192898
{
2920-
// @comm This function is only available on Vista and later; a
2921-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2922-
if (pfnSHGetNameFromIDList == NULL)
2923-
return PyCom_BuildPyException(E_NOTIMPL);
29242899
PyObject *ret = NULL;
29252900
PyObject *obpidl;
29262901
SIGDN flags;
@@ -2954,11 +2929,6 @@ static PyObject *PySHGetNameFromIDList(PyObject *self, PyObject *args)
29542929
// @pymethod <o PyIShellItemArray>|shell|SHCreateShellItemArray|Creates a Shell item array object.
29552930
static PyObject *PySHCreateShellItemArray(PyObject *self, PyObject *args)
29562931
{
2957-
// @comm This function is only available on Vista and later; a
2958-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
2959-
if (pfnSHCreateShellItemArray == NULL)
2960-
return PyCom_BuildPyException(E_NOTIMPL);
2961-
29622932
PyObject *ret = NULL;
29632933
PyObject *obParent;
29642934
PyObject *obChildren;
@@ -3006,11 +2976,6 @@ static PyObject *PySHCreateShellItemArray(PyObject *self, PyObject *args)
30062976
// interface that contains a list of items (eg CF_HDROP)
30072977
static PyObject *PySHCreateShellItemArrayFromDataObject(PyObject *self, PyObject *args)
30082978
{
3009-
// @comm This function is only available on Vista and later; a
3010-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3011-
if (pfnSHCreateShellItemArrayFromDataObject == NULL)
3012-
return PyCom_BuildPyException(E_NOTIMPL);
3013-
30142979
PyObject *ret = NULL;
30152980
PyObject *obdo;
30162981
PyObject *obiid = Py_None;
@@ -3046,11 +3011,6 @@ static PyObject *PySHCreateShellItemArrayFromDataObject(PyObject *self, PyObject
30463011
// item identifiers
30473012
static PyObject *PySHCreateShellItemArrayFromIDLists(PyObject *self, PyObject *args)
30483013
{
3049-
// @comm This function is only available on Vista and later; a
3050-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3051-
if (pfnSHCreateShellItemArrayFromIDLists == NULL)
3052-
return PyCom_BuildPyException(E_NOTIMPL);
3053-
30543014
PyObject *ret = NULL;
30553015
PyObject *obpidls;
30563016
PCIDLIST_ABSOLUTE_ARRAY pidls = NULL;
@@ -3084,11 +3044,6 @@ static PyObject *PySHCreateShellItemArrayFromIDLists(PyObject *self, PyObject *a
30843044
// item
30853045
static PyObject *PySHCreateShellItemArrayFromShellItem(PyObject *self, PyObject *args)
30863046
{
3087-
// @comm This function is only available on Vista and later; a
3088-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3089-
if (pfnSHCreateShellItemArrayFromShellItem == NULL)
3090-
return PyCom_BuildPyException(E_NOTIMPL);
3091-
30923047
PyObject *obsi;
30933048
IShellItem *isi = NULL;
30943049
IID iid = IID_IShellItemArray;
@@ -3116,10 +3071,6 @@ static PyObject *PySHCreateShellItemArrayFromShellItem(PyObject *self, PyObject
31163071
// object from a PIDL. Can also create <o PyIShellItem2> objects.
31173072
static PyObject *PySHCreateItemFromIDList(PyObject *self, PyObject *args)
31183073
{
3119-
// @comm This function is only available on Vista and later; a
3120-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3121-
if (pfnSHCreateItemFromIDList == NULL)
3122-
return PyCom_BuildPyException(E_NOTIMPL);
31233074
PyObject *ret = NULL;
31243075
PyObject *obpidl;
31253076
IID iid = IID_IShellItem;
@@ -3151,11 +3102,6 @@ static PyObject *PySHCreateItemFromIDList(PyObject *self, PyObject *args)
31513102
// parsing name.
31523103
static PyObject *PySHCreateItemFromParsingName(PyObject *self, PyObject *args)
31533104
{
3154-
// @comm This function is only available on Vista and later; a
3155-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3156-
if (pfnSHCreateItemFromParsingName == NULL)
3157-
return PyCom_BuildPyException(E_NOTIMPL);
3158-
31593105
PyObject *ret = NULL;
31603106
PyObject *obname, *obctx, *obiid;
31613107
// @pyparm str|name||The display name of the item to create, eg a file path
@@ -3203,11 +3149,6 @@ static PyObject *PySHCreateItemFromParsingName(PyObject *self, PyObject *args)
32033149
// relative parsing name.
32043150
static PyObject *PySHCreateItemFromRelativeName(PyObject *self, PyObject *args)
32053151
{
3206-
// @comm This function is only available on Vista and later; a
3207-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3208-
if (pfnSHCreateItemFromRelativeName == NULL)
3209-
return PyCom_BuildPyException(E_NOTIMPL);
3210-
32113152
PyObject *ret = NULL;
32123153
PyObject *obname, *obctx, *obiid, *obparent;
32133154
// @pyparm <o PyIShellItem>|Parent||Shell item interface on the parent folder
@@ -3267,11 +3208,6 @@ static PyObject *PySHCreateItemFromRelativeName(PyObject *self, PyObject *args)
32673208
// inside a known folder.
32683209
static PyObject *PySHCreateItemInKnownFolder(PyObject *self, PyObject *args)
32693210
{
3270-
// @comm This function is only available on Vista and later; a
3271-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3272-
if (pfnSHCreateItemInKnownFolder == NULL)
3273-
return PyCom_BuildPyException(E_NOTIMPL);
3274-
32753211
DWORD flags;
32763212
PyObject *obname;
32773213
IID riid = IID_IShellItem;
@@ -3302,10 +3238,6 @@ static PyObject *PySHCreateItemInKnownFolder(PyObject *self, PyObject *args)
33023238
// ID.
33033239
static PyObject *PySHCreateItemWithParent(PyObject *self, PyObject *args)
33043240
{
3305-
// @comm This function is only available on Vista and later; a
3306-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3307-
if (pfnSHCreateItemWithParent == NULL)
3308-
return PyCom_BuildPyException(E_NOTIMPL);
33093241
PyObject *ret = NULL;
33103242
PyObject *obpidlparent, *obsfparent, *obpidl;
33113243
IID riid = IID_IShellItem;
@@ -3352,11 +3284,6 @@ static PyObject *PySHCreateItemWithParent(PyObject *self, PyObject *args)
33523284
// @pymethod <o PyIDL>|shell|SHGetIDListFromObject|Retrieves the PIDL of an object.
33533285
static PyObject *PySHGetIDListFromObject(PyObject *self, PyObject *args)
33543286
{
3355-
// @comm This function is only available on Vista and later; a
3356-
// COM exception with E_NOTIMPL will be thrown if the function can't be located.
3357-
if (pfnSHGetIDListFromObject == NULL)
3358-
return PyCom_BuildPyException(E_NOTIMPL);
3359-
33603287
PyObject *ret = NULL;
33613288
PyObject *ob;
33623289

0 commit comments

Comments
 (0)