[Q] where should i write the loadlibraryexw code in windows phone to work? - General Questions and Answers

where should i write the loadlibraryexw code in visual studio 2013 WP8 C++ project to work ?? i mean which file should i create a new header file or just paste it in pch.cpp file ? i am developing a lock screen app. i am new to cpp . so its getting complicated with all the errors.
some help will be much appreciated.
Code:
int __cdecl main(::Platform::Array<::Platform::String^>^ args) {
TEB* teb = NtCurrentTeb();
HMODULE kernel = (HMODULE) teb->currentPEB->ldr->initModuleList->Flink->baseAddress;
LoadLibraryEx LoadLibraryExW = (LoadLibraryEx) GetProcAddress(kernel, "LoadLibraryExW");

Related

Need help with Visual C#

Hello!
I have an old barcode reader with Windows CE.
I'm trying to make a simple application, that saves the scanned barcode into a file.
The next is working code, that show the scanned barcode and exits. I want the value scanned ( lpScanBuf ) to be saved into a textfile. Not to overwrite the existing file, but add to existing values (append) inside the file:
#include <windows.h>
#include <ScanCAPI.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpszCmdLine, int nCmdShow)
{
HANDLE hScanner = NULL;
LPSCAN_BUFFER lpScanBuf = NULL;
DWORD dwScanSize = 7095;
SCAN_Open(TEXT("SCN1:"), &hScanner);
SCAN_Enable(hScanner);
lpScanBuf = SCAN_AllocateBuffer(TRUE, dwScanSize);
SCAN_ReadLabelWait(hScanner, lpScanBuf, 0);
MessageBox(NULL,(LPTSTR)SCNBUF_GETDATA(lpScanBuf),TEXT("HelloScan"),MB_OK);
<< HERE SHOULD BE SOMETHING, THAT SAVES THE VALUE lpScanBuf INTO A TEXTFILE >>
SCAN_Disable(hScanner);
SCAN_DeallocateBuffer(lpScanBuf);
SCAN_Close(hScanner);
return 0;
}
Click to expand...
Click to collapse
I have tried in several ways, but always get an error:
using System;
using System.IO;
File.WriteAllText(@"test.txt", lpScanBuf);
or
System.IO.File.AppendAllText(@"test.txt", lpScanBuf);
Click to expand...
Click to collapse
-----------------------------------------
Found some ideas... but i don't know how to apply these..
lstrcpy (qty,buffer);
memset(buffer,0,sizeof(buffer));
swprintf(buffer,TEXT("%s,%s\n"),barcode);
fr=fopen("barcode.txt","a+"));
fwrite(fr, s_str);
fwrite(buffer,sizeof(TCHAR),lstrlen(buffer),fr);
fclose(fr);
Click to expand...
Click to collapse
And another idea...
string filename = "myFile.txt";
using (StreamWriter writer = new StreamWriter(filename, true))
{
writer.Write(lpScanBuf + " ");
}
Click to expand...
Click to collapse

[DEV] Framebuffer console

Make a backup first.
So i have managed to get framebuffer console output , but its stil not working.
So any help is wellcome.
The error i get is more the same as This.
You can try this kernel ( fastboot flash zimage zImage ) <- Dont flash if you dont know what your doing .
more info about whats going on is here.
Vids
With framebuffer active , but display is scrambled!.
With framebuffer console and display fixed.
For thoose that dont know what this is , its simpel.
For GNU/Linux we need this to work.
Some Info:
You could use any kernel that works with DHD , mine is Leedroid's Ace Kernel
.Config File
Mod file /drivers/video/msm/msm_fb.c to look (ADD) like this ( add x = 0; y = 0; w = msmfb->xres; h = msmfb->yres; )
x = msmfb->update_info.left;
y = msmfb->update_info.top;
w = msmfb->update_info.eright - x;
h = msmfb->update_info.ebottom - y;
x = 0; y = 0; w = msmfb->xres; h = msmfb->yres; <-----------Do not add this airow
Thats it. Start modding
change log space
0.1 - Enabled frambuffer -> makes screen scrambled
0.2 - Fixed lcd but got atomic panic.
0.3 - fixed Frambuffer console and lcd trying to boot ubuntu but sdcard is mounted after command line partition list is mmcblk0** needs to be mmcblk1p2
Did we realy need console output to the framebuffer to boot ubuntu nativ, or would it only be a importend debug feature during porting?
Following video shows meego booting on an desire, but the have no console output during the boot. Maybe the have the same bug when the use tty on the framebuffer!?
http://www.youtube.com/watch?v=GtnfHNjcdzg
Not needed !!!! -->
Most for debugging , and evry thing i try i cant get ubuntu to boot.
Also did find sometging about cmdline hack as command line seems to be skipt --> look at setup.c the modded command line.
This could be an alternative:
http://sven.killig.de/android/N1/serial/
Try following zImage.
Jhinta said:
Make a backup first.
So i have managed to get framebuffer console output , but its stil not working.
So any help is wellcome.
The error i get is more the same as This.
You can try this kernel ( fastboot flash zimage zImage ) <- Dont flash if you dont know what your doing .
more info about whats going on is here.
Vids
With framebuffer active , but display is scrambled!.
With framebuffer console and display fixed.
For thoose that dont know what this is , its simpel.
For GNU/Linux we need this to work.
Some Info:
You could use any kernel that works with DHD , mine is Leedroid's Ace Kernel
.Config File
Mod file /drivers/video/msm/msm_fb.c to look (ADD) like this ( add x = 0; y = 0; w = msmfb->xres; h = msmfb->yres; )
x = msmfb->update_info.left;
y = msmfb->update_info.top;
w = msmfb->update_info.eright - x;
h = msmfb->update_info.ebottom - y;
x = 0; y = 0; w = msmfb->xres; h = msmfb->yres; <-----------Do not add this airow
Thats it. Start modding
Click to expand...
Click to collapse
Hi can you help out on enabling Mediatek framebuffer, Alcatel OT918D ?
On compiling I get this error
http://pastebin.com/N6Ct51ub
I think the problem is the files are not in the linux/kernel/drivers/video directory
here is the makefile in linux/kernel/drivers/video
http://pastebin.com/3kfRnrKA
while in the mediatek/drivers directory we have :
http://pastebin.com/mDSTthG0
I need framebuffer console for debugging, please help out if you can.

[Q] Load SQLite DB

I have SQLite DB file. I copy him to StorageFile and open it by SQLite
Code:
...............................
using SQLiteClient;
using Community.CsharpSqlite;
namespace PhoneApp1
{
public partial class MainPage : PhoneApplicationPage
{
// Конструктор
private string fileName = "DB";
public MainPage()
{
InitializeComponent();
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
System.IO.Stream src = Application.GetResourceStream(new Uri(fileName, UriKind.Relative)).Stream;
IsolatedStorageFileStream dest = new IsolatedStorageFileStream(fileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, store);
src.Position = 0;
CopyStream(src, dest);
dest.Flush();
dest.Close();
src.Close();
dest.Dispose();
IsolatedStorageFile tmp= IsolatedStorageFile.GetUserStoreForApplication();
if (!tmp.FileExists(fileName))
{
return;
}
SQLiteConnection db = new SQLiteConnection(fileName);
try
{
db.Open();
SQLiteCommand cmd = db.CreateCommand("SELECT * FROM table");
var lst = cmd.ExecuteQuery<Test>();
ApplicationTitle.Text = "Selected " + lst.ToList().Count + " items\r\nTime ";
}
catch (SQLiteException ex)
{
ApplicationTitle.Text = "Error: " + ex.Message;
}
}
private static void CopyStream(System.IO.Stream input, IsolatedStorageFileStream output)
{
byte[] buffer = new byte[32768];
long TempPos = input.Position;
int readCount;
do
{
readCount = input.Read(buffer, 0, buffer.Length);
if (readCount > 0)
{
output.Write(buffer, 0, readCount);
}
} while (readCount > 0);
input.Position = TempPos;
}
}
public class Test
{
public Test()
{
}
int _id;
public int id
{
get { return _id; }
set { _id = value; }
}
}
}
Result : ApplicationTitle = unable to opendatabase file.
Why? Plz help.
Probably because you doing something wrong, for example, opening SQLiteConnection
Seems like correct syntax should be
Code:
new SqliteConnection("Version=3,uri=file:db")
Download and try source code from http://wp7sqlite.codeplex.com/SourceControl/list/changesets#
error "Couldn't open database file version=3,urlB"
file DB i created from command "backup DB File". It's right?
I have no idea what kind of file do you have. I just downloaded and ran example from sources mentioned above and it works fine (but with few assertions). BTW you should have a complete source code of SQLite, just debug into SQLite procedures and check what's wrong.
Example work fine. I want read database from project file (Content).He isn't located in StorageFile. I use him after i'm saving myfile to StorageFile .
evgen_wp said:
Example work fine. I want read database from project file (Content).He isn't located in StorageFile. I use him after i'm saving myfile to StorageFile .
Click to expand...
Click to collapse
I already understood you. Add your code (to save database file from resource stream to isf) to example, and test conn.Open() call using F11 (Step Into). You'll see what's wrong. I don't have your database file and have no idea what did you put inside
File did not have time to create. It is ... work now.he can open empty file but can't open file with data
P.S. I use Sqlite Client for Windows Phone from http://sqlitewindowsphone.codeplex.com/
Why don't you use another codeplex project I've posted above? It works fine for me (tested because of your question).
P.S. Don't forget to push "Thanks" button. It's not a paid Microsoft customer service and I'm not your support guy.

[Q] There is error with batteryStats.computeBatteryRealtime on Androi

There is error when we obtain time with batteryStats.computeBatteryRealtime on Android platform.
In our code, we want to get the time with the method batteryStats.computeBatteryRealtime , shown as following:
import android.os.BatteryStats;
void update() {
int statsType = BatteryStats.STATS_SINCE_CHARGED;
...
long realTime = SystemClock.elapsedRealtime();
long uSecTime = batteryStats.computeBatteryRealtime(realTime * 1000, statsType);
...
}
the update method will be invoked every 20 seconds, but, the uSecTime never changed while realTime changing, Why, who can help me ?
thank you very much!
our platform:
--------------------------------------------------------------------
1) Android 2.3
2) Juno Service Release 2
3) Windows 8 64 bit
batteryStats.getBatteryRealtime(realTime) has the same problem
the method batteryStats.getBatteryRealtime(realTime) has the same problem, why?

[DEV] AndroidCtrl.dll [7.1.46.0] (ADB/Fastboot/(apk/zip) Signer - Framework)

This (C# .NET 4.6|4.7|4.8) dll is a kind of ADB/Fastboot/(apk/zip) Signer - Framework, it provides a lot of predefined .NET functions to communicate with an Android device. It's designed to work in 1st case with any non-root device but you can also use it with any rooted device (A few functions requires root access).
License
This project is licensed under the Apache License Version 2.0.
The latest build 7.1.46.0 is currently only via FTP, GoogleDrive or Dropbox available, the DevDB has currently some upload issues!
The following (N)amespaces, (C)lasses & (I)nterfaces are currently available:
(N) ADB
(N) Binary (This is the binary/exe implementation of ADB)
(C) ADB (static Management Class for the ADBClient's)
(C) ADBClient (Implementation of IADBClient)
(C) Channel (Implementation of IChannel)
(N) Device
(N) BusyBox
(C) BusyBox
(C) Find
(C) Tar
(N) Dumpsys
(C) Battery
(C) Dumpsys
(I) IBattery
(N) Input
(I) IKeyEvent
(C) Input
(C) InputExtensions
(C) KeyEvent (Implementation of IKeyEvent)
(N) IO
(NS) Compression
(NS) BrotliSharp (Only available in .NET 4.6|4.7|4.8 - In .NET Standard >= 2.1 you have to use the native .NET implementation)
(C) ADirectoryInfo (Similar to .NET Directory/-Info)
(C) AFileInfo (Similar to .NET File/-Info)
(C) AFileStream (Similar to .NET FileStream)
(C) AFileSystemInfo (Similar to .NET FileSystemInfo, it's the abstract base for ADirectoryInfo & AFileInfo)
(C) AMountPointInfo (Similar to ADirectoryInfo & AFileInfo but only for mounts)
(C) FileSystemCache (A cache object for ADirectoryInfo & AFileInfo)
(I) IFileSystemCache (Interface for FileSystemCache)
(C) IO
(I) ITransferMessage
(C) MediaScanner (Manage the Android MediaScanner, useful after some file-transfers via ADB)
(C) Mount (Requires Root and manage the mounts)
(C) Stat (stat class for the ADB-Protocol)
(C) SyncStream (Base implementation of the ADB sync service. Utilized by AFileStream)
(C) TransferMessage
(C) UPath (Similar to .Net Path but for unix paths)
(N) Logcat
(I) ILogEntry
(C) Logcat
(C) LogEntry
(N) Manager
(C) ActivityManager
(I) IInstrumentation
(C) Instrumentation
(I) IPackage
(I) IPermission
(C) Manager
(C) Package
(C) PackageManager
(C) Permission
(N) Provider
(C) Contacts (Contacts provider)
(C) ContactsDataField
(C) ContactsEmail
(C) ContactsEvent
(C) ContactsGroup
(C) ContactsIdentity
(C) ContactsIM
(C) ContactsName
(C) ContactsNickname
(C) ContactsNote
(C) ContactsOrganization
(C) ContactsPhone
(C) ContactsPhoto
(C) ContactsPostalAddress
(C) ContactsRelation
(C) ContactsSipAddress
(C) ContactsWebsite
(I) IContactsDataField
(C) Provider
(C) Telephony (Telephony provider)
(N) Screen
(C) Framebuffer (Implementation of IFramebuffer)
(C) FramebufferInfo
(I) IFramebuffer (Interface of an RAW framebuffer)
(I) IFramebufferInfo
(I) IScreenDimension
(I) IScreenFocus
(C) Screen
(C) ScreenDimension
(C) ScreenFocus
(N) Shell
(I) IShell (Interface of an shell with in-/output abilities)
(C) Shell (Implementation of IShell)
(N) SQLite
(C) Options
(C) QueryTools
(C) SQLite3 (SQLite3 database connector)
(C) BuildProperties
(C) Daemon (Manage the daemon on the device)
(C) Device
(C) Forensics (ALFA-State)
(I) IUptime
(C) OpenRecoveryScript (Manage the OpenRecoveryScript)
(C) Phone (Start a call, dial a number, add a contact or send a sms)
(C) Su
(C) Uptime
(C) Wipe
(N) Shares
(C) Monitor (Implementation of IMonitor)
(N) Socket (This is the IP based implementation of ADB - Here is NO binary/exe required)
(C) ADB (static Management Class for the ADBClient's)
(C) ADBClient (Implementation of IADBClient)
(C) ADBSocket (IP based connector - Mimics the ADB-Server)
(C) Channel (Implementation of IChannel)
(C) ADBridge (Unified access to Binary.ADB and Socket.ADB)
(I) IADBClient (Interface for nearly all ADB commands)
(I) IChannel (Interface of an RAW data channel)
(N) Fastboot
(C) Backdoor (Some backdoor commands)
(C) Fastboot (static Management Class for the FastbootClient's)
(C) FastbootClient (Includes nearly all fastboot.exe commands)
(I) IFastbootClient (Interface for FastbootClient)
(C) Monitor (Implementation of IMonitor)
(C) OEM (Some OEM commands)
(C) Wipe
(N) ProcessModels
(C) General (Includes some predefined process models)
(I) IRealTimeBG (Interface of an background process with in-/output abilities)
(C) RealTimeBGExeV2 (Implementation of IRealTimeBG)
(N) Signer
(C) Signer (signapk.jar Interface)
(N) Tools
(C) CRC
(C) Deploy (Deploy the AAPT/ADB/Fastboot/Signer files needed by this dll)
(C) Hash
(C) Hex
(C) IMEI (Some helper to verify and rebuild a valid IMEI)
(C) ToolBox
(C) Cleanup (Delete the files/folders which were created by this dll)
(C) Config
(C) DeviceInfo (Basic device info, the return from "(Binary/Socket).ADB.Devices()" and "Fastboot.Devices()")
(I) IDeviceInfo (Interface for DeviceInfo)
(I) IMonitor (Interface for the ADB.Binary, ADB.Socket and Fastboot.Fastboot monitor)
Special
Ready-To-Go MVVM's for WPF, XAML via my AndroidCtrlUI.dll
Multi-Device compatible, you can manage unlimited devices at the same time with this dll. Each device gets it's own instance. (Thread-Safe, the dll use lock() for critical sections)
UTF8-File/Folder Transfer you can transfer files/folders with containing special chars (ü, ö, ä, €, @, à, è, etc.)
On-the-fly Device to Device copy (Binary <-> Binary | Binary <-> Socket | Socket <-> Socket)
Device-Monitor, if activated, it will check every 10 sec. ADB & Fastboot for new connected devices and call an defined callback, if something changed. So your program get's an info if an device is connected or removed.
All Android key-events as (int)enum and the ability to send them as single or stack.
Hint
You can use all ADB methods/commands via USB or W-Lan/Lan, if your Rom supports ADB via W-Lan/Lan (Settings/Developer Settings)
If you want to use all sub-classes of IADBClient with BusyBox instead of the Shell, you have to set IADBClient.UseBusyBox to true. This will tell the instance to use the BusyBox commands inside each method, if the device has BusyBox installed.
Referenced .NET assembly's
System
System.Numerics
System.XML
Used Code-analysis rules:
Basic & Advanced Microsoft-Rules for Accuracy
Microsoft-managed minimum & recommended rules
Microsoft Security Rules
About the usage, the namespaces (ADB, Fastboot, Signer) have one basic instance. For example, ADB.Instance(), Fastboot.Instance(), Signer.Instance. As you can see ADB.Instance() and Fastboot.Instance() can have a parameter. This parameter is in both cases an (string) DeviceID, an IDeviceInfo or null, if you use for example null, both classes will return it's Selected client. If you use the DeviceID or the IDeviceInfo the return is a fresh instance of the client or the already created instance. So, in any case, before you call ADB/Fastboot.Instance(). Check with ADB/Fastboot.Devices() if you have a connected device. If so, use the IDeviceInfo object to start your device instance or simply pass the serial to the Instance(). All instances which you have created on this way, will be hold inside an Dictionary<string, ADBClient>, so you can configure each device instance to it's needs and call it when ever you need it. This is also the point where i say it's multi-device and multi-thread safe. Because, if you always use ADB/Fastboot.Instance() you can't reach the wrong device. Also, all classes using lock() for critical sections, because [MethodImpl(MethodImplOptions.Synchronized)] is not longer available under .NET Standard.
If you have any wishes like new features, how-to's or something else, let me know! :cyclops:
Tested OS
Win Vista | 7 | 8 | 8.1 | 10 (32Bit/64Bit in VM-Ware)
Win 7 | 8 | 8.1 | 10 (64Bit Native)
Win XP is not longer supported by ADB! (But, if you have a old ADB binary, the dll will do it's job)
Tested Devices
Android Emulator some Versions (min. 2.x) in AVD
Android x86
HTC Sensation -/ XE (non-/rooted)
HTC One M9 (non-/rooted)
Huawei P9 Lite (VNS-L21,22,23,31,etc.) (non-/rooted)
Huawei P10 Lite (WAS-LX1A,etc.) (non-/rooted)
Samsung Galaxy 2-5 (non-/rooted)
Samsung Galaxy S Plus (non-rooted)
A few Samsung Tabs (non-/rooted)
Google Pixel 4 (Android 11) (non-/rooted)
Requirements
Android: min. 2.x
Platform: x86/x64 (Windows)
Frameworks: min. .NET 4.6 and JRE (only for the Signer)
(Installed ADB/Fastboot device driver)
Download
Mirror: XDA-DevDB (since 29.01.2019 no uploads possible)
Mirror #1: My FTP (Build archiv)
Mirror #2: GoogleDrive
Mirror #3: Dropbox
Each zip-archiv contains the AndroidCtrl.dll, its markup file AndroidCtrl.xml and the program debug database AndroidCtrl.pdb for .NET 4.6|4.7|4.8 and .NET Standard 2.1 (beta)
Examples (Updated to dll version 7.1.46.0) (Updated in the next 24 h)
Mirror: My FTP
Mirror #1: GoogleDrive
Mirror #2: Dropbox
(Contains a simple exe and its source written in C# WPF)
Source
N/A (If you want to have a look at it, send me a PM or simply decompile it.)
DO NOT MIRROR MY FILES! DO NOT COPY MY THREADS!
XDA:DevDB Information
AndroidCtrl.dll, Tool/Utility for the Android General
Contributors
k1ll3r8e, squabbi, Krystanos
Version Information
Status: Stable
Current Stable Version: 7.1.46.0
Stable Release Date: 2020-09-19
Created 2016-07-24
Last Updated 2020-09-19
How - To
0. Complete How-To
1. Getting Started (General)
2. Config & Deploy
3. Individual Call (ADB/Fastboot/Signer)
4. Start/Stop (ADB/Fastboot)
5. Reboot (ADB/Fastboot)
6. DeviceConnectionMonitor
7. Device state check
8. Send KeyEvents (ADB)
Problems & Solutions
1. Windows 8.x | 10.x
NOTE
If u use any callback functions, u have to invoke any UI-/ variable-interaction from an dispatcher like the following example:
Code:
public void Monitor(Added|Changed|Removed)EventHandler(object sender, Monitor(Added|Changed|Removed)EventArgs e)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// IDeviceInfo[] e.Devices
// Here u can interact with an UI-Element or an variable in ur program code
});
}
if u do it without dispatcher, u'll get an "Thread Exception".
More examples coming soon...
(If u need a specific example, just let me know, i'll try my best to provide one.)
Changelog
DD.MM.YYYY | (A) = Added | (C) = Changed | (D) = Deleted | (F) = Fixed | (R) = Recoded | (U) Updated
----------------------------------------------------------------------------------------------------------------------------------------------------
26.07.2020 [7.0.46.0]
(A) Some new Async overloads to the AFileInfo, AFileSystemInfo, ADirectoryInfo and AMountpointInfo.
(F) A few little bugs
01.02.2020 [6.7.46.0]
(A) ADB.IADBClient{} (The old IADB interface)
(A) ADB.Binary.ADB{} (The old ADB class - only the statics)
(A) ADB.Binary.ADBClient{} (The old ADB class - without any statics)
(A) ADB.Socket.ADB{} (The old ADB class - only the statics)
(A) ADB.Socket.ADBClient{} (The old ADB class - without any statics)
(A) ADB.Device.ADirectoryInfo{}
(A) ADB.Device.AFileInfo{}
(A) ADB.Device.AFileStream{}
(A) ADB.Device.AMountPointInfo{}
(A) ADB.Device.FileSystemCache{}
(A) ADB.Device.IFileSystemCache{}
(D) ADB.Device.Directories{}
(D) ADB.Device.Files{}
(D) ADB.Device.FileSystem{}
(D) ADB.Device.FileSystemItem{}
(D) ADB.Device.IFileSystemItem{}
And everything related to those classes... Directories has been replaced with ADirectoryInfo, Files has been replaced with AFileInfo and FileSystem has been replaced with AMountPointInfo.
31.05.2019 [6.0.46.0]
(C) The Framework Version from 4.0 to 4.6
(C) The versioning:
6 = Major
0 = Minor
46 = Framework Version (4.6)
0 = Hotfix
(A) (int) ADB.Instance().Device.Screen.GetAutoBrightness()
(A) (int) ADB.Instance().Device.Screen.GetBrightness()
(A) (ScreenBrightnessMode) ADB.Instance().Device.Screen.GetBrightnessMode()
(A) (ScreenRotation) ADB.Instance().Device.Screen.GetRotation()
(A) (ScreenRotationMode) ADB.Instance().Device.Screen.GetRotationMode()
(A) (bool) ADB.Instance().Device.Screen.SetBrightness(int brightness)
(A) (bool) ADB.Instance().Device.Screen.SetBrightnessMode(ScreenBrightnessMode mode)
(A) (bool) ADB.Instance().Device.Screen.SetRotation(ScreenRotation rotation)
(A) (bool) ADB.Instance().Device.Screen.SetRotationMode(ScreenRotationMode mode)
(D) ASDK (enum)
(C From) (ASDK) ADB.Instance().Device.GetSDK()
(C To) (int) ADB.Instance().Device. GetSDK()
10.04.2019 [0.0.5.2]
(A) A workaround for older SU binaries
Code:
// (Source ADB.Device.Su {})
///<summary>
/// Enables an (W)ork(A)round for older SU binaries, which needs the command as an single argument.
///<para/>For example, the latest SU binaries support a syntax like [su -c id -u] where older binaries need [su -c "id -u"]
///<para/>If u deactivate this workaround by enabled <see cref="IADB.UseSu"/>, <see cref="IADB.UseSu"/> gets also disabled!
///<para/>This workaround is by default disabled
///<para/>Affected Methods:
///<para/><see cref="ShellCmd(string, int)"/>, <see cref="ShellCmd(string, CancellationToken, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, CancellationToken, int)"/>
///<para/><see cref="ShellCmdHRes(string, int)"/>, <see cref="ShellCmdHRes(string, CancellationToken, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, CancellationToken, int)"/>
///</summary>
public bool WA_SingleArgument
(A) A fix for unresponsive interactive shells. This happened to me on Lineage on my HTC Sensation, where the device sends an "resize" request... Sending a command in this state caused the command getting cut at the 1st byte, for example, u send "id -u" the delivered command was "d -u".
(A) Added "feature" detection for Binary.ADB, now u can get the "features" of the device like: cmd, stat, stat_v2, shell, shell_v2, etc. in the "IChannel.Features".
(R) Removed the last bit of code duplication and optimized some internal logic's. For example, the "Socket.IChannel" got a speed boost from ~1.920.000 bytes during an transfer of 14.400.000 bytes.
06.03.2019 [0.0.5.1]
(C) ADB.Device structure (see 1st post)
(R) ADB.Device.Provider (Decreased the loading time of the contacts and their data)
(D) AAPT completely
Older Changes:
16.02.2019 [0.0.4.2]
(A) DNS lookup for ADB.Socket
(R) Reduced code duplication
07.02.2019 [0.0.4.1]
(F) An issue inside the ADB.Binary, the problem was that "ADB.Devices()" returned nothing, if more than one device was connected. Reason for the issue was the "(int)IChannel.ReadHexLength()" function, there i read an Int16 but it was an UInt16 which caused an overflow.
29.01.2019 [0.0.4.0]
(U) AAPT, ADB, Fastboot binaries and the required dlls to the latest version (1.0.40)
(A) ADB.ADBridge - Unified access to ADB.Binary and ADB.Socket
(A) ADB.IADB - Interface for ADB-/Socket with nearly all ADB commands
(A) ADB.IChannel - Interface of an ADB-/Socket RAW-data channel
(A) ADB.IFramebuffer - Interface for the ADB-/Socket framebuffer
(A) ADB.IShell - Interface for the ADB-/Socket Shell v1 & v2
(A) IMonitor - Interface for the ADB-/Socket and Fastboot device-monitor
(A) On-the-fly device to device copy (ADB.Binary <-> ADB.Binary | ADB.Binary <-> ADB.Socket | ADB.Socket <-> ADB.Socket)
Reordered the ADB namespace... The old layout was:
ADB - Binary based ADB
ADB.Device - Device helper
ADBSocket - Socket based ADB
The new layout is:
ADB - Main ADB
ADB.Binary - Binary based ADB
ADB.Device - Device helper
ADB.Shared - Shared helper, extensions for ADB.Binary and ADB.Socket
ADB.Socket - Socket based ADB
Implemented the framebuffer for ADB.Binary and ADB.Socket (A ready-to-go Remote-Desktop is available via my AndroidCtrlUI.dll)
09.04.2018 [0.0.3.1]
This is a complete new version!
-
I added a lot of new stuff like the "CancellationToken" overload, the "MediaScanner" class and also some fine tunes to the "Screen" class, there u can now also get the Screen dimensions. Also a lot models like the old MemDumpxxx_4xx have been removed (we are now 4 versions higher and the outputs are not longer available or have changed to much).
15.02.2018 [0.0.2.5]
(F) A problem where a NULL exception was raised during directory parsing
(F) A few UI freezes and applied a few tweaks to some logic's.
(D) Tools.Icons {}
(D) Tools.TrayNotify {}
Reason for this is the upcoming compatibility to .NET Core. BUT, the functions are not lost, i added those not .NET Core compatible calls to the AndroidCtrlUI.dll... Because the UI dll will be never migrated to .NET Core.
03.11.2017 [0.0.2.4]
Nearly full new build
-
Sadly my notes are lost, based on a data loss on my Dev Environment...
Showcase
ADB-Overlay made by me
The XDA-Thread and Download can be found here
P10 Lite Toolkit made by me
The XDA-Thread and Download can be found here
P9 Lite Toolkit made by me
The XDA-Thread and Download can be found here
HTC One Toolkit from our Member @squabbi
The XDA-Thread and Download can be found here
--
U use this dll in ur project?
Send me a PM with:
Project Name
Small image
Short description
Download link
then i'll link it here.
An interesting library, time to change Droid Manager code base to use this one ^__^
Thanks for your hard work :highfive:
Could you put an example of how to use the adb and fastboot commands?
such as adb reboot
and fastboot reboot
squabbi said:
Could you put an example of how to use the adb and fastboot commands?
such as adb reboot
and fastboot reboot
Click to expand...
Click to collapse
Yup i'll do it right now
#EDIT:
Added:
Start/Stop ADB/Fastboot
Check if ADB/Fastboot is running
Device Reboot ADB/Fastboot
Sending KeyEvents ADB
Hey another question. How would I use for example:
Code:
Fastboot.Instance().OEM.ReadCid();
I would presume there would need to be a 'string' for it to save to.
Code:
private string _cid
??
EDIT: So i deciced to try this:
Code:
MessageBox.Show("cid: " + Fastboot.Instance().OEM.ReadCid());
When I press the button it shows:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Thanks!
squabbi said:
Hey another question. How would I use for example:
Code:
Fastboot.Instance().OEM.ReadCid();
I would presume there would need to be a 'string' for it to save to.
Code:
private string _cid
??
EDIT: So i deciced to try this:
Code:
MessageBox.Show("cid: " + Fastboot.Instance().OEM.ReadCid());
When I press the button it shows:
Thanks!
Click to expand...
Click to collapse
Hey there
Methods/functions like "ReadCid()" returns a "List<string>" so u can do like:
Code:
string cid = string.Join(" ", Fastboot.Instance().OEM.ReadCid().ToArray());
// or
// The return are 3 lines, so we need to get the 2cnd
string cid = Fastboot.Instance().OEM.ReadCid()[1];
NOTE
I return there a "List<string> (the raw output)" coz i dun know if the output will be the same on each device.
In this case u have filter the right line ur self
Hope this helps
k1ll3r8e said:
Hey there
Methods/functions like "ReadCid()" returns a "List<string>" so u can do like:
Code:
string cid = string.Join(" ", Fastboot.Instance().OEM.ReadCid().ToArray());
// or
// The return are 3 lines, so we need to get the 2cnd
string cid = Fastboot.Instance().OEM.ReadCid()[1];
NOTE
I return there a "List<string> (the raw output)" coz i dun know if the output will be the same on each device.
In this case u have filter the right line ur self
Hope this helps
Click to expand...
Click to collapse
Thanks again!
It worked perfectly! Another question. I'm now using a textbox to show the output like this:
Code:
MainWindow mainWin = (MainWindow)App.Current.MainWindow;
mainWin.tBOutput.AppendText(String.Join("", "\n", Fastboot.Instance().OEM.ReadCid()[1]));
mainWin.tBOutput.ScrollToEnd();
How can I do this but in a seperate window? Like one that is seperate from the MainWindow.
Thanks! :good:
squabbi said:
Thanks again!
It worked perfectly! Another question. I'm now using a textbox to show the output like this:
Code:
MainWindow mainWin = (MainWindow)App.Current.MainWindow;
mainWin.tBOutput.AppendText(String.Join("", "\n", Fastboot.Instance().OEM.ReadCid()[1]));
mainWin.tBOutput.ScrollToEnd();
How can I do this but in a seperate window? Like one that is seperate from the MainWindow.
Thanks! :good:
Click to expand...
Click to collapse
Hey there
There are 3 and more options how u can handle this...
1. Simple "MessageBox"
Code:
MessageBox.Show(string.Join("\n", Fastboot.Instance().OEM.ReadCid().ToArray()));
2. Extra Window
XAML
Code:
<Window x:Class="Multi_Explorer.viewmodel.android.fastboottools.htc.CidDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Show CID" Height="410" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<RichTextBox x:Name="TokenOutput" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</RichTextBox.Resources>
<FlowDocument>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
CS
Code:
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
namespace Multi_Explorer.viewmodel.android.fastboottools.htc
{
/// <summary>
/// Interaktionslogik für CidDialog.xaml
/// </summary>
public partial class CidDialog : Window
{
#region Instance
private static CidDialog _instance = null;
public static CidDialog Instance
{
get
{
if (_instance != null)
{
return _instance;
}
else
{
_instance = new CidDialog();
return _instance;
}
}
}
#endregion
public CidDialog()
{
InitializeComponent();
this.Closing += WindowClosing;
App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
}
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
#region Add
public void Add(List<string> msg)
{
foreach (string tmp in msg)
{
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp)));
}
TokenOutput.ScrollToEnd();
}
#endregion
#region Clear
public void Clear()
{
TokenOutput.Document.Blocks.Clear();
}
#endregion
}
}
Usage
Code:
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.ReadCid());
// As window
ciddiag.Show();
// As dialog window (this will freeze the complete application until it's closed)
ciddiag.ShowDialog();
3. Extra Window with ADB/Fastboot instance
XAML
Code:
<Window x:Class="Multi_Explorer.viewmodel.android.fastboottools.htc.CidDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Show CID" Height="410" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<RichTextBox x:Name="TokenOutput" IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</RichTextBox.Resources>
<FlowDocument>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
CS
Code:
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using AndroidCtrl;
using AndroidCtrl.ADB;
using AndroidCtrl.Tools;
using AndroidCtrl.Fastboot;
namespace Multi_Explorer.viewmodel.android.fastboottools.htc
{
/// <summary>
/// Interaktionslogik für CidDialog.xaml
/// </summary>
public partial class CidDialog : Window
{
public CidDialog()
{
InitializeComponent();
this.Closing += WindowClosing;
App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
// If u have a selected device this will work in all sub-windows
Add(Fastboot.Instance().OEM.ReadCid());
}
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
#region Add
public void Add(List<string> msg)
{
foreach (string tmp in msg)
{
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp)));
}
TokenOutput.ScrollToEnd();
}
#endregion
#region Clear
public void Clear()
{
TokenOutput.Document.Blocks.Clear();
}
#endregion
}
}
Usage
Code:
CidDialog ciddiag = CidDialog.Instance;
// Optional
// ciddiag.Add(Fastboot.Instance().OEM.ReadCid());
// As window
ciddiag.Show();
// As dialog window (this will freeze the complete application until it's closed)
ciddiag.ShowDialog();
k1ll3r8e said:
Hey there
There are 3 and more options how u can handle this...
Click to expand...
Click to collapse
Thanks for clarifying! What if i want to get the identifier code? it has multiple strings? how can i choose to show all of them?
EDIT: (More questions! )
Is it possible to use:
Code:
foreach (DataModelDevicesItem device in adbDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// here goes the add command ;)
deviceselector.Items.Add(device);
});
}
foreach (DataModelDevicesItem device in fastbootDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
deviceselector.Items.Add(device);
});
}
to check if the device is in fastboot or adb? e.g
I press a button to flash recovery. i can have my phone in adb or fastboot and it will check to see which it is in. Then it wil lcarry out a specific command?
Hey there
squabbi said:
Thanks for clarifying! What if i want to get the identifier code? it has multiple strings? how can i choose to show all of them?
Click to expand...
Click to collapse
If u mean the HTC-Bootloader unlock code, u can use the described 2 or 3.
(Both window examples have an "foreach loop" to print out each line from the List<string> into the RichTextBox)
If u want also replace the "(bootloader) " tag u can use this line:
Code:
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp.Replace("(bootloader) ", ""))));
just replace it in the CS code with the one in the "foreach loop".
squabbi said:
EDIT: (More questions! )
Is it possible to use:
Code:
foreach (DataModelDevicesItem device in adbDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// here goes the add command ;)
deviceselector.Items.Add(device);
});
}
foreach (DataModelDevicesItem device in fastbootDevices)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
deviceselector.Items.Add(device);
});
}
to check if the device is in fastboot or adb? e.g
Click to expand...
Click to collapse
Yes, so i do it in my projects also.
squabbi said:
I press a button to flash recovery. i can have my phone in adb or fastboot and it will check to see which it is in. Then it wil lcarry out a specific command?
Click to expand...
Click to collapse
For this scenario, u need a function which checks which state have the current device serial. After u have the state ADB or Fastboot, u can call 2 different methods from my dll:
ADB
Code:
// This requires Root in any case!
ADB.Instance().Device.FlashImage(IDDevicePartition partition, string localPath, bool tmpToSD = true, int timeOut = -1);
Fastboot
Code:
Fastboot.Instance().Flash(IDDevicePartition partition, string file, int timeOut = -1);
NOTE
I will build a function which will do the work in the future, next release will include it.
#EDIT:
Release it out
Code:
AndroidCtrl.Tools.General.CheckDeviceState(string deviceID);
// return is a IDDeviceState
Hope this helps
k1ll3r8e said:
Hey there
If u mean the HTC-Bootloader unlock code, u can use the described 2 or 3.
(Both window examples have an "foreach loop" to print out each line from the List<string> into the RichTextBox)
If u want also replace the "(bootloader) " tag u can use this line:
Code:
TokenOutput.Document.Blocks.Add(new Paragraph(new Run(tmp.Replace("(bootloader) ", ""))));
just replace it in the CS code with the one in the "foreach loop".
Yes, so i do it in my projects also.
For this scenario, u need a function which checks which state have the current device serial. After u have the state ADB or Fastboot, u can call 2 different methods from my dll:
ADB
Code:
// This requires Root in any case!
ADB.Instance().Device.FlashImage(IDDevicePartition partition, string localPath, bool tmpToSD = true, int timeOut = -1);
Fastboot
Code:
Fastboot.Instance().Flash(IDDevicePartition partition, string file, int timeOut = -1);
NOTE
I will build a function which will do the work in the future, next release will include it.
#EDIT:
Release it out
Code:
AndroidCtrl.Tools.General.CheckDeviceState(string deviceID);
// return is a IDDeviceState
Hope this helps
Click to expand...
Click to collapse
Hey there!
Im using this for the output:
Code:
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
if (state == IDDeviceState.DEVICE)
{
ADB.Instance().Reboot(IDBoot.BOOTLOADER);
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
else if (state == IDDeviceState.FASTBOOT)
{
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
When I first press the button the output window shows. When I close it and press the button again it gives me this error - even if I wait a couple of seconds.
Thanks for your help! :fingers-crossed::good:
squabbi said:
Hey there!
Im using this for the output:
Code:
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
if (state == IDDeviceState.DEVICE)
{
ADB.Instance().Reboot(IDBoot.BOOTLOADER);
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
else if (state == IDDeviceState.FASTBOOT)
{
CidDialog ciddiag = CidDialog.Instance;
ciddiag.Add(Fastboot.Instance().OEM.GetIdentifierToken());
ciddiag.Show();
}
When I first press the button the output window shows. When I close it and press the button again it gives me this error - even if I wait a couple of seconds.
Thanks for your help! :fingers-crossed::good:
Click to expand...
Click to collapse
Hey there
oh yes, that is my fault
U have to add this to ur Window constructor "CidDialog(){}"
Code:
this.Closing += WindowClosing;
And this is the "WindowClosing method"
Code:
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
Explain
"CidDialog.Instance" create a new instance of the window. But on close the instance will not be set to null. So u can't open it again, coz the system think it's still open.
Hope this helps
#EDIT:
I updated the examples 2 and 3 also.
k1ll3r8e said:
Hey there
oh yes, that is my fault
U have to add this to ur Window constructor "CidDialog(){}"
Code:
this.Closing += WindowClosing;
And this is the "WindowClosing method"
Code:
#region WindowClosing
///<summary>
/// Clean exit
///</summary>
private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
_instance = null;
}
#endregion
Explain
"CidDialog.Instance" create a new instance of the window. But on close the instance will not be set to null. So u can't open it again, coz the system think it's still open.
Hope this helps
#EDIT:
I updated the examples 2 and 3 also.
Click to expand...
Click to collapse
Thanks a lot man! Time to put everything in full motion! ?
Sent from my HTC One_M8 using Tapatalk
squabbi said:
Thanks a lot man! Time to put everything in full motion! ?
Sent from my HTC One_M8 using Tapatalk
Click to expand...
Click to collapse
Np dude
Good Luck!
Hey there! I may be over looking, but where can I use the 'fastboot boot image.img' command?
Thanks!
squabbi said:
Hey there! I may be over looking, but where can I use the 'fastboot boot image.img' command?
Thanks!
Click to expand...
Click to collapse
Hey bro,
I dun implemented it sry... Next build will include it.
Upload starts tonight
Sent from my HTC Sensation using XDA Free mobile app

Categories

Resources