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
686a9f90
Commit
686a9f90
authored
May 19, 2003
by
Huw Davies
Committed by
Alexandre Julliard
May 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic implementation of EnumPortsA: dump all the serial and printer
port names into a structure.
parent
2517d809
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
4 deletions
+112
-4
Makefile.in
dlls/winspool/Makefile.in
+1
-1
info.c
dlls/winspool/info.c
+111
-3
No files found.
dlls/winspool/Makefile.in
View file @
686a9f90
...
...
@@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
winspool.drv
IMPORTS
=
advapi32 kernel32 ntdll
IMPORTS
=
user32
advapi32 kernel32 ntdll
LDDLLFLAGS
=
@LDDLLFLAGS@
SYMBOLFILE
=
$(MODULE)
.tmp.o
...
...
dlls/winspool/info.c
View file @
686a9f90
...
...
@@ -41,6 +41,7 @@
#define NONAMELESSSTRUCT
#include "wine/library.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "winreg.h"
#include "wingdi.h"
...
...
@@ -2872,15 +2873,122 @@ BOOL WINAPI EnumPrinterDriversA(LPSTR pName, LPSTR pEnvironment, DWORD Level,
return
ret
;
}
static
CHAR
PortMonitor
[]
=
"Wine Port Monitor"
;
static
CHAR
PortDescription
[]
=
"Wine Port"
;
/******************************************************************************
* EnumPortsA (WINSPOOL.@)
*/
BOOL
WINAPI
EnumPortsA
(
LPSTR
name
,
DWORD
level
,
LPBYTE
ports
,
DWORD
bufsize
,
BOOL
WINAPI
EnumPortsA
(
LPSTR
name
,
DWORD
level
,
LPBYTE
buffer
,
DWORD
bufsize
,
LPDWORD
bufneeded
,
LPDWORD
bufreturned
)
{
FIXME
(
"(%s,%ld,%p,%ld,%p,%p), stub!
\n
"
,
name
,
level
,
ports
,
bufsize
,
bufneeded
,
bufreturned
);
return
FALSE
;
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
;
TRACE
(
"(%s,%ld,%p,%ld,%p,%p)
\n
"
,
name
,
level
,
buffer
,
bufsize
,
bufneeded
,
bufreturned
);
switch
(
level
)
{
case
1
:
info_size
=
sizeof
(
PORT_INFO_1A
);
break
;
case
2
:
info_size
=
sizeof
(
PORT_INFO_2A
);
break
;
default:
SetLastError
(
ERROR_INVALID_LEVEL
);
return
FALSE
;
}
/* see how many exist */
hkey_serial
=
0
;
hkey_printer
=
0
;
serial_count
=
0
;
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
)
{
RegQueryInfoKeyA
(
hkey_printer
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
printer_count
,
NULL
,
NULL
,
NULL
,
NULL
);
}
count
=
serial_count
+
printer_count
;
/* then fill in the structure info structure once
we know the offset to the first string */
memset
(
buffer
,
0
,
bufsize
);
n
=
0
;
ofs
=
info_size
*
count
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
DWORD
vallen
=
sizeof
portname
-
1
;
/* get the serial port values, then the printer values */
if
(
i
<
serial_count
)
r
=
RegEnumValueA
(
hkey_serial
,
i
,
portname
,
&
vallen
,
NULL
,
NULL
,
NULL
,
0
);
else
r
=
RegEnumValueA
(
hkey_printer
,
i
-
serial_count
,
portname
,
&
vallen
,
NULL
,
NULL
,
NULL
,
0
);
if
(
r
)
continue
;
/* add a colon if necessary, and make it upper case */
CharUpperBuffA
(
portname
,
vallen
);
if
(
strcasecmp
(
portname
,
"nul"
)
!=
0
)
if
(
vallen
&&
(
portname
[
vallen
-
1
]
!=
':'
)
)
lstrcatA
(
portname
,
":"
);
/* add the port info structure if we can fit it */
if
(
info_size
*
(
n
+
1
)
<
bufsize
)
{
if
(
level
==
1
)
{
PORT_INFO_1A
*
info
=
(
PORT_INFO_1A
*
)
&
buffer
[
info_size
*
n
];
info
->
pName
=
(
LPSTR
)
&
buffer
[
ofs
];
}
else
if
(
level
==
2
)
{
PORT_INFO_2A
*
info
=
(
PORT_INFO_2A
*
)
&
buffer
[
info_size
*
n
];
info
->
pPortName
=
(
LPSTR
)
&
buffer
[
ofs
];
/* FIXME: fill in more stuff here */
info
->
pMonitorName
=
PortMonitor
;
info
->
pDescription
=
PortDescription
;
info
->
fPortType
=
PORT_TYPE_WRITE
|
PORT_TYPE_READ
;
}
/* add the name of the port if we can fit it */
if
(
ofs
<
bufsize
)
lstrcpynA
(
&
buffer
[
ofs
],
portname
,
bufsize
-
ofs
);
}
ofs
+=
lstrlenA
(
portname
)
+
1
;
n
++
;
}
RegCloseKey
(
hkey_serial
);
RegCloseKey
(
hkey_printer
);
if
(
bufneeded
)
*
bufneeded
=
ofs
;
if
(
bufreturned
)
*
bufreturned
=
count
;
return
TRUE
;
}
/******************************************************************************
...
...
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