Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bdd561cf
Commit
bdd561cf
authored
Nov 27, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Add FILE: port monitor implementation.
parent
3e5bdebb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
28 deletions
+83
-28
localmon.c
dlls/localspl/localmon.c
+83
-28
No files found.
dlls/localspl/localmon.c
View file @
bdd561cf
...
@@ -65,6 +65,7 @@ static CRITICAL_SECTION xcv_handles_cs = { &xcv_handles_cs_debug, -1, 0, 0, 0, 0
...
@@ -65,6 +65,7 @@ static CRITICAL_SECTION xcv_handles_cs = { &xcv_handles_cs_debug, -1, 0, 0, 0, 0
typedef
struct
{
typedef
struct
{
struct
list
entry
;
struct
list
entry
;
DWORD
type
;
DWORD
type
;
HANDLE
hfile
;
WCHAR
nameW
[
1
];
WCHAR
nameW
[
1
];
}
port_t
;
}
port_t
;
...
@@ -386,31 +387,6 @@ static BOOL WINAPI localmon_AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer
...
@@ -386,31 +387,6 @@ static BOOL WINAPI localmon_AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer
}
}
/*****************************************************
/*****************************************************
* localmon_ClosePort [exported through MONITOREX]
*
* Close a
*
* PARAMS
* hPort [i] The Handle to close
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*
*/
static
BOOL
WINAPI
localmon_ClosePort
(
HANDLE
hPort
)
{
port_t
*
port
=
hPort
;
TRACE
(
"(%p)
\n
"
,
port
);
EnterCriticalSection
(
&
port_handles_cs
);
list_remove
(
&
port
->
entry
);
LeaveCriticalSection
(
&
port_handles_cs
);
free
(
port
);
return
TRUE
;
}
/*****************************************************
* localmon_EnumPortsW [exported through MONITOREX]
* localmon_EnumPortsW [exported through MONITOREX]
*
*
* Enumerate all local Ports
* Enumerate all local Ports
...
@@ -501,6 +477,7 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
...
@@ -501,6 +477,7 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
if
(
!
port
)
return
FALSE
;
if
(
!
port
)
return
FALSE
;
port
->
type
=
type
;
port
->
type
=
type
;
port
->
hfile
=
INVALID_HANDLE_VALUE
;
lstrcpyW
(
port
->
nameW
,
pName
);
lstrcpyW
(
port
->
nameW
,
pName
);
*
phPort
=
port
;
*
phPort
=
port
;
...
@@ -512,6 +489,84 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
...
@@ -512,6 +489,84 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
WINAPI
localmon_StartDocPort
(
HANDLE
hport
,
WCHAR
*
printer_name
,
DWORD
job_id
,
DWORD
level
,
BYTE
*
info
)
{
DOC_INFO_1W
*
doc_info
=
(
DOC_INFO_1W
*
)
info
;
port_t
*
port
=
hport
;
TRACE
(
"(%p %s %ld %ld %p)
\n
"
,
hport
,
debugstr_w
(
printer_name
),
job_id
,
level
,
doc_info
);
if
(
port
->
type
!=
PORT_IS_FILE
)
{
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
}
if
(
port
->
hfile
!=
INVALID_HANDLE_VALUE
)
return
TRUE
;
if
(
!
doc_info
||
!
doc_info
->
pOutputFile
)
{
FIXME
(
"set error
\n
"
);
return
FALSE
;
}
port
->
hfile
=
CreateFileW
(
doc_info
->
pOutputFile
,
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
OPEN_ALWAYS
,
0
,
NULL
);
return
port
->
hfile
!=
INVALID_HANDLE_VALUE
;
}
static
BOOL
WINAPI
localmon_WritePort
(
HANDLE
hport
,
BYTE
*
buf
,
DWORD
size
,
DWORD
*
written
)
{
port_t
*
port
=
hport
;
TRACE
(
"(%p %p %lu %p)
\n
"
,
hport
,
buf
,
size
,
written
);
return
WriteFile
(
port
->
hfile
,
buf
,
size
,
written
,
NULL
);
}
static
BOOL
WINAPI
localmon_EndDocPort
(
HANDLE
hport
)
{
port_t
*
port
=
hport
;
TRACE
(
"(%p)
\n
"
,
hport
);
CloseHandle
(
port
->
hfile
);
port
->
hfile
=
INVALID_HANDLE_VALUE
;
return
TRUE
;
}
/*****************************************************
* localmon_ClosePort [exported through MONITOREX]
*
* Close a Port
*
* PARAMS
* hport [i] The Handle to close
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*
*/
static
BOOL
WINAPI
localmon_ClosePort
(
HANDLE
hport
)
{
port_t
*
port
=
hport
;
TRACE
(
"(%p)
\n
"
,
port
);
localmon_EndDocPort
(
hport
);
EnterCriticalSection
(
&
port_handles_cs
);
list_remove
(
&
port
->
entry
);
LeaveCriticalSection
(
&
port_handles_cs
);
free
(
port
);
return
TRUE
;
}
/*****************************************************
/*****************************************************
* localmon_XcvClosePort [exported through MONITOREX]
* localmon_XcvClosePort [exported through MONITOREX]
*
*
...
@@ -755,10 +810,10 @@ LPMONITOREX WINAPI InitializePrintMonitor(LPWSTR regroot)
...
@@ -755,10 +810,10 @@ LPMONITOREX WINAPI InitializePrintMonitor(LPWSTR regroot)
localmon_EnumPortsW
,
localmon_EnumPortsW
,
localmon_OpenPortW
,
localmon_OpenPortW
,
NULL
,
/* localmon_OpenPortExW */
NULL
,
/* localmon_OpenPortExW */
NULL
,
/* localmon_StartDocPortW */
localmon_StartDocPort
,
NULL
,
/* localmon_WritePortW */
localmon_WritePort
,
NULL
,
/* localmon_ReadPortW */
NULL
,
/* localmon_ReadPortW */
NULL
,
/* localmon_EndDocPortW */
localmon_EndDocPort
,
localmon_ClosePort
,
localmon_ClosePort
,
NULL
,
/* Use AddPortUI in localui.dll */
NULL
,
/* Use AddPortUI in localui.dll */
localmon_AddPortExW
,
localmon_AddPortExW
,
...
...
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