Feature: add a remote file hash query for the file manager
Add COMMAND_FILE_HASH/TOKEN_FILE_HASH (182/183) and the CLIENT_CAP_FILE_HASH capability so the server can ask a client for a single file's exact size, mtime and SHA-256 without transferring it. This is the P2 half of the double-click preview design; old clients do not advertise the capability and are skipped by the caller. Windows hashes with BCrypt through the existing VerifyV2 helper; Unix and Android stream Sha256 while reading. Both clamp the peer-supplied maxBytes to FILE_PREVIEW_MAX_BYTES, echo the original request path bytes for correlation, and return TOO_LARGE without reading the file. The Unix loop also verifies the bytes hashed match stat() so a file changed mid-read reports an error instead of a mismatched hash. No existing command changes; the new values are explicit and the four DefaultCaps branches advertise the capability. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
b44935270a
commit
e39b9d1ed5
5 files changed
+263
No files matched your search
@@ -57,6 +57,9 @@ private:
|
||||
int SendToken(BYTE bToken);
|
||||
UINT SendListError(DWORD dwErr); // 列目录失败的结构化回报(TOKEN_FILE_LIST_ERROR + win32 码)
|
||||
void SendDownloadError(DWORD dwErr); // 下载无可用文件的结构化回报(TOKEN_DOWNLOAD_ERROR + win32 码)
|
||||
void HandleFileHash(LPBYTE lpBuffer, UINT nSize); // COMMAND_FILE_HASH:返回大小/mtime/SHA-256
|
||||
void SendFileHashResponse(uint32_t status, uint32_t err, uint64_t size,
|
||||
uint64_t mtimeMs, const BYTE* sha, const std::string& pathOrig);
|
||||
|
||||
void CreateLocalRecvFile(LPBYTE lpBuffer);
|
||||
void SetTransferMode(LPBYTE lpBuffer);
|
||||
|
||||
Reference in new issue
Block a user