|
第一步:
在注册表中的下面位置添加如下键值:
1、[HKEY_LOCAL_MACHINE\Services]下面增加一个Key(比如ExDLL)
2、在ExDLL下增加如下Value
[HKEY_LOCAL_MACHINE\Services\DMNotify]
"Context"=dword:00000000
"Index"=dword:00000000
"Prefix"="###" //三个字符前缀,下面会提到
"Keep"=dword:00000001
"Dll"="DMNotify.dll" //DLL的路径和名称,默认是Windows目录
"Order"=dword:000000c8 //DLL被加载的顺序,尽量写大点,这里是200
3、在外部DLL中导出如下接口(###为注册表中需要些的字符,只能为三个字符的前缀)
extern "C" _declspec(dllexport) DWORD ###_Init(DWORD dwData)
{
//for something
return 1
}
extern "C" _declspec(dllexport) DWORD ###_IOControl(DWORD dwData,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut)
{
//for something
return 1;
}
extern "C" _declspec(dllexport) DWORD ###_Deinit(DWORD dwData)
{
//for something
return 0;
}
4、在设备上安装证书并且给DLL签名
证书路径“安装SDK的路径\Tools\Security\SDK Development Certificates\Certs.cab”此文件拷贝到手机安装
5、把DLL拷贝到Windows目录
6、重启设备,如果加载成功,DLL文件会被Service进程加载 |
|