new version of PFTT

Former-commit-id: 6e253cdcbc61f7a1d7eb8b4914d2ad3d7056fbf8
This commit is contained in:
Matt Ficken
2012-10-19 17:20:16 -07:00
parent 156640260e
commit fe9dd9a736
1889 changed files with 410957 additions and 34030 deletions

27
.classpath Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/groovy-1.8.6.jar"/>
<classpathentry kind="lib" path="lib/icu4j-49_1.jar"/>
<classpathentry kind="lib" path="lib/icudata.jar"/>
<classpathentry kind="lib" path="lib/icutzdata.jar"/>
<classpathentry kind="lib" path="lib/j2ssh-common-0.2.9.jar"/>
<classpathentry kind="lib" path="lib/j2ssh-core-0.2.9.jar"/>
<classpathentry kind="lib" path="lib/jansi-1.7.jar"/>
<classpathentry kind="lib" path="lib/jline-0.9.94.jar"/>
<classpathentry kind="lib" path="lib/jzlib-1.0.7.jar"/>
<classpathentry kind="lib" path="lib/selenium-server-standalone-2.19.0.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="lib/xmlpull-1.1.3.1.jar"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="lib" path="lib/commons-net-3.1.jar"/>
<classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
<classpathentry kind="lib" path="lib/antlr-2.7.7.jar"/>
<classpathentry kind="lib" path="lib/asm-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-analysis-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-commons-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-tree-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-util-3.2.jar"/>
<classpathentry kind="output" path="build"/>
</classpath>

5
.directory Normal file
View File

@@ -0,0 +1,5 @@
[Dolphin]
Timestamp=2012,10,15,15,35,13
[Settings]
HiddenFilesShown=true

View File

@@ -6,12 +6,13 @@
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.dltk.ruby.core.nature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

36
LICENSE
View File

@@ -1,36 +0,0 @@
Copyright (c) 2010-2011, Microsoft Corporation
Copyright (c) 2011 Contributors
All rights reserved.
Contains code from the following open source libraries:
- Prototype (MIT-style license) http://prototypejs.org
- Copyright (c) 2005-2007 Sam Stephenson (http://conio.net)
- JS.js (MS-PL license) https://launchpad.net/jscript-toolkit
- Copyright (c) 2009 Microsoft Corporation (http://microsoft.com)
- Copyright (c) 2010 Garrett Serack (http://fearthecowboy.com)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Microsoft Corporation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
</buildpath>

View File

@@ -1,22 +0,0 @@
source 'http://rubygems.org' # LATER? local cache of dependencies (on PFTT Server)
gem 'rspec', '~> 2.3.0'
gem 'ZenTest', '~> 4.4.2'
gem 'activesupport'
#gem 'i18n' # required by ActiveSupport but bundler fails to see that dependency
gem 'mysql'
gem 'sqlite3-ruby'
gem 'typed-array'
gem 'net-ssh'
gem 'net-sftp'
gem 'pony'
gem 'abstract_class'
gem 'activerecord'
gem 'nokogiri'
gem 'rufus-scheduler'

View File

@@ -1,72 +0,0 @@
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.4.2)
abstract_class (0.0.2)
activemodel (3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activesupport (3.0.9)
arel (2.0.10)
builder (2.1.2)
diff-lcs (1.1.2)
i18n (0.5.0)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mysql (2.8.1)
mysql (2.8.1-x86-mingw32)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.2.1)
nokogiri (1.5.0)
nokogiri (1.5.0-x86-mingw32)
polyglot (0.3.2)
pony (1.3)
mail (> 2.0)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
rspec-mocks (~> 2.3.0)
rspec-core (2.3.1)
rspec-expectations (2.3.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.3.0)
rufus-scheduler (2.0.11)
tzinfo (>= 0.3.23)
sqlite3 (1.3.4)
sqlite3 (1.3.4-x86-mingw32)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
typed-array (0.1.2)
tzinfo (0.3.29)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
ZenTest (~> 4.4.2)
abstract_class
activerecord
activesupport
mysql
net-sftp
net-ssh
nokogiri
pony
rspec (~> 2.3.0)
rufus-scheduler
sqlite3-ruby
typed-array

View File

@@ -1,36 +0,0 @@
Copyright (c) 2010-2011, Microsoft Corporation
Copyright (c) 2011 Contributors
All rights reserved.
Contains code from the following open source libraries:
- Prototype (MIT-style license) http://prototypejs.org
- Copyright (c) 2005-2007 Sam Stephenson (http://conio.net)
- JS.js (MS-PL license) https://launchpad.net/jscript-toolkit
- Copyright (c) 2009 Microsoft Corporation (http://microsoft.com)
- Copyright (c) 2010 Garrett Serack (http://fearthecowboy.com)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Microsoft Corporation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,210 +0,0 @@
# emerge dev-db/mysql dev-db/postgresql-server net-ftp/vsftpd
$dep_server_share = '//terastation/share'
$dep_server_user = 'test'
$dep_server_password = 'password01!'
# --enable-debug-pack and make all will produce the .pdb symbol files
# --disable-zts will create a non-thread-safe build
$cross_platform_config_ops = ' --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd --enable-pdo --enable-openssl'
#
$windows_config_ops = ' --enable-debug-pack --disable-zts --enable-snapshot-build --enable-one-shot --with-extra-includes=%SYSTEMDRIVE%/php-sdk/deps/include --with-extra-libs=%SYSTEMDRIVE%/php-sdk/deps/lib'
$linux_config_ops = ' --enable-debug '
require 'rbconfig'
$is_windows = RbConfig::CONFIG['host_os'] =~ /mswin/ or RbConfig::CONFIG['host_os'] =~ /mingw/
def get_host(args)
Host::Local.new()
return Host.new # TODO
end
desc "Installs PFTT Server"
task :server_install =>[:install_deps] do
# generate pftt_server.bat or pftt_server
Rake::Task[:generate_shell_script].invoke('_pftt_server.rb')
puts 'PFTT-Server: installed'
puts 'PFTT-Server: run pftt_server to start PFTT Server'
puts
end
desc "Generates a Shell script or Batch script to run PFTT"
task :generate_shell_script, [:ruby_script] do |t, args|
if $is_windows
File.open("pftt.bat", "wb") do |f|
f.puts("@echo off")
# %* in batch scripts refers to all arguments
f.puts("bundle exec ruby #{args.ruby_script} %*")
f.close()
end
else
File.open("pftt", "wb") do |f|
f.puts("#!/bin/bash")
# $* in bash scripts refers to all arguments
f.puts("bundle exec ruby #{args.ruby_script} $*")
f.close()
# make script executable
system("chmod +x pftt")
end
end # if
end # task
desc "Installs things PFTT depends on"
task :install_deps do
unless RUBY_VERSION.to_f >= 1.9
puts 'PFTT: error: PFTT requires at least ruby 1.9'
exit
end
if not system("bundle install")
puts "PFTT: 'bundle install' failed!"
else
puts ""
puts "PFTT: ruby dependencies installed"
puts ""
end
end
require 'install.rb'
desc "Installs the PFTT Client"
task :install => [:host_install] do
Rake::Task[:generate_shell_script].invoke('_pftt.rb')
host = Host::Local.new()
# install git
install(host, 'git', 'git', "msysgit-v111", "/Q")
# add pftt to %PATH% or $PATH
add_to_path_permanently(host, __DIR__)
# install subversion client (needed to get php builds)
install(host, 'svn', 'svn', 'win32svn', "/Q")
puts 'PFTT: installation complete'
puts 'PFTT: run pftt to get started'
puts
end
# Later, PHPUnit support (for MediaWiki, etc...)
desc "Installs a remote or local PFTT Host"
task :host_install => [:install_deps] do
end
desc "Downloads PHPT Tests from PHP.net (SVN)"
task :get_tests do
# TODO args for branch and version
# store in pftt-phps directory
end
# TODO get php and/or tests from SVN, snapshot or release
# separate into folders so its clear
desc "Downloads PHP Binary from PHP.net"
task :get_php do
# TODO args for branch and version
# store in php-builds directory
#
# use php-revision-git RMTools
end
desc "Downloads newest PHP Binary from PHP.net"
task :get_newest_php, [:build] do |t, args|
host = get_host(args)
cd_php_sdk(host)
out, status = host.exec!('svn update')
if out.includes?('U ') or out.includes?('A ')
puts 'PFTT: Updated'
puts
else
puts 'PFTT: not updated'
puts
puts out
puts
end
end
require 'util.rb'
desc "Builds PHP binary from source code"
task :build_php, [:build] do |t, args|
host = get_host(args)
if host.windows?
# find Windows SDK
if host.exists?('%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v7.0\Bin')
add_to_path_temp('%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v7.0\Bin')
elsif host.exists?('%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v6.0\Bin')
add_to_path_temp('%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v6.0\Bin')
else
puts "PFTT: error: Can't find Windows SDK 6+ on Windows host. Therefore can't build PHP binary"
puts "PFTT: please install Windows SDK 6 from microsoft.com"
puts
exit(-20)
end
host.exec!("setenv /x86 /xp /release")
end
cd_php_sdk(host)
unless host.exist?(args.build)
puts "PFTT: build not found! #{args.build} in "+host.cwd
exit(-21)
end
host.delete('Release')
host.delete('Release_TS')
host.exec!("buildconf")
if host.windows?
out_err, status = host.exec!("configure #{$cross_platform_config_ops} #{$windows_config_ops}")
else
out_err, status = host.exec!("configure #{$cross_platform_config_ops} #{$linux_config_ops}")
end
unless status
puts 'PFTT: PHP Build configure failed!'
exit(-22)
end
if host.posix?
host.exec!("make snap")
else
host.exec!("nmake snap")
end
build_success = false
if $cross_platform_config_ops.include?('--disable-zts')
build_success = host.exist?('Release')
else
build_success = host.exist?('Release_TS')
end
if build_success
puts 'PFTT: PHP Binary Built Successfully: see '+host.cwd
puts
else
puts 'PFTT: error: failed to build PHP Binary: see '+host.cwd
puts
end
end
desc "Exports Test Results from SQLITE to a CSV File (can then import that into MS-Excel)"
task :export_csv, [:sqlite_file, :table_name, :csv_file] do |t, args|
# TODO
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,54 +0,0 @@
# PFTT Server
#
# Tasks
#
# (1) PSB
# (2) Lock Server
# (3) Network Monitoring/Reporting
# (4) Automatic FBC-D running
# (5) Automatic SVN updater
# (6) mysql database for results (use mysql server)
# (7) file serving for PHPTs, PHP builds and telemetry files (reuse Windows Filesharing or Samba)
require 'rufus-scheduler'
require 'webrick'
require "xmlrpc/server"
require 'util.rb'
require File.join(File.dirname(__FILE__),'bootstrap.rb')
$is_windows = RbConfig::CONFIG['host_os'].include?('mingw') or RbConfig::CONFIG['host_os'].include?('mswin')
generate_shell_script("pftt", "_pftt.rb")
generate_shell_script("pftt_server", "_pftt_server.rb")
localhost = Host::Local.new()
scheduler = Rufus::Scheduler.start_new
# run Lock Server
lock_server = XMLRPC::Server.new(65080)
lock_server.add_handler("PFTTv0", Server::LockServer.new)
lock_server.set_default_handler do |name, *args|
raise XMLRPC::FaultException.new(-99, "Method #{name} missing or wrong number of parameters!")
end
# Task 3
Server::NetworkReporter.new().schedule(scheduler)
# Task 4
Server::FBCDMailer.new().execute(scheduler)
# Task 5
Server::SVNUpdater.new(localhost).execute(scheduler)
# Task 2
Thread.start do
lock_server.serve
end
# Task 1 PSB
psb_server = WEBrick::HTTPServer.new(8080)
psb_server.mount("/", Web::PSB)
psb_server.start

Binary file not shown.

View File

@@ -1,15 +0,0 @@
#bootstrap.rb
require "rubygems"
require "bundler"
Bundler.setup
# Load up the monkeypatches
Dir.glob(File.join( File.dirname(__FILE__), 'lib/monkeypatch/**/*.rb')).reverse_each &method(:require)
require 'active_support/dependencies'
APPROOT = File.absolute_path( File.dirname( __FILE__ ) )
libdir = File.join( APPROOT, 'lib' )
ActiveSupport::Dependencies.autoload_paths << libdir
$: << libdir

View File

@@ -1,15 +0,0 @@
host:
path: config/definitions/host/
# filters:
# type: local
contexts:
path: config/definitions/context/
php:
dir: php-builds/*
filters:
platform: windows
compiler: VC9
middleware:
# filters:
# interface: cli
phpt:

View File

@@ -1,5 +0,0 @@
# runs php.exe from local file system, but runs PHPTs from remote SMB File Share stored on Buffalo Terastation NAS device
#
address: 10.200.51.33
username: test
password: test

View File

@@ -1 +0,0 @@
# directs PHP to use MySQL over SSL

View File

@@ -1 +0,0 @@
# directs PHP to use MySQL (over TCP instead of SSL)

View File

@@ -1,5 +0,0 @@
# run PHPTs and php.exe from remote SMB File Share stored on Buffalo Terastation NAS device
#
address: 10.200.51.33
username: test
password: test

View File

@@ -1,3 +0,0 @@
type: local
address: 127.0.0.1
platform: windows

View File

@@ -1,3 +0,0 @@
REM TODO configure git

View File

Binary file not shown.

View File

@@ -1,32 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: CmdAsAdmin.cmd
:: //
:: // Purpose: To provide a command to start a command prompt running "As
:: // Administrator" on Windows Vista.
:: //
:: // Additional requirement: "Elevate Command" PowerToy for Windows Vista
:: // must be installed
:: //
:: // Usage: CmdAsAdmin.cmd "<optional folder path>"
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo Off
if {%1}=={} (
Elevate.cmd "%SystemRoot%\system32\cmd.exe" /k
) else (
Elevate.cmd "%SystemRoot%\system32\cmd.exe" /k cd /d "%~1"
)

View File

@@ -1,39 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: CmdAsSystem.cmd
:: //
:: // Purpose: To provide a command to start a command prompt running under
:: // the System context on Windows Vista.
:: //
:: // Additional requirement: "Elevate Command" PowerToy for Windows Vista
:: // must be installed and Sysinternals Suite must
:: // be installed in %ProgramFiles%\Sysinternals Suite
:: //
:: // Usage: CmdAsSystem.cmd "<optional folder path>"
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo Off
if exist "%ProgramFiles%\Sysinternals Suite\psexec.exe" (
if {%1}=={} (
Elevate.cmd "%ProgramFiles%\Sysinternals Suite\psexec.exe" -i -s -d "%SystemRoot%\system32\cmd.exe" /k "(color ec & title "CMD Prompt as SYSTEM")"
) else (
Elevate.cmd "%ProgramFiles%\Sysinternals Suite\psexec.exe" -i -s -d "%SystemRoot%\system32\cmd.exe" /k "(cd /d "%~1" & color ec & title "CMD Prompt as SYSTEM")"
)
) else (
echo "Please install the Sysinternals Suite to "%ProgramFiles%\Sysinternals Suite".
pause
)

View File

@@ -1,75 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "CMD Prompt Here" PowerToy (with fixed uninstall)
; //
; // File: CmdHere.inf
; //
; // Purpose: To add a CMD Prompt Here entry to the Explorer context menu
; //
; // Version: 1.0.3
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 11/20/2006 Modified Windows Resource Kit version to fix the
; // uninstall.
; // 1.0.1 01/18/2007 Add /d switch to cd command. Added header.
; // 1.0.2 02/19/2007 Changed Registry Key name so that the command appears
; // next to the "CMD Prompt Here as Administrator"
; // PowerToy context menu entry.
; // 1.0.3 04/29/2008 Added DisplayVersion, DisplayIcon, and changed DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[CmdHereInstall]
CopyFiles = CmdHere.Files.Inf
AddReg = CmdHere.AddReg
[DefaultInstall]
CopyFiles = CmdHere.Files.Inf
AddReg = CmdHere.AddReg
[DefaultUnInstall]
DelFiles = CmdHere.Files.Inf
DelReg = CmdHere.DelReg
[SourceDisksNames]
55="CMD Prompt Here","",1
[SourceDisksFiles]
CmdHere.INF=55
[DestinationDirs]
CmdHere.Files.Inf = 17
[CmdHere.Files.Inf]
CmdHere.INF
[CmdHere.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\CmdHere.inf"
HKCR,Directory\Shell\rCmdHere,,,"%CmdHereAccel%"
HKCR,Directory\Shell\rCmdHere\command,,,"%11%\cmd.exe /k cd /d ""%1"""
HKCR,Drive\Shell\rCmdHere,,,"%CmdHereAccel%"
HKCR,Drive\Shell\rCmdHere\command,,,"%11%\cmd.exe /k cd /d ""%1"""
[CmdHere.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\rCmdHere
HKCR,Drive\Shell\rCmdHere
[Strings]
DisplayName="CMD Prompt Here PowerToy v1.0.3 (Uninstall only)"
DisplayVersion="1.0.3"
CmdHereAccel="CMD &Prompt Here"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\CmdHere"

View File

@@ -1,91 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "CMD Prompt Here as Administrator" PowerToy for Windows Vista
; //
; // File: CmdHereAsAdmin.inf
; //
; // Additional files required: CmdAsAdmin.cmd, ElevationPowertoys.ico
; //
; // Purpose: To add a "CMD Prompt Here as Administrator" entry to the
; // Explorer context menu for Windows Vista
; //
; // Additional requirement: "Elevate Command" PowerToy for Windows Vista
; // must be installed for CmdAsAdmin.cmd to work
; //
; // Version: 1.0.2
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/15/2006 Created initial version.
; // 1.0.1 01/18/2007 Add /d switch to cd command. Added header.
; // 1.0.2 04/29/2008 Added DisplayVersion, DisplayIcon, and version number
; // to DisplayName. Added installation of CmdAsAdmin.cmd.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[CmdHereAsAdminInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
CopyFiles = CmdHereAsAdmin.Files.System
CopyFiles = CmdHereAsAdmin.Files.Icon
AddReg = CmdHereAsAdmin.AddReg
[DefaultInstall]
CopyFiles = CmdHereAsAdmin.Files.Inf
CopyFiles = CmdHereAsAdmin.Files.System
CopyFiles = CmdHereAsAdmin.Files.Icon
AddReg = CmdHereAsAdmin.AddReg
[DefaultUnInstall]
DelFiles = CmdHereAsAdmin.Files.Inf
DelFiles = CmdHereAsAdmin.Files.System
DelReg = CmdHereAsAdmin.DelReg
[SourceDisksNames]
55="CMD Prompt Here as Administrator","",1
[SourceDisksFiles]
CmdHereAsAdmin.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
CmdHereAsAdmin.Files.Inf = 17
CmdHereAsAdmin.Files.System = 11
CmdHereAsAdmin.Files.Icon = 11
[CmdHereAsAdmin.Files.Inf]
CmdHereAsAdmin.INF
[CmdHereAsAdmin.Files.System]
CmdAsAdmin.cmd
[CmdHereAsAdmin.Files.Icon]
ElevationPowertoys.ico
[CmdHereAsAdmin.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\CmdHereAsAdmin.inf"
HKCR,Directory\Shell\runas,,,"%CmdHereAsAdminAccel%"
HKCR,Directory\Shell\runas\command,,,"%11%\cmd.exe /k cd /d ""%1"""
HKCR,Drive\Shell\runas,,,"%CmdHereAsAdminAccel%"
HKCR,Drive\Shell\runas\command,,,"%11%\cmd.exe /k cd /d ""%1"""
[CmdHereAsAdmin.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\runas
HKCR,Drive\Shell\runas
[Strings]
DisplayName="CMD Prompt Here as Administrator PowerToy for Windows Vista v1.0.2 (Uninstall only)"
DisplayVersion="1.0.2"
CmdHereAsAdminAccel="CMD Prompt Here as Administrator"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\CmdHereAsAdmin"

View File

@@ -1,91 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "CMD Prompt Here as System" PowerToy for Windows Vista
; //
; // File: CmdHereAsSystem.inf
; //
; // Additional files required: CmdAsSystem.cmd, ElevationPowertoys.ico
; //
; // Purpose: To add a "Cmd Prompt Here as System" entry to the Explorer
; // context menu for Windows Vista
; //
; // Additional requirement: "Elevate Command" PowerToy for Windows Vista
; // must be installed and Sysinternals Suite must
; // be installed in %ProgramFiles%\Sysinternals Suite
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[CmdHereAsSystemInstall]
CopyFiles = CmdHereAsSystem.Files.Inf
CopyFiles = CmdHereAsSystem.Files.System
CopyFiles = CmdHereAsSystem.Files.Icon
AddReg = CmdHereAsSystem.AddReg
[DefaultInstall]
CopyFiles = CmdHereAsSystem.Files.Inf
CopyFiles = CmdHereAsSystem.Files.System
CopyFiles = CmdHereAsSystem.Files.Icon
AddReg = CmdHereAsSystem.AddReg
[DefaultUnInstall]
DelFiles = CmdHereAsSystem.Files.Inf
DelFiles = CmdHereAsSystem.Files.System
DelReg = CmdHereAsSystem.DelReg
[SourceDisksNames]
55="CMD Prompt Here as System","",1
[SourceDisksFiles]
CmdHereAsSystem.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
CmdHereAsSystem.Files.Inf = 17
CmdHereAsSystem.Files.System = 11
CmdHereAsSystem.Files.Icon = 11
[CmdHereAsSystem.Files.Inf]
CmdHereAsSystem.INF
[CmdHereAsSystem.Files.System]
CmdAsSystem.cmd
[CmdHereAsSystem.Files.Icon]
ElevationPowertoys.ico
[CmdHereAsSystem.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\CmdHereAsSystem.inf"
HKCR,Directory\Shell\runCmdHereAsSystem,,,"%CmdHereAsSystemAccel%"
HKCR,Directory\Shell\runCmdHereAsSystem\command,,,"Elevate.cmd ""%16422%\Sysinternals Suite\psexec.exe"" -i -s -d ""%11%\cmd.exe"" /k ""(cd /d ""%1"" & color ec & title ""%%TitleText%% - %1"")"""
HKCR,Drive\Shell\runCmdHereAsSystem,,,"%CmdHereAsSystemAccel%"
HKCR,Drive\Shell\runCmdHereAsSystem\command,,,"Elevate.cmd ""%16422%\Sysinternals Suite\psexec.exe"" -i -s -d ""%11%\cmd.exe"" /k ""(cd /d ""%1"" & color ec & title ""%%TitleText%% - %1"")"""
[CmdHereAsSystem.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\runCmdHereAsSystem
HKCR,Drive\Shell\runCmdHereAsSystem
[Strings]
DisplayName="CMD Prompt Here as System PowerToy for Windows Vista v1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
CmdHereAsSystemAccel="CMD Prompt Here as System"
TitleText = "CMD Prompt as SYSTEM"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\CmdHereAsSystem"

Binary file not shown.

View File

@@ -1,76 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate AutoHotkey Script" PowerToy for Windows Vista
; //
; // File: ElevateAutoHotkey.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add a "Run as Administrator" entry to the Explorer context
; // menu for AutoHotkey scripts
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateAutoHotkeyInstall]
CopyFiles = ElevateAutoHotkey.Files.Inf
CopyFiles = ElevateAutoHotkey.Files.Icon
AddReg = ElevateAutoHotkey.AddReg
[DefaultInstall]
CopyFiles = ElevateAutoHotkey.Files.Inf
CopyFiles = ElevateAutoHotkey.Files.Icon
AddReg = ElevateAutoHotkey.AddReg
[DefaultUnInstall]
DelFiles = ElevateAutoHotkey.Files.Inf
DelReg = ElevateAutoHotkey.DelReg
[SourceDisksNames]
55="Elevate AutoHotkey Script","",1
[SourceDisksFiles]
ElevateAutoHotkey.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateAutoHotkey.Files.Inf = 17
ElevateAutoHotkey.Files.Icon = 11
[ElevateAutoHotkey.Files.Inf]
ElevateAutoHotkey.INF
[ElevateAutoHotkey.Files.Icon]
ElevationPowertoys.ico
[ElevateAutoHotkey.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateAutoHotkey.inf"
HKCR,AutoHotkeyScript\shell\runas
HKCR,AutoHotkeyScript\shell\runas\command,,,"""%16422%\AutoHotkey\AutoHotkey.exe"" ""%1"" %*"
[ElevateAutoHotkey.DelReg]
HKLM,%UDHERE%
HKCR,AutoHotkeyScript\shell\runas
[Strings]
DisplayName="Elevate AutoHotkey Script PowerToy for Windows Vista v1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateAutoHotkey"

View File

@@ -1,76 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate AutoIt v3 Script" PowerToy for Windows Vista
; //
; // File: ElevateAutoIt3.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add a "Run as Administrator" entry to the Explorer context
; // menu for AutoIt v3 scripts
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateAutoIt3Install]
CopyFiles = ElevateAutoIt3.Files.Inf
CopyFiles = ElevateAutoIt3.Files.Icon
AddReg = ElevateAutoIt3.AddReg
[DefaultInstall]
CopyFiles = ElevateAutoIt3.Files.Inf
CopyFiles = ElevateAutoIt3.Files.Icon
AddReg = ElevateAutoIt3.AddReg
[DefaultUnInstall]
DelFiles = ElevateAutoIt3.Files.Inf
DelReg = ElevateAutoIt3.DelReg
[SourceDisksNames]
55="Elevate AutoIt v3 Script","",1
[SourceDisksFiles]
ElevateAutoIt3.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateAutoIt3.Files.Inf = 17
ElevateAutoIt3.Files.Icon = 11
[ElevateAutoIt3.Files.Inf]
ElevateAutoIt3.INF
[ElevateAutoIt3.Files.Icon]
ElevationPowertoys.ico
[ElevateAutoIt3.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateAutoIt3.inf"
HKCR,AutoIt3Script\shell\runas
HKCR,AutoIt3Script\shell\runas\command,,,"""%16422%\AutoIt3\AutoIt3.exe"" ""%1"" %*"
[ElevateAutoIt3.DelReg]
HKLM,%UDHERE%
HKCR,AutoIt3Script\shell\runas
[Strings]
DisplayName="Elevate AutoIt v3 Script PowerToy for Windows Vista v1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateAutoIt3"

View File

@@ -1,85 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate Command" PowerToy for Windows Vista
; //
; // File: ElevateCommand.inf
; //
; // Additional files required: Elevate.cmd, Elevate.vbs, ElevationPowertoys.ico
; //
; // Purpose: To add a command line method of launching applications that
; // prompt for elevation (run as Administrator) to Windows
; // Vista.
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/02/2007 Created initial version.
; // 1.0.1 04/29/2008 Added DisplayVersion, DisplayIcon, and version number
; // to DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateCommandInstall]
CopyFiles = ElevateCommand.Files.Inf
CopyFiles = ElevateCommand.Files.System
CopyFiles = ElevateCommand.Files.Icon
AddReg = ElevateCommand.AddReg
[DefaultInstall]
CopyFiles = ElevateCommand.Files.Inf
CopyFiles = ElevateCommand.Files.System
CopyFiles = ElevateCommand.Files.Icon
AddReg = ElevateCommand.AddReg
[DefaultUnInstall]
DelFiles = ElevateCommand.Files.Inf
DelFiles = ElevateCommand.Files.System
DelReg = ElevateCommand.DelReg
[SourceDisksNames]
55="Elevate WSH Script","",1
[SourceDisksFiles]
ElevateCommand.INF=55
Elevate.cmd=55
Elevate.vbs=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateCommand.Files.Inf = 17
ElevateCommand.Files.System = 11
ElevateCommand.Files.Icon = 11
[ElevateCommand.Files.Inf]
ElevateCommand.INF
[ElevateCommand.Files.System]
Elevate.cmd
Elevate.vbs
[ElevateCommand.Files.Icon]
ElevationPowertoys.ico
[ElevateCommand.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateCommand.inf"
[ElevateCommand.DelReg]
HKLM,%UDHERE%
[Strings]
DisplayName="Elevate Command PowerToy for Windows Vista v1.0.1 (Uninstall only)"
DisplayVersion="1.0.1"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateCommand"

View File

@@ -1,78 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate HTML Application" PowerToy for Windows Vista
; //
; // File: ElevateHTA.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add a "Run as Administrator" entry to the Explorer context
; // menu for HTML Applications
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/02/2007 Created initial version.
; // 1.0.1 04/29/2008 Added DisplayVersion, DisplayIcon, and version number
; // to DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateHTAInstall]
CopyFiles = ElevateHTA.Files.Inf
CopyFiles = ElevateHTA.Files.Icon
AddReg = ElevateHTA.AddReg
[DefaultInstall]
CopyFiles = ElevateHTA.Files.Inf
CopyFiles = ElevateHTA.Files.Icon
AddReg = ElevateHTA.AddReg
[DefaultUnInstall]
DelFiles = ElevateHTA.Files.Inf
DelReg = ElevateHTA.DelReg
[SourceDisksNames]
55="Elevate HTA","",1
[SourceDisksFiles]
ElevateHTA.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateHTA.Files.Inf = 17
ElevateHTA.Files.Icon = 11
[ElevateHTA.Files.Inf]
ElevateHTA.INF
[ElevateHTA.Files.Icon]
ElevationPowertoys.ico
[ElevateHTA.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateHTA.inf"
HKCR,htafile\shell\runas
HKCR,htafile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\mshta.exe"" ""%1"" %*"
[ElevateHTA.DelReg]
HKLM,%UDHERE%
HKCR,htafile\shell\runas
[Strings]
DisplayName="Elevate HTML Application PowerToy for Windows Vista v1.0.2 (Uninstall only)"
DisplayVersion="1.0.2"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateHTA"

View File

@@ -1,78 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate KiXtart Script" PowerToy for Windows Vista
; //
; // File: ElevateKiXtart.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add a "Run as Administrator" entry to the Explorer context
; // menu for KiXtart scripts
; //
; // Additional requirement: KiXtart must be installed in %ProgramFiles%\KiXtart
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateKiXtartInstall]
CopyFiles = ElevateKiXtart.Files.Inf
CopyFiles = ElevateKiXtart.Files.Icon
AddReg = ElevateKiXtart.AddReg
[DefaultInstall]
CopyFiles = ElevateKiXtart.Files.Inf
CopyFiles = ElevateKiXtart.Files.Icon
AddReg = ElevateKiXtart.AddReg
[DefaultUnInstall]
DelFiles = ElevateKiXtart.Files.Inf
DelReg = ElevateKiXtart.DelReg
[SourceDisksNames]
55="Elevate KiXtart Script","",1
[SourceDisksFiles]
ElevateKiXtart.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateKiXtart.Files.Inf = 17
ElevateKiXtart.Files.Icon = 11
[ElevateKiXtart.Files.Inf]
ElevateKiXtart.INF
[ElevateKiXtart.Files.Icon]
ElevationPowertoys.ico
[ElevateKiXtart.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateKiXtart.inf"
HKCR,kixFile\shell\runas
HKCR,kixFile\shell\runas\command,,,"""%16422%\KiXtart\KIX32.EXE"" """%1""" %*"
[ElevateKiXtart.DelReg]
HKLM,%UDHERE%
HKCR,kixFile\shell\runas
[Strings]
DisplayName="Elevate KiXtart Script PowerToy for Windows Vista v.1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateKiXtart"

View File

@@ -1,89 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate Windows Installer Package" PowerToy for Windows Vista
; //
; // File: ElevateMSI.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add an "Install as Administrator" entry to the Explorer context
; // menu for Windows Installer packages (.msi) and "Apply Patch as
; // Administrator" for Windows Installer patches (.msp)
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 03/01/2007 Created initial version.
; // 1.0.1 04/29/2008 Changed Regsitry values to REG_EXPAND_SZ and changed
; // commands to better match the default open actions.
; // Added DisplayVersion, DisplayIcon, and version number
; // to DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateMSIInstall]
CopyFiles = ElevateMSI.Files.Inf
CopyFiles = ElevateMSI.Files.Icon
AddReg = ElevateMSI.AddReg
[DefaultInstall]
CopyFiles = ElevateMSI.Files.Inf
CopyFiles = ElevateMSI.Files.Icon
AddReg = ElevateMSI.AddReg
[DefaultUnInstall]
DelFiles = ElevateMSI.Files.Inf
DelReg = ElevateMSI.DelReg
[SourceDisksNames]
55="Elevate HTA","",1
[SourceDisksFiles]
ElevateMSI.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateMSI.Files.Inf = 17
ElevateMSI.Files.Icon = 11
[ElevateMSI.Files.Inf]
ElevateMSI.INF
[ElevateMSI.Files.Icon]
ElevationPowertoys.ico
[ElevateMSI.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateMSI.inf"
HKCR,Msi.Package\shell\runas
HKCR,Msi.Package\shell\runas,,,"%ElevateMSIAccel%"
HKCR,Msi.Package\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\msiexec.exe"" /i ""%1"" %*"
HKCR,Msi.Patch\shell\runas
HKCR,Msi.Patch\shell\runas,,,"%ElevateMSPAccel%"
HKCR,Msi.Patch\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\msiexec.exe"" /p ""%1"" %*"
[ElevateMSI.DelReg]
HKLM,%UDHERE%
HKCR,Msi.Package\shell\runas
HKCR,Msi.Patch\shell\runas
[Strings]
DisplayName="Elevate Windows Installer Package PowerToy for Windows Vista v1.0.1 (Uninstall only)"
DisplayVersion="1.0.1"
ElevateMSIAccel="Install as Administrator"
ElevateMSPAccel="Apply Patch as Administrator"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateMSI"

View File

@@ -1,88 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate Perl Script" PowerToy for Windows Vista
; //
; // File: ElevatePerlScript.inf
; //
; // Additional files required: Elevate.cmd, Elevate.vbs, ElevationPowertoys.ico
; //
; // Purpose: To add a Run as Administrator entry and a Run as Administrator
; // with Command Prompt entry to the Explorer context menu for
; // ActiveState Perl scripts
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevatePerlScriptInstall]
CopyFiles = ElevatePerlScript.Files.Inf
CopyFiles = ElevatePerlScript.Files.Icon
AddReg = ElevatePerlScript.AddReg
[DefaultInstall]
CopyFiles = ElevatePerlScript.Files.Inf
CopyFiles = ElevatePerlScript.Files.Icon
AddReg = ElevatePerlScript.AddReg
[DefaultUnInstall]
DelFiles = ElevatePerlScript.Files.Inf
DelReg = ElevatePerlScript.DelReg
[SourceDisksNames]
55="Elevate Perl Script","",1
[SourceDisksFiles]
ElevatePerlScript.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevatePerlScript.Files.Inf = 17
ElevatePerlScript.Files.Icon = 11
[ElevatePerlScript.Files.Inf]
ElevatePerlScript.INF
[ElevatePerlScript.Files.Icon]
ElevationPowertoys.ico
[ElevatePerlScript.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevatePerlScript.inf"
;Perl Files (.pl)
HKCR,Perl\shell\runas,,,"%ElevatePerlScriptAccel%"
HKCR,Perl\shell\runas\command,,0x00020000,"""%SystemDrive%\Perl\bin\perl.exe"" ""%1"" %*"
;PerlScript Files (.pls)
HKCR,PerlScriptFile\shell\runas,,,"%ElevatePerlScriptAccel%"
HKCR,PerlScriptFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,PerlScriptFile\shell\runas With Cscript,,,"%ElevatePerlScriptAccelCscript%"
HKCR,PerlScriptFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%11%\Cscript.exe"" ""%1"" %*"
[ElevatePerlScript.DelReg]
HKLM,%UDHERE%
HKCR,Perl\shell\runas
HKCR,PerlScriptFile\shell\runas
HKCR,PerlScriptFile\shell\runas With Cscript
[Strings]
DisplayName="Elevate Perl Script PowerToy for Windows Vista v1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
ElevatePerlScriptAccel="Run as Administrator"
ElevatePerlScriptAccelCscript="Run as Administrator with Command Prompt"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevatePerlScript"

View File

@@ -1,93 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate PowerShell v1.0 Script" PowerToy for Windows Vista
; //
; // File: ElevatePowerShellScript.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Purpose: To add a "Run as Administrator" entry to the Explorer context
; // menu for Windows PowerShell scripts. Also adds a "Run" entry.
; //
; // (*** Note: This PowerToy changes the default value to "Open" in
; // the Shell key for the PowerShell script object type,
; // Microsoft.PowerShellScript.1, in HKEY_CLASSES_ROOT to preserve
; // "Open" as the default action. If you have changed the default
; // action for PowerShell scripts, comment out the lines containing
; // "Open" in the ElevatePowerShellScript.AddReg and the
; // ElevatePowerShellScript.DelReg sections.)
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/02/2007 Created initial version.
; // 1.0.1 04/29/2008 Changed Regsitry values to REG_EXPAND_SZ and changed
; // commands to better match the default open actions.
; // Added DisplayVersion, DisplayIcon, and version number
; // to DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevatePowerShellScriptInstall]
CopyFiles = ElevatePowerShellScript.Files.Inf
CopyFiles = ElevatePowerShellScript.Files.Icon
AddReg = ElevatePowerShellScript.AddReg
[DefaultInstall]
CopyFiles = ElevatePowerShellScript.Files.Inf
CopyFiles = ElevatePowerShellScript.Files.Icon
AddReg = ElevatePowerShellScript.AddReg
[DefaultUnInstall]
DelFiles = ElevatePowerShellScript.Files.Inf
DelReg = ElevatePowerShellScript.DelReg
[SourceDisksNames]
55="Elevate PowerShell Script","",1
[SourceDisksFiles]
ElevatePowerShellScript.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevatePowerShellScript.Files.Inf = 17
ElevatePowerShellScript.Files.Icon = 11
[ElevatePowerShellScript.Files.Inf]
ElevatePowerShellScript.INF
[ElevatePowerShellScript.Files.Icon]
ElevationPowertoys.ico
[ElevatePowerShellScript.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevatePowerShellScript.inf"
HKCR,Microsoft.PowerShellScript.1\Shell,,,"Open"
HKCR,Microsoft.PowerShellScript.1\Shell\Run
HKCR,Microsoft.PowerShellScript.1\Shell\Run\command,,0x00020000,"""%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"" -NoExit -Command & '%L'"
HKCR,Microsoft.PowerShellScript.1\Shell\runas
HKCR,Microsoft.PowerShellScript.1\Shell\runas\command,,0x00020000,"""%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"" -NoExit -Command & '%L'"
[ElevatePowerShellScript.DelReg]
HKLM,%UDHERE%
HKCR,Microsoft.PowerShellScript.1\Shell,,,"Open"
HKCR,Microsoft.PowerShellScript.1\Shell\Run
HKCR,Microsoft.PowerShellScript.1\Shell\runas
[Strings]
DisplayName="Elevate PowerShell v1.0 Script PowerToy for Windows Vista v1.0.1 (Uninstall only)"
DisplayVersion="1.0.1"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevatePowerShellScript"

View File

@@ -1,133 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Elevate WSH Script" PowerToy for Windows Vista
; //
; // File: ElevateWSHScript.inf
; //
; // Additional files required: ElevationPowertoys.ico
; //
; // Additional requirement: "Elevate Command" PowerToy for Windows Vista
; // must be installed
; //
; // Purpose: To add a Run as Administrator entry and a Run as Administrator
; // with Command Prompt entry to the Explorer context menu for
; // Windows Script Host scripts
; //
; // Version: 1.0.2
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/02/2007 Created initial version.
; // 1.0.1 01/15/2007 Changed script installation folder name.
; // 1.0.2 04/29/2008 Removed install of Elevate.cmd & Elevate.vbs to
; // Program Files\Elevate WSH Script PowerToy. Changed
; // Regsitry values to REG_EXPAND_SZ and changed commands
; // to better match the default open actions. Added
; // DisplayVersion, DisplayIcon, and version number to
; // DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[ElevateWSHScriptInstall]
CopyFiles = ElevateWSHScript.Files.Inf
CopyFiles = ElevateWSHScript.Files.Icon
AddReg = ElevateWSHScript.AddReg
[DefaultInstall]
CopyFiles = ElevateWSHScript.Files.Inf
CopyFiles = ElevateWSHScript.Files.Icon
AddReg = ElevateWSHScript.AddReg
[DefaultUnInstall]
DelFiles = ElevateWSHScript.Files.Inf
DelReg = ElevateWSHScript.DelReg
[SourceDisksNames]
55="Elevate WSH Script","",1
[SourceDisksFiles]
ElevateWSHScript.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
ElevateWSHScript.Files.Inf = 17
ElevateWSHScript.Files.Icon = 11
[ElevateWSHScript.Files.Inf]
ElevateWSHScript.INF
[ElevateWSHScript.Files.Icon]
ElevationPowertoys.ico
[ElevateWSHScript.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\ElevateWSHScript.inf"
;VBScript Files (.vbs)
HKCR,VBSFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,VBSFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,VBSFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,VBSFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
;Encoded VBScript Files (.vbe)
HKCR,VBEFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,VBEFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,VBEFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,VBEFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
;JavaScript Files (.js)
HKCR,JSFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,JSFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,JSFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,JSFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
;Encoded JavaScript Files (.jse)
HKCR,JSEFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,JSEFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,JSEFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,JSEFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
;Windows Script Host Files (.wsf)
HKCR,WSFFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,WSFFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,WSFFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,WSFFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
;Windows Script Host Files (.wsh)
HKCR,WSHFile\shell\runas,,,"%ElevateWSHScriptAccel%"
HKCR,WSHFile\shell\runas\command,,0x00020000,"""%SystemRoot%\System32\Wscript.exe"" ""%1"" %*"
HKCR,WSHFile\shell\runas With Cscript,,,"%ElevateWSHScriptAccelCscript%"
HKCR,WSHFile\shell\runas With Cscript\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\Cscript.exe"" ""%1"" %*"
[ElevateWSHScript.DelReg]
HKLM,%UDHERE%
HKCR,VBSFile\shell\runas
HKCR,VBSFile\shell\runas With Cscript
HKCR,VBEFile\shell\runas
HKCR,VBEFile\shell\runas With Cscript
HKCR,JSFile\shell\runas
HKCR,JSFile\shell\runas With Cscript
HKCR,JSEFile\shell\runas
HKCR,JSEFile\shell\runas With Cscript
HKCR,WSFFile\shell\runas
HKCR,WSFFile\shell\runas With Cscript
HKCR,WSHFile\shell\runas
HKCR,WSHFile\shell\runas With Cscript
[Strings]
DisplayName="Elevate WSH Script PowerToy for Windows Vista v1.0.2 (Uninstall only)"
DisplayVersion="1.0.2"
ElevateWSHScriptAccel="Run as Administrator"
ElevateWSHScriptAccelCscript="Run as Administrator with Command Prompt"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\ElevateWSHScript"

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,165 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: InstallAllPowerToys.cmd
:: //
:: // Additional files required: Elevate.cmd, Elevate.vbs
:: //
:: // Purpose: To provide a method installing all Elevation PowerToys
:: // in a scripted manner.
:: //
:: // Usage: InstallAllPowerToys.cmd
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo off
if {%*}=={%~dp0} goto CONTINUE_SCRIPT
echo Re-Launching script as administrator, Please click allow or continue button from the following prompt to elevate
call elevate.cmd "%~dpnx0" %~dp0
pause
goto :EOF
:CONTINUE_SCRIPT
cd \
cd "%*"
echo continuing InstallAllPowerToys.cmd
:: *************************************************************
:: *** Section 0 - Variables to control installation
:: *************************************************************
:: Set this variable to 1 to install PowerShell-related PowerToys
set INSTALL_POWERSHELL_TOYS=1
:: Set this variable to 1 to install "Prompt Here as System" PowerToys
:: These require that the Sysinternals Suite has been installed using
:: Install_SysinternalsSuite.inf
set INSTALL_SYSTEM_TOYS=1
:: Set this variable to 1 to install Third Party Script PowerToys
set INSTALL_THIRD_PARTY_TOYS=0
:: *************************************************************
:: *** Section I - Install Elevate Command PowerToy
:: *************************************************************
:: I-A: "Elevate Command" PowerToy
echo Installing "Elevate Command" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateCommand.inf"
:: *************************************************************
:: *** Section II - Install CMD Prompt PowerToys
:: *************************************************************
:: II-A: "CMD Prompt Here" PowerToy
echo Installing "CMD Prompt Here" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\CmdHere.inf"
:: II-B: "CMD Prompt Here as Administrator" PowerToy
echo Installing "CMD Prompt Here as Administrator" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\CmdHereAsAdmin.inf"
if {%INSTALL_SYSTEM_TOYS%}=={1} (
:: II-C: "CMD Prompt Here as System" PowerToy
echo Installing "CMD Prompt Here as System" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\CmdHereAsSystem.inf"
)
:: *************************************************************
:: *** Section III - Install Windows PowerShell Prompt PowerToys
:: *************************************************************
if {%INSTALL_POWERSHELL_TOYS%}=={1} (
:: III-A: "PowerShell Prompt Here" PowerToy
echo Installing "PowerShell Prompt Here" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\PowerShellHere.inf"
:: III-B: "PowerShell Prompt Here as Administrator" PowerToy
echo Installing "PowerShell Prompt Here as Administrator" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\PowerShellHereAsAdmin.inf"
if {%INSTALL_SYSTEM_TOYS%}=={1} (
:: III-C: "PowerShell Prompt Here as System" PowerToy
echo Installing "PowerShell Prompt Here as System" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\PowerShellHereAsSystem.inf"
)
)
:: *************************************************************
:: *** Section IV - Install Windows Script PowerToys
:: *************************************************************
:: IV-A: "Elevate WSH Script" PowerToy
echo Installing "Elevate WSH Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateWSHScript.inf"
if {%INSTALL_POWERSHELL_TOYS%}=={1} (
:: IV-B: "Elevate PowerShell v1.0 Script" PowerToy
echo Installing "Elevate PowerShell v1.0 Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevatePowerShellScript.inf"
)
:: IV-C: "Elevate HTML Application" PowerToy
echo Installing "Elevate HTML Application" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateHTA.inf"
:: *************************************************************
:: *** Section V - Install Windows Installer PowerToy
:: *************************************************************
:: V-A: "Elevate Windows Installer Package" PowerToy
echo Installing "Elevate Windows Installer Package" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateMSI.inf"
:: *************************************************************
:: *** Section VI - Install Third Party Script PowerToys
:: *************************************************************
if {%INSTALL_THIRD_PARTY_TOYS%}=={1} (
:: VI-A: "Elevate AutoIt v3 Script" PowerToy
echo Installing "Elevate AutoIt v3 Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateAutoIt3.inf"
:: VI-A: "Elevate AutoHotkey Script" PowerToy
echo Installing "Elevate AutoHotkey Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateAutoHotkey.inf"
:: VI-A: "Elevate Perl Script" PowerToy
echo Installing "Elevate Perl Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevatePerlScript.inf"
:: VI-A: "Elevate KiXtart Script" PowerToy
echo Installing "Elevate KiXtart Script" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\ElevateKiXtart.inf"
)
:: *************************************************************
:: *** Section VII - Install Run As Another User PowerToy
:: *************************************************************
:: VII-A: "Run As Another User" PowerToy
echo Installing "Run As Another User" PowerToy
"%SystemRoot%\System32\InfDefaultInstall.exe" "%cd%\RunAs.inf"
:: *************************************************************
:: *** Section VIII - Install Elevation Gadget
:: *************************************************************
:: VIII-A: Elevation Gadget
echo Installing Elevation Gadget
"%cd%\Elevation.gadget"
pause

View File

@@ -1,178 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // KiXtart 2010 INF Installer
; //
; // File: Install_KiXtart.inf
; //
; // Purpose: Install Kixtart 2010 v4.60
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
signature="$CHICAGO$"
[KiXtartInstall]
CopyFiles = KiXtart.Files.Inf
CopyFiles = KiXtart.Files.ProgramFiles
CopyFiles = KiXtart.Files.ProgramFilesSamples
AddReg = KiXtart.AddReg
UpdateInis = KiXtart.Links
[DefaultInstall]
CopyFiles = KiXtart.Files.Inf
CopyFiles = KiXtart.Files.ProgramFiles
CopyFiles = KiXtart.Files.ProgramFilesSamples
AddReg = KiXtart.AddReg
UpdateInis = KiXtart.Links
[DefaultUnInstall]
DelFiles = KiXtart.Files.Inf
DelFiles = KiXtart.Files.ProgramFiles
DelFiles = KiXtart.Files.ProgramFilesSamples
DelReg = KiXtart.DelReg
AddReg = KiXtart.Once.UnInst.Reg
UpdateInis = KiXtart.Links.Remove
[SourceDisksNames]
55="Elevate WSH Script","",1
[SourceDisksFiles]
Install_KiXtart.inf=55
kix2010.doc=55
kix2010.txt=55
KIX32.EXE=55
KiXtart.dll=55
WKIX32.EXE=55
adaams.spk=55,\Samples
adsi01.kix=55,\Samples
adsi02.kix=55,\Samples
adsi03.kix=55,\Samples
agent.kix=55,\Samples
bouree.spk=55,\Samples
cabaret.spk=55,\Samples
chimes.wav=55,\Samples
delkey.kix=55,\Samples
demo.kix=55,\Samples
Demo.xls=55,\Samples
demo2.kix=55,\Samples
enumdir.kix=55,\Samples
enumkeys.kix=55,\Samples
excel.kix=55,\Samples
fly.kix=55,\Samples
getdrvs.kix=55,\Samples
getip.kix=55,\Samples
jbond.spk=55,\Samples
kick.kix=55,\Samples
kixtart.kix=55,\Samples
macros.vbs=55,\Samples
plt.kix=55,\Samples
recur.kix=55,\Samples
runkix.vbs=55,\Samples
test.kix=55,\Samples
treksong.spk=55,\Samples
[DestinationDirs]
KiXtart.Files.Inf = 17
KiXtart.Files.ProgramFiles = 16422,KiXtart
KiXtart.Files.ProgramFilesSamples = 16422,KiXtart\Samples
[KiXtart.Files.Inf]
Install_KiXtart.inf
[KiXtart.Files.ProgramFiles]
kix2010.doc
kix2010.txt
KIX32.EXE
KiXtart.dll
WKIX32.EXE
[KiXtart.Files.ProgramFilesSamples]
adaams.spk
adsi01.kix
adsi02.kix
adsi03.kix
agent.kix
bouree.spk
cabaret.spk
chimes.wav
delkey.kix
demo.kix
Demo.xls
demo2.kix
enumdir.kix
enumkeys.kix
excel.kix
fly.kix
getdrvs.kix
getip.kix
jbond.spk
kick.kix
kixtart.kix
macros.vbs
plt.kix
recur.kix
runkix.vbs
test.kix
treksong.spk
[KiXtart.Once.UnInst.Reg]
HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,KiXtart,,"%11%\cmd.exe /c rd /s /q ""%16422%\KiXtart"""
[KiXtart.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\Install_KiXtart.inf"
HKCR,.kix,,,"kixFile"
HKCR,kixFile\shell,,,"Run"
HKCR,kixFile\shell\Edit
HKCR,kixFile\shell\Edit\command,,,"""%11%\notepad.exe"" ""%1"""
HKCR,kixFile\shell\Run,,,"%KiXtartAccel%"
HKCR,kixFile\shell\Run\command,,,"""%16422%\KiXtart\KIX32.EXE"" """%1""" %*"
HKCR,kixFile\shell\Run without console,,,"%KiXtartAccelNoConsole%"
HKCR,kixFile\shell\Run without console\command,,,"""%16422%\KiXtart\WKIX32.EXE"" """%1""" %*"
[KiXtart.DelReg]
HKLM,%UDHERE%
HKCR,kixFile\shell,""
HKCR,kixFile\shell\Edit
HKCR,kixFile\shell\Run
HKCR,kixFile\shell\Run without console
[KiXtart.Links]
setup.ini, progman.groups,,""group1="%16407%\%KiXtartGroup%\"""
setup.ini, group1,,"""%KiXtartDoc%"",""""""%16422%\KiXtart\kix2010.doc"""""""
setup.ini, group1,,"""%KiXtartReleaseNotes%"",""""""%16422%\KiXtart\kix2010.txt"""""""
setup.ini, group1,,"""%KiXtartCmdPrompt%"",""""""%11%\cmd.exe"""" /k cd /d """"%16422%\KiXtart"""""",,,,""%16422%\KiXtart"",""%KiXtartCmdPrompt%"""
setup.ini, group1,,"""%KiXtartSamples%"",""""""%16422%\KiXtart\Samples"""""""
[KiXtart.Links.Remove]
setup.ini, progman.groups,,""group1="%16407%\%KiXtartGroup%"""
setup.ini, group1,,"""%KiXtartDoc%"""
setup.ini, group1,,"""%KiXtartReleaseNotes%""
setup.ini, group1,,"""%KiXtartCmdPrompt%""
setup.ini, group1,,"""%KiXtartSamples%""
[Strings]
DisplayName="KiXtart 2010 v4.60 (Uninstall only)"
DisplayVersion="4.60"
KiXtartAccel="Run"
KiXtartAccelNoConsole="Run without console"
KiXtartGroup="KiXtart 2010"
KiXtartDoc="KiXtart 2010 Documentation"
KiXtartReleaseNotes="Realease Notes"
KiXtartSamples="Samples"
KiXtartCmdPrompt="KiXtart Command Prompt
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\KiXtart"

View File

@@ -1,286 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // Sysinternals Suite INF Installer
; //
; // File: Install_SysinternalsSuite.inf
; //
; // Purpose: Installs the Sysinternals Suite
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 02/09/2008 Created initial version for Sysinternals Suite -
; // Published: February 8, 2008
; // 1.0.1 02/26/2008 Updated for Sysinternals Suite - Published: February
; // 26, 2008. (ShellRunas added to Suite.)
; // 1.0.2 04/29/2008 No change, just validated for Sysinternals Suite -
; // Published: April 17, 2008.
; //
; // ***** End Header *****
; //***************************************************************************
[Version]
Signature="$Windows NT$"
[SysinternalsSuiteInstall]
CopyFiles = SysinternalsSuite.Files.Inf
CopyFiles = SysinternalsSuite.Files.ProgramFiles
CopyFiles = SysinternalsSuite.Files.ProgramFiles.ShellRunas
AddReg = SysinternalsSuite.AddReg, SysinternalsSuite.Once.Reg
UpdateInis = SysinternalsSuite.Links
[DefaultInstall]
CopyFiles = SysinternalsSuite.Files.Inf
CopyFiles = SysinternalsSuite.Files.ProgramFiles
CopyFiles = SysinternalsSuite.Files.ProgramFiles.ShellRunas
AddReg = SysinternalsSuite.AddReg, SysinternalsSuite.Once.Reg
UpdateInis = SysinternalsSuite.Links
[DefaultUnInstall]
DelFiles = SysinternalsSuite.Files.Inf
DelFiles = SysinternalsSuite.Files.ProgramFiles
DelReg = SysinternalsSuite.DelReg
AddReg = SysinternalsSuite.Once.UnInst.Reg
UpdateInis = SysinternalsSuite.Links.Remove
[SourceDisksNames]
55="Windows Sysinternals Suite","",1
[SourceDisksFiles]
Install_SysinternalsSuite.inf=55
[DestinationDirs]
SysinternalsSuite.Files.Inf = 17
SysinternalsSuite.Files.ProgramFiles = 16422,Sysinternals Suite
SysinternalsSuite.Files.ProgramFiles.ShellRunas = 16422,Sysinternals Suite
[SysinternalsSuite.Files.Inf]
Install_SysinternalsSuite.inf
[SysinternalsSuite.Files.ProgramFiles]
accesschk.exe
AccessEnum.exe
AdExplorer.chm
ADExplorer.exe
ADInsight.chm
ADInsight.exe
adrestore.exe
Autologon.exe
autoruns.chm
autoruns.exe
autorunsc.exe
Bginfo.exe
Cacheset.exe
Clockres.exe
Contig.exe
ctrl2cap.amd.sys
ctrl2cap.exe
ctrl2cap.nt4.sys
ctrl2cap.nt5.sys
dbgview.chm
Dbgview.exe
diskext.exe
Diskmnt.exe
Diskmnt.hlp
Diskmon.exe
DISKMON.HLP
DiskView.exe
DMON.SYS
du.exe
efsdump.exe
Eula.txt
Filemon.exe
FILEMON.HLP
handle.exe
hex2dec.exe
junction.exe
ldmdump.exe
Listdlls.exe
livekd.exe
LoadOrd.exe
logonsessions.exe
movefile.exe
newsid.exe
ntfsinfo.exe
pagedfrg.exe
pagedfrg.hlp
pdh.dll
pendmoves.exe
PHYSMEM.EXE
pipelist.exe
PORTMON.CNT
portmon.exe
PORTMON.HLP
procexp.chm
procexp.exe
ProcFeatures.exe
procmon.chm
Procmon.exe
psexec.exe
psfile.exe
psgetsid.exe
Psinfo.exe
pskill.exe
pslist.exe
psloggedon.exe
psloglist.exe
pspasswd.exe
psservice.exe
psshutdown.exe
pssuspend.exe
Pstools.chm
psversion.txt
RegDelNull.exe
Reghide.exe
regjump.exe
Regmon.exe
REGMON.HLP
RootkitRevealer.chm
RootkitRevealer.exe
sdelete.exe
ShareEnum.exe
sigcheck.exe
streams.exe
strings.exe
sync.exe
tcpvcon.exe
tcpview.chm
Tcpview.exe
TCPVIEW.HLP
Volumeid.exe
whois.exe
Winobj.exe
WINOBJ.HLP
ZoomIt.exe
[SysinternalsSuite.Files.ProgramFiles.ShellRunas]
ShellRunas.exe
[SysinternalsSuite.Once.Reg]
HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,ShellRunasReg,,"""%16422%\Sysinternals Suite\ShellRunas.exe"" /reg /quiet"
HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,ShellRunasRegNetOnly,,"""%16422%\Sysinternals Suite\ShellRunas.exe"" /regnetonly /quiet"
[SysinternalsSuite.Once.UnInst.Reg]
HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,SysinternalsSuite,,"%11%\cmd.exe /c echo on & ""%16422%\Sysinternals Suite\ShellRunas.exe"" /unreg /quiet & if exist ""%windir%\system32\timeout.exe"" timeout /T 3 & rd /s /q ""%16422%\Sysinternals Suite"""
[SysinternalsSuite.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\Install_SysinternalsSuite.inf"
[SysinternalsSuite.DelReg]
HKLM,%UDHERE%
[SysinternalsSuite.Links]
setup.ini, progman.groups,,""group1="%16407%\%SysinternalsSuiteGroup%\"""
setup.ini, group1,,"""%SysinternalsSuiteCmdPrompt%"",""""""%11%\cmd.exe"""" /k cd /d """"%16422%\Sysinternals Suite"""""",,,,""%16422%\Sysinternals Suite"",""%SysinternalsSuiteCmdPrompt%"""
setup.ini, group1,,"""%SysinternalsSuiteURL%"",""""""%16422%\Internet Explorer\iexplore.exe"""" """"http://www.microsoft.com/technet/sysinternals/utilities/sysinternalssuite.mspx"""""",""%16422%\Internet Explorer\iexplore.exe"",1,,""%HOMEDRIVE%%HOMEPATH%"",""%SysinternalsSuiteURL%"""
setup.ini, group1,,"""%AccessEnumDesc%"",""""""%16422%\Sysinternals Suite\AccessEnum.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%AccessEnumDesc%"""
setup.ini, group1,,"""%AdExplorerDesc%"",""""""%16422%\Sysinternals Suite\AdExplorer.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%AdExplorerDesc%"""
setup.ini, group1,,"""%AutologonDesc%"",""""""%16422%\Sysinternals Suite\Autologon.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%AutologonDesc%"""
setup.ini, group1,,"""%ADInsightDesc%"",""""""%16422%\Sysinternals Suite\ADInsight.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%ADInsightDesc%"""
setup.ini, group1,,"""%AutorunsDesc%"",""""""%16422%\Sysinternals Suite\Autoruns.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%AutorunsDesc%"""
setup.ini, group1,,"""%BginfoDesc%"",""""""%16422%\Sysinternals Suite\Bginfo.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%BginfoDesc%"""
setup.ini, group1,,"""%DbgviewDesc%"",""""""%16422%\Sysinternals Suite\Dbgview.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%DbgviewDesc%"""
setup.ini, group1,,"""%DiskmonDesc%"",""""""%16422%\Sysinternals Suite\Diskmon.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%DiskmonDesc%"""
setup.ini, group1,,"""%DiskViewDesc%"",""""""%16422%\Sysinternals Suite\DiskView.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%DiskViewDesc%"""
setup.ini, group1,,"""%LoadOrdDesc%"",""""""%16422%\Sysinternals Suite\LoadOrd.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%LoadOrdDesc%"""
setup.ini, group1,,"""%ProcexpDesc%"",""""""%16422%\Sysinternals Suite\procexp.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%ProcexpDesc%"""
setup.ini, group1,,"""%ProcmonDesc%"",""""""%16422%\Sysinternals Suite\Procmon.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%ProcmonDesc%"""
setup.ini, group1,,"""%RootkitRevealerDesc%"",""""""%16422%\Sysinternals Suite\RootkitRevealer.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%RootkitRevealerDesc%"""
setup.ini, group1,,"""%TcpviewDesc%"",""""""%16422%\Sysinternals Suite\Tcpview.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%TcpviewDesc%"""
setup.ini, group1,,"""%WinobjDesc%"",""""""%16422%\Sysinternals Suite\Winobj.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%WinobjDesc%"""
setup.ini, group1,,"""%ZoomItDesc%"",""""""%16422%\Sysinternals Suite\ZoomIt.exe"""""",,,,""""%16422%\Sysinternals Suite"""",""%ZoomItDesc%"""
setup.ini, progman.groups,,""group2="%16407%\%SysinternalsSuiteGroup%\%SysinternalsSuiteDocs%\"""
setup.ini, group2,,"""%PsToolsHelp%"",""""""%16422%\Sysinternals Suite\PsTools.chm"""""""
setup.ini, group2,,"""%AdExplorerHelp%"",""""""%16422%\Sysinternals Suite\AdExplorer.chm"""""""
setup.ini, group2,,"""%ADInsightHelp%"",""""""%16422%\Sysinternals Suite\ADInsight.chm"""""""
setup.ini, group2,,"""%AutorunsHelp%"",""""""%16422%\Sysinternals Suite\Autoruns.chm"""""""
setup.ini, group2,,"""%DbgviewHelp%"",""""""%16422%\Sysinternals Suite\Dbgview.chm"""""""
setup.ini, group2,,"""%DiskmonHelp%"",""""""%16422%\Sysinternals Suite\Diskmon.hlp"""""""
setup.ini, group2,,"""%ProcexpHelp%"",""""""%16422%\Sysinternals Suite\Procexp.chm"""""""
setup.ini, group2,,"""%ProcmonHelp%"",""""""%16422%\Sysinternals Suite\Procexp.chm"""""""
setup.ini, group2,,"""%RootkitRevealerHelp%"",""""""%16422%\Sysinternals Suite\RootkitRevealer.chm"""""""
setup.ini, group2,,"""%TcpviewHelp%"",""""""%16422%\Sysinternals Suite\Tcpview.chm"""""""
setup.ini, group2,,"""%WinobjHelp%"",""""""%16422%\Sysinternals Suite\Winobj.hlp"""""""
[SysinternalsSuite.Links.Remove]
setup.ini, progman.groups,,""group1="%16407%\%SysinternalsSuiteGroup%"""
setup.ini, group1,,"""%SysinternalsSuiteCmdPrompt%"""
setup.ini, group1,,"""%SysinternalsSuiteURL%""
setup.ini, group1,,"""%AccessEnumDesc%""
setup.ini, group1,,"""%AdExplorerDesc%""
setup.ini, group1,,"""%AutologonDesc%""
setup.ini, group1,,"""%ADInsightDesc%""
setup.ini, group1,,"""%AutorunsDesc%""
setup.ini, group1,,"""%BginfoDesc%""
setup.ini, group1,,"""%DbgviewDesc%""
setup.ini, group1,,"""%DiskmonDesc%""
setup.ini, group1,,"""%DiskViewDesc%""
setup.ini, group1,,"""%LoadOrdDesc%""
setup.ini, group1,,"""%ProcexpDesc%""
setup.ini, group1,,"""%ProcmonDesc%""
setup.ini, group1,,"""%RootkitRevealerDesc%""
setup.ini, group1,,"""%TcpviewDesc%""
setup.ini, group1,,"""%WinobjDesc%""
setup.ini, group1,,"""%ZoomItDesc%""
setup.ini, progman.groups,,""group2="%16407%\%SysinternalsSuiteGroup%\%SysinternalsSuiteDocs%\"""
setup.ini, group2,,"""%PsToolsHelp%"""
setup.ini, group2,,"""%AdExplorerHelp%""
setup.ini, group2,,"""%ADInsightHelp%""
setup.ini, group2,,"""%AutorunsHelp%""
setup.ini, group2,,"""%DbgviewHelp%""
setup.ini, group2,,"""%DiskmonHelp%""
setup.ini, group2,,"""%ProcexpHelp%""
setup.ini, group2,,"""%ProcmonHelp%""
setup.ini, group2,,"""%RootkitRevealerHelp%""
setup.ini, group2,,"""%TcpviewHelp%""
setup.ini, group2,,"""%WinobjHelp%""
[Strings]
DisplayName = "Sysinternals Suite (Uninstall only)"
SysinternalsSuiteGroup = "Sysinternals Suite"
SysinternalsSuiteCmdPrompt = "Sysinternals Suite Command Prompt"
SysinternalsSuiteURL = "Sysinternals Suite Web Page"
AccessEnumDesc = "AccessEnum"
AdExplorerDesc = "Active Directory Explorer"
AutologonDesc = "Autologon for Windows"
ADInsightDesc = "Insight for Active Directory"
AutorunsDesc = "AutoRuns for Windows"
BginfoDesc = "Bginfo"
DbgviewDesc = "DebugView for Windows"
DiskmonDesc = "DiskMon for Windows"
DiskViewDesc = "DiskView"
LoadOrdDesc = "LoadOrder"
ProcexpDesc = "Process Explorer"
ProcmonDesc = "Process Monitor"
RootkitRevealerDesc = "RootkitRevealer"
TcpviewDesc = "TCPView for Windows"
WinobjDesc = "WinObj"
ZoomItDesc = "ZoomIt"
SysinternalsSuiteDocs = "Documentation"
PsToolsHelp = "PsTools Help"
AdExplorerHelp = "Active Directory Explorer Help"
ADInsightHelp = "Insight for Active Directory Help"
AutorunsHelp = "AutoRuns for Windows Help"
DbgviewHelp = "DebugView for Windows Help"
DiskmonHelp = "DiskMon for Windows Help"
ProcexpHelp = "Process Explorer Help"
ProcmonHelp = "Process Monitor Help"
RootkitRevealerHelp = "RootkitRevealerDesc Help"
TcpviewHelp = "TCPView for Windows Help"
WinobjHelp = "WinObj Help"
UDHERE = "Software\Microsoft\Windows\CurrentVersion\Uninstall\SysinternalsSuite"

View File

@@ -1,32 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: PSAsAdmin.cmd
:: //
:: // Purpose: To provide a command to start a Windows Power Shell prompt "As
:: // Administrator" on Windows Vista.
:: //
:: // Additional requirement: "Elevate Command" PowerToy for Windows Vista
:: // must be installed
:: //
:: // Usage: PSAsAdmin.cmd "<optional folder path>"
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo Off
if {%1}=={} (
Elevate.cmd "%SystemRoot%\system32\windowspowershell\v1.0\powershell.exe" -NoExit -Command $host.ui.rawui.windowtitle = 'Administrator: ' + $host.ui.rawui.windowtitle
) else (
Elevate.cmd "%SystemRoot%\system32\windowspowershell\v1.0\powershell.exe" -NoExit -Command Set-Location -LiteralPath '%~1'; $host.ui.rawui.windowtitle = 'Administrator: ' + $host.ui.rawui.windowtitle
)

View File

@@ -1,38 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: PSAsSystem.cmd
:: //
:: // Purpose: To provide a command to start a Windows Power Shell prompt running
:: // under the System context on Windows Vista.
:: //
:: // Additional requirement: "Elevate Command" PowerToy for Windows Vista
:: // must be installed and Sysinternals Suite must
:: // be installed in %ProgramFiles%\Sysinternals Suite
:: //
:: // Usage: PSAsSystem.cmd "<optional folder path>"
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo Off
if exist "%ProgramFiles%\Sysinternals Suite\psexec.exe" (
if {%1}=={} (
Elevate.cmd "%ProgramFiles%\Sysinternals Suite\psexec.exe" -i -s -d "%SystemRoot%\system32\windowspowershell\v1.0\powershell.exe" -NoExit $host.ui.rawui.windowtitle = 'Windows PowerShell as SYSTEM'; $host.ui.rawui.ForegroundColor = 'Red'; $host.ui.rawui.BackgroundColor = 'Yellow'; Clear-Host
) else (
Elevate.cmd "%ProgramFiles%\Sysinternals Suite\psexec.exe" -i -s -d "%SystemRoot%\system32\windowspowershell\v1.0\powershell.exe" -NoExit Set-Location -LiteralPath '%~1'; $host.ui.rawui.windowtitle = 'Windows PowerShell as SYSTEM - %~1'; $host.ui.rawui.ForegroundColor = 'Red'; $host.ui.rawui.BackgroundColor = 'Yellow'; Clear-Host
)
) else (
echo "Please install the Sysinternals Suite to "%ProgramFiles%\Sysinternals Suite".
pause
)

View File

@@ -1,74 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "PowerShell Here" PowerToy for Windows PowerShell 1.0
; //
; // File: PowerShellHere.inf
; //
; // Purpose: To add a PowerShell Prompt Here entry to the Explorer context
; // menu for Windows PowerShell 1.0
; //
; // Version: 1.0.2
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 11/20/2006 Created initial version.
; // 1.0.1 01/02/2007 Simplified path to powershell.exe (changed
; // %10\system32 to %11). Added header.
; // 1.0.2 04/29/2008 Added DisplayVersion and changed DisplayName.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[PowerShellHereInstall]
CopyFiles = PowerShellHere.Files.Inf
AddReg = PowerShellHere.AddReg
[DefaultInstall]
CopyFiles = PowerShellHere.Files.Inf
AddReg = PowerShellHere.AddReg
[DefaultUnInstall]
DelFiles = PowerShellHere.Files.Inf
DelReg = PowerShellHere.DelReg
[SourceDisksNames]
55="PowerShell Prompt Here","",1
[SourceDisksFiles]
PowerShellHere.INF=55
[DestinationDirs]
PowerShellHere.Files.Inf = 17
[PowerShellHere.Files.Inf]
PowerShellHere.INF
[PowerShellHere.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\PowerShellHere.inf"
HKCR,Directory\Shell\PowerShellHere,,,"%PowerShellHereAccel%"
HKCR,Directory\Shell\PowerShellHere\command,,,"""%11%\windowspowershell\v1.0\powershell.exe"" -NoExit -Command Set-Location -LiteralPath '%L'"
HKCR,Drive\Shell\PowerShellHere,,,"%PowerShellHereAccel%"
HKCR,Drive\Shell\PowerShellHere\command,,,"""%11%\windowspowershell\v1.0\powershell.exe"" -NoExit -Command Set-Location -LiteralPath '%L'"
[PowerShellHere.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\PowerShellHere
HKCR,Drive\Shell\PowerShellHere
[Strings]
DisplayName="PowerShell Prompt Here PowerToy for Windows PowerShell 1.0 (v1.0.2) (Uninstall only)"
DisplayVersion="1.0.2"
PowerShellHereAccel="PowerShell Prompt Here"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerShellHere"

View File

@@ -1,96 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "PowerShell Prompt Here as Administrator" PowerToy for Windows PowerShell 1.0
; //
; // File: PowerShellHereAsAdmin.inf
; //
; // Additional files required: PSAsAdmin.cmd, ElevationPowertoys.ico
; //
; // Purpose: To add a "PowerShell Prompt Here as Administrator" entry to the
; // Explorer context menu for Windows PowerShell 1.0 on Windows
; // Vista
; //
; // Additional requirement: "Elevate Command" PowerToy for Windows Vista
; // must be installed.
; //
; // Version: 1.0.1
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 01/15/2007 Created initial version.
; // 1.0.1 04/29/2008 Removed install of Elevate.cmd & Elevate.vbs to
; // Program Files\Elevate WSH Script PowerToy. Changed
; // Regsitry values to REG_EXPAND_SZ. Added
; // DisplayVersion, DisplayIcon, and version number to
; // DisplayName. Added installation of PSAsAdmin.cmd.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[PowerShellHereAsAdminInstall]
CopyFiles = PowerShellHereAsAdmin.Files.Inf
CopyFiles = PowerShellHereAsAdmin.Files.System
CopyFiles = PowerShellHereAsAdmin.Files.Icon
AddReg = PowerShellHereAsAdmin.AddReg
[DefaultInstall]
CopyFiles = PowerShellHereAsAdmin.Files.Inf
CopyFiles = PowerShellHereAsAdmin.Files.System
CopyFiles = PowerShellHereAsAdmin.Files.Icon
AddReg = PowerShellHereAsAdmin.AddReg
[DefaultUnInstall]
DelFiles = PowerShellHereAsAdmin.Files.Inf
DelFiles = PowerShellHereAsAdmin.Files.System
DelReg = PowerShellHereAsAdmin.DelReg
[SourceDisksNames]
55="PowerShell Prompt Here as Administrator","",1
[SourceDisksFiles]
PowerShellHereAsAdmin.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
PowerShellHereAsAdmin.Files.Inf = 17
PowerShellHereAsAdmin.Files.System = 11
PowerShellHereAsAdmin.Files.Icon = 11
[PowerShellHereAsAdmin.Files.Inf]
PowerShellHereAsAdmin.INF
[PowerShellHereAsAdmin.Files.System]
PSAsAdmin.cmd
[PowerShellHereAsAdmin.Files.Icon]
ElevationPowertoys.ico
[PowerShellHereAsAdmin.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\PowerShellHereAsAdmin.inf"
HKCR,Directory\Shell\PowerShellHereAsAdmin,,,"%PowerShellHereAsAdminAccel%"
HKCR,Directory\Shell\PowerShellHereAsAdmin\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\windowspowershell\v1.0\powershell.exe"" -NoExit -Command Set-Location -LiteralPath '%L'; $host.ui.rawui.windowtitle = 'Administrator: ' + $host.ui.rawui.windowtitle"
HKCR,Drive\Shell\PowerShellHereAsAdmin,,,"%PowerShellHereAsAdminAccel%"
HKCR,Drive\Shell\PowerShellHereAsAdmin\command,,0x00020000,"""%SystemRoot%\System32\cmd.exe"" /c Elevate.cmd ""%SystemRoot%\System32\windowspowershell\v1.0\powershell.exe"" -NoExit -Command Set-Location -LiteralPath '%L'; $host.ui.rawui.windowtitle = 'Administrator: ' + $host.ui.rawui.windowtitle"
[PowerShellHereAsAdmin.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\PowerShellHereAsAdmin
HKCR,Drive\Shell\PowerShellHereAsAdmin
[Strings]
DisplayName="PowerShell Prompt Here as Administrator PowerToy for Windows PowerShell 1.0 on Windows Vista v1.0.1 (Uninstall only)"
DisplayVersion="1.0.1"
PowerShellHereAsAdminAccel="PowerShell Prompt Here as Administrator"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerShellHereAsAdmin"

View File

@@ -1,92 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "PowerShell Prompt Here as System" PowerToy for Windows PowerShell 1.0
; //
; // File: PowerShellHereAsSystem.inf
; //
; // Additional files required: PSAsSystem.cmd, ElevationPowertoys.ico
; //
; // Purpose: To add a "PowerShell Prompt Here as System" entry to the Explorer
; // context menu for Windows PowerShell 1.0 on Windows Vista
; //
; // Additional requirement: "Elevate Command" PowerToy for Windows Vista
; // must be installed and Sysinternals Suite must
; // be installed in %ProgramFiles%\Sysinternals Suite
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[PowerShellHereAsSystemInstall]
CopyFiles = PowerShellHereAsSystem.Files.Inf
CopyFiles = PowerShellHereAsSystem.Files.System
CopyFiles = PowerShellHereAsSystem.Files.Icon
AddReg = PowerShellHereAsSystem.AddReg
[DefaultInstall]
CopyFiles = PowerShellHereAsSystem.Files.Inf
CopyFiles = PowerShellHereAsSystem.Files.System
CopyFiles = PowerShellHereAsSystem.Files.Icon
AddReg = PowerShellHereAsSystem.AddReg
[DefaultUnInstall]
DelFiles = PowerShellHereAsSystem.Files.Inf
DelFiles = PowerShellHereAsSystem.Files.System
DelReg = PowerShellHereAsSystem.DelReg
[SourceDisksNames]
55="PowerShell Prompt Here as System","",1
[SourceDisksFiles]
PowerShellHereAsSystem.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
PowerShellHereAsSystem.Files.Inf = 17
PowerShellHereAsSystem.Files.System = 11
PowerShellHereAsSystem.Files.Icon = 11
[PowerShellHereAsSystem.Files.Inf]
PowerShellHereAsSystem.INF
[PowerShellHereAsSystem.Files.System]
PSAsSystem.cmd
[PowerShellHereAsSystem.Files.Icon]
ElevationPowertoys.ico
[PowerShellHereAsSystem.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\PowerShellHereAsSystem.inf"
HKCR,Directory\Shell\PowerShellHereAsSystem,,,"%PowerShellHereAsSystemAccel%"
HKCR,Directory\Shell\PowerShellHereAsSystem\command,,,"Elevate.cmd ""%16422%\Sysinternals Suite\psexec.exe"" -i -s -d ""%11%\windowspowershell\v1.0\powershell.exe"" -NoExit Set-Location -LiteralPath '%L'; $host.ui.rawui.windowtitle = 'Windows PowerShell as SYSTEM - %L'; $host.ui.rawui.ForegroundColor = 'Red'; $host.ui.rawui.BackgroundColor = 'Yellow'; Clear-Host"
HKCR,Drive\Shell\PowerShellHereAsSystem,,,"%PowerShellHereAsSystemAccel%"
HKCR,Drive\Shell\PowerShellHereAsSystem\command,,,"Elevate.cmd ""%16422%\Sysinternals Suite\psexec.exe"" -i -s -d ""%11%\windowspowershell\v1.0\powershell.exe"" -NoExit Set-Location -LiteralPath '%L'; $host.ui.rawui.windowtitle = 'Windows PowerShell as SYSTEM - %L'; $host.ui.rawui.ForegroundColor = 'Red'; $host.ui.rawui.BackgroundColor = 'Yellow'; Clear-Host"
[PowerShellHereAsSystem.DelReg]
HKLM,%UDHERE%
HKCR,Directory\Shell\PowerShellHereAsSystem
HKCR,Drive\Shell\PowerShellHereAsSystem
[Strings]
DisplayName="PowerShell Prompt Here as System PowerToy for Windows PowerShell 1.0 on Windows Vista v.1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
PowerShellHereAsSystemAccel="PowerShell Prompt Here as System"
TitleText = "Windows PowerShell as SYSTEM"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerShellHereAsSystem"

View File

@@ -1,143 +0,0 @@
//***************************************************************************
// ***** Script Header *****
// =======================================================
// Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
// =======================================================
//
// File: Readme.txt
//
// Purpose: Notes for the Elevation PowerToys
//
// Version: 1.1
// Date : 04/29/2008
//
// History:
// 1.1 04/29/2008 Created initial version.
//
// ***** End Header *****
//***************************************************************************
This document applies to the second web release of Elevation PowerToys for
Windows Vista. All files in this release have a Date Modified of January
29, 2008.
I. Installation
---------------
The PowerToys may be installed individually by right clicking on the INF file,
selecting Install, and approving the elevation. To uninstall them
individually, use the Programs and Features Control Panel.
The only INF files in this download that do not install a PowerToy are
Install_KiXtart.inf and Install_SysinternalsSuite.inf which are used to
install the KiXtart 2010 scripting language and the Sysinternal Suite of
utilities respectively. See the TechNet Magazine article for details.
This download also includes scripts to install or unistall all the Elevation
PowerToys at once (InstallAllPowerToys.cmd and UninstallAllPowerToys.cmd).
These command shell scripts can be modified to install/unistall only the
utilities desired. InstallAllPowerToys.cmd does not install the PowerToys
for the third-party scripting tools by default.
InstallAllPowerToys.cmd has three environment variables for controlling the
installation of PowerToys that depend on the installation of either Windows
PowerShell, the Sysinternals Suite, or the third-party scripting tools. See
the notes in Section 0 of InstallAllPowerToys.cmd.
II. Dependencies
----------------
Below are listed the PowerToys that depend on installation of other items
to function. These dependencies are documented in the header block of
each INF file as well.
Depend on the "Elevate Command" PowerToy being installed:
- "CMD Prompt Here as Administrator" PowerToy (CmdHereAsAdmin.inf)
- "CMD Prompt Here as System" PowerToy (CmdHereAsSystem)
- "PowerShell Prompt Here as Administrator" PowerToy (PowerShellHereAsAdmin.inf)
- "PowerShell Prompt Here as System" PowerToy (PowerShellHereAsSystem.inf)
- "Elevate WSH Script" PowerToy (ElevateWSHScript.inf)
- "Run As Another User" PowerToy (RunAs.inf)
Depend on the Windows PowerShell 1.0 being installed:
- "PowerShell Prompt Here" PowerToy (PowerShellHere.inf)
- "PowerShell Prompt Here as Administrator" PowerToy (PowerShellHereAsAdmin.inf)
- "PowerShell Prompt Here as System" PowerToy (PowerShellHereAsSystem.inf)
Depend on the Sysinternals Suite being installed with Install_SysinternalsSuite.inf:
- "CMD Prompt Here as System" PowerToy (CmdHereAsSystem)
- "PowerShell Prompt Here as System" PowerToy (PowerShellHereAsSystem.inf)
Individually depend on a third-party scripting tool being installed:
- "Elevate AutoIt v3 Script" PowerToy (ElevateAutoIt3.inf)
- "Elevate AutoHotkey Script" PowerToy (ElevateAutoHotkey.inf)
- "Elevate Perl Script" PowerToy (ElevatePerlScript.inf)
- "Elevate KiXtart Script" PowerToy (ElevateKiXtart.inf)
III. Files Included
-------------------
The 04/29/2008 collection consists of the following files:
File name Version New for this release
----------------------------------------------------------------------
CmdAsAdmin.cmd 1.0.0 X
----------------------------------------------------------------------
CmdAsSystem.cmd 1.0.0 X
----------------------------------------------------------------------
CmdHere.inf 1.0.3
----------------------------------------------------------------------
CmdHereAsAdmin.inf 1.0.2
----------------------------------------------------------------------
CmdHereAsSystem.inf 1.0.0 X
----------------------------------------------------------------------
elevate.cmd 1.0.0
----------------------------------------------------------------------
elevate.vbs 1.0.1
----------------------------------------------------------------------
ElevateAutoHotKey.inf 1.0.0 X
----------------------------------------------------------------------
ElevateAutoIt3.inf 1.0.0 X
----------------------------------------------------------------------
ElevateCommand.inf 1.0.1
----------------------------------------------------------------------
ElevateHTA.inf 1.0.1
----------------------------------------------------------------------
ElevateKiXtart.inf 1.0.0 X
----------------------------------------------------------------------
ElevateMSI.inf 1.0.0
----------------------------------------------------------------------
ElevatePerlScript.inf 1.0.0 X
----------------------------------------------------------------------
ElevatePowerShellScript.inf 1.0.1
----------------------------------------------------------------------
ElevateWSHScript.inf 1.0.2
----------------------------------------------------------------------
Elevation.gadget 1.0.0 X
----------------------------------------------------------------------
ElevationPowertoys.ico ----- X
----------------------------------------------------------------------
Install_KiXtart.inf 1.0.0 X
----------------------------------------------------------------------
Install_SysinternalsSuite.inf 1.0.0 X
----------------------------------------------------------------------
InstallAllPowerToys.cmd 1.0.0 X
----------------------------------------------------------------------
PowerShellHere.inf 1.0.2
----------------------------------------------------------------------
PowerShellHereAsAdmin.inf 1.0.1
----------------------------------------------------------------------
PowerShellHereAsSystem.inf 1.0.0 X
----------------------------------------------------------------------
PSAsAdmin.cmd 1.0.0 X
----------------------------------------------------------------------
PSAsSystem.cmd 1.0.0 X
----------------------------------------------------------------------
Readme.txt ----- X
----------------------------------------------------------------------
RunAs.hta 1.0.0 X
----------------------------------------------------------------------
RunAs.inf 1.0.0 X
----------------------------------------------------------------------
UninstallAllPowerToys.cmd 1.0.0 X

View File

@@ -1,206 +0,0 @@
<html>
<!--
//***************************************************************************
// ***** Script Header *****
// =======================================================
// Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
// =======================================================
//
// "Run as Another User" PowerToy for Windows Vista
//
// File: RunAs.hta
//
// Additional files required: RunAs.inf
//
// Additional requirement: Elevate Command PowerToy must be installed
//
// Purpose: To add a "Run as Another User" entry to the Explorer context
// menu for Executables (.exe) and Microsoft Management Console
// files (.msc)
//
// Version: 1.0.0
// Date : 04/29/2008
//
// History:
// 1.0.0 04/29/2008 Created initial version.
//
// ***** End Header *****
//***************************************************************************
-->
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Run as Another User</title>
<HTA:APPLICATION
ID="RunAsHta"
APPLICATIONNAME="Run as Another User Tool"
BORDER="thin"
CAPTION="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal" />
</head>
<style>
body
{background-color:#e8e8e8; font-family:Arial; font-size: 10pt;}
.tbox
{font-family:Arial; font-size:10pt;}
.button
{font-family:Arial; font-size:10pt; width:100px;}
.table
{font-family:Arial; font-size:10pt;}
.password
{font-family:Arial; font-size:10pt;}
#update
{font-family:Arial; font-size:10pt; color="blue"}
</style>
<body onload="Initialize();">
<script language="vbscript">
g_strDblQuote = chr(34)
Set g_objShell = CreateObject("Shell.Application")
Set g_objWshShell = CreateObject("Wscript.Shell")
Set g_objWshNetwork = CreateObject("Wscript.Network")
Set g_objFSO = CreateObject("Scripting.FileSystemObject")
g_strHTAPath = window.location.pathname
g_strHTAFolder = g_objFSO.GetParentFolderName(g_strHTAPath)
g_strCommandLine = RunAsHta.commandLine
g_strCommandToRun = Replace(g_strCommandLine, g_strDblQuote & g_strHTAPath & g_strDblQuote & " ", "")
g_strCommandToRun = Replace(g_strCommandToRun, g_strDblQuote, "")
g_strWindir = g_objWshShell.ExpandEnvironmentStrings("%windir%")
g_strProgramFiles = g_objWshShell.ExpandEnvironmentStrings("%ProgramFiles%")
g_strSystemRoot = g_objWshShell.ExpandEnvironmentStrings("%SystemRoot%")
g_strComputer = g_objWshNetwork.ComputerName
Sub Initialize
' Resize me
window.resizeTo 500,350
textCommandLine.innerHTML = "<font size=""1"">" & g_strCommandToRun & "</font>"
'textHtaPath.innerHTML = "<font size=""1"">" & g_strHTAPath & "</font>"
End Sub
Sub RunAs(blnElevated)
strUser = txtUserID.Value
strDomain = txtUserDomain.Value
strNoProfile = ""
strSmartcard = ""
If strUser = "" or strDomain = "" Then
MsgBox "One or more values are blank. Please fill in all text boxes."
Exit Sub
End If
'If LCase(g_objFSO.GetExtensionName(g_strCommandToRun)) = "msc" Then
' strCmdLine = g_strSystemRoot & "\system32\mmc.exe" & " " & "\" & g_strDblQuote & g_strCommandToRun & "\" & g_strDblQuote
' strCmdLineElevated = "\" & g_strDblQuote & g_strSystemRoot & "\system32\mmc.exe" & "\" & g_strDblQuote & " " & "\" & g_strDblQuote & g_strCommandToRun & "\" & g_strDblQuote
'Else
strCmdLine = g_strCommandToRun
strCmdLineElevated = "\" & g_strDblQuote & g_strCommandToRun & "\" & g_strDblQuote
'End If
If blnElevated Then
strProgramAndArgs = g_strDblQuote & g_strSystemRoot & "\system32\elevate.cmd" & _
" " & strCmdLineElevated & g_strDblQuote
Else
strProgramAndArgs = g_strDblQuote & strCmdLine & g_strDblQuote
End If
If chkNoProfile.checked Then strNoProfile = " /noprofile"
If chkSmartcard.checked Then strSmartcard = " /smartcard"
strCmd = "runas" & strNoProfile & strSmartcard & " /user:" & strDomain & "\" & strUser & " " & strProgramAndArgs
'MsgBox strCmd
rc = g_objWshShell.Run(strCmd, 1, true)
window.close()
End Sub
Sub ToggleLocalAcct(blnIsChecked)
If blnIsChecked Then
txtUserDomain.disabled = True
txtUserDomain.value = g_strComputer
txtUserDomain.style.backgroundColor = "lightgrey"
Else
txtUserDomain.disabled = False
txtUserDomain.value = ""
txtUserDomain.style.backgroundColor = "white"
End If
End Sub
</script>
<table border="0" cellpadding="0" cellspacing="0" width="100%" align=left>
<tr>
<td>
<h3>Run as Another User</h3>
</td>
</tr>
<tr>
<td>
<hr>
<table>
<tr>
<td>User ID:</td>
<td><input id=txtUserID class="tbox" type="text" size="30" style="width:200px"></td>
</tr>
<tr>
<td>Domain:</td>
<td><input id=txtUserDomain class="tbox" type="text" size="30" style="width:200px"></td>
</tr>
<tr>
<td>Command:</td>
<td id=textCommandLine></td>
</tr>
<!--
<tr>
<td>HTA Path:</td>
<td id=textHtaPath></td>
</tr>
-->
</table>
<hr>
Options:
<table>
<tr>
<td><input class="button" type="checkbox" name="chkLocalAcct" onclick="ToggleLocalAcct(chkLocalAcct.checked);"/></td>
<td>Use Local Account</td>
</tr>
<tr>
<td><input class="button" type="checkbox" name="chkSmartcard"/></td>
<td>Use Smartcard credentials</td>
</tr>
<tr>
<td><input class="button" type="checkbox" name="chkNoProfile"/></td>
<td>Do not load user profile</td>
</tr>
</table>
<br>
<input id=btnRunAs type=button style="width:100px" onclick="RunAs(0);" value="Run">
<input id=btnRunAsAdmin type=button style="width:100px" onclick="RunAs(-1);" value="Run as Admin">
</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,98 +0,0 @@
; //***************************************************************************
; // ***** Script Header *****
; // =======================================================
; // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
; // =======================================================
; //
; // "Run as Another User" PowerToy for Windows Vista
; //
; // File: RunAs.inf
; //
; // Additional files required: RunAs.hta, ElevationPowertoys.ico
; //
; // Additional requirement: Elevate Command PowerToy must be installed
; //
; // Purpose: To add a "Run as Another User" entry to the Explorer context
; // menu for Executables (.exe) and Microsoft Management Console
; // files (.msc)
; //
; // Version: 1.0.0
; // Date : 04/29/2008
; //
; // History:
; // 1.0.0 04/29/2008 Created initial version.
; //
; // ***** End Header *****
; //***************************************************************************
[version]
Signature="$Windows NT$"
[RunAsHTAInstall]
CopyFiles = RunAsHTA.Files.Inf
CopyFiles = RunAsHTA.Files.ProgramFiles
CopyFiles = RunAsHTA.Files.Icon
AddReg = RunAsHTA.AddReg
[DefaultInstall]
CopyFiles = RunAsHTA.Files.Inf
CopyFiles = RunAsHTA.Files.ProgramFiles
CopyFiles = RunAsHTA.Files.Icon
AddReg = RunAsHTA.AddReg
[DefaultUnInstall]
DelFiles = RunAsHTA.Files.Inf
DelFiles = RunAsHTA.Files.ProgramFiles
DelReg = RunAsHTA.DelReg
AddReg = RunAsHTA.Once.UnInst.Reg
[SourceDisksNames]
55="RunAs HTA","",1
[SourceDisksFiles]
RunAsHTA.INF=55
ElevationPowertoys.ico=55
[DestinationDirs]
RunAsHTA.Files.Inf = 17
RunAsHTA.Files.ProgramFiles = 16422,%RunAsHTAFolder%
RunAsHTA.Files.Icon = 11
[RunAsHTA.Files.Inf]
RunAs.inf
[RunAsHTA.Files.ProgramFiles]
RunAs.hta
[RunAsHTA.Files.Icon]
ElevationPowertoys.ico
[RunAsHTA.Once.UnInst.Reg]
HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,RunAsHTA,,"%11%\cmd.exe /c rd ""%16422%\%RunAsHTAFolder%"""
[RunAsHTA.AddReg]
HKLM,%UDHERE%,DisplayName,,"%DisplayName%"
HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%"
HKLM,%UDHERE%,DisplayIcon,,"%11%\ElevationPowertoys.ico"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %17%\RunAs.inf"
HKCR,exefile\shell\RunAsHTA
HKCR,exefile\Shell\RunAsHTA,,,"%RunAsHTAAccel%"
HKCR,exefile\shell\RunAsHTA\command,,,"""%11%\mshta.exe"" ""%16422%\%RunAsHTAFolder%\RunAs.hta"" ""%L"""
HKCR,mscfile\shell\RunAsHTA
HKCR,mscfile\Shell\RunAsHTA,,,"%RunAsHTAAccel%"
HKCR,mscfile\shell\RunAsHTA\command,,,"""%11%\mshta.exe"" ""%16422%\%RunAsHTAFolder%\RunAs.hta"" ""%L"""
[RunAsHTA.DelReg]
HKLM,%UDHERE%
HKCR,exefile\shell\RunAsHTA
HKCR,mscfile\shell\RunAsHTA
[Strings]
DisplayName="Run as Another User PowerToy for Windows Vista v1.0.0 (Uninstall only)"
DisplayVersion="1.0.0"
RunAsHTAAccel="Run as Another User"
RunAsHTAFolder="Run as Another User PowerToy"
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\RunAsHTA"

View File

@@ -1,173 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: UninstallAllPowerToys.cmd
:: //
:: // Additional files required: Elevate.cmd, Elevate.vbs
:: //
:: // Purpose: To provide a method uninstall all Elevation PowerToys
:: // in a scripted manner.
:: //
:: // Usage: UninstallAllPowerToys.cmd
:: //
:: // Version: 1.0.0
:: // Date : 04/29/2008
:: //
:: // History:
:: // 1.0.0 04/29/2008 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@echo off
if {%*}=={%~dp0} goto CONTINUE_SCRIPT
echo Re-Launching script as administrator, Please click allow or continue button from the following prompt to elevate
call elevate.cmd "%~dpnx0" %~dp0
pause
goto :EOF
:CONTINUE_SCRIPT
cd \
cd "%*"
echo Continuing UninstallAllPowerToys.cmd....
:: *************************************************************
:: *** Section I - Uninstall Elevate Command PowerToy
:: *************************************************************
:: I-A: "Elevate Command" PowerToy
if exist %SystemRoot%\inf\ElevateCommand.inf (
echo Uninstalling "Elevate Command" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateCommand.inf
)
:: *************************************************************
:: *** Section II - Uninstall CMD Prompt PowerToys
:: *************************************************************
:: II-A: "CMD Prompt Here" PowerToy
if exist %SystemRoot%\inf\CmdHere.inf (
echo Uninstalling "CMD Prompt Here" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\CmdHere.inf
)
:: II-B: "CMD Prompt Here as Administrator" PowerToy
if exist %SystemRoot%\inf\CmdHereAsAdmin.inf (
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\CmdHereAsAdmin.inf
echo Uninstalling "CMD Prompt Here as Administrator" PowerToy
)
:: II-C: "CMD Prompt Here as System" PowerToy
if exist %SystemRoot%\inf\CmdHereAsSystem.inf (
echo Uninstalling "CMD Prompt Here as System" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\CmdHereAsSystem.inf
)
:: *************************************************************
:: *** Section III - Uninstall Windows PowerShell Prompt PowerToys
:: *************************************************************
:: III-A: "PowerShell Prompt Here" PowerToy
if exist %SystemRoot%\inf\PowerShellHere.inf (
echo Uninstalling "PowerShell Prompt Here" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\PowerShellHere.inf
)
:: III-B: "PowerShell Prompt Here as Administrator" PowerToy
if exist %SystemRoot%\inf\PowerShellHereAsAdmin.inf (
echo Uninstalling "PowerShell Prompt Here as Administrator" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\PowerShellHereAsAdmin.inf
)
:: III-C: "PowerShell Prompt Here as System" PowerToy
if exist %SystemRoot%\inf\PowerShellHereAsSystem.inf (
echo Uninstalling "PowerShell Prompt Here as System" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\PowerShellHereAsSystem.inf
)
:: *************************************************************
:: *** Section IV - Uninstall Windows Script PowerToys
:: *************************************************************
:: IV-A: "Elevate WSH Script" PowerToy
if exist %SystemRoot%\inf\ElevateWSHScript.inf (
echo Uninstalling "Elevate WSH Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateWSHScript.inf
)
:: IV-B: "Elevate PowerShell v1.0 Script" PowerToy
if exist %SystemRoot%\inf\ElevatePowerShellScript.inf (
echo Uninstalling "Elevate PowerShell v1.0 Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevatePowerShellScript.inf
)
:: IV-C: "Elevate HTML Application" PowerToy
if exist %SystemRoot%\inf\ElevateHTA.inf (
echo Uninstalling "Elevate HTML Application" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateHTA.inf
)
:: *************************************************************
:: *** Section V - Uninstall Windows Installer PowerToy
:: *************************************************************
:: V-A: "Elevate Windows Installer Package" PowerToy
if exist %SystemRoot%\inf\ElevateMSI.inf (
echo Uninstalling "Elevate Windows Installer Package" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateMSI.inf
)
:: *************************************************************
:: *** Section VI - Uninstall Third Party Script PowerToy
:: *************************************************************
:: VI-A: "Elevate AutoIt v3 Script" PowerToy
if exist %SystemRoot%\inf\ElevateAutoIt3.inf (
echo Uninstalling "Elevate AutoIt v3 Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateAutoIt3.inf
)
:: VI-A: "Elevate AutoHotkey Script" PowerToy
if exist %SystemRoot%\inf\ElevateAutoHotkey.inf (
echo Uninstalling "Elevate AutoHotkey Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateAutoHotkey.inf
)
:: VI-A: "Elevate Perl Script" PowerToy
if exist %SystemRoot%\inf\ElevatePerlScript.inf (
echo Uninstalling "Elevate Perl Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevatePerlScript.inf
)
:: VI-A: "Elevate KiXtart Script" PowerToy
if exist %SystemRoot%\inf\ElevateKiXtart.inf (
echo Uninstalling "Elevate KiXtart Script" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\ElevateKiXtart.inf
)
:: *************************************************************
:: *** Section VII - Uninstall Run As Another User PowerToy
:: *************************************************************
:: VII-A: "Run As Another User" PowerToy
if exist %SystemRoot%\inf\RunAs.inf (
echo Uninstalling "Run As Another User" PowerToy
"%SystemRoot%\System32\rundll32.exe" %SystemRoot%\System32\syssetup.dll,SetupInfObjectInstallAction DefaultUninstall 132 %SystemRoot%\inf\RunAs.inf
)
:: *************************************************************
:: *** Section VIII - Uninstall Elevation Gadget
:: *************************************************************
:: VIII-A: Elevation Gadget
echo The Elevation Gadget should be uninstalled by right clicking on the Windows
echo Sidebar, selecting Add Gadgets..., right clicking on the Elevation Gadget
echo icon in the Gadget Gallery and selecting Uninstall.
pause

View File

@@ -1,33 +0,0 @@
:: //***************************************************************************
:: // ***** Script Header *****
:: // =======================================================
:: // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
:: // =======================================================
:: //
:: // File: Elevate.cmd
:: //
:: // Additional files required: Elevate.vbs
:: //
:: // Purpose: To provide a command line method of launching applications that
:: // prompt for elevation (Run as Administrator) on Windows Vista.
:: //
:: // Usage: elevate.cmd application <application arguments>
:: //
:: // Version: 1.0.0
:: // Date : 01/02/2007
:: //
:: // History:
:: // 1.0.0 01/02/2007 Created initial version.
:: //
:: // ***** End Header *****
:: //***************************************************************************
@setlocal
@echo off
:: Pass raw command line agruments and first argument to Elevate.vbs
:: through environment variables.
set ELEVATE_CMDLINE=%*
set ELEVATE_APP=%1
start wscript //nologo "%~dpn0.vbs" %*

View File

@@ -1,93 +0,0 @@
' //***************************************************************************
' // ***** Script Header *****
' // =======================================================
' // Elevation PowerToys for Windows Vista v1.1 (04/29/2008)
' // =======================================================
' //
' // File: Elevate.vbs
' //
' // Additional files required: Elevate.cmd
' //
' // Purpose: To provide a command line method of launching applications that
' // prompt for elevation (Run as Administrator) on Windows Vista.
' //
' // Usage: (Not used directly. Launched from Elevate.cmd.)
' //
' // Version: 1.0.1
' // Date : 01/03/2007
' //
' // History:
' // 1.0.0 01/02/2007 Created initial version.
' // 1.0.1 01/03/2007 Added detailed usage output.
' //
' // ***** End Header *****
' //***************************************************************************
Set objShell = CreateObject("Shell.Application")
Set objWshShell = WScript.CreateObject("WScript.Shell")
Set objWshProcessEnv = objWshShell.Environment("PROCESS")
' Get raw command line agruments and first argument from Elevate.cmd passed
' in through environment variables.
strCommandLine = objWshProcessEnv("ELEVATE_CMDLINE")
strApplication = objWshProcessEnv("ELEVATE_APP")
strArguments = Right(strCommandLine, (Len(strCommandLine) - Len(strApplication)))
If (WScript.Arguments.Count >= 1) Then
strFlag = WScript.Arguments(0)
If (strFlag = "") OR (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "-?") OR (strFlag="h") _
OR (strFlag = "?") Then
DisplayUsage
WScript.Quit
Else
objShell.ShellExecute strApplication, strArguments, "", "runas"
End If
Else
DisplayUsage
WScript.Quit
End If
Sub DisplayUsage
WScript.Echo "Elevate - Elevation Command Line Tool for Windows Vista" & vbCrLf & _
"" & vbCrLf & _
"Purpose:" & vbCrLf & _
"--------" & vbCrLf & _
"To launch applications that prompt for elevation (i.e. Run as Administrator)" & vbCrLf & _
"from the command line, a script, or the Run box." & vbCrLf & _
"" & vbCrLf & _
"Usage: " & vbCrLf & _
"" & vbCrLf & _
" elevate application <arguments>" & vbCrLf & _
"" & vbCrLf & _
"" & vbCrLf & _
"Sample usage:" & vbCrLf & _
"" & vbCrLf & _
" elevate notepad ""C:\Windows\win.ini""" & vbCrLf & _
"" & vbCrLf & _
" elevate cmd /k cd ""C:\Program Files""" & vbCrLf & _
"" & vbCrLf & _
" elevate powershell -NoExit -Command Set-Location 'C:\Windows'" & vbCrLf & _
"" & vbCrLf & _
"" & vbCrLf & _
"Usage with scripts: When using the elevate command with scripts such as" & vbCrLf & _
"Windows Script Host or Windows PowerShell scripts, you should specify" & vbCrLf & _
"the script host executable (i.e., wscript, cscript, powershell) as the " & vbCrLf & _
"application." & vbCrLf & _
"" & vbCrLf & _
"Sample usage with scripts:" & vbCrLf & _
"" & vbCrLf & _
" elevate wscript ""C:\windows\system32\slmgr.vbs"" dli" & vbCrLf & _
"" & vbCrLf & _
" elevate powershell -NoExit -Command & 'C:\Temp\Test.ps1'" & vbCrLf & _
"" & vbCrLf & _
"" & vbCrLf & _
"The elevate command consists of the following files:" & vbCrLf & _
"" & vbCrLf & _
" elevate.cmd" & vbCrLf & _
" elevate.vbs" & vbCrLf
End Sub

View File

@@ -1,5 +0,0 @@
Do NOT delete or rename any file in this folder.
Do NOT delete or rename this folder.
Doing any of those actions will cause PFTT to be unable to install dependencies!

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

View File

@@ -1,557 +0,0 @@
package com.mostc.pftt
import groovy.lang.Closure;
import java.util.ArrayList;
abstract class AbstractHostList extends ArrayList {
// def size(value=null) {
// //length() returns number of hosts
// // //length(value) returns number of hosts that returned given value
// case value.null?
// when true
// super
// when false
// count_values(value)
// end
// }
// def count_values(value) {
// // count number of hosts that returned given value
// c = 0
// each { k, v ->
// if eq_value(v, value)
// c += 1
// end
// end
// c
// }
// def keys(value=null) {
// // //keys() returns an array of hosts
// // //keys(value) returns a Host::Array of hosts that returned given value
// case value.null?
// when true
// super
// when false
// slice_value(value)
// end
// }
// def slice_value(value) {
// // returns a Host::Array of hosts that returned given value
// ret = Host::Array.new
// each do |k, v|
// if eq_value(v, value)
// ret.push(k)
// end
// end
// ret
// }
def eq_value(a, b) {
a == b
}
def which(cmd, ctx=null) {
each_ret(cmd) { host, sub_cmd ->
host.which(sub_cmd, ctx)
}
}
def hasCmd(cmd, ctx=null) {
each_ret(cmd) { host, sub_cmd ->
host.hasCmd(sub_cmd, ctx)
}
}
def exec_pw(posix_cmd, windows_cmd, ctx, opts={}) {
each_ret { host ->
if (host.isPosix(ctx))
host.exec(sub_cmd(host, posix_cmd), ctx, opts)
else
host.exec(sub_cmd(host, windows_cmd), ctx, opts)
}
}
def exec_ok(cmd, ctx, opts={}) {
each_ret(cmd) { host, sub_cmd ->
host.exec_ok(sub_cmd, ctx, opts)
}
}
def exec_pw_ok(posix_cmd, windows_cmd, ctx, opts={}) {
each_ret { host ->
if (host.isPosix(ctx))
host.exec_ok(sub_cmd(host, posix_cmd), ctx, opts)
else
host.exec_ok(sub_cmd(host, windows_cmd), ctx, opts)
}
}
def cmd_pw(posix_cmd, windows_cmd, ctx, opts={}) {
each_thread { host ->
if (host.isPosix(ctx))
host.cmd(sub_cmd(host, posix_cmd), ctx, opts)
else
host.cmd(sub_cmd(host, windows_cmd), ctx, opts)
}
}
def exec(command, ctx, opts={}) {
each_ret(command) { host, sub_cmd ->
host.exec(sub_cmd, ctx, opts)
}
}
def cmd(cmdline, ctx) {
each_ret(cmdline) { host, sub_cmdline ->
host.cmd(sub_cmdline, ctx)
}
}
def line(cmdline, ctx) {
each_ret(cmdline) { host, sub_cmdline ->
host.line(sub_cmdline, ctx)
}
}
def isPosix(ctx=null) {
each_ret { host ->
host.isPosix(ctx)
}
}
def isWindows(ctx=null) {
each_ret { host ->
host.isWindows(ctx)
}
}
def isLonghorn(ctx=null) {
each_ret { host ->
host.isLonghorn(ctx)
}
}
def isBSD(ctx=null) {
each_ret { host ->
host.isBSD(ctx)
}
}
def isFreeBSD(ctx=null) {
each_ret { host ->
host.isFreeBSD(ctx)
}
}
def isLinux(ctx=null) {
each_ret { host ->
host.isLinux(ctx)
}
}
def isRedhat(ctx=null) {
each_ret { host ->
host.isRedhat(ctx)
}
}
def isFedora(ctx=null) {
each_ret { host ->
host.isFedora(ctx)
}
}
def isDebian(ctx=null) {
each_ret { host ->
host.isDebian(ctx)
}
}
def isUbuntu(ctx=null) {
each_ret { host ->
host.isUbuntu(ctx)
}
}
def isGentoo(ctx=null) {
each_ret { host ->
host.isGentoo(ctx)
}
}
def isSUSE(ctx=null) {
each_ret { host ->
host.isSUSE(ctx)
}
}
def isSolaris(ctx=null) {
each_ret { host ->
host.isSolaris(ctx)
}
}
// def utype? ctx=null
// each_ret do |host|
// host.utype?(ctx)
// end
// end
//
// def windows_and_utype ctx=null
// // TODO
// end
def unquote_line(cmdline, ctx) {
each_ret(cmdline) { host, sub_cmdline ->
host.unquote_line(sub_cmdline, ctx)
}
}
def line_prefix(prefix, cmd, ctx) {
each_ret(cmd) { host, sub_cmd ->
host.line_prefix(prefix, sub_cmd, ctx)
}
}
def reboot(ctx=null) {
each_ret { host ->
host.reboot(ctx)
}
}
def reboot_wait(seconds, ctx=null) {
each_ret { host ->
host.reboot_wait(seconds, ctx)
}
}
def isRebooting(ctx=null) {
each_ret { host ->
host.rebooting(ctx)
}
}
def env_values(ctx=null) {
each_ret { host ->
host.env_values(ctx)
}
}
def env_value(name, ctx=null) {
each_ret { host ->
host.env_value(name, ctx)
}
}
def name(ctx=null) {
each_ret { host ->
host.name(ctx)
}
}
def mkdir(path, ctx) {
each_ret(path) { host, sub_path ->
host.mkdir(sub_path, ctx)
}
}
def mktmpdir(ctx, path=null, suffix='') {
each_ret(path) { host, sub_path ->
host.mktmpdir(ctx, sub_path, suffix)
}
}
def mktmpfile(suffix, ctx, content=null) {
each_ret { host ->
host.mktmpfile(suffix, ctx, content)
}
}
// alias :mktempfile :mktmpfile
// alias :mktempdir :mktmpdir
def delete_if(path, ctx) {
each_ret(path) { host, sub_path ->
host.delete_if(sub_path, ctx)
}
}
def upload(from, to, ctx, opts={}) {
each_ret(to) { host, sub_to ->
host.upload(from, sub_to, ctx, opts)
}
}
def download(from, to, ctx) {
each_ret(to) { host, sub_to ->
host.download(from, sub_to, ctx)
}
}
def upload_force(local, remote, ctx, opts={}) {
each_ret(remote) { host, sub_remote ->
host.upload_force(local, sub_remote, ctx, opts)
}
}
def upload_if_not(local, remote, ctx) {
each_ret(remote) { host, sub_remote ->
host.upload_if_not(local, sub_remote, ctx)
}
}
def glob(path, spec, ctx) {
each_ret(path) { host, sub_path ->
host.glob(sub_path, spec, ctx)
}
}
def list(path, ctx) {
each_ret(path) { host, sub_path ->
host.list(sub_path, ctx)
}
}
def mtime(file, ctx=null) {
each_ret(file) { host, sub_file ->
host.mtime(sub_file, ctx)
}
}
def write(string, path, ctx) {
// TODO
each_ret(path) { host, sub_path ->
host.write(string, sub_path, ctx)
}
}
def read(path, ctx) {
each_ret(path) { host, sub_path ->
host.read(sub_path, ctx)
}
}
def cwd(ctx=null) {
each_ret { host ->
host.cwd(ctx)
}
}
def cd(path, hsh, ctx=null) {
// TODO
each_ret(path) { host, sub_path ->
host.cd(sub_path, hsh, ctx)
}
}
def directory(path, ctx=null) {
each_ret(path) { host, sub_path ->
host.directory(sub_path, ctx)
}
}
def open_file(path, flags='r', ctx=null, Closure block=null) {
each_ret(path) { host, sub_path ->
host.open_file(sub_path, flags, ctx, block)
}
}
def isRemote() {
each_ret { host ->
host.isRemote()
}
}
def delete(path, ctx=null) {
// TODO
each_ret(path) { host, sub_path ->
host.delete(sub_path, ctx)
}
}
def exist(path, ctx=null) {
each_ret(path) { host, sub_path ->
host.exist(sub_path, ctx)
}
}
// alias :exist :exist?
// alias :exists :exist?
// alias :exists? :exist?
def copy(from, to, ctx, opts={}) {
each_ret(to) { host, sub_to ->
host.copy(from, sub_to, ctx, opts)
}
}
def move(from, to, ctx) {
each_ret(to) { host, sub_to ->
host.move(from, sub_to, ctx)
}
}
def time(ctx=null) {
each_ret { host ->
host.time(ctx)
}
}
def setTime(time, ctx=null) {
// // TODO
// ret = VSA.new
// each_thread(ret) do |host|
// ret[host] = host.time = time
// end
// ret
}
def shell(ctx=null) {
each_ret { host ->
host.shell(ctx)
}
}
def systeminfo(ctx=null) {
each_ret { host ->
host.systeminfo(ctx)
}
}
def processor(ctx=null) {
each_ret { host ->
host.processor(ctx)
}
}
def isX86(ctx=null) {
each_ret { host ->
host.isX86(ctx)
}
}
def isX64(ctx=null) {
each_ret { host ->
host.isX64(ctx)
}
}
def isARM(ctx=null) {
each_ret { host ->
host.isARM(ctx)
}
}
def number_of_processors(ctx=null) {
each_ret { host ->
host.number_of_processors(ctx)
}
}
def systemroot(ctx=null) {
each_ret { host ->
host.systemroot(ctx)
}
}
def systemdrive(ctx=null) {
each_ret { host ->
host.systemdrive(ctx)
}
}
def desktop(ctx=null) {
each_ret { host ->
host.desktop(ctx)
}
}
def userprofile(ctx=null) {
each_ret { host ->
host.userprofile(ctx)
}
}
def appdata(ctx=null) {
each_ret { host ->
host.appdata(ctx)
}
}
def appdata_local(ctx=null) {
each_ret { host ->
host.appdata_local(ctx)
}
}
def tempdir(ctx) {
each_ret { host ->
host.tempdir(ctx)
}
}
// alias :tmpdir :tempdir
def osname(ctx=null) {
each_ret { host ->
host.osname(ctx)
}
}
// alias :os_name osname
def hasDebugger(ctx) {
each_ret { host ->
host.hasDebugger(ctx)
}
}
def on_error(host, ex) {
}
def sub_cmd(host, cmd) {
// important that 'host' variable is named 'host'
eval("$cmd")
}
def each_ret(path=null) {// TODO , &block) {
// ret = VSA.new
// each_thread do |host|
// ret[host] = block.call(host, path.null? ? null : sub_cmd(host, path))
// end
// ret
}
protected def each_thread(ret=null) {// TODO , &block) {
// tq = @thread_manager.new_queue
//
// this.each do |host|
// // TODO coordinate with the threads in exec! system
// //
// // TODO @thread_queue
// tq.add_task do
// begin
// block.call(host)
// rescue
// if !ret.null? and !ret.has_key?(host)
// // caller is supposed to return true|false for host
// // to indicate success|failure
// //
// // make sure this gets set to false (since this failed)
// ret[host] = false
// end
// on_error(host, $!)
// end // begin
// end // add_task
//
// end // each
//
// tq.execute
} // def each_thread
} // class AbstractHostList

View File

@@ -1,5 +0,0 @@
package com.mostc.pftt
abstract class Build {
}

View File

@@ -1,105 +0,0 @@
package com.mostc.pftt
import com.mostc.pftt.util.StringUtil
/** Handles generation and manipulation of command line commands without ugly String parsing.
*
* Also allows custom evaluation of the result (success|failure, etc....) of command execution.
*
*
*/
class Command {
public static final int SUCCESS = 0
String program, args=[], arg_sep=[], arg2_sep=[], args_args2_sep=[], args2=[]
/** the output expected in the STDOUT and STDERR streams from the program, for
* the run to be considered successful.
*
* @see #isSuccess
*
* if an empty string then STDOUT|STDERR is expected to be empty
* if null, then run is successful regardless of STDOUT|STDERR being empty or not empty
*/
String expect_stdout, expect_stderr
int expect_exit_code = SUCCESS
def exe_opts
def ExpectedCommand(String program=null) {
this.program = program
}
/** decides if Actual run of the command was successful.
*
* by default, this is based on the Actual command matching the expected STDOUT, STDERR and exit code.
*
* this may be overridden to evaluate success differently.
*
* @param actual
* @return
*/
def isSuccess(actual) {
actual.cmd_str == toString() && (expect_stdout==null||expect_stdout == actual.stdout) && (expect_stderr==null||expect_stderr == actual.stderr) && expect_exit_code == actual.exit_code
}
/** creates an Actual instance to store information about an instance of a run of this Command.
*
* @param cmd_line
* @param stdout
* @param stderr
* @param exit_code
* @return
*/
def createActual(String cmd_line, String stdout, String stderr, int exit_code) {
new Actual(cmd_line, stdout, stderr, exit_code)
}
public class Actual {
String cmd_line, stdout, stderr
int exit_code
def Actual(String cmd_line, String stdout, String stderr, int exit_code) {
this.cmd_line = cmd_line
this.stdout = stdout
this.stderr = stderr
this.exit_code = exit_code
}
def isCmdNotFound() {
return ( stderr.contains('bash:') && exit_code == 127 )
}
def isSuccess() {
Command.this.isSuccess(Actual.this)
}
@Override
String toString() {
cmd_line
}
}
@Override
String toString() {
def str = program
if (!args.isEmpty()) {
str += ' '
str += args_str
}
if (!args2.isEmpty()) {
str += arg2_sep
str += args2_str
}
return str
}
def args_str() {
StringUtil.flatten(args)
StringUtil.join(arg_sep, args)
}
def args2_str() {
StringUtil.flatten(args2)
StringUtil.join(arg2_sep, args2)
}
} // end class Command

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
package com.mostc.pftt
class HostList extends AbstractHostList {
}

View File

@@ -1,5 +0,0 @@
package com.mostc.pftt
class HostManager extends HostList {
} // end class HostManager

View File

@@ -1,273 +0,0 @@
package com.mostc.pftt
import java.util.Timer
import java.util.TimerTask
import java.io.*
import java.lang.ProcessBuilder
import java.io.BufferedReader
import java.io.FileReader
import java.io.ByteArrayOutputStream
import java.io.BufferedOutputStream
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.BufferedInputStream
import java.util.HashMap
import java.lang.Byte
import com.STDIN;
import com.mostc.pftt.*
//LocalHost.metaClass {
// upload = {copy}
// download = {copy}
//}
class LocalHost extends Host {
@Override
def upload(local_file, remote_path, ctx, opts=[]) {
copy(local_file, remote_path, ctx)
}
@Override
def env_values(ctx=null) {
//Hash.new(System.getenv()) //ENV.keys
}
@Override
def env_value(name, ctx=null) {
if (name=='HOSTNAME' && isPosix(ctx)) {
// Linux: for some reason this env var is not available
//
// execute program 'hostname' instead
return line('hostname', ctx)
}
System.getenv(name) // LATER ENV[name]
} // end def env_value
@Override
def reboot_wait(seconds, ctx) {
// if (ctx) {
// // get approval before rebooting localhost
// if (ctx.new(Tracing::Context::SystemSetup::Reboot).approve_reboot_localhost()) {
// return super.reboot_wait(seconds, ctx)
// }
// } else {
return super.reboot_wait(seconds, ctx)
// }
}
// def clone
// clone = Host::Local.new()
// super(clone)
// end
@Override
def close() {
// nothing to close
}
// def toString() {
// if (isPosix())
// return 'Localhost (Posix)'
// else if (isWindows())
// return 'Localhost (Windows)'
// else
// return 'Localhost (Platform-Unknown)'
// }
@Override
def isAlive() {
// was able to call this method therefore must be true (if false, couldn't have called this method)
true
}
@Override
def write(string, path, ctx) {
// writes the given string to the given file/path
// overwrites the file if it exists or creates it if it doesn't exist
//
// if (ctx) {
// ctx.write_file(self, string, path) |new_string, new_path| {
// return write(new_string, new_path, ctx)
// }
// }
mkdir(File.dirname(path), ctx)
output = BufferedOutputStream.new(FileOutputStream.new(path))
output.write(string, 0, string.length)
output.close
}
@Override
def read_lines(path, ctx=null, max_lines=16384) {
def lines = []
def line
def reader = new BufferedReader(new FileReader(path))
while ( ( line = reader.readLine() ) != null && !(lines.size()> max_lines)) {
lines.add(line)
}
reader.close()
lines
}
@Override
def read(path) {
def output = new ByteArrayOutputStream(1024)
def input = new BufferedInputStream(new FileInputStream(path))
copy_stream(input, output)
input.close
output.toString
}
@Override
def getTime(ctx=null) {
new Date()
}
@Override
def cwd(ctx=null) {
if (ctx) {
ctx.fs_op0(self, EFSOp.cwd) {
return cwd(ctx)
}
}
return Dir.getwd()
}
@Override
def cd(path, hsh, ctx=null) {
if (ctx) {
ctx.fs_op1(self, EFSOp.cd, path) |new_path| {
return cd(new_path, hsh, ctx)
}
}
make_absolute(path)
if (!path) {
// popd may have been called when @dir_stack empty
throw new IllegalArgumentException("path not specified")
}
// Dir.chdir(path)
// TODO dir_stack.clear unless hsh.delete(:no_clear) || false
return path
} // end def cd
@Override
def directory(path, ctx=null) {
if (ctx) {
ctx.fs_op1(self, EFSOp.is_dir, path) |new_path| {
return directory(new_path, ctx)
}
}
make_absolute(path)
new File(path).isDirectory()
}
// list the immediate children of the given path
@Override
def list(path, ctx) {
if (ctx) {
ctx.fs_op1(self, EFSOp.list, new_path) |new_path| {
return list(new_path, ctx)
}
}
make_absolute(path)
// Dir.entries( path ).map! do |entry|
// next null if ['.','..'].include? entry
// entry
// end.compact
}
// def glob(path, spec, ctx, &blk) {
// if (ctx) {
// ctx.fs_op2(self, :glob, path, spec) |new_path, new_spec| {
// return glob(new_path, new_spec, ctx, blk)
// }
// }
//
// make_absolute(path)
//
// Dir.glob("//{path}///{spec}", &blk)
// }
@Override
def isRemote() {
false
}
@Override
def mtime(file, ctx=null) {
File.mtime(file).to_i
}
static def copy_stream(input, output) {
def tmp = new byte[1024]
while (true) {
//input.available
def len = input.read(tmp, 0, 1024)
if (len < 0) {
break
}
output.write(tmp, 0, len)
// len = 0// TODO input.read(tmp, 0, 1024)
// if len < 0
break
// end
// // TODO output.write(tmp, 0, len)
// end
}
} // end def copy_stream
protected
def _exist(file, ctx) {
new File(file).exists()
}
def move_file(from, to, ctx) {
new File(from).renameTo(new File(to))
}
def _exec_impl(command, opts, ctx, block) {
// TODO
def lh = STDIN.exec_impl(command, null, null, 0, null)
if (opts.exec_handle) {
return lh
} else {
def ret = lh.run_read_streams()
return [output:ret[0], error:ret[1], exit_code:ret[2]]
}
} // end def _exec_impl
def _delete(path, ctx) {
make_absolute(path)
new File(path).delete()
}
def _mkdir(path, ctx) {
make_absolute(path)
new File(path).mkdir()
}
def _make_absolute(path) {
new File(path).getAbsolutePath()
}
} // end public class LocalHost

View File

@@ -1,132 +0,0 @@
package com.mostc.pftt
abstract class Middleware {
Host host
Build build
Scenario scenario
def Middleware(Host host, Build build, Scenario scenario) {
this.host = host
this.build = build
this.scenario = scenario
}
def start_test_case_group(scenario, test_case_group) {
}
def thread_pool_size(test_case_base_class=null) {
1
}
def isInstalled(ctx=null) {
// Override
true
}
def uninstall(ctx=null) {
// Override
}
def ensure_installed(ctx=null) {
unless(isInstalled(ctx)) {
install(ctx)
}
}
def start(ctx=null) {
// Override
ensure_installed(ctx)
}
def stop(ctx=null) {
// Override
host.close()
}
def close(ctx=null) {
stop(ctx)
}
def restart(ctx=null) {
stop(ctx)
start(ctx)
}
def group_test_cases(test_cases, scenario) {
[test_cases]
}
protected def shouldDisableAEDebug() {
true
}
def disableFirewall(ctx=null) {
}
def install(ctx=null) {
// Override
// client should do install of all middlewares BEFORE running pftt-host
// because installation may require rebooting and pftt-host doesn't support reboots
//
// (could get around this for php or other projects by running pftt-host between reboots if only one middleware can be installed at
// a time, but for php, all middlewares can be installed at once, so just do it all at once (in 1 stage) because it'll be less bad if any install fails)
//
if (host.isWindows(ctx)) {
// turn on file sharing... (add PFTT) share
// make it easy for user to share files with this windows machine
// (during cleanup or analysis or triage, after tests have run)
//
// user can access PHP_SDK and the system drive ( \\hostname\C$ \\hostname\G$ etc...)
//
host.exec("NET SHARE PHP_SDK=$host.systemdrive()\\php-sdk /Grant:$host.username(),Full", ctx)
//
def error_mode_change = false
if (shouldDisableAEDebug()) {
// remove application exception debuggers (Dr Watson, Visual Studio, etc...)
// otherwise, if php crashes a dialog box will appear and prevent PHP from exiting
host.registry_delete('HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug', 'Debugger', ctx)
// disable Hard Error Popup Dialog boxes (will still get this even without a debugger)
// see http://support.microsoft.com/kb/128642
//
def query = host.registry_query('HKLM\\SYSTEM\\CurrentControlSet\\Control\\Windows', 'ErrorMode', 'REG_DWORD', ctx)
if (query['REG_DWORD'] != '0x2') {
// check if registry value is already changed (so we don't reboot if we don't have to)
host.registry_add('HKLM\\SYSTEM\\CurrentControlSet\\Control\\Windows', 'ErrorMode', '2', 'REG_DWORD', ctx)
// for ErrorMode change to take effect, host must be rebooted!
error_mode_change = true
}
}
//
// disable windows firewall
disableFirewall(ctx)
// show filename extensions
host.exec('REG ADD "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced" /v HideFileExt /d 0 /t REG_DWORD /f', ctx)
if (error_mode_change) {
// for ErrorMode change to take effect, host must be rebooted!
host.reboot(ctx)
}
} else {
// LATER add share to samba if posix and samba already installed
}
// if @host.windows?(ctx)
// if @host.credentials // TODO
// @host.exec!('NET SHARE PFTT='+@host.systemdrive+'\\php-sdk /Grant:"'+@host.credentials[:username]+'",Full', ctx)
// end
//
// end
} // end def install
def isRunning(ctx=null) {
true
}
} // end public abstract class Middleware

View File

@@ -1,77 +0,0 @@
package com.mostc.pftt
abstract class RemoteHost extends Host {
def isRemote() {
true
}
@Override
def getTime(ctx=null) {
if (isPosix(ctx)) {
new Date(line('date', ctx))
} else {
// gets the host's time/date
new Date(unquote_line('date /T', ctx)+' '+unquote_line('time /T', ctx))
}
}
def canStream() {
false // ssh can
}
def ensure_7zip_installed(ctx) {
if (tried_install_7zip) {
return installed_7zip
}
// TODO Util::Install::7zip.install(self)
installed_7zip = false
} // end def ensure_7zip_installed ctx
def isRebooting() {
rebooting
}
def reboot_wait(seconds, ctx) {
super.reboot_wait(seconds, ctx)
reboot_reconnect_tries = ( seconds / 60 ).to_i + 1
if (reboot_reconnect_tries < 3) {
reboot_reconnect_tries = 3
}
rebooting = true
// will have to recreate sockets when it comes back up
// session() and sftp() will block until then (so any method
// LATER using sftp() or session() will be automatically blocked during reboot(good))
close
}
def RemoteHost(opts={}) {
reconnected_after_reboot
}
// def clone(clone) {
// clone.rebooting = rebooting
// clone.rebooting_reconnect_tries = rebooting_reconnect_tries
// clone.tried_install_7zip = tried_install_7zip
// clone.installed_7zip = installed_7zip
// super(clone)
// }
protected
// for //clone()
// attr_accessor :rebooting, :rebooting_reconnect_tries, :tried_install_7zip, :installed_7zip
def reconnected_after_reboot() {
tried_install_7zip = false
// maybe reverted to a snapshot (if host is a virtual machine)
installed_7zip = false
rebooting = false
rebooting_reconnect_tries = 0
}
} // end public class RemoteHost

View File

@@ -1,690 +0,0 @@
package com.mostc.pftt;
// SSH - Secure Shell
// for Linux/UNIX and Windows systems
//
// Supported SSH Servers:
// * OpenSSH
// * Apache SSHD (Apache MINA)
// * SSH Tools
//
// Note:
// * KTS-SSH may have occasional problems with some SFTP operations
import java.io.*
import java.util.ArrayList
import com.sshtools.j2ssh.transport.HostKeyVerification
import com.sshtools.j2ssh.SshClient
import com.sshtools.j2ssh.authentication.AuthenticationProtocolState
import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient
class SSHHost extends RemoteHost {
@Override
def canStream() {
true
}
@Override
def close() {
try {
ssh.close()
sftp.close()
} finally {
ssh = null
sftp = null
}
}
// attr_reader :credentials
//
// def SSHHost (opts={}) {
// @sftp = opts[:sftp]
// @session = opts[:sftp_client]
// @sftp_client = opts[:sftp_client]
//
// @credentials = {
// :address => opts[:address],
// :port => opts[:port]||22,
// :username => opts[:username],
// :password => opts[:password],
// }
//
// super
// }
// def clone() {
// clone = Host::Remote::Ssh.new(
// // pass session to clone so it'll share the ssh client (if its already connected)
// :session => @session,
// :address => @credentials[:address],
// :port => @credentials[:port],
// :username => @credentials[:username],
// :password => @credentials[:password]
// )
// super(clone)
// }
@Override
def isAlive(ctx=null) {
try {
return exist(cwd(ctx), ctx)
} catch (Throwable t) {
if_closed()
return false
}
}
// def toString() {
// if (isPosix()) {
// "Remote Posix //{@credentials[:address] || name()}"
// } else {
// "Remote Windows //{@credentials[:address] || name()}"
// }
// }
// checks for the current working directory
// be aware that a command being executed may possibly change this value at some point
// during its execution (in which case, PFTT will only detect that after the command has
// finished execution)
@Override
def cwd(ctx=null) {
if (ctx) {
ctx.fs_op0(self, EFSOp.cwd) {
return cwd(ctx)
}
}
// cwd ||= format_path(sftp_client(ctx).pwd)
}
// alias :pwd :cwd
@Override
def cd(path, ctx=null) {
if (!path) {
// popd may have been called when dir_stack empty
throw new NullPointerException("path not specified")
}
if (ctx) {
ctx.fs_op1(self, EFSOp.cd, path) |new_path| {
return cd(new_path, hsh, ctx)
}
}
path = format_path(path)
path = make_absolute(path)
// e-z same command on both
cmd("cd \"$path\"", ctx)
// cwd is cleared at start of exec, so while in exec, cwd will be empty unless cwd() called in another thread
cwd = path
// TODO dir_stack.clear unless hsh.delete(:no_clear) || false
return path
}
@Override
def env_values(ctx=null) {
env_str = cmd('set', ctx).output
def env = []
for (def line : env_str.split("\n")) {
def i = line.index('=')
if (i) {
def name = line.substring(0, i)
def value = line.substring(i+1, line.length())
if (isPosix(ctx)) {
if (value.startsWith('"')||value.startsWith("'"))
value = value.substring(1, value.length()-2)
}
env[name] = value
}
}
return env
} // end def env_values
@Override
def env_value(name, ctx=null) {
// get the value of the named environment variable from the host
if (isPosix(ctx)) {
return unquote_line('echo $'+name, ctx)
} else {
def out = unquote_line("echo %$name%", ctx)
if (out == "%$name%") {
// variable is not defined
return ''
} else {
return out
}
}
} // end def env_value
@Override
def mtime(file, ctx=null) {
if (ctx) {
ctx.fs_op1(self, EFSOp.mtime, file) |new_path| {
return mtime(new_path, ctx)
}
}
try {
return sftp(ctx).getAttributes(file).getModifiedTime().longValue()
} catch (Exception ex) {
return 0
}
}
@Override
def directory(path, ctx=null) {
if (ctx) {
ctx.fs_op1(self, EFSOp.is_dir, path) |new_path| {
return directory(new_path, ctx)
}
}
try {
return sftp(ctx).getAttributes(file).isDir
} catch(Exception ex) {
if_closed()
return false
}
}
// def glob(path, spec, ctx, &blk) {
// if (ctx) {
// ctx.fs_op2(self, :glob, path, spec) |new_path, new_spec| {
// return glob(new_path, new_spec, ctx, blk)
// }
// }
//
// l = list(path, ctx)
// unless spec.nil? or spec.length == 0
// l.delete_if do |e|
// !(e.include?(spec))
// end
// end
// return l
// }
@Override
def list(path, ctx) {
if (ctx) {
ctx.fs_op1(self, EFSOp.list, path) |new_path| {
return list(new_path, ctx)
}
}
try {
list = []
_sftp = sftp(ctx)
dir = _sftp.openDirectory(path)
children = ArrayList.new()
while (_sftp.listChildren(dir, children) > -1) {
}
dir.close()
i = 0
while (i < children.size) {
list.push(format_path(children.get(i).getAbsolutePath()))
i += 1
}
return list
} catch (Exception ex) {
// if_closed()
//// if (ctx) {
//// ctx.pftt_exception(self, $!, self)
//// } else {
//// // TODO Tracing::Context::Base.show_exception($!)
//// }
throw ex
}
} // end def list
@Override
def read_lines(path, ctx=null, max_lines=16384) {
def output = new ByteArrayOutputStream()
sftp(ctx).get(path, output)
def reader = new BufferedReader(new InputStreamReader(output))
while ( ( line = reader.readLine() ) != null && !(lines.size()> max_lines)) {
lines.add(line)
}
reader.close()
lines
}
@Override
def read(path, ctx=null) {
def output = new ByteArrayOutputStream()
sftp(ctx).get(path, output)
if (ctx) {
ctx.read_file(self, out, path) |new_path| {
return read(new_path, ctx)
}
}
output.toString()
}
@Override
def write(string, path, ctx) {
if (ctx) {
ctx.write_file(self, string, path) |new_string; new_path| {
return write(new_string, new_path, ctx)
}
}
mkdir(File.dirname(path), ctx)
// TODO
try {
def input = new ByteArrayInputStream(string.length)
input.write(string, 0, string.length)
sftp(ctx).put(input, path)
return true
} catch (Exception ex) {
if_closed()
// if (ctx) {
// ctx.pftt_exception(self, $!, self)
// } else {
// Tracing::Context::Base.show_exception($!)
// }
throw ex
}
}
// uploads file/folder to remote host
//
// local_file - local file/folder to copy
// remote_path - remote path to store at
// ctx - context
// opts - hash of
//
// :mkdir - true|false - default=true
// makes a directory to contain multiple files or a folder when uploading
//
// :transport_archive - true|false - default=false
// will (attempt to) archive the local files/folders into a 7zip archive file,
// upload it to the remote host and then decompress it. will install 7zip on
// the remote host if it is not present. If can't upload and execute 7zip on
// remote host, operation will fail.
// see transport_normal_if_decompress_failed
//
// :skip_cached_archive_mtime_check - true|false - default=false
// if true, if archive is already in cache, will use it no matter what.
// if false, will check if the original file(s)/folder(s) have been modified,
// and if yes, will replace the cached archive with the changes.
//
// :transport_normal_if_decompress_failed - true|false - default=true
// if can't decompress fail on remote host, automatically falls back on
// uploading it without archiving
//
// :prearchived - true|false - default=false
// indicates local file has already been archived AOT. archive will be
// uploaded and decompressed IF :transport_archive=true
//
// :transport_archive_no_local_cache - true|false - default=false
// if true, doesn't keep archive in local cache. otherwise, will keep archive in
// local cache to avoid recompressing it for next time.
//
@Override
def upload(local_file, remote_path, ctx, opts=[]) {
if (ctx) {
ctx.fs_op2(self, EFSOp.upload, local_file, remote_path) |new_local_file; new_remote_path| {
return upload(new_local_file, new_remote_path, ctx, opts)
}
}
// if remote_path exists operation will fail!
// therefore, you should check if it exists first
// then, depending on need, delete() or skip the upload
//
// if local_file is a file, remote_path MUST be a file too!!!!!!!!!!!!!
// (if local_file is a dir, remote_path can be a dir)
// LATER remove this gotcha/rule/limitation (implement using File.basename)
//
if (manager && manager.local_host.isWindows()) {
local_file = to_windows_path(local_file)
} else {
local_file = to_posix_path(local_file)
}
if (isWindows()) {
remote_path = to_windows_path(remote_path)
} else {
remote_path = to_posix_path(remote_path)
}
//
remote_path = no_trailing_slash(remote_path)
//
transport_archive = false
if (opts.transport_archive) {
// ensure 7zip is installed on remote host so it can be decompressed
if (ensure_7zip_installed(ctx)) {
unless (opts.prearchived) {
// archive file
local_path = manager.cache_archive(local_path, remote_path, ctx, opts)
}
transport_archive = true
}
}
//
// ensure the target directory exists (or we'll get an error)
if (opts.mkdir!=false) {
mkdir(File.dirname(remote_path), ctx)
}
try {
// TODO
sftp(ctx).put(BufferedInputStream.new(FileInputStream.new(local_file)), remote_path)
return true
} catch (Exception ex) {
if_closed()
// if ctx
// ctx.pftt_exception(self, $!, self)
// else
// Tracing::Context::Base.show_exception($!)
throw ex
}
//
if (transport_archive) {
// decompress archive
decompress_ret = exec!("7za a -y -o//{File.dirname(remote_path)} //{remote_path}")
// if (opts[:transport_archive_no_local_cache]) {
// unless (opts[:prearchived]) {
// if (!opts.has_key?(:multi_host) or is_last?) {
// manager.local_host.delete(local_cache_archive, ctx)
// }
// // TODO sync
//
// }
// // else: leave archive in cache for next time
// }
// if (!decompress_ret[2]) {
// if (opts[:transport_normal_if_decompress_failed]) {
// // upload normal file
// return upload(local_file, remote_path, ctx, {:mkdir=>opts[:mkdir]!=false})
// } else {
// raise 'RemoteDecompressFail', decompress_ret
// }
// }
// file uploaded and decompressed ok
// leave file on remote server if decompression failed for manual triage purposes later
delete(remote_archive, ctx)
}
//
} // end def upload
def download(remote_file, local_path, ctx) {
if (ctx) {
// ctx.fs_op2(self, EFsOp.download, remote_file, local_path) do |new_remote_file, new_local_path| {
// return download(new_remote_file, new_local_path, ctx)
// }
}
//
try {
// TODO
sftp(ctx).get(remote_file, BufferedOutputStream.new(FileOutputStream.new(local_path)))
return true
} catch (Exception ex) {
if_closed()
// if ctx
// ctx.pftt_exception(self, $!, self)
// else
// Tracing::Context::Base.show_exception($!)
throw ex
}
//
} // end def download
protected
def _exist(path, ctx) {
try {
def a = sftp(ctx).getAttributes(path)
return ( a.isFile() || a.isDirectory() )
} catch (Exception ex) {
if_closed()
return false
}
}
def move_file(from, to, ctx) {
move_cmd(from, to, ctx)
}
def copy_file(from, to, ctx, mkdir) {
to = dirname(to)
if (mkdir) {
mkdir(to, ctx)
}
copy_cmd(from, to, ctx)
}
def if_closed() {
try {
if (session && session.isConnected()) {
session.disconnect()
session = null
}
if (sftp_client && sftp_client.isClosed()) {
sftp_client.quit()
sftp_client = null
}
if (sftp && ( sftp.isClosed() || !sftp.isOpen() ) {
sftp.close()
sftp = null
}
} catch (Exception ex) {
}
} // end def is_closed
class SshExecHandle extends ExecHandle {
def channel, stderr, stdout, stderr_len, stdout_len
def SshExecHandle(channel) {
channel = channel
stderr = ''
stdout = ''
stderr_len = 0
stdout_len = 0
}
def isOpen() {
channel.isOpen
}
def close() {
// LATER begin
channel.close
// rescue
// end
}
def write_stdin(stdin_data) {
channel.send_data(stdin_data)
}
def hasStderr() {
stderr.length() > 0
}
def hasStdout() {
stdout.length() > 0
}
def read_stderr() {
def x = stderr
stderr = ''
return x
}
def read_stdout() {
def x = stdout
stdout = ''
return x
}
def post_stdout(data) {
stdout = data
stdout_len += data.length
}
def post_stderr(data) {
stderr = data
stderr_len += data.length
}
def stdout_full(opts) {
opts.max_len > 0 && stdout_len >= opts.max_len
}
def stderr_full(opts) {
opts.max_len > 0 && stderr_len >= opts.max_len
}
} // end class SshExecHandle
def _exec_impl(command, opts, ctx, block) {
//
if (opts.hasProperty('chdir') && opts.chdir) {
if (isWindows(ctx))
command = "CMD /C pushd $opts[:chdir] & $command & popd"
else
command = "pushd $opts[:chdir] && $command && popd"
}
// type com.sshtools.j2ssh.session.SessionChannelClient
exec = session(ctx).openSessionChannel
if (opts.hasProperty('env')) {
for (def k:opts.env.keySet()) {
exec.setEnvironmentVariable(k, opts.env[k])
}
}
def output = new ByteArrayOutputStream(1024)
def error = new ByteArrayOutputStream(1024)
exec.executeCommand(command)
if (opts.hasProperty('stdin_data')) {
stdin_data = opts.stdin_data
if (stdin_data) {
exec.getOutputStream().write(stdin_data, 0, stdin_data.length)
}
}
//
def lh = new SshExecHandle(exec)
//
def o, e
if (opts.hasProperty('by_line') && opts.by_line) {
o = exec_copy_lines(new InputStreamReader(exec.getInputStream()), false, lh, block, opts.max_len)
e = exec_copy_lines(new InputStreamReader(exec.getStderrInputStream()), true, lh, block, opts.max_len)
} else {
exec_copy_stream(new BufferedInputStream(exec.getInputStream()), output, false, lh, block, opts.max_len)
exec_copy_stream(new BufferedInputStream(exec.getStderrInputStream()), error, true, lh, block, opts.max_len)
o = output.toString()
e = error.toString()
}
//
exec.close()
exit_code = exec.getExitCode()
if (opts.hasProperty('exec_handle') && opts.exec_handle)
lh
else
[output:output.toString(), error: error.toString(), exit_code: exit_code]
} // end def _exec_impl
def _delete(path, ctx) {
if (isWindows(ctx)) {
path = to_windows_path(path)
cmd("DEL /Q /F \"//{path}\"", ctx)
} else {
path = to_posix_path(path)
exec("rm -rf \"//{path}\"", ctx)
}
}
def _mkdir(path, ctx) {
try {
sftp_client(ctx).mkdir(path)
true
} catch (Exception ex) {
if_closed
// if (ctx) {
// ctx.pftt_exception(self, ex, self)
// } else {
// Tracing::Context::Base.show_exception(ex)
// }
throw ex
}
}
class AllowAnyHostKeyVerification implements HostKeyVerification {
def verifyHost(host, pk) {
true
}
}
def session(ctx) {
if (session) {
return session
}
session = new SshClient()
session.connect(credentials[:address], @credentials[:port], AllowAnyHostKeyVerification.new)
def pwd = new PasswordAuthenticationClient()
pwd.setUsername(credentials[:username])
pwd.setPassword(credentials[:password])
def result = session.authenticate(pwd)
if (result != AuthenticationProtocolState.COMPLETE) {
throw new IllegalStateException('WrongPassword')
}
session
} // end def session
def sftp_client(ctx) {
if (sftp_client) {
return sftp_client
}
sftp_client = session(ctx).openSftpClient
}
def sftp(ctx) {
if (sftp) {
return sftp
}
sftp = session(ctx).openSftpChannel //SftpSubsystemClient
} // end def sftp
} // end public class SSHHost

View File

@@ -1,136 +0,0 @@
package com.mostc.pftt
//
//class Scenario {
//
// attr_accessor :working_fs, :remote_fs, :date, :database
// attr_reader :id
//
// def initialize(id, working_filesystem_scenario, *optional_other_scenarios)
// @id = id
// @working_fs = working_filesystem_scenario
// optional_other_scenarios.each do |scenario|
// unless (scenario) {
// next // for from_xml
// end
// case scenario.scn_type
// when :remote_file_system
// @remote_fs = scenario
// when :date
// @date = scenario
// when :database
// @database = scenario
// end
// end
// end
//
// //////////////// start message encoding/decoding //////////////////////
// def toXML serial
// // TODO
// end
//
// def self.msg_type
// 'scenario'
// end
//
// def self.fromXML
// end
// //////////////// end message encoding/decoding //////////////////////
//
// def execute_script_start(env, test, script_type, deployed_script, php_binary, php_build, current_ini, host)
// values.each do |ctx|
// ctx.execute_script_start(env, test, script_type, deployed_script, php_binary, php_build, current_ini, host)
// end
// end
//
// def execute_script_stop(test, script_type, deployed_script, php_binary, php_build, host)
// values.each do |ctx|
// ctx.execute_script_stop(test, script_type, deployed_script, self.php_binary, php_build, host)
// end
// end
//
// def create_ini(platform, ini=nil)
// if platform != :windows and platform != :posix
// raise ArgumentError, 'platform must be :windows or :posix'
// end
//
// values.each do |scn|
// ini = scn.create_ini(platform, ini)
// end
//
// return ini
// end
//
// def values
// list = [@working_fs]
// if @remote_fs
// list << @remote_fs
// end
// if @date
// list << @date
// end
// if @database
// list << @database
// end
// return list
// end
//
// def teardown(host)
// values.each do |scn|
// scn.teardown(host)
// end
// end
//
// def deploy(host)
// values.each do |scn|
// scn.deploy(host)
// end
// end
//
// def to_s
// "[Set //{@id} //{values.inspect}]"
// end
//
// def == (o)
// o.instance_of?(Scenario::Set) and o.id == @id
// end
//
// class Part
// // TODO include PhpIni::Inheritable
//
// def deploy(host_info)
// end
//
// def teardown(host_info)
// end
//
// def execute_script_start(env, test, script_type, deployed_script, deployed_php, php_build_info, php_ini, host, platform)
// end
//
// def execute_script_stop(test, script_type, deployed_script, deployed_php, php_build_info, host_info)
// end
//
// def docroot middleware
// middleware.docroot
// end
//
// def deployed_php(middleware)
// nil
// end
//
// // subclasses should override this!!
// def scn_type
// return :unknown
// end
//
// def to_s
// scn_name
// end
//
// def self.instantiable
// All << self
// end
// end // class Part
//
//} // end class Scenario
//

View File

@@ -1,13 +0,0 @@
# use mkinstaller for most apps
# see http://mkinstaller.nisu.org/
module App
class Base
# :name :type
# configure()
# install()
# start()
# stop()
# uninstall()
end
end

View File

@@ -1,8 +0,0 @@
class Drupal7 < App
def install
# download
# install
# configure
end
end

View File

View File

@@ -1,97 +0,0 @@
package com.mostc.pftt
//
//require 'tracing.rb'
//
//module Base
//
//class RunOptions
//
// def self.msg_type
// 'run_options'
// end
//
//end
//
//class TestPack < Tracing::FileManager
//
// attr_reader :correct_test_count
//
// def initialize correct_test_count
// @correct_test_count = correct_test_count
// end
//
// def self.msg_type
// 'test_pack'
// end
//
// def load_test_case_by_name case_name
// []
// end
//
// def load_all_test_cases
// []
// end
//
//end # class TestPack
//
// class CaseName
//
// attr_reader :name_pattern
//
// def initialize name_pattern
// @name_pattern = name_pattern
// end
//
// def self.msg_type
// 'case_name'
// end
//
// def self.fromXML
// end
//
// def toXML
// end
//
// end # class CaseName
//
// class AllCases
//
// attr_reader :correct_test_case_count
//
// def initialize correct_test_case_count
// @correct_test_case_count = correct_test_case_count
// end
//
// def self.msg_type
// 'all_cases'
// end
//
// def self.fromXML
// end
//
// def toXML
// end
//
// end # class AllCases
//
//class Build < Tracing::FileManager
//
// def self.msg_type
// 'build'
// end
// def msg_type # TODO
// 'build'
// end
//
//end # class Build
//
//class Configuration < Tracing::FileManager
//
// def self.msg_type
// 'configuration'
// end
//
//end # class Configuration
//
//end # module Base

View File

@@ -1,5 +0,0 @@
package com.mostc.pftt
abstract class AbstractCaseRunner {
} // abstract class AbstractCaseRunner

View File

@@ -1,14 +0,0 @@
module CaseRunner
class BaseCaseRunner
end
class GroupByAny < BaseCaseRunner
end
class GroupByConfiguration < BaseCaseRunner
end
end # module CaseRunner

View File

View File

@@ -1,66 +0,0 @@
#require "xmlrpc/client"
#
## Make an object to represent the XML-RPC server.
#server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
#
## Call the remote server and get our result
#result = server.call("sample.sumAndDifference", 5, 3)
#
#sum = result["sum"]
#difference = result["difference"]
#
#puts "Sum: #{sum}, Difference: #{difference}"
#
class LockClient
def xmlrpc_server
return '10.200.50.51'
end
def stat_server
'http://10.200.50.51/'
end
def dep_server
'\\\\storage\\matt\PFTT\Deps'
end
def phpt_server
'\\\\storage\\matt\PHPT\Deps'
end
def phpbuild_server
'\\\\storage\\matt\PHP-Builds'
end
def database_server
'web_server'
end
def config_server
'\\\\storage\\matt\PFTT\Config'
end
def update_server
'\\\\storage\\matt\PFTT'
end
def lock(host_name)
# add to list
# ensure heartbeat thread is running
# will need to renew each lock every 5 minutes
end
def lock_renew(host_name, lock_id)
end
def release(host_name, lock_id)
end
def view
return [
{:host_name=>'OI1-PHP-WDW-10', :status=>:ready, :os=>'Windows 2003r2 SP0', :arch=>'x64', :ip_address=>'10.200.30.11'},
{:host_name=>'OI1-PHP-WDW-25', :status=>:locked, :os=>'Windows Vista SP2', :arch=>'x86', :ip_address=>'10.200.30.12'},
{:host_name=>'OI1-PHP-WDW-29', :status=>:ready, :os=>'Windows 8 Client M3', :arch=>'x86', :ip_address=>'10.200.30.13'},
{:host_name=>'PBS-0', :status=>:ready, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.14'},
{:host_name=>'PBS-1', :status=>:locked, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.15'},
{:host_name=>'PBS-2', :status=>:ready, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.16'},
{:host_name=>'AZ-WEB-PHP-0', :status=>:ready, :os=>'Azure Web 2008', :arch=>'x64', :ip_address=>'157.60.40.11'},
{:host_name=>'AZ-VM-PHP-0', :status=>:ready, :os=>'Azure VM 2008', :arch=>'x64', :ip_address=>'157.60.40.12'},
{:host_name=>'AZ-WKR-PHP-0', :status=>:ready, :os=>'Azure Worker 2008', :arch=>'x64', :ip_address=>'157.60.40.13'},
{:host_name=>'AZ-WEB-PHP-1', :status=>:locked, :os=>'Azure Web 2008r2', :arch=>'x64', :ip_address=>'157.60.40.14'},
{:host_name=>'AZ-VM-PHP-1', :status=>:ready, :os=>'Azure VM 2008r2', :arch=>'x64', :ip_address=>'157.60.40.15'},
{:host_name=>'AZ-WKR-PHP-1', :status=>:ready, :os=>'Azure Worker 2008r2', :arch=>'x64', :ip_address=>'157.60.40.16'}
]
end
end # class LockClient

View File

@@ -1,19 +0,0 @@
#require 'clients/lock.rb'
module Clients
class ClientBase
include Clients::Lock
def _common_ruby_runtime_prep
# share with #run_script and Console::Panel
end
def run_script(filename)
# TODO
end
end
end # module Clients

View File

@@ -1,163 +0,0 @@
#require "xmlrpc/client"
#
## Make an object to represent the XML-RPC server.
#server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
#
## Call the remote server and get our result
#result = server.call("sample.sumAndDifference", 5, 3)
#
#sum = result["sum"]
#difference = result["difference"]
#
#puts "Sum: #{sum}, Difference: #{difference}"
#
module Clients
module Lock
def update_config
unless $client
puts 'PFTT: error: not available: this PFTT client has not been set to use a specific PFTT server'
puts 'PFTT: update_config action requires a PFTT server. '
puts
exit(-12)
end
update_config
end
def upgrade
puts 'PFTT: upgrading PFTT'
puts 'PFTT: downloading changes'
exec("git pull")
update_config
puts 'PFTT: running installation script'
exec("rake install")
puts
puts 'PFTT: upgrade complete. newest version installed to #{__DIR__}'
puts
end
def lock_all(hosts)
return # TODO
unless $client
return # no PFTT server, ignore
end
hosts.each{|host|
if host.remote?
$client.net_lock(host[:host_name])
end
}
end
def release_all(hosts)
return # TODO
unless $client
return # no PFTT server, ignore
end
hosts.each{|host|
if host.remote?
$client.net_lock(host[:host_name])
end
}
end
def net_lock
unless $client
puts 'PFTT: error: not available: this PFTT client has not been set to use a specific PFTT server'
puts 'PFTT: net_lock action requires a PFTT server. '
puts
exit(-12)
end
CONFIG[:target_host_name].each{|host_name|
$client.net_lock(host_name)
puts "PFTT: locked #{host_name}"
}
puts
end
def net_release
unless $client
puts 'PFTT: error: not available: this PFTT client has not been set to use a specific PFTT server'
puts 'PFTT: net_release action requires a PFTT server. '
puts
exit(-12)
end
CONFIG[:target_host_name].each{|host_name|
$client.net_release(host_name)
puts "PFTT: released #{host_name}"
}
puts
end
def net_view
unless $client
puts 'PFTT: error: not available: this PFTT client has not been set to use a specific PFTT server'
puts 'PFTT: net_view action requires a PFTT server. '
puts
exit(-12)
end
report = Report::Network.new()
report.text_print()
end
class XMLRPCClient
def xmlrpc_server
return '10.200.50.51'
end
def stat_server
'http://10.200.50.51/'
end
def dep_server
'\\\\storage\\matt\PFTT\Deps'
end
def phpt_server
'\\\\storage\\matt\PHPT\Deps'
end
def phpbuild_server
'\\\\storage\\matt\PHP-Builds'
end
def database_server
'web_server'
end
def config_server
'\\\\storage\\matt\PFTT\Config'
end
def update_server
'\\\\storage\\matt\PFTT'
end
def lock(host_name)
# add to list
# ensure heartbeat thread is running
# will need to renew each lock every 5 minutes
end
def lock_renew(host_name, lock_id)
end
def release(host_name, lock_id)
end
def view
return [
{:host_name=>'OI1-PHP-WDW-10', :status=>:ready, :os=>'Windows 2003r2 SP0', :arch=>'x64', :ip_address=>'10.200.30.11'},
{:host_name=>'OI1-PHP-WDW-25', :status=>:locked, :os=>'Windows Vista SP2', :arch=>'x86', :ip_address=>'10.200.30.12'},
{:host_name=>'OI1-PHP-WDW-29', :status=>:ready, :os=>'Windows 8 Client M3', :arch=>'x86', :ip_address=>'10.200.30.13'},
{:host_name=>'PBS-0', :status=>:ready, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.14'},
{:host_name=>'PBS-1', :status=>:locked, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.15'},
{:host_name=>'PBS-2', :status=>:ready, :os=>'Gentoo Linux', :arch=>'x64', :ip_address=>'10.200.30.16'},
{:host_name=>'AZ-WEB-PHP-0', :status=>:ready, :os=>'Azure Web 2008', :arch=>'x64', :ip_address=>'157.60.40.11'},
{:host_name=>'AZ-VM-PHP-0', :status=>:ready, :os=>'Azure VM 2008', :arch=>'x64', :ip_address=>'157.60.40.12'},
{:host_name=>'AZ-WKR-PHP-0', :status=>:ready, :os=>'Azure Worker 2008', :arch=>'x64', :ip_address=>'157.60.40.13'},
{:host_name=>'AZ-WEB-PHP-1', :status=>:locked, :os=>'Azure Web 2008r2', :arch=>'x64', :ip_address=>'157.60.40.14'},
{:host_name=>'AZ-VM-PHP-1', :status=>:ready, :os=>'Azure VM 2008r2', :arch=>'x64', :ip_address=>'157.60.40.15'},
{:host_name=>'AZ-WKR-PHP-1', :status=>:ready, :os=>'Azure Worker 2008r2', :arch=>'x64', :ip_address=>'157.60.40.16'}
]
end
end # class XMLRPCClient
end # module Lock
end # module Clients

View File

@@ -1,108 +0,0 @@
require 'clients.rb'
module Clients
module PHP
# TODO function args
class Client < ClientBase
include Clients::PHP::Building
include Clients::PHP::Testing
def host_config(host)
# TODO host_config
end # def host_config
def cs
# LATER scenario config
end # def cs
def inspect
# inspects what the configuration and arguments will have pftt do for the core_full or core_part actions
# (lists PHPTs that will be run, hosts, middlewares, php builds and contexts)
report = Report::Inspect::Func.new(CONFIG.selected_tests().flatten())
return report.text_print()
end # def inspect
def host_config
# TODO
iis = Util::Install::IIS.new($hosts.first)
iis.ensure_installed
end # def host_config
def zip7(dir)
# TODO install 7 zip using msi
# TODO
php = PhpBuild.new('C:\\php-sdk\\builds\\5_4\\'+$php_build_path)
dir = 'C:/php-sdk/pftt-telemetry/'+php[:version]
#
# see http://docs.bugaco.com/7zip/MANUAL/switches/method.htm
# see http://www.comprexx.com/UsrHelp/Advanced_Compression_Parameters_(7-Zip_Archive_Type).htm
# see http://www.dotnetperls.com/7-zip-examples
# (-mmt seems to override mt=)
host = Host::Local.new
zip_file = host.mktempfile('.7z', nil)
cmd_string = "\""+host.systemdrive()+"\\Program Files\\7-Zip\\7z\" a -ms=on -mfb=20 -mx1 -m0=LZMA2:mt=32 -ssc #{zip_file} \"#{dir}\""
puts cmd_string
host.exec!(cmd_string, nil, {:null_output=>true})
return zip_file
end
def recover_psc
test_telem_dir = Host::Remote::PSC::HostRecoveryManager.new($hosts, $phps[0], $middlewares[0], $scenarios[0])
# $hosts.each do |host|
# i = Util::Install::IIS.new(host)
# i.ensure_installed
# end
# zip_file = zip7(test_telem_dir)
# puts zip_file
# upload(zip_file)
#
# base = lookup()
#
# store(test)
#
# report(base, test)
end # def recover_psc
def review
d = Tracing::Dashboard::Display.new()
s = Tracing::Dashboard::EnvVarSlash.new(Host::Local.new(), ARGV.join(' '), nil)#'C:\\php-sdk\\')
d.add(s)
s = Tracing::Dashboard::Diff.new(Host::Local.new())
d.add(s)
d.show # or d.show s.show ensures that d.show is called
# om = Diff::OverrideManager.new
#
# om.read
#
# exit
# diff = Diff::ZD::AllTestCases::SingleCombo::BaseRun.new(:added, Test::Telemetry::Folder::Phpt.new('C:\\php-sdk\\PFTT-Telemetry\\OI1-PHP-FUNC-15.2011-12-09_16-31-51_-0800'))
# #diff = Diff::ZD::AllTestCases::AllCombos::BaseMinusTest.new(:added, Test::Telemetry::Folder::Phpt.new('C:\\php-sdk\\PFTT-Telemetry\\Win2k8r2sp_539rc1_'), Test::Telemetry::Folder::Phpt.new('C:\\php-sdk\\PFTT-Telemetry\\Win2k8r2sp_539rc2_'))
#
# puts "All Extra Warnings(1): "
# puts diff.find('Warning').to_override
# puts
# puts "All Other Inserts/Deletes(2): "
# puts diff.find_not('Warning').to_s
# .to_chunk_replacements
# diff.save_chunk_replacements()
# exit
end # def review
end # class Client
end # module PHP
end # module Clients

View File

@@ -1,87 +0,0 @@
module Clients
module PHP
module Building
def build_php
host = Host::Local.new() # LATER, use remote host too
if host.windows?
# find Windows SDK
if host.exists?(host.systemdrive+'\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin')
add_to_path_temp(host.systemdrive+'\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Bin')
elsif host.exists?(host.systemdrive+'\\Program Files\\Microsoft SDKs\\Windows\\v6.0\\Bin')
add_to_path_temp(host.systemdrive+'\\Program Files\\Microsoft SDKs\\Windows\\v6.0\\Bin')
else
puts "PFTT: error: Can't find Windows SDK 6+ on Windows host. Therefore can't build PHP binary"
puts "PFTT: please install Windows SDK 6 from microsoft.com"
puts
exit(-20)
end
host.exec!("setenv /x86 /xp /release")
end
cd_php_sdk(host) # util.rb
unless host.exist?(args.build)
puts "PFTT: build not found! #{args.build} in "+host.cwd
exit(-21)
end
host.delete('Release')
host.delete('Release_TS')
host.exec!("buildconf")
if host.windows?
out_err, status = host.exec!("configure #{$cross_platform_config_ops} #{$windows_config_ops}")
else
out_err, status = host.exec!("configure #{$cross_platform_config_ops} #{$linux_config_ops}")
end
unless status
puts 'PFTT: PHP Build configure failed!'
exit(-22)
end
if host.posix?
host.exec!("make snap")
else
host.exec!("nmake snap")
end
build_success = false
if $cross_platform_config_ops.include?('--disable-zts')
build_success = host.exist?('Release')
else
build_success = host.exist?('Release_TS')
end
if build_success
puts 'PFTT: PHP Binary Built Successfully: see '+host.cwd
puts
else
puts 'PFTT: error: failed to build PHP Binary: see '+host.cwd
puts
exit(-1)
end
#
#
end
def get_php
# LATER remote host support
sg = Server::SnapshotGetter.new(Host::Local.new())
files = sg.ensure_latest_snapshot
puts files.inspect
end
def update_php
# LATER remote host support
su = Server::SVNUpdater.new(Host::Local.new())
su.execute
end
end # module Building
end # module PHP
end

View File

@@ -1,235 +0,0 @@
require 'time'
module Clients
module PHP
module Testing
def stress
# LATER implement stress testing
# LATER run ui test periodically during stress test
puts "PFTT: error: stress testing not implemented"
end
def unit
# LATER implement unit test support (run unit tests supplied with applications like mediawiki)
puts "PFTT: error: PHPUnit support not implemented"
end
def ui
# LATER implement selenium support
# mediawiki, joomla, drupal all have selenium frameworks
# wordpress may have a selenium framework (not sure)
puts "PFTT: error: ui action implemented"
end
def fuzz
# LATER? run same fuzz test on two+ hosts and compare the results
# useful for detecting weird behavior, like unlink() trimming trailing whitespace
end
def perf_pgc
puts "PFTT: error: perf_pgc action not implemented"
end
def core_list
# write list of selected tests to file
$testcases = CONFIG.selected_tests(false, false).flatten
f = File.open(CONFIG[:test_list_file], 'wb')
arw = Util::ArgRewriter.new(ARGV)
arw.cmd('core_part')
arw.remove('--tests')
# demonstrate that user can use # to cause lines in file to be ignored
# also store command line so user can copy and paste it to run this list of tests
f.puts("#\r")
f.puts("# run the line below to run the list of tests in this file: \r")
f.puts("# #{arw.join}\r")
f.puts("#\r")
$testcases.each{|test_case| f.puts("#{test_case.full_name}\r")}
f.close
end
def core_full
_core(:core_full)
end
def core_part
_core(:core_part)
end
def perf
_core(:perf)
end
protected
def _core(action)
#
if $debug_test
# ensure host(s) have a debugging tool installed
missing_debugger = false
$hosts.map{|host|
puts "PFTT: checking #{host} for a debugger..."
unless host.has_debugger?
missing_debugger = true
if host.windows?
puts "PFTT: error: install Debugging Tools For Windows (x86) on #{host}"
else
puts "PFTT: error: install GDB on #{host}"
end
end
}
if missing_debugger
puts "PFTT: to continue with --debug, install debugger(s) on listed host(s)"
puts
exit(-5)
else
puts "PFTT: host(s) have debuggers, continuing..."
end
end
#
unless action == :perf
$testcases = CONFIG.selected_tests()
end
#
# add more threads to keep track of more hosts, but limit the size
$thread_pool_size = $thread_pool_size * $hosts.length
if $thread_pool_size > 60
$thread_pool_size = 60
end
#
# stop Forefront Endpoint Protection and windows search service/indexer
# this will speed up deployment and test runtime by 15-30%
hosts_to_restore = []
test_ctx = nil
begin
# lock hosts with PFTT Server (if available) so they aren't used by two PFTT clients at same time
lock_all($hosts)
if action == :core_full
$hosts.each{|host|
if host.windows?
host.exec!('elevate net stop wsearch')
host.exec!('elevate TASKKILL /IM MsMpEng.exe')
hosts_to_restore.push(host)
end
}
end
start_time = Time.now()
begin
# if core_full automatically do host configuration
if action == :core_full
host_config
end
puts '139'
sm = Tracing::Stage::StageManager.new
puts '141'
if action == :perf
puts '143'
test_bench = Test::Runner::Wcat.new(sm)
else
puts '146'
test_bench = Test::Runner::Phpt.new(sm) # TODO $phps, $hosts, $middlewares, $scenarios
end
puts '149'
puts '152'
# finally do the testing...
# iterate over all hosts, middlewares, etc..., running all tests for each
test_ctx = test_bench.iterate( $phps, $hosts, $middlewares, $scenarios, $testcases)
puts '155'
end_time = Time.now()
run_time = end_time - start_time
#
# for core_full, reboot remote hosts to clean them up for next time
unless action == :core_part
$hosts.each do |host|
if host.remote?
if host.windows?
host.exec!('shutdown /r /t 0')
else
host.exec!('shutdown -r -t 0')
end
sleep(5)
end
end
end
#
ensure
# ensure hosts are unlocked
release_all($hosts)
#
end
#
ensure
if action == :core_full
# restart wsearch on hosts where it was already running (also, restart MsMpEng.exe)
hosts_to_restore.each{|host|
if host.windows?
host.exec!('elevate net start wsearch')
host.exec!('msmpeng')
end
}
#
end
puts '194'
end
########## done testing, collect/store results, report and cleanup #############
#
# test bench would have already done a summary for this one host/middleware so don't need to repeat it
if $html_report or not ( $hosts.length == 1 and $middlewares.length == 1 and ( $brief_output or action == :core_part ) )
# for core_part user shouldn't have to take time navigating through a redudant report
# to get to the telemetry they need
if action == :perf
report == Report::Run::ByHost::Perf.new()
else
report = Report::Run::ByHost::Func.new()
end
# TODO TUE report.text_print()
# show auto triage report
if $auto_triage
Report::Triage.new(test_ctx.tr).text_print()
end
#
# if --html, show html formatted report in web browser
if $html_report
localhost = Host::Local.new()
filename = localhost.mktmpfile("report.html", report.html_string())
# LATER linux support for showing web browser
localhost.exec!("start \"#{filename}\"")
end
end
#
#
end # def _core
end # module Testing
end # module PHP
end # module Clients

View File

@@ -1,332 +0,0 @@
module Diff
class File
def self.guess_format(file)
end
def initialize(file=nil)
@format = Format::Unified.new
end
def add_chunk(chunk)
if chunk.file_name != @last_file_name
@file.write_lines(@format.write_header())
end
@file.write(@format.lines(chunk))
end
def read_init()
end
def read_chunk()
@format.read_chunk(@file)
end
class Format
class Original
#0a1,6
#>
#<
#---
end # class Original
class Edit
# 24a
# .
end # class Edit
class Context
# *** [filename] ''timestamp''
# --- [filename] ''timestamp''
# ***
# *** 1,3 ***
# --- 1,9 ---
# +
# !
end # class Context
class Unified
# --- [filename] ''timestamp''
# +++ [filename] ''timestamp''
# @@
#+
#-
def initialize()#file_a=nil, file_b=nil, time_a=nil, time_b=nil)
end
def read_chunk(file)
while !file.eof?
line = file.next_line # TODO
if line.starts_with?('+++') or line.starts_with?(' +++')
line_type = :header_right
elsif line.starts_with?('+')
line_type = :added
elsif line.starts_with?('---') or line.starts_with?(' ---')
line_type = :header_left
elsif line.starts_with?('-')
line_type = :removed
elsif line.starts_with?(' @') or line.starts_with?('@')
line_type = :shifted
else
line_type = :unchanged
end
case line_type
when :shifted
parse_location(line)
when :header_left
parse_header_left(line)
when :header_right
parse_header_right(line)
else
# TODO increment location
end
@last_line_type = line_type
if line_type != @last_line_type
return Diff::Chunk.new(str, @file_name, line_number, 0)
end
end # while
end # def read_chunk
def parse_location(line)
# TODO
# @@ -a,b +c,d @@
# a = removed chunk starting line number
# b = number of lines of removed chunk
# c = inserted chunk starting line number
# d = number of lines of inserted chunk
end
def parse_header_left(line)
# TODO
end
def parse_header_right(right)
# TODO
end
def write_header()
# TODO
[]
end
def line(chunk)
location(chunk)
if chunk.inserted?
lines(chunk).map do |line|
"+#{line}"
end
elsif chunk.removed?
lines(chunk).map do |line|
"-#{line}"
end
else
lines(chunk)
end
end
def location(chunk)
# TODO
chunk.line_number
end
end # class Unified
end # class Format
end # class File
class ChunkReplacementsFile
def initialize(file_name)
end
def read
end
def write
end
end # class ChunkReplacementsFile
class Chunk
attr_reader :str, :file_name, :type, :line_number, :column
def initialize(str, file_name, line_number, column, type)
case type
when :insert
when :delete
when :equals
else
raise ArgumentError
end
@type = type
@str = str
@file_name = file_name
@line_number = line_number
@column = column
end
def lines
@_lines ||= @str.split("\n")
end
def out_column
lines().last.length
end
def line_count
lines().length
end
def to_s
"#{@file_name}:#{@type}:#{@line_number}:#{@column}:#{@str}"
end
def include?(up_needle, down_needle=nil)
if @str.nil?
return false
elsif down_needle
return ( @str.upcase.include?(up_needle) or @str.downcase.include?(down_needle) )
else
return ( @str.include?(up_needle) )
end
end
def delete?
type == :delete
end
def insert?
type == :insert
end
def equals?
type == :equals
end
def opposite
if equals?
self
end
Chunk.new(@str, @file_name, @line_number, @column, (@type==:delete)?:insert: :delete)
end
class Array # TODO TUE < TypedArray(Diff::Chunk)
def initialize
super
@files = {}
@str = nil
end
def push(chunk)
@files[chunk.file_name]||=[]
@files[chunk.file_name].push(chunk)
clear_string
super(chunk)
end
def delete(chunk)
clear_string
super(chunk)
end
def to_s
unless @str
gen_string
end
return @str
end
# TODO def to_chunk_replacement(zd)
# chunk_replacements = {}
#
# @files.map do |file_name, chunks|
# chunks.each do |rep_chunk|
# org_chunk = zd.expected(rep_chunk)
#
# chunk_replacements[org_chunk] = rep_chunk
# end
# end
#
# return ChunkReplacementFile.new(nil, chunk_replacements)
# end
def to_override
str = ''
@files.map do |file_name, chunks|
file_name = file_name.gsub('C:\\php-sdk\\PFTT-Telemetry\\OI1-PHP-FUNC-15.2011-12-09_14-05-34_-0800/CLI/', '') # TODO TUE
file_name = file_name.gsub('.diffx', '.phpt') # TODO TUE
chunks.each do |chunk|
if chunk.type == :insert
str += "<insert test_case=\"#{file_name}\">#{chunk.str}</insert>"
elsif chunk.type == :delete
str += "<delete test_case=\"#{file_name}\">#{chunk.str}</delete>"
end
end
str += "\n"
end
return str
end
protected
def clear_string
@str = nil
end
def gen_string
str = ''
# TODO generate a 'diff like'/pretty presentation for email and .diff and .diffx files
@files.map do |file_name, chunks|
file_name = file_name.gsub('C:\\php-sdk\\PFTT-Telemetry\\PH4.2011-12-06_17-41-15_-0800/CLI/', '') # TODO TUE
file_name = file_name.gsub('.diffx', '.phpt') # TODO TUE
str += "#{file_name}:\n"
str += "inserted:\n"
chunks.each do |chunk|
if chunk.type == :insert
line_count = chunk.str.split("\n").length
str += "--- #{chunk.line_number},#{line_count} --- \n"#c#{chunk.column} ---"
chunk.str.split("\n").each do |line|
str += "+#{line}\n"
end
end
end
str += "\n"
str += "removed:\n"
chunks.each do |chunk|
if chunk.type == :delete
line_count = chunk.str.split("\n").length
str += "--- #{chunk.line_number},#{line_count} --- \n"#c#{chunk.column} ---"
chunk.str.split("\n").each do |line|
str += "-#{line}\n"
end
end
end
str += "\n\n"
end
puts str
@str = str
end
end # class Array
end # class Chunk
end

View File

@@ -1,633 +0,0 @@
require 'abstract_class'
require 'iconv'
module Diff
module Engine
class BaseDiff
#abstract
attr_accessor :_diff # TODO
def initialize( om, expected, actual, test_ctx, host, middleware, scn_set, php )
@om = om
@expected = expected
@actual = actual
@test_ctx = test_ctx
@host = host
@middleware = middleware
@scn_set = scn_set
@php = php
# TODO character encoding
# also an issue in _compare_line()
# @iconv = Iconv.new('US-ASCII//IGNORE', 'UTF-8')
end
def self.from_xml(xml)
# TODO TUE
d = Diff::Engine::Formatted::Php5.new(Diff::OverrideManager.new(), '', '', nil, nil, nil, nil, nil)
d._diff = []
xml.each do |x|
x.map do |tag_name, chunks|
chunks.each do |chunk|
case tag_name
when 'delete'
d._diff.push([:delete, chunk['text'], chunk['@line'], nil])
when 'insert'
d._diff.push([:insert, nil, chunk['@line'], chunk['text']])
when 'equals'
d._diff.push([:equals, chunk['text'], chunk['@line'], nil])
end
end
end
end
return d
end
def to_xml(serial)
equals = []
delete = []
insert = []
chunk_text = ''
last_chunk_type = nil
diff().each do |line|
chunk_type = line[0]
text = (chunk_type==:insert)?line[3]:line[1]
if text.nil?
next
end
# TODO convert to UTF-8
text = Iconv.conv('UTF-8//IGNORE', 'UTF-8', text)
# merge contiguous chunks of same type
if (last_chunk_type.nil? or last_chunk_type == chunk_type) and chunk_text
chunk_text += text
# if chunk_text
# chunk_text += text
# else
#chunk_text = text
# end
else
if chunk_text
# TODO TUE
if false#@om.ignore?(Chunk.new(chunk_text, 'file_name', 0, 0, last_chunk_type))
chunk_text = ''
else
serial.startTag(nil, (case last_chunk_type
when :delete
'delete'
when :insert
'insert'
when :equals
'equals'
end))
serial.text(chunk_text)
serial.endTag(nil, (case last_chunk_type
when :delete
'delete'
when :insert
'insert'
when :equals
'equals'
end))
end
end
chunk_text = text
end
last_chunk_type = chunk_type
end
end # def to_xml
def to_s
@s ||= diff.map do |line|
case line[0]
when :insert then '+'
when :delete then '-'
else ''
# use iconv to fix character encoding problems
# TODO end + (@iconv.conv(String.not_nil(line[(line[0]==:delete)?1:3])).gsub(/\n\Z/,''))
end + ((String.not_nil(line[(line[0]==:delete)?1:3])).gsub(/\n\Z/,''))
end.join("\n")
end
def stat
{
:inserts=>0,
:deletes=>0
}
end
def match?
@match ||= changes.zero?
end
def changes
@changes ||= diff.count{|token| next true unless token[0]==:equals}
end
protected
def diff
@_diff ||= _get_diff(
@expected.lines.map{|i|i}, # we want to keep the separator
@actual.lines.map{|i|i} # so we can't just split
)
end
protected
# This method gets replaced by sub-classes and is the part that does the actual
# comparrisons.
def _compare_line( expectation, result )
expectation == result or (result.rstrip!=nil and expectation.rstrip.chomp == result.rstrip.chomp)
end
def _get_diff( expectation, result )
prefix = _common_prefix( expectation, result )
if prefix.length.nonzero?
expectation.shift prefix.length
result.shift prefix.length
end
suffix = _common_suffix( expectation, result )
if suffix.length.nonzero?
expectation.pop suffix.length
result.pop suffix.length
end
return (
_tokenize( prefix, :equals ) +
_diff_engine( expectation, result )+
_tokenize( suffix, :equals )
)
end
def _diff_engine( expectation, result )
return _tokenize( result, :insert ) if expectation.empty?
return _tokenize( expectation, :delete ) if result.empty?
case
when expectation.length < result.length
# test to see if the expectation is *inside* the result
start = 0
while start+expectation.length <= result.length
return(
_tokenize( result.first( start ), :insert ) +
_tokenize( result.slice( start, expectation.length ), :equals )
_tokenize( result.dup.drop( start + expectation.length ), :insert )
) if _compare_lines( expectation, result.slice( start, expectation.length ) )
start +=1
end
when result.length < expectation.length
# test to see if the result is *inside* the expectation
start = 0
while start+result.length <= expectation.length
return(
_tokenize( expectation.first( start ), :insert ) +
_tokenize( result, :equals )
_tokenize( expectation.dup.drop( start + result.length ), :insert )
) if _compare_lines( expectation.slice( start, result.length ), result )
start +=1
end
end
lcs_max = 500
chunk_size = 50
if (expectation.length + result.length) < lcs_max
# try using LCS
line_diffs = _diff_lcs( expectation, result)
elsif [expectation.length,result.length].min > chunk_size
# chunk off a bit & try again
line_diffs = _reduce_noise(
_get_diff( expectation.first(chunk_size), result.first(chunk_size) )+
_get_diff( expectation.dup.drop(chunk_size), result.dup.drop(chunk_size) )
)
else
# last resort.
line_diffs = _tokenize( expectation, :delete ) + _tokenize( result, :insert )
end
# $temp_console_lock.synchronize do
# puts "expectation"
# puts expectation
# puts "result"
# puts result
# line_diffs.each do |line_info|
# puts line_info.inspect
# end
# STDIN.gets() # wait for input TODO THU
# end
# #
# # if in interactive mode, prompt the user to debug each diff
# chunk_replacement = {}
# if TODO $interactive_mode
# line_diffs.each{|line_info|
# if line_info[0] == :delete or line_info[0] == :insert
# diff_type = line_info[0]
# expect_line = line_info[1]
# line_num = line_info[2]
# actual_line = line_info[3]
#
# # break up differences within the line into individual changes
# # and then prompt the user for them
# dlm = DiffLineManager.new(line_num, expect_line, actual_line)
#
# #
# @test_ctx.semaphore4.synchronize {
# while dlm.get_next
# if @test_ctx.chunk_replacement.has_key?(dlm.chunk)
# dlm.replace(@test_ctx.chunk_replacement[dlm.chunk])
# elsif chunk_replacement.has_key?(dlm.chunk)
# dlm.replace(chunk_replacement[dlm.chunk])
# else
# while not prompt(chunk_replacement, dlm)
# # keep prompting if we're supposed to
# end
#
# if dlm.skip_file or dlm.skip_line
# break
# end
# end
# end
# }
# if dlm.diff.empty?
# line_diffs.delete
# end
# if dlm.skip_file
# break
# end
# #
#
# end
# }
# end
# #
return line_diffs
end
class DiffLineManager
attr_reader :diff, :modified_expect_line, :original_expect_line, :actual_line, :line_num
attr_accessor :skip_file, :skip_line
def initialize(line_num, expect_line, actual_line)
@line_num = line_num
@modified_expect_line = expect_line
@original_expect_line = expect_line
@actual_line = actual_line
@diff = diff_line(expect_line, actual_line)
@diff_idx = 0
@skip_file = false
@skip_line = false
end
def get_next
if @diff_idx < @diff.length
d = @diff[@diff_idx]
@diff_idx += 1
return d
else
return nil
end
end
def delete?
@diff[@diff_idx][3] == :delete
end
def original_expect_section
original_expect_line # TODO
end
def modified_expect_section
modified_expect_line # TODO
end
def ignore
@diff.delete(@diff_idx)
@diff_idx -= 1
if @diff_idx < 0
@diff_idx = 0
end
end
def in_col
@diff[@diff_idx][0]
end
def out_col
@diff[@diff_idx][1]
end
def chunk
@diff[@diff_idx][2]
end
def delete
@modified_expect_line = @modified_expect_line[0..in_col]+@modified_expect_line[(@modified_expect_line.length-out_col-in_col)..@modified_expect_line.length]
ignore
end
def add
replace(chunk())
end
def replace(replace_with)
@modified_expect_line = @modified_expect_line[0..in_col]+replace_with+@modified_expect_line[(@modified_expect_line.length-out_col-in_col)..@modified_expect_line.length]
ignore
end
def matches?(replacement_chunk)
return _compare_line(@modified_expect_line[in_col..out_col], replacement_chunk)
end
protected
def diff_line(str_a, str_b)
if str_a == str_b
[]
elsif str_a.length>str_b.length
_diff_line(str_b, str_a, :delete, :insert)
else
_diff_line(str_a, str_b, :insert, :delete)
end
end
def _diff_line(str_a, str_b, a_type, b_type) # str_b is longer
in_a = out_a = in_b = out_b = 0
match = last_match = true
diff = []
while out_a < str_a.length and out_b < str_b.length
match = ( str_a[out_a] == str_b[out_b] )
if match
out_b += 1
end
out_a += 1
if last_match!=match
in_a = out_a
in_b = out_b
diff.push([in_a, in_b, str_b[in_b..out_b], b_type])
end
last_match = match
end
if out_a < str_a.length
# remaining characters of str_b are missing from str_a
diff.push([in_a, in_b, str_b[in_b...str_b.length], b_type])
elsif out_b < str_b.length
# remaining characters of str_a are missing from str_b
diff.push([in_a, in_b, str_a[in_a...str_a.length], b_type])
end
if diff.empty?
diff.push([0, 0, str_a[0, str_a.length], b_type])
end
diff
end
end # end class DiffLineManager
def _diff_lcs( expectation, result )
#Build the LCS tables
common = Array.new( expectation.length+1 ).map! {|item| Array.new( result.length+1 ) }
lcslen = Array.new( expectation.length+1 ).map! {|item| Array.new( result.length+1, 0 ) }
expectation.each_index do |a|
result.each_index do |b|
common[a+1][b+1]= _compare_line( expectation[a], result[b] )
lcslen[a+1][b+1] = ( common[a+1][b+1] ? lcslen[a][b] + 1 : [ lcslen[a][b-1], lcslen[a-1][b] ].max )
end
end
# Transverse those tables to build the diff
cursor = {:a=>expectation.length,:b=>result.length}
diff = [];
while cursor.values.max > 0
case
when cursor[:a]>0 && cursor[:b]>0 && common[cursor[:a]][cursor[:b]]
# store token, chunk and line
diff.unshift [:equals,result[cursor[:b]-1],cursor[:b]]
cursor[:a]-=1 # Move left
cursor[:b]-=1 # Move up
when cursor[:b]>0 && (cursor[:a].zero? || lcslen[cursor[:a]][cursor[:b]-1] >= lcslen[cursor[:a]-1][cursor[:b]])
diff.unshift [:insert,expectation[cursor[:b]-1],cursor[:b],result[cursor[:b]-1]]
cursor[:b]-=1 # Move up
when cursor[:a]>0 && (cursor[:b].zero? || lcslen[cursor[:a]][cursor[:b]-1] < lcslen[cursor[:a]-1][cursor[:b]])
diff.unshift [:delete,expectation[cursor[:a]-1],cursor[:a],result[cursor[:b]-1]]
cursor[:a]-=1 # Move left
end
end
diff
end
def _reduce_noise( diff )
return diff if diff.length.zero?
ret = []
cache = Hash.new{|h,k|h[k]=[]}
diff.each do |token|
case token[0]
when :equals
[:insert,:delete].each do |action|
(cache.delete(action)||[]).each do |token|
ret.push token
end
end
ret.push token
else
#puts %Q{pushing: [#{token[0]}] #{token.inspect}}
cache[token[0]].push token
end
end
ret
end
# if the first diff has a bunch of deletes at the end that match inserts at the beginning of the second diff
# or inserts in at the tail of the 1st that match deletes at the head of the 2nd,
def _concatenate_diffs( first_half, second_half )
end
def _compare_lines( expectation, result )
return false unless expectation.length == result.length
expectation.zip(result).each do |ex, re|
return false unless _compare_line( ex, re )
end
return true
end
def _tokenize(ary,token,line=0)
ary.map do |item|
[token,item,line+=1]
end
end
def _common_prefix( expectation, result )
prefix = []
k=0
while k < expectation.length
return prefix if !_compare_line( expectation[k], result[k] )
prefix.push result[k]
k+=1
end
prefix
end
def _common_suffix expectation, result
_common_prefix( expectation.reverse, result.reverse ).reverse
end
end
class Exact < BaseDiff
def _compare_line( expectation, result )
expectation == result or expectation.rstrip.chomp == (result!=nil and result.rstrip.chomp)
end
end
class RegExp < BaseDiff
def _compare_line( expectation, result )
begin
expectation = Iconv.conv('UTF-8//IGNORE', 'UTF-8', expectation)
result = Iconv.conv('UTF-8//IGNORE', 'UTF-8', result)
r = Regexp.new(%Q{\\A#{expectation}\\Z})
begin
r.match(result) or (result!=nil and r.match(result.rstrip.chomp))
rescue
puts $! # TODO include in pftt bug
return false
end
rescue
puts $! # TODO include in bork
return false
end
end
end
class Formatted < RegExp
# Provide some setup for inheritance. Really I should come up with a way
# to abstract this, but yet another implementation will have to work for now.
class << self
def patterns arg=nil
case when arg.nil? #getting with inheritance
compiled = {}
ancestors.to_a.reverse_each do |ancestor|
next true unless ancestor.respond_to? :patterns
compiled.merge! ancestor.patterns(false)
end
compiled
when arg==false # getting without inheritance
@patterns ||= {}
else # setting
(@patterns||={}).merge! arg
end
end
end
def patterns arg={}
(@patterns ||= {}).merge! arg
self.class.patterns.merge( @patterns )
end
protected
#ok, now for the implementation:
def _compare_line( expectation, result )
if expectation == nil || result == nil
return false
end
rresult = result.rstrip.chomp
expectation = expectation.rstrip.chomp
if expectation == result or expectation == rresult
return true
else
rex = Regexp.escape(expectation)
# arrange the patterns in longest-to shortest and apply them.
# the order matters because %string% must be replaced before %s.
patterns(rex)
super( rex, result ) or super( rex, rresult )
end
end
# and some default patterns
# see run-tests.php line 1871
def patterns(rex)
rex.gsub!('%e', '.+') #[\\\\|/]',
rex.gsub!('%s', '.+') # TODO use platform specific EOL @host.EOL
# host.eol_escaped
rex.gsub!('%S', '[^\r\n]*')
rex.gsub!('%a', '.+')
rex.gsub!('%A', '.*')
rex.gsub!('%w', '\s*')
rex.gsub!('%i', '[+-]?\d+')
rex.gsub!('%d', '\d+')
rex.gsub!('%x', '[0-9a-fA-F]+')
rex.gsub!('%f', '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?')
rex.gsub!('%c', '.')
end
def show_expect_info
puts '%e => [\\\\|/] %s => .+'
puts '%S => [^\r\n]* %a => .+'
puts '%A => .* %w => \s*'
puts '%i => [+-]?\d+ %d => \d+'
puts '%x => [0-9a-fA-F]+ %f => [+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?'
puts '%c => .'
end
class Php5 < Formatted
def patterns(rex)
rex.gsub!('%unicode_string_optional%', 'string') #PHP6+: 'Unicode string'
rex.gsub!('%binary_string_optional%', 'string') #PHP6+: 'binary_string'
rex.gsub!('%unicode\|string%', 'string') #PHP6+: 'unicode'
rex.gsub!('%string\|unicode%', 'string') #PHP6+: 'unicode'
rex.gsub!('%u\|b%', '')
rex.gsub!('%b\|%u', '') #PHP6+: 'u'
super(rex)
end
def show_expect_info
super
puts 'PHP5'
puts '%u\|b% => \'\' %b\|%u => \'\''
puts '%binary_string_optional% => string %unicode_string_optional% => string'
puts '%unicode\|string% => string %string\|unicode% => string'
end
end # end Php5
class Php6 < Formatted
def patterns(rex)
rex.gsub!('%unicode_string_optional%', 'Unicode string') #PHP6+: 'Unicode string'
rex.gsub!('%binary_string_optional%', 'binary_string') #PHP6+: 'binary_string'
rex.gsub!('%unicode\|string%', 'unicode') #PHP6+: 'unicode'
rex.gsub!('%string\|unicode%', 'unicode') #PHP6+: 'unicode'
rex.gsub!('%u\|b%', 'u')
rex.gsub!('%b\|%u', 'u') #PHP6+: 'u'
super(rex)
end
def show_expect_info
super
puts 'PHP6'
puts '%u\|b% => u %b\|%u => u'
puts '%unicode\|string% => unicode %string\|unicode% => unicode'
puts '%binary_string_optional% => binary_string'
puts '%unicode_string_optional% => Unicode string'
end
end # end Php6
end
end
end

View File

@@ -1,233 +0,0 @@
module Diff
class OverrideManager
def initialize
@replace = {}
@ignore = {
:insert=>{ # :insert :delete :any
:all=> { # filename
:windows => { # platform_type
:any => { # platform_arch
:sdk => { # platform_sdk
:any => { # os_version
:any => [ # sp
[] # each insert chunk is an [] of strings here
]
}
}
}
}
}
},
:delete=>[]
}
end # def initialize
def read
xml = XmlSimple.xml_in(override_xml, 'AttrPrefix' => true, 'ContentKey'=>'text')
xml['platform'].each do |platform_xml|
platform_type = :any # TODO platform_xml['@type']
platform_sdk = :any # TODO platform_xml['@sdk']
platform_arch = :any # TODO platform_xml['@arch']
platform_xml['os'].each do |os_xml|
os_version = :any # TODO os_xml['@version']
os_xml['sp'].each do |sp_xml|
sp = :any # TODO sp_xml['@sp']
sp_xml['ignore'].each do |ignore_xml|
type = :insert # :insert :delete :any
@ignore[type]||={}
ignore_xml['insert'].each do |insert_xml|
filename = insert_xml['@testcase']
text = insert_xml['text']
# %s can be used to match any string between other parts of chunk
# to do that, split here on %s so ignore? then gets for each part in order
proc_text = text.split("%s")
# store
@ignore[type][filename]||={}
@ignore[type][filename][platform_type]||={}
@ignore[type][filename][platform_type][platform_arch]||={}
@ignore[type][filename][platform_type][platform_arch][platform_sdk]||={}
@ignore[type][filename][platform_type][platform_arch][platform_sdk][os_version]||={}
@ignore[type][filename][platform_type][platform_arch][platform_sdk][os_version][sp]||=[]
@ignore[type][filename][platform_type][platform_arch][platform_sdk][os_version][sp].push(proc_text)
end
end # ignore
end # sp
end # os
end # platform
#ignore_text.split('%s')
end # def read
def will_replace?(chunk)
# TODO
end
def replace(chunk)
# TODO
end
def ignore?(chunk)
return false # TODO TUE
if chunk.type == :equals
return false
end
return ( check_ignore(chunk, @ignore[chunk.type]) or check_ignore(chunk, @ignore[:all]) )
end
def override_xml
# TODO file
return <<-OVERRIDE_XML
<?xml version="1.0" ?>
<override>
<platform type="windows" sdk="any" arch="any"><!-- any windows linux freeBSD -->
<os version="any"><!-- any or (distro version num) distro="name" and MinVersion(int) and MaxVersion(int) or (ship names) XP 2003 2003r2 Vista 2008 7 2008r2 8 -->
<sp sp="any"><!-- any or 0+ -->
<ignore><!-- ignore different chunk of output when pass/fail evaluated: any insert delete -->
<!-- can't write to /tmp/ on Windows ('extra warning')-->
<insert test_case="ext/session/tests/session_set_save_handler_class_002.phpt">
Warning: file_put_contents(/tmp/u_sess_PHPSESSID07b613ebe9c270b421696daf8fd94a88): failed to open stream: No such file or directory in %s\ext\session\tests\session_set_save_handler_class_002.php on line 33
array(0) {
Warning: file_put_contents(/tmp/u_sess_PHPSESSID07b613ebe9c270b421696daf8fd94a88): failed to open stream: No such file or directory in %s\ext\session\tests\session_set_save_handler_class_002.php on line 33
Warning: file_put_contents(/tmp/u_sess_PHPSESSID07b613ebe9c270b421696daf8fd94a88): failed to open stream: No such file or directory in %s\ext\session\tests\session_set_save_handler_class_002.php on line 33
array(0) {
</insert>
<!-- extra warning -->
<insert test_case="ext/standard/tests/dir/opendir_variation6-win32.phpt">Warning: opendir(%s\ext\standard\tests\dir/opendir_var*,%s\ext\standard\tests\dir/opendir_var*): No error in %s\ext\standard\tests\dir\opendir_variation6-win32.php on line 23
Warning: opendir(%s\ext\standard\tests\dir/*,%s\ext\standard\tests\dir/*): No error in %s\ext\standard\tests\dir\opendir_variation6-win32.php on line 24
Warning: opendir(%s\ext\standard\tests\dir/opendir_variation6/sub_dir?,%s\ext\standard\tests\dir/opendir_variation6/sub_dir?): No error in %s\ext\standard\tests\dir\opendir_variation6-win32.php on line 27
Warning: opendir(%s\ext\standard\tests\dir/opendir_variation6/sub?dir1,%s\ext\standard\tests\dir/opendir_variation6/sub?dir1): No error in %s\ext\standard\tests\dir\opendir_variation6-win32.php on line 28
</insert>
<!-- extra warning -->
<insert test_case="ext/standard/tests/dir/scandir_variation6-win32.phpt">Warning: scandir(%s\ext\standard\tests\dir/scandir_var*,%s\ext\standard\tests\dir/scandir_var*): No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 24
Warning: scandir(%s\ext\standard\tests\dir/scandir_var*): failed to open dir: No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 24
Warning: scandir(%s\ext\standard\tests\dir/*,%s\ext\standard\tests\dir/*): No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 25
Warning: scandir(%s\ext\standard\tests\dir/*): failed to open dir: No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 25
Warning: scandir(%s\ext\standard\tests\dir/scandir_variation6/sub_dir?,%s\ext\standard\tests\dir/scandir_variation6/sub_dir?): No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 28
Warning: scandir(%s\ext\standard\tests\dir/scandir_variation6/sub_dir?): failed to open dir: No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 28
Warning: scandir(%s\ext\standard\tests\dir/scandir_variation6/sub?dir1,%s\ext\standard\tests\dir/scandir_variation6/sub?dir1): No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 29
Warning: scandir(%s\ext\standard\tests\dir/scandir_variation6/sub?dir1): failed to open dir: No error in %s\ext\standard\tests\dir\scandir_variation6-win32.php on line 29
</insert>
<!-- test environment/setup problem -->
<insert test_case="ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt">Warning: stream_socket_accept(): accept failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation1.php on line 13
Warning: fwrite() expects parameter 1 to be resource, boolean given in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation1.php on line 16
int(0)
bool(true)
int(0)
bool(true)
Warning: fclose() expects parameter 1 to be resource, boolean given in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation1.php on line 28
</insert>
<!-- test environment/setup problem -->
<insert test_case="ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt">Warning: stream_socket_accept(): accept failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation2.php on line 13
Warning: fwrite() expects parameter 1 to be resource, boolean given in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation2.php on line 23
bool(true)
</insert>
<!-- test environment/setup problem -->
<insert test_case="ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt">Warning: stream_socket_accept(): accept failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation4.php on line 13
Warning: fwrite() expects parameter 1 to be resource, boolean given in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation4.php on line 16
bool(true)
Warning: fclose() expects parameter 1 to be resource, boolean given in %s\ext\standard\tests\streams\stream_get_meta_data_socket_variation4.php on line 24
</insert>
</ignore>
<replace>
<!-- replace chunks of output before pass/fail evaluated: Any Insert Delete -->
</replace>
</sp>
</os>
</platform>
</override>
OVERRIDE_XML
end
protected
def check_ignore(chunk, ignore_list)
if ignore_list.nil?
return false
end
return ( check_ignore_file(chunk, ignore_list[chunk.file_name]) or check_ignore_file(chunk, ignore_list[:all]) )
end
def check_ignore_file(chunk, platform_types)
if platform_types.nil?
return false
end
platform_types.each do |platform_archs|
platform_archs.each do |platform_sdks|
platform_sdks.each do |os_versions|
os_versions.each do |sp|
sp.each do |ignore|
#
#
# check each text chunk to ignore
ignore_list.each do |ignore|
i = 0
match = true
ignore.each do |ignore_part|
i = chunk.str.index(ignore_part, i)
if i.nil?
match = false
break
end
# search for next ignore_part
i = i + ignore_part.length
end
#
if match
# found ignore match, can stop looking (short-circuit)
return true
end
#
end
#
#
end
end
end
end
end
return false
end # def check_ignore_file
end # class OverrideManager
end

View File

@@ -1,100 +0,0 @@
module Diff
module Triage
#
# triages diff and returns new TriageTelemetrys or adds to given TriageTelemetrys
def triage(tr=nil)
unless tr
tr = TriageTelemetrys.new()
end
tr.lock.synchronize do
tr.total_lines += lines.length
end
diff.each do |line|
dlm = DiffLineManager.new(line)
tr.lock.synchronize do
tr.diff_lines += 1
end
while dlm.get_next
chunk = dlm.chunk
chunk = chunk.downcase
tr.lock.synchronize do
tr.total_chunks += 1
end
# triage step #1: is it a changed length (of array or string)?
if chunk.include?('array(')
if dlm.matches?(chunk.gsub('array(%d)', 'array(\%d)'))
tr.lock.synchronize do
tr.changed_len[:arrays] += 1
end
next
end
elsif chunk.include?('string(')
if dlm.matches?(chunk.gsub('string(%d)', 'string(\%d)'))
tr.lock.synchronize do
tr.changed_len[:strings] += 1
end
next
end
end
# triage step #2: is chunk deleted (expected chunk not in actual output)
if dlm.delete?
_triage_chunk(tr, tr.delete, chunk)
# triage step #3: is chunk inserted (actual chunk not in expected output)
elsif insert
# triage into array, string, error, warning, or other, insertion
_triage_chunk(tr.insert, chunk)
end
end
end
return tr
end
def _triage_chunk(tr, hash, chunk)
if chunk.include?('warning')
tr.lock.synchronize do
hash[:warnings]+=1
end
elsif chunk.include?('error')
tr.lock.synchronize do
hash[:errors]+=1
end
elsif chunk.include?('array')
tr.lock.synchronize do
hash[:arrays]+=1
end
elsif chunk.include?('string')
tr.lock.synchronize do
hash[:strings]+=1
end
else
tr.lock.synchronize do
hash[:others]+=1
end
end
end
class TriageTelemetrys
attr_accessor :total_lines, :total_chunks, :diff_lines
attr_reader :deleted, :inserted, :changed_len, :lock
def initialize
@total_lines = @total_chunks = @diff_lines = 0
@deleted = {:warnings=>0, :errors=>0, :arrays=>0, :strings=>0, :others=>0}
@inserted = {:warnings=>0, :errors=>0, :arrays=>0, :strings=>0, :others=>0}
@changed_len = {:arrays=>0, :strings=>0}
@lock = Mutex.new
end
end
end
end

View File

@@ -1,771 +0,0 @@
module Diff
module ZD
class BaseZD
attr_reader :diff_type
def initialize(diff_type)
# TODO rename these diff_types
unless [:expected, :actual, :added, :removed, :added_and_removed, :org_expected, :org_actual].include?(diff_type)
raise ArgumentError, diff_type
end
@diff_type = diff_type
@chunk_replacements = {}
end
def zd_label
"#{level_label()} #{diff_label()}"
end
def diff_label
# Override
end
def sym
# Override
end
def has_sym?
sym.length > 0
end
def level_label
# Override
end
def level
# Override
end
def is_diff_type?(o_diff_type)
diff_type()==o_diff_type
end
def is_level?(o_level)
level() == o_level
end
# class OverrideManager
#
# end
#
# class OverrideFile
# def ignore?(chunk)
# true
# end
# def has_replacement?(chunk)
# end
# def replace(chunk)
# end
#
# end # class OverrideFile
#
# def save_chunk_replacements(file_name)
# # TODO
# # Diff Override File .do
# xml = []
# @chunk_replacements.map do |org, rep|
# xml.push({'chunk'=>{'org'=>{'text'=>org}, 'rep'=>{'text'=>rep}}})
# end
# xml = {'replacements'=>xml}
# xml = {'ignore'=>xml}
#
# XmlSimple.xml_out(file_name, xml)
# end
#
# def load_chunk_replacements(file_name)
# # TODO
# xml = XmlSimple.xml_in(file_name) # TODO opts
# xml['chunk_replacements'].each do |cr|
# org = cr['org']['text']
# rep = cr['rep']['text']
#
# @chunk_replacements[org] = rep
# end
# end
def save
# TODO
end
def pass(chunk)
if chunk.delete?
add(chunk)
elsif chunk.insert?
delete(chunk)
end
end
def find needle, &block
_find(needle, false, block)
end
def find_not needle, &block
_find(needle, true, block)
end
def delete(chunk)
read(chunk.file_name).delete_chunk(chunk)
end
def add(chunk)
read(chunk.file_name).insert_chunk(chunk)
end
def change(old_chunk, new_chunk)
unless old_chunk.file_name == new_chunk.file_name
raise ArgumentError
end
read(old_chunk.file_name).change_chunk(old_chunk, new_chunk)
end
def iterate &block
# Override
end
protected
def _find needle, not_needle, block
up_needle = needle.upcase
down_needle = needle.downcase
chunks_out = (block.nil?) ? Diff::Chunk::Array.new : nil
iterate() do |chunk|
if check_chunk(chunk, up_needle, down_needle) or ( not_needle and !check_chunk(chunk, up_needle, down_needle))
if block
block.call(chunk)
else
chunks_out.push(chunk)
end
end
end
return chunks_out
end # def _find
def check_chunk(chunk, up_needle, down_needle)
chunk.include?(up_needle, down_needle)
end
def read(file_name)
if file_name.ends_with?('.diffx')
return DiffXFileReader.new(file_name)
else
return ExpectedOrResultFileReader.new(file_name)
end
end
end # class ZD
class BaseFileReader
def initialize
@chunks = []
end
def iterate
FileChunkIterator.new(@chunks)
end
def slice(line_number, in_col, line_count, out_col)
lines = read_lines()
slice_lines = lines[line_number..line_number+line_count]
# slice chunk on first and last line of chunk (will be same line if line_count==1)
if in_col != 0
first = slice_lines.first
text = first[:text]
first[:text] = text[in_col..text.length]
end
last = slice_lines.last
text = last[:text]
last[:text] = text[0..out_col]
#
#
slices = []
last_chunk_type = nil
slice_lines.each do |line|
line.each do |line_chunk|
if line_chunk[:type] != last_chunk_type
# create a chunk (with line number and column number)
slices.push(Chunk.new('', @file_name, line_number, (last_chunk_type.nil?)?in_col:0, line_chunk[:type]))
end
# add to the chunk (continue adding to a chunk until type of line(:insert, :delete, :equals) changes)
slices.last.str += line_chunk[:text] + "\n"
last_chunk_type = line_chunk[:type]
end
line_number += 1
end
return slices
end # slice
def change_chunk(old_chunk, new_chunk)
if old_chunk.line_number != new_chunk.line_number or old_chunk.column != new_chunk.column
raise IOError
end
lines = read_lines()
line_number = new_chunk.line_number
line_count = 0
new_chunk.lines.each do |line|
line.each do |chunk_line|
# slice the first/last line to match the in-column and out-column of the chunk
if line_count+1>=new_chunk.line_count # if last
line = line[0..new_chunk.out_column]
elsif line_count==0 and new_chunk.column != 0 # if first
line = line[new_chunk.column..line.length]
end
# TODO if first or last?
lines[line_number] = [{:text=>line, :type=>new_chunk.type}]
end
line_number += 1
line_count += 1
end
rejoin_lines(lines)
end
def insert_chunk(chunk)
lines = read_lines()
line_number = chunk.line_number
line_count = 0
chunk.lines.each do |line|
if line_count==0 and chunk.column > 0
# merge line (first_line)
lines[line_number-1].push({:text=>line, :type=>chunk.type}) # TODO \n ??
elsif line_count+1<chunk.line_count or chunk.str.ends_with?("\n")
# insert line
lines.insert(line_number-1, [{:text=>line, :type=>chunk.type}])
else
# merge line (must be last line)
lines[line_number-1].insert(0, [{:text=>line, :type=>chunk.type}])
end
line_number += 1
line_count += 1
end
rejoin_lines(lines)
end
def delete_chunk(chunk)
lines = read_lines()
# TODO in_col out_col
lines.delete(chunk.line_number, chunk.line_count)
if chunk.column == 0
# TODO
else
if chunk.line_count == 0
# TODO
else
# TODO
end
end
# TODO out_col
rejoin_lines(lines)
end
def slice_chunk(chunk)
slice(chunk.line_number, chunk.column, chunk.line_count, chunk.out_column)
end
def insert_chunk(chunk)
insert(chunk.line_number, chunk.column, chunk.str)
end
def delete_chunk(chunk)
delete(chunk.line_number, chunk.line_count)
end
protected
def read_lines
if @_lines
return @_lines
end
@_lines = []
_line = []
@chunks.each do |chunk|
line_count = 0
chunk.lines.each do |line|
_line.push({:text=>line, :type=>chunk.type})
# some chunks may span only part of a line
last_line = line_count+1>=chunk.line_count
if !last_line or ( last_line and chunk.str.ends_with?("\n"))
# skip to next line
@_lines.push(_line)
_line = []
end
line_count += 1
end
end
if @_lines.last!=_line
# don't forget last one
@_lines.push(_line)
end
return @_lines
end
def rejoin_lines(lines)
# reassembles a list of internally edited lines into @chunks,
# an array of Diff::Chunk objects
#
@_lines = lines
@chunks = []
last_chunk_type = nil
line_number = 1
lines.each do |line|
# most lines will only have one chunk (which will often span multiple lines)
# some lines will have multiple chunks though
col_number = 0
line.each do |line_chunk|
if line_chunk[:type] != last_chunk_type
@chunks.push(Chunk.new('', @file_name, line_number, col_number, line_chunk[:type]))
end
@chunks.last.str += line_chunk[:text]
last_chunk_type = line_chunk[:type]
col_number += line_chunk.length
end
@chunks.last.str += "\n"
line_number += 1
end
end # def rejoin_lines
end # class BaseFileReader
class DiffXFileReader < BaseFileReader
def initialize(file_name)
super()
@file_name = file_name
xml = XmlSimple.xml_in(file_name, 'AttrPrefix' => true, 'ContentKey'=>'text')
# rearrange xml into actual chunk order
['equals', 'insert', 'delete'].each do |tag_name|
tags = xml[tag_name]
if tags
tags.each do |tag|
line_number = tag['@line'].to_i
@chunks.insert(line_number-1, Diff::Chunk.new(tag['text'], file_name, line_number, 0, (tag=='delete')? :delete: :insert))
# TODO column number
end
end
end
@chunks.delete_if do |chunk|
chunk.nil?
end
end
end # class DiffXFileReader
class ExpectedOrResultFileReader < BaseFileReader
# LATER be able to read from .phpt file too
def initialize(file_name)
super()
@file_name = file_name
@chunks = [Diff::Chunk.new(IO.read(@file_name), file_name, 1, 0, :equals)]
end
end # class ExpectedOrResultFileReader
class FileChunkIterator
def initialize(chunks)
@chunks = chunks
@i = 0
end
def has_next?
@i < @chunks.length
end
def next
chunk = @chunks[@i]
@i+=1
return chunk
end
end # class FileChunkIterator
####################
module AllComboAll
# TODO iterate_files impl w/o doing dir.combos().each
def iterate_files &block
end
end
module SingleComboAll
def iterate_files &block
puts '426'
dirs().each do |dir|
dir.combos().each do |combo|
files().each do |file_ext|
dir.glob(combo, file_ext, &block)
end
end
end
end
end
module AllComboExt
# TODO
def iterate_files &block
end
end
module SingleComboExt
def iterate_files &block
# TODO dirs().each do |dir|
# dir.combos().each do |combo|
# files().each do |file_ext|
# dir.glob(combo, file_ext)
# end
# end
# end
end
end
module AllComboSingleFile
# TODO
def iterate_files &block
end
end
module SingleComboSingleFile
def iterate_files &block
# TODO dirs().each do |dir|
# dir.combos().each do |combo|
# block.call(dir, combo, file_name)
# end
# end
end
end
########################
class BaseZD2 < BaseZD
def iterate &block
puts '478'+self.to_s
# search each directory for files with a certain file name extension
iterate_files() do |dir, combo, file_name|
#
# some subclasses may want to compare/evaluate the file to decide if
# it should be searched or not (skipped)
unless accept_file(dir, combo, file_name)
next # skip file
end
# go ahead, search the lines of this file
# search file for needle
chunk_file = read("#{dir}/#{combo}/#{file_name}") # TODO
chunks_in = chunk_file.iterate()
while chunks_in.has_next?
chunk = chunks_in.next()
# replace chunk if needed
replace(chunk)
unless chunk.equals? # in case chunk is now equal
block.call(chunk)
end # accept_line
end # while
end
end # def iterate
protected
def replace(chunk)
if @chunk_replacements.has_key?(chunk.str)
chunk.str = @chunk_replacements[chunk.str]
if [:added, :deleted].include?(diff_type)
# TODO recalculate entire diff
end
end
end
def accept_file(dir, combo, file_name)
true
end
def dirs
# Override
[]
end
def files
if [:added, :deleted].include?(diff_type)
return ['.diffx']
elsif [:org_expected, :expected].include?(diff_type)
return ['.expectf'] # TODO complete list? replace with TelemetryFolder
elsif [:actual, :org_actual].include?(diff_type)
return ['.result']
else
return [] # shouldn't happen
end
end
end # class BaseZD2
class BaseSingleRunZD < BaseZD2
def expected(chunk)
chunk.opposite
end
def actual(chunk)
chunk.opposite
end
end # class BaseSingleRunZD
class BaseSingleRunZD2 < BaseSingleRunZD
attr_reader :dir
def initialize(diff_type, dir)
super(diff_type)
@dir = dir
end
def dirs
[@dir]
end
def sym
''
end
end # class BaseSingleRunZD2
class BaseCompareZD < BaseZD2
attr_reader :base_dir, :test_dir
def initialize(diff_type, base_dir, test_dir)
super(diff_type)
unless base_dir.exists? or test_dir.exists?
raise IOError, "dir not found #{base_dir} #{test_dir}"
end
@base_dir = base_dir
@test_dir = test_dir
end
def expected(chunk)
read(chunk.file_name).slice_chunk(chunk)
end
def actual(chunk)
read(chunk.file_name).slice_chunk(chunk)
end
protected
def dirs
[@base_dir, @test_dir]
end
end # class BaseCompareZD
class BaseCompareDiffMultiRuns < BaseCompareZD
def accept_file(dir, combo, file_name)
if @test_dir.exists?(file_name)
if @base_dir.exists?(file_name)
else
return accept_diff(dir, :only_test_exists, nil)
end
elsif @base_dir.exists?(file_name)
return accept_diff(dir, :only_base_exists, nil)
end
# Later PHP6 support
diff = Diff::Engine::Formatted::Php5.new(@base_dir.gets(combo, file_name), @test_dir.gets(combo, file_name))
# process chunk replacements here too (also done in #iterate)
diff.diff.each do |chunk|
replace(chunk)
end
return accept_diff(dir, :both_exist, diff)
end
end # class BaseCompareDiffMultiRuns
###########################################
module BaseAllTestCases
def level
:all
end
def level_label
'All'
end
end # module BaseAllTestCases
module SingleRun
def diff_label
if @dir.rev
@dir.rev
else
default_diff_label
end
end
end
module TestSingleRun
include SingleRun
def default_diff_label
'Base'
end
end
module BaseSingleRun
include SingleRun
def default_diff_label
'Test'
end
end
module BaseAll2TestCases
include BaseAllTestCases
def diff_label
if @base_rev and @test_rev
"#{@base_rev}#{sym()}#{@test_rev}"
else
"Base#{sym()}Test"
end
end
end # module BaseAll2TestCases
module BaseMultiFileTestMinusBase
# Test-Base => only results from Test not matching those in Base run
include BaseAllTestCases
def diff_label
if @base_rev and @test_rev
"#{@test_rev}#{sym()}#{@base_rev}"
else
"Test#{sym()}Base"
end
end
def sym
'-'
end
protected
def accept_diff(tbe, diff)
( tbe == :both_exist and diff.has?(:insert) ) or tbe == :only_test_exists
end
end # module BaseMultiFileTestMinusBase
module BaseMultiFileBaseMinusTest
# Base-Test => only results from Test not matching those in Base run
include BaseAll2TestCases
def sym
'-'
end
protected
def accept_diff(tbe, diff)
( tbe == :both_exist and diff.has?(:delete) ) or tbe == :only_base_exists
end
end # module BaseMultiFileBaseMinusTest
module BaseMultiFileBasePlusTest
# Base+Test => all results from Base and Test (duplicates removed)
include BaseAll2TestCases
def sym
'+'
end
protected
def accept_diff(dir, tbe, diff)
if tbe == :both_exists
if dir == @base_dir
# if there is no difference (diff.empty?), only report for the base_dir,
# not for files found in test_dir (because there would be a duplicate result)
return diff.empty?
else
# there is a difference
return !diff.empty?
end
else
# :only_base_exists :only_test_exists
return true
end
end
end # module BaseMultiFileBasePlusTest
module BaseMultiFileBaseEqTest
# Base=Test => only results from Base and Test that match
include BaseAll2TestCases
def sym
'='
end
protected
def accept_diff(tbe, diff)
( tbe == :both_exist and diff.empty? )
end
end # module BaseMultiFileBaseEqTest
###########################################
end # module ZD
end # module Diff

View File

@@ -1,86 +0,0 @@
module Diff
module ZD
module AllTestCases
module SingleCombo
class BaseRun < BaseSingleRunZD2
# Base
include SingleComboAll
include TestSingleRun
end
class TestRun < BaseSingleRunZD2
# Test
include SingleComboAll
include BaseSingleRun
end
class TestMinusBase < BaseCompareDiffMultiRuns
# Test-Base
include SingleComboAll
include BaseMultiFileTestMinusBase
end
class BaseMinusTest < BaseCompareDiffMultiRuns
# Base-Test
include SingleComboAll
include BaseMultiFileBaseMinusTest
end
class BasePlusTest < BaseCompareDiffMultiRuns
# Base+Test
include SingleComboAll
include BaseMultiFileBasePlusTest
end
class BaseEqTest < BaseCompareDiffMultiRuns
# Base=Test
include SingleComboAll
include BaseMultiFileBaseEqTest
end
end # module SingleCombo
module AllCombos
class BaseRun < BaseSingleRunZD2
# Base
include AllComboAll
include TestSingleRun
end
class TestRun < BaseSingleRunZD2
# Test
include AllComboAll
include BaseSingleRun
end
class TestMinusBase < BaseCompareDiffMultiRuns
# Test-Base
include AllComboAll
include BaseMultiFileTestMinusBase
end
class BaseMinusTest < BaseCompareDiffMultiRuns
# Base-Test
include AllComboAll
include BaseMultiFileBaseMinusTest
end
class BasePlusTest < BaseCompareDiffMultiRuns
# Base+Test
include AllComboAll
include BaseMultiFileBasePlusTest
end
class BaseEqTest < BaseCompareDiffMultiRuns
# Base=Test
include AllComboAll
include BaseMultiFileBaseEqTest
end
end # module AllCombos
end # module AllTestCases
end
end

View File

@@ -1,87 +0,0 @@
module Diff
module ZD
module Extension
module SingleCombo
class BaseRun < BaseSingleRunZD2
# Base
include SingleComboExt
include TestSingleRun
end
class TestRun < BaseSingleRunZD2
# Test
include SingleComboExt
include BaseSingleRun
end
class TestMinusBase < BaseCompareDiffMultiRuns
# Test-Base
include SingleComboExt
include BaseMultiFileTestMinusBase
end
class BaseMinusTest < BaseCompareDiffMultiRuns
# Base-Test
include SingleComboExt
include BaseMultiFileBaseMinusTest
end
class BasePlusTest < BaseCompareDiffMultiRuns
# Base+Test
include SingleComboExt
include BaseMultiFileBasePlusTest
end
class BaseEqTest < BaseCompareDiffMultiRuns
# Base=Test
include SingleComboExt
include BaseMultiFileBaseEqTest
end
end # module SingleCombo
module AllCombos
class BaseRun < BaseSingleRunZD2
# Base
include AllComboExt
include TestSingleRun
end
class TestRun < BaseSingleRunZD2
# Test
include AllComboExt
include BaseSingleRun
end
class TestMinusBase < BaseCompareDiffMultiRuns
# Test-Base
include AllComboExt
include BaseMultiFileTestMinusBase
end
class BaseMinusTest < BaseCompareDiffMultiRuns
# Base-Test
include AllComboExt
include BaseMultiFileBaseMinusTest
end
class BasePlusTest < BaseCompareDiffMultiRuns
# Base+Test
include AllComboExt
include BaseMultiFileBasePlusTest
end
class BaseEqTest < BaseCompareDiffMultiRuns
# Base=Test
include AllComboExt
include BaseMultiFileBaseEqTest
end
end # module AllCombos
end # module Extension
end # module ZD
end

Some files were not shown because too many files have changed in this diff Show More