Commit 60e4f8a2 authored by David Kahurani's avatar David Kahurani Committed by Alexandre Julliard

msi: Convert newlines to alternate representation when exporting.

parent e1ddc58a
......@@ -892,7 +892,7 @@ end:
static UINT export_field( HANDLE handle, MSIRECORD *row, UINT field )
{
char *buffer;
char *buffer, *ptr;
BOOL ret;
DWORD sz = 0x100;
UINT r;
......@@ -928,6 +928,22 @@ static UINT export_field( HANDLE handle, MSIRECORD *row, UINT field )
return r;
}
ptr = buffer;
while( *ptr )
{
if (*ptr == '\r' && *( ptr + 1 ) == '\n')
{
*ptr++ = '\x11';
*ptr++ = '\x19';
continue;
}
if (*ptr == '\n')
*ptr = '\x19';
ptr++;
}
ret = WriteFile( handle, buffer, sz, &sz, NULL );
free( buffer );
return ret ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED;
......
......@@ -8584,12 +8584,18 @@ static void test_embedded_nulls(void)
"s72\tL0\n"
"Control\tDialog\n"
"LicenseAgreementDlg\ttext\x11\x19text\0text";
static const char export_expected[] =
"Dialog\tText\r\n"
"s72\tL0\r\n"
"Control\tDialog\r\n"
"LicenseAgreementDlg\ttext\x11\x19text\x19text";
/* newlines have alternate representation in idt files */
static const char control_table2[] =
"Dialog\tText\n"
"s72\tL0\n"
"Control\tDialog\n"
"LicenseAgreementDlg\ttext\x11\x19te\nxt\0text";
char data[1024];
UINT r;
DWORD sz;
MSIHANDLE hdb, hrec;
......@@ -8613,6 +8619,12 @@ static void test_embedded_nulls(void)
ok( r == ERROR_SUCCESS, "failed to get string %u\n", r );
ok( !memcmp( "text\r\ntext\ntext", buffer, sizeof("text\r\ntext\ntext") - 1 ), "wrong buffer contents \"%s\"\n", buffer );
r = MsiDatabaseExportA( hdb, "Control", CURR_DIR, "temp_file1");
ok( r == ERROR_SUCCESS, "failed to export table %u\n", r );
read_file_data( "temp_file1", data );
ok( !memcmp( data, export_expected, sizeof(export_expected) - 1), "expected: \"%s\" got: \"%s\"\n", export_expected, data );
DeleteFileA( "temp_file1" );
MsiCloseHandle( hrec );
MsiCloseHandle( hdb );
DeleteFileA( msifile );
......
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