Related
Hi everybody,
I'm trying to comunicate with my SIM, which supports SIM application tookit, using the RIL API.
In order to do that I think I need:
- Send Command to the SIM (Envelope)
- Receive Response from the SIM (Fetch)
- Send Command Response to the SIM (Terminal Response)
At this moment I can do only the first two things.
I can send command using RIL_SendSimToolkitEnvelopeCmd function and using, as input, a well formed string as defined in the specification GSM 11.14; for example, in order to select the second item of the SIM Application Menu, I use this code:
BYTE envcmd[9];
envcmd[0] = 0xd3; // Menu selection tag
envcmd[1] = 0x07; // Length
envcmd[2] = 0x02; // Device Identity Tag
envcmd[3] = 0x02; // Device Identity length
envcmd[4] = 0x82; // Source: ME
envcmd[5] = 0x81; // Destination: SIM
envcmd[6] = 0x10; // Item Identifier tag
envcmd[7] = 0x01; // Item Identifier length
envcmd[8] = 0x02; // Item chosen
hres = RIL_SendSimToolkitEnvelopeCmd(m_hRil, envcmd, 9);
The response for this command is trapped in the notify handler (second thing I can do).
After the notification I need to send a Command Response to the SIM and to do that I think I need to use RIL_SendSimToolkitCmdResponse using, as input parameter, a well formed string as specified in the GSM 11.14; something like this:
// Response for DISPLAY TEXT
response[0x00] = 0x81;
response[0x01] = 0x03;
response[0x02] = 0x01;
response[0x03] = 0x21;
response[0x04] = 0x81;
response[0x05] = 0x02;
response[0x06] = 0x02;
response[0x07] = 0x82;
response[0x08] = 0x81;
response[0x09] = 0x03;
response[0x0a] = 0x01;
response[0x0b] = 0x00;
hres = RIL_SendSimToolkitCmdResponse(m_hRil, response, 12);
But the result (hres) is always 0x80070057 (E_INVALIDARG).
Could anyone help me?
Thanks in advance.
Sektor
P.S.: please note that the response I send is the same as that I sniffed using a Season logger which can intercept all traffic between SIM and PDA.
Although I can't help, I've got a question: Once you're finished - could this then be used to implement Bluetooth SIM Access Profile?
No.
In order to implement SAP, we need a "flat" access to the SIM and to do that the radio module has to export a commad like AT+CSIM (GSM 07.07).
If the radio module implements that command, using the RIL_SendSimCmd we can send all possible commands to the SIM and so we could develope a SAP layer.
Unfortunally, as I know, there is no radio module that permits a complete access to the SIM.
Before to take the SAT street I tryed to use SendSimCmd on my JasJar but the reult was always E_NOTIMPL.
Bye
Sektor
SendSimCmd is implemented on the Wizard, at least (I'm using it ) - but it'll only be useful if you want to access a specific application on the card (if you're trying to talk to the GSM application on channel 0 you're out of luck)
Regarding SendSimToolkitEnvelopeCmd I've got mixed results according to the devices - working on some, and failing on others with this return code, and do not know why, yet. But here since you're failling on the SendSimToolkitCmdResponse, that seems different. Even if I never used this function before (I always let the handset provide its own Terminal Reponse) I think it's badly formatted. The response to a Display Text should only include a General Result (0x03 0x01 0x00).
What do you mean when you say "...to access a specific application on the card"?
What kind of PDU are you able to send to the SIM? And how can you specify which channel you want to open?
BTW, in order to implement SAP, we need to access to channel 0 for sending GSM commands.
Regarding RIL_SendSimToolkitCmdResponse, I tryed also to send General Result (0x03 0x01 0x00), as you suggested, but with no luck.
I think SendSimToolkitCmdResponse wants a specific struct as input parameter (something like specified in this document http://www.intrinsyc.com/whitepapers/RIL_whitepaper_MS_Intrinsyc_June2004.pdf).
I tryed with the struct specified in that document and the resut is changed: 0x8007000e (E_OUTOFMEMORY) :-(
Any ideas?
I have a JasJar with WM 5.0.
Bye
Sektor
What do you mean when you say "...to access a specific application on the card"?
Click to expand...
Click to collapse
I mean access a SIM card application located by its AID
What kind of PDU are you able to send to the SIM? And how can you specify which channel you want to open?
Click to expand...
Click to collapse
Basically you'll need to open a channel to your application with an ISO 7816-4 Open Channel command, then you are in your own world
BTW, in order to implement SAP, we need to access to channel 0 for sending GSM commands.
Click to expand...
Click to collapse
OK, then it's going to be difficult I think. Unless you have a 3G card and a multi-selectable USIM application that you could select on another channel to send your APDUs, but I don't know if this is supported by any card (never tested it).
Any ideas?
Click to expand...
Click to collapse
I did a small project some years ago that can be used to install a dummy driver that'll record everything. I think you can use it for RIL and try to dump the structure that's sent to understand it better (and publish the results here )
http://arisme.free.fr/hacks/binaries/XBridge.zip
Arisme, your application is very cool
With your driver I can see all traffic between RIL.dll and rilgsm.dll and so I can see the commands sent by STK_Service.dll (SIM Application Toolkit layer in the JasJar) to the rilgsm.dll via ril.dll.
The structure used by the RIL.dll to communicate with rilgsm.dll in the function RIL_SendSimToolkitCmdResponse is:
typedef struct rilsimtoolkitrsp_tag
{
DWORD cbSize; // Structure and text size in bytes
DWORD dwParams; // Indicates valid parameters
DWORD dwId; // ID number of command
DWORD dwTag; // Command tag (with comprehension bit)
DWORD dwType; // Type of command (DISPLAY TEXT, etc.)
DWORD dwQualifier; // Command details qualifier
DWORD dwResponse; // Command result from SIM toolkit layer
DWORD dwAdditionalInfo; // Additional command result information.
} RILSIMTOOLKITRSP;
as defined in the document linked in my previous post.
I used the same structure as parameter for RIL_SendSimToolkitCmdResponse, but the question is: is it correct?
That structure is used between RIL.dll and rilgsm.dll and not between my application and RIL.dll.
BTW I tryed to fill the fields with the info logged with your driver and the result is always the same: 0x8007000e (E_OUTOFMEMORY).
I think I need to intercept the call that STK_Service.dll makes to RIL.dll.
Now I'll try to bypass RIL.dll using RIL1: device and DeviceIoControl.
Bye
Sektor
Did you check if the info passed in the IOControl associated to this RIL function (you'll have to find which one it is first ) logged by the bridge matches this structure ?
Yes, I did and the structure matches the info logged.
But I am not sure that the same structure can be used from my application.
When I use that structure as parameter for RIL_SendSimToolkitCmdResponse the response is always bad, as I said.
But I have good news: using RIL1: device and DeviceIoControl I can send a command response; here the code.
#define RIL_SEND_STK_ENVELOPE_RESPONSE 0x300018CL
RILSIMTOOLKITRSP rsp;
memset(&rsp, sizeof(RILSIMTOOLKITRSP), 0);
rsp.cbSize = 0x20;
rsp.dwParams = 0x1f;
rsp.dwId = 0x01;
rsp.dwTag = 0x81;
rsp.dwType = 0x21;
rsp.dwQualifier = 0x81;
rsp.dwResponse = 0x00;
rsp.dwAdditionalInfo = 0x00;
BYTE *b = (BYTE *)&rsp;
int s = rsp.cbSize;
DWORD rildevresult = 0;
DWORD nReturned = 0;
HANDLE m_hRilDev= CreateFile(L"RIL1:", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0);
if (!DeviceIoControl(m_hRilDev, RIL_SEND_STK_ENVELOPE_RESPONSE, b, s, &rildevresult, sizeof(rildevresult), &nReturned,0))
{
rildevresult = GetLastError();
debug("Error: %08lx\n", rildevresult);
}
debug("DeviceIoControl(RIL_SEND_STK_ENVELOPE_RESPONSE): %08lx\n", rildevresult);
BTW I prefer to find the correct structure for RIL_SendSimToolkitCmdResponse.
Bye.
Sektor
that's a good step forward already 8)
I found the solution
The function prototype in the ril.h is NOT correct!
In ril.h RIL_SendSimToolkitCmdResponse is defined as:
HRESULT RIL_SendSimToolkitCmdResponse(HRIL hRil,const BYTE* lpbResponse, DWORD dwSize);
The correct definition for my ril.dll is:
HRESULT RIL_SendSimToolkitCmdResponse(HRIL hRil, const RILSIMTOOLKITRSP* pRsp, const LPBYTE pDetails, DWORD dwDetailsSize);
where RILSIMTOOLKITRSP is
typedef struct rilsimtoolkitrsp_tag
{
DWORD cbSize; // Structure and text size in bytes
DWORD dwParams; // Indicates valid parameters
DWORD dwId; // ID number of command
DWORD dwTag; // Command tag (with comprehension bit)
DWORD dwType; // Type of command (DISPLAY TEXT, etc.)
DWORD dwQualifier; // Command details qualifier
DWORD dwResponse; // Command result from SIM toolkit layer
DWORD dwAdditionalInfo; // Additional command result information.
} RILSIMTOOLKITRSP;
and pDetails is a buffer with the data needed to complete the response, e.g.:
BYTE details[3];
details[0] = 0x90;
details[1] = 0x01;
details[2] = 0x0b;
in order to select the item "0x0b" in response to a "select item" proactive command, or
BYTE details[14];
details[0] = 0x8d;
details[1] = 0x0c;
details[2] = 0x04;
details[3] = 0x74;
details[4] = 0x65;
details[5] = 0x6c;
details[6] = 0x65;
details[7] = 0x76;
details[8] = 0x69;
details[9] = 0x73;
details[10] = 0x69;
details[11] = 0x6f;
details[12] = 0x6e;
details[13] = 0x65;
in order to give an input data ("televisione" in this example) in response to a "get input" proactive command.
I don't know if the parameters for that function depend on the ril version, however I give you the details about my device:
I-Mate JasJar
ROM: 1.13.46 ITA (09/23/05)
Radio: 1.03.01
Protocol: 42.36.P8
ExtRom: 1.13.126 ITA
Windows Mobile 5.0
Bye
Sektor
Thanks, good to know 8)
Many thanks for this topic, it was my guide to RIL_STK programming. I've spent some time developing automatic Multi-SIM switcher application, and would like to share some information (ohh, I'm ETEN M600 owner, so this info could be wrong for other devices).
1. In my case RIL_SendSimToolkitCmdResponse takes DWORD details data, not the BYTE one Sector described in previous post. Information it should contain also differs, it looks like regular RIL structure, not like the GSM standart described Terminal Response. Example of SelectItem response data:
DWORD details[3];
details[0] = sizeof(details);
details[1] = 0x01;
details[2] = selectedItem;
2. The only documentation about RIL structures I had was the Sector links to some PDF's describing RILSIMTOOLKITRSP and RILSIMTOOLKITCMD. I needed however to decode incoming notifications, so I've reversed structures coming from SIM in SelectItem case (lpData points to RILSIMTOOLKITCMD, +dwDetailsOffset you get RILSIMTOOLKITSELECTITEM, +dwOffsetAlpha = menu caption, at +dwOffsetItems you could get dwNumItems looking like RILSIMTOOLKITITEMDESC:
typedef struct rilsimtoolkitselectitem_tag
{
DWORD cbSize;
DWORD dwNull0;
DWORD dwNull1;
DWORD dwNull2;
DWORD dwSizeAlpha;
DWORD dwOffsetAlpha;
DWORD dwNumItems;
DWORD dwSizeItems;
DWORD dwOffsetItems;
} RILSIMTOOLKITSELECTITEM;
typedef struct rilsimtoolkititemdesc_tag
{
DWORD cbSize;
DWORD dwNull0;
DWORD dwItemID;
DWORD dwNull1;
DWORD dwNull2;
DWORD dwSizeAlpha;
DWORD dwOffsetAlpha;
} RILSIMTOOLKITITEMDESC;
3. In overal it seems RIL of my M600 encodes all commands and notifications to such structures and requires similar structures for STK commands, altrough that is not obvious while reading this topic and available documentation.
wbr, Nik.
P.S. ETEN M600, fw 216.
P.P.S. Sorry for interferring with not HTC-clone device, just couldn't found another such usefull WM developers forum.
Hi,
I'm a newbie to the RIL API.
So, first of all, thx to all of you for giving me good info on this in your discussions.
I'm having no success with the RIL_SendSimToolkitEnvelopeCmd function.
Just for testing, I'm sending the same test command as above:
BYTE envcmd[9];
envcmd[0] = 0xd3; // Menu selection tag
envcmd[1] = 0x07; // Length
envcmd[2] = 0x02; // Device Identity Tag
envcmd[3] = 0x02; // Device Identity length
envcmd[4] = 0x82; // Source: ME
envcmd[5] = 0x81; // Destination: SIM
envcmd[6] = 0x10; // Item Identifier tag
envcmd[7] = 0x01; // Item Identifier length
envcmd[8] = 0x02; // Item chosen
hres = RIL_SendSimToolkitEnvelopeCmd(m_hRil, envcmd, 9);
In the result callback, I'm getting dwCode == RIL_RESULT_ERROR and lpData points to E_FAIL (0x80004005).
Now, I've enabled logging and my celog shows that the RIL driver is getting the folowing command.
0:02:47.449.538 : DEBUGMSG: PID:0x805d8dc0 TID:0x834a576c [RETAIL]RilDrv: Sending cmd: AT+SATE=0,D30702028281100102
The response is also shown as:
0:02:47.484.606 : DEBUGMSG: PID:0x805d8dc0 TID:0x8349d974 [RETAIL]RilDrv: Accumulated response: +SATE: 0F00006F008169B4ECAA19CDF41D6A35C8<cr><lf>
I was expecting to recieve the response "6F00" in the result callback.
Any ideas?
If you can give me any other command to test the envelope command, that would help.
Thanks,
-R.
Arisme said:
I mean access a SIM card application located by its AID
Basically you'll need to open a channel to your application with an ISO 7816-4 Open Channel command, then you are in your own world
OK, then it's going to be difficult I think. Unless you have a 3G card and a multi-selectable USIM application that you could select on another channel to send your APDUs, but I don't know if this is supported by any card (never tested it).
I did a small project some years ago that can be used to install a dummy driver that'll record everything. I think you can use it for RIL and try to dump the structure that's sent to understand it better (and publish the results here )
Click to expand...
Click to collapse
Hi:
I've been researching in XDA forums with no success so far. A few days ago I found this thread that you participated in a long time ago. Actually, my problem is I don't know how to access in Windows Mobile an applet application located by means of its AID... I've tried to send selection command:
Code:
00 A4 04 04 10 D2760001180002FF34004F8908010D09
thorugh RIL_SendSimCmd, but it didn't work (response=0x01 0x05 0x00 0x81).
Would you, please, give me a hand? I'm absolutely lost and desperated.
Thanks in advance...
I found the solution:
We must use logic channels. 0 Channel is reserved for GSM/USIM, other channel, usually #1, is used for applets.
APDU's sequence is:
Manage Channel (Open)
00 70 00 00 01
Respose
0x 90 00 (Where "x" indicates the logic channel assigned by the smartcard. Usually the respose is "01 90 00", being "01" channel number one).
Select Local APP
0x A4 04 04 10 <AID> (Substitute "x" for channel number assigned in Manage Channel (Open) command response ("1" in the case of our example).
Response
90 00
COMMAND INVOCATION
From now on if we want to send commands to the app, we just have to indicate the channel in CLASS byte (i.e. "9x" being "x=1", hence 91[INS][...])
Manage Channel (Close)
00 70 80 0x 00, where "0x" indicates the channel number we want to close. ("1" in our example).
Thanks anyway...
Ok, when I'm in my office I have poor signal issues that drain my battery and miss calls. If I switch to Roaming Only in my phone settings, then everything is just peachy. Problem is, its a lot of menus to click through every single time I come in to my office (Start, settings, phone, services, roaming, get settings, roaming only).
And then when I'm leaving, I want to turn the romaing settings back to automatic, once again its a lot of clicking.
I would imagine it would not be too difficult to write an app that could toggle that setting. Then it could be one click, or someone could even map the app to a hardware button for the ultimate ease of use.
I'm sure there are others who can see how useful such an app would be. Many of us do something like this all the time.
So, what do you think? Anyone willing to help develop this?
Sounds like a do-able program that would be very useful even for people not in your situation. Of course, I don't know how to, I'm just endorsing this idea.
In for this
GREAT!
Now, who can actually help figuring out how to code this? Can that sort of data even be accessed from standard APIs?
MortScript
Ok folks, until I have the time to find out what actually goes on behind the scenes when roaming settings are changed, I think our best bet is to write a script of keypresses/mouseclicks using mortscript.
Mortscript, in case you didn't know, is a simple batch process program, which lets you assign a series of commands to a script, sort of like a macro.
This will essentially be a script to go through the menus and click through options to do what we would do by hand. It will speed things up a bit, but it won't be as simple as a standalone app.
playing with mortscript now, I'll keep you guys posted.
EDIT: Anyone who wants to take a crack at this as well, by all means, mortscript is free! I'm just learning how to use it now, but if anyone has any experience with it, hit me up with suggestions! Or better yet, write a script and show me how it works!
Can anyone tell me what registry changes are made when you switch from roaming to automatic?
I can't seem to compare registry backups taken with PHM RegEdit (some propietary format, and no export to text option!)
Mortscript to the rescue....
This is still not the most ideal solution, but it works for me.
I wrote two Mortscript scripts that simulate the key taps automatically. The downside to this is that you can't toggle it on/off, you need to run one program to force roam, and another one to put it back to automatic.
USE THESE AT YOUR OWN RISK!
If you have any bugs/questions/comments, let me know.
Requirements
MortScript:
You need to install the mortscript interpreter first.
http://www.sto-helit.de/downloads/mortscript/MortScript-4.0.zip
The zip file attached below contains two .mscr files:
Roam
Roam-NO
Pretty self explanatory what does what. You can rename them if you want, this just works for me.
Dishe said:
I wrote two Mortscript scripts that simulate the key taps automatically. The downside to this is that you can't toggle it on/off, you need to run one program to force roam, and another one to put it back to automatic.
Click to expand...
Click to collapse
If you wanted to, you could write a temp file or reg key to check if the setting is on or off. In fact, the file wouldn't even need any data in it, you could just check for it's existence. That way you only need one script. Hope that helps you out.
I havent been able to find (or pull) the ril.dll file from a Mogul Wm6 installation, but once you have that file, you should be able to dump the exports and use the RIL_* functions by ordinal. This has been done on GSM phones.
I haven't had time yet, but I believe someone has dumped the files from the newest update rom.
Dishe,
I took your script and applied my suggestion to it. I also wrapped it up in a standalone package, so if anyone else wants to run it, they won't need MortScript installed as the exe is in here. If you already have MortScript installed, you can just run the .mscr file instead of the .exe of the same name.
What it will do is run the prog, then check for the existence of the file "roam" in the script path. If it's not there, it will run your roam function and then create the file. If it already exists (meaning you turned on roaming only), then it run your function to turn off roaming and delete the temp file. Hope it helps you out.
EDIT: If for some reason the key presses do the wrong thing, you can just set your phone back to automatic and delete the "roam" file in the script path if it's there, then you're back in business.
EDIT2: Added a longer wait time (5 secs) for the Comm Manager, should allow it to work with more graphic intensive Comm Managers (like the Kaiser 10-button, tested).
Vinny75 said:
I havent been able to find (or pull) the ril.dll file from a Mogul Wm6 installation, but once you have that file, you should be able to dump the exports and use the RIL_* functions by ordinal. This has been done on GSM phones.
I haven't had time yet, but I believe someone has dumped the files from the newest update rom.
Click to expand...
Click to collapse
I know, qouting myself, but.. you don't need the ordinal, you can get the function by name from the dll, so far I am able to use RIL_Initialize and RIL_GetRoamingMode to call my pfResultCallback, but the value I am getting in reutrn isn't making sense, so have to figure that out. I am using a modified tstril util. I can post the changes if anyone wants to take a look.
Got the following for RIL_GetRoaming Mode
Mode Value
Sprint Only 0x00000001
Automatic 0x000000FF
Roaming Only 0x000000FE
Now using RIL_SetRoamingMode, I can set the Sprint Only mode, the other two throw a 0x80004005 HRESULT, I can use 0x00000002 and 0x0000003 (constants defined if you search the internet), and they don't throw an error, but they dont actually change any settings...
You can get tstril from here:
http://wiki.xda-developers.com/index.php?pagename=RIL
Expanded ril.h (not sure how accurate):
http://www.xs4all.nl/~itsme/projects/xda/ril/ril.h
Replace the DoRIL function in tstril.cpp with this code to test:
Code:
typedef HRESULT (*pfnRIL_Initialize)(DWORD, RILRESULTCALLBACK, RILNOTIFYCALLBACK, DWORD, DWORD, HRIL*);
typedef HRESULT (*pfnRIL_GetRoamingMode)(HRIL);
typedef HRESULT (*pfnRIL_SetRoamingMode)(HRIL, DWORD);
//HRIL g_hRIL;
HINSTANCE g_hDLL;
HRESULT g_hResult;
DWORD
DoRIL(LPVOID lpvoid)
{
HRESULT result;
DWORD dwNotificationClasses = 0xFF0000;
LRESULT lresult;
TCHAR szString[256];
SendMessage(g_hwndEdit, LB_RESETCONTENT, 0, 0);
lresult = SendMessage(g_hwndEdit, LB_GETHORIZONTALEXTENT, 0, 0);
SendMessage(g_hwndEdit, LB_SETHORIZONTALEXTENT, 1000, 0);
//result = RIL_Initialize(1, ResultCallback, NotifyCallback,
// dwNotificationClasses, g_dwParam, &g_hRil);
//wsprintf(szString, L"RIL Handle: %08X, result %08X", g_hRil, result);
//SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
g_hRil = NULL;
g_hDLL = LoadLibrary(L"ril.dll");
//HRESULT hResult = 0;
if (g_hDLL != NULL)
{
pfnRIL_Initialize lpfnRIL_Initialize = (pfnRIL_Initialize)GetProcAddress(g_hDLL, L"RIL_Initialize");
if (lpfnRIL_Initialize)
{
result = (lpfnRIL_Initialize)(1, ResultCallback, NULL /*NotifyCallback*/, 0 /*dwNotificationClasses*/, 0 /*g_dwParam*/, &g_hRil);
if (result == S_OK)
{
wsprintf(szString, L"Initialize RIL Handle: %08X, result %08X", g_hRil, result);
SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
pfnRIL_GetRoamingMode lpfnRIL_GetRoamingMode = (pfnRIL_GetRoamingMode)GetProcAddress(g_hDLL, L"RIL_GetRoamingMode");
if (lpfnRIL_GetRoamingMode)
{
g_hResult = (lpfnRIL_GetRoamingMode)(g_hRil);
wsprintf(szString, L"GetRoamingMode RIL Handle: %08X, g_hResult %08X", g_hRil, g_hResult);
SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
}
//pfnRIL_SetRoamingMode lpfnRIL_SetRoamingMode = (pfnRIL_SetRoamingMode)GetProcAddress(g_hDLL, L"RIL_SetRoamingMode");
//if (lpfnRIL_SetRoamingMode)
//{
// g_hResult = (lpfnRIL_SetRoamingMode)(g_hRil, 254);
// wsprintf(szString, L"SetRoamingMode RIL Handle: %08X, g_hResult %08X", g_hRil, g_hResult);
// SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
//}
}
}
//FreeLibrary(g_hDLL);
}
// while(1) {
// Sleep(100);
//// wsprintf(szString, L"%s",L"...");
//// SendMessage(g_hwndEdit, LB_ADDSTRING, 0, (LPARAM) szString);
// }
return 0;
}
Thanks for the work on those Mort Scripts!
Thank you!
wow, I haven't checked this thread in a while...
Vinny75, I haven't had time to play with this, but it looks like you've been making some progress... how far have you gotten with this?
The following values you should work for the second parameter of the RIL_GetRoamingMode and RIL_SetRoamingMode functions... they appeared to work on my phone
Mode RIL_GetRoamingMode RIL_SetRoamingMode
Sprint Only 0x00000001 0x00000001
Automatic 0x000000FF 0x00000004
Roaming Only 0x000000FE 0x00000005
I found the RIL_SetRoamingMode value in the following Registry Key
[HKEY_LOCAL_MACHINE\SOFTWARE\OEM\PhoneSetting\NetworkService]
Vinny75 said:
The following values you should work for the second parameter of the RIL_GetRoamingMode and RIL_SetRoamingMode functions... they appeared to work on my phone
Mode RIL_GetRoamingMode RIL_SetRoamingMode
Sprint Only 0x00000001 0x00000001
Automatic 0x000000FF 0x00000004
Roaming Only 0x000000FE 0x00000005
I found the RIL_SetRoamingMode value in the following Registry Key
[HKEY_LOCAL_MACHINE\SOFTWARE\OEM\PhoneSetting\NetworkService]
Click to expand...
Click to collapse
So would editing the registry be sufficient to change the roaming mode of the phone?
Did you compile an app to do this?
slightly off topic, but i think vinny75 might know the answer. id like to modify my alltel-based rom to give sprint only, automatic, roaming only options (alltel gives home only and automatic.) is ril.dll all that is needed from the sprint rom?
Dishe said:
So would editing the registry be sufficient to change the roaming mode of the phone?
Did you compile an app to do this?
Click to expand...
Click to collapse
I just compiled a quick and dirty app to test the values... the source is in my previous posts
I am trying to access some control panel applets from
my application. This works fine for the most applets.
I use the ctlpnl.exe process to display the applets like:
CreateProcess(_T("ctlpnl.exe"), _T("cplmain.cpl,27,0"), NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
For some reason I cannot display the applet for USB to PC connection (ID 27 in WM5, 28 in WM6).
In WM6 I have the same problem with the encryption applet (ID 27). All other applets work. The applet is displayed for 1 second, I can see
the title in the window and then it disappears.
Has anybody made the same experiences? Is there a workaround for this?
Is this a bug in ctlpnl.exe or in WM5/6?
Thanks for any help.
Houser
Try calling it independent of ctlpnl.exe:
Do a LoadLibrary on the .cpl file
Call GetProcAddress to get a pointer to the CPlApplet function
Call CPlApplet with msg == CPL_INIT
Call CPlApplet with msg == CPL_GETCOUNT to get the # of applets supported by the .cpl file
For each applet above (i = 0 to CPL_GETCOUNT - 1), call CPlApplet with msg == CPL_NEWINQUIRE, taking note of the lData value returned.
For the applet you want to launch, call CPlApplet with msg == CPL_DBLCLK, lParam1 == the applet #, lParam2 == the lData value from the previous step.
When you're done, call CPlApplet with msg == CPL_STOP.
I've done this in big Windows, but never on CE -- my read of the MSDN doc suggests it should work on WM 5/6.
Have already tried it this way but not with lData value when
calling CPL_DBLCLK. But the problem is still there. When I want to access
the cplmain.cpl applet with ID 27 (USB to PC connection) it does not work.
The other IDs (<27) work perfectly.
I do not know why! Arghhh!
Houser
Nobody has encounter same problems with CPL applets?
Houser
did you ever figure this out?
I am having same issues
Houser said:
I am trying to access some control panel applets from
my application. This works fine for the most applets.
I use the ctlpnl.exe process to display the applets like:
CreateProcess(_T("ctlpnl.exe"), _T("cplmain.cpl,27,0"), NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
For some reason I cannot display the applet for USB to PC connection (ID 27 in WM5, 28 in WM6).
In WM6 I have the same problem with the encryption applet (ID 27). All other applets work. The applet is displayed for 1 second, I can see
the title in the window and then it disappears.
Has anybody made the same experiences? Is there a workaround for this?
Is this a bug in ctlpnl.exe or in WM5/6?
Thanks for any help.
Houser
Click to expand...
Click to collapse
Due to the increasing amount of requests bulking up other threads, regarding how to make and use parameters I'm starting this thread with all the info at the begining, and I'll link it in my signature.
I make no claim to have discovered all of them.
I hereby present my collection gathered (copy & paste mostly) from this and other sites.
How to create .LNK files and use parameters
HOW TO CREATE SHORTCUTS ON YOUR PPC, NOT ON THE PC AND THEN TRANSFER THEM-
1-Don't use the inbuilt file explorer. use gsfinder, or total commander etc. The inbuilt file explorer can't edit links or show file extensions - if you try to rename something to xxx.LNK, it will really be xxx.lnk.txt (or something)
2: Using the other file explorer, copy and paste a shortcut to ANY file/exe/.lnk you want.
3: Tap & hold on this new shortcut, select 'properties'.
4: in properties, write the address of the program you want the shortcut for. ie- program files\xxx.exe or windows\xxx.exe or ctlpnl cplmain.cpl,5 (the about screen)...
5: Ok/Close the properties, & rename the link to whatever you want leaving .LNK at the end
THE OTHER METHOD IS-
Again you'll need a different file explorer. Create a .TXT file with the content '#ctlpnl cplmain.cpl,1' or '#' followed by the address , such as '#tmail.exe' (for example) then rename the file extension to .LNK In my tests a number before the # is NOT required.
---------------------------------------------------------------------------------------
NOTES-
When creating using a .txt file the contents must start with a '#', if creating by editing the properties of an existing .lnk you do not need the '#' There are examples below of both methods, if it has a '#' it's the .txt method, if it is in quotes, it is the address as it would need to be in the properties of the .lnk file
It is NOT possible to open a link to the folder view you get by \start menu\programs unless you have folderview.exe in your windows folder, none of my 4 devices have that so I've not tested it. But you can open to folders with file explorer using, for example- "\program files\greensoftware\gsfinder.exe" windows\start menu\programs\games
There is NO shortcut to quickly dial a number, you would need to go through the 'confirm number page', or use 3rd party soft such as vijay555's
Edit: Quicker dialing shortcut found and added, still requires you to press 'Talk' after you run the .lnk though
---------------------------------------------------------------------------------------
Available parameters for tmail.exe (depending on the service used) are- "tmail.exe" -new ""
"tmail.exe" -service ""
"tmail.exe" -to ""
"tmail.exe" -subject ""
"tmail.exe" -Body ""
"tmail.exe" -attach ""
"tmail.exe" -open "inbox"
"tmail.exe" -sync
or combinations of all such as-
"tmail.exe" -to "[email protected]" -subject "Photos" -Message "Hi, here is the picture" -attach "\my documents\my pictures\1.jpg"
---------------------------------------------------------------------------------------
Links for settings:
Settings>Personal>Password>Password = 20#ctlpnl cplmain.cpl,1
Settings>Personal>Password>Hint = 22#ctlpnl cplmain.cpl,1,1
Settings>Personal>Owner Information>Identification = 20#ctlpnl cplmain.cpl,2
Settings>Personal>Owner Information>Notes = 22#ctlpnl cplmain.cpl,2,1
Settings>Personal>Owner Information>Options = 22#ctlpnl cplmain.cpl,2,2
Settings>System>Power>Main = 20#ctlpnl cplmain.cpl,3
Settings>System>Memory>Main = 20#ctlpnl cplmain.cpl,4
Settings>System>Memory>Storage Card = 22#ctlpnl cplmain.cpl,4,1
Settings>System>Memory>Running Programs = 22#ctlpnl cplmain.cpl,4,2
Settings>System>About>Version = 20#ctlpnl cplmain.cpl,5
Settings>System>About>Device ID = 22#ctlpnl cplmain.cpl,5,1
Settings>System>About>Copyrights = 22#ctlpnl cplmain.cpl,5,2
Settings>System>Backlight>Brightness = 20#ctlpnl cplmain.cpl,6
Settings>System>Backlight>Battery power= 20#ctlpnl cplmain.cpl,6,1
Settings>System>Backlight>External power = 20#ctlpnl cplmain.cpl,6,2
Settings>System>Screen>General = 20#ctlpnl cplmain.cpl,7
Settings>System>Screen>Clear Type = 22#ctlpnl cplmain.cpl,7,1
Settings>System>Screen>Text Size = 22#ctlpnl cplmain.cpl,7,2
Settings>Personal>Input>Input Method = 20#ctlpnl cplmain.cpl,8
Settings>Personal>Input>Word Completion = 22#ctlpnl cplmain.cpl,8,1
Settings>Personal>Input>Options = 22#ctlpnl cplmain.cpl,8,2
Settings>Personal>Sounds & Notifications>Sounds = 20#ctlpnl cplmain.cpl,9
Settings>Personal>Sounds & Notifications>Notifications = 22#ctlpnl cplmain.cpl,9,1
Settings>System>Remove Programs = 21#ctlpnl cplmain.cpl,10
Settings>Personal>Menus>Start Menu = 21#ctlpnl cplmain.cpl,11
Settings>Personal>Menus>New Menu = 23#ctlpnl cplmain.cpl,11,1
Settings>Personal>Buttons>Program Buttons = 21#ctlpnl cplmain.cpl,12
Settings>Personal>Buttons>Up/Down Controls = 23#ctlpnl cplmain.cpl,12,1
Settings>Personal>Today>Appearance = 21#ctlpnl cplmain.cpl,13
Settings>Personal>Today>Items = 23#ctlpnl cplmain.cpl,13,1
Settings>Connections>Beam = 21#ctlpnl cplmain.cpl,15
Settings>System>Clock & Alarms>Time = 21#ctlpnl cplmain.cpl,16
Settings>System>Clock & Alarms>Alarms = 23#ctlpnl cplmain.cpl,16,2
Settings>Connections>Network Cards = 21#ctlpnl cplmain.cpl,17
Settings>System>Regional Settings>Region = 21#ctlpnl cplmain.cpl,18
Settings>System>Regional Settings>Number = 23#ctlpnl cplmain.cpl,18,1
Settings>System>Regional Settings>Currency = 23#ctlpnl cplmain.cpl,18,2
Settings>System>Regional Settings>Time = 23#ctlpnl cplmain.cpl,18,3
Settings>System>Regional Settings>Date = 23#ctlpnl cplmain.cpl,18,4
Settings>Connections>Connections>Task = 21#ctlpnl cplmain.cpl,19
Settings>Connections>Connection>Advanced = 23#ctlpnl cplmain.cpl,19,1
Settings>Personal>Phone>Phone = 21#ctlpnl cplmain.cpl,20
Settings>Personal>Phone>Services = 23#ctlpnl cplmain.cpl,20,1
Settings>Personal>Phone>Network = 23#ctlpnl cplmain.cpl,20,2
Settings>Personal>Phone>More = 23#ctlpnl cplmain.cpl,20,3
Settings>System>Certificates>Personal = 21#ctlpnl cplmain.cpl,22
Settings>System>Certificates>Root = 23#ctlpnl cplmain.cpl,22,1
Settings>Connections>Bluetooth>Mode = 21#ctlpnl cplmain.cpl,23
Settings>Connections>Bluetooth>Devices = 23#ctlpnl cplmain.cpl,23,1
---------------------------------------------------------------------------------------
Calendar agenda view 21#:MSCALENDAR -va?outres.dll,-100002
Calendar day view 21#:MSCALENDAR -vd?outres.dll,-100002
Calendar month view 21#:MSCALENDAR -vm?outres.dll,-100002
Calendar week view 21#:MSCALENDAR -vw?outres.dll,-100002
Calendar year view 21#:MSCALENDAR -vy?outres.dll,-100002
Calendar must be already running in the background for these to work
---------------------------------------------------------------------------------------
New Task: "poutlook.exe" tasks -new
New Note: "notes.exe" -n
New Contact: "poutlook.exe" contacts -new
New Appointment: "poutlook.exe" calendar -new
---------------------------------------------------------------------------------------
To Dial a number: "\windows\cprog.exe" -n -url tel:+1234567890
---------------------------------------------------------------------------------------
camera
"\windows\camera.exe" -i =photo mode
"\windows\camera.exe" -v =video mode
"\windows\camera.exe" -p =contact photo mode
"\windows\camera.exe" -m =mms video mode
"\Windows\HTCAlbum.exe" -mode:camera -type:image
"\Windows\HTCAlbum.exe" -mode:camera -type:video
"\windows\camera.exe" -t =picture theme mode
"\windows\camera.exe" -b =burst mode
"\windows\camera.exe" -g =GPS photo mode
"\windows\camera.exe" -s =Sport mode
---------------------------------------------------------------------------------------
You will also have PowerOffWarning.exe (long power press key) (and maybe others) in your windows folder renaming another .exe (such as device lock) and pasting into windows will result in the long press of the power key running that program instead of turning off your device.
---------------------------------------------------------------------------------------
To change the icon of the .lnk file.
Useful if you have several mail .lnks and would like to differentiate between, for example, Google and Hotmail. Or if you want to assign icons to .lnks for Mortscripts etc.
Icon sources can be .DLLs or .EXEs, not picture files, such as .PNGs. View the icons within these files using RViewer.
Change the file extension of the .lnk file to .txt, open it, you will see the address for the program, or what ever it is that you have linked to eg "program files\my program.exe" you need to append a "?" followed by the address of the icon you want to use, then ",-" then the number of the icon within the icon file you are using, the default icon is "000".
You will end up with "program files\my program.exe",?example.exe,-000
If you have any suggestions or corrections please post and I'll add them or edit this post.
Wiki'd
for future use............
for future use............
and how is it diff than : http://forum.xda-developers.com/showthread.php?t=340974
ather90 said:
and how is it diff than : http://forum.xda-developers.com/showthread.php?t=340974
Click to expand...
Click to collapse
Well that's a 20+ page thread of mostly questions. I can't easily link to it and say look at x, y or z page for the answer can I?
Also as is obvious by the posts in that thread and many others (my reason for this thread) is that most people don't bother reading the thread for the answer, here I have tried to put them all in the first post not over 258.
Secondly, my intention is to improve this thread by adding other 'noob' questions when I find them or think of them, to the first posts, for example how often do you see- 'how to install a .cab file?'? etc.
Basically add all the answers I keep writing in threads, even my signature was made so I could just say 'click it for what you want' (requests I used to read all the time).
Hopefully that answers your question?
hehe thats ok then
Wiki this m8. This is great wiki material.
NeoS2007 said:
Wiki this m8. This is great wiki material.
Click to expand...
Click to collapse
done
http://wiki.xda-developers.com/index.php?pagename=LinksAndParameters
what's the link for the setting page with 3 tabs (personal,system,connections)?
can't find any info for that link.
thanks in advance.
regards,
twisted
twisted said:
what's the link for the setting page with 3 tabs (personal,system,connections)?
can't find any info for that link.
Click to expand...
Click to collapse
There is no known .lnk to the settings pages.
I'll try to upload 2 .exes which simulate it.
bbobeckyj said:
There is no known .lnk to the settings pages.
I'll try to upload 2 .exes which simulate it.
Click to expand...
Click to collapse
the files don't work for me, thanks anyway.
i have browsed thru this thread and found the necessary files for opening the programs and settings page.
regards,
twisted
questions:
1. What parameters in tmail.exe to direct immediately to SMS INBOX?
I tried (tmail.exe -service "SMS" -open "Inbox") But if you happen to you outbox last, it opens outbox instead.
2. What parameters in notes.exe will change the default working directory? For example I want to use another folder named "my notes"
3. I tried MSNOTETAKE and it loads faster than plain notes.exe So what is MSNOTETAKE and MSINBOX? Can you list all the others?
thanks in advance.
BoyBawang2 said:
questions:
1. What parameters in tmail.exe to direct immediately to SMS INBOX?
I tried (tmail.exe -service "SMS" -open "Inbox") But if you happen to you outbox last, it opens outbox instead.
Click to expand...
Click to collapse
If messaging is already open, running the .lnk will just 'show' whatever in/out/box is already open
2. What parameters in notes.exe will change the default working directory? For example I want to use another folder named "my notes"
3. I tried MSNOTETAKE and it loads faster than plain notes.exe So what is MSNOTETAKE Can you list all the others?
thanks in advance.
Click to expand...
Click to collapse
Sorry, I can't help, I don't use MSNOTETAKE
All these parameters are ones I have found elsewhere and a couple I figured out myself through trial and error, then posted here in one place.
Thanks a lot for the continuous collections and discoveries of these shortcuts, which could make great enhancemenent of WM unsing experiience.
Two additional requests though, will add up your heavy works, but will make this thread more perfect.
1. Coming from the experience of using Nanling's QuickMenu app, I assume that it is possible to associate those shortcuts for 'settings' with icons from some dll or exe file. Would you please find the way to do that and upgrade all settings shortcuts?
2. Would you please make all of them into a ready-to-use .lnk files and pack them up in a zip file, then attatch it on first post?
Just ignore my requests if you feel they are unreasonable.
Thanks again for your hard works.
Edit:
Found the shortcut for PowerOff (wiz & w/o icon) in this thread.
If rename any .lnk file to Long_Send.lnk and copy it to windows folder, the long-send button (press and hold the green phone button) will be assigned as the represented function of the .lnk file.
hilinda said:
If messaging is already open, running the .lnk will just 'show' whatever in/out/box is already open ???
Click to expand...
Click to collapse
for example, if sms inbox is already open in the background, and you click a link for sms outbox, it will show the inbox.
wg5566 said:
Thanks a lot for the continuous collections and discoveries of these shortcuts, which could make great enhancemenent of WM unsing experiience.
Two additional requests though, will add up your heavy works, but will make this thread more perfect.
1. Coming from the experience of using Nanling's QuickMenu app, I assume that it is possible to associate those shortcuts for 'settings' with icons from some dll or exe file. Would you please find the way to do that and upgrade all settings shortcuts?
2. Would you please make all of them into a ready-to-use .lnk files and pack them up in a zip file, then attatch it on first post?
Just ignore my requests if you feel they are unreasonable.
Thanks again for your hard works.
Edit:
Found the shortcut for PowerOff (wiz & w/o icon) in this thread.
If rename any .lnk file to Long_Send.lnk and copy it to windows folder, the long-send button (press and hold the green phone button) will be assigned as the represented function of the .lnk file.
Click to expand...
Click to collapse
I don't know any link for the real settings pages, it's been discussed many times on here, if it's truely available someone will have posted it.
I'll get the zip file done soon, with all the universal links, ie no point me posting links to various email names etc.
I don't know if there is a link for power off button, but the long hold actions is 'powerOffWarning.exe' in the windows folder.
I have 4 different ppcs, the long hold functions are different in each one.
bbobeckyj said:
I don't know any link for the real settings pages, it's been discussed many times on here, if it's truely available someone will have posted it.
Click to expand...
Click to collapse
Sorry but English is not my own language and I did not make it clear. I did not mean icon for the 'settings' folder, what a I meant is associate an icon with each specific setting items.
I'll get the zip file done soon, with all the universal links, ie no point me posting links to various email names etc.
Click to expand...
Click to collapse
Thanks.
I don't know if there is a link for power off button, but the long hold actions is 'powerOffWarning.exe' in the windows folder.
Click to expand...
Click to collapse
What I meant is the PowerOff function, not the button, please read this thread, it's 4 pages altogether at yhe moment.
http://forum.xda-developers.com/showthread.php?t=424235&page=1
[Edit: No need to read through the whole thread, these two posts is enough:
http://forum.xda-developers.com/showpost.php?p=2623981&postcount=7
&
http://forum.xda-developers.com/showpost.php?p=2633464&postcount=15]
have 4 different ppcs, the long hold functions are different in each one.
Click to expand...
Click to collapse
Thanks for the comment, I didn't know in the past.
Sorry, I misread your question about file associations, but anyway, I don't know how to do it.
vijay555's vjFastOff (?) I think it's that name, will completely power off your ppc without having the confirmation dialogue.
bbobeckyj said:
Sorry, I misread your question about file associations, but anyway, I don't know how to do it.
vijay555's vjFastOff (?) I think it's that name, will completely power off your ppc without having the confirmation dialogue.
Click to expand...
Click to collapse
Shortcut for poweroff:
_DrG_ said:
Ok had a little play with this, i can get the power off dialogue to appear from a shortcut using any one of the following commands and parameters in a .lnk file:
31#"\Windows\PowerOffWarning.exe", "PowerOff"
31#"\Windows\PowerOffWarning.exe" \ExitWindowsEX (EWX_POWEROFF, 0)
31#"\Windows\PowerOffWarning.exe" \ExitWindowsEX (EWX_SHUTDOWN, NULL)
31#"\Windows\PowerOffWarning.exe" \ExitWindowsEX
Not sure if any of this helps you guys out but i've attached an example, maybe some else will know a way to be able to bypass the yes/no prompt.....
Click to expand...
Click to collapse
For control panel icon, please refer to yhis thread:
Control Panel links and icons wm2003se and higher
But it's not complete,can anybody work out a completed list for this?
Edit: Some of the shortcuts linked on the thread are for PPC2003 only, so we really need a complete list for WM5 & up.
Edit: Some methold & tools can be found in this thread:
http://forum.xda-developers.com/showthread.php?t=332766
tweakradje said:
Hi,
Just compiled a long lasting annoyance of Control Panel shortcuts and matching icons (see attachement)
They work ok for wm2003 and higher.
Example:
22#ctlpnl cplmain.cpl,0,0?shellres.dll,-13905
Note that the second ,0 is the number of the subpage
(Tab) of that settings page. 0 = first, 1 = second etc.
So making a text file called Kill.lnk with the line:
22#ctlpnl cplmain.cpl,4,2?shellres.dll,-13900
gives you instant access to Running Programs.
Placing this link in \Windows\Start Menu\Programs you can
even put it under a button.
Note: subpages don't work if settingX is redirected in HKLM\ControlPanel\settingX with a "Redirect" value.
Have fun,
Tweakradje
A list of them:
nr function icon (shellres.dll)
-------------------------------------------
0 CPL_Contrast 13905
1 CPL_Password 13942
2 CPL_Owner 13841
3 CPL_Power 13895
4 CPL_Memory 13900
5 CPL_About 13899
6 CPL_Screen 13902 (backlight)
7 CPL_Stylus 13906 (align screen)
8 CPL_SIP 13936
9 CPL_Sounds 13924
10 CPL_Remove 13943
11 CPL_Menus 13937
12 CPL_Button 13944
13 CPL_Today 13952
14 CPL_Offerings 13971 (updates)
15 CPL_Beam 13910
16 CPL_Clock 13840
17 CPL_Network 13888
18 CPL_Regional 13901
19 CPL_Phone 13953 (connections)
20 CPL_AdminPasswd 13954
21 CPL_Bluetooth 13909
22 CPL_Certificates 13941
Extra for WM5:
23 CPL_Watson 13996
24 CPL_GPSID 13997
The shortcuts:
22#ctlpnl cplmain.cpl,0,0?shellres.dll,-13905
22#ctlpnl cplmain.cpl,1,0?shellres.dll,-13942
22#ctlpnl cplmain.cpl,2,0?shellres.dll,-13841
22#ctlpnl cplmain.cpl,3,0?shellres.dll,-13895
22#ctlpnl cplmain.cpl,4,0?shellres.dll,-13900
22#ctlpnl cplmain.cpl,5,0?shellres.dll,-13899
22#ctlpnl cplmain.cpl,6,0?shellres.dll,-13902
22#ctlpnl cplmain.cpl,7,0?shellres.dll,-13906
22#ctlpnl cplmain.cpl,8,0?shellres.dll,-13936
22#ctlpnl cplmain.cpl,9,0?shellres.dll,-13924
23#ctlpnl cplmain.cpl,10,0?shellres.dll,-13943
23#ctlpnl cplmain.cpl,11,0?shellres.dll,-13937
23#ctlpnl cplmain.cpl,12,0?shellres.dll,-13944
23#ctlpnl cplmain.cpl,13,0?shellres.dll,-13952
23#ctlpnl cplmain.cpl,14,0?shellres.dll,-13971
23#ctlpnl cplmain.cpl,15,0?shellres.dll,-13910
23#ctlpnl cplmain.cpl,16,0?shellres.dll,-13840
23#ctlpnl cplmain.cpl,17,0?shellres.dll,-13888
23#ctlpnl cplmain.cpl,18,0?shellres.dll,-13901
23#ctlpnl cplmain.cpl,19,0?shellres.dll,-13953
23#ctlpnl cplmain.cpl,20,0?shellres.dll,-13954
23#ctlpnl cplmain.cpl,21,0?shellres.dll,-13909
23#ctlpnl cplmain.cpl,22,0?shellres.dll,-13941
23#ctlpnl cplmain.cpl,23,0?shellres.dll,-13996
23#ctlpnl cplmain.cpl,24,0?shellres.dll,-13997
EDIT: added 2 icons/links for WM5
Click to expand...
Click to collapse
I know folks get annoyed when folks post a thanks (like this) in the thread but here goes anyway.
Very much appreciated; be nice to have this stickied.
Cheers,
Some users, including myself are having a problem with GAlarm turning our devices on at midnight but they don't reenter standby thereafter. GAlarm offers a registry setting change to avoid this (MidnightWakeUp: False), but it could interfere with alarms being properly scheduled and cause them not to go off. Since I rely on GAlarm heavily, that wasn't a solution I could try.
The following script needs to be manually executed once. That places a notification in place to run the script automatically at 12:05am, will reschedule itself for the next day automatically, and then turn off your device.
prscott, RoryB, and CLHatch are the bomb for generously fixing my screwups and providing various code.
Code:
# Turn off your device at 12:05am every morning to counteract a gAlarm bug where device turns on at midnightand refuses to reenter standby.
# Thanks to prscott from xda devs for scheduling script example: http://forum.xda-developers.com/showthread.php?p=1925725#post1925725
# Additional thanks to RoryB and CLHatch for helping me with mortscript time: http://forum.xda-developers.com/showpost.php?p=7414028&postcount=3494
# getting time, date and weekday information
GetTime(hour,min,sec,day,month,year)
date = TimeStamp()
year = (FormatTime("Y"))
nextyear = (FormatTime("Y") + 1)
month = (FormatTime("m"))
nextmonth = (FormatTime("m") + 1)
day = (FormatTime("d"))
weekday = (FormatTime( "w" ))
hour = (FormatTime("H"))
nexthour = (hour + 1)
tomorrow = FormatTime("d", TimeStamp()+86400)
nextday = (FormatTime( "d" ) + 1)
# kill old notification(s) to prevent overlap
RemoveNotifications( "\Storage Card\gamidnightfix.mscr" )
# If on phone - wait 5 minutes to start again
CallActive = RegRead( "HKLM", "System\State\Phone", "Active Call Count" )
If (CallActive > 0)
RunAt( ( TimeStamp() + 60*5 ), "\Storage Card\gamidnightfix.mscr" )
Call ExitNow
EndIf
# add tomorrow's 12:05 am notification and poweroff
# set new notify
If (tomorrow = 01)
If (month = 12)
RunAt( nextyear, 01, 01, 00, 05, "\Storage Card\gamidnightfix.mscr")
Else
RunAt( year, nextmonth, 01, 00, 05, "\Storage Card\gamidnightfix.mscr")
EndIf
Else
RunAt( year, month, nextday, 00, 05, "\Storage Card\gamidnightfix.mscr")
EndIf
# go into standby
poweroff
# exit routine
exit