diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:17:27 +0000 |
commit | f215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch) | |
tree | 6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/ValidationKit/testboxscript/win | |
parent | Initial commit. (diff) | |
download | virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip |
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/ValidationKit/testboxscript/win')
3 files changed, 389 insertions, 0 deletions
diff --git a/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd b/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd new file mode 100644 index 00000000..3e10fbbb --- /dev/null +++ b/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd @@ -0,0 +1,72 @@ +@echo off
+REM $Id: autoexec-testbox.cmd $
+REM REM @file
+REM VirtualBox Validation Kit - testbox script, automatic execution wrapper.
+REM
+
+REM
+REM Copyright (C) 2006-2023 Oracle and/or its affiliates.
+REM
+REM This file is part of VirtualBox base platform packages, as
+REM available from https://www.virtualbox.org.
+REM
+REM This program is free software; you can redistribute it and/or
+REM modify it under the terms of the GNU General Public License
+REM as published by the Free Software Foundation, in version 3 of the
+REM License.
+REM
+REM This program is distributed in the hope that it will be useful, but
+REM WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+REM General Public License for more details.
+REM
+REM You should have received a copy of the GNU General Public License
+REM along with this program; if not, see <https://www.gnu.org/licenses>.
+REM
+REM The contents of this file may alternatively be used under the terms
+REM of the Common Development and Distribution License Version 1.0
+REM (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+REM in the VirtualBox distribution, in which case the provisions of the
+REM CDDL are applicable instead of those of the GPL.
+REM
+REM You may elect to license modified versions of this file under the
+REM terms and conditions of either the GPL or the CDDL or both.
+REM
+REM SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+REM
+
+@echo "$Id: autoexec-testbox.cmd $"
+@echo on
+setlocal EnableExtensions
+set exe=python.exe
+for /f %%x in ('tasklist /NH /FI "IMAGENAME eq %exe%"') do if %%x == %exe% goto end
+
+if exist %SystemRoot%\System32\aim_ll.exe (
+ set RAMEXE=aim
+) else if exist %SystemRoot%\System32\imdisk.exe (
+ set RAMEXE=imdisk
+) else goto defaulttest
+
+REM Take presence of imdisk.exe or aim_ll.exe as order to test in ramdisk.
+set RAMDRIVE=D:
+if exist %RAMDRIVE%\TEMP goto skip
+if %RAMEXE% == aim (
+ aim_ll -a -t vm -s 16G -m %RAMDRIVE% -p "/fs:ntfs /q /y"
+) else if %RAMEXE% == imdisk (
+ imdisk -a -s 16GB -m %RAMDRIVE% -p "/fs:ntfs /q /y" -o "awe"
+) else goto defaulttest
+:skip
+
+set VBOX_INSTALL_PATH=%RAMDRIVE%\VBoxInstall
+set TMP=%RAMDRIVE%\TEMP
+set TEMP=%TMP%
+
+mkdir %VBOX_INSTALL_PATH%
+mkdir %TMP%
+
+set TESTBOXSCRIPT_OPTS=--scratch-root=%RAMDRIVE%\testbox
+
+:defaulttest
+%SystemDrive%\Python27\python.exe %SystemDrive%\testboxscript\testboxscript\testboxscript.py --testrsrc-server-type=cifs --builds-server-type=cifs %TESTBOXSCRIPT_OPTS%
+pause
+:end
diff --git a/src/VBox/ValidationKit/testboxscript/win/fix_stale_refs.py b/src/VBox/ValidationKit/testboxscript/win/fix_stale_refs.py new file mode 100755 index 00000000..4800c99d --- /dev/null +++ b/src/VBox/ValidationKit/testboxscript/win/fix_stale_refs.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# $Id: fix_stale_refs.py $ + +""" +This module must be used interactively! +Use with caution as it will delete some values from the regisry! + +It tries to locate client references to products that no longer exist. +""" + +__copyright__ = \ +""" +Copyright (C) 2012-2023 Oracle and/or its affiliates. + +This file is part of VirtualBox base platform packages, as +available from https://www.virtualbox.org. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, in version 3 of the +License. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see <https://www.gnu.org/licenses>. + +The contents of this file may alternatively be used under the terms +of the Common Development and Distribution License Version 1.0 +(CDDL), a copy of it is provided in the "COPYING.CDDL" file included +in the VirtualBox distribution, in which case the provisions of the +CDDL are applicable instead of those of the GPL. + +You may elect to license modified versions of this file under the +terms and conditions of either the GPL or the CDDL or both. + +SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0 +""" +__version__ = "$Revision: 155244 $" + + +from _winreg import HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS +from _winreg import OpenKey, CloseKey, EnumKey, QueryInfoKey, EnumValue, DeleteValue, QueryValueEx +from distutils.util import strtobool + +def reverse_bytes(hex_string): + """ + This function reverses the order of bytes in the provided string. + Each byte is represented by two characters which are reversed as well. + """ + #print 'reverse_bytes(' + hex_string + ')' + chars = len(hex_string) + if chars > 2: + return reverse_bytes(hex_string[chars/2:]) + reverse_bytes(hex_string[:chars/2]) + else: + return hex_string[1] + hex_string[0] + +def transpose_guid(guid): + """ + Windows Installer uses different way to present GUID string. This function converts GUID + from installer's presentation to more conventional form. + """ + return '{' + reverse_bytes(guid[0:8]) + '-' + reverse_bytes(guid[8:12]) + \ + '-' + reverse_bytes(guid[12:16]) + \ + '-' + reverse_bytes(guid[16:18]) + reverse_bytes(guid[18:20]) + \ + '-' + ''.join([reverse_bytes(guid[i:i+2]) for i in range(20, 32, 2)]) + '}' + +PRODUCTS_KEY = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products' +COMPONENTS_KEY = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components' + +def get_installed_products(): + """ + Enumerate all installed products. + """ + products = {} + hkey_products = OpenKey(HKEY_LOCAL_MACHINE, PRODUCTS_KEY, 0, KEY_ALL_ACCESS) + + try: + product_index = 0 + while True: + product_guid = EnumKey(hkey_products, product_index) + hkey_product_properties = OpenKey(hkey_products, product_guid + r'\InstallProperties', 0, KEY_ALL_ACCESS) + try: + value = QueryValueEx(hkey_product_properties, 'DisplayName')[0] + except WindowsError as oXcpt: + if oXcpt.winerror != 2: + raise + value = '<unknown>' + CloseKey(hkey_product_properties) + products[product_guid] = value + product_index += 1 + except WindowsError as oXcpt: + if oXcpt.winerror != 259: + print(oXcpt.strerror + '.', 'error', oXcpt.winerror) + CloseKey(hkey_products) + + print('Installed products:') + for product_key in sorted(products.keys()): + print(transpose_guid(product_key), '=', products[product_key]) + + print() + return products + +def get_missing_products(hkey_components): + """ + Detect references to missing products. + """ + products = get_installed_products() + + missing_products = {} + + for component_index in xrange(0, QueryInfoKey(hkey_components)[0]): + component_guid = EnumKey(hkey_components, component_index) + hkey_component = OpenKey(hkey_components, component_guid, 0, KEY_ALL_ACCESS) + clients = [] + for value_index in xrange(0, QueryInfoKey(hkey_component)[1]): + client_guid, client_path = EnumValue(hkey_component, value_index)[:2] + clients.append((client_guid, client_path)) + if not client_guid in products: + if client_guid in missing_products: + missing_products[client_guid].append((component_guid, client_path)) + else: + missing_products[client_guid] = [(component_guid, client_path)] + CloseKey(hkey_component) + return missing_products + +def main(): + """ + Enumerate all installed products, go through all components and check if client refences + point to valid products. Remove references to non-existing products if the user allowed it. + """ + hkey_components = OpenKey(HKEY_LOCAL_MACHINE, COMPONENTS_KEY, 0, KEY_ALL_ACCESS) + + missing_products = get_missing_products(hkey_components) + + print('Missing products refer the following components:') + for product_guid in sorted(missing_products.keys()): + if product_guid[1:] == '0'*31: + continue + print('Product', transpose_guid(product_guid) + ':') + for component_guid, component_file in missing_products[product_guid]: + print(' ' + transpose_guid(component_guid), '=', component_file) + + print('Remove all references to product', transpose_guid(product_guid) + '? [y/n]') + if strtobool(raw_input().lower()): + for component_guid, component_file in missing_products[product_guid]: + hkey_component = OpenKey(hkey_components, component_guid, 0, KEY_ALL_ACCESS) + print('Removing reference in ' + transpose_guid(component_guid), '=', component_file) + DeleteValue(hkey_component, product_guid) + CloseKey(hkey_component) + else: + print('Cancelled removal of product', transpose_guid(product_guid)) + + CloseKey(hkey_components) + +if __name__ == "__main__": + main() diff --git a/src/VBox/ValidationKit/testboxscript/win/readme.txt b/src/VBox/ValidationKit/testboxscript/win/readme.txt new file mode 100644 index 00000000..3da82f9d --- /dev/null +++ b/src/VBox/ValidationKit/testboxscript/win/readme.txt @@ -0,0 +1,157 @@ +$Id: readme.txt $ + + +Preparations: + +0. Make sure the computer name (what hostname prints) is the same as the DNS + returns (sans domain) for the host IP. + +1. Install Python 2.7.x from python.org to C:\Python27 or Python 3.y.x to + C:\Python3%y%, where y >= 5. Matching bit count as the host windows version. + +2. Install the win32 extension for python. + +3. Append C:\Python27 or C:\Python3%y% to the system PATH (tail). + +4. Disable UAC. + + Windows 8 / 8.1 / Server 2012: Set the following key to zero: + "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\EnableLUA" + +5. Disable Automatic updates. (No rebooting during tests, thank you!) + + Ideally we would prevent windows from even checking for updates to avoid + influencing benchmarks and such, however the microsofties aren't keen on it. + So, disable it as much as possible. + + W10: gpedit.msc -> "Administrative Templates" -> "Windows Components" + -> "Windows Update": + - "Configure Automatic Updates": Enable and select "2 - Notify for + download and notiy for install". + - "Allow Automatic Updates immediate installation": Disable. + - "No auto-restart with logged on users for scheduled automatic + updates installations": Enabled. + +6. Go to the group policy editor (gpedit.msc) and change "Computer Configuration" + -> "Windows Settings" -> "Security Settings" -> "Local Policies" + -> "Security Options" -> "Network security: LAN Manager authentication level" + to "Send LM & NTLM- use NTLMv2 session security if negotiated". This fixed + passing the password as an argument to "NET USE" (don't ask why!). + +6b. While in the group policy editor, make sure that "Computer Configuration" + -> "Windows Settings" -> "Security Settings" [ -> "Local Policies" ] + -> "Account Policy" -> "Password must meet complexity requirements" is + disabled so the vbox account can be created later one. + +7. Need to disable the error popups blocking testing. + + Set "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows\ErrorMode" + to 2. This immediately disables hard error popups (missing DLLs and such). + + Then there are the sending info to microsoft, debug, dump, look for solution + questions we don't want. Not entirely sure what's required here yet, but + the following stuff might hopefully help (update after testing): + + On Windows XP: + + Go "Control Panel" -> "System Properties" -> "Advanced" + -> "Error Reporting" and check "Disable error reporting" + and uncheck "But notify me when critical erorr occurs". + + On Windows Vista and later: + + In gpedit change the following settings under "Computer Configuration" + -> "Administrative Templates" -> "Windows Components" + -> "Windows Error Reporting": + 1) Enable "Prevent display of the user interface for critical errors". + ... -> "Advanced Error Reporting Settings": + 1) Enable "Configure Report Archive" and set it to "Store All" for + up to 500 (or less) reports. + 2) Disable "Configure Report Queue". + + Run 'serverWerOptin /disable'. + + Then set "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\DontShowUI" + to 1. (Could do all the above from regedit if we wanted...) + +7b. Configure application crash dumps on Vista SP1 and later: + + Set the following values under the key + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps: + DumpFolder [string] = C:\CrashDumps + DumpCount [dword] = 10 + DumpType [dword] = 1 (minidump) + CustomDumpFlags [dword] = 0 + + mkdir C:\CrashDumps + + See also http://msdn.microsoft.com/en-us/library/windows/desktop/bb787181%28v=vs.85%29.aspx + +7c. Enable verbose driver installation logging (C:\Windows\setupapi.dev.log): + + Create the following value under the key + HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\ + LogLevel [dword] = 0xFF (255) + + If it already exists (typical on W10), just OR 0xff into the existing value. + +8. Install firefox or chrome, download the latest testboxscript*.zip from + the build box. If the testbox is very short on disk space, i.e. less than + 15GB free disk space after installing Windows Updates, install ImDisk 2.0.9 + or later from e.g. http://www.ltr-data.se/opencode.html/ + +9. Create a user named "vbox" with password "password". Must be an + Administrator user! + +10. Configure user "vbox" to log in automatically via "control userpasswords2". + +11. Open up the port ranges 6000-6100 (VRDP) for TCP traffic and 5000-5032 + (NetPerf) for both TCP and UDP traffic in the Windows Firewall. + From the command line (recommended in vista): + for /L %i in (6000,1,6100) do netsh firewall add portopening TCP %i "VRDP %i" + for /L %i in (5000,1,5032) do netsh firewall add portopening TCP %i "NetPerf %i TCP" + for /L %i in (5000,1,5032) do netsh firewall add portopening UDP %i "NetPerf %i UDP" + netsh firewall set icmpsetting type=ALL + +11b. Set a hostname which the test script can resolve to the host's IP address. + +12. Setup time server to "wei01-time.de.oracle.com" and update date/time. + +13. Activate windows. "https://linserv.de.oracle.com/vbox/wiki/MSDN Volume License Keys" + +14. Windows 2012 R2: If you experience mouse pointer problems connecting with rdesktop, + open the mouse pointer settings and disable mouse pointer shadow. + +15. Enable RDP access by opening "System Properties" and selecting "Allow + remote connections to this computer" in the "Remote" tab. Ensure that + "Allow connections only from computers running Remote Desktop with Network + Level Authentication" is not checked or rdesktop can't access it. + + W10: Make old rdesktop connect: + \HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\SecurityLayer + Change DWORD Hex '2' -> '1' + +15b. While you're in "System Properties", in the "Hardware" tab, button + "Driver Signing" tell it to ignore logo testing requirements. + + W10: Doesn't exist any more. + +The install (as user vbox): + +16. Disable loading CONIME. Set "HKEY_CURRENT_USER\Console\LoadConIme" to 0. + +17. Unzip (/ copy) the content of the testboxscript-*.zip to C:\testboxscript. + +18. Copy C:\testboxscript\testboxscript\win\autoexec-testbox.cmd to C:\. + +19. Create a shortcut to C:\autoexec-testbox.cmd and drag it into + "Start" -> "All Programs" -> "Startup". + + W10: Find startup folder by hitting Win+R and entering "shell:startup". + +20. If this is an Intel box and the CPU is capable of Nested Paging, edit C:\autoexec-testbox.cmd + and append '--nested-paging' + + +That's currently it. + |