Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Reto Ravasio

@Reto Ravasio
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Getting a computer name from the IP address(C#)
    R Reto Ravasio

    ups :-O
    just realized that the enums PlatformId and ServerType are defined in another file.

    public enum PlatformId
    {
    Unknown = 0,
    DOS = 300,
    OS2 = 400,
    NT = 500,
    OSF = 600,
    VMS = 700,
    }

    [Flags]
    public enum ServerType
    {
    Workstation = 0x00000001, // A LAN Manager workstation
    Server = 0x00000002, // A LAN Manager server
    SqlServer = 0x00000004, // Any server running with Microsoft SQL Server
    DomainController = 0x00000008, // Primary domain controller
    DomainBackupController = 0x00000010, // Backup domain controller
    TimeSource = 0x00000020, // Server running the Timesource service
    Afp = 0x00000040, // Apple File Protocol server
    Novell = 0x00000080, // Novell server
    DomainMember = 0x00000100, // LAN Manager 2.x domain member
    PrintQueueServer = 0x00000200, // Server sharing print queue
    DialinServer = 0x00000400, // Server running dial-in service
    XenixServer = 0x00000800, // Xenix server
    ServerUnix = XenixServer,
    NT = 0x00001000, // Windows Server 2003, Windows XP, Windows 2000, or Windows NT
    Wfw = 0x00002000, // Server running Windows for Workgroups
    ServerMFPN = 0x00004000, // Microsoft File and Print for NetWare
    ServerNT = 0x00008000, // Windows Server 2003, Windows 2000 server, or Windows NT server that is not a domain controller
    PotentialBrowser = 0x00010000, // Server that can run the browser service
    BackupBrowser = 0x00020000, // Server running a browser service as backup
    MasterBrowser = 0x00040000, // Server running the master browser service
    DomainMaster = 0x00080000, // Server running the domain master browser
    ServerOSF = 0x00100000,
    ServerVMS = 0x00200000,
    Windows = 0x00400000, // Windows Me, Windows 98, or Windows 95
    DFS = 0x00800000, // Root of a DFS tree
    ClusterNT = 0x01000000, // NT Cluster
    TerminalServer = 0x02000000, // Terminal Server
    ClusterVsNT = 0x04000000, // Cluster virtual servers available in the domain
    Dce = 0x10000000, // IBM DSS (Directory and Security Services) or equivalent
    }

    .NET (Core and Framework) csharp sysadmin help tutorial

  • Getting a computer name from the IP address(C#)
    R Reto Ravasio

    the longer answer is _Yes:).
    I had once a similar problem an found that NetWkstaGetInfo[^] worked quite well. You can provide the IP address as input and get the (BIOS-)name of the machine (and other stuff) back.
    If I remember correctly I've had had some security issues with workstation configurations (domain worked well). The following c# 2.0 code is all that's needed.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Globalization;
    using NetScan.Contract;
    using System.Diagnostics;

    namespace NetScan.Service
    {
    static class NetBios
    {
    #region public

      public class Info
      {
         private Info()
         {
         }
         internal Info(PlatformId platformId, Version version, string computerName, string lanGroup)
         {
            this.PlatformId = platformId;
            this.Version = version;
            this.ComputerName = computerName;
            this.LanGroup = lanGroup;
         }
         public readonly PlatformId PlatformId;
         public readonly Version Version;
         public readonly string ComputerName;
         public readonly string LanGroup;
    
         public string Comment;
         public ServerType ServerType;
    
         public override string ToString()
         {
            return string.Format(CultureInfo.CurrentCulture, "{0} - {1} - {2}", Version, ComputerName, LanGroup);
         }
      }
    
      public static Info GetInfo(string serverName)
      {
         Info retVal = null;
         System.IntPtr x;
         uint lret = NativeMethods.NetWkstaGetInfo(serverName, 100, out x);
         if (lret != 0 || x == System.IntPtr.Zero)
         {
            return null;
         }
         NativeMethods.WKSTA\_INFO\_100 wi = (NativeMethods.WKSTA\_INFO\_100)Marshal.PtrToStructure(x, typeof(NativeMethods.WKSTA\_INFO\_100));
         retVal = new Info((PlatformId)wi.wki100\_platform\_id, new Version(wi.wki100\_ver\_major, wi.wki100\_ver\_minor), Marshal.PtrToStringUni(wi.wki100\_computername), Marshal.PtrToStringUni(wi.wki100\_langroup));
         NativeMethods.NetApiBufferFree(x);
    
         lret = NativeMethods.NetServerGetInfo(serverName, 101, out x);
         if (lret == 0 && x != System.IntPtr.Zero)
         {
            NativeMetho
    

    _

    .NET (Core and Framework) csharp sysadmin help tutorial

  • Rating Rant
    R Reto Ravasio

    I just got hit by a 1 for my new article[^] and feel quite a bit cheated.
    The average was 5 with 2 votes and then someone comes along and posts a 1 (without comment!) dropping me to 3.4 and straight to the bottom of the category.
    I understand that no voting system is perfect and that it's difficult to solve all kinds of problems but such an obvious abuse should just not be possible.
    What annoys me most is that this is the second time this happened to me (just not so obvious). Of course these spoiler votes get evened out over-time but as I don't expect more than 10 votes for the article I can be happy if the article raises to something above 4 in the years to come. Incidents like this take all the fun and ambition out of being a CPian :-(.
    I think that these extreme low/high samples should be kicked out of the calculation but then I'm not very good at statistics so I wouldn't know how to do it properly. But I still think something should be done.... :mad: btw: see also the Voting - perhaps not?[^] thread.

    Site Bugs / Suggestions csharp wpf com tools tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups