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
90714b88
Commit
90714b88
authored
Oct 27, 2006
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Oct 30, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Implement EnumPortsW.
parent
418d0933
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
213 additions
and
2 deletions
+213
-2
Makefile.in
dlls/localspl/Makefile.in
+1
-1
localmon.c
dlls/localspl/localmon.c
+178
-1
localspl.rc
dlls/localspl/localspl.rc
+3
-0
localspl_private.h
dlls/localspl/localspl_private.h
+3
-0
spl_En.rc
dlls/localspl/spl_En.rc
+28
-0
No files found.
dlls/localspl/Makefile.in
View file @
90714b88
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
localspl.dll
IMPORTS
=
kernel32
IMPORTS
=
user32 advapi32
kernel32
C_SRCS
=
\
localmon.c
\
...
...
dlls/localspl/localmon.c
View file @
90714b88
...
...
@@ -33,12 +33,186 @@
#include "winspool.h"
#include "ddk/winsplp.h"
#include "localspl_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
localspl
);
/*****************************************************/
static
const
WCHAR
WinNT_CV_PortsW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'P'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
/******************************************************************
* enumerate the local Ports from the Registry (internal)
*
* See localmon_EnumPortsW.
*
* NOTES
* returns the needed size (in bytes) for pPorts
* and *lpreturned is set to number of entries returned in pPorts
*
*/
static
DWORD
get_ports_from_reg
(
DWORD
level
,
LPBYTE
pPorts
,
DWORD
cbBuf
,
LPDWORD
lpreturned
)
{
HKEY
hroot
=
0
;
LPWSTR
ptr
;
LPPORT_INFO_2W
out
;
WCHAR
portname
[
MAX_PATH
];
WCHAR
res_PortW
[
32
];
WCHAR
res_MonitorW
[
32
];
INT
reslen_PortW
;
INT
reslen_MonitorW
;
DWORD
len
;
DWORD
res
;
DWORD
needed
=
0
;
DWORD
numentries
;
DWORD
entrysize
;
DWORD
id
=
0
;
TRACE
(
"(%d, %p, %d, %p)
\n
"
,
level
,
pPorts
,
cbBuf
,
lpreturned
);
entrysize
=
(
level
==
1
)
?
sizeof
(
PORT_INFO_1W
)
:
sizeof
(
PORT_INFO_2W
);
numentries
=
*
lpreturned
;
/* this is 0, when we scan the registry */
needed
=
entrysize
*
numentries
;
ptr
=
(
LPWSTR
)
&
pPorts
[
needed
];
if
(
needed
>
cbBuf
)
pPorts
=
NULL
;
/* No buffer for the structs */
numentries
=
0
;
needed
=
0
;
/* we do not check more parameters as done in windows */
if
((
level
<
1
)
||
(
level
>
2
))
{
goto
getports_cleanup
;
}
/* "+1" for '\0' */
reslen_MonitorW
=
LoadStringW
(
LOCALSPL_hInstance
,
IDS_LOCALMONITOR
,
res_MonitorW
,
32
)
+
1
;
reslen_PortW
=
LoadStringW
(
LOCALSPL_hInstance
,
IDS_LOCALPORT
,
res_PortW
,
32
)
+
1
;
res
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
WinNT_CV_PortsW
,
&
hroot
);
if
(
res
==
ERROR_SUCCESS
)
{
/* Scan all Port-Names */
while
(
res
==
ERROR_SUCCESS
)
{
len
=
MAX_PATH
;
portname
[
0
]
=
'\0'
;
res
=
RegEnumValueW
(
hroot
,
id
,
portname
,
&
len
,
NULL
,
NULL
,
NULL
,
NULL
);
if
((
res
==
ERROR_SUCCESS
)
&&
(
portname
[
0
]))
{
numentries
++
;
/* calsulate the required size */
needed
+=
entrysize
;
needed
+=
(
len
+
1
)
*
sizeof
(
WCHAR
);
if
(
level
>
1
)
{
needed
+=
(
reslen_MonitorW
+
reslen_PortW
)
*
sizeof
(
WCHAR
);
}
/* Now fill the user-buffer, if available */
if
(
pPorts
&&
(
cbBuf
>=
needed
)){
out
=
(
LPPORT_INFO_2W
)
pPorts
;
pPorts
+=
entrysize
;
TRACE
(
"%p: writing PORT_INFO_%dW #%d (%s)
\n
"
,
out
,
level
,
numentries
,
debugstr_w
(
portname
));
out
->
pPortName
=
ptr
;
lstrcpyW
(
ptr
,
portname
);
/* Name of the Port */
ptr
+=
(
len
+
1
);
if
(
level
>
1
)
{
out
->
pMonitorName
=
ptr
;
lstrcpyW
(
ptr
,
res_MonitorW
);
/* Name of the Monitor */
ptr
+=
reslen_MonitorW
;
out
->
pDescription
=
ptr
;
lstrcpyW
(
ptr
,
res_PortW
);
/* Port Description */
ptr
+=
reslen_PortW
;
out
->
fPortType
=
PORT_TYPE_WRITE
;
out
->
Reserved
=
0
;
}
}
id
++
;
}
}
RegCloseKey
(
hroot
);
}
else
{
ERR
(
"failed with %d for %s
\n
"
,
res
,
debugstr_w
(
WinNT_CV_PortsW
));
SetLastError
(
res
);
}
getports_cleanup:
*
lpreturned
=
numentries
;
TRACE
(
"need %d byte for %d entries (%d)
\n
"
,
needed
,
numentries
,
GetLastError
());
return
needed
;
}
/*****************************************************
* localmon_EnumPortsW [exported through MONITOREX]
*
* Enumerate all local Ports
*
* PARAMS
* pName [I] Servername (ignored)
* level [I] Structure-Level (1 or 2)
* pPorts [O] PTR to Buffer that receives the Result
* cbBuf [I] Size of Buffer at pPorts
* pcbNeeded [O] PTR to DWORD that receives the size in Bytes used / required for pPorts
* pcReturned [O] PTR to DWORD that receives the number of Ports in pPorts
*
* RETURNS
* Success: TRUE
* Failure: FALSE and in pcbNeeded the Bytes required for pPorts, if cbBuf is too small
*
* NOTES
*| Windows ignores pName
*| Windows crash the app, when pPorts, pcbNeeded or pcReturned are NULL
*| Windows >NT4.0 does not check for illegal levels (TRUE is returned)
*
* ToDo
* "HCU\Software\Wine\Spooler\<portname>" - redirection
*
*/
BOOL
WINAPI
localmon_EnumPortsW
(
LPWSTR
pName
,
DWORD
level
,
LPBYTE
pPorts
,
DWORD
cbBuf
,
LPDWORD
pcbNeeded
,
LPDWORD
pcReturned
)
{
BOOL
res
=
FALSE
;
DWORD
needed
;
DWORD
numentries
;
TRACE
(
"(%s, %d, %p, %d, %p, %p)
\n
"
,
debugstr_w
(
pName
),
level
,
pPorts
,
cbBuf
,
pcbNeeded
,
pcReturned
);
numentries
=
0
;
needed
=
get_ports_from_reg
(
level
,
NULL
,
0
,
&
numentries
);
/* we calculated the needed buffersize. now do the error-checks */
if
(
cbBuf
<
needed
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
goto
cleanup
;
}
/* fill the buffer with the Port-Names */
needed
=
get_ports_from_reg
(
level
,
pPorts
,
cbBuf
,
&
numentries
);
res
=
TRUE
;
if
(
pcReturned
)
*
pcReturned
=
numentries
;
cleanup:
if
(
pcbNeeded
)
*
pcbNeeded
=
needed
;
TRACE
(
"returning %d with %d (%d byte for %d entries)
\n
"
,
res
,
GetLastError
(),
needed
,
numentries
);
return
(
res
);
}
/*****************************************************
* InitializePrintMonitor (LOCALSPL.@)
*
...
...
@@ -62,7 +236,10 @@ LPMONITOREX WINAPI InitializePrintMonitor(LPWSTR regroot)
{
static
MONITOREX
mymonitorex
=
{
sizeof
(
MONITOREX
)
-
sizeof
(
DWORD
)
sizeof
(
MONITOREX
)
-
sizeof
(
DWORD
),
{
localmon_EnumPortsW
}
};
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
regroot
));
...
...
dlls/localspl/localspl.rc
View file @
90714b88
...
...
@@ -22,6 +22,7 @@
#include "windef.h"
#include "winbase.h"
#include "winver.h"
#include "localspl_private.h"
#define WINE_FILENAME_STR "localspl.dll"
#define WINE_FILEDESCRIPTION_STR "Wine Printer spooler component"
...
...
@@ -34,3 +35,5 @@
#define WINE_PRODUCTVERSION_STR "5.1.2600.2180"
#include "wine/wine_common_ver.rc"
#include "spl_En.rc"
dlls/localspl/localspl_private.h
View file @
90714b88
...
...
@@ -25,5 +25,8 @@
/* ## DLL-wide Globals ## */
extern
HINSTANCE
LOCALSPL_hInstance
;
/* ## Resource-ID ## */
#define IDS_LOCALPORT 500
#define IDS_LOCALMONITOR 507
#endif
/* __WINE_LOCALSPL_PRIVATE__ */
dlls/localspl/spl_En.rc
0 → 100644
View file @
90714b88
/*
* English resources for localspl
*
* Copyright 2005 Huw Davies
* Copyright 2006 Detlef Riekenberg
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_LOCALPORT "Local Port"
IDS_LOCALMONITOR "Local Monitor"
}
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