Esempio n. 1
0
        /// <summary>
        /// Grab the join status for the specified computer.
        /// </summary>
        /// <param name="joinStatus">Receives the NetworkJoinStatus value.</param>
        /// <param name="Computer">Optional name of a computer for which to retrieve the NetworkJoinStatus information.  If this parameter is null, the local computer is assumed.</param>
        /// <returns>The name of the current domain or workgroup for the specified computer.</returns>
        /// <remarks></remarks>
        public static string GrabJoin(ref NetworkJoinStatus joinStatus, string Computer = null)
        {
            try
            {
                var mm = new MemPtr();
                mm.NetAlloc(1024);

                NetInfo.NetGetJoinInformation(Computer, ref mm.handle, ref joinStatus);

                string s = (string)mm;
                mm.NetFree();

                return(s);
            }
            catch
            {
                throw new NativeException();
            }
        }
Esempio n. 2
0
 static extern NET_API_STATUS NetGetJoinInformation(string lpServer, ref IntPtr lpNameBuffer, ref NetworkJoinStatus bufferType);