mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:02:59 +00:00
Search driver files in the same directory as the .inf file
svn path=/trunk/; revision=22086
This commit is contained in:
parent
1afe898112
commit
ed2b9d396c
3 changed files with 62 additions and 26 deletions
|
@ -3287,7 +3287,7 @@ SetupDiInstallClassExW(
|
||||||
SectionName,
|
SectionName,
|
||||||
SPINST_REGISTRY | SPINST_FILES | SPINST_BITREG | SPINST_INIFILES | SPINST_INI2REG,
|
SPINST_REGISTRY | SPINST_FILES | SPINST_BITREG | SPINST_INIFILES | SPINST_INI2REG,
|
||||||
hRootKey,
|
hRootKey,
|
||||||
NULL, /* SourceRootPath */
|
NULL, /* FIXME: SourceRootPath */
|
||||||
!(Flags & DI_NOVCP) && (Flags & DI_FORCECOPY) ? SP_COPY_FORCE_IN_USE : 0, /* CopyFlags */
|
!(Flags & DI_NOVCP) && (Flags & DI_FORCECOPY) ? SP_COPY_FORCE_IN_USE : 0, /* CopyFlags */
|
||||||
SetupDefaultQueueCallbackW,
|
SetupDefaultQueueCallbackW,
|
||||||
callback_context,
|
callback_context,
|
||||||
|
@ -5639,6 +5639,49 @@ done:
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct InfFileDetails *
|
||||||
|
CreateInfFileDetails(
|
||||||
|
IN LPCWSTR InfFileName)
|
||||||
|
{
|
||||||
|
struct InfFileDetails *details;
|
||||||
|
PWCHAR last;
|
||||||
|
DWORD Needed;
|
||||||
|
|
||||||
|
last = strrchrW(InfFileName, '\\');
|
||||||
|
Needed = FIELD_OFFSET(struct InfFileDetails, szData)
|
||||||
|
+ strlenW(InfFileName) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||||
|
if (last != NULL)
|
||||||
|
Needed += (last - InfFileName) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||||
|
|
||||||
|
details = HeapAlloc(GetProcessHeap(), 0, Needed);
|
||||||
|
if (!details)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(details, 0, Needed);
|
||||||
|
if (last)
|
||||||
|
{
|
||||||
|
details->DirectoryName = details->szData;
|
||||||
|
details->FullInfFileName = &details->szData[last - InfFileName + 1];
|
||||||
|
strncpyW(details->DirectoryName, InfFileName, last - InfFileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
details->FullInfFileName = details->szData;
|
||||||
|
strcpyW(details->FullInfFileName, InfFileName);
|
||||||
|
ReferenceInfFile(details);
|
||||||
|
details->hInf = SetupOpenInfFileW(InfFileName, NULL, INF_STYLE_WIN4, NULL);
|
||||||
|
if (details->hInf == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, details);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
DPRINT1("FullInfFileName %S\n", details->FullInfFileName);
|
||||||
|
DPRINT1("DirectoryName %S\n", details->DirectoryName);
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiBuildDriverInfoList (SETUPAPI.@)
|
* SetupDiBuildDriverInfoList (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
|
@ -5803,23 +5846,9 @@ SetupDiBuildDriverInfoList(
|
||||||
strcpyW(pFullFilename, filename);
|
strcpyW(pFullFilename, filename);
|
||||||
TRACE("Opening file %s\n", debugstr_w(FullInfFileName));
|
TRACE("Opening file %s\n", debugstr_w(FullInfFileName));
|
||||||
|
|
||||||
currentInfFileDetails = HeapAlloc(
|
currentInfFileDetails = CreateInfFileDetails(FullInfFileName);
|
||||||
GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
FIELD_OFFSET(struct InfFileDetails, FullInfFileName) + strlenW(FullInfFileName) * sizeof(WCHAR) + sizeof(UNICODE_NULL));
|
|
||||||
if (!currentInfFileDetails)
|
if (!currentInfFileDetails)
|
||||||
continue;
|
continue;
|
||||||
memset(currentInfFileDetails, 0, sizeof(struct InfFileDetails));
|
|
||||||
strcpyW(currentInfFileDetails->FullInfFileName, FullInfFileName);
|
|
||||||
|
|
||||||
currentInfFileDetails->hInf = SetupOpenInfFileW(FullInfFileName, NULL, INF_STYLE_WIN4, NULL);
|
|
||||||
ReferenceInfFile(currentInfFileDetails);
|
|
||||||
if (currentInfFileDetails->hInf == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, currentInfFileDetails);
|
|
||||||
currentInfFileDetails = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GetVersionInformationFromInfFile(
|
if (!GetVersionInformationFromInfFile(
|
||||||
currentInfFileDetails->hInf,
|
currentInfFileDetails->hInf,
|
||||||
|
@ -5828,8 +5857,7 @@ SetupDiBuildDriverInfoList(
|
||||||
&DriverDate,
|
&DriverDate,
|
||||||
&DriverVersion))
|
&DriverVersion))
|
||||||
{
|
{
|
||||||
SetupCloseInfFile(currentInfFileDetails->hInf);
|
DereferenceInfFile(currentInfFileDetails);
|
||||||
HeapFree(GetProcessHeap(), 0, currentInfFileDetails->hInf);
|
|
||||||
currentInfFileDetails = NULL;
|
currentInfFileDetails = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -7378,7 +7406,7 @@ SetupDiInstallDriverFiles(
|
||||||
}
|
}
|
||||||
ret = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
ret = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
||||||
SelectedDriver->InfFileDetails->hInf, SectionName,
|
SelectedDriver->InfFileDetails->hInf, SectionName,
|
||||||
SPINST_FILES, NULL, NULL, SP_COPY_NEWER,
|
SPINST_FILES, NULL, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
|
||||||
InstallMsgHandler, InstallMsgHandlerContext,
|
InstallMsgHandler, InstallMsgHandlerContext,
|
||||||
DeviceInfoSet, DeviceInfoData);
|
DeviceInfoSet, DeviceInfoData);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -7388,7 +7416,7 @@ SetupDiInstallDriverFiles(
|
||||||
lstrcatW(SectionName, DotCoInstallers);
|
lstrcatW(SectionName, DotCoInstallers);
|
||||||
ret = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
ret = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
||||||
SelectedDriver->InfFileDetails->hInf, SectionName,
|
SelectedDriver->InfFileDetails->hInf, SectionName,
|
||||||
SPINST_FILES, NULL, NULL, SP_COPY_NEWER,
|
SPINST_FILES, NULL, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
|
||||||
InstallMsgHandler, InstallMsgHandlerContext,
|
InstallMsgHandler, InstallMsgHandlerContext,
|
||||||
DeviceInfoSet, DeviceInfoData);
|
DeviceInfoSet, DeviceInfoData);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -7485,7 +7513,7 @@ SetupDiRegisterCoDeviceInstallers(
|
||||||
}
|
}
|
||||||
Result = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
Result = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
||||||
SelectedDriver->InfFileDetails->hInf, SectionName,
|
SelectedDriver->InfFileDetails->hInf, SectionName,
|
||||||
DoAction, hKey, NULL, SP_COPY_NEWER,
|
DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
|
||||||
SetupDefaultQueueCallback, Context,
|
SetupDefaultQueueCallback, Context,
|
||||||
DeviceInfoSet, DeviceInfoData);
|
DeviceInfoSet, DeviceInfoData);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
|
@ -7792,7 +7820,7 @@ SetupDiInstallDevice(
|
||||||
pSectionName = &SectionName[strlenW(SectionName)];
|
pSectionName = &SectionName[strlenW(SectionName)];
|
||||||
|
|
||||||
/* Get information from [Version] section */
|
/* Get information from [Version] section */
|
||||||
if (!SetupDiGetINFClassW(SelectedDriver->Details.InfFileName, &ClassGuid, ClassName, MAX_CLASS_NAME_LEN, &RequiredSize))
|
if (!SetupDiGetINFClassW(SelectedDriver->InfFileDetails->FullInfFileName, &ClassGuid, ClassName, MAX_CLASS_NAME_LEN, &RequiredSize))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
/* Format ClassGuid to a string */
|
/* Format ClassGuid to a string */
|
||||||
if (UuidToStringW((UUID*)&ClassGuid, &lpGuidString) != RPC_S_OK)
|
if (UuidToStringW((UUID*)&ClassGuid, &lpGuidString) != RPC_S_OK)
|
||||||
|
@ -7834,7 +7862,7 @@ SetupDiInstallDevice(
|
||||||
*pSectionName = '\0';
|
*pSectionName = '\0';
|
||||||
Result = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
Result = SetupInstallFromInfSectionW(InstallParams.hwndParent,
|
||||||
SelectedDriver->InfFileDetails->hInf, SectionName,
|
SelectedDriver->InfFileDetails->hInf, SectionName,
|
||||||
DoAction, hKey, NULL, SP_COPY_NEWER,
|
DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
|
||||||
SetupDefaultQueueCallback, Context,
|
SetupDefaultQueueCallback, Context,
|
||||||
DeviceInfoSet, DeviceInfoData);
|
DeviceInfoSet, DeviceInfoData);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
|
|
|
@ -121,7 +121,7 @@ static BOOL copy_files_callback( HINF hinf, PCWSTR field, void *arg )
|
||||||
struct files_callback_info *info = arg;
|
struct files_callback_info *info = arg;
|
||||||
|
|
||||||
if (field[0] == '@') /* special case: copy single file */
|
if (field[0] == '@') /* special case: copy single file */
|
||||||
SetupQueueDefaultCopyW( info->queue, info->layout, info->src_root, NULL, field, info->copy_flags );
|
SetupQueueDefaultCopyW( info->queue, info->layout, info->src_root, NULL, &field[1], info->copy_flags );
|
||||||
else
|
else
|
||||||
SetupQueueCopySectionW( info->queue, info->src_root, info->layout, hinf, field, info->copy_flags );
|
SetupQueueCopySectionW( info->queue, info->src_root, info->layout, hinf, field, info->copy_flags );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -72,8 +72,16 @@ struct InfFileDetails
|
||||||
HINF hInf;
|
HINF hInf;
|
||||||
LONG References;
|
LONG References;
|
||||||
|
|
||||||
/* May contain no directory if the file is already in %SYSTEMROOT%\Inf */
|
/* Contains the directory name of the .inf file. This field may
|
||||||
WCHAR FullInfFileName[ANYSIZE_ARRAY];
|
* be NULL if the file is already in %SYSTEMROOT%\Inf.
|
||||||
|
* Points into szData at then end of the structure */
|
||||||
|
PCWSTR DirectoryName;
|
||||||
|
/* Contains the full file name of the .inf file. However, the directory
|
||||||
|
* part may be missing if the file is already in %SYSTEMROOT%\Inf.
|
||||||
|
* Points into szData at then end of the structure */
|
||||||
|
PCWSTR FullInfFileName;
|
||||||
|
|
||||||
|
WCHAR szData[ANYSIZE_ARRAY];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */
|
struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue