diff --git a/AutoDuck/pywin32.mak b/AutoDuck/pywin32.mak index 9ab4500cc0..f746f7ebc5 100644 --- a/AutoDuck/pywin32.mak +++ b/AutoDuck/pywin32.mak @@ -43,7 +43,7 @@ WIN32_SOURCE = $(WIN32_SOURCE_DIR)/*.cpp \ $(WIN32_SOURCE_DIR)/win32crypt/*.cpp \ $(GENDIR)/win32evtlog.d $(GENDIR)/win32event.d $(GENDIR)/win32file.d \ $(GENDIR)/win32service.d $(GENDIR)/win32pipe.d $(GENDIR)/win32security.d \ - $(GENDIR)/win32process.d $(GENDIR)/wincerapi.d $(GENDIR)/win32gui.d \ + $(GENDIR)/win32process.d $(GENDIR)/win32gui.d \ $(GENDIR)/win32inet.d $(GENDIR)/_winxptheme.d \ $(GENDIR)/win32job.d \ winxpgui.d @@ -162,9 +162,6 @@ $(GENDIR)/win32security.d: $(WIN32_SOURCE_DIR)/$(*B).i $(GENDIR)/win32process.d: $(WIN32_SOURCE_DIR)/$(*B).i $(PYTHON) makedfromi.py -o$*.d $(WIN32_SOURCE_DIR)/$(*B).i -$(GENDIR)/wincerapi.d: $(WIN32_SOURCE_DIR)/$(*B).i - $(PYTHON) makedfromi.py -o$*.d $(WIN32_SOURCE_DIR)/$(*B).i - $(GENDIR)/win32gui.d: $(WIN32_SOURCE_DIR)/$(*B).i $(PYTHON) makedfromi.py -o$*.d $(WIN32_SOURCE_DIR)/$(*B).i diff --git a/com/win32com/src/ErrorUtils.cpp b/com/win32com/src/ErrorUtils.cpp index 628ba7ae8c..a0a48d1bef 100644 --- a/com/win32com/src/ErrorUtils.cpp +++ b/com/win32com/src/ErrorUtils.cpp @@ -977,11 +977,9 @@ void GetScodeString(HRESULT hr, LPTSTR buf, int bufSize) MAKE_HRESULT_ENTRY(CONNECT_E_CANNOTCONNECT), MAKE_HRESULT_ENTRY(CONNECT_E_OVERRIDDEN), -#ifndef NO_PYCOM_IPROVIDECLASSINFO MAKE_HRESULT_ENTRY(CLASS_E_NOTLICENSED), MAKE_HRESULT_ENTRY(CLASS_E_NOAGGREGATION), MAKE_HRESULT_ENTRY(CLASS_E_CLASSNOTAVAILABLE), -#endif // NO_PYCOM_IPROVIDECLASSINFO MAKE_HRESULT_ENTRY(CTL_E_ILLEGALFUNCTIONCALL), MAKE_HRESULT_ENTRY(CTL_E_OVERFLOW), diff --git a/com/win32com/src/PyGatewayBase.cpp b/com/win32com/src/PyGatewayBase.cpp index 83618d6867..ef48bd159d 100644 --- a/com/win32com/src/PyGatewayBase.cpp +++ b/com/win32com/src/PyGatewayBase.cpp @@ -70,11 +70,9 @@ void *PyGatewayBase::ThisAsIID(IID iid) if (iid == IID_IUnknown || iid == IID_IDispatch) // IDispatch * == IUnknown * return (IDispatch *)(PyGatewayBase *)this; -#ifndef NO_PYCOM_IDISPATCHEX else if (iid == IID_IDispatchEx) // IDispatchEx * probably == IUnknown *, but no real need to assume that! return (IDispatchEx *)this; -#endif // NO_PYCOM_IDISPATCHEX else if (iid == IID_ISupportErrorInfo) return (ISupportErrorInfo *)this; else if (iid == IID_IInternalUnwrapPythonObject) @@ -696,7 +694,6 @@ STDMETHODIMP PyGatewayBase::Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD w return hr; } -#ifndef NO_PYCOM_IDISPATCHEX //////////////////////////////////////////////////////////////////////////// // // The IDispatchEx implementation @@ -850,7 +847,6 @@ STDMETHODIMP PyGatewayBase::GetNameSpaceParent(IUnknown **ppunk) return PyCom_SetCOMErrorFromPyException(IID_IDispatchEx); } -#endif // NO_PYCOM_IDISPATCHEX //////////////////////////////////////////////////////////////////////////// // diff --git a/com/win32com/src/PyIDispatch.cpp b/com/win32com/src/PyIDispatch.cpp index 8a2f66f9a2..4297729b16 100644 --- a/com/win32com/src/PyIDispatch.cpp +++ b/com/win32com/src/PyIDispatch.cpp @@ -600,8 +600,6 @@ PyComTypeObject PyIDispatch::type("PyIDispatch", &PyIUnknown::type, // @base PyIDispatch|PyIUnknown sizeof(PyIDispatch), PyIDispatch_methods, GET_PYCOM_CTOR(PyIDispatch)); -#ifndef NO_PYCOM_IDISPATCHEX - ////////////////////////////////////////////////////////////////// // // PyIDispatchEx @@ -846,4 +844,3 @@ PyComTypeObject PyIDispatchEx::type("PyIDispatchEx", &PyIDispatch::type, // @base PyIDispatchEx|PyIDispatch sizeof(PyIDispatchEx), PyIDispatchEx_methods, GET_PYCOM_CTOR(PyIDispatchEx)); -#endif // NO_PYCOM_IDISPATCHEX diff --git a/com/win32com/src/PyStorage.cpp b/com/win32com/src/PyStorage.cpp index a29d628630..a199fe9c05 100644 --- a/com/win32com/src/PyStorage.cpp +++ b/com/win32com/src/PyStorage.cpp @@ -244,7 +244,6 @@ PyObject *pythoncom_StgOpenStorageOnILockBytes(PyObject *self, PyObject *args) return PyCom_PyObjectFromIUnknown(pResult, IID_IStorage, FALSE); } -#ifndef MS_WINCE // @pymethod int|pythoncom|StgIsStorageFile|Indicates whether a particular disk file contains a storage object. PyObject *pythoncom_StgIsStorageFile(PyObject *self, PyObject *args) { @@ -265,7 +264,6 @@ PyObject *pythoncom_StgIsStorageFile(PyObject *self, PyObject *args) // returns a failure HRESULT. return PyLong_FromLong(hr == 0); } -#endif // MS_WINCE // @pymethod |pythoncom|StgOpenStorage|Opens an existing root storage object in the file system. PyObject *pythoncom_StgOpenStorage(PyObject *self, PyObject *args) diff --git a/com/win32com/src/PythonCOM.cpp b/com/win32com/src/PythonCOM.cpp index 4bfa8dbd30..906ae93a37 100644 --- a/com/win32com/src/PythonCOM.cpp +++ b/com/win32com/src/PythonCOM.cpp @@ -44,9 +44,7 @@ extern PyObject *pythoncom_StgCreateStorageEx(PyObject *self, PyObject *args, Py extern PyObject *pythoncom_FmtIdToPropStgName(PyObject *self, PyObject *args); extern PyObject *pythoncom_PropStgNameToFmtId(PyObject *self, PyObject *args); -#ifndef MS_WINCE extern PyObject *pythoncom_StgIsStorageFile(PyObject *self, PyObject *args); -#endif // MS_WINCE extern PyObject *pythoncom_StgCreateDocfile(PyObject *self, PyObject *args); extern PyObject *pythoncom_StgCreateDocfileOnILockBytes(PyObject *self, PyObject *args); extern PyObject *pythoncom_StgOpenStorageOnILockBytes(PyObject *self, PyObject *args); @@ -67,9 +65,7 @@ extern PyObject *pythoncom_loadtypelib(PyObject *self, PyObject *args); extern PyObject *pythoncom_loadregtypelib(PyObject *self, PyObject *args); extern PyObject *pythoncom_registertypelib(PyObject *self, PyObject *args); extern PyObject *pythoncom_unregistertypelib(PyObject *self, PyObject *args); -#ifndef MS_WINCE extern PyObject *pythoncom_querypathofregtypelib(PyObject *self, PyObject *args); -#endif // MS_WINCE // Type object helpers PyObject *Py_NewFUNCDESC(PyObject *self, PyObject *args); @@ -119,7 +115,6 @@ static CoInitializeSecurityfunc pfnCoInitializeSecurity = NULL; BOOL PyCom_HasDCom() { -#ifndef MS_WINCE static BOOL bHaveDCOM = -1; if (bHaveDCOM == -1) { HMODULE hMod = GetModuleHandle(_T("ole32.dll")); @@ -131,9 +126,6 @@ BOOL PyCom_HasDCom() bHaveDCOM = FALSE; // not much we can do! } return bHaveDCOM; -#else // no DCOM on WinCE. - return FALSE; -#endif } #ifdef _MSC_VER @@ -180,7 +172,6 @@ static PyObject *pythoncom_CoCreateInstance(PyObject *self, PyObject *args) #pragma optimize("", on) #endif // _MSC_VER -#ifndef MS_WINCE #ifdef _MSC_VER #pragma optimize("", off) #endif // _MSC_VER @@ -484,7 +475,6 @@ static PyObject *pythoncom_CoTreatAsClass(PyObject *self, PyObject *args) Py_INCREF(Py_None); return Py_None; } -#endif // MS_WINCE // @pymethod |pythoncom|MakePyFactory|Creates a new object wrapping a PythonCOM // Class Factory object. @@ -528,7 +518,6 @@ static PyObject *pythoncom_GetGatewayCount(PyObject *self, PyObject *args) return PyLong_FromLong(_PyCom_GetGatewayCount()); } -#ifndef MS_WINCE // @pymethod |pythoncom|GetActiveObject|Retrieves an object representing a running object registered with // OLE static PyObject *pythoncom_GetActiveObject(PyObject *self, PyObject *args) @@ -583,7 +572,6 @@ static PyObject *pythoncom_connect(PyObject *self, PyObject *args) // @comm This function is equivalent to (clsid).(pythoncom.IID_IDispatch) } -#endif // MS_WINCE // @pymethod |pythoncom|new|Create a new instance of an OLE automation server. static PyObject *pythoncom_new(PyObject *self, PyObject *args) @@ -606,7 +594,6 @@ static PyObject *pythoncom_new(PyObject *self, PyObject *args) return rc; } -#ifndef MS_WINCE // @pymethod |pythoncom|CreateGuid|Creates a new, unique GUIID. static PyObject *pythoncom_createguid(PyObject *self, PyObject *args) { @@ -647,7 +634,6 @@ static PyObject *pythoncom_progidfromclsid(PyObject *self, PyObject *args) CoTaskMemFree(progid); return ob; } -#endif // MS_WINCE // @pymethod string|pythoncom|GetScodeString|Returns the string for an OLE scode (HRESULT) static PyObject *pythoncom_GetScodeString(PyObject *self, PyObject *args) @@ -801,7 +787,6 @@ static PyObject *pythoncom_MakeTime(PyObject *self, PyObject *args) return PyWinMethod_NewTime(self, args); } -#ifndef MS_WINCE // @pymethod ,int,|pythoncom|MkParseDisplayName|Parses a moniker display name into a moniker // object. The inverse of static PyObject *pythoncom_MkParseDisplayName(PyObject *self, PyObject *args) @@ -992,7 +977,6 @@ static PyObject *pythoncom_GetClassFile(PyObject *self, PyObject *args) return PyCom_BuildPyException(hr); return PyWinObject_FromIID(clsid); } -#endif // MS_WINCE // @pymethod |pythoncom|CoInitialize|Initialize the COM libraries for the calling thread. static PyObject *pythoncom_CoInitialize(PyObject *self, PyObject *args) @@ -1072,7 +1056,6 @@ static PyObject *pythoncom_CoFreeUnusedLibraries(PyObject *self, PyObject *args) return Py_None; } -#ifndef MS_WINCE // @pymethod |pythoncom|GetRunningObjectTable|Creates a new object. static PyObject *pythoncom_GetRunningObjectTable(PyObject *self, PyObject *args) { @@ -1316,7 +1299,6 @@ static PyObject *pythoncom_CoReleaseMarshalData(PyObject *self, PyObject *args) return Py_None; } -#endif // MS_WINCE // @pymethod |pythoncom|CoGetObject|Converts a display name into a moniker that identifies the object // named, and then binds to the object identified by the moniker. @@ -1969,13 +1951,11 @@ static struct PyMethodDef pythoncom_methods[] = { 1}, // @pymeth _GetInterfaceCount|Retrieves the number of interface objects currently in existance {"_GetGatewayCount", pythoncom_GetGatewayCount, 1}, // @pymeth _GetInterfaceCount|Retrieves the number of gateway objects currently in existance -#ifndef MS_WINCE {"CoCreateFreeThreadedMarshaler", pythoncom_CoCreateFreeThreadedMarshaler, 1}, // @pymeth CoCreateFreeThreadedMarshaler|Creates an aggregatable object capable of context-dependent // marshaling. {"CoCreateInstanceEx", pythoncom_CoCreateInstanceEx, 1}, // @pymeth CoCreateInstanceEx|Create a new instance of an OLE automation server possibly on a remote machine. -#endif // MS_WINCE {"CoCreateInstance", pythoncom_CoCreateInstance, 1}, // @pymeth CoCreateInstance|Create a new instance of an OLE automation server. {"CoFreeUnusedLibraries", pythoncom_CoFreeUnusedLibraries, @@ -1985,7 +1965,6 @@ static struct PyMethodDef pythoncom_methods[] = { 1}, // @pymeth CoInitialize|Initialize the COM libraries for the calling thread. {"CoInitializeEx", pythoncom_CoInitializeEx, 1}, // @pymeth CoInitializeEx|Initialize the COM libraries for the calling thread. -#ifndef MS_WINCE {"CoInitializeSecurity", pythoncom_CoInitializeSecurity, 1}, // @pymeth CoInitializeSecurity|Registers security and sets the default security values. {"CoGetInterfaceAndReleaseStream", pythoncom_CoGetInterfaceAndReleaseStream, @@ -2000,12 +1979,10 @@ static struct PyMethodDef pythoncom_methods[] = { 1}, // @pymeth CoUnmarshalInterface|Unmarshals an interface {"CoReleaseMarshalData", pythoncom_CoReleaseMarshalData, 1}, // @pymeth CoReleaseMarshalData|Frees resources used by a marshalled interface -#endif // MS_WINCE {"CoGetObject", pythoncom_CoGetObject, 1}, // @pymeth CoGetObject|Converts a display name into a moniker that identifies the object named, and then binds // to the object identified by the moniker. {"CoUninitialize", pythoncom_CoUninitialize, 1}, // @pymeth CoUninitialize|Uninitialize the COM libraries. -#ifndef MS_WINCE {"CoRegisterClassObject", pythoncom_CoRegisterClassObject, 1}, // @pymeth CoRegisterClassObject|Registers an EXE class object with OLE so other applications can connect to // it. @@ -2040,7 +2017,6 @@ static struct PyMethodDef pythoncom_methods[] = { 1}, // @pymeth CreateTypeLib|Provides access to a new object instance that supports the ICreateTypeLib interface. {"CreateTypeLib2", pythoncom_CreateTypeLib2, 1}, // @pymeth CreateTypeLib2|Provides access to a new object instance // that supports the ICreateTypeLib2 interface. -#endif // MS_WINCE {"CreateStreamOnHGlobal", pythoncom_CreateStreamOnHGlobal, 1}, // @pymeth CreateStreamOnHGlobal|Creates an in-memory stream storage object {"CreateILockBytesOnHGlobal", pythoncom_CreateILockBytesOnHGlobal, @@ -2049,22 +2025,18 @@ static struct PyMethodDef pythoncom_methods[] = { {"EnableQuitMessage", pythoncom_EnableQuitMessage, 1}, // @pymeth EnableQuitMessage|Indicates the thread PythonCOM should post a WM_QUIT message to. {"FUNCDESC", Py_NewFUNCDESC, 1}, // @pymeth FUNCDESC|Returns a new object. -#ifndef MS_WINCE {"GetActiveObject", pythoncom_GetActiveObject, 1}, // @pymeth GetActiveObject|Retrieves an object representing a running object registered with OLE {"GetClassFile", pythoncom_GetClassFile, 1}, // @pymeth GetClassFile|Supplies the CLSID associated with the given filename. -#endif // MS_WINCE {"GetFacilityString", pythoncom_GetFacilityString, 1}, // @pymeth GetFacilityString|Returns the facility string, given an OLE scode. {"GetRecordFromGuids", pythoncom_GetRecordFromGuids, 1}, // @pymeth GetRecordFromGuids|Creates a new record object from the given GUIDs {"GetRecordFromTypeInfo", pythoncom_GetRecordFromTypeInfo, 1}, // @pymeth GetRecordFromTypeInfo|Creates a object from a interface -#ifndef MS_WINCE {"GetRunningObjectTable", pythoncom_GetRunningObjectTable, 1}, // @pymeth GetRunningObjectTable|Obtains a object. -#endif // MS_WINCE {"GetScodeString", pythoncom_GetScodeString, 1}, // @pymeth GetScodeString|Returns the string for an OLE scode. {"GetScodeRangeString", pythoncom_GetScodeRangeString, 1}, // @pymeth GetScodeRangeString|Returns the scode range string, given an OLE scode. @@ -2078,11 +2050,9 @@ static struct PyMethodDef pythoncom_methods[] = { {"MakeTime", pythoncom_MakeTime, 1}, {"MakePyFactory", pythoncom_MakePyFactory, 1}, // @pymeth MakePyFactory|Creates a new object wrapping a PythonCOM Class Factory object. -#ifndef MS_WINCE {"MkParseDisplayName", pythoncom_MkParseDisplayName, 1}, // @pymeth MkParseDisplayName|Parses a moniker display name into a moniker object. The inverse of // IMoniker::GetDisplayName. -#endif // MS_WINCE {"new", pythoncom_new, 1}, {"New", pythoncom_new, 1}, // @pymeth New|Create a new instance of an OLE automation server. {"ObjectFromAddress", pythoncom_ObjectFromAddress, @@ -2106,24 +2076,19 @@ static struct PyMethodDef pythoncom_methods[] = { {"OleSaveToStream", pythoncom_OleSaveToStream, 1}, // @pymeth OleSaveToStream|Save an object to an IStream. {"OleLoad", pythoncom_OleLoad, 1}, // @pymeth OleLoad|Loads into memory an object nested within a specified storage object. -#ifndef MS_WINCE {"ProgIDFromCLSID", pythoncom_progidfromclsid, 1}, // @pymeth ProgIDFromCLSID|Converts a CLSID string to a progID. -#endif // MS_WINCE {"PumpWaitingMessages", pythoncom_PumpWaitingMessages, 1}, // @pymeth PumpWaitingMessages|Pumps all waiting messages for the current thread. {"PumpMessages", pythoncom_PumpMessages, 1}, // @pymeth PumpMessages|Pumps all messages for the current thread until a WM_QUIT message. -#ifndef MS_WINCE {"QueryPathOfRegTypeLib", pythoncom_querypathofregtypelib, 1}, // @pymeth QueryPathOfRegTypeLib|Retrieves the path of a registered type library -#endif // MS_WINCE {"ReadClassStg", pythoncom_ReadClassStg, 1}, // @pymeth ReadClassStg|Reads a CLSID from a storage object {"ReadClassStm", pythoncom_ReadClassStm, 1}, // @pymeth ReadClassStm|Reads a CLSID from a object {"RegisterTypeLib", pythoncom_registertypelib, 1}, // @pymeth RegisterTypeLib|Adds information about a type library to the system registry. {"UnRegisterTypeLib", pythoncom_unregistertypelib, 1}, // @pymeth UnRegisterTypeLib|Removes a type library from the system registry. -#ifndef MS_WINCE {"RegisterActiveObject", pythoncom_RegisterActiveObject, 1}, // @pymeth RegisterActiveObject|Register an object as the active object for its class {"RevokeActiveObject", pythoncom_RevokeActiveObject, @@ -2134,7 +2099,6 @@ static struct PyMethodDef pythoncom_methods[] = { {"RevokeDragDrop", pythoncom_RevokeDragDrop, 1}, // @pymeth RevokeDragDrop|Revokes the specified window as the target of an OLE drag-and-drop operation. {"DoDragDrop", pythoncom_DoDragDrop, 1}, // @pymeth DoDragDrop|Carries out an OLE drag and drop operation. -#endif // MS_WINCE {"StgCreateDocfile", pythoncom_StgCreateDocfile, 1}, // @pymeth StgCreateDocfile|Creates a new compound file storage object using the OLE-provided compound file // implementation for the interface. @@ -2144,10 +2108,8 @@ static struct PyMethodDef pythoncom_methods[] = { {"StgOpenStorageOnILockBytes", pythoncom_StgOpenStorageOnILockBytes, 1}, // @pymeth StgOpenStorageOnILockBytes|Open an existing storage object that does not reside in a disk file, but // instead has an underlying byte array provided by the caller. -#ifndef MS_WINCE {"StgIsStorageFile", pythoncom_StgIsStorageFile, 1}, // @pymeth StgIsStorageFile|Indicates whether a particular disk file contains a storage object. -#endif // MS_WINCE {"STGMEDIUM", Py_NewSTGMEDIUM, 1}, // @pymeth STGMEDIUM|Creates a new object suitable for the interface. {"StgOpenStorage", pythoncom_StgOpenStorage, @@ -2361,10 +2323,8 @@ PYWIN_MODULE_INIT_FUNC(pythoncom) ADD_CONSTANT(DISPID_PROPERTYPUT); ADD_CONSTANT(DISPID_NEWENUM); ADD_CONSTANT(DISPID_EVALUATE); -#ifndef NO_PYCOM_IDISPATCHEX ADD_CONSTANT(DISPID_STARTENUM); ADD_CONSTANT(DISPID_UNKNOWN); -#endif #ifdef DISPID_THIS ADD_CONSTANT(DISPID_THIS); #endif @@ -2641,7 +2601,6 @@ PYWIN_MODULE_INIT_FUNC(pythoncom) ADD_CONSTANT(COWAIT_WAITALL); ADD_CONSTANT(COWAIT_ALERTABLE); -#ifndef NO_PYCOM_IDISPATCHEX ADD_CONSTANT(fdexNameCaseSensitive); // Request that the name lookup be done in a case-sensitive manner. May be // ignored by object that does not support case-sensitive lookup. ADD_CONSTANT(fdexNameEnsure); // Request that the member be created if it does not already exist. The new member @@ -2666,7 +2625,6 @@ PYWIN_MODULE_INIT_FUNC(pythoncom) ADD_CONSTANT(fdexPropCannotConstruct); // The member cannot be called as a constructor using DISPATCH_CONSTRUCT. ADD_CONSTANT(fdexPropCanSourceEvents); // The member can fire events. ADD_CONSTANT(fdexPropCannotSourceEvents); // The member cannot fire events. -#endif // NO_PYCOM_IDISPATCHEX ADD_CONSTANT(DESCKIND_FUNCDESC); ADD_CONSTANT(DESCKIND_VARDESC); diff --git a/com/win32com/src/Register.cpp b/com/win32com/src/Register.cpp index eb5ec4592e..f602e01eaf 100644 --- a/com/win32com/src/Register.cpp +++ b/com/win32com/src/Register.cpp @@ -239,18 +239,12 @@ PyObject *pythoncom_IsGatewayRegistered(PyObject *self, PyObject *args) // Registration of the core PythonCOM module // static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { -#ifndef NO_PYCOM_ICATINFORMATION PYCOM_INTERFACE_CLSID_ONLY(StdComponentCategoriesMgr), -#endif // NO_PYCOM_ICATINFORMATION PYCOM_INTERFACE_CLSID_ONLY(StdGlobalInterfaceTable), // Sort alphabetically just for us poor humans! PYCOM_INTERFACE_CLIENT_ONLY(BindCtx), -#ifndef NO_PYCOM_ICATINFORMATION PYCOM_INTERFACE_CLIENT_ONLY(CatInformation), -#endif // NO_PYCOM_ICATINFORMATION -#ifndef NO_PYCOM_ICATREGISTER PYCOM_INTERFACE_CLIENT_ONLY(CatRegister), -#endif // NO_PYCOM_ICATREGISTER PYCOM_INTERFACE_CLIENT_ONLY(ClassFactory), PYCOM_INTERFACE_FULL(ConnectionPoint), PYCOM_INTERFACE_FULL(ConnectionPointContainer), @@ -260,15 +254,11 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { PYCOM_INTERFACE_FULL(DataObject), PYCOM_INTERFACE_FULL(DropSource), PYCOM_INTERFACE_FULL(DropTarget), -#ifndef NO_PYCOM_IENUMCATEGORYINFO PYCOM_INTERFACE_CLIENT_ONLY(EnumCATEGORYINFO), -#endif // NO_PYCOM_IENUMCATEGORYINFO PYCOM_INTERFACE_FULL(EnumConnectionPoints), PYCOM_INTERFACE_FULL(EnumConnections), PYCOM_INTERFACE_FULL(EnumFORMATETC), -#ifndef NO_PYCOM_IENUMGUID PYCOM_INTERFACE_FULL(EnumGUID), -#endif // NO_PYCOM_IENUMGUID PYCOM_INTERFACE_CLIENT_ONLY(EnumMoniker), #ifndef NO_PYCOM_ENUMSTATPROPSTG PYCOM_INTERFACE_FULL(EnumSTATPROPSTG), @@ -291,25 +281,17 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { PYCOM_INTERFACE_FULL(PersistStream), PYCOM_INTERFACE_FULL(PersistStreamInit), PYCOM_INTERFACE_FULL(PropertyBag), -#ifndef NO_PYCOM_IPROPERTYSETSTORAGE PYCOM_INTERFACE_FULL(PropertySetStorage), -#endif // NO_PYCOM_IPROPERTYSETSTORAGE -#ifndef NO_PYCOM_IPROPERTYSTORAGE PYCOM_INTERFACE_FULL(PropertyStorage), -#endif // NO_PYCOM_IPROPERTYSTORAGE -#ifndef NO_PYCOM_IPROVIDECLASSINFO PYCOM_INTERFACE_CLIENT_ONLY(ProvideClassInfo), PYCOM_INTERFACE_CLIENT_ONLY(ProvideClassInfo2), -#endif // NO_PYCOM_IPROVIDECLASSINFO PYCOM_INTERFACE_CLIENT_ONLY(RunningObjectTable), PYCOM_INTERFACE_CLIENT_ONLY(TypeComp), PYCOM_INTERFACE_CLIENT_ONLY(TypeInfo), PYCOM_INTERFACE_CLIENT_ONLY(TypeLib), -#ifndef NO_PYCOM_ISERVICEPROVIDER PYCOM_INTERFACE_FULL(ServiceProvider), -#endif // NO_PYCOM_ISERVICEPROVIDER PYCOM_INTERFACE_IID_ONLY(StdMarshalInfo), PYCOM_INTERFACE_FULL(Storage), PYCOM_INTERFACE_FULL(Stream), @@ -326,9 +308,7 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { {&IID_NULL, "Null", "IID_NULL", NULL, NULL}, {&IID_IUnknown, "IUnknown", "IID_IUnknown", &PyIUnknown::type, GET_PYGATEWAY_CTOR(PyGatewayBase)}, {&IID_IDispatch, "IDispatch", "IID_IDispatch", &PyIDispatch::type, GET_PYGATEWAY_CTOR(PyGatewayBase)}, -#ifndef NO_PYCOM_IDISPATCHEX {&IID_IDispatchEx, "IDispatchEx", "IID_IDispatchEx", &PyIDispatchEx::type, GET_PYGATEWAY_CTOR(PyGatewayBase)}, -#endif // NO_PYCOM_IDISPATCHEX {&IID_StdOle, "IID_StdOle", "IID_StdOle", NULL, NULL}, }; diff --git a/com/win32com/src/dllmain.cpp b/com/win32com/src/dllmain.cpp index 5cbfbba3b2..b30575cd58 100644 --- a/com/win32com/src/dllmain.cpp +++ b/com/win32com/src/dllmain.cpp @@ -118,11 +118,7 @@ void PyCom_DLLReleaseRef(void) static DWORD g_dwCoInitThread = 0; static BOOL g_bCoInitThreadHasInit = FALSE; -#ifndef MS_WINCE extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -#else -BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) -#endif { if (dwReason == DLL_PROCESS_ATTACH) { // LogEvent("Loaded pythoncom.dll"); @@ -139,9 +135,7 @@ BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) /* ** we don't need to be notified about threads */ -#ifndef MS_WINCE /* but CE doesnt seem to support it ?! */ DisableThreadLibraryCalls(hInstance); -#endif } else if (dwReason == DLL_PROCESS_DETACH) { // LogEvent("Terminated pythoncom.dll"); @@ -176,7 +170,6 @@ HRESULT PyCom_CoInitializeEx(LPVOID reserved, DWORD dwInit) CEnterLeaveFramework _celf; if (g_bCoInitThreadHasInit && g_dwCoInitThread == GetCurrentThreadId()) return S_OK; -#ifndef MS_WINCE // Do a LoadLibrary, as the Ex version may not always exist // on Win95. HMODULE hMod = GetModuleHandle(_T("ole32.dll")); @@ -190,9 +183,6 @@ HRESULT PyCom_CoInitializeEx(LPVOID reserved, DWORD dwInit) mypfn = (PFNCoInitializeEx)fp; HRESULT hr = (*mypfn)(reserved, dwInit); -#else // Windows CE _only_ has the Ex version! - HRESULT hr = CoInitializeEx(reserved, dwInit); -#endif // MS_WINCE // Unlike PyCom_CoInitialize, we return _all_ errors including // RPC_E_CHANGED_MODE @@ -219,11 +209,7 @@ HRESULT PyCom_CoInitialize(LPVOID reserved) // must manage itself. if (g_bCoInitThreadHasInit && g_dwCoInitThread == GetCurrentThreadId()) return S_OK; -#ifndef MS_WINCE HRESULT hr = CoInitialize(reserved); -#else // Windows CE _only_ has the Ex version, and only multi-threaded! - HRESULT hr = CoInitializeEx(reserved, COINIT_MULTITHREADED); -#endif // MS_WINCE if ((hr != RPC_E_CHANGED_MODE) && FAILED(hr)) { PyCom_LoggerException(NULL, L"OLE initialization failed! (0x%08lx)", hr); return hr; @@ -293,11 +279,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) // argc and argv are what Python should see as sys.argv HRESULT DoRegisterUnregister(LPCSTR fileName, int argc, char **argv) { -#ifdef MS_WINCE - FILE *fp = Py_fopen(fileName, "r"); -#else FILE *fp = fopen(fileName, "r"); -#endif if (fp == NULL) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); @@ -313,11 +295,7 @@ HRESULT DoRegisterUnregister(LPCSTR fileName, int argc, char **argv) hr = PyCom_SetCOMErrorFromPyException(); } } // End scope. -#ifdef MS_WINCE - Py_fclose(fp); -#else fclose(fp); -#endif PyCom_DLLReleaseRef(); return hr; diff --git a/com/win32com/src/extensions/PyICatInformation.cpp b/com/win32com/src/extensions/PyICatInformation.cpp index 297c17068f..6ac0e8c291 100644 --- a/com/win32com/src/extensions/PyICatInformation.cpp +++ b/com/win32com/src/extensions/PyICatInformation.cpp @@ -4,8 +4,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_ICATINFORMATION - #include #include "PyICatInformation.h" @@ -155,4 +153,3 @@ PyComTypeObject PyICatInformation::type("PyICatInformation", sizeof(PyICatInformation), PyICatInformation_methods, GET_PYCOM_CTOR(PyICatInformation)); -#endif // NO_PYCOM_ICATINFORMATION diff --git a/com/win32com/src/extensions/PyICatRegister.cpp b/com/win32com/src/extensions/PyICatRegister.cpp index ec3e95d23e..dec1e07d2c 100644 --- a/com/win32com/src/extensions/PyICatRegister.cpp +++ b/com/win32com/src/extensions/PyICatRegister.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_ICATREGISTER - #include "comcat.h" #include "PyICatRegister.h" /*** @@ -315,4 +313,3 @@ PyComTypeObject PyICatRegister::type("PyICatRegister", &PyIUnknown::type, // @base PyICatRegister|PyIUnknown sizeof(PyICatRegister), PyICatRegister_methods, GET_PYCOM_CTOR(PyICatRegister)); -#endif // NO_PYCOM_ICATREGISTER diff --git a/com/win32com/src/extensions/PyIEnumCATEGORYINFO.cpp b/com/win32com/src/extensions/PyIEnumCATEGORYINFO.cpp index ff91ef1fed..6aa8d09ab9 100644 --- a/com/win32com/src/extensions/PyIEnumCATEGORYINFO.cpp +++ b/com/win32com/src/extensions/PyIEnumCATEGORYINFO.cpp @@ -4,8 +4,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_IENUMCATEGORYINFO - #include #include "PyIEnumGUID.h" @@ -142,4 +140,3 @@ PyComEnumTypeObject PyIEnumCATEGORYINFO::type("PyIEnumCATEGORYINFO", sizeof(PyIEnumCATEGORYINFO), PyIEnumCATEGORYINFO_methods, GET_PYCOM_CTOR(PyIEnumCATEGORYINFO)); -#endif // NO_PYCOM_IENUMCATEGORYINFO diff --git a/com/win32com/src/extensions/PyIEnumGUID.cpp b/com/win32com/src/extensions/PyIEnumGUID.cpp index dee73fd255..e074d666fc 100644 --- a/com/win32com/src/extensions/PyIEnumGUID.cpp +++ b/com/win32com/src/extensions/PyIEnumGUID.cpp @@ -4,8 +4,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_IENUMGUID - #include #include "PyIEnumGUID.h" @@ -211,4 +209,3 @@ STDMETHODIMP PyGEnumGUID::Clone(IEnumGUID __RPC_FAR *__RPC_FAR *ppEnum) return PyCom_SetCOMErrorFromSimple(hr, IID_IEnumGUID); } -#endif // NO_PYCOM_IENUMGUID diff --git a/com/win32com/src/extensions/PyIPropertySetStorage.cpp b/com/win32com/src/extensions/PyIPropertySetStorage.cpp index 69a3bc5be6..15199f42b0 100644 --- a/com/win32com/src/extensions/PyIPropertySetStorage.cpp +++ b/com/win32com/src/extensions/PyIPropertySetStorage.cpp @@ -5,7 +5,6 @@ #include "PythonCOM.h" #include "PythonCOMServer.h" -#ifndef NO_PYCOM_IPROPERTYSETSTORAGE #include "PyIPropertySetStorage.h" // @doc - This file contains autoduck documentation @@ -235,4 +234,3 @@ STDMETHODIMP PyGPropertySetStorage::Enum( return hr; } -#endif // NO_PYCOM_IPROPERTYSETSTORAGE diff --git a/com/win32com/src/extensions/PyIPropertyStorage.cpp b/com/win32com/src/extensions/PyIPropertyStorage.cpp index dc4906da8f..98a3708722 100644 --- a/com/win32com/src/extensions/PyIPropertyStorage.cpp +++ b/com/win32com/src/extensions/PyIPropertyStorage.cpp @@ -6,7 +6,6 @@ #include "PythonCOM.h" #include "PythonCOMServer.h" -#ifndef NO_PYCOM_IPROPERTYSTORAGE #include "PyIPropertyStorage.h" // @doc - This file contains autoduck documentation @@ -1161,4 +1160,3 @@ STDMETHODIMP PyGPropertyStorage::Stat( return hr; } -#endif // NO_PYCOM_IPROPERTYSTORAGE diff --git a/com/win32com/src/extensions/PyIProvideClassInfo.cpp b/com/win32com/src/extensions/PyIProvideClassInfo.cpp index 30de4b7a3b..adb9c631ed 100644 --- a/com/win32com/src/extensions/PyIProvideClassInfo.cpp +++ b/com/win32com/src/extensions/PyIProvideClassInfo.cpp @@ -4,8 +4,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_IPROVIDECLASSINFO - PyIProvideClassInfo::PyIProvideClassInfo(IUnknown *pDisp) : PyIUnknown(pDisp) { ob_type = &type; } PyIProvideClassInfo::~PyIProvideClassInfo() {} @@ -87,4 +85,3 @@ PyComTypeObject PyIProvideClassInfo2::type( &PyIProvideClassInfo::type, // @base PyIProvideClassInfo2|PyIProvideClassInfo sizeof(PyIProvideClassInfo2), PyIProvideClassInfo2_methods, GET_PYCOM_CTOR(PyIProvideClassInfo2)); -#endif // NO_PYCOM_IPROVIDECLASSINFO diff --git a/com/win32com/src/extensions/PyIServiceProvider.cpp b/com/win32com/src/extensions/PyIServiceProvider.cpp index 885490e40c..b48c0b2b42 100644 --- a/com/win32com/src/extensions/PyIServiceProvider.cpp +++ b/com/win32com/src/extensions/PyIServiceProvider.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include "PythonCOM.h" -#ifndef NO_PYCOM_ISERVICEPROVIDER - #include "PythonCOMServer.h" #include "PyIServiceProvider.h" // @doc @@ -85,4 +83,3 @@ STDMETHODIMP PyGServiceProvider::QueryService(REFGUID guidService, REFIID riid, return MAKE_PYCOM_GATEWAY_FAILURE_CODE(method_name); } -#endif // NO_PYCOM_ISERVICEPROVIDER diff --git a/com/win32com/src/extensions/PyIType.cpp b/com/win32com/src/extensions/PyIType.cpp index e7d52a8e18..e45e549250 100644 --- a/com/win32com/src/extensions/PyIType.cpp +++ b/com/win32com/src/extensions/PyIType.cpp @@ -815,7 +815,6 @@ PyObject *pythoncom_unregistertypelib(PyObject *self, PyObject *args) // In-process objects typically call this API from DllUnregisterServer. } -#ifndef MS_WINCE // @pymethod |pythoncom|QueryPathOfRegTypeLib|Retrieves the path of a registered type library. PyObject *pythoncom_querypathofregtypelib(PyObject *self, PyObject *args) { @@ -841,7 +840,6 @@ PyObject *pythoncom_querypathofregtypelib(PyObject *self, PyObject *args) return PyCom_BuildPyException(hr); return PyWinObject_FromBstr(result, TRUE); } -#endif ///////////////////////////////////////////////////////////////////////////// // class PyITypeComp @@ -900,10 +898,7 @@ static PyObject *ITypeCompBind(ITypeComp *pTC, OLECHAR *S, unsigned short w) PyObject *ret; unsigned long hashval = 0; PY_INTERFACE_PRECALL; -#ifndef MS_WINCE - // appears in the headers for CE, but wont link!? hashval = LHashValOfNameSys(SYS_WIN32, LOCALE_USER_DEFAULT, S); -#endif SCODE sc = pTC->Bind(S, hashval, w, &pI, &DK, &BP); PY_INTERFACE_POSTCALL; if (FAILED(sc)) @@ -962,10 +957,7 @@ PyObject *PyITypeComp::BindType(OLECHAR *s) unsigned long hashval = 0; ITypeComp *pTC = GetI(this); PY_INTERFACE_PRECALL; -#ifndef MS_WINCE - // appears in the headers for CE, but wont link!? hashval = LHashValOfNameSys(SYS_WIN32, LOCALE_USER_DEFAULT, s); -#endif SCODE sc = pTC->BindType(s, hashval, &pI, &pC); PY_INTERFACE_POSTCALL; if (FAILED(sc)) diff --git a/com/win32com/src/include/PyICatInformation.h b/com/win32com/src/include/PyICatInformation.h index ef44b958c8..a3ec160741 100644 --- a/com/win32com/src/include/PyICatInformation.h +++ b/com/win32com/src/include/PyICatInformation.h @@ -1,6 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// // class PyICatInformation -#ifndef NO_PYCOM_ICATINFORMATION class PyICatInformation : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyICatInformation); @@ -15,4 +14,3 @@ class PyICatInformation : public PyIUnknown { PyICatInformation(IUnknown *); ~PyICatInformation(); }; -#endif // NO_PYCOM_ICATINFORMATION diff --git a/com/win32com/src/include/PyICatRegister.h b/com/win32com/src/include/PyICatRegister.h index 22797511d8..9bf0702394 100644 --- a/com/win32com/src/include/PyICatRegister.h +++ b/com/win32com/src/include/PyICatRegister.h @@ -1,4 +1,3 @@ -#ifndef NO_PYCOM_ICATREGISTER class PyICatRegister : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyICatRegister); @@ -17,4 +16,3 @@ class PyICatRegister : public PyIUnknown { PyICatRegister(IUnknown *pdisp); ~PyICatRegister(); }; -#endif // NO_PYCOM_ICATREGISTER diff --git a/com/win32com/src/include/PyIEnumGUID.h b/com/win32com/src/include/PyIEnumGUID.h index 55b046e665..c2cc8b5a9f 100644 --- a/com/win32com/src/include/PyIEnumGUID.h +++ b/com/win32com/src/include/PyIEnumGUID.h @@ -1,6 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// // class PyIEnumGUID -#ifndef NO_PYCOM_IENUMGUID #include "PythonCOM.h" #include "PythonCOMServer.h" @@ -40,11 +39,9 @@ class PyGEnumGUID : public PyGatewayBase, public IEnumGUID { STDMETHOD(Clone)(IEnumGUID __RPC_FAR *__RPC_FAR *ppenum); }; -#endif // NO_PYCOM_IENUMGUID ///////////////////////////////////////////////////////////////////////////// // class PyIEnumCATEGORYINFO -#ifndef NO_PYCOM_IENUMCATEGORYINFO class PyIEnumCATEGORYINFO : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIEnumCATEGORYINFO); @@ -60,4 +57,3 @@ class PyIEnumCATEGORYINFO : public PyIUnknown { PyIEnumCATEGORYINFO(IUnknown *); ~PyIEnumCATEGORYINFO(); }; -#endif // NO_PYCOM_IENUMCATEGORYINFO diff --git a/com/win32com/src/include/PyIServiceProvider.h b/com/win32com/src/include/PyIServiceProvider.h index 81702a6c02..652e241c7a 100644 --- a/com/win32com/src/include/PyIServiceProvider.h +++ b/com/win32com/src/include/PyIServiceProvider.h @@ -1,7 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // class PyIServiceProvider -#ifndef NO_PYCOM_ISERVICEPROVIDER class PYCOM_EXPORT PyIServiceProvider : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIServiceProvider); @@ -22,4 +21,3 @@ class PyGServiceProvider : public PyGatewayBase, public IServiceProvider { STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppv); }; -#endif // NO_PYCOM_ISERVICEPROVIDER diff --git a/com/win32com/src/include/PythonCOM.h b/com/win32com/src/include/PythonCOM.h index c8b7da82fa..3c862e9acf 100644 --- a/com/win32com/src/include/PythonCOM.h +++ b/com/win32com/src/include/PythonCOM.h @@ -90,24 +90,6 @@ #endif #endif -#ifdef MS_WINCE -// List of interfaces not supported by CE. -#define NO_PYCOM_IDISPATCHEX -#define NO_PYCOM_IPROVIDECLASSINFO -#define NO_PYCOM_IENUMGUID -#define NO_PYCOM_IENUMCATEGORYINFO -#define NO_PYCOM_ICATINFORMATION -#define NO_PYCOM_ICATREGISTER -#define NO_PYCOM_ISERVICEPROVIDER -#define NO_PYCOM_IPROPERTYSTORAGE -#define NO_PYCOM_IPROPERTYSETSTORAGE -#define NO_PYCOM_ENUMSTATPROPSTG - -#include "ocidl.h" -#include "oleauto.h" - -#endif // MS_WINCE - #ifdef __MINGW32__ // Special Mingw32 considerations. #define NO_PYCOM_ENUMSTATPROPSTG @@ -119,9 +101,7 @@ #include // Standard Win32 Types -#ifndef NO_PYCOM_IDISPATCHEX #include // New header for IDispatchEx interface. -#endif // NO_PYCOM_IDISPATCHEX #if defined(MAINWIN) // Mainwin seems to have 1/2 the VT_RECORD infrastructure in place @@ -492,7 +472,6 @@ class PYCOM_EXPORT PyIDispatch : public PyIUnknown { ~PyIDispatch(); }; -#ifndef NO_PYCOM_IDISPATCHEX ///////////////////////////////////////////////////////////////////////////// // class PyIDispatchEx @@ -515,7 +494,6 @@ class PYCOM_EXPORT PyIDispatchEx : public PyIDispatch { PyIDispatchEx(IUnknown *pdisp); ~PyIDispatchEx(); }; -#endif // NO_PYCOM_IDISPATCHEX ///////////////////////////////////////////////////////////////////////////// // class PyIClassFactory @@ -535,8 +513,6 @@ class PYCOM_EXPORT PyIClassFactory : public PyIUnknown { ~PyIClassFactory(); }; -#ifndef NO_PYCOM_IPROVIDECLASSINFO - ///////////////////////////////////////////////////////////////////////////// // class PyIProvideTypeInfo @@ -567,7 +543,6 @@ class PYCOM_EXPORT PyIProvideClassInfo2 : public PyIProvideClassInfo { PyIProvideClassInfo2(IUnknown *pdisp); ~PyIProvideClassInfo2(); }; -#endif // NO_PYCOM_IPROVIDECLASSINFO ///////////////////////////////////////////////////////////////////////////// // class PyITypeInfo diff --git a/com/win32com/src/include/PythonCOMServer.h b/com/win32com/src/include/PythonCOMServer.h index d263b3adb6..f026168a0c 100644 --- a/com/win32com/src/include/PythonCOMServer.h +++ b/com/win32com/src/include/PythonCOMServer.h @@ -86,11 +86,7 @@ interface IInternalUnwrapPythonObject : public IUnknown // Base class for all gateways. // class PYCOM_EXPORT PyGatewayBase : -#ifndef NO_PYCOM_IDISPATCHEX public IDispatchEx, // IDispatch comes along for the ride! -#else - public IDispatch, // No IDispatchEx - must explicitely use IDispatch -#endif public ISupportErrorInfo, public IInternalUnwrapPythonObject { protected: @@ -115,7 +111,6 @@ class PYCOM_EXPORT PyGatewayBase : EXCEPINFO FAR *pexcepinfo, UINT FAR *puArgErr); // IDispatchEx -#ifndef NO_PYCOM_IDISPATCHEX STDMETHOD(GetDispID)(BSTR bstrName, DWORD grfdex, DISPID *pid); STDMETHOD(InvokeEx) (DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller); @@ -125,7 +120,6 @@ class PYCOM_EXPORT PyGatewayBase : STDMETHOD(GetMemberName)(DISPID id, BSTR *pbstrName); STDMETHOD(GetNextDispID)(DWORD grfdex, DISPID id, DISPID *pid); STDMETHOD(GetNameSpaceParent)(IUnknown **ppunk); -#endif // NO_PYCOM_IDISPATCHEX // ISupportErrorInfo STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); diff --git a/com/win32comext/axscript/src/stdafx.h b/com/win32comext/axscript/src/stdafx.h index 0f373ebb42..c60a87042e 100644 --- a/com/win32comext/axscript/src/stdafx.h +++ b/com/win32comext/axscript/src/stdafx.h @@ -11,10 +11,8 @@ #include -#ifndef MS_WINCE // win32 wont need that soon? // Must come after Python headers. #include -#endif #include diff --git a/mypy.ini b/mypy.ini index 9055b84925..e9ab5d76b5 100644 --- a/mypy.ini +++ b/mypy.ini @@ -27,7 +27,7 @@ disable_error_code = attr-defined, method-assign, name-defined exclude = .*((build|adodbapi|Pythonwin/Scintilla|Pythonwin/pywin/idle|[Tt]est|[Dd]emos?)/.*|rasutil.py|setup.py) ; C-modules that will need type-stubs -[mypy-adsi.*,dde,exchange,exchdapi,perfmon,servicemanager,win32api,win32clipboard,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,wincerapi,winxpgui,_win32sysloader,_winxptheme] +[mypy-adsi.*,dde,exchange,exchdapi,perfmon,servicemanager,win32api,win32clipboard,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,winxpgui,_win32sysloader,_winxptheme] ignore_missing_imports = True ; verstamp is installed from win32verstamp.py called in setup.py diff --git a/win32/Demos/cerapi.py b/win32/Demos/cerapi.py deleted file mode 100644 index b0a24a3e96..0000000000 --- a/win32/Demos/cerapi.py +++ /dev/null @@ -1,251 +0,0 @@ -# A demo of the Windows CE Remote API -# -# This connects to a CE device, and interacts with it. - -import getopt -import os -import sys - -import win32api -import win32con -import win32event -import wincerapi - - -def DumpPythonRegistry(): - try: - h = wincerapi.CeRegOpenKeyEx( - win32con.HKEY_LOCAL_MACHINE, - "Software\\Python\\PythonCore\\%s\\PythonPath" % sys.winver, - ) - except win32api.error: - print("The remote device does not appear to have Python installed") - return 0 - path, typ = wincerapi.CeRegQueryValueEx(h, None) - print(f"The remote PythonPath is '{str(path)}'") - h.Close() - return 1 - - -def DumpRegistry(root, level=0): - # A recursive dump of the remote registry to test most functions. - h = wincerapi.CeRegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, None) - level_prefix = " " * level - index = 0 - # Enumerate values. - while 1: - try: - name, data, typ = wincerapi.CeRegEnumValue(root, index) - except win32api.error: - break - print(f"{level_prefix}{name}={repr(str(data))}") - index = index + 1 - # Now enumerate all keys. - index = 0 - while 1: - try: - name, klass = wincerapi.CeRegEnumKeyEx(root, index) - except win32api.error: - break - print(f"{level_prefix}{name}\\") - subkey = wincerapi.CeRegOpenKeyEx(root, name) - DumpRegistry(subkey, level + 1) - index = index + 1 - - -def DemoCopyFile(): - # Create a file on the device, and write a string. - cefile = wincerapi.CeCreateFile( - "TestPython", win32con.GENERIC_WRITE, 0, None, win32con.OPEN_ALWAYS, 0, None - ) - wincerapi.CeWriteFile(cefile, "Hello from Python") - cefile.Close() - # reopen the file and check the data. - cefile = wincerapi.CeCreateFile( - "TestPython", win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None - ) - if wincerapi.CeReadFile(cefile, 100) != "Hello from Python": - print("Couldnt read the data from the device!") - cefile.Close() - # Delete the test file - wincerapi.CeDeleteFile("TestPython") - print("Created, wrote to, read from and deleted a test file!") - - -def DemoCreateProcess(): - try: - hp, ht, pid, tid = wincerapi.CeCreateProcess( - "Windows\\Python.exe", "", None, None, 0, 0, None, "", None - ) - - # Not necessary, except to see if handle closing raises an exception - # (if auto-closed, the error is suppressed) - hp.Close() - ht.Close() - print("Python is running on the remote device!") - except win32api.error as xxx_todo_changeme1: - (hr, fn, msg) = xxx_todo_changeme1.args - print("Couldnt execute remote process -", msg) - - -def DumpRemoteMachineStatus(): - ( - ACLineStatus, - BatteryFlag, - BatteryLifePercent, - BatteryLifeTime, - BatteryFullLifeTime, - BackupBatteryFlag, - BackupBatteryLifePercent, - BackupBatteryLifeTime, - BackupBatteryLifeTime, - ) = wincerapi.CeGetSystemPowerStatusEx() - if ACLineStatus: - power = "AC" - else: - power = "battery" - if BatteryLifePercent == 255: - batPerc = "unknown" - else: - batPerc = BatteryLifePercent - print(f"The batteries are at {batPerc}%, and is currently being powered by {power}") - - ( - memLoad, - totalPhys, - availPhys, - totalPage, - availPage, - totalVirt, - availVirt, - ) = wincerapi.CeGlobalMemoryStatus() - - print("The memory is %d%% utilized." % (memLoad)) - print("%-20s%-10s%-10s" % ("", "Total", "Avail")) - print("%-20s%-10s%-10s" % ("Physical Memory", totalPhys, availPhys)) - print("%-20s%-10s%-10s" % ("Virtual Memory", totalVirt, availVirt)) - print("%-20s%-10s%-10s" % ("Paging file", totalPage, availPage)) - - storeSize, freeSize = wincerapi.CeGetStoreInformation() - print("%-20s%-10s%-10s" % ("File store", storeSize, freeSize)) - - print("The CE temp path is", wincerapi.CeGetTempPath()) - print("The system info for the device is", wincerapi.CeGetSystemInfo()) - - -def DumpRemoteFolders(): - # Dump all special folders possible. - for name, val in list(wincerapi.__dict__.items()): - if name[:6] == "CSIDL_": - try: - loc = str(wincerapi.CeGetSpecialFolderPath(val)) - print(f"Folder {name} is at {loc}") - except win32api.error as details: - pass - - # Get the shortcut targets for the "Start Menu" - print("Dumping start menu shortcuts...") - try: - startMenu = str(wincerapi.CeGetSpecialFolderPath(wincerapi.CSIDL_STARTMENU)) - except win32api.error as details: - print("This device has no start menu!", details) - startMenu = None - - if startMenu: - for fileAttr in wincerapi.CeFindFiles(os.path.join(startMenu, "*")): - fileName = fileAttr[8] - fullPath = os.path.join(startMenu, str(fileName)) - try: - resolved = wincerapi.CeSHGetShortcutTarget(fullPath) - except win32api.error as xxx_todo_changeme: - (rc, fn, msg) = xxx_todo_changeme.args - resolved = "#Error - %s" % msg - print(f"{fileName}->{resolved}") - - # print("The start menu is at") - # print(wincerapi.CeSHGetShortcutTarget("\\Windows\\Start Menu\\Shortcut to Python.exe.lnk")) - - -def usage(): - print("Options:") - print("-a - Execute all demos") - print("-p - Execute Python process on remote device") - print("-r - Dump the remote registry") - print("-f - Dump all remote special folder locations") - print("-s - Dont dump machine status") - print("-y - Perform asynch init of CE connection") - - -def main(): - async_init = bStartPython = bDumpRegistry = bDumpFolders = 0 - bDumpStatus = 1 - try: - opts, args = getopt.getopt(sys.argv[1:], "apr") - except getopt.error as why: - print("Invalid usage:", why) - usage() - return - - for o, v in opts: - if o == "-a": - bStartPython = bDumpRegistry = bDumpStatus = bDumpFolders = asynch_init = 1 - if o == "-p": - bStartPython = 1 - if o == "-r": - bDumpRegistry = 1 - if o == "-s": - bDumpStatus = 0 - if o == "-f": - bDumpFolders = 1 - if o == "-y": - print("Doing asynch init of CE connection") - async_init = 1 - - if async_init: - event, rc = wincerapi.CeRapiInitEx() - while 1: - rc = win32event.WaitForSingleObject(event, 500) - if rc == win32event.WAIT_OBJECT_0: - # We connected. - break - else: - print( - "Waiting for Initialize to complete (picture a Cancel button here :)" - ) - else: - wincerapi.CeRapiInit() - print("Connected to remote CE device.") - try: - verinfo = wincerapi.CeGetVersionEx() - print( - "The device is running windows CE version %d.%d - %s" - % (verinfo[0], verinfo[1], verinfo[4]) - ) - - if bDumpStatus: - print("Dumping remote machine status") - DumpRemoteMachineStatus() - - if bDumpRegistry: - print("Dumping remote registry...") - DumpRegistry(win32con.HKEY_LOCAL_MACHINE) - - if bDumpFolders: - print("Dumping remote folder information") - DumpRemoteFolders() - - DemoCopyFile() - if bStartPython: - print("Starting remote Python process") - if DumpPythonRegistry(): - DemoCreateProcess() - else: - print("Not trying to start Python, as it's not installed") - - finally: - wincerapi.CeRapiUninit() - print("Disconnected") - - -if __name__ == "__main__": - main() diff --git a/win32/Demos/win32wnet/netresource.htm b/win32/Demos/win32wnet/netresource.htm index afacd984d7..30d8272b14 100644 --- a/win32/Demos/win32wnet/netresource.htm +++ b/win32/Demos/win32wnet/netresource.htm @@ -74,8 +74,7 @@

WIN32WNET Functions

win32wnet.py is the Python extension providing access to the WNetXXX Win32APIs. This module is fully -compilable for both Ascii and Unicode and contains conditional, -if untested as of this writing, compiles for Windows CE. This +compilable for both Ascii and Unicode. This module has been tested with Python 1.5.1 and Windows NT workstation 4.0 SP3.

@@ -110,13 +109,7 @@

WIN32WNET Functions

object that is being constructed for the Win32API call. UserName and Password are obvious. Passing None for UserName and Password will attempt a - NULL session connection. NOTE: when compiled for - Windows CE, this function is conditionally - compiled to call the WNetAddConnection3 - API interface with a NULL hwnd parameter, making - it functionally equivalent to WNetAddConnection2. - WNetAddConnection3 is the only interface - supported by Windows CE. + NULL session connection.
Note that this function has since been updated to optionally accept a NETRESOURCE object making its signature almost identical to the win32 version - see the pywin32 help for diff --git a/win32/scripts/ce/pysynch.py b/win32/scripts/ce/pysynch.py deleted file mode 100644 index f01e7e4b89..0000000000 --- a/win32/scripts/ce/pysynch.py +++ /dev/null @@ -1,289 +0,0 @@ -# Simple CE synchronisation utility with Python features. - -import fnmatch -import getopt -import os -import sys -from collections.abc import Callable - -import win32api -import win32con -import win32file -import wincerapi - - -class InvalidUsage(Exception): - pass - - -def print_error(api_exc, msg): - hr, fn, errmsg = api_exc - print("%s - %s(%d)" % (msg, errmsg, hr)) - - -def GetFileAttributes(file, local=1): - if local: - return win32api.GetFileAttributes(file) - else: - return wincerapi.CeGetFileAttributes(file) - - -def FindFiles(spec, local=1): - if local: - return win32api.FindFiles(spec) - else: - return wincerapi.CeFindFiles(spec) - - -def isdir(name, local=1): - try: - attr = GetFileAttributes(name, local) - return attr & win32con.FILE_ATTRIBUTE_DIRECTORY - except win32api.error: - return 0 - - -def CopyFileToCe(src_name, dest_name, progress=None): - sh = win32file.CreateFile( - src_name, win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None - ) - bytes = 0 - try: - dh = wincerapi.CeCreateFile( - dest_name, win32con.GENERIC_WRITE, 0, None, win32con.OPEN_ALWAYS, 0, None - ) - try: - while 1: - hr, data = win32file.ReadFile(sh, 2048) - if not data: - break - wincerapi.CeWriteFile(dh, data) - bytes = bytes + len(data) - if progress is not None: - progress(bytes) - finally: - dh.Close() - finally: - sh.Close() - return bytes - - -def BuildFileList(spec, local, recurse, filter, filter_args, recursed_path=""): - files = [] - if isdir(spec, local): - path = spec - raw_spec = "*" - else: - path, raw_spec = os.path.split(spec) - if recurse: - # Need full scan, to get sub-direcetories. - infos = FindFiles(os.path.join(path, "*"), local) - else: - infos = FindFiles(os.path.join(path, raw_spec), local) - for info in infos: - src_name = str(info[8]) - full_src_name = os.path.join(path, src_name) - if local: # Can't do this for CE! - full_src_name = win32api.GetFullPathName(full_src_name) - if isdir(full_src_name, local): - if recurse and src_name not in [".", ".."]: - new_spec = os.path.join(full_src_name, raw_spec) - files = files + BuildFileList( - new_spec, - local, - 1, - filter, - filter_args, - os.path.join(recursed_path, src_name), - ) - if fnmatch.fnmatch(src_name, raw_spec): - rel_name = os.path.join(recursed_path, src_name) - filter_data = filter(full_src_name, rel_name, info, local, filter_args) - if filter_data is not None: - files.append((full_src_name, info, filter_data)) - return files - - -def _copyfilter(full_name, rel_name, info, local, bMaintainDir): - if isdir(full_name, local): - return - if bMaintainDir: - return rel_name - return os.path.split(rel_name)[1] - - -import pywin.dialogs.status -import win32ui - - -class FileCopyProgressDialog(pywin.dialogs.status.CStatusProgressDialog): - def CopyProgress(self, bytes): - self.Set(bytes / 1024) - - -def copy(args): - """copy src [src ...], dest - Copy files to/from the CE device - """ - bRecurse = bVerbose = 0 - bMaintainDir = 1 - try: - opts, args = getopt.getopt(args, "rv") - except getopt.error as details: - raise InvalidUsage(details) - for o, v in opts: - if o == "-r": - bRecuse = 1 - elif o == "-v": - bVerbose = 1 - - if len(args) < 2: - raise InvalidUsage("Must specify a source and destination") - - src = args[:-1] - dest = args[-1] - # See if WCE: leading anywhere indicates a direction. - if src[0].find("WCE:") == 0: - bToDevice = 0 - elif dest.find("WCE:") == 0: - bToDevice = 1 - else: - # Assume copy to device. - bToDevice = 1 - - if not isdir(dest, not bToDevice): - print("%s does not indicate a directory") - - files = [] # List of FQ (from_name, to_name) - num_files = 0 - num_bytes = 0 - dialog = FileCopyProgressDialog("Copying files") - dialog.CreateWindow(win32ui.GetMainFrame()) - if bToDevice: - for spec in src: - new = BuildFileList(spec, 1, bRecurse, _copyfilter, bMaintainDir) - if not new: - print("Warning: '%s' did not match any files" % (spec)) - files = files + new - - for full_src, src_info, dest_info in files: - dest_name = os.path.join(dest, dest_info) - size = src_info[5] - print("Size=", size) - if bVerbose: - print(full_src, "->", dest_name, "- ", end=" ") - dialog.SetText(dest_name) - dialog.Set(0, size / 1024) - bytes = CopyFileToCe(full_src, dest_name, dialog.CopyProgress) - num_bytes = num_bytes + bytes - if bVerbose: - print(bytes, "bytes") - num_files = num_files + 1 - dialog.Close() - print("%d files copied (%d bytes)" % (num_files, num_bytes)) - - -def _dirfilter(*args): - return args[1] - - -def dir(args): - """dir directory_name ... - Perform a directory listing on the remote device - """ - bRecurse = 0 - try: - opts, args = getopt.getopt(args, "r") - except getopt.error as details: - raise InvalidUsage(details) - for o, v in opts: - if o == "-r": - bRecurse = 1 - for arg in args: - print("Directory of WCE:%s" % arg) - files = BuildFileList(arg, 0, bRecurse, _dirfilter, None) - total_size = 0 - for full_name, info, rel_name in files: - date_str = info[3].Format("%d-%b-%Y %H:%M") - attr_string = " " - if info[0] & win32con.FILE_ATTRIBUTE_DIRECTORY: - attr_string = "" - print("%s %s %10d %s" % (date_str, attr_string, info[5], rel_name)) - total_size = total_size + info[5] - print(" " * 14 + "%3d files, %10d bytes" % (len(files), total_size)) - - -def run(args): - """run program [args] - Starts the specified program on the remote device. - """ - prog_args = [] - for arg in args: - if " " in arg: - prog_args.append('"' + arg + '"') - else: - prog_args.append(arg) - prog_args = " ".join(prog_args) - wincerapi.CeCreateProcess(prog_args, "", None, None, 0, 0, None, "", None) - - -def delete(args): - """delete file, ... - Delete one or more remote files - """ - for arg in args: - try: - wincerapi.CeDeleteFile(arg) - print("Deleted: %s" % arg) - except win32api.error as details: - print_error(details, "Error deleting '%s'" % arg) - - -def DumpCommands(): - print("%-10s - %s" % ("Command", "Description")) - print("%-10s - %s" % ("-------", "-----------")) - for name, item in list(globals().items()): - if isinstance(item, Callable): - doc = getattr(item, "__doc__", "") - if doc: - lines = doc.split("\n") - print("%-10s - %s" % (name, lines[0])) - for line in lines[1:]: - if line: - print(" " * 8, line) - - -def main(): - if len(sys.argv) < 2: - print("You must specify a command!") - DumpCommands() - return - command = sys.argv[1] - fn = globals().get(command) - if fn is None: - print("Unknown command:", command) - DumpCommands() - return - - wincerapi.CeRapiInit() - try: - verinfo = wincerapi.CeGetVersionEx() - print( - "Connected to device, CE version %d.%d %s" - % (verinfo[0], verinfo[1], verinfo[4]) - ) - try: - fn(sys.argv[2:]) - except InvalidUsage as msg: - print("Invalid syntax -", msg) - print(fn.__doc__) - - finally: - try: - wincerapi.CeRapiUninit() - except win32api.error as details: - print_error(details, "Error disconnecting") - - -if __name__ == "__main__": - main() diff --git a/win32/src/PyACL.cpp b/win32/src/PyACL.cpp index 68a3678ac7..bad2d785aa 100644 --- a/win32/src/PyACL.cpp +++ b/win32/src/PyACL.cpp @@ -6,8 +6,6 @@ #include "PyWinObjects.h" #include "PySecurityObjects.h" -#ifndef NO_PYWINTYPES_SECURITY - #include "accctrl.h" #include "aclapi.h" @@ -1235,4 +1233,3 @@ PyACL::~PyACL() { free(buf); } /*static*/ void PyACL::deallocFunc(PyObject *ob) { delete (PyACL *)ob; } -#endif /* NO_PYWINTYPES_SECURITY */ diff --git a/win32/src/PyIID.cpp b/win32/src/PyIID.cpp index 5f0042254d..2958429540 100644 --- a/win32/src/PyIID.cpp +++ b/win32/src/PyIID.cpp @@ -39,16 +39,12 @@ PyObject *PyWinMethod_NewIID(PyObject *self, PyObject *args) HRESULT hr = CLSIDFromString(bstrIID, &iid); if (FAILED(hr)) { -#ifndef MS_WINCE hr = CLSIDFromProgID(bstrIID, &iid); if (FAILED(hr)) { -#endif PyWinObject_FreeWCHAR(bstrIID); PyWin_SetBasicCOMError(hr); return NULL; -#ifndef MS_WINCE } -#endif } PyWinObject_FreeWCHAR(bstrIID); /* iid -> PyObject */ @@ -58,13 +54,9 @@ PyObject *PyWinMethod_NewIID(PyObject *self, PyObject *args) static HRESULT myCLSIDFromString(OLECHAR *str, CLSID *clsid) { HRESULT hr = CLSIDFromString(str, clsid); -#ifdef MS_WINCE - return hr; -#else if (SUCCEEDED(hr)) return hr; return CLSIDFromProgID(str, clsid); -#endif } BOOL PyWinObject_AsIID(PyObject *obCLSID, CLSID *clsid) diff --git a/win32/src/PySECURITY_ATTRIBUTES.cpp b/win32/src/PySECURITY_ATTRIBUTES.cpp index d5fdef4f5d..b1601ff393 100644 --- a/win32/src/PySECURITY_ATTRIBUTES.cpp +++ b/win32/src/PySECURITY_ATTRIBUTES.cpp @@ -6,28 +6,6 @@ #include "PySecurityObjects.h" #include "structmember.h" -#ifdef NO_PYWINTYPES_SECURITY - -BOOL PyWinObject_AsSECURITY_ATTRIBUTES(PyObject *ob, SECURITY_ATTRIBUTES **ppSECURITY_ATTRIBUTES, - BOOL bNoneOK /*= TRUE*/) -{ - if (bNoneOK && ob == Py_None) { - *ppSECURITY_ATTRIBUTES = NULL; - } - else { - if (bNoneOK) - PyErr_SetString(PyExc_TypeError, "This build of pywintypes only supports None as a SECURITY_ATTRIBUTE"); - else - PyErr_SetString( - PyExc_TypeError, - "This function can not work in this build, as only None may be used as a SECURITY_ATTRIBUTE"); - return FALSE; - } - return TRUE; -} - -#else - // @pymethod |pywintypes|SECURITY_ATTRIBUTES|Creates a new SECURITY_ATTRIBUTES object PyObject *PyWinMethod_NewSECURITY_ATTRIBUTES(PyObject *self, PyObject *args) { @@ -197,5 +175,3 @@ int PySECURITY_ATTRIBUTES::setattro(PyObject *self, PyObject *obname, PyObject * } /*static*/ void PySECURITY_ATTRIBUTES::deallocFunc(PyObject *ob) { delete (PySECURITY_ATTRIBUTES *)ob; } - -#endif /* MS_WINCE */ diff --git a/win32/src/PySECURITY_DESCRIPTOR.cpp b/win32/src/PySECURITY_DESCRIPTOR.cpp index 9c13e4d6bb..4ad9aa1d04 100644 --- a/win32/src/PySECURITY_DESCRIPTOR.cpp +++ b/win32/src/PySECURITY_DESCRIPTOR.cpp @@ -6,7 +6,6 @@ #include "PySecurityObjects.h" #include "structmember.h" -#ifndef NO_PYWINTYPES_SECURITY BOOL(WINAPI *setsecuritydescriptorcontrol) (PSECURITY_DESCRIPTOR, SECURITY_DESCRIPTOR_CONTROL, SECURITY_DESCRIPTOR_CONTROL) = NULL; @@ -791,37 +790,3 @@ PySECURITY_DESCRIPTOR::~PySECURITY_DESCRIPTOR(void) } /*static*/ void PySECURITY_DESCRIPTOR::deallocFunc(PyObject *ob) { delete (PySECURITY_DESCRIPTOR *)ob; } -#else /* NO_PYWINTYPES_SECURITY */ - -BOOL PyWinObject_AsSECURITY_DESCRIPTOR(PyObject *ob, PSECURITY_DESCRIPTOR *ppSECURITY_DESCRIPTOR, - BOOL bNoneOK /*= TRUE*/) -{ - if (bNoneOK && ob == Py_None) { - *ppSECURITY_DESCRIPTOR = NULL; - } - else { - if (bNoneOK) - PyErr_SetString(PyExc_TypeError, - "This build of pywintypes only supports None as " - "a SECURITY_DESCRIPTOR"); - else - PyErr_SetString(PyExc_TypeError, - "This function can not work in this build, as " - "only None may be used as a SECURITY_DESCRIPTOR"); - return FALSE; - } - return TRUE; -} -PyObject *PyWinObject_FromSECURITY_DESCRIPTOR(PSECURITY_DESCRIPTOR psd) -{ - if (psd == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - PyErr_SetString(PyExc_RuntimeError, - "A non-NULL SECURITY_DESCRIPTOR was passed, but security " - "descriptors are disabled from this build"); - return NULL; -} - -#endif /* NO_PYWINTYPES_SECURITY */ diff --git a/win32/src/PySID.cpp b/win32/src/PySID.cpp index 879a2822ab..fcb5215e22 100644 --- a/win32/src/PySID.cpp +++ b/win32/src/PySID.cpp @@ -6,8 +6,6 @@ #include "PyWinObjects.h" #include "PySecurityObjects.h" -#ifndef NO_PYWINTYPES_SECURITY - // @pymethod |pywintypes|SID|Creates a new SID object PyObject *PyWinMethod_NewSID(PyObject *self, PyObject *args) { @@ -388,36 +386,3 @@ BOOL GetTextualSid( free(buf); return ret; } -#else /* NO_PYWINTYPES_SECURITY */ - -BOOL PyWinObject_AsSID(PyObject *ob, PSID *ppSID, BOOL bNoneOK /*= TRUE*/) -{ - if (bNoneOK && ob == Py_None) { - *ppSID = NULL; - } - else { - if (bNoneOK) - PyErr_SetString(PyExc_TypeError, - "This build of pywintypes only supports None as " - "a SID"); - else - PyErr_SetString(PyExc_TypeError, - "This function can not work in this build, as " - "only None may be used as a SID"); - return FALSE; - } - return TRUE; -} -PyObject *PyWinObject_FromSID(PSID psid) -{ - if (psid == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - PyErr_SetString(PyExc_RuntimeError, - "A non-NULL SID was passed, but security " - "descriptors are disabled from this build"); - return NULL; -} - -#endif /* NO_PYWINTYPES_SECURITY */ diff --git a/win32/src/PySecurityObjects.h b/win32/src/PySecurityObjects.h index 2535f647ae..34d8ec2cc2 100644 --- a/win32/src/PySecurityObjects.h +++ b/win32/src/PySecurityObjects.h @@ -1,11 +1,6 @@ // Security objects // Much of the security support written by Roger Upole -#ifdef MS_WINCE -#define NO_PYWINTYPES_SECURITY /* This source is not included for WinCE */ -#endif - -#ifndef NO_PYWINTYPES_SECURITY typedef BOOL(WINAPI *addacefunc)(PACL, DWORD, DWORD, PSID); typedef BOOL(WINAPI *addaceexfunc)(PACL, DWORD, DWORD, DWORD, PSID); typedef BOOL(WINAPI *addobjectacefunc)(PACL, DWORD, DWORD, DWORD, GUID *, GUID *, PSID); @@ -173,4 +168,3 @@ class PYWINTYPES_EXPORT PyACL : public PyObject { void *buf; }; -#endif // NO_PYWINTYPES_SECURITY diff --git a/win32/src/PyWinTypesmodule.cpp b/win32/src/PyWinTypesmodule.cpp index c669501169..274d4d6095 100644 --- a/win32/src/PyWinTypesmodule.cpp +++ b/win32/src/PyWinTypesmodule.cpp @@ -357,8 +357,6 @@ static PyObject *PyWin_NewUnicodeFromRaw(PyObject *self, PyObject *args) return PyWinObject_FromWCHAR((WCHAR *)pybuf.ptr(), pybuf.len() / sizeof(OLECHAR)); } -#ifndef MS_WINCE /* This code is not available on Windows CE */ - // @pymethod int, int|pywintypes|IsTextUnicode|Determines whether a buffer probably contains a form of Unicode text. static PyObject *PyWin_IsTextUnicode(PyObject *self, PyObject *args) { @@ -404,7 +402,6 @@ static PyObject *PyWin_DosDateTimeToTime(PyObject *self, PyObject *args) return PyWin_SetAPIError("DosDateTimeToFileTime"); return PyWinObject_FromFILETIME(fd); } -#endif /* MS_WINCE */ PyObject *PyObject_FromWIN32_FIND_DATAW(WIN32_FIND_DATAW *pData) { @@ -755,10 +752,8 @@ PyObject *PyWinObject_FromMSG(const MSG *pMsg) /* List of functions exported by this module */ // @module pywintypes|A module which supports common Windows types. static struct PyMethodDef pywintypes_functions[] = { -#ifndef MS_WINCE {"DosDateTimeToTime", PyWin_DosDateTimeToTime, 1}, // @pymeth DosDateTimeToTime|Converts an MS-DOS Date/Time to a standard Time object -#endif {"UnicodeFromRaw", PyWin_NewUnicodeFromRaw, 1}, // @pymeth UnicodeFromRaw|Creates a new string object from raw binary data {"IsTextUnicode", PyWin_IsTextUnicode, @@ -770,14 +765,12 @@ static struct PyMethodDef pywintypes_functions[] = { {"Time", PyWinMethod_NewTime, 1}, // @pymeth Time|Makes a object from the argument. {"TimeStamp", PyWinMethod_NewTimeStamp, 1}, // @pymeth Time|Makes a object from the argument. {"CreateGuid", PyWin_CreateGuid, 1}, // @pymeth CreateGuid|Creates a new, unique GUIID. -#ifndef NO_PYWINTYPES_SECURITY {"ACL", PyWinMethod_NewACL, 1}, // @pymeth ACL|Creates a new object. {"SID", PyWinMethod_NewSID, 1}, // @pymeth SID|Creates a new object. {"SECURITY_ATTRIBUTES", PyWinMethod_NewSECURITY_ATTRIBUTES, 1}, // @pymeth SECURITY_ATTRIBUTES|Creates a new object. {"SECURITY_DESCRIPTOR", PyWinMethod_NewSECURITY_DESCRIPTOR, 1}, // @pymeth SECURITY_DESCRIPTOR|Creates a new object. -#endif // NO_PYWINTYPES_SECURITY {"HANDLE", PyWinMethod_NewHANDLE, 1}, // @pymeth HANDLE|Creates a new object. {"HKEY", PyWinMethod_NewHKEY, 1}, // @pymeth HKEY|Creates a new object. #ifdef TRACE_THREADSTATE @@ -890,10 +883,8 @@ int PyWinGlobals_Ensure() #ifndef NO_PYWINTYPES_IID || PyType_Ready(&PyIIDType) == -1 #endif // NO_PYWINTYPES_IID -#ifndef NO_PYWINTYPES_SECURITY || PyType_Ready(&PySECURITY_DESCRIPTORType) == -1 || PyType_Ready(&PySECURITY_ATTRIBUTESType) == -1 || PyType_Ready(&PySIDType) == -1 || PyType_Ready(&PyACLType) == -1 -#endif ) return -1; @@ -963,12 +954,10 @@ PYWIN_MODULE_INIT_FUNC(pywintypes) #ifndef NO_PYWINTYPES_IID ADD_TYPE(IIDType); #endif // NO_PYWINTYPES_IID -#ifndef NO_PYWINTYPES_SECURITY ADD_TYPE(SECURITY_DESCRIPTORType); ADD_TYPE(SECURITY_ATTRIBUTESType); ADD_TYPE(SIDType); ADD_TYPE(ACLType); -#endif ADD_TYPE(HANDLEType); ADD_TYPE(OVERLAPPEDType); ADD_TYPE(DEVMODEWType); @@ -980,12 +969,9 @@ PYWIN_MODULE_INIT_FUNC(pywintypes) PYWIN_MODULE_INIT_RETURN_SUCCESS; } -#ifndef MS_WINCE extern "C" __declspec(dllexport) -#endif BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) { -#ifndef NO_PYWINTYPES_SECURITY FARPROC fp; // dll usually will already be loaded HMODULE hmodule = GetModuleHandle(_T("AdvAPI32.dll")); @@ -1025,7 +1011,6 @@ extern "C" __declspec(dllexport) (BOOL(WINAPI *)(PSECURITY_DESCRIPTOR, SECURITY_DESCRIPTOR_CONTROL, SECURITY_DESCRIPTOR_CONTROL))(fp); } -#endif // NO_PYWINTYPES_SECURITY switch (dwReason) { case DLL_PROCESS_ATTACH: { /* diff --git a/win32/src/win32api_display.cpp b/win32/src/win32api_display.cpp index 00cc798b38..16194f88c3 100644 --- a/win32/src/win32api_display.cpp +++ b/win32/src/win32api_display.cpp @@ -4,10 +4,6 @@ #include "PyWinObjects.h" #include "win32api_display.h" -#ifdef MS_WINCE -#define DM_SPECVERSION 0 -#endif - // from user32.dll, loaded in win32api's init function ChangeDisplaySettingsExfunc pfnChangeDisplaySettingsEx = NULL; EnumDisplayDevicesfunc pfnEnumDisplayDevices = NULL; diff --git a/win32/src/win32dynamicdialog.cpp b/win32/src/win32dynamicdialog.cpp index 8f29c0ee5a..c5b815c259 100644 --- a/win32/src/win32dynamicdialog.cpp +++ b/win32/src/win32dynamicdialog.cpp @@ -37,9 +37,6 @@ #include "commctrl.h" #include "windowsx.h" // For edit control hacks. -#ifdef MS_WINCE -#include "winbase.h" -#endif #include "pywintypes.h" #include "pywinobjects.h" #include "tchar.h" diff --git a/win32/src/win32event.i b/win32/src/win32event.i index 62a50cd711..1222b17577 100644 --- a/win32/src/win32event.i +++ b/win32/src/win32event.i @@ -62,9 +62,7 @@ #define QS_ALLINPUT QS_ALLINPUT // Any message is in the queue. -#ifndef MS_WINCE #define QS_HOTKEY QS_HOTKEY // A WM_HOTKEY message is in the queue. -#endif #define QS_INPUT QS_INPUT // An input message is in the queue. @@ -90,10 +88,8 @@ #define SYNCHRONIZE SYNCHRONIZE // Windows NT only:�Enables use of the event handle in any of the wait functions�to wait for the event�s state to be signaled. -#ifndef MS_WINCE // @pyswig |CancelWaitableTimer|Cancels a waiting timer. BOOLAPI CancelWaitableTimer(PyHANDLE handle); -#endif #end @@ -114,7 +110,6 @@ PyHANDLE CreateMutex( TCHAR * INPUT_NULLOK // @pyparm |Name||Mutex-object name, or None ); -#ifndef MS_WINCE // @pyswig |CreateSemaphore|Creates a semaphore, or opens an existing one // @rdesc The result is a handle to the object // @pyseeapi CreateSemaphore @@ -143,7 +138,6 @@ PyHANDLE CreateWaitableTimerEx( DWORD dwFlags, // @pyparm int|Flags||Flags DWORD dwDesiredAccess // @pyparm int|DesiredAccess||The access mask for the timer object ); -#endif // MS_WINCE %{ @@ -216,8 +210,6 @@ static PyObject * MyMsgWaitForMultipleObjects( } %} -#ifndef MS_WINCE - // @pyswig int|MsgWaitForMultipleObjectsEx|Returns when a message arrives of an event is signalled %name(MsgWaitForMultipleObjectsEx) PyObject *MyMsgWaitForMultipleObjectsEx( PyObject *obHandleList, // @pyparm [, ...]|handleList||A sequence of handles to wait on. @@ -283,7 +275,6 @@ PyHANDLE OpenWaitableTimer( TCHAR *lpTimerName // @pyparm str|timerName||pointer to timer object name ); -#endif /* MS_WINCE */ // @pyswig |PulseEvent|Provides a single operation that sets (to signaled) the state of the specified event object and then resets it (to nonsignaled) after releasing the appropriate number of waiting threads. BOOLAPI PulseEvent( @@ -295,7 +286,6 @@ BOOLAPI ReleaseMutex( PyHANDLE hMutex // @pyparm |hEvent||handle of mutex object ); -#ifndef MS_WINCE // @pyswig int|ReleaseSemaphore|Releases a semaphore. BOOLAPI ReleaseSemaphore( PyHANDLE hSemaphore, // @pyparm |hEvent||handle of the semaphore object @@ -303,7 +293,6 @@ BOOLAPI ReleaseSemaphore( long *OUTPUT // address of previous count // @rdesc The result is the previous count of the semaphore. ); -#endif // MS_WINCE // @pyswig |ResetEvent|Resets an event BOOLAPI ResetEvent( @@ -315,7 +304,6 @@ BOOLAPI SetEvent( PyHANDLE hEvent // @pyparm |hEvent||handle of event object ); -#ifndef MS_WINCE // @pyswig |SetWaitableTimer|Sets a waitable timer. BOOLAPI SetWaitableTimer( PyHANDLE hTimer, // @pyparm |handle||handle to timer @@ -331,7 +319,6 @@ BOOLAPI SignalObjectAndWait( DWORD dwMilliseconds, // time-out interval in milliseconds BOOL bAlertable // alertable flag ); -#endif %{ static PyObject *MyWaitForMultipleObjects( @@ -365,7 +352,6 @@ static PyObject *MyWaitForMultipleObjects( DWORD dwMilliseconds // @pyparm int|milliseconds||time-out interval in milliseconds ); -#ifndef MS_WINCE %{ static PyObject *MyWaitForMultipleObjectsEx( PyObject *handleList, @@ -398,7 +384,6 @@ static PyObject *MyWaitForMultipleObjectsEx( DWORD dwMilliseconds, // @pyparm int|milliseconds||time-out interval in milliseconds BOOL bAlertable // @pyparm bool|bAlertable||alertable wait flag. ); -#endif %typedef DWORD DWORD_WAITAPI %typemap(python,except) DWORD_WAITAPI { Py_BEGIN_ALLOW_THREADS @@ -421,8 +406,6 @@ DWORD_WAITAPI WaitForSingleObject( // @flag WAIT_OBJECT_0|The state of the specified object is signaled. // @flag WAIT_TIMEOUT|The time-out interval elapsed, and the object's state is nonsignaled. - -#ifndef MS_WINCE // @pyswig int|WaitForSingleObjectEx|Returns when an event is signalled DWORD_WAITAPI WaitForSingleObjectEx( PyHANDLE hHandle, // @pyparm |hHandle||handle of object to wait for @@ -430,7 +413,6 @@ DWORD_WAITAPI WaitForSingleObjectEx( BOOL bAlertable // @pyparm bool|bAlertable||alertable wait flag. ); // @rdesc See for return values. -#endif /* MS_WINCE */ // @pyswig int|WaitForInputIdle|Waits until the given process is waiting for user input with no input pending, or until the time-out interval has elapsed DWORD_WAITAPI WaitForInputIdle( diff --git a/win32/src/win32file.i b/win32/src/win32file.i index e2b9d0823f..364cf7b02c 100644 --- a/win32/src/win32file.i +++ b/win32/src/win32file.i @@ -22,7 +22,6 @@ // RemoveDirectory / RemoveDirectoryTransacted %{ -#ifndef MS_WINCE //#define FAR #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0600 @@ -64,7 +63,6 @@ #define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0])) #endif #include "Wspiapi.h" // for WspiapiGetAddrInfo/WspiapiFreeAddrInfo -#endif #define NEED_PYWINOBJECTS_H #include "win32file_comm.h" @@ -90,10 +88,8 @@ #define GENERIC_EXECUTE GENERIC_EXECUTE // Specifies execute access. -#ifndef MS_WINCE #define FILE_SHARE_DELETE FILE_SHARE_DELETE // Windows NT only: Subsequent open operations on the object will succeed only if delete access is requested. -#endif #define FILE_SHARE_READ FILE_SHARE_READ // Subsequent open operations on the object will succeed only if read access is requested. #define FILE_SHARE_WRITE FILE_SHARE_WRITE @@ -120,10 +116,8 @@ // The file is hidden. It is not to be included in an ordinary directory listing. #define FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_NORMAL // The file has no other attributes set. This attribute is valid only if used alone. -#ifndef MS_WINCE #define FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_OFFLINE // The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage. -#endif // MS_WINCE #define FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_READONLY // The file is read only. Applications can read the file but cannot write to it or delete it. #define FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_SYSTEM @@ -174,7 +168,6 @@ #define FILE_FLAG_OPEN_REPARSE_POINT FILE_FLAG_OPEN_REPARSE_POINT // used to open a handle for use with DeviceIoControl and FSCTL_GET_REPARSE_POINT/FSCTL_SET_REPARSE_POINT) -#ifndef MS_WINCE #define SECURITY_ANONYMOUS SECURITY_ANONYMOUS // Specifies to impersonate the client at the Anonymous impersonation level. #define SECURITY_IDENTIFICATION SECURITY_IDENTIFICATION @@ -187,15 +180,10 @@ // Specifies that the security tracking mode is dynamic. If this flag is not specified, Security Tracking Mode is static. #define SECURITY_EFFECTIVE_ONLY SECURITY_EFFECTIVE_ONLY // Specifies that only the enabled aspects -#endif // MS_WINCE - -#ifndef MS_WINCE /* Not on CE */ // @pyswig int|AreFileApisANSI|Determines whether a set of Win32 file functions is using the ANSI or OEM character set code page. This function is useful for 8-bit console input and output operations. BOOL AreFileApisANSI(void); -#endif // MS_WINCE - // @pyswig |CancelIo|Cancels pending IO requests for the object. // @pyparm |handle||The handle being cancelled. BOOLAPI CancelIo(PyHANDLE handle); @@ -222,15 +210,12 @@ BOOLAPI CreateDirectoryW( WCHAR *name, // @pyparm string|name||The name of the directory to create SECURITY_ATTRIBUTES *pSA); // @pyparm |sa||The security attributes, or None -#ifndef MS_WINCE // @pyswig |CreateDirectoryEx|Creates a directory BOOLAPI CreateDirectoryEx( TCHAR *templateName, // @pyparm string|templateName||Specifies the path of the directory to use as a template when creating the new directory. TCHAR *newDirectory, // @pyparm string|newDirectory||Specifies the name of the new directory SECURITY_ATTRIBUTES *pSA); // @pyparm |sa||The security attributes, or None -#endif // MS_WINCE - // @pyswig |CreateFile|Creates or opens the a file or other object and returns a handle that can be used to access the object. // @comm The following objects can be opened:filespipesmailslotscommunications resourcesdisk devices (Windows NT only)consolesdirectories (open only) PyHANDLE CreateFile( @@ -260,7 +245,6 @@ PyHANDLE CreateFile( PyHANDLE INPUT_NULLOK // @pyparm |hTemplateFile||Specifies a handle with GENERIC_READ access to a template file. The template file supplies file attributes and extended attributes for the file being created. Under Win95, this must be 0, else an exception will be raised. ); -#ifndef MS_WINCE // CreateIoCompletionPort gets special treatment due to its special result // code handling. @@ -348,7 +332,6 @@ BOOLAPI DefineDosDeviceW( WCHAR *lpDeviceName, // @pyparm string|deviceName||MS-DOS device name string WCHAR *lpTargetPath // @pyparm string|targetPath||MS-DOS or path string for 32-bit Windows. ); -#endif // MS_WINCE // @pyswig |DeleteFile|Deletes a file. BOOLAPI DeleteFile(TCHAR *fileName); @@ -501,7 +484,6 @@ PyCFunction pfnpy_DeviceIoControl=(PyCFunction)py_DeviceIoControl; // @pyswig |FindClose|Closes a find handle. BOOLAPI FindClose(HANDLE hFindFile); // @pyparm int|hFindFile||file search handle -#ifndef MS_WINCE // @pyswig |FindCloseChangeNotification|Closes a handle. BOOLAPI FindCloseChangeNotification( HANDLE hChangeHandle // @pyparm int|hChangeHandle||handle to change notification to close @@ -519,8 +501,6 @@ BOOLAPI FindNextChangeNotification( HANDLE hChangeHandle // @pyparm int|hChangeHandle||handle to change notification to signal ); -#endif // MS_WINCE - %{ @@ -612,7 +592,6 @@ BOOLAPI FlushFileBuffers( PyHANDLE hFile // @pyparm |hFile||open handle to file whose buffers are to be flushed ); -#ifndef MS_WINCE // @pyswig int|GetBinaryType|Determines whether a file is executable, and if so, what type of executable file it is. That last property determines which subsystem an executable file runs under. BOOLAPI GetBinaryType( TCHAR *lpApplicationName, // @pyparm string|appName||Fully qualified path of file to test @@ -624,11 +603,9 @@ BOOLAPI GetBinaryType( #define SCS_PIF_BINARY SCS_PIF_BINARY // A PIF file that executes an MS-DOS - based application #define SCS_POSIX_BINARY SCS_POSIX_BINARY // A POSIX - based application #define SCS_WOW_BINARY SCS_WOW_BINARY // A 16-bit Windows-based application -#endif // MS_WINCE //GetCurrentDirectory -#ifndef MS_WINCE // @pyswig (int, int, int, int)|GetDiskFreeSpace|Determines the free space on a device. BOOLAPI GetDiskFreeSpace( TCHAR *lpRootPathName, // @pyparm string|rootPathName||address of root path @@ -672,9 +649,6 @@ long GetDriveTypeW( #define DRIVE_CDROM DRIVE_CDROM // The drive is a CD-ROM drive. #define DRIVE_RAMDISK DRIVE_RAMDISK // The drive is a RAM disk. -#endif // MS_WINCE - - // @pyswig int|GetFileAttributes|Determines a files attributes. DWORD GetFileAttributes( TCHAR *fileName); // @pyparm string|fileName||Name of the file to retrieve attributes for. @@ -802,7 +776,6 @@ static PyObject *PyGetFileInformationByHandle(PyObject *self, PyObject *args) %} %native(GetFileInformationByHandle) PyGetFileInformationByHandle; -#ifndef MS_WINCE %{ PyObject *MyGetCompressedFileSize(PyObject *self, PyObject *args) { @@ -828,7 +801,6 @@ PyObject *MyGetCompressedFileSize(PyObject *self, PyObject *args) // @pyswig long|GetCompressedFileSize|Determines the compressed size of a file. %native(GetCompressedFileSize) MyGetCompressedFileSize; -#endif %{ PyObject *MyGetFileSize(PyObject *self, PyObject *args) { @@ -858,7 +830,6 @@ PyObject *MyGetFileSize(PyObject *self, PyObject *args) // holding a read buffer. This has been replaced with the standard Python buffer object. // Python does not provide a method for creating a read-write buffer // of arbitary size, so currently this can only be created by . -#ifndef MS_WINCE %{ // @pyswig |AllocateReadBuffer|Allocates a buffer which can be used with an overlapped Read operation using PyObject *MyAllocateReadBuffer(PyObject *self, PyObject *args) @@ -872,7 +843,6 @@ PyObject *MyAllocateReadBuffer(PyObject *self, PyObject *args) %} %native(AllocateReadBuffer) MyAllocateReadBuffer; -#endif %{ // @pyswig (int, string)|ReadFile|Reads a string from a file @@ -907,13 +877,8 @@ PyObject *MyReadFile(PyObject *self, PyObject *args) // @comm in a multi-threaded overlapped environment, it is likely to be necessary to pre-allocate the read buffer using the method, otherwise the I/O operation may complete before you can assign to the resulting buffer. if (obOverlapped!=Py_None){ -#ifdef MS_WINCE - PyErr_SetString(PyExc_NotImplementedError,"Overlapped operation is not supported on this platform"); - return NULL; -#else if (!PyWinObject_AsOVERLAPPED(obOverlapped, &pOverlapped)) return NULL; -#endif } void *buf = NULL; @@ -921,7 +886,7 @@ PyObject *MyReadFile(PyObject *self, PyObject *args) bufSize = PyLong_AsLong(obBuf); if ((bufSize!=(DWORD)-1) || !PyErr_Occurred()){ - if (pOverlapped){ // guaranteed to be NULL on CE + if (pOverlapped){ obRet = PyBuffer_New(bufSize); if (obRet==NULL) return NULL; @@ -1041,7 +1006,6 @@ static PyObject *MyCloseHandle(PyObject *self, PyObject *args) return Py_None; } -#ifndef MS_WINCE // @pyswig |LockFileEx|Locks a file. Wrapper for LockFileEx win32 API. static PyObject * MyLockFileEx(PyObject *self, PyObject *args) @@ -1125,10 +1089,8 @@ MyUnlockFileEx(PyObject *self, PyObject *args) return Py_None; } -#endif // MS_WINCE %} -#ifndef MS_WINCE %{ // See Q192800 for an interesting discussion on overlapped and IOCP. @@ -1252,13 +1214,11 @@ PyObject *myPostQueuedCompletionStatus(PyObject *self, PyObject *args) %native (GetQueuedCompletionStatus) myGetQueuedCompletionStatus; %native (PostQueuedCompletionStatus) myPostQueuedCompletionStatus; -#endif // MS_WINCE %native(ReadFile) MyReadFile; %native(WriteFile) MyWriteFile; %native(CloseHandle) MyCloseHandle; -#ifndef MS_WINCE // @pyswig int|GetFileType|Determines the type of a file. unsigned long GetFileType( // DWORD PyHANDLE hFile // @pyparm |hFile||The handle to the file. @@ -1272,7 +1232,6 @@ unsigned long GetFileType( // DWORD unsigned long GetLogicalDrives( // DWORD ); -#endif // MS_WINCE /** GetLogicalDriveStrings GetShortPathName @@ -1281,7 +1240,6 @@ GetTempPath GetVolumeInformation */ -#ifndef MS_WINCE // @pyswig int|GetOverlappedResult|Determines the result of the most recent call with an OVERLAPPED object. // @comm The result is the number of bytes transferred. The overlapped object's attributes will be changed during this call. BOOLAPI GetOverlappedResult( @@ -1291,9 +1249,6 @@ BOOLAPI GetOverlappedResult( BOOL bWait // @pyparm int|bWait||Indicates if the function should wait for data to become available. ); -#endif // MS_WINCE - -#ifndef MS_WINCE // @pyswig |LockFile|Locks a specified file for exclusive access by the calling process. BOOLAPI LockFile( PyHANDLE hFile, // @pyparm |hFile||handle of file to lock @@ -1305,9 +1260,6 @@ BOOLAPI LockFile( %native(LockFileEx) MyLockFileEx; -#endif // MS_WINCE - - // @pyswig |MoveFile|Renames an existing file or a directory (including all its children). BOOLAPI MoveFile( TCHAR *lpExistingFileName, // @pyparm string|existingFileName||Name of the existing file @@ -1319,7 +1271,6 @@ BOOLAPI MoveFileW( WCHAR *lpNewFileName // @pyparm string|newFileName||New name for the file ); -#ifndef MS_WINCE // @pyswig |MoveFileEx|Renames an existing file or a directory (including all its children). BOOLAPI MoveFileEx( TCHAR *lpExistingFileName, // @pyparm string|existingFileName||Name of the existing file @@ -1339,8 +1290,6 @@ BOOLAPI MoveFileExW( #define MOVEFILE_CREATE_HARDLINK MOVEFILE_CREATE_HARDLINK #define MOVEFILE_FAIL_IF_NOT_TRACKABLE MOVEFILE_FAIL_IF_NOT_TRACKABLE -#endif // MS_WINCE - // @pyswig string|QueryDosDevice|Returns the mapping for a device name, or all device names %native (QueryDosDevice) MyQueryDosDevice; %{ @@ -1544,25 +1493,21 @@ PyObject *PyFILE_NOTIFY_INFORMATION(PyObject *self, PyObject *args) // ReadFileEx // SearchPath -#ifndef MS_WINCE // @pyswig |SetCurrentDirectory|Sets the current directory. %name(SetCurrentDirectory) BOOLAPI SetCurrentDirectoryW( WCHAR *lpPathName // @pyparm str/string|lpPathName||Name of the path to set current. ); -#endif // MS_WINCE // @pyswig |SetEndOfFile|Moves the end-of-file (EOF) position for the specified file to the current position of the file pointer. BOOL SetEndOfFile( PyHANDLE hFile // @pyparm |hFile||handle of file whose EOF is to be set ); -#ifndef MS_WINCE // @pyswig |SetFileApisToANSI|Causes a set of Win32 file functions to use the ANSI character set code page. This function is useful for 8-bit console input and output operations. void SetFileApisToANSI(void); // @pyswig |SetFileApisToOEM|Causes a set of Win32 file functions to use the OEM character set code page. This function is useful for 8-bit console input and output operations. void SetFileApisToOEM(void); -#endif // @pyswig |SetFileAttributes|Changes a file's attributes. BOOLAPI SetFileAttributes( @@ -1611,7 +1556,6 @@ PyObject *MySetFilePointer(PyObject *self, PyObject *args) #define FILE_END FILE_END #define FILE_CURRENT FILE_CURRENT -#ifndef MS_WINCE // @pyswig |SetVolumeLabel|Sets a volume label for a disk drive. BOOLAPI SetVolumeLabel( TCHAR *lpRootPathName, // @pyparm string|rootPathName||address of name of root directory for volume @@ -1628,10 +1572,8 @@ BOOLAPI UnlockFile( ); %native(UnlockFileEx) MyUnlockFileEx; -#endif // MS_WINCE // File Handle / File Descriptor APIs. -#ifndef MS_WINCE // @pyswig long|_get_osfhandle|Gets operating-system file handle associated with existing stream // @pyparm int|fd||File descriptor as returned by file.fileno() %name(_get_osfhandle) @@ -2598,7 +2540,6 @@ Error: #define FD_ROUTING_INTERFACE_CHANGE FD_ROUTING_INTERFACE_CHANGE #define FD_ADDRESS_LIST_CHANGE FD_ADDRESS_LIST_CHANGE -#endif // MS_WINCE %native (DCB) PyWinMethod_NewDCB; diff --git a/win32/src/win32gui.i b/win32/src/win32gui.i index 0bb66da960..7151c4f584 100644 --- a/win32/src/win32gui.i +++ b/win32/src/win32gui.i @@ -32,11 +32,6 @@ #include "Dbt.h" // device notification #include "malloc.h" -#ifdef MS_WINCE -#include "winbase.h" -#define IS_INTRESOURCE(res) (((DWORD)(res) & 0xffff0000) == 0) -#endif - #define CHECK_PFN(fname)if (pfn##fname==NULL) return PyErr_Format(PyExc_NotImplementedError,"%s is not available on this platform", #fname); typedef BOOL (WINAPI *SetLayeredWindowAttributesfunc)(HWND, COLORREF, BYTE,DWORD); static SetLayeredWindowAttributesfunc pfnSetLayeredWindowAttributes=NULL; @@ -330,14 +325,8 @@ if (hmodule){ %} %{ -#ifdef MS_WINCE -typedef HANDLE HINST_ARG; -// WinCE gives a compile error this with dllexport -#define DECLSPEC_DLLMAIN -#else typedef HINSTANCE HINST_ARG; #define DECLSPEC_DLLMAIN __declspec(dllexport) -#endif extern "C" DECLSPEC_DLLMAIN BOOL WINAPI DllMain(HINST_ARG hInstance, DWORD dwReason, LPVOID lpReserved) { @@ -772,11 +761,7 @@ LRESULT CALLBACK PyWndProcHWND(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara rc = CallWindowProc(oldWndProc, hWnd, uMsg, wParam, lParam); } -#ifdef WM_NCDESTROY if (uMsg==WM_NCDESTROY) { -#else // CE doesnt have this message! - if (uMsg==WM_DESTROY) { -#endif _celp.acquire(); // in case we released above - safe if already acquired. PyObject *key = PyWinLong_FromHANDLE(hWnd); if (PyDict_DelItem(g_HWNDMap, key) != 0) @@ -825,11 +810,7 @@ INT_PTR CALLBACK PyDlgProcHDLG(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara rc = (BOOL)lrc; } -#ifdef WM_NCDESTROY if (uMsg==WM_NCDESTROY) { -#else // CE doesnt have this message! - if (uMsg==WM_DESTROY) { -#endif PyObject *key = PyWinLong_FromHANDLE(hWnd); if (g_DLGMap != NULL) @@ -1792,7 +1773,6 @@ static PyObject *PyGetBufferAddressAndLen(PyObject *self, PyObject *args) PyWinObject_FreeResourceId($source); } -#ifndef MS_WINCE // @pyswig int|FlashWindow|The FlashWindow function flashes the specified window one time. It does not change the active state of the window. // @pyparm |hwnd||Handle to a window // @pyparm int|bInvert||Indicates if window should toggle between active and inactive @@ -1831,8 +1811,6 @@ PyObject *PyFlashWindowEx(PyObject *self, PyObject *args) } %} %native(FlashWindowEx) PyFlashWindowEx; -#endif // MS_WINCE - // @pyswig int|GetWindowLong| // @pyparm int|hwnd|| @@ -2021,10 +1999,8 @@ BOOLAPI PostMessage(HWND hwnd, UINT msg, WPARAM wParam = 0, LPARAM lParam = 0); // @pyparm int|lparam||An integer whose value depends on the message BOOLAPI PostThreadMessage(DWORD dwThreadId, UINT msg, WPARAM wParam, LPARAM lParam); -#ifndef MS_WINCE // @pyswig int|ReplyMessage|Used to reply to a message sent through the SendMessage function without returning control to the function that called SendMessage. BOOLAPI ReplyMessage(int lResult); // @pyparm int|result||Specifies the result of the message processing. The possible values are based on the message sent. -#endif /* not MS_WINCE */ // @pyswig int|RegisterWindowMessage|Defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages. // @pyparm unicode|name||The string @@ -2095,7 +2071,6 @@ static PyObject *PyEnumWindows(PyObject *self, PyObject *args) return Py_None; } -#ifndef MS_WINCE // @pyswig |EnumThreadWindows|Enumerates all top-level windows associated with a thread on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumThreadWindows continues until the last top-level window associated with the thread is enumerated or the callback function returns FALSE static PyObject *PyEnumThreadWindows(PyObject *self, PyObject *args) { @@ -2151,14 +2126,10 @@ static PyObject *PyEnumChildWindows(PyObject *self, PyObject *args) return Py_None; } -#endif /* not MS_WINCE */ %} %native (EnumWindows) PyEnumWindows; -#ifndef MS_WINCE %native (EnumThreadWindows) PyEnumThreadWindows; %native (EnumChildWindows) PyEnumChildWindows; -#endif /* not MS_WINCE */ - // @pyswig int|DialogBox|Creates a modal dialog box. %{ @@ -2487,7 +2458,6 @@ HCURSOR SetCursor( // @pyswig HCURSOR|GetCursor| HCURSOR GetCursor(); -#ifndef MS_WINCE %{ // @pyswig flags, hcursor, (x,y)|GetCursorInfo|Retrieves information about the global cursor. PyObject *PyGetCursorInfo(PyObject *self, PyObject *args) @@ -2502,7 +2472,6 @@ PyObject *PyGetCursorInfo(PyObject *self, PyObject *args) } %} %native(GetCursorInfo) PyGetCursorInfo; -#endif // @pyswig HACCEL|CreateAcceleratorTable|Creates an accelerator table %{ @@ -2561,12 +2530,10 @@ HMENU LoadMenu(HINSTANCE hInst, RESOURCE_ID name); // @pyswig |DestroyMenu|Destroys a previously loaded menu. BOOLAPI DestroyMenu( HMENU hmenu ); -#ifndef MS_WINCE // @pyswig |SetMenu|Sets the menu for the specified window. // @pyparm int|hwnd|| // @pyparm int|hmenu|| BOOLAPI SetMenu( HWND hwnd, HMENU hmenu ); -#endif // @pyswig |GetMenu|Gets the menu for the specified window. HMENU GetMenu( HWND hwnd); @@ -2576,11 +2543,9 @@ HMENU GetMenu( HWND hwnd); // @pyparm int/string|resource_id|| HICON LoadIcon(HINSTANCE hInst, RESOURCE_ID name); -#ifndef MS_WINCE // @pyswig HICON|CopyIcon|Copies an icon // @pyparm int|hicon||Existing icon HICON CopyIcon(HICON hicon); -#endif // @pyswig |DrawIcon|Draws an icon or cursor into the specified device context. // To specify additional drawing options, use the function. @@ -2647,7 +2612,6 @@ HANDLE LoadImage(HINSTANCE hInst, // @pyparm int|hinst||Handle to an instance of #define IMAGE_ICON IMAGE_ICON #define LR_DEFAULTCOLOR LR_DEFAULTCOLOR -#ifndef MS_WINCE #define LR_CREATEDIBSECTION LR_CREATEDIBSECTION #define LR_DEFAULTSIZE LR_DEFAULTSIZE #define LR_LOADFROMFILE LR_LOADFROMFILE @@ -2656,7 +2620,6 @@ HANDLE LoadImage(HINSTANCE hInst, // @pyparm int|hinst||Handle to an instance of #define LR_MONOCHROME LR_MONOCHROME #define LR_SHARED LR_SHARED #define LR_VGACOLOR LR_VGACOLOR -#endif /* not MS_WINCE */ %{ // @pyswig |DeleteObject|Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. @@ -2729,7 +2692,6 @@ BOOLAPI PatBlt( int Height, // @pyparm int|Height||Height of rectangular area DWORD Rop); // @pyparm int|Rop||Raster operation, one of PATCOPY,PATINVERT,DSTINVERT,BLACKNESS,WHITENESS -#ifndef MS_WINCE // @pyswig int|SetStretchBltMode|Sets the stretching mode used by // @rdesc If the function succeeds, the return value is the previous stretching mode. // If the function fails, the return value is zero. @@ -2740,7 +2702,6 @@ int SetStretchBltMode( // @pyswig int|GetStretchBltMode|Returns the stretching mode used by // @rdesc Returns one of BLACKONWHITE,COLORONCOLOR,HALFTONE,STRETCH_ANDSCANS,STRETCH_DELETESCANS,STRETCH_HALFTONE,STRETCH_ORSCANS,WHITEONBLACK, or 0 on error. int GetStretchBltMode(HDC hdc); // @pyparm |hdc||Handle to a device context -#endif /* not MS_WINCE */ %{ // @pyswig |TransparentBlt|Transfers color from one DC to another, with one color treated as transparent @@ -2878,13 +2839,11 @@ HIMAGELIST ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow) #define ILC_COLOR ILC_COLOR -#ifndef MS_WINCE #define ILC_COLOR4 ILC_COLOR4 #define ILC_COLOR8 ILC_COLOR8 #define ILC_COLOR16 ILC_COLOR16 #define ILC_COLOR24 ILC_COLOR24 #define ILC_COLOR32 ILC_COLOR32 -#endif /* not MS_WINCE */ #define ILC_COLORDDB ILC_COLORDDB #define ILC_MASK ILC_MASK @@ -2983,7 +2942,6 @@ HWND FindWindow( RESOURCE_ID_NULLOK className, // @pyparm |ClassName||Name or atom of window class to find, can be None TCHAR *INPUT_NULLOK); // @pyparm string|WindowName||Title of window to find, can be None -#ifndef MS_WINCE // @pyswig |FindWindowEx|Retrieves a handle to the top-level window whose class name and window name match the specified strings. HWND FindWindowEx( HWND parent, // @pyparm |Parent||Window whose child windows will be searched. If 0, desktop window is assumed. @@ -3007,7 +2965,6 @@ BOOL DragDetect(HWND hWnd, POINT INPUT); // @pyswig |SetDoubleClickTime| // @pyparm int|newVal|| BOOLAPI SetDoubleClickTime(UINT val); -#endif /* not MS_WINCE */ // @pyswig int|GetDoubleClickTime| UINT GetDoubleClickTime(); @@ -3203,10 +3160,8 @@ HGDIOBJ GetStockObject(int object); // @pyparm int|Object||One of *_BRUSH, *_PEN // @pyparm int|rc|| void PostQuitMessage(int rc); -#ifndef MS_WINCE // @pyswig |WaitMessage|Waits for a message BOOLAPI WaitMessage(); -#endif /* MS_WINCE */ // @pyswig |SetWindowPos|Sets the position and size of a window BOOLAPI SetWindowPos( @@ -3481,29 +3436,6 @@ PyLOWORD(PyObject *self, PyObject *args) // Should go in win32sh? %{ -#ifdef MS_WINCE -BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid) -{ - PyObject *obTip=NULL; - PyObject *obhwnd, *obhicon=Py_None; - memset(pnid, 0, sizeof(*pnid)); - pnid->cbSize = sizeof(*pnid); - if (!PyArg_ParseTuple(ob, "O|iiiOO:NOTIFYICONDATA tuple", &obhwnd, &pnid->uID, &pnid->uFlags, &pnid->uCallbackMessage, &obhicon, &obTip)) - return FALSE; - if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&pnid->hWnd)) - return NULL; - if (!PyWinObject_AsHANDLE(obhicon, (HANDLE *)&pnid->hIcon)) - return NULL; - if (obTip) { - TCHAR *szTip; - if (!PyWinObject_AsTCHAR(obTip, &szTip)) - return NULL; - _tcsncpy(pnid->szTip, szTip, sizeof(pnid->szTip)/sizeof(TCHAR)); - PyWinObject_FreeTCHAR(szTip); - } - return TRUE; -} -#else // MS_WINCE BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid) { PyObject *obTip=NULL, *obInfo=NULL, *obInfoTitle=NULL; @@ -3551,13 +3483,11 @@ BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid) } return TRUE; } -#endif // MS_WINCE %} #define NIF_ICON NIF_ICON #define NIF_MESSAGE NIF_MESSAGE #define NIF_TIP NIF_TIP -#ifndef MS_WINCE #define NIF_INFO NIF_INFO #define NIF_STATE NIF_STATE // #define NIF_GUID NIF_GUID @@ -3568,7 +3498,6 @@ BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid) // #define NIIF_USER NIIF_USER #define NIIF_ICON_MASK NIIF_ICON_MASK #define NIIF_NOSOUND NIIF_NOSOUND -#endif #define NIM_ADD NIM_ADD // Adds an icon to the status area. #define NIM_DELETE NIM_DELETE // Deletes an icon from the status area. @@ -3592,43 +3521,6 @@ BOOLAPI Shell_NotifyIcon( DWORD dwMessage, // @pyparm int|Message||One of win32gui.NIM_* flags NOTIFYICONDATA *pnid); // @pyparm |nid||Tuple containing NOTIFYICONDATA info -#ifdef MS_WINCE -HWND CommandBar_Create(HINSTANCE hInst, HWND hwndParent, int idCmdBar); - -BOOLAPI CommandBar_Show(HWND hwndCB, BOOL fShow); - -int CommandBar_AddBitmap(HWND hwndCB, HINSTANCE hInst, int idBitmap, - int iNumImages, int iImageWidth, - int iImageHeight); - -HWND CommandBar_InsertComboBox(HWND hwndCB, HINSTANCE hInstance, - int iWidth, UINT dwStyle, - WORD idComboBox, WORD iButton); - -BOOLAPI CommandBar_InsertMenubar(HWND hwndCB, HINSTANCE hInst, - WORD idMenu, WORD iButton); - -BOOLAPI CommandBar_InsertMenubarEx(HWND hwndCB, - HINSTANCE hinst, - TCHAR *pszMenu, - WORD iButton); - -BOOLAPI CommandBar_DrawMenuBar(HWND hwndCB, - WORD iButton); - -HMENU CommandBar_GetMenu(HWND hwndCB, WORD iButton); - -BOOLAPI CommandBar_AddAdornments(HWND hwndCB, - DWORD dwFlags, - DWORD dwReserved); - -int CommandBar_Height(HWND hwndCB); - -///////////////////////////////////////////////////////// -// -// Edit control stuff! -#endif - // A hack that needs to be replaced with a general buffer inteface. %{ static PyObject *PyEdit_GetLine(PyObject *self, PyObject *args) @@ -3661,26 +3553,6 @@ static PyObject *PyEdit_GetLine(PyObject *self, PyObject *args) %native (Edit_GetLine) PyEdit_GetLine; -#ifdef MS_WINCE -%{ -#include "dbgapi.h" -static PyObject *PyNKDbgPrintfW(PyObject *self, PyObject *args) -{ - PyObject *obtext; - if (!PyArg_ParseTuple(args, "O", &obtext)) - return NULL; - TCHAR *text; - if (!PyWinObject_AsTCHAR(obtext, &text)) - return NULL; - NKDbgPrintfW(_T("%s"), text); - PyWinObject_FreeTCHAR(text); - Py_INCREF(Py_None); - return Py_None; -} -%} -%native (NKDbgPrintfW) PyNKDbgPrintfW; -#endif - // DAVID ASCHER DAA // Need to complete the documentation! @@ -3703,10 +3575,8 @@ BOOLAPI MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepai // @pyparm int|width|| // @pyparm int|height|| // @pyparm int|bRepaint|| -#ifndef MS_WINCE // @pyswig |CloseWindow| BOOLAPI CloseWindow(HWND hWnd); -#endif // @pyswig |DeleteMenu| // @pyparm int|hmenu||The handle to the menu @@ -3747,10 +3617,8 @@ BOOL TrackPopupMenu(HMENU hmenu, UINT flags, int x, int y, int reserved, HWND hw #define TPM_VCENTERALIGN TPM_VCENTERALIGN #define TPM_NONOTIFY TPM_NONOTIFY #define TPM_RETURNCMD TPM_RETURNCMD -#ifndef MS_WINCE #define TPM_LEFTBUTTON TPM_LEFTBUTTON #define TPM_RIGHTBUTTON TPM_RIGHTBUTTON -#endif /* not MS_WINCE */ %{ #include "commdlg.h" @@ -3811,13 +3679,11 @@ static PyObject *PyExtractIconEx(PyObject *self, PyObject *args) return NULL; if (!PyWinObject_AsTCHAR(obFname, &fname, TRUE)) return NULL; -#ifndef MS_WINCE // CE doesn't have this special "-1" handling. if (index==-1) { nicons = (int)ExtractIconEx(fname, index, NULL, NULL, 0); PyWinObject_FreeTCHAR(fname); return PyLong_FromLong(nicons); } -#endif // MS_WINCE if (nicons<=0) { PyWinObject_FreeTCHAR(fname); return PyErr_Format(PyExc_ValueError, "Must supply a valid number of icons to fetch."); @@ -3842,10 +3708,6 @@ static PyObject *PyExtractIconEx(PyObject *self, PyObject *args) PyWin_SetAPIError("ExtractIconEx"); goto done; } -#ifdef MS_WINCE - /* On WinCE >= 2.1 the API actually returns a HICON */ - nicons_got = 1; -#endif // Asking for 1 always says it got 2!? nicons = min(nicons, nicons_got); objects_large = PyList_New(nicons); @@ -3872,13 +3734,11 @@ done: // @pyparm int|hicon||The icon to destroy. BOOLAPI DestroyIcon( HICON hicon); -#ifndef MS_WINCE // @pyswig |GetIconInfo|Returns parameters for an icon or cursor // @pyparm |hicon||The icon to query // @rdesc The result is a tuple of (fIcon, xHotspot, yHotspot, hbmMask, hbmColor) // The hbmMask and hbmColor items are bitmaps created for the caller, so must be freed. BOOLAPI GetIconInfo( HICON hicon, ICONINFO *OUTPUT); -#endif /* not MS_WINCE */ // @pyswig (int,int)|ScreenToClient|Convert screen coordinates to client coords BOOLAPI ScreenToClient( @@ -4636,8 +4496,6 @@ static PyObject *PyGradientFill(PyObject *self, PyObject *args) BOOL GetOpenFileName(OPENFILENAME *INPUT); -#ifndef MS_WINCE - %{ // @pyswig |InsertMenuItem|Inserts a menu item // @pyparm int|hMenu||Handle to the menu @@ -4768,9 +4626,7 @@ static PyObject *PyGetMenuItemInfo(PyObject *self, PyObject *args) %} %native (GetMenuItemInfo) PyGetMenuItemInfo; -#endif /* not MS_WINCE */ -#ifndef MS_WINCE // @pyswig int|GetMenuItemCount| // @pyparm int|hMenu||Handle to the menu int GetMenuItemCount(HMENU hMenu); @@ -4798,7 +4654,6 @@ BOOLAPI SetMenuDefaultItem(HMENU hMenu, UINT flags, UINT fByPos); // @pyparm int|fByPos|| // @pyparm int|flags|| int GetMenuDefaultItem(HMENU hMenu, UINT fByPos, UINT flags); -#endif /* not MS_WINCE */ // @pyswig |AppendMenu| BOOLAPI AppendMenu(HMENU hMenu, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); @@ -4817,7 +4672,6 @@ int CheckMenuItem(HMENU hMenu, UINT uIDCheckItem, UINT uCheck); // @pyparm int|nPos|| HMENU GetSubMenu(HMENU hMenu, int nPos); -#ifndef MS_WINCE // @pyswig |ModifyMenu|Changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item. BOOLAPI ModifyMenu( HMENU hMnu, // @pyparm int|hMnu||handle to menu @@ -4841,7 +4695,6 @@ BOOLAPI SetMenuItemBitmaps( HBITMAP INPUT_NULLOK, // @pyparm |hBitmapUnchecked||handle to unchecked bitmap, can be None HBITMAP INPUT_NULLOK // @pyparm |hBitmapChecked||handle to checked bitmap, can be None ); -#endif /* not MS_WINCE */ // @pyswig |CheckMenuRadioItem|Checks a specified menu item and makes it a // radio item. At the same time, the function clears all other menu items in @@ -5634,14 +5487,12 @@ BOOLAPI InvalidateRect( RECT *INPUT_NULLOK, // @pyparm |Rect||Client coordinates defining area to be redrawn. Use None for entire client area. BOOL bErase); // @pyparm boolean|Erase||Indicates if background should be erased -#ifndef MS_WINCE // Function is defined as returning int, but semantics are same as a boolean // @pyswig |FrameRect|Draws an outline around a rectangle BOOLAPI FrameRect( HDC hDC, // @pyparm |hDC||Handle to a device context RECT *INPUT, // @pyparm |rc||Rectangle around which to draw HBRUSH hbr); // @pyparm |hbr||Handle to brush created using CreateHatchBrush, CreatePatternBrush, CreateSolidBrush, or GetStockObject -#endif /* not MS_WINCE */ // @pyswig |InvertRect|Inverts the colors in a regtangular region BOOLAPI InvertRect( @@ -5910,12 +5761,9 @@ HDC GetWindowDC( HWND hWnd // @pyparm int|hWnd||handle of window ); -#ifndef MS_WINCE // @pyswig |IsIconic|determines whether the specified window is minimized (iconic). BOOL IsIconic( HWND hWnd // @pyparm int|hWnd||handle to window ); -#endif /* not MS_WINCE */ - // @pyswig |IsWindow|determines whether the specified window handle identifies an existing window. BOOL IsWindow( HWND hWnd // @pyparm int|hWnd||handle to window @@ -5934,11 +5782,9 @@ HWND GetCapture(); // @pyswig |SetCapture|Captures the mouse for the specified window. HWND SetCapture(HWND hWnd); -#ifndef MS_WINCE // @pyswig |_TrackMouseEvent|Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. // @pyparm |tme|| BOOLAPI _TrackMouseEvent(TRACKMOUSEEVENT *INPUT); -#endif // @pyswig int|ReleaseDC|Releases a device context. int ReleaseDC( @@ -6166,13 +6012,11 @@ HWND WindowFromPoint(POINT INPUT); // @pyparm (int, int)|point||The point. HWND ChildWindowFromPoint(HWND INPUT, POINT INPUT); -#ifndef MS_WINCE // @pyswig int|ChildWindowFromPoint|Determines which, if any, of the child windows belonging to a parent window contains the specified point. // @pyparm int|hwndParent||The parent. // @pyparm (int, int)|point||The point. // @pyparm int|flags||Specifies which child windows to skip. This parameter can be one or more of the CWP_* constants. HWND ChildWindowFromPointEx(HWND INPUT, POINT INPUT, int flags); -#endif // Sorting for controls %{ @@ -6256,7 +6100,6 @@ PyListView_SortItems(PyObject *self, PyObject *args) %native (ListView_SortItems) PyListView_SortItems; -#ifndef MS_WINCE %{ // @pyswig |ListView_SortItemsEx|Uses an application-defined comparison function to sort the items of a list view control. static PyObject * @@ -6289,7 +6132,6 @@ PyListView_SortItemsEx(PyObject *self, PyObject *args) } %} %native (ListView_SortItemsEx) PyListView_SortItemsEx; -#endif // !MS_WINCE %typemap(python,in) DEVMODE *INPUT { @@ -6657,9 +6499,7 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject DWORD buflen; BOOL boolParam; UINT uintParam; -#ifndef MS_WINCE long longParam; -#endif if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k|Ok", keywords, &Action, // @pyparm int|Action||System parameter to query or set, one of the SPI_GET* or SPI_SET* constants @@ -6669,7 +6509,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject // @flagh Action|Input/return type switch (Action){ -#ifndef MS_WINCE // @flag SPI_GETDESKWALLPAPER|Returns the path to the bmp used as wallpaper case SPI_GETDESKWALLPAPER: uiParam=MAX_PATH; @@ -6755,13 +6594,11 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_GETMOUSEVANISH: // @flag SPI_GETSCREENREADER|Returns a boolean case SPI_GETSCREENREADER: -#endif // !MS_WINCE // @flag SPI_GETSHOWSOUNDS|Returns a boolean case SPI_GETSHOWSOUNDS: pvParam=&boolParam; break; -#ifndef MS_WINCE // Actions in this section accept a boolean as pvParam // @flag SPI_SETDROPSHADOW|Param must be a boolean case SPI_SETDROPSHADOW: @@ -6836,7 +6673,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_SETSHOWIMEUI: // @flag SPI_SETSCREENREADER|Param is a boolean case SPI_SETSCREENREADER: -#endif // !MS_WINCE // @flag SPI_SETSHOWSOUNDS|Param is a boolean case SPI_SETSHOWSOUNDS: uiParam=(UINT)PyObject_IsTrue(obParam); @@ -6844,14 +6680,11 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject goto done; break; -#ifndef MS_WINCE // These accept an int placed in uiParam // @flag SPI_SETMOUSETRAILS|Param should be an int specifying the nbr of cursors in the trail (0 or 1 means disabled) case SPI_SETMOUSETRAILS: -#endif // !MS_WINCE // @flag SPI_SETWHEELSCROLLLINES|Param is an int specifying nbr of lines case SPI_SETWHEELSCROLLLINES: -#ifndef MS_WINCE // @flag SPI_SETKEYBOARDDELAY|Param is an int in the range 0 - 3 case SPI_SETKEYBOARDDELAY: // @flag SPI_SETKEYBOARDSPEED|Param is an int in the range 0 - 31 @@ -6882,7 +6715,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_SETDRAGWIDTH: // @flag SPI_SETBORDER|Param is an int case SPI_SETBORDER: -#endif // !MS_WINCE if (!PyObject_AsUINT(obParam, &uiParam)) goto done; break; @@ -6890,7 +6722,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject // below Actions all return a UINT pointed to by Param // @flag SPI_GETFONTSMOOTHINGCONTRAST|Returns an int case SPI_GETFONTSMOOTHINGCONTRAST: -#ifndef MS_WINCE // @flag SPI_GETFONTSMOOTHINGTYPE|Returns an int case SPI_GETFONTSMOOTHINGTYPE: // @flag SPI_GETMOUSETRAILS|Returns an int specifying the nbr of cursor images in the trail, 0 or 1 indicates disabled @@ -6909,10 +6740,8 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_GETMOUSEHOVERWIDTH: // @flag SPI_GETMOUSEHOVERTIME|Returns an int case SPI_GETMOUSEHOVERTIME: -#endif // !MS_WINCE // @flag SPI_GETSCREENSAVETIMEOUT|Returns an int (idle time in seconds) case SPI_GETSCREENSAVETIMEOUT: -#ifndef MS_WINCE // @flag SPI_GETMENUSHOWDELAY|Returns an int (shortcut delay in milliseconds) case SPI_GETMENUSHOWDELAY: // @flag SPI_GETLOWPOWERTIMEOUT|Returns an int (in seconds) @@ -6935,14 +6764,12 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_GETFOCUSBORDERWIDTH: // @flag SPI_GETMOUSECLICKLOCKTIME|Returns an int (in milliseconds) case SPI_GETMOUSECLICKLOCKTIME: -#endif // !MS_WINCE pvParam=&uintParam; break; // Actions that take pvParam as an unsigned int // @flag SPI_SETFONTSMOOTHINGCONTRAST|Param should be an int in the range 1000 to 2200 case SPI_SETFONTSMOOTHINGCONTRAST: -#ifndef MS_WINCE // @flag SPI_SETFONTSMOOTHINGTYPE|Param should be one of the FE_FONTSMOOTHING* constants case SPI_SETFONTSMOOTHINGTYPE: // @flag SPI_SETMOUSESPEED|Param should be an int in the range 1 - 20 @@ -6961,12 +6788,10 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_SETFOCUSBORDERWIDTH: // @flag SPI_SETMOUSECLICKLOCKTIME|Param is an int (in milliseconds) case SPI_SETMOUSECLICKLOCKTIME: -#endif // !MS_WINCE if (!PyObject_AsUINT(obParam, (UINT *)&pvParam)) goto done; break; -#ifndef MS_WINCE // @flag SPI_GETICONTITLELOGFONT|Returns a , case SPI_GETICONTITLELOGFONT: uiParam=sizeof(LOGFONT); @@ -6993,7 +6818,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject // @flag SPI_SETICONS|Reloads the system icons. Param is not used case SPI_SETICONS: break; -#endif // !MS_WINCE // @flag SPI_GETMOUSE|Returns a tuple of 3 ints containing the x and y mouse thresholds and the acceleration factor. case SPI_GETMOUSE: @@ -7023,7 +6847,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject break; } -#ifndef MS_WINCE // @flag SPI_GETDEFAULTINPUTLANG|Returns an int (locale id for default language) case SPI_GETDEFAULTINPUTLANG: pvParam=&longParam; @@ -7114,8 +6937,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject goto done; break; -#endif // !MS_WINCE - // below are not handled yet // @flag SPI_SETDESKPATTERN|Unsupported (obsolete) // @flag SPI_GETFASTTASKSWITCH|Unsupported (obsolete) @@ -7161,7 +6982,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject } switch (Action){ -#ifndef MS_WINCE case SPI_GETDESKWALLPAPER: ret=PyWinObject_FromTCHAR((TCHAR *)pvParam); break; @@ -7198,11 +7018,9 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_GETMOUSESONAR: case SPI_GETMOUSEVANISH: case SPI_GETSCREENREADER: -#endif // !MS_WINCE case SPI_GETSHOWSOUNDS: ret=PyBool_FromLong(boolParam); break; -#ifndef MS_WINCE case SPI_GETFONTSMOOTHINGTYPE: case SPI_GETMOUSETRAILS: case SPI_GETKEYBOARDDELAY: @@ -7222,24 +7040,20 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject case SPI_GETFOCUSBORDERHEIGHT: case SPI_GETFOCUSBORDERWIDTH: case SPI_GETMOUSECLICKLOCKTIME: -#endif // !MS_WINCE case SPI_GETFONTSMOOTHINGCONTRAST: case SPI_GETWHEELSCROLLLINES: case SPI_GETSCREENSAVETIMEOUT: ret=PyLong_FromUnsignedLong(uintParam); break; -#ifndef MS_WINCE case SPI_GETDEFAULTINPUTLANG: ret=PyLong_FromLong(longParam); break; case SPI_GETICONTITLELOGFONT: ret=new PyLOGFONT((LOGFONT *)pvParam); break; -#endif // !MS_WINCE case SPI_GETMOUSE: ret=Py_BuildValue("kkk", ((UINT *)pvParam)[0], ((UINT *)pvParam)[1], ((UINT *)pvParam)[2]); break; -#ifndef MS_WINCE case SPI_GETANIMATION: ret=PyLong_FromLong(((ANIMATIONINFO *)pvParam)->iMinAnimate); break; @@ -7282,7 +7096,6 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject "iArrange", p->iArrange); break; } -#endif // !MS_WINCE default: Py_INCREF(Py_None); @@ -7291,12 +7104,10 @@ static PyObject *PySystemParametersInfo(PyObject *self, PyObject *args, PyObject done: switch (Action){ -#ifndef MS_WINCE case SPI_GETDESKWALLPAPER: case SPI_GETICONTITLELOGFONT: case SPI_GETANIMATION: case SPI_SETANIMATION: -#endif // !MS_WINCE case SPI_GETNONCLIENTMETRICS: case SPI_SETNONCLIENTMETRICS: case SPI_GETMINIMIZEDMETRICS: diff --git a/win32/src/win32pipe.i b/win32/src/win32pipe.i index d3f7581d79..f535778010 100644 --- a/win32/src/win32pipe.i +++ b/win32/src/win32pipe.i @@ -270,7 +270,7 @@ PyObject *MyTransactNamedPipe(PyObject *self, PyObject *args) // process the tricky read buffer. cbReadData = PyLong_AsLong(obReadData); if ((cbReadData!=(DWORD)-1) || !PyErr_Occurred()){ - if (pOverlapped){ // guaranteed to be NULL on CE + if (pOverlapped){ obRet = PyBuffer_New(cbReadData); if (obRet==NULL) return NULL; diff --git a/win32/src/win32process.i b/win32/src/win32process.i index adf60b3db2..0606e5b5ed 100644 --- a/win32/src/win32process.i +++ b/win32/src/win32process.i @@ -4,9 +4,7 @@ %{ #define PY_SSIZE_T_CLEAN // may inevitably be defined by swig_lib/python/python.swg already -#ifndef MS_WINCE #include "process.h" -#endif #include "windows.h" #include "Psapi.h" #include "PyWinTypes.h" @@ -31,7 +29,6 @@ static GetModuleFileNameExfunc pfnGetModuleFileNameEx = NULL; typedef DWORD (WINAPI *GetProcessIdfunc)(HANDLE); static GetProcessIdfunc pfnGetProcessId = NULL; -#ifndef MS_WINCE typedef BOOL (WINAPI *GetProcessMemoryInfofunc)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD); static GetProcessMemoryInfofunc pfnGetProcessMemoryInfo=NULL; typedef BOOL (WINAPI *GetProcessTimesfunc)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME); @@ -71,7 +68,6 @@ typedef DWORD (WINAPI *SetProcessAffinityMaskfunc)(HANDLE, DWORD_PTR); static SetProcessAffinityMaskfunc pfnSetProcessAffinityMask = NULL; typedef BOOL (WINAPI *IsWow64Processfunc)(HANDLE, PBOOL); static IsWow64Processfunc pfnIsWow64Process = NULL; -#endif // Support for a STARTUPINFO object. class PySTARTUPINFO : public PyObject @@ -322,16 +318,8 @@ static PyObject *mySTARTUPINFO(PyObject *self, PyObject *args) %typemap(python,in) STARTUPINFO * { -#ifdef MS_WINCE - if ($source!=Py_None) { - PyErr_SetString(PyExc_TypeError, "STARTUPINFO is not supported on Windows CE"); - return NULL; - } - $target = NULL; -#else if (!PyWinObject_AsSTARTUPINFO($source, &$target, FALSE)) return NULL; -#endif } %typemap(python,argout) STARTUPINFO *OUTPUT { @@ -358,8 +346,6 @@ static PyObject *mySTARTUPINFO(PyObject *self, PyObject *args) $target = &temp; } -#ifndef MS_WINCE - %{ class PythonThreadData { @@ -479,7 +465,6 @@ static PyObject *myCreateRemoteThread(PyObject *self, PyObject *args) %} %native (CreateRemoteThread) myCreateRemoteThread; -#endif // MS_WINCE // Wont expose ExitThread!!! May leak all sorts of things! @@ -646,10 +631,8 @@ PyObject *MyCreateProcess( if (!CreateEnvironmentString(environment, &pEnv, &bEnvIsUnicode)) return NULL; -#ifndef MS_WINCE if (bEnvIsUnicode) dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; -#endif //MS_WINCE BOOL ok; Py_BEGIN_ALLOW_THREADS @@ -717,7 +700,6 @@ PyObject *MyCreateProcess( ); -#ifndef MS_WINCE %{ PyObject *MyCreateProcessAsUser( HANDLE h, @@ -780,7 +762,6 @@ PyObject *MyCreateProcessAsUser( STARTUPINFO *lpStartupInfo // @pyparm |startupinfo||a STARTUPINFO object that specifies how the main window for the new process should appear. ); -#endif // MS_WINCE %{ // GetCurrentProcess returns -1 which is INVALID_HANDLE_VALUE, so can't use swig typemap for HANDLE @@ -802,7 +783,6 @@ DWORD GetProcessVersion( // @pyswig int|GetCurrentProcessId|Retrieves the process identifier of the calling process. DWORD GetCurrentProcessId(); -#ifndef MS_WINCE // @pyswig |GetStartupInfo|Retrieves the contents of the STARTUPINFO structure that was specified when the calling process was created. void GetStartupInfo( STARTUPINFO *OUTPUT @@ -813,8 +793,6 @@ DWORD GetPriorityClass( HANDLE hThread // @pyparm |handle||handle to the thread ); -#endif // MS_WINCE - // @pyswig int|GetExitCodeThread| BOOLAPI GetExitCodeThread( HANDLE hThread, // @pyparm |handle||handle to the thread @@ -989,8 +967,6 @@ static PyObject *PyGetProcessId(PyObject *self, PyObject *args) %native (GetThreadTimes) PyGetThreadTimes; %native (GetProcessId) PyGetProcessId; -#ifndef MS_WINCE - // @pyswig |SetPriorityClass| BOOLAPI SetPriorityClass( HANDLE hThread, // @pyparm |handle||handle to the process @@ -1099,7 +1075,6 @@ static PyObject *MySetThreadAffinityMask(PyObject *self, PyObject *args) %native(GetProcessAffinityMask) MyGetProcessAffinityMask; %native(SetProcessAffinityMask) MySetProcessAffinityMask; %native(SetThreadAffinityMask) MySetThreadAffinityMask; -#endif // MS_WINCE // Special result handling for SuspendThread and ResumeThread %typedef DWORD DWORD_SR_THREAD @@ -1365,7 +1340,6 @@ done: } %} -#ifndef MS_WINCE // @pyswig |GetProcessMemoryInfo|Returns process memory statistics as a dict representing a PROCESS_MEMORY_COUNTERS struct %native(GetProcessMemoryInfo) PyGetProcessMemoryInfo; %{ @@ -1712,7 +1686,6 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) } %} -#endif // MS_WINCE %init %{ @@ -1729,12 +1702,9 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) pfnEnumProcessModules = (EnumProcessModulesfunc)GetProcAddress(hmodule, "EnumProcessModules"); pfnEnumProcessModulesEx = (EnumProcessModulesExfunc)GetProcAddress(hmodule, "EnumProcessModulesEx"); pfnGetModuleFileNameEx = (GetModuleFileNameExfunc)GetProcAddress(hmodule, "GetModuleFileNameExW"); -#ifndef MS_WINCE pfnGetProcessMemoryInfo = (GetProcessMemoryInfofunc)GetProcAddress(hmodule, "GetProcessMemoryInfo"); -#endif } -#ifndef MS_WINCE hmodule=GetModuleHandle(_T("Kernel32.dll")); if (hmodule==NULL) hmodule=LoadLibrary(_T("Kernel32.dll")); @@ -1765,7 +1735,6 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) pfnGetProcessWindowStation=(GetProcessWindowStationfunc)GetProcAddress(hmodule,"GetProcessWindowStation"); pfnGetGuiResources=(GetGuiResourcesfunc)GetProcAddress(hmodule,"GetGuiResources"); } -#endif // MS_WINCE // *sob* - these symbols don't exist in the platform sdk needed to build // using Python 2.3 @@ -1779,9 +1748,7 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) #define CREATE_SUSPENDED CREATE_SUSPENDED -#ifndef MS_WINCE #define MAXIMUM_PROCESSORS MAXIMUM_PROCESSORS -#endif // MS_WINCE #define THREAD_PRIORITY_ABOVE_NORMAL THREAD_PRIORITY_ABOVE_NORMAL // Indicates 1 point above normal priority for the priority class. #define THREAD_PRIORITY_BELOW_NORMAL THREAD_PRIORITY_BELOW_NORMAL // Indicates 1 point below normal priority for the priority class. @@ -1793,7 +1760,6 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) #define THREAD_MODE_BACKGROUND_BEGIN THREAD_MODE_BACKGROUND_BEGIN #define THREAD_MODE_BACKGROUND_END THREAD_MODE_BACKGROUND_END -#ifndef MS_WINCE #define CREATE_DEFAULT_ERROR_MODE CREATE_DEFAULT_ERROR_MODE // The new process does not inherit the error mode of the calling process. Instead, CreateProcess gives the new process the current default error mode. An application sets the current default error mode by calling SetErrorMode. // This flag is particularly useful for multi-threaded shell applications that run with hard errors disabled. @@ -1810,7 +1776,6 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL CREATE_PRESERVE_CODE_AUTHZ_LEVEL #define CREATE_NO_WINDOW CREATE_NO_WINDOW -#endif // MS_WINCE #define DEBUG_PROCESS DEBUG_PROCESS // If this flag is set, the calling process is treated as a debugger, and the new process is a process being debugged. The system notifies the debugger of all debug events that occur in the process being debugged. // If you create a process with this flag set, only the calling thread (the thread that called CreateProcess) can call the WaitForDebugEvent function. @@ -1818,7 +1783,6 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) #define DEBUG_ONLY_THIS_PROCESS DEBUG_ONLY_THIS_PROCESS // If not set and the calling process is being debugged, the new process becomes another process being debugged by the calling process's debugger. If the calling process is not a process being debugged, no debugging-related actions occur. -#ifndef MS_WINCE #define DETACHED_PROCESS DETACHED_PROCESS // For console processes, the new process does not have access to the console of the parent process. The new process can call the AllocConsole function at a later time to create a new console. This flag cannot be used with the CREATE_NEW_CONSOLE flag. #define ABOVE_NORMAL_PRIORITY_CLASS ABOVE_NORMAL_PRIORITY_CLASS // Windows 2000: Indicates a process that has priority above NORMAL_PRIORITY_CLASS but below HIGH_PRIORITY_CLASS. @@ -1857,4 +1821,3 @@ PyObject *PyWriteProcessMemory(PyObject *self, PyObject *args) // Sets the standard input, standard output, and standard error handles for the process to the handles specified in the hStdInput, hStdOutput, and hStdError members of the STARTUPINFO structure. The CreateProcess function's fInheritHandles parameter must be set to TRUE for this to work properly. // If this value is not specified, the hStdInput, hStdOutput, and hStdError members of the STARTUPINFO structure are ignored. -#endif // MS_WINCE diff --git a/win32/src/win32wnet/PyNCB.h b/win32/src/win32wnet/PyNCB.h index 30f2d0006f..cbb1c137de 100644 --- a/win32/src/win32wnet/PyNCB.h +++ b/win32/src/win32wnet/PyNCB.h @@ -16,8 +16,6 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -#ifndef _WIN32_WCE // exclude this code under WindowsCE...not supported by CE - #include "structmember.h" class __declspec(dllexport) PyNCB : public PyObject { @@ -43,5 +41,3 @@ class __declspec(dllexport) PyNCB : public PyObject { extern __declspec(dllexport) PyTypeObject PyNCBType; #define PyNCB_Check(ob) ((ob)->ob_type == &PyNCBType) - -#endif // end of _WIN32_WCE exclude diff --git a/win32/src/win32wnet/win32wnet.cpp b/win32/src/win32wnet/win32wnet.cpp index a990682463..beb18c8330 100644 --- a/win32/src/win32wnet/win32wnet.cpp +++ b/win32/src/win32wnet/win32wnet.cpp @@ -150,11 +150,7 @@ static PyObject *PyWNetAddConnection2(PyObject *self, PyObject *args, PyObject * goto done; Py_BEGIN_ALLOW_THREADS -#ifdef _WIN32_WCE_ // Windows CE only has the #3 version...use NULL for HWND to simulate #2 - ErrorNo = WNetAddConnection3(NULL, pNetResource, Password, Username, flags); -#else ErrorNo = WNetAddConnection2(pNetResource, Password, Username, flags); -#endif Py_END_ALLOW_THREADS if (ErrorNo != NO_ERROR) ReturnNetError("WNetAddConnection2", ErrorNo); else { diff --git a/win32/src/wincerapi.i b/win32/src/wincerapi.i deleted file mode 100644 index f1483ae88b..0000000000 --- a/win32/src/wincerapi.i +++ /dev/null @@ -1,948 +0,0 @@ -/* File : wincerapi.i */ -// @doc - -%module wincerapi // A module which provides an interface to the win32 CE Remote API - -%{ -#define PY_SSIZE_T_CLEAN -%} -%include "typemaps.i" -%include "pywintypes.i" - -%{ -#include "Rapi.h" -#include "assert.h" -#include "SHLOBJ.H" - -PyObject *PyWinObject_FromCEHANDLE(HANDLE); -BOOL PyWinObject_AsCEHANDLE(PyObject *ob, HANDLE *pRes, BOOL bNoneOK); - -DWORD GetLastCEError() -{ - DWORD rc = CeRapiGetError(); - return rc==0 ? CeGetLastError() : rc; -} - -// Identical to PyW32_BEGIN_ALLOW_THREADS except no script "{" !!! -// means variables can be declared between the blocks -#define PyW32_BEGIN_ALLOW_THREADS PyThreadState *_save = PyEval_SaveThread(); -#define PyW32_END_ALLOW_THREADS PyEval_RestoreThread(_save); -#define PyW32_BLOCK_THREADS Py_BLOCK_THREADS - -%} - -%typemap(python,except) PyCEHANDLE { - Py_BEGIN_ALLOW_THREADS - $function - Py_END_ALLOW_THREADS - if ($source==0 || $source==INVALID_HANDLE_VALUE) { - $cleanup - return PyWin_SetAPIError("$name",GetLastCEError()); - } -} - -%typemap(python,in) PyCEHANDLE { - if (!PyWinObject_AsCEHANDLE($source, &$target, FALSE)) - return NULL; -} - -%typemap(python,in) PyCEHANDLE INPUT_NULLOK { - if (!PyWinObject_AsCEHANDLE($source, &$target, TRUE)) - return NULL; -} - -%typemap(python,ignore) PyCEHANDLE *OUTPUT(HANDLE temp) -{ - $target = &temp; -} - -%typemap(python,out) PyCEHANDLE { - $target = PyWinObject_FromCEHANDLE($source); -} - -%typemap(python,argout) PyCEHANDLE *OUTPUT { - PyObject *o; - o = PyWinObject_FromCEHANDLE(*$source); - if (!$target) { - $target = o; - } else if ($target == Py_None) { - Py_DECREF(Py_None); - $target = o; - } else { - if (!PyList_Check($target)) { - PyObject *o2 = $target; - $target = PyList_New(0); - PyList_Append($target,o2); - Py_XDECREF(o2); - } - PyList_Append($target,o); - Py_XDECREF(o); - } -} - - -typedef HANDLE PyCEHANDLE; -%{ -#define PyCEHANDLE HANDLE; -%} - -%typedef int HRESULTAPI - -%typemap(python,out) HRESULTAPI { - $target = Py_None; - Py_INCREF(Py_None); -} - -%typemap(python,except) HRESULTAPI { - Py_BEGIN_ALLOW_THREADS - $function - Py_END_ALLOW_THREADS - if (FAILED($source)) { - $cleanup - return PyWin_SetAPIError("$name", $source); - } -} - -%typedef BOOL BOOLCEAPI - -%typemap(python,out) BOOLCEAPI { - $target = Py_None; - Py_INCREF(Py_None); -} - -%typemap(python,except) BOOLCEAPI { - Py_BEGIN_ALLOW_THREADS - $function - Py_END_ALLOW_THREADS - if (!$source) { - $cleanup - return PyWin_SetAPIError("$name", GetLastCEError()); - } -} - -%typemap(python,in) STARTUPINFO * -{ - if ($source!=Py_None) { - PyErr_SetString(PyExc_TypeError, "STARTUPINFO must be None on Windows CE"); - return NULL; - } - $target = NULL; -} - -// @pyswig |CeRapiInit|Initializes the remote API. -HRESULTAPI CeRapiInit(); - -// @pyswig |CeRapiUninit|UnInitializes the remote API. -HRESULTAPI CeRapiUninit(); - - -%{ - -static BOOL CreateEnvironmentString(PyObject *env, LPVOID *ppRet, BOOL *pRetIsUnicode) -{ - *pRetIsUnicode = FALSE; - if (env==Py_None) { - *ppRet = NULL; - return TRUE; - } - // First loop counting the size of the environment. - if (!PyMapping_Check(env)) { - PyErr_SetString(PyExc_TypeError, "environment parameter must be a dictionary object of strings or unicode objects."); - return FALSE; - } - int envLength = PyMapping_Length(env); - PyObject *keys = PyMapping_Keys(env); - PyObject *vals = PyMapping_Values(env); - if (!keys || !vals) - return FALSE; - - int i; - BOOL bIsUnicode; - unsigned bufLen = 0; - for (i=0;i, , int, int|CreateProcess|Creates a new process and its primary thread. The new process executes the specified executable file. -// @comm The result is a tuple of (hProcess, hThread, dwProcessId, dwThreadId) -%name(CeCreateProcess) -PyObject *MyCreateProcess( - TCHAR *INPUT_NULLOK, // @pyparm string|appName||name of executable module, or None - TCHAR *INPUT_NULLOK, // @pyparm string|commandLine||command line string, or None - SECURITY_ATTRIBUTES *INPUT_NULLOK, // @pyparm |processAttributes||process security attributes, or None - SECURITY_ATTRIBUTES *INPUT_NULLOK, // @pyparm |threadAttributes||thread security attributes, or None - BOOL bInheritHandles, // @pyparm int|bInheritHandles||handle inheritance flag - DWORD dwCreationFlags, // @pyparm int|dwCreationFlags||creation flags - PyObject *env, // @pyparm None|newEnvironment||A dictionary of stringor Unicode pairs to define the environment for the process, or None to inherit the current environment. - TCHAR *INPUT_NULLOK, // @pyparm string|currentDirectory||current directory name, or None - STARTUPINFO *lpStartupInfo // @pyparm |startupinfo||a STARTUPINFO object that specifies how the main window for the new process should appear. - -); - -%{ -PyObject *PyCeRapiInitEx(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, "")) - return NULL; - RAPIINIT ri; - ri.cbSize = sizeof(ri); - PyW32_BEGIN_ALLOW_THREADS - HRESULT hr = CeRapiInitEx(&ri); - PyW32_END_ALLOW_THREADS - if (hr==S_OK) { // || hr==CERAPI_E_ALREADYINITIALIZED) - PyObject *obHandle = PyWinObject_FromHANDLE(ri.heRapiInit); - PyObject *ret = Py_BuildValue("Ol", obHandle, ri.hrRapiInit); - Py_DECREF(obHandle); - return ret; - } else - return PyWin_SetAPIError("CeCreateProcess", hr); -} -%} -// @pyswig int|CeRapiInitEx|Initializes the remote API asynchronously. -%native(CeRapiInitEx) PyCeRapiInitEx; - - -// @pyswig |CeCopyFile|Copies a file -BOOLCEAPI CeCopyFile( - TCHAR *from, // @pyparm |from||The name of the file to copy from - TCHAR *to, // @pyparm |to||The name of the file to copy to - BOOL bFailIfExists); // @pyparm int|bFailIfExists||Indicates if the operation should fail if the file exists. - -// @pyswig |CeCheckPassword|This function compares a specified string to the system password. -BOOLCEAPI CeCheckPassword( - TCHAR *password // @pyparm |password||The password to compare. -); - -// @pyswig |CeCreateFile|Creates or opens the a file or other object and returns a handle that can be used to access the object. -// @comm The following objects can be opened:filespipesmailslotscommunications resourcesdisk devices (Windows NT only)consolesdirectories (open only) -PyCEHANDLE CeCreateFile( - TCHAR *lpFileName, // @pyparm |fileName||The name of the file - DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access (read-write) mode - // Specifies the type of access to the object. An application can obtain read access, write access, read-write access, or device query access. This parameter can be any combination of the following values. - // @flagh Value|Meaning - // @flag 0|Specifies device query access to the object. An application can query device attributes without accessing the device. - // @flag GENERIC_READ|Specifies read access to the object. Data can be read from the file and the file pointer can be moved. Combine with GENERIC_WRITE for read-write access. - // @flag GENERIC_WRITE|Specifies write access to the object. Data can be written to the file and the file pointer can be moved. Combine with GENERIC_READ for read-write access. - DWORD dwShareMode, // @pyparm int|shareMode||Set of bit flags that specifies how the object can be shared. If dwShareMode is 0, the object cannot be shared. Subsequent open operations on the object will fail, until the handle is closed. - // To share the object, use a combination of one or more of the following values: - // @flagh Value|Meaning - // @flag FILE_SHARE_DELETE|Windows NT: Subsequent open operations on the object will succeed only if delete access is requested. - // @flag FILE_SHARE_READ|Subsequent open operations on the object will succeed only if read access is requested. - // @flag FILE_SHARE_WRITE|Subsequent open operations on the object will succeed only if write access is requested. - SECURITY_ATTRIBUTES *lpSecurityAttributes, // @pyparm |attributes||The security attributes, or None - DWORD dwCreationDistribution, // @pyparm int|creationDisposition||Specifies which action to take on files that exist, and which action to take when files do not exist. For more information about this parameter, see the Remarks section. This parameter must be one of the following values: - // @flagh Value|Meaning - // @flag CREATE_NEW|Creates a new file. The function fails if the specified file already exists. - // @flag CREATE_ALWAYS|Creates a new file. If the file exists, the function overwrites the file and clears the existing attributes. - // @flag OPEN_EXISTING|Opens the file. The function fails if the file does not exist. - // See the Remarks section for a discussion of why you should use the OPEN_EXISTING flag if you are using the CreateFile function for devices, including the console. - // @flag OPEN_ALWAYS|Opens the file, if it exists. If the file does not exist, the function creates the file as if dwCreationDisposition were CREATE_NEW. - // @flag TRUNCATE_EXISTING|Opens the file. Once opened, the file is truncated so that its size is zero bytes. The calling process must open the file with at least GENERIC_WRITE access. The function fails if the file does not exist. - DWORD dwFlagsAndAttributes, // @pyparm int|flagsAndAttributes||file attributes - PyCEHANDLE INPUT_NULLOK // @pyparm |hTemplateFile||Specifies a handle with GENERIC_READ access to a template file. The template file supplies file attributes and extended attributes for the file being created. Under Win95, this must be 0, else an exception will be raised. -); - -// @pyswig |CeDeleteFile|Deletes a file. -BOOLCEAPI CeDeleteFile(TCHAR *fileName); -// @pyparm |fileName||The filename to delete - -// @pyswig |CeMoveFile|Renames an existing file or a directory (including all its children). -BOOLCEAPI CeMoveFile( - TCHAR *lpExistingFileName, // @pyparm |existingFileName||Name of the existing file - TCHAR *lpNewFileName // @pyparm |newFileName||New name for the file -); - -// @pyswig |CeCreateDirectory|Creates a directory -BOOLCEAPI CeCreateDirectory( - TCHAR *name, // @pyparm |name||The name of the directory to create - SECURITY_ATTRIBUTES *pSA); // @pyparm |sa||The security attributes, or None - -// @pyswig |CeRemoveDirectory|Removes an existing directory -BOOLCEAPI CeRemoveDirectory( - TCHAR *lpPathName // @pyparm |lpPathName||Name of the path to remove. -); - -%{ -// @pyswig |CeGetTempPath|Obtains the temp path on the device. -static PyObject *PyCeGetTempPath(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, "")) - return NULL; - TCHAR buf[_MAX_PATH]; - PyW32_BEGIN_ALLOW_THREADS - DWORD numChars = CeGetTempPath(_MAX_PATH, buf); - PyW32_END_ALLOW_THREADS - if (numChars==0) - return PyWin_SetAPIError("CeGetTempPath", GetLastCEError()); - return PyWinObject_FromTCHAR(buf, numChars); -} -%} -%native (CeGetTempPath) PyCeGetTempPath; - -%{ -// @pyswig tuple|CeGetSystemInfo|Retrieves information about the CE device. -static PyObject * -PyCeGetSystemInfo(PyObject * self, PyObject * args) -{ - if (!PyArg_ParseTuple(args, ":GetSystemInfo")) - return NULL; - // @pyseeapi GetSystemInfo - SYSTEM_INFO info; - PyW32_BEGIN_ALLOW_THREADS - CeGetSystemInfo( &info ); - PyW32_END_ALLOW_THREADS - return Py_BuildValue("iiiiiiii(ii)", info.dwOemId, info.dwPageSize, - info.lpMinimumApplicationAddress, info.lpMaximumApplicationAddress, - info.dwActiveProcessorMask, info.dwNumberOfProcessors, - info.dwProcessorType, info.dwAllocationGranularity, - info.wProcessorLevel, info.wProcessorRevision); - // @rdesc The return value is a tuple of 9 values, which corresponds - // to the Win32 SYSTEM_INFO structure. The element names are: - // dwOemIddwPageSizelpMinimumApplicationAddresslpMaximumApplicationAddress, - // dwActiveProcessorMaskdwNumberOfProcessors - // dwProcessorTypedwAllocationGranularity(wProcessorLevel,wProcessorRevision) -} -%} -%native (CeGetSystemInfo) PyCeGetSystemInfo; - -// @pyswig int|CeGetDesktopDeviceCaps|Retrieves information about the CE desktop. -int CeGetDesktopDeviceCaps(int nIndex); - -// @pyswig int|CeGetSystemMetrics|Retrieves information about the CE system. -int CeGetSystemMetrics(int nIndex); - -// @pyswig |CeGetSpecialFolderPath|Retrieves the location of special folders on the CE device. -%{ -static PyObject *PyCeGetSpecialFolderPath(PyObject *self, PyObject *args) -{ - int typ; - if (!PyArg_ParseTuple(args, "i", &typ)) - return NULL; - TCHAR buf[_MAX_PATH]; - PyW32_BEGIN_ALLOW_THREADS - DWORD numChars = CeGetSpecialFolderPath(typ, _MAX_PATH, buf); - PyW32_END_ALLOW_THREADS - if (numChars==0) - return PyWin_SetAPIError("CeGetSpecialFolderPath", GetLastCEError()); - return PyWinObject_FromTCHAR(buf, numChars); -} -%} -%native (CeGetSpecialFolderPath) PyCeGetSpecialFolderPath; - -// @pyswig int, int|CeGetStoreInformation|Retrieves information about store on the CE system. -%{ -static PyObject *PyCeGetStoreInformation(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, "")) - return NULL; - STORE_INFORMATION si; - PyW32_BEGIN_ALLOW_THREADS - BOOL ok = CeGetStoreInformation(&si); - PyW32_END_ALLOW_THREADS - if (!ok) - return PyWin_SetAPIError("CeGetStoreInformation", GetLastCEError()); - // @rdesc The result is a tuple of (storeSize, freeSize) - return Py_BuildValue("ii", si.dwStoreSize, si.dwFreeSize); -} -%} -%native (CeGetStoreInformation) PyCeGetStoreInformation; - -// @pyswig tuple|CeGetSystemPowerStatusEx|Retrieves the power status of the CE device. -%{ -static PyObject * -PyCeGetSystemPowerStatusEx(PyObject *self, PyObject *args) -{ SYSTEM_POWER_STATUS_EX *lpInfo=NULL; - PyObject *obInfo=NULL; - - BOOL bUpdate = TRUE; - if(!PyArg_ParseTuple(args, "|i:CeGetSystemPowerStatusEx", &bUpdate)) - return NULL; - SYSTEM_POWER_STATUS_EX info; - PyW32_BEGIN_ALLOW_THREADS - BOOL ok = CeGetSystemPowerStatusEx(&info, TRUE); - PyW32_END_ALLOW_THREADS - if (!ok) { - return PyWin_SetAPIError("CeGetSystemPowerStatusEx", GetLastCEError()); - } - // @rdesc The result is a tuple of (ACLineStatus, BatteryFlag, BatteryLifePercent, BatteryLifeTime, BatteryFullLifeTime, BackupBatteryFlag, BackupBatteryLifePercent, BackupBatteryLifeTime, BackupBatteryLifeTime); - return Py_BuildValue("iiiiiiiii", info.ACLineStatus, info.BatteryFlag, info.BatteryLifePercent, info.BatteryLifeTime, info.BatteryFullLifeTime, info.BackupBatteryFlag, info.BackupBatteryLifePercent, info.BackupBatteryLifeTime, info.BackupBatteryLifeTime); -} -%} -%native (CeGetSystemPowerStatusEx) PyCeGetSystemPowerStatusEx; - - -// @pyswig |CeSHCreateShortcut|Creates a shortcut on the remote device. -DWORDAPI CeSHCreateShortcut(TCHAR *lpszShortcut, TCHAR *lpszTarget); - -// @pyswig tuple|CeSHGetShortcutTarget|Retrieves the target of a shortcut. -%{ -static PyObject * -PyCeSHGetShortcutTarget(PyObject *self, PyObject *args) -{ - PyObject *obSC; - if(!PyArg_ParseTuple(args, "|O:CeGetSystemPowerStatusEx", &obSC)) - return NULL; - TCHAR *sc; - if (!PyWinObject_AsTCHAR(obSC, &sc, FALSE)) - return NULL; - TCHAR target[_MAX_PATH]; - PyW32_BEGIN_ALLOW_THREADS - BOOL ok = CeSHGetShortcutTarget(sc, target, _MAX_PATH); - PyW32_END_ALLOW_THREADS - PyObject *result; - if (ok) - result = PyWinObject_FromTCHAR(target); - else - result = PyWin_SetAPIError("CeSHGetShortcutTarget", GetLastCEError()); - PyWinObject_FreeTCHAR(sc); - return result; -} -%} -%native (CeSHGetShortcutTarget) PyCeSHGetShortcutTarget; - -%{ -// @pyswig (int,int,int,int,string)|CeGetVersionEx|Returns the current version of Windows, and information about the environment for the CE device. -static PyObject * -PyCeGetVersionEx(PyObject * self, PyObject * args) -{ - if (!PyArg_ParseTuple(args, ":GetVersionEx")) - return NULL; - CEOSVERSIONINFO ver; - ver.dwOSVersionInfoSize = sizeof(ver); - PyW32_BEGIN_ALLOW_THREADS - BOOL ok = ::CeGetVersionEx(&ver); - PyW32_END_ALLOW_THREADS - if (!ok) - return PyWin_SetAPIError("CeGetVersionEx", GetLastCEError()); - PyObject *textVersion = PyWinObject_FromTCHAR(ver.szCSDVersion); - PyObject *rc = Py_BuildValue("iiiiO", - // @rdesc The return value is a tuple with the following information. - ver.dwMajorVersion, // majorVersion - Identifies the major version number of the operating system. - ver.dwMinorVersion, // minorVersion - Identifies the minor version number of the operating system. - ver.dwBuildNumber, // buildNumber - Identifies the build number of the operating system in the low-order word. (The high-order word contains the major and minor version numbers.) - ver.dwPlatformId, // platformId - Identifies the platform supported by the operating system. May be one of VER_PLATFORM_WIN32s, VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT - textVersion); // version - Contains a string that provides arbitrary additional information about the operating system. - Py_XDECREF(textVersion); - return rc; -} -%} -%native (CeGetVersionEx) PyCeGetVersionEx; - -%{ -// @pyswig tuple|CeGlobalMemoryStatus|Returns information about current memory availability. -static PyObject * -PyCeGlobalMemoryStatus(PyObject * self, PyObject * args) -{ - if (!PyArg_ParseTuple(args, ":PyCeGetGlobalMemoryStatus")) - return NULL; - MEMORYSTATUS ms; - // No return code from fn, so zero memory! - memset(&ms, 0, sizeof(ms)); - ms.dwLength = sizeof(ms); - PyW32_BEGIN_ALLOW_THREADS - CeGlobalMemoryStatus(&ms); - PyW32_END_ALLOW_THREADS - return Py_BuildValue("lllllll", - // @rdesc The return value is a tuple with the following information. - ms.dwMemoryLoad, // MemoryLoad - Specifies a number between 0 and 100 that gives a general idea of current memory utilization, in which 0 indicates no memory use and 100 indicates full memory use. - ms.dwTotalPhys, // TotalPhys - Indicates the total number of bytes of physical memory. - ms.dwAvailPhys, // AvailPhys - Indicates the number of bytes of physical memory available. - ms.dwTotalPageFile, // TotalPageFile - Indicates the total number of bytes that can be stored in the paging file. Note that this number does not represent the actual physical size of the paging file on disk. - ms.dwAvailPageFile, // AvailPageFile - Indicates the number of bytes available in the paging file. - ms.dwTotalVirtual, // TotalVirtual - Indicates the total number of bytes that can be described in the user mode portion of the virtual address space of the calling process. - ms.dwAvailVirtual); // AvailVirtual - Indicates the number of bytes of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process. -} -%} -%native (CeGlobalMemoryStatus) PyCeGlobalMemoryStatus; - -%{ -// @pyswig list|FindFiles|Retrieves a list of matching filenames on the CE device. An interface to the API CeFindFirstFile/CeFindNextFile functions. -static PyObject * -PyCeFindFiles(PyObject *self, PyObject *args) -{ - PyObject *obFileSpec; - // @pyparm |fileSpec||A string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?). - - if (!PyArg_ParseTuple (args, "O:FindFiles", &obFileSpec)) - return NULL; - TCHAR *fileSpec; - if (!PyWinObject_AsTCHAR(obFileSpec, &fileSpec, FALSE)) - return NULL; - - CE_FIND_DATA findData; - // @pyseeapi CeFindFirstFile - HANDLE hFind; - PyW32_BEGIN_ALLOW_THREADS - hFind = ::CeFindFirstFile(fileSpec, &findData); - PyW32_END_ALLOW_THREADS - PyWinObject_FreeTCHAR(fileSpec); - if (hFind==INVALID_HANDLE_VALUE) { - if (::GetLastError()==ERROR_FILE_NOT_FOUND) { // this is OK - return PyList_New(0); - } - return PyWin_SetAPIError("CeFindFirstFile", GetLastCEError()); - } - PyObject *retList = PyList_New(0); - if (!retList) { - ::CeFindClose(hFind); - return NULL; - } - BOOL ok = TRUE; - while (ok) { - PyObject *obCreateTime = PyWinObject_FromFILETIME(findData.ftCreationTime); - PyObject *obAccessTime = PyWinObject_FromFILETIME(findData.ftLastAccessTime); - PyObject *obWriteTime = PyWinObject_FromFILETIME(findData.ftLastWriteTime); - PyObject *obFileName = PyWinObject_FromTCHAR(findData.cFileName); - if (obCreateTime==NULL || obAccessTime==NULL || obWriteTime==NULL || obFileName==NULL) { - Py_XDECREF(obCreateTime); - Py_XDECREF(obAccessTime); - Py_XDECREF(obWriteTime); - Py_XDECREF(obFileName); - Py_DECREF(retList); - ::CeFindClose(hFind); - return NULL; - } - PyObject *newItem = Py_BuildValue("lOOOllllOz", - // @rdesc The return value is a list of tuples, in the same format as the WIN32_FIND_DATA structure: - findData.dwFileAttributes, // @tupleitem 0|int|attributes|File Attributes. A combination of the win32com.FILE_ATTRIBUTE_* flags. - obCreateTime, // @tupleitem 1||createTime|File creation time. - obAccessTime, // @tupleitem 2||accessTime|File access time. - obWriteTime, // @tupleitem 3||writeTime|Time of last file write - findData.nFileSizeHigh, // @tupleitem 4|int|nFileSizeHigh|high order word of file size. - findData.nFileSizeLow, // @tupleitem 5|int|nFileSizeLow|low order word of file size. - findData.dwOID, // @tupleitem 6|int|OID|The object identifier for the file - 0, // @tupleitem 7|int|zero|Filler - obFileName, // @tupleitem 8|string|fileName|The name of the file. - NULL); // @tupleitem 9|None|altName|Always None - if (newItem!=NULL) { - PyList_Append(retList, newItem); - Py_DECREF(newItem); - } - // @pyseeapi FindNextFile - Py_XDECREF(obFileName); - Py_DECREF(obCreateTime); - Py_DECREF(obAccessTime); - Py_DECREF(obWriteTime); - PyW32_BEGIN_ALLOW_THREADS - ok=::CeFindNextFile(hFind, &findData); - PyW32_END_ALLOW_THREADS - } - ok = (GetLastCEError()==ERROR_NO_MORE_FILES); - // @pyseeapi CloseHandle - ::CeFindClose(hFind); - if (!ok) { - Py_DECREF(retList); - return PyWin_SetAPIError("CeFindNextFile", GetLastCEError()); - } - return retList; -} -%} -%native (CeFindFiles) PyCeFindFiles; - -%{ -// @pyswig int|CeGetFileAttributes|Determines a files attributes. -static PyObject * -PyCeGetFileAttributes(PyObject * self, PyObject * args) -{ - PyObject *obfname; - // @pyparm |fileName||Name of the file to retrieve attributes for. - if (!PyArg_ParseTuple(args, "O:CeGetFileAttributes", &obfname)) - return NULL; - TCHAR *fname; - if (!PyWinObject_AsTCHAR(obfname, &fname, FALSE)) - return NULL; - - PyW32_BEGIN_ALLOW_THREADS - DWORD rc = CeGetFileAttributes(fname); - PyW32_END_ALLOW_THREADS - - PyWinObject_FreeTCHAR(fname); - if (rc==(DWORD)-1) - return PyWin_SetAPIError("CeGetFileAttributes", GetLastCEError()); - - return PyLong_FromLong(rc); -} -%} -%native (CeGetFileAttributes) PyCeGetFileAttributes; - -// @pyswig |CeSetFileAttributes|Changes a file's attributes. -BOOLCEAPI CeSetFileAttributes( - TCHAR *lpFileName, // @pyparm |filename||filename - DWORD dwFileAttributes // @pyparm int|newAttributes||attributes to set -); - -%{ -static PyObject *PyCeGetFileSize(PyObject *self, PyObject *args) -{ - PyObject *obHandle; - if (!PyArg_ParseTuple(args, "O", &obHandle)) - return NULL; - HANDLE hFile; - if (!PyWinObject_AsCEHANDLE(obHandle, &hFile, FALSE)) - return NULL; - DWORD dwSizeLow=0, dwSizeHigh=0; - Py_BEGIN_ALLOW_THREADS - dwSizeLow = CeGetFileSize (hFile, &dwSizeHigh); - Py_END_ALLOW_THREADS - // If we failed ... - if (dwSizeLow == 0xFFFFFFFF && - GetLastCEError() != NO_ERROR ) - return PyWin_SetAPIError("GetFileSize"); - return PyLong_FromTwoInts(dwSizeHigh, dwSizeLow); -} - -%} -// @pyswig |CeGetFileSize|Determines the size of a file. -%native(CeGetFileSize) PyCeGetFileSize; - -// @pyswig string|CeReadFile|Reads a file from the CE device. -%{ -PyObject *PyCeReadFile(PyObject *self, PyObject *args) -{ - PyObject *obhFile; - PyObject *obOverlapped; - HANDLE hFile; - DWORD bufSize; - - if (!PyArg_ParseTuple(args, "Ol|O:CeReadFile", - &obhFile, // @pyparm /int|hFile||Handle to the file - &bufSize, // @pyparm int|bufSize||Size of the buffer to create for the read. - &obOverlapped)) - return NULL; - if (!PyWinObject_AsCEHANDLE(obhFile, &hFile, FALSE)) - return NULL; - - void *buf = malloc(bufSize); - if (buf==NULL) { - PyErr_SetString(PyExc_MemoryError, "Allocating read buffer"); - return NULL; - } - DWORD numRead; - BOOL ok; - Py_BEGIN_ALLOW_THREADS - ok = CeReadFile(hFile, buf, bufSize, &numRead, NULL); - Py_END_ALLOW_THREADS - if (!ok) { - free(buf); - return PyWin_SetAPIError("CeReadFile", GetLastCEError()); - } - return PyBytes_FromStringAndSize((char *)buf, numRead); -} -%} -%native (CeReadFile) PyCeReadFile; - - -%{ -// @pyswig int, int|WriteFile|Writes a string to a file -// @rdesc The result is a tuple of (errCode, nBytesWritten). -// errCode will always be zero (until overlapped IO is supported!) -PyObject *PyCeWriteFile(PyObject *self, PyObject *args) -{ - char *writeData; - Py_ssize_t dataSize; - PyObject *obOverlapped; - PyObject *obhFile; - if (!PyArg_ParseTuple(args, "Os#|O:CeWriteFile", - &obhFile, // @pyparm /int|hFile||Handle to the file - &writeData, // @pyparm string|data||The data to write. - &dataSize, - &obOverlapped)) - return NULL; - HANDLE hFile; - if (!PyWinObject_AsCEHANDLE(obhFile, &hFile, FALSE)) - return NULL; - DWORD numWritten; - BOOL ok; - Py_BEGIN_ALLOW_THREADS - ok = CeWriteFile(hFile, writeData, dataSize, &numWritten, NULL); - Py_END_ALLOW_THREADS - DWORD err = GetLastError(); - if (!ok) { - return PyWin_SetAPIError("CeWriteFile", GetLastCEError()); - } - return Py_BuildValue("ll", err, numWritten); -} -%} -%native (CeWriteFile) PyCeWriteFile; - -///////////////////////////////////////////////////////////////////////// -// -// Support for a remote handle. -// -%{ -#undef PyHANDLE -#undef PyCEHANDLE -#include "PyWinObjects.h" - -class PyCEHANDLE : public PyHANDLE -{ -public: - PyCEHANDLE(HANDLE hInit) : PyHANDLE(hInit) {} - virtual BOOL Close(void); - virtual const char *GetTypeName() {return "PyCEHANDLE";} -}; - -// A CE Remote handle. -// @object PyCEHANDLE|A Python object, representing a remote Windows CE handle -BOOL PyWinObject_AsCEHANDLE(PyObject *ob, HANDLE *pRes, BOOL bNoneOK) -{ - return PyWinObject_AsHANDLE(ob, pRes, bNoneOK); -} -PyObject *PyWinObject_FromCEHANDLE(HANDLE h) -{ - return new PyCEHANDLE(h); -} -// @pymethod |wincerapi|CEHANDLE|Creates a new CEHANDLE object -PyObject *PyWinMethod_NewCEHANDLE(PyObject *self, PyObject *args) -{ - HANDLE hInit; - if (!PyArg_ParseTuple(args, "|i:CEHANDLE", &hInit)) - return NULL; - return new PyCEHANDLE(hInit); -} - -BOOL PyWinObject_CloseCEHANDLE(PyObject *obHandle) -{ - BOOL ok; - if (PyHANDLE_Check(obHandle)) - ok = ((PyCEHANDLE *)obHandle)->Close(); - else if PyLong_Check(obHandle) { - PyW32_BEGIN_ALLOW_THREADS - long rc = ::CeCloseHandle((HANDLE)PyLong_AsLong(obHandle)); - PyW32_END_ALLOW_THREADS - ok = (rc==ERROR_SUCCESS); - if (!ok) - PyWin_SetAPIError("CeCloseHandle", rc); - } else { - PyErr_SetString(PyExc_TypeError, "A handle must be a CEHANDLE object or an integer"); - return FALSE; - } - return ok; -} - -// The non-static member functions -BOOL PyCEHANDLE::Close(void) -{ - BOOL ok = m_handle ? CeCloseHandle((HANDLE)m_handle) : TRUE; - m_handle = 0; - if (!ok) - PyWin_SetAPIError("CeCloseHandle", GetLastCEError()); - return ok; -} - -// Redefine them -#define PyHANDLE HANDLE -#define PyCEHANDLE HANDLE - -%} - -// End of CEHANDLE support. -// - -// Registry stuff externally implemented. -%{ -extern PyObject *PyCeRegCreateKeyEx(PyObject *self, PyObject *args); -extern PyObject *PyCeRegDeleteKey(PyObject *self, PyObject *args); -extern PyObject *PyCeRegDeleteValue(PyObject *self, PyObject *args); -extern PyObject *PyCeRegEnumKeyEx(PyObject *self, PyObject *args); -extern PyObject *PyCeRegEnumValue(PyObject *self, PyObject *args); -extern PyObject *PyCeRegOpenKeyEx(PyObject *self, PyObject *args); -extern PyObject *PyCeRegQueryInfoKey(PyObject *self, PyObject *args); -extern PyObject *PyCeRegQueryValueEx(PyObject *self, PyObject *args); -extern PyObject *PyCeRegSetValueEx(PyObject *self, PyObject *args); -extern PyObject *PyWinMethod_NewCEHKEY(PyObject *self, PyObject *args); -%} - -%native(CeRegCreateKeyEx) PyCeRegCreateKeyEx; -%native (CeRegDeleteKey) PyCeRegDeleteKey; -%native (CeRegDeleteValue) PyCeRegDeleteValue; -%native (CeRegEnumKeyEx) PyCeRegEnumKeyEx; -%native (CeRegEnumValue) PyCeRegEnumValue; -%native (CeRegOpenKeyEx) PyCeRegOpenKeyEx; -%native (CeRegQueryInfoKey) PyCeRegQueryInfoKey; -%native (CeRegQueryValueEx) PyCeRegQueryValueEx; -%native (CeRegSetValueEx) PyCeRegSetValueEx; -%native (CEHKEY) PyWinMethod_NewCEHKEY; -//////////////////////////////////////////////////////////////////////// -#define CSIDL_BITBUCKET CSIDL_BITBUCKET -// Recycle bin-file system directory containing file objects in the user's recycle bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it. -#define CSIDL_COMMON_DESKTOPDIRECTORY CSIDL_COMMON_DESKTOPDIRECTORY -// File system directory that contains files and folders that appear on the desktop for all users. -#define CSIDL_COMMON_PROGRAMS CSIDL_COMMON_PROGRAMS -// File system directory that contains the directories for the common program groups that appear on the Start menu for all users. -#define CSIDL_COMMON_STARTMENU CSIDL_COMMON_STARTMENU -// File system directory that contains the programs and folders that appear on the Start menu for all users. -#define CSIDL_COMMON_STARTUP CSIDL_COMMON_STARTUP -// File system directory that contains the programs that appear in the Startup folder for all users. The system starts these programs whenever any user logs on to a Windows desktop platform. -#define CSIDL_CONTROLS CSIDL_CONTROLS -// Control Panel-virtual folder containing icons for the control panel applications. -#define CSIDL_DESKTOP CSIDL_DESKTOP -// Windows desktop-virtual folder at the root of the name space. -#define CSIDL_DESKTOPDIRECTORY CSIDL_DESKTOPDIRECTORY -// File system directory used to physically store file objects on the desktop - not to be confused with the desktop folder itself. -#define CSIDL_DRIVES CSIDL_DRIVES -// My Computer-virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder can also contain mapped network drives. -#define CSIDL_FONTS CSIDL_FONTS -// Virtual folder containing fonts. -#define CSIDL_NETHOOD CSIDL_NETHOOD -// File system directory containing objects that appear in the network neighborhood. -#define CSIDL_NETWORK CSIDL_NETWORK -// Network Neighborhood-virtual folder representing the top level of the network hierarchy. -#define CSIDL_PERSONAL CSIDL_PERSONAL -// File system directory that serves as a common repository for documents. -#define CSIDL_PRINTERS CSIDL_PRINTERS -// Printers folder-virtual folder containing installed printers. -#define CSIDL_PROGRAMS CSIDL_PROGRAMS -// File system directory that contains the user's program groups which are also file system directories. -#define CSIDL_RECENT CSIDL_RECENT -// File system directory containing the user's most recently used documents. -#define CSIDL_SENDTO CSIDL_SENDTO -// File system directory containing Send To menu items. -#define CSIDL_STARTMENU CSIDL_STARTMENU -// File system directory containing Start menu items. -#define CSIDL_STARTUP CSIDL_STARTUP -// File system directory that corresponds to the user's Startup program group. -#define CSIDL_TEMPLATES CSIDL_TEMPLATES -// File system directory that serves as a common repository for document templates. diff --git a/win32/src/wincerapi_reg.cpp b/win32/src/wincerapi_reg.cpp deleted file mode 100644 index fa134e03aa..0000000000 --- a/win32/src/wincerapi_reg.cpp +++ /dev/null @@ -1,653 +0,0 @@ -#include "Windows.h" -#include "Python.h" -#include "PyWinTypes.h" -#include "PyWinObjects.h" -#include "Rapi.h" -#include "math.h" - -// Identical to PyW32_BEGIN_ALLOW_THREADS except no script "{" !!! -// means variables can be declared between the blocks -#define PyW32_BEGIN_ALLOW_THREADS PyThreadState *_save = PyEval_SaveThread(); -#define PyW32_END_ALLOW_THREADS PyEval_RestoreThread(_save); -#define PyW32_BLOCK_THREADS Py_BLOCK_THREADS - -class PyCEHKEY : public PyHANDLE { - public: - PyCEHKEY(HKEY hInit) : PyHANDLE((HANDLE)hInit) {} - virtual BOOL Close(void); - virtual const char *GetTypeName() { return "PyCEHKEY"; } -}; - -// @object PyCEHKEY|A Python object, representing a remote Windows CE Registry handle -BOOL PyWinObject_AsCEHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK = FALSE) -{ - return PyWinObject_AsHANDLE(ob, (HANDLE *)pRes, bNoneOK); -} -PyObject *PyWinObject_FromCEHKEY(HKEY h) { return new PyCEHKEY(h); } -// @pymethod |wincerapi|CEHKEY|Creates a new CEHKEY object -PyObject *PyWinMethod_NewCEHKEY(PyObject *self, PyObject *args) -{ - long hInit; - if (!PyArg_ParseTuple(args, "|l:CEHKEY", &hInit)) - return NULL; - return new PyCEHKEY((HKEY)hInit); -} - -BOOL PyWinObject_CloseCEHKEY(PyObject *obHandle) -{ - BOOL ok; - if (PyHANDLE_Check(obHandle)) - // Python error already set. - ok = ((PyCEHKEY *)obHandle)->Close(); - else if - PyLong_Check(obHandle) - { - PyW32_BEGIN_ALLOW_THREADS long rc = ::CeRegCloseKey((HKEY)PyLong_AsLong(obHandle)); - PyW32_END_ALLOW_THREADS ok = (rc == ERROR_SUCCESS); - if (!ok) - PyWin_SetAPIError("CeRegCloseKey", rc); - } - else { - PyErr_SetString(PyExc_TypeError, "A handle must be a CEHKEY object or an integer"); - return FALSE; - } - return ok; -} - -// The non-static member functions -BOOL PyCEHKEY::Close(void) -{ - long rc = m_handle ? CeRegCloseKey((HKEY)m_handle) : 0; - m_handle = 0; - if (rc != 0) - PyWin_SetAPIError("CeRegCloseKey", rc); - return rc == 0; -} - -////////////////////////////////////////////////////////////////// -// -// The methods. - -// @pymethod (, int)|wincerapi|CeRegCreateKeyEx|Creates the specified key, or opens the key if it already -// exists. -PyObject *PyCeRegCreateKeyEx(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obSubKey; - HKEY retKey; - long rc; - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|subKey||The name of a key that this method opens or creates. - // This key must be a subkey of the key identified by the key parameter. - // If key is one of the predefined keys, subKey may be None. In that case, - // the handle returned is the same hkey handle passed in to the function. - if (!PyArg_ParseTuple(args, "OO:CeRegCreateKeyEx", &obKey, &obSubKey)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *subKey; - if (!PyWinObject_AsTCHAR(obSubKey, &subKey, 1)) - return NULL; - // @pyseeapi CeRegCreateKey - DWORD disposition; - rc = CeRegCreateKeyEx(hKey, subKey, 0, NULL, 0, 0, NULL, &retKey, &disposition); - PyWinObject_FreeTCHAR(subKey); - if (rc != ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegCreateKey", rc); - PyObject *h = PyWinObject_FromCEHKEY(retKey); - PyObject *prc = Py_BuildValue("Oi", h, disposition); - Py_DECREF(h); - return prc; - // @rdesc The return value is the handle of the opened key, and a flag - // indicating if the key was opened or created. - // If the function fails, an exception is raised. -} -// @pymethod |wincerapi|CeRegDeleteKey|Deletes the specified key. This method can not delete keys with subkeys. -PyObject *PyCeRegDeleteKey(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obSubKey; - long rc; - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|subKey||The name of the key to delete. - // This key must be a subkey of the key identified by the key parameter. - // This value must not be None, and the key may not have subkeys. - if (!PyArg_ParseTuple(args, "OO:CeRegDeleteKey", &obKey, &obSubKey)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *subKey; - if (!PyWinObject_AsTCHAR(obSubKey, &subKey, 1)) - return NULL; - // @pyseeapi CeRegDeleteKey - rc = CeRegDeleteKey(hKey, subKey); - PyWinObject_FreeTCHAR(subKey); - if (rc != ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegDeleteKey", rc); - Py_INCREF(Py_None); - return Py_None; - // @comm If the method succeeds, the entire key, including all of its values, is removed. - // If the method fails, and exception is raised. -} -// @pymethod |wincerapi|CeRegDeleteValue|Removes a named value from the specified registry key. -PyObject *PyCeRegDeleteValue(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obSubKey; - long rc; - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|value||The name of the value to remove. - if (!PyArg_ParseTuple(args, "OO:CeRegDeleteValue", &obKey, &obSubKey)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *subKey; - if (!PyWinObject_AsTCHAR(obSubKey, &subKey, TRUE)) - return NULL; - // @pyseeapi CeRegDeleteValue - PyW32_BEGIN_ALLOW_THREADS rc = CeRegDeleteValue(hKey, subKey); - PyW32_END_ALLOW_THREADS PyWinObject_FreeTCHAR(subKey); - if (rc != ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegDeleteValue", rc); - Py_INCREF(Py_None); - return Py_None; -} -// @pymethod (string, string)|wincerapi|CeRegEnumKeyEx|Enumerates subkeys of the specified open registry key. The -// function retrieves the name of one subkey each time it is called. -PyObject *PyCeRegEnumKeyEx(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - int index; - long rc; - TCHAR *retBuf; - DWORD len; - - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm int|index||The index of the key to retrieve. - if (!PyArg_ParseTuple(args, "Oi:CeRegEnumKey", &obKey, &index)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - - if ((rc = CeRegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, &len, NULL, NULL, NULL, NULL, NULL, NULL)) != - ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegQueryInfoKey", rc); - ++len; // include null terminator - retBuf = (TCHAR *)malloc(len * sizeof(TCHAR)); - - // @pyseeapi CeRegEnumKey - PyObject *prc = NULL; - rc = CeRegEnumKeyEx(hKey, index, retBuf, &len, NULL, NULL, NULL, NULL); - if (rc == ERROR_SUCCESS) { - PyObject *r1 = PyWinObject_FromTCHAR(retBuf, len); - prc = Py_BuildValue("Oz", r1, NULL); // place-holder for class - Py_XDECREF(r1); - } - else - PyWin_SetAPIError("CeRegEnumKey", rc); - free(retBuf); - return prc; -} - -// Note that fixupMultiSZ and countString have both had changes -// made to support "incorrect strings". The registry specification -// calls for strings to be terminated with 2 null bytes. It seems -// some commercial packages install strings which dont conform, -// causing this code to fail - however, "regedit" etc still work -// with these strings (ie only we dont!). -static void fixupMultiSZ(TCHAR **str, TCHAR *data, int len) -{ - TCHAR *P; - int i; - TCHAR *Q; - - Q = data + len; - for (P = data, i = 0; P < Q && *P != _T('\0'); P++, i++) { - str[i] = P; - for (; *P != _T('\0'); P++) - ; - } -} - -static int countStrings(TCHAR *data, int len) -{ - int strings; - TCHAR *P; - TCHAR *Q = data + len; - - for (P = data, strings = 0; P < Q && *P != _T('\0'); P++, strings++) - for (; P < Q && *P != _T('\0'); P++) - ; - - return strings; -} - -/* Convert PyObject into Registry data. - Allocates space as needed. */ -static int Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize) -{ - int i, j; - switch (typ) { - case REG_DWORD: - if (value != Py_None && !PyLong_Check(value)) - return 0; - *retDataBuf = (BYTE *)PyMem_NEW(DWORD, 1); - *retDataSize = sizeof(DWORD); - if (value == Py_None) { - DWORD zero = 0; - memcpy(*retDataBuf, &zero, sizeof(DWORD)); - } - else - memcpy(*retDataBuf, &PyLong_AS_LONG((PyIntObject *)value), sizeof(DWORD)); - break; - case REG_SZ: - case REG_EXPAND_SZ: { - int numChars; - TCHAR *temp = NULL; - if (value == Py_None) - numChars = 1; - else { - if (!PyWinObject_AsTCHAR(value, &temp, 0)) - return 0; - numChars = _tcslen(temp) + 1; - } - *retDataSize = numChars * sizeof(TCHAR); - *retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize); - if (temp == NULL) - _tcscpy((TCHAR *)*retDataBuf, _T("")); - else - _tcscpy((TCHAR *)*retDataBuf, temp); - if (temp) - PyWinObject_FreeTCHAR(temp); - } break; - case REG_MULTI_SZ: { - DWORD cch = 0; - PyObject *t; - - if (value == Py_None) - i = 0; - else { - if (!PyList_Check(value)) - return 0; - i = PyList_Size(value); - } - for (j = 0; j < i; j++) { - t = PyList_GET_ITEM((PyListObject *)value, j); - TCHAR *temp; - if (!PyWinObject_AsTCHAR(t, &temp, 0)) - return 0; - cch += _tcslen(temp) + 1; - PyWinObject_FreeTCHAR(temp); - } - - cch++; // extra null. - *retDataSize = cch * sizeof(TCHAR); - *retDataBuf = (BYTE *)PyMem_NEW(TCHAR, *retDataSize); - TCHAR *P = (TCHAR *)*retDataBuf; - - for (j = 0; j < i; j++) { - t = PyList_GET_ITEM((PyListObject *)value, j); - TCHAR *temp = _T(""); - PyWinObject_AsTCHAR(t, &temp, 0); - _tcscpy(P, temp); - P += _tcslen(temp) + 1; - PyWinObject_FreeTCHAR(temp); - } - // And doubly-terminate the list... - *P = _T('\0'); - break; - } - case REG_BINARY: - // ALSO handle ALL unknown data types here. Even if we cant support - // it natively, we should handle the bits. - default: - if (value == Py_None) - *retDataSize = 0; - else { - if (!PyBytes_Check(value)) - return 0; - *retDataSize = PyBytes_Size(value); - *retDataBuf = (BYTE *)PyMem_NEW(char, *retDataSize); - memcpy(*retDataBuf, PyBytes_AS_STRING((PyStringObject *)value), *retDataSize); - } - break; - } - - return 1; -} - -/* Convert Registry data into PyObject*/ -PyObject *Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ) -{ - PyObject *obData; - // couple of helers used for strings. - int numChars = retDataSize / sizeof(TCHAR); - TCHAR *sz = (TCHAR *)retDataBuf; - - switch (typ) { - case REG_DWORD: - if (retDataSize == 0) - obData = Py_BuildValue("i", 0); - else - obData = Py_BuildValue("i", *(int *)retDataBuf); - break; - case REG_SZ: - case REG_EXPAND_SZ: - // retDataBuf may or may not have a trailing NULL in - // the buffer. - if (numChars && sz[numChars - 1] == _T('\0')) - --numChars; - if (numChars == 0) - sz = _T(""); - obData = PyWinObject_FromTCHAR(sz, numChars); - break; - case REG_MULTI_SZ: - if (retDataSize == 0) - obData = PyList_New(0); - else { - int index = 0; - int s = countStrings(sz, numChars); - TCHAR **str = (TCHAR **)malloc(sizeof(TCHAR *) * s); - - fixupMultiSZ(str, sz, numChars); - obData = PyList_New(s); - for (index = 0; index < s; index++) { - PyObject *n = PyWinObject_FromTCHAR(str[index]); - PyList_SetItem(obData, index, n); - } - free(str); - break; - } - case REG_BINARY: - // ALSO handle ALL unknown data types here. Even if we cant support - // it natively, we should handle the bits. - default: - if (retDataSize == 0) { - Py_INCREF(Py_None); - obData = Py_None; - } - else - obData = PyBuffer_FromMemory(retDataBuf, retDataSize); - break; - } - if (obData == NULL) - return NULL; - else - return obData; -} - -// @pymethod (string,object,type)|wincerapi|CeRegEnumValue|Enumerates values of the specified open registry key. The -// function retrieves the name of one subkey each time it is called. -PyObject *PyCeRegEnumValue(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - int index; - long rc; - TCHAR *retValueBuf = NULL; - BYTE *retDataBuf = NULL; - DWORD retValueSize; - DWORD retDataSize = 1024; - DWORD typ; - PyObject *prc = NULL; - PyObject *obData = NULL; - PyObject *obValueBuf = NULL; - - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm int|index||The index of the key to retrieve. - // @pyparm int|bufSize|1024|The size of the buffer to allocate for the result. - - if (!PyArg_ParseTuple(args, "Oi|i:CeRegEnumValue", &obKey, &index, &retDataSize)) - goto done; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - goto done; - - if ((rc = CeRegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &retValueSize, NULL, NULL, NULL)) != - ERROR_SUCCESS) { - PyWin_SetAPIError("CeRegQueryInfoKey", rc); - goto done; - } - // retValueSize is in characters. - ++retValueSize; // include null terminators - retValueBuf = (TCHAR *)malloc(retValueSize * sizeof(TCHAR)); - retDataBuf = (BYTE *)malloc(retDataSize); - if (retValueBuf == NULL || retDataBuf == NULL) { - PyErr_NoMemory(); - goto done; - } - - // @pyseeapi CeRegEnumValue - { - PyW32_BEGIN_ALLOW_THREADS rc = - CeRegEnumValue(hKey, index, retValueBuf, &retValueSize, NULL, &typ, (BYTE *)retDataBuf, &retDataSize); - PyW32_END_ALLOW_THREADS - } - if (rc != ERROR_SUCCESS) { - PyWin_SetAPIError("CeRegEnumValue", rc); - goto done; - } - obData = Reg2Py(retDataBuf, retDataSize, typ); - if (obData == NULL) - goto done; - obValueBuf = PyWinObject_FromTCHAR(retValueBuf, retValueSize); - if (obValueBuf == NULL) - goto done; - prc = Py_BuildValue("OOi", obValueBuf, obData, typ); -done: - Py_XDECREF(obValueBuf); - Py_XDECREF(obData); - if (retValueBuf) - free(retValueBuf); - if (retDataBuf) - free(retDataBuf); - return prc; - // @comm This function is typically called repeatedly, until an exception is raised, indicating no more values. -} - -// @pymethod |wincerapi|CeRegOpenKeyEx|Opens the specified key. -PyObject *PyCeRegOpenKeyEx(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obSubKey; - - int res = 0; - HKEY retKey; - long rc; - REGSAM sam = KEY_READ; - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|subKey||The name of a key that this method opens. - // This key must be a subkey of the key identified by the key parameter. - // If key is one of the predefined keys, subKey may be None. In that case, - // the handle returned is the same key handle passed in to the function. - // @pyparm int|reserved|0|Reserved. Must be zero. - // @pyparm int|sam|KEY_READ|Specifies an access mask that describes the desired security access for the new key. - // This parameter can be a combination of the following win32con constants: - // KEY_ALL_ACCESSKEY_CREATE_LINKKEY_CREATE_SUB_KEYKEY_ENUMERATE_SUB_KEYSKEY_EXECUTEKEY_NOTIFYKEY_QUERY_VALUEKEY_READKEY_SET_VALUEKEY_WRITE - if (!PyArg_ParseTuple(args, "OO|ii:CeRegOpenKeyEx", &obKey, &obSubKey, &res, &sam)) - return NULL; - // @pyseeapi CeRegOpenKeyEx - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *subKey; - if (!PyWinObject_AsTCHAR(obSubKey, &subKey, 1)) - return NULL; - - PyW32_BEGIN_ALLOW_THREADS rc = CeRegOpenKeyEx(hKey, subKey, res, sam, &retKey); - PyW32_END_ALLOW_THREADS PyWinObject_FreeTCHAR(subKey); - if (rc != ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegOpenKeyEx", rc); - return PyWinObject_FromCEHKEY(retKey); - - // @rdesc The return value is the handle of the opened key. - // If the function fails, an exception is raised. -} - -static double LI2double(LARGE_INTEGER *li) -{ - double d = li->LowPart; - d = d + pow(2.0, 32.0) * li->HighPart; - return d; -} - -// @pymethod (int, int, long)|wincerapi|CeRegQueryInfoKey|Returns the number of -// subkeys, the number of values a key has, -// and if available the last time the key was modified as -// 100's of nanoseconds since Jan 1, 1600. -PyObject *PyCeRegQueryInfoKey(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - long rc; - DWORD nSubKeys, nValues; - FILETIME ft; - LARGE_INTEGER li; - PyObject *l; - - // @pyparm /int|key||An already open key, or or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - if (!PyArg_ParseTuple(args, "O:CeRegQueryInfoKey", &obKey)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - // @pyseeapi CeRegQueryInfoKey - if ((rc = CeRegQueryInfoKey(hKey, NULL, NULL, 0, &nSubKeys, NULL, NULL, &nValues, NULL, NULL, NULL, &ft)) != - ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegQueryInfoKey", rc); - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - if (!(l = PyLong_FromDouble(LI2double(&li)))) - return NULL; - return Py_BuildValue("iiO", nSubKeys, nValues, l); -} - -// @pymethod (object,type)|wincerapi|CeRegQueryValueEx|Retrieves the type and data for a specified value name associated -// with an open registry key. -PyObject *PyCeRegQueryValueEx(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obValueName; - - long rc; - BYTE *retBuf; - DWORD bufSize; - DWORD typ; - - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|valueName||The name of the value to query. - if (!PyArg_ParseTuple(args, "OO:CeRegQueryValueEx", &obKey, &obValueName)) - return NULL; - // @pyseeapi CeRegQueryValueEx - - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *valueName; - if (!PyWinObject_AsTCHAR(obValueName, &valueName, 1)) - return NULL; - if ((rc = CeRegQueryValueEx(hKey, valueName, NULL, NULL, NULL, &bufSize)) != ERROR_SUCCESS) { - PyWinObject_FreeTCHAR(valueName); - return PyWin_SetAPIError("CeRegQueryValueEx", rc); - } - retBuf = (BYTE *)malloc(bufSize); - if (retBuf == NULL) - return PyErr_NoMemory(); - - rc = CeRegQueryValueEx(hKey, valueName, NULL, &typ, retBuf, &bufSize); - PyWinObject_FreeTCHAR(valueName); - if (rc != ERROR_SUCCESS) { - free(retBuf); - return PyWin_SetAPIError("CeRegQueryValueEx", rc); - } - PyObject *obData = Reg2Py(retBuf, bufSize, typ); - free(retBuf); - if (obData == NULL) - return NULL; - PyObject *result = Py_BuildValue("Oi", obData, typ); - Py_DECREF(obData); - return result; - // @comm Values in the registry have name, type, and data components. This method - // retrieves the data for the given value. -} - -// @pymethod |wincerapi|CeRegSetValueEx|Stores data in the value field of an open registry key. -PyObject *PyCeRegSetValueEx(PyObject *self, PyObject *args) -{ - HKEY hKey; - PyObject *obKey; - PyObject *obValueName; - PyObject *obRes; - PyObject *value; - BYTE *data; - DWORD len; - DWORD typ; - - DWORD rc; - - // @pyparm /int|key||An already open key, or any one of the following win32con - // constants:HKEY_CLASSES_ROOTHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERS - // @pyparm string|valueName||The name of the value to set. - // If a value with this name is not already present in the key, the method adds it to the key. - // If this parameter is None or an empty string and the type parameter is the wincerapi.REG_SZ type, this - // function sets the same value the method would set. - // @pyparm any|reserved||Place holder for reserved argument. Zero will always be passed to the API function. - // @pyparm int|type||Type of data. - // @flagh Value|Meaning - // @flag REG_BINARY|Binary data in any form. - // @flag REG_DWORD|A 32-bit number. - // @flag REG_DWORD_LITTLE_ENDIAN|A 32-bit number in little-endian format. This is equivalent to REG_DWORD.In - // little-endian format, a multi-byte value is stored in memory from the lowest byte (the little end) to the highest - // byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format. Windows NT - // and Windows 95 are designed to run on little-endian computer architectures. A user may connect to computers that - // have big-endian architectures, such as some UNIX systems. - // @flag REG_DWORD_BIG_ENDIAN|A 32-bit number in big-endian format. - // In big-endian format, a multi-byte value is stored in memory from the highest byte (the big end) to the lowest - // byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format. - // @flag REG_EXPAND_SZ|A null-terminated string that contains unexpanded references to environment variables (for - // example, %PATH%). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions. - // @flag REG_LINK|A Unicode symbolic link. - // @flag REG_MULTI_SZ|An array of null-terminated strings, terminated by two null characters. - // @flag REG_NONE|No defined value type. - // @flag REG_RESOURCE_LIST|A device-driver resource list. - // @flag REG_SZ|A null-terminated string. It will be a Unicode or ANSI string depending on whether you use the - // Unicode or ANSI functions - - // @pyparm registry data|value||The value to be stored with the specified value name. - if (!PyArg_ParseTuple(args, "OOOiO:CeRegSetValueEx", &obKey, &obValueName, &obRes, &typ, &value)) - return NULL; - if (!PyWinObject_AsCEHKEY(obKey, &hKey)) - return NULL; - TCHAR *valueName; - if (!PyWinObject_AsTCHAR(obValueName, &valueName)) - return NULL; - // @pyseeapi CeRegSetValueEx - if (!Py2Reg(value, typ, &data, &len)) { - PyWinObject_FreeTCHAR(valueName); - PyErr_SetObject(PyExc_ValueError, Py_BuildValue("sO", "Data didn't match Registry Type", data)); - return NULL; - } - PyW32_BEGIN_ALLOW_THREADS rc = CeRegSetValueEx(hKey, valueName, NULL, typ, data, len); - PyW32_END_ALLOW_THREADS PyWinObject_FreeTCHAR(valueName); - if (rc != ERROR_SUCCESS) - return PyWin_SetAPIError("CeRegSetValueEx", rc); - Py_INCREF(Py_None); - return Py_None; - // @comm This method can also set additional value and type information for the specified key. - // The key identified by the key parameter must have been opened with KEY_SET_VALUE access. - // To open the key, use the or methods. - // Value lengths are limited by available memory. - // Long values (more than 2048 bytes) should be stored as files with the filenames stored in the configuration - // registry. This helps the registry perform efficiently. The key identified by the key parameter must have been - // opened with KEY_SET_VALUE access. -} diff --git a/win32/test/testall.py b/win32/test/testall.py index 334dc0d91d..c66a89887a 100644 --- a/win32/test/testall.py +++ b/win32/test/testall.py @@ -15,12 +15,11 @@ win32gui_devicenotify NetValidatePasswordPolicy""".split() # Other demos known as 'bad' (or at least highly unlikely to work) -# cerapi: no CE module is built (CE via pywin32 appears dead) # desktopmanager: hangs (well, hangs for 60secs or so...) # EvtSubscribe_*: must be run together: # SystemParametersInfo: a couple of the params cause markh to hang, and there's # no great reason to adjust (twice!) all those system settings! -bad_demos = """cerapi desktopmanager win32comport_demo +bad_demos = """desktopmanager win32comport_demo EvtSubscribe_pull EvtSubscribe_push SystemParametersInfo """.split() diff --git a/win32/wincerapi.dsp b/win32/wincerapi.dsp deleted file mode 100644 index 5111bac831..0000000000 --- a/win32/wincerapi.dsp +++ /dev/null @@ -1,133 +0,0 @@ -# Microsoft Developer Studio Project File - Name="wincerapi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=wincerapi - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "wincerapi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "wincerapi.mak" CFG="wincerapi - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "wincerapi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "wincerapi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "Desktop" -# PROP WCE_FormatVersion "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "wincerapi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\wincerapi\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\wincerapi\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_UNICODE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 rapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Build/wincerapi.pyd" - -!ELSEIF "$(CFG)" == "wincerapi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\wincerapi\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\wincerapi\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "__WIN32__" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_UNICODE" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 rapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Build/wincerapi_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "wincerapi - Win32 Release" -# Name "wincerapi - Win32 Debug" -# Begin Source File - -SOURCE=.\src\wincerapi.i - -!IF "$(CFG)" == "wincerapi - Win32 Release" - -# Begin Custom Build - Invoking SWIG... -InputDir=.\src -InputPath=.\src\wincerapi.i -InputName=wincerapi - -"$(InputDir)\$(InputName)module.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ..\swig.bat $(InputDir) -python -c++ -o $(InputName)module.cpp $(InputName).i - -# End Custom Build - -!ELSEIF "$(CFG)" == "wincerapi - Win32 Debug" - -# Begin Custom Build - Invoking SWIG... -InputDir=.\src -InputPath=.\src\wincerapi.i -InputName=wincerapi - -"$(InputDir)\$(InputName)module.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ..\swig.bat $(InputDir) -python -c++ -o $(InputName)module.cpp $(InputName).i - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\src\wincerapi_reg.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\wincerapimodule.cpp -# End Source File -# End Target -# End Project