5 changed files
BEApi | ||
BEApi.vcxproj | ||
BEH/BEH | ||
main.cpp | ||
BExplorer/BetterExplorer | ||
BEH64.dll | ||
MainWindow.xaml.cs | ||
Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell | ||
WindowsAPI.cs | ||
Add comment 47 <UseDebugLibraries>false</UseDebugLibraries>
Add comment 48 <PlatformToolset>v110</PlatformToolset>
Add comment 49 <WholeProgramOptimization>true</WholeProgramOptimization>
Add comment 50 Minus <CharacterSet>MultiByte</CharacterSet>
Add comment 50 Plus <CharacterSet>Unicode</CharacterSet>
Add comment 51 </PropertyGroup>
Add comment 52 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Add comment 53 <ImportGroup Label="ExtensionSettings">
Add comment 3 #include <vector>
Add comment 4 #include <Objbase.h>
Add comment 5 #include <string.h>
Add comment 6 Plus #include <winnetwk.h>
Add comment 6 7
Add comment 7 8
Add comment 8 9 extern "C"
Add comment 128 129 pointx = p.x;
Add comment 129 130 pointy = p.y;
Add comment 130 131 }
Add comment 131 Minus
Add comment 132 }
The two versions of the file are different.
MainWindow.xaml.cs
/BExplorer/BetterExplorer/MainWindow.xaml.cs-6+1/BExplorer/BetterExplorer/MainWindow.xaml.cs
Add comment 5875
Add comment 5876 private void btnMapDrive_Click(object sender, RoutedEventArgs e)
Add comment 5877 {
Add comment 5878 Minus WindowsAPI.WNetConnectionDialog(this.Handle, 1);
Add comment 5878 Plus WindowsAPI.MapDrive(this.Handle, Explorer.SelectedItems.Count == 1 ? Explorer.SelectedItems[0].ParsingName : String.Empty);
Add comment 5879 }
Add comment 5880
Add comment 5881 private void btnDisconectDrive_Click(object sender, RoutedEventArgs e)
Add comment 5885
Add comment 5886 private void Button_Click_4(object sender, RoutedEventArgs e)
Add comment 5887 {
Add comment 5888 Minus //ShareWizzard sw = new ShareWizzard();
Add comment 5889 Minus //sw.CurrentPath = Explorer.SelectedItems[0].ParsingName;
Add comment 5890 Minus //sw.SetIcon(Explorer.SelectedItems[0]);
Add comment 5891 Minus //sw.ShowDialog(this.GetWin32Window());
Add comment 5892 Minus //sw.Close();
Add comment 5893 5888 Explorer.OpenShareUI();
Add comment 5894 5889 }
Add comment 5895 5890
WindowsAPI.cs
/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/WindowsAPI.cs-2+146/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/WindowsAPI.cs
Add comment 1510 IntPtr dwItem2);
Add comment 1511
Add comment 1512
Add comment 1513 Plus [DllImport("kernel32.dll")]
Add comment 1514 Plus public static extern IntPtr GlobalAlloc(uint uFlags, UIntPtr dwBytes);
Add comment 1515 Plus
Add comment 1516 Plus [DllImport("kernel32.dll")]
Add comment 1517 Plus public static extern IntPtr GlobalFree(IntPtr hMem);
Add comment 1518 Plus
Add comment 1519 Plus [DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory")]
Add comment 1520 Plus static extern void CopyMemory(IntPtr destination, NETRESOURCE source, uint length);
Add comment 1521 Plus
Add comment 1522 Plus [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
Add comment 1523 Plus public static extern bool PathIsNetworkPath(string pszPath);
Add comment 1524 Plus
Add comment 1525 Plus public enum ResourceScope
Add comment 1526 Plus {
Add comment 1527 Plus RESOURCE_CONNECTED = 1,
Add comment 1528 Plus RESOURCE_GLOBALNET,
Add comment 1529 Plus RESOURCE_REMEMBERED,
Add comment 1530 Plus RESOURCE_RECENT,
Add comment 1531 Plus RESOURCE_CONTEXT
Add comment 1532 Plus }
Add comment 1533 Plus
Add comment 1534 Plus public enum ResourceType
Add comment 1535 Plus {
Add comment 1536 Plus RESOURCETYPE_ANY,
Add comment 1537 Plus RESOURCETYPE_DISK,
Add comment 1538 Plus RESOURCETYPE_PRINT,
Add comment 1539 Plus RESOURCETYPE_RESERVED
Add comment 1540 Plus }
Add comment 1541 Plus
Add comment 1542 Plus public enum ResourceUsage
Add comment 1543 Plus {
Add comment 1544 Plus RESOURCEUSAGE_CONNECTABLE = 0x00000001,
Add comment 1545 Plus RESOURCEUSAGE_CONTAINER = 0x00000002,
Add comment 1546 Plus RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,
Add comment 1547 Plus RESOURCEUSAGE_SIBLING = 0x00000008,
Add comment 1548 Plus RESOURCEUSAGE_ATTACHED = 0x00000010,
Add comment 1549 Plus RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
Add comment 1550 Plus }
Add comment 1551 Plus
Add comment 1552 Plus public enum ResourceDisplayType
Add comment 1553 Plus {
Add comment 1554 Plus RESOURCEDISPLAYTYPE_GENERIC,
Add comment 1555 Plus RESOURCEDISPLAYTYPE_DOMAIN,
Add comment 1556 Plus RESOURCEDISPLAYTYPE_SERVER,
Add comment 1557 Plus RESOURCEDISPLAYTYPE_SHARE,
Add comment 1558 Plus RESOURCEDISPLAYTYPE_FILE,
Add comment 1559 Plus RESOURCEDISPLAYTYPE_GROUP,
Add comment 1560 Plus RESOURCEDISPLAYTYPE_NETWORK,
Add comment 1561 Plus RESOURCEDISPLAYTYPE_ROOT,
Add comment 1562 Plus RESOURCEDISPLAYTYPE_SHAREADMIN,
Add comment 1563 Plus RESOURCEDISPLAYTYPE_DIRECTORY,
Add comment 1564 Plus RESOURCEDISPLAYTYPE_TREE,
Add comment 1565 Plus RESOURCEDISPLAYTYPE_NDSCONTAINER
Add comment 1566 Plus }
Add comment 1567 Plus
Add comment 1568 Plus [StructLayout(LayoutKind.Sequential)]
Add comment 1569 Plus public class NETRESOURCE
Add comment 1570 Plus {
Add comment 1571 Plus public ResourceScope dwScope = 0;
Add comment 1572 Plus public ResourceType dwType = 0;
Add comment 1573 Plus public ResourceDisplayType dwDisplayType = 0;
Add comment 1574 Plus public ResourceUsage dwUsage = 0;
Add comment 1575 Plus public string lpLocalName = null;
Add comment 1576 Plus public IntPtr lpRemoteName = IntPtr.Zero;
Add comment 1577 Plus public string lpComment = null;
Add comment 1578 Plus public string lpProvider = null;
Add comment 1579 Plus }
Add comment 1580 Plus
Add comment 1581 Plus
Add comment 1582 Plus [Flags]
Add comment 1583 Plus public enum DisconnectDialogFlags :
Add comment 1584 Plus int
Add comment 1585 Plus {
Add comment 1586 Plus UpdateProfile = 0x00000001,
Add comment 1587 Plus NoForce = 0x00000040,
Add comment 1588 Plus }
Add comment 1589 Plus
Add comment 1590 Plus [Flags]
Add comment 1591 Plus public enum ConnectDialogFlags :
Add comment 1592 Plus int
Add comment 1593 Plus {
Add comment 1594 Plus ReadOnlyPath = 0x00000001,
Add comment 1595 Plus // Conn_point = 0x00000002,
Add comment 1596 Plus UseMru = 0x00000004,
Add comment 1597 Plus HideBox = 0x00000008,
Add comment 1598 Plus Persist = 0x00000010,
Add comment 1599 Plus NotPersist = 0x00000020,
Add comment 1600 Plus }
Add comment 1601 Plus
Add comment 1602 Plus
Add comment 1603 Plus public struct ConnectDialogInfo
Add comment 1604 Plus {
Add comment 1605 Plus public uint StructureSize;
Add comment 1606 Plus public IntPtr Owner;
Add comment 1607 Plus public IntPtr ConnectResource;
Add comment 1608 Plus public ConnectDialogFlags Flags;
Add comment 1609 Plus public int DeviceNumber;
Add comment 1610 Plus }
Add comment 1611 Plus
Add comment 1612 Plus
Add comment 1613 Plus [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto)]
Add comment 1614 Plus public struct DisconnectDialogInfo
Add comment 1615 Plus {
Add comment 1616 Plus public uint StructureSize;
Add comment 1617 Plus public IntPtr Owner;
Add comment 1618 Plus [MarshalAs(UnmanagedType.LPTStr, SizeConst = 200)]
Add comment 1619 Plus public string LocalName;
Add comment 1620 Plus [MarshalAs(UnmanagedType.LPTStr, SizeConst = 200)]
Add comment 1621 Plus public string RemoteName;
Add comment 1622 Plus public DisconnectDialogFlags Flags;
Add comment 1623 Plus }
Add comment 1513 1624
Add comment 1625 Plus
Add comment 1514 1626 [DllImport("mpr.dll", EntryPoint = "WNetConnectionDialog", SetLastError = true, CharSet = CharSet.Auto)]
Add comment 1515 1627 public static extern int WNetConnectionDialog(IntPtr whnd, int dwType);
Add comment 1516 1628
Add comment 1629 Plus [DllImport("mpr.dll", CharSet = CharSet.Auto)]
Add comment 1630 Plus public static extern int WNetConnectionDialog1(ConnectDialogInfo connDlgStruct);
Add comment 1631 Plus
Add comment 1517 1632 /// <summary>
Add comment 1518 Minus /// Map Network Drive dialog
Add comment 1633 Plus /// Disconnect Mapped Network Drive dialog
Add comment 1519 1634 /// </summary>
Add comment 1520 1635 /// <param name="whnd"></param>
Add comment 1521 1636 /// <param name="dwType"></param>
Add comment 1523 1638 [DllImport("mpr.dll", EntryPoint = "WNetDisconnectDialog", SetLastError = true, CharSet = CharSet.Auto)]
Add comment 1524 1639 public static extern int WNetDisconnectDialog(IntPtr whnd, int dwType);
Add comment 1525 1640
Add comment 1641 Plus [DllImport("mpr.dll", CharSet = CharSet.Auto)]
Add comment 1642 Plus public static extern int WNetDisconnectDialog1(DisconnectDialogInfo disConnDlgStruct);
Add comment 1643 Plus
Add comment 1644 Plus public static void MapDrive(IntPtr owner, String remotePath)
Add comment 1645 Plus {
Add comment 1646 Plus if (String.IsNullOrEmpty(remotePath) || !PathIsNetworkPath(remotePath))
Add comment 1647 Plus {
Add comment 1648 Plus WNetConnectionDialog(owner, 1);
Add comment 1649 Plus }
Add comment 1650 Plus else
Add comment 1651 Plus {
Add comment 1652 Plus ConnectDialogInfo info = new ConnectDialogInfo();
Add comment 1653 Plus info.Owner = owner;
Add comment 1654 Plus info.Flags = ConnectDialogFlags.Persist | ConnectDialogFlags.ReadOnlyPath;
Add comment 1655 Plus
Add comment 1656 Plus NETRESOURCE res = new NETRESOURCE();
Add comment 1657 Plus res.dwType = ResourceType.RESOURCETYPE_DISK;
Add comment 1658 Plus res.lpRemoteName = Marshal.StringToHGlobalAuto(remotePath);
Add comment 1659 Plus
Add comment 1660 Plus IntPtr resptr = GlobalAlloc(0x0040 | 0x0000, (UIntPtr)Marshal.SizeOf(res));
Add comment 1661 Plus CopyMemory(resptr, res, (uint)Marshal.SizeOf(res));
Add comment 1662 Plus
Add comment 1663 Plus info.ConnectResource = resptr;
Add comment 1664 Plus info.StructureSize = (uint)Marshal.SizeOf(info);
Add comment 1665 Plus var result = WNetConnectionDialog1(info);
Add comment 1666 Plus GlobalFree(resptr);
Add comment 1667 Plus }
Add comment 1668 Plus }
Add comment 1669 Plus
Add comment 1526 1670 [DllImport("user32.dll", SetLastError = true)]
Add comment 1527 1671 public static extern uint SendInput(uint nInputs, INPUT pInputs, int cbSize);
Add comment 1528 1672 [StructLayout(LayoutKind.Sequential)]
Add comment 2862 3006
Add comment 2863 3007 [DllImport(@"SHLWAPI", CharSet = CharSet.Auto)]
Add comment 2864 3008 [return: MarshalAsAttribute(UnmanagedType.Bool)]
Add comment 2865 Minus [ResourceExposure(ResourceScope.None)]
Add comment 3009 Plus // [ResourceExposure(ResourceScope.None)]
Add comment 2866 3010 public static extern bool PathIsDirectory([MarshalAsAttribute(UnmanagedType.LPWStr), In] string pszPath);
Add comment 2867 3011
Add comment 2868 3012