Using Provxml to add accents. - Windows Phone 7 Development and Hacking
I've been trying to add a custom accent to my Focus S. Most tools available don't yet work (advance config is one) but the interlop unlock by using a provxml does work.
I've tried this
Code:
<wap-provisioningdoc>
<characteristic type="Registry">
<characteristic type="HKLM\ControlPanel\Themes\1\Accents">
<parm name="11" value="4286808708" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\0\Accents">
<parm name="11" value="4286808708" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\AccentsDisplayName\ 0409">
<parm name="11" value="Gray" datatype="string" />
</characteristic>
</characteristic>
</wap-provisioningdoc>
and this to eliminate variables
Code:
<wap-provisioningdoc>
<characteristic type="Registry">
<characteristic type="HKLM\ControlPanel\Themes\1\Accents">
<parm name="1" value="-8158588" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\0\Accents">
<parm name="1" value="-8158588" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\AccentsDisplayName\ 0409">
<parm name="1" value="Gray" datatype="string" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\1\Accents">
<parm name="2" value="FF838284" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\0\Accents">
<parm name="2" value="FF838284" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\AccentsDisplayName\ 0409">
<parm name="2" value="Gray" datatype="string" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\1\Accents">
<parm name="3" value="4286808708" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\0\Accents">
<parm name="3" value="4286808708" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\AccentsDisplayName\ 0409">
<parm name="3" value="Gray" datatype="string" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\1\Accents">
<parm name="4" value="0xFF838284" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\0\Accents">
<parm name="4" value="0xFF838284" datatype="integer" />
</characteristic>
<characteristic type="HKLM\ControlPanel\Themes\AccentsDisplayName\ 0409">
<parm name="4" value="Gray" datatype="string" />
</characteristic>
</characteristic>
</wap-provisioningdoc>
but it doesn't work.
Any help would gratefully be appreciated.
Quick question: did you save the file as Unicode? I think the Samsung tools expect Unicode provxml files. Or maybe it's the other way around, I forget.
GoodDayToDie said:
Quick question: did you save the file as Unicode? I think the Samsung tools expect Unicode provxml files. Or maybe it's the other way around, I forget.
Click to expand...
Click to collapse
I edited other provxml files that I know work. I edited them with notepad and with visual studio, lol I've tried everything.
I tried to do this myself when I had a Focus S with no success.
I wonder how Marvin_S's On-Device ProvXML TOOL gets this to work.
Hopefully he can chime in, hopefully he can get the tool working on the Focus S
ManelScout4Life said:
I wonder how Marvin_S's On-Device ProvXML TOOL gets this to work.
Hopefully he can chime in, hopefully he can get the tool working on the Focus S
Click to expand...
Click to collapse
Im using first gen dlls so a small chance it will work... Are u saying anything trough this app worked on the focus s? If non of the default edits work than dont even bother, ill need to update the app for the samsung s than.
Samsung indeed uses Unicode. Otherwise it wont work. Again there are no focus s dlls in there so idk if it will work, but let me know, otherwise I can add a focus s dll.
Marvin_S said:
Im using first gen dlls so a small chance it will work... Are u saying anything trough this app worked on the focus s? If non of the default edits work than dont even bother, ill need to update the app for the samsung s than.
Samsung indeed uses Unicode. Otherwise it wont work. Again there are no focus s dlls in there so idk if it will work, but let me know, otherwise I can add a focus s dll.
Click to expand...
Click to collapse
No, your tool does not work at all on the S, it opens but none of the functions work.
However, I can add provxml files with the filedeployer xaps.
I'm also unsure what the proper provxml file should look like for changing accents.
ManelScout4Life said:
No, your tool does not work at all on the S, it opens but none of the functions work.
However, I can add provxml files with the filedeployer xaps.
I'm also unsure what the proper provxml file should look like for changing accents.
Click to expand...
Click to collapse
As expected.
Very simple just save it in Unicode, than it should work man.
Also if you want to bind it in an app, I've found some native stuff to work with on the Samsung S
Code:
Nevermind
EDIT:
The api is listed here, there might be a way to update the app
EDIT2:
Code:
public void Initialize()
{
ComBridge.RegisterComDll("WirelessManager_SecProxyClient.dll", new Guid("6992E452-12CB-4cb7-A9C8-5CC548159A69"));
this.m_CoClass = new COSecWin32Proxy();
this.m_CoInterface = (ISecProxyWin32Interface) this.m_CoClass;
}
[ComImport, Guid("6992E452-12CB-4cb7-A9C8-5CC548159A69"), ClassInterface(ClassInterfaceType.None)]
public class COSecWin32Proxy
{
}
[ComImport, Guid("2A9C50C0-77AC-4a12-9E26-17395ADF8870"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISecProxyWin32Interface
{
void GetProxyVersion(out uint version);
void Reserved();
void ChekcAPI(uint apiID, out uint result);
void RegistrySetString(uint HKEY, string pwszPath, string valueName, string value);
void RegistryGetString(uint HKEY, string pwszPath, string valueName, out string value);
void RegistrySetDWORD(uint HKEY, string pwszPath, string valueName, uint value);
void RegistryGetDWORD(uint HKEY, string pwszPath, string valueName, out uint value);
void CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, uint dwCreationDisposition, uint dwFlagsAndAttributes, out uint phCreateFile);
void CloseHandle(uint hObject);
void ReadFile(uint hFile, out byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead);
void WriteFile(uint hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten);
void GetFileSize(uint hFile, out uint lpFileSizeHigh);
void CopyFile(string lpExistingFileName, string lpNewFileName, int bFailIfExists);
void DeleteFile(string lpFileName);
void LaunchExe(string szExe, string szArg);
}
Should be the code Ill need to add to the app (not sure if it will work though, ill have to scan the app further).
Marvin_S said:
As expected.
Very simple just save it in Unicode, than it should work man.
Also if you want to bind it in an app, I've found some native stuff to work with on the Samsung S
Code:
namespace Samsung.Phone.Native
{
public class Con
{
// Fields
private COSecCONProxy m_CoClass;
private ISecProxyCONInterface m_CoInterface;
private static Con m_single;
// Methods
static Con();
private Con();
public static void BluetoothCloseAudio();
public static void BluetoothOpenAudio();
public static ISecProxyCONInterface CallInterface();
public ISecProxyCONInterface GetComInterface();
public static Con GetInstance();
public static void GetRadioState(int device, out bool state);
public static void GetWirelessState(out bool state);
public void Initialize();
public static void SetRadioState(int device, bool state);
public static void SetWirelessState(bool state);
public static void WlanGetIpInfo(out string IpAddr, out string Subnet, out string Gateway, out string Dns, out string Wins, out bool DhcpMode);
public static void WlanGetStatus(out string macAddr, out string ssid, out int status, out int rssi, out int security);
public static void WlanSetIpInfo(string IpAddr, string Subnet, string Gateway, string Dns, string Wins, bool DhcpMode);
}
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("3E16DD96-1BB8-4ed4-A74F-EE16307A147E")]
public class COSecCONProxy
{
}
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("89DE267C-9F5A-43f5-895C-B891F0F64C6E")]
public class COSecRILProxy
{
}
[ComImport, Guid("A1EF1A51-6156-4882-A9D3-202881BC7A05"), ClassInterface(ClassInterfaceType.None)]
public class COSecSYSProxy
{
}
[ComImport, Guid("6992E452-12CB-4cb7-A9C8-5CC548159A69"), ClassInterface(ClassInterfaceType.None)]
public class COSecWin32Proxy
{
}
[ComImport, Guid("9ADD1CCA-FB7B-4f31-A496-9FC565DB0272"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISecProxyCONInterface
{
void GetProxyVersion(out uint version);
void Reserved();
void ChekcAPI(uint apiID, out uint result);
void WlanGetIpInfo(out string IpAddr, out string Subnet, out string Gateway, out string Dns, out string Wins, out bool DhcpMode);
void WlanSetIpInfo(string IpAddr, string Subnet, string Gateway, string Dns, string Wins, bool DhcpMode);
void WlanGetStatus(out string macAddr, out string ssid, out int status, out int rssi, out int security);
void SetRadioState(int device, bool state);
void GetRadioState(int device, out bool state);
void SetWirelessState(bool state);
void GetWirelessState(out bool state);
void BluetoothOpenAudio();
void BluetoothCloseAudio();
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("CA785B58-3211-46ee-B2B8-13F0CFA18C17")]
public interface ISecProxyRILInterface
{
void GetProxyVersion(out uint version);
void Reserved();
void ChekcAPI(uint apiID, out uint result);
void GetIMSI(out string IMSI);
void GetIMEI(out string IMEI);
void GetLockingStatus(uint m_dwLockFacility, out uint pdwLockStatus, out uint pdwResult);
void GetCallWaitingStatus(out uint pdwInfoClass, out uint pdwResult);
void SetCallWaitingStatus(uint dwInfoClass, uint dwStatus, out uint pdwResult);
void GetOperatorList([MarshalAs(UnmanagedType.SafeArray)] out byte[] info, out uint pdwCount, out uint pdwResult);
void SetCurrentOperator(uint dwMode, IntPtr info, out uint pdwResult);
void GetCallForwardingSettings(uint dwReason, uint dwAddressID, out uint pdwStatus, out uint pdwNumType, out string pwszAddress, out uint pdwDelayTime, out uint pdwResult);
void AddCallForwardingSettings(uint dwReason, uint dwInfoClass, string wszAddress, uint dwDelayTime, out uint pdwResult);
void RemoveCallForwardingSettings(uint dwReason, uint dwInfoClass, out uint pdwResult);
void RIL_Devspecific2DWORD(uint dwCmdID, out uint pdwParam1, out uint pdwParam2, out uint pdwResult);
void GetCallBarringStatus(uint dwType, uint dwInfoClass, string szPassword, out uint pdwBarringStatus, out uint pdwResult);
void SetCallBarringStatus(uint dwType, uint dwInfoClass, string szPassword, uint dwBarringStatus, out uint pdwResult);
void GetAudioMute(out uint dwEnable);
void SetAudioMute(uint dwEnable);
void Hangup();
void PerformImeiCompare(out string strSalesCode, out uint dwResult, out string strErrorMessage);
void SetLockingStatus(uint m_dwLockFacility, string pPasswd, out uint m_dwStatus, out uint pdwResult);
void CallBlockerUpdateInfo(string pwszUpdatedUserInfo, uint dwOpMode, out uint dwResult);
void GetCBConfig(out uint dwTotal, out uint dwSize, out byte[] lpBuffer);
void SetCBConfig(uint dwTotal, uint dwSize, byte[] lpBuffer);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("E05255E0-ED8F-4898-B3C3-4F8C5E29A2C1")]
public interface ISecProxySYSInterface
{
void ChekcAPI(uint apiID, out uint result);
}
[ComImport, Guid("2A9C50C0-77AC-4a12-9E26-17395ADF8870"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISecProxyWin32Interface
{
void GetProxyVersion(out uint version);
void Reserved();
void ChekcAPI(uint apiID, out uint result);
void RegistrySetString(uint HKEY, string pwszPath, string valueName, string value);
void RegistryGetString(uint HKEY, string pwszPath, string valueName, out string value);
void RegistrySetDWORD(uint HKEY, string pwszPath, string valueName, uint value);
void RegistryGetDWORD(uint HKEY, string pwszPath, string valueName, out uint value);
void CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, uint dwCreationDisposition, uint dwFlagsAndAttributes, out uint phCreateFile);
void CloseHandle(uint hObject);
void ReadFile(uint hFile, out byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead);
void WriteFile(uint hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten);
void GetFileSize(uint hFile, out uint lpFileSizeHigh);
void CopyFile(string lpExistingFileName, string lpNewFileName, int bFailIfExists);
void DeleteFile(string lpFileName);
void LaunchExe(string szExe, string szArg);
}
public class RIL
{
// Fields
private COSecRILProxy m_CoClass;
private ISecProxyRILInterface m_CoInterface;
private static RIL m_single;
// Methods
static RIL();
private RIL();
public static void AddCallForwardingSettings(uint dwReason, uint dwInfoClass, string wszAddress, uint dwDelayTime, out uint pdwResult);
public static void CallBlockerUpdateInfo(string pwszUpdatedUserInfo, uint dwOpMode, out uint dwResult);
public static ISecProxyRILInterface CallInterface();
public static void GetAudioMute(out uint dwEnable);
public static void GetCallBarringStatus(uint dwType, uint dwInfoClass, string szPassword, out uint pdwBarringStatus, out uint pdwResult);
public static void GetCallForwardingSettings(uint dwReason, uint dwAddressID, out uint pdwStatus, out uint pdwNumType, out string pwszAddress, out uint pdwDelayTime, out uint pdwResult);
public static void GetCallWaitingStatus(out uint pdwInfoClass, out uint pdwResult);
public ISecProxyRILInterface GetComInterface();
public static void GetIMEI(out string IMEI);
public static void GetIMSI(out string IMSI);
public static RIL GetInstance();
public static void GetLockingStatus(uint m_dwLockFacility, out uint pdwLockStatus, out uint pdwResult);
public static void GetOperatorList(out byte[] info, out uint pdwCount, out uint pdwResult);
public void Initialize();
public static void PerformImeiCompare(out string strSalesCode, out uint dwResult, out string strErrorMessage);
public static void RemoveCallForwardingSettings(uint dwReason, uint dwInfoClass, out uint pdwResult);
public static void RIL_Devspecific2DWORD(uint dwCmdID, out uint pdwParam1, out uint pdwParam2, out uint pdwResult);
public static void SetAudioMute(uint dwEnable);
public static void SetCallBarringStatus(uint dwType, uint dwInfoClass, string szPassword, uint dwBarringStatus, out uint pdwResult);
public static void SetCallWaitingStatus(uint dwInfoClass, uint dwStatus, out uint pdwResult);
public static void SetCurrentOperator(uint dwMode, IntPtr info, out uint pdwResult);
}
public class RilCBMsgConfig
{
// Fields
public uint cbSize;
public List<RILRANGE> channelList;
public uint dwBroadcastMsgLangs;
public uint dwParams;
public bool fAccept;
// Methods
public RilCBMsgConfig();
public void AddChannel(RILRANGE range);
public bool Contains(RILRANGE range);
public uint GetCbSize();
public RILCBMSGCONFIG GetConfigStruct();
public static RILRANGE GetRange(int channel);
public static byte[] MakeRawData(RilCBMsgConfig cbConfg);
public static RilCBMsgConfig ParseData(uint total, uint size, byte[] rawData);
public override string ToString();
// Nested Types
[StructLayout(LayoutKind.Sequential)]
public struct RILCBMSGCONFIG
{
public uint cbSize;
public uint dwParams;
public uint dwBroadcastMsgLangs;
public bool fAccept;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public byte[] channelList;
}
[StructLayout(LayoutKind.Sequential)]
public struct RILRANGE
{
public uint dwMin;
public uint dwMax;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct RILOPERATORNAMES
{
public uint cbSize;
public uint dwParams;
public string szLongName;
public string szShortName;
public string szNumName;
public string szCountryCode;
}
public class Sys
{
// Fields
private COSecSYSProxy m_CoClass;
private ISecProxySYSInterface m_CoInterface;
private static Sys m_single;
// Methods
static Sys();
private Sys();
public static ISecProxySYSInterface CallInterface();
public ISecProxySYSInterface GetComInterface();
public static Sys GetInstance();
public void Initialize();
}
public class Win32
{
// Fields
public static uint CREATE_ALWAYS;
public static uint CREATE_NEW;
public static uint FILE_ATTRIBUTE_ARCHIVE;
public static uint FILE_ATTRIBUTE_COMPRESSED;
public static uint FILE_ATTRIBUTE_DIRECTORY;
public static uint FILE_ATTRIBUTE_ENCRYPTED;
public static uint FILE_ATTRIBUTE_HIDDEN;
public static uint FILE_ATTRIBUTE_INROM;
public static uint FILE_ATTRIBUTE_NORMAL;
public static uint FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
public static uint FILE_ATTRIBUTE_OFFLINE;
public static uint FILE_ATTRIBUTE_READONLY;
public static uint FILE_ATTRIBUTE_REPARSE_POINT;
public static uint FILE_ATTRIBUTE_ROMMODULE;
public static uint FILE_ATTRIBUTE_ROMSTATICREF;
public static uint FILE_ATTRIBUTE_SPARSE_FILE;
public static uint FILE_ATTRIBUTE_SYSTEM;
public static uint FILE_ATTRIBUTE_TEMPORARY;
public static uint FILE_FLAG_BACKUP_SEMANTICS;
public static uint FILE_FLAG_DELETE_ON_CLOSE;
public static uint FILE_FLAG_NO_BUFFERING;
public static uint FILE_FLAG_OVERLAPPED;
public static uint FILE_FLAG_POSIX_SEMANTICS;
public static uint FILE_FLAG_RANDOM_ACCESS;
public static uint FILE_FLAG_SEQUENTIAL_SCAN;
public static uint FILE_FLAG_WRITE_THROUGH;
public static uint FILE_SHARE_DELETE;
public static uint FILE_SHARE_READ;
public static uint FILE_SHARE_WRITE;
public static uint GENERIC_ALL;
public static uint GENERIC_EXECUTE;
public static uint GENERIC_READ;
public static uint GENERIC_WRITE;
public static uint HKEY_CLASSES_ROOT;
public static uint HKEY_CURRENT_USER;
public static uint HKEY_LOCAL_MACHINE;
public static uint HKEY_USERS;
private COSecWin32Proxy m_CoClass;
private ISecProxyWin32Interface m_CoInterface;
private static Win32 m_single;
public static uint MODULE_ATTR_NODEBUG;
public static uint MODULE_ATTR_NOT_TRUSTED;
public static uint OPEN_ALWAYS;
public static uint OPEN_EXISTING;
public static uint OPEN_FOR_LOADER;
public static string REG_WM_BUSY_FLAG;
public static string REG_WM_GPRS_ALWAYSON;
public static string REG_WM_GPRS_APN;
public static string REG_WM_GPRS_AUTH_TYPE;
public static string REG_WM_GPRS_NAME;
public static string REG_WM_GPRS_PASSWORD;
public static string REG_WM_GPRS_PROFILES_TO_DELETE;
public static string REG_WM_GPRS_UNAME;
public static string REG_WM_MMS_APN;
public static string REG_WM_MMS_MMSC;
public static string REG_WM_MMS_MSGSIZE;
public static string REG_WM_MMS_NAME;
public static string REG_WM_MMS_PROFILES_TO_DELETE;
public static string REG_WM_MMS_PROXY;
public static string REG_WM_PROXY_ADDR;
public static string REG_WM_PROXY_APN;
public static string REG_WM_PROXY_DOMAIN;
public static string REG_WM_PROXY_NAME;
public static string REG_WM_PROXY_PORT;
public static string REG_WM_PROXY_PROFILES_TO_DELETE;
public static string REG_WM_ROOT;
public static uint TRUNCATE_EXISTING;
// Methods
static Win32();
private Win32();
public static ISecProxyWin32Interface CallInterface();
public static void CloseHandle(uint hObject);
public static void CopyFile(string lpExistingFileName, string lpNewFileName, int bFailIfExists);
public static void CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, uint dwCreationDisposition, uint dwFlagsAndAttributes, out uint phCreateFile);
public static void DeleteFile(string lpFileName);
public ISecProxyWin32Interface GetComInterface();
public static void GetFileSize(uint hFile, out uint lpFileSizeHigh);
public static Win32 GetInstance();
public void Initialize();
public static void LaunchExe(string szExe, string szArg);
public static void ReadFile(uint hFile, out byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead);
public static void RegistryGetDWORD(uint HKEY, string pwszPath, string valueName, out uint value);
public static void RegistryGetString(uint HKEY, string pwszPath, string valueName, out string value);
public static void RegistrySetDWORD(uint HKEY, string pwszPath, string valueName, uint value);
public static void RegistrySetString(uint HKEY, string pwszPath, string valueName, string value);
public static void WriteFile(uint hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten);
}
}
It seems the API I need to make DiagProvXML work is still there. I might give it an update to support the Focus S (also Focus W & co.)
Ill need somebody with a Focus S to test it for me also.
Click to expand...
Click to collapse
I can test it but which one of the codes in the opening post is done correctly?
@Marvin_S: If you do a search you can find my post from a couple weeks back with various tests for the Samsung gen2 DLLs. They are indeed different from the gen1 DLLs, but offer a lot of exciting new capabilities. Unfortunately, there's also some kind of check or block on third-party use of the DLLs. I'm not yet sure exactly what caused it to not work. I'm still working on that, though.
EDIT: You've been able to make that work? My test app either produced an error message (file not found, of all things) or simply crashed each time I tried to use one of those APIs.
GoodDayToDie said:
@Marvin_S: If you do a search you can find my post from a couple weeks back with various tests for the Samsung gen2 DLLs. They are indeed different from the gen1 DLLs, but offer a lot of exciting new capabilities. Unfortunately, there's also some kind of check or block on third-party use of the DLLs. I'm not yet sure exactly what caused it to not work. I'm still working on that, though.
EDIT: You've been able to make that work? My test app either produced an error message (file not found, of all things) or simply crashed each time I tried to use one of those APIs.
Click to expand...
Click to collapse
No, untested, just inspected the samsung xap. I already assumed it would not work, but I posted it here for future reference for myself.
Ah too bad, can you call any api at all? For example the launchexe? it seems like they renamed rapiconfig.exe into ConfigXML.exe (or maybe rapiconfig is still there) it seems that ConfigXML.exe does not accept raw xml indeed but rather canned commands.
I included the source for the app, so feel free to take a look (and read the thread of tester comments, since I don't have a suitable device for testing).
Registry access: failed.
Filesystem access (yes the new DLLs seem to offer it): failed.
Provxml: failed
Other, trivial things: failed.
The OEM apps all contain a file simply called "_" which is a simple text file containing hex data as a string. I suspect the problems may be related to this file. If it's some kind of signature, that's going to be very hard to fake.
Here is the test app and source
[XAP][SOURCE][MANGO] Samsung gen2 interop test app v2
Any news from anyone?
Related
[Q] How to tap into CoreDLL.DLL GetSystemPowerStatusEx2 ?
Hi all, none of the currently existing battery current (mA) meters for WindowsMobile make me really happy: acbPower, PowerMonitor 1.05, some Mortscripts... I'd rather try to write something on my own to record and store the power usage profile, plot it somehow, do runtime prediction etc. Apparently the data comes from CoreDLL.DLL, esp GetSystemPowerStatusEx2. The registry only stores the remaining capacity, which is of low interest to me. Neither Mortscript nor Basic4PPC seem to able to tap into the functions of this CoreDLL, Are there 'wrapper' tools to expose these functions to them somehow? How to I skin this cat? Is there a way to embed the DLL and functions into Basic4PPC somehow? May need complex SDK tools or something, maybe out of my league? I found the following code sniplet, probably .NET (VisualBasic, VIsualC?), but don't know how to convert it to use it in Basic4PPC, NSBasic or else? Any ideas, suggestions - thanks! m [DllImport("coredll.dll", EntryPoint = "GetSystemPowerStatusEx2", SetLastError = true)] private static extern uint GetSystemPowerStatusEx2(_SYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx2, uint dwLen, bool fUpdate); public bool MS_GetSystemPowerStatusEx2() { bool ret_value = false; if (MSAPIWrapperStart == false) { return true; } if (GetSystemPowerStatusEx2(SystemPowerStatusEX2, (uint)Marshal.SizeOf(typeof(_SYSTEM_POWER_STATUS_E X2)), false) != 0) { ret_value = true; } return ret_value; } public struct _SYSTEM_POWER_STATUS_EX2 { public byte ACLineStatus; public byte BatteryFlag; public byte BatteryLifePercent; public byte Reserved1; public uint BatteryLifeTime; public uint BatteryFullLifeTime; public byte Reserved2; public byte BackupBatteryFlag; public byte BackupBatteryLifePercent; public byte Reserved3; public uint BackupBatteryLifeTime; public uint BackupBatteryFullLifeTime; public uint BatteryVoltage; public uint BatteryCurrent; public uint BatteryAverageCurrent; public uint BatteryAverageInterval; public uint BatterymAHourConsumed; public uint BatteryTemperature; public uint BackupBatteryVoltage; public byte BatteryChemistry; [MarshalAs(UnmanagedType.ByValArray, SizeConst=128)] public byte[] ExtraInfo; } private _SYSTEM_POWER_STATUS_EX2 SystemPowerStatusEX2; SystemPowerStatusEX2 = new _SYSTEM_POWER_STATUS_EX2();
XClasses - A Xposed Library
Hello guys, I want to share my library XClasses. My idea was to see every XClass as an extension of the original class. My aim was to improve the user experience during the development. Also I wanted to increase the readability of xposed code. So it's nothing special. It's just my personal opinion how readable code should look like. A small example: Code: public class XposedMain implements IXposedHookLoadPackage { @Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { if(lpparam.packageName.equals("com.android.systemui")) { XposedHelpers.findAndHookMethod(TextView.class, "setText", CharSequence.class, TextView.BufferType.class, boolean.class, int.class, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { TextView tv = (TextView)param.thisObject; CharSequence text = (CharSequence)param.args[0]; TextView.BufferType type = (TextView.BufferType)param.args[1]; boolean notifyBefore = (Boolean)param.args[2]; int oldlen = (Integer)param.args[3]; XposedBridge.log("setText "+text+" with size "+tv.getTextSize()); } }); } } } The same code with XClasses: Code: // class 1 public class XposedMain implements IXposedHookLoadPackage { @Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { if(lpparam.packageName.equals("com.android.systemui")) { setup(lpparam.classLoader); hook(XTextView.class); } } } // class 2 public class XTextView extends AbstractXClass<TextView> { public static String getOriginalClassName() { return TextView.class.getCanonicalName(); } public XTextView(TextView objectThis) { super(objectThis); } @BeforeOriginalMethod private void setText_Before(CharSequence text, TextView.BufferType type, boolean notifyBefore, int oldlen) throws Throwable { XposedBridge.log("setText "+text+" with size "+getThis().getTextSize()); } } If you would like to know more you should visit the following site: https://github.com/seebye/XClasses Regards, Seebye
Getting java.lang.NoSuchFieldError with getXXXField
Hi, I have hooked into afterHookedMethod to read some fields from an object but I'm getting java.lang.NoSuchFieldError and I don't understand why. Say I have these files: Code: package com.android.demo; public class Bar { public boolean mBoolean; public Bar() { mBoolean = false; } } Code: package com.android.sample; public class Foo { Bar getBar() { Bar bar = new Bar(); bar.mBoolean = true; return bar; } } And my Xposed hook: Code: findAndHookMethod( "com.android.sample", lpparam.classLoader, "getBar", new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { // This is supposed to be `bar`, right? Object result = param.getResult(); // Throws java.lang.NoSuchFieldError: com.android.demo.Bar#mBoolean Log.d(TAG, "mBoolean: " + String.valueOf(getBooleanField(result, "mBoolean"))); // In the end this is what I'm trying to do... //setBooleanField(result, "mBoolean", false); //Log.d(TAG, "mBoolean: " + String.valueOf(getBooleanField(result, "mBoolean"))); //param.setResult(result); } } ); One thing that I should mention is that the real code I'm trying to change is obfuscated with Proguard. But I decoded it and looked for the method name - which was just "f" and use that instead of "getBar". I know I got the method name right because the error outputs the package name and class name correctly for the result object which is not obfuscated. And I'm sure this object has many public fields, but I can't access (or change for that matter) any of them without an exception being thrown. What am I missing?
Whenever I've used this method, the first parameter has been the instance of the class (param.thisObject). I'm curious to know if it's possible to make it work the way you're trying to do with param.getResult(). But if you hook the constructor of the Bar class and try getObjectField with (param.thisObject, mBoolean) it should work.
PunchUp said: Whenever I've used this method, the first parameter has been the instance of the class (param.thisObject). I'm curious to know if it's possible to make it work the way you're trying to do with param.getResult(). But if you hook the constructor of the Bar class and try getObjectField with (param.thisObject, mBoolean) it should work. Click to expand... Click to collapse Maybe, but I'm not sure that allows me to achieve my end goal... To be more specific, I'm trying to change the result of this: https://github.com/android/platform...rc/com/android/email/SecurityPolicy.java#L120
Tried something simpler: Code: findAndHookMethod( "com.android.emailcommon.provider.Policy", lpparam.classLoader, "a", "android.database.Cursor", new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { Log.d(TAG, "mPasswordMode = " + String.valueOf(XposedHelpers.getIntField(param.thisObject, "mPasswordMode"))); } } ); Got this: Code: 06-28 21:45:11.133 7201-7824/? E/Xposed: java.lang.NoSuchFieldError: com.android.emailcommon.provider.Policy#mPasswordMode I don't understand what I'm missing...
I feel like an idiot... I've been focusing on the methods and the fact that they are obfuscated that I forgot that the instance variables also are obfuscated. It makes perfect sense now why none of this was working... Back to the drawing board.
Great Your question made me learn something new
PunchUp said: Great Your question made me learn something new Click to expand... Click to collapse Cool But what was that? Save
KeyDef.smali - How to edit Hardware buttons
I'm working on that http://forum.xda-developers.com/android-auto/android-head-units/identify-head-unit-apps-kk-4-4-4-t3446989 to edit main files. I am now trying to change hardware buttons to use "back, home key" or "Music player activity"... Is that the right file? This is what I decompiled from Ts8317_media.apk (which controls, DVD, CD, USB, SD activities) : Ts8317_media.apk/smali/com/yyw/ts90xhw/KeyDef.smali Code: .class public Lcom/yyw/ts90xhw/KeyDef; .super Ljava/lang/Object; .source "KeyDef.java" # static fields .field public static final EKEY_TUNDEC:I = 0x203 .field public static final EKEY_TUNINC:I = 0x204 .field public static final EKEY_VOLDN:I = 0x201 .field public static final EKEY_VOLUP:I = 0x202 .field public static final PKEY_0:I = 0x1f .field public static final PKEY_1:I = 0x20 .field public static final PKEY_2:I = 0x21 .field public static final PKEY_3:I = 0x22 .field public static final PKEY_4:I = 0x23 .field public static final PKEY_5:I = 0x24 .field public static final PKEY_6:I = 0x25 .field public static final PKEY_7:I = 0x26 .field public static final PKEY_8:I = 0x27 .field public static final PKEY_9:I = 0x28 .field public static final PKEY_AM:I = 0x35 .field public static final PKEY_AMS:I = 0x3a .field public static final PKEY_ANGLEDN:I = 0x4a .field public static final PKEY_ANGLEUP:I = 0x49 .field public static final PKEY_AUX:I = 0x2 .field public static final PKEY_AVIN:I = 0x3 .field public static final PKEY_BKL:I = 0x6 .field public static final PKEY_BT:I = 0x17 .field public static final PKEY_CLOCK:I = 0x5 .field public static final PKEY_DELETE:I = 0x54 .field public static final PKEY_DIM:I = 0x18 .field public static final PKEY_DIMDN:I = 0x58 .field public static final PKEY_DIMUP:I = 0x57 .field public static final PKEY_DISP:I = 0x55 .field public static final PKEY_DN:I = 0x43 .field public static final PKEY_DTV:I = 0x1 .field public static final PKEY_DVD:I = 0xd .field public static final PKEY_DVR:I = 0x1b .field public static final PKEY_ECAR:I = 0x59 .field public static final PKEY_EJECT:I = 0x47 .field public static final PKEY_EJECT_L:I = 0x53 .field public static final PKEY_ENT:I = 0x15 .field public static final PKEY_EQ:I = 0x11 .field public static final PKEY_FAV:I = 0x56 .field public static final PKEY_FCAM:I = 0x1a .field public static final PKEY_FF:I = 0x2e .field public static final PKEY_FM:I = 0x34 .field public static final PKEY_FMAM:I = 0x33 .field public static final PKEY_FR:I = 0x2f .field public static final PKEY_IPOD:I = 0x19 .field public static final PKEY_J:I = 0x29 .field public static final PKEY_LEFT:I = 0x44 .field public static final PKEY_LOC:I = 0x37 .field public static final PKEY_LOUD:I = 0x12 .field public static final PKEY_MEDIA:I = 0x1c .field public static final PKEY_MEDIA_PP:I = 0x3c .field public static final PKEY_MEDIA_RDM:I = 0x3d .field public static final PKEY_MEDIA_RPT:I = 0x3e .field public static final PKEY_MEDIA_SCAN:I = 0x3f .field public static final PKEY_MEDIA_SEARCH:I = 0x41 .field public static final PKEY_MEDIA_STOP:I = 0x40 .field public static final PKEY_MENU:I = 0x8 .field public static final PKEY_MODE:I = 0xa .field public static final PKEY_MUTE:I = 0x10 .field public static final PKEY_NAVI:I = 0xb .field public static final PKEY_NEXT:I = 0x2c .field public static final PKEY_OPEN:I = 0x48 .field public static final PKEY_PAUSE:I = 0x5b .field public static final PKEY_PLAY:I = 0x5a .field public static final PKEY_POWER:I = 0x46 .field public static final PKEY_POWER_OFF:I = 0x52 .field public static final PKEY_POWER_ON:I = 0x51 .field public static final PKEY_PRE:I = 0x2d .field public static final PKEY_RADIO:I = 0xc .field public static final PKEY_RADIO_1S:I = 0x4b .field public static final PKEY_RADIO_2S:I = 0x4c .field public static final PKEY_RADIO_3S:I = 0x4d .field public static final PKEY_RADIO_4S:I = 0x4e .field public static final PKEY_RADIO_5S:I = 0x4f .field public static final PKEY_RADIO_6S:I = 0x50 .field public static final PKEY_RADIO_BAND:I = 0x2b .field public static final PKEY_RADIO_SCAN:I = 0x3b .field public static final PKEY_RDS_AF:I = 0x30 .field public static final PKEY_RDS_PTY:I = 0x32 .field public static final PKEY_RDS_TA:I = 0x31 .field public static final PKEY_RETURN:I = 0x16 .field public static final PKEY_RIGHT:I = 0x45 .field public static final PKEY_SD:I = 0xf .field public static final PKEY_SET:I = 0x7 .field public static final PKEY_ST:I = 0x36 .field public static final PKEY_TELCALLOF:I = 0x1e .field public static final PKEY_TELCALLON:I = 0x1d .field public static final PKEY_TOUCH:I = 0x9 .field public static final PKEY_TUNEDEC:I = 0x39 .field public static final PKEY_TUNEINC:I = 0x38 .field public static final PKEY_TV:I = 0x4 .field public static final PKEY_UP:I = 0x42 .field public static final PKEY_USB:I = 0xe .field public static final PKEY_VIEW360:I = 0x5c .field public static final PKEY_VOLDN:I = 0x14 .field public static final PKEY_VOLUP:I = 0x13 .field public static final PKEY_X:I = 0x2a .field public static final RKEY_0:I = 0x113 .field public static final RKEY_1:I = 0x114 .field public static final RKEY_2:I = 0x115 .field public static final RKEY_3:I = 0x116 .field public static final RKEY_4:I = 0x117 .field public static final RKEY_5:I = 0x118 .field public static final RKEY_6:I = 0x119 .field public static final RKEY_7:I = 0x11a .field public static final RKEY_8:I = 0x11b .field public static final RKEY_9:I = 0x11c .field public static final RKEY_AMS:I = 0x127 .field public static final RKEY_ANGLEDN:I = 0x13e .field public static final RKEY_ANGLEUP:I = 0x13d .field public static final RKEY_BAND:I = 0x107 .field public static final RKEY_BKL:I = 0x102 .field public static final RKEY_CMMB_PBC:I = 0x139 .field public static final RKEY_DN:I = 0x122 .field public static final RKEY_DVD:I = 0x108 .field public static final RKEY_EJECT:I = 0x13b .field public static final RKEY_EJECT_L:I = 0x14e .field public static final RKEY_ENTER:I = 0x130 .field public static final RKEY_EQ:I = 0x10c .field public static final RKEY_FF:I = 0x125 .field public static final RKEY_FR:I = 0x126 .field public static final RKEY_J:I = 0x11d .field public static final RKEY_LEFT:I = 0x120 .field public static final RKEY_LOC:I = 0x12a .field public static final RKEY_LOUD:I = 0x10d .field public static final RKEY_MEDIA_10:I = 0x142 .field public static final RKEY_MEDIA_ANGLE:I = 0x131 .field public static final RKEY_MEDIA_AUDIO:I = 0x133 .field public static final RKEY_MEDIA_GOTO:I = 0x12f .field public static final RKEY_MEDIA_MENU:I = 0x134 .field public static final RKEY_MEDIA_OSD:I = 0x138 .field public static final RKEY_MEDIA_PP:I = 0x12b .field public static final RKEY_MEDIA_PROG:I = 0x141 .field public static final RKEY_MEDIA_RDM:I = 0x12c .field public static final RKEY_MEDIA_RPT:I = 0x12d .field public static final RKEY_MEDIA_SCAN:I = 0x12e .field public static final RKEY_MEDIA_SEL:I = 0x137 .field public static final RKEY_MEDIA_SLOW:I = 0x140 .field public static final RKEY_MEDIA_STOP:I = 0x13f .field public static final RKEY_MEDIA_SUBT:I = 0x136 .field public static final RKEY_MEDIA_TITLE:I = 0x132 .field public static final RKEY_MEDIA_ZOOM:I = 0x135 .field public static final RKEY_MENU:I = 0x103 .field public static final RKEY_MODE:I = 0x105 .field public static final RKEY_MUTE:I = 0x10b .field public static final RKEY_NAVI:I = 0x106 .field public static final RKEY_NEXT:I = 0x123 .field public static final RKEY_OPEN:I = 0x13c .field public static final RKEY_POWER:I = 0x13a .field public static final RKEY_POWER_OFF:I = 0x14d .field public static final RKEY_POWER_ON:I = 0x14c .field public static final RKEY_PRE:I = 0x124 .field public static final RKEY_RADIO_1S:I = 0x143 .field public static final RKEY_RADIO_2S:I = 0x144 .field public static final RKEY_RADIO_3S:I = 0x145 .field public static final RKEY_RADIO_4S:I = 0x146 .field public static final RKEY_RADIO_5S:I = 0x147 .field public static final RKEY_RADIO_6S:I = 0x148 .field public static final RKEY_RADIO_SCAN:I = 0x128 .field public static final RKEY_RDS_AF:I = 0x149 .field public static final RKEY_RDS_PTY:I = 0x14b .field public static final RKEY_RDS_TA:I = 0x14a .field public static final RKEY_RETURN:I = 0x110 .field public static final RKEY_RIGHT:I = 0x11f .field public static final RKEY_SD:I = 0x10a .field public static final RKEY_SET:I = 0x101 .field public static final RKEY_ST:I = 0x129 .field public static final RKEY_TELCALLOF:I = 0x112 .field public static final RKEY_TELCALLON:I = 0x111 .field public static final RKEY_TOUCH:I = 0x104 .field public static final RKEY_UP:I = 0x121 .field public static final RKEY_USB:I = 0x109 .field public static final RKEY_VOLDEC:I = 0x10f .field public static final RKEY_VOLINC:I = 0x10e .field public static final RKEY_X:I = 0x11e .field public static final SKEY_CALLDN_1:I = 0x333 .field public static final SKEY_CALLDN_2:I = 0x334 .field public static final SKEY_CALLDN_3:I = 0x335 .field public static final SKEY_CALLDN_4:I = 0x336 .field public static final SKEY_CALLDN_5:I = 0x337 .field public static final SKEY_CALLUP_1:I = 0x32e .field public static final SKEY_CALLUP_2:I = 0x32f .field public static final SKEY_CALLUP_3:I = 0x330 .field public static final SKEY_CALLUP_4:I = 0x331 .field public static final SKEY_CALLUP_5:I = 0x332 .field public static final SKEY_CHDN_1:I = 0x31f .field public static final SKEY_CHDN_2:I = 0x320 .field public static final SKEY_CHDN_3:I = 0x321 .field public static final SKEY_CHDN_4:I = 0x322 .field public static final SKEY_CHDN_5:I = 0x323 .field public static final SKEY_CHUP_1:I = 0x31a .field public static final SKEY_CHUP_2:I = 0x31b .field public static final SKEY_CHUP_3:I = 0x31c .field public static final SKEY_CHUP_4:I = 0x31d .field public static final SKEY_CHUP_5:I = 0x31e .field public static final SKEY_MODE_1:I = 0x329 .field public static final SKEY_MODE_2:I = 0x32a .field public static final SKEY_MODE_3:I = 0x32b .field public static final SKEY_MODE_4:I = 0x32c .field public static final SKEY_MODE_5:I = 0x32d .field public static final SKEY_MUTE_1:I = 0x324 .field public static final SKEY_MUTE_2:I = 0x325 .field public static final SKEY_MUTE_3:I = 0x326 .field public static final SKEY_MUTE_4:I = 0x327 .field public static final SKEY_MUTE_5:I = 0x328 .field public static final SKEY_NAVI_1:I = 0x33d .field public static final SKEY_NAVI_2:I = 0x33e .field public static final SKEY_NAVI_3:I = 0x33f .field public static final SKEY_NAVI_4:I = 0x340 .field public static final SKEY_NAVI_5:I = 0x341 .field public static final SKEY_POWEWR_1:I = 0x301 .field public static final SKEY_POWEWR_2:I = 0x302 .field public static final SKEY_POWEWR_3:I = 0x303 .field public static final SKEY_POWEWR_4:I = 0x304 .field public static final SKEY_POWEWR_5:I = 0x305 .field public static final SKEY_PP_1:I = 0x338 .field public static final SKEY_PP_2:I = 0x339 .field public static final SKEY_PP_3:I = 0x33a .field public static final SKEY_PP_4:I = 0x33b .field public static final SKEY_PP_5:I = 0x33c .field public static final SKEY_SEEKDN_1:I = 0x315 .field public static final SKEY_SEEKDN_2:I = 0x316 .field public static final SKEY_SEEKDN_3:I = 0x317 .field public static final SKEY_SEEKDN_4:I = 0x318 .field public static final SKEY_SEEKDN_5:I = 0x319 .field public static final SKEY_SEEKUP_1:I = 0x310 .field public static final SKEY_SEEKUP_2:I = 0x311 .field public static final SKEY_SEEKUP_3:I = 0x312 .field public static final SKEY_SEEKUP_4:I = 0x313 .field public static final SKEY_SEEKUP_5:I = 0x314 .field public static final SKEY_VOLDN_1:I = 0x30b .field public static final SKEY_VOLDN_2:I = 0x30c .field public static final SKEY_VOLDN_3:I = 0x30d .field public static final SKEY_VOLDN_4:I = 0x30e .field public static final SKEY_VOLDN_5:I = 0x30f .field public static final SKEY_VOLUP_1:I = 0x306 .field public static final SKEY_VOLUP_2:I = 0x307 .field public static final SKEY_VOLUP_3:I = 0x308 .field public static final SKEY_VOLUP_4:I = 0x309 .field public static final SKEY_VOLUP_5:I = 0x30a # direct methods .method public constructor <init>()V .locals 0 .prologue .line 3 invoke-direct {p0}, Ljava/lang/Object;-><init>()V return-void .end method The head unit I am working on has the hardware keys/buttons below: Volume knob (round) Phone key Power Eject Prev Next Eject DIMM (Shuts of screen) BAND (RADIO) NAV (Navigation app) SET (OEM Factory Settings)
Casting and reflection issues in a method argument. okhttp3.OkHttpClient$Builder;->addInterceptor(···)
Hi guys, I'm trying to hook the constructor of Java: okhttp3.OkHttpClient$Builder in order to add an interceptor that converts any OkHttp call into a curl call and log it (see https://github.com/mrmike/Ok2Curl by MrMike). But I'm having problems with reflection, say I must haven't understood it pretty well... The idea is to call Java: .addInterceptor(okhttp3.Interceptor) method JUST after the Java: OkHttpClient$Builder instance has been constructed, but it's more painful than expected. (See code and code comments for further details) Java: @Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { Class builderClass = XposedHelpers.findClassIfExists("okhttp3.OkHttpClient$Builder", lpparam.classLoader); if(builderClass != null){ XposedBridge.hookAllConstructors(builderClass, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { CurlInterceptor interceptor = new CurlInterceptor(new Loggable() { @Override public void log(String message) { Log.v("Ok2Curl", message); } }); /* Attempt nº1: Cannot do it this way, it throws an exception because there's not (and there's actually not) a method 'okhttp3.OkHttpClient$Builder#addInterceptor(CurlInterceptor)' since CurlInterceptor is from the Ok2Curl library. Maybe the '.callMethod()' cannot make implicit casting? */ Object attempt1 = XposedHelpers.callMethod(param.thisObject, "addInterceptor", interceptor); /* Attempt nº2: Declaring explicitly the argument classes that addInterceptor(···) has, does not help. I get an exception: it could not find an ".addInterceptor(java.lang.Class, ...CurlInterceptor)" method, so this means Interceptor.class was taken as one of the method arguments and not as an argument type. Anyways, given the results from attempt 1, it seems that .callMethod() will not do implicit casting whatsoever... */ Object attempt2 = XposedHelpers.callMethod(param.thisObject, "addInterceptor", Interceptor.class, interceptor); /* Attempt nº3: Explicit casting from CurlInterceptor to okhttp3.Interceptor did not help... java.lang.NoSuchMethodError: okhttp3.OkHttpClient$Builder#addInterceptor(com.moczul.ok2curl.CurlInterceptor)#bestmatch */ Object attempt3 = XposedHelpers.callMethod(param.thisObject, "addInterceptor", (okhttp3.Interceptor) interceptor); } }); } } Thanks in advance!