Ignore:
Timestamp:
Feb 6, 2002, 9:18:30 PM (24 years ago)
Author:
sandervl
Message:

Wine resync

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shlwapi/path.c

    r7508 r7820  
    22 * Path Functions
    33 */
    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_H
    13 #include <win\shlwapi.h>
    14 
    15 #include <heapstring.h>
    16 #include <wine\undocshell.h>
    17 #endif
    184
    195#include <ctype.h>
    206#include <string.h>
     7#include <stdlib.h>
    218
    229#include "winerror.h"
     
    2512#include "wingdi.h"
    2613#include "winuser.h"
     14#include "winreg.h"
     15#define NO_SHLWAPI_STREAM
    2716#include "shlwapi.h"
    2817#include "debugtools.h"
    29 
     18#include "ordinal.h"
    3019
    3120DEFAULT_DEBUG_CHANNEL(shell);
     21
     22INT __cdecl _wtoi(LPWSTR string);
    3223
    3324#define isSlash(x) ((x)=='\\' || (x)=='/')
     
    453444
    454445/*************************************************************************
    455  * PathStripPathA       [SHELLWAPI.@]
     446 * PathStripPathA       [SHLWAPI.@]
    456447 *
    457448 * NOTES
     
    469460
    470461/*************************************************************************
    471  * PathStripPathW       [SHELLWAPI.@]
     462 * PathStripPathW       [SHLWAPI.@]
    472463 */
    473464void WINAPI PathStripPathW(LPWSTR lpszPath)
     
    747738{
    748739        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));
    751743
    752744        if (lpstrComma && lpstrComma[1])
    753745        {
    754746          lpstrComma[0]='\0';
    755 /*        return atoi(&lpstrComma[1]);  FIXME */
     747          ret = atoi(&lpstrComma[1]);
    756748        }
    757749       
    758750        PathUnquoteSpacesA(lpszPath);
    759         return 0;
     751        return ret;
    760752}
    761753
     
    766758{
    767759        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));
    770763
    771764        if (lpstrComma && lpstrComma[1])
    772765        {
    773766          lpstrComma[0]='\0';
    774 /*        return _wtoi(&lpstrComma[1]); FIXME */
     767          ret = _wtoi(&lpstrComma[1]);
    775768        }
    776769        PathUnquoteSpacesW(lpszPath);
    777         return 0;
     770        return ret;
    778771}
    779772
     
    785778 * PathFindOnPathA      [SHLWAPI.@]
    786779 */
    787 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)
    788 {
    789         FIXME("%s %s\n",sFile, sOtherDirs);
     780BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR *sOtherDirs)
     781{
     782        FIXME("%s %p\n",sFile, sOtherDirs);
    790783        return FALSE;
    791784}
     
    794787 * PathFindOnPathW      [SHLWAPI.@]
    795788 */
    796 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)
    797 {
    798         FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));
     789BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR *sOtherDirs)
     790{
     791        FIXME("%s %p\n",debugstr_w(sFile), sOtherDirs);
    799792        return FALSE;
    800793}
     
    11181111            if (lpszPath1[pos]=='\\') bsfound++;
    11191112            if (bsfound == 2) return TRUE;
    1120             pos++; /* fixme: use CharNext*/
     1113            pos++; /* FIXME: use CharNext*/
    11211114          }
    11221115          return (lpszPath1[pos] == lpszPath2[pos]);
     
    11501143            if (lpszPath1[pos]=='\\') bsfound++;
    11511144            if (bsfound == 2) return TRUE;
    1152             pos++;/* fixme: use CharNext*/
     1145            pos++;/* FIXME: use CharNext*/
    11531146          }
    11541147          return (lpszPath1[pos] == lpszPath2[pos]);
     
    11581151
    11591152/*************************************************************************
    1160  * PathIsURLA
     1153 * PathIsURLA (SHLWAPI.@)
    11611154 */
    11621155BOOL WINAPI PathIsURLA(LPCSTR lpstrPath)
    11631156{
    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;
    11951166
    11961167
    11971168/*************************************************************************
    1198  * PathIsURLW
     1169 * PathIsURLW (SHLWAPI.@)
    11991170 */
    12001171BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
    12011172{
    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;
    12251182
    12261183
     
    13021259 */
    13031260BOOL 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        }
    13071276        return FALSE;
    13081277}
     
    13121281 */
    13131282BOOL 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        }
    13171298        return FALSE;
    13181299}
     
    13221303 */
    13231304BOOL 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        }
    13271320        return FALSE;
    13281321}
     
    13321325 */
    13331326BOOL 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        }
    13371342        return FALSE;
    13381343}
     
    16931698BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt)
    16941699{
    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;
    16971708}
    16981709
     
    17021713BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt)
    17031714{
    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;
    17061723}
    17071724
     
    17591776        DWORD dwFlags)
    17601777{
     1778    /* extracts thing prior to : in pszURL and checks against:
     1779     *   https
     1780     *   shell
     1781     *   local
     1782     *   about  - if match returns E_INVALIDARG
     1783     */
    17611784        FIXME("%s %p %p 0x%08lx\n",
    17621785          pszUrl, pszPath, pcchPath, dwFlags);
    1763         return S_OK;
     1786        return E_INVALIDARG;
    17641787}
    17651788
     
    17731796        DWORD dwFlags)
    17741797{
     1798    /* extracts thing prior to : in pszURL and checks against:
     1799     *   https
     1800     *   shell
     1801     *   local
     1802     *   about  - if match returns E_INVALIDARG
     1803     */
    17751804        FIXME("%s %p %p 0x%08lx\n",
    17761805          debugstr_w(pszUrl), pszPath, pcchPath, dwFlags);
    1777         return S_OK;
     1806        return E_INVALIDARG;
    17781807}
    17791808
Note: See TracChangeset for help on using the changeset viewer.