Hi all,

Does anyone has an example that is using the SimWriteMessage method of the
SIM manager API?

Thanks in advance.

RE: SimWriteMessage example by djarjar

djarjar
Thu May 26 12:05:01 CDT 2005

The best way to have the format of data for the SimWriteMessage is to call
before the SimReadMessage ;-).

That's what I have done with the following code:
HRESULT status=SimReadMessage (hSim,SIM_SMSSTORAGE_SIM,1,&simMessage);
dwIndex = 1;
status=SimWriteMessage (hSim,SIM_SMSSTORAGE_SIM,&dwIndex,&simMessage);

The SimReadMessage returns 0 so it's ok, the simMessage structure is filled
with a message read from the SIM.

Now, I am trying to write the message I have just read and I got an
0x80070057 error (incorrect parameters).

How is it possible since I am writing the same message that I have just
successfully read?

Can anyone help me to solve this issue?

thanks in advance.

"djarjar" wrote:

> Hi all,
>
> Does anyone has an example that is using the SimWriteMessage method of the
> SIM manager API?
>
> Thanks in advance.

Re: SimWriteMessage example by Peter

Peter
Thu May 26 17:07:07 CDT 2005

At what index in the SIM are you trying to write the record?

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org

"djarjar" <djarjar@discussions.microsoft.com> wrote in message
news:ABDC292E-6FDE-4D34-BF2B-FAD084BB6769@microsoft.com...
> The best way to have the format of data for the SimWriteMessage is to call
> before the SimReadMessage ;-).
>
> That's what I have done with the following code:
> HRESULT status=SimReadMessage (hSim,SIM_SMSSTORAGE_SIM,1,&simMessage);
> dwIndex = 1;
> status=SimWriteMessage (hSim,SIM_SMSSTORAGE_SIM,&dwIndex,&simMessage);
>
> The SimReadMessage returns 0 so it's ok, the simMessage structure is
> filled
> with a message read from the SIM.
>
> Now, I am trying to write the message I have just read and I got an
> 0x80070057 error (incorrect parameters).
>
> How is it possible since I am writing the same message that I have just
> successfully read?
>
> Can anyone help me to solve this issue?
>
> thanks in advance.
>
> "djarjar" wrote:
>
>> Hi all,
>>
>> Does anyone has an example that is using the SimWriteMessage method of
>> the
>> SIM manager API?
>>
>> Thanks in advance.



Re: SimWriteMessage example by djarjar

djarjar
Mon May 30 02:26:04 CDT 2005

Hi Peter,
In fact I am reading and writing in record 1 (cf. the code of my second post).
I also tried to read index 1 and to write index 2... same problem.


"Peter Foot [MVP]" wrote:

> At what index in the SIM are you trying to write the record?
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> http://www.inthehand.com | http://www.peterfoot.net |
> http://www.opennetcf.org
>
> "djarjar" <djarjar@discussions.microsoft.com> wrote in message
> news:ABDC292E-6FDE-4D34-BF2B-FAD084BB6769@microsoft.com...
> > The best way to have the format of data for the SimWriteMessage is to call
> > before the SimReadMessage ;-).
> >
> > That's what I have done with the following code:
> > HRESULT status=SimReadMessage (hSim,SIM_SMSSTORAGE_SIM,1,&simMessage);
> > dwIndex = 1;
> > status=SimWriteMessage (hSim,SIM_SMSSTORAGE_SIM,&dwIndex,&simMessage);
> >
> > The SimReadMessage returns 0 so it's ok, the simMessage structure is
> > filled
> > with a message read from the SIM.
> >
> > Now, I am trying to write the message I have just read and I got an
> > 0x80070057 error (incorrect parameters).
> >
> > How is it possible since I am writing the same message that I have just
> > successfully read?
> >
> > Can anyone help me to solve this issue?
> >
> > thanks in advance.
> >
> > "djarjar" wrote:
> >
> >> Hi all,
> >>
> >> Does anyone has an example that is using the SimWriteMessage method of
> >> the
> >> SIM manager API?
> >>
> >> Thanks in advance.
>
>
>

Re: SimWriteMessage example by djarjar

djarjar
Mon May 30 02:46:02 CDT 2005

If it can help in solving the issue, here is the SIMMESSAGE structure
returned by the
SimReadMessage method.

dwParams 0x4F
lpszAddress "1234"
dwAddressType 0x00
dwNumPlan 0x00
stReceiveTime: current time
cbHdrLength: 0x00
rgbHeader: 0x00
lpszMessage: "abc"

And if I try to write the same message, I have the 0x80070057 error.
The header is not used, what could it be used for (transport header 03.40...)?

Thanks again for your help because I am fully blocked on that subject.

"djarjar" wrote:

> Hi Peter,
> In fact I am reading and writing in record 1 (cf. the code of my second post).
> I also tried to read index 1 and to write index 2... same problem.
>
>
> "Peter Foot [MVP]" wrote:
>
> > At what index in the SIM are you trying to write the record?
> >
> > Peter
> >
> > --
> > Peter Foot
> > Windows Embedded MVP
> > http://www.inthehand.com | http://www.peterfoot.net |
> > http://www.opennetcf.org
> >
> > "djarjar" <djarjar@discussions.microsoft.com> wrote in message
> > news:ABDC292E-6FDE-4D34-BF2B-FAD084BB6769@microsoft.com...
> > > The best way to have the format of data for the SimWriteMessage is to call
> > > before the SimReadMessage ;-).
> > >
> > > That's what I have done with the following code:
> > > HRESULT status=SimReadMessage (hSim,SIM_SMSSTORAGE_SIM,1,&simMessage);
> > > dwIndex = 1;
> > > status=SimWriteMessage (hSim,SIM_SMSSTORAGE_SIM,&dwIndex,&simMessage);
> > >
> > > The SimReadMessage returns 0 so it's ok, the simMessage structure is
> > > filled
> > > with a message read from the SIM.
> > >
> > > Now, I am trying to write the message I have just read and I got an
> > > 0x80070057 error (incorrect parameters).
> > >
> > > How is it possible since I am writing the same message that I have just
> > > successfully read?
> > >
> > > Can anyone help me to solve this issue?
> > >
> > > thanks in advance.
> > >
> > > "djarjar" wrote:
> > >
> > >> Hi all,
> > >>
> > >> Does anyone has an example that is using the SimWriteMessage method of
> > >> the
> > >> SIM manager API?
> > >>
> > >> Thanks in advance.
> >
> >
> >