Index of /pub/mirrors/ftp.novell.com/forge/vblib

Icon  Name                               Last modified      Size  Description
[DIR] Parent Directory - [TXT] CHANGELOG.html 18-Feb-2005 19:21 2.3K [TXT] DEPENDENCIES.html 18-Feb-2005 19:21 1.2K [TXT] DOCUMENTATION.html 24-Jan-2005 00:00 132 [TXT] LICENSE.txt 02-Dec-2004 00:00 11K [TXT] README.html 02-Dec-2004 00:00 18K [DIR] builds/ 27-Aug-2008 02:06 -
Visual Basic Libraries for Novell Services

Visual Basic Libraries for Novell Services

1.0 Release Notes
2.0 Documentation
3.0 Usage
3.1 Passing Parameters
4.0 Tips and Changes
4.1 Unsigned Types
4.2 Changes
5.0 Support
6.0 Legal Notices

1.0 Release Notes

Visual Basic Libraries for Novell® Services allows a VB user to use NetWare® APIs in a VB program. The libraries are in the form of a text file and a set of helper routines in a .BAS file. The text file (netware.txt) contains declarations for most of the NetWare APIs.

The libraries do not support the 16-bit library.

All of the constants, types, and routine declares are in the netware.txt file to make it easier to include them in a project. This one file replaces all of the other files that used to be shipped with the Visual Basic Libraries. A sample project, NDSLoginSample, is also included to demonstrate some of the routines that are available.


2.0 Documentation

While no Visual Basic specific documentation exists, you can find documentation for each API listed in the netware.txt file by


3.0 Usage

The netware.txt file can be used through the API Viewer or added as a module directly into a Visual Basic project.


3.1 Passing Parameters

The most important step in calling NetWare APIs from VB is passing parameters correctly. The parameters can be categorized into three groups:

  1. Primitive Types

    Integer, Long, and Byte are primitive types. These parameters can be passed by value or by reference. You don't have to be concerned about the way this type of parameter is passed since they are automatically taken care of.

  2. Strings

    String are declared in one of two ways:

  3. User-defined Types

    User-defined types can be passed only ByRef. A field of user-defined type can contain primitive types, string types, user-defined types, or a pointer to any of the above.

    VB does not support pointers. However a variable of type Long can be used for containing the address of a variable.

    To retrieve the address of any variable, you can call the routines provided in the netware.txt file. To get the address of a variable, call the corresponding routines and pass the variable as the first and second parameters. The routines return the address of the variable.

    The following table contains information about the routine to call for each variable:

    Integer

    aInteger

    Long

    aLong

    Byte

    aByte

    The following code is an example of how these routines can be called to initialize a member of a structure that is a pointer to an Integer..

    Type twoInt 
    pointerToInt As Long
    Int As Integer
    End Type

    Dim x As Integer
    Dim y As twoInt
    x = 5
    y.pointerToInt = aInteger(x,x)

    Some of the APIs take a pointer to a pointer of a structure. For example, AllocBuf takes a pointer to a pointer of the buf_t structure (the buf variable in NWDSAllocBuf). In this case, declare a variable of type Long.


4.0 Tips and Changes


4.1 Unsigned Types

Most of the NetWare APIs have types that are unsigned, such as an unsigned long and an unsigned int.

Because Visual Basic does not support unsigned long or unsigned int types, we have included some helper routines in a module called ConvertTypes.bas that can be used to promote or demote the type to the desired result.

For example, the following code defines the NWFSE_FILE_SYSTEM_INFO structure as it is declared in a C header file of the NetWare API:

typedef struct 
{
SERVER_AND_VCONSOLE_INFO serverTimeAndVConsoleInfo;
nuint16 reserved;
FSE_FILE_SYSTEM_INFO fileSystemInfo;
} NWFSE_FILE_SYSTEM_INFO;

In Visual Basic, the same structure is declared as follows:

Type NWFSE_FILE_SYSTEM_INFO 
serverTimeAndVConsoleInfo As SERVER_AND_VCONSOLE_INFO
reserved As Integer
fileSystemInfo As FSE_FILE_SYSTEM_INFO
End Type

Notice that reserved in the C declaration is of type nuint16 and in Visual Basic, it is a signed integer. Both are two bytes. However, because Visual Basic doesn't have unsigned integers or long types, it is signed instead of unsigned. For this reason, we have provided the following helper routines in the converttypes.bas file:

IntegerToLong
LongToInteger
LongToDouble
DoubleToLong

The preceeding routines help you to get the desired results back from structures and routines that have types of unsigned long and unsigned integer.


4.2 Changes

The NWCCGetConnInfo function was earlier declared as follows:

Declare Function NWCCGetConnInfo Lib "clxwin32" (ByVal connHandle As Long, ByVal infoType As Long, ByVal len1 As Long, buffer As Byte) As Long

Here, the last parameter (buffer) is a generic pointer. If used as is, it does not work. If the type for buffer is converted to Any, attempting to get a string causes Visual Basic to crash. However, other types work.

For strings, the last parameter should be declared as "ByVal buffer As String," so we've added the following two declarations:

Declare Function NWCCGetConnInfoString Lib "clxwin32" Alias "NWCCGetConnInfo" (ByVal connHandle As Long, ByVal infoType As Long, ByVal len1 As Long, ByVal buffer As String) As Long [for String values]

Declare Function NWCCGetConnInfo Lib "clxwin32" (ByVal connHandle As Long, ByVal infoType As Long, ByVal len1 As Long, buffer As Any) As Long [for non-String values]

These declarations are similar to the NWDSGetContext and NWDSSetContext functions. To see how to pass strings to these routines, see the additional routines listed in the converttypes.bas file.


5.0 Support

Visual Basic Libraries for Novell Services is unsupported.


6.0 Legal Notices

Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes.

Further, Novell, Inc. makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to make changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes.

You may not use, export, or re-export this product in violation of any applicable laws or regulations including, without limitation, U.S. export regulations or the laws of the country in which you reside.

All files provided in this release are subject to the Novell Developer License Agreement , which can be found in the license.txt file provided in this download.

Copyright © 1999-2004 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher.

Novell and NetWare are registered trademarks of Novell, Inc. in the United States and other countries.

All third-party products are the property of their respective owners.