CM_Request_Device_Eject_ExA function (cfgmgr32.h)
[Beginning with Windows 8 and Windows Server 2012, this function has been deprecated. Please use CM_Request_Device_Eject instead.]
The CM_Request_Device_Eject_Ex function prepares a local or a remote device instance for safe removal, if the device is removable. If the device can be physically ejected, it will be.
Syntax
CMAPI CONFIGRET CM_Request_Device_Eject_ExA(
[in] DEVINST dnDevInst,
[out, optional] PPNP_VETO_TYPE pVetoType,
[out, optional] LPSTR pszVetoName,
[in] ULONG ulNameLength,
[in] ULONG ulFlags,
[in, optional] HMACHINE hMachine
);
Parameters
[in] dnDevInst
Caller-supplied device instance handle that is bound to the machine handle supplied by hMachine.
[out, optional] pVetoType
(Optional.) If not NULL, this points to a location that, if the removal request fails, receives a PNP_VETO_TYPE-typed value indicating the reason for the failure.
[out, optional] pszVetoName
(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 PNP_VETO_TYPE.
[in] ulNameLength
(Optional.) Caller-supplied value representing the length of the string buffer supplied by pszVetoName. This should be set to MAX_PATH.
[in] ulFlags
Not used.
[in, optional] hMachine
Caller-supplied machine handle to which the caller-supplied device instance handle is bound.
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.)
For remote machines, this function only works for "dock" device instances. That is, the function can only be used remotely to undock a machine. In that case, the caller must have SeUndockPrivilege.
Callers of CM_Request_Eject_Ex 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.
For information about using device instance handles that are bound to a local or a remote machine, see CM_Get_Child_Ex.
Functionality to access remote machines has been removed in Windows 8 and Windows Server 2012 and later operating systems thus you cannot access remote machines when running on these versions of Windows.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available in Microsoft Windows 2000 and later versions of Windows. |
Target Platform | Desktop |
Header | cfgmgr32.h (include Cfgmgr32.h) |
Library | Cfgmgr32.lib |
See also
CM_Get_Child_Ex
CM_Query_And_Remove_SubTree
CM_Query_And_Remove_SubTree_Ex
CM_Request_Device_Eject