Harald Welte 8 months ago
commit 81356e9526
  1. 9
      Released/Read Me First.txt
  2. 103
      TestSuite/Boot Time Commands/Install Test Suite.cmd
  3. BIN
      TestSuite/Boot Time Commands/ud-boot-time-test-call.cmd
  4. BIN
      TestSuite/Boot Time Commands/ud-boot-time-test-debug.cmd
  5. BIN
      TestSuite/Boot Time Commands/ud-boot-time-test-suite.cmd
  6. BIN
      TestSuite/Boot Time Commands/ud-boot-time-test-udefrag.cmd
  7. BIN
      TestSuite/Boot Time Commands/ud-boot-time.cmd
  8. 77
      TestSuite/Check against Windows Utilities/CheckVolumes.cmd
  9. 161
      TestSuite/CommonRoutines/winx_fwrite.c
  10. 211
      TestSuite/CommonRoutines/winx_print_strings_test.c
  11. 170
      TestSuite/Create Bug Report Log File.cmd
  12. 475
      TestSuite/Create Fragmented Volumes/Create Fragmented Volumes.cmd
  13. 69
      TestSuite/Create Fragmented Volumes/ReadMe_First.txt
  14. 122
      TestSuite/Create Fragmented Volumes/VirtualBox Create Test Hardisks.cmd
  15. 25
      doc/SF_files_readme.txt
  16. 30
      doc/doxygen_defaults/generate_defaults.cmd
  17. 5
      doc/html/.htaccess
  18. 48
      doc/html/Error_Pages/404.html
  19. BIN
      doc/html/Error_Pages/back.jpg
  20. BIN
      doc/html/Error_Pages/gradientbg.jpg
  21. 288
      doc/html/Scripts/AC_RunActiveContent.js
  22. 2195
      doc/html/SpryAssets/Copy of SpryEffects.js
  23. 88
      doc/html/SpryAssets/SpryEffects.js
  24. 328
      doc/html/about.html
  25. 12
      doc/html/appstat/console-ia64.html
  26. 12
      doc/html/appstat/console-x64.html
  27. 12
      doc/html/appstat/console-x86.html
  28. 12
      doc/html/appstat/gui-ia64.html
  29. 12
      doc/html/appstat/gui-x64.html
  30. 12
      doc/html/appstat/gui-x86.html
  31. 212
      doc/html/artgallery.html
  32. 1
      doc/html/bugs.html
  33. 3
      doc/html/bugs/.htaccess
  34. 359
      doc/html/de/index.html
  35. 8
      doc/html/development.html
  36. 8
      doc/html/download.html
  37. BIN
      doc/html/ext_image/link_a.gif
  38. BIN
      doc/html/ext_image/link_b.gif
  39. BIN
      doc/html/ext_image/link_c.gif
  40. BIN
      doc/html/ext_image/link_d.gif
  41. 331
      doc/html/fa/index.html
  42. 1
      doc/html/faq.html
  43. 4
      doc/html/flags/gif/.htaccess
  44. BIN
      doc/html/flags/gif/ad.gif
  45. BIN
      doc/html/flags/gif/ae.gif
  46. BIN
      doc/html/flags/gif/af.gif
  47. BIN
      doc/html/flags/gif/ag.gif
  48. BIN
      doc/html/flags/gif/ai.gif
  49. BIN
      doc/html/flags/gif/al.gif
  50. BIN
      doc/html/flags/gif/am.gif
  51. BIN
      doc/html/flags/gif/an.gif
  52. BIN
      doc/html/flags/gif/ao.gif
  53. BIN
      doc/html/flags/gif/ar.gif
  54. BIN
      doc/html/flags/gif/as.gif
  55. BIN
      doc/html/flags/gif/at.gif
  56. BIN
      doc/html/flags/gif/au.gif
  57. BIN
      doc/html/flags/gif/aw.gif
  58. BIN
      doc/html/flags/gif/ax.gif
  59. BIN
      doc/html/flags/gif/az.gif
  60. BIN
      doc/html/flags/gif/ba.gif
  61. BIN
      doc/html/flags/gif/bb.gif
  62. BIN
      doc/html/flags/gif/bd.gif
  63. BIN
      doc/html/flags/gif/be.gif
  64. BIN
      doc/html/flags/gif/bf.gif
  65. BIN
      doc/html/flags/gif/bg.gif
  66. BIN
      doc/html/flags/gif/bh.gif
  67. BIN
      doc/html/flags/gif/bi.gif
  68. BIN
      doc/html/flags/gif/bj.gif
  69. BIN
      doc/html/flags/gif/bm.gif
  70. BIN
      doc/html/flags/gif/bn.gif
  71. BIN
      doc/html/flags/gif/bo.gif
  72. BIN
      doc/html/flags/gif/br.gif
  73. BIN
      doc/html/flags/gif/bs.gif
  74. BIN
      doc/html/flags/gif/bt.gif
  75. BIN
      doc/html/flags/gif/bv.gif
  76. BIN
      doc/html/flags/gif/bw.gif
  77. BIN
      doc/html/flags/gif/by.gif
  78. BIN
      doc/html/flags/gif/bz.gif
  79. BIN
      doc/html/flags/gif/ca.gif
  80. BIN
      doc/html/flags/gif/catalonia.gif
  81. BIN
      doc/html/flags/gif/cc.gif
  82. BIN
      doc/html/flags/gif/cd.gif
  83. BIN
      doc/html/flags/gif/cf.gif
  84. BIN
      doc/html/flags/gif/cg.gif
  85. BIN
      doc/html/flags/gif/ch.gif
  86. BIN
      doc/html/flags/gif/ci.gif
  87. BIN
      doc/html/flags/gif/ck.gif
  88. BIN
      doc/html/flags/gif/cl.gif
  89. BIN
      doc/html/flags/gif/cm.gif
  90. BIN
      doc/html/flags/gif/cn.gif
  91. BIN
      doc/html/flags/gif/co.gif
  92. BIN
      doc/html/flags/gif/cr.gif
  93. BIN
      doc/html/flags/gif/cs.gif
  94. BIN
      doc/html/flags/gif/cu.gif
  95. BIN
      doc/html/flags/gif/cv.gif
  96. BIN
      doc/html/flags/gif/cx.gif
  97. BIN
      doc/html/flags/gif/cy.gif
  98. BIN
      doc/html/flags/gif/cz.gif
  99. BIN
      doc/html/flags/gif/de.gif
  100. BIN
      doc/html/flags/gif/dj.gif
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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.

@ -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

@ -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

@ -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;
}

@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#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;
}

@ -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

@ -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

@ -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.

@ -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 (