تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تحديد المعرف unc الخاص بجهاز على الشبكة
#1
كاتب الموضوع : Boutemine Oualid

السلام عليكم و رحمة الله و بركاته

كود :
using System.Text;
using System.Runtime.InteropServices

[DllImport("shlwapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool PathIsNetworkPath([MarshalAs(UnmanagedType.LPTStr)]string pszPath);
[DllImport("mpr.dll", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "WNetGetConnectionW")]
public static extern int WNetGetConnection([MarshalAs(UnmanagedType.LPWStr)]string lpLocalName, StringBuilder lpRemoteName, ref int lpnLength);
public string GetUNCPath(string NetworkPath)
{
string szRoot = NetworkPath.Substring(0, 2);
string szPath = NetworkPath;
if (PathIsNetworkPath(szPath))
{
StringBuilder szbUNC = new StringBuilder(260);
int iLength = 260;
if (WNetGetConnection(szRoot, szbUNC, ref iLength) == ERROR_SUCCESS)
{
szPath = Path.Combine(szbUNC.ToString(), Path.GetFileName(szPath));
}
}
return szPath;
}
}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  كود لتغيير خلفية قرص و الأيكون الخاص به RaggiTech 0 1,811 17-10-12, 07:08 PM
آخر رد: RaggiTech
  معرفة العنوان الفيزيائي لكروت الشبكة المثبة على الجهاز RaggiTech 0 2,351 17-10-12, 06:47 PM
آخر رد: RaggiTech
  لمعرفة جميع عناوين Ip في الشبكة المحلية RaggiTech 0 1,817 17-10-12, 05:38 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم