* FastLZ: 修改加载库

This commit is contained in:
Sunny 2023-02-12 13:48:30 +08:00
parent 5a5d806bc2
commit a932af940f
2 changed files with 23 additions and 2 deletions

View File

@ -129,6 +129,7 @@ namespace Sunny.UI
/// <returns>压缩结果</returns>
public static byte[] Compress(byte[] input, int begin, int length)
{
CheckFastLZDll();
byte[] output = new byte[Math.Max(length * 2, 66)];
fixed (void* pSrc1 = &input[begin])
fixed (void* pSrc2 = output)
@ -150,6 +151,7 @@ namespace Sunny.UI
/// <returns>压缩结果</returns>
public static byte[] Compress(FastLZCompressionLevel level, byte[] input, int begin, int length)
{
CheckFastLZDll();
byte[] output = new byte[Math.Max(length * 2, 66)];
fixed (void* pSrc1 = &input[begin])
fixed (void* pSrc2 = output)
@ -171,6 +173,7 @@ namespace Sunny.UI
/// <returns>解压缩结果</returns>
public static byte[] Decompress(byte[] input, int begin, int length, int maxout)
{
CheckFastLZDll();
byte[] output = new byte[maxout + 66];
fixed (byte* pSrc1 = &input[begin])
fixed (byte* pSrc2 = output)
@ -198,6 +201,7 @@ namespace Sunny.UI
/// <returns>压缩结果</returns>
public static byte[] CompressEx(byte[] input, int begin, int length, DateTime dateTime, int index)
{
CheckFastLZDll();
byte[] result = CompressEx(input, begin, length);
if (result.Length > 0)
{
@ -221,6 +225,7 @@ namespace Sunny.UI
/// <returns>压缩结果</returns>
public static byte[] CompressEx(byte[] input, int begin, int length)
{
CheckFastLZDll();
byte[] result = new byte[0];
if (begin + length > input.Length) return result;
byte[] output = new byte[Math.Max(length * 2, 66)];
@ -257,6 +262,7 @@ namespace Sunny.UI
/// <returns>解压缩结果</returns>
public static byte[] DecompressEx(byte[] input, int begin, int length)
{
CheckFastLZDll();
byte[] result = new byte[0];
if (input.Length <= 2 + ExHeadAllLength + ExTailAllLength) return result;
if (begin + length > input.Length) return result;
@ -287,6 +293,7 @@ namespace Sunny.UI
/// <returns>解压缩结果</returns>
public static byte[] DecompressEx(byte[] input, int begin, int length, out DateTime datetime, out int index)
{
CheckFastLZDll();
byte[] result = DecompressEx(input, begin, length);
datetime = Jan1st1970;
@ -300,8 +307,11 @@ namespace Sunny.UI
return result;
}
private static bool FileExist = false;
public static bool CheckFastLZDll()
{
if (FileExist) return true;
if (File.Exists(DirEx.CurrentDir() + "FastLZx86.dll") && File.Exists(DirEx.CurrentDir() + "FastLZx64.dll")) return true;
try
@ -314,7 +324,8 @@ namespace Sunny.UI
return false;
}
return File.Exists(DirEx.CurrentDir() + "FastLZx86.dll") && File.Exists(DirEx.CurrentDir() + "FastLZx64.dll");
FileExist = File.Exists(DirEx.CurrentDir() + "FastLZx86.dll") && File.Exists(DirEx.CurrentDir() + "FastLZx64.dll");
return FileExist;
}
/// <summary>

View File

@ -1521,7 +1521,17 @@ namespace Sunny.UI.Win32
public const int DOMAIN_GROUP_RID_USERS = 0x201;
public const int DOMAIN_USER_RID_ADMIN = 0x1F4;
public const int DOMAIN_USER_RID_GUEST = 0x1F5;
public const int DONT_RESOLVE_DLL_REFERENCES = 0x1;
public const int DONT_RESOLVE_DLL_REFERENCES = 0x00000001;
public const int LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x00000010;
public const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
public const int LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040;
public const int LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020;
public const int LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x00000200;
public const int LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000;
public const int LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x00000100;
public const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;
public const int LOAD_LIBRARY_SEARCH_USER_DIRS = 0x00000400;
public const int LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008;
public const int DOUBLE_CLICK = 0x2;
public const int DRIVE_CDROM = 5;
public const int DRIVE_FIXED = 3;