diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWin32Dll.c | 22 | ||||
-rw-r--r-- | win/tclWinFCmd.c | 153 | ||||
-rw-r--r-- | win/tclWinFile.c | 183 | ||||
-rw-r--r-- | win/tclWinInt.h | 4 | ||||
-rw-r--r-- | win/tclWinPipe.c | 45 | ||||
-rw-r--r-- | win/tclWinSock.c | 6 | ||||
-rw-r--r-- | win/tclWinTest.c | 6 |
7 files changed, 186 insertions, 233 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index c3fb6f8..9b8ec13 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWin32Dll.c,v 1.68 2010/09/14 08:53:49 nijtmans Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.69 2010/10/12 10:21:55 nijtmans Exp $ */ #include "tclWinInt.h" @@ -146,7 +146,7 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, typedef struct MountPointMap { const TCHAR *volumeName; /* Native wide string volume name. */ - char driveLetter; /* Drive letter corresponding to the volume + TCHAR driveLetter; /* Drive letter corresponding to the volume * name. */ struct MountPointMap *nextPtr; /* Pointer to next structure in list, or @@ -486,11 +486,11 @@ TclWinResetInterfaces(void) char TclWinDriveLetterForVolMountPoint( - const WCHAR *mountPoint) + const TCHAR *mountPoint) { MountPointMap *dlIter, *dlPtr2; - WCHAR Target[55]; /* Target of mount at mount point */ - WCHAR drive[4] = { L'A', L':', L'\\', L'\0' }; + TCHAR Target[55]; /* Target of mount at mount point */ + TCHAR drive[4] = TEXT("A:\\"); /* * Detect the volume mounted there. Unfortunately, there is no simple way @@ -501,14 +501,14 @@ TclWinDriveLetterForVolMountPoint( Tcl_MutexLock(&mountPointMap); dlIter = driveLetterLookup; while (dlIter != NULL) { - if (wcscmp(dlIter->volumeName, mountPoint) == 0) { + if (_tcscmp(dlIter->volumeName, mountPoint) == 0) { /* * We need to check whether this information is still valid, since * either the user or various programs could have adjusted the * mount points on the fly. */ - drive[0] = L'A' + (dlIter->driveLetter - 'A'); + drive[0] = (TCHAR) dlIter->driveLetter; /* * Try to read the volume mount point and see where it points. @@ -516,7 +516,7 @@ TclWinDriveLetterForVolMountPoint( if (GetVolumeNameForVolumeMountPoint(drive, Target, 55) != 0) { - if (wcscmp(dlIter->volumeName, Target) == 0) { + if (_tcscmp(dlIter->volumeName, Target) == 0) { /* * Nothing has changed. */ @@ -579,7 +579,7 @@ TclWinDriveLetterForVolMountPoint( for (dlIter = driveLetterLookup; dlIter != NULL; dlIter = dlIter->nextPtr) { - if (wcscmp(dlIter->volumeName, Target) == 0) { + if (_tcscmp(dlIter->volumeName, Target) == 0) { alreadyStored = 1; break; } @@ -587,7 +587,7 @@ TclWinDriveLetterForVolMountPoint( if (!alreadyStored) { dlPtr2 = (MountPointMap *) ckalloc(sizeof(MountPointMap)); dlPtr2->volumeName = TclNativeDupInternalRep(Target); - dlPtr2->driveLetter = 'A' + (drive[0] - L'A'); + dlPtr2->driveLetter = (char) drive[0]; dlPtr2->nextPtr = driveLetterLookup; driveLetterLookup = dlPtr2; } @@ -600,7 +600,7 @@ TclWinDriveLetterForVolMountPoint( for (dlIter = driveLetterLookup; dlIter != NULL; dlIter = dlIter->nextPtr) { - if (wcscmp(dlIter->volumeName, mountPoint) == 0) { + if (_tcscmp(dlIter->volumeName, mountPoint) == 0) { Tcl_MutexUnlock(&mountPointMap); return dlIter->driveLetter; } diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 47c1b09..a35cc3b 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.68 2010/09/21 21:50:35 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.69 2010/10/12 10:21:55 nijtmans Exp $ */ #include "tclWinInt.h" @@ -277,7 +277,7 @@ DoRenameFile( [registration] "m" (registration), [nativeDst] "m" (nativeDst), [nativeSrc] "m" (nativeSrc), - [moveFile] "r" (tclWinProcs->moveFileProc) + [moveFile] "r" (MoveFile) : "%eax", "%ebx", "%ecx", "%edx", "memory" ); @@ -288,7 +288,7 @@ DoRenameFile( #ifndef HAVE_NO_SEH __try { #endif - if ((*tclWinProcs->moveFileProc)(nativeSrc, nativeDst) != FALSE) { + if ((*MoveFile)(nativeSrc, nativeDst) != FALSE) { retval = TCL_OK; } #ifndef HAVE_NO_SEH @@ -302,10 +302,10 @@ DoRenameFile( TclWinConvertError(GetLastError()); - srcAttr = tclWinProcs->getFileAttributesProc(nativeSrc); - dstAttr = tclWinProcs->getFileAttributesProc(nativeDst); + srcAttr = GetFileAttributes(nativeSrc); + dstAttr = GetFileAttributes(nativeDst); if (srcAttr == 0xffffffff) { - if (tclWinProcs->getFullPathNameProc(nativeSrc, 0, NULL, + if (GetFullPathName(nativeSrc, 0, NULL, NULL) >= MAX_PATH) { errno = ENAMETOOLONG; return TCL_ERROR; @@ -313,7 +313,7 @@ DoRenameFile( srcAttr = 0; } if (dstAttr == 0xffffffff) { - if (tclWinProcs->getFullPathNameProc(nativeDst, 0, NULL, + if (GetFullPathName(nativeDst, 0, NULL, NULL) >= MAX_PATH) { errno = ENAMETOOLONG; return TCL_ERROR; @@ -336,21 +336,21 @@ DoRenameFile( Tcl_DString srcString, dstString; const char *src, *dst; - size = tclWinProcs->getFullPathNameProc(nativeSrc, MAX_PATH, + size = GetFullPathName(nativeSrc, MAX_PATH, nativeSrcPath, &nativeSrcRest); if ((size == 0) || (size > MAX_PATH)) { return TCL_ERROR; } - size = tclWinProcs->getFullPathNameProc(nativeDst, MAX_PATH, + size = GetFullPathName(nativeDst, MAX_PATH, nativeDstPath, &nativeDstRest); if ((size == 0) || (size > MAX_PATH)) { return TCL_ERROR; } - tclWinProcs->charLowerProc(nativeSrcPath); - tclWinProcs->charLowerProc(nativeDstPath); + CharLower(nativeSrcPath); + CharLower(nativeDstPath); - src = tclWinProcs->tchar2utf(nativeSrcPath, -1, &srcString); - dst = tclWinProcs->tchar2utf(nativeDstPath, -1, &dstString); + src = Tcl_WinTCharToUtf(nativeSrcPath, -1, &srcString); + dst = Tcl_WinTCharToUtf(nativeDstPath, -1, &dstString); /* * Check whether the destination path is actually inside the @@ -429,7 +429,7 @@ DoRenameFile( * directory back, for completeness. */ - if (tclWinProcs->moveFileProc(nativeSrc, + if (MoveFile(nativeSrc, nativeDst) != FALSE) { return TCL_OK; } @@ -440,8 +440,8 @@ DoRenameFile( */ TclWinConvertError(GetLastError()); - tclWinProcs->createDirectoryProc(nativeDst, NULL); - tclWinProcs->setFileAttributesProc(nativeDst, dstAttr); + CreateDirectory(nativeDst, NULL); + SetFileAttributes(nativeDst, dstAttr); if (Tcl_GetErrno() == EACCES) { /* * Decode the EACCES to a more meaningful error. @@ -470,7 +470,7 @@ DoRenameFile( int result, size; TCHAR tempBuf[MAX_PATH]; - size = tclWinProcs->getFullPathNameProc(nativeDst, MAX_PATH, + size = GetFullPathName(nativeDst, MAX_PATH, tempBuf, &nativeRest); if ((size == 0) || (size > MAX_PATH) || (nativeRest == NULL)) { return TCL_ERROR; @@ -480,7 +480,7 @@ DoRenameFile( result = TCL_ERROR; nativePrefix = (TCHAR *) L"tclr"; - if (tclWinProcs->getTempFileNameProc(nativeTmp, nativePrefix, + if (GetTempFileName(nativeTmp, nativePrefix, 0, tempBuf) != 0) { /* * Strictly speaking, need the following DeleteFile and @@ -489,19 +489,16 @@ DoRenameFile( * same temp file. */ - nativeTmp = (TCHAR *) tempBuf; - tclWinProcs->deleteFileProc(nativeTmp); - if (tclWinProcs->moveFileProc(nativeDst, - nativeTmp) != FALSE) { - if (tclWinProcs->moveFileProc(nativeSrc, - nativeDst) != FALSE) { - tclWinProcs->setFileAttributesProc(nativeTmp, - FILE_ATTRIBUTE_NORMAL); - tclWinProcs->deleteFileProc(nativeTmp); + nativeTmp = tempBuf; + DeleteFile(nativeTmp); + if (MoveFile(nativeDst, nativeTmp) != FALSE) { + if (MoveFile(nativeSrc, nativeDst) != FALSE) { + SetFileAttributes(nativeTmp, FILE_ATTRIBUTE_NORMAL); + DeleteFile(nativeTmp); return TCL_OK; } else { - tclWinProcs->deleteFileProc(nativeDst); - tclWinProcs->moveFileProc(nativeTmp, nativeDst); + DeleteFile(nativeDst); + MoveFile(nativeTmp, nativeDst); } } @@ -668,7 +665,7 @@ DoCopyFile( [registration] "m" (registration), [nativeDst] "m" (nativeDst), [nativeSrc] "m" (nativeSrc), - [copyFile] "r" (tclWinProcs->copyFileProc) + [copyFile] "r" (CopyFile) : "%eax", "%ebx", "%ecx", "%edx", "memory" ); @@ -679,7 +676,7 @@ DoCopyFile( #ifndef HAVE_NO_SEH __try { #endif - if ((*tclWinProcs->copyFileProc)(nativeSrc, nativeDst, 0) != FALSE) { + if (CopyFile(nativeSrc, nativeDst, 0) != FALSE) { retval = TCL_OK; } #ifndef HAVE_NO_SEH @@ -699,8 +696,8 @@ DoCopyFile( if (Tcl_GetErrno() == EACCES) { DWORD srcAttr, dstAttr; - srcAttr = tclWinProcs->getFileAttributesProc(nativeSrc); - dstAttr = tclWinProcs->getFileAttributesProc(nativeDst); + srcAttr = GetFileAttributes(nativeSrc); + dstAttr = GetFileAttributes(nativeDst); if (srcAttr != 0xffffffff) { if (dstAttr == 0xffffffff) { dstAttr = 0; @@ -716,9 +713,9 @@ DoCopyFile( Tcl_SetErrno(EISDIR); } if (dstAttr & FILE_ATTRIBUTE_READONLY) { - tclWinProcs->setFileAttributesProc(nativeDst, + SetFileAttributes(nativeDst, dstAttr & ~((DWORD)FILE_ATTRIBUTE_READONLY)); - if (tclWinProcs->copyFileProc(nativeSrc, nativeDst, + if (CopyFile(nativeSrc, nativeDst, 0) != FALSE) { return TCL_OK; } @@ -729,7 +726,7 @@ DoCopyFile( */ TclWinConvertError(GetLastError()); - tclWinProcs->setFileAttributesProc(nativeDst, dstAttr); + SetFileAttributes(nativeDst, dstAttr); } } } @@ -785,13 +782,13 @@ TclpDeleteFile( return TCL_ERROR; } - if (tclWinProcs->deleteFileProc(path) != FALSE) { + if (DeleteFile(path) != FALSE) { return TCL_OK; } TclWinConvertError(GetLastError()); if (Tcl_GetErrno() == EACCES) { - attr = tclWinProcs->getFileAttributesProc(path); + attr = GetFileAttributes(path); if (attr != 0xffffffff) { if (attr & FILE_ATTRIBUTE_DIRECTORY) { if (attr & FILE_ATTRIBUTE_REPARSE_POINT) { @@ -812,21 +809,21 @@ TclpDeleteFile( Tcl_SetErrno(EISDIR); } else if (attr & FILE_ATTRIBUTE_READONLY) { - int res = tclWinProcs->setFileAttributesProc(path, + int res = SetFileAttributes(path, attr & ~((DWORD) FILE_ATTRIBUTE_READONLY)); if ((res != 0) && - (tclWinProcs->deleteFileProc(path) != FALSE)) { + (DeleteFile(path) != FALSE)) { return TCL_OK; } TclWinConvertError(GetLastError()); if (res != 0) { - tclWinProcs->setFileAttributesProc(path, attr); + SetFileAttributes(path, attr); } } } } else if (Tcl_GetErrno() == ENOENT) { - attr = tclWinProcs->getFileAttributesProc(path); + attr = GetFileAttributes(path); if (attr != 0xffffffff) { if (attr & FILE_ATTRIBUTE_DIRECTORY) { /* @@ -885,7 +882,7 @@ static int DoCreateDirectory( const TCHAR *nativePath) /* Pathname of directory to create (native). */ { - if (tclWinProcs->createDirectoryProc(nativePath, NULL) == 0) { + if (CreateDirectory(nativePath, NULL) == 0) { DWORD error = GetLastError(); TclWinConvertError(error); @@ -935,8 +932,8 @@ TclpObjCopyDirectory( return TCL_ERROR; } - tclWinProcs->utf2tchar(Tcl_GetString(normSrcPtr), -1, &srcString); - tclWinProcs->utf2tchar(Tcl_GetString(normDestPtr), -1, &dstString); + Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString); + Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString); ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds); @@ -1008,7 +1005,7 @@ TclpObjRemoveDirectory( if (normPtr == NULL) { return TCL_ERROR; } - tclWinProcs->utf2tchar(Tcl_GetString(normPtr), -1, &native); + Tcl_WinUtfToTChar(Tcl_GetString(normPtr), -1, &native); ret = DoRemoveDirectory(&native, recursive, &ds); Tcl_DStringFree(&native); } else { @@ -1054,7 +1051,7 @@ DoRemoveJustDirectory( goto end; } - attr = tclWinProcs->getFileAttributesProc(nativePath); + attr = GetFileAttributes(nativePath); if (attr & FILE_ATTRIBUTE_REPARSE_POINT) { /* @@ -1068,7 +1065,7 @@ DoRemoveJustDirectory( * Ordinary directory. */ - if (tclWinProcs->removeDirectoryProc(nativePath) != FALSE) { + if (RemoveDirectory(nativePath) != FALSE) { return TCL_OK; } } @@ -1076,7 +1073,7 @@ DoRemoveJustDirectory( TclWinConvertError(GetLastError()); if (Tcl_GetErrno() == EACCES) { - attr = tclWinProcs->getFileAttributesProc(nativePath); + attr = GetFileAttributes(nativePath); if (attr != 0xffffffff) { if ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) { /* @@ -1100,15 +1097,15 @@ DoRemoveJustDirectory( if (attr & FILE_ATTRIBUTE_READONLY) { attr &= ~FILE_ATTRIBUTE_READONLY; - if (tclWinProcs->setFileAttributesProc(nativePath, + if (SetFileAttributes(nativePath, attr) == FALSE) { goto end; } - if (tclWinProcs->removeDirectoryProc(nativePath) != FALSE) { + if (RemoveDirectory(nativePath) != FALSE) { return TCL_OK; } TclWinConvertError(GetLastError()); - tclWinProcs->setFileAttributesProc(nativePath, + SetFileAttributes(nativePath, attr | FILE_ATTRIBUTE_READONLY); } @@ -1176,7 +1173,7 @@ DoRemoveJustDirectory( end: if (errorPtr != NULL) { - tclWinProcs->tchar2utf(nativePath, -1, errorPtr); + Tcl_WinTCharToUtf(nativePath, -1, errorPtr); } return TCL_ERROR; @@ -1247,7 +1244,7 @@ TraverseWinTree( TCHAR *nativeSource, *nativeTarget, *nativeErrfile; int result, found, sourceLen, targetLen = 0, oldSourceLen, oldTargetLen; HANDLE handle; - WIN32_FIND_DATAT data; + WIN32_FIND_DATA data; nativeErrfile = NULL; result = TCL_OK; @@ -1258,7 +1255,7 @@ TraverseWinTree( (targetPtr == NULL ? NULL : Tcl_DStringValue(targetPtr)); oldSourceLen = Tcl_DStringLength(sourcePtr); - sourceAttr = tclWinProcs->getFileAttributesProc(nativeSource); + sourceAttr = GetFileAttributes(nativeSource); if (sourceAttr == 0xffffffff) { nativeErrfile = nativeSource; goto end; @@ -1285,7 +1282,7 @@ TraverseWinTree( Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1); nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr); - handle = tclWinProcs->findFirstFileProc(nativeSource, &data); + handle = FindFirstFile(nativeSource, &data); if (handle == INVALID_HANDLE_VALUE) { /* * Can't read directory. @@ -1318,11 +1315,11 @@ TraverseWinTree( } found = 1; - for (; found; found = tclWinProcs->findNextFileProc(handle, &data)) { + for (; found; found = FindNextFile(handle, &data)) { TCHAR *nativeName; int len; - WCHAR *wp = data.w.cFileName; + WCHAR *wp = data.cFileName; if (*wp == '.') { wp++; if (*wp == '.') { @@ -1332,8 +1329,8 @@ TraverseWinTree( continue; } } - nativeName = (TCHAR *) data.w.cFileName; - len = wcslen(data.w.cFileName) * sizeof(WCHAR); + nativeName = (TCHAR *) data.cFileName; + len = wcslen(data.cFileName) * sizeof(WCHAR); /* * Append name after slash, and recurse on the file. @@ -1387,7 +1384,7 @@ TraverseWinTree( if (nativeErrfile != NULL) { TclWinConvertError(GetLastError()); if (errorPtr != NULL) { - tclWinProcs->tchar2utf(nativeErrfile, -1, errorPtr); + Tcl_WinTCharToUtf(nativeErrfile, -1, errorPtr); } result = TCL_ERROR; } @@ -1433,9 +1430,9 @@ TraversalCopy( break; case DOTREE_PRED: if (DoCreateDirectory(nativeDst) == TCL_OK) { - DWORD attr = tclWinProcs->getFileAttributesProc(nativeSrc); + DWORD attr = GetFileAttributes(nativeSrc); - if (tclWinProcs->setFileAttributesProc(nativeDst, + if (SetFileAttributes(nativeDst, attr) != FALSE) { return TCL_OK; } @@ -1452,7 +1449,7 @@ TraversalCopy( */ if (errorPtr != NULL) { - tclWinProcs->tchar2utf(nativeDst, -1, errorPtr); + Tcl_WinTCharToUtf(nativeDst, -1, errorPtr); } return TCL_ERROR; } @@ -1507,7 +1504,7 @@ TraversalDelete( } if (errorPtr != NULL) { - tclWinProcs->tchar2utf(nativeSrc, -1, errorPtr); + Tcl_WinTCharToUtf(nativeSrc, -1, errorPtr); } return TCL_ERROR; } @@ -1571,7 +1568,7 @@ GetWinFileAttributes( int attr; nativeName = Tcl_FSGetNativePath(fileName); - result = tclWinProcs->getFileAttributesProc(nativeName); + result = GetFileAttributes(nativeName); if (result == 0xffffffff) { StatError(interp, fileName); @@ -1701,7 +1698,7 @@ ConvertFileNameFormat( const TCHAR *nativeName; const char *tempString; int tempLen; - WIN32_FIND_DATAT data; + WIN32_FIND_DATA data; HANDLE handle; DWORD attr; @@ -1715,9 +1712,9 @@ ConvertFileNameFormat( Tcl_DStringInit(&ds); tempString = Tcl_GetStringFromObj(tempPath,&tempLen); - nativeName = tclWinProcs->utf2tchar(tempString, tempLen, &ds); + nativeName = Tcl_WinUtfToTChar(tempString, tempLen, &ds); Tcl_DecrRefCount(tempPath); - handle = tclWinProcs->findFirstFileProc(nativeName, &data); + handle = FindFirstFile(nativeName, &data); if (handle == INVALID_HANDLE_VALUE) { /* * FindFirstFile() doesn't like root directories. We would @@ -1726,7 +1723,7 @@ ConvertFileNameFormat( * root directory */ - attr = tclWinProcs->getFileAttributesProc(nativeName); + attr = GetFileAttributes(nativeName); if ((attr!=0xFFFFFFFF) && (attr & FILE_ATTRIBUTE_DIRECTORY)) { Tcl_DStringFree(&ds); goto simple; @@ -1740,14 +1737,14 @@ ConvertFileNameFormat( } goto cleanup; } - nativeName = (TCHAR *) data.w.cAlternateFileName; + nativeName = data.cAlternateFileName; if (longShort) { - if (data.w.cFileName[0] != '\0') { - nativeName = (TCHAR *) data.w.cFileName; + if (data.cFileName[0] != TEXT('\0')) { + nativeName = data.cFileName; } } else { - if (data.w.cAlternateFileName[0] == '\0') { - nativeName = (TCHAR *) data.w.cFileName; + if (data.cAlternateFileName[0] == TEXT('\0')) { + nativeName = (TCHAR *) data.cFileName; } } @@ -1764,7 +1761,7 @@ ConvertFileNameFormat( */ Tcl_DStringInit(&dsTemp); - tclWinProcs->tchar2utf(nativeName, -1, &dsTemp); + Tcl_WinTCharToUtf(nativeName, -1, &dsTemp); /* * Deal with issues of tildes being absolute. @@ -1897,7 +1894,7 @@ SetWinFileAttributes( const TCHAR *nativeName; nativeName = Tcl_FSGetNativePath(fileName); - fileAttributes = tclWinProcs->getFileAttributesProc(nativeName); + fileAttributes = GetFileAttributes(nativeName); if (fileAttributes == 0xffffffff) { StatError(interp, fileName); @@ -1915,7 +1912,7 @@ SetWinFileAttributes( fileAttributes &= ~(attributeArray[objIndex]); } - if (!tclWinProcs->setFileAttributesProc(nativeName, fileAttributes)) { + if (!SetFileAttributes(nativeName, fileAttributes)) { StatError(interp, fileName); return TCL_ERROR; } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index e43e593..e3d674b 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.114 2010/10/11 12:11:53 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.115 2010/10/12 10:21:55 nijtmans Exp $ */ #include "tclWinInt.h" @@ -200,7 +200,7 @@ WinLink( * Get the full path referenced by the target. */ - if (!tclWinProcs->getFullPathNameProc(linkTargetPath, MAX_PATH, + if (!GetFullPathName(linkTargetPath, MAX_PATH, tempFileName, &tempFilePart)) { /* * Invalid file. @@ -214,7 +214,7 @@ WinLink( * Make sure source file doesn't exist. */ - attr = tclWinProcs->getFileAttributesProc(linkSourcePath); + attr = GetFileAttributes(linkSourcePath); if (attr != INVALID_FILE_ATTRIBUTES) { Tcl_SetErrno(EEXIST); return -1; @@ -224,7 +224,7 @@ WinLink( * Get the full path referenced by the source file/directory. */ - if (!tclWinProcs->getFullPathNameProc(linkSourcePath, MAX_PATH, + if (!GetFullPathName(linkSourcePath, MAX_PATH, tempFileName, &tempFilePart)) { /* * Invalid file. @@ -238,7 +238,7 @@ WinLink( * Check the target. */ - attr = tclWinProcs->getFileAttributesProc(linkTargetPath); + attr = GetFileAttributes(linkTargetPath); if (attr == INVALID_FILE_ATTRIBUTES) { /* * The target doesn't exist. @@ -252,13 +252,13 @@ WinLink( * It is a file. */ - if (tclWinProcs->createHardLinkProc == NULL) { + if (CreateHardLink == NULL) { Tcl_SetErrno(ENOTDIR); return -1; } if (linkAction & TCL_CREATE_HARD_LINK) { - if (!tclWinProcs->createHardLinkProc(linkSourcePath, + if (!CreateHardLink(linkSourcePath, linkTargetPath, NULL)) { TclWinConvertError(GetLastError()); return -1; @@ -321,7 +321,7 @@ WinReadLink( * Get the full path referenced by the target. */ - if (!tclWinProcs->getFullPathNameProc(linkSourcePath, MAX_PATH, + if (!GetFullPathName(linkSourcePath, MAX_PATH, tempFileName, &tempFilePart)) { /* * Invalid file. @@ -335,7 +335,7 @@ WinReadLink( * Make sure source file does exist. */ - attr = tclWinProcs->getFileAttributesProc(linkSourcePath); + attr = GetFileAttributes(linkSourcePath); if (attr == INVALID_FILE_ATTRIBUTES) { /* * The source doesn't exist. @@ -492,7 +492,7 @@ TclWinSymLinkDelete( memset(reparseBuffer, 0, sizeof(DUMMY_REPARSE_BUFFER)); reparseBuffer->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; - hFile = tclWinProcs->createFileProc(linkOrigPath, GENERIC_WRITE, 0, NULL, + hFile = CreateFile(linkOrigPath, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -508,7 +508,7 @@ TclWinSymLinkDelete( } else { CloseHandle(hFile); if (!linkOnly) { - tclWinProcs->removeDirectoryProc(linkOrigPath); + RemoveDirectory(linkOrigPath); } return 0; } @@ -548,7 +548,7 @@ WinReadLinkDirectory( Tcl_DString ds; const char *copy; - attr = tclWinProcs->getFileAttributesProc(linkDirPath); + attr = GetFileAttributes(linkDirPath); if (!(attr & FILE_ATTRIBUTE_REPARSE_POINT)) { goto invalidError; } @@ -635,7 +635,7 @@ WinReadLinkDirectory( } } - tclWinProcs->tchar2utf((const TCHAR *) + Tcl_WinTCharToUtf((const TCHAR *) reparseBuffer->MountPointReparseBuffer.PathBuffer, (int) reparseBuffer->MountPointReparseBuffer .SubstituteNameLength, &ds); @@ -676,7 +676,7 @@ NativeReadReparse( HANDLE hFile; DWORD returnedLength; - hFile = tclWinProcs->createFileProc(linkDirPath, GENERIC_READ, 0, NULL, + hFile = CreateFile(linkDirPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -736,7 +736,7 @@ NativeWriteReparse( * Create the directory - it must not already exist. */ - if (tclWinProcs->createDirectoryProc(linkDirPath, NULL) == 0) { + if (CreateDirectory(linkDirPath, NULL) == 0) { /* * Error creating directory. */ @@ -744,7 +744,7 @@ NativeWriteReparse( TclWinConvertError(GetLastError()); return -1; } - hFile = tclWinProcs->createFileProc(linkDirPath, GENERIC_WRITE, 0, NULL, + hFile = CreateFile(linkDirPath, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hFile == INVALID_HANDLE_VALUE) { @@ -769,7 +769,7 @@ NativeWriteReparse( TclWinConvertError(GetLastError()); CloseHandle(hFile); - tclWinProcs->removeDirectoryProc(linkDirPath); + RemoveDirectory(linkDirPath); return -1; } CloseHandle(hFile); @@ -879,15 +879,15 @@ TclpMatchInDirectory( native = Tcl_FSGetNativePath(pathPtr); - if (tclWinProcs->getFileAttributesExProc == NULL) { - attr = tclWinProcs->getFileAttributesProc(native); + if (GetFileAttributesEx == NULL) { + attr = GetFileAttributes(native); if (attr == INVALID_FILE_ATTRIBUTES) { return TCL_OK; } } else { WIN32_FILE_ATTRIBUTE_DATA data; - if (tclWinProcs->getFileAttributesExProc(native, + if (GetFileAttributesEx(native, GetFileExInfoStandard, &data) != TRUE) { return TCL_OK; } @@ -902,7 +902,7 @@ TclpMatchInDirectory( } else { DWORD attr; HANDLE handle; - WIN32_FIND_DATAT data; + WIN32_FIND_DATA data; const char *dirName; /* UTF-8 dir name, later with pattern * appended. */ int dirLength; @@ -931,7 +931,7 @@ TclpMatchInDirectory( if (native == NULL) { return TCL_OK; } - attr = tclWinProcs->getFileAttributesProc(native); + attr = GetFileAttributes(native); if ((attr == INVALID_FILE_ATTRIBUTES) || ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0)) { @@ -972,16 +972,16 @@ TclpMatchInDirectory( dirName = Tcl_DStringAppend(&dsOrig, "*.*", 3); } - native = tclWinProcs->utf2tchar(dirName, -1, &ds); - if (tclWinProcs->findFirstFileExProc == NULL || (types == NULL) + native = Tcl_WinUtfToTChar(dirName, -1, &ds); + if (FindFirstFileEx == NULL || (types == NULL) || (types->type != TCL_GLOB_TYPE_DIR)) { - handle = tclWinProcs->findFirstFileProc(native, &data); + handle = FindFirstFile(native, &data); } else { /* * We can be more efficient, for pure directory requests. */ - handle = tclWinProcs->findFirstFileExProc(native, + handle = FindFirstFileEx(native, FindExInfoStandard, &data, FindExSearchLimitToDirectories, NULL, 0); } @@ -1044,9 +1044,9 @@ TclpMatchInDirectory( int checkDrive = 0, isDrive; DWORD attr; - native = (const TCHAR *) data.w.cFileName; - attr = data.w.dwFileAttributes; - utfname = tclWinProcs->tchar2utf(native, -1, &ds); + native = data.cFileName; + attr = data.dwFileAttributes; + utfname = Tcl_WinTCharToUtf(native, -1, &ds); if (!matchSpecialDots) { /* @@ -1105,7 +1105,7 @@ TclpMatchInDirectory( */ Tcl_DStringFree(&ds); - } while (tclWinProcs->findNextFileProc(handle, &data) == TRUE); + } while (FindNextFile(handle, &data) == TRUE); FindClose(handle); Tcl_DStringFree(&dsOrig); @@ -1486,18 +1486,18 @@ NativeAccess( { DWORD attr; - attr = tclWinProcs->getFileAttributesProc(nativePath); + attr = GetFileAttributes(nativePath); if (attr == INVALID_FILE_ATTRIBUTES) { /* * File might not exist. */ - WIN32_FIND_DATAT ffd; + WIN32_FIND_DATA ffd; HANDLE hFind; - hFind = tclWinProcs->findFirstFileProc(nativePath, &ffd); + hFind = FindFirstFile(nativePath, &ffd); if (hFind != INVALID_HANDLE_VALUE) { - attr = ffd.w.dwFileAttributes; + attr = ffd.dwFileAttributes; FindClose(hFind); } else { TclWinConvertError(GetLastError()); @@ -1505,19 +1505,20 @@ NativeAccess( } } +#ifndef UNICODE if ((mode & W_OK) - && (tclWinProcs->getFileSecurityProc == NULL) && (attr & FILE_ATTRIBUTE_READONLY)) { /* - * We don't have the advanced 'getFileSecurityProc', and our + * We don't have the advanced 'GetFileSecurity', and our * attributes say the file is not writable. If we do have - * 'getFileSecurityProc', we'll do a more robust XP-related check + * 'GetFileSecurity', we'll do a more robust XP-related check * below. */ Tcl_SetErrno(EACCES); return -1; } +#endif /* !UNICODE */ if (mode & X_OK) { if (!(attr & FILE_ATTRIBUTE_DIRECTORY) && !NativeIsExec(nativePath)) { @@ -1542,7 +1543,7 @@ NativeAccess( * readable' is 5-6 times slower than 'file exists'). */ - if ((mode != F_OK) && (tclWinProcs->getFileSecurityProc != NULL)) { + if (mode != F_OK) { SECURITY_DESCRIPTOR *sdPtr = NULL; unsigned long size; GENERIC_MAPPING genMap; @@ -1558,7 +1559,7 @@ NativeAccess( */ size = 0; - tclWinProcs->getFileSecurityProc(nativePath, + GetFileSecurity(nativePath, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, 0, 0, &size); @@ -1591,7 +1592,7 @@ NativeAccess( * Call GetFileSecurity() for real. */ - if (!tclWinProcs->getFileSecurityProc(nativePath, + if (!GetFileSecurity(nativePath, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, sdPtr, size, &size)) { /* @@ -1606,14 +1607,14 @@ NativeAccess( * thread token. */ - if (!tclWinProcs->impersonateSelfProc(SecurityImpersonation)) { + if (!ImpersonateSelf(SecurityImpersonation)) { /* * Unable to perform security impersonation. */ goto accessError; } - if (!tclWinProcs->openThreadTokenProc(GetCurrentThread(), + if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, FALSE, &hToken)) { /* * Unable to get current thread's token. @@ -1622,7 +1623,7 @@ NativeAccess( goto accessError; } - tclWinProcs->revertToSelfProc(); + RevertToSelf(); /* * Setup desiredAccess according to the access priveleges we are @@ -1649,7 +1650,7 @@ NativeAccess( * Perform access check using the token. */ - if (!tclWinProcs->accessCheckProc(sdPtr, hToken, desiredAccess, + if (!AccessCheck(sdPtr, hToken, desiredAccess, &genMap, &privSet, &privSetSize, &grantedAccess, &accessYesNo)) { /* @@ -1765,12 +1766,12 @@ TclpObjChdir( * Cygwin chdir only groks POSIX path. */ - path = tclWinProcs->tchar2utf(nativePath, -1, &ds); + path = Tcl_WinTCharToUtf(nativePath, -1, &ds); cygwin_conv_to_posix_path(path, posixPath); result = (chdir(posixPath) == 0 ? 1 : 0); Tcl_DStringFree(&ds); #else /* __CYGWIN__ */ - result = tclWinProcs->setCurrentDirectoryProc(nativePath); + result = SetCurrentDirectory(nativePath); #endif /* __CYGWIN__ */ if (result == 0) { @@ -1857,7 +1858,7 @@ TclpGetCwd( char *p; WCHAR *native; - if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) { + if (GetCurrentDirectory(MAX_PATH, buffer) == 0) { TclWinConvertError(GetLastError()); if (interp != NULL) { Tcl_AppendResult(interp, "error getting working directory name: ", @@ -1875,7 +1876,7 @@ TclpGetCwd( && (native[2] == '\\') && (native[3] == '\\')) { native += 2; } - tclWinProcs->tchar2utf((TCHAR *) native, -1, bufferPtr); + Tcl_WinTCharToUtf((TCHAR *) native, -1, bufferPtr); /* * Convert to forward slashes for easier use in scripts. @@ -1949,7 +1950,7 @@ NativeStat( * simpler routines. */ - fileHandle = tclWinProcs->createFileProc(nativePath, GENERIC_READ, + fileHandle = CreateFile(nativePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL); @@ -1988,23 +1989,23 @@ NativeStat( */ inode = data.nFileIndexHigh | data.nFileIndexLow; - } else if (tclWinProcs->getFileAttributesExProc != NULL) { + } else { /* * Fall back on the less capable routines. This means no nlink or ino. */ WIN32_FILE_ATTRIBUTE_DATA data; - if (tclWinProcs->getFileAttributesExProc(nativePath, + if (GetFileAttributesEx(nativePath, GetFileExInfoStandard, &data) != TRUE) { /* * We might have just been denied access */ - WIN32_FIND_DATAT ffd; + WIN32_FIND_DATA ffd; HANDLE hFind; - hFind = tclWinProcs->findFirstFileProc(nativePath, &ffd); + hFind = FindFirstFile(nativePath, &ffd); if (hFind != INVALID_HANDLE_VALUE) { memcpy(&data, &ffd, sizeof(data)); FindClose(hFind); @@ -2021,46 +2022,6 @@ NativeStat( statPtr->st_atime = ToCTime(data.ftLastAccessTime); statPtr->st_mtime = ToCTime(data.ftLastWriteTime); statPtr->st_ctime = ToCTime(data.ftCreationTime); - } else { - /* - * We don't have the faster attributes proc, so we're probably running - * on Win95. - */ - - WIN32_FIND_DATAT data; - HANDLE handle; - - handle = tclWinProcs->findFirstFileProc(nativePath, &data); - if (handle == INVALID_HANDLE_VALUE) { - /* - * FindFirstFile() doesn't work on root directories, so call - * GetFileAttributes() to see if the specified file exists. - */ - - attr = tclWinProcs->getFileAttributesProc(nativePath); - if (attr == INVALID_FILE_ATTRIBUTES) { - Tcl_SetErrno(ENOENT); - return -1; - } - - /* - * Make up some fake information for this file. It has the correct - * file attributes and a time of 0. - */ - - memset(&data, 0, sizeof(data)); - data.a.dwFileAttributes = attr; - } else { - FindClose(handle); - } - - attr = data.a.dwFileAttributes; - - statPtr->st_size = ((Tcl_WideInt) data.a.nFileSizeLow) | - (((Tcl_WideInt) data.a.nFileSizeHigh) << 32); - statPtr->st_atime = ToCTime(data.a.ftLastAccessTime); - statPtr->st_mtime = ToCTime(data.a.ftLastWriteTime); - statPtr->st_ctime = ToCTime(data.a.ftCreationTime); } dev = NativeDev(nativePath); @@ -2096,10 +2057,10 @@ NativeDev( TCHAR *nativePart; const char *fullPath; - tclWinProcs->getFullPathNameProc(nativePath, MAX_PATH, nativeFullPath, + GetFullPathName(nativePath, MAX_PATH, nativeFullPath, &nativePart); - fullPath = tclWinProcs->tchar2utf(nativeFullPath, -1, &ds); + fullPath = Tcl_WinTCharToUtf(nativeFullPath, -1, &ds); if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) { const char *p; @@ -2120,9 +2081,9 @@ NativeDev( } else { p++; } - nativeVol = tclWinProcs->utf2tchar(fullPath, p - fullPath, &volString); + nativeVol = Tcl_WinUtfToTChar(fullPath, p - fullPath, &volString); dw = (DWORD) -1; - tclWinProcs->getVolumeInformationProc(nativeVol, NULL, 0, &dw, NULL, + GetVolumeInformation(nativeVol, NULL, 0, &dw, NULL, NULL, NULL, 0); /* @@ -2268,13 +2229,13 @@ TclpGetNativeCwd( { TCHAR buffer[MAX_PATH]; - if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) { + if (GetCurrentDirectory(MAX_PATH, buffer) == 0) { TclWinConvertError(GetLastError()); return NULL; } if (clientData != NULL) { - if (wcscmp((const WCHAR*)clientData, (const WCHAR*)buffer) == 0) { + if (_tcscmp((const TCHAR*)clientData, buffer) == 0) { return clientData; } } @@ -2385,14 +2346,14 @@ TclpFilesystemPathType( firstSeparator = strchr(path, '/'); if (firstSeparator == NULL) { - found = tclWinProcs->getVolumeInformationProc( + found = GetVolumeInformation( Tcl_FSGetNativePath(pathPtr), NULL, 0, NULL, NULL, NULL, volType, VOL_BUF_SIZE); } else { Tcl_Obj *driveName = Tcl_NewStringObj(path, firstSeparator - path+1); Tcl_IncrRefCount(driveName); - found = tclWinProcs->getVolumeInformationProc( + found = GetVolumeInformation( Tcl_FSGetNativePath(driveName), NULL, 0, NULL, NULL, NULL, volType, VOL_BUF_SIZE); Tcl_DecrRefCount(driveName); @@ -2404,7 +2365,7 @@ TclpFilesystemPathType( Tcl_DString ds; Tcl_Obj *objPtr; - tclWinProcs->tchar2utf(volType, -1, &ds); + Tcl_WinTCharToUtf(volType, -1, &ds); objPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); @@ -2631,10 +2592,10 @@ TclpObjNormalizePath( */ WIN32_FILE_ATTRIBUTE_DATA data; - const TCHAR *nativePath = tclWinProcs->utf2tchar(path, + const TCHAR *nativePath = Tcl_WinUtfToTChar(path, currentPathEndPosition - path, &ds); - if (tclWinProcs->getFileAttributesExProc(nativePath, + if (GetFileAttributesEx(nativePath, GetFileExInfoStandard, &data) != TRUE) { /* * File doesn't exist. @@ -2826,8 +2787,8 @@ TclpObjNormalizePath( if (1) { WCHAR wpath[MAX_PATH]; const TCHAR *nativePath = - tclWinProcs->utf2tchar(path, lastValidPathEnd - path, &ds); - DWORD wpathlen = tclWinProcs->getLongPathNameProc(nativePath, + Tcl_WinUtfToTChar(path, lastValidPathEnd - path, &ds); + DWORD wpathlen = GetLongPathNameProc(nativePath, (TCHAR *) wpath, MAX_PATH); /* @@ -2857,7 +2818,7 @@ TclpObjNormalizePath( Tcl_DString dsTemp; - tclWinProcs->tchar2utf((const TCHAR *)Tcl_DStringValue(&dsNorm), + Tcl_WinTCharToUtf((const TCHAR *)Tcl_DStringValue(&dsNorm), Tcl_DStringLength(&dsNorm), &dsTemp); nextCheckpoint = Tcl_DStringLength(&dsTemp); if (*lastValidPathEnd != 0) { @@ -3035,7 +2996,7 @@ TclpNativeToNormalized( int len; char *copy, *p; - tclWinProcs->tchar2utf((const TCHAR *) clientData, -1, &ds); + Tcl_WinTCharToUtf((const TCHAR *) clientData, -1, &ds); copy = Tcl_DStringValue(&ds); len = Tcl_DStringLength(&ds); @@ -3129,7 +3090,7 @@ TclNativeCreateNativeRep( } } } - tclWinProcs->utf2tchar(str, len, &ds); + Tcl_WinUtfToTChar(str, len, &ds); len = Tcl_DStringLength(&ds) + sizeof(WCHAR); Tcl_DecrRefCount(validPathPtr); nativePathPtr = ckalloc((unsigned) len); @@ -3208,7 +3169,7 @@ TclpUtime( native = Tcl_FSGetNativePath(pathPtr); - attr = tclWinProcs->getFileAttributesProc(native); + attr = GetFileAttributes(native); if (attr != INVALID_FILE_ATTRIBUTES && attr & FILE_ATTRIBUTE_DIRECTORY) { flags = FILE_FLAG_BACKUP_SEMANTICS; @@ -3219,7 +3180,7 @@ TclpUtime( * savings complications that utime gets wrong. */ - fileHandle = tclWinProcs->createFileProc(native, FILE_WRITE_ATTRIBUTES, + fileHandle = CreateFile(native, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING, flags, NULL); if (fileHandle == INVALID_HANDLE_VALUE || diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 94aa045..f2e40d4 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInt.h,v 1.37 2010/09/09 14:30:20 nijtmans Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.38 2010/10/12 10:21:55 nijtmans Exp $ */ #ifndef _TCLWININT @@ -121,7 +121,7 @@ MODULE_SCOPE const TclWinProcs *const tclWinProcs; */ MODULE_SCOPE char TclWinDriveLetterForVolMountPoint( - const WCHAR *mountPoint); + const TCHAR *mountPoint); MODULE_SCOPE void TclWinEncodingsCleanup(); MODULE_SCOPE void TclWinInit(HINSTANCE hInst); MODULE_SCOPE TclFile TclWinMakeFile(HANDLE handle); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 3aa641a..a859c8c 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.84 2010/09/21 21:50:35 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.85 2010/10/12 10:21:55 nijtmans Exp $ */ #include "tclWinInt.h" @@ -478,14 +478,14 @@ TempFileName( * gets stored. */ { TCHAR *prefix = TEXT("TCL"); - if (tclWinProcs->getTempPathProc(MAX_PATH, name) != 0) { - if (tclWinProcs->getTempFileNameProc(name, prefix, 0, name) != 0) { + if (GetTempPath(MAX_PATH, name) != 0) { + if (GetTempFileName(name, prefix, 0, name) != 0) { return 1; } } name[0] = '.'; name[1] = '\0'; - return tclWinProcs->getTempFileNameProc(name, prefix, 0, name); + return GetTempFileName(name, prefix, 0, name); } /* @@ -589,7 +589,7 @@ TclpOpenFile( break; } - nativePath = tclWinProcs->utf2tchar(path, -1, &ds); + nativePath = Tcl_WinUtfToTChar(path, -1, &ds); /* * If the file is not being created, use the existing file attributes. @@ -597,7 +597,7 @@ TclpOpenFile( flags = 0; if (!(mode & O_CREAT)) { - flags = tclWinProcs->getFileAttributesProc(nativePath); + flags = GetFileAttributes(nativePath); if (flags == 0xFFFFFFFF) { flags = 0; } @@ -613,7 +613,7 @@ TclpOpenFile( * Now we get to create the file. */ - handle = tclWinProcs->createFileProc(nativePath, accessMode, shareMode, + handle = CreateFile(nativePath, accessMode, shareMode, NULL, createMode, flags, NULL); Tcl_DStringFree(&ds); @@ -670,7 +670,7 @@ TclpCreateTempFile( return NULL; } - handle = tclWinProcs->createFileProc((TCHAR *) name, + handle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, NULL); if (handle == INVALID_HANDLE_VALUE) { @@ -730,7 +730,7 @@ TclpCreateTempFile( TclWinConvertError(GetLastError()); CloseHandle(handle); - tclWinProcs->deleteFileProc((TCHAR *) name); + DeleteFile(name); return NULL; } @@ -1162,7 +1162,7 @@ TclpCreateProcess( BuildCommandLine(execPath, argc, argv, &cmdLine); - if (tclWinProcs->createProcessProc(NULL, + if (CreateProcess(NULL, (TCHAR *) Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo, &procInfo) == 0) { TclWinConvertError(GetLastError()); @@ -1319,9 +1319,9 @@ ApplicationType( for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) { Tcl_DStringSetLength(&nameBuf, nameLen); Tcl_DStringAppend(&nameBuf, extensions[i], -1); - nativeName = tclWinProcs->utf2tchar(Tcl_DStringValue(&nameBuf), + nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(&nameBuf), Tcl_DStringLength(&nameBuf), &ds); - found = tclWinProcs->searchPathProc(NULL, nativeName, NULL, MAX_PATH, + found = SearchPath(NULL, nativeName, NULL, MAX_PATH, nativeFullPath, &rest); Tcl_DStringFree(&ds); if (found == 0) { @@ -1333,11 +1333,11 @@ ApplicationType( * known type. */ - attr = tclWinProcs->getFileAttributesProc(nativeFullPath); + attr = GetFileAttributes(nativeFullPath); if ((attr == 0xffffffff) || (attr & FILE_ATTRIBUTE_DIRECTORY)) { continue; } - strcpy(fullName, tclWinProcs->tchar2utf(nativeFullPath, -1, &ds)); + strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); Tcl_DStringFree(&ds); ext = strrchr(fullName, '.'); @@ -1346,7 +1346,7 @@ ApplicationType( break; } - hFile = tclWinProcs->createFileProc(nativeFullPath, + hFile = CreateFile(nativeFullPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { @@ -1426,9 +1426,8 @@ ApplicationType( * application name from the arguments. */ - tclWinProcs->getShortPathNameProc(nativeFullPath, - nativeFullPath, MAX_PATH); - strcpy(fullName, tclWinProcs->tchar2utf(nativeFullPath, -1, &ds)); + GetShortPathName(nativeFullPath, nativeFullPath, MAX_PATH); + strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); Tcl_DStringFree(&ds); } return applType; @@ -1544,7 +1543,7 @@ BuildCommandLine( } } Tcl_DStringFree(linePtr); - tclWinProcs->utf2tchar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr); + Tcl_WinUtfToTChar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr); Tcl_DStringFree(&ds); } @@ -3104,7 +3103,7 @@ TclpOpenTemporaryFile( } namePtr = (char *) name; - length = tclWinProcs->getTempPathProc(MAX_PATH, name); + length = GetTempPath(MAX_PATH, name); if (length == 0) { goto gotError; } @@ -3112,7 +3111,7 @@ TclpOpenTemporaryFile( if (basenameObj) { const char *string = Tcl_GetStringFromObj(basenameObj, &length); - tclWinProcs->utf2tchar(string, length, &buf); + Tcl_WinUtfToTChar(string, length, &buf); memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)); namePtr += Tcl_DStringLength(&buf); Tcl_DStringFree(&buf); @@ -3132,12 +3131,12 @@ TclpOpenTemporaryFile( sprintf(number, "%d.TMP", counter); counter = (unsigned short) (counter + 1); - tclWinProcs->utf2tchar(number, strlen(number), &buf); + Tcl_WinUtfToTChar(number, strlen(number), &buf); Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf) + 1); memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf) + 1); Tcl_DStringFree(&buf); - handle = tclWinProcs->createFileProc((TCHAR *) name, + handle = CreateFile(name, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, flags, NULL); } while (handle == INVALID_HANDLE_VALUE && --counter2 > 0 diff --git a/win/tclWinSock.c b/win/tclWinSock.c index e7e8c61..1976d4b 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.76 2010/09/28 15:13:55 rmax Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.77 2010/10/12 10:21:55 nijtmans Exp $ * * ----------------------------------------------------------------------- * @@ -118,7 +118,7 @@ typedef struct SocketInfo SocketInfo; typedef struct TcpFdList { SocketInfo *infoPtr; - int fd; + SOCKET fd; struct TcpFdList *next; } TcpFdList; @@ -1016,7 +1016,7 @@ CreateSocket( u_long flag = 1; /* Indicates nonblocking mode. */ int asyncConnect = 0; /* Will be 1 if async connect is in * progress. */ - int chosenport = 0; + unsigned short chosenport = 0; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ struct addrinfo *myaddrlist = NULL, *myaddrPtr; /* Socket address for client */ const char *errorMsg = NULL; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 6b37f48..3e6c6e3 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinTest.c,v 1.28 2010/10/11 12:11:53 nijtmans Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.29 2010/10/12 10:21:55 nijtmans Exp $ */ #ifndef USE_TCL_STUBS @@ -505,10 +505,6 @@ TestplatformChmod( int res = 0; /* - * One time initialization, dynamically load Windows NT features - */ - - /* * Process the chmod request. */ |