Commit 44ab294e authored by Alexandre Julliard's avatar Alexandre Julliard

setupapi: Move strdupW and strdupWtoA to the setupapi_private.h header.

parent d5aea7d0
......@@ -73,29 +73,6 @@ struct file_queue
};
static inline WCHAR *strdupW( const WCHAR *str )
{
WCHAR *ret = NULL;
if (str)
{
int len = (strlenW(str) + 1) * sizeof(WCHAR);
if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
}
return ret;
}
static inline char *strdupWtoA( const WCHAR *str )
{
char *ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
}
/* append a file operation to a queue */
static inline void queue_file_op( struct file_op_queue *queue, struct file_op *op )
{
......
......@@ -29,6 +29,29 @@
#define REGPART_RENAME "\\Rename"
#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
static inline WCHAR *strdupW( const WCHAR *str )
{
WCHAR *ret = NULL;
if (str)
{
int len = (lstrlenW(str) + 1) * sizeof(WCHAR);
if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
}
return ret;
}
static inline char *strdupWtoA( const WCHAR *str )
{
char *ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
}
static inline WCHAR *strdupAtoW( const char *str )
{
WCHAR *ret = NULL;
......
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