View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000755 | Plugins | ProcList | public | 2009-02-24 13:28 | 2009-06-02 20:09 |
| Reporter | IlyaS | Assigned To | alexy | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.75 | ||||
| Fixed in Version | 2.0 | ||||
| Summary | 0000755: Proclist ограничивает Command Line процессов | ||||
| Description | При просмотре информации выполняемого процесса F3/F4/F5 строка Command Line ограничена 256 символами. Windows 2000 SP4, Far 1.75 b2527, Far 2.0 b768 | ||||
| Additional Information | Например, start cmd /k dir "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Documents and Settings" "C:\Program Files" При просмотре процесса параметр "C:\Program Files" не отображается в Command Line. | ||||
| Tags | No tags attached. | ||||
|
|
Предлагаю некий вариант решения, см. патч. Пропатченный proclist выводит в просмотрщике все 8191 символов командной строки. |
|
2009-03-12 20:05
|
proclist.diff (5,388 bytes)
Index: Proclist.hpp
===================================================================
--- Proclist.hpp (revision 2704)
+++ Proclist.hpp (working copy)
@@ -46,6 +46,7 @@
#define Max(x,y) (((x)>(y)) ? (x):(y))
#define MAX_CMDLINE 512 // Max length of displayed process's cmd line
+#define MAX_CMDLINE_XP 8192 // Max length of displayed process's cmd line on XP
#define NPANELMODES 10 // Number of panel modes
#define MAX_MODE_STR 80 // Max length of panel mode string and width string
#define MAX_CUSTOM_COLS 20 // Max number of custom cols in any panel mode
@@ -240,6 +241,7 @@
#define OUT_CVT(pp) __chk_wca(pp)
#endif
+void GetProcessCommandLine(HANDLE hProcess,TCHAR *pCommandLine);
void GetOpenProcessDataNT(HANDLE hProcess, TCHAR* pProcessName=0, DWORD cbProcessName=0,
TCHAR* pFullPath=0, DWORD cbFullPath=0, TCHAR* pCommandLine=0, DWORD cbCommandLine=0,
TCHAR** ppEnvStrings=0, CURDIR_STR_TYPE** pCurDir=0);
Index: Pclass.cpp
===================================================================
--- Pclass.cpp (revision 2704)
+++ Pclass.cpp (working copy)
@@ -670,13 +670,32 @@
if (NT && !*HostName) // local only
{
- if (*((ProcessDataNT*)pdata)->CommandLine)
- fprintf(InfoFile, _T("\n%s:\n%s\n"), GetMsg(MCommandLine), OUT_STRING(((ProcessDataNT*)pdata)->CommandLine));
-
DebugToken token;
hProcess = OpenProcessForced(&token, PROCESS_QUERY_INFORMATION|PROCESS_VM_READ|READ_CONTROL,pdata->dwPID);
if(hProcess) {
+ if (*((ProcessDataNT*)pdata)->CommandLine) {
+ const int PRINT_LEN = 512;
+ TCHAR sCmdLine[MAX_CMDLINE_XP];
+ TCHAR sPrintBuf[PRINT_LEN+1];
+ TCHAR *pCmdLine = sCmdLine;
+ int bCmdLineLen;
+ int bPrintBufLen;
+ GetProcessCommandLine(hProcess, sCmdLine);
+ fprintf(InfoFile, _T("\n%s:\n"), GetMsg(MCommandLine));
+ //���� ������ sCmdLine �� 512 ��������
+ //(���� ������ �������, �� ���� ������ �� ~1000 �������)
+ bCmdLineLen = lstrlenW(sCmdLine);
+ while (bCmdLineLen>0) {
+ bPrintBufLen = min(bCmdLineLen, PRINT_LEN);
+ memcpy(sPrintBuf, pCmdLine, bPrintBufLen*sizeof(TCHAR));
+ sPrintBuf[bPrintBufLen] = 0;
+ fprintf(InfoFile, _T("%s"), OUT_STRING(sPrintBuf));
+ pCmdLine += PRINT_LEN;
+ bCmdLineLen -= PRINT_LEN;
+ }
+ fprintf(InfoFile, _T("\n"));
+ }
PrintNTCurDirAndEnv(InfoFile, hProcess, Opt.ExportEnvironment);
CloseHandle(hProcess);
}
Index: PlistNT.cpp
===================================================================
--- PlistNT.cpp (revision 2704)
+++ PlistNT.cpp (working copy)
@@ -359,6 +359,36 @@
return TRUE;
}
+/**
+ * ��������� ����� �������� ������,
+ * � ������ �� GetOpenProcessDataNT, ��������� ������ ������ �� ������ � ������.
+ * \param hProcess - ����� �������
+ * \param pCommandLine - ����� ��� ������ �������� MAX_CMDLINE_XP ��������
+ */
+void GetProcessCommandLine(HANDLE hProcess,TCHAR *pCommandLine) {
+ ModuleData Data={0};
+ char *pEnd;
+ PROCESS_PARAMETERS* pProcessParams = 0;
+ if(GetInternalProcessData(hProcess, &Data, pProcessParams, pEnd))
+ {
+ UNICODE_STRING pCmd;
+ if(ReadProcessMemory(hProcess, &pProcessParams->CommandLine, &pCmd, sizeof(pCmd), 0)) {
+ SIZE_T sz = min(MAX_CMDLINE_XP, (ULONG)pCmd.Length/2) + 1;
+ Array<WCHAR> sCommandLine((DWORD)sz);
+ *pCommandLine = 0;
+ if(ReadProcessMemory(hProcess, pCmd.Buffer, sCommandLine, 2*(sz-1),0)) {
+ sCommandLine[sz-1] = 0;
+#ifndef UNICODE
+ WideCharToMultiByte(CP_ACP, 0, sCommandLine, -1,
+ pCommandLine, MAX_CMDLINE_XP, NULL, NULL);
+#else
+ lstrcpyn(pCommandLine, sCommandLine, MAX_CMDLINE_XP);
+#endif
+ }
+ }
+ }
+}
+
void GetOpenProcessDataNT(HANDLE hProcess, TCHAR* pProcessName, DWORD cbProcessName,
TCHAR* pFullPath, DWORD cbFullPath, TCHAR* pCommandLine, DWORD cbCommandLine,
TCHAR** ppEnvStrings, CURDIR_STR_TYPE** psCurDir)
@@ -397,10 +427,10 @@
if(pCommandLine) {
UNICODE_STRING pCmd;
if(ReadProcessMemory(hProcess, &pProcessParams->CommandLine, &pCmd, sizeof(pCmd), 0)) {
- SIZE_T sz = min(cbCommandLine, (ULONG)pCmd.Length + 1);
+ SIZE_T sz = min(cbCommandLine, (ULONG)pCmd.Length/2) + 1;
Array<WCHAR> sCommandLine((DWORD)sz);
*pCommandLine = 0;
- if(ReadProcessMemory(hProcess, pCmd.Buffer, sCommandLine, sz-1,0)) {
+ if(ReadProcessMemory(hProcess, pCmd.Buffer, sCommandLine, 2*(sz-1),0)) {
sCommandLine[sz-1] = 0;
#ifndef UNICODE
WideCharToMultiByte(CP_ACP, 0, sCommandLine, -1,
|
|
|
build 151 |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-02-24 13:28 | IlyaS | New Issue | |
| 2009-03-12 20:05 | igor_yudincev | Note Added: 0002773 | |
| 2009-03-12 20:05 | igor_yudincev | File Added: proclist.diff | |
| 2009-03-29 16:08 | alexy | Status | new => assigned |
| 2009-03-29 16:08 | alexy | Assigned To | => alexy |
| 2009-05-31 12:42 | alexy | Note Added: 0003381 | |
| 2009-05-31 12:42 | alexy | Status | assigned => feedback |
| 2009-06-02 20:09 | alexy | Status | feedback => closed |
| 2009-06-02 20:09 | alexy | Resolution | open => fixed |
| 2009-06-02 20:09 | alexy | Fixed in Version | => 2.0 |