Registry hack problem! - Windows CE

This is a discussion on Registry hack problem! - Windows CE ; Hi, I am an students.I am interested in wince.Now I have some troubles. I am programming a registry editor for smartphone/PPC,. I have modified the registry key,and then reboot the ppc, but take no effect. After reset, I view the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Registry hack problem!

  1. Registry hack problem!

    Hi,
    I am an students.I am interested in wince.Now I have some troubles. I
    am programming a registry editor for smartphone/PPC,.
    I have modified the registry key,and then reboot the ppc, but take no
    effect. After reset, I view the registry key which I modified by the vs
    remote registry editor and other registry editor, the registry key is
    really
    modified. The following is my codes, by which I want to display some
    words in the today screen.

    HKEY hOpenKey;
    DWORD result;
    long lresult =
    RegCreateKeyEx(HKLM,TEXT("Software\\Microsoft\\Shell\\DeviceBeta"),
    0,L"",NULL,NULL,NULL,&hOpenKey,&result);
    if(lresult==ERROR_SUCCESS)
    {
    TCHAR Value[256];
    ZeroMemory(Value,256);
    lstrcpy(Value,TEXT("IBE"));;
    lresult =
    RegSetValueEx(hOpenKey,TEXT("Today"),0,REG_SZ,(const BYTE
    *)&Value,256);
    }
    RegFlushKey (hOpenKey);
    RegCloseKey (hOpenKey);
    PostMessage(::GetDesktopWindow(),WM_WININICHANGE,0 xF2,0);
    please help me!!


  2. Re: Registry hack problem!

    I have a few suggestions (below, in-line), but am not confident. If
    you need more help, I suggest posting in
    microsoft.public.pocketpc.developer. But mention that you have tried
    here first (to avoid posts telling you not to post separately to
    multiple newsgroups).


    On 20 Nov 2006 23:40:14 -0800, "frank chen"
    wrote:

    >Hi,
    >I am an students.I am interested in wince.Now I have some troubles. I
    >am programming a registry editor for smartphone/PPC,.
    >I have modified the registry key,and then reboot the ppc, but take no
    >effect. After reset, I view the registry key which I modified by the vs
    >remote registry editor and other registry editor, the registry key is
    >really
    >modified.


    Are your targets running Windows Mobile 5 (WM 5)? If so, that may
    explain the symptoms. Because WM5 uses persistent memory for main
    storage, and that is relatively slow, it caches changes in the
    registry. Rebooting before the cache is flushed could cause your
    symptoms. I haven't used RegFlushKey, so I have no idea how it
    relates. Try pressing the power button and waiting a few seconds
    before rebooting. This is definitely counter-intuitive for me, but
    seems to be the recommended way to force changes to be saved.


    > The following is my codes, by which I want to display some
    >words in the today screen.
    >
    >HKEY hOpenKey;
    >DWORD result;
    >long lresult =
    >RegCreateKeyEx(HKLM,TEXT("Software\\Microsoft\\Shell\\DeviceBeta"),
    >0,L"",NULL,NULL,NULL,&hOpenKey,&result);
    >if(lresult==ERROR_SUCCESS)
    >{
    > TCHAR Value[256];
    > ZeroMemory(Value,256);


    ZeroMemory is redundant here; the next line is sufficient. No real
    harm, just a slight inefficiency.


    > lstrcpy(Value,TEXT("IBE"));;


    If you really only compile when UNICODE is defined (as for Windows
    CE), this will cause no problem. But you have mixed a macro (TEXT)
    that depends on whether UNICODE is defined with a function (lstrcpy)
    that doesn't. You should either use
    L and lstrcpy
    or
    TEXT and _tcscpy
    I suspect you don't fully understand the implications of CE's heavy
    bias towards UNICODE, so I strongly recommend taking time to learn.
    Otherwise, you will waste a lot of your time. For this particular
    issue, I suggest reading the tchar.h header file; it is not meant for
    human reading (I needed several attempts), but will clarify several
    mysteries. I also suggest using google
    (http://groups.google.com/advanced_group_search) to look up
    unicode
    in this newsgroup. This is not the cause of the symptom you describe.


    > lresult =
    >RegSetValueEx(hOpenKey,TEXT("Today"),0,REG_SZ,(const BYTE
    >*)&Value,256);
    >}
    >RegFlushKey (hOpenKey);
    >RegCloseKey (hOpenKey);
    >PostMessage(::GetDesktopWindow(),WM_WININICHANGE,0 xF2,0);
    >please help me!!


    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret, eMVP
    PenFact, Inc.
    20 Park Plaza, Suite 478
    Boston, MA 02116
    www.penfact.com

  3. Re: Registry hack problem!

    I have try, but failed. I am a stranger in windows ce, I will take you
    suggestion.
    I use the Remote Registry Editor in VS to see the Key value,the new key
    value is really exist after reboot(This show that I have changed the
    key), then I open it and click OK, then the words can be show in the
    screen. I feel delusory!

    "r_z_aret@pen_fact.com д
    "
    > I have a few suggestions (below, in-line), but am not confident. If
    > you need more help, I suggest posting in
    > microsoft.public.pocketpc.developer. But mention that you have tried
    > here first (to avoid posts telling you not to post separately to
    > multiple newsgroups).
    >
    >
    > On 20 Nov 2006 23:40:14 -0800, "frank chen"
    > wrote:
    >
    > >Hi,
    > >I am an students.I am interested in wince.Now I have some troubles. I
    > >am programming a registry editor for smartphone/PPC,.
    > >I have modified the registry key,and then reboot the ppc, but take no
    > >effect. After reset, I view the registry key which I modified by the vs
    > >remote registry editor and other registry editor, the registry key is
    > >really
    > >modified.

    >
    > Are your targets running Windows Mobile 5 (WM 5)? If so, that may
    > explain the symptoms. Because WM5 uses persistent memory for main
    > storage, and that is relatively slow, it caches changes in the
    > registry. Rebooting before the cache is flushed could cause your
    > symptoms. I haven't used RegFlushKey, so I have no idea how it
    > relates. Try pressing the power button and waiting a few seconds
    > before rebooting. This is definitely counter-intuitive for me, but
    > seems to be the recommended way to force changes to be saved.
    >
    >
    > > The following is my codes, by which I want to display some
    > >words in the today screen.
    > >
    > >HKEY hOpenKey;
    > >DWORD result;
    > >long lresult =
    > >RegCreateKeyEx(HKLM,TEXT("Software\\Microsoft\\Shell\\DeviceBeta"),
    > >0,L"",NULL,NULL,NULL,&hOpenKey,&result);
    > >if(lresult==ERROR_SUCCESS)
    > >{
    > > TCHAR Value[256];
    > > ZeroMemory(Value,256);

    >
    > ZeroMemory is redundant here; the next line is sufficient. No real
    > harm, just a slight inefficiency.
    >
    >
    > > lstrcpy(Value,TEXT("IBE"));;

    >
    > If you really only compile when UNICODE is defined (as for Windows
    > CE), this will cause no problem. But you have mixed a macro (TEXT)
    > that depends on whether UNICODE is defined with a function (lstrcpy)
    > that doesn't. You should either use
    > L and lstrcpy
    > or
    > TEXT and _tcscpy
    > I suspect you don't fully understand the implications of CE's heavy
    > bias towards UNICODE, so I strongly recommend taking time to learn.
    > Otherwise, you will waste a lot of your time. For this particular
    > issue, I suggest reading the tchar.h header file; it is not meant for
    > human reading (I needed several attempts), but will clarify several
    > mysteries. I also suggest using google
    > (http://groups.google.com/advanced_group_search) to look up
    > unicode
    > in this newsgroup. This is not the cause of the symptom you describe.
    >
    >
    > > lresult =
    > >RegSetValueEx(hOpenKey,TEXT("Today"),0,REG_SZ,(const BYTE
    > >*)&Value,256);
    > >}
    > >RegFlushKey (hOpenKey);
    > >RegCloseKey (hOpenKey);
    > >PostMessage(::GetDesktopWindow(),WM_WININICHANGE,0 xF2,0);
    > >please help me!!

    >
    > -----------------------------------------
    > To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
    >
    > Robert E. Zaret, eMVP
    > PenFact, Inc.
    > 20 Park Plaza, Suite 478
    > Boston, MA 02116
    > www.penfact.com



+ Reply to Thread