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