home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
spattr.exe
/
SNAPATTR.C
next >
Wrap
C/C++ Source or Header
|
1995-02-15
|
35KB
|
919 lines
/*-------------------------------------------------------------------------*/
/* snapattr.c */
/* */
/* (c) Copyright 1992-1995 Novell, Inc. All rights reserved. */
/* */
/* The following source code is provided to aid in the development of */
/* NetWare (TM) compatible products and is provided "AS IS" AND WITHOUT */
/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING WITHOUT LIMITATION ANY */
/* IMPLIED WARRANTIES OF MERCHANTABILITY, TITLE AND FITNESS FOR A */
/* PARTICULAR PURPOSE. Some states do not allow limitations on how long */
/* an implied warranty lasts, so the above limitation may not apply to */
/* You. This warranty gives you specific legal rights which vary from */
/* state to state. Some states do not allow the exclusion or limitation */
/* of incidental or consequential damages, so the above limitation or */
/* exclusion may not apply to You. */
/* */
/*-------------------------------------------------------------------------*/
#include <windows.h>
#include <toolhelp.h>
#include <string.h>
#include <stdio.h>
#include <nwnet.h>
#include <nwsnapin.h>
#include "snapattr.h"
/*------------------------------------------------------------------------*/
/* Function Prototypes */
/*------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
N_EXTERN_LIBRARY (NWRCODE)
SnapinUserProc (pnstr8 name, nuint16 msg, nparam p1, nparam p2);
N_EXTERN_LIBRARY (nuint32)
DSFlatBrowserLaunchProc (nuint32 userParam, nuint16 uMsg,
nparam param1, nparam param2) ;
N_EXTERN_LIBRARY (nuint32)
MvedProc (nuint32 userParam, nuint16 uMsg, nparam param1, nparam param2) ;
BOOL _export FAR PASCAL UserPhotoPageDlg (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
BOOL _export FAR PASCAL UserRelativesPageDlg (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
BOOL _export FAR PASCAL MvedExampleDlg (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
int ReadUserData (void);
int ModifyUserData (char *name);
#ifdef __cplusplus
}
#endif
/*------------------------------------------------------------------------*/
/* Type Definitions And MACROS */
/*------------------------------------------------------------------------*/
typedef struct tagUserObjData
{
HWND hDialogRelatives;
char name[256];
char spouse[256];
char spouseChange[256];
int nParentCount;
int nParentChangeCount;
char parentList[5][MAX_DN_BYTES];
char parentChanges[5][MAX_DN_BYTES];
int bPhotoDefined;
char photo[17];
char photoChange[17];
} TUserObject;
#define NUM_USER_PAGES 2
/*------------------------------------------------------------------------*/
/* Global Used in the Test Object */
/*------------------------------------------------------------------------*/
NWAPageStruct UserPages[NUM_USER_PAGES];
static TUserObject userObjData;
HINSTANCE hDLL;
BOOL bChangePhoto;
/*-------------------------------------------------------------------------*/
/* DLL Entry Point */
/*-------------------------------------------------------------------------*/
int FAR PASCAL LibMain (HINSTANCE hInstance, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpCmdLine)
{
hDLL = hInstance;
if (cbHeapSize != 0)
UnlockData (0);
return 1;
};
/*-------------------------------------------------------------------------*/
/* Function : InitSnapin (void) */
/* Description : */
/* Every Snapin DLL must provide this function. In this function, */
/* snapin menu items (under Tools) are registered. Also, object procs */
/* are registered. */
/* */
/*-------------------------------------------------------------------------*/
int _export FAR PASCAL InitSnapin () /* # */
{ /* # # */
/*----------------------------------------------------------*/ /* # # */
/* Registering User Object Class Proc */ /* ##### */
/*----------------------------------------------------------*/ /* # # */
NWARegisterObjectProc (NWA_DS_OBJECT_TYPE, /* #### */
"User", /* # # */
"Novell, Inc. (C) All rights reserved.",/* #### */
hDLL, /* # # */
(NWASnapinObjectProc) SnapinUserProc, /* #### */
NWA_SNAPIN_VERSION);
return NWA_RET_SUCCESS;
}
/*-------------------------------------------------------------------------*/
/* Function : ShutDown (void) */
/* Description : */
/* Free up muscroll.dll */
/*-------------------------------------------------------------------------*/
void FAR PASCAL ShutDown (void)
{
}
/*-------------------------------------------------------------------------*/
/* Function : SnapinUserProc */
/* Description : */
/* Snapin User Object Class Proc */
/*-------------------------------------------------------------------------*/
N_GLOBAL_LIBRARY (NWRCODE) _export
SnapinUserProc (pnstr8 name, nuint16 msg, nparam p1, nparam p2)
{
switch (msg)
{
case NWA_MSG_INITSNAPIN:
{
/*-------------------------------------------------*/
/* initialize pages */
/*-------------------------------------------------*/
UserPages[0].dlgProc = (DLGPROC)UserPhotoPageDlg;
UserPages[0].resName = "UserPhotograph";
UserPages[0].pageTitle = "Photograph";
UserPages[1].dlgProc = (DLGPROC)UserRelativesPageDlg;
UserPages[1].resName = "UserRelatives";
UserPages[1].pageTitle = "Relatives";
NWAAddPropertyNameTranslation ("Photograph", /* #### */
"User", /* # */
"Fotograf"); /* # */
/* # */
return NWA_RET_SUCCESS; /* #### */
}
case NWA_MSG_GETPAGECOUNT: /* #### */
{ /* # # */
lstrcpy (userObjData.name, name); /* # # */
userObjData.spouse[0]='\0'; /* # # */
userObjData.spouseChange[0]='\0'; /* #### */
userObjData.nParentCount=0;
userObjData.nParentChangeCount=0;
ReadUserData ();
return NUM_USER_PAGES;
}
case NWA_MSG_REGISTERPAGE: /* ##### */
{ /* # */
NWAPageStruct *pageInfo = (NWAPageStruct *)p2; /* #### */
pageInfo->dlgProc = UserPages[p1].dlgProc; /* # */
pageInfo->resName = UserPages[p1].resName; /* ##### */
pageInfo->pageTitle = UserPages[p1].pageTitle;
pageInfo->hDLL = hDLL;
pageInfo->initParam = 0;
return NWA_RET_SUCCESS;
}
case NWA_MSG_MODIFY: /* # # */
{ /* # # */
MessageBox (NULL, "NWA_MSG_MODIFY received", /* ##### */
name, MB_OK); /* # # */
ModifyUserData (name); /* # # */
return NWA_RET_SUCCESS;
}
case NWA_MSG_CLOSESNAPIN:
{
/*-------------------------------------------------*/
/* unregister bitmaps and delete them */
/*-------------------------------------------------*/
MessageBox (NULL, "NWA_MSG_CLOSESNAPIN received",
"User proc", MB_OK);
return NWA_RET_SUCCESS;
}
default:
break;
}
return NWA_RET_SUCCESS;
}
/*-------------------------------------------------------------------------*/
/* Function : UserPhotoPageDlg */
/* Description : */
/* Page dialog to enhance User Details. */
/*-------------------------------------------------------------------------*/
BOOL _export FAR PASCAL UserPhotoPageDlg (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
bChangePhoto = 0;
SetDlgItemText (hwnd, IDC_PHOTO, userObjData.photo);
SendDlgItemMessage (hwnd, IDC_PHOTO, EM_LIMITTEXT, 5, 0L);
return TRUE;
}
case WM_COMMAND:
switch (wParam)
{
case IDC_PHOTO:
if (HIWORD (lParam) == EN_CHANGE)
{
SendMessage (hwnd, /* ##### */
NWA_WM_SETPAGEMODIFY, /* # */
(WORD)hwnd, /* #### */
MAKELONG (0,TRUE)); /* # */
GetDlgItemText (hwnd, /* # */
IDC_PHOTO,
userObjData.photoChange,
1024);
}
break;
}
break;
case NWA_WM_CANCLOSE: /* #### */
{ /* # */
if (stricmp (userObjData.photo, /* # ## */
userObjData.photoChange) == 0) /* # # */
{ /* ### */
bChangePhoto = 1;
}
return TRUE;
}
case NWA_WM_F1HELP: /* ### */
{ /* # */
MessageBox (NULL, "Draw a picture using keyboard", /* # */
"Snapin Help", MB_OK); /* # */
return TRUE; /* ### */
}
}
return FALSE ;
}
/*-------------------------------------------------------------------------*/
/* Function : UserRelativesPageDlg */
/* Description : */
/* Page dialog to enhance User Details. */
/*-------------------------------------------------------------------------*/
BOOL _export FAR PASCAL UserRelativesPageDlg (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
userObjData.hDialogRelatives = hwnd;
SendDlgItemMessage (hwnd, IDC_SPOUSE, EM_LIMITTEXT, 255, 0L);
SetDlgItemText (hwnd, IDC_SPOUSE, userObjData.spouse);
NWACreateMved (hwnd, /* ### */
1, /* # */
IDD_EDIT_DN, /* # */
IDD_SPIN_DN, /* # # */
IDD_BUTTON_DN, /* ### */
NWA_MVED_VALUE_DISTNAME,
32,
"Mved Example",
DS_ROOT_NAME,
0,
MvedProc) ;
return TRUE;
}
case NWA_WM_F1HELP:
{
MessageBox (NULL, "Fill in the info by clicking browse buttons",
"Snapin Help", MB_OK);
return TRUE;
}
case NWA_WM_CANCLOSE:
{
int i;
GetDlgItemText (hwnd, IDC_SPOUSE, userObjData.spouseChange,
127);
NWAGetMvedCount (hwnd, IDD_EDIT_DN, (pnuint16) /* # */
&(userObjData.nParentChangeCount)); /* # */
for (i=0; i<userObjData.nParentChangeCount; i++) /* # */
{ /* # */
NWAGetMvedValue (hwnd, IDD_EDIT_DN, i, MAX_DN_BYTES, /* ##### */
userObjData.parentChanges[i]);
}
return TRUE;
}
case WM_COMMAND:
switch (wParam)
{
case IDC_SPOUSE:
if (HIWORD (lParam) == EN_CHANGE)
{
SendMessage (hwnd, NWA_WM_SETPAGEMODIFY, (WORD)hwnd,
MAKELONG (0,TRUE));
GetDlgItemText (hwnd, IDC_SPOUSE,
userObjData.spouseChange, 255);
}
break;
case IDD_BBSPOUSE_DN:
{
char contextStr[256];
strcpy(contextStr, "");
NWALaunchDSFlatBrowser(hwnd, /* # # */
(long) &userObjData, /* ## ## */
contextStr, /* # # # */
NULL, /* # # */
NULL, /* # # */
"Selected Object",
NWA_FB_SINGLE_SELECT,
DSFlatBrowserLaunchProc);
}
break;
}
break;
}
return FALSE ;
}
/*-------------------------------------------------------------------------*/
/* Function : MvedProc */
/* Description : */
/* Mved Callback Proc */
/*-------------------------------------------------------------------------*/
N_EXTERN_LIBRARY (nuint32) _export
MvedProc
(
nuint32 userParam,
nuint16 msg,
nparam param1,
nparam param2
)
{
switch (msg)
{
case NWA_MSG_MVED_INITCOUNT : /* # # */
{ /* # # */
/*-------------------------------------------------*/ /* ### */
/* Return the number of values to initialize the */ /* # # */
/* MVED with. */ /* # # */
/*-------------------------------------------------*/
*((int *)param1) = userObjData.nParentCount;
break;
}
case NWA_MSG_MVED_INITVALUE :
{
/*-------------------------------------------------*/
/* Return the Nth value to initialize the MVED */
/* with, as specified in param1. */
/*-------------------------------------------------*/
strcpy ((char *) param2, userObjData.parentList[param1]);
break;
}
case NWA_MSG_FBFILTER_COUNT :
{
/*-------------------------------------------------*/
/* Return the number of DS classes that will be */
/* allowed to be shown in the flat browser when */
/* adding a value to the MVED. */
/* This message is only received if the MVED is */
/* created for distinguished names or filenames. */
/*-------------------------------------------------*/
*((int *)param1) = 1;
break;
}
case NWA_MSG_FBFILTER_VALUE :
{
/*-------------------------------------------------*/
/* Return the Nth DS class name that will be */
/* allowed to be shown in the flat browser, as */
/* specified in param1. */
/* This message is only received if the MVED is */
/* created for distinguished names or filenames. */
/*-------------------------------------------------*/
switch (param1)
{
case 0L:
strcpy ((char *) param2, "User");
break;
}
break;
}
}
return (0);
}
/*-------------------------------------------------------------------------*/
/* Function : DSFlatBrowserLaunchProc */
/* Description : */
/* DSFlat Browser Callback Proc */
/*-------------------------------------------------------------------------*/
N_EXTERN_LIBRARY (nuint32) _export
DSFlatBrowserLaunchProc
(
nuint32 userParam,
nuint16 msg,
nparam param1,
nparam param2
)
{
int fltCount;
NWASelObject *pObj;
char tmpBuf[512];
TUserObject * puData;
fltCount=1;
switch (msg)
{
case NWA_MSG_FBFILTER_COUNT : /* # # */
{ /* ## # */
/*-------------------------------------------------*/ /* # # # */
/* Return the number of classes that will be used */ /* # ## */
/* to filter the types of objects that may appear */ /* # # */
/* in the flat browser. */
/*-------------------------------------------------*/
*((int *)param1) = fltCount;
break;
}
case NWA_MSG_FBFILTER_VALUE : /* ### */
{ /* # # */
/*-------------------------------------------------*/ /* # # */
/* Return the Nth filter class (i.e. "User"), used */ /* # # */
/* to filter the types of objects that may appear */ /* ### */
/* in the flat browser. */
/*-------------------------------------------------*/
switch (param1)
{
case 0L:
strcpy ((char *) param2, "User");
break;
}
break;
}
case NWA_MSG_FBOBJECT_COUNT : /* #### */
{ /* # # */
/*-------------------------------------------------*/ /* #### */
/* Upon exit, the flat browser tells us how many */ /* # */
/* objects are selected, via param1. Since we're */ /* # */
/* updating a single-valued attribute, and thus */
/* launched the flat browser as single-select, we */
/* don't care how many objects are selected. */
/* We do, however, use this notification message */
/* to set the Identification page as modified. */
/*-------------------------------------------------*/
puData = (TUserObject *) userParam;
SendMessage (puData->hDialogRelatives,
NWA_WM_SETPAGEMODIFY,
(WORD)puData->hDialogRelatives,
MAKELONG (0,TRUE));
break;
}
case NWA_MSG_FBOBJECT_VALUE : /* ### */
{ /* # # */
/*-------------------------------------------------*/ /* # # */
/* Fetch the single value that was selected in the */ /* # ## */
/* flat browser when its OK button was pressed. */ /* #### */
/* Put that value both in the edit control next to */
/* the flat browser's launch button (spouse), and */
/* in the global data area's spouseChange string. */
/*-------------------------------------------------*/
pObj= (NWASelObject *) param2;
puData = (TUserObject *) userParam;
SetDlgItemText (puData->hDialogRelatives, IDC_SPOUSE,
(LPSTR) pObj->objName);
strcpy (puData->spouseChange, (LPSTR) pObj->objName);
break;
}
}
return (0);
}
/*-------------------------------------------------------------------------*/
/* Function : ReadUserData */
/* Description : */
/* Function for reading / modifying object data in DS */
/*-------------------------------------------------------------------------*/
int ReadUserData ()
{
NWDSContextHandle context;
int err = 0, i, j;
int32 iterHandle = -1L;
Buf_T *resBuf, *nameBuf;
char *attributes[] = {"Photograph"
"Spouse",
"Parents"};
uint32 totAttr, valCount, synID;
char attrName[MAX_DN_CHARS+1];
uint32 flags;
totAttr = sizeof (attributes)/sizeof (attributes[0]);
context = NWDSCreateContext ();
if (context == (NWDSContextHandle) ERR_CONTEXT_CREATION)
return ((int) context);
err = NWDSSetContext (context, DCK_NAME_CONTEXT, DS_ROOT_NAME);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
err = NWDSGetContext (context, DCK_FLAGS, (void *)&flags);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
flags |= DCV_TYPELESS_NAMES;
flags |= DCV_XLATE_STRINGS;
flags |= DCV_DEREF_ALIASES;
flags |= DCV_DEREF_BASE_CLASS;
err = NWDSSetContext (context, DCK_FLAGS, (void *)&flags);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
err = NWDSAllocBuf (DEFAULT_MESSAGE_LEN, &resBuf);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
err = NWDSAllocBuf (DEFAULT_MESSAGE_LEN, &nameBuf);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
return err;
}
/*----------------------------------------------------------------------*/
/* Initialize input buffer and check for errors. The output buffer does */
/* not need to be initialized. This buffer will be initialized to */
/* DSV_READ operations */
/*----------------------------------------------------------------------*/
err = NWDSInitBuf (context, DSV_READ, nameBuf);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
/*----------------------------------------------------------------------*/
/* Put object attributes that are to be read into input buffer. */
/* Check for errors. */
/*----------------------------------------------------------------------*/
for (i = 0; i < totAttr; i++)
{
err = NWDSPutAttrName (context, nameBuf, attributes[i]);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
}
/*----------------------------------------------------------------------*/
/* Read the data. */
/*----------------------------------------------------------------------*/
userObjData.bPhotoDefined = 0;
iterHandle = NO_MORE_ITERATIONS;
do
{
err = NWDSRead (context, userObjData.name, DS_ATTRIBUTE_VALUES,
FALSE, nameBuf, &iterHandle, resBuf);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
/*--------------------------------------------------------------------*/
/* pull stuff out of the output buffer, checking for errors. */
/* First, get total no of attributes in the buffer. */
/*--------------------------------------------------------------------*/
err = NWDSGetAttrCount (context, resBuf, &totAttr);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
for (i = 0; i< totAttr; i++)
{
err = NWDSGetAttrName (context, resBuf, attrName, &valCount, &synID);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
if (lstrcmp (attrName, "Photograph") == 0)
{
userObjData.bPhotoDefined = 1;
err = NWDSGetAttrVal (context, resBuf, synID, userObjData.photo);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
}
else if (lstrcmp (attrName, "Spouse") == 0)
{
err=NWDSGetAttrVal (context, resBuf, synID, userObjData.spouse);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
}
else if (lstrcmp (attrName, "Parents") == 0)
{
userObjData.nParentCount = valCount;
for (j=0; j<valCount; j++) // multi-valued: fetch each one
{
err=NWDSGetAttrVal (context, resBuf, synID,
userObjData.parentList[j]);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return err;
}
}
}
}
} while (iterHandle != NO_MORE_ITERATIONS);
NWDSFreeContext (context);
NWDSFreeBuf (resBuf);
NWDSFreeBuf (nameBuf);
return 0;
}
/*-------------------------------------------------------------------------*/
/* Function : ModifyUserData (void) */
/* Description : */
/* Modifies a User Object's Attribute Values */
/*-------------------------------------------------------------------------*/
int ModifyUserData (char *name)
{
NWDSContextHandle context;
int err = 0, i, j;
Buf_T *inpBuf;
uint32 flags;
uint32 syntaxID;
context = NWDSCreateContext ();
if (context == (NWDSContextHandle) ERR_CONTEXT_CREATION)
return ((int) context);
err = NWDSSetContext (context, DCK_NAME_CONTEXT, DS_ROOT_NAME);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
err = NWDSGetContext (context, DCK_FLAGS, (void *)&flags);
flags |= DCV_TYPELESS_NAMES;
flags |= DCV_XLATE_STRINGS;
flags |= DCV_DEREF_ALIASES;
flags |= DCV_DEREF_BASE_CLASS;
err = NWDSSetContext (context, DCK_FLAGS, (void *)&flags);
err = NWDSAllocBuf (DEFAULT_MESSAGE_LEN, &inpBuf);
if (err < 0)
{
NWDSFreeContext (context);
return err;
}
err = NWDSInitBuf (context, DSV_MODIFY_ENTRY, inpBuf);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
/*------------------------------------------------------------*/
/* Handle modifications of the Parents attribute */
/*------------------------------------------------------------*/
err = NWDSGetSyntaxID (context, "Parents", &syntaxID);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
/*-------------------------------------------------------*/
/* Modify Parents Attribute values */
/* (This isn't really the way to do it, but the built-in */
/* MVED has no mechanism for informing you that the */
/* attribute has changed, or which values were changed.) */
/*-------------------------------------------------------*/
if (userObjData.nParentCount != userObjData.nParentChangeCount)
{
if (userObjData.nParentCount)
{
/*---------------------------------------------------*/
/* There were some Parents in the object; */
/* remove all of them first (brute force method). */
/*---------------------------------------------------*/
err = NWDSPutChange (context, inpBuf, DS_REMOVE_VALUE, "Parents");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
for (j=0; j<userObjData.nParentCount; j++)
{
err = NWDSPutAttrVal (context, inpBuf, syntaxID,
userObjData.parentList[j]);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
}
/*---------------------------------------------------*/
/* Now, add all of the ones that were found at the */
/* time the OK button was pressed. This includes */
/* even those that were in the original list that */
/* weren't deleted (continuation of brute force...) */
/*---------------------------------------------------*/
if (userObjData.nParentChangeCount)
{
err = NWDSPutChange (context, inpBuf, DS_ADD_VALUE,
"Parents");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
for (j=0; j<userObjData.nParentChangeCount; j++)
{
err = NWDSPutAttrVal (context, inpBuf, syntaxID,
userObjData.parentChanges[j]);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
}
}
/*------------------------------------------------------------*/
/* Handle modifications of the Spouse attribute */
/*------------------------------------------------------------*/
if (strcmp (userObjData.spouse, userObjData.spouseChange) != 0)
{
if (userObjData.spouse[0])
{
err = NWDSPutChange (context, inpBuf, DS_REMOVE_VALUE, "Spouse");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
err = NWDSPutAttrVal (context, inpBuf, SYN_DIST_NAME,
userObjData.spouse);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
err = NWDSPutChange (context, inpBuf, DS_ADD_VALUE, "Spouse");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
err = NWDSPutAttrVal (context, inpBuf, SYN_DIST_NAME,
userObjData.spouseChange);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
/*---------------------------------------------------------------*/
/* Modify Photograph Attribute */
/*---------------------------------------------------------------*/
if (bChangePhoto)
{
if (userObjData.bPhotoDefined)
{
err = NWDSPutChange (context, inpBuf, DS_REMOVE_VALUE, "Photograph");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
err = NWDSPutAttrVal (context, inpBuf, SYN_CI_STRING,
userObjData.photo);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
err = NWDSPutChange (context, inpBuf, DS_ADD_VALUE, "Photograph");
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
err = NWDSPutAttrVal (context, inpBuf, SYN_CI_STRING,
userObjData.photoChange);
if (err < 0)
{
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}
}
err = NWDSModifyObject (context, name, NULL, 0, inpBuf);
NWDSFreeContext (context);
NWDSFreeBuf (inpBuf);
return err;
}