Feature: Let the client report structured failures for MCP tools
Four new client-to-server tokens carry a win32/LSTATUS code when a command fails instead of returning empty data: TOKEN_SERVICE_ERROR (170), TOKEN_FILE_LIST_ERROR (171), TOKEN_REG_ERROR (172) and TOKEN_DOWNLOAD_ERROR (173). They sit on byte values that were unused, so existing numbering is untouched. The three data paths that used to collapse "failed" and "empty" into the same packet now distinguish them: OpenSCManager failures, directory enumeration failures and RegOpenKeyEx failures all report the code that was actually returned, and UploadToRemoteV2 reports why it found no file to transfer before the transfer sub-connection is ever created. Every failure branch still sends the packet the old server expects (TOKEN_FILE_LIST, the empty TOKEN_REG_PATH/KEY pair, the ClientMsg popup), so a new client talking to an old server degrades to exactly today's behaviour instead of timing out. Success paths are byte-for- byte unchanged. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
eaa10cc7d3
commit
315a0855dc
8 files changed
+89
-13
No files matched your search
@@ -60,6 +60,7 @@ RegisterOperation::RegisterOperation(char bToken)
|
||||
}
|
||||
|
||||
ZeroMemory(KeyPath,MAX_PATH);
|
||||
m_lastOpenStatus = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegisterOperation::~RegisterOperation()
|
||||
@@ -73,7 +74,8 @@ char* RegisterOperation::FindPath()
|
||||
char *szBuffer=NULL;
|
||||
HKEY hKey; //注册表返回句柄
|
||||
/*打开注册表 User kdjfjkf\kdjfkdjf\ */
|
||||
if(RegOpenKeyEx(MKEY,KeyPath,0,KEY_READ,&hKey)==ERROR_SUCCESS) { //打开
|
||||
m_lastOpenStatus = RegOpenKeyEx(MKEY,KeyPath,0,KEY_READ,&hKey);
|
||||
if(m_lastOpenStatus==ERROR_SUCCESS) { //打开
|
||||
DWORD dwIndex=0,NameCount,NameMaxLen;
|
||||
DWORD KeySize,KeyCount,KeyMaxLen,MaxDataLen;
|
||||
//这就是枚举了
|
||||
@@ -127,7 +129,8 @@ char* RegisterOperation::FindKey()
|
||||
|
||||
char *szBuffer=NULL;
|
||||
HKEY hKey; //注册表返回句柄
|
||||
if(RegOpenKeyEx(MKEY,KeyPath,0,KEY_READ,&hKey)==ERROR_SUCCESS) { //打开
|
||||
m_lastOpenStatus = RegOpenKeyEx(MKEY,KeyPath,0,KEY_READ,&hKey);
|
||||
if(m_lastOpenStatus==ERROR_SUCCESS) { //打开
|
||||
DWORD dwIndex=0,NameSize,NameCount,NameMaxLen,Type;
|
||||
DWORD KeyCount,KeyMaxLen,DataSize,MaxDataLen;
|
||||
//这就是枚举了
|
||||
|
||||
Reference in new issue
Block a user