GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — reactos/base/shell/cmd/ver.c at master · reactos/reactos Expand file tree/ Copy pathver.cMore file actions 201 lines (173 loc) · 5.42 KB / Copy pathver.cFile metadata and controls201 lines (173 loc) · 5.42 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 /* * VER.C - ver internal command. * * * History: * * 06/30/98 (Rob Lake) * rewrote ver command to accept switches, now ver alone prints * copyright notice only. * * 27-Jul-1998 (John P Price <[email protected]>) * added config.h include * * 30-Jul-1998 (John P Price <[email protected]>) * added text about where to send bug reports and get updates. * * 20-Jan-1999 (Eric Kohl) * Unicode and redirection safe! * * 26-Feb-1999 (Eric Kohl) * New version info and some output changes. */ #include "precomp.h" #include <reactos/buildno.h> #include <reactos/version.h> OSVERSIONINFO osvi; TCHAR szOSName[50] = _T(""); VOID InitOSVersion(VOID) { LONG lResult; HKEY hKey; /* Get version information */ ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); /* Build OS version string */ /* Open registry key */ lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_QUERY_VALUE, &hKey); if (lResult == ERROR_SUCCESS) { DWORD dwSize, dwType; /* Retrieve the ProductName value */ dwSize = sizeof(szOSName); lResult = RegQueryValueEx(hKey, _T("ProductName"), NULL, &dwType, (LPBYTE)szOSName, &dwSize); /* If we have failed or the data type is unsupported... */ if (lResult != ERROR_SUCCESS || dwType != REG_SZ) { /* ... reserve size for one NULL character only! */ dwSize = sizeof(TCHAR); /* Set an error code (anything != ERROR_SUCCESS) */ lResult = ERROR_INVALID_PARAMETER; } /* NULL-terminate the string */ szOSName[(dwSize / sizeof(TCHAR)) - 1] = _T('\0'); /* Close the key */ RegCloseKey(hKey); } /* * If the registry key somehow doesn't exist or cannot be loaded, then * determine at least whether the version of Windows is either 9x or NT. */ if (lResult != ERROR_SUCCESS) { switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: { if (osvi.dwMajorVersion == 4) { if (osvi.dwMinorVersion == 0) _tcscpy(szOSName, _T("Windows 95")); else if (osvi.dwMinorVersion == 1) _tcscpy(szOSName, _T("Windows 98")); else if (osvi.dwMinorVersion == 9) _tcscpy(szOSName, _T("Windows ME")); else _tcscpy(szOSName, _T("Windows 9x")); } break; } case VER_PLATFORM_WIN32_NT: { _tcscpy(szOSName, _T("Windows NT")); break; } } } } /* Print the current OS version, suitable for VER command and PROMPT $V format */ VOID PrintOSVersion(VOID) { ConOutResPrintf(STRING_VERSION_RUNVER, szOSName, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.szCSDVersion); } #ifdef INCLUDE_CMD_VER /* * display shell version info internal command. */ INT cmd_ver (LPTSTR param) { INT i; nErrorLevel = 0; if (_tcsstr(param, _T("/?")) != NULL) { ConOutResPaging(TRUE,STRING_VERSION_HELP1); return 0; } ConOutResPrintf(STRING_CMD_SHELLINFO, _T(KERNEL_VERSION_STR), _T(KERNEL_VERSION_BUILD_STR)); ConOutChar(_T('\n')); ConOutResPuts(STRING_VERSION_RUNNING_ON); PrintOSVersion(); /* Basic copyright notice */ if (param[0] != _T('\0')) { ConOutPuts(_T("\n\n")); ConOutPuts(_T("Copyright (C) 1994-1998 Tim Norman and others.\n")); ConOutResPrintf(STRING_CMD_COPYRIGHT, _T(COPYRIGHT_YEAR)); for (i = 0; param[i]; i++) { /* Skip spaces */ if (param[i] == _T(' ')) continue; if (param[i] == _T('/')) { /* Is this a lone '/' ? */ if (param[i + 1] == 0) { error_invalid_switch(_T(' ')); return 1; } continue; } if (_totupper(param[i]) == _T('W')) { /* Warranty notice */ ConOutResPuts(STRING_VERSION_HELP3); } else if (_totupper(param[i]) == _T('R')) { /* Redistribution notice */ ConOutResPuts(STRING_VERSION_HELP4); } else if (_totupper(param[i]) == _T('C')) { /* Developer listing */ ConOutResPuts(STRING_VERSION_HELP6); ConOutResPuts(STRING_FREEDOS_DEV); ConOutResPuts(STRING_VERSION_HELP7); ConOutResPuts(STRING_REACTOS_DEV); } else { error_invalid_switch(_totupper(param[i])); return 1; } } /* Bug report notice */ ConOutResPuts(STRING_VERSION_HELP5); } ConOutChar(_T('\n')); return 0; } #endif |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |