Changeset 6709 for trunk/src/comdlg32/filetitle.c
- Timestamp:
- Sep 15, 2001, 11:26:26 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/filetitle.c
r6708 r6709 13 13 #include "debugtools.h" 14 14 15 #include "heap.h" 15 #include "heap.h" /* Has to go */ 16 16 17 17 DEFAULT_DEBUG_CHANNEL(commdlg) … … 20 20 21 21 /*********************************************************************** 22 * GetFileTitleA(COMDLG32.8)22 * GetFileTitleA (COMDLG32.8) 23 23 * 24 24 */ 25 25 short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) 26 26 { 27 27 int i, len; 28 28 29 29 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf); 30 30 31 32 31 if(lpFile == NULL || lpTitle == NULL) 32 return -1; 33 33 34 34 len = strlen(lpFile); 35 35 36 37 36 if (len == 0) 37 return -1; 38 38 39 40 39 if(strpbrk(lpFile, "*[]")) 40 return -1; 41 41 42 42 len--; 43 43 44 45 44 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':') 45 return -1; 46 46 47 48 49 50 51 52 53 54 47 for(i = len; i >= 0; i--) 48 { 49 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':') 50 { 51 i++; 52 break; 53 } 54 } 55 55 56 57 56 if(i == -1) 57 i++; 58 58 59 TRACE("---> '%s' \n", &lpFile[i]); 59 TRACE("---> '%s' \n", &lpFile[i]); 60 61 len = strlen(lpFile+i)+1; 62 if(cbBuf < len) 63 return len; 60 64 61 len = strlen(lpFile+i)+1; 62 if(cbBuf < len) 63 return len; 64 65 strncpy(lpTitle, &lpFile[i], len); 66 return 0; 65 strncpy(lpTitle, &lpFile[i], len); 66 return 0; 67 67 } 68 68 69 69 70 70 /*********************************************************************** 71 * GetFileTitleW(COMDLG32.9)71 * GetFileTitleW (COMDLG32.9) 72 72 * 73 73 */ 74 74 short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf) 75 75 { 76 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);/* Has to go */77 78 shortret;76 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile); /* Has to go */ 77 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf); 78 short ret; 79 79 80 80 ret = GetFileTitleA(file, title, cbBuf); 81 81 82 83 84 85 82 lstrcpynAtoW(lpTitle, title, cbBuf); 83 HeapFree(GetProcessHeap(), 0, file); 84 HeapFree(GetProcessHeap(), 0, title); 85 return ret; 86 86 } 87 87 … … 89 89 #ifndef __WIN32OS2__ 90 90 /*********************************************************************** 91 * GetFileTitle16(COMMDLG.27)91 * GetFileTitle16 (COMMDLG.27) 92 92 */ 93 93 short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) 94 94 { 95 95 return GetFileTitleA(lpFile, lpTitle, cbBuf); 96 96 } 97 97 #endif
Note:
See TracChangeset
for help on using the changeset viewer.