Commit ae64a622 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

setupapi: Implement SetupGetSourceInfo{A,W}.

parent 167323e6
......@@ -425,3 +425,94 @@ BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR
}
return TRUE;
}
/***********************************************************************
* SetupGetSourceInfoA (SETUPAPI.@)
*/
BOOL WINAPI SetupGetSourceInfoA( HINF hinf, UINT source_id, UINT info,
PSTR buffer, DWORD buffer_size, LPDWORD required_size )
{
BOOL ret = FALSE;
WCHAR *bufferW = NULL;
DWORD required;
INT size;
TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
required_size);
if (!SetupGetSourceInfoW( hinf, source_id, info, NULL, 0, &required ))
return FALSE;
if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
return FALSE;
if (!SetupGetSourceInfoW( hinf, source_id, info, bufferW, required, NULL ))
goto done;
size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
if (required_size) *required_size = size;
if (buffer)
{
if (buffer_size >= size)
WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, buffer_size, NULL, NULL );
else
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
goto done;
}
}
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, bufferW );
return ret;
}
/***********************************************************************
* SetupGetSourceInfoW (SETUPAPI.@)
*/
BOOL WINAPI SetupGetSourceInfoW( HINF hinf, UINT source_id, UINT info,
PWSTR buffer, DWORD buffer_size, LPDWORD required_size )
{
INFCONTEXT ctx;
WCHAR source_id_str[11];
static const WCHAR fmt[] = {'%','d',0};
DWORD index;
TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
required_size);
sprintfW( source_id_str, fmt, source_id );
if (!SetupFindFirstLineW( hinf, source_disks_names_platform, source_id_str, &ctx ) &&
!SetupFindFirstLineW( hinf, source_disks_names, source_id_str, &ctx ))
return FALSE;
switch (info)
{
case SRCINFO_PATH: index = 4; break;
case SRCINFO_TAGFILE: index = 2; break;
case SRCINFO_DESCRIPTION: index = 1; break;
default:
WARN("unknown info level: %d\n", info);
return FALSE;
}
if (SetupGetStringFieldW( &ctx, index, buffer, buffer_size, required_size ))
return TRUE;
if (required_size) *required_size = 1;
if (buffer)
{
if (buffer_size >= 1) buffer[0] = 0;
else
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return FALSE;
}
}
return TRUE;
}
......@@ -417,8 +417,8 @@
@ stdcall SetupGetSourceFileLocationW(ptr ptr wstr ptr ptr long ptr)
@ stub SetupGetSourceFileSizeA
@ stub SetupGetSourceFileSizeW
@ stdcall SetupGetSourceInfoA(ptr long long str long ptr)
@ stdcall SetupGetSourceInfoW(ptr long long wstr long ptr)
@ stdcall SetupGetSourceInfoA(ptr long long ptr long ptr)
@ stdcall SetupGetSourceInfoW(ptr long long ptr long ptr)
@ stdcall SetupGetStringFieldA(ptr long ptr long ptr)
@ stdcall SetupGetStringFieldW(ptr long ptr long ptr)
@ stub SetupGetTargetPathA
......
......@@ -140,28 +140,6 @@ BOOL WINAPI SetupCopyOEMInfW(PCWSTR sourceinffile, PCWSTR sourcemedialoc,
}
/***********************************************************************
* SetupGetSourceInfoA (SETUPAPI.@)
*/
BOOL WINAPI SetupGetSourceInfoA(HINF InfHandle, UINT SourceId, UINT InfoDesired,
PSTR ReturnBuffer, DWORD ReturnBufferSize, LPDWORD RequiredSize)
{
FIXME("(%p, %d, %d, %p, %d, %p): stub\n", InfHandle, SourceId, InfoDesired,
ReturnBuffer, ReturnBufferSize, RequiredSize);
return FALSE;
}
/***********************************************************************
* SetupGetSourceInfoW (SETUPAPI.@)
*/
BOOL WINAPI SetupGetSourceInfoW(HINF InfHandle, UINT SourceId, UINT InfoDesired,
PWSTR ReturnBuffer, DWORD ReturnBufferSize, LPDWORD RequiredSize)
{
FIXME("(%p, %d, %d, %p, %d, %p): stub\n", InfHandle, SourceId, InfoDesired,
ReturnBuffer, ReturnBufferSize, RequiredSize);
return FALSE;
}
/***********************************************************************
* SetupInitializeFileLogW(SETUPAPI.@)
*/
HANDLE WINAPI SetupInitializeFileLogW(LPWSTR LogFileName, DWORD Flags)
......
......@@ -692,6 +692,10 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PFILEPATHS)
#define LogSevFatalError 0x00000003
#define LogSevMaximum 0x00000004
#define SRCINFO_PATH 1
#define SRCINFO_TAGFILE 2
#define SRCINFO_DESCRIPTION 3
LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
......@@ -817,6 +821,9 @@ BOOL WINAPI SetupGetMultiSzFieldW( PINFCONTEXT context, DWORD index, PWSTR b
BOOL WINAPI SetupGetSourceFileLocationA( HINF hinf, PINFCONTEXT context, PCSTR filename, PUINT source_id, PSTR buffer, DWORD buffer_size, PDWORD required_size );
BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR filename, PUINT source_id, PWSTR buffer, DWORD buffer_size, PDWORD required_size );
#define SetupGetSourceFileLocation WINELIB_NAME_AW(SetupGetSourceFileLocation)
BOOL WINAPI SetupGetSourceInfoA( HINF hinf, UINT source_id, UINT info, PSTR buffer, DWORD buffer_size, LPDWORD required_size );
BOOL WINAPI SetupGetSourceInfoW( HINF hinf, UINT source_id, UINT info, PWSTR buffer, DWORD buffer_size, LPDWORD required_size );
#define SetupGetSourceInfo WINELIB_NAME_AW(SetupGetSourceInfo)
BOOL WINAPI SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, PDWORD required );
BOOL WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, PDWORD required );
#define SetupGetStringField WINELIB_NAME_AW(SetupGetStringField)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment