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
57b83719
Commit
57b83719
authored
Oct 31, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Added ExtractFilesW implementation.
parent
a49da3ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
2 deletions
+72
-2
advpack_private.h
dlls/advpack/advpack_private.h
+23
-0
files.c
dlls/advpack/files.c
+30
-2
files.c
dlls/advpack/tests/files.c
+19
-0
No files found.
dlls/advpack/advpack_private.h
View file @
57b83719
...
...
@@ -27,4 +27,27 @@ void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECL
HRESULT
launch_exe
(
LPCWSTR
cmd
,
LPCWSTR
dir
,
HANDLE
*
phEXE
)
DECLSPEC_HIDDEN
;
static
inline
void
*
heap_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
char
*
heap_strdupWtoA
(
const
WCHAR
*
str
)
{
char
*
ret
=
NULL
;
if
(
str
)
{
size_t
size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ret
=
heap_alloc
(
size
);
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
size
,
NULL
,
NULL
);
}
return
ret
;
}
#endif
/* __ADVPACK_PRIVATE_H */
dlls/advpack/files.c
View file @
57b83719
...
...
@@ -779,11 +779,39 @@ done:
HRESULT
WINAPI
ExtractFilesW
(
LPCWSTR
CabName
,
LPCWSTR
ExpandDir
,
DWORD
Flags
,
LPCWSTR
FileList
,
LPVOID
LReserved
,
DWORD
Reserved
)
{
char
*
cab_name
=
NULL
,
*
expand_dir
=
NULL
,
*
file_list
=
NULL
;
HRESULT
hres
=
S_OK
;
FIXME
(
"(%s, %s, %d, %s, %p, %d) stub!
\n
"
,
debugstr_w
(
CabName
),
debugstr_w
(
ExpandDir
),
TRACE
(
"(%s, %s, %d, %s, %p, %d)
\n
"
,
debugstr_w
(
CabName
),
debugstr_w
(
ExpandDir
),
Flags
,
debugstr_w
(
FileList
),
LReserved
,
Reserved
);
return
E_FAIL
;
if
(
CabName
)
{
cab_name
=
heap_strdupWtoA
(
CabName
);
if
(
!
cab_name
)
return
E_OUTOFMEMORY
;
}
if
(
ExpandDir
)
{
expand_dir
=
heap_strdupWtoA
(
ExpandDir
);
if
(
!
expand_dir
)
hres
=
E_OUTOFMEMORY
;
}
if
(
SUCCEEDED
(
hres
)
&&
FileList
)
{
file_list
=
heap_strdupWtoA
(
FileList
);
if
(
!
file_list
)
hres
=
E_OUTOFMEMORY
;
}
/* cabinet.dll, which does the real job of extracting files, doesn't have UNICODE API,
so we need W->A conversion at some point anyway. */
if
(
SUCCEEDED
(
hres
))
hres
=
ExtractFilesA
(
cab_name
,
expand_dir
,
Flags
,
file_list
,
LReserved
,
Reserved
);
heap_free
(
cab_name
);
heap_free
(
expand_dir
);
heap_free
(
file_list
);
return
hres
;
}
/***********************************************************************
...
...
dlls/advpack/tests/files.c
View file @
57b83719
...
...
@@ -32,6 +32,7 @@
static
HMODULE
hAdvPack
;
static
HRESULT
(
WINAPI
*
pAddDelBackupEntry
)(
LPCSTR
,
LPCSTR
,
LPCSTR
,
DWORD
);
static
HRESULT
(
WINAPI
*
pExtractFiles
)(
LPCSTR
,
LPCSTR
,
DWORD
,
LPCSTR
,
LPVOID
,
DWORD
);
static
HRESULT
(
WINAPI
*
pExtractFilesW
)(
const
WCHAR
*
,
const
WCHAR
*
,
DWORD
,
const
WCHAR
*
,
void
*
,
DWORD
);
static
HRESULT
(
WINAPI
*
pAdvInstallFile
)(
HWND
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
);
static
CHAR
CURR_DIR
[
MAX_PATH
];
...
...
@@ -44,6 +45,7 @@ static void init_function_pointers(void)
{
pAddDelBackupEntry
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"AddDelBackupEntry"
);
pExtractFiles
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"ExtractFiles"
);
pExtractFilesW
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"ExtractFilesW"
);
pAdvInstallFile
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"AdvInstallFile"
);
}
}
...
...
@@ -468,6 +470,23 @@ static void test_ExtractFiles(void)
ok
(
!
DeleteFileA
(
"dest
\\
a.txt"
),
"Expected dest
\\
a.txt to not exist
\n
"
);
ok
(
!
DeleteFileA
(
"dest
\\
testdir
\\
c.txt"
),
"Expected dest
\\
testdir
\\
c.txt to not exist
\n
"
);
ok
(
!
RemoveDirectoryA
(
"dest
\\
testdir"
),
"Expected dest
\\
testdir to not exist
\n
"
);
if
(
pExtractFilesW
)
{
static
const
WCHAR
extract_cabW
[]
=
{
'e'
,
'x'
,
't'
,
'r'
,
'a'
,
'c'
,
't'
,
'.'
,
'c'
,
'a'
,
'b'
,
0
};
static
const
WCHAR
destW
[]
=
{
'd'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
file_listW
[]
=
{
'a'
,
'.'
,
't'
,
'x'
,
't'
,
':'
,
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
'\\'
,
'c'
,
'.'
,
't'
,
'x'
,
't'
,
0
};
hr
=
pExtractFilesW
(
extract_cabW
,
destW
,
0
,
file_listW
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
DeleteFileA
(
"dest
\\
a.txt"
),
"Expected dest
\\
a.txt to exist
\n
"
);
ok
(
DeleteFileA
(
"dest
\\
testdir
\\
c.txt"
),
"Expected dest
\\
testdir
\\
c.txt to exist
\n
"
);
ok
(
RemoveDirectoryA
(
"dest
\\
testdir"
),
"Expected dest
\\
testdir to exist
\n
"
);
ok
(
!
DeleteFileA
(
"dest
\\
b.txt"
),
"Expected dest
\\
b.txt to not exist
\n
"
);
ok
(
!
DeleteFileA
(
"dest
\\
testdir
\\
d.txt"
),
"Expected dest
\\
testdir
\\
d.txt to not exist
\n
"
);
}
else
{
win_skip
(
"ExtractFilesW not available
\n
"
);
}
}
static
void
test_AdvInstallFile
(
void
)
...
...
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