5 /* INCLUDES *****************************************************************/
12 /* FUNCTIONS *****************************************************************/
15 ScmWriteDependencies(HKEY hServiceKey
,
16 LPWSTR lpDependencies
,
17 DWORD dwDependenciesLength
)
19 DWORD dwError
= ERROR_SUCCESS
;
20 DWORD dwGroupLength
= 0;
21 DWORD dwServiceLength
= 0;
28 if (*lpDependencies
== 0)
30 RegDeleteValue(hServiceKey
,
32 RegDeleteValue(hServiceKey
,
37 lpGroupDeps
= HeapAlloc(GetProcessHeap(),
39 (dwDependenciesLength
+ 2) * sizeof(WCHAR
));
40 if (lpGroupDeps
== NULL
)
41 return ERROR_NOT_ENOUGH_MEMORY
;
43 lpSrc
= lpDependencies
;
47 dwLength
= wcslen(lpSrc
);
48 if (*lpSrc
== SC_GROUP_IDENTIFIERW
)
51 dwGroupLength
+= dwLength
;
53 lpDst
= lpDst
+ dwLength
;
56 lpSrc
= lpSrc
+ dwLength
;
62 lpSrc
= lpDependencies
;
63 lpServiceDeps
= lpDst
;
66 dwLength
= wcslen(lpSrc
) + 1;
67 if (*lpSrc
!= SC_GROUP_IDENTIFIERW
)
69 dwServiceLength
+= dwLength
;
71 lpDst
= lpDst
+ dwLength
;
74 lpSrc
= lpSrc
+ dwLength
;
79 dwError
= RegSetValueExW(hServiceKey
,
84 dwGroupLength
* sizeof(WCHAR
));
86 if (dwError
== ERROR_SUCCESS
)
88 dwError
= RegSetValueExW(hServiceKey
,
92 (LPBYTE
)lpServiceDeps
,
93 dwServiceLength
* sizeof(WCHAR
));
96 HeapFree(GetProcessHeap(), 0, lpGroupDeps
);