Author: ekohl
Date: Sun Aug 21 14:04:19 2011
New Revision: 53356
URL:
http://svn.reactos.org/svn/reactos?rev=53356&view=rev
Log:
[ADVAPI32]
QueryServiceLockStatusA/W: If lpLockStatus is NULL or cbBufSize is less than
sizeof(QUERY_SERVICE_LOCK_STATUSA/W) pass a pointer to an buffer to
RQueryServiceLockStatusA/W.
Modified:
trunk/reactos/dll/win32/advapi32/service/scm.c
Modified: trunk/reactos/dll/win32/advapi32/service/scm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] Sun Aug 21 14:04:19 2011
@@ -2309,16 +2309,30 @@
DWORD cbBufSize,
LPDWORD pcbBytesNeeded)
{
+ QUERY_SERVICE_LOCK_STATUSA LockStatus;
+ LPQUERY_SERVICE_LOCK_STATUSA lpStatusPtr;
+ DWORD dwBufferSize;
DWORD dwError;
TRACE("QueryServiceLockStatusA() called\n");
+
+ if (lpLockStatus == NULL || cbBufSize < sizeof(QUERY_SERVICE_LOCK_STATUSA))
+ {
+ lpStatusPtr = &LockStatus;
+ dwBufferSize = sizeof(QUERY_SERVICE_LOCK_STATUSA);
+ }
+ else
+ {
+ lpStatusPtr = lpLockStatus;
+ dwBufferSize = cbBufSize;
+ }
RpcTryExcept
{
/* Call to services.exe using RPC */
dwError = RQueryServiceLockStatusA((SC_RPC_HANDLE)hSCManager,
- lpLockStatus,
- cbBufSize,
+ lpStatusPtr,
+ dwBufferSize,
pcbBytesNeeded);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
@@ -2334,10 +2348,10 @@
return FALSE;
}
- if (lpLockStatus->lpLockOwner != NULL)
- {
- lpLockStatus->lpLockOwner =
- (LPSTR)((UINT_PTR)lpLockStatus + (UINT_PTR)lpLockStatus->lpLockOwner);
+ if (lpStatusPtr->lpLockOwner != NULL)
+ {
+ lpStatusPtr->lpLockOwner =
+ (LPSTR)((UINT_PTR)lpStatusPtr + (UINT_PTR)lpStatusPtr->lpLockOwner);
}
TRACE("QueryServiceLockStatusA() done\n");
@@ -2357,16 +2371,30 @@
DWORD cbBufSize,
LPDWORD pcbBytesNeeded)
{
+ QUERY_SERVICE_LOCK_STATUSW LockStatus;
+ LPQUERY_SERVICE_LOCK_STATUSW lpStatusPtr;
+ DWORD dwBufferSize;
DWORD dwError;
TRACE("QueryServiceLockStatusW() called\n");
+
+ if (lpLockStatus == NULL || cbBufSize < sizeof(QUERY_SERVICE_LOCK_STATUSW))
+ {
+ lpStatusPtr = &LockStatus;
+ dwBufferSize = sizeof(QUERY_SERVICE_LOCK_STATUSW);
+ }
+ else
+ {
+ lpStatusPtr = lpLockStatus;
+ dwBufferSize = cbBufSize;
+ }
RpcTryExcept
{
/* Call to services.exe using RPC */
dwError = RQueryServiceLockStatusW((SC_RPC_HANDLE)hSCManager,
- lpLockStatus,
- cbBufSize,
+ lpStatusPtr,
+ dwBufferSize,
pcbBytesNeeded);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
@@ -2382,10 +2410,10 @@
return FALSE;
}
- if (lpLockStatus->lpLockOwner != NULL)
- {
- lpLockStatus->lpLockOwner =
- (LPWSTR)((UINT_PTR)lpLockStatus + (UINT_PTR)lpLockStatus->lpLockOwner);
+ if (lpStatusPtr->lpLockOwner != NULL)
+ {
+ lpStatusPtr->lpLockOwner =
+ (LPWSTR)((UINT_PTR)lpStatusPtr + (UINT_PTR)lpStatusPtr->lpLockOwner);
}
TRACE("QueryServiceLockStatusW() done\n");