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
6c8929f8
Commit
6c8929f8
authored
Nov 30, 2011
by
Ken Thomases
Committed by
Alexandre Julliard
Dec 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi.exe16: Wait for and reap print spool child process.
parent
5bac5ee2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
printdrv.c
dlls/gdi.exe16/printdrv.c
+23
-5
No files found.
dlls/gdi.exe16/printdrv.c
View file @
6c8929f8
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
#ifdef HAVE_IO_H
#ifdef HAVE_IO_H
# include <io.h>
# include <io.h>
#endif
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# include <unistd.h>
#endif
#endif
...
@@ -205,6 +208,7 @@ typedef struct PRINTJOB
...
@@ -205,6 +208,7 @@ typedef struct PRINTJOB
HANDLE16
hHandle
;
HANDLE16
hHandle
;
int
nIndex
;
int
nIndex
;
int
fd
;
int
fd
;
pid_t
pid
;
}
PRINTJOB
,
*
PPRINTJOB
;
}
PRINTJOB
,
*
PPRINTJOB
;
#define MAX_PRINT_JOBS 1
#define MAX_PRINT_JOBS 1
...
@@ -218,7 +222,7 @@ static PPRINTJOB FindPrintJobFromHandle(HANDLE16 hHandle)
...
@@ -218,7 +222,7 @@ static PPRINTJOB FindPrintJobFromHandle(HANDLE16 hHandle)
return
gPrintJobsTable
[
0
];
return
gPrintJobsTable
[
0
];
}
}
static
int
CreateSpoolFile
(
LPCSTR
pszOutput
)
static
int
CreateSpoolFile
(
LPCSTR
pszOutput
,
pid_t
*
out_pid
)
{
{
int
fd
=-
1
;
int
fd
=-
1
;
char
psCmd
[
1024
];
char
psCmd
[
1024
];
...
@@ -227,9 +231,11 @@ static int CreateSpoolFile(LPCSTR pszOutput)
...
@@ -227,9 +231,11 @@ static int CreateSpoolFile(LPCSTR pszOutput)
/* TTD convert the 'output device' into a spool file name */
/* TTD convert the 'output device' into a spool file name */
if
(
pszOutput
==
NULL
||
*
pszOutput
==
'\0'
)
if
(
pszOutput
==
NULL
||
*
pszOutput
==
'\0'
||
out_pid
==
NULL
)
return
-
1
;
return
-
1
;
*
out_pid
=
-
1
;
psCmd
[
0
]
=
0
;
psCmd
[
0
]
=
0
;
/* @@ Wine registry key: HKCU\Software\Wine\Printing\Spooler */
/* @@ Wine registry key: HKCU\Software\Wine\Printing\Spooler */
if
(
!
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Printing
\\
Spooler"
,
&
hkey
))
if
(
!
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Printing
\\
Spooler"
,
&
hkey
))
...
@@ -263,7 +269,7 @@ static int CreateSpoolFile(LPCSTR pszOutput)
...
@@ -263,7 +269,7 @@ static int CreateSpoolFile(LPCSTR pszOutput)
ERR
(
"pipe() failed!
\n
"
);
ERR
(
"pipe() failed!
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
fork
(
)
==
0
)
if
(
(
*
out_pid
=
fork
()
)
==
0
)
{
{
psCmdP
++
;
psCmdP
++
;
...
@@ -317,12 +323,22 @@ static int FreePrintJob(HANDLE16 hJob)
...
@@ -317,12 +323,22 @@ static int FreePrintJob(HANDLE16 hJob)
pPrintJob
=
FindPrintJobFromHandle
(
hJob
);
pPrintJob
=
FindPrintJobFromHandle
(
hJob
);
if
(
pPrintJob
!=
NULL
)
if
(
pPrintJob
!=
NULL
)
{
{
nRet
=
SP_OK
;
gPrintJobsTable
[
pPrintJob
->
nIndex
]
=
NULL
;
gPrintJobsTable
[
pPrintJob
->
nIndex
]
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
->
pszOutput
);
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
->
pszOutput
);
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
->
pszTitle
);
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
->
pszTitle
);
if
(
pPrintJob
->
fd
>=
0
)
close
(
pPrintJob
->
fd
);
if
(
pPrintJob
->
fd
>=
0
)
close
(
pPrintJob
->
fd
);
if
(
pPrintJob
->
pid
>
0
)
{
pid_t
wret
;
int
status
;
do
{
wret
=
waitpid
(
pPrintJob
->
pid
,
&
status
,
0
);
}
while
(
wret
<
0
&&
errno
==
EINTR
);
if
(
wret
<
0
||
!
WIFEXITED
(
status
)
||
WEXITSTATUS
(
status
))
nRet
=
SP_ERROR
;
}
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
);
HeapFree
(
GetProcessHeap
(),
0
,
pPrintJob
);
nRet
=
SP_OK
;
}
}
return
nRet
;
return
nRet
;
}
}
...
@@ -342,9 +358,10 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
...
@@ -342,9 +358,10 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
if
(
pPrintJob
==
NULL
)
if
(
pPrintJob
==
NULL
)
{
{
int
fd
;
int
fd
;
pid_t
pid
;
/* Try and create a spool file */
/* Try and create a spool file */
fd
=
CreateSpoolFile
(
lpOutput
);
fd
=
CreateSpoolFile
(
lpOutput
,
&
pid
);
if
(
fd
>=
0
)
if
(
fd
>=
0
)
{
{
pPrintJob
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PRINTJOB
));
pPrintJob
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PRINTJOB
));
...
@@ -364,6 +381,7 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
...
@@ -364,6 +381,7 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
}
}
pPrintJob
->
hDC
=
hDC
;
pPrintJob
->
hDC
=
hDC
;
pPrintJob
->
fd
=
fd
;
pPrintJob
->
fd
=
fd
;
pPrintJob
->
pid
=
pid
;
pPrintJob
->
nIndex
=
0
;
pPrintJob
->
nIndex
=
0
;
pPrintJob
->
hHandle
=
hHandle
;
pPrintJob
->
hHandle
=
hHandle
;
gPrintJobsTable
[
pPrintJob
->
nIndex
]
=
pPrintJob
;
gPrintJobsTable
[
pPrintJob
->
nIndex
]
=
pPrintJob
;
...
...
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