View Issue Details

IDProjectCategoryView StatusLast Update
0000668Far ManagerCommand Line/Executepublic2008-12-26 12:34
ReporterDenis Assigned Toalexy  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version2.0 
Summary0000668: Far ожидает закрытия запущенного приложения
DescriptionЕсть menu item, в коммандах которого прописано следующее:
svn update >>res.txt
svn log --limit 10 >res_log.txt
res_log.txt
res.txt

При выполнении данной комманды "res_log.txt" Far 2 останавливается и ждёт, когда будет закрыт текстовый редактор с "res_log.txt". Far 1.75 нормально продолжает выполение.
Additional InformationFar 2.0 alpha 1 build 659
TagsNo tags attached.
Build672

Activities

Denis

2008-12-17 14:42

reporter   bugnote:0002182

Можно упростить. Если в Far2 на res_log.txt нажать Enter, то Far2 ждёт закрытия текстового редактора.

Denis

2008-12-17 14:58

reporter   bugnote:0002183

Ещё подробности. Far запущен без плагинов. Нужно зайти куда-нибудь в сеть:
cd \\somepc\\someshare\
После средставми Far'a возвращаемся на родной диск, запускаем "res_log.txt" и Far ждёт закрытия внешнего редкатора.

Denis

2008-12-17 19:03

reporter   bugnote:0002187

Патч под это дело.

2008-12-17 19:03

 

patch.diff (928 bytes)   
Index: registry.cpp
===================================================================
--- registry.cpp	(revision 2293)
+++ registry.cpp	(working copy)
@@ -823,9 +823,14 @@
 {
 	DWORD cbSize = 0;
 
-	int nResult = RegQueryValueExW (
-					hKey,
-					lpwszSubKey,
+  HKEY hKey2 = 0;
+  int nResult = RegOpenKeyEx(hKey, lpwszSubKey, 0, KEY_QUERY_VALUE, &hKey2);
+  if ( nResult != ERROR_SUCCESS )
+    return nResult;
+
+	nResult = RegQueryValueExW (
+					hKey2,
+					L"",
 					NULL,
 					NULL,
 					NULL,
@@ -837,8 +842,8 @@
 		wchar_t *lpwszData = strData.GetBuffer (cbSize/sizeof(wchar_t)+1);
 		DWORD Type=REG_SZ;
 		nResult = RegQueryValueExW (
-				hKey,
-				lpwszSubKey,
+				hKey2,
+				L"",
 				NULL,
 				&Type,
 				(LPBYTE)lpwszData,
@@ -854,6 +859,8 @@
 
 	if ( nResult != ERROR_SUCCESS )
 		strData = lpwszDefault;
+		
+  RegCloseKey(hKey2);
 
 	return nResult;
 }
patch.diff (928 bytes)   

2008-12-17 19:22

 

patch2.diff (1,291 bytes)   
Index: registry.cpp
===================================================================
--- registry.cpp	(revision 2293)
+++ registry.cpp	(working copy)
@@ -823,9 +823,29 @@
 {
 	DWORD cbSize = 0;
 
-	int nResult = RegQueryValueExW (
-					hKey,
-					lpwszSubKey,
+  string sKeyName;
+  string sValueName;
+  
+  const wchar_t* pwszValueName = wcsrchr(lpwszSubKey, L'\\');
+  if (pwszValueName != NULL)
+  {
+    sKeyName = lpwszSubKey;
+    sKeyName.SetLength(sKeyName.GetLength() - wcslen(pwszValueName));
+    sValueName = pwszValueName + 1;
+  }
+  else
+  {
+    sKeyName = lpwszSubKey;
+  }
+  
+  HKEY hKey2 = 0;
+  int nResult = RegOpenKeyEx(hKey, sKeyName, 0, KEY_QUERY_VALUE, &hKey2);
+  if ( nResult != ERROR_SUCCESS )
+    return nResult;
+
+	nResult = RegQueryValueExW (
+					hKey2,
+					sValueName,
 					NULL,
 					NULL,
 					NULL,
@@ -837,8 +857,8 @@
 		wchar_t *lpwszData = strData.GetBuffer (cbSize/sizeof(wchar_t)+1);
 		DWORD Type=REG_SZ;
 		nResult = RegQueryValueExW (
-				hKey,
-				lpwszSubKey,
+				hKey2,
+				sValueName,
 				NULL,
 				&Type,
 				(LPBYTE)lpwszData,
@@ -854,6 +874,8 @@
 
 	if ( nResult != ERROR_SUCCESS )
 		strData = lpwszDefault;
+		
+  RegCloseKey(hKey2);
 
 	return nResult;
 }
patch2.diff (1,291 bytes)   

Denis

2008-12-17 19:22

reporter   bugnote:0002188

Более осмысленный патч.

Denis

2008-12-17 20:07

reporter   bugnote:0002189

Судя по использованию функции, более осмысленен всё-таки первый патч.

alexy

2008-12-19 07:38

administrator   bugnote:0002212

668

Denis

2008-12-19 07:48

reporter   bugnote:0002213

проверено на 668

Denis

2008-12-19 08:55

reporter   bugnote:0002214

Нашёл ещё место, где использовалась RegQueryStringValue не по назначению.

2008-12-19 08:56

 

patch_qview.cpp.diff (1,154 bytes)   
Index: qview.cpp
===================================================================
--- qview.cpp	(revision 2311)
+++ qview.cpp	(working copy)
@@ -357,12 +357,25 @@
   {
     string strValue;
 
-    if ( RegQueryStringValue (HKEY_CLASSES_ROOT, ExtPtr, strValue)==ERROR_SUCCESS)
+    HKEY hKey;
+    if (RegOpenKeyW(HKEY_CLASSES_ROOT,ExtPtr,&hKey)==ERROR_SUCCESS)
     {
-      if (RegQueryStringValue (HKEY_CLASSES_ROOT, strValue,strCurFileType)!=ERROR_SUCCESS)
-        strCurFileType=L"";
+      if (RegQueryStringValue(hKey,L"",strValue,L"")==ERROR_SUCCESS)
+      {
+        HKEY hKey2;
+        if (RegOpenKeyW(HKEY_CLASSES_ROOT,strValue,&hKey2)==ERROR_SUCCESS)
+        {
+          if (RegQueryStringValue(hKey2,L"",strCurFileType,L"")!=ERROR_SUCCESS)
+          {
+            strCurFileType=L"";
+          }
+          RegCloseKey(hKey2);
+        }
+      }
+      RegCloseKey(hKey);
     }
   }
+  
   if (hDirPlugin || ((FileAttr=GetFileAttributesW(strCurFileName))!=INVALID_FILE_ATTRIBUTES && (FileAttr & FILE_ATTRIBUTE_DIRECTORY)))
   {
     // �� �������� ��� ����� �� ��������� � "������� ���������"
patch_qview.cpp.diff (1,154 bytes)   

Denis

2008-12-19 08:56

reporter   bugnote:0002216

Добавил patch_qview.cpp.diff

alexy

2008-12-19 19:48

administrator   bugnote:0002225

672

Issue History

Date Modified Username Field Change
2008-12-17 14:35 Denis New Issue
2008-12-17 14:35 Denis Status new => assigned
2008-12-17 14:35 Denis Assigned To => alexy
2008-12-17 14:42 Denis Note Added: 0002182
2008-12-17 14:58 Denis Note Added: 0002183
2008-12-17 19:03 Denis Note Added: 0002187
2008-12-17 19:03 Denis File Added: patch.diff
2008-12-17 19:22 Denis File Added: patch2.diff
2008-12-17 19:22 Denis Note Added: 0002188
2008-12-17 20:07 Denis Note Added: 0002189
2008-12-19 07:38 alexy Note Added: 0002212
2008-12-19 07:40 alexy Status assigned => feedback
2008-12-19 07:48 Denis Note Added: 0002213
2008-12-19 07:48 Denis Status feedback => resolved
2008-12-19 07:48 Denis Resolution open => fixed
2008-12-19 08:05 alexy Build => 668
2008-12-19 08:05 alexy Status resolved => closed
2008-12-19 08:05 alexy Fixed in Version => 2.0
2008-12-19 08:55 Denis Note Added: 0002214
2008-12-19 08:55 Denis Status closed => assigned
2008-12-19 08:55 Denis Resolution fixed => reopened
2008-12-19 08:56 Denis File Added: patch_qview.cpp.diff
2008-12-19 08:56 Denis Note Added: 0002216
2008-12-19 19:48 alexy Note Added: 0002225
2008-12-19 19:48 alexy Status assigned => feedback
2008-12-26 12:34 alexy Build 668 => 672
2008-12-26 12:34 alexy Status feedback => closed
2008-12-26 12:34 alexy Resolution reopened => fixed