通用是相对的,这里指的是xp和win7(其他版本我没测试过,不要用不要来找我)
#define CMP_FRM COMPRESSION_FORMAT_LZNT1|COMPRESSION_ENGINE_MAXIMUM typedef DWORD(__stdcall *RtlCompressBuffer_Fn)( IN ULONG CompressionFormat, IN PVOID SourceBuffer, IN ULONG SourceBufferLength, OUT PVOID DestinationBuffer, IN ULONG DestinationBufferLength, IN ULONG Unknown, OUT PULONG pDestinationSize, IN PVOID WorkspaceBuffer); typedef DWORD(__stdcall *RtlDecompressBuffer_Fn)( IN ULONG CompressionFormat, OUT PVOID DestinationBuffer, IN ULONG DestinationBufferLength, IN PVOID SourceBuffer, IN ULONG SourceBufferLength, OUT PULONG pDestinationSize); typedef DWORD(__stdcall *RtlGetCompressionWorkSpaceSize_Fn)( IN ULONG CompressionFormat, OUT PULONG pNeededBufferSize, OUT PULONG pUnknown); LPBYTE CompressBuffer(LPBYTE lpIn, int iInLen, int & iOut); LPBYTE DecompressBuffer(LPBYTE lpIn, int iInlen, int & iOut);
static RtlCompressBuffer_Fn compress = NULL; static RtlDecompressBuffer_Fn decompress = NULL; static RtlGetCompressionWorkSpaceSize_Fn getcompressionworkspacesize = NULL; void GetCompressApis() { if (compress && decompress && getcompressionworkspacesize) { return; } static WCHAR wszntdll[] = { L'n', L't', L'd', L'l', L'l', L'.', L'd', L'l', L'l', L'