From: Ernst Sauer on
Hello,

I want to find the OwnerName of a PPC.
Also I found many articles about CeRegSetValueEx
in the Internet, I could not solve the problem.

First I included the rapi2.h from
....\Windows Mobile 6 SDK\Activesync\Inc

#include "rapi2.h" (or <rapi2.h>)

Then I put the Rapiuuid.lib from
....\Windows Mobile 6 SDK\Activesync\Lib
to my project and gave all the information to the
project-settings: foldername ...)

Finally I tried the following function,
which i found in the Internet

//-----------------------------------------------
void RegOwnerChange(LPCTSTR OwnerName)

{ int strLength = (int)wcslen(OwnerName);
LONG rslt;
HKEY hOwner;
HRESULT hRapiResult;

hRapiResult = CeRapiInit();

rslt = CeRegOpenKeyEx(HKEY_CURRENT_USER
,L"ControlPanel\\Owner",0,KEY_SET_VALUE, &hOwner);

rslt = CeRegSetValueEx(hOwner, L"Name", 0, REG_SZ, (BYTE*)OwnerName,
(strLength+1)*sizeof(wchar_t));
rslt = CeRegSetValueEx(hOwner, L"Owner", 0, REG_BINARY,
(BYTE*)OwnerName, ( strLength + 1) *sizeof(wchar_t));
CeRegCloseKey(hOwner);
}
//------------------------------------------------

I get errors

..\MainFrm.cpp(281) : error C3861: 'CeRapiInit': identifier not found
..\MainFrm.cpp(283) : error C3861: 'CeRegOpenKeyEx': identifier not found
..\MainFrm.cpp(291) : error C3861: 'CeRegOpenKeyEx': identifier not found
..\MainFrm.cpp(293) : error C3861: 'CeRegSetValueEx': identifier not found
..\MainFrm.cpp(297) : error C3861: 'CeRegSetValueEx': identifier not found
..\MainFrm.cpp(298) : error C3861: 'CeRegCloseKey': identifier not found

For me, it looks like the compiler can not find the rapi2.h,
but I included it.

I use VISTA, VS 2005 prof., Windows Mobile 6 SDK.

Thanks
Ernst


From: Trevor on
Try including rapi.h instead of rapi2.h. You should probably link in
rapi.lib as well.

"Ernst Sauer" <Sauer-Ernst(a)t-online.de> wrote in message
news:hb20bb$a9e$02$1(a)news.t-online.com...
> Hello,
>
> I want to find the OwnerName of a PPC.
> Also I found many articles about CeRegSetValueEx
> in the Internet, I could not solve the problem.
>
> First I included the rapi2.h from
> ...\Windows Mobile 6 SDK\Activesync\Inc
>
> #include "rapi2.h" (or <rapi2.h>)
>
> Then I put the Rapiuuid.lib from
> ...\Windows Mobile 6 SDK\Activesync\Lib
> to my project and gave all the information to the
> project-settings: foldername ...)
>
> Finally I tried the following function,
> which i found in the Internet
>
> //-----------------------------------------------
> void RegOwnerChange(LPCTSTR OwnerName)
>
> { int strLength = (int)wcslen(OwnerName);
> LONG rslt;
> HKEY hOwner;
> HRESULT hRapiResult;
>
> hRapiResult = CeRapiInit();
>
> rslt = CeRegOpenKeyEx(HKEY_CURRENT_USER
> ,L"ControlPanel\\Owner",0,KEY_SET_VALUE, &hOwner);
>
> rslt = CeRegSetValueEx(hOwner, L"Name", 0, REG_SZ, (BYTE*)OwnerName,
> (strLength+1)*sizeof(wchar_t));
> rslt = CeRegSetValueEx(hOwner, L"Owner", 0, REG_BINARY,
> (BYTE*)OwnerName, ( strLength + 1) *sizeof(wchar_t));
> CeRegCloseKey(hOwner);
> }
> //------------------------------------------------
>
> I get errors
>
> .\MainFrm.cpp(281) : error C3861: 'CeRapiInit': identifier not found
> .\MainFrm.cpp(283) : error C3861: 'CeRegOpenKeyEx': identifier not found
> .\MainFrm.cpp(291) : error C3861: 'CeRegOpenKeyEx': identifier not found
> .\MainFrm.cpp(293) : error C3861: 'CeRegSetValueEx': identifier not found
> .\MainFrm.cpp(297) : error C3861: 'CeRegSetValueEx': identifier not found
> .\MainFrm.cpp(298) : error C3861: 'CeRegCloseKey': identifier not found
>
> For me, it looks like the compiler can not find the rapi2.h,
> but I included it.
>
> I use VISTA, VS 2005 prof., Windows Mobile 6 SDK.
>
> Thanks
> Ernst
>
>

From: Ernst Sauer on
Trevor schrieb:
> Try including rapi.h instead of rapi2.h. You should probably link in
> rapi.lib as well.
>

I get the same errors:
error C3861: 'CeRegEnumKeyEx': identifier not found
....
....


There is an example "pregdmp" in WM 6 SDK.
I successfully tested this example.
Then I did the same configuration in my projekt,
took the test-function
void DumpChild(HKEY hKey, int level)
from the example and got the errors above.

Perhaps it has something to do with the line
#ifndef UNDER_CE
in rapi.h

If I kill this line, I get other errors.

??????

Thanks
Ernst

From: Trevor on
Is your project a Win32 desktop project? The RAPI API are only used in
desktop projects. eVC/Visual Studio define UNDER_CE by default for Windows
Mobile/Pocket PC projects. Desktop projects shouldn't have UNDER_CE
defined.

"Ernst Sauer" <Sauer-Ernst(a)t-online.de> wrote in message
news:hb2s0f$ibs$03$1(a)news.t-online.com...
> Trevor schrieb:
>> Try including rapi.h instead of rapi2.h. You should probably link in
>> rapi.lib as well.
>>
>
> I get the same errors:
> error C3861: 'CeRegEnumKeyEx': identifier not found
> ...
> ...
>
>
> There is an example "pregdmp" in WM 6 SDK.
> I successfully tested this example.
> Then I did the same configuration in my projekt,
> took the test-function
> void DumpChild(HKEY hKey, int level)
> from the example and got the errors above.
>
> Perhaps it has something to do with the line
> #ifndef UNDER_CE
> in rapi.h
>
> If I kill this line, I get other errors.
>
> ??????
>
> Thanks
> Ernst
>

From: Ernst Sauer on
Trevor schrieb:
> Is your project a Win32 desktop project?

Hm, I think no.
With VS 2005 and WM 6 SDK I'm writing a program
for the PPC (MainFrm, MFC).
This program runs on the PPC and there I want
get the owner name which you normally can see on
the startup screen.

Is this a job only for .NET, I don't hope so.

Thanks
Ernst




> The RAPI API are only used in
> desktop projects. eVC/Visual Studio define UNDER_CE by default for
> Windows Mobile/Pocket PC projects. Desktop projects shouldn't have
> UNDER_CE defined.
>
> "Ernst Sauer" <Sauer-Ernst(a)t-online.de> wrote in message
> news:hb2s0f$ibs$03$1(a)news.t-online.com...
>> Trevor schrieb:
>>> Try including rapi.h instead of rapi2.h. You should probably link in
>>> rapi.lib as well.
>>>
>>
>> I get the same errors:
>> error C3861: 'CeRegEnumKeyEx': identifier not found
>> ...
>> ...
>>
>>
>> There is an example "pregdmp" in WM 6 SDK.
>> I successfully tested this example.
>> Then I did the same configuration in my projekt,
>> took the test-function
>> void DumpChild(HKEY hKey, int level)
>> from the example and got the errors above.
>>
>> Perhaps it has something to do with the line
>> #ifndef UNDER_CE
>> in rapi.h
>>
>> If I kill this line, I get other errors.
>>
>> ??????
>>
>> Thanks
>> Ernst
>>
>