Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11284/win32/src
Modified Files:
PyWinTypes.h PyWinTypesmodule.cpp mmapfilemodule.cpp odbc.cpp
timermodule.cpp win2krasmodule.cpp win32apimodule.cpp
win32clipboardmodule.cpp win32consolemodule.cpp
win32credmodule.cpp win32helpmodule.cpp win32lzmodule.cpp
win32pdhmodule.cpp win32rasmodule.cpp win32trace.cpp
win32transactionmodule.cpp win32tsmodule.cpp
Log Message:
py3k friendly: PYWIN_MODULE_* macros to help with module's init etc.
Index: odbc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** odbc.cpp 6 Dec 2008 00:43:19 -0000 1.28
--- odbc.cpp 8 Dec 2008 13:16:37 -0000 1.29
***************
*** 2002,2038 ****
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR;
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initodbc(void)
! #else
! PyObject *PyInit_odbc(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("odbc", globalMethods);
!
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef odbc_def = {
! PyModuleDef_HEAD_INIT,
! "odbc",
! "A Python wrapper around the ODBC API.",
! -1,
! globalMethods
! };
! module = PyModule_Create(&odbc_def);
! #endif
!
! if (!module)
! RETURN_ERROR;
! dict = PyModule_GetDict(module);
! if (!dict)
! RETURN_ERROR;
// Sql dates are now returned as python's datetime object.
--- 2002,2011 ----
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_FUNC(odbc)
{
! PYWIN_MODULE_INIT_PREPARE(odbc, globalMethods,
! "A Python wrapper around the ODBC API.");
// Sql dates are now returned as python's datetime object.
***************
*** 2040,2052 ****
datetime_module=PyImport_ImportModule("datetime");
if (datetime_module == NULL)
! RETURN_ERROR;
datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
if (datetime_class == NULL)
! RETURN_ERROR;
if (unsuccessful(SQLAllocEnv(&Env)))
{
odbcPrintError(SQL_NULL_HENV, 0, SQL_NULL_HSTMT, _T("INIT"));
! RETURN_ERROR;
}
--- 2013,2025 ----
datetime_module=PyImport_ImportModule("datetime");
if (datetime_module == NULL)
! PYWIN_MODULE_INIT_RETURN_ERROR;
datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
if (datetime_class == NULL)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (unsuccessful(SQLAllocEnv(&Env)))
{
odbcPrintError(SQL_NULL_HENV, 0, SQL_NULL_HSTMT, _T("INIT"));
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
***************
*** 2065,2069 ****
// Steals a ref to obtypes, so it doesn't need to be DECREF'ed.
if (obtypes==NULL || PyModule_AddObject(module, "TYPES", obtypes) == -1)
! RETURN_ERROR;
DbiString = PyTuple_GET_ITEM(obtypes, 0);
DbiRaw = PyTuple_GET_ITEM(obtypes, 1);
--- 2038,2042 ----
// Steals a ref to obtypes, so it doesn't need to be DECREF'ed.
if (obtypes==NULL || PyModule_AddObject(module, "TYPES", obtypes) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiString = PyTuple_GET_ITEM(obtypes, 0);
DbiRaw = PyTuple_GET_ITEM(obtypes, 1);
***************
*** 2077,2104 ****
||PyDict_SetItem(dict, DbiNumber, DbiNumber) == -1
||PyDict_SetItem(dict, DbiDate, DbiDate) == -1)
! RETURN_ERROR;
// Initialize various exception types
odbcError = PyErr_NewException("odbc.odbcError", NULL, NULL);
if (odbcError == NULL || PyDict_SetItemString(dict, "error", odbcError) == -1)
! RETURN_ERROR;
DbiNoError = PyErr_NewException("dbi.noError", NULL, NULL);
if (DbiNoError == NULL || PyDict_SetItemString(dict, "noError", DbiNoError) == -1)
! RETURN_ERROR;
DbiOpError = PyErr_NewException("dbi.opError", NULL, NULL);
if (DbiOpError == NULL || PyDict_SetItemString(dict, "opError", DbiOpError) == -1)
! RETURN_ERROR;
DbiProgError = PyErr_NewException("dbi.progError", NULL, NULL);
if (DbiProgError == NULL || PyDict_SetItemString(dict, "progError", DbiProgError) == -1)
! RETURN_ERROR;
DbiIntegrityError = PyErr_NewException("dbi.integrityError", NULL, NULL);
if (DbiIntegrityError == NULL || PyDict_SetItemString(dict, "integrityError", DbiIntegrityError) == -1)
! RETURN_ERROR;
DbiDataError = PyErr_NewException("dbi.dataError", NULL, NULL);
if (DbiDataError == NULL || PyDict_SetItemString(dict, "dataError", DbiDataError) == -1)
! RETURN_ERROR;
DbiInternalError = PyErr_NewException("dbi.internalError", NULL, NULL);
if (DbiInternalError == NULL || PyDict_SetItemString(dict, "internalError", DbiInternalError) == -1)
! RETURN_ERROR;
/* The indices go to indices in the ODBC error table */
dbiErrors[0] = DbiNoError;
--- 2050,2077 ----
||PyDict_SetItem(dict, DbiNumber, DbiNumber) == -1
||PyDict_SetItem(dict, DbiDate, DbiDate) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
// Initialize various exception types
odbcError = PyErr_NewException("odbc.odbcError", NULL, NULL);
if (odbcError == NULL || PyDict_SetItemString(dict, "error", odbcError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiNoError = PyErr_NewException("dbi.noError", NULL, NULL);
if (DbiNoError == NULL || PyDict_SetItemString(dict, "noError", DbiNoError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiOpError = PyErr_NewException("dbi.opError", NULL, NULL);
if (DbiOpError == NULL || PyDict_SetItemString(dict, "opError", DbiOpError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiProgError = PyErr_NewException("dbi.progError", NULL, NULL);
if (DbiProgError == NULL || PyDict_SetItemString(dict, "progError", DbiProgError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiIntegrityError = PyErr_NewException("dbi.integrityError", NULL, NULL);
if (DbiIntegrityError == NULL || PyDict_SetItemString(dict, "integrityError", DbiIntegrityError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiDataError = PyErr_NewException("dbi.dataError", NULL, NULL);
if (DbiDataError == NULL || PyDict_SetItemString(dict, "dataError", DbiDataError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiInternalError = PyErr_NewException("dbi.internalError", NULL, NULL);
if (DbiInternalError == NULL || PyDict_SetItemString(dict, "internalError", DbiInternalError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
/* The indices go to indices in the ODBC error table */
dbiErrors[0] = DbiNoError;
***************
*** 2118,2124 ****
ADD_CONSTANT(SQL_FETCH_FIRST_SYSTEM);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 2091,2095 ----
ADD_CONSTANT(SQL_FETCH_FIRST_SYSTEM);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32rasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32rasmodule.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** win32rasmodule.cpp 6 Dec 2008 00:21:07 -0000 1.13
--- win32rasmodule.cpp 8 Dec 2008 13:16:38 -0000 1.14
***************
*** 832,849 ****
}
! extern "C" __declspec(dllexport) void
! initwin32ras(void)
{
! PyWinGlobals_Ensure();
! PyObject *dict, *module;
! module = Py_InitModule("win32ras", win32ras_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return;
! module_error = PyWinExc_ApiError;
! Py_INCREF(module_error);
! // module_error = PyString_FromString("win32ras error");
! PyDict_SetItemString(dict, "error", module_error);
! AddConstants(module);
}
--- 832,848 ----
}
! PYWIN_MODULE_INIT_FUNC(win32ras)
{
! PYWIN_MODULE_INIT_PREPARE(win32ras, win32ras_functions,
! "A module encapsulating the Windows Remote Access Service (RAS) API.");
!
! module_error = PyWinExc_ApiError;
! Py_INCREF(module_error);
! PyDict_SetItemString(dict, "error", module_error);
! if (PyType_Ready(&PyRASDIALEXTENSIONS::type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32trace.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** win32trace.cpp 3 Dec 2008 22:34:21 -0000 1.17
--- win32trace.cpp 8 Dec 2008 13:16:38 -0000 1.18
***************
*** 604,619 ****
};
! extern "C" __declspec(dllexport) void
! initwin32trace(void)
{
! PyWinGlobals_Ensure();
! PyObject *dict;
! PyObject* pModMe = Py_InitModule("win32trace", win32trace_functions);
! #define RETURN_ERROR return // towards py3k
! if (!pModMe) return;
! dict = PyModule_GetDict(pModMe);
! if (!dict) return;
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
// Allocate memory for the security descriptor.
--- 604,616 ----
};
! PYWIN_MODULE_INIT_FUNC(win32trace)
{
! PYWIN_MODULE_INIT_PREPARE(win32trace, win32trace_functions,
! "Interface to the Windows Console functions for dealing with character-mode applications.");
! if (PyType_Ready(&PyTraceObjectType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
// Allocate memory for the security descriptor.
***************
*** 670,674 ****
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! RETURN_ERROR ;
}
assert (hEvent==NULL);
--- 667,671 ----
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
assert (hEvent==NULL);
***************
*** 676,680 ****
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR;
}
assert (hEventEmpty==NULL);
--- 673,677 ----
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
assert (hEventEmpty==NULL);
***************
*** 682,686 ****
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR ;
}
}
--- 679,684 ----
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: mmapfilemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/mmapfilemodule.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mmapfilemodule.cpp 3 Dec 2008 22:34:21 -0000 1.6
--- mmapfilemodule.cpp 8 Dec 2008 13:16:37 -0000 1.7
***************
*** 634,649 ****
};
! extern"C" __declspec(dllexport) void
! initmmapfile(void)
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! module = Py_InitModule ("mmapfile", mmapfile_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict (module);
! if (!dict) return; /* Another serious error!*/
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
}
--- 634,647 ----
};
! PYWIN_MODULE_INIT_FUNC(mmapfile)
{
! PYWIN_MODULE_INIT_PREPARE(mmapfile, mmapfile_functions,
! "Compiled extension module that provides access to the memory mapped file API");
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyType_Ready(&mmapfile_object_type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32apimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** win32apimodule.cpp 4 Dec 2008 00:17:13 -0000 1.91
--- win32apimodule.cpp 8 Dec 2008 13:16:37 -0000 1.92
***************
*** 6194,6208 ****
};
! extern "C" __declspec(dllexport) void
! initwin32api(void)
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! module = Py_InitModule("win32api", win32api_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
PyDict_SetItemString(dict,"STD_INPUT_HANDLE",
--- 6194,6202 ----
};
! PYWIN_MODULE_INIT_FUNC(win32api)
{
! PYWIN_MODULE_INIT_PREPARE(win32api, win32api_functions,
! "Wraps general API functions that are not subsumed in the more specific modules");
!
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
PyDict_SetItemString(dict,"STD_INPUT_HANDLE",
***************
*** 6212,6216 ****
PyDict_SetItemString(dict,"STD_ERROR_HANDLE",
PyInt_FromLong(STD_ERROR_HANDLE));
! PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType);
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
PyModule_AddIntConstant(module, "NameFullyQualifiedDN", NameFullyQualifiedDN);
--- 6206,6214 ----
PyDict_SetItemString(dict,"STD_ERROR_HANDLE",
PyInt_FromLong(STD_ERROR_HANDLE));
!
! if (PyType_Ready(&PyDISPLAY_DEVICEType) == -1
! || PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
PyModule_AddIntConstant(module, "NameFullyQualifiedDN", NameFullyQualifiedDN);
***************
*** 6317,6319 ****
}
! }
--- 6315,6318 ----
}
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
! }
Index: win32clipboardmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** win32clipboardmodule.cpp 26 Nov 2008 01:11:54 -0000 1.24
--- win32clipboardmodule.cpp 8 Dec 2008 13:16:37 -0000 1.25
***************
*** 1182,1198 ****
}
!
! extern "C" __declspec(dllexport) void
! initwin32clipboard(void)
{
! PyObject *dict, *module;
! module = Py_InitModule("win32clipboard", clipboard_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! PyWinGlobals_Ensure();
! AddConstants(module);
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
}
--- 1182,1202 ----
}
! PYWIN_MODULE_INIT_FUNC(win32clipboard)
{
! PYWIN_MODULE_INIT_PREPARE(win32clipboard, clipboard_functions,
! "A module which supports the Windows Clipboard API.");
!
! if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict,"UNICODE",
! #ifdef UNICODE
! Py_True
! #else
! Py_False
! #endif
! )==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32consolemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** win32consolemodule.cpp 4 Dec 2008 00:17:13 -0000 1.16
--- win32consolemodule.cpp 8 Dec 2008 13:16:37 -0000 1.17
***************
*** 2053,2062 ****
! extern "C" __declspec(dllexport) void
! initwin32console(void)
{
! PyObject *dict, *mod;
! PyWinGlobals_Ensure();
! mod = Py_InitModule("win32console", win32console_functions);
// load function pointers
--- 2053,2062 ----
! PYWIN_MODULE_INIT_FUNC(win32console)
{
! PYWIN_MODULE_INIT_PREPARE(win32console, win32console_functions,
! "Interface to the Windows Console functions for dealing with character-mode applications.");
!
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
// load function pointers
***************
*** 2082,2150 ****
}
- dict = PyModule_GetDict(mod);
- Py_INCREF(PyWinExc_ApiError);
- PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
- PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType);
- PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType);
- PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType);
- PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType);
- PyModule_AddIntConstant(mod, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
- PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN", CONSOLE_FULLSCREEN);
- PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN_HARDWARE", CONSOLE_FULLSCREEN_HARDWARE);
- PyModule_AddIntConstant(mod, "ATTACH_PARENT_PROCESS", ATTACH_PARENT_PROCESS);
! PyModule_AddIntConstant(mod, "ENABLE_LINE_INPUT", ENABLE_LINE_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_ECHO_INPUT", ENABLE_ECHO_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_PROCESSED_INPUT", ENABLE_PROCESSED_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_WINDOW_INPUT", ENABLE_WINDOW_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_MOUSE_INPUT", ENABLE_MOUSE_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT);
! PyModule_AddIntConstant(mod, "ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT);
// text attribute flags - ?????? COMMON_* flags don't seem to do anything ??????
! PyModule_AddIntConstant(mod, "FOREGROUND_BLUE", FOREGROUND_BLUE);
! PyModule_AddIntConstant(mod, "FOREGROUND_GREEN", FOREGROUND_GREEN);
! PyModule_AddIntConstant(mod, "FOREGROUND_RED", FOREGROUND_RED);
! PyModule_AddIntConstant(mod, "FOREGROUND_INTENSITY", FOREGROUND_INTENSITY);
! PyModule_AddIntConstant(mod, "BACKGROUND_BLUE", BACKGROUND_BLUE);
! PyModule_AddIntConstant(mod, "BACKGROUND_GREEN", BACKGROUND_GREEN);
! PyModule_AddIntConstant(mod, "BACKGROUND_RED", BACKGROUND_RED);
! PyModule_AddIntConstant(mod, "BACKGROUND_INTENSITY", BACKGROUND_INTENSITY);
! PyModule_AddIntConstant(mod, "COMMON_LVB_LEADING_BYTE", COMMON_LVB_LEADING_BYTE);
! PyModule_AddIntConstant(mod, "COMMON_LVB_TRAILING_BYTE", COMMON_LVB_TRAILING_BYTE);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_HORIZONTAL", COMMON_LVB_GRID_HORIZONTAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_LVERTICAL", COMMON_LVB_GRID_LVERTICAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_RVERTICAL", COMMON_LVB_GRID_RVERTICAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_REVERSE_VIDEO", COMMON_LVB_REVERSE_VIDEO);
! PyModule_AddIntConstant(mod, "COMMON_LVB_UNDERSCORE", COMMON_LVB_UNDERSCORE);
// selection flags for GetConsoleSelectionInfo
! PyModule_AddIntConstant(mod, "CONSOLE_NO_SELECTION", CONSOLE_NO_SELECTION);
! PyModule_AddIntConstant(mod, "CONSOLE_SELECTION_IN_PROGRESS", CONSOLE_SELECTION_IN_PROGRESS);
! PyModule_AddIntConstant(mod, "CONSOLE_SELECTION_NOT_EMPTY", CONSOLE_SELECTION_NOT_EMPTY);
! PyModule_AddIntConstant(mod, "CONSOLE_MOUSE_SELECTION", CONSOLE_MOUSE_SELECTION);
! PyModule_AddIntConstant(mod, "CONSOLE_MOUSE_DOWN", CONSOLE_MOUSE_DOWN);
! PyModule_AddIntConstant(mod, "LOCALE_USER_DEFAULT", LOCALE_USER_DEFAULT);
// event types for INPUT_RECORD
! PyModule_AddIntConstant(mod, "KEY_EVENT", KEY_EVENT);
! PyModule_AddIntConstant(mod, "MOUSE_EVENT", MOUSE_EVENT);
! PyModule_AddIntConstant(mod, "WINDOW_BUFFER_SIZE_EVENT", WINDOW_BUFFER_SIZE_EVENT);
! PyModule_AddIntConstant(mod, "MENU_EVENT", MENU_EVENT);
! PyModule_AddIntConstant(mod, "FOCUS_EVENT", FOCUS_EVENT);
// Control events for GenerateConsoleCtrlEvent
! PyModule_AddIntConstant(mod, "CTRL_C_EVENT", CTRL_C_EVENT);
! PyModule_AddIntConstant(mod, "CTRL_BREAK_EVENT", CTRL_BREAK_EVENT);
// std handles
! PyModule_AddIntConstant(mod, "STD_INPUT_HANDLE", STD_INPUT_HANDLE);
! PyModule_AddIntConstant(mod, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
! PyModule_AddIntConstant(mod, "STD_ERROR_HANDLE", STD_ERROR_HANDLE);
// flags used with SetConsoleDisplayMode
// ?????? these aren't in my SDK headers
! PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN_MODE", 1);
! PyModule_AddIntConstant(mod, "CONSOLE_WINDOWED_MODE", 2);
}
--- 2082,2166 ----
}
! if (PyType_Ready(&PyConsoleScreenBufferType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! if (PyType_Ready(&PySMALL_RECTType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! if (PyType_Ready(&PyCOORDType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! if (PyType_Ready(&PyINPUT_RECORDType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PyModule_AddIntConstant(module, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN", CONSOLE_FULLSCREEN);
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN_HARDWARE", CONSOLE_FULLSCREEN_HARDWARE);
! PyModule_AddIntConstant(module, "ATTACH_PARENT_PROCESS", ATTACH_PARENT_PROCESS);
!
! PyModule_AddIntConstant(module, "ENABLE_LINE_INPUT", ENABLE_LINE_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_ECHO_INPUT", ENABLE_ECHO_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_PROCESSED_INPUT", ENABLE_PROCESSED_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_WINDOW_INPUT", ENABLE_WINDOW_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_MOUSE_INPUT", ENABLE_MOUSE_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT);
! PyModule_AddIntConstant(module, "ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT);
// text attribute flags - ?????? COMMON_* flags don't seem to do anything ??????
! PyModule_AddIntConstant(module, "FOREGROUND_BLUE", FOREGROUND_BLUE);
! PyModule_AddIntConstant(module, "FOREGROUND_GREEN", FOREGROUND_GREEN);
! PyModule_AddIntConstant(module, "FOREGROUND_RED", FOREGROUND_RED);
! PyModule_AddIntConstant(module, "FOREGROUND_INTENSITY", FOREGROUND_INTENSITY);
! PyModule_AddIntConstant(module, "BACKGROUND_BLUE", BACKGROUND_BLUE);
! PyModule_AddIntConstant(module, "BACKGROUND_GREEN", BACKGROUND_GREEN);
! PyModule_AddIntConstant(module, "BACKGROUND_RED", BACKGROUND_RED);
! PyModule_AddIntConstant(module, "BACKGROUND_INTENSITY", BACKGROUND_INTENSITY);
! PyModule_AddIntConstant(module, "COMMON_LVB_LEADING_BYTE", COMMON_LVB_LEADING_BYTE);
! PyModule_AddIntConstant(module, "COMMON_LVB_TRAILING_BYTE", COMMON_LVB_TRAILING_BYTE);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_HORIZONTAL", COMMON_LVB_GRID_HORIZONTAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_LVERTICAL", COMMON_LVB_GRID_LVERTICAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_RVERTICAL", COMMON_LVB_GRID_RVERTICAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_REVERSE_VIDEO", COMMON_LVB_REVERSE_VIDEO);
! PyModule_AddIntConstant(module, "COMMON_LVB_UNDERSCORE", COMMON_LVB_UNDERSCORE);
// selection flags for GetConsoleSelectionInfo
! PyModule_AddIntConstant(module, "CONSOLE_NO_SELECTION", CONSOLE_NO_SELECTION);
! PyModule_AddIntConstant(module, "CONSOLE_SELECTION_IN_PROGRESS", CONSOLE_SELECTION_IN_PROGRESS);
! PyModule_AddIntConstant(module, "CONSOLE_SELECTION_NOT_EMPTY", CONSOLE_SELECTION_NOT_EMPTY);
! PyModule_AddIntConstant(module, "CONSOLE_MOUSE_SELECTION", CONSOLE_MOUSE_SELECTION);
! PyModule_AddIntConstant(module, "CONSOLE_MOUSE_DOWN", CONSOLE_MOUSE_DOWN);
! PyModule_AddIntConstant(module, "LOCALE_USER_DEFAULT", LOCALE_USER_DEFAULT);
// event types for INPUT_RECORD
! PyModule_AddIntConstant(module, "KEY_EVENT", KEY_EVENT);
! PyModule_AddIntConstant(module, "MOUSE_EVENT", MOUSE_EVENT);
! PyModule_AddIntConstant(module, "WINDOW_BUFFER_SIZE_EVENT", WINDOW_BUFFER_SIZE_EVENT);
! PyModule_AddIntConstant(module, "MENU_EVENT", MENU_EVENT);
! PyModule_AddIntConstant(module, "FOCUS_EVENT", FOCUS_EVENT);
// Control events for GenerateConsoleCtrlEvent
! PyModule_AddIntConstant(module, "CTRL_C_EVENT", CTRL_C_EVENT);
! PyModule_AddIntConstant(module, "CTRL_BREAK_EVENT", CTRL_BREAK_EVENT);
// std handles
! PyModule_AddIntConstant(module, "STD_INPUT_HANDLE", STD_INPUT_HANDLE);
! PyModule_AddIntConstant(module, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
! PyModule_AddIntConstant(module, "STD_ERROR_HANDLE", STD_ERROR_HANDLE);
// flags used with SetConsoleDisplayMode
// ?????? these aren't in my SDK headers
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN_MODE", 1);
! PyModule_AddIntConstant(module, "CONSOLE_WINDOWED_MODE", 2);
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32transactionmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32transactionmodule.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** win32transactionmodule.cpp 3 Jun 2007 14:53:07 -0000 1.3
--- win32transactionmodule.cpp 8 Dec 2008 13:16:38 -0000 1.4
***************
*** 244,253 ****
};
! extern "C" __declspec(dllexport) void
! initwin32transaction(void)
{
! PyObject *dict, *mod;
! PyWinGlobals_Ensure();
! mod = Py_InitModule("win32transaction", win32transaction_functions);
// Load dll and function pointers to avoid dependency on newer libraries and headers
--- 244,252 ----
};
! PYWIN_MODULE_INIT_FUNC(win32transaction)
{
! PYWIN_MODULE_INIT_PREPARE(win32transaction, win32transaction_functions,
! "Module wrapping Kernal Transaction Manager functions, as used with"
! " transacted NTFS and transacted registry functions.");
// Load dll and function pointers to avoid dependency on newer libraries and headers
***************
*** 273,279 ****
}
- dict = PyModule_GetDict(mod);
Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
}
--- 272,278 ----
}
Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** PyWinTypesmodule.cpp 4 Dec 2008 00:17:13 -0000 1.46
--- PyWinTypesmodule.cpp 8 Dec 2008 13:16:37 -0000 1.47
***************
*** 913,970 ****
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR;
#define ADD_TYPE(type_name) \
if (PyType_Ready(&Py##type_name)==-1 \
|| PyDict_SetItemString(dict, #type_name, (PyObject *)&Py##type_name) == -1) \
! RETURN_ERROR;
! extern "C" __declspec(dllexport)
! void initpywintypes(void)
{
! // ensure the framework has a valid thread state to work with.
! PyWinGlobals_Ensure();
!
! // Note we assume the Python global lock has been acquired for us already.
! PyObject *dict, *module;
!
! #define RETURN_ERROR return; // path to py3k...
!
! module = Py_InitModule("pywintypes", pywintypes_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! if (PyWinExc_ApiError == NULL || PyWinExc_COMError == NULL) {
! PyErr_SetString(PyExc_MemoryError, "Could not initialise the error objects");
! return;
! }
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PyDict_SetItemString(dict, "com_error", PyWinExc_COMError);
! PyDict_SetItemString(dict, "TRUE", Py_True);
! PyDict_SetItemString(dict, "FALSE", Py_False);
! ADD_CONSTANT(WAVE_FORMAT_PCM);
// Add a few types.
#ifndef NO_PYWINTYPES_TIME
! PyDict_SetItemString(dict, "TimeType", (PyObject *)&PyTimeType);
#endif // NO_PYWINTYPES_TIME
#ifndef NO_PYWINTYPES_IID
! PyDict_SetItemString(dict, "IIDType", (PyObject *)&PyIIDType);
#endif // NO_PYWINTYPES_IID
- PyDict_SetItemString(dict, "UnicodeType", (PyObject *)&PyUnicode_Type);
#ifndef NO_PYWINTYPES_SECURITY
! PyDict_SetItemString(dict, "SECURITY_ATTRIBUTESType", (PyObject *)&PySECURITY_ATTRIBUTESType);
! PyDict_SetItemString(dict, "SIDType", (PyObject *)&PySIDType);
! PyDict_SetItemString(dict, "ACLType", (PyObject *)&PyACLType);
#endif
! PyDict_SetItemString(dict, "HANDLEType", (PyObject *)&PyHANDLEType);
! PyDict_SetItemString(dict, "OVERLAPPEDType", (PyObject *)&PyOVERLAPPEDType);
! PyDict_SetItemString(dict, "DEVMODEType", (PyObject *)&PyDEVMODEType);
! PyDict_SetItemString(dict, "DEVMODEWType", (PyObject *)&PyDEVMODEWType);
! PyDict_SetItemString(dict, "WAVEFORMATEXType", (PyObject *)&PyWAVEFORMATEXType);
}
--- 913,963 ----
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR;
#define ADD_TYPE(type_name) \
if (PyType_Ready(&Py##type_name)==-1 \
|| PyDict_SetItemString(dict, #type_name, (PyObject *)&Py##type_name) == -1) \
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_FUNC(pywintypes)
{
! PYWIN_MODULE_INIT_PREPARE(pywintypes, pywintypes_functions,
! "Module containing common objects and functions used by various Pywin32 modules");
! if (PyWinExc_ApiError == NULL || PyWinExc_COMError == NULL) {
! PyErr_SetString(PyExc_MemoryError, "Could not initialise the error objects");
! PYWIN_MODULE_INIT_RETURN_ERROR;
! }
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1
! || PyDict_SetItemString(dict, "com_error", PyWinExc_COMError) == -1
! || PyDict_SetItemString(dict, "TRUE", Py_True) == -1
! || PyDict_SetItemString(dict, "FALSE", Py_False) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! ADD_CONSTANT(WAVE_FORMAT_PCM);
// Add a few types.
+ if (PyDict_SetItemString(dict, "UnicodeType", (PyObject *)&PyUnicode_Type) == -1)
+ PYWIN_MODULE_INIT_RETURN_ERROR;
+
#ifndef NO_PYWINTYPES_TIME
! ADD_TYPE(TimeType);
#endif // NO_PYWINTYPES_TIME
#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(DEVMODEType);
! ADD_TYPE(DEVMODEWType);
! ADD_TYPE(WAVEFORMATEXType);
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32lzmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32lzmodule.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32lzmodule.cpp 1 Oct 2004 00:10:15 -0000 1.4
--- win32lzmodule.cpp 8 Dec 2008 13:16:38 -0000 1.5
***************
*** 12,21 ****
******************************************************************/
! #include "windows.h"
#include "lzexpand.h"
- #include "Python.h"
-
- static PyObject *module_error;
static PyObject *obHandleMap = NULL;
--- 12,18 ----
******************************************************************/
! #include "Pywintypes.h"
#include "lzexpand.h"
static PyObject *obHandleMap = NULL;
***************
*** 25,29 ****
PyObject *v = Py_BuildValue("(izs)", 0, fnName, msg);
if (v != NULL) {
! PyErr_SetObject(module_error, v);
Py_DECREF(v);
}
--- 22,26 ----
PyObject *v = Py_BuildValue("(izs)", 0, fnName, msg);
if (v != NULL) {
! PyErr_SetObject(PyWinExc_ApiError, v);
Py_DECREF(v);
}
***************
*** 65,69 ****
PyObject *v = Py_BuildValue("(iss)", err, fnName, pMsg);
if (v != NULL) {
! PyErr_SetObject(module_error, v);
Py_DECREF(v);
}
--- 62,66 ----
PyObject *v = Py_BuildValue("(iss)", err, fnName, pMsg);
if (v != NULL) {
! PyErr_SetObject(PyWinExc_ApiError, v);
Py_DECREF(v);
}
***************
*** 74,87 ****
PyGetExpandedName(PyObject *self, PyObject *args)
{
! char outName[_MAX_PATH+1];
! char *nameIn;
! if (!PyArg_ParseTuple(args, "s:GetExpandedName", &nameIn )) // @pyparm int|idControl||The Id of the control to be retrieved.
return NULL;
-
// @pyseeapi GetExpandedName
int ret = GetExpandedName(nameIn, outName);
if (ret!=1)
return ReturnLZError("GetExpandedName", ret);
! return Py_BuildValue("s",outName);
}
--- 71,87 ----
PyGetExpandedName(PyObject *self, PyObject *args)
{
! TCHAR outName[_MAX_PATH+1];
! TCHAR *nameIn;
! PyObject *obnameIn;
! if (!PyArg_ParseTuple(args, "O:GetExpandedName", &obnameIn )) // @pyparm str|Source||Name of a compressed file
! return NULL;
! if (!PyWinObject_AsTCHAR(obnameIn, &nameIn, FALSE))
return NULL;
// @pyseeapi GetExpandedName
int ret = GetExpandedName(nameIn, outName);
+ PyWinObject_FreeTCHAR(nameIn);
if (ret!=1)
return ReturnLZError("GetExpandedName", ret);
! return PyWinObject_FromTCHAR(outName);
}
***************
*** 138,152 ****
PyLZOpenFile(PyObject *self, PyObject *args)
{
! char *fname;
int op;
! if (!PyArg_ParseTuple(args, "si:OpenFile", &fname, &op ))
// @pyparm string|fileName||Name of file to open
// @pyparm int|action||Can be one of the wi32con.OF_ constants (OF_CREATE, OF_DELETE, etc)
return NULL;
!
// @pyseeapi LZOpenFile
OFSTRUCT of;
of.cBytes = sizeof(OFSTRUCT);
INT ret = LZOpenFile(fname, &of, op);
if (ret<0)
return ReturnLZError("LZOpenFile",ret);
--- 138,155 ----
PyLZOpenFile(PyObject *self, PyObject *args)
{
! TCHAR *fname;
! PyObject *obfname;
int op;
! if (!PyArg_ParseTuple(args, "Oi:OpenFile", &obfname, &op ))
// @pyparm string|fileName||Name of file to open
// @pyparm int|action||Can be one of the wi32con.OF_ constants (OF_CREATE, OF_DELETE, etc)
return NULL;
! if (!PyWinObject_AsTCHAR(obfname, &fname, FALSE))
! return NULL;
// @pyseeapi LZOpenFile
OFSTRUCT of;
of.cBytes = sizeof(OFSTRUCT);
INT ret = LZOpenFile(fname, &of, op);
+ PyWinObject_FreeTCHAR(fname);
if (ret<0)
return ReturnLZError("LZOpenFile",ret);
***************
*** 157,161 ****
/* List of functions exported by this module */
// @module win32lz|A module encapsulating the Windows LZ compression routines.
! static struct PyMethodDef win32ras_functions[] = {
{"GetExpandedName", PyGetExpandedName, METH_VARARGS}, // @pymeth GetExpandedName|Retrieves the original name of an expanded file,
{"Close", PyLZClose, METH_VARARGS}, // @pymeth Close|Closes a handle to an LZ file.
--- 160,164 ----
/* List of functions exported by this module */
// @module win32lz|A module encapsulating the Windows LZ compression routines.
! static struct PyMethodDef win32lz_functions[] = {
{"GetExpandedName", PyGetExpandedName, METH_VARARGS}, // @pymeth GetExpandedName|Retrieves the original name of an expanded file,
{"Close", PyLZClose, METH_VARARGS}, // @pymeth Close|Closes a handle to an LZ file.
***************
*** 166,180 ****
};
!
! extern "C" __declspec(dllexport) void
! initwin32lz(void)
{
! PyObject *dict, *module;
! module = Py_InitModule("win32lz", win32ras_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! module_error = PyString_FromString("win32lz error");
! PyDict_SetItemString(dict, "error", module_error);
}
--- 169,179 ----
};
! PYWIN_MODULE_INIT_FUNC(win32lz)
{
! PYWIN_MODULE_INIT_PREPARE(win32lz, win32lz_functions,
! "A module encapsulating the Windows LZ compression routines.");
!
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32credmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32credmodule.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win32credmodule.cpp 12 Aug 2007 08:31:41 -0000 1.8
--- win32credmodule.cpp 8 Dec 2008 13:16:37 -0000 1.9
***************
*** 1035,1111 ****
! extern "C" __declspec(dllexport) void
! initwin32cred(void)
{
! PyObject *dict, *mod;
! PyWinGlobals_Ensure();
! mod = Py_InitModule("win32cred", win32cred_functions);
- dict = PyModule_GetDict(mod);
// CRED_MARSHAL_TYPE used with CredMarshalCredential and CredUnmarshalCredential
! PyModule_AddIntConstant(mod, "CertCredential", CertCredential);
! PyModule_AddIntConstant(mod, "UsernameTargetCredential", UsernameTargetCredential);
// credential types
! PyModule_AddIntConstant(mod, "CRED_TYPE_GENERIC", CRED_TYPE_GENERIC);
! PyModule_AddIntConstant(mod, "CRED_TYPE_DOMAIN_PASSWORD", CRED_TYPE_DOMAIN_PASSWORD);
! PyModule_AddIntConstant(mod, "CRED_TYPE_DOMAIN_CERTIFICATE", CRED_TYPE_DOMAIN_CERTIFICATE);
! PyModule_AddIntConstant(mod, "CRED_TYPE_DOMAIN_VISIBLE_PASSWORD", CRED_TYPE_DOMAIN_VISIBLE_PASSWORD);
// credential flags
! PyModule_AddIntConstant(mod, "CRED_FLAGS_PROMPT_NOW", CRED_FLAGS_PROMPT_NOW);
! PyModule_AddIntConstant(mod, "CRED_FLAGS_USERNAME_TARGET", CRED_FLAGS_USERNAME_TARGET);
! PyModule_AddIntConstant(mod, "CRED_FLAGS_PASSWORD_FOR_CERT", CRED_FLAGS_PASSWORD_FOR_CERT);
! PyModule_AddIntConstant(mod, "CRED_FLAGS_OWF_CRED_BLOB", CRED_FLAGS_OWF_CRED_BLOB);
! PyModule_AddIntConstant(mod, "CRED_FLAGS_VALID_FLAGS", CRED_FLAGS_VALID_FLAGS);
// persistence flags
! PyModule_AddIntConstant(mod, "CRED_PERSIST_NONE", CRED_PERSIST_NONE);
! PyModule_AddIntConstant(mod, "CRED_PERSIST_SESSION", CRED_PERSIST_SESSION);
! PyModule_AddIntConstant(mod, "CRED_PERSIST_LOCAL_MACHINE", CRED_PERSIST_LOCAL_MACHINE);
! PyModule_AddIntConstant(mod, "CRED_PERSIST_ENTERPRISE", CRED_PERSIST_ENTERPRISE);
// CREDENTIAL_TARGET_INFORMATION flags
! PyModule_AddIntConstant(mod, "CRED_TI_SERVER_FORMAT_UNKNOWN", CRED_TI_SERVER_FORMAT_UNKNOWN);
! PyModule_AddIntConstant(mod, "CRED_TI_DOMAIN_FORMAT_UNKNOWN", CRED_TI_DOMAIN_FORMAT_UNKNOWN);
! PyModule_AddIntConstant(mod, "CRED_TI_ONLY_PASSWORD_REQUIRED", CRED_TI_ONLY_PASSWORD_REQUIRED);
! PyModule_AddIntConstant(mod, "CRED_TI_USERNAME_TARGET", CRED_TI_USERNAME_TARGET);
! PyModule_AddIntConstant(mod, "CRED_TI_CREATE_EXPLICIT_CRED", CRED_TI_CREATE_EXPLICIT_CRED);
! PyModule_AddIntConstant(mod, "CRED_TI_WORKGROUP_MEMBER", CRED_TI_WORKGROUP_MEMBER);
! PyModule_AddIntConstant(mod, "CRED_TI_VALID_FLAGS", CRED_TI_VALID_FLAGS);
// CredGetTargetInfo flag
! PyModule_AddIntConstant(mod, "CRED_ALLOW_NAME_RESOLUTION", CRED_ALLOW_NAME_RESOLUTION);
// flag used with CredReadDomainCredentials
! PyModule_AddIntConstant(mod, "CRED_CACHE_TARGET_INFORMATION", CRED_CACHE_TARGET_INFORMATION);
// flag used with CredWriteDomainCredentials
! PyModule_AddIntConstant(mod, "CRED_PRESERVE_CREDENTIAL_BLOB", CRED_PRESERVE_CREDENTIAL_BLOB);
// CredUIPromptForCredentials/CredUICmdLinePromptForCredentials options
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_PROMPT_VALID", CREDUI_FLAGS_PROMPT_VALID);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_INCORRECT_PASSWORD", CREDUI_FLAGS_INCORRECT_PASSWORD);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_DO_NOT_PERSIST", CREDUI_FLAGS_DO_NOT_PERSIST);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_REQUEST_ADMINISTRATOR", CREDUI_FLAGS_REQUEST_ADMINISTRATOR);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_EXCLUDE_CERTIFICATES", CREDUI_FLAGS_EXCLUDE_CERTIFICATES);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_REQUIRE_CERTIFICATE", CREDUI_FLAGS_REQUIRE_CERTIFICATE);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX", CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_ALWAYS_SHOW_UI", CREDUI_FLAGS_ALWAYS_SHOW_UI);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_REQUIRE_SMARTCARD", CREDUI_FLAGS_REQUIRE_SMARTCARD);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_PASSWORD_ONLY_OK", CREDUI_FLAGS_PASSWORD_ONLY_OK);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_VALIDATE_USERNAME", CREDUI_FLAGS_VALIDATE_USERNAME);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_COMPLETE_USERNAME", CREDUI_FLAGS_COMPLETE_USERNAME);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_PERSIST", CREDUI_FLAGS_PERSIST);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_SERVER_CREDENTIAL", CREDUI_FLAGS_SERVER_CREDENTIAL);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_EXPECT_CONFIRMATION", CREDUI_FLAGS_EXPECT_CONFIRMATION);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_GENERIC_CREDENTIALS", CREDUI_FLAGS_GENERIC_CREDENTIALS);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS", CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS);
! PyModule_AddIntConstant(mod, "CREDUI_FLAGS_KEEP_USERNAME", CREDUI_FLAGS_KEEP_USERNAME);
// size limits for various credential strings
! PyModule_AddIntConstant(mod, "CRED_MAX_STRING_LENGTH", CRED_MAX_STRING_LENGTH);
! PyModule_AddIntConstant(mod, "CRED_MAX_USERNAME_LENGTH", CRED_MAX_USERNAME_LENGTH);
! PyModule_AddIntConstant(mod, "CRED_MAX_GENERIC_TARGET_NAME_LENGTH", CRED_MAX_GENERIC_TARGET_NAME_LENGTH);
! PyModule_AddIntConstant(mod, "CRED_MAX_DOMAIN_TARGET_NAME_LENGTH", CRED_MAX_DOMAIN_TARGET_NAME_LENGTH);
! PyModule_AddIntConstant(mod, "CRED_MAX_VALUE_SIZE", CRED_MAX_VALUE_SIZE);
! PyModule_AddIntConstant(mod, "CRED_MAX_ATTRIBUTES", CRED_MAX_ATTRIBUTES);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_MESSAGE_LENGTH", CREDUI_MAX_MESSAGE_LENGTH);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_CAPTION_LENGTH", CREDUI_MAX_CAPTION_LENGTH);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_GENERIC_TARGET_LENGTH", CREDUI_MAX_GENERIC_TARGET_LENGTH);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_DOMAIN_TARGET_LENGTH", CREDUI_MAX_DOMAIN_TARGET_LENGTH);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_USERNAME_LENGTH", CREDUI_MAX_USERNAME_LENGTH);
! PyModule_AddIntConstant(mod, "CREDUI_MAX_PASSWORD_LENGTH", CREDUI_MAX_PASSWORD_LENGTH);
}
--- 1035,1109 ----
! PYWIN_MODULE_INIT_FUNC(win32cred)
{
! PYWIN_MODULE_INIT_PREPARE(win32cred, win32cred_functions,
! "Interface to credentials management functions.");
// CRED_MARSHAL_TYPE used with CredMarshalCredential and CredUnmarshalCredential
! PyModule_AddIntConstant(module, "CertCredential", CertCredential);
! PyModule_AddIntConstant(module, "UsernameTargetCredential", UsernameTargetCredential);
// credential types
! PyModule_AddIntConstant(module, "CRED_TYPE_GENERIC", CRED_TYPE_GENERIC);
! PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_PASSWORD", CRED_TYPE_DOMAIN_PASSWORD);
! PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_CERTIFICATE", CRED_TYPE_DOMAIN_CERTIFICATE);
! PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_VISIBLE_PASSWORD", CRED_TYPE_DOMAIN_VISIBLE_PASSWORD);
// credential flags
! PyModule_AddIntConstant(module, "CRED_FLAGS_PROMPT_NOW", CRED_FLAGS_PROMPT_NOW);
! PyModule_AddIntConstant(module, "CRED_FLAGS_USERNAME_TARGET", CRED_FLAGS_USERNAME_TARGET);
! PyModule_AddIntConstant(module, "CRED_FLAGS_PASSWORD_FOR_CERT", CRED_FLAGS_PASSWORD_FOR_CERT);
! PyModule_AddIntConstant(module, "CRED_FLAGS_OWF_CRED_BLOB", CRED_FLAGS_OWF_CRED_BLOB);
! PyModule_AddIntConstant(module, "CRED_FLAGS_VALID_FLAGS", CRED_FLAGS_VALID_FLAGS);
// persistence flags
! PyModule_AddIntConstant(module, "CRED_PERSIST_NONE", CRED_PERSIST_NONE);
! PyModule_AddIntConstant(module, "CRED_PERSIST_SESSION", CRED_PERSIST_SESSION);
! PyModule_AddIntConstant(module, "CRED_PERSIST_LOCAL_MACHINE", CRED_PERSIST_LOCAL_MACHINE);
! PyModule_AddIntConstant(module, "CRED_PERSIST_ENTERPRISE", CRED_PERSIST_ENTERPRISE);
// CREDENTIAL_TARGET_INFORMATION flags
! PyModule_AddIntConstant(module, "CRED_TI_SERVER_FORMAT_UNKNOWN", CRED_TI_SERVER_FORMAT_UNKNOWN);
! PyModule_AddIntConstant(module, "CRED_TI_DOMAIN_FORMAT_UNKNOWN", CRED_TI_DOMAIN_FORMAT_UNKNOWN);
! PyModule_AddIntConstant(module, "CRED_TI_ONLY_PASSWORD_REQUIRED", CRED_TI_ONLY_PASSWORD_REQUIRED);
! PyModule_AddIntConstant(module, "CRED_TI_USERNAME_TARGET", CRED_TI_USERNAME_TARGET);
! PyModule_AddIntConstant(module, "CRED_TI_CREATE_EXPLICIT_CRED", CRED_TI_CREATE_EXPLICIT_CRED);
! PyModule_AddIntConstant(module, "CRED_TI_WORKGROUP_MEMBER", CRED_TI_WORKGROUP_MEMBER);
! PyModule_AddIntConstant(module, "CRED_TI_VALID_FLAGS", CRED_TI_VALID_FLAGS);
// CredGetTargetInfo flag
! PyModule_AddIntConstant(module, "CRED_ALLOW_NAME_RESOLUTION", CRED_ALLOW_NAME_RESOLUTION);
// flag used with CredReadDomainCredentials
! PyModule_AddIntConstant(module, "CRED_CACHE_TARGET_INFORMATION", CRED_CACHE_TARGET_INFORMATION);
// flag used with CredWriteDomainCredentials
! PyModule_AddIntConstant(module, "CRED_PRESERVE_CREDENTIAL_BLOB", CRED_PRESERVE_CREDENTIAL_BLOB);
// CredUIPromptForCredentials/CredUICmdLinePromptForCredentials options
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_PROMPT_VALID", CREDUI_FLAGS_PROMPT_VALID);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_INCORRECT_PASSWORD", CREDUI_FLAGS_INCORRECT_PASSWORD);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_DO_NOT_PERSIST", CREDUI_FLAGS_DO_NOT_PERSIST);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_REQUEST_ADMINISTRATOR", CREDUI_FLAGS_REQUEST_ADMINISTRATOR);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_EXCLUDE_CERTIFICATES", CREDUI_FLAGS_EXCLUDE_CERTIFICATES);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_REQUIRE_CERTIFICATE", CREDUI_FLAGS_REQUIRE_CERTIFICATE);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX", CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_ALWAYS_SHOW_UI", CREDUI_FLAGS_ALWAYS_SHOW_UI);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_REQUIRE_SMARTCARD", CREDUI_FLAGS_REQUIRE_SMARTCARD);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_PASSWORD_ONLY_OK", CREDUI_FLAGS_PASSWORD_ONLY_OK);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_VALIDATE_USERNAME", CREDUI_FLAGS_VALIDATE_USERNAME);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_COMPLETE_USERNAME", CREDUI_FLAGS_COMPLETE_USERNAME);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_PERSIST", CREDUI_FLAGS_PERSIST);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_SERVER_CREDENTIAL", CREDUI_FLAGS_SERVER_CREDENTIAL);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_EXPECT_CONFIRMATION", CREDUI_FLAGS_EXPECT_CONFIRMATION);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_GENERIC_CREDENTIALS", CREDUI_FLAGS_GENERIC_CREDENTIALS);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS", CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS);
! PyModule_AddIntConstant(module, "CREDUI_FLAGS_KEEP_USERNAME", CREDUI_FLAGS_KEEP_USERNAME);
// size limits for various credential strings
! PyModule_AddIntConstant(module, "CRED_MAX_STRING_LENGTH", CRED_MAX_STRING_LENGTH);
! PyModule_AddIntConstant(module, "CRED_MAX_USERNAME_LENGTH", CRED_MAX_USERNAME_LENGTH);
! PyModule_AddIntConstant(module, "CRED_MAX_GENERIC_TARGET_NAME_LENGTH", CRED_MAX_GENERIC_TARGET_NAME_LENGTH);
! PyModule_AddIntConstant(module, "CRED_MAX_DOMAIN_TARGET_NAME_LENGTH", CRED_MAX_DOMAIN_TARGET_NAME_LENGTH);
! PyModule_AddIntConstant(module, "CRED_MAX_VALUE_SIZE", CRED_MAX_VALUE_SIZE);
! PyModule_AddIntConstant(module, "CRED_MAX_ATTRIBUTES", CRED_MAX_ATTRIBUTES);
! PyModule_AddIntConstant(module, "CREDUI_MAX_MESSAGE_LENGTH", CREDUI_MAX_MESSAGE_LENGTH);
! PyModule_AddIntConstant(module, "CREDUI_MAX_CAPTION_LENGTH", CREDUI_MAX_CAPTION_LENGTH);
! PyModule_AddIntConstant(module, "CREDUI_MAX_GENERIC_TARGET_LENGTH", CREDUI_MAX_GENERIC_TARGET_LENGTH);
! PyModule_AddIntConstant(module, "CREDUI_MAX_DOMAIN_TARGET_LENGTH", CREDUI_MAX_DOMAIN_TARGET_LENGTH);
! PyModule_AddIntConstant(module, "CREDUI_MAX_USERNAME_LENGTH", CREDUI_MAX_USERNAME_LENGTH);
! PyModule_AddIntConstant(module, "CREDUI_MAX_PASSWORD_LENGTH", CREDUI_MAX_PASSWORD_LENGTH);
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: PyWinTypes.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** PyWinTypes.h 6 Dec 2008 00:43:19 -0000 1.56
--- PyWinTypes.h 8 Dec 2008 13:16:37 -0000 1.57
***************
*** 21,24 ****
--- 21,81 ----
#include "windows.h"
+
+ // Helpers for our modules.
+ // Some macros to help the pywin32 modules co-exist in py2x and py3k.
+ // Creates and initializes local variables called 'module' and 'dict'.
+
+ #if (PY_VERSION_HEX < 0x03000000)
+
+ // Use to define the function itself (ie, its name, linkage, params)
+ #define PYWIN_MODULE_INIT_FUNC(module_name) \
+ extern "C" __declspec(dllexport) void init##module_name(void)
+
+ // If the module needs to early-exit on an error condition.
+ #define PYWIN_MODULE_INIT_RETURN_ERROR return;
+
+ // When the module has successfully initialized.
+ #define PYWIN_MODULE_INIT_RETURN_SUCCESS return;
+
+ // To setup the module object itself and the module's dictionary.
+ #define PYWIN_MODULE_INIT_PREPARE(module_name, functions, docstring) \
+ PyObject *dict, *module; \
+ if (PyWinGlobals_Ensure()==-1) \
+ return; \
+ if (!(module = Py_InitModule(#module_name, functions))) \
+ return; \
+ if (!(dict = PyModule_GetDict(module))) \
+ return;
+
+ #else
+ // py3k module helpers.
+ // Use to define the function itself (ie, its name, linkage, params)
+ #define PYWIN_MODULE_INIT_FUNC(module_name) \
+ extern "C" __declspec(dllexport) PyObject *PyInit_##module_name(void)
+
+ // If the module needs to early-exit on an error condition.
+ #define PYWIN_MODULE_INIT_RETURN_ERROR return NULL;
+
+ // When the module has successfully initialized.
+ #define PYWIN_MODULE_INIT_RETURN_SUCCESS return module;
+
+ // To setup the module object itself and the module's dictionary.
+ #define PYWIN_MODULE_INIT_PREPARE(module_name, functions, docstring) \
+ PyObject *dict, *module; \
+ static PyModuleDef module_name##_def = { \
+ PyModuleDef_HEAD_INIT, \
+ #module_name, \
+ docstring , \
+ -1, \
+ functions }; \
+ if (PyWinGlobals_Ensure()==-1) \
+ return NULL; \
+ if (!(module = PyModule_Create(&module_name##_def))) \
+ return NULL; \
+ if (!(dict = PyModule_GetDict(module))) \
+ return NULL;
+ #endif // PY_VERSION_HEX
+
+
// Helpers for our types.
#if (PY_VERSION_HEX < 0x03000000)
Index: win32helpmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32helpmodule.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** win32helpmodule.cpp 3 Dec 2008 22:34:21 -0000 1.6
--- win32helpmodule.cpp 8 Dec 2008 13:16:37 -0000 1.7
***************
*** 3123,3138 ****
// Module initialization:
! extern "C" __declspec(dllexport) void
! initwin32help(void)
{
! PyObject *dict, *module;
! module = Py_InitModule("win32help", win32help_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! AddConstants(module);
! PyDict_SetItemString(dict, "__version__",
PyString_FromString("$Revision$"));
- }
--- 3123,3144 ----
// Module initialization:
! PYWIN_MODULE_INIT_FUNC(win32help)
{
! PYWIN_MODULE_INIT_PREPARE(win32help, win32help_functions,
! "A module, encapsulating the Win32 help API's.");
! if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PyDict_SetItemString(dict, "__version__",
PyString_FromString("$Revision$"));
+ if (PyType_Ready(&PyHH_AKLINKType) == -1
+ ||PyType_Ready(&PyHH_FTS_QUERYType) == -1
+ ||PyType_Ready(&PyHH_POPUPType) == -1
+ ||PyType_Ready(&PyHH_WINTYPEType) == -1
+ ||PyType_Ready(&PyNMHDRType) == -1
+ ||PyType_Ready(&PyHHN_NOTIFYType) == -1
+ ||PyType_Ready(&PyHHNTRACKType) == -1)
+ PYWIN_MODULE_INIT_RETURN_ERROR;
+
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
+ }
Index: timermodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/timermodule.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** timermodule.cpp 13 Aug 2007 02:11:41 -0000 1.5
--- timermodule.cpp 8 Dec 2008 13:16:37 -0000 1.6
***************
*** 148,167 ****
};
! extern"C" __declspec(dllexport) void
! inittimer(void)
{
! PyWinGlobals_Ensure();
timer_id_callback_map = PyDict_New();
if (!timer_id_callback_map)
! return;
! PyObject *dict, *module;
! module = Py_InitModule("timer", timer_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return; /* Another serious error!*/
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2"));
}
--- 148,166 ----
};
!
! PYWIN_MODULE_INIT_FUNC(timer)
{
! PYWIN_MODULE_INIT_PREPARE(timer, timer_functions,
! "Extension that wraps Win32 Timer functions");
!
timer_id_callback_map = PyDict_New();
if (!timer_id_callback_map)
! PYWIN_MODULE_INIT_RETURN_ERROR
!
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win2krasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win2krasmodule.cpp 3 Dec 2008 22:34:21 -0000 1.8
--- win2krasmodule.cpp 8 Dec 2008 13:16:37 -0000 1.9
***************
*** 183,198 ****
}
! extern "C" __declspec(dllexport) void
! initwin2kras(void)
{
! PyWinGlobals_Ensure();
! PyObject *dict, *module;
! #define RETURN_ERROR return // towards py3k
! module = Py_InitModule("win2kras", win2kras_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! AddConstants(module);
#ifdef _DEBUG
const TCHAR *modName = _T("win32ras_d.pyd");
--- 183,196 ----
}
! PYWIN_MODULE_INIT_FUNC(win2kras)
{
! PYWIN_MODULE_INIT_PREPARE(win2kras, win2kras_functions,
! "A module encapsulating the Windows 2000 extensions to the Remote Access Service (RAS) API.");
!
! if (PyType_Ready(&PyRASEAPUSERIDENTITY::type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
#ifdef _DEBUG
const TCHAR *modName = _T("win32ras_d.pyd");
***************
*** 210,220 ****
if (hmod==NULL) {
PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module");
! RETURN_ERROR;
}
FARPROC fp = GetProcAddress(hmod, "ReturnRasError");
if (fp==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'");
! RETURN_ERROR;
}
pfnReturnRasError = (PFNReturnRasError)fp;
}
--- 208,220 ----
if (hmod==NULL) {
PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
FARPROC fp = GetProcAddress(hmod, "ReturnRasError");
if (fp==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
pfnReturnRasError = (PFNReturnRasError)fp;
+
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32pdhmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** win32pdhmodule.cpp 3 Dec 2008 21:34:22 -0000 1.18
--- win32pdhmodule.cpp 8 Dec 2008 13:16:38 -0000 1.19
***************
*** 1119,1155 ****
#define ADD_CONSTANT(tok) PyModule_AddIntConstant(module, #tok, tok)
! extern"C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32pdh(void)
! #else
! PyObject *PyInit_win32pdh(void)
! #endif
{
InitializeCriticalSection(&critSec);
- PyObject *dict, *module;
-
- #if (PY_VERSION_HEX < 0x03000000)
- #define RETURN_ERROR return;
- module = Py_InitModule("win32pdh", win32pdh_functions);
- #else
-
- #define RETURN_ERROR return NULL;
- static PyModuleDef win32pdh_def = {
- PyModuleDef_HEAD_INIT,
- "win32pdh",
- "A module, encapsulating the Windows Performance Data Helpers API",
- -1,
- win32pdh_functions
- };
- module = PyModule_Create(&win32pdh_def);
- #endif
-
- if (!module)
- RETURN_ERROR;
- dict = PyModule_GetDict(module);
- if (!dict)
- RETURN_ERROR;
- if (PyWinGlobals_Ensure() == -1)
- RETURN_ERROR;
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
--- 1119,1127 ----
#define ADD_CONSTANT(tok) PyModule_AddIntConstant(module, #tok, tok)
! PYWIN_MODULE_INIT_FUNC(win32pdh)
{
+ PYWIN_MODULE_INIT_PREPARE(win32pdh, win32pdh_functions,
+ "A module, encapsulating the Windows Performance Data Helpers API");
InitializeCriticalSection(&critSec);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
***************
*** 1178,1183 ****
ADD_CONSTANT(PERF_DETAIL_WIZARD);
// ADD_CONSTANT();
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 1150,1153 ----
ADD_CONSTANT(PERF_DETAIL_WIZARD);
// ADD_CONSTANT();
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32tsmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32tsmodule.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32tsmodule.cpp 25 Oct 2008 00:17:19 -0000 1.5
--- win32tsmodule.cpp 8 Dec 2008 13:16:38 -0000 1.6
***************
*** 689,790 ****
! extern "C" __declspec(dllexport) void
! initwin32ts(void)
{
! PyObject *dict, *mod;
! PyWinGlobals_Ensure();
! mod = Py_InitModule("win32ts", win32ts_functions);
! dict = PyModule_GetDict(mod);
// WTS_CONNECTSTATE_CLASS
! PyModule_AddIntConstant(mod, "WTSActive", WTSActive);
! PyModule_AddIntConstant(mod, "WTSConnected", WTSConnected);
! PyModule_AddIntConstant(mod, "WTSConnectQuery", WTSConnectQuery);
! PyModule_AddIntConstant(mod, "WTSShadow", WTSShadow);
! PyModule_AddIntConstant(mod, "WTSDisconnected", WTSDisconnected);
! PyModule_AddIntConstant(mod, "WTSIdle", WTSIdle);
! PyModule_AddIntConstant(mod, "WTSListen", WTSListen);
! PyModule_AddIntConstant(mod, "WTSReset", WTSReset);
! PyModule_AddIntConstant(mod, "WTSDown", WTSDown);
! PyModule_AddIntConstant(mod, "WTSInit", WTSInit);
// WTS_INFO_CLASS
! PyModule_AddIntConstant(mod, "WTSInitialProgram", WTSInitialProgram);
! PyModule_AddIntConstant(mod, "WTSApplicationName", WTSApplicationName);
! PyModule_AddIntConstant(mod, "WTSWorkingDirectory", WTSWorkingDirectory);
! PyModule_AddIntConstant(mod, "WTSOEMId", WTSOEMId);
! PyModule_AddIntConstant(mod, "WTSSessionId", WTSSessionId);
! PyModule_AddIntConstant(mod, "WTSUserName", WTSUserName);
! PyModule_AddIntConstant(mod, "WTSWinStationName", WTSWinStationName);
! PyModule_AddIntConstant(mod, "WTSDomainName", WTSDomainName);
! PyModule_AddIntConstant(mod, "WTSConnectState", WTSConnectState);
! PyModule_AddIntConstant(mod, "WTSClientBuildNumber", WTSClientBuildNumber);
! PyModule_AddIntConstant(mod, "WTSClientName", WTSClientName);
! PyModule_AddIntConstant(mod, "WTSClientDirectory", WTSClientDirectory);
! PyModule_AddIntConstant(mod, "WTSClientProductId", WTSClientProductId);
! PyModule_AddIntConstant(mod, "WTSClientHardwareId", WTSClientHardwareId...
[truncated message content] |