Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
c561b679
Commit
c561b679
authored
13 years ago
by
eric pouech
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
expand: No longer use Unix stdio functions, but rather the kernel32 equivalent.
parent
60460147
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
programs/expand/expand.c
+27
-12
27 additions, 12 deletions
programs/expand/expand.c
with
27 additions
and
12 deletions
programs/expand/expand.c
+
27
−
12
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
)
{
f
printf
(
stderr
,
"Usage:
\n
"
);
f
printf
(
stderr
,
"
\t
%s infile outfile
\n
"
,
argv
[
0
]
);
f
printf
(
stderr
,
"
\t
%s /r infile
\n
"
,
argv
[
0
]
);
my
printf
(
"Usage:
\n
"
);
my
printf
(
"
\t
%s infile outfile
\n
"
,
argv
[
0
]
);
my
printf
(
"
\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
))
{
f
printf
(
stderr
,
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
my
printf
(
"%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
))
{
f
printf
(
stderr
,
"%s: can't determine original name
\n
"
,
argv
[
0
]
);
my
printf
(
"%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:
f
printf
(
stderr
,
"%s: can't determine original
\n
"
,
argv
[
0
]
);
my
printf
(
"%s: can't determine original
\n
"
,
argv
[
0
]
);
return
1
;
}
}
...
...
@@ -128,7 +143,7 @@ int main(int argc, char *argv[])
if
(
!
lstrcmpiA
(
infile
,
outfile
))
{
f
printf
(
stderr
,
"%s: can't expand file to itself
\n
"
,
argv
[
0
]
);
my
printf
(
"%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
))
{
f
printf
(
stderr
,
"%s: cabinet extraction failed
\n
"
,
argv
[
0
]
);
my
printf
(
"%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
)
{
f
printf
(
stderr
,
"%s: can't open input file %s
\n
"
,
argv
[
0
],
infile
);
my
printf
(
"%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
);
f
printf
(
stderr
,
"%s: can't open output file %s
\n
"
,
argv
[
0
],
outfile
);
my
printf
(
"%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
)
{
f
printf
(
stderr
,
"%s: LZCopy failed, error is %d
\n
"
,
argv
[
0
],
error
);
my
printf
(
"%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
))
{
f
printf
(
stderr
,
"%s: CopyFileA failed
\n
"
,
argv
[
0
]
);
my
printf
(
"%s: CopyFileA failed
\n
"
,
argv
[
0
]
);
return
1
;
}
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment