Changeset 2866 for trunk/src/lib/nt/kFsCache.c
- Timestamp:
- Sep 3, 2016, 1:04:26 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/kFsCache.c
r2864 r2866 807 807 ) 808 808 { 809 /* 810 * Convert the names to ANSI first, that way we know all the lengths. 811 */ 812 char szName[KFSCACHE_CFG_MAX_ANSI_NAME]; 813 int cchName = WideCharToMultiByte(CP_ACP, 0, pwcName, cwcName, szName, sizeof(szName) - 1, NULL, NULL); 814 if (cchName >= 0) 815 { 816 #ifdef KFSCACHE_CFG_SHORT_NAMES 817 char szShortName[12*3 + 1]; 818 int cchShortName = 0; 819 if ( cwcShortName == 0 820 || (cchShortName = WideCharToMultiByte(CP_ACP, 0, pwcShortName, cwcShortName, 821 szShortName, sizeof(szShortName) - 1, NULL, NULL)) > 0) 822 #endif 823 { 824 /* 825 * Shortening is easy for non-directory objects, for 826 * directory object we're only good when the length doesn't change 827 * on any of the components (cchParent et al). 828 * 829 * This deals with your typical xxxx.ext.tmp -> xxxx.ext renames. 830 */ 831 if ( cchName <= pCur->cchName 832 #ifdef KFSCACHE_CFG_UTF16 833 && cwcName <= pCur->cwcName 834 #endif 835 #ifdef KFSCACHE_CFG_SHORT_NAMES 836 && ( cchShortName == 0 837 || ( cchShortName <= pCur->cchShortName 838 && pCur->pszShortName != pCur->pszName 839 # ifdef KFSCACHE_CFG_UTF16 840 && cwcShortName <= pCur->cwcShortName 841 && pCur->pwszShortName != pCur->pwszName 842 # endif 843 ) 844 ) 845 #endif 846 ) 847 { 848 if ( pCur->bObjType != KFSOBJ_TYPE_DIR 849 || ( cchName == pCur->cchName 850 #ifdef KFSCACHE_CFG_UTF16 851 && cwcName == pCur->cwcName 852 #endif 853 #ifdef KFSCACHE_CFG_SHORT_NAMES 854 && ( cchShortName == 0 855 || ( cchShortName == pCur->cchShortName 856 # ifdef KFSCACHE_CFG_UTF16 857 && cwcShortName == pCur->cwcShortName 858 ) 859 # endif 860 ) 861 #endif 862 ) 863 ) 864 { 865 KFSCACHE_LOG(("Refreshing %ls - name changed to '%*.*ls'\n", pCur->pwszName, cwcName, cwcName, pwcName)); 866 *(char *)kHlpMemPCopy((void *)pCur->pszName, szName, cchName) = '\0'; 867 pCur->cchName = cchName; 868 #ifdef KFSCACHE_CFG_UTF16 869 *(wchar_t *)kHlpMemPCopy((void *)pCur->pwszName, pwcName, cwcName * sizeof(wchar_t)) = '\0'; 870 pCur->cwcName = cwcName; 871 #endif 872 #ifdef KFSCACHE_CFG_SHORT_NAMES 873 *(char *)kHlpMemPCopy((void *)pCur->pszShortName, szShortName, cchShortName) = '\0'; 874 pCur->cchShortName = cchShortName; 875 # ifdef KFSCACHE_CFG_UTF16 876 *(wchar_t *)kHlpMemPCopy((void *)pCur->pwszShortName, pwcShortName, cwcShortName * sizeof(wchar_t)) = '\0'; 877 pCur->cwcShortName = cwcShortName; 878 # endif 879 #endif 880 return pCur; 881 } 882 } 883 } 884 } 885 886 887 fprintf(stderr, 888 "kFsCacheDirRefreshOldChildName - not implemented!\n" 889 " Old name: %#x '%ls'\n" 890 " New name: %#x '%*.*ls'\n" 891 " Old short: %#x '%ls'\n" 892 " New short: %#x '%*.*ls'\n", 893 pCur->cwcName, pCur->pwszName, 894 cwcName, cwcName, cwcName, pwcName, 895 pCur->cwcShortName, pCur->pwszShortName, 896 cwcShortName, cwcShortName, cwcShortName, pwcShortName); 809 897 __debugbreak(); 810 898 /** @todo implement this. It's not entirely straight forward, especially if … … 1692 1780 KFSCACHE_LOG(("Refreshing %s/%s, ID changed %#llx -> %#llx and names too...\n", 1693 1781 pObj->pParent->Obj.pszName, pObj->pszName, pObj->Stats.st_ino, uBuf.WithId.FileId.QuadPart)); 1782 fprintf(stderr, "kFsCacheRefreshObj - ID + name change not implemented!!\n"); 1694 1783 __debugbreak(); 1695 1784 pObj->Stats.st_ino = uBuf.WithId.FileId.QuadPart; … … 1717 1806 /* ouch! */ 1718 1807 kHlpAssertMsgFailed(("%#x\n", rcNt)); 1808 fprintf(stderr, "kFsCacheRefreshObj - rcNt=%#x on non-dir - not implemented!\n", rcNt); 1719 1809 __debugbreak(); 1720 1810 fRc = K_FALSE; … … 1775 1865 /* ouch! */ 1776 1866 kHlpAssertMsgFailed(("%#x\n", rcNt)); 1867 fprintf(stderr, "kFsCacheRefreshObj - rcNt=%#x on dir - not implemented!\n", rcNt); 1777 1868 __debugbreak(); 1778 1869 fRc = K_FALSE; … … 2733 2824 else 2734 2825 { 2826 fprintf(stderr, "kFsCacheRefreshPathA - refresh failure handling not implemented!\n"); 2735 2827 __debugbreak(); 2736 2828 /** @todo just remove this entry. */ … … 2781 2873 else 2782 2874 { 2875 fprintf(stderr, "kFsCacheRefreshPathW - refresh failure handling not implemented!\n"); 2783 2876 __debugbreak(); 2784 2877 /** @todo just remove this entry. */ … … 3162 3255 3163 3256 KFSCACHE_LOG(("Destroying %s/%s, type=%d\n", pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType)); 3164 __debugbreak();3165 3257 3166 3258 /*
Note:
See TracChangeset
for help on using the changeset viewer.