home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
dsque.exe
/
EXTSCMA.C
< prev
Wrap
Text File
|
1994-11-07
|
6KB
|
233 lines
/****************************************************************************
** File: EXTSCMA.C
**
** Desc: This program extends the schema creating a new effective class
** named QServer. This is a necessary step in preparation for
** creating an object of type QServer.
**
**
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
**
** Programmers:
**
** Ini Who Firm
** -----------------------------------------------------------------------
** KLB Karl Bunnell Novell Developer Support.
**
** History:
**
** When Who What
** -----------------------------------------------------------------------
** 10-24-94 klb First code.
*/
/****************************************************************************
** Include headers, macros, function prototypes, etc.
*/
/*------------------------------------------------------------------------
** MACROS
*/
#define NWDOS
/*------------------------------------------------------------------------
** ANSI
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
/*------------------------------------------------------------------------
** NetWare
*/
#include <nwnet.h>
#include <nwcalls.h>
#include <nwlocale.h>
void main (void)
{
NWDSCCODE cCode;
NWDSContextHandle dContext;
DWORD flags;
NWDS_BUFFER *classBuf;
LCONV lconvInfo;
Class_Info_T classInfo;
char className[MAX_SCHEMA_NAME_CHARS+2];
char superClass[MAX_SCHEMA_NAME_CHARS+2];
cCode = NWCallsInit(NULL, NULL);
if (cCode)
{
printf("\nCall to NWCallsInit returned: %04X", cCode);
exit(1);
}
NWLsetlocale(LC_ALL, "");
NWLlocaleconv(&lconvInfo);
cCode = NWInitUnicodeTables(lconvInfo.country_id, lconvInfo.code_page);
if(cCode)
{
printf("NWInitUnicodeTables() returned: %04X\n", cCode);
goto _FreeUnicodeTables;
}
dContext = NWDSCreateContext();
if (dContext == ERR_CONTEXT_CREATION)
{
printf("NWDSCreateContext returned: %04X\n", cCode);
goto _FreeContext;
}
/*----------------------------------------------------------------
** Get the current directory context flags so we can modify them.
*/
cCode = NWDSGetContext(
/* Contxt Handle */ dContext,
/* Key */ DCK_FLAGS,
/* Context Flags */ &flags
);
if (cCode < 0)
{
printf("NWDSGetContext returned: %04X\n", cCode);
goto _FreeContext;
}
/*-------------------------------------------------------------------
** Turn typeless naming on.
** Turn canonicalize names off. This means we will get full names.
*/
flags |= DCV_TYPELESS_NAMES;
flags &= ~DCV_CANONICALIZE_NAMES;
/*----------------------------------------------------------------
** Set the directory context flags so they take effect.
*/
cCode = NWDSSetContext(
/* Context Handle */ dContext,
/* Key */ DCK_FLAGS,
/* Set Flag Value */ &flags
);
if (cCode < 0)
{
printf("NWDSSetContext returned: %04X\n", cCode);
goto _FreeContext;
}
strcpy(className, "QServer");
strcpy(superClass, "Server");
classInfo.classFlags = DS_EFFECTIVE_CLASS;
cCode = NWDSAllocBuf(DEFAULT_MESSAGE_LEN, &classBuf);
if( cCode < 0 )
{
printf("\nNWDSAllocBuf returned %04X", cCode);
goto _FreeUnicodeTables;
}
cCode = NWDSInitBuf(dContext, DSV_DEFINE_CLASS, classBuf);
if( cCode < 0 )
{
printf("\nNWDSInitBuf returned %04X", cCode);
goto _FreeBuf;
}
/*----------------------------------------------------------------
** entries for super class names
*/
cCode = NWDSBeginClassItem(dContext, classBuf);
if( cCode < 0 )
{
printf("\nNWDSBeginClassItem returned %04X", cCode);
goto _FreeBuf;
}
cCode = NWDSPutClassItem(dContext, classBuf, superClass);
if( cCode < 0 )
{
printf("\nNWDSPutClassItem returned %04X", cCode);
goto _FreeBuf;
}
/*----------------------------------------------------------------
** entries for containment class names; which are none
*/
cCode = NWDSBeginClassItem(dContext, classBuf);
if( cCode < 0 )
{
printf("\nNWDSBeginClassItem returned %04X", cCode);
goto _FreeBuf;
}
/*----------------------------------------------------------------
** entries for naming attribute names; same as Server
*/
cCode = NWDSBeginClassItem(dContext, classBuf);
if( cCode < 0 )
{
printf("\nNWDSBeginClassItem returned %04X", cCode);
goto _FreeBuf;
}
/*----------------------------------------------------------------
** entries for mandatory attribute names; same as Server
*/
cCode = NWDSBeginClassItem(dContext, classBuf);
if( cCode < 0 )
{
printf("\nNWDSBeginClassItem returned %04X", cCode);
goto _FreeBuf;
}
/*----------------------------------------------------------------
** entries for optional attribute names; same as server for now.
*/
cCode = NWDSBeginClassItem(dContext, classBuf);
if( cCode < 0 )
{
printf("\nNWDSBeginClassItem returned %04X", cCode);
goto _FreeBuf;
}
cCode = NWDSDefineClass(dContext, className, &classInfo, classBuf);
if( cCode < 0 )
{
printf("\nNWDSDefineClass returned %04X", cCode);
goto _FreeBuf;
}
_FreeBuf:
NWDSFreeBuf(classBuf);
_FreeContext:
NWDSFreeContext(dContext);
_FreeUnicodeTables:
NWFreeUnicodeTables();
}