home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / ni_vb / nwdir.bas < prev    next >
BASIC Source File  |  1993-06-03  |  14KB  |  257 lines

  1. 'NWDIR.BAS  NetWare Directory Services Interface for Visual Basic For Windows
  2. 'Version 1.0
  3. 'Novell Systems Research Department, Novell, Inc.
  4. 'Copyright (c) 1993, Novell, Inc.
  5. 'This interface is not supported through Novell's regular
  6. 'support channels.  See README.TXT for more information.
  7.  
  8. 'Modify flags for SetEntry
  9. Global Const M_MODIFY_NAME = 1
  10. Global Const M_FILE_ATTRIBUTES = 2
  11. Global Const M_CREATE_DATE = 4
  12. Global Const M_CREATE_TIME = 8
  13. Global Const M_OWNER_ID = 16
  14. Global Const M_LAST_ARCHIVED_DATE = 32
  15. Global Const M_LAST_ARCHIVED_TIME = 64
  16. Global Const M_LAST_ARCHIVED_ID = 128
  17. Global Const M_LAST_UPDATED_DATE = 256
  18. Global Const M_LAST_UPDATED_TIME = 512
  19. Global Const M_LAST_UPDATED_ID = 1024
  20. Global Const M_LAST_ACCESSED_DATE = 2048
  21. Global Const M_INHERITED_RIGHTS_MASK = 4096
  22. Global Const M_MAXIMUM_SPACE = 8192
  23. Global Const M_MAC_MODIFY_NAME = 1
  24. Global Const M_MAC_FINDER_INFO = 2
  25. Global Const M_MAC_PRODOS_INFO = 4
  26.  
  27. Global Const NWMAX_VOL_NAME = 48
  28. Global Const NCP_MAX_BUFFER = 512
  29.  
  30. 'Drive constants
  31. Global Const NO_BASE_DRIVE = &HFF
  32. Global Const TEMPORARY_DRIVE = 0
  33. Global Const PERMANENT_DRIVE = 1
  34. Global Const TEMP_DRIVE = 26
  35. Global Const TEMP_DRIVE1 = 27
  36. Global Const TEMP_DRIVE2 = 28
  37. Global Const TEMP_DRIVE3 = 29
  38.  
  39. 'Search drive flags
  40. Global Const DRIVE_ADD = 1
  41. Global Const DRIVE_INSERT = 2
  42. Global Const DRIVE_DELETE = 3
  43. Global Const MAX_NETWARE_SEARCH_DRIVES = 16
  44.  
  45. 'Drive flags
  46. Global Const DRIVE_LOCAL = &H80
  47. Global Const DRIVE_PERMANENT = 1
  48. Global Const DRIVE_TEMPORARY = 2
  49. Global Const DRIVE_NETWORK = 3
  50.  
  51. 'Trustee rights for v2.x
  52. Global Const TA_NONE = &H0
  53. Global Const TA_READ = &H1
  54. Global Const TA_WRITE = &H2
  55. Global Const TA_OPEN = &H4
  56. Global Const TA_CREATE = &H8
  57. Global Const TA_DELETE = &H10
  58. Global Const TA_OWNERSHIP = &H20
  59. Global Const TA_SEARCH = &H40
  60. Global Const TA_MODIFY = &H80
  61. Global Const TA_ALL = &HFF
  62.  
  63. 'Trustee rights for v3.x/4.x
  64. Global Const TR_NONE = &H0
  65. Global Const TR_READ = &H1
  66. Global Const TR_WRITE = &H2
  67. Global Const TR_CREATE = &H8
  68. Global Const TR_ERASE = &H10
  69. Global Const TR_ACCESS = &H20
  70. Global Const TR_FILE = &H40
  71. Global Const TR_MODIFY = &H80
  72. Global Const TR_SUPERVISOR = &H100
  73. Global Const TR_NORMAL = &HFF
  74. Global Const TR_ALL = &H1FF
  75.  
  76. 'Set numTrusteeEntries to the number of trustees that the
  77. '  ScanEntryForTrustees function is to return data for.
  78. '  Used in the TRUSTEE_BUFFER_3X type below
  79. Global Const numTrusteeEntries = 4
  80.  
  81. Type NWDIR_ENTRY
  82.      sequence As Long
  83.      reserved1 As Long
  84.      attributes As Long
  85.      reserved2 As Integer
  86.      NSType As String * 1
  87.      nameLength As String * 1
  88.      name As String * 12
  89.      creationDate As Integer
  90.      creationTime As Integer
  91.      ownerID As Long
  92.      lastArchivedDate As Integer
  93.      lastArchivedTime As Integer
  94.      lastArchiverID As Long
  95.      modifyDate As Integer
  96.      modifyTime As Integer
  97.      reserved3 As String * 56
  98.      inheritedRightsMask As Integer
  99.      reserved4 As String * 26
  100. End Type
  101.  
  102. Type NWFILE_ENTRY
  103.      sequence As Long
  104.      reserved1 As Long
  105.      attributes As Long
  106.      reserved2 As Integer
  107.      NSType As String * 1
  108.      nameLength As String * 1
  109.      name As String * 12
  110.      creationDate As Integer
  111.      creationTime As Integer
  112.      ownerID As Long
  113.      lastArchivedDate As Integer
  114.      lastArchivedTime As Integer
  115.      lastArchiverID As Long
  116.      modifyDate As Integer
  117.      modifyTime As Integer
  118.      lastModifierID As Long
  119.      dataForkSize As Long
  120.      reserved3 As String * 44
  121.      inheritedRightsMask As Integer
  122.      lastAccessDate As Integer
  123.      reserved4 As String * 28
  124. End Type
  125.  
  126. Type NWDIR_INFO
  127.      totalBlocks As Long
  128.      freeBlocks As Long
  129.      totalDirEntries As Long
  130.      availDirEntries As Long
  131.      flags As Long              'currently unused
  132.      sectorsPerBlock As String * 1
  133.      volumeName As String * NWMAX_VOL_NAME
  134. End Type
  135.  
  136. Type DRIVE_VECTOR
  137.      vector As String * 17
  138. End Type
  139.  
  140. Type VOLUME_STATS
  141.      systemElapsedTime As Long
  142.      volumeNumber As String * 1
  143.      logicalDriveNumber As String * 1
  144.      sectorsPerBlock As Integer
  145.      startingBlock As Integer
  146.      totalBlocks As Integer
  147.      availableBlocks As Integer
  148.      totalDirectorySlots As Integer
  149.      availableDirectorySlots As Integer
  150.      maxDirectorySlotsUsed As Integer
  151.      isHashing As String * 1
  152.      isCaching As String * 1
  153.      isRemovable As String * 1
  154.      isMounted As String * 1
  155.      volumeName As String * 16
  156. End Type
  157.  
  158. Type NWVOL_USAGE
  159.      totalBlocks As Long
  160.      freeBlocks As Long
  161.      purgableBlocks As Long
  162.      notYetPurgableBlocks As Long
  163.      totalDirEntries As Long
  164.      availDirEntries As Long
  165.      maxDirEntriesUsed As Long
  166.      unused As String * 4
  167.      blockSize As Integer
  168.      isHashing As String * 1
  169.      isRemovable As String * 1
  170.      volName As String * NWMAX_VOL_NAME
  171. End Type
  172.  
  173. Type NWBUFFER
  174.     buffer As String * NCP_MAX_BUFFER
  175. End Type
  176.  
  177. Type TRUSTEE_BUFFER_2X
  178.     dirName As String * 16
  179.     created As String * 4
  180.     ownerID As Long
  181.     oID(5) As Long
  182.     rights(5) As String * 1
  183. End Type
  184.  
  185. Type TRUSTEE_BUFFER_3X
  186.     numEntriesReturned As String * 1
  187.     oID(numTrusteeEntries) As Long
  188.     rights(numTrusteeEntries) As Integer
  189. End Type
  190.  
  191. Declare Function AddTrusteeToDirectory Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, ByVal trusteeObjectID&, ByVal trusteeRightsMask%) As Integer
  192. Declare Function AllocPermanentDirectoryHandle Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, ByVal driveLetter%, newDirHandle%, effectiveRightsMask%) As Integer
  193. Declare Function AllocTemporaryDirectoryHandle Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, ByVal driveLetter%, newDirHandle%, effectiveRightsMask%) As Integer
  194. Declare Function ClearVolRestrictions Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal volNumber%, ByVal objectID&) As Integer
  195. Declare Function CreateDirectory Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, ByVal maximumRightsMask%) As Integer
  196. Declare Function DeallocateDirectoryHandle Lib "NWNETAPI.DLL" (ByVal dirHandle%) As Integer
  197. Declare Function DeleteDirectory Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$) As Integer
  198. Declare Function DeleteTrustee Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal path$, ByVal objectID&) As Integer      '3.x/4.x only
  199. Declare Function DeleteTrusteeFromDirectory Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, ByVal trusteeObjectID&) As Integer
  200. Declare Function GetCurrentDirectory Lib "NWNETAPI.DLL" (ByVal driveNumber%, ByVal directory$) As Integer
  201. Declare Function GetDirectoryHandle Lib "NWNETAPI.DLL" (ByVal driveNumber%) As Integer
  202. 'dirPath$ must be initialized to 255 bytes
  203. Declare Function GetDirectoryPath Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$) As Integer
  204. Declare Function GetDirEntry Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, dirEntry As NWDIR_ENTRY) As Integer     '3.x/4.x only
  205. Declare Function GetDirInfo Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, dirInfo As NWDIR_INFO) As Integer        '3.x/4.x only
  206. Declare Function GetDriveInformation Lib "NWNETAPI.DLL" (ByVal driveNumber%, connectionID%, dirHandle%) As Integer
  207. Declare Function GetEffectiveDirectoryRights Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal dirPath$, effectiveRightsMask%) As Integer
  208. Declare Function GetEffectiveRights Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal path$, rights%) As Integer '3.x/4.x only
  209. Declare Function GetObjectDiskRestrictions Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal volNumber%, ByVal objectID&, volRestrictions&, blocksInUse&) As Integer   '3.x/4.x only
  210. 'vectorBuffer must be initialized to 17 bytes
  211. Declare Function GetSearchDriveVector Lib "NWNETAPI.DLL" (vectorBuffer As DRIVE_VECTOR) As Integer
  212. Declare Function GetVolumeInformation Lib "NWNETAPI.DLL" (ByVal connectionID%, ByVal volumeNumber%, ByVal structSize%, volStats As VOLUME_STATS) As Integer
  213. 'volumeName must be initialized to 16 bytes
  214. Declare Function GetVolumeInfoWithHandle Lib "NWNETAPI.DLL" (ByVal dirHandle%, ByVal volumeName$, totalBlocks%, sectorsPerBlock%, availableBlocks%, totalDirectorySlots%, availableDirectorySlots%, volumeIsRemovable%) As Integer
  215. 'volumeName must be initialized to 16 bytes
  216. Declare Function GetVolumeInfoWithNumber Lib "NWNETAPI.DLL" (ByVal volNumber%, ByVal volumeName$, totalBlocks%, sectorsPerBlock%, availableBlocks%, totalDirectorySlots%, availableDirectorySlots%, volumeIsRemovable%) As Integer
  217. 'volumeName must be initialized to 16 bytes
  218. Declare Function GetVolumeName Lib "NWNETAPI.DLL" (ByVal volumeNumber%, ByVal volumeName$) As Integer
  219. Declare Function GetVolumeNumber Lib "NWNETAPI.DLL" (ByVal volumeName$, volumeNumber%) As Integer
  220. Declare Function GetVolUsage Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal volNumber%, volUsage As NWVOL_USAGE) As Integer     '3.x/4.x only
  221. Declare Function IsSearchDrive Lib "NWNETAPI.DLL" (ByVal driveLetter%) As Integer
  222. Declare Function MapDrive Lib "NWNETAPI.DLL" (ByVal connectionID%, ByVal baseDriveNumber%, ByVal directoryPath$, ByVal searchFlag%, ByVal searchOrder%, ByVal driveLetter$) As Integer
  223. Declare Function MapDriveUsingString Lib "NWNETAPI.DLL" (ByVal mapType$, ByVal drive$, ByVal mapString$) As Integer
  224. Declare Function MapV2TrusteeRightsToV3 Lib "NWNETAPI.DLL" (ByVal trusteeRightsV2%) As Long     '3.x/4.x only
  225. Declare Function MapV3TrusteeRightsToV2 Lib "NWNETAPI.DLL" (ByVal trusteeRightsV3&) As Integer  '3.x/4.x only
  226. Declare Function ModifyMaximumRightsMask Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal directoryPath$, ByVal revokeRightsMask%, ByVal grantRightsMask%) As Integer
  227. Declare Function MoveEntry Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal sourceAttributes%, ByVal sourceDirHandle%, ByVal sourcePath$, ByVal destDirHandle%, ByVal destPath$) As Integer   '3.x/4.x only
  228. Declare Function RenameDirectory Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal directoryPath$, ByVal newDirectoryName$) As Integer
  229. Declare Function RestoreDirectoryHandle Lib "NWNETAPI.DLL" (ByVal saveBuffer$, newDirectoryHandle%, effectiveRightsMask%) As Integer    '2.x only
  230. 'saveBuffer must be initialized to 14 characters
  231. Declare Function SaveDirectoryHandle Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal saveBuffer$) As Integer      '2.x only
  232. 'trusteePathName must be initialized to 255 characters
  233. Declare Function ScanBinderyObjectTrusteePaths Lib "NWNETAPI.DLL" (ByVal objectID&, ByVal volumeNumber%, sequenceNumber%, trusteeAccessMask%, ByVal trusteePathName$) As Integer
  234. 'directoryName must be initialized to 16 bytes
  235. 'trusteeIDs is an array of 5 Longs
  236. 'trusteeRights must be initialized to 5 bytes
  237. Declare Function ScanDirectoryForTrustees Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal directoryPath$, sequenceNumber%, ByVal directoryName$, creationDateAndTime&, ownerID&, trusteeIDs&, trusteeRights$) As Integer  '2.x only
  238. 'directoryName must be initialized to 16 bytes
  239. Declare Function ScanDirectoryInformation Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal searchDirectoryPath$, sequenceNumber%, ByVal directoryName$, creationDateAndTime&, ownerObjectID&, maximumRightsMask%) As Integer
  240. Declare Function ScanDirEntry Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal searchPath$, ByVal searchAttributes%, sequence%, dirEntry As NWDIR_ENTRY) As Integer
  241. 'buffer must be initialized to ((numberOfStructures * 9) + 1) bytes
  242. Declare Function ScanDirRestrictions Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal buffer$, ByVal numberOfStructures%) As Integer    '3.x/4.x only
  243. 'pass a structure of type TRUSTEE_BUFFER_2X in trusteeBuffer parameter for NetWare 2.x,
  244. 'TRUSTEE_BUFFER_3X for NetWare 3.x/4.x
  245. Declare Function ScanEntryForTrustees Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal directoryHandle%, ByVal directoryPath$, trusteeBuffer As Any, ByVal trusteeSetNumber%, ByVal trusteeGroupsToReturn%) As Integer
  246. Declare Function ScanVolForRestrictions Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal volumeNumber%, sequence%, buffer As NWBUFFER) As Integer     '3.x/4.x only
  247. Declare Function SetDirectoryHandle Lib "NWNETAPI.DLL" (ByVal sourceDirectoryHandle%, ByVal sourceDirectoryPath$, ByVal targetDirectoryHandle%) As Integer
  248. Declare Function SetDirectoryInformation Lib "NWNETAPI.DLL" (ByVal directoryHandle%, ByVal directoryPath$, ByVal newCreationDateAndTime&, ByVal newOwnerObjectID&, ByVal newRightsMask%) As Integer
  249. Declare Function SetDirRestriction Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal restriction&) As Integer    '3.x/4.x only
  250. Declare Function SetDrivePath Lib "NWNETAPI.DLL" (ByVal driveNumber%, ByVal baseDriveNumber%, ByVal path$, ByVal permanentFlag%) As Integer
  251. 'entry can be a pointer to a NWDIR_ENTRY or NWFILE_ENTRY structure
  252. Declare Function SetEntry Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal searchAttributes%, ByVal entryID&, ByVal changeBits&, entry As Any) As Integer   '3.x/4.x only
  253. Declare Function SetSearchDriveVector Lib "NWNETAPI.DLL" (ByVal vectorBuffer$) As Integer
  254. Declare Function SetTrustee Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal dirHandle%, ByVal dirPath$, ByVal trusteeObjectID&, ByVal trusteeRightsMask&) As Integer     '3.x/4.x only
  255. Declare Function SetVolRestriction Lib "NWNETAPI.DLL" (ByVal serverConnID%, ByVal volNumber%, ByVal objectID&, ByVal restriction&) As Integer       '3.x/4.x only
  256.  
  257.