Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c561b679
Commit
c561b679
authored
Nov 04, 2011
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expand: No longer use Unix stdio functions, but rather the kernel32 equivalent.
parent
60460147
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
expand.c
programs/expand/expand.c
+27
-12
No files found.
programs/expand/expand.c
View file @
c561b679
...
...
@@ -26,6 +26,21 @@
#include <lzexpand.h>
#include <setupapi.h>
static
int
myprintf
(
const
char
*
format
,
...)
{
va_list
va
;
char
tmp
[
8192
];
DWORD
w
;
int
len
;
va_start
(
va
,
format
);
len
=
vsnprintf
(
tmp
,
sizeof
(
tmp
),
format
,
va
);
if
(
len
>
0
)
WriteFile
(
GetStdHandle
(
STD_ERROR_HANDLE
),
tmp
,
len
,
&
w
,
NULL
);
va_end
(
va
);
return
w
;
}
static
UINT
CALLBACK
set_outfile
(
PVOID
context
,
UINT
notification
,
UINT_PTR
param1
,
UINT_PTR
param2
)
{
FILE_IN_CABINET_INFO_A
*
info
=
(
FILE_IN_CABINET_INFO_A
*
)
param1
;
...
...
@@ -83,9 +98,9 @@ int main(int argc, char *argv[])
if
(
argc
<
3
)
{
fprintf
(
stderr
,
"Usage:
\n
"
);
fprintf
(
stderr
,
"
\t
%s infile outfile
\n
"
,
argv
[
0
]
);
fprintf
(
stderr
,
"
\t
%s /r infile
\n
"
,
argv
[
0
]
);
myprintf
(
"Usage:
\n
"
);
myprintf
(
"
\t
%s infile outfile
\n
"
,
argv
[
0
]
);
myprintf
(
"
\t
%s /r infile
\n
"
,
argv
[
0
]
);
return
1
;
}
...
...
@@ -96,7 +111,7 @@ int main(int argc, char *argv[])
if
(
!
SetupGetFileCompressionInfoExA
(
infile
,
actual_name
,
sizeof
(
actual_name
),
NULL
,
NULL
,
NULL
,
&
comp
))
{
fprintf
(
stderr
,
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
myprintf
(
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
return
1
;
}
...
...
@@ -108,7 +123,7 @@ int main(int argc, char *argv[])
outfile_basename
[
0
]
=
0
;
if
(
!
SetupIterateCabinetA
(
infile
,
0
,
set_outfile
,
outfile_basename
))
{
fprintf
(
stderr
,
"%s: can't determine original name
\n
"
,
argv
[
0
]
);
myprintf
(
"%s: can't determine original name
\n
"
,
argv
[
0
]
);
return
1
;
}
GetFullPathNameA
(
infile
,
sizeof
(
outfile
),
outfile
,
&
basename_index
);
...
...
@@ -119,7 +134,7 @@ int main(int argc, char *argv[])
GetExpandedNameA
(
infile
,
outfile_basename
);
break
;
default:
fprintf
(
stderr
,
"%s: can't determine original
\n
"
,
argv
[
0
]
);
myprintf
(
"%s: can't determine original
\n
"
,
argv
[
0
]
);
return
1
;
}
}
...
...
@@ -128,7 +143,7 @@ int main(int argc, char *argv[])
if
(
!
lstrcmpiA
(
infile
,
outfile
))
{
fprintf
(
stderr
,
"%s: can't expand file to itself
\n
"
,
argv
[
0
]
);
myprintf
(
"%s: can't expand file to itself
\n
"
,
argv
[
0
]
);
return
1
;
}
...
...
@@ -137,7 +152,7 @@ int main(int argc, char *argv[])
case
FILE_COMPRESSION_MSZIP
:
if
(
!
SetupIterateCabinetA
(
infile
,
0
,
extract_callback
,
outfile
))
{
fprintf
(
stderr
,
"%s: cabinet extraction failed
\n
"
,
argv
[
0
]
);
myprintf
(
"%s: cabinet extraction failed
\n
"
,
argv
[
0
]
);
return
1
;
}
break
;
...
...
@@ -149,13 +164,13 @@ int main(int argc, char *argv[])
if
((
hin
=
LZOpenFileA
(
infile
,
&
ofin
,
OF_READ
))
<
0
)
{
fprintf
(
stderr
,
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
myprintf
(
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
return
1
;
}
if
((
hout
=
LZOpenFileA
(
outfile
,
&
ofout
,
OF_CREATE
|
OF_WRITE
))
<
0
)
{
LZClose
(
hin
);
fprintf
(
stderr
,
"%s: can't open output file %s
\n
"
,
argv
[
0
],
outfile
);
myprintf
(
"%s: can't open output file %s
\n
"
,
argv
[
0
],
outfile
);
return
1
;
}
error
=
LZCopy
(
hin
,
hout
);
...
...
@@ -165,7 +180,7 @@ int main(int argc, char *argv[])
if
(
error
<
0
)
{
fprintf
(
stderr
,
"%s: LZCopy failed, error is %d
\n
"
,
argv
[
0
],
error
);
myprintf
(
"%s: LZCopy failed, error is %d
\n
"
,
argv
[
0
],
error
);
return
1
;
}
break
;
...
...
@@ -173,7 +188,7 @@ int main(int argc, char *argv[])
default:
if
(
!
CopyFileA
(
infile
,
outfile
,
FALSE
))
{
fprintf
(
stderr
,
"%s: CopyFileA failed
\n
"
,
argv
[
0
]
);
myprintf
(
"%s: CopyFileA failed
\n
"
,
argv
[
0
]
);
return
1
;
}
break
;
...
...
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