setupapi: Implement SetupGetSourceInfo{A,W}.

This commit is contained in:
Hans Leidekker 2006-11-14 15:16:04 +01:00 committed by Alexandre Julliard
parent 167323e6f8
commit ae64a62241
4 changed files with 100 additions and 24 deletions

View File

@ -425,3 +425,94 @@ BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR
} }
return TRUE; 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;
}

View File

@ -417,8 +417,8 @@
@ stdcall SetupGetSourceFileLocationW(ptr ptr wstr ptr ptr long ptr) @ stdcall SetupGetSourceFileLocationW(ptr ptr wstr ptr ptr long ptr)
@ stub SetupGetSourceFileSizeA @ stub SetupGetSourceFileSizeA
@ stub SetupGetSourceFileSizeW @ stub SetupGetSourceFileSizeW
@ stdcall SetupGetSourceInfoA(ptr long long str long ptr) @ stdcall SetupGetSourceInfoA(ptr long long ptr long ptr)
@ stdcall SetupGetSourceInfoW(ptr long long wstr long ptr) @ stdcall SetupGetSourceInfoW(ptr long long ptr long ptr)
@ stdcall SetupGetStringFieldA(ptr long ptr long ptr) @ stdcall SetupGetStringFieldA(ptr long ptr long ptr)
@ stdcall SetupGetStringFieldW(ptr long ptr long ptr) @ stdcall SetupGetStringFieldW(ptr long ptr long ptr)
@ stub SetupGetTargetPathA @ stub SetupGetTargetPathA

View File

@ -139,28 +139,6 @@ BOOL WINAPI SetupCopyOEMInfW(PCWSTR sourceinffile, PCWSTR sourcemedialoc,
return FALSE; return FALSE;
} }
/***********************************************************************
* 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.@) * SetupInitializeFileLogW(SETUPAPI.@)
*/ */

View File

@ -692,6 +692,10 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PFILEPATHS)
#define LogSevFatalError 0x00000003 #define LogSevFatalError 0x00000003
#define LogSevMaximum 0x00000004 #define LogSevMaximum 0x00000004
#define SRCINFO_PATH 1
#define SRCINFO_TAGFILE 2
#define SRCINFO_DESCRIPTION 3
LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3); LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst); DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
DWORD WINAPI CaptureStringArg(PCWSTR 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 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 ); 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) #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 SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer, DWORD size, PDWORD required );
BOOL WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, PDWORD required ); BOOL WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer, DWORD size, PDWORD required );
#define SetupGetStringField WINELIB_NAME_AW(SetupGetStringField) #define SetupGetStringField WINELIB_NAME_AW(SetupGetStringField)