GetListSelection("", " " # NAME_TBOSDT # " version " # MINVERS_TBOSDT # " or later required ^n", 1, "err")
goto exit
elseif tbsenv<>"WINDOWS" then
if GetListSelection("Caution: script not running from WINDOWS", "For UFD, the System Drive won't be assigned correctly.^nPress <Enter> to continue or <Escape> to cancel.^n", 1, "warn")<=0 then
goto exit
end if
end if
gOsdtoolPath=LocateFile(FILE_OSDTOOL)
if gOsdtoolPath="" then
goto exit
end if
tbospath=LocateFile(FILE_TBOSDTW)
if tbospath="" then
goto exit
end if
operation=1
while operation>0
operation=GetListSelection("Select operation", "Copy a Windows installation to a USB drive^nEnable Windows already installed on a USB drive to boot^n", operation, "")
if operation=1 then
if gImagePath="" then
gImagePath=LocateImageFile()
end if
if gImagePath<>"" then
winsel=GetWindowsSelection("Select Windows Installation to copy", "all")
while winsel
if CopyWinInst(winsel)=1 then
operation=0
ExitLoop
end if
winsel=GetWindowsSelection("Select Windows Installation to copy", "all")
wend
end if
elseif operation=2 then
winsel=GetWindowsSelection("Select Windows Installation to modify", "USB")
while winsel
if winsel.needbcd=1 then
bcdpart=GetActiveBCDPartition(winsel.hd, 0)
if bcdpart=0 then
GetListSelection("" " No boot files and no active BCD found on HD" # winsel.hd # " ^n", 1, "warn")
elseif (winsel.needbcd=1 or destsel.guid<>"") and destsel.hd<>bcdpart.hd then
if destsel.pid>0 then
bcddest=GetActiveBCDPartition(destsel.hd, 0)
end if
if destsel.pid>0 and bcddest=1 then
bcdpart=0
elseif bcddest=0 then
if destsel.pid=0 or destsel.pid=0x80 then
bcdpart=GetActiveBCDPartition(winsel.hd, 500)
hd=0
while hd<=1 and bcdpart=0
if winsel.hd<>hd and destsel.hd<>hd then
bcdpart=GetActiveBCDPartition(hd, 500)
end if
if bcdpart=1 and destsel.pid=0x80 then
if destsel.guid<>"" and bcdpart.guid="" then
bcdpart=0
elseif destsel.guid="" and bcdpart.guid<>"" then
bcdpart=0
end if
end if
hd=hd+1
wend
end if
if bcdpart=0 then
if destsel.guid<>"" then
title="EFI System"
else
title="System Reserved"
end if
if GetListSelection("No " # title # " partition found on drive #" # destsel.hd, "Continue anyway (single copy)^nCancel operation^n", 1, "warn")<>1 then