Exemplo n.º 1
0
            public WinVersion()
            {
                osvi = new OSVERSIONINFO();
                osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(typeof(OSVERSIONINFO));

                GetVersionEx(ref osvi);
            }
Exemplo n.º 2
0
        //New

        // check for NT4 SP6 or later
        private static bool UseOSVersionInfoEx(OSVERSIONINFO info)
        {
            bool b = NativeMethods.GetVersionEx(info);

            //If Not b Then
            //    Dim [error] As Integer = Marshal.GetLastWin32Error()

            //    Throw New InvalidOperationException("Failed to get OSVersionInfo. Error = 0x" + [error].ToString("8X", CultureInfo.CurrentCulture))
            //End If

            if (info.MajorVersion < 4)
            {
                return(false);
            }
            if (info.MajorVersion > 4)
            {
                return(true);
            }
            if (info.MinorVersion < 0)
            {
                return(false);
            }
            if (info.MinorVersion > 0)
            {
                return(true);
            }
            // TODO: CSDVersion for NT4 SP6
            if (info.CSDVersion == "Service Pack 6")
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        //Public Function Win7Ver() As Boolean
        // Dim Ret As Integer
        // Dim OSInfo As OSVERSIONINFO
        // Dim PId As String
        // 'Set the graphical mode to persistent
        //' '    Me.AutoRedraw = True
        //'Set the structure size
        //		OSInfo.dwOSVersionInfoSize = Len(OSInfo)
        //    'Get the Windows version'
        //	Ret = GetVersionEx(OSInfo)
        //Chack for error's
        //    If ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
        //	If Ret = 0 Then Win7Ver = False : Exit Function
        //Print the information to the form
        //	Select Case OSInfo.dwPlatformId
        //			Case 0'
        //		PId = "Windows 32s "
        //	Case '1
        //		PId = "Windows 95/98"
        //	Case 2
        //		PId = "Windows NT "
        //End Select
        //    Print "OS: " + PId
        //    Print "Win version:" + Str$(OSInfo.dwMajorVersion) + "." + LTrim(Str(OSInfo.dwMinorVersion))
        //    Print "Build: " + Str(OSInfo.dwBuildNumber)
        //	If OSInfo.dwMajorVersion >= 6 Then Win7Ver = True
        //End Function

        public static string getWinVer()
        {
            int           Ret    = 0;
            OSVERSIONINFO OSInfo = default(OSVERSIONINFO);
            string        PId    = null;

            //Set the graphical mode to persistent
            //    Me.AutoRedraw = True
            //Set the structure size
            OSInfo.dwOSVersionInfoSize = Strings.Len(OSInfo);
            //Get the Windows version
            Ret = GetVersionEx(ref OSInfo);
            //Chack for errors
            //    If ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
            //If Ret& = 0 Then Win7Ver = False: Exit Function
            //Print the information to the form
            switch (OSInfo.dwPlatformId)
            {
            case 0:
                PId = "Windows 32s ";
                break;

            case 1:
                PId = "Windows 95/98";
                break;

            case 2:
                PId = "Windows NT ";
                break;
            }
            //    Print "OS: " + PId
            //    Print "Win version:" + Str$(OSInfo.dwMajorVersion) + "." + LTrim(Str(OSInfo.dwMinorVersion))
            //    Print "Build: " + Str(OSInfo.dwBuildNumber)
            return(PId);
        }
Exemplo n.º 4
0
        static OperatingSystem()
        {
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                UseNativeData = false;
                return;
            }
            OSVERSIONINFO osVersionInfo = new OSVERSIONINFO
            {
                OSVersionInfoSize = (uint)Marshal.SizeOf <OSVERSIONINFO>()
            };
            uint status = RtlGetVersion(ref osVersionInfo);

            if (status != 0)
            {
                throw new Win32Exception(RtlNtStatusToDosError(status));
            }
            UseNativeData       = true;
            NativeVersion       = new Version((int)osVersionInfo.MajorVersion, (int)osVersionInfo.MinorVersion, (int)osVersionInfo.BuildNumber);
            NativeVersionString = $"Windows {osVersionInfo.MajorVersion}.{osVersionInfo.MinorVersion}.{osVersionInfo.BuildNumber}";
            if (!string.IsNullOrEmpty(osVersionInfo.CSDVersion))
            {
                NativeVersionString += " " + osVersionInfo.CSDVersion;
            }
        }
Exemplo n.º 5
0
 protected static void CheckWinVer()
 {
     STS.WinApi.OSVERSIONINFO info = new OSVERSIONINFO();
     if (STS.WinApi.Call.GetVersionEx(info))
     {
     }
 }
Exemplo n.º 6
0
        protected static void CheckWinVer()
        {
            var info = new OSVERSIONINFO();

            if (Call.GetVersionEx(info))
            {
            }
        }
Exemplo n.º 7
0
        static bool CheckWindows10()
        {
            var ov = new OSVERSIONINFO();

            ov.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            RtlGetVersion(ref ov);
            return(ov.dwMajorVersion >= 10);
        }
Exemplo n.º 8
0
        private void InitOsVersionInfo(OSVERSIONINFO info)
        {
            OSPlatformId = GetOSPlatformId(info.PlatformId);

            OSMajorVersion = info.MajorVersion;
            OSMinorVersion = info.MinorVersion;
            BuildNumber    = info.BuildNumber;
            OSCSDVersion   = info.CSDVersion;
        }
Exemplo n.º 9
0
 public static string GetServicePack()
 {
     OSVERSIONINFO os = new OSVERSIONINFO();
     os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
     GetVersionEx(ref os);
     if (os.szCSDVersion == "")
         return "";
     else
         return os.szCSDVersion;
 }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            // Aufruf der Funktion GetDiskFreeSpaceEx
            ulong bytesFree = 0, bytesTotal = 0, totalBytesFree = 0;

            GetDiskFreeSpaceEx("C:", ref bytesFree, ref bytesTotal, ref totalBytesFree);
            Console.WriteLine("Free: {0}", bytesFree);
            Console.WriteLine("Total: {0}", bytesTotal);
            Console.WriteLine("Total Free: {0}", totalBytesFree);

            // Aufruf der Funktion GetWindowsDirectory
            StringBuilder buffer = new StringBuilder(261);

            if (GetWindowsDirectory(buffer, 261) > 0)
            {
                Console.WriteLine("Windows-Ordner: {0}", buffer.ToString());
            }
            else
            {
                Console.WriteLine("Fehler bei der Ermittlung des Windows-Ordners");
            }

            // Aufruf der Funktion GetUserName, die einen String und
            // einen uint-Wert zurückgibt
            StringBuilder userName = new StringBuilder(1024);
            uint          size     = 1024;

            if (GetUserName(userName, ref size) != 0)
            {
                Console.WriteLine("Aktueller Benutzer: {0}", userName.ToString());
            }
            else
            {
                Console.WriteLine("Fehler beim Aufruf von GetUserName");
            }

            // Aufruf der Funktion GetVersionEx, die eine Struktur vom
            // Typ OSVERSIONINFO erwartet
            OSVERSIONINFO vi = new OSVERSIONINFO();

            vi.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            if (GetVersionEx(ref vi) != 0)
            {
                Console.WriteLine("Windows-Version: {0}.{1}.{2}",
                                  vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber);
                Console.WriteLine("Service-Pack: {0}", vi.szCSDVersion);
            }
            else
            {
                Console.WriteLine("Fehler beim Aufruf von GetVersionEx");
            }

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }
Exemplo n.º 11
0
        public double DeviceInfo()
        {
            if (Connected)
            {
                OSVERSIONINFO os = new OSVERSIONINFO();
                m_RAPI.GetDeviceVersion(out os);
                return(os.dwMajorVersion + (os.dwMinorVersion * 0.1));
            }

            return(0f);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Tests minimun OS required
 /// </summary>
 /// <returns>bool</returns>
 public bool VersionCheck()
 {
     OSVERSIONINFO tVer = new OSVERSIONINFO();
     tVer.dwVersionInfoSize = Marshal.SizeOf(tVer);
     GetVersionEx(ref tVer);
     if ((tVer.dwPlatformId & VER_PLATFORM_WIN32_NT) == VER_PLATFORM_WIN32_NT)
     {
         return true;
     }
     return false;
 }
Exemplo n.º 13
0
        //-----------------------------------------------------------------------------
        // Constructors
        public OperatingSystemVersion()
        {
            OSVERSIONINFO osVersionInfo = new OSVERSIONINFO();

            if ( ! UseOSVersionInfoEx( osVersionInfo ) )
                InitOsVersionInfo( osVersionInfo );
            else
                InitOsVersionInfoEx();

            //			Lock();
        }
Exemplo n.º 14
0
//-----------------------------------------------------------------------------
// Constructors

        public OperatingSystemVersion()
        {
            OSVERSIONINFO osVersionInfo = new OSVERSIONINFO();

            if (!UseOSVersionInfoEx(osVersionInfo))
            {
                InitOsVersionInfo(osVersionInfo);
            }
            else
            {
                InitOsVersionInfoEx();
            }
        }
Exemplo n.º 15
0
        static PreviewForm()
        {
            RibbonStyle.UpdateInstance(DefaultThemeColor, ThemeLightness.Colorful);
            var ipStyle = (C1.Win.InputPanel.ThemeColor)((int)DefaultThemeColor);

            C1.Win.InputPanel.InputStyle.UpdateInstance(ipStyle, C1.Win.InputPanel.ThemeLightness.LightGray);

            var ov = new OSVERSIONINFO();

            ov.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            RtlGetVersion(ref ov);

            _exePath = Application.ExecutablePath;
        }
Exemplo n.º 16
0
        static public string GetServicePack()
        {
            OSVERSIONINFO os = new OSVERSIONINFO();

            os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            GetVersionEx(ref os);
            if (os.szCSDVersion == "")
            {
                return("No Service Pack Installed");
            }
            else
            {
                return(os.szCSDVersion);
            }
        }
Exemplo n.º 17
0
        //-----------------------------------------------------------------------------
        // Constructors

        public OperatingSystemVersion()
        {
            OSVERSIONINFO osVersionInfo = new OSVERSIONINFO();

            if (!UseOSVersionInfoEx(osVersionInfo))
            {
                InitOsVersionInfo(osVersionInfo);
            }
            else
            {
                InitOsVersionInfoEx();
            }

            //			Lock();

            InitArchitecture();
        }
Exemplo n.º 18
0
        public static string GetServicePack()
        {
            OSVERSIONINFO osinfoA = new OSVERSIONINFO();

            short retvalue;

            osinfoA.dwOSVersionInfoSize = 148;
            retvalue = GetVersionExA(ref osinfoA);
            if (Strings.Len(osinfoA.szCSDVersion) == 0)
            {
                return("");
            }
            else
            {
                return(" - " + (System.Convert.ToString(osinfoA.szCSDVersion)));
            }
        }
Exemplo n.º 19
0
        // check for NT4 SP6 or later
        private static bool UseOSVersionInfoEx(OSVERSIONINFO info)
        {
            bool b = NativeMethods.GetVersionEx(info);

            if (!b)
            {
                int error = Marshal.GetLastWin32Error();

                throw new InvalidOperationException(
                          "Failed to get OSVersionInfo. Error = 0x" +
                          error.ToString("8X", CultureInfo.CurrentCulture));
            }

            if (info.MajorVersion < 4)
            {
                return(false);
            }
            if (info.MajorVersion > 4)
            {
                return(true);
            }

            if (info.MinorVersion < 0)
            {
                return(false);
            }
            if (info.MinorVersion > 0)
            {
                return(true);
            }

            // TODO: CSDVersion for NT4 SP6
            if (info.CSDVersion == "Service Pack 6")
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 20
0
 internal static extern bool GetVersionEx([In, Out] OSVERSIONINFO ver);
Exemplo n.º 21
0
 public static extern int GetVersionEx(ref OSVERSIONINFO lpVersionInfo);
Exemplo n.º 22
0
 private static extern bool GetVersionEx([In(), Out()]
                                         OSVERSIONINFO osVersionInfo);
Exemplo n.º 23
0
        public static void GetOSInfo( ref OSVERSIONINFO mOSInfo , ref string mOSName )
        {
            int Result = 0;

            mOSInfo.szCSDVersion = Function.Space( 128 );
            mOSInfo.dwOSVersionInfoSize = (uint) Marshal.SizeOf( mOSInfo );
            Result = GetVersionEx( ref mOSInfo );
            mOSName = "";

            if( Result == 0 ) return;

            switch( mOSInfo.dwPlatformId )
            {
                case Const.VER_PLATFORM_WIN32_NT:

                    if( mOSInfo.dwMajorVersion <= 4 )
                        mOSName = "WINNT";

                    if( mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 0 )
                        mOSName = "WIN2000";

                    if( mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 1 )
                        mOSName = "WINXP";

                    if (mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 2)
                        mOSName = "WIN2003";

                    break;

                case Const.VER_PLATFORM_WIN32_WINDOWS:

                    if( ( mOSInfo.dwMajorVersion == 4 ) && ( mOSInfo.dwMinorVersion == 0 ) )
                        mOSName = "WIN95";
                    if( ( mOSInfo.dwMajorVersion == 4 ) && ( mOSInfo.dwMinorVersion == 10 ) )
                        mOSName = "WIN98";
                    if( ( mOSInfo.dwMajorVersion == 4 ) && ( mOSInfo.dwMinorVersion == 90 ) )
                        mOSName = "WIN98ME";

                    break;

                case Const.VER_PLATFORM_WIN32s:

                    mOSName = "WIN32S";

                    break;
            }
        }
Exemplo n.º 24
0
        public static void GetOSInfo(ref OSVERSIONINFO mOSInfo, ref string mOSName)
        {
            int Result = 0;

            mOSInfo.szCSDVersion        = Function.Space(128);
            mOSInfo.dwOSVersionInfoSize = (uint)Marshal.SizeOf(mOSInfo);
            Result  = GetVersionEx(ref mOSInfo);
            mOSName = "";

            if (Result == 0)
            {
                return;
            }

            switch (mOSInfo.dwPlatformId)
            {
            case Const.VER_PLATFORM_WIN32_NT:

                if (mOSInfo.dwMajorVersion <= 4)
                {
                    mOSName = "WINNT";
                }

                if (mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 0)
                {
                    mOSName = "WIN2000";
                }

                if (mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 1)
                {
                    mOSName = "WINXP";
                }

                if (mOSInfo.dwMajorVersion == 5 && mOSInfo.dwMinorVersion == 2)
                {
                    mOSName = "WIN2003";
                }

                break;

            case Const.VER_PLATFORM_WIN32_WINDOWS:

                if ((mOSInfo.dwMajorVersion == 4) && (mOSInfo.dwMinorVersion == 0))
                {
                    mOSName = "WIN95";
                }
                if ((mOSInfo.dwMajorVersion == 4) && (mOSInfo.dwMinorVersion == 10))
                {
                    mOSName = "WIN98";
                }
                if ((mOSInfo.dwMajorVersion == 4) && (mOSInfo.dwMinorVersion == 90))
                {
                    mOSName = "WIN98ME";
                }

                break;

            case Const.VER_PLATFORM_WIN32s:

                mOSName = "WIN32S";

                break;
            }
        }
Exemplo n.º 25
0
 private static extern short GetVersionExA(ref OSVERSIONINFO lpVersionInformation);
Exemplo n.º 26
0
        /// <summary>
        /// Sets system version info.
        /// </summary>
        /// <returns></returns>
        public static bool SetSystemVersionInfo()
        {
            OSVERSIONINFO os = new OSVERSIONINFO();
            os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            int getVersion = SEBGlobalConstants.OS_UNKNOWN;

            try
            {
                // Gets os version
                if (GetVersionEx(ref os) != 0)
                {
                    switch (os.dwPlatformId)
                    {
                        case 1:
                            switch (os.dwMinorVersion)
                            {
                                case 0:
                                    getVersion = SEBGlobalConstants.WIN_95;
                                    break;
                                case 10:
                                    getVersion = SEBGlobalConstants.WIN_98;
                                    break;
                                case 90:
                                    getVersion = SEBGlobalConstants.WIN_ME;
                                    break;
                                default:
                                    getVersion = SEBGlobalConstants.OS_UNKNOWN;
                                    break;
                            }
                            break;
                        case 2:
                            switch (os.dwMajorVersion)
                            {
                                case 3:
                                    getVersion = SEBGlobalConstants.WIN_NT_351;
                                    break;
                                case 4:
                                    getVersion = SEBGlobalConstants.WIN_NT_40;
                                    break;
                                case 5:
                                    if (os.dwMinorVersion == 0)
                                        getVersion = SEBGlobalConstants.WIN_2000;
                                    else
                                        getVersion = SEBGlobalConstants.WIN_XP;
                                    break;
                                case 6:
                                    if (os.dwMinorVersion == 0)
                                        getVersion = SEBGlobalConstants.WIN_VISTA;
                                    else if (os.dwMinorVersion == 1)
                                        getVersion = SEBGlobalConstants.WIN_7;
                                    else if (os.dwMinorVersion == 2)
                                        getVersion = SEBGlobalConstants.WIN_8;
                                    else
                                        getVersion = SEBGlobalConstants.WIN_VISTA;
                                    break;
                                default:
                                    getVersion = SEBGlobalConstants.OS_UNKNOWN;
                                    break;
                            }
                            break;
                        default:
                            getVersion = SEBGlobalConstants.OS_UNKNOWN;
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.AddError("SetSystemVersionInfo.", null, ex);
            }

            Logger.AddInformation("OS Version: " + getVersion.ToString(), null, null);

            // Is new windows version
            switch (getVersion)
            {
                case SEBGlobalConstants.WIN_NT_351:
                case SEBGlobalConstants.WIN_NT_40:
                case SEBGlobalConstants.WIN_2000:
                case SEBGlobalConstants.WIN_XP:
                case SEBGlobalConstants.WIN_VISTA:
                    IsNewOS = true;
                    return true;
                case SEBGlobalConstants.WIN_95:
                case SEBGlobalConstants.WIN_98:
                case SEBGlobalConstants.WIN_ME:
                    IsNewOS = false;
                    return true;
                default:
                    return false;

            }
        }
Exemplo n.º 27
0
 public static extern bool GetVersionEx
 (
     [In, Out] OSVERSIONINFO osVersionInfo
 );
Exemplo n.º 28
0
 private static extern bool GetVersionEx(ref OSVERSIONINFO osvi);
Exemplo n.º 29
0
 public static extern short GetVersionEx(ref OSVERSIONINFO o);
Exemplo n.º 30
0
 public static extern short GetVersionEx(ref OSVERSIONINFO o);
Exemplo n.º 31
0
        public string getVersionInfo()
        {
            string retVal = "";
            string fChecks = "";
            string spInfo = "";
            string err = "";
            string[] stuff;
            errorCount = 0;
            try
            {
                fChecks += doFileChecks();
            }
            catch (Exception e) {
                Form1.debugMessage("FILE CHECK ERROR..." + e.Message + "\n" + e.Source + "\n" + e.StackTrace);
            }
            Form1.debugMessage("Now getting system info...");
            OSVERSIONINFO os = new OSVERSIONINFO();
            os.dwOSVersionInfoSize=Marshal.SizeOf(typeof(OSVERSIONINFO));
            GetVersionEx(ref os);
            if (os.szCSDVersion=="")
                spInfo = "No Service Pack Installed";
            else
                spInfo = os.szCSDVersion;
            OperatingSystem os2 = System.Environment.OSVersion;
            if (!checkVer(os2.ToString()+" ("+spInfo+")",parent.osVersionStandard))
            {
                errorCount++;
                err = "---bad version---\nYours:["+os2.ToString()+" ("+spInfo+")] Standard:["+showA(parent.osVersionStandard)+"]";
            }

            //if (!checkVer(spInfo,osSPStandard))
            //err = "---bad service pack---\nYours:["+spInfo+"] Standard:["+showA(osSPStandard)+"]";
            retVal += "Timestamp: " + System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString() + "\n";
            retVal += "Windows: " + parent.SplitByString(os2.ToString(),"Service Pack")[0].ToString() + " (" + spInfo + ") "+err+"\n";
            err="";
            Form1.debugMessage("Getting Processor Info...");
            retVal += "Processor: " + getProcessor() +"\n";
            err = "";
            string holder="";
            //holder = getMemory();
            //if (strToInt(holder) < strToInt(memoryMin[0].Trim()))
            //	err = "---bad Memory Size---\nYours:["+holder+"] Standard Minimum:["+memoryMin[0].Trim()+"]";
            //retVal += "Memory: " + holder + err + "\n";
            err = "";
            holder = "";
            retVal += "\nIBS Workstation: " + Form1.cver +"\n";
            Form1.debugMessage("Getting DotNet Version...");

            if (!checkVer(System.Environment.Version.ToString(),parent.dotnetVersionStandard))
            {
                errorCount++;
                err = "---bad version---\nYours:["+System.Environment.Version.ToString()+"] Standard:["+showA(parent.dotnetVersionStandard)+"]";
            }
            retVal += "dotNet Version: " + System.Environment.Version.ToString()+err+"\n";
            err = "";
            retVal += "Auto Update: " + parent.autoUpdate.Checked.ToString() +"\n";
            retVal += "Enter = Send: " + parent.enterSend.Checked.ToString() +"\n";
            retVal += "Auto Hide: " + parent.autoHide.Checked.ToString() +"\n";
            retVal += "Disable Pops: " + parent.disablePops.Checked.ToString() +"\n";
            DateTime startTime = parent.startTime;
            retVal += "Workstation Started: " + startTime.ToShortDateString() + " " + startTime.ToShortTimeString() + "\n";
            //if (System.Environment.CommandLine.ToString().ToLower().IndexOf("isaac\\ibsworkstation") < 1)
            //{
            //	errorCount++;
            //	err = "---bad source location---\nYours:["+System.Environment.CommandLine.ToString()+"] Standard:[\\\\isaac\\ibsWorkstation\\IBSWorkstation.exe]";
            //}
            retVal += "Command Line: " + System.Environment.CommandLine.ToString() +err+"\n";
            retVal += "Path: " + Form1.controlPath + err + "\n";
            err = "";
            retVal += "\nUser: "******"\n";
            string ls = "Not Logged In";
            string sid = "";
            if (Form1.loggedIn)
                ls = "Logged In";
            try
            {
                sid = Form1.getRegVal("ProfileImagePath","Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + SID.ShowUserSID(Form1.currentUser)).ToString();
                if (sid.Length > 1)
                {
                    homeDirectory = sid;
                    Form1.setRegVal("homeDirectory",sid);
                }
                else
                {
                    sid = Form1.getRegVal("homeDirectory").ToString();
                    if (sid.Length > 1)
                        homeDirectory = sid;
                }
                retVal += "Home Directory: " + homeDirectory + "\n";
            }
            catch (Exception e)
                {
                Form1.debugMessage(e.Message + "\n" + Form1.currentUser);
                string ret = "";
                sid = "C:\\Documents and Settings\\" + Form1.currentUser.ToLower().Replace("us_ibs\\","");
                Form1.debugMessage("Trying " + sid);
                if (System.IO.Directory.Exists(sid)){
                    ret = sid;
                    }
                else
                {
                    string sid2 = sid + ".US_IBS";
                    Form1.debugMessage("Trying " + sid2);
                    if (System.IO.Directory.Exists(sid2))
                        ret = sid2;
                    else
                    {
                    sid2 = sid + ".ibs.org";
                    Form1.debugMessage("Trying " + sid2);
                    if (System.IO.Directory.Exists(sid2))
                        ret = sid2;
                    else
                        {
                        sid2 = sid + ".ibs";
                        Form1.debugMessage("Trying " + sid2);
                        if (System.IO.Directory.Exists(sid2))
                            ret = sid2;
                        else
                        {
                            sid2 = sid + ".WINNT";
                            Form1.debugMessage("Trying " + sid2);
                            if (System.IO.Directory.Exists(sid2))
                                ret = sid2;
                            else
                            {
                                ret = "C:\\";
                                Form1.debugMessage("Gave up using: " + ret);
                            }
                        }
                        }
                    }
                }
                retVal += "Home Directory: " + ret + "\n";
                homeDirectory = ret;
                Form1.setRegVal("homeDirectory",ret);
                }
            retVal += "Login Status: " + ls +"\n";
            retVal += "Program Context: " + System.Environment.UserName +"\n";
            retVal += "Computer: " + System.Environment.MachineName +"\n";
            retVal += "Hostname: " + System.Net.Dns.GetHostName() + "\n";
            retVal += "IP Address: " + getIPAddress() + "\n";

            //retVal += "Last Reboot: " + ((float)((uint)System.Environment.TickCount)/1000/60/60/24) +" days ago.\n";
            //retVal += "Last Reboot: " + lastSystemBootUp.getSystemBootup().ToString() + "\n";
            //retVal += "Last Reboot (simple): " + wmiQuery("Win32_OperatingSystem","LastBootUpTime") + "\n";
            err="";
            displaySettings [] dps = getScreenInfo();
            //			if (rr.CompareTo(refreshRateMin[0]) > 1)
            string sep="";
            for (int i=0;i<dps.Length;i++)
            {
                holder += sep + dps[i].refreshRate;
                sep = ",";
            }
            stuff = holder.Split(",".ToCharArray());
            for (int i=0;i<stuff.Length;i++)
                if (strToInt(stuff[i]) < strToInt(parent.refreshRateMin[0]))
                {
                    errorCount++;
                    err = "---bad Refresh Rate---\nYours:["+holder+"] Standard:["+parent.refreshRateMin[0].Trim()+"]";
                }
            retVal += "Refresh Rate: " + holder + err + "\n";
            retVal += "Screen Resolution: ";
            sep = "";
            for (int idx=0;idx<dps.Length;idx++)
            {
                retVal+= sep + dps[idx].width + "x" + dps[idx].height + "x" + dps[idx].colorDepth;
                sep = ",";
            }
            retVal += "\n";
            retVal += parent.fileReadStat;
            retVal += fChecks;
            retVal += "\nError Count: " + errorCount;
            Form1.debugMessage("Getting Update History...");
            eventLog eLog = new eventLog();
            if (parent.updateHistory.Length > 0)
            {
                retVal += "\n-------------UPDATE HISTORY----------------";
                retVal += parent.updateHistory;
            }
            //retVal += "\n-------------Application Log----------------\n";
            parent.applicationLog = eLog.viewLog("Application",300);
            //retVal += "\n-------------System Log----------------\n";
            parent.systemLog  = eLog.viewLog("System",300);

            parent.directoryLog  = eLog.viewLog("Directory Service",300);
            parent.frsLog  = eLog.viewLog("File Replication Service",300);

            Form1.debugMessage("Finishing Up...");
            return retVal;
        }
Exemplo n.º 32
0
 private static extern bool GetVersionEx(ref OSVERSIONINFO osvi);
Exemplo n.º 33
0
 private static extern int GetVersionAdv(ref OSVERSIONINFO lpVersionInformation);
Exemplo n.º 34
0
 public static extern bool GetVersionEx(out OSVERSIONINFO lpVersionInfo);
Exemplo n.º 35
0
        private void InitOsVersionInfo( OSVERSIONINFO info )
        {
            OSPlatformId = GetOSPlatformId( info.PlatformId );

            OSMajorVersion = info.MajorVersion ;
            OSMinorVersion = info.MinorVersion ;
            BuildNumber    = info.BuildNumber  ;
            //			PlatformId     = info.PlatformId   ;
            OSCSDVersion   = info.CSDVersion   ;
        }
Exemplo n.º 36
0
 private static extern int GetVersionAdv(ref OSVERSIONINFO lpVersionInformation);
Exemplo n.º 37
0
        /// <summary>
        /// Sets system version info.
        /// </summary>
        /// <returns></returns>
        public static void GetVersionInfo()
        {
            var os = new OSVERSIONINFO();
            os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            try
            {
                // Gets os version
                if(GetVersionEx(ref os) != 0)
                {
                    switch(os.dwPlatformId)
                    {
                        case 1:
                            switch(os.dwMinorVersion)
                            {
                                case 0:
                                    version = WIN_95;
                                    break;
                                case 10:
                                    version = WIN_98;
                                    break;
                                case 90:
                                    version = WIN_ME;
                                    break;
                                default:
                                    version = OS_UNKNOWN;
                                    break;
                            }
                            break;
                        case 2:
                            switch(os.dwMajorVersion)
                            {
                                case 3:
                                    version = WIN_NT_351;
                                    break;
                                case 4:
                                    version = WIN_NT_40;
                                    break;
                                case 5:
                                    if(os.dwMinorVersion == 0)
                                        version = WIN_2000;
                                    else
                                        version = WIN_XP;
                                    break;
                                case 6:
                                    if(os.dwMinorVersion == 0)
                                        version = WIN_VISTA;
                                    else if(os.dwMinorVersion == 1)
                                        version = WIN_7;
                                    else if(os.dwMinorVersion == 2)
                                        version = WIN_8;
                                    else
                                        version = WIN_VISTA;
                                    break;
                                default:
                                    version = OS_UNKNOWN;
                                    break;
                            }
                            break;
                        default:
                            version = OS_UNKNOWN;
                            break;
                    }
                }
            }
            catch(Exception ex)
            {
                Logger.AddError("SetSystemVersionInfo.", null, ex);
                version = OS_UNKNOWN;
            }

            Logger.AddInformation("OS Version: " + version);
        }
Exemplo n.º 38
0
 static extern int RtlGetVersion(ref OSVERSIONINFO osVersion);
Exemplo n.º 39
0
		[DllImport("kernel32.Dll")] public static extern short GetVersionEx(ref OSVERSIONINFO o);
Exemplo n.º 40
0
 public static extern bool GetVersionEx(ref OSVERSIONINFO version);
Exemplo n.º 41
0
        /// <summary>
        /// Sets system version info.
        /// </summary>
        /// <returns></returns>
        public static bool SetSystemVersionInfo()
        {
            OSVERSIONINFO os = new OSVERSIONINFO();

            os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
            int getVersion = SEBGlobalConstants.OS_UNKNOWN;

            try
            {
                // Gets os version
                if (GetVersionEx(ref os) != 0)
                {
                    switch (os.dwPlatformId)
                    {
                    case 1:
                        switch (os.dwMinorVersion)
                        {
                        case 0:
                            getVersion = SEBGlobalConstants.WIN_95;
                            break;

                        case 10:
                            getVersion = SEBGlobalConstants.WIN_98;
                            break;

                        case 90:
                            getVersion = SEBGlobalConstants.WIN_ME;
                            break;

                        default:
                            getVersion = SEBGlobalConstants.OS_UNKNOWN;
                            break;
                        }
                        break;

                    case 2:
                        switch (os.dwMajorVersion)
                        {
                        case 3:
                            getVersion = SEBGlobalConstants.WIN_NT_351;
                            break;

                        case 4:
                            getVersion = SEBGlobalConstants.WIN_NT_40;
                            break;

                        case 5:
                            if (os.dwMinorVersion == 0)
                            {
                                getVersion = SEBGlobalConstants.WIN_2000;
                            }
                            else
                            {
                                getVersion = SEBGlobalConstants.WIN_XP;
                            }
                            break;

                        case 6:
                            if (os.dwMinorVersion == 0)
                            {
                                getVersion = SEBGlobalConstants.WIN_VISTA;
                            }
                            else if (os.dwMinorVersion == 1)
                            {
                                getVersion = SEBGlobalConstants.WIN_7;
                            }
                            else if (os.dwMinorVersion == 2)
                            {
                                getVersion = SEBGlobalConstants.WIN_8;
                            }
                            else
                            {
                                getVersion = SEBGlobalConstants.WIN_VISTA;
                            }
                            break;

                        default:
                            getVersion = SEBGlobalConstants.OS_UNKNOWN;
                            break;
                        }
                        break;

                    default:
                        getVersion = SEBGlobalConstants.OS_UNKNOWN;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.AddError("SetSystemVersionInfo.", null, ex);
            }

            Logger.AddInformation("OS Version: " + getVersion.ToString(), null, null);

            // Is new windows version
            switch (getVersion)
            {
            case SEBGlobalConstants.WIN_NT_351:
            case SEBGlobalConstants.WIN_NT_40:
            case SEBGlobalConstants.WIN_2000:
            case SEBGlobalConstants.WIN_XP:
            case SEBGlobalConstants.WIN_VISTA:
                IsNewOS = true;
                return(true);

            case SEBGlobalConstants.WIN_95:
            case SEBGlobalConstants.WIN_98:
            case SEBGlobalConstants.WIN_ME:
                IsNewOS = false;
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 42
0
        // check for NT4 SP6 or later
        private static bool UseOSVersionInfoEx( OSVERSIONINFO info )
        {
            bool b = NativeMethods.GetVersionEx( info );

            if ( ! b )
            {
                int error = Marshal.GetLastWin32Error();

                throw new InvalidOperationException(
                    "Failed to get OSVersionInfo. Error = 0x" +
                    error.ToString( "8X", CultureInfo.CurrentCulture ) );
            }

            if ( info.MajorVersion < 4 ) return false;
            if ( info.MajorVersion > 4 ) return true;

            if ( info.MinorVersion < 0 ) return false;
            if ( info.MinorVersion > 0 ) return true;

            // TODO: CSDVersion for NT4 SP6
            if ( info.CSDVersion == "Service Pack 6" ) return true;

            return false;
        }
Exemplo n.º 43
0
 public static extern bool GetVersionEx(ref OSVERSIONINFO version);
Exemplo n.º 44
0
 public static extern Boolean GetVersionEx([In, Out] OSVERSIONINFO ver);
Exemplo n.º 45
0
 bool checkVista()
 {
     OSVERSIONINFO osvi = new OSVERSIONINFO();
     osvi.dwOSVersionInfoSize = Marshal.SizeOf(osvi);
     GetVersionEx(ref osvi);
     return osvi.dwMajorVersion >= 6;
 }
Exemplo n.º 46
0
            public WinVersion()
            {
                osvi = new OSVERSIONINFO();
                osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(typeof(OSVERSIONINFO));

                GetVersionEx(ref osvi);
            }
Exemplo n.º 47
0
 public static extern int GetVersionEx(ref OSVERSIONINFO lpVersionInformation);