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
05fb3ca6
Commit
05fb3ca6
authored
Oct 04, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Oct 04, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix port enumeration.
parent
c6a51b4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
16 deletions
+41
-16
info.c
dlls/winspool/info.c
+41
-16
No files found.
dlls/winspool/info.c
View file @
05fb3ca6
...
...
@@ -3002,6 +3002,34 @@ BOOL WINAPI EnumPrinterDriversA(LPSTR pName, LPSTR pEnvironment, DWORD Level,
static
CHAR
PortMonitor
[]
=
"Wine Port Monitor"
;
static
CHAR
PortDescription
[]
=
"Wine Port"
;
static
BOOL
WINSPOOL_ComPortExists
(
LPCSTR
name
)
{
HANDLE
handle
;
handle
=
CreateFileA
(
name
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
CloseHandle
(
handle
);
return
TRUE
;
}
static
DWORD
WINSPOOL_CountSerialPorts
()
{
CHAR
name
[
6
];
DWORD
n
=
0
,
i
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
strcpy
(
name
,
"COMx:"
);
name
[
3
]
=
'1'
+
i
;
if
(
WINSPOOL_ComPortExists
(
name
))
n
++
;
}
return
n
;
}
/******************************************************************************
* EnumPortsA (WINSPOOL.@)
*/
...
...
@@ -3010,9 +3038,8 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE buffer,DWORD bufsize,
{
CHAR
portname
[
10
];
DWORD
info_size
,
ofs
,
i
,
printer_count
,
serial_count
,
count
,
n
,
r
;
const
LPCSTR
szSerialPortKey
=
"Software
\\
Wine
\\
Wine
\\
Config
\\
serialports"
;
const
LPCSTR
szPrinterPortKey
=
"Software
\\
Wine
\\
Wine
\\
Config
\\
spooler"
;
HKEY
hkey_
serial
,
hkey_
printer
;
HKEY
hkey_printer
;
TRACE
(
"(%s,%ld,%p,%ld,%p,%p)
\n
"
,
name
,
level
,
buffer
,
bufsize
,
bufneeded
,
bufreturned
);
...
...
@@ -3032,16 +3059,9 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE buffer,DWORD bufsize,
/* see how many exist */
hkey_serial
=
0
;
hkey_printer
=
0
;
serial_count
=
0
;
serial_count
=
WINSPOOL_CountSerialPorts
()
;
printer_count
=
0
;
r
=
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
szSerialPortKey
,
&
hkey_serial
);
if
(
r
==
ERROR_SUCCESS
)
{
RegQueryInfoKeyA
(
hkey_serial
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
serial_count
,
NULL
,
NULL
,
NULL
,
NULL
);
}
r
=
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
szPrinterPortKey
,
&
hkey_printer
);
if
(
r
==
ERROR_SUCCESS
)
...
...
@@ -3063,14 +3083,20 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE buffer,DWORD bufsize,
/* get the serial port values, then the printer values */
if
(
i
<
serial_count
)
r
=
RegEnumValueA
(
hkey_serial
,
i
,
portname
,
&
vallen
,
NULL
,
NULL
,
NULL
,
0
);
{
strcpy
(
portname
,
"COMx:"
);
portname
[
3
]
=
'1'
+
i
;
if
(
!
WINSPOOL_ComPortExists
(
portname
))
continue
;
vallen
=
strlen
(
portname
);
}
else
{
r
=
RegEnumValueA
(
hkey_printer
,
i
-
serial_count
,
portname
,
&
vallen
,
NULL
,
NULL
,
NULL
,
0
);
if
(
r
)
continue
;
if
(
r
)
continue
;
}
/* add a colon if necessary, and make it upper case */
CharUpperBuffA
(
portname
,
vallen
);
...
...
@@ -3105,7 +3131,6 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE buffer,DWORD bufsize,
n
++
;
}
RegCloseKey
(
hkey_serial
);
RegCloseKey
(
hkey_printer
);
if
(
bufneeded
)
...
...
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