Hard Reset programmatically corrupts microSD - Windows Mobile Software Development

I just got my Treo and noting the lack of a software reset (the need to use the stylus on the reset button really annoys me), I decided to build my own.
The Reset and Suspend part of my little program works like a charm and then I decided to improve a little more and add a Hard Reset feature, which would restore the device to its factory settings.
Searching high and low on the net I found two possible ways. The first one involved calling SetCleanRebootFlag() and then reset the device.
Code:
[DllImport("coredll.dll", SetLastError=true)]
public static extern void SetCleanRebootFlag();
[DllImport("coredll.dll", SetLastError=true)]
private static extern int SetSystemPowerState(IntPtr psState, PowerStateFlags flags, uint Options);
[DllImport("coredll.dll", SetLastError=true)]
private static extern bool KernelIoControl(int dwIoControlCode, IntPtr inBuf, int inBufSize, IntPtr outBuf, int outBufSize, ref int bytesReturned);
public static void SoftReset()
{
if (SetSystemPowerState(IntPtr.Zero, PowerStateFlags.Reset, 0x1000) != 0)
{
int bytesReturned = 0;
if (!KernelIoControl(0x101003c, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
}
}
public static void HardReset()
{
SetCleanRebootFlag();
SoftReset();
}
The other involved using the ConfigurationManager to process a XML that would perform a "RemoteWipe".
Code:
public static void HardReset()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<wap-provisioningdoc><characteristic type='RemoteWipe'><parm name='doWipe' value='1'/></characteristic></wap-provisioningdoc>");
ConfigurationManager.ProcessConfiguration(doc, true);
}
The first method didn't work because after Windows Mobile 5 it ignores the CleanBootFlag; the second method worked... too much.
It corrupted the microSD on the device to the point that it needed to be reformatted in order to be recognized again.
Does anyone had any experience with that?

Related

Device Power Management in WM

Dear сolleagues and development guru!
I have some stopper in Power Management. I hope somebody will help me to understand.
Technologies: C#, .NET 3.5
The main point of application:
Make beep periodically.
Main problem is:
When PocketPC in active mode application running correct, but when PocketPC went to sleep mode it does not make a beep. As I understood speaker is turned off in sleep mode (like all other devices in PocketPC).
Question:
How can I turn on speaker in sleep mode?
Simply what I need is turn on speaker, make beep and back speaker to previous mode without wake up all device.
I tried code like this:
Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Media;
using System.Threading;
using System.Runtime.InteropServices;
namespace TestProject
{
static class Program
{
public const int POWER_NAME = 0x00000001;
public enum DevicePowerState : int
{
Unspecified = -1,
D0 = 0,
D1,
D2,
D3,
D4,
}
[DllImport("coredll.dll", SetLastError = true)]
public static extern int SetDevicePower(
string pvDevice,
int dwDeviceFlags,
DevicePowerState DeviceState
);
[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr SetPowerRequirement(
string device,
DevicePowerState state,
uint deviceFlags,
IntPtr systemState,
ulong stateFlags
);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int ReleasePowerRequirement(IntPtr handle);
[MTAThread]
static void Main()
{
MessageBox.Show("Application is running...", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);
string deviceName = "WAV1:"; // speaker
for (; ; )
{
// set D0 power value
IntPtr handle = SetPowerRequirement(deviceName, DevicePowerState.D0, 1, IntPtr.Zero, 0);
// make a beep
SystemSounds.Beep.Play();
// set default power value
ReleasePowerRequirement(handle);
Thread.Sleep(10000);
}
}
}
}
And like this:
Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Media;
using System.Threading;
using System.Runtime.InteropServices;
namespace TestProject
{
static class Program
{
public const int POWER_NAME = 0x00000001;
public enum DevicePowerState : int
{
Unspecified = -1,
D0 = 0,
D1,
D2,
D3,
D4,
}
[DllImport("coredll.dll", SetLastError = true)]
public static extern int SetDevicePower(
string pvDevice,
int dwDeviceFlags,
DevicePowerState DeviceState
);
[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr SetPowerRequirement(
string device,
DevicePowerState state,
uint deviceFlags,
IntPtr systemState,
ulong stateFlags
);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int ReleasePowerRequirement(IntPtr handle);
[MTAThread]
static void Main()
{
MessageBox.Show("Application is running...", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);
string deviceName = "WAV1:"; // speaker
int resDevicePowerOn = SetDevicePower(deviceName, POWER_NAME, DevicePowerState.D0);
for (; ; )
{
// make a beep
SystemSounds.Beep.Play();
Thread.Sleep(10000);
}
}
}
}
But any of these codes does not work - there are no beep in sleep mode.
Hi, I just happened to find an article from codeproject.
You may want to take a look at it.
http://www.codeproject.com/KB/mobile/WiMoPower1.aspx
I think what you need is cerunappattime.
It seems you are enabling the audio device to run in low-power mode, but you are not actually telling the CPU to keep running ("unattended mode").
Lookup PowerPolicyNotify, specifically PPN_UNATTENDEDMODE.
You may also need to periodically call SHIdleTimerResetEx and/or SystemIdleTimerReset to keep the device active in unattended mode or it will still truely suspend.
Prevent the system enter sleep mode
The system will stop all activitis when the system enter sleep mode.So you must prevent the system enter sleep mode.
The system sleep mode:
on -> unattended -> suspend
You can run:
on -> unattended -> resuming
my code:time up is system on
ex file:screenblack.rar
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace ScreenBlack
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//取得系統狀態 Get system state
[DllImport("Coredll.dll", SetLastError = true)]
public static extern int GetSystemPowerState(StringBuilder PowerState, int length, ref int Flags);
//設定系統電源狀態
[DllImport("Coredll.dll")]
public static extern int SetSystemPowerState(int psState, int StateFlags, int Options);
public const int POWER_STATE_ON = 0x12010000;
public const int NULL = 0;
public const int POWER_FORCE = 0x00001000;
private void Form1_Load(object sender, EventArgs e)
{
//設定 timer1 的設定值 0.5 秒 Set timer1 activie in 0.5 second
timer1.Interval = 500;
//啟動定時器 Start timer1
timer1.Enabled = true;
}
//宣告變數判斷是否有改變 suspend 0:沒有改變 1:有改變
int change = 0;
//宣告變數判斷執行秒數 10
int second = 20;
private void timer1_Tick(object sender, EventArgs e)
{
//設定其標為 0
int flags = 0;
//取得系統狀態名稱 on、suspend、unattended、resuming
StringBuilder stb = new StringBuilder(260);
//取得系統狀態 Get Current system state
GetSystemPowerState(stb, stb.Capacity, ref flags);
//判斷目前系統狀態
if (flags.ToString() == "4194304")
{
//改變 unattended 為 resuming Chang unattended into resuming
RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Control\Power\State\Suspend", true);
reg.SetValue("Flags", "268435456", RegistryValueKind.DWord);
reg.Close();
//設定 reg 有改變
change = 1;
}
else if (flags.ToString() == "268435456")
{
//秒數減一
second--;
//判斷 second 是否等於零
if (second == 0)
{
//************
// your code
//************
//system on
SetSystemPowerState(NULL, POWER_STATE_ON, POWER_FORCE);
//設定秒數
second = 20;
}
}
else
{
//判斷是否有改變
if (change == 1)
{
//改變 unattended 為 resuming Chang unattended into resuming
RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Control\Power\State\Suspend", true);
reg.SetValue("Flags", "2097152", RegistryValueKind.DWord);
reg.Close();
//設定 reg 有改變
change = 0;
//設定秒數
second = 20;
}
}
}
}
}

Turn off GPRS

I'm looking for a way to turn off the data (GRPS)
Search didn't brought me anything usefull, I'm sure there is somwhere the data but can't find it.
I'm especially need it for WM 6.5 (HD2)
Search around for Modaco's NoData program. It's late and I'm too tired to search it up for you right now.
kekkle said:
Search around for Modaco's NoData program. It's late and I'm too tired to search it up for you right now.
Click to expand...
Click to collapse
Thanks for the replay but it’s not what I meant, sorry for not be clarify.
I know the NoData app and actually i just finish writing something similar but more user friendly, hope to release it asap (Now I have problem with the icon )
What I’m looking is a way to turn off programmatically the data connection of the device, what the CommManager in the HTC sense do.
I tried to use the RAS api but it didn't work
look for jmlcomm.exe here at xda and use it in your app.simple command line call.and free to use.
MichelDiamond said:
look for jmlcomm.exe here at xda and use it in your app.simple command line call.and free to use.
Click to expand...
Click to collapse
Thanks for the idea, I'll try it.
But I prefer to do it directly from my app. without calling external tool.
I found a solution!
Its from few posts in the net, don't remember where exactly with some modification of me.
here is the code I use, if someone else will need it:
Code:
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace RasHelper
{
class RasHelper
{
private const int SUCCESS = 0;
private const int ERROR_NOT_ENOUGH_MEMORY = 8;
private const int RASBASE = 600;
private const int ERROR_BUFFER_TOO_SMALL = RASBASE + 3;
private const int ERROR_INVALID_SIZE = RASBASE + 32;
// --- RASCONN data structure definition (refer to ras.h) --
private const int RAS_MaxEntryName = 20;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct RASCONN
{
public int dwSize;
public IntPtr hrasconn;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxEntryName + 1)]
public string szEntryName;
}
// --------------------------------------------
[DllImport("coredll.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern uint RasEnumConnections(
[In, Out] RASCONN[] rasconn,
[In, Out] ref int cb,
[Out] out int connections);
[DllImport("coredll.dll")]
private static extern uint RasHangUp(IntPtr pRasConn);
/// <summary>
/// Returns all active RAS connections as an array of data structure RASCONN
/// </summary>
/// <returns></returns>
public static RASCONN[] GetAllConnections()
{
RASCONN[] tempConn = new RASCONN[1];
RASCONN[] allConnections = tempConn;
tempConn[0].dwSize = Marshal.SizeOf(typeof(RASCONN));
int lpcb = tempConn[0].dwSize;
int lpcConnections = 0;
uint ret = RasEnumConnections(tempConn, ref lpcb, out lpcConnections);
if (ret == ERROR_INVALID_SIZE)
{
throw new Exception("RAS: RASCONN data structure has invalid format");
}
else if (ret == ERROR_BUFFER_TOO_SMALL && lpcb != 0)
{
// first call returned that there are more than one connections
// and more memory is required
allConnections = new RASCONN[lpcb / Marshal.SizeOf(typeof(RASCONN))];
allConnections[0] = tempConn[0];
ret = RasEnumConnections(allConnections, ref lpcb, out lpcConnections);
}
// Check errors
if (ret != SUCCESS)
{
throw new Exception("RAS returns error: " + ret);
}
if (lpcConnections > allConnections.Length)
{
throw new Exception("RAS: error retrieving correct connection count");
}
else if (lpcConnections == 0)
{
// if there are no connections resize the data structure
allConnections = new RASCONN[0];
}
return allConnections;
}
/// <summary>
/// Closes all active RAS connections
/// </summary>
/// <returns></returns>
public static void CloseAllConnections()
{
RASCONN[] connections = GetAllConnections();
for (int i = 0; i < connections.Length; ++i)
{
//MessageBox.Show(connections[i].ToString());
RasHangUp(connections[i].hrasconn);
}
}
/// <summary>
/// Check if there are open data connections
/// </summary>
/// <returns></returns>
public static bool IsConnectionsOpen()
{
RASCONN[] connections = GetAllConnections();
if (connections.Length > 0)
return true;
else
return false;
}
}
}

Turn off phone

I need to turn off the phone (radio?) in my application
The only thing I found is by using lineSetEquipmentState but I couldn't find how to work with it.
Another option is with the openNetCf.tapi but this dll isn't free.
Any ides?
Someone? something?
Other option will be if possible to call flight mode
You can do this via RIL:
Code:
RIL_SetEquipmentState(FHandle,RIL_EQSTATE_MINIMUM);
Here FHandle is handle to opened RIL.
TrashKalmar said:
You can do this via RIL:
Code:
RIL_SetEquipmentState(FHandle,RIL_EQSTATE_MINIMUM);
Here FHandle is handle to opened RIL.
Click to expand...
Click to collapse
Thanks for the info, seems the right way.
However something doesn't work, every thing looks ok, the hRes is 0 but nothing happens.
Any ideas?
Code:
[DllImport("ril.dll")]
private static extern IntPtr RIL_SetEquipmentState(IntPtr hRil);
public static bool SetAirplaneState()
{
IntPtr hRil = IntPtr.Zero;
IntPtr hRes = IntPtr.Zero;
hRes = RIL_Initialize(1, // RIL port 1
new RILRESULTCALLBACK(SetEquipmentStateCallback), // function to call with result
null, // function to call with notify
0, // classes of notification to enable
0x00000001, // RIL parameters
out hRil); // RIL handle returned
if (hRes != IntPtr.Zero)
{
return false;
}
hRes = RIL_GetCellTowerInfo(hRil);
waithandle.WaitOne();
RIL_Deinitialize(hRil);
return true;
}
private static void SetEquipmentStateCallback(uint dwCode, IntPtr hrCmdID, IntPtr lpData, uint cbData, uint dwParam)
{
waithandle.Set();
}
private static AutoResetEvent waithandle = new AutoResetEvent(false);
public delegate void RILNOTIFYCALLBACK(uint dwCode,
IntPtr lpData,
uint cbData,
uint dwParam);
public delegate void RILRESULTCALLBACK(uint dwCode,
IntPtr hrCmdID,
IntPtr lpData,
uint cbData,
uint dwParam);
alto said:
Code:
...
hRes = RIL_Initialize(1, // RIL port 1
new RILRESULTCALLBACK(SetEquipmentStateCallback), // function to call with result
null, // function to call with notify
0, // classes of notification to enable
0x00000001, // RIL parameters
out hRil); // RIL handle returned
if (hRes != IntPtr.Zero)
{
return false;
}
hRes = RIL_GetCellTowerInfo(hRil);
...
Click to expand...
Click to collapse
What do you want to achieve? If you want to turn off the phone, you should use RIL_SetEquipmentState. But in your code you obtain Cell Tower info via RIL_GetCellTowerInfo.
Also, if I remember rightly, you must specify RILNOTIFYCALLBACK in RIL_Initialize.
TrashKalmar said:
What do you want to achieve? If you want to turn off the phone, you should use RIL_SetEquipmentState. But in your code you obtain Cell Tower info via RIL_GetCellTowerInfo.
Also, if I remember rightly, you must specify RILNOTIFYCALLBACK in RIL_Initialize.
Click to expand...
Click to collapse
Correct, sorry I made mish-mash in the code I copied here.
My error was that I forgot to pass the second parameter to the SetEquipmentState function.
Works great now, Thanks!
Any chance of publishing this code?
Am I right in that it takes some time for the application to quit?
Thanks,
ajhvdb, this code works quite fine. And yes, it may take a while to quit app.
TrashKalmar said:
ajhvdb, this code works quite fine. And yes, it may take a while to quit app.
Click to expand...
Click to collapse
If I past your code into my code I'm missing RIL_Initialize, RIL_GetCellTowerInfo.
Sorry for being slow with this but I never used delegates and RIL before
If I past your code into my code I'm missing RIL_Initialize, RIL_GetCellTowerInfo.
Sorry for being slow with this but I never used delegates and RIL before
Bump

Samsung Registry and File System Access?

I'm getting sick of seeing all the HTC and LG guys having all the fun. Trying to do something about it. xboxmod posted this in another thread...
xboxmod said:
For now the only possible door is this registry key.
[HKEY_LOCAL_MACHINE\Software\Microsoft\FieldTest]
"ManufacturingProvXmlPath"="\\windows\\DiagnosisAp p_1.provxml"
if we can identify when it's called and by what.
possibly
FieldTestApp.exe
DiagnosisApp.xap
Click to expand...
Click to collapse
Sooo I've done some mucking around with this. Made a little progress but not much.
That provxml is executed every time you dial "##634#". It just installs the Diagnosis app. Whatever process is actually doing this then launches Diagnosis which is just a silverlight app.
I can write to that registry key and put in whatever path I want. The problem is, whenver I try to run it with a provxml that I've deployed to the rigtones folder or to the app's install folder it does nothing. I was able to get it to launch the provxml that installs the AT&T crapware so I know it is working after it's modified, I just can't convince it to run one that's not in \windows\. I tried emailing the file and saving the attachment (took some tricking) and that didn't work either.
Is there any way to write files to \windows\ on samsung devices? If I'm not mistaken we don't have permission to do that from SL and there's no "WriteFile" function thrown in the drivers that we know of.
Anyone have any ideas? Anything else I should try?
so...what you're saying...is that mfg is launched provxml is written...
is it possible to dump the samsung rom to pull the xap and sideload it that way...edit the xap with the new provxml so it installs on ##634# assuming mfg is an installable app
I know it is installable I have it on my phone I dunno where I got it though...if it works...
that just leaves dell being late to the party as usual...
I think you're confused. I don't think there is a XAP that installs the provxml. It's just sitting in \windows (which I don't think we have write access too) and the phone dialer or whatnot launches hte provxml which installs the xap. The XAP ships with the phone in the \windows\ folder but isn't "installed" until it's provisioned by running ##634#.
^
you're right thought you were asking something else
YAY! Progress!!! I figured out how to get better (full?) write access to the registry
Soo in the "Diagnosis" app they use an additional COM DLL which has a whole slew of interesting features. With this one, you can write to more of the registry. I was able to change my theme colors and some of the other fun mods The following code removes the app deployment limit and replaces magenta with gray. I've attached the DLL that you'll need to include in your project. It would be nice if those of you who have developed apps like registry editors could update your Samsung support.
Code:
private CHybridClass_FCRProxy HybridClass_FCRProxy;
private IHybridInterface_FCRProxy HybridInterface_FCRProxy;
public void DoHack()
{
this.HybridClass_FCRProxy = null;
this.HybridInterface_FCRProxy = null;
this.InitializeComponent();
ComBridge.RegisterComDll("FCRouterProxy.dll", new Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0"));
this.HybridClass_FCRProxy = new CHybridClass_FCRProxy();
this.HybridInterface_FCRProxy = (IHybridInterface_FCRProxy)this.HybridClass_FCRProxy;
bool success;
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"Software\Microsoft\DeviceReg\Install", "MaxUnsignedApp", 2147483647, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.RegistrySetString(0, @"ControlPanel\Themes\AccentsDisplayName\0409", "10", "Gray", out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\0\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\1\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
}
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0")]
public class CHybridClass_FCRProxy
{
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5F471A84-8D09-46fe-94D6-AF856A7CF3C8")]
internal interface IHybridInterface_FCRProxy
{
void Error_GetLastErrorMessage(out string strErrorMessage);
void Sensor_GetProximityValue(out int pdwObjectDetected, out int pdwReturn);
void Sensor_GetAmbientLightValue(out int pdwMilliLux, out int pdwReturn);
void Sensor_GetCompassValue(out float fHRawX, out float fHRawY, out float fHRawZ, out int pdwReturn);
void Sensor_GetAccelerometerValue(out float pdwACCX, out float pdwACCY, out float pdwACCZ, out int pdwReturn);
void FactoryProcess_GetHistoryNV(out int stringtext, out int pdwReturn);
void FactoryProcess_GetResultNV(out int stringtext, out int pdwReturn);
void USBSwitch_GetFunctionDriver(out uint nPathType, out int pdwReturn);
void USBSwitch_SetFunctionDriver(uint nPathType, out int pdwReturn);
void KeyTest_Enable(out int pdwReturn);
void KeyTest_Disable(out int pdwReturn);
void SMD_GetInfo(out string strSMDInfo, out int pdwReturn);
void Camera_UpdateFirmwareVersion(out int pdwReturn);
void Camera_GetFirmwareVersion(out string strISPFWVersion, out string strISPPRAVersion, out string strBINFWVersion, out string strBINPRAVersion, out string strFWVendorVersion, out string strFWReleaseVersion, out string strFWWriteCount, out int pdwReturn);
void Camera_PerformFirmwareUpdate(int dwUpdateType, out int pdwReturn);
void Camera_IsFirmwareUpdateValid(out bool bValid, out int pdwReturn);
void Loopback_Test(int dwVoiceFlag, int dwLoopbackMode, int dwStartFlag, out int pdwReturn);
void FactoryProcess_SetResultNV(int dwID, int dwPASS, out int pdwReturn);
void HKLM_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData);
void GetSubSystemConfig(out int dwReg0, out int dwData0, out int dwReg1, out int dwData1, out int dwReg2, out int dwData2, out int dwReg3, out int dwData3, out int dwReg4, out int dwData4, out int dwReg5, out int dwData5, out int dwReg6, out int dwData6, out int dwReg7, out int dwData7);
void SetSubSystemConfig(int dwReg0, int dwData0, int dwReg1, int dwData1, int dwReg2, int dwData2, int dwReg3, int dwData3, int dwReg4, int dwData4, int dwReg5, int dwData5, int dwReg6, int dwData6, int dwReg7, int dwData7);
void GetSystemGain(int reg0, out int reg1, out int reg2);
void SetSystemGain(int reg0, int reg1, int reg2);
void GetClassGain(int reg0, int reg1, out int reg2);
void SetClassGain(int reg0, int reg1, int reg2);
void GetDeviceGain(int reg0, out int reg1, out int reg2);
void SetDeviceGain(int reg0, int reg1, int reg2);
void SetDualMicControl(bool bOnOff);
void Battery_GetLoggingStatus(out int pdwStatus, out int pdwReturn);
void Battery_SetLoggingStatus(int dwEnable, out int pdwReturn);
void FMRadio_Initialize(out bool bReturn);
void FMRadio_UnInitialize(out bool bReturn);
void FMRadio_GetStatusValues(out int nRSSI, out ushort unThreshold, out ushort unSNR, out ushort unStereoMode, out bool bReturn);
void FMRadio_SetTheradholdValue(ushort unType, ushort unValue, out bool bReturn);
void HKCU_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData, out int pdwReturn);
void FMRadio_SetFrequency(int unFrequency, out bool pbReturn);
void BT_GetMode(int dwGetFlag, int dwModeFlag, out int pdwStatus, out bool pbReturn);
void System_Reboot(out bool pbReturn);
void Sensor_GetProximityValue_Chip(out int pdwObjectDetected, out int pdwObjectValue, out int pdwReturn);
void FMRadio_SetRegion(int dwRegion, out bool pbReturn);
void Touch_RelianceTestEnable(out int pdwReturn);
void Touch_RelianceTestDisable(out int pdwReturn);
void Touch_GetDeltaValue(out int pdwXCoord, out int pdwYCoord, out int pdwDelta, out int pdwReference, out int pdwFirmwareVer, out int pdwReturn);
void SetBacklightLevel(int nLevel);
void GetFGInfo(out int Version, out int RCOMP, out int VCELL, out int rawSOC, out int adjSOC, out int pdwReturn);
void SetFGQuickStart(out int pdwReturn);
void SetLogEnable(out int pdwReturn);
void GetPowerStatus(out int ACLineStatus, out int BatteryFlag, out int BatteryLifePercent, out int Reserved1, out int BatteryLifeTime, out int BatteryFullLifeTime, out int Reserved2, out int BackupBatteryFlag, out int BackupBatteryLifePercent, out int Reserved3, out int BackupBatteryLifeTime, out int BackupBatteryFullLifeTime, out int BatteryChemistry, out int BatteryVoltage, out int BatteryCurrent, out int BatteryAverageCurrent, out int BatteryAverageInterval, out int BatterymAHourConsumed, out int BatteryTemperature, out int BackupBatteryVoltage, out int pdwReturn);
void GETADCInfo(out ushort VBATT, out ushort VCHG, out ushort INCHG, out ushort THERM, out bool TACABLE, out bool USBCABLE, out ushort BATT_ID, out int pdwReturn);
void GetMVInfo(out short VBATT_MV, out short VCHG_MV, out short INCHG_OUT_MV, out short DEG, out short BAT_PER, out int pdwReturn);
void SleepMode(out int pdwReturn);
void Camera_SetSimpleTest(uint nPathType, out int pdwReturn);
void SetPreventSleep(out int pdwReturn);
void ReleasePreventSleep(out int pdwReturn);
void FMRadio_ScanFrequency(out int nScanFrequnecy, out bool pbReturn);
void Camera_GetSimpleTest(out uint nPathType, out int pdwReturn);
void HKCU_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void HKLM_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void Touch_GetInfoValue(out int pdwFirmwareVer, out int pdwFirmwarebuild, out int pdwThreadHold, out int pdwXCoord, out int pdwYCoord, out int pdwReference1, out int pdwReference2, out int pdwReference3, out int pdwReference4, out int pdwReference5, out int pdwDelta1, out int pdwDelta2, out int pdwDelta3, out int pdwDelta4, out int pdwDelta5, out int pdwReturn);
void TouchKey_GetInfoValue(out string pbstrKeyVer, out int pdwReturn);
void FactoryProcess_GetDPPPVKKEY(out int pdwLength, out int stringtext, out int pdwReturn);
void FactoryProcess_GetDPPPVKFILENAME(out int pdwLength, out int stringtext, out int pdwReturn);
void RegistrySetString(int nKey, string pszSubKey, string pszValueName, string pszString, out bool pbReturn);
void RegistryGetString(int nKey, string pszSubKey, string pszValueName, out string strKeyMessage, out bool pbReturn);
void FMRadio_OutputSwitch(int OutputType, out bool pbReturn);
void Light_SetCalValue(int dwValue, out int pdwReturn);
void Accelerometer_SetCalValue(int dwValue, out int pdwReturn);
void Sensor_GetCompassBearing(out int pdwBearing, out int pdwHDST, out int pdwPASS, out int pdwReturn);
void FactoryProcess_SetDaylightTime(int dwTime, out int pdwReturn);
void VolumeControl_waveOutSetVolume(int dwVolume, out int pdwReturn);
void VolumeControl_waveOutGetVolume(out int dwVolume, out int pdwReturn);
void DualMic_Test(int dwStartFlag, out int pdwReturn);
}
RustyGrom said:
YAY! Progress!!! I figured out how to get better (full?) write access to the registry
Soo in the "Diagnosis" app they use an additional COM DLL which has a whole slew of interesting features. With this one, you can write to more of the registry. I was able to change my theme colors and some of the other fun mods The following code removes the app deployment limit and replaces magenta with gray. I've attached the DLL that you'll need to include in your project. It would be nice if those of you who have developed apps like registry editors could update your Samsung support.
Click to expand...
Click to collapse
I'm not able to add the COM DLL to my C# project. Am I missing something here? I'd like to test it out.
pixeltec said:
I'm not able to add the COM DLL to my C# project. Am I missing something here? I'd like to test it out.
Click to expand...
Click to collapse
There's a few things you gotta do to get native code working. Check out this thread (and my sample solution) for more info.
RustyGrom said:
YAY! Progress!!! I figured out how to get better (full?) write access to the registry
Soo in the "Diagnosis" app they use an additional COM DLL which has a whole slew of interesting features. With this one, you can write to more of the registry. I was able to change my theme colors and some of the other fun mods The following code removes the app deployment limit and replaces magenta with gray. I've attached the DLL that you'll need to include in your project. It would be nice if those of you who have developed apps like registry editors could update your Samsung support.
Code:
private CHybridClass_FCRProxy HybridClass_FCRProxy;
private IHybridInterface_FCRProxy HybridInterface_FCRProxy;
public void DoHack()
{
this.HybridClass_FCRProxy = null;
this.HybridInterface_FCRProxy = null;
this.InitializeComponent();
ComBridge.RegisterComDll("FCRouterProxy.dll", new Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0"));
this.HybridClass_FCRProxy = new CHybridClass_FCRProxy();
this.HybridInterface_FCRProxy = (IHybridInterface_FCRProxy)this.HybridClass_FCRProxy;
bool success;
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"Software\Microsoft\DeviceReg\Install", "MaxUnsignedApp", 2147483647, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.RegistrySetString(0, @"ControlPanel\Themes\AccentsDisplayName\0409", "10", "Gray", out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\0\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\1\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
}
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0")]
public class CHybridClass_FCRProxy
{
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5F471A84-8D09-46fe-94D6-AF856A7CF3C8")]
internal interface IHybridInterface_FCRProxy
{
void Error_GetLastErrorMessage(out string strErrorMessage);
void Sensor_GetProximityValue(out int pdwObjectDetected, out int pdwReturn);
void Sensor_GetAmbientLightValue(out int pdwMilliLux, out int pdwReturn);
void Sensor_GetCompassValue(out float fHRawX, out float fHRawY, out float fHRawZ, out int pdwReturn);
void Sensor_GetAccelerometerValue(out float pdwACCX, out float pdwACCY, out float pdwACCZ, out int pdwReturn);
void FactoryProcess_GetHistoryNV(out int stringtext, out int pdwReturn);
void FactoryProcess_GetResultNV(out int stringtext, out int pdwReturn);
void USBSwitch_GetFunctionDriver(out uint nPathType, out int pdwReturn);
void USBSwitch_SetFunctionDriver(uint nPathType, out int pdwReturn);
void KeyTest_Enable(out int pdwReturn);
void KeyTest_Disable(out int pdwReturn);
void SMD_GetInfo(out string strSMDInfo, out int pdwReturn);
void Camera_UpdateFirmwareVersion(out int pdwReturn);
void Camera_GetFirmwareVersion(out string strISPFWVersion, out string strISPPRAVersion, out string strBINFWVersion, out string strBINPRAVersion, out string strFWVendorVersion, out string strFWReleaseVersion, out string strFWWriteCount, out int pdwReturn);
void Camera_PerformFirmwareUpdate(int dwUpdateType, out int pdwReturn);
void Camera_IsFirmwareUpdateValid(out bool bValid, out int pdwReturn);
void Loopback_Test(int dwVoiceFlag, int dwLoopbackMode, int dwStartFlag, out int pdwReturn);
void FactoryProcess_SetResultNV(int dwID, int dwPASS, out int pdwReturn);
void HKLM_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData);
void GetSubSystemConfig(out int dwReg0, out int dwData0, out int dwReg1, out int dwData1, out int dwReg2, out int dwData2, out int dwReg3, out int dwData3, out int dwReg4, out int dwData4, out int dwReg5, out int dwData5, out int dwReg6, out int dwData6, out int dwReg7, out int dwData7);
void SetSubSystemConfig(int dwReg0, int dwData0, int dwReg1, int dwData1, int dwReg2, int dwData2, int dwReg3, int dwData3, int dwReg4, int dwData4, int dwReg5, int dwData5, int dwReg6, int dwData6, int dwReg7, int dwData7);
void GetSystemGain(int reg0, out int reg1, out int reg2);
void SetSystemGain(int reg0, int reg1, int reg2);
void GetClassGain(int reg0, int reg1, out int reg2);
void SetClassGain(int reg0, int reg1, int reg2);
void GetDeviceGain(int reg0, out int reg1, out int reg2);
void SetDeviceGain(int reg0, int reg1, int reg2);
void SetDualMicControl(bool bOnOff);
void Battery_GetLoggingStatus(out int pdwStatus, out int pdwReturn);
void Battery_SetLoggingStatus(int dwEnable, out int pdwReturn);
void FMRadio_Initialize(out bool bReturn);
void FMRadio_UnInitialize(out bool bReturn);
void FMRadio_GetStatusValues(out int nRSSI, out ushort unThreshold, out ushort unSNR, out ushort unStereoMode, out bool bReturn);
void FMRadio_SetTheradholdValue(ushort unType, ushort unValue, out bool bReturn);
void HKCU_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData, out int pdwReturn);
void FMRadio_SetFrequency(int unFrequency, out bool pbReturn);
void BT_GetMode(int dwGetFlag, int dwModeFlag, out int pdwStatus, out bool pbReturn);
void System_Reboot(out bool pbReturn);
void Sensor_GetProximityValue_Chip(out int pdwObjectDetected, out int pdwObjectValue, out int pdwReturn);
void FMRadio_SetRegion(int dwRegion, out bool pbReturn);
void Touch_RelianceTestEnable(out int pdwReturn);
void Touch_RelianceTestDisable(out int pdwReturn);
void Touch_GetDeltaValue(out int pdwXCoord, out int pdwYCoord, out int pdwDelta, out int pdwReference, out int pdwFirmwareVer, out int pdwReturn);
void SetBacklightLevel(int nLevel);
void GetFGInfo(out int Version, out int RCOMP, out int VCELL, out int rawSOC, out int adjSOC, out int pdwReturn);
void SetFGQuickStart(out int pdwReturn);
void SetLogEnable(out int pdwReturn);
void GetPowerStatus(out int ACLineStatus, out int BatteryFlag, out int BatteryLifePercent, out int Reserved1, out int BatteryLifeTime, out int BatteryFullLifeTime, out int Reserved2, out int BackupBatteryFlag, out int BackupBatteryLifePercent, out int Reserved3, out int BackupBatteryLifeTime, out int BackupBatteryFullLifeTime, out int BatteryChemistry, out int BatteryVoltage, out int BatteryCurrent, out int BatteryAverageCurrent, out int BatteryAverageInterval, out int BatterymAHourConsumed, out int BatteryTemperature, out int BackupBatteryVoltage, out int pdwReturn);
void GETADCInfo(out ushort VBATT, out ushort VCHG, out ushort INCHG, out ushort THERM, out bool TACABLE, out bool USBCABLE, out ushort BATT_ID, out int pdwReturn);
void GetMVInfo(out short VBATT_MV, out short VCHG_MV, out short INCHG_OUT_MV, out short DEG, out short BAT_PER, out int pdwReturn);
void SleepMode(out int pdwReturn);
void Camera_SetSimpleTest(uint nPathType, out int pdwReturn);
void SetPreventSleep(out int pdwReturn);
void ReleasePreventSleep(out int pdwReturn);
void FMRadio_ScanFrequency(out int nScanFrequnecy, out bool pbReturn);
void Camera_GetSimpleTest(out uint nPathType, out int pdwReturn);
void HKCU_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void HKLM_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void Touch_GetInfoValue(out int pdwFirmwareVer, out int pdwFirmwarebuild, out int pdwThreadHold, out int pdwXCoord, out int pdwYCoord, out int pdwReference1, out int pdwReference2, out int pdwReference3, out int pdwReference4, out int pdwReference5, out int pdwDelta1, out int pdwDelta2, out int pdwDelta3, out int pdwDelta4, out int pdwDelta5, out int pdwReturn);
void TouchKey_GetInfoValue(out string pbstrKeyVer, out int pdwReturn);
void FactoryProcess_GetDPPPVKKEY(out int pdwLength, out int stringtext, out int pdwReturn);
void FactoryProcess_GetDPPPVKFILENAME(out int pdwLength, out int stringtext, out int pdwReturn);
void RegistrySetString(int nKey, string pszSubKey, string pszValueName, string pszString, out bool pbReturn);
void RegistryGetString(int nKey, string pszSubKey, string pszValueName, out string strKeyMessage, out bool pbReturn);
void FMRadio_OutputSwitch(int OutputType, out bool pbReturn);
void Light_SetCalValue(int dwValue, out int pdwReturn);
void Accelerometer_SetCalValue(int dwValue, out int pdwReturn);
void Sensor_GetCompassBearing(out int pdwBearing, out int pdwHDST, out int pdwPASS, out int pdwReturn);
void FactoryProcess_SetDaylightTime(int dwTime, out int pdwReturn);
void VolumeControl_waveOutSetVolume(int dwVolume, out int pdwReturn);
void VolumeControl_waveOutGetVolume(out int dwVolume, out int pdwReturn);
void DualMic_Test(int dwStartFlag, out int pdwReturn);
}
Click to expand...
Click to collapse
DUDE Thanks SO much for taking the initiative on this.. We're getting somewhere good on this! Let's get the Samsung community in the same lime light as HTC!
Cool beans dude!!! finally getting somewhere with the samsung...great job!!
How to use FCRouterProxy.dll? I cannot add it as reference. thank you.
varavut said:
How to use FCRouterProxy.dll? I cannot add it as reference. thank you.
Click to expand...
Click to collapse
RustyGrom said:
There's a few things you gotta do to get native code working. Check out this thread (and my sample solution) for more info.
Click to expand...
Click to collapse
It's a Native COM DLL, not a .net dll.
RustyGrom said:
It's a Native COM DLL, not a .net dll.
Click to expand...
Click to collapse
Do you think it'd be possible to write a managed wrapper DLL for the native calls? I think that'd make the whole process a lot less messy.
I took a look at your native calls project, and I must admit, I feel a bit silly. I'm not sure what to define ComBridge as. I can't compile without it.
RustyGrom said:
YAY! Progress!!! I figured out how to get better (full?) write access to the registry
Soo in the "Diagnosis" app they use an additional COM DLL which has a whole slew of interesting features. With this one, you can write to more of the registry. I was able to change my theme colors and some of the other fun mods The following code removes the app deployment limit and replaces magenta with gray. I've attached the DLL that you'll need to include in your project. It would be nice if those of you who have developed apps like registry editors could update your Samsung support.
Code:
private CHybridClass_FCRProxy HybridClass_FCRProxy;
private IHybridInterface_FCRProxy HybridInterface_FCRProxy;
public void DoHack()
{
this.HybridClass_FCRProxy = null;
this.HybridInterface_FCRProxy = null;
this.InitializeComponent();
ComBridge.RegisterComDll("FCRouterProxy.dll", new Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0"));
this.HybridClass_FCRProxy = new CHybridClass_FCRProxy();
this.HybridInterface_FCRProxy = (IHybridInterface_FCRProxy)this.HybridClass_FCRProxy;
bool success;
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"Software\Microsoft\DeviceReg\Install", "MaxUnsignedApp", 2147483647, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.RegistrySetString(0, @"ControlPanel\Themes\AccentsDisplayName\0409", "10", "Gray", out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\0\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
this.HybridInterface_FCRProxy.HKLM_RegistrySetDWORD(@"ControlPanel\Themes\1\Accents", "10", (uint)0xFF1B1B1B, out success);
if (!success)
{
string str;
this.HybridInterface_FCRProxy.Error_GetLastErrorMessage(out str);
MessageBox.Show(str);
}
}
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("BE2E2E71-FC72-4507-B8AD-A2FED536AAB0")]
public class CHybridClass_FCRProxy
{
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5F471A84-8D09-46fe-94D6-AF856A7CF3C8")]
internal interface IHybridInterface_FCRProxy
{
void Error_GetLastErrorMessage(out string strErrorMessage);
void Sensor_GetProximityValue(out int pdwObjectDetected, out int pdwReturn);
void Sensor_GetAmbientLightValue(out int pdwMilliLux, out int pdwReturn);
void Sensor_GetCompassValue(out float fHRawX, out float fHRawY, out float fHRawZ, out int pdwReturn);
void Sensor_GetAccelerometerValue(out float pdwACCX, out float pdwACCY, out float pdwACCZ, out int pdwReturn);
void FactoryProcess_GetHistoryNV(out int stringtext, out int pdwReturn);
void FactoryProcess_GetResultNV(out int stringtext, out int pdwReturn);
void USBSwitch_GetFunctionDriver(out uint nPathType, out int pdwReturn);
void USBSwitch_SetFunctionDriver(uint nPathType, out int pdwReturn);
void KeyTest_Enable(out int pdwReturn);
void KeyTest_Disable(out int pdwReturn);
void SMD_GetInfo(out string strSMDInfo, out int pdwReturn);
void Camera_UpdateFirmwareVersion(out int pdwReturn);
void Camera_GetFirmwareVersion(out string strISPFWVersion, out string strISPPRAVersion, out string strBINFWVersion, out string strBINPRAVersion, out string strFWVendorVersion, out string strFWReleaseVersion, out string strFWWriteCount, out int pdwReturn);
void Camera_PerformFirmwareUpdate(int dwUpdateType, out int pdwReturn);
void Camera_IsFirmwareUpdateValid(out bool bValid, out int pdwReturn);
void Loopback_Test(int dwVoiceFlag, int dwLoopbackMode, int dwStartFlag, out int pdwReturn);
void FactoryProcess_SetResultNV(int dwID, int dwPASS, out int pdwReturn);
void HKLM_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData);
void GetSubSystemConfig(out int dwReg0, out int dwData0, out int dwReg1, out int dwData1, out int dwReg2, out int dwData2, out int dwReg3, out int dwData3, out int dwReg4, out int dwData4, out int dwReg5, out int dwData5, out int dwReg6, out int dwData6, out int dwReg7, out int dwData7);
void SetSubSystemConfig(int dwReg0, int dwData0, int dwReg1, int dwData1, int dwReg2, int dwData2, int dwReg3, int dwData3, int dwReg4, int dwData4, int dwReg5, int dwData5, int dwReg6, int dwData6, int dwReg7, int dwData7);
void GetSystemGain(int reg0, out int reg1, out int reg2);
void SetSystemGain(int reg0, int reg1, int reg2);
void GetClassGain(int reg0, int reg1, out int reg2);
void SetClassGain(int reg0, int reg1, int reg2);
void GetDeviceGain(int reg0, out int reg1, out int reg2);
void SetDeviceGain(int reg0, int reg1, int reg2);
void SetDualMicControl(bool bOnOff);
void Battery_GetLoggingStatus(out int pdwStatus, out int pdwReturn);
void Battery_SetLoggingStatus(int dwEnable, out int pdwReturn);
void FMRadio_Initialize(out bool bReturn);
void FMRadio_UnInitialize(out bool bReturn);
void FMRadio_GetStatusValues(out int nRSSI, out ushort unThreshold, out ushort unSNR, out ushort unStereoMode, out bool bReturn);
void FMRadio_SetTheradholdValue(ushort unType, ushort unValue, out bool bReturn);
void HKCU_RegistryGetDWORD(string pszSubKey, string pszValueName, out int pdwData, out int pdwReturn);
void FMRadio_SetFrequency(int unFrequency, out bool pbReturn);
void BT_GetMode(int dwGetFlag, int dwModeFlag, out int pdwStatus, out bool pbReturn);
void System_Reboot(out bool pbReturn);
void Sensor_GetProximityValue_Chip(out int pdwObjectDetected, out int pdwObjectValue, out int pdwReturn);
void FMRadio_SetRegion(int dwRegion, out bool pbReturn);
void Touch_RelianceTestEnable(out int pdwReturn);
void Touch_RelianceTestDisable(out int pdwReturn);
void Touch_GetDeltaValue(out int pdwXCoord, out int pdwYCoord, out int pdwDelta, out int pdwReference, out int pdwFirmwareVer, out int pdwReturn);
void SetBacklightLevel(int nLevel);
void GetFGInfo(out int Version, out int RCOMP, out int VCELL, out int rawSOC, out int adjSOC, out int pdwReturn);
void SetFGQuickStart(out int pdwReturn);
void SetLogEnable(out int pdwReturn);
void GetPowerStatus(out int ACLineStatus, out int BatteryFlag, out int BatteryLifePercent, out int Reserved1, out int BatteryLifeTime, out int BatteryFullLifeTime, out int Reserved2, out int BackupBatteryFlag, out int BackupBatteryLifePercent, out int Reserved3, out int BackupBatteryLifeTime, out int BackupBatteryFullLifeTime, out int BatteryChemistry, out int BatteryVoltage, out int BatteryCurrent, out int BatteryAverageCurrent, out int BatteryAverageInterval, out int BatterymAHourConsumed, out int BatteryTemperature, out int BackupBatteryVoltage, out int pdwReturn);
void GETADCInfo(out ushort VBATT, out ushort VCHG, out ushort INCHG, out ushort THERM, out bool TACABLE, out bool USBCABLE, out ushort BATT_ID, out int pdwReturn);
void GetMVInfo(out short VBATT_MV, out short VCHG_MV, out short INCHG_OUT_MV, out short DEG, out short BAT_PER, out int pdwReturn);
void SleepMode(out int pdwReturn);
void Camera_SetSimpleTest(uint nPathType, out int pdwReturn);
void SetPreventSleep(out int pdwReturn);
void ReleasePreventSleep(out int pdwReturn);
void FMRadio_ScanFrequency(out int nScanFrequnecy, out bool pbReturn);
void Camera_GetSimpleTest(out uint nPathType, out int pdwReturn);
void HKCU_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void HKLM_RegistrySetDWORD(string pszSubKey, string pszValueName, uint dwData, out bool pbReturn);
void Touch_GetInfoValue(out int pdwFirmwareVer, out int pdwFirmwarebuild, out int pdwThreadHold, out int pdwXCoord, out int pdwYCoord, out int pdwReference1, out int pdwReference2, out int pdwReference3, out int pdwReference4, out int pdwReference5, out int pdwDelta1, out int pdwDelta2, out int pdwDelta3, out int pdwDelta4, out int pdwDelta5, out int pdwReturn);
void TouchKey_GetInfoValue(out string pbstrKeyVer, out int pdwReturn);
void FactoryProcess_GetDPPPVKKEY(out int pdwLength, out int stringtext, out int pdwReturn);
void FactoryProcess_GetDPPPVKFILENAME(out int pdwLength, out int stringtext, out int pdwReturn);
void RegistrySetString(int nKey, string pszSubKey, string pszValueName, string pszString, out bool pbReturn);
void RegistryGetString(int nKey, string pszSubKey, string pszValueName, out string strKeyMessage, out bool pbReturn);
void FMRadio_OutputSwitch(int OutputType, out bool pbReturn);
void Light_SetCalValue(int dwValue, out int pdwReturn);
void Accelerometer_SetCalValue(int dwValue, out int pdwReturn);
void Sensor_GetCompassBearing(out int pdwBearing, out int pdwHDST, out int pdwPASS, out int pdwReturn);
void FactoryProcess_SetDaylightTime(int dwTime, out int pdwReturn);
void VolumeControl_waveOutSetVolume(int dwVolume, out int pdwReturn);
void VolumeControl_waveOutGetVolume(out int dwVolume, out int pdwReturn);
void DualMic_Test(int dwStartFlag, out int pdwReturn);
}
Click to expand...
Click to collapse
You are the man! I've put together an accent changer w/source.
http://www.daveamenta.com/2011-01/change-accent-colors-on-windows-phone-7-samsung-devices/
pixeltec said:
Do you think it'd be possible to write a managed wrapper DLL for the native calls? I think that'd make the whole process a lot less messy.
I took a look at your native calls project, and I must admit, I feel a bit silly. I'm not sure what to define ComBridge as. I can't compile without it.
Click to expand...
Click to collapse
you must add Microsoft.Phone.InteropServices to reference.
varavut said:
you must add Microsoft.Phone.InteropServices to reference.
Click to expand...
Click to collapse
Gotcha. Thanks.
@davux: Freaking awesome. Works flawlessly on my Focus. Kudos.
Well, I spent a while hacking together my first ever C# program today. Though to call it mine is a bit of a stretch. What I've done is I've taken a Registry editor for the Samsung Focus (here), and modified it to use this DLL instead.
It successfully reads and writes to the hklm hive, but I have not tested it on hkcu. I've used it to keep my phone from relocking and manually editing the theme data. I haven't run into a registry key I can't read or write with it.
However, it still doesn't browse through the registry, only edits stuff you know the locations of.
Enjoy, either way. And ignore the silly splash screen I threw together in twenty seconds and forgot to remove. Source is included. xD
Edit: Found a minor bug, the default path that it starts on points to a key that doesn't exist. (Namely, the actual key is in hklm, not hkcu)
RustyGrom said:
I can write to that registry key and put in whatever path I want. The problem is, whenver I try to run it with a provxml that I've deployed to the rigtones folder or to the app's install folder it does nothing. I was able to get it to launch the provxml that installs the AT&T crapware so I know it is working after it's modified, I just can't convince it to run one that's not in \windows\. I tried emailing the file and saving the attachment (took some tricking) and that didn't work either.
Click to expand...
Click to collapse
Did you email the file in your \windows folder, or another one you created yourself?
ad what do you mean by "I just can't convince it to run one that's not in \windows\"?? it cannot run a program not in the \windows folder or cannot install a provxml that in not in the \windows folder?
thanx
pixeltec said:
Do you think it'd be possible to write a managed wrapper DLL for the native calls? I think that'd make the whole process a lot less messy.
I took a look at your native calls project, and I must admit, I feel a bit silly. I'm not sure what to define ComBridge as. I can't compile without it.
Click to expand...
Click to collapse
I think someone said they're working on one that will abstract all platforms. Hopefully they'll incorporate this.
martani said:
Did you email the file in your \windows folder, or another one you created yourself?
ad what do you mean by "I just can't convince it to run one that's not in \windows\"?? it cannot run a program not in the \windows folder or cannot install a provxml that in not in the \windows folder?
thanx
Click to expand...
Click to collapse
Saved email attachments go to "\Application Data\Volatile\EmailAttachments\AttachmentsXXXXXXXXXXX" where XXXXXXXXXXX is some random number it assigns. I don't know of a way to get the file from that folder to \windows.
It won't install a provxml that's not in the windows folder. I tried putting the same provxml that it normally uses in other folders and it won't run it.
Here is my registry app with cross device writing (at least HTC and Samsung, LG may work).
XAP: http://bit.ly/eEZ0Uf
It includes a lib that abstract registry API for each device.
(nico) said:
Here is my registry app with cross device writing (at least HTC and Samsung, LG may work).
XAP: http://bit.ly/eEZ0Uf
It includes a lib that abstract registry API for each device.
Click to expand...
Click to collapse
How do you detect the type of the device? or is it just a "try ... catch" and whatever works if the one to use?

How to access byte[] array from hooked method?

I'm a noob when it comes to both java and xposed, although I can more or less "read" java. I'm trying to create my first xposed plugin.
This is in the source (via jadx) from my original apk:
Code:
private void onHandle(byte[] data, int start, int length) {
byte b = data[start];
I wrote in my plugin:
Code:
findAndHookMethod("com.syu.ms.dev.ReceiverMcu", lpparam.classLoader, "onHandle", byte[].class, int.class, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
[B]byte[] data = assetAsByteArray(param.thisObject, "byte[].class");[/B]
int start = getIntField(param.thisObject, "start");
int length = getIntField(param.thisObject, "length");
byte b = data[start];
....... etcetera .................
The bold part is what I need. I know that this line of code is wrong, but I'm already trying (monkey like) all kinds of constructions, but I always get an error.
How can I access that "byte[] data" from my original apk in my plugin?
The arguments are in 'param.args'. Since you want to access the first one, what you need is 'byte[] data = (byte[]) param.args[0];'
JoseRebelo said:
The arguments are in 'param.args'. Since you want to access the first one, what you need is 'byte[] data = (byte[]) param.args[0];'
Click to expand...
Click to collapse
Thanks a lot. It compiles fine now.
Now see if it really works

Categories

Resources