This commit is contained in:
Wiesław Šoltés 2018-02-21 18:14:31 +01:00
Родитель 64eaeb4332
Коммит 7632eb82f1
1 изменённых файлов: 0 добавлений и 84 удалений

Просмотреть файл

@ -453,90 +453,6 @@ namespace util
// use always + 1 to null-terminate string
_wcstombsz(szAnsi, szUnicode, nLength + 1);
}
public:
static PTCHAR* MyCommandLineToArgv(PTCHAR pszCmdLine, int *pnArgc)
{
BOOLEAN bHaveQuotationMark, bHaveText, bHaveSpace;
ULONG nLength, nArgc, nI, nJ;
PTCHAR *pszArgv;
PTCHAR pszTmpArgv;
TCHAR cNext;
nLength = _tcslen(pszCmdLine);
nI = ((nLength + 2) / 2) * sizeof(PVOID) + sizeof(PVOID);
pszArgv = (PTCHAR *)GlobalAlloc(GMEM_FIXED, nI + (nLength + 2) * sizeof(TCHAR));
pszTmpArgv = (PTCHAR)(((PUCHAR)pszArgv) + nI);
nArgc = nI = nJ = 0;
pszArgv[nArgc] = pszTmpArgv;
bHaveQuotationMark = FALSE;
bHaveText = FALSE;
bHaveSpace = TRUE;
while (cNext = pszCmdLine[nI])
{
if (bHaveQuotationMark)
{
if (cNext == '\"')
{
bHaveQuotationMark = FALSE;
}
else
{
pszTmpArgv[nJ] = cNext;
nJ++;
}
}
else
{
if (cNext == '\"')
{
bHaveQuotationMark = TRUE;
bHaveText = TRUE;
if (bHaveSpace)
{
pszArgv[nArgc] = pszTmpArgv + nJ;
nArgc++;
}
bHaveSpace = FALSE;
}
else if ((cNext == ' ') || (cNext == '\t') || (cNext == '\n') || (cNext == '\r'))
{
if (bHaveText)
{
pszTmpArgv[nJ] = '\0';
nJ++;
}
bHaveText = FALSE;
bHaveSpace = TRUE;
}
else
{
bHaveText = TRUE;
if (bHaveSpace)
{
pszArgv[nArgc] = pszTmpArgv + nJ;
nArgc++;
}
pszTmpArgv[nJ] = cNext;
nJ++;
bHaveSpace = FALSE;
}
}
nI++;
}
pszTmpArgv[nJ] = '\0';
pszArgv[nArgc] = nullptr;
(*pnArgc) = nArgc;
return pszArgv;
}
public:
static bool Unzip2Folder(BSTR lpZipFile, BSTR lpFolder)
{