سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب کد گرفتن اطلاعات Workstation با Netapi32.dll در سی شارپ #C را آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی این کد به این صورت است:
System JAVA2S has 3 users logged on
کد گرفتن اطلاعات Workstation با Netapi32.dll در سی شارپ #C :
''class NWGetInfo
{
[ StructLayout( LayoutKind.Sequential ) ]
struct WkstaInfo102
{
public uint platform_id;
public IntPtr computername;
public IntPtr langroup;
public uint ver_major;
public uint ver_minor;
public IntPtr lanroot;
public uint logged_on_users;
}
[ DllImport( "Netapi32.dll" ) ]
static extern unsafe int NetWkstaGetInfo( IntPtr servername, int level, byte** bufptr );
[ DllImport( "Netapi32.dll" ) ]
static extern unsafe int NetApiBufferFree( byte* bufptr );
{
[ StructLayout( LayoutKind.Sequential ) ]
struct WkstaInfo102
{
public uint platform_id;
public IntPtr computername;
public IntPtr langroup;
public uint ver_major;
public uint ver_minor;
public IntPtr lanroot;
public uint logged_on_users;
}
[ DllImport( "Netapi32.dll" ) ]
static extern unsafe int NetWkstaGetInfo( IntPtr servername, int level, byte** bufptr );
[ DllImport( "Netapi32.dll" ) ]
static extern unsafe int NetApiBufferFree( byte* bufptr );