463 lines
16 KiB
C
463 lines
16 KiB
C
/****************************************************************************
|
|
|
|
|
| (C) Copyright 1985, 1991, 1993, 1996, 2003 Novell, Inc.
|
|
| All Rights Reserved.
|
|
|
|
|
| This program is free software; you can redistribute it and/or
|
|
| modify it under the terms of version 2 of the GNU General Public
|
|
| License as published by the Free Software Foundation.
|
|
|
|
|
| This program is distributed in the hope that it will be useful,
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| GNU General Public License for more details.
|
|
|
|
|
| You should have received a copy of the GNU General Public License
|
|
| along with this program; if not, contact Novell, Inc.
|
|
|
|
|
| To contact Novell about this file by physical or electronic mail,
|
|
| you may find current contact information at www.novell.com
|
|
|
|
|
|***************************************************************************
|
|
|
|
|
| NetWare Advance File Services (NSS) module
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
|
|
|
| $Author: blarsen $
|
|
| $Date: 2006-11-15 04:57:17 +0530 (Wed, 15 Nov 2006) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 1644 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| This module is used to:
|
|
| NSS Library source
|
|
|
|
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
|
|
|
|
| This header file should ONLY be used for NSS internal development.
|
|
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
|
|
| Any other use may cause conflicts which NSS will NOT fix.
|
|
+-------------------------------------------------------------------------*/
|
|
#ifndef _SYSIMP_H_
|
|
#define _SYSIMP_H_
|
|
|
|
#ifndef _OMNI_H_
|
|
#include <omni.h>
|
|
#endif
|
|
|
|
#if !defined(__KERNEL__)
|
|
#ifndef __DDSAPI_H
|
|
#include <ddsapi.h>
|
|
#endif
|
|
|
|
#ifndef __DDSBASE_H
|
|
#include <ddsbase.h>
|
|
#endif
|
|
#endif
|
|
|
|
#if zNETWARE || (zLINUX && defined(__KERNEL__))
|
|
#ifndef _MPKTYPES_H_
|
|
#include <mpktypes.h>
|
|
#endif
|
|
|
|
#include <alert.h> /* NetWare Include*/
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef __linux__
|
|
/* Pre-declare the following structure(s) */
|
|
struct ReplyProceduresStructure;
|
|
struct RequestPacketStructure;
|
|
struct zUnixInfo_s;
|
|
#endif
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Routines that will initialize the system imports
|
|
*-------------------------------------------------------------------------*/
|
|
extern STATUS LB_InitializeSystemImports(void);
|
|
extern void LB_UninitializeSystemImports(void);
|
|
|
|
#ifndef __linux__
|
|
extern void LB_ImportOptionalUnixlibStuff(void);
|
|
extern void LB_UnimportOptionalUnixlibStuff(void);
|
|
#endif
|
|
extern STATUS LB_ImportNDSPublics(LONG handle);
|
|
|
|
extern void UnimportNSSPublics(void);
|
|
extern STATUS ImportNSSPublics(void);
|
|
|
|
extern BOOL NdsPublicsLoaded;
|
|
#ifndef __linux__
|
|
extern int (*NDSRenameEventFunc)();
|
|
extern int (*NDSDeleteEventFunc)();
|
|
extern LONG NDSEventHandlerHandle;
|
|
extern DDSAPI int(*DDSGetLocalAgentInfoPtr)(NINT *state, void *treeName);
|
|
extern DDSAPI int(*DDSGetLocalEntryNamePtr)(NINT entryid, int FormFlags, unicode_t *dn);
|
|
#endif
|
|
#if !defined(__KERNEL__)
|
|
extern DDSAPI int(*DDCCreateContextPtr)(SAL_ModHandle taskID, int *context);
|
|
extern DDSAPI int(*DDCDuplicateContextPtr)(int oldContext, int *newContext);
|
|
extern DDSAPI int(*DDCResolveNamePtr)(int context, uint32 flags, const void *dn);
|
|
extern DDSAPI int(*DDCGetEntryInfoPtr)(int context, uint32 infoflags, size_t bufsize, void *buffer);
|
|
extern DDSAPI void(*DDCFreeContextPtr)(int context);
|
|
extern DDSAPI int(*DDCSetContextFlagsPtr)(int context, uint32 setflags, uint32 clearflags);
|
|
extern DDSAPI int(*DDCSetContextEntryIDPtr)(int context, uint32 id);
|
|
//extern int int(*DDSGetLocalEntryIDPtr)(const unicode_t *name, LONG *id);
|
|
extern DDSAPI int(*DDCLoginPtr)(int context, const char *password);
|
|
extern DDSAPI int(*DDSLoginAsServerPtr)(int context);
|
|
extern DDSAPI int(*DDCCreateEntryPtr)(int context, const DDCString *rdn, unsigned valueCount, const DDCVALUE *values);
|
|
extern DDSAPI int(*DDCRemoveEntryPtr)(int context);
|
|
extern DDSAPI int(*DDCRemoveAttributePtr)(int context, const DDCString *attrName);
|
|
extern DDSAPI int(*DDCGenerateKeyPairPtr)(int context, const char *password);
|
|
extern DDSAPI int(*DDCLogoutPtr)(int context);
|
|
extern DDSAPI int(*DDCReadToBufferPtr)(int context, const DDCReadFilter *filter, uint32 infoType, size_t maxValueSize, size_t valuesSize, DDCVALUE *values, unsigned int *valueCount);
|
|
extern DDSAPI int(*DDCReadToCBPtr)(int context, const DDCReadFilter *filter, uint32 infoType, size_t maxValueSize, DDCReadCB rcb, void *clientData);
|
|
extern DDSAPI int(*DDCListToBufferPtr)(int context, const DDCListFilter *filter, uint32 infoFlags, size_t bufSize, void *buffer, unsigned int *entryeCount);
|
|
extern DDSAPI int(*DDCModifyEntryPtr)(int context, unsigned int count, const DDCVALUE *values);
|
|
extern DDSAPI int(*DDCModifyRDNPtr)(int context, const DDCString *newRDN, int deleteOld);
|
|
extern DDSAPI int(*DDCGetServerNamePtr)(int context, DDCString *serverName, size_t maxSize, size_t *actualSize, char *referral);
|
|
extern DDSAPI int(*DDCSetContextBaseDNPtr)(int context, const DDCString *dn, const unicode *delims);
|
|
extern DDSAPI int(*DDCAuthenticateConnectionPtr)(int context);
|
|
extern DDSAPI int(*DDCGetEffectivePrivilegesPtr)(int context, const DDCString *trusteeDN,
|
|
const DDCString *attrName, uint32 *privileges);
|
|
extern DDSAPI int(*DDCCheckConsoleOperatorPtr)(int context, const DDCString *dn);
|
|
extern DDSAPI int(*DDCNameToIDPtr)(int context, uint32 flags, const DDCString *dn);
|
|
extern DDSAPI int(*DDCConnectToReferralPtr)(int context, int flags, const char *referral);
|
|
#if zLINUX && !defined(__KERNEL__)
|
|
extern DDSAPI int (*DDCGetDefaultAddressPtr)(int *type, size_t maxSize, size_t *size, void *data);
|
|
extern DDSAPI int(*DDCConnectToAddressPtr)(int context, int flags, int type,
|
|
size_t size, const void *data);
|
|
#endif
|
|
extern DDSAPI uint32(*DDCContextEntryIDPtr)(int context);
|
|
extern DDSAPI int(*DDCPingPtr)(int context, uint32 *dsVersion, uint32 *rootMostEntryDepth, char *treeName, uint32 *flags, unicode *uTree);
|
|
#endif
|
|
|
|
#if zNETWARE || (zLINUX && defined(__KERNEL__))
|
|
extern STATUS (*zClosePtr)(
|
|
Key_t key);
|
|
|
|
extern STATUS (*zGetInfoPtr)(
|
|
Key_t key,
|
|
QUAD getInfoMask,
|
|
NINT sizeRetGetInfo,
|
|
NINT infoVersion,
|
|
void *retGetInfo);
|
|
|
|
extern STATUS (*zOpenPtr)(
|
|
Key_t key,
|
|
NINT taskID,
|
|
NINT nameSpace,
|
|
const void *path,
|
|
NINT requestedRights,
|
|
Key_t *retKey);
|
|
|
|
extern STATUS (*zReadPtr)(
|
|
Key_t key,
|
|
Xid_t xid,
|
|
QUAD startingOffset,
|
|
NINT bytesToRead,
|
|
void *retBuffer,
|
|
NINT *retBytesRead);
|
|
|
|
extern STATUS (*zRootKeyPtr)(
|
|
NINT connectionID,
|
|
Key_t *retRootKey);
|
|
|
|
extern STATUS (*zWritePtr)(
|
|
Key_t key,
|
|
Xid_t xid,
|
|
QUAD startingOffset,
|
|
NINT bytesToWrite,
|
|
const void *buffer,
|
|
NINT *retBytesWritten);
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* Version defintions for NetWare
|
|
*-------------------------------------------------------------------------*/
|
|
#define GREENRIVER_MAJOR_VERSION 4
|
|
#define GREENRIVER_MINOR_VERSION 11
|
|
|
|
#define MOAB_MAJOR_VERSION 5
|
|
#define MOAB_MINOR_VERSION 0
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* GreenRiver does NOT have a .H file defining the "LocaleTable" table,
|
|
* so this is a local copy.
|
|
*---------------------------------------------------------------------------*/
|
|
struct LocaleTableStruct
|
|
{
|
|
/*BYTE LocaleTableSgnature[12];*/ /* "LoCaLe Table" */
|
|
/* the address we get from the OS starts HERE*/
|
|
/* LCONFIG.SYS relative offset */
|
|
LONG OSLanguageID; /* 0 */
|
|
LONG OSDoubleBytePresentFlag; /* 4 */
|
|
LONG OSDoubleByteSpace; /* 8 */
|
|
|
|
LONG OSUpperCaseTableID; /* 12 */
|
|
|
|
/* WARNING - util.386 assumes OSUpperCaseTable is at offset 16 */
|
|
BYTE OSUpperCaseTable[256]; /* 16 */
|
|
|
|
LONG OSSortTableID; /* 272 */
|
|
BYTE OSSortTable[256]; /* 276 */
|
|
|
|
LONG OSLineDrawCharTableID; /* 532 */
|
|
BYTE OSLineDrawCharTable[8 * 6]; /* 536 */
|
|
|
|
LONG OSDoubleByteTableID; /* 584 */
|
|
BYTE OSFirstByteBitMap[256 / 8]; /* 588 */
|
|
|
|
/* DOS Flavor Tables */
|
|
|
|
LONG DOSType; /* 620 */
|
|
|
|
BYTE DOSValidCharBitMap[256/8]; /* 624 */
|
|
|
|
BYTE DOSValidCharBitMapNoLower[256/8];/* 656 */
|
|
|
|
BYTE DOSFirstByteBitMap[256/8]; /* 688 */
|
|
|
|
BYTE DOSSecondByteBitMap[256/8]; /* 720 */
|
|
|
|
/* WARNING - util.386 assumes DOSUpperCaseTable is at offset 752 */
|
|
BYTE DOSUpperCaseTable[256]; /* 752 */
|
|
|
|
BYTE DOSToMAC[256]; /* 1008 */
|
|
|
|
BYTE MACToDOS[256]; /* 1264 */
|
|
};
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* MOAB specific definitions
|
|
*-------------------------------------------------------------------------*/
|
|
#ifdef _NWMOAB_
|
|
# define ResourceTagDef ResourceTagStructure /* old GreenRiver name to correct name */
|
|
extern struct LocaleTableStruct *LocaleTable;
|
|
#endif
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* General definitions
|
|
*-------------------------------------------------------------------------*/
|
|
extern struct ResourceTagStructure *NW_OSGeneralWorkAllocTag;
|
|
extern LONG *NW_NumberOfVolumes;
|
|
extern struct LocaleTableStruct *NW_LocaleTable;
|
|
extern struct ConnectionStructure *((**NW_connectionTable)[]);
|
|
extern LONG *NW_numberOfConnectionSlots;
|
|
|
|
extern void (*(*NW_SwitchVector)[256])();
|
|
|
|
extern struct LoadDefinitionStructure **NW_OSHandle;
|
|
extern NetWareAlertStructure *NW_StationAttemptedToUseBadPacket;
|
|
extern NetWareAlertStructure *NW_StationUsedBadPacket;
|
|
extern NetWareAlertStructure *NW_NCPHasBadSubFunctionLength;
|
|
extern NetWareAlertStructure *NW_NCPUsedBadSubFunctionLength;
|
|
|
|
extern LONG *NW_NCPBoundCheckFlag;
|
|
extern LONG *NW_NCPBoundCheckFailed;
|
|
extern LONG *NW_NCPBoundWarningFlag;
|
|
extern LONG *NW_NCPCompCheckFailed;
|
|
extern LONG *NW_NCPCompCheckFlag;
|
|
extern LONG *NW_NCPCompWarningFlag;
|
|
|
|
extern LONG *NW_MLIDMaximumPacketSize;
|
|
extern LONG *NW_MaximumNumberOfServerProcesses;
|
|
extern LONG *NW_MinimumNumberOfServerProcesses;
|
|
|
|
extern void *NW_PBInternalDelaySendPacketWithSignatures;
|
|
extern void *NW_PBInternalSendPacketWithSignatures;
|
|
extern void **NW_WriteActiveList;
|
|
extern void **NW_WriteControlAvailList;
|
|
extern void *NW_SkipReceiveBufferReturn;
|
|
|
|
extern BYTE *NW_NestedInterruptCount;
|
|
extern BYTE *NW_DebuggerActive;
|
|
|
|
#ifndef __linux__
|
|
extern THREAD (*kStartThreadWithModuleHandlePtr)(
|
|
BYTE *pThreadName,
|
|
void *(*StartAddress)(THREAD, void *),
|
|
void *StackAddressHigh,
|
|
LONG StackSize,
|
|
void *Argument,
|
|
uint32 ModuleHandle);
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Routines in the OS that we have set local pointers to
|
|
*---------------------------------------------------------------------------*/
|
|
extern LONG (*NW_CDisAssemble)(
|
|
struct ScreenStruct *screenID,
|
|
BYTE **instruction,
|
|
BYTE *unassembleBuffer,
|
|
struct StackFrame *stackFrame);
|
|
|
|
extern LONG (*UNIXLIB_MapDOSToNFSforNewNSSFilePtr)(
|
|
LONG connectionNum,
|
|
LONG volumeNum,
|
|
LONG DirectoryNum,
|
|
BOOL isSubdirectory,
|
|
LONG fileOwnerID,
|
|
LONG acsOpt,
|
|
struct zUnixInfo_s *unixMetaData,
|
|
BYTE **variableSizeData);
|
|
|
|
extern BOOL UNIXLIB_isLoaded;
|
|
extern BOOL UNIXLIB_isUnloading;
|
|
extern NINT UNIXLIB_useCount;
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Handle certain NCP Errors
|
|
*---------------------------------------------------------------------------*/
|
|
extern void (*NW_ErrCase)(
|
|
struct RequestPacketStructure *Request,
|
|
struct ReplyProceduresStructure *RP);
|
|
|
|
/*===========================================================================
|
|
*===========================================================================
|
|
* Emulation routines that are in PSS that emulate functionality
|
|
* that is in some versions of NETWARE but not ALL.
|
|
*===========================================================================
|
|
*===========================================================================*/
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* This emulates the "BranchTable" code that is in the C Code base version
|
|
* of NetWare.
|
|
*---------------------------------------------------------------------------*/
|
|
struct NW_BranchTableEntry /* from NSIMMU.H */
|
|
{
|
|
BYTE OpCode; /* Must be the first field*/
|
|
LONG Target; /* Must immediately follow OpCode*/
|
|
};
|
|
|
|
extern void NW_WriteBranchTableEntry( /* from NSIMMU.C */
|
|
NINT instruction,
|
|
struct NW_BranchTableEntry *entry,
|
|
void *branchRoutine);
|
|
|
|
#define CALL_INST 0xE8
|
|
#define JMP_INST 0xE9
|
|
|
|
#define I386_OFFSET_TO_ABSOLUTE(_jmpAddr,_startAddr) \
|
|
((ADDR)(((struct NW_BranchTableEntry *)(_jmpAddr))->Target + ((LONG)(_startAddr) + 5)))
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* NCP Error reporting routines.
|
|
*---------------------------------------------------------------------------*/
|
|
extern LONG NW_NCPLengthError(
|
|
struct RequestPacketStructure *ncppacket,
|
|
struct ReplyProceduresStructure *RP,
|
|
LONG subfunc);
|
|
|
|
extern LONG NW_NCPFuncBoundaryError(
|
|
struct RequestPacketStructure *ncppacket,
|
|
struct ReplyProceduresStructure *RP,
|
|
LONG subfunc);
|
|
|
|
extern LONG NW_NCPSubFuncLengthError(
|
|
struct RequestPacketStructure *ncppacket,
|
|
struct ReplyProceduresStructure *RP,
|
|
LONG subfunc);
|
|
#endif
|
|
#endif
|
|
|
|
/*---------------------------------------------------------------------------
|
|
* Inline assembly pragma from C Code base that is not in GreeRiver.
|
|
*
|
|
* Call assembly routine with one parameter in ESI
|
|
*---------------------------------------------------------------------------*/
|
|
#if zNETWARE
|
|
LONG NW_CallAsm1(void *RoutineAddress, void *parm1);
|
|
|
|
#pragma aux NW_CallAsm1 = \
|
|
"push ebp", \
|
|
"push esi", \
|
|
"call eax", \
|
|
"add esp, 4", \
|
|
"pop ebp", \
|
|
parm [EAX] [ESI] \
|
|
modify exact [EAX EBX ECX EDX ESI EDI];
|
|
#endif
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
* NW_CallAsm2a has two parameters ESI and second parameter in eax
|
|
* NW_CallAsm2b has two parameters ESI and second parameter in ebx,
|
|
* NW_CallAsm2d has two parameters ESI and second parameter in edx,
|
|
*-------------------------------------------------------------------------*/
|
|
#if zNETWARE
|
|
LONG NW_CallAsm2a(void *RoutineAddress, void *parm1, LONG parm2);
|
|
|
|
#pragma aux NW_CallAsm2a = \
|
|
"push ebp", \
|
|
"push eax", \
|
|
"push esi", \
|
|
"call ecx", \
|
|
"add esp, 8", \
|
|
"pop ebp", \
|
|
parm [ECX] [ESI] [EAX] \
|
|
modify exact [EAX EBX ECX EDX ESI EDI];
|
|
#endif
|
|
|
|
|
|
#if zNETWARE
|
|
LONG NW_CallAsm2b(void *RoutineAddress, void *parm1, LONG parm2);
|
|
|
|
#pragma aux NW_CallAsm2b = \
|
|
"push ebp", \
|
|
"push ebx", \
|
|
"push esi", \
|
|
"call eax", \
|
|
"add esp, 8", \
|
|
"pop ebp", \
|
|
parm [EAX] [ESI] [EBX] \
|
|
modify exact [EAX EBX ECX EDX ESI EDI];
|
|
#endif
|
|
|
|
|
|
#if zNETWARE
|
|
LONG NW_CallAsm2d(void *RoutineAddress, void *parm1, void *parm2);
|
|
|
|
#pragma aux NW_CallAsm2d = \
|
|
"push ebp", \
|
|
"push edx", \
|
|
"push esi", \
|
|
"call eax", \
|
|
"add esp, 8", \
|
|
"pop ebp", \
|
|
parm [EAX] [ESI] [EDX] \
|
|
modify exact [EAX EBX ECX EDX ESI EDI];
|
|
#endif
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
*
|
|
*-------------------------------------------------------------------------*/
|
|
|
|
#if zNETWARE
|
|
LONG NW_CallAsm3(void *RoutineAddress, void *parm1, LONG parm2, LONG parm3);
|
|
|
|
#pragma aux NW_CallAsm3 = \
|
|
"push ebp", \
|
|
"push ebx", \
|
|
"push eax", \
|
|
"push esi", \
|
|
"call ecx", \
|
|
"add esp, 12", \
|
|
"pop ebp", \
|
|
parm [ECX] [ESI] [EAX] [EBX] \
|
|
modify exact [EAX EBX ECX EDX ESI EDI];
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|