meoit Posted May 4, 2017 Share Posted May 4, 2017 (edited) Hello all !. Sorry for my bad English. I am trying to write an mini appliication for bootable usb, but my script died. It has been abruptly stopped, accompanied by the message "App1 has stopped working.". I tried compile with the export of x86 and x64 executive file types, but the problem still exists for both Windows x86 and x64 (build and test run on Windows 10). Here is my script: expandcollapse popup;https://www.autoitscript.com/forum/topic/188343-my-script-died/ Opt('MustDeclareVars', 1) Opt('TrayIconHide', 1) Opt('TrayMenuMode', 15) #include <Constants.au3> #include <GUIConstants.au3> #include <TrayConstants.au3> HotKeySet('{f2}', 'H_show_setting_gui') Global Const $fdLANG = @TempDir & '\Languages', $myAppName = 'My App1', $myAppShortName = 'App1', $myTemp = @TempDir & '\App1', $zipped_AOMEI = @WorkingDir & '\AOMEI.7z', $Extracter7Zip = @WorkingDir & '\7zip.exe', $myExtracterDll = @WorkingDir & '\7z.dll', $DP_File = @TempDir & '\Partition.txt', _ $Info = 64 + 8192 + 262144, $Warn = 48 + 8192 + 262144, $Err = 16 + 8192 + 262144, $Q_N = 32 + 4 + 256 + 8192 + 262144, $Q_Y = 32 + 4 + 8192 + 262144, $S2TB = 2097152, $PV2_4096MB = 4096, $PV1_APPs = 1024, $BasicISOsize = 58 * 2^20, $Copy32 = @WorkingDir & '\copy.dll', $Copy64 = @WorkingDir & '\copy64.dll' Global $B_Msg, $B_main_gui, $B_setting_gui, $B_working_gui #include <File.au3> #include <String.au3> #include <Array.au3> #include <WinAPIFiles.au3> #include <Misc.au3> ; #include <MultiLang.au3> ;https://www.autoitscript.com/forum/topic/118495-multilangau3/ #include <Copy.au3> ;https://www.autoitscript.com/forum/topic/121833-copy-udf/ DirRemove($fdLANG, 1) DirRemove($myTemp, 1) H_show_select_lang_gui() ;MsgBox($Info, 'Test language', _MultiLang_GetText('LNG_xxxxxxxxx')) Global $TimeStart_Dev = TimerInit(), $TimeStart_Color = TimerInit(), $B_ImFree = true, $Unknow = _MultiLang_GetText('LNG_unknow'), $B_CurTotalDev, $B_UpdateTotalDev, _ $B_BootPartSize = $Unknow, $B_DLB = 'Data', $B_BLB = 'Boot', $B_ID2T = $Unknow, $B_letter_for_create, $B_DiskName, $B_TotalSizeGB, $B_TotalSize, _ $B_myDiskStatus = $Unknow, $B_PartitionStyle = $Unknow, $B_isHDD = $Unknow, $B_ISO = $Unknow, $B_SelectedCase = $Unknow, $B_Conv2MBR = false, $B_Conv2GPT = false Global $B_CopyState, $B_CopyState_Data, $B_HaveCopy = False, $B_PauseCopy = False Opt('GUICloseOnEsc', 0) H_create_main_gui($B_main_gui) H_create_setting_gui($B_setting_gui, H_getControl('$main_gui', $B_main_gui)) H_create_working_gui($B_working_gui, H_getControl('$main_gui', $B_main_gui)) GUISetState(@SW_SHOW, H_getControl('$main_gui', $B_main_gui)) H_start_app1() While 1 $B_Msg = GUIGetMsg(1) If $B_Msg[0] <> $GUI_EVENT_MOUSEMOVE Then Select Case $B_Msg[1] = $B_main_gui[0][1] H_processing_for_main_gui() Case $B_Msg[1] = $B_working_gui[0][1] H_processing_for_working_gui() Case $B_Msg[1] = $B_setting_gui[0][1] H_processing_for_setting_gui() EndSelect If TimerDiff($TimeStart_Dev) > 3011 And $B_ImFree Then H_devices_event() $TimeStart_Dev = TimerInit() EndIf EndIf WEnd Func H_start_app1() H_disable_1() #RequireAdmin If Not IsAdmin() Then DirRemove($fdLANG, 1) MsgBox($Warn, 'Admin Rights', _MultiLang_GetText('LNG_please_run_admin_rights')) Exit EndIf H_enable_1() H_get_disks() If $B_CurTotalDev = 0 Then H_disable_when_nodisk() Else GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), H_get_disks()) EndIf GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 128) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_CurTotalDev) EndFunc Func H_create_main_gui(ByRef $fNew) Dim $fNew[16][2] $fNew[0][0] = '$main_gui' $fNew[0][1] = GUICreate($myAppShortName & ' - ' & _MultiLang_GetText('LNG_gui_title'), 540, 255, -1, -1, -1, $WS_EX_ACCEPTFILES) $fNew[1][0] = GUICtrlCreateMenu(_MultiLang_GetText('LNG_start_menu')) $fNew[2][0] = '$smenu_setting' $fNew[2][1] = GUICtrlCreateMenuItem(_MultiLang_GetText('LNG_SETTING_SMENU') & ' (F2)', $fNew[1][0]) $fNew[3][0] = '$tabs' $fNew[3][1] = GUICtrlCreateTab(5, 6, 530, 205) GUICtrlSetFont(-1, 11, 400, 0, 'Arial') $fNew[4][0] = '$main_tab' $fNew[4][1] = GUICtrlCreateTabItem(_MultiLang_GetText('LNG_create_boot_tab')) $fNew[5][0] = '$button_browse_iso' $fNew[5][1] = GUICtrlCreateButton(_MultiLang_GetText('LNG_button_browse_iso'), 15, 42, 105, 27) GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma') GUICtrlSetCursor(-1, 0) $fNew[6][0] = '$textbox_browse_iso' $fNew[6][1] = GUICtrlCreateInput(_MultiLang_GetText('LNG_IP_ISO_FILE'), 135, 42, 390, 27) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlSetState(-1, 8) GUICtrlCreateLabel(_MultiLang_GetText('LNG_lb_my_disks') & ':', 15, 81, 120, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[7][0] = '$combobox_my_disks' $fNew[7][1] = GUICtrlCreateCombo(_MultiLang_GetText('LNG_please_select_a_disk'), 135, 78, 390, -1, 0x0003) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateLabel(_MultiLang_GetText('LNG_lb_my_cases') & ':', 15, 115, 120, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[8][0] = '$combobox_my_cases' $fNew[8][1] = GUICtrlCreateCombo(_MultiLang_GetText('LNG_please_select_a_case'), 135, 113, 390, -1, 0x0003) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlSetData(-1, _MultiLang_GetText('LNG_PP_2PV') & '|' & _MultiLang_GetText('LNG_PP_1PV')) GUICtrlCreateLabel(_MultiLang_GetText('LNG_PV2SIZE_LB'), 15, 150, 215, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[9][0] = '$input_pv2_size' $fNew[9][1] = GUICtrlCreateInput($Unknow, 185, 146, 90, 27) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[10][0] = '$updown_pv2_size' $fNew[10][1] = GUICtrlCreateUpdown(H_getControl('$input_pv2_size', $B_main_gui), BitOR($UDS_NOTHOUSANDS, $UDS_ARROWKEYS)) GUICtrlCreateLabel('/', 280, 147, 35, 27) GUICtrlSetFont(-1, 16, 400, 0, 'Arial') $fNew[11][0] = '$lb_total_size' $fNew[11][1] = GUICtrlCreateLabel($Unknow, 290, 150, 110, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[12][0] = '$checkbox_option1' $fNew[12][1] = GUICtrlCreateCheckbox(_MultiLang_GetText('LNG_option1'), 15, 182, 155, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[13][0] = '$checkbox_option2' $fNew[13][1] = GUICtrlCreateCheckbox(_MultiLang_GetText('LNG_option2'), 190, 182, 195, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[14][0] = '$button_create_boot' $fNew[14][1] = GUICtrlCreateButton(_MultiLang_GetText('LNG_button_create_boot'), 420, 172, 105, 27) GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma') GUICtrlSetCursor(-1, 0) GUICtrlCreateTabItem('') $fNew[15][0] = '$lb_footer_status' $fNew[15][1] = GUICtrlCreateLabel('Loading data...', 5, 215, 530, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Tahoma') GUICtrlSetColor(-1, 0x008000) EndFunc Func H_processing_for_main_gui() Select Case $B_Msg[0] = $GUI_EVENT_CLOSE H_close_all() Case $B_Msg[0] = H_getControl('$smenu_setting', $B_main_gui) H_show_setting_gui() Case $B_Msg[0] = H_getControl('$button_browse_iso', $B_main_gui) ToolTip(Null, -1, -1, Null, 1, 4) Local $sFOD = FileOpenDialog(_MultiLang_GetText('LNG_BROWSE_TO_ISO_FILE'), @DesktopDir, 'ISO (*.iso)', $FD_FILEMUSTEXIST, '') If @error Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_canceled_browse_iso')) FileChangeDir(@WorkingDir) GUICtrlSetData(H_getControl('$textbox_browse_iso', $B_main_gui), _MultiLang_GetText('LNG_IP_ISO_FILE')) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_CurTotalDev) $B_ISO = $Unknow Else FileChangeDir(@WorkingDir) If H_check_iso_size($sFOD) Then $B_ISO = $sFOD GUICtrlSetData(H_getControl('$textbox_browse_iso', $B_main_gui), $sFOD) Else $B_ISO = $Unknow GUICtrlSetData(H_getControl('$textbox_browse_iso', $B_main_gui), _MultiLang_GetText('LNG_FREESPACE_OF_SYSDISK_NOT')) EndIf EndIf Case $B_Msg[0] = H_getControl('$checkbox_option1', $B_main_gui) If H_checkbox_option1_checked() Then Local $D0 = GUICtrlRead(H_getControl('$combobox_my_disks', $B_main_gui)) If $D0 == _MultiLang_GetText('LNG_please_select_a_disk') Or $D0 == _MultiLang_GetText('LNG_please_select_disk_again') Or $B_ID2T == $Unknow Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_please_select_a_disk') & '.') GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), $GUI_UNCHECKED) ElseIf GUICtrlRead(H_getControl('$combobox_my_cases', $B_main_gui)) == _MultiLang_GetText('LNG_please_select_a_case') Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_please_select_a_case') & '.') GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), $GUI_UNCHECKED) EndIf EndIf Case $B_Msg[0] = H_getControl('$button_create_boot', $B_main_gui) ToolTip(Null, -1, -1, Null, 1, 4) H_enable_processing_gui() Local $DLL, $SC_DLL, $BootSize, $ID_SysDisk $BootSize = GUICtrlRead(H_getControl('$input_pv2_size', $B_main_gui)) $ID_SysDisk = _WinAPI_GetDriveNumber(@HomeDrive)[1] If Not FileExists(@SystemDir & '\diskpart.exe') Then MsgBox($Err, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_NOT_FOUND_DP')) Return 0 ElseIf $B_ID2T == $Unknow Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_please_select_a_disk') & '.') Return 0 ElseIf $B_isHDD == $Unknow Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_unsupport_for_thisdisk')) Return 0 ElseIf $B_ID2T = $ID_SysDisk Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_I_AM_A_SYSDISK') & @CRLF & @CRLF & _MultiLang_GetText('LNG_unsupport_for_systemdisk')) Return 0 ElseIf $B_SelectedCase == $Unknow Or $B_SelectedCase == _MultiLang_GetText('LNG_please_select_a_case') Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_please_select_a_case') & '.') Return 0 ElseIf Not H_disk_ready() Then MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_this_device_not_ready') & @CRLF & @CRLF & _MultiLang_GetText('LNG_check_and_try_again')) Return 0 ElseIf $B_SelectedCase == _MultiLang_GetText('LNG_PP_2PV') And Not ($BootSize > 0) Then MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_size_of_pv2_must_larger_zero')) GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 256) Return 0 ElseIf StringLower($B_PartitionStyle) == 'gpt' And Not H_newer_windows7() Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_need_new_windows_for_gpt')) Return 0 ElseIf IsBool($B_isHDD) And $B_isHDD And Not H_newer_windows7() Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_need_new_windows')) Return 0 ElseIf $B_ISO == $Unknow Or Not FileExists($B_ISO) Or Not FileExists(GUICtrlRead(H_getControl('$textbox_browse_iso', $B_main_gui))) Then MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_NOT_FOUND_ISO')) GUICtrlSetState(H_getControl('$textbox_browse_iso', $B_main_gui), 256) Return 0 EndIf If $B_SelectedCase == _MultiLang_GetText('LNG_PP_2PV') Then Local $BootSize = GUICtrlRead(H_getControl('$input_pv2_size', $B_main_gui)) $B_BootPartSize = $BootSize GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $BootSize) If H_checkbox_option2_checked() Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _ _MultiLang_GetText('LNG_create_boot_confirm') & @CRLF & @CRLF & _ '* ' & _MultiLang_GetText('LNG_option2') & ': Yes' & @CRLF & _ '* ISO: ' & $B_ISO) Else MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _ _MultiLang_GetText('LNG_create_boot_confirm') & @CRLF & @CRLF & _ '* ' & _MultiLang_GetText('LNG_option2') & ': No' & @CRLF & _ '* ISO: ' & $B_ISO) EndIf EndIf If $B_SelectedCase == _MultiLang_GetText('LNG_PP_1PV') Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _ _MultiLang_GetText('LNG_create_boot_confirm') & @CRLF & @CRLF & _ '* ISO: ' & $B_ISO) EndIf _Copy_CloseDll() If Not H_checkbox_option1_checked() And MsgBox($Q_N, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_create_boot_confirm1')) <> 6 Then Return 0 EndIf If H_checkbox_option1_checked() And MsgBox($Q_N, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_create_boot_confirm2')) <> 6 Then Return 0 EndIf If $B_PartitionStyle == 'GPT' And $B_TotalSize > $S2TB Then MsgBox($Info, $myAppName, _MultiLang_GetText('LNG_GPT_CHI_UEFI')) EndIf If $B_PartitionStyle <> 'GPT' And $B_TotalSize > $S2TB Then $B_Conv2GPT = true MsgBox($Info, $myAppName, _MultiLang_GetText('LNG_MBR_LH2TB')) EndIf If $B_PartitionStyle == 'GPT' And $B_TotalSize < $S2TB Then $B_Conv2MBR = true MsgBox($Info, $myAppName, _MultiLang_GetText('LNG_GPT_NH2TB')) EndIf If $B_SelectedCase == _MultiLang_GetText('LNG_PP_2PV') Then If H_checkbox_option5_checked() Then H_proceed_with_case2_option5() Else H_proceed_with_case2() EndIf ElseIf $B_SelectedCase == _MultiLang_GetText('LNG_PP_1PV') Then If H_checkbox_option5_checked() Then H_proceed_with_case1_option5() Else H_proceed_with_case1() EndIf EndIf Case $B_Msg[0] = H_getControl('$combobox_my_disks', $B_main_gui) H_reset_cases() Local $DL = GUICtrlRead(H_getControl('$combobox_my_disks', $B_main_gui)) If $DL == _MultiLang_GetText('LNG_please_select_a_disk') Or $DL == _MultiLang_GetText('LNG_please_select_disk_again') Then ToolTip(Null, -1, -1, Null, 1, 4) GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), Null) GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), _MultiLang_GetText('LNG_please_select_a_disk') & '|' & H_get_disks()) GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), _MultiLang_GetText('LNG_please_select_a_disk')) $B_ID2T = $Unknow GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 64) GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $Unknow) GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0x008000) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_CurTotalDev) Else H_combobox_disks_init() EndIf Case $B_Msg[0] = H_getControl('$combobox_my_cases', $B_main_gui) H_combobox_cases_click() EndSelect EndFunc Func H_combobox_cases_click() Local $DL, $PP, $ID_SysDisk $DL = GUICtrlRead(H_getControl('$combobox_my_disks', $B_main_gui)) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), $GUI_UNCHECKED) If $DL == _MultiLang_GetText('LNG_please_select_a_disk') Or $DL == _MultiLang_GetText('LNG_please_select_disk_again') Then MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_please_select_a_disk') & '.') H_reset_cases() Else If H_disk_ready() Then $PP = GUICtrlRead(H_getControl('$combobox_my_cases', $B_main_gui)) If $PP == _MultiLang_GetText('LNG_please_select_a_case') Then $B_SelectedCase = $Unknow GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $Unknow) GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 128) ToolTip(Null, -1, -1, Null, 1, 4) Else $B_SelectedCase = $PP $ID_SysDisk = _WinAPI_GetDriveNumber(@HomeDrive)[1] If $B_SelectedCase == _MultiLang_GetText('LNG_PP_1PV') Then GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 128) GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $B_TotalSize) GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 128) ToolTip(_MultiLang_GetText('LNG_PP_1PV_INF'), -1, -1, '❤ ' & $B_SelectedCase, 1, 4) ElseIf $B_SelectedCase == _MultiLang_GetText('LNG_PP_2PV') Then GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 64) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 64) ToolTip(_MultiLang_GetText('LNG_PP_2PV_INF'), -1, -1, '❤ ' & $B_SelectedCase, 1, 4) EndIf EndIf Else MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, $B_DiskName & @CRLF & @CRLF & _MultiLang_GetText('LNG_please_insert_disk') & '.') H_reset_cases() EndIf EndIf EndFunc Func H_reset_cases() ToolTip(Null, -1, -1, Null, 1, 4) $B_SelectedCase = $Unknow GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 128) GUICtrlSetData(H_getControl('$lb_total_size', $B_main_gui), $Unknow) GUICtrlSetData(H_getControl('$combobox_my_cases', $B_main_gui), Null) GUICtrlSetData(H_getControl('$combobox_my_cases', $B_main_gui), _MultiLang_GetText('LNG_please_select_a_case') & '|' & _MultiLang_GetText('LNG_PP_2PV') & '|' & _MultiLang_GetText('LNG_PP_1PV')) GUICtrlSetData(H_getControl('$combobox_my_cases', $B_main_gui), _MultiLang_GetText('LNG_please_select_a_case')) EndFunc Func H_show_setting_gui() ToolTip(Null, -1, -1, Null, 1, 4) GUISetState(@SW_DISABLE, H_getControl('$main_gui', $B_main_gui)) GUISetState(@SW_SHOW, H_getControl('$setting_gui', $B_setting_gui)) EndFunc Func H_devices_event() Local $aDriveInfo, $iLastDevNumber = -1 Local $aFixed = DriveGetDrive('FIXED'), $aRemovable = DriveGetDrive('REMOVABLE') Local $aDrives[ (IsArray($aFixed) ? $aFixed[0] : 0) + (IsArray($aRemovable) ? $aRemovable[0] : 0) ][3] Local $iDrive = 0 For $i = 1 To UBound($aFixed) - 1 $aDrives[$iDrive][0] = $aFixed[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aFixed[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next For $i = 1 To UBound($aRemovable) - 1 $aDrives[$iDrive][0] = $aRemovable[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aRemovable[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next _ArraySort($aDrives, 0, 0, 0, 1) Local $aDisks[UBound($aDrives)][2] For $i = 0 To UBound($aDrives) - 1 If IsNumber($aDrives[$i][1]) Then If $aDrives[$i][1] <> $iLastDevNumber Then $iLastDevNumber = $aDrives[$i][1] $aDisks[$iLastDevNumber][0] = $aDrives[$i][1] & ' ' EndIf $aDisks[$iLastDevNumber][1] &= $aDrives[$i][0] & ';' EndIf Next ReDim $aDisks[$iLastDevNumber + 1][2] $B_UpdateTotalDev = UBound($aDisks) If $B_UpdateTotalDev = 0 Then H_disable_when_nodisk() ElseIf $B_CurTotalDev <> $B_UpdateTotalDev Then Beep(1888, 250) GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0x008000) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_UpdateTotalDev) MsgBox($Info, $myAppName, _MultiLang_GetText('LNG_TB_DATHAYDOI') & '(' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_UpdateTotalDev & ')' & @CRLF & @CRLF & _MultiLang_GetText('LNG_CHONLAI_ODIA')) H_enable_when_have_disks() GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), Null) GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), _MultiLang_GetText('LNG_please_select_disk_again') & '|' & H_get_disks()) GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), _MultiLang_GetText('LNG_please_select_disk_again')) H_reset_cases() GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $Unknow) $B_ID2T = $Unknow EndIf EndFunc Func H_check_iso_size($MyISO) Local $sDrive = '', $sDir = '', $sFileName = '', $sExtension = '', $SysFreeSize_Bytes, $MyISO_Bytes, $ArrISO $SysFreeSize_Bytes = DriveSpaceFree(@HomeDrive) * 2^20 $MyISO_Bytes = FileGetSize($MyISO) If ($MyISO_Bytes >= $SysFreeSize_Bytes) Then GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0xDC143C) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FREESPACE_OF_SYSDISK') & ': ' & H_convert_size_storage($SysFreeSize_Bytes) & '. ' & _MultiLang_GetText('LNG_SIZE_OF') & ' ISO: ' & H_convert_size_storage($MyISO_Bytes) & '.') MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_FREESPACE_OF_SYSDISK_NOT') & @CRLF & @CRLF & _MultiLang_GetText('LNG_CLEANTO_MORESPACE')) Return false Else $ArrISO = _PathSplit($MyISO, $sDrive, $sDir, $sFileName, $sExtension) GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0x008000) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_SIZE_OF') & ' "' & $ArrISO[3] & $ArrISO[4] & '": ' & H_convert_size_storage($MyISO_Bytes)) Return true EndIf EndFunc Func H_create_working_gui(ByRef $fNew, $frmParent) Dim $fNew[11][2] $fNew[0][0] = '$working_gui' $fNew[0][1] = GUICreate($myAppShortName & ' - I am working...', 540, 90, -1, -1, -1, -1, $frmParent) $fNew[2][0] = '$working_status' $fNew[2][1] = GUICtrlCreateLabel('Reading...', 10, 20, 525, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Tahoma') $fNew[3][0] = '$total_size_copied' $fNew[3][1] = GUICtrlCreateLabel('*', 10, 40, 135, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Arial') $fNew[4][0] = '$total_size' $fNew[4][1] = GUICtrlCreateLabel('*', 155, 40, 75, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Arial') $fNew[5][0] = '$current_file_copying' $fNew[5][1] = GUICtrlCreateLabel('*', 250, 40, 80, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Arial') GUICtrlSetColor(-1, 0x008000) GUICtrlSetCursor(-1, 0) $fNew[6][0] = '$current_file_total_size_copied' $fNew[6][1] = GUICtrlCreateLabel('*', 350, 40, 75, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Arial') $fNew[7][0] = '$current_file_total_size' $fNew[7][1] = GUICtrlCreateLabel('*', 430, 40, 75, -1) GUICtrlSetFont(-1, 9, 400, 0, 'Arial') GUICtrlSetColor(-1, 0x008000) $fNew[8][0] = '$progress_copying' $fNew[8][1] = GUICtrlCreateProgress(10, 62, 462, -1) $fNew[9][0] = '$button_pause_copying' $fNew[9][1] = GUICtrlCreateButton(';', 481, 60, 23, 23) GUICtrlSetFont(-1, 10, 400, 0, 'Webdings') GUICtrlSetState(-1, 128) GUICtrlSetCursor(-1, 0) $fNew[10][0] = '$button_minimum_copying' $fNew[10][1] = GUICtrlCreateButton('6', 509, 60, 23, 23) GUICtrlSetFont(-1, 10, 400, 0, 'Webdings') GUICtrlSetState(-1, 128) GUICtrlSetCursor(-1, 0) EndFunc Func H_processing_for_working_gui() Select Case $B_Msg[0] = $GUI_EVENT_CLOSE H_disable_processing_gui() EndSelect EndFunc Func H_enable_processing_gui() $B_ImFree = 0 ToolTip(Null, -1, -1, Null, 1, 4) GUISetState(@SW_HIDE, H_getControl('$main_gui', $B_main_gui)) GUISetState(@SW_SHOW, H_getControl('$working_gui', $B_working_gui)) H_reset_for_copy() If H_checkbox_option3_checked() Then WinSetOnTop(H_getControl('$working_gui', $B_working_gui), '', 1) EndIf EndFunc Func H_disable_processing_gui() WinSetOnTop(H_getControl('$working_gui', $B_working_gui), '', 0) GUISetState(@SW_HIDE, H_getControl('$working_gui', $B_working_gui)) $B_ImFree = 1 GUISetState(@SW_SHOW, H_getControl('$main_gui', $B_main_gui)) Beep(1888, 250) GUISetState(@SW_RESTORE, H_getControl('$main_gui', $B_main_gui)) EndFunc Func H_proceed_with_case2() H_enable_processing_gui() If Not H_checkbox_option1_checked() Then If IsBool($B_isHDD) And Not $B_isHDD Then H_extract_partassist() RunWait(@ComSpec & ' /c ' & $myTemp & '\partassist.exe /hd:' & $B_ID2T & ' /setletter:0 /letter:*', '', @SW_HIDE) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_preparing_for_pv1') & ' (15%)') RunWait(@ComSpec & ' /c ' & $myTemp & '\partassist.exe /hd:' & $B_ID2T & ' /setletter:1 /letter:*', '', @SW_HIDE) ; ----> My script sometimes died from here --------> H_create_partition($DP_File, $B_ID2T, 'MBR', ($B_TotalSize - $B_BootPartSize), $B_DLB, StringReplace($B_letter_for_create, ':', '')) ; <---- My script sometimes died here <-------- RunWait(@ComSpec & ' /c DiskPart /s "' & $DP_File & '"', '', @SW_HIDE) FileDelete($DP_File) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_preparing_for_pv2') & ' (25%)') RunWait(@ComSpec & ' /c ' & $myTemp & '\partassist.exe /hd:' & $B_ID2T & ' /cre /pri /size:auto /end /fs:fat32 /act /label:' & $B_BLB, '', @SW_HIDE) DirRemove($myTemp, 1) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_extracting_my_apps') & ' (30%)') RunWait(@ComSpec & ' /c ' & $Extracter7Zip & ' x -y -aoa "' & $B_ISO & '" -o"' & $myTemp & '" -ir"!freeSoft"', '', @SW_HIDE) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_transfering_my_apps') & ' (35%)') ; ----> My script sometimes died from here --------> If Not H_checkbox_option4_checked() Then DirMove($myTemp & '\freeSoft', $B_letter_for_create, 1) Else H_SC('DirMove', $myTemp & '\freeSoft', $B_letter_for_create, 1) EndIf ; <---- My script sometimes died here <-------- GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_extracting_my_data') & ' (40%)') If H_checkbox_option2_checked() Then RunWait(@ComSpec & ' /c ' & $Extracter7Zip & ' x -y -aoa "' & $B_ISO & '" -o"' & $myTemp & '" -xr"!freeSoft" -xr"!antivirus"', '', @SW_HIDE) Else RunWait(@ComSpec & ' /c ' & $Extracter7Zip & ' x -y -aoa "' & $B_ISO & '" -o"' & $myTemp & '" -xr"!freeSoft" -xr"!for_option2" -xr"!antivirus"', '', @SW_HIDE) EndIf FileDelete($myTemp & '\EFI\Boot\bootia32.efi') FileDelete($myTemp & '\EFI\Boot\bootx64.efi') GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_installing_my_boot') & ' (60%)') DirMove($myTemp & '\EFI', $B_letter_for_create & '\', 1) FileMove($myTemp & '\install\loader32.efi', $B_letter_for_create & '\EFI\Boot\bootia32.efi', 1) FileMove($myTemp & '\install\loader64.efi', $B_letter_for_create & '\EFI\Boot\bootx64.efi', 1) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_installing_my_boot') & ' (80%)') If Not H_checkbox_option4_checked() Then DirMove($myTemp & '\BootData', $B_letter_for_create, 1) Else H_SC('DirMove', $myTemp & '\BootData', $B_letter_for_create, 2) EndIf GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_installing_my_boot') & ' (85%)') If Not H_checkbox_option4_checked() Then DirMove($myTemp & '\googlechrome', $B_letter_for_create, 1) Else H_SC('DirMove', $myTemp & '\googlechrome', $B_letter_for_create, 3) EndIf If H_checkbox_option2_checked() Then FileMove($myTemp & '\livecd', $B_letter_for_create & '\', 1) If Not H_checkbox_option4_checked() Then DirMove($myTemp & '\for_option2', $B_letter_for_create, 1) Else H_SC('DirMove', $myTemp & '\for_option2', $B_letter_for_create, 4) EndIf EndIf GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_create_success_with_case2')) RunWait(@ComSpec & ' /c ping -n 2 127.0.0.1', '', @SW_HIDE) EndIf DirRemove($myTemp, 1) EndIf H_delete_ampa_files() H_disable_processing_gui() MsgBox($Info, $myAppShortName, _MultiLang_GetText('LNG_ALL_DONE')) EndFunc Func H_proceed_with_case1() EndFunc Func H_proceed_with_case1_option5() EndFunc Func H_proceed_with_case2_option5() EndFunc Func H_SC($copy_type, $my_source, $my_dest, $ThisID = 0) If $B_HaveCopy Then _Copy_Abort() Else Local $my_dest_ok = $my_dest & '\' & StringRegExpReplace($my_source, '^.*\\', '') H_reset_for_copy() _Copy_OpenDll() Sleep(200) Switch StringLower($copy_type) Case 'dircopy' _Copy_CopyDir($my_source, $my_dest_ok, 0, BitOR(0x00000001, 0x00001000), $ThisID, '', '') Case 'dirmove' ;Local $ErrMod = H_SetErrorMode(0x0001) _Copy_MoveDir($my_source, $my_dest_ok, BitOR($MOVE_FILE_COPY_ALLOWED, $MOVE_FILE_REPLACE_EXISTING), 0x00000001, $ThisID, '', '') ;H_SetErrorMode($ErrMod) EndSwitch $B_HaveCopy = 1 H_show_copying_status($ThisID) EndIf EndFunc Func H_show_copying_status($WorkingID) While _Copy_GetState($WorkingID, 0) If $B_HaveCopy Then $B_CopyState = _Copy_GetState($WorkingID) If Not IsArray($B_CopyState) Then GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_something_wrong')) EndIf If $B_CopyState[0] Then ;[0] - The current state. (0 - Complete; (-1) - Prepare; 1 - Progress) If $B_CopyState[0] = -1 Then ; Else Local $TotalSizeCopied, $TotalSize, $FileSizeCopied, $FileSize $B_CopyState_Data = Round($B_CopyState[1] / $B_CopyState[2] * 100) If GUICtrlRead(H_getControl('$progress_copying', $B_working_gui)) <> $B_CopyState_Data Then GUICtrlSetData(H_getControl('$progress_copying', $B_working_gui), $B_CopyState_Data) EndIf $TotalSizeCopied = H_convert_size_storage($B_CopyState[1], 0, false) $TotalSize = H_convert_size_storage($B_CopyState[2], 2, false) $FileSizeCopied = H_convert_size_storage($B_CopyState[3], 0, false) $FileSize = H_convert_size_storage($B_CopyState[4], 2, false) GUICtrlSetData(H_getControl('$total_size_copied', $B_working_gui), $TotalSizeCopied & 'MB copied (' & $B_CopyState_Data & '%)') GUICtrlSetData(H_getControl('$total_size', $B_working_gui), '/ ' & $TotalSize & 'MB') GUICtrlSetData(H_getControl('$current_file_total_size_copied', $B_working_gui), $FileSizeCopied & 'MB') GUICtrlSetData(H_getControl('$current_file_total_size', $B_working_gui), '/ ' & $FileSize & 'MB') $B_CopyState_Data = StringRegExpReplace($B_CopyState[6], '^.*\\', '') If GUICtrlRead(H_getControl('$current_file_copying', $B_working_gui)) <> $B_CopyState_Data Then GUICtrlSetData(H_getControl('$current_file_copying', $B_working_gui), $B_CopyState_Data) EndIf EndIf If TimerDiff($TimeStart_Color) > 988 And Not $B_ImFree And Not $B_PauseCopy Then GUICtrlSetColor(H_getControl('$total_size_copied', $B_working_gui), Random(1, 999999999, 1)) GUICtrlSetColor(H_getControl('$current_file_total_size_copied', $B_working_gui), Random(99, 999999999, 1)) $TimeStart_Color = TimerInit() EndIf Else Switch $B_CopyState[5] Case 0, 3 GUICtrlSetData(H_getControl('$progress_copying', $B_working_gui), 100) GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_CP_SUCCESS') & '. Code: ' & $B_CopyState[5]) Case 1235 ;ERROR_REQUEST_ABORTED GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_CP_ABORTED') & '. Code: ' & $B_CopyState[5]) Case Else GUICtrlSetData(H_getControl('$working_status', $B_working_gui), _MultiLang_GetText('LNG_CP_NOT_SUCCESS') & '. Code: ' & $B_CopyState[5]) EndSwitch H_reset_for_copy() $B_HaveCopy = 0 EndIf EndIf Return 1 WEnd $B_HaveCopy = 0 H_reset_for_copy() EndFunc Func H_delete_ampa_files() FileDelete(@WindowsDir & '\ampa.exe') If H_app1_exe_type() == '32-bit Windows-based application' then FileDelete(@SystemDir & '\ampa.sys') Local $Arch = @OSArch If StringLower($Arch) == 'x64' Then DllCall('kernel32.dll', 'boolean', 'Wow64EnableWow64FsRedirection', 'boolean', false) FileDelete(@SystemDir & '\ampa.sys') EndIf Else FileDelete(@SystemDir & '\ampa.sys') FileDelete(@WindowsDir & '\SysWOW64\ampa.sys') EndIf Return 1 EndFunc Func H_reset_for_copy() GUICtrlSetData(H_getControl('$button_pause_copying', $B_working_gui), ';') GUICtrlSetData(H_getControl('$progress_copying', $B_working_gui), 0) GUICtrlSetData(H_getControl('$total_size_copied', $B_working_gui), '...') GUICtrlSetData(H_getControl('$total_size', $B_working_gui), '...') GUICtrlSetData(H_getControl('$current_file_copying', $B_working_gui), '...') GUICtrlSetData(H_getControl('$current_file_total_size_copied', $B_working_gui), '...') GUICtrlSetData(H_getControl('$current_file_total_size', $B_working_gui), '...') EndFunc Func H_create_partition(Const $sFile, $index, $style_type, $MB_Size, $label, $letter) Local $hFO = FileOpen($sFile, $FO_APPEND) If $hFO = -1 Then MsgBox($Err, $myAppName, _MultiLang_GetText('LNG_WRITE_ERR')) Return 0 EndIf FileWrite($hFO, 'SELECT DISK ' & $index & @CRLF) FileWrite($hFO, 'CLEAN' & @CRLF) FileWrite($hFO, 'CONVERT ' & $style_type & @CRLF) FileWrite($hFO, 'CREATE PARTITION PRIMARY SIZE=' & $MB_Size & @CRLF) If H_newer_windows7() Then FileWrite($hFO, 'FORMAT FS=ntfs LABEL="' & $label & '" QUICK NOERR' & @CRLF) FileWrite($hFO, 'ASSIGN LETTER=' & $letter & ' NOERR' & @CRLF) Else FileWrite($hFO, 'FORMAT FS=ntfs LABEL="' & $label & '" QUICK' & @CRLF) FileWrite($hFO, 'ASSIGN LETTER=' & $letter & @CRLF) EndIf FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT') FileClose($hFO) EndFunc Func H_combobox_disks_init() Local $DL, $position_disk, $position_disk_rep, $ID_API, $ID_Rep, $ID_SysDisk, $disk_name, $DLDia, $bus_type, $UUID, $disk_type, $Oh_SSD $ID_SysDisk = _WinAPI_GetDriveNumber(@HomeDrive)[1] $DL = GUICtrlRead(H_getControl('$combobox_my_disks', $B_main_gui)) $B_letter_for_create = StringReplace(StringRight($DL, 3), ')', '') $ID_API = _WinAPI_GetDriveNumber($B_letter_for_create)[1] $position_disk = Number($ID_API, 1) + 1 $disk_name = H_get_disk_name($ID_API) $B_DiskName = StringStripWS($disk_name, 3) $DLDia = _WinAPI_GetDriveGeometryEx($ID_API) If @error == '10' Or Not IsArray(_WinAPI_GetDriveNumber($B_letter_for_create)) Or Not IsArray($DLDia) Then $B_ID2T = $Unknow GUICtrlSetData(H_getControl('$input_pv2_size', $B_main_gui), $Unknow) GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 128) GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0xDC143C) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), $B_DiskName & ': No Media. ' & _MultiLang_GetText('LNG_please_insert_disk') & '.') ToolTip(Null, -1, -1, Null, 1, 4) MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, $B_DiskName & @CRLF & @CRLF & _MultiLang_GetText('LNG_please_insert_disk') & '.') H_reset_cases() Else GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 64) $B_TotalSizeGB = H_convert_size_storage($DLDia[5]) $B_TotalSize = Int($DLDia[5]/(2^20), 1) GUICtrlSetData(H_getControl('$lb_total_size', $B_main_gui), $B_TotalSize & ' MB') GUICtrlSetTip(H_getControl('$lb_total_size', $B_main_gui), _MultiLang_GetText('LNG_LB_TOTAL_SIZE')) $B_myDiskStatus = _MultiLang_GetText('LNG_disk_ready') $B_PartitionStyle = H_partition_style($B_letter_for_create) $UUID = Hex(DriveGetSerial($B_letter_for_create)) $disk_type = DriveGetType($B_letter_for_create) $bus_type = DriveGetType($ID_API, 3) $Oh_SSD = DriveGetType($ID_API, 2) $position_disk_rep = StringReplace(StringReplace(StringReplace(StringReplace(StringLeft($DL, 4), 'RM', ''), 'UK', ''), 'HD', ''), ':', '') $ID_Rep = Number($position_disk_rep, 1) - 1 If $bus_type == 'USB' Then Switch $disk_type Case 'Removable' $B_isHDD = false ToolTip(StringFormat(_MultiLang_GetText('LNG_REMOVABLE_DISK') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Case 'Fixed' $B_isHDD = true If $Oh_SSD == '' Then ToolTip(StringFormat(_MultiLang_GetText('LNG_external_disk_have_motor') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Else ToolTip(StringFormat(_MultiLang_GetText('LNG_EXT_DISK_SSD') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) EndIf Case 'Network' $B_isHDD = $Unknow ToolTip('❥ ' & StringFormat(_MultiLang_GetText('LNG_NETWORK_DISK') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Case 'CDROM' $B_isHDD = $Unknow ToolTip('❥ ' & StringFormat(_MultiLang_GetText('LNG_CDROM_DISK') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Case 'RAMDisk' $B_isHDD = $Unknow ToolTip('❥ ' & StringFormat(_MultiLang_GetText('LNG_RAM_DISK') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Case 'Unknown' $B_isHDD = $Unknow ToolTip('❥ ' & StringFormat(_MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) EndSwitch ElseIf $bus_type == 'Unknown' Then $B_isHDD = $Unknow Else $B_isHDD = true If $Oh_SSD == '' Then ToolTip(StringFormat(_MultiLang_GetText('LNG_internal_disk_have_motor') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) Else ToolTip(StringFormat(_MultiLang_GetText('LNG_INT_DISK_SSD') & '\r\n ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '\r\n ' & _MultiLang_GetText('LNG_position_disk') & ': ' & $position_disk_rep & '\r\n ' & _MultiLang_GetText('LNG_order_disk') & ': ' & $ID_API & '\r\n ' & _MultiLang_GetText('LNG_online_disk') & ': ' & $B_myDiskStatus & '.'), -1, -1, _MultiLang_GetText('LNG_lb_my_disks') & ' "' & $B_DiskName & '"', 1, 4) EndIf EndIf If $ID_API = $ID_SysDisk Then GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 128) GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0xDC143C) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), 'System Disk: ' & $B_DiskName & ' (' & $B_PartitionStyle & '). ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '.') MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_I_AM_A_SYSDISK') & @CRLF & @CRLF & _MultiLang_GetText('LNG_unsupport_for_systemdisk')) GUICtrlSetState(H_getControl('$button_create_boot', $B_main_gui), 64) ToolTip(Null, -1, -1, Null, 1, 4) ElseIf $ID_Rep <> $ID_API Then MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_something_wrong') & @CRLF & @CRLF & _MultiLang_GetText('LNG_RESTART_KTVTL')) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_CurTotalDev) GUICtrlSetState(H_getControl('$button_create_boot', $B_main_gui), 128) ElseIf $position_disk_rep <> $position_disk Then MsgBox($Warn, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_something_wrong') & @CRLF & @CRLF & _MultiLang_GetText('LNG_RESTART_KTVTL')) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), _MultiLang_GetText('LNG_FIRMWARE_ENV') & ': ' & H_get_fw_environment() & '. ' & _MultiLang_GetText('LNG_total_number_devices') & ': ' & $B_CurTotalDev) GUICtrlSetState(H_getControl('$button_create_boot', $B_main_gui), 128) ElseIf $B_isHDD == $Unknow Then GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 128) MsgBox($Info, _MultiLang_GetText('LNG_create_boot_tab') & ' - ' & $myAppName, _MultiLang_GetText('LNG_unsupport_for_thisdisk')) ToolTip(Null, -1, -1, Null, 1, 4) Else GUICtrlSetColor(H_getControl('$lb_footer_status', $B_main_gui), 0x008000) GUICtrlSetData(H_getControl('$lb_footer_status', $B_main_gui), $B_DiskName & ' (' & $B_PartitionStyle & '). ' & _MultiLang_GetText('LNG_ACTUAL_CAPACITY') & ': ' & $B_TotalSizeGB & '. ' & $B_myDiskStatus & '.') EndIf $B_ID2T = 1 EndIf EndFunc Func H_remove_invalid_letter($aString) Local $KQ $KQ = StringReplace(StringReplace(StringReplace(StringReplace(StringReplace($aString, '\', '-'), '/', '-'), '<', '-'), '>', '-'), ':', '-') $KQ = StringReplace(StringReplace(StringReplace(StringReplace($KQ, '*', '-'), '?', '-'), '"', '-'), '|', '-') Return $KQ EndFunc Func H_create_setting_gui(ByRef $fNew, $frmParent) Dim $fNew[9][2] $fNew[0][0] = '$setting_gui' $fNew[0][1] = GUICreate(_MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppShortName, 380, 270, -1, -1, BitOr($WS_CAPTION, $WS_SYSMENU, $WS_POPUP), -1, $frmParent) $fNew[1][0] = '$checkbox_option3' $fNew[1][1] = GUICtrlCreateCheckbox(_MultiLang_GetText('LNG_CBOX_INS_TOPMOST'), 15, 5, 305, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[2][0] = '$checkbox_option4' $fNew[2][1] = GUICtrlCreateCheckbox(_MultiLang_GetText('LNG_CBOX_SECONDFT'), 15, 29, 280, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[3][0] = '$checkbox_option5' $fNew[3][1] = GUICtrlCreateCheckbox(_MultiLang_GetText('LNG_CBOX_MAXSPEED'), 15, 54, 280, 16) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateGroup(_MultiLang_GetText('LNG_grb_labels'), 5, 79, 370, 85) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateLabel(_MultiLang_GetText('LNG_LB_PV1_LABEL'), 15, 132, 195, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateLabel(_MultiLang_GetText('LNG_LB_PV2_LABEL'), 15, 102, 195, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[4][0] = '$ip_pv2_label' $fNew[4][1] = GUICtrlCreateInput($B_BLB, 220, 100, 145, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[5][0] = '$ip_pv1_label' $fNew[5][1] = GUICtrlCreateInput($B_DLB, 220, 131, 145, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateGroup('', -99, -99, 1, 1) GUICtrlCreateGroup(_MultiLang_GetText('LNG_GRB_START_LBA'), 5, 171, 370, 60) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlCreateLabel(_MultiLang_GetText('LNG_LB_START_LBA'), 15, 200, 160, -1) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') $fNew[6][0] = '$combobox_my_lba' $fNew[6][1] = GUICtrlCreateCombo('', 220, 196, 147, -1, 0x0003) GUICtrlSetFont(-1, 10, 400, 0, 'Arial') GUICtrlSetData(-1, '512|1024|2048') GUICtrlSetData(-1, '512') GUICtrlCreateGroup('', -99, -99, 1, 1) $fNew[7][0] = '$button_ok_at_setting_gui' $fNew[7][1] = GUICtrlCreateButton(_MultiLang_GetText('LNG_button_ok'), 5, 240, 90, 27) GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma') GUICtrlSetCursor(-1, 0) $fNew[8][0] = '$button_cancel_at_setting_gui' $fNew[8][1] = GUICtrlCreateButton(_MultiLang_GetText('LNG_button_cancel'), 285, 240, 90, 27) GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma') GUICtrlSetCursor(-1, 0) EndFunc Func H_processing_for_setting_gui() Select Case $B_Msg[0] = $GUI_EVENT_CLOSE H_button_cancel_at_setting_gui_Click() Case $B_Msg[0] = H_getControl('$button_ok_at_setting_gui', $B_setting_gui) H_button_ok_at_setting_gui_Click() Case $B_Msg[0] = H_getControl('$button_cancel_at_setting_gui', $B_setting_gui) H_button_cancel_at_setting_gui_Click() Case $B_Msg[0] = H_getControl('$checkbox_option5', $B_setting_gui) MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_CBOX_MAXSPEED_INFO')) EndSelect EndFunc Func H_button_cancel_at_setting_gui_Click() MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppShortName, _MultiLang_GetText('LNG_load_default_setting')) GUICtrlSetState(H_getControl('$checkbox_option3', $B_setting_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option4', $B_setting_gui), $GUI_UNCHECKED) GUICtrlSetState(H_getControl('$checkbox_option5', $B_setting_gui), $GUI_UNCHECKED) GUICtrlSetData(H_getControl('$combobox_my_lba', $B_setting_gui), '512') GUICtrlSetData(H_getControl('$ip_pv1_label', $B_setting_gui), 'Data') GUICtrlSetData(H_getControl('$ip_pv2_label', $B_setting_gui), 'Boot') H_setting_gui_close() EndFunc Func H_button_ok_at_setting_gui_Click() Local $lb_PV1, $lb_PV2 $lb_PV1 = H_remove_invalid_letter(StringStripWS(GUICtrlRead(H_getControl('$ip_pv1_label', $B_setting_gui)), 3)) $lb_PV2 = H_remove_invalid_letter(StringStripWS(GUICtrlRead(H_getControl('$ip_pv2_label', $B_setting_gui)), 3)) If $lb_PV1 == '' Then MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppName, _MultiLang_GetText('LNG_DNOT_EMPTY_PV1_LB')) GUICtrlSetState(H_getControl('$ip_pv1_label', $B_setting_gui), 256) GUICtrlSetData(H_getControl('$ip_pv1_label', $B_setting_gui), $B_DLB) ElseIf $lb_PV2 == '' Then MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppName, _MultiLang_GetText('LNG_DNOT_EMPTY_PV2_LB')) GUICtrlSetState(H_getControl('$ip_pv2_label', $B_setting_gui), 256) GUICtrlSetData(H_getControl('$ip_pv2_label', $B_setting_gui), $B_BLB) ElseIf StringLen($lb_PV1) > 32 Then MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppName, _MultiLang_GetText('LNG_DNOT_32KT_PV1_LB')) GUICtrlSetState(H_getControl('$ip_pv1_label', $B_setting_gui), 256) GUICtrlSetData(H_getControl('$ip_pv1_label', $B_setting_gui), $B_DLB) ElseIf StringLen($lb_PV2) > 11 Then MsgBox($Info, _MultiLang_GetText('LNG_SETTING_SMENU') & ' - ' & $myAppName, _MultiLang_GetText('LNG_DNOT_11KT_PV2_LB')) GUICtrlSetState(H_getControl('$ip_pv2_label', $B_setting_gui), 256) GUICtrlSetData(H_getControl('$ip_pv2_label', $B_setting_gui), $B_BLB) Else $B_DLB = $lb_PV1 $B_BLB = $lb_PV2 GUICtrlSetData(H_getControl('$ip_pv1_label', $B_setting_gui), $lb_PV1) GUICtrlSetData(H_getControl('$ip_pv2_label', $B_setting_gui), $lb_PV2) H_setting_gui_close() EndIf EndFunc Func H_setting_gui_close() GUISetState(@SW_ENABLE, H_getControl('$main_gui', $B_main_gui)) GUISetState(@SW_HIDE, H_getControl('$setting_gui', $B_setting_gui)) EndFunc Func H_checkbox_option4_checked() If BitAND(GUICtrlRead(H_getControl('$checkbox_option4', $B_setting_gui)), $GUI_CHECKED) = $GUI_CHECKED Then Return true Else Return false EndIf EndFunc Func H_checkbox_option5_checked() If BitAND(GUICtrlRead(H_getControl('$checkbox_option5', $B_setting_gui)), $GUI_CHECKED) = $GUI_CHECKED Then Return true Else Return false EndIf EndFunc Func H_checkbox_option2_checked() If BitAND(GUICtrlRead(H_getControl('$checkbox_option2', $B_main_gui)), $GUI_CHECKED) = $GUI_CHECKED Then Return true Else Return false EndIf EndFunc Func H_checkbox_option1_checked() If BitAND(GUICtrlRead(H_getControl('$checkbox_option1', $B_main_gui)), $GUI_CHECKED) = $GUI_CHECKED Then Return true Else Return false EndIf EndFunc Func H_checkbox_option3_checked() If BitAND(GUICtrlRead(H_getControl('$checkbox_option3', $B_setting_gui)), $GUI_CHECKED) = $GUI_CHECKED Then Return true Else Return false EndIf EndFunc Func H_app1_exe_type() Local Const $SCS_32BIT_BINARY = 0 Local Const $SCS_64BIT_BINARY = 6 Local Const $SCS_DOS_BINARY = 1 Local Const $SCS_OS216_BINARY = 5 Local Const $SCS_PIF_BINARY = 3 Local Const $SCS_POSIX_BINARY = 4 Local Const $SCS_WOW_BINARY = 2 If H_GetBinaryType(@AutoItExe) Then Switch @extended Case $SCS_32BIT_BINARY Return '32-bit Windows-based application' Case $SCS_64BIT_BINARY Return '64-bit Windows-based application' Case $SCS_DOS_BINARY Return 'MS-DOS-based application' Case $SCS_OS216_BINARY Return '16-bit OS/2-based application.' Case $SCS_PIF_BINARY Return 'PIF file that executes an MS-DOS-based application' Case $SCS_POSIX_BINARY Return 'POSIX-based application' Case $SCS_WOW_BINARY Return '16-bit Windows-based application' Case Else Return 'Unknown executable type' EndSwitch Else Return 'Not executable file' EndIf EndFunc Func H_GetBinaryType($sFilePath) Local $aRet = DllCall('kernel32.dll', 'int', 'GetBinaryTypeW', 'wstr', $sFilePath, 'dword*', 0) If @error Then Return SetError(@error, @extended, 0) If Not $aRet[0] Then $aRet[2] = 0 Return SetExtended($aRet[2], $aRet[0]) EndFunc Func H_disable_1() GUISetState(@SW_DISABLE, H_getControl('$main_gui', $B_main_gui)) EndFunc Func H_enable_1() GUISetState(@SW_ENABLE, H_getControl('$main_gui', $B_main_gui)) GUISetState(@SW_SHOW, H_getControl('$main_gui', $B_main_gui)) EndFunc Func H_disable_when_nodisk() GUICtrlSetData(H_getControl('$combobox_my_disks', $B_main_gui), _MultiLang_GetText('LNG_DEVICE_NOTFOUND')) GUICtrlSetData(H_getControl('$combobox_my_cases', $B_main_gui), Null) GUICtrlSetState(H_getControl('$textbox_browse_iso', $B_main_gui), 128) GUICtrlSetState(H_getControl('$button_browse_iso', $B_main_gui), 128) GUICtrlSetState(H_getControl('$combobox_my_disks', $B_main_gui), 128) GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 128) GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 128) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 128) GUICtrlSetState(H_getControl('$button_create_boot', $B_main_gui), 128) EndFunc Func H_enable_when_have_disks() GUICtrlSetState(H_getControl('$textbox_browse_iso', $B_main_gui), 64) GUICtrlSetState(H_getControl('$button_browse_iso', $B_main_gui), 64) GUICtrlSetState(H_getControl('$combobox_my_disks', $B_main_gui), 64) GUICtrlSetState(H_getControl('$combobox_my_cases', $B_main_gui), 64) GUICtrlSetState(H_getControl('$input_pv2_size', $B_main_gui), 64) GUICtrlSetState(H_getControl('$updown_pv2_size', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option1', $B_main_gui), 64) GUICtrlSetState(H_getControl('$checkbox_option2', $B_main_gui), 64) GUICtrlSetState(H_getControl('$button_create_boot', $B_main_gui), 64) EndFunc Func H_disk_ready() Local $Ready, $DiskID, $DLDia $Ready = GUICtrlRead(H_getControl('$combobox_my_disks', $B_main_gui)) $DiskID = StringReplace(StringReplace(StringReplace(StringReplace(StringLeft($Ready, 4), 'RM', ''), 'UK', ''), 'HD', ''), ':', '') $DiskID = Number($DiskID, 1) - 1 $DLDia = _WinAPI_GetDriveGeometryEx($DiskID) If @error == '10' Or Not IsArray($DLDia) Then Return false Else Return true EndIf EndFunc Func H_get_disk_name($iDiskNumber) Local $iCount, $sDiskKey, $sDiskName $iCount = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum', 'Count') $sDiskKey = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum', String($iDiskNumber)) If @error Then Return SetError(1, 0, 0) $sDiskName = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\' & $sDiskKey, 'FriendlyName') If $sDiskName = '' Then $sDiskName = RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\' & $sDiskKey, 'DeviceDesc') Return $sDiskName EndFunc Func H_get_disks() Local $disk_type, $name_ok, $bus_type, $my_disk_data, $SizeOfDisk, $sOutput = '' Local $aDriveInfo, $iLastDevNumber = -1 Local $aFixed = DriveGetDrive('FIXED'), $aRemovable = DriveGetDrive('REMOVABLE') Local $aDrives[ (IsArray($aFixed) ? $aFixed[0] : 0) + (IsArray($aRemovable) ? $aRemovable[0] : 0) ][3] Local $iDrive = 0 For $i = 1 To UBound($aFixed) - 1 $aDrives[$iDrive][0] = $aFixed[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aFixed[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next For $i = 1 To UBound($aRemovable) - 1 $aDrives[$iDrive][0] = $aRemovable[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aRemovable[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next _ArraySort($aDrives, 0, 0, 0, 1) Local $aDisks[UBound($aDrives)][2] For $i = 0 To UBound($aDrives) - 1 If IsNumber($aDrives[$i][1]) Then If $aDrives[$i][1] <> $iLastDevNumber Then $iLastDevNumber = $aDrives[$i][1] $name_ok = H_get_disk_name($aDrives[$i][1]) $bus_type = DriveGetType($aDrives[$i][1], 3) If $bus_type == 'USB' Then $disk_type = 'RM' ElseIf $bus_type == 'Unknown' Then $disk_type = 'UK' Else $disk_type = 'HD' EndIf $name_ok = StringStripWS($name_ok, 3) $aDisks[$iLastDevNumber][0] = $disk_type & $aDrives[$i][1] + 1 & ': ' & $name_ok & ' ' EndIf $aDisks[$iLastDevNumber][1] &= $aDrives[$i][0] & ';' EndIf Next ReDim $aDisks[$iLastDevNumber + 1][2] $B_CurTotalDev = UBound($aDisks) For $i = 0 To UBound($aDisks) - 1 $my_disk_data = _WinAPI_GetDriveGeometryEx($i) If @error == '10' Or Not IsArray($my_disk_data) Then $SizeOfDisk = '0 Byte' Else $SizeOfDisk = H_convert_size_storage($my_disk_data[5]) EndIf $sOutput &= $aDisks[$i][0] & '(' & $SizeOfDisk & ', ' Local $aSplit = StringRegExp($aDisks[$i][1], '[^;]+', 3) _ArraySort($aSplit) For $j = 0 To UBound($aSplit) - 1 $sOutput &= StringUpper($aSplit[$j]) & ', ' Next $sOutput &= ')' & '|' Next $sOutput = StringReplace($sOutput, ', )', ')') Return $sOutput EndFunc Func H_newer_windows7() Local $OS = @OSVersion If $OS <> 'WIN_XP' And $OS <> 'WIN_XPe' And $OS <> 'WIN_2003' Then Return true Else Return false Endif EndFunc Func H_partition_style($sDrive) Local $tDriveLayout, $hDrive $tDriveLayout = DllStructCreate('dword PartitionStyle;' & _ 'dword PartitionCount;' & _ 'byte union[40];' & _ 'byte PartitionEntry[8192]') $hDrive = DllCall('kernel32.dll', 'handle', 'CreateFileW', _ 'wstr', '\\.\' & $sDrive, _ 'dword', 0, _ 'dword', 0, _ 'ptr', 0, _ 'dword', 3, _ 'dword', 0, _ 'ptr', 0) If @error Or $hDrive[0] = Ptr(-1) Then Return SetError(@error, @extended, 0) ; INVALID_HANDLE_VALUE DllCall('kernel32.dll', 'int', 'DeviceIoControl', _ 'hwnd', $hDrive[0], _ 'dword', 0x00070050, _ 'ptr', 0, _ 'dword', 0, _ 'ptr', DllStructGetPtr($tDriveLayout), _ 'dword', DllStructGetSize($tDriveLayout), _ 'dword*', 0, _ 'ptr', 0) DllCall('kernel32.dll', 'bool', 'CloseHandle', 'handle', $hDrive[0]) Switch DllStructGetData($tDriveLayout, 'PartitionStyle') Case 0 Return 'MBR' Case 1 Return 'GPT' Case 2 Return 'RAW' Case Else Return 'UnKnown' EndSwitch EndFunc Func H_get_fw_environment() DllCall('kernel32.dll', 'dword', _ 'GetFirmwareEnvironmentVariableW', 'wstr', '', _ 'wstr', '{00000000-0000-0000-0000-000000000000}', 'wstr', '', 'dword', 4096) Local $iError = DllCall('kernel32.dll', 'dword', 'GetLastError') Switch $iError[0] Case 1 Return 'LEGACY' Case 998 Return 'UEFI' Case Else Return 'UnKnown' EndSwitch EndFunc Func H_convert_size_storage($bytes, $rounding = 2, $outputstring = True) Local $M[3] Select Case $bytes < 2^10 ;bytes $M[0] = $bytes $M[1] = 'Bytes' $M[2] = 'Bytes' Case $bytes >= 2^10 and $bytes < 2^20 ;kilobytes $M[0] = Round($bytes/2^10, $rounding) $M[1] = 'KiloBytes' $M[2] = 'KB' Case $bytes >= 2^20 and $bytes < 2^30 ;megabytes $M[0] = Round($bytes/2^20, $rounding) $M[1] = 'MegaBytes' $M[2] = 'MB' Case $bytes >= 2^30 and $bytes < 2^40 ;gigabytes $M[0] = Round($bytes/2^30, $rounding) $M[1] = 'GigaBytes' $M[2] = 'GB' Case $bytes >= 2^40 and $bytes < 2^50 ;terabytes $M[0] = Round($bytes/2^40, $rounding) $M[1] = 'TeraBytes' $M[2] = 'TB' Case $bytes >= 2^50 and $bytes < 2^60 ;petabytes $M[0] = Round($bytes/2^50, $rounding) $M[1] = 'PetaBytes' $M[2] = 'PB' Case $bytes >= 2^60 and $bytes < 2^70 ;exabytes $M[0] = Round($bytes/2^60, $rounding) $M[1] = 'ExaBytes' $M[2] = 'EB' Case $bytes >= 2^70 and $bytes < 2^80 ;zettabytes $M[0] = Round($bytes/ 2^70, $rounding) $M[1] = 'ZettaBytes' $M[2] = 'ZB' Case $bytes >= 2^80 ;yottabytes $M[0] = Round($bytes/ 2^80, $rounding) $M[1] = 'YottaBytes' $M[2] = 'YB' EndSelect If $outputstring Then Return $M[0] & ' ' & $M[2] Else Return $M[0] EndIf EndFunc Func H_close_all() Select Case $B_Msg[0] = $GUI_EVENT_CLOSE GUIDelete($B_setting_gui[0][1]) GUIDelete($B_main_gui[0][1]) GUIDelete($B_working_gui[0][1]) FileDelete($DP_File) FileDelete($Extracter7Zip) FileDelete($myExtracterDll) ;_Copy_Abort(-1) ;_Copy_CloseDll() FileDelete($Copy32) FileDelete($Copy64) _MultiLang_Close() DirRemove($fdLANG, 1) DirRemove($myTemp, 1) Exit EndSelect EndFunc Func H_getControl($sCtrlName, $afrmArray) For $i = 0 to UBound($afrmArray, 1) - 1 If $afrmArray[$i][0] = $sCtrlName Then Return $afrmArray[$i][1] EndIf Next If $i > UBound($afrmArray, 1) - 1 Then MsgBox($Err, $myAppName, _MultiLang_GetText('LNG_not_found_control') & @CRLF & @CRLF & _MultiLang_GetText('LNG_form_name') & ': ' & $afrmArray[0][0] & @CRLF & _MultiLang_GetText('LNG_control_name') & ': ' & $sCtrlName) SetError(1) EndIf EndFunc Func H_show_select_lang_gui() If Not FileExists($fdLANG) Then DirCreate($fdLANG) If Not FileExists($fdLANG) Then MsgBox($Err, $myAppName, 'Can not create lang folder.') Exit EndIf EndIf FileInstall('C:\App1\EN.lng', $fdLANG & '\', 1) Local $UseLang = -1 Local $myLangFiles_App1[1][3] $myLangFiles_App1[0][0] = 'English' ; $myLangFiles_App1[0][1] = $fdLANG & '\EN.lng' $myLangFiles_App1[0][2] = '0409 ' & _ ;English_United_States '0809 ' & _ ;English_United_Kingdom '0c09 ' & _ ;English_Australia '1009 ' & _ ;English_Canadian '1409 ' & _ ;English_New_Zealand '1809 ' & _ ;English_Irish '1c09 ' & _ ;English_South_Africa '2009 ' & _ ;English_Jamaica '2409 ' & _ ;English_Caribbean '2809 ' & _ ;English_Belize '2c09 ' & _ ;English_Trinidad '3009 ' & _ ;English_Zimbabwe '3409' ;English_Philippines ;Set the available language files, names, and codes. _MultiLang_SetFileInfo($myLangFiles_App1) If @error Then MsgBox($Warn, $myAppName, @error) Exit EndIf ;Check if the loaded settings file exists. If not ask user to select language. If $UseLang = -1 Then ;Create Selection GUI $UseLang = _MultiLang_SelectGUI('Select language', 'Please select a language', '0409') If @error Then MsgBox($Warn, $myAppName, @error) Exit EndIf ;It is here where you could save the settings. EndIf ;Load the language file _MultiLang_LoadLangFile($UseLang) EndFunc Func H_extract_partassist() ProcessClose('partassist.exe') H_delete_ampa_files() RunWait(@ComSpec & ' /c ' & $Extracter7Zip & ' x -y -aoa "' & $zipped_AOMEI & '" -o"' & $myTemp, '', @SW_HIDE) EndFunc I need your help. Thank for everything. Edited May 4, 2017 by meoit Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 4, 2017 Moderators Share Posted May 4, 2017 @meoit what have you done to troubleshoot this on your own? We're happy to help, but you have basically posted 1200+ lines of code with nothing more than "it's broke, fixt it for me" as an explanation. Are we to assume that, uncompiled, it is working as you would expect? Have you put any work into taking the time to narrow down where it is failing? RIght at the outset, halfway through, you see it do step 1 but not step 2, etc? You have a number of functions, how far does the script get before it fails? The more information you can provide, the better able we are to assist. meoit 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Trong Posted May 4, 2017 Share Posted May 4, 2017 Try debug it! Please provide the full package of the script if you want someone else to help you solve troubleshoot! Regards, Link to comment Share on other sites More sharing options...
Bert Posted May 5, 2017 Share Posted May 5, 2017 10 hours ago, JLogan3o13 said: @meoit what have you done to troubleshoot this on your own? We're happy to help, but you have basically posted 1200+ lines of code with nothing more than "it's broke, fixt it for me" as an explanation. Are we to assume that, uncompiled, it is working as you would expect? Have you put any work into taking the time to narrow down where it is failing? RIght at the outset, halfway through, you see it do step 1 but not step 2, etc? You have a number of functions, how far does the script get before it fails? The more information you can provide, the better able we are to assist. I'm thinking there is a bigger question to be asked - Did Meoit even write the script? meoit 1 The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
meoit Posted May 5, 2017 Author Share Posted May 5, 2017 (edited) 1 hour ago, Bert said: I'm thinking there is a bigger question to be asked - Did Meoit even write the script? @Bert @JLogan3o13 - Thanks for reply Yes, I wrote this script, with the help of @jguinch , He helped me a lot. I tested and comment where I see error "has stopped working", butt I do not know why it is this and can not fix. Edited May 5, 2017 by meoit Link to comment Share on other sites More sharing options...
meoit Posted May 5, 2017 Author Share Posted May 5, 2017 I tried put function: Func H_SetErrorMode($iMode) ; https://www.autoitscript.com/forum/topic/164375-autoit-v3-script-has-stopped-working/ ; https://www.autoitscript.com/wiki/Interrupting_a_running_function ; https://www.autoitscript.com/forum/topic/137385-cdrom-no-disc-error/ ;https://www.autoitscript.com/forum/topic/156736-the-device-generic-volume-cannot-be-stopped-right-now-try-stopping-the-device-again-later/ ; WinAPIDiag.au3 ; SEM_FAILCRITICALERRORS = 0x0001 ; SEM_NOGPFAULTERRORBOX = 0x0002 ; SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 ; SEM_NOOPENFILEERRORBOX = 0x8000 ;H_SetErrorMode($SEM_FAILCRITICALERRORS Or $SEM_NOGPFAULTERRORBOX) Local $aRet = DllCall('kernel32.dll', 'uint', 'SetErrorMode', 'uint', $iMode) If @error Then Return SetError(1, 0, 0) Return $aRet[0] EndFunc and in my script: But my problem is still... Link to comment Share on other sites More sharing options...
nitekram Posted May 6, 2017 Share Posted May 6, 2017 (edited) Not that looked at all your code, but you have two places, where you say it stops...those functions are not listed, so put some stop places in those functions that are being called, and see where it is stopping there. as these (comments in your coded) have nothing to do with why it is stopping. Edit...made clear these... (comments in your coded) Edited May 6, 2017 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Bert Posted May 6, 2017 Share Posted May 6, 2017 what happens if you did error checking on the runwaits? Also, for the runwait you have a few variables. Can you do logging on those variables so that when you get a failure you can see the log file to see what the variables are reporting. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Deye Posted May 6, 2017 Share Posted May 6, 2017 meoit, You are saying that when you compiled your script for 64bit and its stopped working even for the 32bit what did you use before when it was good and working ? what other changes have you made ? I have a similar problem with copy_dll_64 for a 64bit compile and I get that same error you could try commenting out Copy_Copy() commands just to see if your script will survive without those lines meoit 1 Link to comment Share on other sites More sharing options...
meoit Posted May 16, 2017 Author Share Posted May 16, 2017 (edited) After searching, I found it stop at here: Func H_create_partition(Const $sFile, $index, $style_type, $MB_Size, $label, $letter) Local $hFO = FileOpen($sFile, $FO_APPEND) If $hFO = -1 Then MsgBox($Err, $myAppName, _MultiLang_GetText('LNG_WRITE_ERR')) Return 0 EndIf FileWrite($hFO, 'SELECT DISK ' & $index & @CRLF) FileWrite($hFO, 'CLEAN' & @CRLF) FileWrite($hFO, 'CONVERT ' & $style_type & @CRLF) FileWrite($hFO, 'CREATE PARTITION PRIMARY SIZE=' & $MB_Size & @CRLF) FileWrite($hFO, 'SELECT PARTITION 1' & @CRLF) If H_newer_windows7() Then FileWrite($hFO, 'FORMAT FS=ntfs LABEL="' & $label & '" QUICK NOERR' & @CRLF) FileWrite($hFO, 'ASSIGN LETTER=' & $letter & ' NOERR' & @CRLF) Else FileWrite($hFO, 'FORMAT FS=ntfs LABEL="' & $label & '" QUICK' & @CRLF) FileWrite($hFO, 'ASSIGN LETTER=' & $letter & @CRLF) EndIf FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT') FileClose($hFO) EndFunc with call : RunWait(@ComSpec & ' /c DiskPart /s "' & $DP_File & '"', '', @SW_HIDE) Someone help me. Does my function go to wrong ?. Edited May 17, 2017 by meoit Link to comment Share on other sites More sharing options...
Deye Posted May 16, 2017 Share Posted May 16, 2017 meoit, Use RunWait as debug RunWait(@ComSpec & ' /K DiskPart /s "' & $DP_File & '"', '', @SW_SHOW) meoit 1 Link to comment Share on other sites More sharing options...
meoit Posted May 17, 2017 Author Share Posted May 17, 2017 (edited) After I try different cases of RunWait, I have the result (tested on Win10 x64, compiled with x86 compiler): RunWait(@ComSpec & ' /k diskpart.exe /s "' & $DP_File & '"', @SystemDir, @SW_HIDE) --> no "...has stopped working...", pass through this command, but the script do not run next command. In Task Manager no have Windows Command Processor (x86) - conhost.exe - cmd.exe RunWait(@ComSpec & ' /c diskpart.exe /s "' & $DP_File & '"', @SystemDir, @SW_HIDE) --> "...has stopped working...", script died RunWait(@ComSpec & ' /c diskpart.exe /s "' & $DP_File & '"', @SystemDir, @SW_MINIMIZE) --> "...has stopped working...", script died RunWait(@ComSpec & ' /k diskpart.exe /s "' & $DP_File & '"', @SystemDir, @SW_MINIMIZE) --> no "...has stopped working...", pass through this command, but the script do not run next command, the CMD window still show and not auto close. @Deye - please reply. And someone help me. Edited May 17, 2017 by meoit Link to comment Share on other sites More sharing options...
Deye Posted May 17, 2017 Share Posted May 17, 2017 meoit, what if you remove FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT') then RunWait(@ComSpec & ' /k diskpart.exe /s "' & $DP_File & '"') what do you see in the cmd window ? Link to comment Share on other sites More sharing options...
meoit Posted May 17, 2017 Author Share Posted May 17, 2017 14 hours ago, Deye said: meoit, what if you remove FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT' & @CRLF) FileWrite($hFO, 'EXIT') then RunWait(@ComSpec & ' /k diskpart.exe /s "' & $DP_File & '"') what do you see in the cmd window ? I saw Diskpart working fine (all cmd lines have successful text). I just wondered why after I added /c and @SW_Hide the code I was dying right away. Link to comment Share on other sites More sharing options...
meoit Posted May 19, 2017 Author Share Posted May 19, 2017 I changed the code to: Local $ProcID $ProcID = Run(@ComSpec & ' /c diskpart.exe /s "' & $DP_File & '"', @SystemDir, @SW_HIDE, 0x4 + 0x2) ;$STDERR_CHILD + $STDOUT_CHILD ProcessWaitClose($ProcID) it is still "...has stopped working..." Someone please help me. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now