Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a8d87a86
Commit
a8d87a86
authored
Feb 11, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Feb 11, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Handle the special table _ForceCodepage in MsiDatabaseExport.
parent
7d529228
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
1 deletion
+89
-1
database.c
dlls/msi/database.c
+24
-1
db.c
dlls/msi/tests/db.c
+65
-0
No files found.
dlls/msi/database.c
View file @
a8d87a86
...
@@ -849,12 +849,29 @@ static UINT msi_export_row( MSIRECORD *row, void *arg )
...
@@ -849,12 +849,29 @@ static UINT msi_export_row( MSIRECORD *row, void *arg )
return
msi_export_record
(
arg
,
row
,
1
);
return
msi_export_record
(
arg
,
row
,
1
);
}
}
static
UINT
msi_export_forcecodepage
(
HANDLE
handle
)
{
DWORD
sz
;
static
const
char
data
[]
=
"
\r\n\r\n
0
\t
_ForceCodepage
\r\n
"
;
FIXME
(
"Read the codepage from the strings table!
\n
"
);
sz
=
lstrlenA
(
data
)
+
1
;
if
(
!
WriteFile
(
handle
,
data
,
sz
,
&
sz
,
NULL
))
return
ERROR_FUNCTION_FAILED
;
return
ERROR_SUCCESS
;
}
UINT
MSI_DatabaseExport
(
MSIDATABASE
*
db
,
LPCWSTR
table
,
UINT
MSI_DatabaseExport
(
MSIDATABASE
*
db
,
LPCWSTR
table
,
LPCWSTR
folder
,
LPCWSTR
file
)
LPCWSTR
folder
,
LPCWSTR
file
)
{
{
static
const
WCHAR
query
[]
=
{
static
const
WCHAR
query
[]
=
{
's'
,
'e'
,
'l'
,
'e'
,
'c'
,
't'
,
' '
,
'*'
,
' '
,
'f'
,
'r'
,
'o'
,
'm'
,
' '
,
'%'
,
's'
,
0
};
's'
,
'e'
,
'l'
,
'e'
,
'c'
,
't'
,
' '
,
'*'
,
' '
,
'f'
,
'r'
,
'o'
,
'm'
,
' '
,
'%'
,
's'
,
0
};
static
const
WCHAR
szbs
[]
=
{
'\\'
,
0
};
static
const
WCHAR
szbs
[]
=
{
'\\'
,
0
};
static
const
WCHAR
forcecodepage
[]
=
{
'_'
,
'F'
,
'o'
,
'r'
,
'c'
,
'e'
,
'C'
,
'o'
,
'd'
,
'e'
,
'p'
,
'a'
,
'g'
,
'e'
,
0
};
MSIRECORD
*
rec
=
NULL
;
MSIRECORD
*
rec
=
NULL
;
MSIQUERY
*
view
=
NULL
;
MSIQUERY
*
view
=
NULL
;
LPWSTR
filename
;
LPWSTR
filename
;
...
@@ -882,6 +899,12 @@ UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
...
@@ -882,6 +899,12 @@ UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
if
(
handle
==
INVALID_HANDLE_VALUE
)
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
ERROR_FUNCTION_FAILED
;
return
ERROR_FUNCTION_FAILED
;
if
(
!
lstrcmpW
(
table
,
forcecodepage
))
{
r
=
msi_export_forcecodepage
(
handle
);
goto
done
;
}
r
=
MSI_OpenQuery
(
db
,
&
view
,
query
,
table
);
r
=
MSI_OpenQuery
(
db
,
&
view
,
query
,
table
);
if
(
r
==
ERROR_SUCCESS
)
if
(
r
==
ERROR_SUCCESS
)
{
{
...
@@ -915,8 +938,8 @@ UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
...
@@ -915,8 +938,8 @@ UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table,
msiobj_release
(
&
view
->
hdr
);
msiobj_release
(
&
view
->
hdr
);
}
}
done:
CloseHandle
(
handle
);
CloseHandle
(
handle
);
return
r
;
return
r
;
}
}
...
...
dlls/msi/tests/db.c
View file @
a8d87a86
...
@@ -5701,6 +5701,70 @@ static void test_noquotes(void)
...
@@ -5701,6 +5701,70 @@ static void test_noquotes(void)
DeleteFileA
(
msifile
);
DeleteFileA
(
msifile
);
}
}
static
void
read_file_data
(
LPCSTR
filename
,
LPSTR
buffer
)
{
OFSTRUCT
ofs
;
HFILE
file
;
DWORD
read
;
file
=
OpenFile
(
filename
,
&
ofs
,
OF_READ
);
ZeroMemory
(
buffer
,
MAX_PATH
);
ReadFile
((
HANDLE
)
file
,
buffer
,
MAX_PATH
,
&
read
,
NULL
);
CloseHandle
((
HANDLE
)
file
);
}
static
void
test_forcecodepage
(
void
)
{
MSIHANDLE
hdb
;
const
char
*
query
;
char
buffer
[
MAX_PATH
];
UINT
r
;
DeleteFile
(
msifile
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `_ForceCodepage`"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `_ForceCodepage`"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
r
=
MsiDatabaseCommit
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `_ForceCodepage`"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_DIRECT
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `_ForceCodepage`"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
r
=
MsiDatabaseExport
(
hdb
,
"_ForceCodepage"
,
CURR_DIR
,
"forcecodepage.idt"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
read_file_data
(
"forcecodepage.idt"
,
buffer
);
ok
(
!
lstrcmpA
(
buffer
,
"
\r\n\r\n
0
\t
_ForceCodepage
\r\n
"
),
"Expected
\"\r\n\r\n
0
\t
_ForceCodepage
\r\n\"
, got
\"
%s
\"
"
,
buffer
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
DeleteFileA
(
"forcecodepage.idt"
);
}
START_TEST
(
db
)
START_TEST
(
db
)
{
{
test_msidatabase
();
test_msidatabase
();
...
@@ -5735,4 +5799,5 @@ START_TEST(db)
...
@@ -5735,4 +5799,5 @@ START_TEST(db)
test_quotes
();
test_quotes
();
test_carriagereturn
();
test_carriagereturn
();
test_noquotes
();
test_noquotes
();
test_forcecodepage
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment