首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

WINCE流驱动的自动加载

WINCE流驱动的自动加载

动态加载在系统启动之后根据需要来加载,而不是在系统启动过程中加载,就动态加载CMC.dll驱动为例来说明大概需要的工作:

1.在platform.bib中通过下面语句把CMC.dl放在windows文件夹下面
CMC.dll         $(_FLATRELEASEDIR)/CMC.dll                  NK  SHK

2.创建注册表子键并在此驱动注册表子键中写键值,键值是由键值名称和键值的值组成的。
下面介绍需要用的的注册表相关函数。
⑴RegCreateKeyEx函数

RegCreateKeyEx函数头如下:
LONG RegCreateKeyEx(
  HKEY hKey,
  LPCWSTR lpSubKey,
  DWORD Reserved,
  LPWSTR lpClass,
  DWORD dwOptions,
  REGSAM samDesired,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  PHKEY phkResult,
  LPDWORD lpdwDisposition
);
下面来看这些参数的描述
Parameters

hKey
[in] Handle to a currently open key or one of the following predefined reserved handle values:
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Windows CE does not support the HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA, or HKEY_DYN_DATA predefined reserved handle values.

The key opened or created by the RegCreateKeyEx function is a subkey of the key identified by the hKey parameter.


lpSubKey

[in] Pointer to a null-terminated string specifying the name of a subkey that this function opens or creates. The subkey specified must be a subkey of the key identified by the hKey parameter. This subkey must not begin with the backslash character (/). If the parameter is NULL, then RegCreateKeyEx behaves like RegOpenKey where it opens the key specified by hKey. In Windows CE, the maximum length of a key name is 255 characters, not including the terminating NULL character. You can also only nest 16 levels of sub-keys in Windows CE.

Reserved
[in] Reserved; set to 0.

lpClass
[in] Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists. In Windows CE, the maximum length of a class string is 255 characters, not including the terminating NULL character.

dwOptions
[in] Registry key options.
REG_OPTION_NON_VOLATILE :Default setting. All registry keys are created as non-volatile and the information stored in memory is preserved when the OS is restarted. The RegSaveKey function saves keys that are non-volatile.
REG_OPTION_VOLATILE :All registry keys are created as volatile, and the information is stored in memory and is not preserved when the corresponding registry hive is unloaded. For HKEY_LOCAL_MACHINE, this occurs when the OS is shut down. The RegSaveKey function does not save volatile registry keys. This flag is ignored for keys that already exist.

samDesired
[in] Ignored; set to 0 to ensure compatibility with future versions of Windows CE.

lpSecurityAttributes
[in] Set to NULL. Windows CE automatically assigns the key a default security descriptor.

phkResult
[out] Pointer to a variable that receives a handle to the opened or created key. When you no longer need the returned handle, call the RegCloseKey function to close it.
lpdwDisposition

[out] Pointer to a variable that receives disposition values. The following table shows possible values for this parameter. Value Description
REG_CREATED_NEW_KEY The key did not exist and was created.
REG_OPENED_EXISTING_KEY The key existed and was simply opened without being changed.
继承事业,薪火相传
返回列表