Use strdup, implement MsiDatabaseImportA.
This commit is contained in:
parent
852fc5f161
commit
30e388af51
|
@ -608,21 +608,17 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
|
|||
LPSTR szBuffer, DWORD *pcchValueBuf)
|
||||
{
|
||||
LPWSTR szwProduct = NULL, szwAttribute = NULL, szwBuffer = NULL;
|
||||
UINT hr = ERROR_INSTALL_FAILURE;
|
||||
UINT hr = ERROR_OUTOFMEMORY;
|
||||
|
||||
FIXME("%s %s %p %p\n",debugstr_a(szProduct), debugstr_a(szAttribute),
|
||||
TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute),
|
||||
szBuffer, pcchValueBuf);
|
||||
|
||||
if( NULL != szBuffer && NULL == pcchValueBuf )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
if( szProduct )
|
||||
{
|
||||
szwProduct = strdupAtoW( szProduct );
|
||||
if( !szwProduct )
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if( szAttribute )
|
||||
{
|
||||
|
@ -630,11 +626,6 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
|
|||
if( !szwAttribute )
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = ERROR_INVALID_PARAMETER;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if( szBuffer )
|
||||
{
|
||||
|
@ -679,40 +670,59 @@ UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
|
|||
return hr;
|
||||
}
|
||||
|
||||
UINT WINAPI MsiDatabaseImportA(MSIHANDLE handle, LPCSTR szFolderPath, LPCSTR szFilename)
|
||||
{
|
||||
FIXME("%lx %s %s\n",handle,debugstr_a(szFolderPath), debugstr_a(szFilename));
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolderPath, LPCWSTR szFilename)
|
||||
{
|
||||
FIXME("%lx %s %s\n",handle,debugstr_w(szFolderPath), debugstr_w(szFilename));
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
|
||||
LPCSTR szFolderPath, LPCSTR szFilename )
|
||||
{
|
||||
LPWSTR path = NULL, file = NULL;
|
||||
UINT r = ERROR_OUTOFMEMORY;
|
||||
|
||||
TRACE("%lx %s %s\n", handle, debugstr_a(szFolderPath), debugstr_a(szFilename));
|
||||
|
||||
if( szFolderPath )
|
||||
{
|
||||
path = strdupAtoW( szFolderPath );
|
||||
if( !path )
|
||||
goto end;
|
||||
}
|
||||
|
||||
if( szFilename )
|
||||
{
|
||||
file = strdupAtoW( szFilename );
|
||||
if( !file )
|
||||
goto end;
|
||||
}
|
||||
|
||||
r = MsiDatabaseImportW( handle, path, file );
|
||||
|
||||
end:
|
||||
HeapFree( GetProcessHeap(), 0, path );
|
||||
HeapFree( GetProcessHeap(), 0, file );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
|
||||
{
|
||||
LPWSTR szwLogFile = NULL;
|
||||
UINT hr = ERROR_INSTALL_FAILURE;
|
||||
UINT r;
|
||||
|
||||
FIXME("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes);
|
||||
TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_a(szLogFile), attributes);
|
||||
|
||||
if( szLogFile )
|
||||
{
|
||||
szwLogFile = strdupAtoW( szLogFile );
|
||||
if( !szwLogFile )
|
||||
goto end;
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
|
||||
|
||||
end:
|
||||
r = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
|
||||
HeapFree( GetProcessHeap(), 0, szwLogFile );
|
||||
|
||||
return hr;
|
||||
return r;
|
||||
}
|
||||
|
||||
UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
|
||||
|
@ -721,7 +731,7 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
|
|||
|
||||
TRACE("%08lx %s %08lx\n", dwLogMode, debugstr_w(szLogFile), attributes);
|
||||
|
||||
strcpyW(gszLogFile,szLogFile);
|
||||
lstrcpyW(gszLogFile,szLogFile);
|
||||
if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
|
||||
DeleteFileW(szLogFile);
|
||||
file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
|
||||
|
|
|
@ -448,7 +448,6 @@ UINT WINAPI MsiRecordDataSize(MSIHANDLE handle, unsigned int iField)
|
|||
UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
|
||||
{
|
||||
LPWSTR str;
|
||||
UINT len;
|
||||
|
||||
TRACE("%p %d %s\n", rec, iField, debugstr_a(szValue));
|
||||
|
||||
|
@ -458,9 +457,7 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
|
|||
MSI_FreeField( &rec->fields[iField] );
|
||||
if( szValue && szValue[0] )
|
||||
{
|
||||
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
|
||||
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, szValue, -1, str, len );
|
||||
str = strdupAtoW( szValue );
|
||||
rec->fields[iField].type = MSIFIELD_WSTR;
|
||||
rec->fields[iField].u.szwVal = str;
|
||||
}
|
||||
|
@ -493,7 +490,6 @@ UINT WINAPI MsiRecordSetStringA( MSIHANDLE handle, unsigned int iField, LPCSTR s
|
|||
UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue )
|
||||
{
|
||||
LPWSTR str;
|
||||
UINT len;
|
||||
|
||||
TRACE("%p %d %s\n", rec, iField, debugstr_w(szValue));
|
||||
|
||||
|
@ -504,10 +500,7 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue
|
|||
|
||||
if( szValue && szValue[0] )
|
||||
{
|
||||
len = lstrlenW(szValue) + 1;
|
||||
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR));
|
||||
lstrcpyW( str, szValue );
|
||||
|
||||
str = strdupW( szValue );
|
||||
rec->fields[iField].type = MSIFIELD_WSTR;
|
||||
rec->fields[iField].u.szwVal = str;
|
||||
}
|
||||
|
@ -633,15 +626,15 @@ UINT MSI_RecordSetStreamW(MSIRECORD *rec, unsigned int iField, LPCWSTR szFilenam
|
|||
UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord, unsigned int iField, LPCSTR szFilename)
|
||||
{
|
||||
LPWSTR wstr = NULL;
|
||||
UINT ret, len;
|
||||
UINT ret;
|
||||
|
||||
TRACE("%ld %d %s\n", hRecord, iField, debugstr_a(szFilename));
|
||||
|
||||
if( szFilename )
|
||||
{
|
||||
len = MultiByteToWideChar(CP_ACP,0,szFilename,-1,NULL,0);
|
||||
wstr = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP,0,szFilename,-1,wstr,len);
|
||||
wstr = strdupAtoW( szFilename );
|
||||
if( !wstr )
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
ret = MsiRecordSetStreamW(hRecord, iField, wstr);
|
||||
HeapFree(GetProcessHeap(),0,wstr);
|
||||
|
|
Loading…
Reference in New Issue