stormlib 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (624) hide show
  1. checksums.yaml +4 -4
  2. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CMakeCCompiler.cmake +72 -0
  3. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake +83 -0
  4. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin +0 -0
  5. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin +0 -0
  6. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CMakeSystem.cmake +15 -0
  7. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c +803 -0
  8. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CompilerIdC/a.out +0 -0
  9. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp +791 -0
  10. data/ext/stormlib/StormLib/CMakeFiles/3.22.1/CompilerIdCXX/a.out +0 -0
  11. data/ext/stormlib/StormLib/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  12. data/ext/stormlib/StormLib/CMakeFiles/CMakeOutput.log +478 -0
  13. data/ext/stormlib/StormLib/CMakeFiles/Export/share/StormLib/StormLibConfig-noconfig.cmake +19 -0
  14. data/ext/stormlib/StormLib/CMakeFiles/Export/share/StormLib/StormLibConfig.cmake +99 -0
  15. data/ext/stormlib/StormLib/CMakeFiles/Makefile.cmake +61 -0
  16. data/ext/stormlib/StormLib/CMakeFiles/Makefile2 +112 -0
  17. data/ext/stormlib/StormLib/CMakeFiles/TargetDirectories.txt +9 -0
  18. data/ext/stormlib/StormLib/CMakeFiles/cmake.check_cache +1 -0
  19. data/ext/stormlib/StormLib/CMakeFiles/progress.marks +1 -0
  20. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/DependInfo.cmake +243 -0
  21. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/build.make +3695 -0
  22. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/cmake_clean.cmake +459 -0
  23. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/cmake_clean_target.cmake +3 -0
  24. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/compiler_depend.make +2 -0
  25. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/compiler_depend.ts +2 -0
  26. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/depend.make +2 -0
  27. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/flags.make +17 -0
  28. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/link.txt +2 -0
  29. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/progress.make +227 -0
  30. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/FileStream.cpp.o.d +160 -0
  31. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SBaseCommon.cpp.o.d +159 -0
  32. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SBaseDumpData.cpp.o.d +159 -0
  33. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SBaseFileTable.cpp.o.d +159 -0
  34. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SBaseSubTypes.cpp.o.d +159 -0
  35. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SCompression.cpp.o.d +159 -0
  36. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileAddFile.cpp.o.d +159 -0
  37. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileAttributes.cpp.o.d +159 -0
  38. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileCompactArchive.cpp.o.d +159 -0
  39. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileCreateArchive.cpp.o.d +159 -0
  40. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileExtractFile.cpp.o.d +159 -0
  41. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileFindFile.cpp.o.d +159 -0
  42. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileGetFileInfo.cpp.o.d +159 -0
  43. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileListFile.cpp.o.d +159 -0
  44. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileOpenArchive.cpp.o.d +159 -0
  45. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileOpenFileEx.cpp.o.d +159 -0
  46. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFilePatchArchives.cpp.o.d +159 -0
  47. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileReadFile.cpp.o.d +159 -0
  48. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/SFileVerify.cpp.o.d +159 -0
  49. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/adpcm/adpcm.cpp.o.d +12 -0
  50. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/huffman/huff.cpp.o.d +16 -0
  51. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/jenkins/lookup3.c.o.d +88 -0
  52. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/hashes/hash_memory.c.o.d +102 -0
  53. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/hashes/md5.c.o.d +102 -0
  54. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/hashes/sha1.c.o.d +102 -0
  55. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/hashes/sha256.c.o.d +102 -0
  56. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/math/ltm_desc.c.o.d +105 -0
  57. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/math/multi.c.o.d +102 -0
  58. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/math/rand_prime.c.o.d +102 -0
  59. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/base64_decode.c.o.d +102 -0
  60. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_argchk.c.o.d +102 -0
  61. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_find_hash.c.o.d +102 -0
  62. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_find_prng.c.o.d +102 -0
  63. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_hash_descriptor.c.o.d +102 -0
  64. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_hash_is_valid.c.o.d +102 -0
  65. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_libc.c.o.d +102 -0
  66. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c.o.d +102 -0
  67. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_prng_descriptor.c.o.d +102 -0
  68. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_prng_is_valid.c.o.d +102 -0
  69. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_register_hash.c.o.d +102 -0
  70. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/crypt_register_prng.c.o.d +102 -0
  71. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/misc/zeromem.c.o.d +102 -0
  72. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_bit_string.c.o.d +102 -0
  73. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_boolean.c.o.d +102 -0
  74. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_choice.c.o.d +102 -0
  75. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_ia5_string.c.o.d +102 -0
  76. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_integer.c.o.d +102 -0
  77. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_object_identifier.c.o.d +102 -0
  78. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_octet_string.c.o.d +102 -0
  79. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_printable_string.c.o.d +102 -0
  80. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_sequence_ex.c.o.d +102 -0
  81. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_sequence_flexi.c.o.d +102 -0
  82. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_sequence_multi.c.o.d +102 -0
  83. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_short_integer.c.o.d +102 -0
  84. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_utctime.c.o.d +102 -0
  85. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_decode_utf8_string.c.o.d +102 -0
  86. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_bit_string.c.o.d +102 -0
  87. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_boolean.c.o.d +102 -0
  88. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_ia5_string.c.o.d +102 -0
  89. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_integer.c.o.d +102 -0
  90. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_object_identifier.c.o.d +102 -0
  91. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_octet_string.c.o.d +102 -0
  92. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_printable_string.c.o.d +102 -0
  93. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_sequence_ex.c.o.d +102 -0
  94. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_sequence_multi.c.o.d +102 -0
  95. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_set.c.o.d +102 -0
  96. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_setof.c.o.d +102 -0
  97. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_short_integer.c.o.d +102 -0
  98. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_utctime.c.o.d +102 -0
  99. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_encode_utf8_string.c.o.d +102 -0
  100. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_bit_string.c.o.d +102 -0
  101. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_boolean.c.o.d +102 -0
  102. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_ia5_string.c.o.d +102 -0
  103. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_integer.c.o.d +102 -0
  104. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_object_identifier.c.o.d +102 -0
  105. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_octet_string.c.o.d +102 -0
  106. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_printable_string.c.o.d +102 -0
  107. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_sequence.c.o.d +102 -0
  108. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_short_integer.c.o.d +102 -0
  109. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_utctime.c.o.d +102 -0
  110. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_length_utf8_string.c.o.d +102 -0
  111. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/asn1/der_sequence_free.c.o.d +102 -0
  112. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_map.c.o.d +102 -0
  113. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c.o.d +102 -0
  114. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c.o.d +102 -0
  115. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_points.c.o.d +102 -0
  116. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c.o.d +102 -0
  117. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c.o.d +102 -0
  118. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c.o.d +102 -0
  119. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c.o.d +102 -0
  120. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c.o.d +102 -0
  121. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c.o.d +102 -0
  122. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c.o.d +102 -0
  123. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c.o.d +102 -0
  124. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_exptmod.c.o.d +102 -0
  125. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_free.c.o.d +102 -0
  126. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_import.c.o.d +102 -0
  127. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_make_key.c.o.d +102 -0
  128. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_sign_hash.c.o.d +102 -0
  129. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c.o.d +102 -0
  130. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c.o.d +102 -0
  131. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_fast_mp_invmod.c.o.d +65 -0
  132. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_fast_mp_montgomery_reduce.c.o.d +65 -0
  133. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_fast_s_mp_mul_digs.c.o.d +65 -0
  134. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_fast_s_mp_mul_high_digs.c.o.d +65 -0
  135. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_fast_s_mp_sqr.c.o.d +65 -0
  136. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_2expt.c.o.d +65 -0
  137. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_abs.c.o.d +65 -0
  138. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_add.c.o.d +65 -0
  139. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_add_d.c.o.d +65 -0
  140. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_addmod.c.o.d +65 -0
  141. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_and.c.o.d +65 -0
  142. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_clamp.c.o.d +65 -0
  143. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_clear.c.o.d +65 -0
  144. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_clear_multi.c.o.d +65 -0
  145. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_cmp.c.o.d +65 -0
  146. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_cmp_d.c.o.d +65 -0
  147. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_cmp_mag.c.o.d +65 -0
  148. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_cnt_lsb.c.o.d +65 -0
  149. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_copy.c.o.d +65 -0
  150. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_count_bits.c.o.d +65 -0
  151. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_div.c.o.d +65 -0
  152. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_div_2.c.o.d +65 -0
  153. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_div_2d.c.o.d +65 -0
  154. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_div_3.c.o.d +65 -0
  155. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_div_d.c.o.d +65 -0
  156. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_dr_is_modulus.c.o.d +65 -0
  157. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_dr_reduce.c.o.d +65 -0
  158. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_dr_setup.c.o.d +65 -0
  159. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_exch.c.o.d +65 -0
  160. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_expt_d.c.o.d +65 -0
  161. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_exptmod.c.o.d +65 -0
  162. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_exptmod_fast.c.o.d +65 -0
  163. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_exteuclid.c.o.d +65 -0
  164. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_fread.c.o.d +65 -0
  165. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_fwrite.c.o.d +65 -0
  166. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_gcd.c.o.d +65 -0
  167. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_get_int.c.o.d +65 -0
  168. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_grow.c.o.d +65 -0
  169. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init.c.o.d +65 -0
  170. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init_copy.c.o.d +65 -0
  171. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init_multi.c.o.d +65 -0
  172. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init_set.c.o.d +65 -0
  173. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init_set_int.c.o.d +65 -0
  174. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_init_size.c.o.d +65 -0
  175. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_invmod.c.o.d +65 -0
  176. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_invmod_slow.c.o.d +65 -0
  177. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_is_square.c.o.d +65 -0
  178. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_jacobi.c.o.d +65 -0
  179. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_karatsuba_mul.c.o.d +65 -0
  180. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_karatsuba_sqr.c.o.d +65 -0
  181. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_lcm.c.o.d +65 -0
  182. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_lshd.c.o.d +65 -0
  183. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mod.c.o.d +65 -0
  184. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mod_2d.c.o.d +65 -0
  185. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mod_d.c.o.d +65 -0
  186. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_montgomery_calc_normalization.c.o.d +65 -0
  187. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_montgomery_reduce.c.o.d +65 -0
  188. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_montgomery_setup.c.o.d +65 -0
  189. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mul.c.o.d +65 -0
  190. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mul_2.c.o.d +65 -0
  191. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mul_2d.c.o.d +65 -0
  192. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mul_d.c.o.d +65 -0
  193. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_mulmod.c.o.d +65 -0
  194. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_n_root.c.o.d +65 -0
  195. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_neg.c.o.d +65 -0
  196. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_or.c.o.d +65 -0
  197. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_fermat.c.o.d +65 -0
  198. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_is_divisible.c.o.d +65 -0
  199. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_is_prime.c.o.d +65 -0
  200. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_miller_rabin.c.o.d +65 -0
  201. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_next_prime.c.o.d +65 -0
  202. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_rabin_miller_trials.c.o.d +65 -0
  203. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_prime_random_ex.c.o.d +65 -0
  204. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_radix_size.c.o.d +65 -0
  205. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_radix_smap.c.o.d +65 -0
  206. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_rand.c.o.d +65 -0
  207. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_read_radix.c.o.d +65 -0
  208. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_read_signed_bin.c.o.d +65 -0
  209. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_read_unsigned_bin.c.o.d +65 -0
  210. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce.c.o.d +65 -0
  211. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_2k.c.o.d +65 -0
  212. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_2k_l.c.o.d +65 -0
  213. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_2k_setup.c.o.d +65 -0
  214. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_2k_setup_l.c.o.d +65 -0
  215. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_is_2k.c.o.d +65 -0
  216. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_is_2k_l.c.o.d +65 -0
  217. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_reduce_setup.c.o.d +65 -0
  218. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_rshd.c.o.d +65 -0
  219. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_set.c.o.d +65 -0
  220. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_set_int.c.o.d +65 -0
  221. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_shrink.c.o.d +65 -0
  222. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_signed_bin_size.c.o.d +65 -0
  223. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_sqr.c.o.d +65 -0
  224. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_sqrmod.c.o.d +65 -0
  225. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_sqrt.c.o.d +65 -0
  226. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_sub.c.o.d +65 -0
  227. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_sub_d.c.o.d +65 -0
  228. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_submod.c.o.d +65 -0
  229. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_to_signed_bin.c.o.d +65 -0
  230. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_to_signed_bin_n.c.o.d +65 -0
  231. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_to_unsigned_bin.c.o.d +65 -0
  232. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_to_unsigned_bin_n.c.o.d +65 -0
  233. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_toom_mul.c.o.d +65 -0
  234. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_toom_sqr.c.o.d +65 -0
  235. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_toradix.c.o.d +65 -0
  236. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_toradix_n.c.o.d +65 -0
  237. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_unsigned_bin_size.c.o.d +65 -0
  238. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_xor.c.o.d +65 -0
  239. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_mp_zero.c.o.d +65 -0
  240. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_prime_tab.c.o.d +65 -0
  241. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_reverse.c.o.d +65 -0
  242. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_add.c.o.d +65 -0
  243. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_exptmod.c.o.d +65 -0
  244. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_mul_digs.c.o.d +65 -0
  245. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_mul_high_digs.c.o.d +65 -0
  246. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_sqr.c.o.d +65 -0
  247. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bn_s_mp_sub.c.o.d +65 -0
  248. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/libtommath/bncore.c.o.d +65 -0
  249. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/lzma/C/LzFind.c.o.d +18 -0
  250. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/lzma/C/LzmaDec.c.o.d +17 -0
  251. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/lzma/C/LzmaEnc.c.o.d +18 -0
  252. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/pklib/explode.c.o.d +16 -0
  253. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/pklib/implode.c.o.d +23 -0
  254. data/ext/stormlib/StormLib/CMakeFiles/storm.dir/src/sparse/sparse.cpp.o.d +16 -0
  255. data/ext/stormlib/StormLib/CMakeLists.txt +418 -0
  256. data/ext/stormlib/StormLib/Info.plist +22 -0
  257. data/ext/stormlib/StormLib/LICENSE +21 -0
  258. data/ext/stormlib/StormLib/Premake5.lua +132 -0
  259. data/ext/stormlib/StormLib/README.md +39 -0
  260. data/ext/stormlib/StormLib/StormLib.sln +162 -0
  261. data/ext/stormlib/StormLib/StormLib.vcxproj +1024 -0
  262. data/ext/stormlib/StormLib/StormLib.vcxproj.filters +221 -0
  263. data/ext/stormlib/StormLib/StormLib.xcodeproj/project.pbxproj +2104 -0
  264. data/ext/stormlib/StormLib/StormLib_dll.vcxproj +348 -0
  265. data/ext/stormlib/StormLib/StormLib_dll.vcxproj.filters +229 -0
  266. data/ext/stormlib/StormLib/StormLib_test.vcxproj +360 -0
  267. data/ext/stormlib/StormLib/StormLib_test.vcxproj.filters +230 -0
  268. data/ext/stormlib/StormLib/StormLib_vs08.sln +139 -0
  269. data/ext/stormlib/StormLib/StormLib_vs08.vcproj +4205 -0
  270. data/ext/stormlib/StormLib/StormLib_vs08_dll.vcproj +1851 -0
  271. data/ext/stormlib/StormLib/StormLib_vs08_test.vcproj +1289 -0
  272. data/ext/stormlib/StormLib/doc/History.txt +78 -0
  273. data/ext/stormlib/StormLib/doc/The MoPaQ File Format 0.9.txt +318 -0
  274. data/ext/stormlib/StormLib/doc/The MoPaQ File Format 1.0.txt +433 -0
  275. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-deDE.txt +1 -0
  276. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-enGB.txt +1 -0
  277. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-enSG.txt +1 -0
  278. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-enUS.txt +1 -0
  279. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-esES.txt +1 -0
  280. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-esMX.txt +1 -0
  281. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-frFR.txt +1 -0
  282. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-itIT.txt +1 -0
  283. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-koKR.txt +1 -0
  284. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-plPL.txt +1 -0
  285. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-ptBR.txt +1 -0
  286. data/ext/stormlib/StormLib/doc/d3-authenticationcode/d3-authenticationcode-zhTW.txt +1 -0
  287. data/ext/stormlib/StormLib/doc/hots-authenticationcode/hots-authenticationcode-bgdl.txt +1 -0
  288. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-deDE.txt +1 -0
  289. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-enGB.txt +1 -0
  290. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-enUS.txt +1 -0
  291. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-esES.txt +1 -0
  292. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-esMX.txt +1 -0
  293. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-frFR.txt +1 -0
  294. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-itIT.txt +1 -0
  295. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-koKR.txt +1 -0
  296. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-plPL.txt +1 -0
  297. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-ptBR.txt +1 -0
  298. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-ruRU.txt +1 -0
  299. data/ext/stormlib/StormLib/doc/sc2-authenticationcode/sc2-authenticationcode-zhTW.txt +1 -0
  300. data/ext/stormlib/StormLib/make-msvc.bat +95 -0
  301. data/ext/stormlib/StormLib/make.bat +46 -0
  302. data/ext/stormlib/StormLib/sources +14 -0
  303. data/ext/stormlib/StormLib/src/DllMain.c +24 -0
  304. data/ext/stormlib/StormLib/src/DllMain.def +79 -0
  305. data/ext/stormlib/StormLib/src/DllMain.rc +110 -0
  306. data/ext/stormlib/StormLib/src/FileStream.cpp +2928 -0
  307. data/ext/stormlib/StormLib/src/FileStream.h +217 -0
  308. data/ext/stormlib/StormLib/src/LibTomCrypt.c +85 -0
  309. data/ext/stormlib/StormLib/src/LibTomMath.c +125 -0
  310. data/ext/stormlib/StormLib/src/LibTomMathDesc.c +4 -0
  311. data/ext/stormlib/StormLib/src/SBaseCommon.cpp +1970 -0
  312. data/ext/stormlib/StormLib/src/SBaseDumpData.cpp +183 -0
  313. data/ext/stormlib/StormLib/src/SBaseFileTable.cpp +3194 -0
  314. data/ext/stormlib/StormLib/src/SBaseSubTypes.cpp +688 -0
  315. data/ext/stormlib/StormLib/src/SCompression.cpp +1183 -0
  316. data/ext/stormlib/StormLib/src/SFileAddFile.cpp +1337 -0
  317. data/ext/stormlib/StormLib/src/SFileAttributes.cpp +573 -0
  318. data/ext/stormlib/StormLib/src/SFileCompactArchive.cpp +654 -0
  319. data/ext/stormlib/StormLib/src/SFileCreateArchive.cpp +285 -0
  320. data/ext/stormlib/StormLib/src/SFileExtractFile.cpp +64 -0
  321. data/ext/stormlib/StormLib/src/SFileFindFile.cpp +484 -0
  322. data/ext/stormlib/StormLib/src/SFileGetFileInfo.cpp +627 -0
  323. data/ext/stormlib/StormLib/src/SFileListFile.cpp +750 -0
  324. data/ext/stormlib/StormLib/src/SFileOpenArchive.cpp +723 -0
  325. data/ext/stormlib/StormLib/src/SFileOpenFileEx.cpp +423 -0
  326. data/ext/stormlib/StormLib/src/SFilePatchArchives.cpp +1175 -0
  327. data/ext/stormlib/StormLib/src/SFileReadFile.cpp +922 -0
  328. data/ext/stormlib/StormLib/src/SFileVerify.cpp +1059 -0
  329. data/ext/stormlib/StormLib/src/StormCommon.h +450 -0
  330. data/ext/stormlib/StormLib/src/StormLib.exp +74 -0
  331. data/ext/stormlib/StormLib/src/StormLib.h +1157 -0
  332. data/ext/stormlib/StormLib/src/StormPort.h +474 -0
  333. data/ext/stormlib/StormLib/src/adpcm/adpcm.cpp +539 -0
  334. data/ext/stormlib/StormLib/src/adpcm/adpcm.h +27 -0
  335. data/ext/stormlib/StormLib/src/bzip2/blocksort.c +1094 -0
  336. data/ext/stormlib/StormLib/src/bzip2/bzlib.c +1573 -0
  337. data/ext/stormlib/StormLib/src/bzip2/bzlib.h +282 -0
  338. data/ext/stormlib/StormLib/src/bzip2/bzlib_private.h +509 -0
  339. data/ext/stormlib/StormLib/src/bzip2/compress.c +672 -0
  340. data/ext/stormlib/StormLib/src/bzip2/crctable.c +104 -0
  341. data/ext/stormlib/StormLib/src/bzip2/decompress.c +626 -0
  342. data/ext/stormlib/StormLib/src/bzip2/huffman.c +205 -0
  343. data/ext/stormlib/StormLib/src/bzip2/randtable.c +84 -0
  344. data/ext/stormlib/StormLib/src/huffman/huff.cpp +915 -0
  345. data/ext/stormlib/StormLib/src/huffman/huff.h +143 -0
  346. data/ext/stormlib/StormLib/src/jenkins/lookup.h +24 -0
  347. data/ext/stormlib/StormLib/src/jenkins/lookup3.c +1003 -0
  348. data/ext/stormlib/StormLib/src/libtomcrypt/src/hashes/hash_memory.c +69 -0
  349. data/ext/stormlib/StormLib/src/libtomcrypt/src/hashes/md5.c +368 -0
  350. data/ext/stormlib/StormLib/src/libtomcrypt/src/hashes/sha1.c +288 -0
  351. data/ext/stormlib/StormLib/src/libtomcrypt/src/hashes/sha256.c +340 -0
  352. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt.h +91 -0
  353. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_argchk.h +38 -0
  354. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_cfg.h +144 -0
  355. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_cipher.h +891 -0
  356. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_custom.h +424 -0
  357. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_hash.h +378 -0
  358. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_mac.h +384 -0
  359. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_macros.h +424 -0
  360. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_math.h +500 -0
  361. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_misc.h +23 -0
  362. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_pk.h +558 -0
  363. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_pkcs.h +89 -0
  364. data/ext/stormlib/StormLib/src/libtomcrypt/src/headers/tomcrypt_prng.h +199 -0
  365. data/ext/stormlib/StormLib/src/libtomcrypt/src/math/ltm_desc.c +483 -0
  366. data/ext/stormlib/StormLib/src/libtomcrypt/src/math/multi.c +61 -0
  367. data/ext/stormlib/StormLib/src/libtomcrypt/src/math/rand_prime.c +87 -0
  368. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/base64_decode.c +104 -0
  369. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_argchk.c +30 -0
  370. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_find_hash.c +40 -0
  371. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_find_prng.c +41 -0
  372. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_hash_descriptor.c +27 -0
  373. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_hash_is_valid.c +36 -0
  374. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_libc.c +43 -0
  375. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c +13 -0
  376. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_prng_descriptor.c +26 -0
  377. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_prng_is_valid.c +36 -0
  378. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_register_hash.c +54 -0
  379. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/crypt_register_prng.c +54 -0
  380. data/ext/stormlib/StormLib/src/libtomcrypt/src/misc/zeromem.c +34 -0
  381. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_bit_string.c +102 -0
  382. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_boolean.c +47 -0
  383. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_choice.c +182 -0
  384. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_ia5_string.c +96 -0
  385. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_integer.c +110 -0
  386. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_object_identifier.c +99 -0
  387. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_octet_string.c +91 -0
  388. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_printable_string.c +96 -0
  389. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_sequence_ex.c +287 -0
  390. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_sequence_flexi.c +386 -0
  391. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_sequence_multi.c +139 -0
  392. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_short_integer.c +68 -0
  393. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_utctime.c +127 -0
  394. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_decode_utf8_string.c +111 -0
  395. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_bit_string.c +89 -0
  396. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_boolean.c +51 -0
  397. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_ia5_string.c +85 -0
  398. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_integer.c +130 -0
  399. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_object_identifier.c +111 -0
  400. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_octet_string.c +86 -0
  401. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_printable_string.c +85 -0
  402. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_sequence_ex.c +335 -0
  403. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_sequence_multi.c +138 -0
  404. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_set.c +103 -0
  405. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_setof.c +162 -0
  406. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_short_integer.c +97 -0
  407. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_utctime.c +83 -0
  408. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_encode_utf8_string.c +105 -0
  409. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_bit_string.c +54 -0
  410. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_boolean.c +35 -0
  411. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_ia5_string.c +194 -0
  412. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_integer.c +82 -0
  413. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_object_identifier.c +89 -0
  414. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_octet_string.c +53 -0
  415. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_printable_string.c +166 -0
  416. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_sequence.c +169 -0
  417. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_short_integer.c +70 -0
  418. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_utctime.c +46 -0
  419. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_length_utf8_string.c +83 -0
  420. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/asn1/der_sequence_free.c +65 -0
  421. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_map.c +76 -0
  422. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c +207 -0
  423. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c +222 -0
  424. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_points.c +60 -0
  425. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c +196 -0
  426. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c +147 -0
  427. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c +108 -0
  428. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c +189 -0
  429. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c +177 -0
  430. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c +175 -0
  431. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c +110 -0
  432. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c +111 -0
  433. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_exptmod.c +113 -0
  434. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_free.c +34 -0
  435. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_import.c +143 -0
  436. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_make_key.c +112 -0
  437. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_sign_hash.c +134 -0
  438. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c +167 -0
  439. data/ext/stormlib/StormLib/src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c +87 -0
  440. data/ext/stormlib/StormLib/src/libtommath/bn_fast_mp_invmod.c +148 -0
  441. data/ext/stormlib/StormLib/src/libtommath/bn_fast_mp_montgomery_reduce.c +172 -0
  442. data/ext/stormlib/StormLib/src/libtommath/bn_fast_s_mp_mul_digs.c +107 -0
  443. data/ext/stormlib/StormLib/src/libtommath/bn_fast_s_mp_mul_high_digs.c +98 -0
  444. data/ext/stormlib/StormLib/src/libtommath/bn_fast_s_mp_sqr.c +114 -0
  445. data/ext/stormlib/StormLib/src/libtommath/bn_mp_2expt.c +48 -0
  446. data/ext/stormlib/StormLib/src/libtommath/bn_mp_abs.c +43 -0
  447. data/ext/stormlib/StormLib/src/libtommath/bn_mp_add.c +53 -0
  448. data/ext/stormlib/StormLib/src/libtommath/bn_mp_add_d.c +112 -0
  449. data/ext/stormlib/StormLib/src/libtommath/bn_mp_addmod.c +41 -0
  450. data/ext/stormlib/StormLib/src/libtommath/bn_mp_and.c +57 -0
  451. data/ext/stormlib/StormLib/src/libtommath/bn_mp_clamp.c +44 -0
  452. data/ext/stormlib/StormLib/src/libtommath/bn_mp_clear.c +44 -0
  453. data/ext/stormlib/StormLib/src/libtommath/bn_mp_clear_multi.c +34 -0
  454. data/ext/stormlib/StormLib/src/libtommath/bn_mp_cmp.c +43 -0
  455. data/ext/stormlib/StormLib/src/libtommath/bn_mp_cmp_d.c +44 -0
  456. data/ext/stormlib/StormLib/src/libtommath/bn_mp_cmp_mag.c +55 -0
  457. data/ext/stormlib/StormLib/src/libtommath/bn_mp_cnt_lsb.c +53 -0
  458. data/ext/stormlib/StormLib/src/libtommath/bn_mp_copy.c +68 -0
  459. data/ext/stormlib/StormLib/src/libtommath/bn_mp_count_bits.c +45 -0
  460. data/ext/stormlib/StormLib/src/libtommath/bn_mp_div.c +292 -0
  461. data/ext/stormlib/StormLib/src/libtommath/bn_mp_div_2.c +68 -0
  462. data/ext/stormlib/StormLib/src/libtommath/bn_mp_div_2d.c +97 -0
  463. data/ext/stormlib/StormLib/src/libtommath/bn_mp_div_3.c +79 -0
  464. data/ext/stormlib/StormLib/src/libtommath/bn_mp_div_d.c +115 -0
  465. data/ext/stormlib/StormLib/src/libtommath/bn_mp_dr_is_modulus.c +43 -0
  466. data/ext/stormlib/StormLib/src/libtommath/bn_mp_dr_reduce.c +94 -0
  467. data/ext/stormlib/StormLib/src/libtommath/bn_mp_dr_setup.c +32 -0
  468. data/ext/stormlib/StormLib/src/libtommath/bn_mp_exch.c +34 -0
  469. data/ext/stormlib/StormLib/src/libtommath/bn_mp_expt_d.c +57 -0
  470. data/ext/stormlib/StormLib/src/libtommath/bn_mp_exptmod.c +112 -0
  471. data/ext/stormlib/StormLib/src/libtommath/bn_mp_exptmod_fast.c +321 -0
  472. data/ext/stormlib/StormLib/src/libtommath/bn_mp_exteuclid.c +82 -0
  473. data/ext/stormlib/StormLib/src/libtommath/bn_mp_fread.c +67 -0
  474. data/ext/stormlib/StormLib/src/libtommath/bn_mp_fwrite.c +52 -0
  475. data/ext/stormlib/StormLib/src/libtommath/bn_mp_gcd.c +105 -0
  476. data/ext/stormlib/StormLib/src/libtommath/bn_mp_get_int.c +45 -0
  477. data/ext/stormlib/StormLib/src/libtommath/bn_mp_grow.c +57 -0
  478. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init.c +46 -0
  479. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init_copy.c +32 -0
  480. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init_multi.c +59 -0
  481. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init_set.c +32 -0
  482. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init_set_int.c +31 -0
  483. data/ext/stormlib/StormLib/src/libtommath/bn_mp_init_size.c +48 -0
  484. data/ext/stormlib/StormLib/src/libtommath/bn_mp_invmod.c +43 -0
  485. data/ext/stormlib/StormLib/src/libtommath/bn_mp_invmod_slow.c +175 -0
  486. data/ext/stormlib/StormLib/src/libtommath/bn_mp_is_square.c +109 -0
  487. data/ext/stormlib/StormLib/src/libtommath/bn_mp_jacobi.c +105 -0
  488. data/ext/stormlib/StormLib/src/libtommath/bn_mp_karatsuba_mul.c +167 -0
  489. data/ext/stormlib/StormLib/src/libtommath/bn_mp_karatsuba_sqr.c +121 -0
  490. data/ext/stormlib/StormLib/src/libtommath/bn_mp_lcm.c +60 -0
  491. data/ext/stormlib/StormLib/src/libtommath/bn_mp_lshd.c +67 -0
  492. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mod.c +48 -0
  493. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mod_2d.c +55 -0
  494. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mod_d.c +27 -0
  495. data/ext/stormlib/StormLib/src/libtommath/bn_mp_montgomery_calc_normalization.c +59 -0
  496. data/ext/stormlib/StormLib/src/libtommath/bn_mp_montgomery_reduce.c +118 -0
  497. data/ext/stormlib/StormLib/src/libtommath/bn_mp_montgomery_setup.c +59 -0
  498. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mul.c +66 -0
  499. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mul_2.c +82 -0
  500. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mul_2d.c +85 -0
  501. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mul_d.c +79 -0
  502. data/ext/stormlib/StormLib/src/libtommath/bn_mp_mulmod.c +40 -0
  503. data/ext/stormlib/StormLib/src/libtommath/bn_mp_n_root.c +132 -0
  504. data/ext/stormlib/StormLib/src/libtommath/bn_mp_neg.c +40 -0
  505. data/ext/stormlib/StormLib/src/libtommath/bn_mp_or.c +50 -0
  506. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_fermat.c +62 -0
  507. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_is_divisible.c +50 -0
  508. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_is_prime.c +83 -0
  509. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_miller_rabin.c +103 -0
  510. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_next_prime.c +170 -0
  511. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_rabin_miller_trials.c +52 -0
  512. data/ext/stormlib/StormLib/src/libtommath/bn_mp_prime_random_ex.c +125 -0
  513. data/ext/stormlib/StormLib/src/libtommath/bn_mp_radix_size.c +78 -0
  514. data/ext/stormlib/StormLib/src/libtommath/bn_mp_radix_smap.c +24 -0
  515. data/ext/stormlib/StormLib/src/libtommath/bn_mp_rand.c +55 -0
  516. data/ext/stormlib/StormLib/src/libtommath/bn_mp_read_radix.c +85 -0
  517. data/ext/stormlib/StormLib/src/libtommath/bn_mp_read_signed_bin.c +41 -0
  518. data/ext/stormlib/StormLib/src/libtommath/bn_mp_read_unsigned_bin.c +55 -0
  519. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce.c +100 -0
  520. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_2k.c +61 -0
  521. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_2k_l.c +62 -0
  522. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_2k_setup.c +47 -0
  523. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_2k_setup_l.c +44 -0
  524. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_is_2k.c +52 -0
  525. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_is_2k_l.c +44 -0
  526. data/ext/stormlib/StormLib/src/libtommath/bn_mp_reduce_setup.c +34 -0
  527. data/ext/stormlib/StormLib/src/libtommath/bn_mp_rshd.c +72 -0
  528. data/ext/stormlib/StormLib/src/libtommath/bn_mp_set.c +29 -0
  529. data/ext/stormlib/StormLib/src/libtommath/bn_mp_set_int.c +48 -0
  530. data/ext/stormlib/StormLib/src/libtommath/bn_mp_shrink.c +35 -0
  531. data/ext/stormlib/StormLib/src/libtommath/bn_mp_signed_bin_size.c +27 -0
  532. data/ext/stormlib/StormLib/src/libtommath/bn_mp_sqr.c +58 -0
  533. data/ext/stormlib/StormLib/src/libtommath/bn_mp_sqrmod.c +41 -0
  534. data/ext/stormlib/StormLib/src/libtommath/bn_mp_sqrt.c +81 -0
  535. data/ext/stormlib/StormLib/src/libtommath/bn_mp_sub.c +59 -0
  536. data/ext/stormlib/StormLib/src/libtommath/bn_mp_sub_d.c +93 -0
  537. data/ext/stormlib/StormLib/src/libtommath/bn_mp_submod.c +42 -0
  538. data/ext/stormlib/StormLib/src/libtommath/bn_mp_to_signed_bin.c +33 -0
  539. data/ext/stormlib/StormLib/src/libtommath/bn_mp_to_signed_bin_n.c +31 -0
  540. data/ext/stormlib/StormLib/src/libtommath/bn_mp_to_unsigned_bin.c +48 -0
  541. data/ext/stormlib/StormLib/src/libtommath/bn_mp_to_unsigned_bin_n.c +31 -0
  542. data/ext/stormlib/StormLib/src/libtommath/bn_mp_toom_mul.c +284 -0
  543. data/ext/stormlib/StormLib/src/libtommath/bn_mp_toom_sqr.c +226 -0
  544. data/ext/stormlib/StormLib/src/libtommath/bn_mp_toradix.c +75 -0
  545. data/ext/stormlib/StormLib/src/libtommath/bn_mp_toradix_n.c +88 -0
  546. data/ext/stormlib/StormLib/src/libtommath/bn_mp_unsigned_bin_size.c +28 -0
  547. data/ext/stormlib/StormLib/src/libtommath/bn_mp_xor.c +51 -0
  548. data/ext/stormlib/StormLib/src/libtommath/bn_mp_zero.c +36 -0
  549. data/ext/stormlib/StormLib/src/libtommath/bn_prime_tab.c +61 -0
  550. data/ext/stormlib/StormLib/src/libtommath/bn_reverse.c +39 -0
  551. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_add.c +109 -0
  552. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_exptmod.c +252 -0
  553. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_mul_digs.c +90 -0
  554. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_mul_high_digs.c +81 -0
  555. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_sqr.c +84 -0
  556. data/ext/stormlib/StormLib/src/libtommath/bn_s_mp_sub.c +89 -0
  557. data/ext/stormlib/StormLib/src/libtommath/bncore.c +36 -0
  558. data/ext/stormlib/StormLib/src/libtommath/tommath.h +584 -0
  559. data/ext/stormlib/StormLib/src/libtommath/tommath_class.h +999 -0
  560. data/ext/stormlib/StormLib/src/libtommath/tommath_superclass.h +76 -0
  561. data/ext/stormlib/StormLib/src/lzma/C/LzFind.c +761 -0
  562. data/ext/stormlib/StormLib/src/lzma/C/LzFind.h +115 -0
  563. data/ext/stormlib/StormLib/src/lzma/C/LzFindMt.c +793 -0
  564. data/ext/stormlib/StormLib/src/lzma/C/LzFindMt.h +105 -0
  565. data/ext/stormlib/StormLib/src/lzma/C/LzHash.h +54 -0
  566. data/ext/stormlib/StormLib/src/lzma/C/LzmaDec.c +999 -0
  567. data/ext/stormlib/StormLib/src/lzma/C/LzmaDec.h +231 -0
  568. data/ext/stormlib/StormLib/src/lzma/C/LzmaEnc.c +2268 -0
  569. data/ext/stormlib/StormLib/src/lzma/C/LzmaEnc.h +80 -0
  570. data/ext/stormlib/StormLib/src/lzma/C/Threads.c +84 -0
  571. data/ext/stormlib/StormLib/src/lzma/C/Threads.h +59 -0
  572. data/ext/stormlib/StormLib/src/lzma/C/Types.h +236 -0
  573. data/ext/stormlib/StormLib/src/lzma/info.txt +1 -0
  574. data/ext/stormlib/StormLib/src/pklib/crc32.c +66 -0
  575. data/ext/stormlib/StormLib/src/pklib/explode.c +521 -0
  576. data/ext/stormlib/StormLib/src/pklib/implode.c +674 -0
  577. data/ext/stormlib/StormLib/src/pklib/pklib.h +160 -0
  578. data/ext/stormlib/StormLib/src/resource.h +15 -0
  579. data/ext/stormlib/StormLib/src/sparse/sparse.cpp +287 -0
  580. data/ext/stormlib/StormLib/src/sparse/sparse.h +17 -0
  581. data/ext/stormlib/StormLib/src/wdk/sources-cpp.cpp +26 -0
  582. data/ext/stormlib/StormLib/src/wdk/sources-wdk-bzip2.c +13 -0
  583. data/ext/stormlib/StormLib/src/wdk/sources-wdk-ltc.c +4 -0
  584. data/ext/stormlib/StormLib/src/wdk/sources-wdk-lzma.c +8 -0
  585. data/ext/stormlib/StormLib/src/wdk/sources-wdk-misc.c +6 -0
  586. data/ext/stormlib/StormLib/src/wdk/sources-wdk-tomcrypt.c +82 -0
  587. data/ext/stormlib/StormLib/src/wdk/sources-wdk-tommath.c +123 -0
  588. data/ext/stormlib/StormLib/src/wdk/sources-wdk-zlib.c +21 -0
  589. data/ext/stormlib/StormLib/src/zlib/adler32.c +169 -0
  590. data/ext/stormlib/StormLib/src/zlib/compress.c +80 -0
  591. data/ext/stormlib/StormLib/src/zlib/compress_zlib.c +5 -0
  592. data/ext/stormlib/StormLib/src/zlib/crc32.c +442 -0
  593. data/ext/stormlib/StormLib/src/zlib/crc32.h +441 -0
  594. data/ext/stormlib/StormLib/src/zlib/deflate.c +1834 -0
  595. data/ext/stormlib/StormLib/src/zlib/deflate.h +342 -0
  596. data/ext/stormlib/StormLib/src/zlib/gzguts.h +218 -0
  597. data/ext/stormlib/StormLib/src/zlib/inffast.c +340 -0
  598. data/ext/stormlib/StormLib/src/zlib/inffast.h +11 -0
  599. data/ext/stormlib/StormLib/src/zlib/inffixed.h +94 -0
  600. data/ext/stormlib/StormLib/src/zlib/inflate.c +1480 -0
  601. data/ext/stormlib/StormLib/src/zlib/inflate.h +130 -0
  602. data/ext/stormlib/StormLib/src/zlib/inftrees.c +330 -0
  603. data/ext/stormlib/StormLib/src/zlib/inftrees.h +67 -0
  604. data/ext/stormlib/StormLib/src/zlib/trees.c +1244 -0
  605. data/ext/stormlib/StormLib/src/zlib/trees.h +128 -0
  606. data/ext/stormlib/StormLib/src/zlib/zconf.h +428 -0
  607. data/ext/stormlib/StormLib/src/zlib/zlib.h +1613 -0
  608. data/ext/stormlib/StormLib/src/zlib/zutil.c +318 -0
  609. data/ext/stormlib/StormLib/src/zlib/zutil.h +274 -0
  610. data/ext/stormlib/StormLib/storm_dll/storm.cpp +117 -0
  611. data/ext/stormlib/StormLib/storm_dll/storm.def +25 -0
  612. data/ext/stormlib/StormLib/storm_dll/storm.h +65 -0
  613. data/ext/stormlib/StormLib/storm_dll/storm.vcxproj +209 -0
  614. data/ext/stormlib/StormLib/storm_dll/storm.vcxproj.filters +28 -0
  615. data/ext/stormlib/StormLib/storm_dll/storm_test.cpp +182 -0
  616. data/ext/stormlib/StormLib/storm_dll/storm_test.vcxproj +202 -0
  617. data/ext/stormlib/StormLib/storm_dll/storm_test.vcxproj.filters +22 -0
  618. data/ext/stormlib/StormLib/test/StormTest.cpp +4393 -0
  619. data/ext/stormlib/StormLib/test/TLogHelper.cpp +567 -0
  620. data/ext/stormlib/StormLib/test/stormlib-test-001.txt +164 -0
  621. data/ext/stormlib/extconf.rb +0 -2
  622. data/lib/stormlib/version.rb +1 -1
  623. data/stormlib.gemspec +1 -1
  624. metadata +621 -2
@@ -0,0 +1,1337 @@
1
+ /*****************************************************************************/
2
+ /* SFileAddFile.cpp Copyright (c) Ladislav Zezula 2010 */
3
+ /*---------------------------------------------------------------------------*/
4
+ /* MPQ Editing functions */
5
+ /*---------------------------------------------------------------------------*/
6
+ /* Date Ver Who Comment */
7
+ /* -------- ---- --- ------- */
8
+ /* 27.03.10 1.00 Lad Splitted from SFileCreateArchiveEx.cpp */
9
+ /* 21.04.13 1.01 Dea AddFile callback now part of TMPQArchive */
10
+ /*****************************************************************************/
11
+
12
+ #define __STORMLIB_SELF__
13
+ #include "StormLib.h"
14
+ #include "StormCommon.h"
15
+
16
+ //-----------------------------------------------------------------------------
17
+ // Local variables
18
+
19
+ // Mask for lossy compressions
20
+ #define MPQ_LOSSY_COMPRESSION_MASK (MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO | MPQ_COMPRESSION_HUFFMANN)
21
+
22
+ // Data compression for SFileAddFile
23
+ // Kept here for compatibility with code that was created with StormLib version < 6.50
24
+ static DWORD DefaultDataCompression = MPQ_COMPRESSION_PKWARE;
25
+
26
+ //-----------------------------------------------------------------------------
27
+ // WAVE verification
28
+
29
+ #define FILE_SIGNATURE_RIFF 0x46464952
30
+ #define FILE_SIGNATURE_WAVE 0x45564157
31
+ #define FILE_SIGNATURE_FMT 0x20746D66
32
+ #define AUDIO_FORMAT_PCM 1
33
+
34
+ typedef struct _WAVE_FILE_HEADER
35
+ {
36
+ DWORD dwChunkId; // 0x52494646 ("RIFF")
37
+ DWORD dwChunkSize; // Size of that chunk, in bytes
38
+ DWORD dwFormat; // Must be 0x57415645 ("WAVE")
39
+
40
+ // Format sub-chunk
41
+ DWORD dwSubChunk1Id; // 0x666d7420 ("fmt ")
42
+ DWORD dwSubChunk1Size; // 0x16 for PCM
43
+ USHORT wAudioFormat; // 1 = PCM. Other value means some sort of compression
44
+ USHORT wChannels; // Number of channels
45
+ DWORD dwSampleRate; // 8000, 44100, etc.
46
+ DWORD dwBytesRate; // SampleRate * NumChannels * BitsPerSample/8
47
+ USHORT wBlockAlign; // NumChannels * BitsPerSample/8
48
+ USHORT wBitsPerSample; // 8 bits = 8, 16 bits = 16, etc.
49
+
50
+ // Followed by "data" sub-chunk (we don't care)
51
+ } WAVE_FILE_HEADER, *PWAVE_FILE_HEADER;
52
+
53
+ static bool IsWaveFile_16BitsPerAdpcmSample(
54
+ LPBYTE pbFileData,
55
+ DWORD cbFileData,
56
+ LPDWORD pdwChannels)
57
+ {
58
+ PWAVE_FILE_HEADER pWaveHdr = (PWAVE_FILE_HEADER)pbFileData;
59
+
60
+ // The amount of file data must be at least size of WAVE header
61
+ if(cbFileData > sizeof(WAVE_FILE_HEADER))
62
+ {
63
+ // Check for the RIFF header
64
+ if(pWaveHdr->dwChunkId == FILE_SIGNATURE_RIFF && pWaveHdr->dwFormat == FILE_SIGNATURE_WAVE)
65
+ {
66
+ // Check for ADPCM format
67
+ if(pWaveHdr->dwSubChunk1Id == FILE_SIGNATURE_FMT && pWaveHdr->wAudioFormat == AUDIO_FORMAT_PCM)
68
+ {
69
+ // Now the number of bits per sample must be at least 16.
70
+ // If not, the WAVE file gets corrupted by the ADPCM compression
71
+ if(pWaveHdr->wBitsPerSample >= 0x10)
72
+ {
73
+ *pdwChannels = pWaveHdr->wChannels;
74
+ return true;
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ return false;
81
+ }
82
+
83
+ static DWORD FillWritableHandle(
84
+ TMPQArchive * ha,
85
+ TMPQFile * hf,
86
+ ULONGLONG FileTime,
87
+ DWORD dwFileSize,
88
+ DWORD dwFlags)
89
+ {
90
+ TFileEntry * pFileEntry = hf->pFileEntry;
91
+
92
+ // Initialize the hash entry for the file
93
+ hf->RawFilePos = ha->MpqPos + hf->MpqFilePos;
94
+ hf->dwDataSize = dwFileSize;
95
+
96
+ // Initialize the block table entry for the file
97
+ pFileEntry->ByteOffset = hf->MpqFilePos;
98
+ pFileEntry->dwFileSize = dwFileSize;
99
+ pFileEntry->dwCmpSize = 0;
100
+ pFileEntry->dwFlags = dwFlags | MPQ_FILE_EXISTS;
101
+
102
+ // Initialize hashing of the file
103
+ if((hf->hctx = STORM_ALLOC(hash_state, 1)) != NULL)
104
+ md5_init((hash_state *)hf->hctx);
105
+
106
+ // Fill-in file time and CRC
107
+ pFileEntry->FileTime = FileTime;
108
+ pFileEntry->dwCrc32 = crc32(0, Z_NULL, 0);
109
+
110
+ // Mark the archive as modified
111
+ ha->dwFlags |= MPQ_FLAG_CHANGED;
112
+
113
+ // Call the callback, if needed
114
+ if(ha->pfnAddFileCB != NULL)
115
+ ha->pfnAddFileCB(ha->pvAddFileUserData, 0, hf->dwDataSize, false);
116
+ hf->dwAddFileError = ERROR_SUCCESS;
117
+
118
+ return ERROR_SUCCESS;
119
+ }
120
+
121
+ //-----------------------------------------------------------------------------
122
+ // MPQ write data functions
123
+
124
+ static DWORD WriteDataToMpqFile(
125
+ TMPQArchive * ha,
126
+ TMPQFile * hf,
127
+ LPBYTE pbFileData,
128
+ DWORD dwDataSize,
129
+ DWORD dwCompression)
130
+ {
131
+ TFileEntry * pFileEntry = hf->pFileEntry;
132
+ ULONGLONG ByteOffset;
133
+ LPBYTE pbCompressed = NULL; // Compressed (target) data
134
+ LPBYTE pbToWrite = hf->pbFileSector; // Data to write to the file
135
+ DWORD dwErrCode = ERROR_SUCCESS;
136
+ int nCompressionLevel; // ADPCM compression level (only used for wave files)
137
+
138
+ // Make sure that the caller won't overrun the previously initiated file size
139
+ assert(hf->dwFilePos + dwDataSize <= pFileEntry->dwFileSize);
140
+ assert(hf->dwSectorCount != 0);
141
+ assert(hf->pbFileSector != NULL);
142
+ if((hf->dwFilePos + dwDataSize) > pFileEntry->dwFileSize)
143
+ return ERROR_DISK_FULL;
144
+
145
+ // Now write all data to the file sector buffer
146
+ if(dwErrCode == ERROR_SUCCESS)
147
+ {
148
+ DWORD dwBytesInSector = hf->dwFilePos % hf->dwSectorSize;
149
+ DWORD dwSectorIndex = hf->dwFilePos / hf->dwSectorSize;
150
+ DWORD dwBytesToCopy;
151
+
152
+ // Process all data.
153
+ while(dwDataSize != 0)
154
+ {
155
+ dwBytesToCopy = dwDataSize;
156
+
157
+ // Check for sector overflow
158
+ if(dwBytesToCopy > (hf->dwSectorSize - dwBytesInSector))
159
+ dwBytesToCopy = (hf->dwSectorSize - dwBytesInSector);
160
+
161
+ // Copy the data to the file sector
162
+ memcpy(hf->pbFileSector + dwBytesInSector, pbFileData, dwBytesToCopy);
163
+ dwBytesInSector += dwBytesToCopy;
164
+ pbFileData += dwBytesToCopy;
165
+ dwDataSize -= dwBytesToCopy;
166
+
167
+ // Update the file position
168
+ hf->dwFilePos += dwBytesToCopy;
169
+
170
+ // If the current sector is full, or if the file is already full,
171
+ // then write the data to the MPQ
172
+ if(dwBytesInSector >= hf->dwSectorSize || hf->dwFilePos >= pFileEntry->dwFileSize)
173
+ {
174
+ // Set the position in the file
175
+ ByteOffset = hf->RawFilePos + pFileEntry->dwCmpSize;
176
+
177
+ // Update MD5 and CRC32 of the file
178
+ if(hf->hctx != NULL)
179
+ md5_process((hash_state *)hf->hctx, hf->pbFileSector, dwBytesInSector);
180
+ hf->dwCrc32 = crc32(hf->dwCrc32, hf->pbFileSector, dwBytesInSector);
181
+
182
+ // Compress the file sector, if needed
183
+ if(pFileEntry->dwFlags & MPQ_FILE_COMPRESS_MASK)
184
+ {
185
+ int nOutBuffer = (int)dwBytesInSector;
186
+ int nInBuffer = (int)dwBytesInSector;
187
+
188
+ // If the file is compressed, allocate buffer for the compressed data.
189
+ // Note that we allocate buffer that is a bit longer than sector size,
190
+ // for case if the compression method performs a buffer overrun
191
+ if(pbCompressed == NULL)
192
+ {
193
+ pbToWrite = pbCompressed = STORM_ALLOC(BYTE, hf->dwSectorSize + 0x100);
194
+ if(pbCompressed == NULL)
195
+ {
196
+ dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
197
+ break;
198
+ }
199
+ }
200
+
201
+ //
202
+ // Note that both SCompImplode and SCompCompress copy data as-is,
203
+ // if they are unable to compress the data.
204
+ //
205
+
206
+ if(pFileEntry->dwFlags & MPQ_FILE_IMPLODE)
207
+ {
208
+ SCompImplode(pbCompressed, &nOutBuffer, hf->pbFileSector, nInBuffer);
209
+ }
210
+
211
+ if(pFileEntry->dwFlags & MPQ_FILE_COMPRESS)
212
+ {
213
+ // If this is the first sector, we need to override the given compression
214
+ // by the first sector compression. This is because the entire sector must
215
+ // be compressed by the same compression.
216
+ //
217
+ // Test case:
218
+ //
219
+ // WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_PKWARE) // Write 0x10 bytes (sector 0)
220
+ // WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_ADPCM_MONO) // Write 0x10 bytes (still sector 0)
221
+ // WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_ADPCM_MONO) // Write 0x10 bytes (still sector 0)
222
+ // WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_ADPCM_MONO) // Write 0x10 bytes (still sector 0)
223
+ dwCompression = (dwSectorIndex == 0) ? hf->dwCompression0 : dwCompression;
224
+
225
+ // If the caller wants ADPCM compression, we will set wave compression level to 4,
226
+ // which corresponds to medium quality
227
+ nCompressionLevel = (dwCompression & MPQ_LOSSY_COMPRESSION_MASK) ? 4 : -1;
228
+ SCompCompress(pbCompressed, &nOutBuffer, hf->pbFileSector, nInBuffer, (unsigned)dwCompression, 0, nCompressionLevel);
229
+ }
230
+
231
+ // Update sector positions
232
+ dwBytesInSector = nOutBuffer;
233
+ if(hf->SectorOffsets != NULL)
234
+ hf->SectorOffsets[dwSectorIndex+1] = hf->SectorOffsets[dwSectorIndex] + dwBytesInSector;
235
+
236
+ // We have to calculate sector CRC, if enabled
237
+ if(hf->SectorChksums != NULL)
238
+ hf->SectorChksums[dwSectorIndex] = adler32(0, pbCompressed, nOutBuffer);
239
+ }
240
+
241
+ // Encrypt the sector, if necessary
242
+ if(pFileEntry->dwFlags & MPQ_FILE_ENCRYPTED)
243
+ {
244
+ BSWAP_ARRAY32_UNSIGNED(pbToWrite, dwBytesInSector);
245
+ EncryptMpqBlock(pbToWrite, dwBytesInSector, hf->dwFileKey + dwSectorIndex);
246
+ BSWAP_ARRAY32_UNSIGNED(pbToWrite, dwBytesInSector);
247
+ }
248
+
249
+ // Do not allow Warcraft III maps to go over 2GB.
250
+ // https://github.com/ladislav-zezula/StormLib/issues/306
251
+ if((ha->dwFlags & MPQ_FLAG_WAR3_MAP) && (ByteOffset + dwBytesInSector) > 0x7FFFFFFF)
252
+ {
253
+ dwErrCode = ERROR_DISK_FULL;
254
+ break;
255
+ }
256
+
257
+ // Write the file sector
258
+ if(!FileStream_Write(ha->pStream, &ByteOffset, pbToWrite, dwBytesInSector))
259
+ {
260
+ dwErrCode = GetLastError();
261
+ break;
262
+ }
263
+
264
+ // Call the compact callback, if any
265
+ if(ha->pfnAddFileCB != NULL)
266
+ ha->pfnAddFileCB(ha->pvAddFileUserData, hf->dwFilePos, hf->dwDataSize, false);
267
+
268
+ // Update the compressed file size
269
+ pFileEntry->dwCmpSize += dwBytesInSector;
270
+ dwBytesInSector = 0;
271
+ dwSectorIndex++;
272
+ }
273
+ }
274
+ }
275
+
276
+ // Cleanup
277
+ if(pbCompressed != NULL)
278
+ STORM_FREE(pbCompressed);
279
+ return dwErrCode;
280
+ }
281
+
282
+ //-----------------------------------------------------------------------------
283
+ // Recrypts file data for file renaming
284
+
285
+ static DWORD RecryptFileData(
286
+ TMPQArchive * ha,
287
+ TMPQFile * hf,
288
+ const char * szFileName,
289
+ const char * szNewFileName)
290
+ {
291
+ ULONGLONG RawFilePos;
292
+ TFileEntry * pFileEntry = hf->pFileEntry;
293
+ DWORD dwBytesToRecrypt = pFileEntry->dwCmpSize;
294
+ DWORD dwOldKey;
295
+ DWORD dwNewKey;
296
+ DWORD dwErrCode = ERROR_SUCCESS;
297
+
298
+ // The file must be encrypted
299
+ assert(pFileEntry->dwFlags & MPQ_FILE_ENCRYPTED);
300
+
301
+ // File decryption key is calculated from the plain name
302
+ szNewFileName = GetPlainFileName(szNewFileName);
303
+ szFileName = GetPlainFileName(szFileName);
304
+
305
+ // Calculate both file keys
306
+ dwOldKey = DecryptFileKey(szFileName, pFileEntry->ByteOffset, pFileEntry->dwFileSize, pFileEntry->dwFlags);
307
+ dwNewKey = DecryptFileKey(szNewFileName, pFileEntry->ByteOffset, pFileEntry->dwFileSize, pFileEntry->dwFlags);
308
+
309
+ // Incase the keys are equal, don't recrypt the file
310
+ if(dwNewKey == dwOldKey)
311
+ return ERROR_SUCCESS;
312
+ hf->dwFileKey = dwOldKey;
313
+
314
+ // Calculate the raw position of the file in the archive
315
+ hf->MpqFilePos = pFileEntry->ByteOffset;
316
+ hf->RawFilePos = ha->MpqPos + hf->MpqFilePos;
317
+
318
+ // Allocate buffer for file transfer
319
+ dwErrCode = AllocateSectorBuffer(hf);
320
+ if(dwErrCode != ERROR_SUCCESS)
321
+ return dwErrCode;
322
+
323
+ // Also allocate buffer for sector offsets
324
+ // Note: Don't load sector checksums, we don't need to recrypt them
325
+ dwErrCode = AllocateSectorOffsets(hf, true);
326
+ if(dwErrCode != ERROR_SUCCESS)
327
+ return dwErrCode;
328
+
329
+ // If we have sector offsets, recrypt these as well
330
+ if(hf->SectorOffsets != NULL)
331
+ {
332
+ // Allocate secondary buffer for sectors copy
333
+ DWORD * SectorOffsetsCopy = STORM_ALLOC(DWORD, hf->SectorOffsets[0] / sizeof(DWORD));
334
+ DWORD dwSectorOffsLen = hf->SectorOffsets[0];
335
+
336
+ if(SectorOffsetsCopy == NULL)
337
+ return ERROR_NOT_ENOUGH_MEMORY;
338
+
339
+ // Recrypt the array of sector offsets
340
+ memcpy(SectorOffsetsCopy, hf->SectorOffsets, dwSectorOffsLen);
341
+ EncryptMpqBlock(SectorOffsetsCopy, dwSectorOffsLen, dwNewKey - 1);
342
+ BSWAP_ARRAY32_UNSIGNED(SectorOffsetsCopy, dwSectorOffsLen);
343
+
344
+ // Write the recrypted array back
345
+ if(!FileStream_Write(ha->pStream, &hf->RawFilePos, SectorOffsetsCopy, dwSectorOffsLen))
346
+ dwErrCode = GetLastError();
347
+ STORM_FREE(SectorOffsetsCopy);
348
+ }
349
+
350
+ // Now we have to recrypt all file sectors. We do it without
351
+ // recompression, because recompression is not necessary in this case
352
+ if(dwErrCode == ERROR_SUCCESS)
353
+ {
354
+ for(DWORD dwSector = 0; dwSector < hf->dwSectorCount; dwSector++)
355
+ {
356
+ DWORD dwRawDataInSector = hf->dwSectorSize;
357
+ DWORD dwRawByteOffset = dwSector * hf->dwSectorSize;
358
+
359
+ // Last sector: If there is not enough bytes remaining in the file, cut the raw size
360
+ if(dwRawDataInSector > dwBytesToRecrypt)
361
+ dwRawDataInSector = dwBytesToRecrypt;
362
+
363
+ // Fix the raw data length if the file is compressed
364
+ if(hf->SectorOffsets != NULL)
365
+ {
366
+ dwRawDataInSector = hf->SectorOffsets[dwSector+1] - hf->SectorOffsets[dwSector];
367
+ dwRawByteOffset = hf->SectorOffsets[dwSector];
368
+ }
369
+
370
+ // Calculate the raw file offset of the file sector
371
+ RawFilePos = CalculateRawSectorOffset(hf, dwRawByteOffset);
372
+
373
+ // Read the file sector
374
+ if(!FileStream_Read(ha->pStream, &RawFilePos, hf->pbFileSector, dwRawDataInSector))
375
+ {
376
+ dwErrCode = GetLastError();
377
+ break;
378
+ }
379
+
380
+ // If necessary, re-encrypt the sector
381
+ // Note: Recompression is not necessary here. Unlike encryption,
382
+ // the compression does not depend on the position of the file in MPQ.
383
+ BSWAP_ARRAY32_UNSIGNED(hf->pbFileSector, dwRawDataInSector);
384
+ DecryptMpqBlock(hf->pbFileSector, dwRawDataInSector, dwOldKey + dwSector);
385
+ EncryptMpqBlock(hf->pbFileSector, dwRawDataInSector, dwNewKey + dwSector);
386
+ BSWAP_ARRAY32_UNSIGNED(hf->pbFileSector, dwRawDataInSector);
387
+
388
+ // Write the sector back
389
+ if(!FileStream_Write(ha->pStream, &RawFilePos, hf->pbFileSector, dwRawDataInSector))
390
+ {
391
+ dwErrCode = GetLastError();
392
+ break;
393
+ }
394
+
395
+ // Decrement number of bytes remaining
396
+ dwBytesToRecrypt -= hf->dwSectorSize;
397
+ }
398
+ }
399
+
400
+ return dwErrCode;
401
+ }
402
+
403
+ //-----------------------------------------------------------------------------
404
+ // Internal support for MPQ modifications
405
+
406
+ DWORD SFileAddFile_Init(
407
+ TMPQArchive * ha,
408
+ const char * szFileName,
409
+ ULONGLONG FileTime,
410
+ DWORD dwFileSize,
411
+ LCID lcFileLocale,
412
+ DWORD dwFlags,
413
+ TMPQFile ** phf)
414
+ {
415
+ TFileEntry * pFileEntry = NULL;
416
+ TMPQFile * hf = NULL; // File structure for newly added file
417
+ DWORD dwHashIndex = HASH_ENTRY_FREE;
418
+ DWORD dwErrCode = ERROR_SUCCESS;
419
+
420
+ //
421
+ // Note: This is an internal function so no validity checks are done.
422
+ // It is the caller's responsibility to make sure that no invalid
423
+ // flags get to this point
424
+ //
425
+
426
+ // Sestor CRC is not allowed with single unit files
427
+ if(dwFlags & MPQ_FILE_SINGLE_UNIT)
428
+ dwFlags &= ~MPQ_FILE_SECTOR_CRC;
429
+
430
+ // Sector CRC is not allowed if the file is not compressed
431
+ if(!(dwFlags & MPQ_FILE_COMPRESS_MASK))
432
+ dwFlags &= ~MPQ_FILE_SECTOR_CRC;
433
+
434
+ // Fix Key is not allowed if the file is not encrypted
435
+ if(!(dwFlags & MPQ_FILE_ENCRYPTED))
436
+ dwFlags &= ~MPQ_FILE_KEY_V2;
437
+
438
+ // If the MPQ is of version 3.0 or higher, we ignore file locale.
439
+ // This is because HET and BET tables have no known support for it
440
+ if(ha->pHeader->wFormatVersion >= MPQ_FORMAT_VERSION_3)
441
+ lcFileLocale = 0;
442
+
443
+ // Allocate the TMPQFile entry for newly added file
444
+ hf = CreateWritableHandle(ha, dwFileSize);
445
+ if(hf == NULL)
446
+ return false;
447
+
448
+ // Allocate file entry in the MPQ
449
+ if(dwErrCode == ERROR_SUCCESS)
450
+ {
451
+ // Check if the file already exists in the archive
452
+ pFileEntry = GetFileEntryExact(ha, szFileName, lcFileLocale, &dwHashIndex);
453
+ if(pFileEntry != NULL)
454
+ {
455
+ if(dwFlags & MPQ_FILE_REPLACEEXISTING)
456
+ InvalidateInternalFiles(ha);
457
+ else
458
+ dwErrCode = ERROR_ALREADY_EXISTS;
459
+ }
460
+ else
461
+ {
462
+ // Attempt to allocate new file entry
463
+ pFileEntry = AllocateFileEntry(ha, szFileName, lcFileLocale, &dwHashIndex);
464
+ if(pFileEntry != NULL)
465
+ InvalidateInternalFiles(ha);
466
+ else
467
+ dwErrCode = ERROR_DISK_FULL;
468
+ }
469
+
470
+ // Set the file entry to the file structure
471
+ hf->pFileEntry = pFileEntry;
472
+ }
473
+
474
+ // Prepare the pointer to hash table entry
475
+ if(dwErrCode == ERROR_SUCCESS && ha->pHashTable != NULL && dwHashIndex < ha->pHeader->dwHashTableSize)
476
+ {
477
+ hf->pHashEntry = ha->pHashTable + dwHashIndex;
478
+ hf->pHashEntry->Locale = SFILE_LOCALE(lcFileLocale);
479
+ hf->pHashEntry->Platform = SFILE_PLATFORM(lcFileLocale);
480
+ hf->pHashEntry->Reserved = 0;
481
+ }
482
+
483
+ // Prepare the file key
484
+ if(dwErrCode == ERROR_SUCCESS && (dwFlags & MPQ_FILE_ENCRYPTED))
485
+ {
486
+ hf->dwFileKey = DecryptFileKey(szFileName, hf->MpqFilePos, dwFileSize, dwFlags);
487
+ if(hf->dwFileKey == 0)
488
+ dwErrCode = ERROR_UNKNOWN_FILE_KEY;
489
+ }
490
+
491
+ // Fill the file entry and TMPQFile structure
492
+ if(dwErrCode == ERROR_SUCCESS)
493
+ {
494
+ // At this point, the file name in the file entry must be set
495
+ assert(pFileEntry->szFileName != NULL);
496
+ assert(_stricmp(pFileEntry->szFileName, szFileName) == 0);
497
+
498
+ dwErrCode = FillWritableHandle(ha, hf, FileTime, dwFileSize, dwFlags);
499
+ }
500
+
501
+ // Free the file handle if failed
502
+ if(dwErrCode != ERROR_SUCCESS && hf != NULL)
503
+ FreeFileHandle(hf);
504
+
505
+ // Give the handle to the caller
506
+ *phf = hf;
507
+ return dwErrCode;
508
+ }
509
+
510
+ DWORD SFileAddFile_Init(
511
+ TMPQArchive * ha,
512
+ TMPQFile * hfSrc,
513
+ TMPQFile ** phf)
514
+ {
515
+ TFileEntry * pFileEntry = NULL;
516
+ TMPQFile * hf = NULL; // File structure for newly added file
517
+ ULONGLONG FileTime = hfSrc->pFileEntry->FileTime;
518
+ DWORD dwFileSize = hfSrc->pFileEntry->dwFileSize;
519
+ DWORD dwFlags = hfSrc->pFileEntry->dwFlags;
520
+ DWORD dwErrCode = ERROR_SUCCESS;
521
+
522
+ // Allocate the TMPQFile entry for newly added file
523
+ hf = CreateWritableHandle(ha, dwFileSize);
524
+ if(hf == NULL)
525
+ dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
526
+
527
+ // We need to keep the file entry index the same like in the source archive
528
+ // This is because multiple hash table entries can point to the same file entry
529
+ if(dwErrCode == ERROR_SUCCESS)
530
+ {
531
+ // Retrieve the file entry for the target file
532
+ pFileEntry = ha->pFileTable + (hfSrc->pFileEntry - hfSrc->ha->pFileTable);
533
+
534
+ // Copy all variables except file name
535
+ if((pFileEntry->dwFlags & MPQ_FILE_EXISTS) == 0)
536
+ {
537
+ pFileEntry[0] = hfSrc->pFileEntry[0];
538
+ pFileEntry->szFileName = NULL;
539
+ }
540
+ else
541
+ dwErrCode = ERROR_ALREADY_EXISTS;
542
+
543
+ // Set the file entry to the file structure
544
+ hf->pFileEntry = pFileEntry;
545
+ }
546
+
547
+ // Prepare the pointer to hash table entry
548
+ if(dwErrCode == ERROR_SUCCESS && ha->pHashTable != NULL && hfSrc->pHashEntry != NULL)
549
+ {
550
+ hf->dwHashIndex = (DWORD)(hfSrc->pHashEntry - hfSrc->ha->pHashTable);
551
+ hf->pHashEntry = ha->pHashTable + hf->dwHashIndex;
552
+ }
553
+
554
+ // Prepare the file key (copy from source file)
555
+ if(dwErrCode == ERROR_SUCCESS && (dwFlags & MPQ_FILE_ENCRYPTED))
556
+ {
557
+ hf->dwFileKey = hfSrc->dwFileKey;
558
+ if(hf->dwFileKey == 0)
559
+ dwErrCode = ERROR_UNKNOWN_FILE_KEY;
560
+ }
561
+
562
+ // Fill the file entry and TMPQFile structure
563
+ if(dwErrCode == ERROR_SUCCESS)
564
+ {
565
+ dwErrCode = FillWritableHandle(ha, hf, FileTime, dwFileSize, dwFlags);
566
+ }
567
+
568
+ // Free the file handle if failed
569
+ if(dwErrCode != ERROR_SUCCESS && hf != NULL)
570
+ FreeFileHandle(hf);
571
+
572
+ // Give the handle to the caller
573
+ *phf = hf;
574
+ return dwErrCode;
575
+ }
576
+
577
+ DWORD SFileAddFile_Write(TMPQFile * hf, const void * pvData, DWORD dwSize, DWORD dwCompression)
578
+ {
579
+ TMPQArchive * ha;
580
+ TFileEntry * pFileEntry;
581
+ DWORD dwErrCode = ERROR_SUCCESS;
582
+
583
+ // Don't bother if the caller gave us zero size
584
+ if(pvData == NULL || dwSize == 0)
585
+ return ERROR_SUCCESS;
586
+
587
+ // Get pointer to the MPQ archive
588
+ pFileEntry = hf->pFileEntry;
589
+ ha = hf->ha;
590
+
591
+ // Allocate file buffers
592
+ if(hf->pbFileSector == NULL)
593
+ {
594
+ ULONGLONG RawFilePos = hf->RawFilePos;
595
+
596
+ // Allocate buffer for file sector
597
+ hf->dwAddFileError = dwErrCode = AllocateSectorBuffer(hf);
598
+ if(dwErrCode != ERROR_SUCCESS)
599
+ return dwErrCode;
600
+
601
+ // Allocate patch info, if the data is patch
602
+ if(hf->pPatchInfo == NULL && IsIncrementalPatchFile(pvData, dwSize, &hf->dwPatchedFileSize))
603
+ {
604
+ // Set the MPQ_FILE_PATCH_FILE flag
605
+ pFileEntry->dwFlags |= MPQ_FILE_PATCH_FILE;
606
+
607
+ // Allocate the patch info
608
+ hf->dwAddFileError = dwErrCode = AllocatePatchInfo(hf, false);
609
+ if(dwErrCode != ERROR_SUCCESS)
610
+ return dwErrCode;
611
+ }
612
+
613
+ // Allocate sector offsets
614
+ if(hf->SectorOffsets == NULL)
615
+ {
616
+ hf->dwAddFileError = dwErrCode = AllocateSectorOffsets(hf, false);
617
+ if(dwErrCode != ERROR_SUCCESS)
618
+ return dwErrCode;
619
+ }
620
+
621
+ // Create array of sector checksums
622
+ if(hf->SectorChksums == NULL && (pFileEntry->dwFlags & MPQ_FILE_SECTOR_CRC))
623
+ {
624
+ hf->dwAddFileError = dwErrCode = AllocateSectorChecksums(hf, false);
625
+ if(dwErrCode != ERROR_SUCCESS)
626
+ return dwErrCode;
627
+ }
628
+
629
+ // Pre-save the patch info, if any
630
+ if(hf->pPatchInfo != NULL)
631
+ {
632
+ if(!FileStream_Write(ha->pStream, &RawFilePos, hf->pPatchInfo, hf->pPatchInfo->dwLength))
633
+ dwErrCode = GetLastError();
634
+
635
+ pFileEntry->dwCmpSize += hf->pPatchInfo->dwLength;
636
+ RawFilePos += hf->pPatchInfo->dwLength;
637
+ }
638
+
639
+ // Pre-save the sector offset table, just to reserve space in the file.
640
+ // Note that we dont need to swap the sector positions, nor encrypt the table
641
+ // at the moment, as it will be written again after writing all file sectors.
642
+ if(hf->SectorOffsets != NULL)
643
+ {
644
+ if(!FileStream_Write(ha->pStream, &RawFilePos, hf->SectorOffsets, hf->SectorOffsets[0]))
645
+ dwErrCode = GetLastError();
646
+
647
+ pFileEntry->dwCmpSize += hf->SectorOffsets[0];
648
+ RawFilePos += hf->SectorOffsets[0];
649
+ }
650
+ }
651
+
652
+ // Write the MPQ data to the file
653
+ if(dwErrCode == ERROR_SUCCESS)
654
+ {
655
+ // Save the first sector compression to the file structure
656
+ // Note that the entire first file sector will be compressed
657
+ // by compression that was passed to the first call of SFileAddFile_Write
658
+ if(hf->dwFilePos == 0)
659
+ hf->dwCompression0 = dwCompression;
660
+
661
+ // Write the data to the MPQ
662
+ dwErrCode = WriteDataToMpqFile(ha, hf, (LPBYTE)pvData, dwSize, dwCompression);
663
+ }
664
+
665
+ // If it succeeded and we wrote all the file data,
666
+ // we need to re-save sector offset table
667
+ if(dwErrCode == ERROR_SUCCESS)
668
+ {
669
+ if(hf->dwFilePos >= pFileEntry->dwFileSize)
670
+ {
671
+ // Finish calculating CRC32
672
+ pFileEntry->dwCrc32 = hf->dwCrc32;
673
+
674
+ // Finish calculating MD5
675
+ if(hf->hctx != NULL)
676
+ md5_done((hash_state *)hf->hctx, pFileEntry->md5);
677
+
678
+ // If we also have sector checksums, write them to the file
679
+ if(hf->SectorChksums != NULL)
680
+ {
681
+ dwErrCode = WriteSectorChecksums(hf);
682
+ }
683
+
684
+ // Now write patch info
685
+ if(hf->pPatchInfo != NULL)
686
+ {
687
+ memcpy(hf->pPatchInfo->md5, pFileEntry->md5, MD5_DIGEST_SIZE);
688
+ hf->pPatchInfo->dwDataSize = pFileEntry->dwFileSize;
689
+ pFileEntry->dwFileSize = hf->dwPatchedFileSize;
690
+ dwErrCode = WritePatchInfo(hf);
691
+ }
692
+
693
+ // Now write sector offsets to the file
694
+ if(hf->SectorOffsets != NULL)
695
+ {
696
+ dwErrCode = WriteSectorOffsets(hf);
697
+ }
698
+
699
+ // Write the MD5 hashes of each file chunk, if required
700
+ if(ha->pHeader->dwRawChunkSize != 0)
701
+ {
702
+ dwErrCode = WriteMpqDataMD5(ha->pStream,
703
+ ha->MpqPos + pFileEntry->ByteOffset,
704
+ hf->pFileEntry->dwCmpSize,
705
+ ha->pHeader->dwRawChunkSize);
706
+ }
707
+ }
708
+ }
709
+
710
+ // Update the archive size
711
+ if((ha->MpqPos + pFileEntry->ByteOffset + pFileEntry->dwCmpSize) > ha->FileSize)
712
+ ha->FileSize = ha->MpqPos + pFileEntry->ByteOffset + pFileEntry->dwCmpSize;
713
+
714
+ // Store the error code from the Write File operation
715
+ hf->dwAddFileError = dwErrCode;
716
+ return dwErrCode;
717
+ }
718
+
719
+ DWORD SFileAddFile_Finish(TMPQFile * hf)
720
+ {
721
+ TMPQArchive * ha = hf->ha;
722
+ TFileEntry * pFileEntry = hf->pFileEntry;
723
+ DWORD dwErrCode = hf->dwAddFileError;
724
+
725
+ // If all previous operations succeeded, we can update the MPQ
726
+ if(dwErrCode == ERROR_SUCCESS)
727
+ {
728
+ // Verify if the caller wrote the file properly
729
+ if(hf->pPatchInfo == NULL)
730
+ {
731
+ assert(pFileEntry != NULL);
732
+ if(hf->dwFilePos != pFileEntry->dwFileSize)
733
+ dwErrCode = ERROR_CAN_NOT_COMPLETE;
734
+ }
735
+ else
736
+ {
737
+ if(hf->dwFilePos != hf->pPatchInfo->dwDataSize)
738
+ dwErrCode = ERROR_CAN_NOT_COMPLETE;
739
+ }
740
+ }
741
+
742
+ // Now we need to recreate the HET table, if exists
743
+ if(dwErrCode == ERROR_SUCCESS && ha->pHetTable != NULL)
744
+ {
745
+ dwErrCode = RebuildHetTable(ha);
746
+ }
747
+
748
+ // Update the block table size
749
+ if(dwErrCode == ERROR_SUCCESS)
750
+ {
751
+ // Call the user callback, if any
752
+ if(ha->pfnAddFileCB != NULL)
753
+ ha->pfnAddFileCB(ha->pvAddFileUserData, hf->dwDataSize, hf->dwDataSize, true);
754
+ }
755
+ else
756
+ {
757
+ // Free the file entry in MPQ tables
758
+ if(pFileEntry != NULL)
759
+ DeleteFileEntry(ha, hf);
760
+ }
761
+
762
+ // Clear the add file callback
763
+ FreeFileHandle(hf);
764
+ return dwErrCode;
765
+ }
766
+
767
+ //-----------------------------------------------------------------------------
768
+ // Adds data as file to the archive
769
+
770
+ bool WINAPI SFileCreateFile(
771
+ HANDLE hMpq,
772
+ const char * szArchivedName,
773
+ ULONGLONG FileTime,
774
+ DWORD dwFileSize,
775
+ LCID lcFileLocale,
776
+ DWORD dwFlags,
777
+ HANDLE * phFile)
778
+ {
779
+ TMPQArchive * ha = (TMPQArchive *)hMpq;
780
+ DWORD dwErrCode = ERROR_SUCCESS;
781
+
782
+ // Check valid parameters
783
+ if(!IsValidMpqHandle(hMpq))
784
+ dwErrCode = ERROR_INVALID_HANDLE;
785
+ if(szArchivedName == NULL || *szArchivedName == 0)
786
+ dwErrCode = ERROR_INVALID_PARAMETER;
787
+ if(phFile == NULL)
788
+ dwErrCode = ERROR_INVALID_PARAMETER;
789
+
790
+ // Don't allow to add file if the MPQ is open for read only
791
+ if(dwErrCode == ERROR_SUCCESS)
792
+ {
793
+ if(ha->dwFlags & MPQ_FLAG_READ_ONLY)
794
+ dwErrCode = ERROR_ACCESS_DENIED;
795
+
796
+ // Don't allow to add a file under pseudo-file name
797
+ if(IsPseudoFileName(szArchivedName, NULL))
798
+ dwErrCode = ERROR_INVALID_PARAMETER;
799
+
800
+ // Don't allow to add any of the internal files
801
+ if(IsInternalMpqFileName(szArchivedName))
802
+ dwErrCode = ERROR_INTERNAL_FILE;
803
+ }
804
+
805
+ // Perform validity check of the MPQ flags
806
+ if(dwErrCode == ERROR_SUCCESS)
807
+ {
808
+ // Mask all unsupported flags out
809
+ dwFlags &= ha->dwValidFileFlags;
810
+
811
+ // Check for valid flag combinations
812
+ if((dwFlags & (MPQ_FILE_IMPLODE | MPQ_FILE_COMPRESS)) == (MPQ_FILE_IMPLODE | MPQ_FILE_COMPRESS))
813
+ dwErrCode = ERROR_INVALID_PARAMETER;
814
+ }
815
+
816
+ // Initiate the add file operation
817
+ if(dwErrCode == ERROR_SUCCESS)
818
+ dwErrCode = SFileAddFile_Init(ha, szArchivedName, FileTime, dwFileSize, lcFileLocale, dwFlags, (TMPQFile **)phFile);
819
+
820
+ // Deal with the errors
821
+ if(dwErrCode != ERROR_SUCCESS)
822
+ SetLastError(dwErrCode);
823
+ return (dwErrCode == ERROR_SUCCESS);
824
+ }
825
+
826
+ bool WINAPI SFileWriteFile(
827
+ HANDLE hFile,
828
+ const void * pvData,
829
+ DWORD dwSize,
830
+ DWORD dwCompression)
831
+ {
832
+ TMPQFile * hf = (TMPQFile *)hFile;
833
+ DWORD dwErrCode = ERROR_SUCCESS;
834
+
835
+ // Check the proper parameters
836
+ if(!IsValidFileHandle(hFile))
837
+ dwErrCode = ERROR_INVALID_HANDLE;
838
+ if(hf->bIsWriteHandle == false)
839
+ dwErrCode = ERROR_INVALID_HANDLE;
840
+
841
+ // Special checks for single unit files
842
+ if(dwErrCode == ERROR_SUCCESS && (hf->pFileEntry->dwFlags & MPQ_FILE_SINGLE_UNIT))
843
+ {
844
+ //
845
+ // Note: Blizzard doesn't support single unit files
846
+ // that are stored as encrypted or imploded. We will allow them here,
847
+ // the calling application must ensure that such flag combination doesn't get here
848
+ //
849
+
850
+ // if(dwFlags & MPQ_FILE_IMPLODE)
851
+ // dwErrCode = ERROR_INVALID_PARAMETER;
852
+ //
853
+ // if(dwFlags & MPQ_FILE_ENCRYPTED)
854
+ // dwErrCode = ERROR_INVALID_PARAMETER;
855
+
856
+ // Lossy compression is not allowed on single unit files
857
+ if(dwCompression & MPQ_LOSSY_COMPRESSION_MASK)
858
+ dwErrCode = ERROR_INVALID_PARAMETER;
859
+ }
860
+
861
+
862
+ // Write the data to the file
863
+ if(dwErrCode == ERROR_SUCCESS)
864
+ dwErrCode = SFileAddFile_Write(hf, pvData, dwSize, dwCompression);
865
+
866
+ // Deal with errors
867
+ if(dwErrCode != ERROR_SUCCESS)
868
+ SetLastError(dwErrCode);
869
+ return (dwErrCode == ERROR_SUCCESS);
870
+ }
871
+
872
+ bool WINAPI SFileFinishFile(HANDLE hFile)
873
+ {
874
+ TMPQFile * hf = (TMPQFile *)hFile;
875
+ DWORD dwErrCode = ERROR_SUCCESS;
876
+
877
+ // Check the proper parameters
878
+ if(!IsValidFileHandle(hFile))
879
+ dwErrCode = ERROR_INVALID_HANDLE;
880
+ if(hf->bIsWriteHandle == false)
881
+ dwErrCode = ERROR_INVALID_HANDLE;
882
+
883
+ // Finish the file
884
+ if(dwErrCode == ERROR_SUCCESS)
885
+ dwErrCode = SFileAddFile_Finish(hf);
886
+
887
+ // Deal with errors
888
+ if(dwErrCode != ERROR_SUCCESS)
889
+ SetLastError(dwErrCode);
890
+ return (dwErrCode == ERROR_SUCCESS);
891
+ }
892
+
893
+ //-----------------------------------------------------------------------------
894
+ // Adds a file to the archive
895
+
896
+ bool WINAPI SFileAddFileEx(
897
+ HANDLE hMpq,
898
+ const TCHAR * szFileName,
899
+ const char * szArchivedName,
900
+ DWORD dwFlags,
901
+ DWORD dwCompression, // Compression of the first sector
902
+ DWORD dwCompressionNext) // Compression of next sectors
903
+ {
904
+ ULONGLONG FileSize = 0;
905
+ ULONGLONG FileTime = 0;
906
+ TFileStream * pStream = NULL;
907
+ TMPQArchive * ha;
908
+ HANDLE hMpqFile = NULL;
909
+ LPBYTE pbFileData = NULL;
910
+ DWORD dwBytesRemaining = 0;
911
+ DWORD dwBytesToRead;
912
+ DWORD dwSectorSize = 0x1000;
913
+ DWORD dwChannels = 0;
914
+ bool bIsAdpcmCompression = false;
915
+ bool bIsFirstSector = true;
916
+ DWORD dwErrCode = ERROR_SUCCESS;
917
+
918
+ // Check parameters
919
+ if(hMpq == NULL || szFileName == NULL || *szFileName == 0 || (ha = IsValidMpqHandle(hMpq)) == NULL)
920
+ {
921
+ SetLastError(ERROR_INVALID_PARAMETER);
922
+ return false;
923
+ }
924
+
925
+ // Open added file
926
+ pStream = FileStream_OpenFile(szFileName, STREAM_FLAG_READ_ONLY | STREAM_PROVIDER_FLAT | BASE_PROVIDER_FILE);
927
+ if(pStream == NULL)
928
+ return false;
929
+
930
+ // Files bigger than 4GB cannot be added to MPQ
931
+ FileStream_GetTime(pStream, &FileTime);
932
+ FileStream_GetSize(pStream, &FileSize);
933
+ if(FileSize >> 32)
934
+ dwErrCode = ERROR_DISK_FULL;
935
+
936
+ // Allocate data buffer for reading from the source file
937
+ if(dwErrCode == ERROR_SUCCESS)
938
+ {
939
+ dwBytesRemaining = (DWORD)FileSize;
940
+ pbFileData = STORM_ALLOC(BYTE, dwSectorSize);
941
+ if(pbFileData == NULL)
942
+ dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
943
+ }
944
+
945
+ // LZMA compression can only be present in MPQ version 2 or higher
946
+ if(dwErrCode == ERROR_SUCCESS)
947
+ {
948
+ if(dwCompression == MPQ_COMPRESSION_LZMA && ha->pHeader->wFormatVersion == MPQ_FORMAT_VERSION_1)
949
+ dwErrCode = ERROR_INVALID_PARAMETER;
950
+ }
951
+
952
+ // Deal with various combination of compressions
953
+ if(dwErrCode == ERROR_SUCCESS)
954
+ {
955
+ // When the compression for next blocks is set to default,
956
+ // we will copy the compression for the first sector
957
+ if(dwCompressionNext == MPQ_COMPRESSION_NEXT_SAME)
958
+ dwCompressionNext = dwCompression;
959
+
960
+ // If the caller wants ADPCM compression, we make sure
961
+ // that the first sector is not compressed with lossy compression
962
+ if(dwCompressionNext & (MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO))
963
+ {
964
+ // The compression of the first file sector must not be ADPCM
965
+ // in order not to corrupt the headers
966
+ if(dwCompression & (MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO))
967
+ dwCompression = MPQ_COMPRESSION_PKWARE;
968
+
969
+ // Remove both flag mono and stereo flags.
970
+ // They will be re-added according to WAVE type
971
+ dwCompressionNext &= ~(MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO);
972
+ bIsAdpcmCompression = true;
973
+ }
974
+
975
+ // Initiate adding file to the MPQ
976
+ if(!SFileCreateFile(hMpq, szArchivedName, FileTime, (DWORD)FileSize, g_lcFileLocale, dwFlags, &hMpqFile))
977
+ dwErrCode = GetLastError();
978
+ }
979
+
980
+ // Write the file data to the MPQ
981
+ while(dwErrCode == ERROR_SUCCESS && dwBytesRemaining != 0)
982
+ {
983
+ // Get the number of bytes remaining in the source file
984
+ dwBytesToRead = dwBytesRemaining;
985
+ if(dwBytesToRead > dwSectorSize)
986
+ dwBytesToRead = dwSectorSize;
987
+
988
+ // Read data from the local file
989
+ if(!FileStream_Read(pStream, NULL, pbFileData, dwBytesToRead))
990
+ {
991
+ dwErrCode = GetLastError();
992
+ break;
993
+ }
994
+
995
+ // If the file being added is a WAVE file, we check number of channels
996
+ if(bIsFirstSector && bIsAdpcmCompression)
997
+ {
998
+ // The file must really be a WAVE file with at least 16 bits per sample,
999
+ // otherwise the ADPCM compression will corrupt it
1000
+ if(IsWaveFile_16BitsPerAdpcmSample(pbFileData, dwBytesToRead, &dwChannels))
1001
+ {
1002
+ // Setup the compression of next sectors according to number of channels
1003
+ dwCompressionNext |= (dwChannels == 1) ? MPQ_COMPRESSION_ADPCM_MONO : MPQ_COMPRESSION_ADPCM_STEREO;
1004
+ }
1005
+ else
1006
+ {
1007
+ // Setup the compression of next sectors to a lossless compression
1008
+ dwCompressionNext = (dwCompression & MPQ_LOSSY_COMPRESSION_MASK) ? MPQ_COMPRESSION_PKWARE : dwCompression;
1009
+ }
1010
+
1011
+ bIsFirstSector = false;
1012
+ }
1013
+
1014
+ // Add the file sectors to the MPQ
1015
+ if(!SFileWriteFile(hMpqFile, pbFileData, dwBytesToRead, dwCompression))
1016
+ {
1017
+ dwErrCode = GetLastError();
1018
+ break;
1019
+ }
1020
+
1021
+ // Set the next data compression
1022
+ dwBytesRemaining -= dwBytesToRead;
1023
+ dwCompression = dwCompressionNext;
1024
+ }
1025
+
1026
+ // Finish the file writing
1027
+ if(hMpqFile != NULL)
1028
+ {
1029
+ if(!SFileFinishFile(hMpqFile))
1030
+ dwErrCode = GetLastError();
1031
+ }
1032
+
1033
+ // Cleanup and exit
1034
+ if(pbFileData != NULL)
1035
+ STORM_FREE(pbFileData);
1036
+ if(pStream != NULL)
1037
+ FileStream_Close(pStream);
1038
+ if(dwErrCode != ERROR_SUCCESS)
1039
+ SetLastError(dwErrCode);
1040
+ return (dwErrCode == ERROR_SUCCESS);
1041
+ }
1042
+
1043
+ // Adds a data file into the archive
1044
+ bool WINAPI SFileAddFile(HANDLE hMpq, const TCHAR * szFileName, const char * szArchivedName, DWORD dwFlags)
1045
+ {
1046
+ return SFileAddFileEx(hMpq,
1047
+ szFileName,
1048
+ szArchivedName,
1049
+ dwFlags,
1050
+ DefaultDataCompression,
1051
+ DefaultDataCompression);
1052
+ }
1053
+
1054
+ // Adds a WAVE file into the archive
1055
+ bool WINAPI SFileAddWave(HANDLE hMpq, const TCHAR * szFileName, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality)
1056
+ {
1057
+ DWORD dwCompression = 0;
1058
+
1059
+ //
1060
+ // Note to wave compression level:
1061
+ // The following conversion table applied:
1062
+ // High quality: WaveCompressionLevel = -1
1063
+ // Medium quality: WaveCompressionLevel = 4
1064
+ // Low quality: WaveCompressionLevel = 2
1065
+ //
1066
+ // Starcraft files are packed as Mono (0x41) on medium quality.
1067
+ // Because this compression is not used anymore, our compression functions
1068
+ // will default to WaveCompressionLevel = 4 when using ADPCM compression
1069
+ //
1070
+
1071
+ // Convert quality to data compression
1072
+ switch(dwQuality)
1073
+ {
1074
+ case MPQ_WAVE_QUALITY_HIGH:
1075
+ // WaveCompressionLevel = -1;
1076
+ dwCompression = MPQ_COMPRESSION_PKWARE;
1077
+ break;
1078
+
1079
+ case MPQ_WAVE_QUALITY_MEDIUM:
1080
+ // WaveCompressionLevel = 4;
1081
+ dwCompression = MPQ_COMPRESSION_ADPCM_STEREO | MPQ_COMPRESSION_HUFFMANN;
1082
+ break;
1083
+
1084
+ case MPQ_WAVE_QUALITY_LOW:
1085
+ // WaveCompressionLevel = 2;
1086
+ dwCompression = MPQ_COMPRESSION_ADPCM_STEREO | MPQ_COMPRESSION_HUFFMANN;
1087
+ break;
1088
+ }
1089
+
1090
+ return SFileAddFileEx(hMpq,
1091
+ szFileName,
1092
+ szArchivedName,
1093
+ dwFlags,
1094
+ MPQ_COMPRESSION_PKWARE, // First sector should be compressed as data
1095
+ dwCompression); // Next sectors should be compressed as WAVE
1096
+ }
1097
+
1098
+ //-----------------------------------------------------------------------------
1099
+ // bool SFileRemoveFile(HANDLE hMpq, char * szFileName)
1100
+ //
1101
+ // This function removes a file from the archive.
1102
+ //
1103
+
1104
+ bool WINAPI SFileRemoveFile(HANDLE hMpq, const char * szFileName, DWORD dwSearchScope)
1105
+ {
1106
+ TMPQArchive * ha = IsValidMpqHandle(hMpq);
1107
+ TMPQFile * hf = NULL;
1108
+ DWORD dwErrCode = ERROR_SUCCESS;
1109
+
1110
+ // Keep compilers happy
1111
+ STORMLIB_UNUSED(dwSearchScope);
1112
+
1113
+ // Check the parameters
1114
+ if(ha == NULL)
1115
+ dwErrCode = ERROR_INVALID_HANDLE;
1116
+ if(szFileName == NULL || *szFileName == 0)
1117
+ dwErrCode = ERROR_INVALID_PARAMETER;
1118
+ if(IsInternalMpqFileName(szFileName))
1119
+ dwErrCode = ERROR_INTERNAL_FILE;
1120
+
1121
+ // Do not allow to remove files from read-only or patched MPQs
1122
+ if(dwErrCode == ERROR_SUCCESS)
1123
+ {
1124
+ if((ha->dwFlags & MPQ_FLAG_READ_ONLY) || (ha->haPatch != NULL))
1125
+ dwErrCode = ERROR_ACCESS_DENIED;
1126
+ }
1127
+
1128
+ // If all checks have passed, we can delete the file from the MPQ
1129
+ if(dwErrCode == ERROR_SUCCESS)
1130
+ {
1131
+ // Open the file from the MPQ
1132
+ if(SFileOpenFileEx(hMpq, szFileName, SFILE_OPEN_BASE_FILE, (HANDLE *)&hf))
1133
+ {
1134
+ // Delete the file entry
1135
+ dwErrCode = DeleteFileEntry(ha, hf);
1136
+ FreeFileHandle(hf);
1137
+ }
1138
+ else
1139
+ dwErrCode = GetLastError();
1140
+ }
1141
+
1142
+ // If the file has been deleted, we need to invalidate
1143
+ // the internal files and recreate HET table
1144
+ if(dwErrCode == ERROR_SUCCESS)
1145
+ {
1146
+ // Invalidate the entries for internal files
1147
+ // After we are done with MPQ changes, we need to re-create them anyway
1148
+ InvalidateInternalFiles(ha);
1149
+
1150
+ //
1151
+ // Don't rebuild HET table now; the file's flags indicate
1152
+ // that it's been deleted, which is enough
1153
+ //
1154
+ }
1155
+
1156
+ // Resolve error and exit
1157
+ if(dwErrCode != ERROR_SUCCESS)
1158
+ SetLastError(dwErrCode);
1159
+ return (dwErrCode == ERROR_SUCCESS);
1160
+ }
1161
+
1162
+ // Renames the file within the archive.
1163
+ bool WINAPI SFileRenameFile(HANDLE hMpq, const char * szFileName, const char * szNewFileName)
1164
+ {
1165
+ TMPQArchive * ha = IsValidMpqHandle(hMpq);
1166
+ TMPQFile * hf;
1167
+ DWORD dwErrCode = ERROR_SUCCESS;
1168
+
1169
+ // Test the valid parameters
1170
+ if(ha == NULL)
1171
+ dwErrCode = ERROR_INVALID_HANDLE;
1172
+ if(szFileName == NULL || *szFileName == 0 || szNewFileName == NULL || *szNewFileName == 0)
1173
+ dwErrCode = ERROR_INVALID_PARAMETER;
1174
+ if(IsInternalMpqFileName(szFileName) || IsInternalMpqFileName(szNewFileName))
1175
+ dwErrCode = ERROR_INTERNAL_FILE;
1176
+
1177
+ // Do not allow to rename files in MPQ open for read only
1178
+ if(dwErrCode == ERROR_SUCCESS)
1179
+ {
1180
+ if(ha->dwFlags & MPQ_FLAG_READ_ONLY)
1181
+ dwErrCode = ERROR_ACCESS_DENIED;
1182
+ }
1183
+
1184
+ // Open the new file. If exists, we don't allow rename operation
1185
+ if(dwErrCode == ERROR_SUCCESS)
1186
+ {
1187
+ if(GetFileEntryLocale(ha, szNewFileName, g_lcFileLocale) != NULL)
1188
+ dwErrCode = ERROR_ALREADY_EXISTS;
1189
+ }
1190
+
1191
+ // Open the file from the MPQ
1192
+ if(dwErrCode == ERROR_SUCCESS)
1193
+ {
1194
+ // Attempt to open the file
1195
+ if(SFileOpenFileEx(hMpq, szFileName, SFILE_OPEN_BASE_FILE, (HANDLE *)&hf))
1196
+ {
1197
+ ULONGLONG RawDataOffs;
1198
+ TFileEntry * pFileEntry = hf->pFileEntry;
1199
+
1200
+ // Invalidate the entries for internal files
1201
+ InvalidateInternalFiles(ha);
1202
+
1203
+ // Rename the file entry in the table
1204
+ dwErrCode = RenameFileEntry(ha, hf, szNewFileName);
1205
+
1206
+ // If the file is encrypted, we have to re-crypt the file content
1207
+ // with the new decryption key
1208
+ if((dwErrCode == ERROR_SUCCESS) && (pFileEntry->dwFlags & MPQ_FILE_ENCRYPTED))
1209
+ {
1210
+ // Recrypt the file data in the MPQ
1211
+ dwErrCode = RecryptFileData(ha, hf, szFileName, szNewFileName);
1212
+
1213
+ // Update the MD5 of the raw block
1214
+ if(dwErrCode == ERROR_SUCCESS && ha->pHeader->dwRawChunkSize != 0)
1215
+ {
1216
+ RawDataOffs = ha->MpqPos + pFileEntry->ByteOffset;
1217
+ WriteMpqDataMD5(ha->pStream,
1218
+ RawDataOffs,
1219
+ pFileEntry->dwCmpSize,
1220
+ ha->pHeader->dwRawChunkSize);
1221
+ }
1222
+ }
1223
+
1224
+ // Free the file handle
1225
+ FreeFileHandle(hf);
1226
+ }
1227
+ else
1228
+ {
1229
+ dwErrCode = GetLastError();
1230
+ }
1231
+ }
1232
+
1233
+ // We also need to rebuild the HET table, if present
1234
+ if(dwErrCode == ERROR_SUCCESS && ha->pHetTable != NULL)
1235
+ dwErrCode = RebuildHetTable(ha);
1236
+
1237
+ // Resolve error and exit
1238
+ if(dwErrCode != ERROR_SUCCESS)
1239
+ SetLastError(dwErrCode);
1240
+ return (dwErrCode == ERROR_SUCCESS);
1241
+ }
1242
+
1243
+ //-----------------------------------------------------------------------------
1244
+ // Sets default data compression for SFileAddFile
1245
+
1246
+ bool WINAPI SFileSetDataCompression(DWORD DataCompression)
1247
+ {
1248
+ unsigned int uValidMask = (MPQ_COMPRESSION_ZLIB | MPQ_COMPRESSION_PKWARE | MPQ_COMPRESSION_BZIP2 | MPQ_COMPRESSION_SPARSE);
1249
+
1250
+ if((DataCompression & uValidMask) != DataCompression)
1251
+ {
1252
+ SetLastError(ERROR_INVALID_PARAMETER);
1253
+ return false;
1254
+ }
1255
+
1256
+ DefaultDataCompression = DataCompression;
1257
+ return true;
1258
+ }
1259
+
1260
+ //-----------------------------------------------------------------------------
1261
+ // Changes locale ID of a file
1262
+
1263
+ bool WINAPI SFileSetFileLocale(HANDLE hFile, LCID lcNewLocale)
1264
+ {
1265
+ TMPQArchive * ha;
1266
+ TFileEntry * pFileEntry;
1267
+ TMPQFile * hf = IsValidFileHandle(hFile);
1268
+
1269
+ // Invalid handle => do nothing
1270
+ if(hf == NULL)
1271
+ {
1272
+ SetLastError(ERROR_INVALID_HANDLE);
1273
+ return false;
1274
+ }
1275
+
1276
+ // Do not allow to rename files in MPQ open for read only
1277
+ ha = hf->ha;
1278
+ if(ha->dwFlags & MPQ_FLAG_READ_ONLY)
1279
+ {
1280
+ SetLastError(ERROR_ACCESS_DENIED);
1281
+ return false;
1282
+ }
1283
+
1284
+ // Do not allow unnamed access
1285
+ if(hf->pFileEntry->szFileName == NULL)
1286
+ {
1287
+ SetLastError(ERROR_CAN_NOT_COMPLETE);
1288
+ return false;
1289
+ }
1290
+
1291
+ // Do not allow to change locale of any internal file
1292
+ if(IsInternalMpqFileName(hf->pFileEntry->szFileName))
1293
+ {
1294
+ SetLastError(ERROR_INTERNAL_FILE);
1295
+ return false;
1296
+ }
1297
+
1298
+ // Do not allow changing file locales if there is no hash table
1299
+ if(hf->pHashEntry == NULL)
1300
+ {
1301
+ SetLastError(ERROR_NOT_SUPPORTED);
1302
+ return false;
1303
+ }
1304
+
1305
+ // We have to check if the file+locale is not already there
1306
+ pFileEntry = GetFileEntryExact(ha, hf->pFileEntry->szFileName, lcNewLocale, NULL);
1307
+ if(pFileEntry != NULL)
1308
+ {
1309
+ SetLastError(ERROR_ALREADY_EXISTS);
1310
+ return false;
1311
+ }
1312
+
1313
+ // Update the locale in the hash table entry
1314
+ hf->pHashEntry->Locale = SFILE_LOCALE(lcNewLocale);
1315
+ hf->pHashEntry->Platform = SFILE_PLATFORM(lcNewLocale);
1316
+ hf->pHashEntry->Reserved = 0;
1317
+ ha->dwFlags |= MPQ_FLAG_CHANGED;
1318
+ return true;
1319
+ }
1320
+
1321
+ //-----------------------------------------------------------------------------
1322
+ // Sets add file callback
1323
+
1324
+ bool WINAPI SFileSetAddFileCallback(HANDLE hMpq, SFILE_ADDFILE_CALLBACK AddFileCB, void * pvUserData)
1325
+ {
1326
+ TMPQArchive * ha = (TMPQArchive *) hMpq;
1327
+
1328
+ if(!IsValidMpqHandle(hMpq))
1329
+ {
1330
+ SetLastError(ERROR_INVALID_HANDLE);
1331
+ return false;
1332
+ }
1333
+
1334
+ ha->pvAddFileUserData = pvUserData;
1335
+ ha->pfnAddFileCB = AddFileCB;
1336
+ return true;
1337
+ }