1 |
#Region "Microsoft.VisualBasic::6629b09098c0cb9d74a59c74a36819e1, Microsoft.VisualBasic.Core\ApplicationServices\Tools\OSVersionInfo.vb"
|
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 |
#End Region
|
88 |
|
89 |
#Region "USINGS"
|
90 |
Imports System.Collections.Generic
|
91 |
Imports System.Diagnostics
|
92 |
Imports System.Runtime.InteropServices
|
93 |
Imports System.Runtime.InteropServices.Marshal
|
94 |
Imports System.Text
|
95 |
#End Region
|
96 |
|
97 |
Namespace ApplicationServices
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
Public Module OSVersionInfo
|
103 |
|
104 |
#Region "ENUMS"
|
105 |
Public Enum SoftwareArchitecture
|
106 |
Unknown = 0
|
107 |
Bit32 = 1
|
108 |
Bit64 = 2
|
109 |
End Enum
|
110 |
|
111 |
Public Enum ProcessorArchitecture
|
112 |
Unknown = 0
|
113 |
Bit32 = 1
|
114 |
Bit64 = 2
|
115 |
Itanium64 = 3
|
116 |
End Enum
|
117 |
#End Region
|
118 |
|
119 |
#Region "DELEGATE DECLARATION"
|
120 |
Private Delegate Function IsWow64ProcessDelegate(<[In]> handle As IntPtr, <Out> ByRef isWow64Process As Boolean) As Boolean
|
121 |
#End Region
|
122 |
|
123 |
#Region "BITS"
|
124 |
|
125 |
|
126 |
|
127 |
Public ReadOnly Property ProgramBits() As SoftwareArchitecture
|
128 |
Get
|
129 |
Dim pbits As SoftwareArchitecture = SoftwareArchitecture.Unknown
|
130 |
|
131 |
Dim test As System.Collections.IDictionary = Environment.GetEnvironmentVariables()
|
132 |
|
133 |
Select Case IntPtr.Size * 8
|
134 |
Case 64
|
135 |
pbits = SoftwareArchitecture.Bit64
|
136 |
|
137 |
|
138 |
Case 32
|
139 |
pbits = SoftwareArchitecture.Bit32
|
140 |
|
141 |
Case Else
|
142 |
|
143 |
pbits = SoftwareArchitecture.Unknown
|
144 |
|
145 |
End Select
|
146 |
|
147 |
|
148 |
'{
|
149 |
' string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
|
150 |
' return ((String.IsNullOrEmpty(pa) || String.Compare(pa, 0, "x86", 0, 3, true) == 0) ? 32 : 64);
|
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 |
Return pbits
|
185 |
End Get
|
186 |
End Property
|
187 |
|
188 |
Public ReadOnly Property OSBits() As SoftwareArchitecture
|
189 |
Get
|
190 |
Dim osbits__1 As SoftwareArchitecture = SoftwareArchitecture.Unknown
|
191 |
|
192 |
Select Case IntPtr.Size * 8
|
193 |
Case 64
|
194 |
osbits__1 = SoftwareArchitecture.Bit64
|
195 |
|
196 |
|
197 |
Case 32
|
198 |
If Is32BitProcessOn64BitProcessor() Then
|
199 |
osbits__1 = SoftwareArchitecture.Bit64
|
200 |
Else
|
201 |
osbits__1 = SoftwareArchitecture.Bit32
|
202 |
End If
|
203 |
|
204 |
Case Else
|
205 |
|
206 |
osbits__1 = SoftwareArchitecture.Unknown
|
207 |
|
208 |
End Select
|
209 |
|
210 |
Return osbits__1
|
211 |
End Get
|
212 |
End Property
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
Public ReadOnly Property ProcessorBits() As ProcessorArchitecture
|
218 |
Get
|
219 |
Dim pbits As ProcessorArchitecture = ProcessorArchitecture.Unknown
|
220 |
|
221 |
Try
|
222 |
Dim l_System_Info As New SYSTEM_INFO()
|
223 |
GetNativeSystemInfo(l_System_Info)
|
224 |
|
225 |
Select Case l_System_Info.uProcessorInfo.wProcessorArchitecture
|
226 |
Case 9
|
227 |
|
228 |
pbits = ProcessorArchitecture.Bit64
|
229 |
|
230 |
Case 6
|
231 |
|
232 |
pbits = ProcessorArchitecture.Itanium64
|
233 |
|
234 |
Case 0
|
235 |
|
236 |
pbits = ProcessorArchitecture.Bit32
|
237 |
|
238 |
Case Else
|
239 |
|
240 |
pbits = ProcessorArchitecture.Unknown
|
241 |
|
242 |
End Select
|
243 |
|
244 |
Catch
|
245 |
End Try
|
246 |
|
247 |
Return pbits
|
248 |
End Get
|
249 |
End Property
|
250 |
#End Region
|
251 |
|
252 |
#Region "EDITION"
|
253 |
Private s_Edition As String
|
254 |
|
255 |
|
256 |
|
257 |
Public ReadOnly Property Edition() As String
|
258 |
Get
|
259 |
If s_Edition IsNot Nothing Then
|
260 |
Return s_Edition
|
261 |
End If
|
262 |
|
263 |
Dim edition__1 As String = String.Empty
|
264 |
|
265 |
Dim osVersion As OperatingSystem = Environment.OSVersion
|
266 |
Dim osVersionInfo As New OSVERSIONINFOEX()
|
267 |
osVersionInfo.dwOSVersionInfoSize = SizeOf(GetType(OSVERSIONINFOEX))
|
268 |
|
269 |
If GetVersion(osVersionInfo) Then
|
270 |
Dim majorVersion As Integer = osVersion.Version.Major
|
271 |
Dim minorVersion As Integer = osVersion.Version.Minor
|
272 |
Dim productType As Byte = osVersionInfo.wProductType
|
273 |
Dim suiteMask As Short = osVersionInfo.wSuiteMask
|
274 |
|
275 |
'#Region "VERSION 4"
|
276 |
If majorVersion = 4 Then
|
277 |
If productType = VER_NT_WORKSTATION Then
|
278 |
|
279 |
edition__1 = "Workstation"
|
280 |
ElseIf productType = VER_NT_SERVER Then
|
281 |
If (suiteMask And VER_SUITE_ENTERPRISE) <> 0 Then
|
282 |
|
283 |
edition__1 = "Enterprise Server"
|
284 |
Else
|
285 |
|
286 |
edition__1 = "Standard Server"
|
287 |
End If
|
288 |
End If
|
289 |
|
290 |
|
291 |
'#Region "VERSION 5"
|
292 |
ElseIf majorVersion = 5 Then
|
293 |
If productType = VER_NT_WORKSTATION Then
|
294 |
If (suiteMask And VER_SUITE_PERSONAL) <> 0 Then
|
295 |
edition__1 = "Home"
|
296 |
Else
|
297 |
If GetSystemMetrics(86) = 0 Then
|
298 |
|
299 |
edition__1 = "Professional"
|
300 |
Else
|
301 |
edition__1 = "Tablet Edition"
|
302 |
End If
|
303 |
End If
|
304 |
ElseIf productType = VER_NT_SERVER Then
|
305 |
If minorVersion = 0 Then
|
306 |
If (suiteMask And VER_SUITE_DATACENTER) <> 0 Then
|
307 |
|
308 |
edition__1 = "Datacenter Server"
|
309 |
ElseIf (suiteMask And VER_SUITE_ENTERPRISE) <> 0 Then
|
310 |
|
311 |
edition__1 = "Advanced Server"
|
312 |
Else
|
313 |
|
314 |
edition__1 = "Server"
|
315 |
End If
|
316 |
Else
|
317 |
If (suiteMask And VER_SUITE_DATACENTER) <> 0 Then
|
318 |
|
319 |
edition__1 = "Datacenter"
|
320 |
ElseIf (suiteMask And VER_SUITE_ENTERPRISE) <> 0 Then
|
321 |
|
322 |
edition__1 = "Enterprise"
|
323 |
ElseIf (suiteMask And VER_SUITE_BLADE) <> 0 Then
|
324 |
|
325 |
edition__1 = "Web Edition"
|
326 |
Else
|
327 |
|
328 |
edition__1 = "Standard"
|
329 |
End If
|
330 |
End If
|
331 |
End If
|
332 |
|
333 |
|
334 |
'#Region "VERSION 6"
|
335 |
ElseIf majorVersion = 6 Then
|
336 |
Dim ed As Integer
|
337 |
If GetProductInfo(majorVersion, minorVersion, osVersionInfo.wServicePackMajor, osVersionInfo.wServicePackMinor, ed) Then
|
338 |
Select Case ed
|
339 |
Case PRODUCT_BUSINESS
|
340 |
edition__1 = "Business"
|
341 |
|
342 |
Case PRODUCT_BUSINESS_N
|
343 |
edition__1 = "Business N"
|
344 |
|
345 |
Case PRODUCT_CLUSTER_SERVER
|
346 |
edition__1 = "HPC Edition"
|
347 |
|
348 |
Case PRODUCT_CLUSTER_SERVER_V
|
349 |
edition__1 = "HPC Edition without Hyper-V"
|
350 |
|
351 |
Case PRODUCT_DATACENTER_SERVER
|
352 |
edition__1 = "Datacenter Server"
|
353 |
|
354 |
Case PRODUCT_DATACENTER_SERVER_CORE
|
355 |
edition__1 = "Datacenter Server (core installation)"
|
356 |
|
357 |
Case PRODUCT_DATACENTER_SERVER_V
|
358 |
edition__1 = "Datacenter Server without Hyper-V"
|
359 |
|
360 |
Case PRODUCT_DATACENTER_SERVER_CORE_V
|
361 |
edition__1 = "Datacenter Server without Hyper-V (core installation)"
|
362 |
|
363 |
Case PRODUCT_EMBEDDED
|
364 |
edition__1 = "Embedded"
|
365 |
|
366 |
Case PRODUCT_ENTERPRISE
|
367 |
edition__1 = "Enterprise"
|
368 |
|
369 |
Case PRODUCT_ENTERPRISE_N
|
370 |
edition__1 = "Enterprise N"
|
371 |
|
372 |
Case PRODUCT_ENTERPRISE_E
|
373 |
edition__1 = "Enterprise E"
|
374 |
|
375 |
Case PRODUCT_ENTERPRISE_SERVER
|
376 |
edition__1 = "Enterprise Server"
|
377 |
|
378 |
Case PRODUCT_ENTERPRISE_SERVER_CORE
|
379 |
edition__1 = "Enterprise Server (core installation)"
|
380 |
|
381 |
Case PRODUCT_ENTERPRISE_SERVER_CORE_V
|
382 |
edition__1 = "Enterprise Server without Hyper-V (core installation)"
|
383 |
|
384 |
Case PRODUCT_ENTERPRISE_SERVER_IA64
|
385 |
edition__1 = "Enterprise Server for Itanium-based Systems"
|
386 |
|
387 |
Case PRODUCT_ENTERPRISE_SERVER_V
|
388 |
edition__1 = "Enterprise Server without Hyper-V"
|
389 |
|
390 |
Case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT
|
391 |
edition__1 = "Essential Business Server MGMT"
|
392 |
|
393 |
Case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL
|
394 |
edition__1 = "Essential Business Server ADDL"
|
395 |
|
396 |
Case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC
|
397 |
edition__1 = "Essential Business Server MGMTSVC"
|
398 |
|
399 |
Case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC
|
400 |
edition__1 = "Essential Business Server ADDLSVC"
|
401 |
|
402 |
Case PRODUCT_HOME_BASIC
|
403 |
edition__1 = "Home Basic"
|
404 |
|
405 |
Case PRODUCT_HOME_BASIC_N
|
406 |
edition__1 = "Home Basic N"
|
407 |
|
408 |
Case PRODUCT_HOME_BASIC_E
|
409 |
edition__1 = "Home Basic E"
|
410 |
|
411 |
Case PRODUCT_HOME_PREMIUM
|
412 |
edition__1 = "Home Premium"
|
413 |
|
414 |
Case PRODUCT_HOME_PREMIUM_N
|
415 |
edition__1 = "Home Premium N"
|
416 |
|
417 |
Case PRODUCT_HOME_PREMIUM_E
|
418 |
edition__1 = "Home Premium E"
|
419 |
|
420 |
Case PRODUCT_HOME_PREMIUM_SERVER
|
421 |
edition__1 = "Home Premium Server"
|
422 |
|
423 |
Case PRODUCT_HYPERV
|
424 |
edition__1 = "Microsoft Hyper-V Server"
|
425 |
|
426 |
Case PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT
|
427 |
edition__1 = "Windows Essential Business Management Server"
|
428 |
|
429 |
Case PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING
|
430 |
edition__1 = "Windows Essential Business Messaging Server"
|
431 |
|
432 |
Case PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY
|
433 |
edition__1 = "Windows Essential Business Security Server"
|
434 |
|
435 |
Case PRODUCT_PROFESSIONAL
|
436 |
edition__1 = "Professional"
|
437 |
|
438 |
Case PRODUCT_PROFESSIONAL_N
|
439 |
edition__1 = "Professional N"
|
440 |
|
441 |
Case PRODUCT_PROFESSIONAL_E
|
442 |
edition__1 = "Professional E"
|
443 |
|
444 |
Case PRODUCT_SB_SOLUTION_SERVER
|
445 |
edition__1 = "SB Solution Server"
|
446 |
|
447 |
Case PRODUCT_SB_SOLUTION_SERVER_EM
|
448 |
edition__1 = "SB Solution Server EM"
|
449 |
|
450 |
Case PRODUCT_SERVER_FOR_SB_SOLUTIONS
|
451 |
edition__1 = "Server for SB Solutions"
|
452 |
|
453 |
Case PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM
|
454 |
edition__1 = "Server for SB Solutions EM"
|
455 |
|
456 |
Case PRODUCT_SERVER_FOR_SMALLBUSINESS
|
457 |
edition__1 = "Windows Essential Server Solutions"
|
458 |
|
459 |
Case PRODUCT_SERVER_FOR_SMALLBUSINESS_V
|
460 |
edition__1 = "Windows Essential Server Solutions without Hyper-V"
|
461 |
|
462 |
Case PRODUCT_SERVER_FOUNDATION
|
463 |
edition__1 = "Server Foundation"
|
464 |
|
465 |
Case PRODUCT_SMALLBUSINESS_SERVER
|
466 |
edition__1 = "Windows Small Business Server"
|
467 |
|
468 |
Case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM
|
469 |
edition__1 = "Windows Small Business Server Premium"
|
470 |
|
471 |
Case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE
|
472 |
edition__1 = "Windows Small Business Server Premium (core installation)"
|
473 |
|
474 |
Case PRODUCT_SOLUTION_EMBEDDEDSERVER
|
475 |
edition__1 = "Solution Embedded Server"
|
476 |
|
477 |
Case PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE
|
478 |
edition__1 = "Solution Embedded Server (core installation)"
|
479 |
|
480 |
Case PRODUCT_STANDARD_SERVER
|
481 |
edition__1 = "Standard Server"
|
482 |
|
483 |
Case PRODUCT_STANDARD_SERVER_CORE
|
484 |
edition__1 = "Standard Server (core installation)"
|
485 |
|
486 |
Case PRODUCT_STANDARD_SERVER_SOLUTIONS
|
487 |
edition__1 = "Standard Server Solutions"
|
488 |
|
489 |
Case PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE
|
490 |
edition__1 = "Standard Server Solutions (core installation)"
|
491 |
|
492 |
Case PRODUCT_STANDARD_SERVER_CORE_V
|
493 |
edition__1 = "Standard Server without Hyper-V (core installation)"
|
494 |
|
495 |
Case PRODUCT_STANDARD_SERVER_V
|
496 |
edition__1 = "Standard Server without Hyper-V"
|
497 |
|
498 |
Case PRODUCT_STARTER
|
499 |
edition__1 = "Starter"
|
500 |
|
501 |
Case PRODUCT_STARTER_N
|
502 |
edition__1 = "Starter N"
|
503 |
|
504 |
Case PRODUCT_STARTER_E
|
505 |
edition__1 = "Starter E"
|
506 |
|
507 |
Case PRODUCT_STORAGE_ENTERPRISE_SERVER
|
508 |
edition__1 = "Enterprise Storage Server"
|
509 |
|
510 |
Case PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE
|
511 |
edition__1 = "Enterprise Storage Server (core installation)"
|
512 |
|
513 |
Case PRODUCT_STORAGE_EXPRESS_SERVER
|
514 |
edition__1 = "Express Storage Server"
|
515 |
|
516 |
Case PRODUCT_STORAGE_EXPRESS_SERVER_CORE
|
517 |
edition__1 = "Express Storage Server (core installation)"
|
518 |
|
519 |
Case PRODUCT_STORAGE_STANDARD_SERVER
|
520 |
edition__1 = "Standard Storage Server"
|
521 |
|
522 |
Case PRODUCT_STORAGE_STANDARD_SERVER_CORE
|
523 |
edition__1 = "Standard Storage Server (core installation)"
|
524 |
|
525 |
Case PRODUCT_STORAGE_WORKGROUP_SERVER
|
526 |
edition__1 = "Workgroup Storage Server"
|
527 |
|
528 |
Case PRODUCT_STORAGE_WORKGROUP_SERVER_CORE
|
529 |
edition__1 = "Workgroup Storage Server (core installation)"
|
530 |
|
531 |
Case PRODUCT_UNDEFINED
|
532 |
edition__1 = "Unknown product"
|
533 |
|
534 |
Case PRODUCT_ULTIMATE
|
535 |
edition__1 = "Ultimate"
|
536 |
|
537 |
Case PRODUCT_ULTIMATE_N
|
538 |
edition__1 = "Ultimate N"
|
539 |
|
540 |
Case PRODUCT_ULTIMATE_E
|
541 |
edition__1 = "Ultimate E"
|
542 |
|
543 |
Case PRODUCT_WEB_SERVER
|
544 |
edition__1 = "Web Server"
|
545 |
|
546 |
Case PRODUCT_WEB_SERVER_CORE
|
547 |
edition__1 = "Web Server (core installation)"
|
548 |
|
549 |
End Select
|
550 |
End If
|
551 |
|
552 |
End If
|
553 |
End If
|
554 |
|
555 |
s_Edition = edition__1
|
556 |
Return edition__1
|
557 |
End Get
|
558 |
End Property
|
559 |
#End Region
|
560 |
|
561 |
#Region "NAME"
|
562 |
|
563 |
Public Enum WindowsNameList
|
564 |
|
565 |
|
566 |
|
567 |
null
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
Windows3_1
|
573 |
|
574 |
|
575 |
|
576 |
WindowsCE
|
577 |
|
578 |
|
579 |
|
580 |
Windows95OSR2
|
581 |
|
582 |
|
583 |
|
584 |
Windows95
|
585 |
|
586 |
|
587 |
|
588 |
Windows98SecondEdition
|
589 |
|
590 |
|
591 |
|
592 |
Windows98
|
593 |
|
594 |
|
595 |
|
596 |
WindowsMe
|
597 |
|
598 |
|
599 |
|
600 |
WindowsNT3_51
|
601 |
|
602 |
|
603 |
|
604 |
WindowsNT4_0
|
605 |
|
606 |
Server
|
607 |
|
608 |
WindowsNT4_0Server
|
609 |
|
610 |
|
611 |
|
612 |
Windows2000
|
613 |
|
614 |
|
615 |
|
616 |
WindowsXP
|
617 |
|
618 |
|
619 |
|
620 |
WindowsServer2003
|
621 |
|
622 |
|
623 |
|
624 |
WindowsVista
|
625 |
|
626 |
|
627 |
|
628 |
WindowsServer2008
|
629 |
|
630 |
|
631 |
|
632 |
Windows7
|
633 |
|
634 |
R2
|
635 |
|
636 |
WindowsServer2008R2
|
637 |
|
638 |
|
639 |
|
640 |
Windows8
|
641 |
|
642 |
|
643 |
|
644 |
WindowsServer2012
|
645 |
End Enum
|
646 |
|
647 |
Private s_Name As WindowsNameList
|
648 |
|
649 |
|
650 |
|
651 |
Public ReadOnly Property WindowsName() As WindowsNameList
|
652 |
Get
|
653 |
If s_Name <> WindowsNameList.null Then
|
654 |
Return s_Name
|
655 |
End If
|
656 |
|
657 |
|
658 |
|
659 |
Dim osVersion As OperatingSystem = Environment.OSVersion
|
660 |
Dim osVersionInfo As New OSVERSIONINFOEX()
|
661 |
osVersionInfo.dwOSVersionInfoSize = SizeOf(GetType(OSVERSIONINFOEX))
|
662 |
|
663 |
If GetVersion(osVersionInfo) Then
|
664 |
Dim majorVersion As Integer = osVersion.Version.Major
|
665 |
Dim minorVersion As Integer = osVersion.Version.Minor
|
666 |
|
667 |
Select Case osVersion.Platform
|
668 |
Case PlatformID.Win32S
|
669 |
s_Name = WindowsNameList.Windows3_1 ' name__1 = "Windows 3.1"
|
670 |
|
671 |
Case PlatformID.WinCE
|
672 |
s_Name = WindowsNameList.WindowsCE ' name__1 = "Windows CE"
|
673 |
|
674 |
Case PlatformID.Win32Windows
|
675 |
If True Then
|
676 |
If majorVersion = 4 Then
|
677 |
Dim csdVersion As String = osVersionInfo.szCSDVersion
|
678 |
Select Case minorVersion
|
679 |
Case 0
|
680 |
If csdVersion = "B" OrElse csdVersion = "C" Then
|
681 |
s_Name = WindowsNameList.Windows95OSR2 ' name__1 = "Windows 95 OSR2"
|
682 |
Else
|
683 |
s_Name = WindowsNameList.Windows95 ' name__1 = "Windows 95"
|
684 |
End If
|
685 |
|
686 |
Case 10
|
687 |
If csdVersion = "A" Then
|
688 |
s_Name = WindowsNameList.Windows98SecondEdition ' name__1 = "Windows 98 Second Edition"
|
689 |
Else
|
690 |
s_Name = WindowsNameList.Windows98 ' name__1 = "Windows 98"
|
691 |
End If
|
692 |
|
693 |
Case 90
|
694 |
s_Name = WindowsNameList.WindowsMe ' name__1 = "Windows Me"
|
695 |
|
696 |
End Select
|
697 |
End If
|
698 |
|
699 |
End If
|
700 |
Case PlatformID.Win32NT
|
701 |
If True Then
|
702 |
Dim productType As Byte = osVersionInfo.wProductType
|
703 |
|
704 |
Select Case majorVersion
|
705 |
Case 3
|
706 |
s_Name = WindowsNameList.WindowsNT3_51 ' name__1 = "Windows NT 3.51"
|
707 |
|
708 |
Case 4
|
709 |
Select Case productType
|
710 |
Case 1
|
711 |
s_Name = WindowsNameList.WindowsNT4_0 ' name__1 = "Windows NT 4.0"
|
712 |
|
713 |
Case 3
|
714 |
s_Name = WindowsNameList.WindowsNT4_0Server ' name__1 = "Windows NT 4.0 Server"
|
715 |
|
716 |
End Select
|
717 |
|
718 |
Case 5
|
719 |
Select Case minorVersion
|
720 |
Case 0
|
721 |
s_Name = WindowsNameList.Windows2000 ' name__1 = "Windows 2000"
|
722 |
|
723 |
Case 1
|
724 |
s_Name = WindowsNameList.WindowsXP ' name__1 = "Windows XP"
|
725 |
|
726 |
Case 2
|
727 |
s_Name = WindowsNameList.WindowsServer2003 ' name__1 = "Windows Server 2003"
|
728 |
|
729 |
End Select
|
730 |
|
731 |
Case 6
|
732 |
Select Case minorVersion
|
733 |
Case 0
|
734 |
Select Case productType
|
735 |
Case 1
|
736 |
s_Name = WindowsNameList.WindowsVista ' name__1 = "Windows Vista"
|
737 |
|
738 |
Case 3
|
739 |
s_Name = WindowsNameList.WindowsServer2008 ' name__1 = "Windows Server 2008"
|
740 |
|
741 |
End Select
|
742 |
|
743 |
|
744 |
Case 1
|
745 |
Select Case productType
|
746 |
Case 1
|
747 |
s_Name = WindowsNameList.Windows7 ' name__1 = "Windows 7"
|
748 |
|
749 |
Case 3
|
750 |
s_Name = WindowsNameList.WindowsServer2008R2 ' name__1 = "Windows Server 2008 R2"
|
751 |
|
752 |
End Select
|
753 |
|
754 |
Case 2
|
755 |
Select Case productType
|
756 |
Case 1
|
757 |
s_Name = WindowsNameList.Windows8 ' name__1 = "Windows 8"
|
758 |
|
759 |
Case 3
|
760 |
s_Name = WindowsNameList.WindowsServer2012 ' name__1 = "Windows Server 2012"
|
761 |
|
762 |
End Select
|
763 |
|
764 |
End Select
|
765 |
|
766 |
End Select
|
767 |
|
768 |
End If
|
769 |
End Select
|
770 |
|
771 |
Else
|
772 |
|
773 |
s_Name = WindowsNameList.null
|
774 |
|
775 |
End If
|
776 |
|
777 |
Return s_Name
|
778 |
End Get
|
779 |
End Property
|
780 |
#End Region
|
781 |
|
782 |
#Region "PINVOKE"
|
783 |
|
784 |
#Region "GET"
|
785 |
#Region "PRODUCT INFO"
|
786 |
<DllImport("Kernel32.dll")>
|
787 |
Friend Function GetProductInfo(osMajorVersion As Integer, osMinorVersion As Integer, spMajorVersion As Integer, spMinorVersion As Integer, ByRef edition As Integer) As Boolean
|
788 |
End Function
|
789 |
#End Region
|
790 |
|
791 |
#Region "VERSION"
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
_GetVersionEx may be altered Or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions_
|
797 |
|
798 |
With the release Of Windows 8.1, the behavior Of the GetVersionEx API has changed In the value it will Return For the
|
799 |
operating system version. The value returned by the GetVersionEx Function now depends On how the application Is
|
800 |
manifested.
|
801 |
Applications Not manifested for Windows 8.1 Or Windows 10 will return the Windows 8 OS version value (6.2). Once an
|
802 |
application Is manifested for a given operating system version, GetVersionEx will always return the version that the
|
803 |
application Is manifested for in future releases. To manifest your applications for Windows 8.1 Or Windows 10, refer
|
804 |
to Targeting your application for Windows.
|
805 |
|
806 |
**Syntax**
|
807 |
|
808 |
```C
|
809 |
BOOL WINAPI GetVersionEx(
|
810 |
_Inout_ LPOSVERSIONINFO lpVersionInfo
|
811 |
);
|
812 |
```
|
813 |
|
814 |
|
815 |
<param name="osVersionInfo">An OSVersionInfo Or OSVERSIONINFOEX structure that receives the operating system information.
|
816 |
Before calling the GetVersionEx Function, set the dwOSVersionInfoSize member of the structure as appropriate to indicate
|
817 |
which data structure Is being passed to this function.
|
818 |
</param>
|
819 |
<returns>If the Then Function succeeds, the Return value Is a nonzero value.
|
820 |
If the Then Function fails, the Return value Is zero. To Get extended Error information, Call GetLastError.
|
821 |
The Function fails If you specify an invalid value For the dwOSVersionInfoSize member Of the OSVERSIONINFO
|
822 |
Or OSVERSIONINFOEX Structure.
|
823 |
</returns>
|
824 |
<remarks>
|
825 |
Identifying the current operating system Is usually Not the best way To determine whether a particular operating system
|
826 |
feature Is present. This Is because the operating system may have had New features added In a redistributable DLL. Rather
|
827 |
than Using GetVersionEx To determine the operating system platform Or version number, test For the presence Of the feature
|
828 |
itself. For more information, see Operating System Version.
|
829 |
The GetSystemMetrics function provides additional information about the current operating system.
|
830 |
|
831 |
|Product|Setting|
|
832 |
|-------|-------|
|
833 |
|Windows XP Media Center Edition|SM_MEDIACENTER|
|
834 |
|Windows XP Starter Edition|SM_STARTER|
|
835 |
|Windows XP Tablet PC Edition|SM_TABLETPC|
|
836 |
|Windows Server 2003 R2|SM_SERVERR2|
|
837 |
'''
|
838 |
To check for specific operating systems Or operating system features, use the IsOS function. The GetProductInfo function retrieves the product type.
|
839 |
To retrieve information for the operating system on a remote computer, use the NetWkstaGetInfo function, the Win32_OperatingSystem WMI class, Or the OperatingSystem property of the IADsComputer interface.
|
840 |
To compare the current system version to a required version, use the VerifyVersionInfo function instead of using GetVersionEx to perform the comparison yourself.
|
841 |
|
842 |
If compatibility Then mode Is In effect, the GetVersionEx Function reports the operating system As it identifies itself, which may Not
|
843 |
be the operating system that Is installed. For example, If compatibility mode Is In effect, GetVersionEx reports the operating system
|
844 |
that Is selected For application compatibility.
|
845 |
|
846 |
**Examples**
|
847 |
'''
|
848 |
When using the GetVersionEx function to determine whether your application Is running on a particular version of the operating system,
|
849 |
check for version numbers that are greater than Or equal to the desired version numbers. This ensures that the test succeeds for later
|
850 |
versions of the operating system. For example, if your application requires Windows XP Or later, use the following test.
|
851 |
|
852 |
```C
|
853 |
#include <windows.h>
|
854 |
#include <stdio.h>
|
855 |
'''
|
856 |
Void main()
|
857 |
{
|
858 |
OSVersionInfo osvi;
|
859 |
BOOL bIsWindowsXPorLater;
|
860 |
'''
|
861 |
ZeroMemory(&osvi, SizeOf(OSVersionInfo));
|
862 |
osvi.dwOSVersionInfoSize = SizeOf(OSVersionInfo);
|
863 |
'''
|
864 |
GetVersionEx(&osvi);
|
865 |
'''
|
866 |
bIsWindowsXPorLater =
|
867 |
((osvi.dwMajorVersion > 5) ||
|
868 |
((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1) ));
|
869 |
|
870 |
if(bIsWindowsXPorLater)
|
871 |
printf("The system meets the requirements.\n");
|
872 |
else printf("The system does not meet the requirements.\n");
|
873 |
}
|
874 |
```
|
875 |
'''
|
876 |
For an example that identifies the current operating system, see Getting the System Version.
|
877 |
|
878 |
**Requirements**
|
879 |
'''
|
880 |
| | |
|
881 |
|-|-|
|
882 |
|Minimum supported client|Windows 2000 Professional [desktop apps only]|
|
883 |
|Minimum supported server|Windows 2000 Server [desktop apps only]|
|
884 |
|Header|Winbase.h(include Windows.h)|
|
885 |
|Library|Kernel32.lib|
|
886 |
|DLL|Kernel32.dll|
|
887 |
|Unicode And ANSI names|GetVersionExW(Unicode) And GetVersionExA (ANSI)|
|
888 |
</remarks>
|
889 |
<DllImport("kernel32.dll")>
|
890 |
Private Function GetVersionEx(ByRef osVersionInfo As OSVERSIONINFOEX) As Boolean
|
891 |
End Function
|
892 |
|
893 |
Private Function GetVersion(ByRef osVersionInfo As OSVERSIONINFOEX) As Boolean
|
894 |
If Environment.OSVersion.Platform = PlatformID.Unix OrElse
|
895 |
Environment.OSVersion.Platform = PlatformID.MacOSX Then
|
896 |
Return False
|
897 |
Else
|
898 |
Return GetVersionEx(osVersionInfo)
|
899 |
End If
|
900 |
End Function
|
901 |
#End Region
|
902 |
|
903 |
#Region "SYSTEMMETRICS"
|
904 |
<DllImport("user32")>
|
905 |
Public Function GetSystemMetrics(nIndex As Integer) As Integer
|
906 |
End Function
|
907 |
#End Region
|
908 |
|
909 |
#Region "SYSTEMINFO"
|
910 |
<DllImport("kernel32.dll")>
|
911 |
Public Sub GetSystemInfo(<MarshalAs(UnmanagedType.Struct)> ByRef lpSystemInfo As SYSTEM_INFO)
|
912 |
End Sub
|
913 |
|
914 |
<DllImport("kernel32.dll")>
|
915 |
Public Sub GetNativeSystemInfo(<MarshalAs(UnmanagedType.Struct)> ByRef lpSystemInfo As SYSTEM_INFO)
|
916 |
End Sub
|
917 |
#End Region
|
918 |
|
919 |
#End Region
|
920 |
|
921 |
#Region "OSVERSIONINFOEX"
|
922 |
<StructLayout(LayoutKind.Sequential)>
|
923 |
Public Structure OSVERSIONINFOEX
|
924 |
Public dwOSVersionInfoSize As Integer
|
925 |
Public dwMajorVersion As Integer
|
926 |
Public dwMinorVersion As Integer
|
927 |
Public dwBuildNumber As Integer
|
928 |
Public dwPlatformId As Integer
|
929 |
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)>
|
930 |
Public szCSDVersion As String
|
931 |
Public wServicePackMajor As Short
|
932 |
Public wServicePackMinor As Short
|
933 |
Public wSuiteMask As Short
|
934 |
Public wProductType As Byte
|
935 |
Public wReserved As Byte
|
936 |
End Structure
|
937 |
#End Region
|
938 |
|
939 |
#Region "SYSTEM_INFO"
|
940 |
<StructLayout(LayoutKind.Sequential)>
|
941 |
Public Structure SYSTEM_INFO
|
942 |
Friend uProcessorInfo As _PROCESSOR_INFO_UNION
|
943 |
Public dwPageSize As UInteger
|
944 |
Public lpMinimumApplicationAddress As IntPtr
|
945 |
Public lpMaximumApplicationAddress As IntPtr
|
946 |
Public dwActiveProcessorMask As IntPtr
|
947 |
Public dwNumberOfProcessors As UInteger
|
948 |
Public dwProcessorType As UInteger
|
949 |
Public dwAllocationGranularity As UInteger
|
950 |
Public dwProcessorLevel As UShort
|
951 |
Public dwProcessorRevision As UShort
|
952 |
End Structure
|
953 |
#End Region
|
954 |
|
955 |
#Region "_PROCESSOR_INFO_UNION"
|
956 |
<StructLayout(LayoutKind.Explicit)>
|
957 |
Public Structure _PROCESSOR_INFO_UNION
|
958 |
<FieldOffset(0)>
|
959 |
Friend dwOemId As UInteger
|
960 |
<FieldOffset(0)>
|
961 |
Friend wProcessorArchitecture As UShort
|
962 |
<FieldOffset(2)>
|
963 |
Friend wReserved As UShort
|
964 |
End Structure
|
965 |
#End Region
|
966 |
|
967 |
#Region "64 BIT OS DETECTION"
|
968 |
<DllImport("kernel32", SetLastError:=True, CallingConvention:=CallingConvention.Winapi)>
|
969 |
Public Function LoadLibrary(libraryName As String) As IntPtr
|
970 |
End Function
|
971 |
|
972 |
<DllImport("kernel32", SetLastError:=True, CallingConvention:=CallingConvention.Winapi)>
|
973 |
Public Function GetProcAddress(hwnd As IntPtr, procedureName As String) As IntPtr
|
974 |
End Function
|
975 |
#End Region
|
976 |
|
977 |
#Region "PRODUCT"
|
978 |
Private Const PRODUCT_UNDEFINED As Integer = &H0
|
979 |
Private Const PRODUCT_ULTIMATE As Integer = &H1
|
980 |
Private Const PRODUCT_HOME_BASIC As Integer = &H2
|
981 |
Private Const PRODUCT_HOME_PREMIUM As Integer = &H3
|
982 |
Private Const PRODUCT_ENTERPRISE As Integer = &H4
|
983 |
Private Const PRODUCT_HOME_BASIC_N As Integer = &H5
|
984 |
Private Const PRODUCT_BUSINESS As Integer = &H6
|
985 |
Private Const PRODUCT_STANDARD_SERVER As Integer = &H7
|
986 |
Private Const PRODUCT_DATACENTER_SERVER As Integer = &H8
|
987 |
Private Const PRODUCT_SMALLBUSINESS_SERVER As Integer = &H9
|
988 |
Private Const PRODUCT_ENTERPRISE_SERVER As Integer = &HA
|
989 |
Private Const PRODUCT_STARTER As Integer = &HB
|
990 |
Private Const PRODUCT_DATACENTER_SERVER_CORE As Integer = &HC
|
991 |
Private Const PRODUCT_STANDARD_SERVER_CORE As Integer = &HD
|
992 |
Private Const PRODUCT_ENTERPRISE_SERVER_CORE As Integer = &HE
|
993 |
Private Const PRODUCT_ENTERPRISE_SERVER_IA64 As Integer = &HF
|
994 |
Private Const PRODUCT_BUSINESS_N As Integer = &H10
|
995 |
Private Const PRODUCT_WEB_SERVER As Integer = &H11
|
996 |
Private Const PRODUCT_CLUSTER_SERVER As Integer = &H12
|
997 |
Private Const PRODUCT_HOME_SERVER As Integer = &H13
|
998 |
Private Const PRODUCT_STORAGE_EXPRESS_SERVER As Integer = &H14
|
999 |
Private Const PRODUCT_STORAGE_STANDARD_SERVER As Integer = &H15
|
1000 |
Private Const PRODUCT_STORAGE_WORKGROUP_SERVER As Integer = &H16
|
1001 |
Private Const PRODUCT_STORAGE_ENTERPRISE_SERVER As Integer = &H17
|
1002 |
Private Const PRODUCT_SERVER_FOR_SMALLBUSINESS As Integer = &H18
|
1003 |
Private Const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM As Integer = &H19
|
1004 |
Private Const PRODUCT_HOME_PREMIUM_N As Integer = &H1A
|
1005 |
Private Const PRODUCT_ENTERPRISE_N As Integer = &H1B
|
1006 |
Private Const PRODUCT_ULTIMATE_N As Integer = &H1C
|
1007 |
Private Const PRODUCT_WEB_SERVER_CORE As Integer = &H1D
|
1008 |
Private Const PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT As Integer = &H1E
|
1009 |
Private Const PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY As Integer = &H1F
|
1010 |
Private Const PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING As Integer = &H20
|
1011 |
Private Const PRODUCT_SERVER_FOUNDATION As Integer = &H21
|
1012 |
Private Const PRODUCT_HOME_PREMIUM_SERVER As Integer = &H22
|
1013 |
Private Const PRODUCT_SERVER_FOR_SMALLBUSINESS_V As Integer = &H23
|
1014 |
Private Const PRODUCT_STANDARD_SERVER_V As Integer = &H24
|
1015 |
Private Const PRODUCT_DATACENTER_SERVER_V As Integer = &H25
|
1016 |
Private Const PRODUCT_ENTERPRISE_SERVER_V As Integer = &H26
|
1017 |
Private Const PRODUCT_DATACENTER_SERVER_CORE_V As Integer = &H27
|
1018 |
Private Const PRODUCT_STANDARD_SERVER_CORE_V As Integer = &H28
|
1019 |
Private Const PRODUCT_ENTERPRISE_SERVER_CORE_V As Integer = &H29
|
1020 |
Private Const PRODUCT_HYPERV As Integer = &H2A
|
1021 |
Private Const PRODUCT_STORAGE_EXPRESS_SERVER_CORE As Integer = &H2B
|
1022 |
Private Const PRODUCT_STORAGE_STANDARD_SERVER_CORE As Integer = &H2C
|
1023 |
Private Const PRODUCT_STORAGE_WORKGROUP_SERVER_CORE As Integer = &H2D
|
1024 |
Private Const PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE As Integer = &H2E
|
1025 |
Private Const PRODUCT_STARTER_N As Integer = &H2F
|
1026 |
Private Const PRODUCT_PROFESSIONAL As Integer = &H30
|
1027 |
Private Const PRODUCT_PROFESSIONAL_N As Integer = &H31
|
1028 |
Private Const PRODUCT_SB_SOLUTION_SERVER As Integer = &H32
|
1029 |
Private Const PRODUCT_SERVER_FOR_SB_SOLUTIONS As Integer = &H33
|
1030 |
Private Const PRODUCT_STANDARD_SERVER_SOLUTIONS As Integer = &H34
|
1031 |
Private Const PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE As Integer = &H35
|
1032 |
Private Const PRODUCT_SB_SOLUTION_SERVER_EM As Integer = &H36
|
1033 |
Private Const PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM As Integer = &H37
|
1034 |
Private Const PRODUCT_SOLUTION_EMBEDDEDSERVER As Integer = &H38
|
1035 |
Private Const PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE As Integer = &H39
|
1036 |
|
1037 |
Private Const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT As Integer = &H3B
|
1038 |
Private Const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL As Integer = &H3C
|
1039 |
Private Const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC As Integer = &H3D
|
1040 |
Private Const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC As Integer = &H3E
|
1041 |
Private Const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE As Integer = &H3F
|
1042 |
Private Const PRODUCT_CLUSTER_SERVER_V As Integer = &H40
|
1043 |
Private Const PRODUCT_EMBEDDED As Integer = &H41
|
1044 |
Private Const PRODUCT_STARTER_E As Integer = &H42
|
1045 |
Private Const PRODUCT_HOME_BASIC_E As Integer = &H43
|
1046 |
Private Const PRODUCT_HOME_PREMIUM_E As Integer = &H44
|
1047 |
Private Const PRODUCT_PROFESSIONAL_E As Integer = &H45
|
1048 |
Private Const PRODUCT_ENTERPRISE_E As Integer = &H46
|
1049 |
Private Const PRODUCT_ULTIMATE_E As Integer = &H47
|
1050 |
|
1051 |
#End Region
|
1052 |
|
1053 |
#Region "VERSIONS"
|
1054 |
Private Const VER_NT_WORKSTATION As Integer = 1
|
1055 |
Private Const VER_NT_DOMAIN_CONTROLLER As Integer = 2
|
1056 |
Private Const VER_NT_SERVER As Integer = 3
|
1057 |
Private Const VER_SUITE_SMALLBUSINESS As Integer = 1
|
1058 |
Private Const VER_SUITE_ENTERPRISE As Integer = 2
|
1059 |
Private Const VER_SUITE_TERMINAL As Integer = 16
|
1060 |
Private Const VER_SUITE_DATACENTER As Integer = 128
|
1061 |
Private Const VER_SUITE_SINGLEUSERTS As Integer = 256
|
1062 |
Private Const VER_SUITE_PERSONAL As Integer = 512
|
1063 |
Private Const VER_SUITE_BLADE As Integer = 1024
|
1064 |
#End Region
|
1065 |
|
1066 |
#End Region
|
1067 |
|
1068 |
#Region "SERVICE PACK"
|
1069 |
|
1070 |
Gets the service pack information of the operating system running on this computer.
|
1071 |
|
1072 |
Public ReadOnly Property ServicePack() As String
|
1073 |
Get
|
1074 |
Dim servicePack__1 As String = String.Empty
|
1075 |
Dim osVersionInfo As New OSVERSIONINFOEX()
|
1076 |
|
1077 |
osVersionInfo.dwOSVersionInfoSize = SizeOf(GetType(OSVERSIONINFOEX))
|
1078 |
|
1079 |
If GetVersion(osVersionInfo) Then
|
1080 |
servicePack__1 = osVersionInfo.szCSDVersion
|
1081 |
End If
|
1082 |
|
1083 |
Return servicePack__1
|
1084 |
End Get
|
1085 |
End Property
|
1086 |
#End Region
|
1087 |
|
1088 |
#Region "VERSION"
|
1089 |
#Region "BUILD"
|
1090 |
|
1091 |
Gets the build version number of the operating system running on this computer.
|
1092 |
|
1093 |
Public ReadOnly Property BuildVersion() As Integer
|
1094 |
Get
|
1095 |
Return Environment.OSVersion.Version.Build
|
1096 |
End Get
|
1097 |
End Property
|
1098 |
#End Region
|
1099 |
|
1100 |
#Region "FULL"
|
1101 |
#Region "STRING"
|
1102 |
|
1103 |
Gets the full version string of the operating system running on this computer.
|
1104 |
|
1105 |
Public ReadOnly Property VersionString() As String
|
1106 |
Get
|
1107 |
Return Environment.OSVersion.Version.ToString()
|
1108 |
End Get
|
1109 |
End Property
|
1110 |
#End Region
|
1111 |
|
1112 |
#Region "VERSION"
|
1113 |
|
1114 |
Gets the full version of the operating system running on this computer.
|
1115 |
|
1116 |
Public ReadOnly Property Version() As Version
|
1117 |
Get
|
1118 |
Return Environment.OSVersion.Version
|
1119 |
End Get
|
1120 |
End Property
|
1121 |
#End Region
|
1122 |
#End Region
|
1123 |
|
1124 |
#Region "MAJOR"
|
1125 |
|
1126 |
Gets the major version number of the operating system running on this computer.
|
1127 |
|
1128 |
Public ReadOnly Property MajorVersion() As Integer
|
1129 |
Get
|
1130 |
Return Environment.OSVersion.Version.Major
|
1131 |
End Get
|
1132 |
End Property
|
1133 |
#End Region
|
1134 |
|
1135 |
#Region "MINOR"
|
1136 |
|
1137 |
Gets the minor version number of the operating system running on this computer.
|
1138 |
|
1139 |
Public ReadOnly Property MinorVersion() As Integer
|
1140 |
Get
|
1141 |
Return Environment.OSVersion.Version.Minor
|
1142 |
End Get
|
1143 |
End Property
|
1144 |
#End Region
|
1145 |
|
1146 |
#Region "REVISION"
|
1147 |
|
1148 |
Gets the revision version number of the operating system running on this computer.
|
1149 |
|
1150 |
Public ReadOnly Property RevisionVersion() As Integer
|
1151 |
Get
|
1152 |
Return Environment.OSVersion.Version.Revision
|
1153 |
End Get
|
1154 |
End Property
|
1155 |
#End Region
|
1156 |
#End Region
|
1157 |
|
1158 |
#Region "64 BIT OS DETECTION"
|
1159 |
Private Function GetIsWow64ProcessDelegate() As IsWow64ProcessDelegate
|
1160 |
Dim handle As IntPtr = LoadLibrary("kernel32")
|
1161 |
|
1162 |
If handle <> IntPtr.Zero Then
|
1163 |
Dim fnPtr As IntPtr = GetProcAddress(handle, "IsWow64Process")
|
1164 |
|
1165 |
If fnPtr <> IntPtr.Zero Then
|
1166 |
Return DirectCast(GetDelegateForFunctionPointer(CType(fnPtr, IntPtr), GetType(IsWow64ProcessDelegate)), IsWow64ProcessDelegate)
|
1167 |
End If
|
1168 |
End If
|
1169 |
|
1170 |
Return Nothing
|
1171 |
End Function
|
1172 |
|
1173 |
Private Function Is32BitProcessOn64BitProcessor() As Boolean
|
1174 |
Dim fnDelegate As IsWow64ProcessDelegate = GetIsWow64ProcessDelegate()
|
1175 |
|
1176 |
If fnDelegate Is Nothing Then
|
1177 |
Return False
|
1178 |
End If
|
1179 |
|
1180 |
Dim isWow64 As Boolean
|
1181 |
Dim retVal As Boolean = fnDelegate.Invoke(Process.GetCurrentProcess().Handle, isWow64)
|
1182 |
|
1183 |
If retVal = False Then
|
1184 |
Return False
|
1185 |
End If
|
1186 |
|
1187 |
Return isWow64
|
1188 |
End Function
|
1189 |
#End Region
|
1190 |
End Module
|
1191 |
End Namespace
|