Hans Leidekker : setupapi: Implement SetupCopyOEMInf{A,W}.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 20 14:18:55 CST 2007
Module: wine
Branch: master
Commit: 939e8e4ce279a24b2bc2f716b5fcb66748677434
URL: http://source.winehq.org/git/wine.git/?a=commit;h=939e8e4ce279a24b2bc2f716b5fcb66748677434
Author: Hans Leidekker <hans at it.vu.nl>
Date: Tue Feb 20 12:03:23 2007 +0100
setupapi: Implement SetupCopyOEMInf{A,W}.
---
dlls/setupapi/misc.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++
dlls/setupapi/stubs.c | 27 ---------------
include/setupapi.h | 3 ++
3 files changed, 92 insertions(+), 27 deletions(-)
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c
index d7febe5..0e9dbd1 100644
--- a/dlls/setupapi/misc.c
+++ b/dlls/setupapi/misc.c
@@ -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;
+}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index dbde71c..ed6caa2 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -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.@)
*/
diff --git a/include/setupapi.h b/include/setupapi.h
index 1815324..8c7aaf5 100644
--- a/include/setupapi.h
+++ b/include/setupapi.h
@@ -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)
More information about the wine-cvs
mailing list