Remove MAX_PATH buffersize to support long file path (#69)
This is already reviewed by Pan.
This commit is contained in:
parent
044648a213
commit
135aa12529
|
|
@ -348,7 +348,7 @@ PATH::IsPathUnc(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
STACK_STRU( strTempPath, MAX_PATH );
|
STRU strTempPath;
|
||||||
|
|
||||||
if ( pszPath == NULL || pfIsUnc == NULL )
|
if ( pszPath == NULL || pfIsUnc == NULL )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ SERVER_PROCESS::StartProcess(
|
||||||
LPCWSTR pszRootApplicationPath = NULL;
|
LPCWSTR pszRootApplicationPath = NULL;
|
||||||
BOOL fDebuggerAttachedToChildProcess = FALSE;
|
BOOL fDebuggerAttachedToChildProcess = FALSE;
|
||||||
STRU strFullProcessPath;
|
STRU strFullProcessPath;
|
||||||
|
STRU struRelativePath;
|
||||||
STRU struApplicationId;
|
STRU struApplicationId;
|
||||||
RPC_STATUS rpcStatus;
|
RPC_STATUS rpcStatus;
|
||||||
UUID logUuid;
|
UUID logUuid;
|
||||||
|
|
@ -131,9 +132,10 @@ SERVER_PROCESS::StartProcess(
|
||||||
//
|
//
|
||||||
DWORD dwActualProcessId = 0;
|
DWORD dwActualProcessId = 0;
|
||||||
WCHAR* pszPath = NULL;
|
WCHAR* pszPath = NULL;
|
||||||
WCHAR pszFullPath[_MAX_PATH];
|
WCHAR* pszFullPath = NULL;
|
||||||
LPCWSTR apsz[1];
|
LPCWSTR apsz[1];
|
||||||
PCWSTR pszAppPath = NULL;
|
PCWSTR pszAppPath = NULL;
|
||||||
|
DWORD dwBufferSize = 0;
|
||||||
|
|
||||||
GetStartupInfoW(&startupInfo);
|
GetStartupInfoW(&startupInfo);
|
||||||
|
|
||||||
|
|
@ -299,21 +301,24 @@ SERVER_PROCESS::StartProcess(
|
||||||
if ((wcsstr(pszPath, L":") == NULL) && (wcsstr(pszPath, L"%") == NULL))
|
if ((wcsstr(pszPath, L":") == NULL) && (wcsstr(pszPath, L"%") == NULL))
|
||||||
{
|
{
|
||||||
// let's check whether it is a relative path
|
// let's check whether it is a relative path
|
||||||
WCHAR pszRelativePath[_MAX_PATH];
|
if (FAILED(hr = struRelativePath.Copy(pszRootApplicationPath)) ||
|
||||||
|
FAILED(hr = struRelativePath.Append(L"\\")) ||
|
||||||
if (swprintf_s(pszRelativePath,
|
FAILED(hr = struRelativePath.Append(pszPath)))
|
||||||
_MAX_PATH,
|
|
||||||
L"%s\\%s",
|
|
||||||
pszRootApplicationPath,
|
|
||||||
pszPath) == -1)
|
|
||||||
{
|
{
|
||||||
hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwBufferSize = struRelativePath.QueryCCH() + 1;
|
||||||
|
pszFullPath = new WCHAR[dwBufferSize];
|
||||||
|
if (pszFullPath == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wfullpath(pszFullPath,
|
if (_wfullpath(pszFullPath,
|
||||||
pszRelativePath,
|
struRelativePath.QueryStr(),
|
||||||
_MAX_PATH) == NULL)
|
dwBufferSize) == NULL)
|
||||||
{
|
{
|
||||||
hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
|
hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
@ -828,6 +833,12 @@ Finished:
|
||||||
pszCommandLine = NULL;
|
pszCommandLine = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pszFullPath != NULL)
|
||||||
|
{
|
||||||
|
delete[] pszFullPath;
|
||||||
|
pszFullPath = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(hr) || m_fReady == FALSE)
|
if (FAILED(hr) || m_fReady == FALSE)
|
||||||
{
|
{
|
||||||
if (m_hStdoutHandle != NULL)
|
if (m_hStdoutHandle != NULL)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue