Platform SDK: Removable Storage Manager

OpenNtmsSession

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

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

Parameters

lpServer
Specifies a character string that points to the RSM server name. If this parameter is NULL, the current computer is used.
lpApplication
Specifies a unique character string that identifies the application. This name identifies resources and operator requests.
dwOptions
Reserved. The application should pass 0.

Return Values

Value Meaning
ERROR_INVALID_COMPUTERNAME An invalid computer name format was supplied.
ERROR_INVALID_PARAMETER Invalid parameters were supplied.
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.

The OpenNtmsSession function returns a handle that uniquely identifies this session, or it returns INVALID_HANDLE_VALUE if RSM cannot open a session. Other RSM functions use this session handle to perform operations.

If INVALID_HANDLE_VALUE returns, you can call the Win32 GetLastError function to retrieve the error code.

When OpenNtmsSession returns, the application can perform RSM operations.

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

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Ntmsapi.h.
  Library: Use Ntmsapi.lib.

See Also

Session Management Functions, CloseNtmsSession