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
672a6113
Commit
672a6113
authored
May 08, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
May 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Don't copy an OEM inf file if the exact same OEM inf file already exists.
parent
4cd064ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
1 deletion
+56
-1
misc.c
dlls/setupapi/misc.c
+56
-1
No files found.
dlls/setupapi/misc.c
View file @
672a6113
...
@@ -919,6 +919,29 @@ done:
...
@@ -919,6 +919,29 @@ done:
return
ret
;
return
ret
;
}
}
static
int
compare_files
(
HANDLE
file1
,
HANDLE
file2
)
{
char
buffer1
[
2048
];
char
buffer2
[
2048
];
DWORD
size1
;
DWORD
size2
;
while
(
ReadFile
(
file1
,
buffer1
,
sizeof
(
buffer1
),
&
size1
,
NULL
)
&&
ReadFile
(
file2
,
buffer2
,
sizeof
(
buffer2
),
&
size2
,
NULL
)
)
{
int
ret
;
if
(
size1
!=
size2
)
return
size1
>
size2
?
1
:
-
1
;
if
(
!
size1
)
return
0
;
ret
=
memcmp
(
buffer1
,
buffer2
,
size1
);
if
(
ret
)
return
ret
;
}
return
0
;
}
/***********************************************************************
/***********************************************************************
* SetupCopyOEMInfW (SETUPAPI.@)
* SetupCopyOEMInfW (SETUPAPI.@)
*/
*/
...
@@ -959,6 +982,20 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
...
@@ -959,6 +982,20 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
{
{
static
const
WCHAR
oem
[]
=
{
'o'
,
'e'
,
'm'
,
0
};
static
const
WCHAR
oem
[]
=
{
'o'
,
'e'
,
'm'
,
0
};
unsigned
int
i
;
unsigned
int
i
;
LARGE_INTEGER
source_file_size
;
HANDLE
source_file
;
source_file
=
CreateFileW
(
source
,
FILE_READ_DATA
|
FILE_READ_ATTRIBUTES
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
source_file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
if
(
!
GetFileSizeEx
(
source_file
,
&
source_file_size
))
{
CloseHandle
(
source_file
);
return
FALSE
;
}
p
=
strrchrW
(
target
,
'\\'
)
+
1
;
p
=
strrchrW
(
target
,
'\\'
)
+
1
;
memcpy
(
p
,
oem
,
sizeof
(
oem
)
);
memcpy
(
p
,
oem
,
sizeof
(
oem
)
);
...
@@ -968,12 +1005,30 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
...
@@ -968,12 +1005,30 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
for
(
i
=
0
;
i
<
OEM_INDEX_LIMIT
;
i
++
)
for
(
i
=
0
;
i
<
OEM_INDEX_LIMIT
;
i
++
)
{
{
static
const
WCHAR
format
[]
=
{
'%'
,
'u'
,
'.'
,
'i'
,
'n'
,
'f'
,
0
};
static
const
WCHAR
format
[]
=
{
'%'
,
'u'
,
'.'
,
'i'
,
'n'
,
'f'
,
0
};
HANDLE
dest_file
;
LARGE_INTEGER
dest_file_size
;
wsprintfW
(
p
,
format
,
i
);
wsprintfW
(
p
,
format
,
i
);
dest_file
=
CreateFileW
(
target
,
FILE_READ_DATA
|
FILE_READ_ATTRIBUTES
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
/* if we found a file name that doesn't exist then we're done */
/* if we found a file name that doesn't exist then we're done */
if
(
GetFileAttributesW
(
target
)
==
INVALID_FILE_ATTRIBUTES
)
if
(
dest_file
==
INVALID_HANDLE_VALUE
)
break
;
break
;
/* now check if the same inf file has already been copied to the inf
* directory. if so, use that file and don't create a new one */
if
(
!
GetFileSizeEx
(
dest_file
,
&
dest_file_size
)
||
(
dest_file_size
.
QuadPart
!=
source_file_size
.
QuadPart
)
||
compare_files
(
source_file
,
dest_file
))
{
CloseHandle
(
dest_file
);
continue
;
}
CloseHandle
(
dest_file
);
break
;
}
}
CloseHandle
(
source_file
);
if
(
i
==
OEM_INDEX_LIMIT
)
if
(
i
==
OEM_INDEX_LIMIT
)
{
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
...
...
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