mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +00:00
AcquireLoadDriverPrivilege() to fix problem with SCM not being able to load drivers. Patch by Filip Navara.
svn path=/trunk/; revision=9084
This commit is contained in:
parent
f2d2a85374
commit
763fb168d1
2 changed files with 27 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: database.c,v 1.12 2003/11/17 02:12:51 hyperion Exp $
|
/* $Id: database.c,v 1.13 2004/04/11 16:09:11 jfilby Exp $
|
||||||
*
|
*
|
||||||
* service control manager
|
* service control manager
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#include "services.h"
|
#include "services.h"
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,6 +461,7 @@ ScmStartService(PSERVICE Service,
|
||||||
DPRINT("ScmStartService() called\n");
|
DPRINT("ScmStartService() called\n");
|
||||||
|
|
||||||
Service->ControlPipeHandle = INVALID_HANDLE_VALUE;
|
Service->ControlPipeHandle = INVALID_HANDLE_VALUE;
|
||||||
|
DPRINT("Service->Type: %u\n", Service->Type);
|
||||||
|
|
||||||
if (Service->Type == SERVICE_KERNEL_DRIVER ||
|
if (Service->Type == SERVICE_KERNEL_DRIVER ||
|
||||||
Service->Type == SERVICE_FILE_SYSTEM_DRIVER ||
|
Service->Type == SERVICE_FILE_SYSTEM_DRIVER ||
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: services.c,v 1.13 2003/11/15 15:08:32 gvg Exp $
|
/* $Id: services.c,v 1.14 2004/04/11 16:09:11 jfilby Exp $
|
||||||
*
|
*
|
||||||
* service control manager
|
* service control manager
|
||||||
*
|
*
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include "services.h"
|
#include "services.h"
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,6 +243,25 @@ BOOL StartScmNamedPipeThreadListener(void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
AcquireLoadDriverPrivilege(VOID)
|
||||||
|
{
|
||||||
|
HANDLE hToken;
|
||||||
|
TOKEN_PRIVILEGES tkp;
|
||||||
|
|
||||||
|
/* Get a token for this process. */
|
||||||
|
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
|
||||||
|
/* Get the LUID for the debug privilege. */
|
||||||
|
LookupPrivilegeValue(NULL, SE_LOAD_DRIVER_NAME, &tkp.Privileges[0].Luid);
|
||||||
|
|
||||||
|
tkp.PrivilegeCount = 1; /* one privilege to set */
|
||||||
|
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||||
|
|
||||||
|
/* Get the debug privilege for this process. */
|
||||||
|
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
WinMain(HINSTANCE hInstance,
|
WinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
|
@ -255,6 +274,9 @@ WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
DPRINT("SERVICES: Service Control Manager\n");
|
DPRINT("SERVICES: Service Control Manager\n");
|
||||||
|
|
||||||
|
/* Acquire privileges to load drivers */
|
||||||
|
AcquireLoadDriverPrivilege();
|
||||||
|
|
||||||
/* Create start event */
|
/* Create start event */
|
||||||
if (!ScmCreateStartEvent(&hScmStartEvent))
|
if (!ScmCreateStartEvent(&hScmStartEvent))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue