commit 81356e95264f05963212206f13aeb6e815a2fbdf Author: Harald Welte Date: Sat Apr 9 13:03:51 2022 +0200 Initial import of ultradefrag-5.0.0AB.8 https://jp-andre.pagesperso-orange.fr/ultradefrag-5.0.0AB.8.zip see also https://github.com/tuxera/ntfs-3g/issues/31 diff --git a/Released/Read Me First.txt b/Released/Read Me First.txt new file mode 100644 index 0000000..d78d952 --- /dev/null +++ b/Released/Read Me First.txt @@ -0,0 +1,9 @@ +This folder contains the entire repository in the state it was released. + +This enables applying and releasing small changes, like updating translations +and minor fixes, without interfering with the main development stream. + +A branch of the doc and src folders must be created here after a release +overwriting the current contents. + +Do not make the branch the working copy. diff --git a/TestSuite/Boot Time Commands/Install Test Suite.cmd b/TestSuite/Boot Time Commands/Install Test Suite.cmd new file mode 100644 index 0000000..5d82c54 --- /dev/null +++ b/TestSuite/Boot Time Commands/Install Test Suite.cmd @@ -0,0 +1,103 @@ +@echo off + +:: +:: This script will install the Ultradefrag Boot Time Defrag Test Suite on your system. +:: Copyright (c) 2010 by Stefan Pendl (stefanpe@users.sourceforge.net). +:: +:: This program is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation; either version 2 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program; if not, write to the Free Software +:: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +:: + +:: check for administrative rights +for /f "tokens=2 delims=[" %%V in ('ver') do set test=%%V +for /f "tokens=2" %%V in ('echo %test%') do set test1=%%V +for /f "tokens=1,2 delims=." %%V in ('echo %test1%') do set OSversion=%%V.%%W + +if %OSversion% LSS 6.0 goto :IsAdmin + +if /i %USERNAME% == Administrator goto :IsAdmin +if not defined SESSIONNAME goto :IsAdmin + +echo. +echo This script must be run by the Administrator !!! +goto :quit + +:IsAdmin +cd /D %~dp0 + +rem For Windows XP x64 Edition we need to force notepad. +rem For Windows Vista and higher x64 Editions +rem there is the SysNative workaround for Notepad++ +set force_default_editor=0 + +set default_editor=notepad +set boot_time_scripts=ud-boot-time.cmd "%SystemRoot%\System32\ud-boot-time.cmd" + +for /F "tokens=2 delims=[]" %%V in ('ver') do for /F "tokens=2" %%R in ( 'echo %%V' ) do set win_ver=%%R + +if %PROCESSOR_ARCHITECTURE% == AMD64 ( + if %win_ver% LSS 6 ( + set force_default_editor=1 + ) else ( + set boot_time_scripts=ud-boot-time.cmd "%SystemRoot%\SysNative\ud-boot-time.cmd" + ) +) + +title Installing Ultradefrag Boot Time Test Suite + +echo. +echo Select Action for Default Test Suite Boot Time Script +echo. +echo 1 ... Replace existing Boot Time Script +echo 2 ... Edit existing Boot Time Script +echo 3 ... Only Copy Test Scripts +echo. +echo 0 ... EXIT +echo. +set /P answer="Select an Option: " +echo. + +if %answer% LEQ 3 goto %answer% + +:0 +goto :quit + +:1 +copy /b /v /y ud-boot-time.cmd %SystemRoot%\System32 +goto :3 + +:2 +set editor_cmd=%default_editor% + +if %force_default_editor% == 1 goto :3 + +set editor_cmd="%ProgramFiles(x86)%\Notepad++\notepad++.exe" +if not exist %editor_cmd% set editor_cmd="%ProgramFiles%\Notepad++\notepad++.exe" +if not exist %editor_cmd% set editor_cmd=%default_editor% + +:3 +rem copy test command scripts +copy /b /v /y ud-boot-time-test-*.cmd C:\ + +if %answer% NEQ 2 goto :quit + +if %editor_cmd% == %default_editor% ( + for %%F in ( %boot_time_scripts% ) do start "" %editor_cmd% "%%~F" +) else ( + %editor_cmd% %boot_time_scripts% +) + +:quit +echo. +pause diff --git a/TestSuite/Boot Time Commands/ud-boot-time-test-call.cmd b/TestSuite/Boot Time Commands/ud-boot-time-test-call.cmd new file mode 100644 index 0000000..d846a81 Binary files /dev/null and b/TestSuite/Boot Time Commands/ud-boot-time-test-call.cmd differ diff --git a/TestSuite/Boot Time Commands/ud-boot-time-test-debug.cmd b/TestSuite/Boot Time Commands/ud-boot-time-test-debug.cmd new file mode 100644 index 0000000..917f28b Binary files /dev/null and b/TestSuite/Boot Time Commands/ud-boot-time-test-debug.cmd differ diff --git a/TestSuite/Boot Time Commands/ud-boot-time-test-suite.cmd b/TestSuite/Boot Time Commands/ud-boot-time-test-suite.cmd new file mode 100644 index 0000000..4dabd23 Binary files /dev/null and b/TestSuite/Boot Time Commands/ud-boot-time-test-suite.cmd differ diff --git a/TestSuite/Boot Time Commands/ud-boot-time-test-udefrag.cmd b/TestSuite/Boot Time Commands/ud-boot-time-test-udefrag.cmd new file mode 100644 index 0000000..e2d8691 Binary files /dev/null and b/TestSuite/Boot Time Commands/ud-boot-time-test-udefrag.cmd differ diff --git a/TestSuite/Boot Time Commands/ud-boot-time.cmd b/TestSuite/Boot Time Commands/ud-boot-time.cmd new file mode 100644 index 0000000..b6124dd Binary files /dev/null and b/TestSuite/Boot Time Commands/ud-boot-time.cmd differ diff --git a/TestSuite/Check against Windows Utilities/CheckVolumes.cmd b/TestSuite/Check against Windows Utilities/CheckVolumes.cmd new file mode 100644 index 0000000..5f50aa2 --- /dev/null +++ b/TestSuite/Check against Windows Utilities/CheckVolumes.cmd @@ -0,0 +1,77 @@ +@rem +@echo off + +:: +:: This test utility collects output of Windows utilities chkdsk and defrag. +:: Copyright (c) 2010 by Stefan Pendl (stefanpe@users.sourceforge.net). +:: +:: This program is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation; either version 2 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program; if not, write to the Free Software +:: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +:: + +:: check for administrative rights +for /f "tokens=2 delims=[" %%V in ('ver') do set test=%%V +for /f "tokens=2" %%V in ('echo %test%') do set test1=%%V +for /f "tokens=1,2 delims=." %%V in ('echo %test1%') do set OSversion=%%V.%%W + +if %OSversion% LSS 6.0 goto :IsAdmin + +if /i %USERNAME% == Administrator goto :IsAdmin +if not defined SESSIONNAME goto :IsAdmin + +echo. +echo This script must be run by the Administrator !!! +goto :quit + +:IsAdmin +for /F "tokens=2 delims=[]" %%V in ('ver') do for /F "tokens=2" %%R in ( 'echo %%V' ) do set win_ver=%%R + +echo. +for /F "tokens=1 skip=8" %%D in ( 'udefrag -l' ) do call :process %%D + +:quit +echo. +pause +goto :EOF + +:process + set drive_tmp=%1 + set drive=%drive_tmp:~0,1% + + echo Processing %1 ... + echo Running CHKDSK .... + call :RunUtility chkdsk %1 >"%COMPUTERNAME%_%drive%_chkdsk.log" 2>nul + + if %win_ver% GEQ 5.1 ( + echo Running DEFRAG .... + call :RunUtility defrag %1 >"%COMPUTERNAME%_%drive%_defrag.log" 2>nul + ) + + echo Running UDEFRAG ... + call :RunUtility udefrag %1 >"%COMPUTERNAME%_%drive%_udefrag.log" 2>nul + echo ------------------------ +goto :EOF + +:RunUtility + echo. + echo Started "%*" at %DATE% - %TIME% + echo ------------------------------- + echo. + if /i "%1" == "chkdsk" chkdsk %2 | findstr /v /i "Prozent percent" + if /i "%1" == "defrag" defrag -a -v %2 + if /i "%1" == "udefrag" udefrag -a -v %2 + echo. + echo ------------------------------- + echo Finished "%*" at %DATE% - %TIME% +goto :EOF diff --git a/TestSuite/CommonRoutines/winx_fwrite.c b/TestSuite/CommonRoutines/winx_fwrite.c new file mode 100644 index 0000000..b726a75 --- /dev/null +++ b/TestSuite/CommonRoutines/winx_fwrite.c @@ -0,0 +1,161 @@ +/* + * Test suite for winx_fwrite(). + * Copyright (c) 2010 by Dmitri Arkhangelski (dmitriar@gmail.com). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +static int winx_fwrite_test_buffered_io(char *filename,char **strings,int test_number,int buffer_size); +static int winx_fwrite_test_compare(char *filename,char **strings,int total_length,int test_number); + +/* +* accepts native filenames like that: +* \??\C:\test.txt +* returns zero on success, negative value otherwise +*/ +int winx_fwrite_test(char *filename) +{ + WINX_FILE *f; + char *strings[] = { + "Sherlock Holmes took his bottle from the corner of the mantelpiece, \r\n", + "and his hypodermic syringe from its neat morocco case. With his long, \r\n", + "white, nervous fingers he adjusted the delicate needle and rolled back \r\n", + "his left shirtcuff. For some little time his eyes rested thoughtfully \r\n", + "upon the sinewy forearm and wrist, all dotted and scarred with innumerable \r\n", + NULL + }; + int total_length; + int i; + + /* 1. test not buffered i/o */ + f = winx_fopen(filename,"w"); + if(f == NULL){ + DebugPrint("@winx_fwrite_test: winx_fopen failed in test 1\n"); + return (-1); + } + total_length = 0; + for(i = 0; strings[i]; i++){ + total_length += strlen(strings[i]); + if(!winx_fwrite(strings[i],sizeof(char),strlen(strings[i]),f)){ + DebugPrint("@winx_fwrite_test: winx_fwrite failed in test 1 for %s\n",strings[i]); + winx_fclose(f); + return (-1); + } + } + winx_fclose(f); + if(winx_fwrite_test_compare(filename,strings,total_length,1) < 0){ + return (-1); + } + + /* 2. test buffered i/o with negative buffer size */ + if(winx_fwrite_test_buffered_io(filename,strings,2,-100) < 0) + return (-1); + + /* 3. test buffered i/o with zero buffer size */ + if(winx_fwrite_test_buffered_io(filename,strings,3,0) < 0) + return (-1); + + /* 4. test buffered i/o with small buffer size */ + if(winx_fwrite_test_buffered_io(filename,strings,4,10) < 0) + return (-1); + + /* 5. test buffered i/o with medium buffer size */ + if(winx_fwrite_test_buffered_io(filename,strings,5,170) < 0) + return (-1); + + /* 6. test buffered i/o with large buffer size */ + if(winx_fwrite_test_buffered_io(filename,strings,6,10000) < 0) + return (-1); + + /* 7. test buffered i/o with buffer size equal to the length of the first string */ + if(winx_fwrite_test_buffered_io(filename,strings,7,strlen(strings[0])) < 0) + return (-1); + + /* 8. test buffered i/o with buffer size equal to the length of the first two strings */ + if(winx_fwrite_test_buffered_io(filename,strings,8,strlen(strings[0]) + strlen(strings[1])) < 0) + return (-1); + + /* 9. test buffered i/o with buffer size equal to the length of the first three strings */ + if(winx_fwrite_test_buffered_io(filename,strings,9,strlen(strings[0]) + strlen(strings[1]) + strlen(strings[2])) < 0) + return (-1); + + /* 10. test buffered i/o with buffer size equal to the length of all strings */ + if(winx_fwrite_test_buffered_io(filename,strings,10,total_length) < 0) + return (-1); + + DebugPrint("@winx_fwrite_test: all tests passed!\n"); + return 0; +} + +static int winx_fwrite_test_buffered_io(char *filename,char **strings,int test_number,int buffer_size) +{ + WINX_FILE *f; + int total_length; + int i; + + f = winx_fbopen(filename,"w",buffer_size); + if(f == NULL){ + DebugPrint("@winx_fwrite_test: winx_fbopen failed in test %i\n",test_number); + return (-1); + } + total_length = 0; + for(i = 0; strings[i]; i++){ + total_length += strlen(strings[i]); + if(!winx_fwrite(strings[i],sizeof(char),strlen(strings[i]),f)){ + DebugPrint("@winx_fwrite_test: winx_fwrite failed in test %i for %s\n",test_number,strings[i]); + winx_fclose(f); + return (-1); + } + } + winx_fclose(f); + if(winx_fwrite_test_compare(filename,strings,total_length,test_number) < 0){ + return (-1); + } + return 0; +} + +static int winx_fwrite_test_compare(char *filename,char **strings,int total_length,int test_number) +{ + int i; + char *written_strings; + size_t written_data_length; + int j, n; + + /* read the entire file contents */ + written_strings = (char *)winx_get_file_contents(filename,&written_data_length); + if(written_strings == NULL){ + DebugPrint("@winx_fwrite_test: winx_get_file_contents failed in test %i\n",test_number); + return (-1); + } + if(written_data_length != total_length){ + DebugPrint("@winx_fwrite_test: size mismatch in test %i\n",test_number); + winx_release_file_contents((void *)written_strings); + return (-1); + } + /* compare the file contents with original data */ + j = 0; + for(i = 0; strings[i]; i++){ + n = strlen(strings[i]); + if(memcmp(written_strings + j,strings[i],n) != 0){ + DebugPrint("@winx_fwrite_test: contents mismatch in test %i\n",test_number); + winx_release_file_contents((void *)written_strings); + return (-1); + } + j += n; + } + winx_release_file_contents((void *)written_strings); + DebugPrint("@winx_fwrite_test: test %i passed\n",test_number); + return 0; +} diff --git a/TestSuite/CommonRoutines/winx_print_strings_test.c b/TestSuite/CommonRoutines/winx_print_strings_test.c new file mode 100644 index 0000000..fc5147e --- /dev/null +++ b/TestSuite/CommonRoutines/winx_print_strings_test.c @@ -0,0 +1,211 @@ +/* + * Test suite for winx_print_array_of_strings(). + * Copyright (c) 2010 by Dmitri Arkhangelski (dmitriar@gmail.com). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +#define DEFAULT_PROMPT_TO_HIT_ANY_KEY " Hit any key to display next page..." +#define DEFAULT_TAB_WIDTH 2 +int __cdecl winx_print_array_of_strings(char **strings,int line_width,int max_rows,char *prompt,int divide_to_pages); + +char *strings[] = { + "Sherlock Holmes took his bottle from the corner of the mantelpiece, " + "and his hypodermic syringe from its neat morocco case. With his long, " + "white, nervous fingers he adjusted the delicate needle and rolled back " + "his left shirtcuff. For some little time his eyes rested thoughtfully " + "upon the sinewy forearm and wrist, all dotted and scarred with innumerable " + "puncture-marks. Finally, he thrust the sharp point home, pressed down the tiny " + "piston, and sank back into the velvet-lined armchair with a long sigh of satisfaction.", + "", + "Three times a day for many months I had witnessed this performance, " + "but custom had not reconciled my mind to it. On the contrary, from " + "day to day I had become more irritable at the sight, and my conscience " + "swelled nightly within me at the thought that I had lacked the courage " + "to protest. Again and again I had registered a vow that I should deliver " + "my soul upon the subject; but there was that in the cool, nonchalant air " + "of my companion which made him the last man with whom one would care to " + "take anything approaching to a liberty. His great powers, his masterly manner, " + "and the experience which I had had of his many extraordinary qualities, all " + "made me diffident and backward in crossing him. ", + "", + "Yet upon that afternoon, whether it was the Beaune which I had taken with " + "my lunch or the additional exasperation produced by the extreme deliberation " + "of his manner, I suddenly felt that I could hold out no longer. ", + "", + "this_is_a_very_very_long_word_qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890~!@#$#$#%$^%$^%&^&(*&(**)(*", + "", + "first line \rsecond\nthird\r\n4th\n\r5th\n\n\n8th", + "", + "before_tab\tafter_tab\t\tafter_two_tabs", + "", + NULL +}; + +int main(void) +{ + winx_print_array_of_strings(strings,60,24," Hit any key to continue...",1); + printf("Test completed, hit any key to exit...\n"); + getch(); + return 0; +} + +/* returns 1 if break or escape was pressed, zero otherwise */ +static int print_line(char *line_buffer,char *prompt,int max_rows,int *rows_printed,int last_line) +{ + printf("%s\n",line_buffer); + (*rows_printed) ++; + + if(*rows_printed == max_rows && !last_line){ + *rows_printed = 0; + printf("\n%s\n",prompt); + if(getch() == 0x1b){ /* esc */ + printf("\n"); + return 1; + } + printf("\n"); + } + return 0; +} + +int __cdecl winx_print_array_of_strings(char **strings,int line_width,int max_rows,char *prompt,int divide_to_pages) +{ + int i, j, k, index, length; + char *line_buffer, *second_buffer; + int n, r; + int rows_printed; + + if(!strings) return (-1); + + /* handle situation when text must be displayed entirely */ + if(!divide_to_pages){ + for(i = 0; strings[i] != NULL; i++) + printf("%s\n",strings[i]); + return 0; + } + + if(!line_width || !max_rows) return (-1); + if(prompt == NULL) prompt = DEFAULT_PROMPT_TO_HIT_ANY_KEY; + + /* allocate space for prompt on the screen */ + max_rows -= 3; + + /* allocate memory for line buffer */ + line_buffer = malloc(line_width + 1); + if(!line_buffer){ + printf("Cannot allocate %u bytes of memory for winx_print_array_of_strings()!", + line_width + 1); + return (-1); + } + /* allocate memory for second ancillary buffer */ + second_buffer = malloc(line_width + 1); + if(!second_buffer){ + printf("Cannot allocate %u bytes of memory for winx_print_array_of_strings()!", + line_width + 1); + free(line_buffer); + return (-1); + } + + /* start to display strings */ + rows_printed = 0; + for(i = 0; strings[i] != NULL; i++){ + line_buffer[0] = 0; + index = 0; + length = strlen(strings[i]); + for(j = 0; j < length; j++){ + /* handle \n, \r, \r\n, \n\r sequencies */ + n = r = 0; + if(strings[i][j] == '\n') n = 1; + else if(strings[i][j] == '\r') r = 1; + if(n || r){ + /* print buffer */ + line_buffer[index] = 0; + if(print_line(line_buffer,prompt,max_rows,&rows_printed,0)) + goto cleanup; + /* reset buffer */ + line_buffer[0] = 0; + index = 0; + /* skip sequence */ + j++; + if(j == length) goto print_rest_of_string; + if((strings[i][j] == '\n' && r) || (strings[i][j] == '\r' && n)){ + continue; + } else { + if(strings[i][j] == '\n' || strings[i][j] == '\r'){ + /* process repeating new lines */ + j--; + continue; + } + /* we have an ordinary character or tabulation -> process them */ + } + } + /* handle horizontal tabulation by replacing it by DEFAULT_TAB_WIDTH spaces */ + if(strings[i][j] == '\t'){ + for(k = 0; k < DEFAULT_TAB_WIDTH; k++){ + line_buffer[index] = 0x20; + index ++; + if(index == line_width){ + if(j == length - 1) goto print_rest_of_string; + line_buffer[index] = 0; + if(print_line(line_buffer,prompt,max_rows,&rows_printed,0)) + goto cleanup; + line_buffer[0] = 0; + index = 0; + break; + } + } + continue; + } + /* handle ordinary characters */ + line_buffer[index] = strings[i][j]; + index ++; + if(index == line_width){ + if(j == length - 1) goto print_rest_of_string; + line_buffer[index] = 0; + /* break line between words, if possible */ + for(k = index - 1; k > 0; k--){ + if(line_buffer[k] == 0x20) break; + } + if(line_buffer[k] == 0x20){ /* space character found */ + strcpy(second_buffer,line_buffer + k + 1); + line_buffer[k] = 0; + if(print_line(line_buffer,prompt,max_rows,&rows_printed,0)) + goto cleanup; + strcpy(line_buffer,second_buffer); + index = strlen(line_buffer); + } else { + if(print_line(line_buffer,prompt,max_rows,&rows_printed,0)) + goto cleanup; + line_buffer[0] = 0; + index = 0; + } + } + } +print_rest_of_string: + line_buffer[index] = 0; + if(print_line(line_buffer,prompt,max_rows,&rows_printed, + (strings[i+1] == NULL) ? 1 : 0)) goto cleanup; + } + +cleanup: + free(line_buffer); + free(second_buffer); + return 0; +} diff --git a/TestSuite/Create Bug Report Log File.cmd b/TestSuite/Create Bug Report Log File.cmd new file mode 100644 index 0000000..73d5432 --- /dev/null +++ b/TestSuite/Create Bug Report Log File.cmd @@ -0,0 +1,170 @@ +@rem +@echo off + +:: +:: This script is used to create a log file for a bug report. +:: Copyright (c) 2010-2011 by Stefan Pendl (stefanpe@users.sourceforge.net). +:: +:: This program is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation; either version 2 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program; if not, write to the Free Software +:: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +:: + +:: check for administrative rights +for /f "tokens=2 delims=[" %%V in ('ver') do set test=%%V +for /f "tokens=2" %%V in ('echo %test%') do set test1=%%V +for /f "tokens=1,2 delims=." %%V in ('echo %test1%') do set OSversion=%%V.%%W + +if %OSversion% LSS 6.0 goto :IsAdmin + +if /i %USERNAME% == Administrator goto :IsAdmin +if not defined SESSIONNAME goto :IsAdmin + +echo. +echo This script must be run by the Administrator !!! +goto :quit + +:IsAdmin +title UltraDefrag - Create Bug Report Log File + +:SelectVolume +:: collect volumes that can be processed +cls +echo. +echo Collecting available volumes ... +echo. +set MenuItem=0 +set ItemList= + +for /f "tokens=1,6* skip=8" %%D in ('udefrag -l') do call :AddToItemList %%~D & call :DisplayMenuItem %%~D - "%%~F" + +echo. +echo 0 ... EXIT +echo. +set /p SelectedVolume="Select volume to process: " + +if "%SelectedVolume%" == "" goto :EOF +if %SelectedVolume% EQU 0 goto :EOF + +if %SelectedVolume% LEQ %MenuItem% goto :GetDriveLetter +echo. +echo Selection must be between 0 and %MenuItem% !!! +echo. +pause +goto :SelectVolume + +:GetDriveLetter +for /f "tokens=%SelectedVolume%" %%V in ("%ItemList%") do set ProcessVolume=%%~V + +:SelectAction +:: select action to take +cls +echo. +set MenuItem=0 +set ItemList=-a -d -q -o + +for %%D in ("Analyze" "Defrag" "Quick Optimize" "Full Optimize") do call :DisplayMenuItem %%~D + +echo. +echo 0 ... EXIT +echo. +set /p SelectedAction="Select action to take: " + +if "%SelectedAction%" == "" goto :EOF +if %SelectedAction% EQU 0 goto :EOF + +if %SelectedAction% LEQ %MenuItem% goto :GetAction +echo. +echo Selection must be between 0 and %MenuItem% !!! +echo. +pause +goto :SelectAction + +:GetAction +for /f "tokens=%SelectedAction%" %%V in ("%ItemList%") do set ProcessAction=%%~V +if "%ProcessAction%" == "-d" set ProcessAction= + +set ItemList=Analyze Defrag QuickOptimize FullOptimize +for /f "tokens=%SelectedAction%" %%V in ("%ItemList%") do set ActionName=%%~V + +:AskRepeatAction +:: ask if we like to repeat the action +echo. +set /p RepeatAction="Repeat action for volume %ProcessVolume%? (Y/[N]) " +if /i not "%RepeatAction%" == "Y" ( + set RepeatAction= +) else ( + set RepeatAction=-r +) + +:SelectLogLevel +:: select log level to use +cls +echo. +set MenuItem=0 +set ItemList=DETAILED PARANOID + +for %%D in ("Detailed" "Paranoid") do call :DisplayMenuItem %%~D + +echo. +echo 0 ... EXIT +echo. +set /p SelectedLogLevel="Select log level to use: " + +if "%SelectedLogLevel%" == "" goto :EOF +if %SelectedLogLevel% EQU 0 goto :EOF + +if %SelectedLogLevel% LEQ %MenuItem% goto :GetLogLevel +echo. +echo Selection must be between 0 and %MenuItem% !!! +echo. +pause +goto :SelectLogLevel + +:GetLogLevel +for /f "tokens=%SelectedLogLevel%" %%V in ("%ItemList%") do set ProcessLogLevel=%%~V + +cls +echo. +set UD_DBGPRINT_LEVEL=%ProcessLogLevel% +echo Debug level set to "%UD_DBGPRINT_LEVEL%" +echo. +set UD_LOG_FILE_PATH=%SystemRoot%\UltraDefrag\Logs\udefrag_%ActionName%_%ProcessVolume:~0,1%.log +echo Using log file "%UD_LOG_FILE_PATH%" +echo. +echo. +echo Executing "udefrag %RepeatAction% %ProcessAction% %ProcessVolume%"... +echo. +echo. +udefrag %RepeatAction% %ProcessAction% %ProcessVolume% + +title Operation Completed ... + +:quit +echo. +pause + +goto :EOF + +:DisplayMenuItem + set /a MenuItem+=1 + echo %MenuItem% ... %* +goto :EOF + +:AddToItemList + if "%ItemList%" == "" ( + set ItemList=%~1 + ) else ( + set ItemList=%ItemList% %~1 + ) +goto :EOF diff --git a/TestSuite/Create Fragmented Volumes/Create Fragmented Volumes.cmd b/TestSuite/Create Fragmented Volumes/Create Fragmented Volumes.cmd new file mode 100644 index 0000000..8c7b7ae --- /dev/null +++ b/TestSuite/Create Fragmented Volumes/Create Fragmented Volumes.cmd @@ -0,0 +1,475 @@ +@rem +@echo off + +:: +:: This script is used to create fragmented test volumes. +:: Copyright (c) 2010-2011 by Stefan Pendl (stefanpe@users.sourceforge.net). +:: +:: This program is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation; either version 2 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program; if not, write to the Free Software +:: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +:: + +:: check for administrative rights +for /f "tokens=2 delims=[" %%V in ('ver') do set test=%%V +for /f "tokens=2" %%V in ('echo %test%') do set test1=%%V +for /f "tokens=1,2 delims=." %%V in ('echo %test1%') do set OSversion=%%V.%%W + +if %OSversion% LSS 6.0 goto :IsAdmin + +if /i %USERNAME% == Administrator goto :IsAdmin +if not defined SESSIONNAME goto :IsAdmin + +echo. +echo This script must be run by the Administrator !!! +goto :quit + +:IsAdmin +title UltraDefrag - Test Volume Fragmentation Creator + +:: +:: it uses the fragmentation utility included in MyDefrag +:: available at http://www.mydefrag.com/ +:: +for /d %%D in ( "%ProgramFiles%\MyDefrag*" ) do set MyDefragDir=%%~D + +if "%MyDefragDir%" == "" ( + echo. + echo MyDefrag not installed ... aborting! + echo. + pause + goto :EOF +) + +:: +:: get install language from registry +:: +echo. +echo Getting language from registry, please wait ... + +set YES= +set InstallLanguage=X +for /f "tokens=3" %%L in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language" /v InstallLanguage') do set InstallLanguage=%%L + +:: German installation +for %%L in (0407 0c07 1407 1007 0807) do if %InstallLanguage% == %%L set YES=J + +:: English installation +for %%L in (0409 0809 0c09 2809 1009 2409 3c09 4009 3809 1809 2009 4409 1409 3409 4809 1c09 2c09 3009) do if %InstallLanguage% == %%L set YES=Y + +if not "%YES%" == "" goto :SelectVolume +:: the following must be set to the character representing "YES" +:: this is needed to run the format utility without user interaction +echo. +set /p YES="Enter the letter that represents YES in your language [Y]: " +if "%YES%" == "" set YES=Y + +:SelectVolume +:: collect volumes that can be used as test volumes +cls +echo. +echo Collecting available volumes ... +echo. +set MenuItem=0 +set FoundVolumes= + +for /f "tokens=1,6* skip=8" %%D in ('udefrag -l') do call :AddToDriveList %%~D & if not %%~D == %SystemDrive% call :DisplayMenuItem %%~D - "%%~F" + +echo. +echo 0 ... EXIT +echo. +set /p SelectedVolume="Select volume to process: " + +if "%SelectedVolume%" == "" goto :EOF +if %SelectedVolume% EQU 0 goto :EOF + +if %SelectedVolume% LEQ %MenuItem% goto :GetDriveLetter +echo. +echo Selection must be between 0 and %MenuItem% !!! +echo. +pause +goto :SelectVolume + +:GetDriveLetter +for /f "tokens=%SelectedVolume%" %%V in ("%FoundVolumes%") do set ProcessVolume=%%~V + +:: ask if we like to format the volume +echo. +set /p FormatVolume="Format volume %ProcessVolume%? (Y/[N]) " +if /i not "%FormatVolume%" == "Y" ( + set FormatVolume=N +) else ( + set FormatVolume=Y +) +if "%FormatVolume%" == "N" goto :SelectFragmentationRate + +:: collect available volume types +for /f "tokens=2 delims=[" %%V in ('ver') do set test=%%V +for /f "tokens=2" %%V in ('echo %test%') do set test1=%%V +for /f "tokens=1,2 delims=." %%V in ('echo %test1%') do set OSversion=%%V.%%W + +:: FAT volumes +set AvailableTypes=FAT FAT32 +set SelectionTypes=FAT-FAT32 +if %OSversion% GEQ 5.1 ( + set AvailableTypes=%AvailableTypes% exFAT + set SelectionTypes=%SelectionTypes%-exFAT +) + +:: NTFS volumes +set AvailableTypes=%AvailableTypes% NTFS "NTFS compressed" "NTFS mixed" +set SelectionTypes=%SelectionTypes%-NTFS-NTFS compressed-NTFS mixed + +:: UDF volumes +if %OSversion% GEQ 6.0 ( + set AvailableTypes=%AvailableTypes% "UDF 1.02" "UDF 1.50" "UDF 2.00" "UDF 2.01" "UDF 2.50" "UDF 2.50 mirror" + set SelectionTypes=%SelectionTypes%-UDF 1.02-UDF 1.50-UDF 2.00-UDF 2.01-UDF 2.50-UDF 2.50 mirror +) + +:SelectVolumeType +cls +echo. +set MenuItem=0 +for %%I in (%AvailableTypes%) do call :DisplayMenuItem %%~I + +echo. +echo 0 ... EXIT +echo. +set /p SelectedType="Select new volume type: " + +if "%SelectedType%" == "" goto :EOF +if %SelectedType% EQU 0 goto :EOF + +if %SelectedType% LEQ %MenuItem% goto :GetVolumeType +echo. +echo Selection must be between 0 and %MenuItem% !!! +echo. +pause +goto :SelectVolumeType + +:GetVolumeType +for /f "tokens=%SelectedType% delims=-" %%V in ('echo %SelectionTypes%') do set SelectedVolumeType=%%~V + +:SelectFreeSpace +cls +echo. +echo Values 1 to 9 will be multiplied by 10 +echo any other value will be used as is + +echo. +echo 0 ... EXIT +echo. +set /p value="Enter percentage of free Space: " + +if "%value%" == "" goto :EOF +if %value% EQU 0 goto :EOF + +set PercentageFree=0 + +if %value% LEQ 100 set PercentageFree=%value% +if %value% LSS 10 set /a PercentageFree="value * 10" + +if %PercentageFree% GTR 0 goto :SelectSmallFileRate + +echo. +echo Selection must be between 0 and 100 !!! +echo. +pause +goto :SelectFreeSpace + +:SelectSmallFileRate +echo. +echo -------------------------------------- +echo. +echo Enter the small files rate, +echo x out of 10 files should be below 512kB. +echo. +set /p SmallFileRate="Enter a value between 1 and 10 for x: " + +if "%SmallFileRate%" == "" set SmallFileRate=1 +if %SmallFileRate% LEQ 0 set SmallFileRate=1 +if %SmallFileRate% GTR 10 set SmallFileRate=10 + +:SelectFragmentationRate +echo. +echo -------------------------------------- +echo. +echo Enter the fragmentation rate, +echo every x-th file should be fragmented. +echo. +set /p FragmentationRate="Enter a value between 1 and 100 for x: " + +if "%FragmentationRate%" == "" set FragmentationRate=1 +if %FragmentationRate% LEQ 0 set FragmentationRate=1 +if %FragmentationRate% GTR 100 set FragmentationRate=100 + +call :delay 0 + +if "%FormatVolume%" == "N" goto :ParseVolumeLabel + +for /f "tokens=1,2,3" %%R in ('echo %SelectedVolumeType%') do ( + set ex_type=%%R + set option1=%%S + set option2=%%T +) + +set VolumeName=%ex_type% +if not "%option1%" == "" set VolumeName=%VolumeName%_%option1:.=% +if not "%option2%" == "" set VolumeName=%VolumeName%_%option2% +set VolumeName=%VolumeName%_sr%SmallFileRate%_fr%FragmentationRate% + +call :answers >"%TMP%\answers.txt" + +title Setting Volume Label of "%ProcessVolume%" ... +echo. +set CommandLine=label %ProcessVolume% TEST +echo %CommandLine% +echo. +%CommandLine% + +call :delay 2 + +title Formatting Drive "%ProcessVolume%" ... + +set Switches= + +if not "%ex_type%" == "FAT" if not "%ex_type%" == "FAT32" if not "%ex_type%" == "exFAT" goto :NTFS +goto :DoFormat + +:NTFS +if not "%ex_type%" == "NTFS" goto :UDF +if "%option1%" == "compressed" set Switches=/C +goto :DoFormat + +:UDF +set Switches=/R:%option1% +if "%option2%" == "mirror" set Switches=%Switches% /D + +:DoFormat +echo. +set CommandLine=format %ProcessVolume% /FS:%ex_type% /V:%VolumeName% %Switches% /X +echo %CommandLine% +echo. +%CommandLine% <"%TMP%\answers.txt" + +call :delay 5 + +goto :StartProcess + +:ParseVolumeLabel +for /f "tokens=1,5,6* skip=8" %%D in ('udefrag -l') do if %%~D == %ProcessVolume% set PercentageFree=%%E & set VolumeName="%%~G" + +for /f "tokens=1,2,3,4 delims=_" %%R in ('echo %VolumeName:"=%') do ( + set ex_type=%%R + set option1=%%S + set option2=%%T + set option3=%%U +) + +set ApplyLabel=0 + +if not "%ex_type%" == "FAT" if not "%ex_type%" == "FAT32" if not "%ex_type%" == "exFAT" goto :makeNTFS +set ApplyLabel=1 +set VolumeName=%ex_type% + +:makeNTFS +if not "%ex_type%" == "NTFS" goto :makeUDF +set ApplyLabel=1 +set VolumeName=%ex_type% +if not "%option1%" == "compressed" if not "%option1%" == "mixed" goto :makeUDF +set VolumeName=%VolumeName%_%option1% + +:makeUDF +if not "%ex_type%" == "UDF" goto :ApplyVolumeLabel +set ApplyLabel=1 +set VolumeName=%ex_type% +set VolumeName=%VolumeName%_%option1:.=% +if "%option2%" == "mirror" set VolumeName=%VolumeName%_%option2% + +:ApplyVolumeLabel +if %ApplyLabel% EQU 0 goto :StartProcess +set temp_var=%option1:~0,2% +if "%temp_var%" == "sr" set SmallFileRate=%option1:~2% +set temp_var=%option2:~0,2% +if "%temp_var%" == "sr" set SmallFileRate=%option2:~2% +set temp_var=%option3:~0,2% +if "%temp_var%" == "sr" set SmallFileRate=%option3:~2% +set VolumeName=%VolumeName%_sr%SmallFileRate%_fr%FragmentationRate% + +title Setting Volume Label of "%ProcessVolume%" ... +echo. +set CommandLine=label %ProcessVolume% %VolumeName% +echo %CommandLine% +echo. +%CommandLine% + +call :delay 2 + +:StartProcess +rem process the volume +call :FragmentDrive "%ProcessVolume%" + +title Operation Completed ... + +:quit +echo. +pause + +goto :EOF + +:DisplayMenuItem + set /a MenuItem+=1 + echo %MenuItem% ... %* +goto :EOF + +:AddToDriveList + if %~1 == %SystemDrive% goto :EOF + + if "%FoundVolumes%" == "" ( + set FoundVolumes=%~1 + ) else ( + set FoundVolumes=%FoundVolumes% %~1 + ) +goto :EOF + +:FragmentDrive + title Checking Drive "%~1" ... + echo Executing ... chkdsk %~1 /r /f + echo. & echo %YES% | chkdsk %~1 /r /f + + call :delay 2 + + set /a size="24 + %RANDOM% / 3" + set /a fragments="%RANDOM% / 1365" + set count=0 + set NoCompr=0 + set dest=%~1 + set ExitCode=0 + + if "%FormatVolume%" == "Y" goto :create + + title Changing Fragmented Files on Drive "%~1 (%VolumeName%)" ... + echo Changing Fragmented Files on Drive "%~1 (%VolumeName%)" ... + echo. + + for /r "%~1" %%X in ( *.* ) do ( + call :doFragment "%%~X" "%%~zX" || goto :finished + call :increment + ping -n 3 localhost >NUL + ) + + goto :finished + + :create + title Creating Fragmented Files on Drive "%~1 (%VolumeName%)" until %PercentageFree%%% free space left ... + echo Creating Fragmented Files on Drive "%~1 (%VolumeName%)" until %PercentageFree%%% free space left ... + echo. + + :loop + call :doit "%~1" || goto :finished + call :increment + ping -n 3 localhost >NUL + for /f "tokens=1,5 skip=8" %%X in ( 'udefrag -l' ) do if "%%~X" == "%~1" if %PercentageFree% LEQ %%Y goto :loop + + :finished + if %ExitCode% GTR 0 ( + echo. + echo Operation failed ... + ) else ( + echo. + echo Operation succeeded ... + ) + + call :delay 5 + + title Checking Drive "%~1" ... + echo Executing ... chkdsk %~1 /r /f + echo. & echo %YES% | chkdsk %~1 /r /f + + call :delay 2 +goto :EOF + +:answers + echo TEST + echo %YES% +goto :EOF + +:doFragment + set /a size="%~2 / 1024" + + set count_fmt= %count% + set size_fmt= %size% + set frag_fmt= %fragments% + + echo File %count_fmt:~-3% ... %size_fmt:~-6% kB ... %frag_fmt:~-3% Fragments ... "%~1" + + "%MyDefragDir%\MyFragmenter.exe" -p %fragments% "%~1" >NUL + set ExitCode=%ERRORLEVEL% + exit /B %ExitCode% +goto :EOF + +:doit + if %count% EQU 0 goto :skip + if %NoFolder% EQU 0 set dest=%~1\folder_%count% + if %NoFolder% EQU 0 echo Folder %dest% + if %NoFolder% EQU 0 mkdir "%dest%" + :skip + + set count_fmt= %count% + set size_fmt= %size% + set frag_fmt= %fragments% + + echo File %count_fmt:~-3% ... %size_fmt:~-6% kB ... %frag_fmt:~-3% Fragments + + "%MyDefragDir%\MyFragmenter.exe" -p %fragments% -s %size% "%dest%\file_%count%.bin" >NUL + set ExitCode=%ERRORLEVEL% + if %ExitCode% GTR 0 exit /B %ExitCode% + + if "%option1%" == "mixed" if %NoCompr% EQU 0 compact /c "%dest%\file_%count%.bin" >NUL + set ExitCode=%ERRORLEVEL% + exit /B %ExitCode% +goto :EOF + +:delay + set /a seconds="%1 + 1" + echo. + if %seconds% == 1 ( + echo ============================================ + ) else ( + echo -------------------------------------------- + ping -n %seconds% localhost >NUL + ) + echo. +goto :EOF + +:increment + set /a count+=1 + + set /a NoFolder="count %% 10" + set /a NoCompr="count %% 5" + + if %NoFolder% LSS %SmallFileRate% ( + set divisor=64 + ) else ( + set divisor=3 + ) + + set /a size="24 + %RANDOM% / %divisor%" + set /a fragments="%RANDOM% / 1365" + + set /a quotient="count %% %FragmentationRate%" + + if %quotient% EQU 0 goto :EOF + + set fragments=0 +goto :EOF diff --git a/TestSuite/Create Fragmented Volumes/ReadMe_First.txt b/TestSuite/Create Fragmented Volumes/ReadMe_First.txt new file mode 100644 index 0000000..4540eab --- /dev/null +++ b/TestSuite/Create Fragmented Volumes/ReadMe_First.txt @@ -0,0 +1,69 @@ + +General Information: + + This test suite is designed to be used with volumes of 1GB in size, + which allows for a really short processing time. + + It is used on a virtual machine to test the algorithm. + + The following file systems are supported: + + 1) FAT + 2) FAT32 + 3) exFAT (1) + 4) NTFS + 5) NTFS compressed + (with compression enabled) + 6) NTFS mixed + (with 25% of compressed files, which mimics a regular system disk) + 7) UDF v1.02 (2) + 8) UDF v1.50 (2) + 9) UDF v2.00 (2) + 10) UDF v2.01 (2) + 11) UDF v2.50 (2) + 12) UDF v2.50 with duplicated meta-data (2) + + The fragmentation utility from http://www.mydefrag.com/ is used to create + fragmented files. + + For cloning the disks to test different settings on the same data you may use + HDClone available freely at http://www.miray.de/products/sat.hdclone.html + + You can change the number of fragmented files by not formating the drive. + This way the current files will be fragmented. + + (1) exFAT is only included with Vista and above. + For Windows XP SP2 and SP3 you need to download and install + the driver from http://support.microsoft.com/kb/955704/en-us + Windows XP SP1 and below do not support exFAT. + + (2) UDF is only included with Vista and above. + +--- + + !!! CAUTION !!! + + If you select to format the volume make sure to not use a volume, + where you have valuable data stored else your data is lost. + + It is best to use virtual test volumes without any existing data. + +--- + +Setup: + + 1) Prepare separate volumes, 1GB in size with the disk management utility + + 2) assign a volume letter and any file system, so it can be found by the utility + + a) You will be asked for the volume to process, which you select from the menu + + b) If you format the volume you will be asked to select one of the supported file systems + + 3) CHKDSK is executed before and after the fragmented files creation process, + to make sure the volume is consistent. + + 4) It is best to always format the volume to always start with a fresh volume, + this will detect bad clusters. + In addition do only use volumes of 1GB in size, since quick format is not used, which + would only clear the file allocation table and would not detect bad clusters. diff --git a/TestSuite/Create Fragmented Volumes/VirtualBox Create Test Hardisks.cmd b/TestSuite/Create Fragmented Volumes/VirtualBox Create Test Hardisks.cmd new file mode 100644 index 0000000..f4e652f --- /dev/null +++ b/TestSuite/Create Fragmented Volumes/VirtualBox Create Test Hardisks.cmd @@ -0,0 +1,122 @@ +@rem +@echo off +:: +:: This script creates virtual harddisks +:: It is tested with VirtualBox v4.1 +:: +:: It can be used to create NewHardDisk{Index}.vdi files +:: in the folders containing virtual machines +:: +:: Copyright (c) 2010-2011 by Stefan Pendl (stefanpe@users.sourceforge.net). +:: +:: This program is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation; either version 2 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program; if not, write to the Free Software +:: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +:: + +setlocal enabledelayedexpansion + +title %~n0 + +:: installation folder of VirtualBox +for /f "tokens=2*" %%I in ('reg query "HKLM\SOFTWARE\Oracle\VirtualBox" /v InstallDir') do set VBoxRoot=%%~J +if "%VBoxRoot%" == "" goto :noVBroot +if not exist "%VBoxRoot%" goto :noVBroot + +:: Folder containing the virtual machines +if not exist "%USERPROFILE%\.VirtualBox\VirtualBox.xml" goto :noVMRoot + +for /f "tokens=2" %%D in ('findstr "defaultMachineFolder" "%USERPROFILE%\.VirtualBox\VirtualBox.xml"') do set VMRootTMP1=%%~D +set VMRootTMP=%VMRootTMP1:"=% +if "%VMRootTMP%" == "" goto :noVMRoot + +for /f "tokens=2 delims==" %%D in ('echo "%VMRootTMP%"') do set VMRootTMP1=%%~D +set VMRoot=%VMRootTMP1:"=% +if "%VMRoot%" == "" goto :noVMRoot +if not exist "%VMRoot%" goto :noVMRoot + +cd /d %VMRoot% + +:DisplayVMlist +cls +set MenuItem=0 +set MenuSelectionsTMP= +echo. +for /d %%V in ( * ) do set /a MenuItem+=1 & echo !MenuItem! ... "%%~V" & set MenuSelectionsTMP=!MenuSelectionsTMP!:%%~V + +set MenuSelections=%MenuSelectionsTMP:~1% +echo. +echo 0 ... EXIT +echo. +set /p SelectedItem="Select the VM to create disks for: " + +if "%SelectedItem%" == "" goto :quit +if %SelectedItem% EQU 0 goto :quit + +if %SelectedItem% LEQ %MenuItem% goto :CreateDisks + +echo. +echo Please enter a number in the range of 0 to %MenuItem%. +echo. +pause +goto :DisplayVMlist + +:CreateDisks +for /f "tokens=%SelectedItem% delims=:" %%S in ('echo %MenuSelections%') do set SelectedVM=%%~S + +echo. +echo For Windows 2000 the maximum disk count is 8, +echo since the controller dosn't support more! +echo. +set /p MaxIndex="Enter number of disks to create (0 to exit, maximum 15): " +if "%MaxIndex%" == "" goto :quit +if %MaxIndex% EQU 0 goto :quit +if %MaxIndex% GTR 15 set MaxIndex=15 + +cd /d %VBoxRoot% + +for /L %%F in (1,1,%MaxIndex%) do ( + set HardDiskName="%VMRoot%\%SelectedVM%\%SelectedVM: =_%_TestDisk_%%F.vdi" + + echo. + echo --------------------------------------- + echo. + + if not exist !HardDiskName! ( + echo Creating !HardDiskName! ... + echo. + VBoxManage createhd --filename !HardDiskName! --size 1024 + ) else ( + echo Modifying !HardDiskName! ... + echo. + VBoxManage modifyhd !HardDiskName! --resize 1024 + ) +) + +:quit +echo. +echo --------------------------------------- +echo. +pause + +goto :EOF + +:noVBroot +echo. +echo VirtualBox not installed, aborting ... +goto :quit + +:noVMRoot +echo. +echo Harddisk Root Folder missing, aborting ... +goto :quit diff --git a/doc/SF_files_readme.txt b/doc/SF_files_readme.txt new file mode 100644 index 0000000..7cc2699 --- /dev/null +++ b/doc/SF_files_readme.txt @@ -0,0 +1,25 @@ +Package and Windows version relation: + + i386 .... for 32-bit Windows on Intel and AMD processors + AMD64 ... for 64-bit Windows on Intel and AMD processors + + IA64 .... for Windows Itanium on Intel Itanium processors only + +Package contents: + + regular (with installer): + ultradefrag ... full package with GUI, console and boot time components, + allows installing the micro edition too by omitting the GUI components + + portable (for removable drives, no installer): + ultradefrag ... full package with GUI and console components, + micro edition can be extracted by using only the console components + +Release stages explained: + + alpha ... new features implemented and tested, problems may be experienced + used to test major changes + beta .... base features implemented and tested, problems may be experienced + used to test minor changes + RC ...... release candidate, all features are implemented and fully tested + used to iron out last remaining problems diff --git a/doc/doxygen_defaults/generate_defaults.cmd b/doc/doxygen_defaults/generate_defaults.cmd new file mode 100644 index 0000000..3b905a3 --- /dev/null +++ b/doc/doxygen_defaults/generate_defaults.cmd @@ -0,0 +1,30 @@ +@echo off +:: +:: This utility will generate the default HTML header, footer and CSS style sheet +:: for a default doxygen configuration without any additional customization +:: +:: Three versions will be created: +:: 1) regular ... no search and treeview +:: 2) search .... search only +:: 3) tree ...... treeview only +:: +echo. + +del /f /q default_*.* + +doxygen -g default_Doxyfile + +echo Generating Default HTML files with Search... +echo PROJECT_NAME=Default >>default_Doxyfile +doxygen -w html default_header_search.html default_footer_search.html default_doxygen_search.css default_Doxyfile + +echo Generating Default HTML files... +echo SEARCHENGINE=NO >>default_Doxyfile +doxygen -w html default_header_regular.html default_footer_regular.html default_doxygen_regular.css default_Doxyfile + +echo Generating Default HTML files with Treeview... +echo GENERATE_TREEVIEW=YES >>default_Doxyfile +doxygen -w html default_header_tree.html default_footer_tree.html default_doxygen_tree.css default_Doxyfile + +echo. +pause diff --git a/doc/html/.htaccess b/doc/html/.htaccess new file mode 100644 index 0000000..3bb747e --- /dev/null +++ b/doc/html/.htaccess @@ -0,0 +1,5 @@ +ErrorDocument 404 /Error_Pages/404.html +# enable expirations +ExpiresActive On +# expire icon after a month in the client's cache +ExpiresByType image/ico A2592000 diff --git a/doc/html/Error_Pages/404.html b/doc/html/Error_Pages/404.html new file mode 100644 index 0000000..089bb80 --- /dev/null +++ b/doc/html/Error_Pages/404.html @@ -0,0 +1,48 @@ +UltraDefrag error 404 + +

http://www.ultradefrag.com

+

 

+

!!! You seem to be lost my friend !!!!!

+

This is a page not found error.

+

It means, that the location you wanted to access does no longer exist

+

or has been moved to some other place.

+

+ + to go to the UltraDefrag home page.

+

+ +

+ + \ No newline at end of file diff --git a/doc/html/Error_Pages/back.jpg b/doc/html/Error_Pages/back.jpg new file mode 100644 index 0000000..dfc8807 Binary files /dev/null and b/doc/html/Error_Pages/back.jpg differ diff --git a/doc/html/Error_Pages/gradientbg.jpg b/doc/html/Error_Pages/gradientbg.jpg new file mode 100644 index 0000000..ed88f4c Binary files /dev/null and b/doc/html/Error_Pages/gradientbg.jpg differ diff --git a/doc/html/Scripts/AC_RunActiveContent.js b/doc/html/Scripts/AC_RunActiveContent.js new file mode 100644 index 0000000..bcb6010 --- /dev/null +++ b/doc/html/Scripts/AC_RunActiveContent.js @@ -0,0 +1,288 @@ +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + } + str += ''; + } + else + { + str += '0) + { + if(isFirstEntry) + { + camelizedString = oStringList[i]; + isFirstEntry = false; + } + else + { + var s = oStringList[i]; + camelizedString += s.charAt(0).toUpperCase() + s.substring(1); + } + } + } + + return camelizedString; +} + +Spry.Effect.Utils.isPercentValue = function(value) +{ + var result = false; + try + { + if (value.lastIndexOf("%") > 0) + result = true; + } + catch (e) {} + return result; +} + +Spry.Effect.Utils.getPercentValue = function(value) +{ + var result = 0; + try + { + result = Number(value.substring(0, value.lastIndexOf("%"))); + } + catch (e) {Spry.Effect.Utils.showError('Spry.Effect.Utils.getPercentValue: ' + e);} + return result; +} + +Spry.Effect.Utils.getPixelValue = function(value) +{ + var result = 0; + try + { + result = Number(value.substring(0, value.lastIndexOf("px"))); + } + catch (e) {} + return result; +} + +Spry.Effect.Utils.getFirstChildElement = function(node) +{ + if (node) + { + var childCurr = node.firstChild; + + while (childCurr) + { + if (childCurr.nodeType == 1) // Node.ELEMENT_NODE + return childCurr; + + childCurr = childCurr.nextSibling; + } + } + + return null; +}; + +Spry.Effect.Utils.fetchChildImages = function(startEltIn, targetImagesOut) +{ + if(!startEltIn || startEltIn.nodeType != 1 || !targetImagesOut) + return; + + if(startEltIn.hasChildNodes()) + { + var childImages = startEltIn.getElementsByTagName('img') + var imageCnt = childImages.length; + for(var i=0; i