ScanBinderyObject
Scans the bindery for an object (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWScanObject)
#include <\nlm\nit\nwbindry.h>
int ScanBinderyObject (
char *searchObjectName,
WORD searchObjectType,
long *objectID,
char *objectName,
WORD *objectType,
char *objectHasProperties,
char *objectFlag,
char *objectSecurity);
This function is used iteratively to scan the bindery for all objects that match both the searchObjectName and the searchObjectType parameters.
The objectID parameter should be set to -1 for the first search. Upon return, the objectID parameter receives a number which is the value in the objectID parameter for the next call. This function can scan for one particular object type or all object types (WILD). It can also scan for a specific object name, or it can use wildcard characters to scan for a group of related object names.
The objectSecurity parameter is actually two nibbles. The low-order nibble determines who can scan for and find the object. The high-order nibble determines who can add properties to the object. The following values are defined for each nibble:
|
0 |
0 0 0 0 |
Anyone |
|
1 |
0 0 0 1 |
Logged |
|
2 |
0 0 1 0 |
Object |
|
3 |
0 0 1 1 |
Supervisor |
|
4 |
0 1 0 0 |
NetWare Operating System |
For example, 0x31 indicates that any user logged in to the server can find the object, but only the supervisor can add a property to the object.
#include <stdio.h>
#include <\nlm\nit\nwbindry.h>
main()
{
int completionCode;
char searchObjectName[48];
WORD searchObjectType;
long objectID = -1;
char objectName[48];
WORD objectType;
char objectHasProperties;
char objectFlag;
char objectSecurity;
printf ("\n\n");
printf ("Enter Object name to search: ");
scanf ("%s", searchObjectName);
printf ("\nEnter object type to search: ");
scanf ("%4X", &searchObjectType);
printf ("\nObject name... %s\n", searchObjectName);
printf ("\nObject type... %d\n", searchObjectType);
printf ("\nObject type... %4X\n", searchObjectType);
printf ("\n\n\n\n\n\n");
printf ("OBJECT NAME OBJECT TYPE OBJECT ID\n");
printf ("———- ———- ——\n\n");
for (objectID = -1, completionCode = 0; !completionCode;)
{
completionCode = ScanBinderyObject (searchObjectName,
searchObjectType, &objectID, objectName,
&objectType, &objectHasProperties,
&objectFlag, &objectSecurity);
if (completionCode == 0)
{
printf ("%15s %2d %8lX\n",
objectName, objectType, objectID);
printf ("More %d, Dynamic/Static %d, R/W Access %d\n",
objectHasProperties, objectFlag,
objectSecurity);
}
}
}