setupapi: Add SetupDiGetActualSectionToInstallExA/W.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49130 Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1e32463a45
commit
9a044007cc
|
@ -1845,18 +1845,18 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO devinfo, SP_DEVINFO_DATA *devic
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiGetActualSectionToInstallA (SETUPAPI.@)
|
* SetupDiGetActualSectionToInstallExA (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetupDiGetActualSectionToInstallA(HINF hinf, const char *section,
|
BOOL WINAPI SetupDiGetActualSectionToInstallExA(HINF hinf, const char *section, SP_ALTPLATFORM_INFO *altplatform,
|
||||||
char *section_ext, DWORD size, DWORD *needed, char **extptr)
|
char *section_ext, DWORD size, DWORD *needed, char **extptr, void *reserved)
|
||||||
{
|
{
|
||||||
WCHAR sectionW[LINE_LEN], section_extW[LINE_LEN], *extptrW;
|
WCHAR sectionW[LINE_LEN], section_extW[LINE_LEN], *extptrW;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, section, -1, sectionW, ARRAY_SIZE(sectionW));
|
MultiByteToWideChar(CP_ACP, 0, section, -1, sectionW, ARRAY_SIZE(sectionW));
|
||||||
|
|
||||||
ret = SetupDiGetActualSectionToInstallW(hinf, sectionW, section_extW,
|
ret = SetupDiGetActualSectionToInstallExW(hinf, sectionW, altplatform, section_extW,
|
||||||
ARRAY_SIZE(section_extW), NULL, &extptrW);
|
ARRAY_SIZE(section_extW), NULL, &extptrW, reserved);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
if (needed)
|
if (needed)
|
||||||
|
@ -1879,72 +1879,93 @@ BOOL WINAPI SetupDiGetActualSectionToInstallA(HINF hinf, const char *section,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiGetActualSectionToInstallW (SETUPAPI.@)
|
* SetupDiGetActualSectionToInstallA (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetupDiGetActualSectionToInstallW(
|
BOOL WINAPI SetupDiGetActualSectionToInstallA(HINF hinf, const char *section, char *section_ext,
|
||||||
HINF InfHandle,
|
DWORD size, DWORD *needed, char **extptr)
|
||||||
PCWSTR InfSectionName,
|
|
||||||
PWSTR InfSectionWithExt,
|
|
||||||
DWORD InfSectionWithExtSize,
|
|
||||||
PDWORD RequiredSize,
|
|
||||||
PWSTR *Extension)
|
|
||||||
{
|
{
|
||||||
WCHAR szBuffer[MAX_PATH];
|
return SetupDiGetActualSectionToInstallExA(hinf, section, NULL, section_ext, size,
|
||||||
DWORD dwLength;
|
needed, extptr, NULL);
|
||||||
DWORD dwFullLength;
|
}
|
||||||
LONG lLineCount = -1;
|
|
||||||
|
|
||||||
lstrcpyW(szBuffer, InfSectionName);
|
/***********************************************************************
|
||||||
dwLength = lstrlenW(szBuffer);
|
* SetupDiGetActualSectionToInstallExW (SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI SetupDiGetActualSectionToInstallExW(HINF hinf, const WCHAR *section, SP_ALTPLATFORM_INFO *altplatform,
|
||||||
|
WCHAR *section_ext, DWORD size, DWORD *needed, WCHAR **extptr, void *reserved)
|
||||||
|
{
|
||||||
|
WCHAR buffer[MAX_PATH];
|
||||||
|
DWORD len;
|
||||||
|
DWORD full_len;
|
||||||
|
LONG line_count = -1;
|
||||||
|
|
||||||
|
TRACE("hinf %p, section %s, altplatform %p, ext %p, size %d, needed %p, extptr %p, reserved %p.\n",
|
||||||
|
hinf, debugstr_w(section), altplatform, section_ext, size, needed, extptr, reserved);
|
||||||
|
|
||||||
|
if (altplatform)
|
||||||
|
FIXME("SP_ALTPLATFORM_INFO unsupported\n");
|
||||||
|
|
||||||
|
lstrcpyW(buffer, section);
|
||||||
|
len = lstrlenW(buffer);
|
||||||
|
|
||||||
if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||||
{
|
{
|
||||||
/* Test section name with '.NTx86' extension */
|
/* Test section name with '.NTx86' extension */
|
||||||
lstrcpyW(&szBuffer[dwLength], NtPlatformExtension);
|
lstrcpyW(&buffer[len], NtPlatformExtension);
|
||||||
lLineCount = SetupGetLineCountW(InfHandle, szBuffer);
|
line_count = SetupGetLineCountW(hinf, buffer);
|
||||||
|
|
||||||
if (lLineCount == -1)
|
if (line_count == -1)
|
||||||
{
|
{
|
||||||
/* Test section name with '.NT' extension */
|
/* Test section name with '.NT' extension */
|
||||||
lstrcpyW(&szBuffer[dwLength], NtExtension);
|
lstrcpyW(&buffer[len], NtExtension);
|
||||||
lLineCount = SetupGetLineCountW(InfHandle, szBuffer);
|
line_count = SetupGetLineCountW(hinf, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Test section name with '.Win' extension */
|
/* Test section name with '.Win' extension */
|
||||||
lstrcpyW(&szBuffer[dwLength], WinExtension);
|
lstrcpyW(&buffer[len], WinExtension);
|
||||||
lLineCount = SetupGetLineCountW(InfHandle, szBuffer);
|
line_count = SetupGetLineCountW(hinf, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lLineCount == -1)
|
if (line_count == -1)
|
||||||
szBuffer[dwLength] = 0;
|
buffer[len] = 0;
|
||||||
|
|
||||||
dwFullLength = lstrlenW(szBuffer);
|
full_len = lstrlenW(buffer);
|
||||||
|
|
||||||
if (InfSectionWithExt != NULL && InfSectionWithExtSize != 0)
|
if (section_ext != NULL && size != 0)
|
||||||
{
|
{
|
||||||
if (InfSectionWithExtSize < (dwFullLength + 1))
|
if (size < (full_len + 1))
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
lstrcpyW(InfSectionWithExt, szBuffer);
|
lstrcpyW(section_ext, buffer);
|
||||||
if (Extension != NULL)
|
if (extptr != NULL)
|
||||||
{
|
{
|
||||||
*Extension = (dwLength == dwFullLength) ? NULL : &InfSectionWithExt[dwLength];
|
*extptr = (len == full_len) ? NULL : §ion_ext[len];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RequiredSize != NULL)
|
if (needed != NULL)
|
||||||
{
|
{
|
||||||
*RequiredSize = dwFullLength + 1;
|
*needed = full_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetupDiGetActualSectionToInstallW (SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF hinf, const WCHAR *section, WCHAR *section_ext,
|
||||||
|
DWORD size, DWORD *needed, WCHAR **extptr)
|
||||||
|
{
|
||||||
|
return SetupDiGetActualSectionToInstallExW(hinf, section, NULL, section_ext, size,
|
||||||
|
needed, extptr, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiGetClassDescriptionA (SETUPAPI.@)
|
* SetupDiGetClassDescriptionA (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -316,6 +316,8 @@
|
||||||
@ stdcall SetupDiEnumDriverInfoA(ptr ptr long long ptr)
|
@ stdcall SetupDiEnumDriverInfoA(ptr ptr long long ptr)
|
||||||
@ stdcall SetupDiEnumDriverInfoW(ptr ptr long long ptr)
|
@ stdcall SetupDiEnumDriverInfoW(ptr ptr long long ptr)
|
||||||
@ stdcall SetupDiGetActualSectionToInstallA(long str str long ptr ptr)
|
@ stdcall SetupDiGetActualSectionToInstallA(long str str long ptr ptr)
|
||||||
|
@ stdcall SetupDiGetActualSectionToInstallExA(long str ptr str long ptr ptr ptr)
|
||||||
|
@ stdcall SetupDiGetActualSectionToInstallExW(long wstr ptr wstr long ptr ptr ptr)
|
||||||
@ stdcall SetupDiGetActualSectionToInstallW(long wstr wstr long ptr ptr)
|
@ stdcall SetupDiGetActualSectionToInstallW(long wstr wstr long ptr ptr)
|
||||||
@ stdcall SetupDiGetClassBitmapIndex(ptr ptr)
|
@ stdcall SetupDiGetClassBitmapIndex(ptr ptr)
|
||||||
@ stdcall SetupDiGetClassDescriptionA(ptr str long ptr)
|
@ stdcall SetupDiGetClassDescriptionA(ptr str long ptr)
|
||||||
|
|
Loading…
Reference in New Issue