Skip to content

Commit

Permalink
翻译补丁中遗漏的内容
Browse files Browse the repository at this point in the history
  • Loading branch information
larryli committed Feb 14, 2024
1 parent e51e29b commit a58adfb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions windows/pageant.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ DWORD errorShow(const char* pcErrText, const char* pcErrParam) {
errorCode = GetLastError();
ltoa(errorCode, pcBuf, 10);

strcpy(pcMessage, "Error: ");
strcpy(pcMessage, "错误: ");
strcat(pcMessage, pcErrText);
strcat(pcMessage, "\n");

if (pcErrParam) {
strcat(pcMessage, pcErrParam);
strcat(pcMessage, "\n");
}
strcat(pcMessage, "Error code: ");
strcat(pcMessage, "错误代码: ");
strcat(pcMessage, pcBuf);

/* JK: get parent-window and show */
hwRParent = GetActiveWindow();
if (hwRParent != NULL) { hwRParent = GetLastActivePopup(hwRParent); }

if (MessageBox(hwRParent, pcMessage, "Error", MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION) == 0) {
if (MessageBox(hwRParent, pcMessage, "错误", MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION) == 0) {
/* JK: this is really bad -> just ignore */
return 0;
}
Expand Down Expand Up @@ -1063,7 +1063,7 @@ static void update_sessions(void)
/* at first ExpandEnvironmentStrings */
if (0 == ExpandEnvironmentStrings(p2, pcBuf, MAX_PATH)) {
/* JK: failure -> revert back - but it ussualy won't work, so report error to user! */
errorShow("Unable to ExpandEnvironmentStrings for session path", p2);
errorShow("无法从会话路径中展开环境字符串", p2);
strncpy(pcBuf, p2, strlen(p2));
}

Expand Down
34 changes: 17 additions & 17 deletions windows/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ DWORD errorShow(const char* pcErrText, const char* pcErrParam) {
errorCode = GetLastError();
ltoa(errorCode, pcBuf, 10);

strcpy(pcMessage, "Error: ");
strcpy(pcMessage, "错误: ");
strcat(pcMessage, pcErrText);
strcat(pcMessage, "\n");

if (pcErrParam) {
strcat(pcMessage, pcErrParam);
strcat(pcMessage, "\n");
}
strcat(pcMessage, "Error code: ");
strcat(pcMessage, "错误代码: ");
strcat(pcMessage, pcBuf);

/* JK: get parent-window and show */
hwRParent = GetActiveWindow();
if (hwRParent != NULL) { hwRParent = GetLastActivePopup(hwRParent);}

if (MessageBox(hwRParent, pcMessage, "Error", MB_OK|MB_APPLMODAL|MB_ICONEXCLAMATION) == 0) {
if (MessageBox(hwRParent, pcMessage, "错误", MB_OK|MB_APPLMODAL|MB_ICONEXCLAMATION) == 0) {
/* JK: this is really bad -> just ignore */
return 0;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ char* joinPath(char* pcDest, char* pcMain, char* pcSuf) {
/* at first ExpandEnvironmentStrings */
if (0 == ExpandEnvironmentStrings(pcSuf, pcBuf, MAX_PATH)) {
/* JK: failure -> revert back - but it usually won't work, so report error to user! */
errorShow("Unable to ExpandEnvironmentStrings for session path", pcSuf);
errorShow("无法从会话路径中展开环境字符串", pcSuf);
strncpy(pcBuf, pcSuf, strlen(pcSuf));
}
/* now ExpandEnvironmentStringsForUser - only on win2000Pro and above */
Expand Down Expand Up @@ -273,7 +273,7 @@ int loadPath() {

if (!ReadFile(hFile, fileCont, fileSize, &bytesRead, NULL))
{
errorShow("Unable to read configuration file, falling back to defaults", NULL);
errorShow("无法读取配置文件,回滚到默认设置", NULL);
/* JK: default values are already there and clean-up at end */
}
else {
Expand Down Expand Up @@ -756,7 +756,7 @@ char *read_setting_s(settings_r *handle, const char *key)
/* JK: at first ExpandEnvironmentStrings */
if (0 == ExpandEnvironmentStrings(p2, buffer, size)) {
/* JK: failure -> revert back - but it usually won't work, so report error to user! */
errorShow("Unable to ExpandEnvironmentStrings for session path", p2);
errorShow("无法从会话路径中展开环境字符串", p2);
strncpy(p2, buffer, strlen(p2));
}
sfree(p);
Expand Down Expand Up @@ -1244,11 +1244,11 @@ int check_stored_host_key(const char *hostname, int port,
else { /* key matched OK in registry */
/* JK: matching key found in registry -> warn user, ask what to do */
p = snewn(256, char);
userMB = MessageBox(NULL, "Host key is cached but in registry. "
"Do you want to move it to file? \n\n"
"Yes \t-> Move (delete key in registry)\n"
"No \t-> Copy (keep key in registry)\n"
"Cancel \t-> nothing will be done\n", "Security risk", MB_YESNOCANCEL|MB_ICONWARNING);
userMB = MessageBox(NULL, "主机密钥缓存在注册表中。"
"需要将其移动到文件中么?\n\n"
" \t-> 移动 (从注册表中删除密钥)\n"
" \t-> 复制 (在注册表中保留密钥)\n"
"取消 \t-> 不做任何操作\n", "安全警告", MB_YESNOCANCEL|MB_ICONWARNING);

if ((userMB == IDYES) || (userMB == IDNO)) {
/* JK: save key to file */
Expand All @@ -1266,12 +1266,12 @@ int check_stored_host_key(const char *hostname, int port,
hFile = CreateFile(p, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

if (hFile == INVALID_HANDLE_VALUE) {
errorShow("Unable to create file (key won't be deleted from registry)", p);
errorShow("无法创建文件 (密钥不会从注册表中删除)", p);
userMB = IDNO;
}
else {
if (!WriteFile(hFile, key, strlen(key), &bytesRW, NULL)) {
errorShow("Unable to save key to file (key won't be deleted from registry)", NULL);
errorShow("无法保存密钥文件 (密钥不会从注册表中删除)", NULL);
userMB = IDNO;
}
CloseHandle(hFile);
Expand All @@ -1282,7 +1282,7 @@ int check_stored_host_key(const char *hostname, int port,
if (userMB == IDYES) {
/* delete from registry */
if (RegDeleteValue(rkey, regname) != ERROR_SUCCESS) {
errorShow("Unable to delete registry value", regname);
errorShow("无法删除注册表中的值", regname);
}
}
/* JK: else (Cancel) -> nothing to be done right now */
Expand Down Expand Up @@ -1722,7 +1722,7 @@ static int transform_jumplist_registry

if (!ReadFile(hFile, fileCont, fileSize, &bytesRW, NULL))
{
errorShow("Unable to load jumplist file", jumplistpath);
errorShow("无法载入 jumplist 文件", jumplistpath);
sfree(fileCont);
return JUMPLISTREG_ERROR_KEYOPENCREATE_FAILURE;
}
Expand Down Expand Up @@ -1772,11 +1772,11 @@ static int transform_jumplist_registry

hFile = CreateFile(jumplistpath , GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if (hFile == INVALID_HANDLE_VALUE) {
errorShow("Unable to open file for writing", jumplistpath );
errorShow("无法打开文件用于保存", jumplistpath );
return JUMPLISTREG_ERROR_VALUEWRITE_FAILURE;
}
if (! WriteFile( (HANDLE) hFile, new_value, value_length, &bytesRW, NULL)) {
errorShow("Unable to save jumplist", jumplistpath);
errorShow("无法保存 jumplist", jumplistpath);
return JUMPLISTREG_ERROR_VALUEWRITE_FAILURE;
/* JK: memory should be freed here - fixme */
}
Expand Down

0 comments on commit a58adfb

Please sign in to comment.