Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
3f0ddcb8
Commit
3f0ddcb8
authored
Dec 30, 2022
by
Luca Bacci
Committed by
Jehan
Jan 24, 2023
Browse files
Use GetBinaryTypeW ()
parent
1e24240f
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/plug-in/gimpplugin.c
View file @
3f0ddcb8
...
...
@@ -338,39 +338,32 @@ gimp_plug_in_flush (GIOChannel *channel,
static
void
gimp_plug_in_set_dll_directory
(
const
gchar
*
path
)
{
LPWSTR
w_path
;
const
gchar
*
install_dir
;
gchar
*
bin_dir
;
LPWSTR
w_bin_dir
;
DWORD
BinaryType
;
int
n
;
w_path
=
NULL
;
w_bin_dir
=
NULL
;
install_dir
=
gimp_installation_directory
();
if
(
path
&&
GetBinaryTypeA
(
path
,
&
BinaryType
)
&&
if
(
path
&&
(
w_path
=
g_utf8_to_utf16
(
path
,
-
1
,
NULL
,
NULL
,
NULL
))
&&
GetBinaryTypeW
(
w_path
,
&
BinaryType
)
&&
BinaryType
==
SCS_32BIT_BINARY
)
bin_dir
=
g_build_filename
(
install_dir
,
WIN32_32BIT_DLL_FOLDER
,
NULL
);
else
bin_dir
=
g_build_filename
(
install_dir
,
"bin"
,
NULL
);
n
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
bin_dir
,
-
1
,
NULL
,
0
);
if
(
n
==
0
)
goto
out
;
w_bin_dir
=
g_malloc_n
(
n
+
1
,
sizeof
(
wchar_t
));
n
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
bin_dir
,
-
1
,
w_bin_dir
,
(
n
+
1
)
*
sizeof
(
wchar_t
));
if
(
n
==
0
)
goto
out
;
SetDllDirectoryW
(
w_bin_dir
);
out:
w_bin_dir
=
g_utf8_to_utf16
(
bin_dir
,
-
1
,
NULL
,
NULL
,
NULL
);
if
(
w_bin_dir
)
g_free
((
void
*
)
w_bin_dir
);
{
SetDllDirectoryW
(
w_bin_dir
);
g_free
(
w_bin_dir
);
}
g_free
(
bin_dir
);
g_free
(
w_path
);
}
#endif
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment