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
ad2895d1
Commit
ad2895d1
authored
Sep 05, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Register builtin encoders.
parent
d701e8fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
250 additions
and
0 deletions
+250
-0
regsvr.c
dlls/windowscodecs/regsvr.c
+248
-0
wincodecs_private.h
dlls/windowscodecs/wincodecs_private.h
+2
-0
No files found.
dlls/windowscodecs/regsvr.c
View file @
ad2895d1
...
...
@@ -83,6 +83,21 @@ struct regsvr_decoder
static
HRESULT
register_decoders
(
struct
regsvr_decoder
const
*
list
);
static
HRESULT
unregister_decoders
(
struct
regsvr_decoder
const
*
list
);
struct
regsvr_encoder
{
CLSID
const
*
clsid
;
/* NULL for end of list */
LPCSTR
author
;
LPCSTR
friendlyname
;
LPCSTR
version
;
GUID
const
*
vendor
;
LPCSTR
mimetypes
;
LPCSTR
extensions
;
GUID
const
*
const
*
formats
;
};
static
HRESULT
register_encoders
(
struct
regsvr_encoder
const
*
list
);
static
HRESULT
unregister_encoders
(
struct
regsvr_encoder
const
*
list
);
struct
regsvr_converter
{
CLSID
const
*
clsid
;
/* NULL for end of list */
...
...
@@ -475,6 +490,177 @@ error_return:
}
/***********************************************************************
* register_encoders
*/
static
HRESULT
register_encoders
(
struct
regsvr_encoder
const
*
list
)
{
LONG
res
=
ERROR_SUCCESS
;
HKEY
coclass_key
;
WCHAR
buf
[
39
];
HKEY
encoders_key
;
HKEY
instance_key
;
res
=
RegCreateKeyExW
(
HKEY_CLASSES_ROOT
,
clsid_keyname
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
coclass_key
,
NULL
);
if
(
res
==
ERROR_SUCCESS
)
{
StringFromGUID2
(
&
CATID_WICBitmapEncoders
,
buf
,
39
);
res
=
RegCreateKeyExW
(
coclass_key
,
buf
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
encoders_key
,
NULL
);
if
(
res
==
ERROR_SUCCESS
)
{
res
=
RegCreateKeyExW
(
encoders_key
,
instance_keyname
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
instance_key
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_coclass_key
;
}
if
(
res
!=
ERROR_SUCCESS
)
RegCloseKey
(
coclass_key
);
}
if
(
res
!=
ERROR_SUCCESS
)
goto
error_return
;
for
(;
res
==
ERROR_SUCCESS
&&
list
->
clsid
;
++
list
)
{
HKEY
clsid_key
;
HKEY
instance_clsid_key
;
StringFromGUID2
(
list
->
clsid
,
buf
,
39
);
res
=
RegCreateKeyExW
(
coclass_key
,
buf
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
clsid_key
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_coclass_key
;
StringFromGUID2
(
list
->
clsid
,
buf
,
39
);
res
=
RegCreateKeyExW
(
instance_key
,
buf
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
instance_clsid_key
,
NULL
);
if
(
res
==
ERROR_SUCCESS
)
{
res
=
RegSetValueExW
(
instance_clsid_key
,
clsid_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
buf
),
78
);
RegCloseKey
(
instance_clsid_key
);
}
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
if
(
list
->
author
)
{
res
=
RegSetValueExA
(
clsid_key
,
author_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
list
->
author
),
strlen
(
list
->
author
)
+
1
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
friendlyname
)
{
res
=
RegSetValueExA
(
clsid_key
,
friendlyname_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
list
->
friendlyname
),
strlen
(
list
->
friendlyname
)
+
1
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
vendor
)
{
StringFromGUID2
(
list
->
vendor
,
buf
,
39
);
res
=
RegSetValueExW
(
clsid_key
,
vendor_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
buf
),
78
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
version
)
{
res
=
RegSetValueExA
(
clsid_key
,
version_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
list
->
version
),
strlen
(
list
->
version
)
+
1
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
mimetypes
)
{
res
=
RegSetValueExA
(
clsid_key
,
mimetypes_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
list
->
mimetypes
),
strlen
(
list
->
mimetypes
)
+
1
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
extensions
)
{
res
=
RegSetValueExA
(
clsid_key
,
extensions_valuename
,
0
,
REG_SZ
,
(
CONST
BYTE
*
)(
list
->
extensions
),
strlen
(
list
->
extensions
)
+
1
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
if
(
list
->
formats
)
{
HKEY
formats_key
;
GUID
const
*
const
*
format
;
res
=
RegCreateKeyExW
(
clsid_key
,
formats_keyname
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
formats_key
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
for
(
format
=
list
->
formats
;
*
format
;
++
format
)
{
HKEY
format_key
;
StringFromGUID2
(
*
format
,
buf
,
39
);
res
=
RegCreateKeyExW
(
formats_key
,
buf
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
format_key
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
break
;
RegCloseKey
(
format_key
);
}
RegCloseKey
(
formats_key
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_clsid_key
;
}
error_close_clsid_key:
RegCloseKey
(
clsid_key
);
}
error_close_coclass_key:
RegCloseKey
(
instance_key
);
RegCloseKey
(
encoders_key
);
RegCloseKey
(
coclass_key
);
error_return:
return
res
!=
ERROR_SUCCESS
?
HRESULT_FROM_WIN32
(
res
)
:
S_OK
;
}
/***********************************************************************
* unregister_encoders
*/
static
HRESULT
unregister_encoders
(
struct
regsvr_encoder
const
*
list
)
{
LONG
res
=
ERROR_SUCCESS
;
HKEY
coclass_key
;
WCHAR
buf
[
39
];
HKEY
encoders_key
;
HKEY
instance_key
;
res
=
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
clsid_keyname
,
0
,
KEY_READ
|
KEY_WRITE
,
&
coclass_key
);
if
(
res
==
ERROR_FILE_NOT_FOUND
)
return
S_OK
;
if
(
res
==
ERROR_SUCCESS
)
{
StringFromGUID2
(
&
CATID_WICBitmapEncoders
,
buf
,
39
);
res
=
RegCreateKeyExW
(
coclass_key
,
buf
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
encoders_key
,
NULL
);
if
(
res
==
ERROR_SUCCESS
)
{
res
=
RegCreateKeyExW
(
encoders_key
,
instance_keyname
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
instance_key
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_coclass_key
;
}
if
(
res
!=
ERROR_SUCCESS
)
RegCloseKey
(
coclass_key
);
}
if
(
res
!=
ERROR_SUCCESS
)
goto
error_return
;
for
(;
res
==
ERROR_SUCCESS
&&
list
->
clsid
;
++
list
)
{
StringFromGUID2
(
list
->
clsid
,
buf
,
39
);
res
=
RegDeleteTreeW
(
coclass_key
,
buf
);
if
(
res
==
ERROR_FILE_NOT_FOUND
)
res
=
ERROR_SUCCESS
;
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_coclass_key
;
res
=
RegDeleteTreeW
(
instance_key
,
buf
);
if
(
res
==
ERROR_FILE_NOT_FOUND
)
res
=
ERROR_SUCCESS
;
if
(
res
!=
ERROR_SUCCESS
)
goto
error_close_coclass_key
;
}
error_close_coclass_key:
RegCloseKey
(
instance_key
);
RegCloseKey
(
encoders_key
);
RegCloseKey
(
coclass_key
);
error_return:
return
res
!=
ERROR_SUCCESS
?
HRESULT_FROM_WIN32
(
res
)
:
S_OK
;
}
/***********************************************************************
* register_converters
*/
static
HRESULT
register_converters
(
struct
regsvr_converter
const
*
list
)
...
...
@@ -969,6 +1155,64 @@ static struct regsvr_decoder const decoder_list[] = {
{
NULL
}
/* list terminator */
};
static
GUID
const
*
const
bmp_encode_formats
[]
=
{
&
GUID_WICPixelFormat16bppBGR555
,
&
GUID_WICPixelFormat16bppBGR565
,
&
GUID_WICPixelFormat24bppBGR
,
&
GUID_WICPixelFormat32bppBGR
,
NULL
};
static
GUID
const
*
const
png_encode_formats
[]
=
{
&
GUID_WICPixelFormat24bppBGR
,
&
GUID_WICPixelFormatBlackWhite
,
&
GUID_WICPixelFormat2bppGray
,
&
GUID_WICPixelFormat4bppGray
,
&
GUID_WICPixelFormat8bppGray
,
&
GUID_WICPixelFormat16bppGray
,
&
GUID_WICPixelFormat32bppBGR
,
&
GUID_WICPixelFormat32bppBGRA
,
&
GUID_WICPixelFormat48bppRGB
,
&
GUID_WICPixelFormat64bppRGBA
,
NULL
};
static
GUID
const
*
const
icns_encode_formats
[]
=
{
&
GUID_WICPixelFormat32bppBGRA
,
NULL
};
static
struct
regsvr_encoder
const
encoder_list
[]
=
{
{
&
CLSID_WICBmpEncoder
,
"The Wine Project"
,
"BMP Encoder"
,
"1.0.0.0"
,
&
GUID_VendorMicrosoft
,
"image/bmp"
,
".bmp,.dib,.rle"
,
bmp_encode_formats
},
{
&
CLSID_WICPngEncoder
,
"The Wine Project"
,
"PNG Encoder"
,
"1.0.0.0"
,
&
GUID_VendorMicrosoft
,
"image/png"
,
".png"
,
png_encode_formats
},
{
&
CLSID_WICIcnsEncoder
,
"The Wine Project"
,
"ICNS Encoder"
,
"1.0.0.0"
,
&
GUID_VendorWine
,
"image/icns"
,
".icns"
,
icns_encode_formats
},
{
NULL
}
/* list terminator */
};
static
GUID
const
*
const
converter_formats
[]
=
{
&
GUID_WICPixelFormat1bppIndexed
,
&
GUID_WICPixelFormat2bppIndexed
,
...
...
@@ -1010,6 +1254,8 @@ HRESULT WINAPI DllRegisterServer(void)
if
(
SUCCEEDED
(
hr
))
register_decoders
(
decoder_list
);
if
(
SUCCEEDED
(
hr
))
register_encoders
(
encoder_list
);
if
(
SUCCEEDED
(
hr
))
register_converters
(
converter_list
);
return
hr
;
}
...
...
@@ -1024,6 +1270,8 @@ HRESULT WINAPI DllUnregisterServer(void)
if
(
SUCCEEDED
(
hr
))
unregister_decoders
(
decoder_list
);
if
(
SUCCEEDED
(
hr
))
unregister_encoders
(
encoder_list
);
if
(
SUCCEEDED
(
hr
))
unregister_converters
(
converter_list
);
return
hr
;
}
dlls/windowscodecs/wincodecs_private.h
View file @
ad2895d1
...
...
@@ -21,6 +21,8 @@
DEFINE_GUID
(
CLSID_WICIcnsEncoder
,
0x312fb6f1
,
0xb767
,
0x409d
,
0x8a
,
0x6d
,
0x0f
,
0xc1
,
0x54
,
0xd4
,
0xf0
,
0x5c
);
DEFINE_GUID
(
GUID_VendorWine
,
0xddf46da1
,
0x7dc1
,
0x404e
,
0x98
,
0xf2
,
0xef
,
0xa4
,
0x8d
,
0xfc
,
0x95
,
0x0a
);
extern
HRESULT
FormatConverter_CreateInstance
(
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
);
extern
HRESULT
ImagingFactory_CreateInstance
(
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
);
extern
HRESULT
BmpDecoder_CreateInstance
(
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
);
...
...
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