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
832e3069
Commit
832e3069
authored
Aug 22, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Aug 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cabinet: Formalize the SESSION struct.
parent
d13541f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
50 deletions
+51
-50
cabinet.h
dlls/cabinet/cabinet.h
+16
-18
cabinet_main.c
dlls/cabinet/cabinet_main.c
+35
-32
No files found.
dlls/cabinet/cabinet.h
View file @
832e3069
...
@@ -631,29 +631,27 @@ static const cab_UWORD Zipmask[17] = {
...
@@ -631,29 +631,27 @@ static const cab_UWORD Zipmask[17] = {
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff \
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff \
}
}
/*
EXTRACTdest flags
*/
/*
SESSION Operation
*/
#define EXTRACT_FILLFILELIST 0x00000001
#define EXTRACT_FILLFILELIST 0x00000001
#define EXTRACT_EXTRACTFILES 0x00000002
#define EXTRACT_EXTRACTFILES 0x00000002
struct
ExtractFileList
{
struct
FILELIST
{
LPSTR
filen
ame
;
LPSTR
FileN
ame
;
struct
ExtractFileList
*
next
;
struct
FILELIST
*
next
;
BOOL
flag
;
BOOL
Extracted
;
}
;
};
/* the first parameter of the function extract */
typedef
struct
{
typedef
struct
{
long
result1
;
/* 0x000 */
INT
FileSize
;
long
unknown1
[
3
];
/* 0x004 */
ERF
Error
;
struct
ExtractFileList
*
filelist
;
/* 0x010 */
struct
FILELIST
*
FileList
;
long
filecount
;
/* 0x014 */
INT
FileCount
;
DWORD
flags
;
/* 0x018 */
INT
Operation
;
char
directory
[
MAX_PATH
];
/* 0x01c */
CHAR
Destination
[
MAX_PATH
];
char
lastfile
[
MAX_PATH
];
/* 0x120 */
CHAR
CurrentFile
[
MAX_PATH
];
char
unknown2
[
MAX_PATH
];
/* 0x224 */
CHAR
Reserved
[
MAX_PATH
];
struct
ExtractFileList
*
filterlist
;
/* 0x328 */
struct
FILELIST
*
FilterList
;
}
EXTRACTdest
;
}
SESSION
;
/* from fdi.c */
/* from fdi.c */
void
QTMupdatemodel
(
struct
QTMmodel
*
model
,
int
sym
);
void
QTMupdatemodel
(
struct
QTMmodel
*
model
,
int
sym
);
...
...
dlls/cabinet/cabinet_main.c
View file @
832e3069
...
@@ -154,20 +154,20 @@ static long fdi_seek(INT_PTR hf, long dist, int seektype)
...
@@ -154,20 +154,20 @@ static long fdi_seek(INT_PTR hf, long dist, int seektype)
return
SetFilePointer
(
handle
,
dist
,
NULL
,
seektype
);
return
SetFilePointer
(
handle
,
dist
,
NULL
,
seektype
);
}
}
static
void
fill_file_node
(
struct
ExtractFileList
*
pNode
,
LPCSTR
szFilename
)
static
void
fill_file_node
(
struct
FILELIST
*
pNode
,
LPCSTR
szFilename
)
{
{
pNode
->
next
=
NULL
;
pNode
->
next
=
NULL
;
pNode
->
flag
=
FALSE
;
pNode
->
Extracted
=
FALSE
;
pNode
->
filen
ame
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
szFilename
)
+
1
);
pNode
->
FileN
ame
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
szFilename
)
+
1
);
lstrcpyA
(
pNode
->
filen
ame
,
szFilename
);
lstrcpyA
(
pNode
->
FileN
ame
,
szFilename
);
}
}
static
BOOL
file_in_list
(
const
struct
ExtractFileList
*
pNode
,
LPCSTR
szFilename
)
static
BOOL
file_in_list
(
const
struct
FILELIST
*
pNode
,
LPCSTR
szFilename
)
{
{
while
(
pNode
)
while
(
pNode
)
{
{
if
(
!
lstrcmpiA
(
pNode
->
filen
ame
,
szFilename
))
if
(
!
lstrcmpiA
(
pNode
->
FileN
ame
,
szFilename
))
return
TRUE
;
return
TRUE
;
pNode
=
pNode
->
next
;
pNode
=
pNode
->
next
;
...
@@ -182,17 +182,17 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
...
@@ -182,17 +182,17 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
{
{
case
fdintCOPY_FILE
:
case
fdintCOPY_FILE
:
{
{
struct
ExtractFileList
**
fileList
;
struct
FILELIST
**
fileList
;
EXTRACTdest
*
pDestination
=
pfdin
->
pv
;
SESSION
*
pDestination
=
pfdin
->
pv
;
LPSTR
szFullPath
,
szDirectory
;
LPSTR
szFullPath
,
szDirectory
;
HANDLE
hFile
=
0
;
HANDLE
hFile
=
0
;
DWORD
dwSize
;
DWORD
dwSize
;
dwSize
=
lstrlenA
(
pDestination
->
directory
)
+
dwSize
=
lstrlenA
(
pDestination
->
Destination
)
+
lstrlenA
(
"
\\
"
)
+
lstrlenA
(
pfdin
->
psz1
)
+
1
;
lstrlenA
(
"
\\
"
)
+
lstrlenA
(
pfdin
->
psz1
)
+
1
;
szFullPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
szFullPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
lstrcpyA
(
szFullPath
,
pDestination
->
directory
);
lstrcpyA
(
szFullPath
,
pDestination
->
Destination
);
lstrcatA
(
szFullPath
,
"
\\
"
);
lstrcatA
(
szFullPath
,
"
\\
"
);
lstrcatA
(
szFullPath
,
pfdin
->
psz1
);
lstrcatA
(
szFullPath
,
pfdin
->
psz1
);
...
@@ -201,26 +201,26 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
...
@@ -201,26 +201,26 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
szDirectory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
szDirectory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
lstrcpynA
(
szDirectory
,
szFullPath
,
dwSize
);
lstrcpynA
(
szDirectory
,
szFullPath
,
dwSize
);
if
(
pDestination
->
flags
&
EXTRACT_FILLFILELIST
)
if
(
pDestination
->
Operation
&
EXTRACT_FILLFILELIST
)
{
{
fileList
=
&
pDestination
->
filel
ist
;
fileList
=
&
pDestination
->
FileL
ist
;
while
(
*
fileList
)
while
(
*
fileList
)
fileList
=
&
((
*
fileList
)
->
next
);
fileList
=
&
((
*
fileList
)
->
next
);
*
fileList
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
fileList
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
ExtractFileList
));
sizeof
(
struct
FILELIST
));
fill_file_node
(
*
fileList
,
pfdin
->
psz1
);
fill_file_node
(
*
fileList
,
pfdin
->
psz1
);
lstrcpyA
(
pDestination
->
lastf
ile
,
szFullPath
);
lstrcpyA
(
pDestination
->
CurrentF
ile
,
szFullPath
);
pDestination
->
filec
ount
++
;
pDestination
->
FileC
ount
++
;
}
}
if
((
pDestination
->
flags
&
EXTRACT_EXTRACTFILES
)
||
if
((
pDestination
->
Operation
&
EXTRACT_EXTRACTFILES
)
||
file_in_list
(
pDestination
->
filterl
ist
,
pfdin
->
psz1
))
file_in_list
(
pDestination
->
FilterL
ist
,
pfdin
->
psz1
))
{
{
/* skip this file if it is not in the file list */
/* skip this file if it is not in the file list */
if
(
!
file_in_list
(
pDestination
->
filel
ist
,
pfdin
->
psz1
))
if
(
!
file_in_list
(
pDestination
->
FileL
ist
,
pfdin
->
psz1
))
return
0
;
return
0
;
/* create the destination directory if it doesn't exist */
/* create the destination directory if it doesn't exist */
...
@@ -281,25 +281,28 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
...
@@ -281,25 +281,28 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
* NOTES
* NOTES
* The following members of the dest struct control the operation
* The following members of the dest struct control the operation
* of Extract:
* of Extract:
* filelist [I] A linked list of filenames. Extract only extracts
* FileSize [O] The size of all files extracted up to CurrentFile.
* files from the cabinet that are in this list.
* Error [O] The error in case the extract operation fails.
* filecount [O] Contains the number of files in filelist on
* FileList [I] A linked list of filenames. Extract only extracts
* completion.
* files from the cabinet that are in this list.
* flags [I] See Operation.
* FileCount [O] Contains the number of files in FileList on
* directory [I] The destination directory.
* completion.
* lastfile [O] The last file extracted.
* Operation [I] See Operation.
* Destination [I] The destination directory.
* CurrentFile [O] The last file extracted.
* FilterList [I] A linked list of files that should not be extracted.
*
*
* Operation
* Operation
* If
flags contains EXTRACT_FILLFILELIST, then filel
ist will be
* If
Operation contains EXTRACT_FILLFILELIST, then FileL
ist will be
* filled with all the files in the cabinet. If
flags
contains
* filled with all the files in the cabinet. If
Operation
contains
* EXTRACT_EXTRACTFILES, then only the files in the
filel
ist will
* EXTRACT_EXTRACTFILES, then only the files in the
FileL
ist will
* be extracted from the cabinet. EXTRACT_FILLFILELIST can be called
* be extracted from the cabinet. EXTRACT_FILLFILELIST can be called
* by itself, but EXTRACT_EXTRACTFILES must have a valid
filel
ist
* by itself, but EXTRACT_EXTRACTFILES must have a valid
FileL
ist
* in order to succeed. If
flags
contains both EXTRACT_FILLFILELIST
* in order to succeed. If
Operation
contains both EXTRACT_FILLFILELIST
* and EXTRACT_EXTRACTFILES, then all the files in the cabinet
* and EXTRACT_EXTRACTFILES, then all the files in the cabinet
* will be extracted.
* will be extracted.
*/
*/
HRESULT
WINAPI
Extract
(
EXTRACTdest
*
dest
,
LPCSTR
szCabName
)
HRESULT
WINAPI
Extract
(
SESSION
*
dest
,
LPCSTR
szCabName
)
{
{
HRESULT
res
=
S_OK
;
HRESULT
res
=
S_OK
;
HFDI
hfdi
;
HFDI
hfdi
;
...
@@ -321,7 +324,7 @@ HRESULT WINAPI Extract(EXTRACTdest *dest, LPCSTR szCabName)
...
@@ -321,7 +324,7 @@ HRESULT WINAPI Extract(EXTRACTdest *dest, LPCSTR szCabName)
if
(
!
hfdi
)
if
(
!
hfdi
)
return
E_FAIL
;
return
E_FAIL
;
if
(
GetFileAttributesA
(
dest
->
directory
)
==
INVALID_FILE_ATTRIBUTES
)
if
(
GetFileAttributesA
(
dest
->
Destination
)
==
INVALID_FILE_ATTRIBUTES
)
return
S_OK
;
return
S_OK
;
/* split the cabinet name into path + name */
/* split the cabinet name into path + name */
...
...
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