Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
1dd462b6
Commit
1dd462b6
authored
3 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
twain_32: Fix loading of TWAIN source modules.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8f70855f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/twain_32/dsm_ctrl.c
+16
-19
16 additions, 19 deletions
dlls/twain_32/dsm_ctrl.c
with
16 additions
and
19 deletions
dlls/twain_32/dsm_ctrl.c
+
16
−
19
View file @
1dd462b6
...
...
@@ -40,7 +40,7 @@ static HWND DSM_parent;
static
UINT
event_message
;
struct
all_devices
{
char
*
modname
;
WCHAR
*
modname
;
TW_IDENTITY
identity
;
};
...
...
@@ -48,21 +48,23 @@ static int nrdevices = 0;
static
struct
all_devices
*
devices
=
NULL
;
static
void
twain_add_onedriver
(
const
char
*
dsname
)
{
twain_add_onedriver
(
const
WCHAR
*
dsname
)
{
HMODULE
hmod
;
DSENTRYPROC
dsEntry
;
TW_IDENTITY
fakeOrigin
;
TW_IDENTITY
sourceId
;
TW_UINT16
ret
;
WCHAR
path
[
MAX_PATH
];
hmod
=
LoadLibraryA
(
dsname
);
swprintf
(
path
,
MAX_PATH
,
L"c:
\\
windows
\\
twain_%u
\\
%s"
,
sizeof
(
void
*
)
*
8
,
dsname
);
hmod
=
LoadLibraryW
(
path
);
if
(
!
hmod
)
{
ERR
(
"Failed to load TWAIN Source %s
\n
"
,
debugstr_
a
(
dsname
));
ERR
(
"Failed to load TWAIN Source %s
\n
"
,
debugstr_
w
(
path
));
return
;
}
dsEntry
=
(
DSENTRYPROC
)
GetProcAddress
(
hmod
,
"DS_Entry"
);
if
(
!
dsEntry
)
{
ERR
(
"Failed to find DS_Entry() in TWAIN DS %s
\n
"
,
debugstr_
a
(
dsname
));
ERR
(
"Failed to find DS_Entry() in TWAIN DS %s
\n
"
,
debugstr_
w
(
path
));
return
;
}
/* Loop to do multiple detects, mostly for sane.ds and gphoto2.ds */
...
...
@@ -87,12 +89,8 @@ twain_add_onedriver(const char *dsname) {
}
if
(
i
<
nrdevices
)
break
;
if
(
nrdevices
)
devices
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
devices
,
sizeof
(
devices
[
0
])
*
(
nrdevices
+
1
));
else
devices
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
devices
[
0
]));
if
((
devices
[
nrdevices
].
modname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
dsname
)
+
1
)))
lstrcpyA
(
devices
[
nrdevices
].
modname
,
dsname
);
devices
=
realloc
(
devices
,
sizeof
(
devices
[
0
])
*
(
nrdevices
+
1
)
);
devices
[
nrdevices
].
modname
=
wcsdup
(
path
);
devices
[
nrdevices
].
identity
=
sourceId
;
nrdevices
++
;
DSM_sourceId
++
;
...
...
@@ -107,12 +105,12 @@ twain_autodetect(void) {
if
(
detectionrun
)
return
;
detectionrun
=
TRUE
;
twain_add_onedriver
(
"sane.ds"
);
twain_add_onedriver
(
"gphoto2.ds"
);
twain_add_onedriver
(
L
"sane.ds"
);
twain_add_onedriver
(
L
"gphoto2.ds"
);
#if 0
twain_add_onedriver("
c:\\windows\\Twain_32\\
Largan\\sp503a.ds");
twain_add_onedriver("
c:\\windows\\Twain_32\\
vivicam10\\vivicam10.ds");
twain_add_onedriver("
c:\\windows\\Twain_32\\
ws30slim\\sp500a.ds");
twain_add_onedriver(
L
"Largan\\sp503a.ds");
twain_add_onedriver(
L
"vivicam10\\vivicam10.ds");
twain_add_onedriver(
L
"ws30slim\\sp500a.ds");
#endif
}
...
...
@@ -282,7 +280,6 @@ TW_UINT16 TWAIN_OpenDS (pTW_IDENTITY pOrigin, TW_MEMREF pData)
TW_UINT16
i
=
0
;
pTW_IDENTITY
pIdentity
=
(
pTW_IDENTITY
)
pData
;
activeDS
*
newSource
;
const
char
*
modname
=
NULL
;
HMODULE
hmod
;
TRACE
(
"DG_CONTROL/DAT_IDENTITY/MSG_OPENDS
\n
"
);
...
...
@@ -315,9 +312,9 @@ TW_UINT16 TWAIN_OpenDS (pTW_IDENTITY pOrigin, TW_MEMREF pData)
FIXME
(
"Out of memory.
\n
"
);
return
TWRC_FAILURE
;
}
hmod
=
LoadLibrary
A
(
devices
[
i
].
modname
);
hmod
=
LoadLibrary
W
(
devices
[
i
].
modname
);
if
(
!
hmod
)
{
ERR
(
"Failed to load TWAIN Source %s
\n
"
,
debugstr_
a
(
modname
));
ERR
(
"Failed to load TWAIN Source %s
\n
"
,
debugstr_
w
(
devices
[
i
].
modname
));
DSM_twCC
=
TWCC_OPERATIONERROR
;
HeapFree
(
GetProcessHeap
(),
0
,
newSource
);
return
TWRC_FAILURE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment