NWWriteEA

Writes data to an Extended Attribute

Local Servers:blocking
Remote Servers:blocking
NetWare Server:3.11, 3.12, 3.2, 4.x, 5.x, 6.x
Platform:NLM, Windows NT, Windows 95, Windows 98
Library:Cross-Platform NetWare Calls (CAL*.*)
Service:Extended Attribute

Syntax

  #include <nwnamspc.h> 
  #include <nwea.h> 
  or 
  #include <nwcalls.h> 
    
  N_EXTERN_LIBRARY(NWCCODE) NWWriteEA ( 
     NW_EA_HANDLE N_FAR  *EAHandle,  
     nuint32              totalWriteSize,  
     nuint32              bufferSize,  
     const nstr8 N_FAR   *buffer,  
     pnuint32             amountWritten);
  

Delphi Syntax

  uses calwin32 
   
  Function NWWriteEA 
    (Var EAHandle : NW_EA_HANDLE; 
     totalWriteSize : nuint32; 
     bufferSize : nuint32; 
     buffer : pnuint8; 
     amountWritten : pnuint32 
  ) : NWCCODE;
  

Parameters

EAHandle
(IN/OUT) Points to the NW_EA_HANDLE structure returned by the NWGetEAHandleStruct, NWFindFirstEA, NWFindNextEA, or NWOpenEA function.
totalWriteSize
(IN) Specifies the size of the total Write.
bufferSize
(IN) Specifies the size of the buffer.
buffer
(IN) Points to a data buffer.
amountWritten
(OUT) Points to the amount of data written by NWWriteEA (not cumulative across multiple calls).

Return Values

These are common return values; see Return Values (Return Values for C) for more information.

0x0000

SUCCESSFUL; valid data remains in the Extended Attribute

0x0001

SUCCESSFUL; valid data remains in the buffer, not the Extended Attribute

0x8901

ERR_INSUFFICIENT_SPACE

0x898C

NO_MODIFY_PRIVILEGES

0x899C

INVALID_PATH

0x89C8

MISSING_EA_KEY

0x89C9

EA_NOT_FOUND

0x89CB

EA_NO_KEY_NO_DATA

0x89CE

EA_BAD_DIR_NUM

0x89CF

INVALID_EA_HANDLE

0x89D0

EA_POSITION_OUT_OF_RANGE

0x89D1

EA_ACCESS_DENIED

0x89D2

DATA_PAGE_ODD_SIZE

0x89D3

EA_VOLUME_NOT_MOUNTED

0x89D4

BAD_PAGE_BOUNDARY

0x89FF

HARDWARE_FAILURE

Remarks

If the Extended Attribute does not exist, NWWriteEA attempts to create it.

NWWriteEA returns 0x0000 when there is more data in the Extended Attribute and NWWriteEA needs to be called again. NWWriteEA returns 0x0001 when there is valid data in the buffer but none left in the Extended Attribute.

The NWReadEA function and NWWriteEA can perform multiple actions, such as opening or creating an Extended Attribute and then performing the appropriate function. To properly end NWWriteEA, the NWCloseEA function must be called after the last Read, Write, and/or Find Extended Attribute function.

Extended Attribute values should always be read or written completely. Extended Attributes are not treated like files when transferring. Therefore, partial Reads or Writes are not allowed.

IMPORTANT:If an Extended Attribute is not read or written completely, data past the end of the last Read or Write may be lost!

Before calling NWWriteEA, an application must properly initialize the NW_EA_HANDLE structure to access the Extended Attribute database. An application can initialize the NW_EA_HANDLE structure by calling the NWFindFirstEA, NWFindNextEA, NWGetEAHandleStruct, or NWOpenEA function. The NW_EA_HANDLE structure is for internal use only; do not manipulate it in any way.

For Writes, the bufferSize parameter should be at least 512 bytes. If the bufferSize parameter is less than the totalWriteSize parameter, it must be a multiple of 512.

NWWriteEA writes up to the number of bytes specified by the bufferSize parameter or until the end of the Extended Attribute data, whichever comes first. If the data to be written is larger than the buffer size, NWWriteEA must be called multiple times to write all the data to the Extended Attribute.

An application should complete the entire Write before closing the Extended Attribute.

NCP Calls

See Also

NWReadEA