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
1ae212a1
Commit
1ae212a1
authored
May 12, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
May 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split SHGetFileInfoW into two functions.
parent
ac5b0251
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
59 deletions
+63
-59
shell32_main.c
dlls/shell32/shell32_main.c
+63
-59
No files found.
dlls/shell32/shell32_main.c
View file @
1ae212a1
...
@@ -236,6 +236,67 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
...
@@ -236,6 +236,67 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
return
argv
;
return
argv
;
}
}
static
DWORD
shgfi_get_exe_type
(
LPCWSTR
szFullPath
)
{
BOOL
status
=
FALSE
;
HANDLE
hfile
;
DWORD
BinaryType
;
IMAGE_DOS_HEADER
mz_header
;
IMAGE_NT_HEADERS
nt
;
DWORD
len
;
char
magic
[
4
];
status
=
GetBinaryTypeW
(
szFullPath
,
&
BinaryType
);
if
(
!
status
)
return
0
;
if
(
BinaryType
==
SCS_DOS_BINARY
||
BinaryType
==
SCS_PIF_BINARY
)
return
0x4d5a
;
hfile
=
CreateFileW
(
szFullPath
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
0
;
/*
* The next section is adapted from MODULE_GetBinaryType, as we need
* to examine the image header to get OS and version information. We
* know from calling GetBinaryTypeA that the image is valid and either
* an NE or PE, so much error handling can be omitted.
* Seek to the start of the file and read the header information.
*/
SetFilePointer
(
hfile
,
0
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
mz_header
,
sizeof
(
mz_header
),
&
len
,
NULL
);
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
magic
,
sizeof
(
magic
),
&
len
,
NULL
);
if
(
*
(
DWORD
*
)
magic
==
IMAGE_NT_SIGNATURE
)
{
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
nt
,
sizeof
(
nt
),
&
len
,
NULL
);
CloseHandle
(
hfile
);
if
(
nt
.
OptionalHeader
.
Subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_GUI
)
{
return
IMAGE_NT_SIGNATURE
|
(
nt
.
OptionalHeader
.
MajorSubsystemVersion
<<
24
)
|
(
nt
.
OptionalHeader
.
MinorSubsystemVersion
<<
16
);
}
return
IMAGE_NT_SIGNATURE
;
}
else
if
(
*
(
WORD
*
)
magic
==
IMAGE_OS2_SIGNATURE
)
{
IMAGE_OS2_HEADER
ne
;
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
ne
,
sizeof
(
ne
),
&
len
,
NULL
);
CloseHandle
(
hfile
);
if
(
ne
.
ne_exetyp
==
2
)
return
IMAGE_OS2_SIGNATURE
|
(
ne
.
ne_expver
<<
16
);
return
0
;
}
CloseHandle
(
hfile
);
return
0
;
}
#define SHGFI_KNOWN_FLAGS \
#define SHGFI_KNOWN_FLAGS \
(SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
(SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
...
@@ -277,7 +338,7 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
...
@@ -277,7 +338,7 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if
(
!
(
flags
&
SHGFI_PIDL
))
if
(
!
(
flags
&
SHGFI_PIDL
))
{
{
/* SHG
i
tFileInfo should work with absolute and relative paths */
/* SHG
e
tFileInfo should work with absolute and relative paths */
if
(
PathIsRelativeW
(
path
))
if
(
PathIsRelativeW
(
path
))
{
{
GetCurrentDirectoryW
(
MAX_PATH
,
szLocation
);
GetCurrentDirectoryW
(
MAX_PATH
,
szLocation
);
...
@@ -291,66 +352,9 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
...
@@ -291,66 +352,9 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if
(
flags
&
SHGFI_EXETYPE
)
if
(
flags
&
SHGFI_EXETYPE
)
{
{
BOOL
status
=
FALSE
;
HANDLE
hfile
;
DWORD
BinaryType
;
IMAGE_DOS_HEADER
mz_header
;
IMAGE_NT_HEADERS
nt
;
DWORD
len
;
char
magic
[
4
];
if
(
flags
!=
SHGFI_EXETYPE
)
if
(
flags
!=
SHGFI_EXETYPE
)
return
0
;
return
0
;
return
shgfi_get_exe_type
(
szFullPath
);
status
=
GetBinaryTypeW
(
szFullPath
,
&
BinaryType
);
if
(
!
status
)
return
0
;
if
((
BinaryType
==
SCS_DOS_BINARY
)
||
(
BinaryType
==
SCS_PIF_BINARY
))
return
0x4d5a
;
hfile
=
CreateFileW
(
szFullPath
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
0
;
/*
* The next section is adapted from MODULE_GetBinaryType, as we need
* to examine the image header to get OS and version information. We
* know from calling GetBinaryTypeA that the image is valid and either
* an NE or PE, so much error handling can be omitted.
* Seek to the start of the file and read the header information.
*/
SetFilePointer
(
hfile
,
0
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
mz_header
,
sizeof
(
mz_header
),
&
len
,
NULL
);
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
magic
,
sizeof
(
magic
),
&
len
,
NULL
);
if
(
*
(
DWORD
*
)
magic
==
IMAGE_NT_SIGNATURE
)
{
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
nt
,
sizeof
(
nt
),
&
len
,
NULL
);
CloseHandle
(
hfile
);
if
(
nt
.
OptionalHeader
.
Subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_GUI
)
{
return
IMAGE_NT_SIGNATURE
|
(
nt
.
OptionalHeader
.
MajorSubsystemVersion
<<
24
)
|
(
nt
.
OptionalHeader
.
MinorSubsystemVersion
<<
16
);
}
return
IMAGE_NT_SIGNATURE
;
}
else
if
(
*
(
WORD
*
)
magic
==
IMAGE_OS2_SIGNATURE
)
{
IMAGE_OS2_HEADER
ne
;
SetFilePointer
(
hfile
,
mz_header
.
e_lfanew
,
NULL
,
SEEK_SET
);
ReadFile
(
hfile
,
&
ne
,
sizeof
(
ne
),
&
len
,
NULL
);
CloseHandle
(
hfile
);
if
(
ne
.
ne_exetyp
==
2
)
return
IMAGE_OS2_SIGNATURE
|
(
ne
.
ne_expver
<<
16
);
return
0
;
}
CloseHandle
(
hfile
);
return
0
;
}
}
/*
/*
...
...
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