Additional BUC Components

BUC uses several constant values and supporting functions. A discussion of some of these peripheral tools follows.

Constant Values
The first group of BUC constant values is simply a list of array index values that I included to keep track of which value relates to which data-structure element. The remaining values are declarations for the bit mask values that the API functions use. These bit masks let each data structure element contain a range of information.

Supporting Functions
Two BUC functions deserve special mention: NetAPIBufferAllocate and NetAPIBufferFree. These functions allocate and free buffer space in the system's memory. If you don't use these functions properly, they can cause problems. You must free any buffer that you allocate using the API functions. Otherwise, you might experience memory leaks and unusual system behavior. In addition, you must allocate a buffer right before you use it and free it right after you use it. These actions improve applications' performance and prevent the system from moving your allocated buffer before you use it.

BUC uses the GetRegValue, SetRegValue, CreateRegKey, and GetRegErrorText Registry functions to save advanced user values to the Registry. These functions let BUC operate in the Registry without restricting the utility to the key that Visual Basic (VB) built-in functions must use. BUC also includes data-manipulation functions—such as TrimUniStr, which deletes trailing null characters from the strings that API calls return, and SecsToYears, which converts a long integer value representing seconds into a combination of years, weeks, days, hours, minutes, or seconds. SecsToYears is prone to large rounding errors, so I recommend using it for displaying data to users rather than for calculation purposes. The ByteToMask and MaskToByte functions convert byte values to bit masks.

For additional information about the VB functions, constant values, data structures, and error codes that BUC uses, see the Microsoft Platform Software Development Kit (SDK) in the Microsoft Developer Network (MSDN). You can find detailed information about supporting functions, constant values, and data structures under Networking and Distributed Services. Then, continue through the Networking (Net) subtopic to find Net Functions Reference. You can find information about potential BUC error codes under Windows Base Services, then drill down through Debugging and Error Handling to find Error Codes. Finally, you can find information about NetAPI functions, their uses, and historical information about their LAN Manager origins under Networking and Distributed Services. Continue to the About Net Functions area located under the Networking (Net) subtopic.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.