 |
|
|
|
| Author |
Message |
Veena
Joined: 15 Aug 2007 Posts: 13
|
Posted: Wed Oct 17, 2007 5:51 am Post subject: Auto start a service on windows mobile 5.0 |
|
|
Hello,
I have written an simple service. I need to auto start my service when
the device boots. I have made the following registry settings:
DLL : ServiceSample.dll
Prefix : MMM
Context : 1 (tried with 0 too)
Keep : 1
Order : 8
I have my dll in \windows folder.
If i call my service using ActivateService(), i can see my dll running
using the Remote process viewer.
But if i reset my device, it does not auto start.
What am i doing wrong?
I'll also give you my Init code
DWORD __declspec(dllexport) MMM_Init(DWORD dwData)
{
FILE *fp = fopen("\\TestService.txt","wb");
fwrite("In M4M_Init", strlen("In M4M_Init"),1,fp);
fclose(fp);
HANDLE hThread = CreateThread( 0, 0,
(LPTHREAD_START_ROUTINE)SSWControllingFunction, 0, 0, 0);
return 1;
}
Please help.
Regards,
Veena
Archived from group: microsoft>public>pocketpc>wireless |
|
| Back to top |
|
 |
ultrapro
Joined: 01 Nov 2007 Posts: 1
|
Posted: Thu Nov 01, 2007 3:10 pm Post subject: Re: Auto start a service on windows mobile 5.0 |
|
|
Was the service dll signed?
"Veena"
??????:1192611062.414470.305880@v29g2000prd.googlegroups.com...
> Hello,
> I have written an simple service. I need to auto start my service when
> the device boots. I have made the following registry settings:
> DLL : ServiceSample.dll
> Prefix : MMM
> Context : 1 (tried with 0 too)
> Keep : 1
> Order : 8
>
> I have my dll in \windows folder.
> If i call my service using ActivateService(), i can see my dll running
> using the Remote process viewer.
> But if i reset my device, it does not auto start.
> What am i doing wrong?
>
> I'll also give you my Init code
>
> DWORD __declspec(dllexport) MMM_Init(DWORD dwData)
> {
> FILE *fp = fopen("\\TestService.txt","wb");
> fwrite("In M4M_Init", strlen("In M4M_Init"),1,fp);
> fclose(fp);
>
> HANDLE hThread = CreateThread( 0, 0,
> (LPTHREAD_START_ROUTINE)SSWControllingFunction, 0, 0, 0);
> return 1;
> }
>
> Please help.
>
> Regards,
> Veena
> |
|
| Back to top |
|
 |
syedmoin2005
Joined: 16 Nov 2007 Posts: 1
|
Posted: Fri Nov 16, 2007 10:03 am Post subject: Re: Auto start a service on windows mobile 5.0 |
|
|
Hi,
I have made a sample service as given in MSDN Sample , Compiled
it Using Visual Studio 2005 using Windows Mobile 5 Smartphone . The
Build is signed with the
Privilaged certificate but when i try to view the service using Remote
Process viewer i can't see the service.
The Registry Entry is
HKEY_LOCAL_MACHINE\Init\Services\MYS
DLL : MYS.dll
Prefix : MYS
Context : 0
Keep : 1
Order : 8
(Using Remote Registry edit)
Privilaged Certificate found in
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone
SDK\Tools\SDKSamplePrivDeveloper.pfx
The Code file is MYS.DEF
MYS.H
MYS.CPP
///////////////////////////////////////////////////MY SERVICE DEF FILE
MYS.DEF/////////////////////////////////////////
LIBRARY "MYS"
EXPORTS
; Explicit exports can go here
MYS_Close
MYS_Deinit
MYS_Init
MYS_IOControl
MYS_Open
MYS_Read
MYS_Seek
MYS_Write
///////////////////////////////////////// MY SERVICE HEADER MYS.H
#ifdef MYS_EXPORTS
#define MYS_API __declspec(dllexport)
#else
#define MYS_API __declspec(dllimport)
#endif
// This class is exported from the MYS.dll
class MYS_API CMYS {
public:
CMYS(void);
// TODO: add your methods here.
};
extern MYS_API int nMYS;
MYS_API int fnMYS(void);
////////////////////////////// My Service
Code /////////////////////////////////////////
// MYS.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "MYS.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
UINT g_nTimer;
void CALLBACK MyTimerProc(
HWND hwnd,
UINT uMsg,
UINT idEvent,
DWORD dwTime )
{
::MessageBox(NULL, _T("timer"), _T("SMS"), MB_OK);
}
unsigned long __cdecl MyControllingFunction( LPVOID pParam )
{
g_nTimer = SetTimer(0, 0, 10 * 1000, MyTimerProc);
MSG msg;
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
DWORD MYS_Close(DWORD dwData)
{
return 0;
}
DWORD MYS_Deinit(DWORD dwData)
{
return 0;
}
DWORD MYS_Init(DWORD dwData)
{
HANDLE hThread = CreateThread( 0, 0, MyControllingFunction, 0, 0, 0);
return 1;
}
DWORD MYS_IOControl(
DWORD dwData,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut)
{
return 1;
}
DWORD MYS_Open(
DWORD dwData,
DWORD dwAccess,
DWORD dwShareMode)
{
return 0;
}
DWORD MYS_Read(
DWORD dwData,
LPVOID pBuf,
DWORD dwLen)
{
return 0;
}
DWORD MYS_Seek(
DWORD dwData,
long pos,
DWORD type)
{
return 0;
}
DWORD MYS_Write(
DWORD dwData,
LPCVOID pInBuf,
DWORD dwInLen)
{
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
Sampleservice//////////////////////////////////////////
////////////////////////////////////////////////////////
STDAFX.H /////////////////////////////////////////////////////////////////////////////////
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !
defined(AFX_STDAFX_H__974F2576_8BB1_45C6_BF7E_578E6CC3CFF2__INCLUDED_)
#define AFX_STDAFX_H__974F2576_8BB1_45C6_BF7E_578E6CC3CFF2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows
headers
#include
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations
immediately before the previous line.
#endif // !
defined(AFX_STDAFX_H__974F2576_8BB1_45C6_BF7E_578E6CC3CFF2__INCLUDED_)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
| Back to top |
|
 |
|
|
| Related Topics: | wzc service crashes When I boot up, a process goes crazy to teh point of lokcing up my PC. I can open task manger and end the process. What happens is the wzc service shuts down. So, the wzx service is pushes my servicehost to teh max, until I end it. I c
Bluetooth max connections to a service. Hello All, I am developing an bluetooth applicatn for Windows Mobile 5.0 devices (PocketPC & Smartphone). I am able to register my own service with newly created GUID. I am able to connect to this service too but only two connections succeed . When i try
Lest expensive Wireless service for occasional user? Hi all, I travel allot for business and I'm looking for a way to get my email when I'm at airports and hotels and maybe do a little personal surfing. Since I work for the govt I cant use my laptop for personal stuff and therefore would like a cheap alter
callback for start of any new process Hi, I need a to receive a notifications whenever any new process is created on Windows Mobile Pocket PC(5.0) process I don't need a hook, just a notification. Is there no way to register my application for such notification call
Windows Mobile 6 I have just had a look at it at Microsoft and haven't seen where it mentions what you need in your current PDA in order to update to it or, indeed, where to get it to do that anyway. Anyone know? |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|