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
几个链接: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