Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 3781:a257e03c580e
[xemacs-hg @ 2007-01-08 13:33:42 by vins]
On Windows, check read-only bit first.
author | vins |
---|---|
date | Mon, 08 Jan 2007 13:33:43 +0000 |
parents | 6765f2581182 |
children | b98f0084dc23 |
comparison
equal
deleted
inserted
replaced
3780:48cade988b67 | 3781:a257e03c580e |
---|---|
2309 GENERIC_MAPPING genericMapping; | 2309 GENERIC_MAPPING genericMapping; |
2310 DWORD accessMask; | 2310 DWORD accessMask; |
2311 PRIVILEGE_SET PrivilegeSet; | 2311 PRIVILEGE_SET PrivilegeSet; |
2312 DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET ); | 2312 DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET ); |
2313 BOOL fAccessGranted = FALSE; | 2313 BOOL fAccessGranted = FALSE; |
2314 DWORD dwAccessAllowed; | 2314 DWORD dwAccessAllowed; |
2315 Extbyte *fnameext; | 2315 Extbyte *fnameext; |
2316 | 2316 |
2317 #ifdef CYGWIN | 2317 #ifdef CYGWIN |
2318 cygwin_conv_to_full_win32_path(filename, filename_buffer); | 2318 cygwin_conv_to_full_win32_path(filename, filename_buffer); |
2319 filename = (Ibyte*)filename_buffer; | 2319 filename = (Ibyte*)filename_buffer; |
2320 #endif | 2320 #endif |
2321 | 2321 |
2322 C_STRING_TO_TSTR(filename, fnameext); | 2322 C_STRING_TO_TSTR(filename, fnameext); |
2323 | |
2324 // First check for a normal file with the old-style readonly bit | |
2325 attributes = qxeGetFileAttributes(fnameext); | |
2326 if (FILE_ATTRIBUTE_READONLY == (attributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_READONLY))) | |
2327 return 0; | |
2328 | |
2323 /* Win32 prototype lacks const. */ | 2329 /* Win32 prototype lacks const. */ |
2324 error = qxeGetNamedSecurityInfo(fnameext, SE_FILE_OBJECT, | 2330 error = qxeGetNamedSecurityInfo(fnameext, SE_FILE_OBJECT, |
2325 DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, | 2331 DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, |
2326 &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc); | 2332 &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc); |
2327 if(error != ERROR_SUCCESS) { // FAT? | 2333 if(error != ERROR_SUCCESS) { // FAT? |
2328 attributes = qxeGetFileAttributes((Extbyte *)filename); | 2334 attributes = qxeGetFileAttributes(fnameext); |
2329 return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY)); | 2335 return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY)); |
2330 } | 2336 } |
2331 | 2337 |
2332 genericMapping.GenericRead = FILE_GENERIC_READ; | 2338 genericMapping.GenericRead = FILE_GENERIC_READ; |
2333 genericMapping.GenericWrite = FILE_GENERIC_WRITE; | 2339 genericMapping.GenericWrite = FILE_GENERIC_WRITE; |