Skip to main content

[archive] GetVersionEx Api

  • March 11, 2008
  • 6 replies
  • 0 views

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much

6 replies

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
I am trying to get this API to work as well. Did you ever get this working? Could you post an example?

Thanks,
Rob

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
Apart of the obvious values available in the structure (which will work if you change from PIC 9(9) COMP-5 to PIC X(4) COMP-N and PIC 9(5) COMP-5 to PIC X(2) COMP-N, it is rather difficult to dechiffer information from the data returned by GetVersionEx.
Boolean is btw also PIC X(4) COMP-N.

If you want to find if you are a Windows Terminal Server Session or not, using the GetVersion API is an overkill.
The GetSystemMetrics function is much easier to use:


...
77 SM-REMOTESESSION PIC X(4) COMP-N VALUE x"1000".
77 RET-VAL PIC X(4) COMP-N.
...
CALL "GetSystemMetrics" USING BY VALUE SM-REMOTESESSION
GIVING RET-VAL.
IF RET-VAL NOT = 0
DISPLAY MESSAGE BOX "Wow! You are a remote client..."
ELSE
DISPLAY MESSAGE BOX "You are running on the console"
END-IF



You may also use the SM-REMOTECONTROL x"2001", which will return non zero if the your session is remotely controlled. That is, like if you are getting help from someone.

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
Gisle,

You are correct that I was attempting to use this API to determine whether Terminal Services was installed. I was trying to test for wSuiteMask = VER_SUITE_TERMINAL.

So, I don't think the suggestion you gave is what I need because I'm not concerned about remote or console... However, I like the simplicity of this one!

Rob

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
Gisle,

You are correct that I was attempting to use this API to determine whether Terminal Services was installed. I was trying to test for wSuiteMask = VER_SUITE_TERMINAL.

So, I don't think the suggestion you gave is what I need because I'm not concerned about remote or console... However, I like the simplicity of this one!

Rob

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
Gisle,

You are correct that I was attempting to use this API to determine whether Terminal Services was installed. I was trying to test for wSuiteMask = VER_SUITE_TERMINAL.

So, I don't think the suggestion you gave is what I need because I'm not concerned about remote or console... However, I like the simplicity of this one!

Rob

[Migrated content. Thread originally posted on 08 February 2006]

Hello, im trying to get working this api but can't, can anyone help?

set environment "dll-convention" to 1.

initialize boolean OSVERSIONINFOEX lpVersionInfo.

set dwOSVersionInfoSize to size of OSVERSIONINFOEX.
if dwOSVersionInfoSize = NULL
go Comprobar_Conexiones_2
end-if.
inspect szCSDVersion replacing trailing space by null.

set lpVersionInfo to address of OSVERSIONINFOEX.
if lpVersionInfo = NULL
go Comprobar_Conexiones_2
end-if.

call "kernel32.dll".
call "GetVersionEx" using by value lpVersionInfo
giving boolean.
cancel "kernel32.dll".


01 OSVERSIONINFOEX.
03 dwOSVersionInfoSize pic 9(09) comp-5.
03 dwMajorVersion pic 9(09) comp-5.
03 dwMinorVersion pic 9(09) comp-5.
03 dwBuildNumber pic 9(09) comp-5.
03 dwPlatformId pic 9(09) comp-5.
03 szCSDVersion pic x(128).
03 wServicePackMajor pic 9(05) comp-5.
03 wServicePackMinor pic 9(05) comp-5.
03 wSuiteMask pic 9(05) comp-5.
03 wProductType pic x(01).
03 wReserved pic x(01).

77 lpVersionInfo pic 9(09) comp-5.
77 Boolean pic 9(01).


Microsoft Help About GetVersionEx

Thank you very much
Right, as noted in another thread, to verify the suite you need to use the function VerifyVersionInfo. (remember the A suffix).