home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / sysmgmt / sms / vbsmsapi / common / objectty.bas next >
Encoding:
BASIC Source File  |  1996-10-15  |  13.2 KB  |  404 lines

  1. Attribute VB_Name = "OBJECTTY"
  2. Option Explicit
  3. '// *************************************************************************
  4. '//
  5. '//  File: OBJECTTY.H
  6. '//
  7. '//  Copyright (c) 1994, 1995 Microsoft Corp.
  8. '//
  9. '//  This is the header file for the obejctity engine. The objectity
  10. '//  engine is the core of the SMS API set.
  11. '//
  12. '//  This file contains externally visible structures, and certain manifests
  13. '//  needed by them.
  14. '//
  15. '//
  16. '// *************************************************************************
  17. '//
  18. '
  19. '// ====================================================================
  20. '//
  21. '//      Manifests.
  22. '//
  23. '// ====================================================================
  24. '
  25. 'typedef DWORD   SMS_STATUS;         // API return codes are all of this type.
  26. '/* VB: All API's return Long  */
  27. '
  28.  Global Const F_ANY = 0              'Indicates any folder type
  29. '
  30. '
  31. '// ====================================================================
  32. '//  Scalar values can be strings, integers (DWORDs), time, or binary.
  33. '//NOTE: binary not yet implemented.
  34. '// ====================================================================
  35.  Type SCALARTYPE
  36.      enum As Long
  37.  End Type
  38.  
  39.  ' These are initialized in Init_SCALARTYPE_enums()
  40.  Global SCALAR_STRING As SCALARTYPE
  41.  Global SCALAR_INT As SCALARTYPE
  42.  Global SCALAR_TIME As SCALARTYPE
  43.  Global SCALAR_BINARY As SCALARTYPE
  44. '
  45. '
  46. '// ====================================================================
  47. '//      SCALAR
  48. '//  This structure is used by the application and the engine to
  49. '//  communicate a scalar's details.
  50. '//
  51. '//  All scalars have a type (SCALARTYPE), a name (a character string),
  52. '//  and a value, which is determined by the scalar's type.
  53. '//  There are separate fields here for the value in all its guises.
  54. '//  Additionally, if the scalar is a string or a binary, a length
  55. '//  field indicates the datum's size.
  56. '//
  57. '//  This length field can also be set by the application when
  58. '//  retrieving a scalar. In this case it indicates the size of the
  59. '//  receiving buffer (string and binary).
  60. '//
  61. '// ====================================================================
  62.  Type SCALAR
  63.      scType As SCALARTYPE       '// string, int, time etc
  64.      pszName As String          '// Scalar name.
  65.      pszValue As String         '// Scalar value as a string.
  66.      dwValue As Long            '// Scalar value as a DWORD.
  67.      tValue As Long             '// Scalar value as a time.
  68.      pValue() As Byte           '// Scalar as a binary.
  69.      dwLen As Long              '// Size of the scalar value either as a string
  70.                                 '// or as a binary.
  71.                                 '// If a get scalar API is called with NULL
  72.                                 '// for the appropriate value, then the
  73.                                 '// length of that value is returned here.
  74.      bStringEquivalence As Long
  75.                                 '// True if a string exists for an INT or
  76.                                 '// TIME scalar. String will be in pszValue.
  77.      fAccess As Long            '// Access mode.
  78.  End Type
  79. '
  80. '
  81. '
  82. '
  83. '// --------------------------------------------------------------------
  84. '// Manifests used in filter token APIs.
  85. '// --------------------------------------------------------------------
  86.  Global Const OTT_AT_START = -1 '// Token will be inserted at start of
  87.                                 '// expression.
  88.  Global Const OTT_AT_END = -2   '// Token will be appended to end of
  89.                                 '// expression.
  90. '
  91. '
  92. '
  93. '
  94. '// ====================================================================
  95. '//
  96. '//  Return codes from the objectity engine.
  97. '//
  98. '// ====================================================================
  99.  Global Const OTT_OK = 0
  100.  Global Const OTT_MORE_DATA = 1
  101.  Global Const OTT_NO_MORE_DATA = 2
  102.  Global Const OTT_FOLDER_NO_UPDATE = 3
  103.  Global Const OTT_DUPLICATE_CONTAINER_ID = 4
  104.  Global Const OTT_DUPLICATE_FOLDER_ID = 5
  105.  Global Const OTT_DUPLICATE_FILTER_ID = 6
  106.  Global Const OTT_SCALAR_NO_UPDATE = 7
  107.  Global Const OTT_SCALAR_WRONG_TYPE = 8
  108.  Global Const OTT_INVALID_CONTAINER_ID = 9
  109.  Global Const OTT_INVALID_FOLDER_ID = 10
  110.  Global Const OTT_INVALID_FILTER_ID = 11
  111. '
  112.  Global Const OTT_CONTAINER_NO_UPDATE = 12
  113. '
  114.  Global Const OTT_PARAMETER_ERROR = 13
  115.  Global Const OTT_UNSUPPORTED = 14
  116.  Global Const OTT_NOT_FOUND = 15
  117.  Global Const OTT_PARENT_NOT_FOUND = 16
  118.  Global Const OTT_CANT_DELETE = 17
  119.  Global Const OTT_NEW_FOLDER = 18
  120. '
  121. '// Error when attempting to multiply link a folder.
  122.  Global Const OTT_FOLDER_LINKED = 19
  123. '
  124. '//
  125. '// Filter operations.
  126.  Global Const OTT_RANGE_ERROR = 20
  127. '
  128.  Global Const OTT_DUPLICATE_FILTER = 21
  129. '
  130. '// Container operations that are out of sequence.
  131.  Global Const OTT_CONTAINER_NOT_POPULATED = 22
  132.  Global Const OTT_CONTAINER_POPULATED = 23
  133. '
  134. '// Only persistent filters have scalars.
  135.  Global Const OTT_FILTER_NOT_PERSISTENT = 24
  136. '
  137. '// Error return if the connection handle of a filter doesn't match
  138. '// that of a container to which the filter is being applied.
  139.  Global Const OTT_INVALID_CONNECTION_HANDLE = 25
  140.  
  141.  Global Const OTT_INVALID_FILTER_TYPE = 26
  142. '
  143. '// Folder's can't be unlinked if there are multiple handles
  144. '// to the same object.
  145.  Global Const OTT_IN_USE_BY_OTHER = 27
  146. '
  147. '
  148. '// The last one, user codes start from here to give
  149. '// leaway for future expansion.
  150. '//
  151.  Global Const OTT_END = 50
  152. '
  153. '
  154. '// ====================================================================
  155. '//
  156. '//  Other manifests.
  157. '//
  158. '// ====================================================================
  159. '
  160. '// Access rights to containers/folders/scalars.
  161. '// -------------------------------------------------------------
  162.  Global Const ACCESS_READ = &H1
  163.  Global Const ACCESS_CREATE = &H2
  164.  Global Const ACCESS_MODIFY = &H4
  165.  Global Const ACCESS_DELETE = &H8
  166. '
  167. '// Modification flags
  168. '// ------------------
  169.  Global Const MOD_UNMODIFIED = &H0
  170.  Global Const MOD_CREATED = &H1
  171.  Global Const MOD_DELETED = &H2
  172.  Global Const MOD_DENY_ACCESS = &H4
  173. '
  174. '// Tokens are ANDed or ORed into filters.
  175. '// -------------------------------------------------------------
  176.  Type ANDOR
  177.      enum As Long
  178.  End Type
  179.  
  180.  ' These are initialized in Init_ANDOR_enums()
  181.  Global OP_AND As ANDOR
  182.  Global OP_OR As ANDOR
  183. '
  184. '// Options for Rewind on a folder.
  185. '// -------------------------------------------------------------
  186.  Global Const RW_FOLDER = &H80000000      '// Rewind folder lists.
  187.  Global Const RW_SCALAR = &H40000000      '// Rewind scalar list only.
  188.  Global Const RW_ALL = RW_FOLDER + RW_SCALAR ' // Rewind both.
  189. '
  190. '
  191. '
  192. '
  193. '
  194. '
  195. '
  196. '// These structures are used to retrieve container and filter
  197. '// information from the engine.
  198. '// These are used in enumertaing containers and filters.
  199. '// -------------------------------------------------------------
  200.  Global Const BUFF_SIZE = 256
  201. '
  202. '
  203. '// An objectity is either a container or a folder.
  204. '// -------------------------------------------------------------
  205.  Type BASETYPE
  206.      enum As Long
  207.  End Type
  208.  
  209.  ' These are initialized in Init_BASETYPE_enums()
  210.  Global T_CONTAINER As BASETYPE
  211.  Global T_FOLDER As BASETYPE
  212. '
  213. '
  214. '// ====================================================================
  215. '//
  216. '//  The structures.
  217. '//
  218. '// ====================================================================
  219. '
  220. '//
  221. '// NOTIFY structure.
  222. '//
  223. '// This struct used for async population. Enables async operation to
  224. '// use either event handle or window handle/message.
  225. '
  226.  Type NOTIFY
  227.     dwFreq As Long     '// Notify after this number of rows retrieved.
  228.     hEvent As Long     '// Event handle if type=POP_EVENT
  229.     hwnd As Long       '// hwnd if type=POP_WINDOW
  230.     uiMsg As Long      '// Message if type=POP_WINDOW
  231.  End Type
  232. '
  233. '
  234. '//
  235. '// TOKEN structure.
  236. '//
  237.  Global Const TOKEN_STRING_SIZE = 4608 '// 4.5k
  238. '// The manifest is this large because it can used in the package inventory
  239. '// rules. In these rules we are allowed to define upto four string fields,
  240. '// each of which can be 1k long. This size allows us to accommodate it all.
  241. '
  242.  Type TOKEN
  243.      tokenType As Long            '// Returns: type of token (ie USER, AND,
  244.                                          '// OR, LEFT_PAREN, RIGHT_PAREN).
  245.      szName As String
  246.      szValue As String
  247.      dwOp As Long
  248.  
  249.      szArchitecture As String
  250.      szGroupClass As String
  251.      szAttributeName As String
  252.      szTokenString As String           '// Display form of the token.
  253.      bIndent As Long                   '// Request display indentation.
  254.  End Type
  255. '
  256. '
  257. '
  258. '//
  259. '// FILTER_INFO
  260. '//
  261. '//  This structure is used to provide the user a filter template.
  262. '//  An array of these structures is returned via the SmsEnumFilters API.
  263. '//  This returns information about all filters registered with the engine.
  264. '//
  265. '//  It is considered that the user will use this information in order to
  266. '//  display information. The information that is provided here is:
  267. '//  a) the type and tag of the filter, b) the fields that comprise a
  268. '//  particular filter's tokens, and c) the names that should be used
  269. '//  for these fields for display purposes. That is, for a GUI application,
  270. '//  they provide the labels for edit controls. If a field in the structure
  271. '//  is empty (ie NULL) then that field is not used for that particular
  272. '//  filter.
  273. '//
  274. '//  As an example consider a group filter. If the developer wants to
  275. '//  present, say, a dialogue box to the end user, they would use the
  276. '//  following fields: szName, szValue. Looking at the template they
  277. '//  will see that the strings associated with these fields are 'Name'
  278. '//  and 'GroupClass'. They would thus display a dialogue box with
  279. '//  two edit controls, the first labelled 'Name', the second labelled
  280. '//  'GroupClass. Since these are the only two fields that are filled in
  281. '//  no other fields should be presented to the user.
  282. '//
  283. '//NOTE: what about default values?
  284. '//
  285. '//  Job filter:
  286. '//      szName          = 'Type'
  287. '//      szValue         = 'Value'
  288. '//      szOperator      = 'Operator'
  289. '//
  290. '//  Machine filter:
  291. '//      szArchitecture  = 'Architecture'
  292. '//      szGroupClass    = 'GroupClass'
  293. '//      szAttributeName = 'Attribute name'
  294. '//      szValue         = 'Value'
  295. '//      szOperator      = 'Operator'
  296. '//
  297. '//  Site filter:
  298. '//      szName          = 'Type'
  299. '//      szValue         = 'Site code'
  300. '//      szOperator      = 'Operator'
  301. '//
  302. '//  Group filter:
  303. '//      szName          = 'Name'
  304. '//      szValue         = 'GroupClass'
  305. '//      szOperator      = 'Operator'
  306. '//
  307. '//  Architecture filter:
  308. '//      szName          = 'Name'
  309. '//      szValue         = 'Architecture'
  310. '//      szOperator      = 'Operator'
  311. '//
  312. '//  Package filter:
  313. '//      szName          = 'Type'
  314. '//      szValue         = 'Value'
  315. '//      szOperator      = 'Operator'
  316. '//
  317. '//  Attribute filter:
  318. '//      szArchitecture  = 'Architecture'
  319. '//      szGroupClass    = 'GroupClass'
  320. '//      szAttributeName = 'Attribute name'
  321. '//
  322. '//  SiteLimit filter:
  323. '//      szName          = 'Site'
  324. '//      szValue         = 'Domain'
  325. '//
  326. '//
  327.  Global Const NAME_SIZE = 52
  328. '
  329.  Type FILTER_INFO
  330.      szTag As String                 '// Filter tag (eg "Architecture filter").
  331. '     tokenType As Integer
  332.      filterType As Long              '// Type number (eg ARCHITECTURE_FILTER).
  333.  
  334.      szName As String
  335.      szValue As String
  336.      szOperator As String
  337.  
  338.      szArchitecture As String
  339.      szGroupClass As String
  340.      szAttributeName As String
  341.  End Type
  342. '
  343. '
  344. '
  345. '// This is what the user gets as a description of a scalar.
  346. '// Currently this is only used internally in objectty.cpp (RegisterObjectity).
  347. '// I'll proably make this externally visible though very soon now.
  348.  Type SCALAR_INFO
  349.      szName As String                '// Scalar's name.
  350.      scType As SCALARTYPE            '// Type: SCALAR_STRING, INT, TIME etc
  351.      fAccess As Long                 '// Access mode: ACCESS_READ, MODIFY etc
  352.  End Type
  353. '
  354. '
  355. '// Now the C struct form of CFolderInfo. This is what we'll
  356. '// return in a call to DescribeFolder().
  357. '// This is created during a call to RegisterObjectity. It is stored
  358. '// in the CFolderInfo object, itself held in the Folder registry.
  359. '// 29-Sep-94. Expanded to deal with Containers as well as folders.
  360. '
  361. '
  362.  Type FOLDER_INFO
  363.      tObjectity As BASETYPE          '// T_CONTAINER or T_FOLDER.
  364.      pszTag As String
  365.      dwTag As Long
  366.  
  367.      ctFolders As Long
  368.      FolderTags() As Long
  369.  
  370.      ctFilters As Long
  371.      FilterTags() As Long
  372.  
  373.      ctScalars As Long               '// Not used by for containers.
  374.      Scalars() As SCALAR_INFO        '// ditto.
  375.  
  376.      NewFunc As Long                 '// needs cast!! Used when registering
  377.                                      '// a container. This is a pointer to
  378.                                      '// the container's 'new' function.
  379.  End Type
  380.  
  381.  Sub Init_ANDOR_enums()
  382.      OP_AND.enum = 3
  383.      OP_OR.enum = 2
  384.  End Sub
  385.  
  386.  Sub Init_BASETYPE_enums()
  387.      T_CONTAINER.enum = 0
  388.      T_FOLDER.enum = 1
  389.  End Sub
  390.  
  391.  Sub Init_OBJECTTY()
  392.      Init_SCALARTYPE_enums
  393.      Init_ANDOR_enums
  394.      Init_BASETYPE_enums
  395.  End Sub
  396.  
  397.  Sub Init_SCALARTYPE_enums()
  398.      SCALAR_STRING.enum = 0
  399.      SCALAR_INT.enum = 1
  400.      SCALAR_TIME.enum = 2
  401.      SCALAR_BINARY.enum = 3
  402.  End Sub
  403.  
  404.