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
8141fb80
Commit
8141fb80
authored
Nov 15, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: Create service environment when first service is started.
parent
f0d8c338
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
Makefile.in
programs/services/Makefile.in
+1
-1
services.c
programs/services/services.c
+16
-1
No files found.
programs/services/Makefile.in
View file @
8141fb80
EXTRADEFS
=
-DWINE_NO_UNICODE_MACROS
MODULE
=
services.exe
APPMODE
=
-mconsole
IMPORTS
=
rpcrt4 advapi32
IMPORTS
=
rpcrt4 advapi32
userenv
C_SRCS
=
\
rpc.c
\
...
...
programs/services/services.c
View file @
8141fb80
...
...
@@ -24,6 +24,7 @@
#include <windows.h>
#include <winsvc.h>
#include <rpc.h>
#include <userenv.h>
#include "wine/unicode.h"
#include "wine/debug.h"
...
...
@@ -40,6 +41,7 @@ struct scmdatabase *active_database;
DWORD
service_pipe_timeout
=
10000
;
DWORD
service_kill_timeout
=
20000
;
static
void
*
env
=
NULL
;
static
const
int
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
...
...
@@ -581,6 +583,17 @@ static DWORD service_start_process(struct service_entry *service_entry, HANDLE *
service_lock_exclusive
(
service_entry
);
if
(
!
env
)
{
HANDLE
htok
;
if
(
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
|
TOKEN_DUPLICATE
,
&
htok
))
CreateEnvironmentBlock
(
&
env
,
htok
,
FALSE
);
if
(
!
env
)
WINE_ERR
(
"failed to create services environment
\n
"
);
}
size
=
ExpandEnvironmentStringsW
(
service_entry
->
config
.
lpBinaryPathName
,
NULL
,
0
);
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
if
(
!
path
)
...
...
@@ -632,7 +645,7 @@ static DWORD service_start_process(struct service_entry *service_entry, HANDLE *
service_unlock
(
service_entry
);
r
=
CreateProcessW
(
NULL
,
path
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
r
=
CreateProcessW
(
NULL
,
path
,
NULL
,
NULL
,
FALSE
,
CREATE_UNICODE_ENVIRONMENT
,
env
,
NULL
,
&
si
,
&
pi
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
if
(
!
r
)
{
...
...
@@ -867,5 +880,7 @@ int main(int argc, char *argv[])
RPC_MainLoop
();
}
scmdatabase_destroy
(
active_database
);
if
(
env
)
DestroyEnvironmentBlock
(
env
);
return
err
;
}
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