1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: sysinfo.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-13 10:27:06 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : helge.delfs@sun.com
36 '* short description : Establish facts of the operating system
38 '************************************************************************
40 ' #1 PlatFormInit ' Insert the list variables PlatformName, PlatformExt and PlatormGroup
41 ' #1 getToolPlatform ' Affected variables: gtSystemPath, gTesttoolIni, gtPlatform, gSamePC, gtSYSName, gUser and gHost.
42 ' #1 GetOfficePlatform ' Affected variables: gSamePC, gSystemPath, gSYSName, gTesttoolPath and gOfficePath.
43 ' #1 hGetSystemLanguage ' Get the system language
44 ' #0 hfGetTTProfileName
46 '\***********************************************************************
48 ' define the global definitions for operating systems
50 Global Const MAX_PLATFORM = 25
51 Global gSystemnummer as Integer
53 ' Systeme und Versionen
54 Global Const SYS_00 = 0
55 Global Const SYS_W95 = 1
56 Global Const SYS_W98 = 2
57 Global Const SYS_WSE = 3
58 Global Const SYS_WME = 4
59 Global Const SYS_WNT = 5
60 Global Const SYS_W2K = 6
61 Global Const SYS_WXP = 7
62 Global Const SYS_MAC = 8
63 Global Const SYS_SOL = 9
64 Global Const SYS_LIN = 10
65 Global Const SYS_x86 = 11
66 Global Const SYS_OSX = 12
67 Global Const SYS_PPC = 13
68 Global Const SYS_SCO = 14
69 Global Const SYS_AIX = 15
70 Global Const SYS_IRI = 16
71 Global Const SYS_HP = 17
72 Global Const SYS_FBSD = 18
73 Global Const SYS_NBSD = 19
74 Global Const SYS_LIN64 = 20
75 Global Const SYS_LINSPARC = 21
76 Global Const SYS_ECS = 22
78 Global PlatFormGroup(MAX_PLATFORM) as String
79 Global PlatFormName(MAX_PLATFORM) as String
80 Global PlatFormExt(MAX_PLATFORM) as String
83 '///<b>Initialize information arrays</b>
84 '///+Supported Operating Systems:
85 '///+<TABLE BORDER=1><TR><TH>Name</TH><TH>Short Name</TH><TH>Platgroup</TH></TR>
86 '///+<TR><TD>Win95</TD><TD>w95</TD><TD>w95</TD></TR>
87 '///+<TR><TD>Win98</TD><TD>w98</TD><TD>w95</TD></TR>
88 '///+<TR><TD>Win98SE</TD><TD>wse</TD><TD>w95</TD></TR>
89 '///+<TR><TD>Win98ME</TD><TD>wme</TD><TD>s95</TD></TR>
90 '///+<TR><TD>WinNT</TD><TD>wnt</TD><TD>w95</TD></TR>
91 '///+<TR><TD>Win2000</TD><TD>w2k</TD><TD>w95</TD></TR>
92 '///+<TR><TD>WinXP</TD><TD>wxp</TD><TD>w95</TD></TR>
93 '///+<TR><TD>Solaris SPARC</TD><TD>sol</TD><TD>unx</TD></TR>
94 '///+<TR><TD>Solaris x86</TD><TD>x86</TD><TD>unx</TD></TR>
95 '///+<TR><TD>Linux</TD><TD>lin</TD><TD>unx</TD></TR>
96 '///+<TR><TD>Mac OS X</TD><TD>osx</TD><TD>unx</TD></TR>
97 '///+<TR><TD>Linux PPC</TD><TD>ppc</TD><TD>unx</TD></TR>
98 '///+<TR><TD>SCO UNIX</TD><TD>sco</TD><TD>unx</TD></TR>
99 '///+<TR><TD>AIX</TD><TD>aix</TD><TD>unx</TD></TR>
100 '///+<TR><TD>Irix</TD><TD>iri</TD><TD>unx</TD></TR>
101 '///+<TR><TD>HP UNIX</TD><TD>hp</TD><TD>unx</TD></TR>
102 '///+<TR><TD>FreeBSD</TD><TD>fbsd</TD><TD>unx</TD></TR>
103 '///+<TR><TD>NetBSD</TD><TD>nbsd</TD><TD>unx</TD></TR>
104 '///+<TR><TD>Linux 64 bit</TD><TD>lin64</TD><TD>unx</TD></TR>
105 '///+<TR><TD>Linux SPARC</TD><TD>linsparc</TD><TD>unx</TD></TR>
106 '///+<TR><TD>eComStation</TD><TD>ecs</TD><TD>ecs</TD></TR>
108 PlatFormName(SYS_00) = "Unknown" : PlatFormExt(SYS_00) = "a00"
109 PlatFormName(SYS_W95) = "Win95" : PlatFormExt(SYS_W95) = "w95"
110 PlatFormName(SYS_W98) = "Win98" : PlatFormExt(SYS_W98) = "w98"
111 PlatFormName(SYS_WSE) = "Win98SE" : PlatFormExt(SYS_WSE) = "wse"
112 PlatFormName(SYS_WME) = "Win98ME" : PlatFormExt(SYS_WME) = "wme"
113 PlatFormName(SYS_WNT) = "WinNT" : PlatFormExt(SYS_WNT) = "wnt"
114 PlatFormName(SYS_W2K) = "Win2000" : PlatFormExt(SYS_W2K) = "w2k"
115 PlatFormName(SYS_WXP) = "WinXP" : PlatFormExt(SYS_WXP) = "wxp"
116 PlatFormName(SYS_SOL) = "Solaris SPARC" : PlatFormExt(SYS_SOL) = "sol"
117 PlatFormName(SYS_X86) = "Solaris x86" : PlatFormExt(SYS_X86) = "x86"
118 PlatFormName(SYS_LIN) = "Linux" : PlatFormExt(SYS_LIN) = "lin"
119 PlatformName(SYS_OSX) = "Mac OS X" : PlatformExt(SYS_OSX) = "osx"
120 PlatformName(SYS_PPC) = "Linux PPC" : PlatformExt(SYS_PPC) = "ppc"
121 PlatFormName(SYS_SCO) = "SCO Unix" : PlatFormExt(SYS_SCO) = "sco"
122 PlatFormName(SYS_AIX) = "AIX" : PlatFormExt(SYS_AIX) = "aix"
123 PlatFormName(SYS_IRI) = "IRIX" : PlatFormExt(SYS_IRI) = "iri"
124 PlatFormName(SYS_HP) = "HP UNIX" : PlatFormExt(SYS_Hp) = "hp"
125 PlatFormName(SYS_FBSD) = "FreeBSD" : PlatFormExt(SYS_FBSD) = "fbsd"
126 PlatFormName(SYS_NBSD) = "NetBSD" : PlatFormExt(SYS_NBSD) = "nbsd"
127 PlatFormName(SYS_LIN64) = "Linux 64 bit" : PlatFormExt(SYS_LIN64)= "lin64"
128 PlatFormName(SYS_LINSPARC) = "Linux SPARC" : PlatFormExt(SYS_LINSPARC) = "linsparc"
129 PlatFormName(SYS_ECS) = "eComStation" : PlatFormExt(SYS_ECS) = "ecs"
131 PlatFormGroup(SYS_00) = "a00"
132 PlatFormGroup(SYS_W95) = "w95"
133 PlatFormGroup(SYS_W98) = "w95"
134 PlatFormGroup(SYS_WSE) = "w95"
135 PlatFormGroup(SYS_WME) = "w95"
136 PlatFormGroup(SYS_WNT) = "w95"
137 PlatFormGroup(SYS_W2K) = "w95"
138 PlatFormGroup(SYS_WXP) = "w95"
139 PlatFormGroup(SYS_SOL) = "unx"
140 PlatFormGroup(SYS_X86) = "unx"
141 PlatFormGroup(SYS_LIN) = "unx"
142 PlatFormGroup(SYS_OSX) = "unx"
143 PlatFormGroup(SYS_PPC) = "unx"
144 PlatFormGroup(SYS_SCO) = "unx"
145 PlatFormGroup(SYS_AIX) = "unx"
146 PlatFormGroup(SYS_IRI) = "unx"
147 PlatFormGroup(SYS_HP) = "unx"
148 PlatFormGroup(SYS_FBSD) = "unx"
149 PlatFormGroup(SYS_NBSD) = "unx"
150 PlatFormGroup(SYS_LIN64)= "unx"
151 PlatFormGroup(SYS_LINSPARC) = "unx"
152 PlatFormGroup(SYS_ECS) = "ecs"
155 '-------------------------------------------------------------------------
158 '///<b>Get all information about the system where the testtool runs.</b>
159 '///The following global variables will be set:
160 '///+<ul><li><i>gtSystemPath</i>: Systenmpath of the operating system (Testtool)</li>
161 '///+<li><i>gTesttoolIni</i>: Path to <i>testtool.ini</i></li>
162 '///+<li><i>gtPlatform</i>: Name of the operating system (3 digit e.g. 'w95')</li>
163 '///+<li><i>gSamePC</i>: Bolean if the testtool and the office run on same system</li>
164 '///+<li><i>gtSYSName</i>: Full name of the operating system</li>
165 '///+<li><i>gUser</i>: Username on the testtool system</li>
166 '///+<li><i>gHost</i>: The hostname</li></ul>
168 Dim iGUIVersion as Integer
169 Dim gtIniPath as String
173 '///Get GUI information -> global definition of the operating system (Windows, UNIX, etc.)
174 '///+ GUI is a systemvariable, it can get by testtool (1 =" Windows; 4 => UNIX [<b>depricated</b> 2 was " OS/2;])
177 case 1 : gtSystemPath = GetApplicationPath + "\" 'Change from 'windir' to internal instruction
178 gUser = environ ("vcsid")
180 gUser = environ ("USERNAME")
182 gtIniPath = gtSystemPath
183 case 2 : ' For eComStation all variables must point to the same directory
184 gUser = environ ("HOME")
185 if ( gUser = "" ) then
186 warnlog( "Please add the HOME variable to the environment and make it point to the directory you wat to store your personal setting in."
188 gtSystemPath = gUser & "\"
189 gtIniPath = gtSystemPath
190 case 4 : gtSystemPath = getApplicationPath + "/"
191 gUser = environ ("USER")
193 gUser = environ ("LOGNAME") ' on some Unix systems
195 gtIniPath = gtSystemPath
196 case else : QAErrorLog "Not supported operating system! Please write an issue about it (qa/testscripts)! The 'GetGUIType' command is returning '" & GUI & "'."
197 QAErrorLog "Setting 'GUI' variable to 4 (=Unix) to try testing. If it fails you have to wait until your issue will have been fixed."
199 gtSystemPath = getApplicationPath + "/"
200 gUser = environ ("USER")
202 gUser = environ ("LOGNAME") ' on some Unix systems
204 gtIniPath = gtSystemPath
206 '///Get GUI version -> Detailed definition of the operating system (Win95, WinNT, Win2000, Linux, Sparc, x86 etc.)
207 '///+This data can be get only out of the <i>testtool.ini/.testtoolrc</i>
208 '///+Here is the list, which entries for which OS
209 '///+<TABLE BORDER=1><TR><TH>Name</TH><TH>Value</TH></TR>
210 '///+<TR><TD>Win95</TD><TD>100</TD></TR>
211 '///+<TR><TD>Win98</TD><TD>395</TD></TR>
212 '///+<TR><TD>WinNT</TD><TD>351 or 400</TD></TR>
213 '///+<TR><TD>WinSE</TD><TD>410</TD></TR>
214 '///+<TR><TD>WinME</TD><TD>490</TD></TR>
215 '///+<TR><TD>Win2000</TD><TD>500</TD></TR>
216 '///+<TR><TD>WinXP</TD><TD>501</TD></TR>
217 '///+<TR><TD>Solaris SPARC</TD><TD>01</TD></TR>
218 '///+<TR><TD>Linux</TD><TD>03</TD></TR>
219 '///+<TR><TD>Solaris x86</TD><TD>05</TD></TR>
220 '///+<TR><TD>Mac OS X</TD><TD>12</TD></TR>
221 '///+<TR><TD>Linux PPC</TD><TD>13</TD></TR>
222 '///+<TR><TD>SCO UNIX</TD><TD>02</TD></TR>
223 '///+<TR><TD>AIX</TD><TD>04</TD></TR>
224 '///+<TR><TD>Irix</TD><TD>06</TD></TR>
225 '///+<TR><TD>HP UNIX</TD><TD>07</TD></TR>
226 '///+<TR><TD>FreeBSD</TD><TD>08</TD></TR>
227 '///+<TR><TD>NetBSD</TD><TD>14</TD></TR>
228 '///+<TR><TD>Linux 64 bit</TD><TD>15</TD></TR>
229 '///+<TR><TD>Linux SPARC</TD><TD>16</TD></TR>
230 '///+<TR><TD>eComStation</TD><TD>17</TD></TR>
232 '///Get the path to <i>testtool.ini/.testtoolrc</i>
234 gTesttoolIni = gtIniPath + ".testtoolrc"
235 gSVersionIni = gtIniPath + ".sversionrc"
237 gTesttoolIni = gtIniPath + "testtool.ini"
238 gSVersionIni = gtIniPath + "sversion.ini"
241 if Dir (gTesttoolIni) = "" then
243 MsgBox ("The Test ends, because 'testtool.ini' is missing at : "+ Chr(13) + gTesttoolIni, 1, "Config-file for testtool is missing")
245 MsgBox ("The Test ends, because '.testtoolrc' is missing at : " + Chr(13) + gTesttoolIni, 1, "Config-file for testtool is missing")
249 '///Get <b>iGuiVersion</b> out of <i>testtool.ini/.testtoolrc</i>
250 iGuiVersion = GetIniValue (gTesttoolIni, "GUI Platform", "Current")
251 if iGuiVersion = 0 then
254 qaErrorLog("The GUI-entry in '" + gTesttoolIni + "' is missing!"+Chr(13)+"Please insert the correct number for your operating system! In Section [GUI Platform], entry Current= "+Chr(13)+"Win95....: 100"+Chr(13)+"Win98....: 395"+Chr(13)+"WinNT....: 351 or 400"+Chr(13)+"WinSE....: 410"+Chr(13)+"WinME....: 490"+Chr(13)+"Win2000..: 500"+Chr(13)+"WinXP....: 501")
257 QAErrorLog("The GUI value in '" + gTesttoolIni + "' is missing!"+Chr(13)+"Please insert the correct number for your operating system! In Section [GUI Platform], entry Current= "+Chr(13)+"Solaris SPARC.: 01"+Chr(13)+"SCO UNIX......: 02"+Chr(13)+"Linux.........: 03"+Chr(13)+"AIX...........: 04"+Chr(13)+"Solaris x86...: 05"+Chr(13)+"Irix..........: 06"+Chr(13)+"HP-UX.........: 07"+Chr(13)+"FreeBSD........: 08"+Chr(13)+"Mac OS X......: 12"+Chr(13)+"Linux PPC.....: 13"+Chr(13)+"NetBSD.....: 14"+Chr(13)+"Linux 64 bit.....: 15"+Chr(13)+"Linux SPARC.....: 16")
260 '///Get the variable <b>gSamePC</b>
261 gHost = GetIniValue (gTesttoolIni, "Communication", "Host")
262 if (gHost = "") then gHost = "LOCALHOST" ' if entry is not in configuration file set default value
263 if uCase (gHost) = "LOCALHOST" then ' ein Client kann immer nur lokal sein
268 '///Set <b>gtPlatform</b> and <b>gtSYSName</b>
272 select case iGuiVersion
273 case 100: gSystemnummer = SYS_W95
274 case 351: gSystemnummer = SYS_WNT
275 case 395: gSystemnummer = SYS_W95
276 case 400: gSystemnummer = SYS_WNT
277 case 410: gSystemnummer = SYS_WSE
278 case 490: gSystemnummer = SYS_WME
279 case 500: gSystemnummer = SYS_W2K
280 case 501: gSystemnummer = SYS_WXP
281 case else: Print "Unknown OS ("+GUI+"/"+iGuiVersion+") please insert in sysinfo.inc::GetToolPlatform, WinNT will be used now."
282 gSystemnummer = SYS_WNT
287 select case iGuiVersion
288 case 17: gSystemNummer = SYS_ECS
289 case else: Print "Unknown OS ("+GUI+"/"+iGuiVersion+") please insert in sysinfo.inc::GetToolPlatform, WinNT will be used now."
290 gSystemNummer = SYS_ECS
293 'Deprecated OSes: - (2) OS/2 2.x, 3.x, 4 (Merlin), 4.5 (Aurora)
294 ' - (3) Mac OS Classic
295 print "Deprecated OS ("+GUI+"/"+iGuiVersion+") please insert in sysinfo.inc::GetToolPlatform."
296 gSystemnummer = SYS_SOL
299 select case iGuiVersion
300 case 01 : gSystemnummer = SYS_SOL
301 case 02 : gSystemnummer = SYS_SCO
302 case 03 : gSystemnummer = SYS_LIN
303 case 04 : gSystemnummer = SYS_AIX
304 case 05 : gSystemnummer = SYS_X86
305 case 06 : gSystemnummer = SYS_IRI
306 case 07 : gSystemnummer = SYS_HP
307 case 08 : gSystemnummer = SYS_FBSD
308 case 12 : gSystemnummer = SYS_OSX
309 case 13 : gSystemnummer = SYS_PPC
310 case 14 : gSystemnummer = SYS_NBSD
311 case 15 : gSystemnummer = SYS_LIN64
312 case 16 : gSystemnummer = SYS_LINSPARC
313 case else: Print "Unknown OS ("+GUI+"/"+iGuiVersion+") please insert in sysinfo.inc::GetToolPlatform. TestTool will try to use the same environment as Solaris SPARC uses."
314 gSystemnummer = SYS_SOL
318 gtPlatform = PlatFormExt(gSystemnummer)
319 gtSYSName = PlatFormName(gSystemnummer)
322 '-------------------------------------------------------------------------
324 sub GetOfficePlatform
325 '///<b>Get all information about the system where the office is running.</b>
326 '///The following global variables will be set:
327 '///+<ul><li><i>gPlatform</i>: Name of the operating system (3 digit e.g. 'w95')</li>
328 '///+<li><i>gSYSName</i>: Full name of the operating system</li>
329 '///+<li><i>gPlatGroup</i>: Groupname of the operation system (w95, unx)</li></ul>
330 '///If the Testtool and the office are running on the same machine (<b>gSamePC = TRUE</b>) then all variables have the same value.
331 '///+If not the value of <i>Aktuell</i> in section <i>[Office Platform]</i> has to be set in <i>testtool.ini/.testtoolrc</i> (testing remotely)
332 '///+the variables are :
333 '///+<TABLE BORDER=1><TR><TH>Name</TH><TH>Entry in <i>testtool.ini</i></TH></TR>
334 '///+<TR><TD>Win95</TD><TD>WIN95</TD></TR>
335 '///+<TR><TD>Win98</TD><TD>WIN98</TD></TR>
336 '///+<TR><TD>WinSE</TD><TD>WIN98SE</TD></TR>
337 '///+<TR><TD>WinME</TD><TD>WIN98ME</TD></TR>
338 '///+<TR><TD>WinNT</TD><TD>WINNT</TD></TR>
339 '///+<TR><TD>Win2000</TD><TD>WIN2000</TD></TR>
340 '///+<TR><TD>WinXP</TD><TD>WINXP</TD></TR>
341 '///+<TR><TD>Solaris SPARC</TD><TD>SOLARIS</TD></TR>
342 '///+<TR><TD>Linux</TD><TD>LINUX</TD></TR>
343 '///+<TR><TD>Solaris x86</TD><TD>X86</TD></TR>
344 '///+<TR><TD>Mac OS X</TD><TD>OSX</TD></TR>
345 '///+<TR><TD>Linux PPC</TD><TD>PPC</TD></TR>
346 '///+<TR><TD>SCO UNIX</TD><TD>SCO</TD></TR>
347 '///+<TR><TD>AIX</TD><TD>AIX</TD></TR>
348 '///+<TR><TD>Irix</TD><TD>IRI</TD></TR>
349 '///+<TR><TD>HP UNIX</TD><TD>HP</TD></TR>
350 '///+<TR><TD>FreeBSD</TD><TD>FBSD</TD></TR>
351 '///+<TR><TD>NetBSD</TD><TD>NBSD</TD></TR>
352 '///+<TR><TD>Linux 64 bit</TD><TD>LIN64</TD></TR>
353 '///+<TR><TD>Linux SPARC</TD><TD>LINSPARC</TD></TR>
354 '///+<TR><TD>eComStation</TD><TD>ecs</TD></TR>
357 Dim GuiString as String
360 if gSamePC = FALSE then
361 GuiString = UCase (GetIniValue (gTesttoolIni, "Office Platform", "Current"))
362 select case GuiString
363 case "WIN95" : GUI = 1
364 case "WIN98" : GUI = 2
365 case "WIN98SE" : GUI = 3
366 case "WIN98ME" : GUI = 4
367 case "WINNT" : GUI = 5
368 case "WIN2000" : GUI = 6
369 case "WINXP" : GUI = 7
370 case "SOLARIS" : GUI = 9
371 case "LINUX" : GUI = 10
372 case "X86" : GUI = 11
373 case "OSX" : GUI = 12
374 case "PPC" : GUI = 13
375 case "SCO" : GUI = 14
376 case "AIX" : GUI = 15
377 case "IRI" : GUI = 16
379 case "FBSD" : GUI = 18
380 case "NBSD" : GUI = 19
381 case "LIN64" : GUI = 20
382 case "LINSPARC": GUI = 21
383 case "ECS" : GUI = 22
384 case else : print "Unknown operating system : '" & GuiString & "'. The test run should be canceled."
387 gPlatform = PlatFormExt(GUI)
388 gSYSName = PlatFormName(GUI)
389 gPlatGroup = PlatFormGroup(GUI)
391 gPlatform = gtPlatform
393 gPlatGroup = PlatFormGroup(gSystemnummer)
397 '-------------------------------------------------------------------------
399 function hGetSystemLanguage as Integer
400 '///Get the systemlanguage (ID)
403 hGetSystemLanguage = 0
406 sDummy = GetSystemLanguage
408 print "You are testing an Office, that wasn't synced at least with version srx 644r Build 8509! \n Please call the Developer, that provided the CWS to you and tell him to resync !!!!!!!!!!"
413 warnlog "sysinfo.inc::hGetSystemLanguage: The Systemlanguage is unknown, the default will be 01 = English (USA)."
414 hGetSystemLanguage = 1
416 hGetSystemLanguage = ConvertCodeToLanguage (sDummy)
420 '-------------------------------------------------------------------------
422 function hfGetTTProfileName as string
423 ' Author: JSI, 22. January 2003
424 '/// Get the current profile name in the TestTool control file (testtool.ini / .testtoolrc).
425 hfGetTTProfileName = GetIniValue (gTesttoolIni, "Misc", "CurrentProfile")