[ the jinxbot project :: home | community forum | bn# | controls | mbncsutil | get the source ]

The MBNCSUtil namespace provides managed types for the implementation of Battle.net logon authorization as well as a number of other utilities to support Battle.net development.

This library should run on an x86- or x64-based Windows system. MBNCSUtil now includes Windows-specific API calls for the MPQ file handling (MBNCSUtil.Data) and Lockdown CheckRevision calls. Other code should function normally on systems with the Common Language Infrastructure.

This code was originally based upon Eric Naseth's (shadypalm88's) BNCSUtil 1.0.4, Ron Bowes' (iago's) various implementations in Java and C, and Robert ONeal's, from whose code most of the Lockdown implementation was based. However, most code is original C#, unless otherwise noted, by Robert Paveza (MyndFyre).

This library is licensed under a modified version of the BSD license as of version 1.2.0.4. This license supercedes previous licenses of this library for versions 1.2.0.4 and newer. Older libraries will continue to be licensed under their old license or, optionally, the new BSD license. For more information, consult the licensing terms or the License.txt file that should have accompanied this code.

This library includes binary code under license from Ladislave Zezula. Separation of this library from the binary code is not permitted, nor is distribution of the binary. Please obtain your own license for StormLib by downloading it from www.zezula.net.

Versioning Information

MBNCSUtil v2.0 is a relatively major departure from previous versions. COM support is no longer included, and the library is offered only for .NET 2.0. Furthermore, assemblies are versioned for a specific processor architecture. As of version 2.1, MBNCSUtil no longer has separate versions for x64- and x86-based processors. Also, MBNCSUtil has been moved into the JinxBot source code repository on the Google Code hosting project.

Changelog

VersionChanges
Planned (Future) Updates
  • Installation (.msi) utility and integration with Visual Studio's help system.
  • BNLS integration, due for version 2.3.
  • The ability to write to MPQ files as well as read from them, due for version 2.2.
  • There is a possibility that I may include support for Warden in future updates. I have not decided whether I will do so, or in what form.
2.1.7.22
Downloads
  • Support for BLP images - part of the Warcraft 3 and World of Warcraft interfaces - has been added. BLP1 and BLP2 parsing code is original. The ImageParser class can be found in the MBNCSUtil.Data namespace.
  • Support for .BNI image files such as icons_star.bni is also included as part of the BniFilerParser class. This class has different interface requirements than the ImageParser class and could not be related to it. This class is incompatible with BNI files included as part of Warcraft III; these files are actually MPQ files.
  • The DataBuffer class now implemented IDisposable. This is not a breaking change, but should be respected in future builds.
  • The CdKey.Value2 property has been marked as obsolete; FxCop design rules suggested a different strategy. It will not cause build errors but will in future versions. As an alternative, use the CdKey.GetValue2 method.
  • For the first time, I have begun auditing builds of MBNCSUtil with FxCop. FxCop is a free utility available from Microsoft that enables validation of .NET Framework Best Practices. You may see a new file called GlobalSuppressions that contains assembly-level attributes, and you may also see these attributes on class members. Usually I commented why these are problems where appropriate.
  • MBNCSUtil has been changed so that it no longer has separate x86- and x64 builds. Any problems related to loading MPQ files should be reported in the Google code issue tracker.
  • The MBNCSUtil codebase has been merged into the JinxBot repository at Google Code hosting. It can be obtained through instructions located at the JinxBot wiki. The MBNCSUtil codebase is located in /branches/mbncsutil/.
2.0.5.18 Final
[documentation] [code]
Binaries:
x86 Debug
x86 Release
x64 Debug
x64 Release
Current SVN
Revision: 21
2.0.4.17 BETA 2
[documentation] [code]
Binaries:
x86 Debug
x86 Release
x64 Debug
x64 Release
Current SVN
Revision: 15
  • Did you know that MBNCSUtil includes a number of additional tools used in the development and testing of MBNCSUtil? These tools and utilities are sample code that indicate how to use some of MBNCSUtil's features, including a command-line tool for downloading files from BnFTP, extracting a file from an MPQ, and even a rudimentary client used to ensure the Lockdown implementation works with class based on JinxBot's ConnectionBase class. These files are all available through the Subversion repository at https://svn2.hosted-projects.com/robpaveza/mbncsutil/. You should log in with the username mbncsutil_anonymous with no password. Need a Subversion client? I use TortoiseSVN.
  • Added event/status support to the Battle.net FTP downloading scheme. To obtain status updates, listen to the BnFtpRequestBase.FilePartDownloaded event.
  • Corrected an issue in which approximately 7.5% of lockdown calls would result in failure. The bulk test tool reports 100% success. If you encounter a revision check failure, please e-mail MyndFyre@valhallalegends.com with the value-string and lockdown MPQ file parameters (as well as the product).
  • Corrected documentation that provided a sample for extracting files from MPQ archives.
  • Corrected an issue reported by Homerlan and iNsaNe (at the vL forums) in which the NLS class was generating a NullReferenceException because the k field had not been initialized to a value.
  • Corrected an issue reported by Chriso.de (at the vL forums) in which the NLS class was generating an IOException because certain username values returned shorter names when using Encoding.ASCII.GetByteLength than the actual length of the username.
  • Explicitly added a NotSupportedException when CheckRevision.ExtractMPQNumber is called with a Lockdown MPQ filename.
  • Corrected an issue reported by Joe[x86] in which the MPQ loader would mistakenly load the 64-bit MPQ support DLL when operating within a 32-bit process on Win32 platforms not running 64-bit OSes.
2.0.3.16 BETA 1 Service Release
[documentation] [code]
Binaries:
x86 Debug
x86 Release
x64 Debug
x64 Release
Current SVN Revision: 9
  • A bug was identified in the way the LockdownHeap class (part of the MBNCSUtil.Util namespace, which is not a public namespace) was marshaling data to the unmanaged heap, which was cauing 100% failure rates on lockdown. This issue has been corrected. Please note that the downloadable documentation file has not been updated for this service release, as the API has not changed.
2.0.3.15 BETA 1 [documentation] [code]
Binaries:
x86 Debug
x86 Release
x64 Debug
x64 Release
  • Lockdown CheckRevision is now supported for Starcraft and Warcraft II: Battle.net Edition. This is a pre-release version of MBNCSUtil 2.0 that previews the MPQ, BnFTP, and Lockdown Checkrevision functionality of MBNCSUtil 2.0. Tests indicate that Lockdown currently incorrectly calculates the revision check 7.4% of its uses.
  • IMPORTANT - MBNCSUtil 2.0 does not support the .NET Framework 1.x; clients that wish to use MBNCSUtil 2.0 should target the .NET Framework 2.0.
  • MBNCSUtil is now hosted in a Subversion repository. Point your favorite SVN client at https://www2.hosted-projects.com/robpaveza/mbncsutil/trunk/ to download the latest bits. (Note that the SVN repository is updated much more frequently than the stable build list; for stable builds, be sure to download the software from the official site). Along with Subversion, there is now a Trac wiki and bug tracker. Visit it at https://www2.hosted-projects.com/trac/robpaveza/mbncsutil. Both Subversion and Trac require authentication; use the username mbncsutil_anonymous with no password.
  • MBNCSUtil 2.0 includes the ability to open MPQ archives! See the MBNCSUtil.Data namespace for implementation details. If you retrieve the solution from Subversion, you will find a project called mmpq in the trunk; this project demonstrates opening an MPQ and retrieving its listfile.
  • MBNCSUtil 2.0 includes an integrated ability to download files from Battle.net via the proprietary BnFTP protocol. See the MBNCSUtil.BnFtp namespace for implementation details. If you retrieve the solution from Subversion, you will find a project called mbnftp in the trunk; this project demonstrates downloading files from the BnFTP service.

Classes

  ClassDescription
BncsPacket
Completes a DataBuffer implementation with the additional data used by the BNCS protocol.
BncsReader
Completes a DataBuffer implementation with the additional data used by the BNCS protocol.
CdKey
Provides utilities for decoding and otherwise validating CD keys of Blizzard products. This class cannot be inherited.
CheckRevision
Encompasses any revision check functionality for all Battle.net games. This class cannot be inherited.
DataBuffer
Operates as a data buffer for network and file output.
DataFormatter
Provides functions for printing bytes to various output devices. This class cannot be inherited.
DataReader
Operates as a buffered data reader for network and file input.
NLS
Supports the New Logon System's SRP (Secure Remote Password) authentication system as well as Warcraft III server signature validation. This class cannot be inherited.
OldAuth
Calculates hash values for data using the old login-system checks.
XSha1
Provides an implementation of Battle.net's "broken" (nonstandard) SHA-1 implementation. This class cannot be inherited.