Can you programmatically enable "Button Lock"? - Windows Mobile Development and Hacking General

Does anyone know how to programmatically enable the "Button Lock" function on the HTC devices? It's obviously not a registry key, so I assume there's some kind of (HTC) API function used to accomplish it :?:

maybe capturing and handling the event would be the way to go
i would asume that the hardware buttons throw events like most other things in windows
try looking into it

I'm not sure I understand what you're meaning by "capturing and handling the event"? There's no event to capture, unless you're suggesting I should "emulate" a couple of UI keypress-events which changes this setting. But that kind of implemenations usually aren't very stable.
It seems like quite of few device configuration settings isn't stored (or is visible) in either registry or filesystem. Is there some kind of non-visible configuraton hive available on these devices?

try reading this
http://www.pocketpcdn.com/forum/viewtopic.php?t=1966
you can prob find more using this search
http://www.google.dk/search?num=20&...G=Søg&meta=lr=lang_da|lang_en|lang_no|lang_sv

Ok, now I understand why you're talking about events. But the "Button Lock" setting isn't set by a hardware button. Its set from a "control panel applet", which got two alternatives
"When device is off:
( ) Lock all button except Power button
(*) Do not lock button"
Where the latter is the default after a cold reboot. Settings like these are not stored in registry, and I havent found an API for setting them either..

well the thing i was talking about was when you said program
i talked about one could write a program capturing all the buttons and only redirect the power button and leave the other event hanging
but i would asume that in the sdk there would be a flag which indicated if the the buttonlock was active
where i save if it is i'm not sure but it sure keep it on after a softreset so it cant be in active mem

Wille, did you ever work this one out? It's another of the many things I'd like to adjust programmatically.

have you looked in the stk ?
it should contain all the function calls that makes a pda work
changing something in the reg and changing sometime from a program are 2 different things

theora said:
Wille, did you ever work this one out? It's another of the many things I'd like to adjust programmatically.
Click to expand...
Click to collapse
No, unfortunately I didn't. Its not possible from an official standpoint since it seems to be a vendor specific implementation. The setting isn't stored in the registry or inside the standard file system.

You can try if Mort can help, he has made MortSaver, which shuts off the screen and buttons to act as buttonlock and screensaver in one. Perhaps he can help? Right now you can find him in the thread on MortRing, or through his website www.sto-helit.de. Or you can PM him of course.

I just handle the button events in MortSaver. Nothing special there...

wille said:
Does anyone know how to programmatically enable the "Button Lock" function on the HTC devices? It's obviously not a registry key, so I assume there's some kind of (HTC) API function used to accomplish it :?:
Click to expand...
Click to collapse
Try some reversing on \windows\buttonlock.exe and you'll get what u want

I've seen it's possible to set through a KernelIoControl call, but I haven't got enough debugging/re experience to determine the required function parameters.
(are there any in-memory debuggers like SoftIce available for these devices/Windows Mobile?)

As far as I know the best debugger right now is the free embedded visual tools from Microsoft.
There is nothing even close to SICE for CE.
However, IDA Pro, even though a disassembler and not a debugger, is quite powerful and usually does the trick.

Button Lock set/enable
I am also looking for a program/setting to turn on the button lock. I found this in another forum on xda-developers.com through a google search. There is a file to download but when executed on the PPC it gives an error Setup Failed "The file "\temp\SetButtonLock.exe" is not a valid Windows CE Setup file." I am not a programmer but I manage over 60 of these devices right now soon to be hundreds. Any info is appreciated.
http://forum.xda-developers.com/viewtopic.php?p=112394
This device is known by several names:
Audiovox PPC-6600
Audiovox PPC-6601
XdaIII (XDAIIi)
XdaIIs - O2
MdaIII (T-Mobile)
SPV M2000
i-mate PDA2k (MOST POPULAR NAME)
i-mate Pocket PC Phone 2
Qtek 9090
Siemens SX66 (Cingular)
HTC Blue Angel
Unicom CU928 (CDMA based China)
XV6600WOC (Verizon)

wille said:
Does anyone know how to programmatically enable the "Button Lock" function on the HTC devices? It's obviously not a registry key, so I assume there's some kind of (HTC) API function used to accomplish it :?:
Click to expand...
Click to collapse
Hi Wille,
This is probably too late to help, but I came across your post while looking for a solution. I ended up having to reverse engineer it myself...
You can use KernelIoControl(...) to set the button lock:
BOOL success = KernelIoControl(0x01012A00, &in, sizeof(in), NULL, 0, NULL);
struct button_lock_in
{
DWORD set_or_get;
DWORD set_value;
};
If set_or_get is 0x00000000, the set_value must be 0x00000000 to disable key lock and 0x00000001 to enable key lock.
If set_or_get is 0x00000001, set_value should be 0x00000000 (but it may be ignored). You then pass in a pointer to a DWORD in lpOutBuf and set nOutBufSize to sizeof(DWORD) (4 bytes). You'll get a 0x00000001 or 0x00000000 depending on if the buttons are locked or unlocked.
The above calls seem to work, but because it was gained from intercepting kernel calls and not from documentation I can not warrant that the above will work or won't set fire to your XDA.
By the way, lpBytesReturned doesn't seem to be implemented properly. It is unmodified by the KernelIoControl(...) IOCTL.

HELP
HELP
Somehow when I did a hard reset (for the first time) the ButtonLock is gone from Settings->System
Tried to call Audiovox/UTStar support, no help available.
Any idea how to get that app back? thx

Keylocking
Microsoft recommended way of doing this (turning keylock on) is posting
VK_F22 keycode (special key for locking WM5). I did small utility which looks Power Notification Queue and as soon as it sees WM_SUSPENDING message in it, it throws VK_F22 thus locking keyboard,
Utility can be found from
http://mobilitytoday.com/forum/showthread.php?t=13030

Devicelock
There is an aygshell-API function from Microsoft:
HRESULT SHDeviceLockAndPrompt();
But it is available only in very new Windows Mobile versions.
It works fine on a MDA Pro with AKU2.0 (OS 5.1.195 Build 14847.2.0.0) and on the landscape smartphone emulator image (same OS build) but it is not available in the standard emulator image with OS version 5.1.1700 (Build 14343.0.0.0).

How about the PIN-settings?
I would like to alternate between regular screen lock and PIN-lock..

Related

Any way of preventing screen rotate to portrait ?

Just wondering if there is a registry hack that stops the screen from automatically rotating and displaying in portrait mode when you flip the screen round ?
i.e. it should stay in landscape mode no matter if the screen is facing in/out or otherwise.
You can do it manually by clicking on the screen rotate icon, or going into Settings > Screen > Orientation, so I figure there must be a reghack to put it permanently into Landscape ?
tia
Ok, i've found the key at least which shows what mode is currently in use:
This is Landscape (Right-handed) mode:
HKEY_LOCAL_MACHINE\System\GDI\Rotation
Angle 0x5A (90)
HideOrientationUI 0x0 (0)
LanscapeMode 0x1 (1)
The question is, how do I stop those being overwritten or change it so when it's in Portrait mode, it actually uses those settings ?
gaspx: I'm an odd fellow. I'd written you a long post about basically:
rotation is achieved at OS level, and driver level, so althought it's possible to be notified of the screen being rotated, intercepting it would require, AFAIK, some fairly substantial low level code or a reg key I'm not aware of.
But then I remembered my work on the Universal Voice Command/External Key issue in another thread. I've written a test program called VJElectrify, which contains a hack called ClamHack. And I just tried clamhack, and amongst its other side effects, yes, it does allow you to prevent the system forcing a rotation. So system stays in landscape if you open in laptop mode, or rotait into portrait mode. You then manually choose your rotations.
VJElectrify isn't finished yet, still a lot more research to do, but yes, it is possible to prevent it Keep an eye out for when VJElectrify is released.
Anyone else know another way to do this? I can't think of any relevant reg settings.
V
Heh heh, I knew it probably wouldn't be as simple as a reg hack.. cheers for the reply Vijay, i'll keep a watch on your website for the forthcoming VJElectrify..
gaspx said:
Ok, i've found the key at least which shows what mode is currently in use:
This is Landscape (Right-handed) mode:
HKEY_LOCAL_MACHINE\System\GDI\Rotation
Angle 0x5A (90)
HideOrientationUI 0x0 (0)
LanscapeMode 0x1 (1)
Click to expand...
Click to collapse
Thats just the keys where the current state is stored.
the key you need is HKLM\Services\ScreenRotate (you can change the ShowIcon value here to enable/disable the today icon)
Ive tried just renaming the ScreenRotate but that failed then i tried changing the dll name stored in the key, after all if it cant find the dll surlly it'll stop the rotations.
NOPE, i know the dll rename is working as the icon failed to appear, but the auto rotates continue to happen, it must be OS, it must be!!
.....the search continues
Ive tried just renaming the ScreenRotate but that failed then i tried changing the dll name stored in the key, after all if it cant find the dll surlly it'll stop the rotations.
Click to expand...
Click to collapse
I did that as well.. sorry, should've mentioned it in my original post, but I had the same idea as you! - the screenrotate.dll just seems to be tied to the icon in the systray. sigh.
Have to wait patiently for the VJClamhack to be released..
The clam hack has, by design, side effects - it disables part of the system OS, which conveniently disables screen rotation detection and some other stuff on the hinge. However, the bugger refuses to enable hardware keys with lid closed.
Because clamhack is quite a big sledgehammer for a nut, I'm a little worried about putting it out - however, I've never seen any negative sideeffects, only positive
V
Load DinarSoft MemMaid on your Universal.
Just as you can delete Startup Items, you can also delete Start Up Services. I believe I saw a service related to screen rotation in there.
I don't have my Universal for another week (getting replaced), but I do recall seeing that in there.
As always, perform a backup in case you can't "add" it back in.
I don't think that Rotation service helps, I tried it a bit earlier, since it seems to be an obvious target.
V
However, the bugger refuses to enable hardware keys with lid closed.
Click to expand...
Click to collapse
Thats OK, i don't need to use hardware keys when it's closed -- I figure this is part of a bigger problem you're looking at..
ust as you can delete Startup Items, you can also delete Start Up Services. I believe I saw a service related to screen rotation in there.
Click to expand...
Click to collapse
Yeah, I think that was the one Carnivor and myself had found.. we just prevented the service starting manually by bodging the registry key, but all it does is stop the little screen rotate icon from appearing.. thanks though
Has anyone figured this out yet?
Thanks

How to disable the Phone buttons ?

To secure a Qtek2020i i must disable the phone buttons.
Only the GPRS mode must stay in use. (no call)
Any solution is welcome.
THX for your help
Dany (tontonpc)
Do you just want to disable the buttons or the incoming and outgoing calling facility?
http://forum.xda-developers.com/viewtopic.php?t=16135&highlight=disable+button
THX for the link.
I have read and find the AE ButtonPlus verry nice but not freeware.
Ther are also an old version free but...
I will just disable the red and green button.
Any suggestion ??? registry documentation ?
THX Again for your help, and for the link ;-)
Dany (tontonpc)
Why disable the buttons ?
Surely you should block calls using Settings->Phone->Services->Call Baring
I assume if you set this up it can be password protected.
tontonpc said:
To secure a Qtek2020i i must disable the phone buttons.
Only the GPRS mode must stay in use. (no call)
Any solution is welcome.
THX for your help
Dany (tontonpc)
Click to expand...
Click to collapse
I know how to remap the phone buttons, but i don't know if this will actually create a "secure" Qtek. This is because even if the phone won't execute by pressing the buttons, it can execute with the stylus. Now the solution isn't exactly simple, but it can be done. The "trick" is that the first application that maps the green and the red button, locks them and afterwards no other application can map them. In order to achieve this you must create an application, which will be started either by services.exe or HKEY_LOCAL_MACHINE\init which wil map the two keys.
To register the two buttons, you must execute the
RegisterHotKey API
The virtual key code for the green (talk) button is 114 (decimal not hex) and for the red (close) is 115 (decimal again). The fsModifiers parameter as stated in the API must be zero (0). You can give any IDs for these two buttons as long as they are unique.
Happy remaping.
I agree with CSExpert. For securing the phone, you're probably better off using TAPI methods to disable the line, standard API stuff to find and close the cprog.exe app, and possibly consider disconnecting the Phone's Modem programmatically.
V

HOWTO: programmatically pop up soft keyboard

Hi,
I want to programmatically make the soft keyboard show up on my device.
I am using eVC++ 4.0. Any Ideas?
Mohammad.
mohgdeisat said:
Hi,
I want to programmatically make the soft keyboard show up on my device.
I am using eVC++ 4.0. Any Ideas?
Mohammad.
Click to expand...
Click to collapse
Code:
SIPINFO si = {0};
si.cbSize = [COLOR=Blue]sizeof[/COLOR](SIPINFO);
SHSipInfo(SPI_GETSIPINFO, 0, &si, 0);
si.fdwFlags = SIPF_ON|SIPF_DOCKED;
SHSipInfo(SPI_SETSIPINFO, 0, &si, 0);
Code:
SHSipPreference(m_hWnd, SIP_UP); [COLOR=Green]// for a specific window (to use in focus events)[/COLOR]
Cheers,
.Fred
Thanks Fred, this really works perfectly...
I am happpy now
Mohammad
dotfred said:
Code:
SIPINFO si = {0};
si.cbSize = [COLOR=Blue]sizeof[/COLOR](SIPINFO);
SHSipInfo(SPI_GETSIPINFO, 0, &si, 0);
si.fdwFlags = SIPF_ON|SIPF_DOCKED;
SHSipInfo(SPI_SETSIPINFO, 0, &si, 0);
Code:
SHSipPreference(m_hWnd, SIP_UP); [COLOR=Green]// for a specific window (to use in focus events)[/COLOR]
Cheers,
.Fred
Click to expand...
Click to collapse
hopefully this question is astute enough to keep from being flamed, but what the heck, nothing ventured, nothing gained....
so, if i took this line of code:
SHSipPreference(m_hWnd, SIP_UP); // for a specific window (to use in focus events)
and modified it something like this:
SHSipPreference(m_hWnd, SIP_DOWN); // for a specific window (to use in focus events)
or some such, could i then set it to keep the soft keyboard from popping up (either programatically or globally) without selecting it from the input menu?
obviously i know little of programming, but you should be able to catch the logic behind it. as to why, people are all but begging for this functionality for their Wizards....
blazoner said:
hopefully this question is astute enough to keep from being flamed, but what the heck, nothing ventured, nothing gained....
so, if i took this line of code:
SHSipPreference(m_hWnd, SIP_UP); // for a specific window (to use in focus events)
and modified it something like this:
SHSipPreference(m_hWnd, SIP_DOWN); // for a specific window (to use in focus events)
or some such, could i then set it to keep the soft keyboard from popping up (either programatically or globally) without selecting it from the input menu?
obviously i know little of programming, but you should be able to catch the logic behind it. as to why, people are all but begging for this functionality for their Wizards....
Click to expand...
Click to collapse
The SHSipPreference(m_hWnd, SIP_DOWN); is normally used when you catch the WM_SETFOCUS/WM_KILLFOCUS of a specific window. This is the normal behaviour for EDIT controls on pocket pcs that do not have an integrated keyboard. I can imagine it is a burden on the Wizard...
If you want to control the behaviour of the virtual keyboard for all controls of the active window, I should consider to use the first code.
You can also hide the sip button appearing on the soft keys bar, when you use the SHCreateMenuBar api.
You can also show a window with the sip down with the SHInitDialog api.
ps.: if you want to control the SIP of the whole system, you have to subclass the window with the classname MS_SIPBUTTON.
Cheers,
.Fred
.Fred
Now I leave myself open for flaming, the way I read this:
On a wizard that has a keyboard that is open and i am using, there seem to be many application that do not relize this and thus pop up the soft keyboard.
Is there a application that will stop this on a global bases ? (as in trick the applications into thinking my soft keyboard is my hardware keyboard or on call just closing the soft keyboard)
If so were can I get it from as I cant program my VCR let alone my 8track.
Well maybe reading is not my strong point but I feel that there might be a need for a .fred kbd (on / Off) tool.
Myself I have a BA with a hardware Keyboard that I NEVER use so I am not sure how apps react.
PS no offence intended
MDAIIIUser said:
.Fred
Now I leave myself open for flaming, the way I read this:
On a wizard that has a keyboard that is open and i am using, there seem to be many application that do not relize this and thus pop up the soft keyboard.
Is there a application that will stop this on a global bases ? (as in trick the applications into thinking my soft keyboard is my hardware keyboard or on call just closing the soft keyboard)
If so were can I get it from as I cant program my VCR let alone my 8track.
Well maybe reading is not my strong point but I feel that there might be a need for a .fred kbd (on / Off) tool.
Myself I have a BA with a hardware Keyboard that I NEVER use so I am not sure how apps react.
PS no offence intended
Click to expand...
Click to collapse
I think different solutions are possible for this:
1) I know somebody developed a NULL virtual keyboard (no layout), so whatever happens, the keyboard will never show up on the screen.
2) The SIP is a driver, so if it is unloaded, the soft keybard will never show up on the screen even when clicking on the keyboard button on the softkey bar, BUT I don't know what will happen with the hard keyboard, will the keys still be handled? It should but... (I can't try, I don't have a hard keyboard)
3) As you suggested a background program that would handle the on/off SIP behaviour on demand.
For me, the easiest would be the second option, because you just unload a driver, so no harm is done and no extra hack is made.
Cheers,
.Fred
3)
Well 2 sounds fine but can "joe blow" do that.
Myself I like to 1.
I see a cab that installs GhostKbd, ....
a null keyboard that can be chossen as the "input methord" over keyboard icon bottom right, options.
This gives the user the chance of having it when he wants nothing or not have it when he wants something (wiered looking at it that way).
This also wont conflict with what ever the Hardkeyboard does (well I think any way).
Can you talk to "somebody" and get it ?
Maybe we could have soem input from those that have the problem.
EDIT and 3 but could be some work
MDAIIIUser said:
Well 2 sounds fine but can "joe blow" do that.
Myself I like to 1.
I see a cab that installs GhostKbd, ....
a null keyboard that can be chossen as the "input methord" over keyboard icon bottom right, options.
This gives the user the chance of having it when he wants nothing or not have it when he wants something (wiered looking at it that way).
This also wont conflict with what ever the Hardkeyboard does (well I think any way).
Can you talk to "somebody" and get it ?
Maybe we could have soem input from those that have the problem.
EDIT and 3 but could be some work
Click to expand...
Click to collapse
Here is a free app, that does that!
http://personales.ya.com/beemer/nullkeyboard.htm
Cheers,
.Fred
@ blazoner
So does the above solve your problem and if so should we post it in the wizard wiki ?
i'm not sure. i had a cab file not uninstall completely, and it was interfering with my SIP options. i'll give it another go after a hard reset/rom upgrade. should know by tomorrow.
looks like there's a solution out there after all....
i found this in this thread http://forum.xda-developers.com/showthread.php?p=918794#post918794
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#3 07-04-2006, 04:50 PM
mistrix Join Date: Nov 2005
Posts: 10
Hardware Keyboard only in Landscape
--------------------------------------------------------------------------------
On the Universal the combination of PQZ (to assign different SIPs to landscape and portrait, should work on other devices too) and PHMs "NoDoSIP" (registers a SIP that does nothing) works perfectly. Disable all SIPs not needed at all by setting the Reg Value (search for the SIP by name in the registry) Default under IsSIPInputMethod for that method to 0. You can rename your remaining SIPs there as well.
__________________
MDAPro, HBH662
Click to expand...
Click to collapse
so far it seems to work on my 8125
i've still gotta go through and delete SIP methods from my phone (just cause i'm a perfectionist....)
if it works all through the weekend, i'll post it to the wiki....
still working great! posted to the Wiki!
Can you add the wiki link just in case somebody uses search and finds this thread.
MDAIIIUser said:
Can you add the wiki link just in case somebody uses search and finds this thread.
Click to expand...
Click to collapse
Sure! It's on the main Wiki page for the Wizard.
Enjoy!

disallow screen rotation

Hello!
I need to write software that disallows any screen rotation on my Wizard.
How can I do it? I didn’t found any registry settings for this. The best way
that I see is hooking ChangeDisplaySettingsEx. But unfortunately, SetWindowsHookEx
doesn’t works on WM 5.0, at least it said on some topics. Please, give me any solution for this problem or example code to hook some API function.
wm5: [HKLM\System\GDI\Rotation]
Angle=dword:0
00000000 portrait
0000005a righthanded landscape
0000010e lefthanded landscape
then RegistryNotifyCallback will do
tanks a lot
I will try this way.
But I afraid it will be notified after screen rotation starting.
Adjusting this registry value in regedit tool did't help.
So I suppose this value is changing after rotation is done.
You can delete the start up service of ScreanRotate.
Go to HKLM/Services/ScreanRotate and delete it.
I think before you doing this,you can export it to a reg file
It's not bad idea.
but delete this key leading to system restart for apply
I just try to stop this service.
Not luck : (
This key not present in the registry storage.
I am under WM 5.0
Maybe you talk about some early system.
Hi hoblano, I'm experiencing the same problem, did you find a solution ?
thanks,
Scalposcarno
use task manager 2.7 and stop service...if you know it is service...
same way to stop kbd lights...btw,
I tried, but the result is the same as the one obtained by manually deleting the Screen Rotate voice within the services voices in the registry: avoiding the load of the service providing the icon on the task bar enabling the user to rotate the sceen one or more times by tapping on it.
I still don't understand ... at this point the most probable thing is that the service that rotate the OS screen when rotating by hand the HW screen, is invisible with respect to registry voices and to applications like Task Manager 2.7 or MemMaid. Apart from criticizing the constructor choice (why didn't they thought that someone should have been more comfortable using only one view mode ? e.g. landscape one), is there a way to obtain a list of core services and to avoid one of those to be loaded ? or, otherway, is there a way to intercept the event thrown when manually rotating the screen of the terminal ?
By the way, I'll have to do it with Java ...
thanks all

Quastion about Windows Mobile Registry. Need Help

I need programmatically change Profiles in phone (Normal, Silent...).
When I change Value ActiveProfile in Registry Key "HKEY_CURRENT_USER\ControlPanel\Profiles" I need also update changes in phone.
Question: How can I do it? What system message I must send for updating profiles status?
2007fs said:
I need programmatically change Profiles in phone (Normal, Silent...).
When I change Value ActiveProfile in Registry Key "HKEY_CURRENT_USER\ControlPanel\Profiles" I need also update changes in phone.
Question: How can I do it? What system message I must send for updating profiles status?
Click to expand...
Click to collapse
Depends what you need to do, in general there is a Windows Meesage WM_SETTINGCHANGE that will notify the change (provided that you flush the registry), however to me it looks like you are "hacking" the registry instead of using a more appropiate method, I never changed a profile, but I done some similar things, did you try something like the API SystemParametersInfo?
For example I must change Profile from Normal to Silent and after changing at the same time must automatically turn off the phone sound and on desktop must show non-sound icon.
I have try a sending message WM_SETTINGCHANGE, but I have no effect, may be I not correctly used command SendMessage.
API SystemParametersInfo and other I didn't try. May be you have any expirience in this?
As far as possible, write please some example to solve my problem
Take a look here:
http://groups.google.com/group/micr...rofile+registry&rnum=1&hl=en#b3a56f92d65fee2d
There are not good news, you either try to simulate a key stroke to change the profile or try to feed it or try to work out if DMProcessConfigXml function will make the trick by feeding the XML with the profile configuration.
It doesn't seem to be other workout, for the DMProcessConfigXml function is plenty of information and examples @ msdn.microsoft.com.
Hey!
I used this code and it helped me
HWND hWnd = FindWindow(_T("MSCprog"),NULL);
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);
::SendMessage(HWND_BROADCAST, WM_NOTIFY, 0, 0);
::SendMessage(HWND_BROADCAST, WM_USER+0x3084,0xFFFFFFFF,2);
if (hWnd!=NULL)
{
::SendMessage(hWnd, WM_USER+0x3084,0xFFFFFFFF,2);
::SendMessage(hWnd, WM_USER+0x3084,0xFFFFFFFF,2);
::SendMessage(hWnd, WM_USER+0x3084,0xFFFFFFFF,2);
}
don't worry and be happy, as I am
On the HTC Touch pro 2 in the settings somewhere I tapped commit registry and it said registry flushed. Since I have nothing on my phone really just yet I feel like doing a hard reset after pressing that button.
What does it do? Should I hard reset or not? Is it safe?
Does it change anything in the phone? Does/ can it make the phone run slower (after time maybe, or better?)? Can it make the phone have problems and flaws along with bad performance and instability; can it make the phone not stable? Can it change a certain program or make it worse? How often is the registry to be flushed?

Categories

Resources