ServerCreateEnumUsbDev
 ServerRemoveEnumUsbDev
 ServerGetUsbDevFromHub
 ServerUsbDevIsHub
 ServerUsbDevIsShared
 ServerUsbDevIsConnected
 ServerGetUsbDevName
 ServerGetUsbDevNameEx
 ServerShareUsbDev
 ServerShareUsbWithPredefinedValues
 ServerUnshareUsbDev
 ServerUnshareAllUsbDev
 ServerGetUsbDevStatus
 ServerGetUsbDevClassCode
 ServerGetUsbDevValueByName
 ServerGetSharedUsbDevNetSettings
 ServerGetSharedUsbDevIsCrypt
 ServerGetSharedUsbDevRequiresAuth
 ServerGetSharedUsbDevIsCompressed
 ServerDisconnectRemoteDev
 ServerAllowDevRemoteDisconnect
 ServerGetLastError 
 ServerSetDevUserDescription
 ServerSetSharedUsbDevAuth
 ServerSetSharedUsbDevCompress
 ServerSetSharedUsbDevCrypt
 ServerSetUsbDevValueByName 



ServerCreateEnumUsbDev


BOOL ServerCreateEnumUsbDev(
OUT PVOID *ppContext
);

 
Routine Description:

 
Creates and returns USB devices enumerator. This enumerator is used in all subsequent functions
starting with "Server".

 
Arguments:

 
ppContext - a pointer to USB devices enumerator.

 
Return Value:

 
True - if USB devices enumerator was created successfully. False - if an error occurred.


ServerRemoveEnumUsbDev


BOOL ServerRemoveEnumUsbDev(
IN PVOID pContext
);

 
Routine Description:

 
Removes USB devices enumerator.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
Return Value:

 
True - if USB devices enumerator was removed successfully. False - if an error occurred.


ServerGetUsbDevFromHub


BOOL
ServerGetUsbDevFromHub(
IN PVOID pContext,
IN PVOID pHubContext,
IN int iIndex,
OUT PVOID *ppDevContext
);

 
Routine Description:

 
Gets USB device descriptor from USB hub.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pHubContext - USB hub returned by the ServerGetUsbDevFromHub function. If this parameter is NULL, root hubs are enumerated.

 
iIndex - USB port number.

 
ppDevContext - a pointer to USB devices descriptor used in subsequent operations with devices.

 
Return Value:

 
True - if the function was executed successfully. False - if an error occurred.



ServerUsbDevIsHub


BOOL ServerUsbDevIsHub(
IN PVOID pContext,
IN PVOID pDevContext,
);

 
Routine Description:

 
Determines, whether the USB device is a USB hub.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
Return Value:

 
True - if the USB device is a USB hub. False - if an error occurred.


ServerUsbDevIsShared


BOOL ServerUsbDevIsShared(
IN PVOID pContext,
IN PVOID pDevContext,
);

 
Routine Description:

 
Determines whether the USB device is shared.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
Return Value:

 
True - if the USB device is shared. False - if an error occurred.


ServerUsbDevIsConnected


BOOL
ServerUsbDevIsConnected(
IN PVOID pContext,
IN PVOID pDevContext,
)

 
Routine Description:

 
Determines whether the real USB device is connected to the USB port pointed by pDevContext.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
Return Value:

 
True - if the real USB device is connected to the USB port.
False - if an error occurred.


ServerGetUsbDevName


BOOL ServerGetUsbDevName(
IN PVOID pContext,
IN PVOID pDevContext,
OUT VARIANT *strName
);

 
Routine Description:

 
Returns USB device name.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strName - a pointer to string variable to which USB device name is returned.

 
Return Value:

 
True - if the function was executed successfully. Otherwise the "False" value is returned.


ServerGetUsbDevNameEx


BOOL
ServerGetUsbDevNameEx(
IN PVOID pContext,
IN PVOID pDevContext,
OUT VARIANT *strName,
OUT VARIANT *strUserDescription
)

 
Routine Description:

 
Returns USB device name and user description as separate objects.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strName - a pointer to USB device name.

 
strUserDescription - a pointer to USB device user description.

 
Return Value:

 
True - if the function was executed successfully. False - if an error occurred.


ServerShareUsbDev


BOOL ServerShareUsbDev (
IN PVOID pContext,
IN PVOID pDevContext,
IN VARIANT varNetSettings,
IN VARIANT strDescription,
IN BOOL bAuth,
IN VARIANT strPassword,
IN BOOL bCrypt
IN BOOL bCompress
);

 
Routine Description:

 
Shares USB device.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
varNetSettings - network settings. If not set, default network settings are used. For regular connections, the TCP port is selected automatically unless explicitly specified. For callback connections, the client's IP address and connection port should always be specified manually in the format "[host-name-or-ip]:[tcp-port]", for example "localhost:5000".

 

strDescription - additional USB device description to simplify its identification.

 
bAuth - enables authorization for the USB device if set to TRUE. strPassword parameter should be set.

 
strPassword - password for authentication. Is used if bAuth is set to TRUE.

 
Note: When sharing devices with password authentication enabled, the traffic encryption option will be turned on automatically.

 
bCrypt - enables encryption for all network traffic, if set to True.

 
bCompress - enables compression for all network traffic, if set to True.

 
Return Value:

 
True - if USB device was successfully shared. False - if an error occurred.


ServerShareUsbWithPredefinedValues


IN PVOID pContext,
IN PVOID pDevContext,
);

 
Routine Description:

 
Shares USB device with predefined parameters. Parameters should be set with the ServerSetUsbDevValueByName function.

 

Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 

pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 

Notes:

 

Desired sharing parameters (net settings, description, authorization, encryption,compression) should be
set with the ServerSetUsbDevValueByName function before calling ServerShareUsbWithPredefinedValues.
Otherwise sharing with default parameters will be performed.

 

Return Value:

 

True - if USB device was successfully shared. False - if an error occurred.


ServerUnshareUsbDev


BOOL ServerUnshareUsbDev (
IN PVOID pContext,
IN PVOID pDevContext,
);

 
Routine Description:

 
Unshares USB device. USB device becomes accessible for usage on the local machine.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
Return Value:

 
True - if USB device was successfully unshared. False - if an error occurred, or the USB device was not
unshared.


ServerUnshareAllUsbDev


BOOL
ServerUnshareAllUsbDev ()

 
Routine Description:

 
Unshares all previously shared USB devices.

 
Arguments:

 
None.

 
Return Value:

 
True - if USB devices were successfully unshared. False - if an error occurred.


ServerGetUsbDevStatus


BOOL ServerGetUsbDevStatus (
IN PVOID pContext,
IN PVOID pDevContext,
OUT LONG *piState,
OUT VARIANT *strHostConnected
);

 
Routine Description:

 
Gets the current status of the shared USB device.

 
Arguments:

 
pContext - a pointer to USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
piState - a pointer to long variable to which the current status of the shared USB device is returned:

 
1 – the device is waiting for connection;
2 – the device is already connected.

 
strHostConnected - a pointer to string variable to which hostname of the client, to which the server is currently connected, is returned. Returned only when piState is 2.

 
Return Value:

 
True - if the function was executed successfully. Otherwise the "False" value is returned.


ServerGetUsbDevClassCode


BOOL
ServerGetUsbDevClassCode (
IN PVOID pContext,
IN PVOID pDevContext,
OUT BYTE *bBaseClass,
OUT BYTE *bSubClass,
OUT BYTE *bProtocol
)


Routine Description:

 
Returns the Class Code triple (Base Class, SubClass and Protocol) of USB device as separate objects.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
bBaseClass - a pointer to a variable that receives the Base Class byte value.

 
bSubClass - a pointer to a variable that receives the SubClass byte value.

 
bProtocol - a pointer to variable that receives the Protocol byte value.

 
Return Value:

 
True - if the function was executed successfully. False - if an error occurred.


ServerGetUsbDevValueByName


BOOL
ServerGetUsbDevValueByName(
IN PVOID pContext,
IN PVOID pDevContext,
IN VARIANT strValueName,
OUT VARIANT *pValue
)

 
Routine Description:

 
Returns the value of the variable by its name.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strValueName - name of the value in question.

 
pValue - pointer to the output value.

 
Notes:

 
- Values are cached at the moment of calling of the ServerCreateEnumUsbDev function.
- You can change some values with the ServerSetUsbDevValueByName function. See notes to the ServerSetUsbDevValueByName function.
- Supported value names are:

 

NETPARAM (string)
network settings (e.g., ip:port)
NAME (string)
name of the USB device
NICK (string) 
user description of the USB device
AUTH (bool) 
authorization
ENCR (bool)
encryption
COMPR (bool)
compression
COMPR_TYPE (int)
compression type
STATUS (int) 
connection status (for shared USB devices)
SHARED_WITH (string)
client connected to the shared USB device
ALLOW_RDISCONN (bool)
allow disconnection of remote clients from the shared USB device by other clients
USBCLASS (string) 
USB device class triple as single hex-ascii string xxyyzz (where xx=class, yy=subclass, zz=protocol)
BCDUSB (uint)
version of the USB specification
VID (uint)
vendor identifier for the device
PID (uint) 
product identifier
REV (uint) 
version of the device
SERIAL (string) 
serial number of the device
USBLOC (string)
USB port location

 

Return Value:

 
True - if the function was executed successfully. False - if an error occurred.


ServerGetSharedUsbDevNetSettings


BOOL ServerGetSharedUsbDevNetSettings (
IN PVOID pContext,
IN PVOID pDevContext,
OUT VARIANT *strNetSettings,
);

 
Routine Description:

 
Gets current network settings of the shared USB device.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strNetSettings - a pointer to string variable to which information about network settings of the shared USB
device is returned. If only the TCP port number is returned, it is a standard network connection. If a full
network address is returned ("host_name:tcp_port"), it is a callback connection.

 
Return Value:

 
True - if the function was executed successfully. Otherwise the "False" value is returned.


ServerGetSharedUsbDevIsCrypt


BOOL
ServerGetSharedUsbDevIsCrypt (
IN PVOID pContext,
IN PVOID pDevContext,
OUT BOOL *bCrypt,
)

 
Routine Description:

 
Returns whether shared USB device traffic is encrypted.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB device descriptor, returned by the ServerGetUsbDevFromHub function.

 
bCrypt – is True if network traffic is encrypted. Otherwise, "False" value is returned.

 
Return Value:

 
True - if the USB device was successfully shared. False - if an error occurred, or a USB device was not
shared.


ServerGetSharedUsbDevRequiresAuth


BOOL
ServerGetSharedUsbDevRequiresAuth (
IN PVOID pContext,
IN PVOID pDevContext,
OUT BOOL *bAuth,
)

 
Routine Description:

 
Determines whether the shared USB device requires authorization.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
bAuth - is True if a shared USB device requires authorization on connection. Otherwise, "False" value is returned.

 

Return Value:

 
True – if the function was executed successfully. Otherwise, "False" value is returned.


ServerGetSharedUsbDevIsCompressed


BOOL
ServerGetSharedUsbDevIsCompressed (
IN PVOID pContext,
IN PVOID pDevContext,
OUT BOOL *bCompress,
)

 
Routine Description:

 
Determines whether network traffic for the shared USB device is compressed.

 
Arguments:

 
pContext - USB devices enumerator returned by ServerCreateEnumUsbDev function.

 

pDevContext - USB devices descriptor returned by ServerGetUsbDevFromHub function.

 

bCompress - is TRUE if network traffic is compressed. Otherwise the "False" value is returned.

 

Return Value:

 
True - if the function was executed successfully. Otherwise the "False" value is returned.


ServerDisconnectRemoteDev


BOOL ServerDisconnectRemoteDev (
PVOID pContext,
PVOID pDevContext
);

 
Routine Description:

 
Disconnects from a remote shared USB device from the client side.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 

Return Value:

 
True - if the function was executed successfully. False - if an error occurred.


ServerAllowDevRemoteDisconnect


BOOL
ServerAllowDevRemoteDisconnect (
IN PVOID pContext,
IN PVOID pDevContext,
IN BOOL bCompress

 
Routine Description:

 
Enables the client to be disconnected by another client.

 
Arguments:

 
pContext - USB devices enumerator returned by ServerCreateEnumUsbDev function.
pDevContext - USB devices descriptor returned by ServerGetUsbDevFromHub function.
bEnable – enables the client to be disconnected by another client, if set to True.

 
Return Value:

 
True – if the function was executed successfully. Otherwise the "False" value is returned.


ServerGetLastError


BOOL
ServerGetLastError (
IN PVOID pContext,
OUT VARIANT *strErrorCode
)

 
Routine Description:

 
Gets the error code from the last server operation.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
strErrorCode - returns the error code.

 
Possible error codes:

 
OK - the last command was executed successfully;

 
ERR - general error code;

 
DEMO - sharing operation failed due to demo limitations;

 
TCP_PORT - specified TCP port is already occupied;

 
NOT_FOUND - specified USB port/device was not found.

 
Return Value:

 
True – if the function was executed successfully. Otherwise the "False" value is returned.


ServerSetDevUserDescription


BOOL
ServerSetDevUserDescription (
IN PVOID pContext,
IN PVOID pDevContext,
IN VARIANT strUserDescription
)

 
Routine Description:

 
Changes custom description for USB device on the go.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strUserDescription - custom USB device description.

 
Return Value:

 
True – if the function was executed successfully. Otherwise the "False" value is returned.


ServerSetSharedUsbDevAuth


BOOL
ServerSetSharedUsbDevAuth (
IN PVOID pContext,
IN PVOID pDevContext,
IN BOOL bAuth,
IN VARIANT strPassword
)

 
Routine Description:

 
Changes traffic authorization settings for shared USB device on the go.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
bAuth - enables authorization for USB device if set to TRUE. strPassword parameter should be set.

 
strPassword - authorization password. Is used if bAuth is set to TRUE.

 
Note: When enabling the password authentication option, the traffic encryption option is enabled
automatically.

 
Return Value:

 
True – if the function was executed successfully. Otherwise the "False" value is returned.


ServerSetSharedUsbDevCompress


BOOL
ServerSetSharedUsbDevCompress (
IN PVOID pContext,
IN PVOID pDevContext,
IN BOOL bCompress
)

 
Routine Description:

 
Changes traffic compression settings for shared USB device on the go.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
bCompress – enables compression for all network traffic, if set to True.

 
Return Value:

 
True – if the function was executed successfully. Otherwise the "False" value is returned.


ServerSetSharedUsbDevCrypt


BOOL
ServerSetSharedUsbDevCrypt (
IN PVOID pContext,
IN PVOID pDevContext,
IN BOOL bCrypt
)

 
Routine Description:

 
Changes traffic encryption settings for shared USB device on the go.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB device descriptor, returned by the ServerGetUsbDevFromHub function.

 
bCrypt – enables encryption for all network traffic, if set to True.

 
Note: When turning off the traffic encryption option, (if enabled) the password authentication option will be disabled automatically.

 
Return Value:

 
True - if the function was executed successfully. Otherwise the "False" value is returned.


ServerSetUsbDevValueByName


BOOL
ServerSetUsbDevValueByName(
IN PVOID pContext,
IN PVOID pDevContext,
IN VARIANT strValueName,
IN VARIANT varValue
);

 
Routine Description:

 
Sets a new value by name for a USB device.

 
Arguments:

 
pContext - USB devices enumerator returned by the ServerCreateEnumUsbDev function.

 
pDevContext - USB devices descriptor returned by the ServerGetUsbDevFromHub function.

 
strValueName - name of the value.

 
varValue - the value.

 
Notes:

 
- Values are cached on the moment of the ServerCreateEnumUsbDev call. With this function, you can change some values for an unshared device and use them later when sharing.
- Note: When turning on the password authentication option (AUTH), the traffic encryption option (ENCR) will be enabled automatically. When turning off the traffic encryption option (ENCR), (if enabled) the password authentication option (AUTH) will be automatically disabled. The last action (value set) will prevail.


Supported value names: 

 

NETPARAM (string)
network settings (e.g., ip:port)
NICK (string) 
user description of the USB device
AUTH (string) 
Authentication (a new password to be set. Pass an empty string to turn off authentication)
ENCR (bool)
encryption
COMPR (bool)
compression
COMPR_TYPE (int)
compression type
ALLOW_RDISCONN (bool)
allow disconnection of remote clients from the shared USB device by other clients

 

Return Value:

 
True - if the function was executed successfully. False - if an error occurred.