Changeset 2258 for trunk/src/shell32/shellord.cpp
- Timestamp:
- Dec 30, 1999, 1:22:45 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shellord.cpp
r2237 r2258 1 /* $Id: shellord.cpp,v 1. 4 1999-12-28 23:16:33 sandervlExp $ */1 /* $Id: shellord.cpp,v 1.5 1999-12-30 00:21:33 phaller Exp $ */ 2 2 /* 3 3 * The parameters of many functions changes between different OS versions … … 7 7 * 1998 Jürgen Schmied 8 8 */ 9 10 11 /***************************************************************************** 12 * Includes * 13 *****************************************************************************/ 14 9 15 #include <string.h> 10 16 #include <odin.h> 17 #include <odinwrap.h> 18 #include <os2sel.h> 11 19 12 20 #define ICOM_CINTERFACE 1 … … 28 36 #include <heapstring.h> 29 37 #include <misc.h> 30 31 DEFAULT_DEBUG_CHANNEL(shell) 38 #include <ctype.h> 39 #include <wctype.h> 40 #include <wcstr.h> 41 42 43 /***************************************************************************** 44 * Local Variables * 45 *****************************************************************************/ 46 47 ODINDEBUGCHANNEL(shell32-shellord) 48 32 49 33 50 /************************************************************************* … … 1496 1513 return TRUE; 1497 1514 } 1515 1516 1517 /***************************************************************************** 1518 * Name : StrChrIA 1519 * Purpose : Searches a string for the first occurrence of a character that 1520 * matches the specified character. The comparison is not case sensitive. 1521 * Parameters: LPCSTR lpStart Address of the string to be searched. 1522 * TCHAR wMatch Character to be used for comparison. 1523 * Variables : 1524 * Result : Returns the address of the first occurrence of the character in 1525 * the string if successful, or NULL otherwise. 1526 * Remark : SHELL32. 1527 * Status : UNTESTED UNKNOWN 1528 * 1529 * Author : Patrick Haller [Wed, 1999/12/29 09:00] 1530 *****************************************************************************/ 1531 1532 ODINFUNCTION2(LPSTR, StrChrIA, 1533 LPCSTR, lpStart, 1534 CHAR, wMatch) 1535 { 1536 LPSTR lpRes; 1537 1538 wMatch = tolower(wMatch); 1539 lpRes = strchr(lpStart, wMatch); // lower case comparsion 1540 if (NULL == lpRes) 1541 { 1542 wMatch = toupper(wMatch); 1543 lpRes = strchr(lpStart, wMatch); // upper case comparsion 1544 } 1545 1546 return lpRes; 1547 } 1548 1549 1550 /***************************************************************************** 1551 * Name : StrChrIW 1552 * Purpose : Searches a string for the first occurrence of a character that 1553 * matches the specified character. The comparison is not case sensitive. 1554 * Parameters: LPCSTR lpStart Address of the string to be searched. 1555 * TCHAR wMatch Character to be used for comparison. 1556 * Variables : 1557 * Result : Returns the address of the first occurrence of the character in 1558 * the string if successful, or NULL otherwise. 1559 * Remark : SHELL32. 1560 * Status : UNTESTED UNKNOWN 1561 * 1562 * Author : Patrick Haller [Wed, 1999/12/29 09:00] 1563 *****************************************************************************/ 1564 1565 ODINFUNCTION2(LPWSTR, StrChrIW, 1566 LPCWSTR, lpStart, 1567 WCHAR, wMatch) 1568 { 1569 LPWSTR lpRes; 1570 1571 wMatch = towlower(wMatch); 1572 lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // lower case comparsion 1573 if (NULL == lpRes) 1574 { 1575 wMatch = towupper(wMatch); 1576 lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch); // upper case comparsion 1577 } 1578 1579 return lpRes; 1580 } 1581 1582 1583 /***************************************************************************** 1584 * Name : StrStrIA 1585 * Purpose : Finds the first occurrence of a substring within a string. The 1586 * comparison is not case sensitive. 1587 * Parameters: LPCSTR lpFirst 1588 * LPCSTR lpSrch 1589 * Variables : 1590 * Result : Returns the address of the first occurrence of the matching 1591 * substring if successful, or NULL otherwise. 1592 * Remark : SHELL32. 1593 * Status : UNTESTED UNKNOWN 1594 * 1595 * Author : Patrick Haller [Wed, 1999/12/29 09:00] 1596 *****************************************************************************/ 1597 1598 ODINFUNCTION2(LPSTR, StrStrIA, 1599 LPCSTR, lpFirst, 1600 LPCSTR, lpSrch) 1601 { 1602 char ch = lpSrch[0]; // look for 1st character 1603 LONG lLen = lstrlenA(lpSrch); // length of search string 1604 int iRes; // comparsion result 1605 1606 do 1607 { 1608 lpFirst = StrChrIA(lpFirst, // find first matching character 1609 ch); 1610 if (NULL == lpFirst) // not found 1611 return NULL; 1612 1613 iRes = StrCmpNIA((LPSTR)lpFirst, // compare search string 1614 (LPSTR)lpSrch, 1615 lLen); 1616 1617 if (0 == iRes) // Found! 1618 return (LPSTR)lpFirst; 1619 1620 lpFirst = CharNextA(lpFirst); // skip to next character 1621 } 1622 while (*lpFirst != 0); // safe termination 1623 1624 return NULL; // default result 1625 } 1626 1627 1628 1629 /***************************************************************************** 1630 * Name : StrStrIW 1631 * Purpose : Finds the first occurrence of a substring within a string. The 1632 * comparison is not case sensitive. 1633 * Parameters: LPCWSTR lpFirst 1634 * LPCWSTR lpSrch 1635 * Variables : 1636 * Result : Returns the address of the first occurrence of the matching 1637 * substring if successful, or NULL otherwise. 1638 * Remark : SHELL32. 1639 * Status : UNTESTED UNKNOWN 1640 * 1641 * Author : Patrick Haller [Wed, 1999/12/29 09:00] 1642 *****************************************************************************/ 1643 1644 ODINFUNCTION2(LPWSTR, StrStrIW, 1645 LPCWSTR, lpFirst, 1646 LPCWSTR, lpSrch) 1647 { 1648 WCHAR ch = lpSrch[0]; // look for 1st character 1649 LONG lLen = lstrlenW(lpSrch); // length of search string 1650 int iRes; // comparsion result 1651 1652 do 1653 { 1654 lpFirst = StrChrIW(lpFirst, // find first matching character 1655 ch); 1656 if (NULL == lpFirst) // not found 1657 return NULL; 1658 1659 iRes = StrCmpNIW((LPWSTR)lpFirst, // compare search string 1660 (LPWSTR)lpSrch, 1661 lLen); 1662 1663 if (0 == iRes) // Found! 1664 return (LPWSTR)lpFirst; 1665 1666 lpFirst = CharNextW(lpFirst); // skip to next character 1667 } 1668 while (*lpFirst != 0); // safe termination 1669 1670 return NULL; // default result 1671 } 1672 1673
Note:
See TracChangeset
for help on using the changeset viewer.