Chinaunix首页 | 论坛 | 博客
  • 博客访问: 949884
  • 博文数量: 108
  • 博客积分: 3243
  • 博客等级: 中校
  • 技术积分: 964
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-15 22:09
文章分类

全部博文(108)

文章存档

2020年(2)

2019年(1)

2018年(2)

2017年(9)

2016年(20)

2015年(1)

2013年(1)

2012年(12)

2011年(28)

2010年(27)

2009年(4)

2008年(1)

分类: C/C++

2012-03-01 17:55:34

来源:
 
CM_Request_Device_Eject function

The CM_Request_Device_Eject function prepares a local device instance for safe removal, if the device is removable. If the device can be physically ejected, it will be.

Syntax
  1. CMAPI
  2. CONFIGRET
  3. WINAPI CM_Request_Device_Eject(
  4.   __in       DEVINST dnDevInst,
  5.   __out_opt  PPNP_VETO_TYPE pVetoType,
  6.   __out_opt  LPTSTR pszVetoName,
  7.   __in       ULONG ulNameLength,
  8.   __in       ULONG ulFlags
  9. );
Parameters dnDevInst [in]

Caller-supplied device instance handle that is bound to the local machine.

pVetoType [out, optional]

(Optional.) If not NULL, this points to a location that, if the removal request fails, receives a -typed value indicating the reason for the failure.

pszVetoName [out, optional]

(Optional.) If not NULL, this is a caller-supplied pointer to a string buffer that receives a text string. The type of information this string provides is dependent on the value received by pVetoType. For information about these strings, see .

ulNameLength [in]

(Optional.) Caller-supplied value representing the length of the string buffer supplied by pszVetoName. This should be set to MAX_PATH.

ulFlags [in]

Not used.

Return value

If the operation succeeds, the function returns CR_SUCCESS. Otherwise, it returns one of the CR_-prefixed error codes defined in Cfgmgr32.h.

Remarks

If pszVetoName is NULL, the PnP manager displays a message to the user indicating the device was removed or, if the request failed, identifying the reason for the failure. If pszVetoName is not NULL, the PnP manager does not display a message. (Note, however, that for Microsoft Windows 2000 only, the PnP manager displays a message even if pszVetoName is not NULL, if the device's CM_DEVCAP_DOCKDEVICE capability is set.)

Callers of CM_Request_Device_Eject sometimes require SeUndockPrivilege or SeLoadDriverPrivilege, as follows:

  • If the device's CM_DEVCAP_DOCKDEVICE capability is set (the device is a "dock" device), callers must have SeUndockPrivilege. (SeLoadDriverPrivilege is not required.)

  • If the device's CM_DEVCAP_DOCKDEVICE capability is not set (the device is not a "dock" device), and if the calling process is either not interactive or is running in a multi-user environment in a session not attached to the physical console (such as a remote Terminal Services session), callers of this function must have SeLoadDriverPrivilege.

Privileges are described in the Microsoft Windows SDK documentation.

For information about using device instance handles that are bound to the local machine, see .

Requirements

Version

Available in Microsoft Windows 2000 and later versions of Windows.

Header

Cfgmgr32.h (include Cfgmgr32.h)

Library

Contained in Cfgmgr32.lib. Link to Cfgmgr32.lib.
阅读(4458) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~