diff --git a/dumpsmc.exe b/dumpsmc.exe index 8b930cc..fa54e77 100755 Binary files a/dumpsmc.exe and b/dumpsmc.exe differ diff --git a/gettools.exe b/gettools.exe index 4424c30..14b0e77 100755 Binary files a/gettools.exe and b/gettools.exe differ diff --git a/gettools.py b/gettools.py index 8cd7004..534e51d 100755 --- a/gettools.py +++ b/gettools.py @@ -86,6 +86,60 @@ def reporthook(count, block_size, total_size): (percent, progress_size / (1024 * 1024), speed, time_remaining)) sys.stdout.flush() +def query(question, default="yes"): + """Ask a yes/no question via raw_input() and return their answer. + + "question" is a string that is presented to the user. + "default" is the presumed answer if the user just hits . + It must be "yes" (the default), "no" or None (meaning + an answer is required of the user). + + The "answer" return value is True for "yes" or False for "no". + ########### CODE FROM https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input ########### + """ + valid = {"yes": True, "y": True, "ye": True, + "no": False, "n": False} + if default is None: + prompt = " [y/n] " + elif default == "yes": + prompt = " [Y/n] " + elif default == "no": + prompt = " [y/N] " + else: + raise ValueError("invalid default answer: '%s'" % default) + + while True: + sys.stdout.write(question + prompt) + choice = input().lower() + if default is not None and choice == '': + return valid[default] + elif choice in valid: + return valid[choice] + else: + sys.stdout.write("Please respond with 'yes' or 'no' " + "(or 'y' or 'n').\n") + +def processfiles(dest): + print('Extracting com.vmware.fusion.zip.tar...') + tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), 'r') + tar.extract('com.vmware.fusion.zip', path=convertpath(dest + '/tools/')) + tar.close() + + print('Extracting files from com.vmware.fusion.zip...') + cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.zip'), 'r') + cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/darwin.iso', path=convertpath(dest + '/tools/')) + cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/darwinPre15.iso', path=convertpath(dest + '/tools/')) + cdszip.close() + + # Move the iso and sig files to tools folder + shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/darwin.iso'), convertpath(dest + '/tools/darwin.iso')) + shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/darwinPre15.iso'), convertpath(dest + '/tools/darwinPre15.iso')) + + # Cleanup working files and folders + shutil.rmtree(convertpath(dest + '/tools/payload'), True) + os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip.tar')) + os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip')) + def main(): # Check minimal Python version is 2.7 if sys.version_info < (3, 0): @@ -94,14 +148,25 @@ def main(): dest = os.path.dirname(os.path.abspath(__file__)) - # Re-create the tools folder - shutil.rmtree(dest + '/tools', True) - os.mkdir(dest + '/tools') + # Check if path exists + if not os.path.exists(dest + '/tools'): + # Re-create the tools folder + shutil.rmtree(dest + '/tools', True) + os.mkdir(dest + '/tools') parser = CDSParser() # Last published version doesn't ship with darwin tools # so in case of error get it from the core.vmware.fusion.tar + + # Ask user if file has been there + if os.path.isfile(dest + '/tools/com.vmware.fusion.zip.tar'): + print('Seems like you had already had the file com.vmware.fusion.zip.tar in the folder tools.') + # User says yes + if query('Would you like to use it?'): + processfiles(dest) + return + # User says no or file didnt exist print('Trying to get tools from the packages folder...') # Setup url and file paths @@ -138,7 +203,7 @@ def main(): except: # No tools found, get em from the core tar print('Tools aren\'t here... Be patient while I download and' + - ' give a look into the core.vmware.fusion.tar file') + ' give a look into the core.vmware.fusion.tar file') urlcoretar = url + lastVersion + '/core/com.vmware.fusion.zip.tar' # Get the main core file @@ -150,25 +215,7 @@ def main(): print() - print('Extracting com.vmware.fusion.zip.tar...') - tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), 'r') - tar.extract('com.vmware.fusion.zip', path=convertpath(dest + '/tools/')) - tar.close() - - print('Extracting files from com.vmware.fusion.zip...') - cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.zip'), 'r') - cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/darwin.iso', path=convertpath(dest + '/tools/')) - cdszip.extract('payload/VMware Fusion.app/Contents/Library/isoimages/darwinPre15.iso', path=convertpath(dest + '/tools/')) - cdszip.close() - - # Move the iso and sig files to tools folder - shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/darwin.iso'), convertpath(dest + '/tools/darwin.iso')) - shutil.move(convertpath(dest + '/tools/payload/VMware Fusion.app/Contents/Library/isoimages/darwinPre15.iso'), convertpath(dest + '/tools/darwinPre15.iso')) - - # Cleanup working files and folders - shutil.rmtree(convertpath(dest + '/tools/payload'), True) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip.tar')) - os.remove(convertpath(dest + '/tools/com.vmware.fusion.zip')) + processfiles(dest) print('Tools retrieved successfully') return diff --git a/unlocker.exe b/unlocker.exe index 7bee5ba..9009946 100755 Binary files a/unlocker.exe and b/unlocker.exe differ diff --git a/win-install-exe.cmd b/win-install-exe.cmd new file mode 100644 index 0000000..87ee9bc --- /dev/null +++ b/win-install-exe.cmd @@ -0,0 +1,63 @@ +@echo off +setlocal ENABLEEXTENSIONS +echo. +echo Unlocker 3.0.2 for VMware Workstation +echo ===================================== +echo (c) Dave Parsons 2011-18 +echo. +echo Set encoding parameters... +chcp 850 + +net session >NUL 2>&1 +if %errorlevel% neq 0 ( + echo Administrator privileges required! + exit /b +) + +echo. +set KeyName="HKLM\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Player" +:: delims is a TAB followed by a space +for /F "tokens=2* delims= " %%A in ('REG QUERY %KeyName% /v InstallPath') do set InstallPath=%%B +echo VMware is installed at: %InstallPath% +for /F "tokens=2* delims= " %%A in ('REG QUERY %KeyName% /v ProductVersion') do set ProductVersion=%%B +echo VMware product version: %ProductVersion% + +pushd %~dp0 + +echo. +echo Stopping VMware services... +net stop vmware-view-usbd > NUL 2>&1 +net stop VMwareHostd > NUL 2>&1 +net stop VMAuthdService > NUL 2>&1 +net stop VMUSBArbService > NUL 2>&1 +taskkill /F /IM vmware-tray.exe > NUL 2>&1 + +echo. +echo Backing up files... +rd /s /q .\backup > NUL 2>&1 +mkdir .\backup +mkdir .\backup\x64 +xcopy /F /Y "%InstallPath%x64\vmware-vmx.exe" .\backup\x64 +xcopy /F /Y "%InstallPath%x64\vmware-vmx-debug.exe" .\backup\x64 +xcopy /F /Y "%InstallPath%x64\vmware-vmx-stats.exe" .\backup\x64 +xcopy /F /Y "%InstallPath%vmwarebase.dll" .\backup\ + +echo. +echo Patching... +.\unlocker.exe + +echo. +echo Getting VMware Tools... +.\gettools.exe +xcopy /F /Y .\tools\darwin*.* "%InstallPath%" + +echo. +echo Starting VMware services... +net start VMUSBArbService > NUL 2>&1 +net start VMAuthdService > NUL 2>&1 +net start VMwareHostd > NUL 2>&1 +net start vmware-view-usbd > NUL 2>&1 + +popd +echo. +echo Finished!