Freigeben über


OpenNtmsSession Function

[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]

The OpenNtmsSession function sets up a session with a RSM server.

Syntax

HANDLE OpenNtmsSession(
  __in  LPCTSTR lpServer,
  __in  LPCTSTR lpApplication,
  DWORD dwOptions
);

Parameters

  • lpServer [in]
    RSM server name. If this parameter is NULL, the current computer name is used.

  • lpApplication [in]
    Unique character string that identifies the application. This name identifies resources and operator requests. This parameter is optional and may be NULL.

  • dwOptions
    Reserved; must be zero.

Return Value

If OpenNtmsSession succeeds, it returns a handle that uniquely identifies this session. If the function fails, it returns INVALID_HANDLE_VALUE. To retrieve more information, call the GetLastError function. This function can return one of the following values.

Value Meaning
ERROR_INVALID_COMPUTERNAME

The computer name format that was specified was not in a valid format.

ERROR_INVALID_PARAMETER

One of the parameter values was not valid.

ERROR_NO_NETWORK

The network is not started or not available.

ERROR_NOT_CONNECTED

Unable to connect to the RSM service.

ERROR_NOT_READY

RSM service has not started. The application should wait and retry.

ERROR_SUCCESS

The function was successful.

INVALID_HANDLE_VALUE

RSM cannot open a session.

RPC_S_NO_INTERFACES

The service is using an older version of RSM than your application.

 

Remarks

The OpenNtmsSession function returns a session handle used with other RSM functions, establishes a connection with the RSM database, and initializes the RSM subsystem for the application.

When OpenNtmsSession returns, the application can perform RSM operations.

Sessions are thread-safe but cannot be passed among processes.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

End of client support

Windows Vista

End of server support

Windows Server 2008

Header

Ntmsapi.h

Library

Ntmsapi.lib

DLL

Ntmsapi.dll

Unicode and ANSI names

OpenNtmsSessionW (Unicode) and OpenNtmsSessionA (ANSI)

See Also

Session Management Functions

CloseNtmsSession

 

 

Send comments about this topic to Microsoft

Build date: 6/9/2011