Jump to content

kvk1989

Members
  • Content Count

    71
  • Joined

  • Last visited

Everything posted by kvk1989

  1. kvk1989

    Hwid based lock

    Hi, can someone help me to make a hwid based login form? Thanks ! Good day
  2. kvk1989

    Almdev component

    Hello can someone tell me almdev component working in Delphi 7 ? Thanks !! Good day
  3. Hi, I'm making a program and I want to add some sniffer tool detection function Like http debugger , ollydbg , x64dbg If detect these tools then program can force stop services Thanks !!
  4. kvk1989

    Sniffer tool detection function

    Ohh great thank for this 🙂
  5. kvk1989

    Sniffer tool detection function

    I don't have any idea I'm asking for codes
  6. kvk1989

    load from file

    hi , how can add file path ? i"m making a project procedure TForm1.scGPButton8Click(Sender: TObject); var i: Integer; partname, storage: string; strsize, endsize, sz: string; begin if cb.ItemIndex = 0 then begin end; if (Firehose = '') then begin Showmessage('Firehose not found'); exit; end; SearchPort(cbb1); if cbb1.Items.Count > 0 then cbb1.ItemIndex := 0; if (not Pos('9008', cbb1.Text) > 0) then begin Showmessage('Port qualcomm not detected '); exit; end; Screen.Cursor := crHourGlass; Port := Getport(cbb1.Text).Trim; adlg('Scanning port ', 0, 0); adlg('Qualcomm HS-USB QDLoader 9008' + #13, 0, 1); adlg('Connect ', 0, 0); adlg(Trim(cbb1.Text) + #13, clTeal, 1); adlg('Initialize ... ' + #13, 0, 0); if (not EmmcDlInfo(Port)) then exit; adlg('Serial ', 0, 0); adlg(info.serial + #13, 0, 1); adlg('MSM ID ', 0, 0); adlg(info.msmid + #13, 0, 1); adlg('PKHASH ', 0, 0); adlg(info.hash + #13, 0, 1); adlg('SBL ID ', 0, 0); adlg(info.sblid + #13, 0, 1); adlg(#13, 0, 1); application.ProcessMessages; if (cbb2.ItemIndex = 0) then // storage combo storage := 'emmc' else storage := 'ufs'; adlg('Storage Type ', 0, 0); adlg(uppercase(storage) + #13, 0, 1); application.ProcessMessages; adlg('Processing ', 0, 0); case cboOperation.ItemIndex of 0: // read info begin end; 1: // factory reset begin end; 2: // frp begin adlg('Erasing FRP ' + #13, 0, 1); EmmcDlErase(Port, storage, Firehose, 'frp'); EmmcDlErase(Port, storage, Firehose, 'config'); adlg(' Erase ', 0, 0); adlg(partname, 0, 1); adlg(' ( ' + strsize + '-' + endsize + ' ) ...', 0, 0); end; end; application.ProcessMessages; adlg('Rebooting ... ', 0, 0); EmmcDlReboot(Port); end; i want to add file with file path like this if combobox.itemindex =0 then begin firehose loader file with file path end; thanks
  7. hi, i get comport in combobox but i want add modem port in combobox can someone help me ? here is my comport codes and here modem port registry guid <{4d36e96d-e325-11ce-bfc1-08002be10318}> thanks !! < > unit USBPort; interface uses Winapi.Windows, System.SysUtils, System.Variants, System.Classes, SetupApi, System.Win.Registry, Vcl.StdCtrls, Vcl.Graphics; const GUID_DEVINTERFACE_COMPORT: TGUID = '{86E0D1E0-8089-11D0-9CE4-08003E301F73}'; procedure SearchPort(cb: Tcombobox); Function GetPort(port:string):string; implementation uses Unit1; function SetupEnumAvailableComPorts: TstringList; var RequiredSize: Cardinal; GUIDSize: DWORD; Guid: TGUID; DevInfoHandle: HDEVINFO; DeviceInfoData: TSPDevInfoData; MemberIndex: Cardinal; PropertyRegDataType: DWord; RegProperty: Cardinal; RegTyp: Cardinal; Key: Hkey; Info: TRegKeyInfo; S1, S2: string; hc: THandle; begin Result := Nil; if not LoadsetupAPI then exit; try GUIDSize := 1; if SetupDiClassGuidsFromName('Ports', @Guid, GUIDSize, RequiredSize) then begin DevInfoHandle := SetupDiGetClassDevs(@Guid, Nil, 0, DIGCF_PRESENT); if Cardinal(DevInfoHandle) <> Invalid_Handle_Value then begin try MemberIndex := 0; result := TStringList.Create; repeat FillChar(DeviceInfoData, SizeOf(DeviceInfoData), 0); DeviceInfoData.cbSize := SizeOf(DeviceInfoData); if not SetupDiEnumDeviceInfo(DevInfoHandle, MemberIndex, DeviceInfoData) then break; RegProperty := SPDRP_FriendlyName; SetupDiGetDeviceRegistryProperty(DevInfoHandle, DeviceInfoData, RegProperty, PropertyRegDataType, NIL, 0, RequiredSize); SetLength(S1, RequiredSize); if SetupDiGetDeviceRegistryProperty(DevInfoHandle, DeviceInfoData, RegProperty, PropertyRegDataType, @S1[1], RequiredSize, RequiredSize) then begin Key := SetupDiOpenDevRegKey(DevInfoHandle, DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); if Key <> INValid_Handle_Value then begin FillChar(Info, SizeOf(Info), 0); if RegQueryInfoKey(Key, nil, nil, nil, @Info.NumSubKeys, @Info.MaxSubKeyLen, nil, @Info.NumValues, @Info.MaxValueLen, @Info.MaxDataLen, nil, @Info.FileTime) = ERROR_SUCCESS then begin RequiredSize := Info.MaxValueLen + 1; SetLength(S2, RequiredSize); if RegQueryValueEx(Key, 'PortName', Nil, @RegTyp, @S2[1], @RequiredSize) = Error_Success then begin if (Pos('COM', S2) = 1) then begin hc := CreateFile(pchar('\\.\' + S2 + #0), GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if hc <> INVALID_HANDLE_VALUE then begin Result.Add(StrPas(PChar(S1))); CloseHandle(hc); end; end; end; end; RegCloseKey(Key); end; end; Inc(MemberIndex); until False; if Result.Count = 0 then begin Result.Free; Result := NIL; end finally SetupDiDestroyDeviceInfoList(DevInfoHandle); end; end; end; finally UnloadSetupApi; end; end; procedure SearchPort(cb: Tcombobox); var ComPortString: TStringList; i: integer; nameport: string; begin cb.Items.Clear; ComPortString := TStringList.Create; try ComPortString := SetupEnumAvailableComPorts; if (ComPortString <> nil) and (ComPortString.Count > 0) then begin for i := 0 to ComPortString.Count - 1 do begin nameport := ComPortString[i].trim; cb.items.add(nameport); cb.itemindex := 0; end; end; finally ComPortString.free; end; end; Function GetPort(port:string):string; begin result := RightStr(port, 7).Replace('(', '').Replace('C', '').Replace('O', '').Replace('M', '').Replace(')', '').trim; end; end.
  8. kvk1989

    how can i get modem port in combo box

    yes today I have to work on it and then I will tell what I have found
  9. kvk1989

    how can i get modem port in combo box

    after install component its show error
  10. kvk1989

    how can i get modem port in combo box

    hi, i want to add modem port see here in this pic
  11. kvk1989

    how can i get modem port in combo box

    Thanks for your component but there is any demos project available?
  12. kvk1989

    function error

    hi , i'm trying to install driver function but give me error here is my code Function InstalUinstallMTP_Driver(IsInstall: Boolean = true): Boolean; var driverpath, dir, cmd: string; begin result := false; driverpath := ExtractFilepath(application.ExeName) + 'adb\mtp\drivers\SAMSUNG_Android.inf'; if not fileexists(driverpath) then begin addlog('Driver not exist, '); exit; end; dir := ExtractFilepath(application.ExeName) + '\drivers'; if IsWindows64 then driverpath := 'install_x64.exe' else driverpath := 'install_x86.exe'; if IsInstall then begin cmd := driverpath + ' install "--inf=SAMSUNG_Android.inf"'; cmd := Shell(cmd, dir); //// here error if cmd.Contains('starting devices') then result := true; end else begin cmd := driverpath + ' uninstall "--inf=SAMSUNG_Android.inf"'; cmd := Shell(cmd, dir); // addlog(cmd); if cmd.Contains('starting devices') then result := true; end;
  13. kvk1989

    function error

    cmd := driverpath + ' install "--inf=SAMSUNG_Android.inf"'; // cmd := Shell(cmd, dir); if cmd.Contains('starting devices') then result := true; end else begin cmd := driverpath + ' uninstall "--inf=SAMSUNG_Android.inf"'; // cmd := Shell(cmd, dir); // addlog(cmd); cmd error
  14. kvk1989

    function error

    yes , runtime here shell codes function IsWinNT: Boolean; var OSV: OSVERSIONINFO; begin OSV.dwOSVersionInfoSize := sizeof(OSV); GetVersionEx(OSV); Result := OSV.dwPlatformId = VER_PLATFORM_WIN32_NT; end; function Shell(Cmd: string; dirpath: string): string; var Buffer: array [0 .. 10096] of char; si: STARTUPINFO; sa: SECURITY_ATTRIBUTES; sd: SECURITY_DESCRIPTOR; pi: PROCESS_INFORMATION; newstdin, newstdout, read_stdout, write_stdin: THANDLE; exitcod, bread, avail: cardinal; Str: ansistring; begin Result := ''; SetCurrentDir(dirpath); // ExtractFilePath(Application.ExeName)); if IsWinNT then begin InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(@sd, True, nil, False); sa.lpSecurityDescriptor := @sd; end else sa.lpSecurityDescriptor := nil; sa.nLength := sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle := True; if CreatePipe(newstdin, write_stdin, @sa, 0) then begin if CreatePipe(read_stdout, newstdout, @sa, 0) then begin GetStartupInfo(si); with si do begin dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW; wShowWindow := SW_HIDE; hStdOutput := newstdout; hStdError := newstdout; hStdInput := newstdin; end; FillChar(Buffer, sizeof(Buffer), 0); GetEnvironmentVariable('COMSPEC', @Buffer, sizeof(Buffer) - 1); StrCat(@Buffer, PChar(' /c ' + Cmd)); if CreateProcess(nil, @Buffer, nil, nil, True, CREATE_NEW_CONSOLE, nil, nil, si, pi) then begin Str := #13; WriteFile(write_stdin, PansiChar(Str)^, Length(Str), bread, nil); repeat application.ProcessMessages; PeekNamedPipe(read_stdout, @Buffer, sizeof(Buffer) - 1, @bread, @avail, nil); if bread > 0 then begin FillChar(Buffer, sizeof(Buffer), 0); ReadFile(read_stdout, Buffer, bread, bread, nil); Result := Result + ansistring(PansiChar(@Buffer)); end; GetExitCodeProcess(pi.hProcess, exitcod); until (exitcod <> STILL_ACTIVE) and (bread = 0); end; CloseHandle(read_stdout); CloseHandle(newstdout); end; CloseHandle(newstdin); CloseHandle(write_stdin); end; end; function Cmd(Cmd: string): string; var Buffer: array [0 .. 10096] of PChar; si: STARTUPINFO; sa: SECURITY_ATTRIBUTES; sd: SECURITY_DESCRIPTOR; pi: PROCESS_INFORMATION; newstdin, newstdout, read_stdout, write_stdin: THANDLE; exitcod, bread, avail: cardinal; Str: string; StopExecution: BOOL; path: string; begin Result := ''; SetCurrentDir(ExtractFilePath(application.ExeName)); if IsWinNT then begin InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(@sd, True, nil, False); sa.lpSecurityDescriptor := @sd; end else sa.lpSecurityDescriptor := nil; sa.nLength := sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle := True; if CreatePipe(newstdin, write_stdin, @sa, 0) then begin if CreatePipe(read_stdout, newstdout, @sa, 0) then begin GetStartupInfo(si); with si do begin dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW; wShowWindow := SW_HIDE; hStdOutput := newstdout; hStdError := newstdout; hStdInput := newstdin; end; FillChar(Buffer, sizeof(Buffer), 0); GetEnvironmentVariable('COMSPEC', @Buffer, sizeof(Buffer) - 1); StrCat(@Buffer, PChar(' /c ' + Cmd)); if CreateProcess(nil, @Buffer, nil, nil, True, CREATE_NEW_CONSOLE, nil, nil, si, pi) then begin Str := #13; WriteFile(write_stdin, PChar(Str)^, Length(Str), bread, nil); repeat PeekNamedPipe(read_stdout, @Buffer, sizeof(Buffer) - 1, @bread, @avail, nil); if bread > 0 then begin FillChar(Buffer, sizeof(Buffer), 0); ReadFile(read_stdout, Buffer, bread, bread, nil); Result := Result + string(PansiChar(@Buffer)); end; GetExitCodeProcess(pi.hProcess, exitcod); until (exitcod <> STILL_ACTIVE) and (bread = 0); end; CloseHandle(read_stdout); CloseHandle(newstdout); end; CloseHandle(newstdin); CloseHandle(write_stdin); end; end; function IsWindows64: boolean; type TIsWow64Process = function(AHandle: THandle; var AIsWow64: BOOL) : BOOL; stdcall; var vKernel32Handle: DWORD; vIsWow64Process: TIsWow64Process; vIsWow64: BOOL; begin // 1) assume that we are not running under Windows 64 bit result := false; // 2) Load kernel32.dll library vKernel32Handle := LoadLibrary('kernel32.dll'); if (vKernel32Handle = 0) then exit; // Loading kernel32.dll was failed, just return try // 3) Load windows api IsWow64Process @vIsWow64Process := GetProcAddress(vKernel32Handle, 'IsWow64Process'); if not Assigned(vIsWow64Process) then exit; // Loading IsWow64Process was failed, just return // 4) Execute IsWow64Process against our own process vIsWow64 := false; if (vIsWow64Process(GetCurrentProcess, vIsWow64)) then result := vIsWow64; // use the returned value finally FreeLibrary(vKernel32Handle); // unload the library end; end; Function InstalUinstallMTP_Driver(IsInstall: boolean = true): boolean; var driverpath, dir, cmd: string; begin result := false; driverpath := ExtractFilePath(Application.ExeName) + 'adb\mtp\drivers\SAMSUNG_Android.inf'; if not fileexists(driverpath) then begin adlg('please inform me for driver not found ',clblue,true) ; exit; end; dir := ExtractFilePath(Application.ExeName) + 'adb\mtp\drivers'; if IsWindows64 then driverpath := 'install_x64.exe' else driverpath := 'install_x86.exe'; if IsInstall then begin cmd := driverpath + ' install "--inf=SAMSUNG_Android.inf"'; // cmd := Shell(cmd, dir); if cmd.Contains('starting devices') then result := true; end else begin cmd := driverpath + ' uninstall "--inf=SAMSUNG_Android.inf"'; // cmd := Shell(cmd, dir); // addlog(cmd); if cmd.Contains('starting devices') then result := true; end; end;
  15. kvk1989

    progress bar issue

    hi , i have a issue with my project progress bar not working with actual file size thanks !! here is my codes unit Emmcdl; interface uses Winapi.Windows, System.Classes, System.SysUtils, Vcl.Controls, Vcl.Graphics, Vcl.StdCtrls, Dos, forms, fungsi,FileCtrl; const emmc = 'emmcdl.exe'; type TEmmcdl_info = record serial: string; msmid: string; hash: string; sblid: string; end; function EmmcDlInfo(port: string): Boolean; function EmmcDlGPT(port, storage, firehose: string): Boolean; function EmmcDlRead(port, storage, firehose, partname, filename: string): Boolean; function EmmcDlWrite(port, storage, firehose, partname, filename: string): Boolean; function EmmcDlErase(port, storage, firehose, partname: string): Boolean; function EmmcDlEraseAdress(port, storage, firehose, startadress, sizeadress: string): Boolean; function EmmcDlRawXMl(port, storage, firehose, xml: string): Boolean; function EmmcDlPathXMl(port, storage, firehose, xml: string): Boolean; function EmmcDlReboot(port: string): Boolean; var getemmcdl: string; info: TEmmcdl_info; ListGPT: Tstringlist; maxprogress: Int64; implementation uses SetupApi, USBPort, XMLparser, main; function EmmcDlInfo(port: string): Boolean; var found: Boolean; begin result := false; found := false; ProcessRunning := True; stopprogress := false; Screen.Cursor := 11; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -info', '', procedure(const Line: PAnsiChar) var str, str1: string; begin str := string(Line).Trim; if (pos('SerialNumber:', str) > 0) then begin str1 := copy(str, pos('SerialNumber:', str) + 13, 10); info.serial := str1; end; if (pos('MSM_HW_ID:', str) > 0) then begin str1 := copy(str, pos('MSM_HW_ID:', str) + 10, 10); info.msmid := str1; end; if (pos('OEM_PK_HASH:', str) > 0) then begin str1 := copy(str, pos('OEM_PK_HASH:', str) + 12, 67); info.hash := str1; end; if (pos('SBL SW Version:', str) > 0) then begin str1 := copy(str, pos('SBL SW Version:', str) + 15, 10); info.sblid := str1; end; if (pos('invalid', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; Screen.Cursor := 0; ProcessRunning := false; stopprogress := True; end; end; procedure adlg(Text: string; clrr: TColor; newline: Boolean); begin Application.ProcessMessages; Form7.rch.SelAttributes.Color := clrr; if newline then begin Form7.rch.SelText := ansistring(#13#10) + Text; end else begin Form7.rch.SelText := Text; end; Application.ProcessMessages; end; function TakenTime(Start, EndT: DWORD): string; var dt: TDateTime; begin dt := (EndT - Start) / (1000.0 * 86400); Result := FormatDateTime('hh:mm:ss', dt); end; function EmmcDlGPT(port, storage, firehose: string): Boolean; var found: Boolean; dev: string; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -f "' + firehose + '" -MemoryName ' + storage + ' ', '-gpt', procedure(const Line: PAnsiChar) var str: string; begin str := string(Line).Trim; dev := str; log(str + #13, 0, 1); if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; found := True; end); finally if found then begin result := True; dev := copy(dev, pos('', dev), pos('', dev)); ListGPT.Add(dev); end else result := false; Screen.Cursor := 0; ProcessRunning := false; stopprogress := True; end; end; function EmmcDlRead(port, storage, firehose, partname, filename: string): Boolean; var found: Boolean; dev: string; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -d ', partname + ' -o "' + filename + '"', procedure(const Line: PAnsiChar) var str, str1: string; begin str := string(Line).Trim; dev := str; if (AnsiPos('remaining', str) <> 0) then begin str1 := copy(str, pos('remaining', str) + 9, 10); Form7.stat.Panels[3].Text := str1; //Form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / // ) * 100); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; Screen.Cursor := 0; ProcessRunning := false; stopprogress := True; end; end; function EmmcDlWrite(port, storage, firehose, partname, filename: string): Boolean; var found: Boolean; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -b ', partname + ' "' + filename + '"', procedure(const Line: PAnsiChar) var str, str1: string; begin str := string(Line).Trim; if (AnsiPos('remaining', str) <> 0) then begin str1 := copy(str, pos('remaining', str) + 9, 10); Form7.stat.Panels[3].Text := str1; Form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / maxprogress) * 100); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; function EmmcDlErase(port, storage, firehose, partname: string): Boolean; var found: Boolean; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -e ', partname, procedure(const Line: PAnsiChar) var str, str1: string; begin str := string(Line).Trim; if (AnsiPos('remaining', str) <> 0) then begin str1 := copy(str, pos('remaining', str) + 9, 10); Form7.stat.Panels[3].Text := str1; Form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / maxprogress) * 100); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; function EmmcDlEraseAdress(port, storage, firehose, startadress, sizeadress: string): Boolean; var found: Boolean; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -e ', startadress + ' ' + sizeadress, procedure(const Line: PAnsiChar) var str, str1: string; begin str := string(Line).Trim; if (AnsiPos('remaining', str) <> 0) then begin str1 := copy(str, pos('remaining', str) + 9, 10); Form7.stat.Panels[3].Text := str1; Form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / maxprogress) * 100); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; function EmmcDlRawXMl(port, storage, firehose, xml: string): Boolean; var found: Boolean; l1, l2, l3, l4, l5: string; begin result := false; found := false; Screen.Cursor := 11; ProcessRunning := True; stopprogress := false; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -x ', '"' + xml + '"', procedure(const Line: PAnsiChar) var str, str1: string; i: integer; begin StartTime := GetTickCount; str := string(Line).Trim; for i := 0 to Form7.lv1.Items.Count - 1 do begin if Form7.lv1.Items[i].Checked then begin l1 := Form7.lv1.Items[i].Caption; l2 := Form7.lv1.Items[i].SubItems.Strings[0].Trim; l3 := Form7.lv1.Items[i].SubItems.Strings[1].Trim; l4 := Form7.lv1.Items[i].SubItems.Strings[2].Trim; l5 := Form7.lv1.Items[i].SubItems.Strings[3].Trim; if (AnsiPos(lowercase(l2), str) > 0) then begin adlg(' Write =>: ', clblack, True); EndTime := GetTickCount; adlg(l1 + ' : ', clHighlight, false); adlg(' [ '.Trim, clWebWhiteSmoke, false); adlg(l3 + ' '.Trim, clWebDarkGoldenRod, false); adlg(' ] '.Trim, clWebWhiteSmoke, false); adlg(' [Size :] '.Trim, clWebWhiteSmoke, false); adlg(l5 + ') ...'.Trim, clWebOrangeRed, false); adlg('Done', clWebLime, false); end; end; end; if (AnsiPos('remaining', str) <> 0) then begin str1 := copy(str, pos('remaining', str) + 9, 10); Form7.stat.Panels[3].Text := str1; form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / maxprogress) * 100); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; function EmmcDlPathXMl(port, storage, firehose, xml: string): Boolean; var found: Boolean; l1, l2, l3, l4, l5: string; begin result := false; found := false; ProcessRunning := True; stopprogress := false; Screen.Cursor := 11; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -MemoryName ' + storage + ' -f "' + firehose + '" -x ', '"' + xml + '"', procedure(const Line: PAnsiChar) var str, str1: string; i: integer; begin str := string(Line).Trim; for i := 0 to Form7.lv1.Items.Count - 1 do begin if Form7.lv1.Items[i].Checked then begin l1 := Form7.lv1.Items[i].Caption; l2 := Form7.lv1.Items[i].SubItems.Strings[0].Trim; l3 := Form7.lv1.Items[i].SubItems.Strings[1].Trim; l4 := Form7.lv1.Items[i].SubItems.Strings[2].Trim; l5 := Form7.lv1.Items[i].SubItems.Strings[3].Trim; if (AnsiPos(lowercase(l2), str) > 0) then begin log(' Patch ', 0, 0); log(l1 + ' ', 0, 1); log('...', 0, 0); end; end; end; if (AnsiPos('disk', str) <> 0) then begin log(' Patch ', 0, 0); log('Disk ' + ' ', 0, 1); log(' ... ' + #13, 0, 0); end; if (pos('invalid', lowercase(str)) > 0) or (pos('error ', lowercase(str)) > 0) or (pos('failed', lowercase(str)) > 0) or (pos('no response', lowercase(str)) > 0) or (pos('cannot find the file specified', lowercase(str)) > 0) or (pos('status: 87 the parameter', lowercase(str)) > 0) or (pos('the device is not ready', lowercase(str)) > 0) then begin found := false; end; if (pos('Status: 0', lowercase(str)) > 0) or (pos('operation completed successfully', lowercase(str)) > 0) then begin found := True; end; end); finally if found then result := True else result := false; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; function EmmcDlReboot(port: string): Boolean; const data1 = '0x3C 0x3F 0x78 0x6D 0x6C 0x20 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x3D 0x22 0x31 0x2E 0x30 0x22 0x3F 0x3E 0x3C 0x64 0x61 0x74 0x61 0x3E 0x3C 0x70 '; data2 = '0x6F 0x77 0x65 0x72 0x20 0x76 0x61 0x6C 0x75 0x65 0x3D 0x22 0x72 0x65 0x73 0x65 0x74 0x22 0x20 0x2F 0x3E 0x3C 0x2F 0x64 0x61 0x74 0x61 0x3E'; var dev: string; found: Boolean; begin ProcessRunning := True; stopprogress := false; dev := ''; found := false; Screen.Cursor := 11; getemmcdl := pathexe + emmc; Application.ProcessMessages; try CMD(getemmcdl + ' -p ' + port + ' -raw ', data1 + data2, procedure(const Line: PAnsiChar) var str: string; begin str := string(Line).Trim; dev := str; if (pos('invalid', dev) > 0) or (pos('failed', dev) > 0) or (pos('cannot find the file specified', dev) > 0) or (pos('status: 87 the parameter', dev) > 0) then begin found := false; end; if (pos('Status: 0', dev) > 0) or (pos('The operation completed successfully', dev) > 0) then begin found := True; end; end); finally if found then begin result := True; log('OK' + #13, clBlue, 1); end else begin result := false; log('Error' + #13, clred, 1); end; ProcessRunning := false; stopprogress := True; Screen.Cursor := 0; end; end; end. and button click codes procedure TForm7.Button5Click(Sender: TObject); var DirXml, storage: string; begin if (Firehose = '') or (RawXML = '') or (PathXML = '') then begin Showmessage('Firehose or RawProgram0.xml or Path0.xml Not found'); exit; end; if (not Pos('9008', cbb1.Text) > 0) then begin Showmessage('Port qualcomm not detected '); exit; end; Screen.Cursor := crHourGlass; Port := Getport(cbb1.Text).Trim; adlg(' Scanning port =>: ', claqua, true); log('Qualcomm HS-USB QDLoader 9008' + #13, 0, 1); adlg(' Connect =>: ', claqua, true); log(Trim(cbb1.Text) + #13, clTeal, 1); DirXml := ExtractFileDir(RawXML) + '\duplicate.xml'; if (not DuplicateXml(DirXml, lv1)) then begin log('Error data xml !!' + #13, clred, 1); Screen.Cursor := 0; exit; end; log('Initialize ... ' + #13, 0, 0); if (not EmmcDlInfo(Port)) then exit; adlg(' Serial =>: ', claqua, true); log(info.serial + #13, 0, 1); adlg(' MSM ID =>: ', claqua, true); log(info.msmid + #13, 0, 1); adlg(' PKHASH =>: ', claqua, true); log(info.hash + #13, 0, 1); adlg(' SBL ID =>: ', claqua, true); log(info.sblid + #13, 0, 1); application.ProcessMessages; if (cbb2.ItemIndex = 0) then storage := 'emmc' else storage := 'ufs'; log('Storage Type ', 0, 0); log(uppercase(storage) + #13, 0, 1); application.ProcessMessages; adlg(' Processing =>: ', clolive, true); log(#13, 0, 1); log('Rawprogram0.xml ' + #13, 0, 1); if (DirXml <> '') then EmmcDlRawXMl(Port, storage, Firehose, DirXml); application.ProcessMessages; log('Processing ', 0, 0); log('Patch0.xml ' + #13, 0, 1); if (PathXML <> '') then EmmcDlPathXMl(Port, storage, Firehose, PathXML); application.ProcessMessages; log(#13, 0, 1); log('Rebooting ... ', 0, 0); EmmcDlReboot(Port); if FileExists(DirXml) then DeleteFile(DirXml); end;
  16. kvk1989

    Memo get real-time output

    Hi, I'm trying to get real-time in memo Here codes function GetDosOutput(CommandLine: string; Work: string = 'C:\'): string; var SA: TSecurityAttributes; SI: TStartupInfo; PI: TProcessInformation; StdOutPipeRead, StdOutPipeWrite: THandle; WasOK: Boolean; Buffer: array[0..255] of AnsiChar; BytesRead: Cardinal; WorkDir: string; Handle: Boolean; begin Result := ''; with SA do begin nLength := SizeOf(SA); bInheritHandle := True; lpSecurityDescriptor := nil; end; CreatePipe(StdOutPipeRead, StdOutPipeWrite, @SA, 0); try with SI do begin FillChar(SI, SizeOf(SI), 0); cb := SizeOf(SI); dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; wShowWindow := SW_HIDE; hStdInput := GetStdHandle(STD_INPUT_HANDLE); // don't redirect stdin hStdOutput := StdOutPipeWrite; hStdError := StdOutPipeWrite; end; WorkDir := Work; Handle := CreateProcess(nil, PChar('cmd.exe /C ' + CommandLine), nil, nil, True, 0, nil, PChar(WorkDir), SI, PI); CloseHandle(StdOutPipeWrite); if Handle then try repeat WasOK := ReadFile(StdOutPipeRead, Buffer, 255, BytesRead, nil); if BytesRead > 0 then begin Buffer[BytesRead] := #0; Result := Result + Buffer; end; until not WasOK or (BytesRead = 0); WaitForSingleObject(PI.hProcess, INFINITE); finally CloseHandle(PI.hThread); CloseHandle(PI.hProcess); end; finally CloseHandle(StdOutPipeRead); end; end; procedure TForm7.Button1Click(Sender: TObject); begin Memo1.Text:= GetDosOutput('python mtk payload', ExtractFilePath(application.ExeName) + 'bin\'); end; end.
  17. kvk1989

    progress bar issue

    Form7.stat.Panels[3].Text := str1; //Form7.pb1.Position := Trunc(((maxprogress - StrToInt64(str1)) / // ) * 100); here is main issue (strtoint64)
  18. kvk1989

    Memo get real-time output

    thanks but its not working :( can you upload it with form thanks !
  19. kvk1989

    Memo get real-time output

    Hi, code working fine but memo output very late
  20. kvk1989

    For gui information

    Hi , can someone tell me which components use for this for build this application ? Thanks !!
  21. kvk1989

    List index out of bounds(1)

    Hi , I'm trying to get gpt partition in listview when i click button it's give me this error My codes procedure TForm1.sButton9Click(Sender: TObject); var st1, st2, st3, st4: Int64; i: Integer; staradr, endadr, sizeadr: string; sList: TStringList; storage: string; begin if (Firehose = '') then // (RawXML = '') or (PathXML = '') then begin Showmessage('Firehose Not Found Please add it'); exit; end; if (not Pos('9008', cbb1.Text) > 0) then begin Showmessage('Port qualcomm not detected '); exit; end; Screen.Cursor := crHourGlass; Port := Getport(cbb1.Text).Trim; log('Scanning port ', 0, 0); log('Qualcomm HS-USB QDLoader 9008' + #13, 0, 1); log('Connect ', 0, 0); log(Trim(cbb1.Text) + #13, clTeal, 1); log('Initialize device ... ' + #13, 0, 0); if not(EmmcDlInfo(Port)) then begin log('Expection : DA already Send Please remove cable and try again ' + #13, clred, 1); Screen.Cursor := 0; exit; end; log('Serial ', 0, 0); log(info.serial + #13, 0, 1); log('MSM ID ', 0, 0); log(info.msmid + #13, 0, 1); log('PKHASH ', 0, 0); log(info.hash + #13, 0, 1); log('SBL ID ', 0, 0); log(info.sblid + #13, 0, 1); log('Initialize successfuly ' + #13, 0, 0); application.ProcessMessages; if (cbb2.ItemIndex = 0) then storage := 'emmc' else storage := 'ufs'; log('Storage Type ', 0, 0); log(uppercase(storage) + #13, 0, 1); application.ProcessMessages; ListGPT := TStringList.Create; sList := TStringList.Create; try if not(EmmcDlGPT(Port, storage, Firehose)) then exit; if ListGPT.Count > 0 then begin application.ProcessMessages; for i := 0 to ListGPT.Count - 1 do begin splitkata(',', ListGPT, sList); st1 := (StrToint64(sList[1]) * 512); st2 := (StrToint64(sList[2]) * 512); st3 := ((st1 + st2) - 1); st4 := Trunc(StrToint64(sList[2]) / 2); staradr := '0x' + IntToHex(st1, 8); endadr := '0x' + IntToHex(st3, 8); sizeadr := intTostr(st4); application.ProcessMessages; ListViewXML(sList, sList + '.img', staradr, endadr, sizeadr, lv1); end; end; log('Information GPT operation successfuly' + #13, 0, 1); finally ListGPT.Free; sList.Free; end; application.ProcessMessages; log('Rebooting ... ', 0, 0); EmmcDlReboot(Port); Screen.Cursor := 0; end;
  22. kvk1989

    For gui information

    Program written in in Delphi but how can I found library it's only single exe
  23. kvk1989

    For gui information

    For listbox they are using tms component for skin I don't know which component used
  24. kvk1989

    comport output

    hello all ! can someone help me to get comport output in combobox ? output like this
  25. kvk1989

    comport output

    hi all, problem solved thanks for all ! unit USBPort; interface uses Winapi.Windows, System.SysUtils, System.Variants, System.Classes, SetupApi, System.Win.Registry, Vcl.StdCtrls, Vcl.Graphics,Fungsi; const GUID_DEVINTERFACE_COMPORT: TGUID = '{86E0D1E0-8089-11D0-9CE4-08003E301F73}'; procedure SearchPort(cb: Tcombobox); Function GetPort(port:string):string; implementation uses Dos, Emmcdl, Unit1, XMLparser; function SetupEnumAvailableComPorts: TstringList; var RequiredSize: Cardinal; GUIDSize: DWORD; Guid: TGUID; DevInfoHandle: HDEVINFO; DeviceInfoData: TSPDevInfoData; MemberIndex: Cardinal; PropertyRegDataType: DWord; RegProperty: Cardinal; RegTyp: Cardinal; Key: Hkey; Info: TRegKeyInfo; S1, S2: string; hc: THandle; begin Result := Nil; if not LoadsetupAPI then exit; try GUIDSize := 1; if SetupDiClassGuidsFromName('Ports', @Guid, GUIDSize, RequiredSize) then begin DevInfoHandle := SetupDiGetClassDevs(@Guid, Nil, 0, DIGCF_PRESENT); if Cardinal(DevInfoHandle) <> Invalid_Handle_Value then begin try MemberIndex := 0; result := TStringList.Create; repeat FillChar(DeviceInfoData, SizeOf(DeviceInfoData), 0); DeviceInfoData.cbSize := SizeOf(DeviceInfoData); if not SetupDiEnumDeviceInfo(DevInfoHandle, MemberIndex, DeviceInfoData) then break; RegProperty := SPDRP_FriendlyName; SetupDiGetDeviceRegistryProperty(DevInfoHandle, DeviceInfoData, RegProperty, PropertyRegDataType, NIL, 0, RequiredSize); SetLength(S1, RequiredSize); if SetupDiGetDeviceRegistryProperty(DevInfoHandle, DeviceInfoData, RegProperty, PropertyRegDataType, @S1[1], RequiredSize, RequiredSize) then begin Key := SetupDiOpenDevRegKey(DevInfoHandle, DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); if Key <> INValid_Handle_Value then begin FillChar(Info, SizeOf(Info), 0); if RegQueryInfoKey(Key, nil, nil, nil, @Info.NumSubKeys, @Info.MaxSubKeyLen, nil, @Info.NumValues, @Info.MaxValueLen, @Info.MaxDataLen, nil, @Info.FileTime) = ERROR_SUCCESS then begin RequiredSize := Info.MaxValueLen + 1; SetLength(S2, RequiredSize); if RegQueryValueEx(Key, 'PortName', Nil, @RegTyp, @S2[1], @RequiredSize) = Error_Success then begin if (Pos('COM', S2) = 1) then begin hc := CreateFile(pchar('\\.\' + S2 + #0), GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if hc <> INVALID_HANDLE_VALUE then begin Result.Add(StrPas(PansiChar(S1))); CloseHandle(hc); end; end; end; end; RegCloseKey(Key); end; end; Inc(MemberIndex); until False; if Result.Count = 0 then begin Result.Free; Result := NIL; end finally SetupDiDestroyDeviceInfoList(DevInfoHandle); end; end; end; finally UnloadSetupApi; end; end; procedure SearchPort(cb: Tcombobox); var ComPortString: TStringList; i: integer; nameport: string; begin cb.Items.Clear; ComPortString := TStringList.Create; try ComPortString := SetupEnumAvailableComPorts; if (ComPortString <> nil) and (ComPortString.Count > 0) then begin for i := 0 to ComPortString.Count - 1 do begin nameport := ComPortString[i].trim; cb.items.add(nameport); cb.itemindex := 0; end; end; finally ComPortString.free; end; end; Function GetPort(port:string):string; begin result := RightStr(port, 7).Replace('(', '').Replace('C', '').Replace('O', '').Replace('M', '').Replace(')', '').trim; end; end.
×