mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Allow very long path names for .inf files by using a dynamic buffer
Check return code of GetFullPathNameW svn path=/trunk/; revision=18780
This commit is contained in:
parent
7dd5d44a29
commit
ae16fd8e66
1 changed files with 17 additions and 2 deletions
|
@ -4204,6 +4204,7 @@ SetupDiBuildDriverInfoList(
|
||||||
WCHAR ManufacturerSection[LINE_LEN + 1];
|
WCHAR ManufacturerSection[LINE_LEN + 1];
|
||||||
LPWSTR HardwareIDs = NULL;
|
LPWSTR HardwareIDs = NULL;
|
||||||
LPWSTR CompatibleIDs = NULL;
|
LPWSTR CompatibleIDs = NULL;
|
||||||
|
LPWSTR FullInfFileName = NULL;
|
||||||
FILETIME DriverDate;
|
FILETIME DriverDate;
|
||||||
DWORDLONG DriverVersion = 0;
|
DWORDLONG DriverVersion = 0;
|
||||||
DWORD RequiredSize;
|
DWORD RequiredSize;
|
||||||
|
@ -4325,18 +4326,31 @@ SetupDiBuildDriverInfoList(
|
||||||
if (Result)
|
if (Result)
|
||||||
{
|
{
|
||||||
LPCWSTR filename;
|
LPCWSTR filename;
|
||||||
WCHAR FullInfFileName[MAX_PATH];
|
|
||||||
LPWSTR pFullFilename;
|
LPWSTR pFullFilename;
|
||||||
|
|
||||||
if (*InstallParams.DriverPath)
|
if (*InstallParams.DriverPath)
|
||||||
{
|
{
|
||||||
GetFullPathNameW(InstallParams.DriverPath, MAX_PATH, FullInfFileName, &pFullFilename);
|
DWORD len;
|
||||||
|
len = GetFullPathNameW(InstallParams.DriverPath, 0, NULL, NULL);
|
||||||
|
if (len == 0)
|
||||||
|
goto done;
|
||||||
|
FullInfFileName = HeapAlloc(GetProcessHeap(), 0, len + MAX_PATH);
|
||||||
|
if (!FullInfFileName)
|
||||||
|
goto done;
|
||||||
|
len = GetFullPathNameW(InstallParams.DriverPath, len, FullInfFileName, NULL);
|
||||||
|
if (len == 0)
|
||||||
|
goto done;
|
||||||
if (*FullInfFileName && FullInfFileName[wcslen(FullInfFileName) - 1] != '\\')
|
if (*FullInfFileName && FullInfFileName[wcslen(FullInfFileName) - 1] != '\\')
|
||||||
wcscat(FullInfFileName, L"\\");
|
wcscat(FullInfFileName, L"\\");
|
||||||
pFullFilename = &FullInfFileName[wcslen(FullInfFileName)];
|
pFullFilename = &FullInfFileName[wcslen(FullInfFileName)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
FullInfFileName = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
|
||||||
|
if (!FullInfFileName)
|
||||||
|
goto done;
|
||||||
pFullFilename = &FullInfFileName[0];
|
pFullFilename = &FullInfFileName[0];
|
||||||
|
}
|
||||||
|
|
||||||
for (filename = (LPCWSTR)Buffer; *filename; filename += wcslen(filename) + 1)
|
for (filename = (LPCWSTR)Buffer; *filename; filename += wcslen(filename) + 1)
|
||||||
{
|
{
|
||||||
|
@ -4565,6 +4579,7 @@ done:
|
||||||
HeapFree(GetProcessHeap(), 0, ManufacturerName);
|
HeapFree(GetProcessHeap(), 0, ManufacturerName);
|
||||||
HeapFree(GetProcessHeap(), 0, HardwareIDs);
|
HeapFree(GetProcessHeap(), 0, HardwareIDs);
|
||||||
HeapFree(GetProcessHeap(), 0, CompatibleIDs);
|
HeapFree(GetProcessHeap(), 0, CompatibleIDs);
|
||||||
|
HeapFree(GetProcessHeap(), 0, FullInfFileName);
|
||||||
if (currentInfFileDetails)
|
if (currentInfFileDetails)
|
||||||
DereferenceInfFile(currentInfFileDetails);
|
DereferenceInfFile(currentInfFileDetails);
|
||||||
HeapFree(GetProcessHeap(), 0, Buffer);
|
HeapFree(GetProcessHeap(), 0, Buffer);
|
||||||
|
|
Loading…
Reference in a new issue