Thread: [pywin32-checkins] pywin32/win32/src win32file.i,1.87,1.88
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-12-26 18:09:13
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12287 Modified Files: win32file.i Log Message: Allow to build with UNICODE defined Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** win32file.i 10 Dec 2007 23:24:34 -0000 1.87 --- win32file.i 26 Dec 2007 18:09:16 -0000 1.88 *************** *** 279,283 **** // @pyseeapi CreateMailslot PyHANDLE CreateMailslot( ! LPCTSTR Name, // @pyparm str|Name||Name of the mailslot, of the form \\.\mailslot\[path]name DWORD MaxMessageSize, // @pyparm int|MaxMessageSize||Largest message size. Use 0 for unlimited. DWORD ReadTimeout, // @pyparm int|ReadTimeout||Timeout in milliseconds. Use -1 for no timeout. --- 279,283 ---- // @pyseeapi CreateMailslot PyHANDLE CreateMailslot( ! TCHAR *Name, // @pyparm str|Name||Name of the mailslot, of the form \\.\mailslot\[path]name DWORD MaxMessageSize, // @pyparm int|MaxMessageSize||Largest message size. Use 0 for unlimited. DWORD ReadTimeout, // @pyparm int|ReadTimeout||Timeout in milliseconds. Use -1 for no timeout. *************** *** 1218,1228 **** static PyObject *MyQueryDosDevice(PyObject *self, PyObject *args) { ! PyObject *ret=NULL; ! char *devicename, *targetpath=NULL; DWORD retlen, buflen, err; // @pyparm string|DeviceName||Name of device to query, or None to return all defined devices // @rdesc Returns a string containing substrings separated by NULLs with 2 terminating NULLs ! if (!PyArg_ParseTuple(args, "z:QueryDosDevice", &devicename)) return NULL; if (devicename==NULL) // this returns a huge string buflen=8192; --- 1218,1231 ---- static PyObject *MyQueryDosDevice(PyObject *self, PyObject *args) { ! PyObject *obdevicename, *ret=NULL; ! TCHAR *devicename, *targetpath=NULL; DWORD retlen, buflen, err; // @pyparm string|DeviceName||Name of device to query, or None to return all defined devices // @rdesc Returns a string containing substrings separated by NULLs with 2 terminating NULLs ! if (!PyArg_ParseTuple(args, "O:QueryDosDevice", &obdevicename)) return NULL; + if (!PyWinObject_AsTCHAR(obdevicename, &devicename, TRUE)) + return NULL; + if (devicename==NULL) // this returns a huge string buflen=8192; *************** *** 1235,1244 **** buflen*=2; } ! targetpath=(char *)malloc(buflen); ! if (targetpath==NULL) ! return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buflen); retlen=QueryDosDevice(devicename, targetpath, buflen); if (retlen!=0){ ! ret=PyString_FromStringAndSize(targetpath, retlen); break; } --- 1238,1249 ---- buflen*=2; } ! targetpath=(TCHAR *)malloc(buflen *sizeof(TCHAR)); ! if (targetpath==NULL){ ! PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buflen); ! break; ! } retlen=QueryDosDevice(devicename, targetpath, buflen); if (retlen!=0){ ! ret=PyWinObject_FromTCHAR(targetpath, retlen); break; } *************** *** 1249,1252 **** --- 1254,1258 ---- } } + PyWinObject_FreeTCHAR(devicename); if (targetpath) free(targetpath); *************** *** 3034,3037 **** --- 3040,3044 ---- PyWinObject_FromSID((*user_item)->pUserSid), PyString_FromStringAndSize((char *)(*user_item)->pCertBlob->pbData, (*user_item)->pCertBlob->cbData)); + // ??? This doesn't return EFS_CERTIFICATE_BLOB.dwCertEncodingType ??? if (!ret_item){ Py_DECREF(ret); *************** *** 4258,4262 **** } PyCFunction pfnpy_GetFileAttributesExW=(PyCFunction)py_GetFileAttributesExW; ! PyCFunction pfnpy_GetFileAttributesExA=(PyCFunction)py_GetFileAttributesExA; // @pyswig |SetFileAttributesW|Sets a file's attributes --- 4265,4273 ---- } PyCFunction pfnpy_GetFileAttributesExW=(PyCFunction)py_GetFileAttributesExW; ! #ifdef UNICODE ! PyCFunction pfnpy_GetFileAttributesEx=(PyCFunction)py_GetFileAttributesExW; ! #else ! PyCFunction pfnpy_GetFileAttributesEx=(PyCFunction)py_GetFileAttributesExA; ! #endif // @pyswig |SetFileAttributesW|Sets a file's attributes *************** *** 4974,4978 **** %native (CreateFileW) pfnpy_CreateFileW; %native (DeleteFileW) pfnpy_DeleteFileW; ! %native (GetFileAttributesEx) pfnpy_GetFileAttributesExA; %native (GetFileAttributesExW) pfnpy_GetFileAttributesExW; %native (SetFileAttributesW) pfnpy_SetFileAttributesW; --- 4985,4989 ---- %native (CreateFileW) pfnpy_CreateFileW; %native (DeleteFileW) pfnpy_DeleteFileW; ! %native (GetFileAttributesEx) pfnpy_GetFileAttributesEx; %native (GetFileAttributesExW) pfnpy_GetFileAttributesExW; %native (SetFileAttributesW) pfnpy_SetFileAttributesW; *************** *** 5024,5030 **** HMODULE hmodule; ! hmodule=GetModuleHandle("AdvAPI32.dll"); if (hmodule==NULL) ! hmodule=LoadLibrary("AdvAPI32.dll"); if (hmodule){ pfnEncryptFile=(EncryptFilefunc)GetProcAddress(hmodule, "EncryptFileW"); --- 5035,5041 ---- HMODULE hmodule; ! hmodule=GetModuleHandle(TEXT("AdvAPI32.dll")); if (hmodule==NULL) ! hmodule=LoadLibrary(TEXT("AdvAPI32.dll")); if (hmodule){ pfnEncryptFile=(EncryptFilefunc)GetProcAddress(hmodule, "EncryptFileW"); *************** *** 5045,5051 **** } ! hmodule=GetModuleHandle("kernel32.dll"); if (hmodule==NULL) ! hmodule=LoadLibrary("kernel32.dll"); if (hmodule){ pfnSetVolumeMountPoint=(SetVolumeMountPointfunc)GetProcAddress(hmodule, "SetVolumeMountPointW"); --- 5056,5062 ---- } ! hmodule=GetModuleHandle(TEXT("kernel32.dll")); if (hmodule==NULL) ! hmodule=LoadLibrary(TEXT("kernel32.dll")); if (hmodule){ pfnSetVolumeMountPoint=(SetVolumeMountPointfunc)GetProcAddress(hmodule, "SetVolumeMountPointW"); *************** *** 5090,5096 **** } ! hmodule=GetModuleHandle("sfc.dll"); if (hmodule==NULL) ! hmodule=LoadLibrary("sfc.dll"); if (hmodule){ pfnSfcGetNextProtectedFile=(SfcGetNextProtectedFilefunc)GetProcAddress(hmodule, "SfcGetNextProtectedFile"); --- 5101,5107 ---- } ! hmodule=GetModuleHandle(TEXT("sfc.dll")); if (hmodule==NULL) ! hmodule=LoadLibrary(TEXT("sfc.dll")); if (hmodule){ pfnSfcGetNextProtectedFile=(SfcGetNextProtectedFilefunc)GetProcAddress(hmodule, "SfcGetNextProtectedFile"); |