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
3ff08570
Commit
3ff08570
authored
Mar 22, 2004
by
Kevin Koltzau
Committed by
Alexandre Julliard
Mar 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement FindMimeFromData.
parent
8901df76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
3 deletions
+53
-3
Makefile.in
dlls/urlmon/Makefile.in
+1
-1
umon.c
dlls/urlmon/umon.c
+52
-2
No files found.
dlls/urlmon/Makefile.in
View file @
3ff08570
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
urlmon.dll
IMPORTS
=
cabinet ole32 wininet user32 kernel32 ntdll
IMPORTS
=
cabinet ole32 wininet user32
advapi32
kernel32 ntdll
EXTRALIBS
=
-luuid
C_SRCS
=
\
...
...
dlls/urlmon/umon.c
View file @
3ff08570
...
...
@@ -918,18 +918,68 @@ HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption,
return
S_OK
;
}
static
BOOL
URLMON_IsBinary
(
LPVOID
pBuffer
,
DWORD
cbSize
)
{
int
binarycount
=
0
;
int
i
;
unsigned
char
*
buff
=
pBuffer
;
for
(
i
=
0
;
i
<
cbSize
;
i
++
)
{
if
(
buff
[
i
]
<
32
)
binarycount
++
;
}
return
binarycount
>
(
cbSize
-
binarycount
);
}
/***********************************************************************
* FindMimeFromData (URLMON.@)
*
* Determines the Multipurpose Internet Mail Extensions (MIME) type from the data provided.
*
* NOTE
* See http://msdn.microsoft.com/workshop/networking/moniker/overview/appendix_a.asp
*/
HRESULT
WINAPI
FindMimeFromData
(
LPBC
pBC
,
LPCWSTR
pwzUrl
,
LPVOID
pBuffer
,
DWORD
cbSize
,
LPCWSTR
pwzMimeProposed
,
DWORD
dwMimeFlags
,
LPWSTR
*
ppwzMimeOut
,
DWORD
dwReserved
)
{
FIXME
(
"stub
\n
"
);
return
E_OUTOFMEMORY
;
const
WCHAR
szBinaryMime
[]
=
{
'a'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'/'
,
'o'
,
'c'
,
't'
,
'e'
,
't'
,
'-'
,
's'
,
't'
,
'r'
,
'e'
,
'a'
,
'm'
,
'\0'
};
const
WCHAR
szTextMime
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'p'
,
'l'
,
'a'
,
'i'
,
'n'
,
'\0'
};
const
WCHAR
szContentType
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
' '
,
'T'
,
'y'
,
'p'
,
'e'
,
'\0'
};
WCHAR
szTmpMime
[
256
];
LPCWSTR
mimeType
=
NULL
;
HKEY
hKey
=
NULL
;
TRACE
(
"(%p,%s,%p,%ld,%s,0x%lx,%p,0x%lx)
\n
"
,
pBC
,
debugstr_w
(
pwzUrl
),
pBuffer
,
cbSize
,
debugstr_w
(
pwzMimeProposed
),
dwMimeFlags
,
ppwzMimeOut
,
dwReserved
);
if
((
!
pwzUrl
&&
(
!
pBuffer
||
cbSize
<=
0
))
||
!
ppwzMimeOut
)
return
E_INVALIDARG
;
if
(
pwzMimeProposed
)
mimeType
=
pwzMimeProposed
;
else
{
/* Try and find the mime type in the registry */
if
(
pwzUrl
)
{
LPWSTR
ext
=
strrchrW
(
pwzUrl
,
'.'
);
if
(
ext
)
{
DWORD
dwSize
;
if
(
!
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
ext
,
0
,
0
,
&
hKey
))
{
if
(
!
RegQueryValueExW
(
hKey
,
szContentType
,
NULL
,
NULL
,
(
LPBYTE
)
szTmpMime
,
&
dwSize
))
{
mimeType
=
szTmpMime
;
}
RegCloseKey
(
hKey
);
}
}
}
}
if
(
!
mimeType
&&
pBuffer
&&
cbSize
>
0
)
mimeType
=
URLMON_IsBinary
(
pBuffer
,
cbSize
)
?
szBinaryMime
:
szTextMime
;
TRACE
(
"Using %s
\n
"
,
debugstr_w
(
mimeType
));
*
ppwzMimeOut
=
CoTaskMemAlloc
((
lstrlenW
(
mimeType
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!*
ppwzMimeOut
)
return
E_OUTOFMEMORY
;
lstrcpyW
(
*
ppwzMimeOut
,
mimeType
);
return
S_OK
;
}
/***********************************************************************
...
...
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