Hi,
Anybody succeeded to override APIs like DrawText on Pocket PC?
Is there Anybody had succeeded to hook any Coredlls functions?

Anybody will be appreciated.

RE: Hooking by DarrenShaffer

DarrenShaffer
Sun Oct 03 19:21:01 CDT 2004

Mohamed,

You can certainly access coredll functions from your Compact
Framework application. As an example, below I access core.dll
to get or set the device's system time:

using System.Runtime.InteropServices;
///
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}

[DllImport("coredll.dll")]
public extern static void GetLocalTime(ref SYSTEMTIME lpSystemTime);

[DllImport("coredll.dll")]
public extern static uint SetLocalTime(ref SYSTEMTIME lpSystemTime);

private void _showCurrentLocalDateTime()
{
SYSTEMTIME st = new SYSTEMTIME();
try
{
GetLocalTime(ref st);
this.nudDay.Value = (int)st.wDay;
this.nudMonth.Value = (int)st.wMonth;
this.nudYear.Value = (int)st.wYear;
this.nudMinute.Value = (int)st.wMinute;
this.dudHour.SelectedIndex = (int)st.wHour;
}
catch (Exception e)
{
MessageBox.Show("Error retrieving or displaying current system
date/time:\n\n" +
e.Message.ToString(),
"Error", MessageBoxButtons.OK, MessageBoxIcon.Hand,
MessageBoxDefaultButton.Button1);
}

}

-Darren

"Mohamed" wrote:

> Hi,
> Anybody succeeded to override APIs like DrawText on Pocket PC?
> Is there Anybody had succeeded to hook any Coredlls functions?
>
> Anybody will be appreciated.
>
>
>

Re: Hooking by Mohamed

Mohamed
Mon Oct 04 01:26:59 CDT 2004

Hi Darren,
Thank you very much.

What I want to know is how to change the functionality.
I understand this would happen if I changed the functions addresses in the
.idata and .edata sections in the PE. I succeeded to reach those addresses
(RVAs) in the file before loading, and I understand that winCE is not
loading the PE header into memory. So, where exactly I need to change? or Is
there any other way to replace DrawText with my own code?

I am using eVC3.0.

Anyhelp will be appreciated.

Mohamed.

"Darren Shaffer" <DarrenShaffer@discussions.microsoft.com> wrote in message
news:C76BC99D-3863-45F4-9D36-340B516C2001@microsoft.com...
> Mohamed,
>
> You can certainly access coredll functions from your Compact
> Framework application. As an example, below I access core.dll
> to get or set the device's system time:
>
> using System.Runtime.InteropServices;
> ///
> public struct SYSTEMTIME
> {
> public ushort wYear;
> public ushort wMonth;
> public ushort wDayOfWeek;
> public ushort wDay;
> public ushort wHour;
> public ushort wMinute;
> public ushort wSecond;
> public ushort wMilliseconds;
> }
>
> [DllImport("coredll.dll")]
> public extern static void GetLocalTime(ref SYSTEMTIME lpSystemTime);
>
> [DllImport("coredll.dll")]
> public extern static uint SetLocalTime(ref SYSTEMTIME lpSystemTime);
>
> private void _showCurrentLocalDateTime()
> {
> SYSTEMTIME st = new SYSTEMTIME();
> try
> {
> GetLocalTime(ref st);
> this.nudDay.Value = (int)st.wDay;
> this.nudMonth.Value = (int)st.wMonth;
> this.nudYear.Value = (int)st.wYear;
> this.nudMinute.Value = (int)st.wMinute;
> this.dudHour.SelectedIndex = (int)st.wHour;
> }
> catch (Exception e)
> {
> MessageBox.Show("Error retrieving or displaying current system
> date/time:\n\n" +
> e.Message.ToString(),
> "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand,
> MessageBoxDefaultButton.Button1);
> }
>
> }
>
> -Darren
>
> "Mohamed" wrote:
>
> > Hi,
> > Anybody succeeded to override APIs like DrawText on Pocket PC?
> > Is there Anybody had succeeded to hook any Coredlls functions?
> >
> > Anybody will be appreciated.
> >
> >
> >



Re: Hooking by Anthony

Anthony
Fri Oct 08 13:16:30 CDT 2004

Yes I had! Look into PSL mechanism! Read the article on Spy: A Windows CE
API Interceptor of Dr. Dobb Journal Oct/2003.


"Mohamed" <whiletrue@hotmail.com> wrote in message
news:uVSPVRRqEHA.2764@TK2MSFTNGP11.phx.gbl...
> Hi,
> Anybody succeeded to override APIs like DrawText on Pocket PC?
> Is there Anybody had succeeded to hook any Coredlls functions?
>
> Anybody will be appreciated.
>
>