setupapi: Implement SetupCopyOEMInf{A,W}.

This commit is contained in:
Hans Leidekker 2007-02-20 12:03:23 +01:00 committed by Alexandre Julliard
parent 0e59ff2592
commit 939e8e4ce2
3 changed files with 92 additions and 27 deletions

View File

@ -877,3 +877,92 @@ void WINAPI AssertFail(LPCSTR lpFile, UINT uLine, LPCSTR lpMessage)
{
FIXME("%s %u %s\n", lpFile, uLine, lpMessage);
}
/***********************************************************************
* SetupCopyOEMInfA (SETUPAPI.@)
*/
BOOL WINAPI SetupCopyOEMInfA( PCSTR source, PCSTR location,
DWORD media_type, DWORD style, PSTR dest,
DWORD buffer_size, PDWORD required_size, PSTR *component )
{
BOOL ret = FALSE;
WCHAR destW[MAX_PATH], *sourceW = NULL, *locationW = NULL;
INT size = sizeof(destW);
TRACE("%s, %s, %d, %d, %p, %d, %p, %p\n", debugstr_a(source), debugstr_a(location),
media_type, style, dest, buffer_size, required_size, component);
if (source && !(sourceW = strdupAtoW( source ))) return FALSE;
if (location && !(locationW = strdupAtoW( location ))) goto done;
if (!(ret = SetupCopyOEMInfW( sourceW, locationW, media_type, style, destW, size, NULL, NULL )))
goto done;
size = WideCharToMultiByte( CP_ACP, 0, destW, -1, NULL, 0, NULL, NULL );
if (required_size) *required_size = size;
if (dest)
{
if (buffer_size >= size)
{
WideCharToMultiByte( CP_ACP, 0, destW, -1, dest, buffer_size, NULL, NULL );
if (component) *component = strrchr( dest, '\\' ) + 1;
}
else
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
goto done;
}
}
done:
HeapFree( GetProcessHeap(), 0, sourceW );
HeapFree( GetProcessHeap(), 0, locationW );
return ret;
}
/***********************************************************************
* SetupCopyOEMInfW (SETUPAPI.@)
*/
BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
DWORD media_type, DWORD style, PWSTR dest,
DWORD buffer_size, PDWORD required_size, PWSTR *component )
{
BOOL ret = FALSE;
WCHAR target[MAX_PATH], *p;
static const WCHAR inf_oem[] = { '\\','i','n','f','\\','O','E','M',0 };
DWORD size;
TRACE("%s, %s, %d, %d, %p, %d, %p, %p\n", debugstr_w(source), debugstr_w(location),
media_type, style, dest, buffer_size, required_size, component);
if (!GetWindowsDirectoryW( target, sizeof(target)/sizeof(WCHAR) )) return FALSE;
strcatW( target, inf_oem );
p = strrchrW( source, '\\' ) + 1;
strcatW( target, p );
size = strlenW( target ) + 1;
if (dest)
{
if (buffer_size >= size)
{
/* FIXME: honour style flags */
if ((ret = CopyFileW( source, target, FALSE )))
{
if (style & SP_COPY_DELETESOURCE) DeleteFileW( source );
strcpyW( dest, target );
}
}
else
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
ret = FALSE;
}
}
if (component) *component = p;
if (required_size) *required_size = size;
return ret;
}

View File

@ -112,33 +112,6 @@ DWORD WINAPI CM_Get_Device_ID_ListA(
return CR_SUCCESS;
}
/***********************************************************************
* SetupCopyOEMInfA (SETUPAPI.@)
*/
BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc,
DWORD mediatype, DWORD copystyle, PSTR destinfname,
DWORD destnamesize, PDWORD required,
PSTR *destinfnamecomponent)
{
FIXME("stub: source %s location %s ...\n", debugstr_a(sourceinffile),
debugstr_a(sourcemedialoc));
return FALSE;
}
/***********************************************************************
* SetupCopyOEMInfW (SETUPAPI.@)
*/
BOOL WINAPI SetupCopyOEMInfW(PCWSTR sourceinffile, PCWSTR sourcemedialoc,
DWORD mediatype, DWORD copystyle, PWSTR destinfname,
DWORD destnamesize, PDWORD required,
PWSTR *destinfnamecomponent)
{
FIXME("stub: source %s location %s ...\n", debugstr_w(sourceinffile),
debugstr_w(sourcemedialoc));
return FALSE;
}
/***********************************************************************
* SetupInitializeFileLogW(SETUPAPI.@)
*/

View File

@ -723,6 +723,9 @@ BOOL WINAPI SetupCommitFileQueueW( HWND, HSPFILEQ, PSP_FILE_CALLBACK_W, PVOI
UINT WINAPI SetupCopyErrorA( HWND, PCSTR, PCSTR, PCSTR, PCSTR, PCSTR, UINT, DWORD, PSTR, DWORD, PDWORD );
UINT WINAPI SetupCopyErrorW( HWND, PCWSTR, PCWSTR, PCWSTR, PCWSTR, PCWSTR, UINT, DWORD, PWSTR, DWORD, PDWORD );
#define SetupCopyError WINELIB_NAME_AW(SetupCopyError)
BOOL WINAPI SetupCopyOEMInfA( PCSTR, PCSTR, DWORD, DWORD, PSTR, DWORD, PDWORD, PSTR * );
BOOL WINAPI SetupCopyOEMInfW( PCWSTR, PCWSTR, DWORD, DWORD, PWSTR, DWORD, PDWORD, PWSTR * );
#define SetupCopyOEMInf WINELIB_NAME_AW(SetupCopyOEMInf)
UINT WINAPI SetupDefaultQueueCallbackA( PVOID, UINT, UINT_PTR, UINT_PTR );
UINT WINAPI SetupDefaultQueueCallbackW( PVOID, UINT, UINT_PTR, UINT_PTR );
#define SetupDefaultQueueCallback WINELIB_NAME_AW(SetupDefaultQueueCallback)