| 1576 | |
| 1577 | |
| 1578 | static void share_name_from_unc(tstring& file_name, LPREMOTE_NAME_INFO unc_remote) |
| 1579 | { |
| 1580 | /************************************** |
| 1581 | * |
| 1582 | * s h a r e _ n a m e _ f r o m _ u n c |
| 1583 | * |
| 1584 | ************************************** |
| 1585 | * |
| 1586 | * Functional description |
| 1587 | * Extract the share name from a REMOTE_NAME_INFO struct |
| 1588 | * returned by WNetGetUniversalName. It uses only the |
| 1589 | * lpConnectionName element of the structure. It converts |
| 1590 | * "\\node\sharepoint" to "\\node\!sharepoint!" and appends |
| 1591 | * the rest of file_name after the drive into expanded_name. |
| 1592 | * |
| 1593 | **************************************/ |
| 1594 | tstring expanded_name = unc_remote->lpConnectionName; |
| 1595 | |
| 1596 | // bracket the share name with "!" characters |
| 1597 | size p = expanded_name.find('\\', 2); |
| 1598 | expanded_name.insert(++p, 1, '!'); |
| 1599 | p = expanded_name.find('\\', p + 1); |
| 1600 | if (p != npos) |
| 1601 | { |
| 1602 | expanded_name.erase(p, npos); |
| 1603 | } |
| 1604 | expanded_name += '!'; |
| 1605 | |
| 1606 | // add rest of file name |
| 1607 | file_name.replace(0, 2, expanded_name); |
| 1608 | } |
| 1609 | #endif // WIN_NT |
| 1610 | |
| 1611 | #ifdef HAVE_ICONV_H |
no test coverage detected