Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

error C3861: 'CeRegSetValueEx': identifier not found

 
   Soft32 Home -> PDA -> Pocket PC Developer RSS
Next:  How to get the operator name?  
Author Message
Ernst Sauer

External


Since: Jan 16, 2009
Posts: 11



(Msg. 1) Posted: Tue Oct 13, 2009 9:20 am
Post subject: error C3861: 'CeRegSetValueEx': identifier not found
Archived from groups: microsoft>public>pocketpc>developer (more info?)

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
Back to top
Login to vote
Trevor

External


Since: Nov 06, 2008
Posts: 15



(Msg. 2) Posted: Tue Oct 13, 2009 12:34 pm
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

"Ernst Sauer" <Sauer-Ernst.DeleteThis@t-online.de> wrote in message
news:hb20bb$a9e$02$1@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
>
>
Back to top
Login to vote
Ernst Sauer

External


Since: Jan 16, 2009
Posts: 11



(Msg. 3) Posted: Tue Oct 13, 2009 5:20 pm
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
Back to top
Login to vote
Trevor

External


Since: Nov 06, 2008
Posts: 15



(Msg. 4) Posted: Wed Oct 14, 2009 11:20 am
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.RemoveThis@t-online.de> wrote in message
news:hb2s0f$ibs$03$1@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
>
Back to top
Login to vote
Ernst Sauer

External


Since: Jan 16, 2009
Posts: 11



(Msg. 5) Posted: Wed Oct 14, 2009 3:20 pm
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.DeleteThis@t-online.de> wrote in message
> news:hb2s0f$ibs$03$1@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
>>
>
Back to top
Login to vote
Trevor

External


Since: Nov 06, 2008
Posts: 15



(Msg. 6) Posted: Wed Oct 14, 2009 5:11 pm
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

RAPI is used in desktop programs to interface with Pocket PC/Windows Mobile
devices connected via ActiveSync/Windows Mobile Device Center. RAPI2 is an
improved interface over RAPI, but it requires you to use COM. You must get
a pointer to the IRAPISession object and then you can use that to call
IRAPISession->CeRegEnumKeyEx. RAPI1 is just straight C functions like the
CeRegEnumKeyEx function you are trying to use. RAPI1 is easier to use in
C++, but it is lacking some nice features from RAPI2 like the ability to be
notified when devices connect/disconnect & a way to get the GUID for the
connected device & more.

If your goal is to read the registry from a program running on the mobile
device then forget about the CeXXX functions because those are only for
RAPI. You can use the same functions you would use in Win32 (for the most
part). If you only want to run this code on the device without using the
desktop/RAPI interface then you can use RegEnumKeyEx (which does not require
RAPI).

There is a .NET managed wrapper for RAPI2 on Codeplex
(http://rapi2.codeplex.com/). I found an example C++ class to wrap some of
the RAPI2 COM interfaces
(http://knowledgepointer.wordpress.com/2008/11/01/talking-to-a-windows-mobile-device-rapi-2/).
I have very little experience with either of them, but they look good.

"Ernst Sauer" <Sauer-Ernst.RemoveThis@t-online.de> wrote in message
news:hb5bfi$gfc$03$1@news.t-online.com...
> 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.RemoveThis@t-online.de> wrote in message
>> news:hb2s0f$ibs$03$1@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
>>>
>>
Back to top
Login to vote
Erwin Zwart

External


Since: Dec 29, 2008
Posts: 4



(Msg. 7) Posted: Thu Oct 15, 2009 3:25 am
Post subject: Re: error C3861: 'CeRegSetValueEx': identifier not found [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Use the RegCreateKeyEx/RegSetValueEx api's to retrieve the registry keys
from an application running on the device.

check:
http://www.pocketpcdn.com/articles/ownerinformation.html


Good luck,

Erwin Zwart,
Check out my blog: http://GuruCE.com/blog

GuruCE
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

Trevor schreef:
> RAPI is used in desktop programs to interface with Pocket PC/Windows
> Mobile devices connected via ActiveSync/Windows Mobile Device Center.
> RAPI2 is an improved interface over RAPI, but it requires you to use
> COM. You must get a pointer to the IRAPISession object and then you can
> use that to call IRAPISession->CeRegEnumKeyEx. RAPI1 is just straight C
> functions like the CeRegEnumKeyEx function you are trying to use. RAPI1
> is easier to use in C++, but it is lacking some nice features from RAPI2
> like the ability to be notified when devices connect/disconnect & a way
> to get the GUID for the connected device & more.
>
> If your goal is to read the registry from a program running on the
> mobile device then forget about the CeXXX functions because those are
> only for RAPI. You can use the same functions you would use in Win32
> (for the most part). If you only want to run this code on the device
> without using the desktop/RAPI interface then you can use RegEnumKeyEx
> (which does not require RAPI).
>
> There is a .NET managed wrapper for RAPI2 on Codeplex
> (http://rapi2.codeplex.com/). I found an example C++ class to wrap some
> of the RAPI2 COM interfaces
> (http://knowledgepointer.wordpress.com/2008/11/01/talking-to-a-windows-mobile-device-rapi-2/).
> I have very little experience with either of them, but they look good.
>
> "Ernst Sauer" <Sauer-Ernst RemoveThis @t-online.de> wrote in message
> news:hb5bfi$gfc$03$1@news.t-online.com...
>> 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 RemoveThis @t-online.de> wrote in message
>>> news:hb2s0f$ibs$03$1@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
>>>>
>>>
>
Back to top
Login to vote
Ernst Sauer

External


Since: Jan 16, 2009
Posts: 11



(Msg. 8) Posted: Thu Oct 15, 2009 7:20 am
Post subject: Thanks Trevor and Erwin [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Now it works fine.

Ernst
Back to top
Login to vote
Display posts from previous:   
Related Topics:
error C3861: 'CoInitializeSecurity': identifier not found - I am writing a Smart Device MFC Application (using Visual Studio 2005 for Windows Mobile 5.0 Pocket PC) which actually...

using EDB, "identifier not found" problem - Hi, I'm trying to get started with EDB in VS2005. I've got: #define EDB #include "windbase.h" but when...

error C2065: '_JBLEN' : undeclared identifier IN VS2005 - hello everyone ! I use VS2005 and PPC2003 platform to compile a Project ,and got the following error :..

error C2065: 'SetDlgItemText' : undeclared identifier when.. - Hi, I am developing in eVC++ 2002 for the x86 Pocket PC 2002 emulator. I had the following SetDlgItemText command..

Check SQL Query - if correct, no syntax error, procee some.. - Hi, I have a textbox which allow user to enter their SQL query. So that query will be dynamic each time cos it is base...

File not found IO error - On my device (IPAQ5450), I always receive the exception (File not found) when I try to read the EmployeTache.xml file..
       Soft32 Home -> PDA -> Pocket PC Developer All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
 Mac
  PDA


[ Contact us | Terms of Service/Privacy Policy ]