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
31ec065b
Commit
31ec065b
authored
Sep 25, 2004
by
Alexander Yaworsky
Committed by
Alexandre Julliard
Sep 25, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructured code of StartServiceCtrlDispatcherA/W.
parent
34cffce6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
31 deletions
+34
-31
service.c
dlls/advapi32/service.c
+34
-31
No files found.
dlls/advapi32/service.c
View file @
31ec065b
...
@@ -218,6 +218,30 @@ static BOOL read_scm_lock_data( LPWSTR buffer )
...
@@ -218,6 +218,30 @@ static BOOL read_scm_lock_data( LPWSTR buffer )
}
}
/******************************************************************************
/******************************************************************************
* open_seb_shmem
*
* helper function for StartServiceCtrlDispatcherA/W
*/
static
struct
SEB
*
open_seb_shmem
(
LPWSTR
service_name
,
HANDLE
*
hServiceShmem
)
{
WCHAR
object_name
[
MAX_PATH
];
HANDLE
hmem
;
struct
SEB
*
ret
;
snprintfW
(
object_name
,
MAX_PATH
,
szServiceShmemNameFmtW
,
service_name
);
hmem
=
OpenFileMappingW
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
object_name
);
if
(
NULL
==
hmem
)
return
NULL
;
ret
=
MapViewOfFile
(
hmem
,
FILE_MAP_ALL_ACCESS
,
0
,
0
,
0
);
if
(
NULL
==
ret
)
CloseHandle
(
hmem
);
else
*
hServiceShmem
=
hmem
;
return
ret
;
}
/******************************************************************************
* build_arg_vectors
* build_arg_vectors
*
*
* helper function for StartServiceCtrlDispatcherA/W
* helper function for StartServiceCtrlDispatcherA/W
...
@@ -253,13 +277,13 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
...
@@ -253,13 +277,13 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
{
{
LPSERVICE_MAIN_FUNCTIONA
fpMain
;
LPSERVICE_MAIN_FUNCTIONA
fpMain
;
WCHAR
service_name
[
MAX_SERVICE_NAME
];
WCHAR
service_name
[
MAX_SERVICE_NAME
];
WCHAR
object_name
[
MAX_PATH
];
HANDLE
hServiceShmem
=
NULL
;
HANDLE
hServiceShmem
=
NULL
;
struct
SEB
*
seb
=
NULL
;
struct
SEB
*
seb
=
NULL
;
DWORD
dwNumServiceArgs
;
DWORD
dwNumServiceArgs
=
0
;
LPWSTR
*
lpArgVecW
=
NULL
;
LPWSTR
*
lpArgVecW
=
NULL
;
LPSTR
*
lpArgVecA
;
LPSTR
*
lpArgVecA
=
NULL
;
unsigned
int
i
;
unsigned
int
i
;
BOOL
ret
=
FALSE
;
TRACE
(
"(%p)
\n
"
,
servent
);
TRACE
(
"(%p)
\n
"
,
servent
);
...
@@ -271,30 +295,17 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
...
@@ -271,30 +295,17 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
submitted against revision 1.45 and so preserved here.
submitted against revision 1.45 and so preserved here.
*/
*/
FIXME
(
"should fail with ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
\n
"
);
FIXME
(
"should fail with ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
\n
"
);
dwNumServiceArgs
=
0
;
lpArgVecA
=
NULL
;
goto
run_service
;
goto
run_service
;
}
}
snprintfW
(
object_name
,
MAX_PATH
,
szServiceShmemNameFmtW
,
service_name
);
seb
=
open_seb_shmem
(
service_name
,
&
hServiceShmem
);
hServiceShmem
=
OpenFileMappingW
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
object_name
);
if
(
NULL
==
hServiceShmem
)
return
FALSE
;
seb
=
MapViewOfFile
(
hServiceShmem
,
FILE_MAP_ALL_ACCESS
,
0
,
0
,
0
);
if
(
NULL
==
seb
)
if
(
NULL
==
seb
)
{
CloseHandle
(
hServiceShmem
);
return
FALSE
;
return
FALSE
;
}
lpArgVecW
=
build_arg_vectors
(
seb
);
lpArgVecW
=
build_arg_vectors
(
seb
);
if
(
NULL
==
lpArgVecW
)
if
(
NULL
==
lpArgVecW
)
{
goto
done
;
UnmapViewOfFile
(
seb
);
CloseHandle
(
hServiceShmem
);
return
FALSE
;
}
lpArgVecW
[
0
]
=
service_name
;
lpArgVecW
[
0
]
=
service_name
;
dwNumServiceArgs
=
seb
->
argc
+
1
;
dwNumServiceArgs
=
seb
->
argc
+
1
;
...
@@ -316,6 +327,7 @@ run_service:
...
@@ -316,6 +327,7 @@ run_service:
servent
++
;
servent
++
;
}
}
done:
if
(
dwNumServiceArgs
)
if
(
dwNumServiceArgs
)
{
{
/* free arg strings */
/* free arg strings */
...
@@ -327,7 +339,7 @@ run_service:
...
@@ -327,7 +339,7 @@ run_service:
if
(
lpArgVecW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpArgVecW
);
if
(
lpArgVecW
)
HeapFree
(
GetProcessHeap
(),
0
,
lpArgVecW
);
if
(
seb
)
UnmapViewOfFile
(
seb
);
if
(
seb
)
UnmapViewOfFile
(
seb
);
if
(
hServiceShmem
)
CloseHandle
(
hServiceShmem
);
if
(
hServiceShmem
)
CloseHandle
(
hServiceShmem
);
return
TRUE
;
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -341,8 +353,7 @@ StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
...
@@ -341,8 +353,7 @@ StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
{
{
LPSERVICE_MAIN_FUNCTIONW
fpMain
;
LPSERVICE_MAIN_FUNCTIONW
fpMain
;
WCHAR
service_name
[
MAX_SERVICE_NAME
];
WCHAR
service_name
[
MAX_SERVICE_NAME
];
WCHAR
object_name
[
MAX_PATH
];
HANDLE
hServiceShmem
=
NULL
;
HANDLE
hServiceShmem
;
struct
SEB
*
seb
;
struct
SEB
*
seb
;
DWORD
dwNumServiceArgs
;
DWORD
dwNumServiceArgs
;
LPWSTR
*
lpServiceArgVectors
;
LPWSTR
*
lpServiceArgVectors
;
...
@@ -352,17 +363,9 @@ StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
...
@@ -352,17 +363,9 @@ StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
if
(
!
read_scm_lock_data
(
service_name
)
)
if
(
!
read_scm_lock_data
(
service_name
)
)
return
FALSE
;
return
FALSE
;
snprintfW
(
object_name
,
MAX_PATH
,
szServiceShmemNameFmtW
,
service_name
);
seb
=
open_seb_shmem
(
service_name
,
&
hServiceShmem
);
hServiceShmem
=
OpenFileMappingW
(
FILE_MAP_ALL_ACCESS
,
FALSE
,
object_name
);
if
(
NULL
==
hServiceShmem
)
return
FALSE
;
seb
=
MapViewOfFile
(
hServiceShmem
,
FILE_MAP_ALL_ACCESS
,
0
,
0
,
0
);
if
(
NULL
==
seb
)
if
(
NULL
==
seb
)
{
CloseHandle
(
hServiceShmem
);
return
FALSE
;
return
FALSE
;
}
lpServiceArgVectors
=
build_arg_vectors
(
seb
);
lpServiceArgVectors
=
build_arg_vectors
(
seb
);
if
(
NULL
==
lpServiceArgVectors
)
if
(
NULL
==
lpServiceArgVectors
)
...
...
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