关于网络共享路径的几个win32 API

1,     [DllImport("kernel32.dll", CharSet=CharSet.Unicode)]
        internal static extern bool GetDiskFreeSpaceEx(
                string lpDirectoryName,
                out UInt64 lpFreeBytesAvailable,
                out UInt64 lpTotalNumberOfBytes,
                out UInt64 lpTotalNumberOfFreeBytes);

2,

   [DllImport("mpr.dll", CharSet = CharSet.Unicode, SetLastError = true)]  

        public static extern int WNetGetConnection(   [MarshalAs(UnmanagedType.LPTStr)] string localName,   [MarshalAs(UnmanagedType.LPTStr)] StringBuilder remoteName,  ref int length);  

 

3,NET_API_STATUS NET_API_FUNCTION NetShareEnum( LMSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle );

 

这个等同cmd: net share 

关于网络共享路径的几个win32 API_第1张图片

 

几个链接:https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netshareenum

https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getdiskfreespaceexa

https://docs.microsoft.com/en-us/windows/desktop/CIMWin32Prov/win32-networkconnection

你可能感兴趣的:(关于网络共享路径的几个win32 API)