GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > Other Gsm/Mobile Related Forums > GSM Programming & Reverse Engineering


GSM Programming & Reverse Engineering Here you can post all Kind of GSM Programming and Reverse Engineering tools and Secrets.

Reply
 
LinkBack Thread Tools Display Modes
Old 01-08-2014, 04:48   #1 (permalink)
Insane Poster
 
Join Date: Jul 2012
Posts: 95
Member: 1786269
Status: Offline
Thanks Meter: 6
request guidance for use adb command in my progrom


hi

i need help for execute and get output adb command in delphi or c++
For example :
i want run one command from fastboot command's in my progrom and get The result in my program .

i will be grateful if someone help me ...
  Reply With Quote
The Following User Says Thank You to hoseyni- For This Useful Post:
Old 01-08-2014, 16:03   #2 (permalink)
Insane Poster
 
Join Date: Jul 2012
Posts: 95
Member: 1786269
Status: Offline
Thanks Meter: 6
plz help meeeee ... !!!!!!!!!

Last edited by hoseyni-; 01-08-2014 at 16:10.
  Reply With Quote
Old 01-08-2014, 22:54   #3 (permalink)
Insane Poster
 
Join Date: May 2008
Location: Poland ;)
Age: 38
Posts: 69
Member: 776944
Status: Offline
Thanks Meter: 26
Easyiest answer for your question is using pipes.
Look on : Capture Console Output Realtime To Memo - Delphi Programming
  Reply With Quote
The Following User Says Thank You to McManiek For This Useful Post:
Old 01-08-2014, 23:31   #4 (permalink)
No Life Poster
 
dzunlocker's Avatar
 
Join Date: Aug 2004
Location: With old & new friends
Age: 49
Posts: 692
Member: 79640
Status: Offline
Sonork: 1577251
Thanks Meter: 238
Learn how to use adbwinapi.dll with your project. There are alot of good code samples on the net just google it !

Last edited by dzunlocker; 01-08-2014 at 23:40.
  Reply With Quote
The Following 2 Users Say Thank You to dzunlocker For This Useful Post:
Old 01-10-2014, 04:11   #5 (permalink)
Insane Poster
 
Join Date: Jul 2012
Posts: 95
Member: 1786269
Status: Offline
Thanks Meter: 6
Quote:
Originally Posted by McManiek View Post
Easyiest answer for your question is using pipes.
Look on : Capture Console Output Realtime To Memo - Delphi Programming
I used this code before, but it did not work. Did you make use of it ؟؟؟!!!!!!
  Reply With Quote
Old 01-10-2014, 04:20   #6 (permalink)
Insane Poster
 
Join Date: Jul 2012
Posts: 95
Member: 1786269
Status: Offline
Thanks Meter: 6
Quote:
Originally Posted by dzunlocker View Post
Learn how to use adbwinapi.dll with your project. There are alot of good code samples on the net just google it !
thnx for your help ,but im serearch ed .. and im not find good guide or help for it ... :-? can you help ??
  Reply With Quote
Old 01-10-2014, 15:24   #7 (permalink)
No Life Poster
 
jodge's Avatar
 
Join Date: Apr 2004
Posts: 753
Member: 61389
Status: Offline
Thanks Meter: 193
really, mate?
After search, first page:

c#
[HOW TO] Make your own Android Toolkit for Windows in C# - Make it to your liking! - xda-developers

java:
android - Adding ADB to my Java PC application - Stack Overflow

c++
https://android.googlesource.com/pla...indows/usb/api
  Reply With Quote
The Following User Says Thank You to jodge For This Useful Post:
Old 01-11-2014, 18:45   #8 (permalink)
Banned
 
Join Date: Nov 2009
Location: Lima, Perú
Posts: 1,477
Member: 1159099
Status: Offline
Thanks Meter: 6,371
@hoseyni- here a small example how run cmd with ADB,this code is partly a small project.

Code:
function IsWinNT: boolean;
var
  OSV: OSVERSIONINFO;
begin
  OSV.dwOSVersionInfoSize := sizeof(osv);
  GetVersionEx(OSV);
  result := OSV.dwPlatformId = VER_PLATFORM_WIN32_NT;
end;

function cmdxcx(Cmd: string): string;
var
  Buffer: array[0..4096] 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: string;
begin
  Result:= '';
  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(PChar(@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;
adb files need put in C:\WINDOWS or in same file folder

pic test
https://imagizer.imageshack.us/v2/97...0/713/h4tr.jpg

Thxz!/regards
Pablo
  Reply With Quote
The Following User Says Thank You to xcachorrox For This Useful Post:
Old 01-15-2014, 12:32   #9 (permalink)
Insane Poster
 
Join Date: Jul 2012
Posts: 95
Member: 1786269
Status: Offline
Thanks Meter: 6
Quote:
Originally Posted by XcachorroX® View Post
@hoseyni- here a small example how run cmd with ADB,this code is partly a small project.

Code:
function IsWinNT: boolean;
var
  OSV: OSVERSIONINFO;
begin
  OSV.dwOSVersionInfoSize := sizeof(osv);
  GetVersionEx(OSV);
  result := OSV.dwPlatformId = VER_PLATFORM_WIN32_NT;
end;

function cmdxcx(Cmd: string): string;
var
  Buffer: array[0..4096] 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: string;
begin
  Result:= '';
  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(PChar(@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;
adb files need put in C:\WINDOWS or in same file folder

pic test
https://imagizer.imageshack.us/v2/97...0/713/h4tr.jpg

Thxz!/regards
Pablo

thnx dear - XcachorroX ** can you upload your example source project ??
  Reply With Quote
Old 01-15-2014, 21:34   #10 (permalink)
Banned
 
Join Date: Nov 2009
Location: Lima, Perú
Posts: 1,477
Member: 1159099
Status: Offline
Thanks Meter: 6,371
Quote:
Originally Posted by hoseyni- View Post
thnx dear - XcachorroX ** can you upload your example source project ??
yes friend,why not.
src+example


DOWNLOAD
  Reply With Quote
The Following 2 Users Say Thank You to xcachorrox For This Useful Post:
Old 02-13-2017, 01:22   #11 (permalink)
Insane Poster
 
Join Date: Jan 2017
Posts: 95
Member: 2674769
Status: Offline
Thanks Meter: 17
it works for me good but thare is a proplem

it gives achineise characters insteed of english way

i send this Memo1.Lines.Add(Cmdxcx('adb devices'));

i got

楌瑳漠⁦敤楶散⁳瑡慴档摥ഠ搊㘷搵攳ऴ敤楶散਍਍
  Reply With Quote
Old 02-14-2017, 01:25   #12 (permalink)
Insane Poster
 
Join Date: Jan 2017
Posts: 95
Member: 2674769
Status: Offline
Thanks Meter: 17
Hello.

Any body have idea
  Reply With Quote
Old 02-14-2017, 13:55   #13 (permalink)
No Life Poster
 
Nishith's Avatar
 
Join Date: May 2012
Location: BHARAT
Posts: 1,571
Member: 1766148
Status: Offline
Sonork: 100.1614494
Thanks Meter: 490
Quote:
Originally Posted by doctorsu View Post
it works for me good but thare is a proplem

it gives achineise characters insteed of english way

i send this Memo1.Lines.Add(Cmdxcx('adb devices'));

i got

楌瑳漠⁦敤楶散⁳瑡慴档摥ഠ搊㘷搵攳ऴ敤楶散਍਍
Quote:
Originally Posted by doctorsu View Post
Hello.

Any body have idea

Check your PC's Regional settings and adb.exe file.
  Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 



All times are GMT +1. The time now is 11:14.



Powered by Searchlight © 2024 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -
Page generated in 0.21390 seconds with 8 queries

SEO by vBSEO