Changeset 7820 for trunk/src/shlwapi/path.c
- Timestamp:
- Feb 6, 2002, 9:18:30 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shlwapi/path.c
r7508 r7820 2 2 * Path Functions 3 3 */ 4 #ifdef __WIN32OS2__5 #include <odin.h>6 #include <odinwrap.h>7 #include <os2sel.h>8 9 #include <string.h>10 #include <wctype.h>11 #include <wcstr.h>12 #define HAVE_WCTYPE_H13 #include <win\shlwapi.h>14 15 #include <heapstring.h>16 #include <wine\undocshell.h>17 #endif18 4 19 5 #include <ctype.h> 20 6 #include <string.h> 7 #include <stdlib.h> 21 8 22 9 #include "winerror.h" … … 25 12 #include "wingdi.h" 26 13 #include "winuser.h" 14 #include "winreg.h" 15 #define NO_SHLWAPI_STREAM 27 16 #include "shlwapi.h" 28 17 #include "debugtools.h" 29 18 #include "ordinal.h" 30 19 31 20 DEFAULT_DEBUG_CHANNEL(shell); 21 22 INT __cdecl _wtoi(LPWSTR string); 32 23 33 24 #define isSlash(x) ((x)=='\\' || (x)=='/') … … 453 444 454 445 /************************************************************************* 455 * PathStripPathA [SH ELLWAPI.@]446 * PathStripPathA [SHLWAPI.@] 456 447 * 457 448 * NOTES … … 469 460 470 461 /************************************************************************* 471 * PathStripPathW [SH ELLWAPI.@]462 * PathStripPathW [SHLWAPI.@] 472 463 */ 473 464 void WINAPI PathStripPathW(LPWSTR lpszPath) … … 747 738 { 748 739 LPSTR lpstrComma = strchr(lpszPath, ','); 749 750 FIXME("%s stub\n", debugstr_a(lpszPath)); 740 int ret = 0; 741 742 TRACE("%s\n", debugstr_a(lpszPath)); 751 743 752 744 if (lpstrComma && lpstrComma[1]) 753 745 { 754 746 lpstrComma[0]='\0'; 755 /* return atoi(&lpstrComma[1]); FIXME */ 747 ret = atoi(&lpstrComma[1]); 756 748 } 757 749 758 750 PathUnquoteSpacesA(lpszPath); 759 return 0;751 return ret; 760 752 } 761 753 … … 766 758 { 767 759 LPWSTR lpstrComma = strchrW(lpszPath, ','); 768 769 FIXME("%s stub\n", debugstr_w(lpszPath)); 760 int ret = 0; 761 762 TRACE("%s\n", debugstr_w(lpszPath)); 770 763 771 764 if (lpstrComma && lpstrComma[1]) 772 765 { 773 766 lpstrComma[0]='\0'; 774 /* return _wtoi(&lpstrComma[1]); FIXME */ 767 ret = _wtoi(&lpstrComma[1]); 775 768 } 776 769 PathUnquoteSpacesW(lpszPath); 777 return 0;770 return ret; 778 771 } 779 772 … … 785 778 * PathFindOnPathA [SHLWAPI.@] 786 779 */ 787 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)788 { 789 FIXME("%s % s\n",sFile, sOtherDirs);780 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR *sOtherDirs) 781 { 782 FIXME("%s %p\n",sFile, sOtherDirs); 790 783 return FALSE; 791 784 } … … 794 787 * PathFindOnPathW [SHLWAPI.@] 795 788 */ 796 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)797 { 798 FIXME("%s % s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));789 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR *sOtherDirs) 790 { 791 FIXME("%s %p\n",debugstr_w(sFile), sOtherDirs); 799 792 return FALSE; 800 793 } … … 1118 1111 if (lpszPath1[pos]=='\\') bsfound++; 1119 1112 if (bsfound == 2) return TRUE; 1120 pos++; /* fixme: use CharNext*/1113 pos++; /* FIXME: use CharNext*/ 1121 1114 } 1122 1115 return (lpszPath1[pos] == lpszPath2[pos]); … … 1150 1143 if (lpszPath1[pos]=='\\') bsfound++; 1151 1144 if (bsfound == 2) return TRUE; 1152 pos++;/* fixme: use CharNext*/1145 pos++;/* FIXME: use CharNext*/ 1153 1146 } 1154 1147 return (lpszPath1[pos] == lpszPath2[pos]); … … 1158 1151 1159 1152 /************************************************************************* 1160 * PathIsURLA 1153 * PathIsURLA (SHLWAPI.@) 1161 1154 */ 1162 1155 BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) 1163 1156 { 1164 // 2001-08-30 PH 1165 // SHLWAPI/W95 Code: 1166 // 1167 // if (lpstrPath == NULL) 1168 // return FALSE; 1169 // 1170 // DWORD dwUnknown = SHREG_xxx; // 0x18 1171 // return SHLWAPI_1(lpstrPath, &dwUnknown); 1172 1173 1174 LPSTR lpstrRes; 1175 int iSize, i=0; 1176 static LPSTR SupportedProtocol[] = 1177 {"http","https","ftp","gopher","file","mailto",NULL}; 1178 1179 if(!lpstrPath) return FALSE; 1180 1181 /* get protocol */ 1182 lpstrRes = strchr(lpstrPath,':'); 1183 if(!lpstrRes) return FALSE; 1184 iSize = lpstrRes - lpstrPath; 1185 1186 while(SupportedProtocol[i]) 1187 { 1188 if (iSize == strlen(SupportedProtocol[i])) 1189 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize)) 1190 return TRUE; 1191 i++; 1192 } 1193 1194 return FALSE; 1157 UNKNOWN_SHLWAPI_1 base; 1158 DWORD res1; 1159 1160 if (!lpstrPath || !*lpstrPath) return FALSE; 1161 1162 /* get protocol */ 1163 base.size = 24; 1164 res1 = SHLWAPI_1(lpstrPath, &base); 1165 return (base.fcncde) ? TRUE : FALSE; 1195 1166 } 1196 1167 1197 1168 /************************************************************************* 1198 * PathIsURLW 1169 * PathIsURLW (SHLWAPI.@) 1199 1170 */ 1200 1171 BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) 1201 1172 { 1202 LPWSTR lpstrRes; 1203 int iSize, i=0; 1204 static WCHAR SupportedProtocol[7][7] = 1205 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'}, 1206 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'}, 1207 {'m','a','i','l','t','o','\0'},{0}}; 1208 1209 if(!lpstrPath) return FALSE; 1210 1211 /* get protocol */ 1212 lpstrRes = strchrW(lpstrPath,':'); 1213 if(!lpstrRes) return FALSE; 1214 iSize = lpstrRes - lpstrPath; 1215 1216 while(SupportedProtocol[i]) 1217 { 1218 if (iSize == strlenW(SupportedProtocol[i])) 1219 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) 1220 return TRUE; 1221 i++; 1222 } 1223 1224 return FALSE; 1173 UNKNOWN_SHLWAPI_2 base; 1174 DWORD res1; 1175 1176 if (!lpstrPath || !*lpstrPath) return FALSE; 1177 1178 /* get protocol */ 1179 base.size = 24; 1180 res1 = SHLWAPI_2(lpstrPath, &base); 1181 return (base.fcncde) ? TRUE : FALSE; 1225 1182 } 1226 1183 … … 1302 1259 */ 1303 1260 BOOL WINAPI PathIsUNCServerA( 1304 LPCSTR pszPath) 1305 { 1306 FIXME("%s\n", pszPath); 1261 LPCSTR lpszPath) 1262 { 1263 TRACE("%s\n", debugstr_a(lpszPath)); 1264 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 1265 { 1266 int foundbackslash = 0; 1267 lpszPath += 2; 1268 while (*lpszPath) 1269 { 1270 if (*lpszPath=='\\') foundbackslash++; 1271 lpszPath = CharNextA(lpszPath); 1272 } 1273 if (foundbackslash == 0) 1274 return TRUE; 1275 } 1307 1276 return FALSE; 1308 1277 } … … 1312 1281 */ 1313 1282 BOOL WINAPI PathIsUNCServerW( 1314 LPCWSTR pszPath) 1315 { 1316 FIXME("%s\n", debugstr_w(pszPath)); 1283 LPCWSTR lpszPath) 1284 { 1285 TRACE("%s\n", debugstr_w(lpszPath)); 1286 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 1287 { 1288 int foundbackslash = 0; 1289 lpszPath += 2; 1290 while (*lpszPath) 1291 { 1292 if (*lpszPath=='\\') foundbackslash++; 1293 lpszPath = CharNextW(lpszPath); 1294 } 1295 if (foundbackslash == 0) 1296 return TRUE; 1297 } 1317 1298 return FALSE; 1318 1299 } … … 1322 1303 */ 1323 1304 BOOL WINAPI PathIsUNCServerShareA( 1324 LPCSTR pszPath) 1325 { 1326 FIXME("%s\n", pszPath); 1305 LPCSTR lpszPath) 1306 { 1307 TRACE("%s\n", debugstr_a(lpszPath)); 1308 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 1309 { 1310 int foundbackslash = 0; 1311 lpszPath += 2; 1312 while (*lpszPath) 1313 { 1314 if (*lpszPath=='\\') foundbackslash++; 1315 lpszPath = CharNextA(lpszPath); 1316 } 1317 if (foundbackslash == 1) 1318 return TRUE; 1319 } 1327 1320 return FALSE; 1328 1321 } … … 1332 1325 */ 1333 1326 BOOL WINAPI PathIsUNCServerShareW( 1334 LPCWSTR pszPath) 1335 { 1336 FIXME("%s\n", debugstr_w(pszPath)); 1327 LPCWSTR lpszPath) 1328 { 1329 TRACE("%s\n", debugstr_w(lpszPath)); 1330 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 1331 { 1332 int foundbackslash = 0; 1333 lpszPath += 2; 1334 while (*lpszPath) 1335 { 1336 if (*lpszPath=='\\') foundbackslash++; 1337 lpszPath = CharNextW(lpszPath); 1338 } 1339 if (foundbackslash == 1) 1340 return TRUE; 1341 } 1337 1342 return FALSE; 1338 1343 } … … 1693 1698 BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) 1694 1699 { 1695 FIXME("%s %s\n", pszPath, pszExt); 1696 return FALSE; 1700 LPSTR pszExtension = PathFindExtensionA(pszPath); 1701 1702 if (!pszExtension) return FALSE; 1703 if (pszExtension-pszPath + strlen(pszExt) > MAX_PATH) return FALSE; 1704 1705 strcpy(pszExtension, pszExt); 1706 TRACE("%s\n", pszPath); 1707 return TRUE; 1697 1708 } 1698 1709 … … 1702 1713 BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) 1703 1714 { 1704 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); 1705 return FALSE; 1715 LPWSTR pszExtension = PathFindExtensionW(pszPath); 1716 1717 if (!pszExtension) return FALSE; 1718 if (pszExtension-pszPath + strlenW(pszExt) > MAX_PATH) return FALSE; 1719 1720 strcpyW(pszExtension, pszExt); 1721 TRACE("%s\n", debugstr_w(pszPath)); 1722 return TRUE; 1706 1723 } 1707 1724 … … 1759 1776 DWORD dwFlags) 1760 1777 { 1778 /* extracts thing prior to : in pszURL and checks against: 1779 * https 1780 * shell 1781 * local 1782 * about - if match returns E_INVALIDARG 1783 */ 1761 1784 FIXME("%s %p %p 0x%08lx\n", 1762 1785 pszUrl, pszPath, pcchPath, dwFlags); 1763 return S_OK;1786 return E_INVALIDARG; 1764 1787 } 1765 1788 … … 1773 1796 DWORD dwFlags) 1774 1797 { 1798 /* extracts thing prior to : in pszURL and checks against: 1799 * https 1800 * shell 1801 * local 1802 * about - if match returns E_INVALIDARG 1803 */ 1775 1804 FIXME("%s %p %p 0x%08lx\n", 1776 1805 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags); 1777 return S_OK;1806 return E_INVALIDARG; 1778 1807 } 1779 1808
Note:
See TracChangeset
for help on using the changeset viewer.