- Remove the hack implemenation of LookupPrivilegeValueW.

- Don't check for load driver privilege yet.
- Don't try to acquire load driver privilege in Services.

svn path=/trunk/; revision=9103
This commit is contained in:
Filip Navara 2004-04-12 15:22:53 +00:00
parent 95182ed8f5
commit d24371eaec
3 changed files with 7 additions and 60 deletions

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.13 2004/04/11 19:21:43 navaraf Exp $
/* $Id: misc.c,v 1.14 2004/04/12 15:22:52 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -421,47 +421,13 @@ LookupPrivilegeValueA (LPCSTR lpSystemName,
/**********************************************************************
* LookupPrivilegeValueW EXPORTED
*
* @implemented
* @unimplemented
*/
BOOL STDCALL
LookupPrivilegeValueW (LPCWSTR lpSystemName,
LPCWSTR lpName,
PLUID lpLuid)
{
static LPCWSTR DefaultPrivilegeNames[] =
{
NULL, NULL,
L"SeCreateTokenPrivilege", L"SeAssignPrimaryTokenPrivilege",
L"SeLockMemoryPrivilege", L"SeIncreaseQuotaPrivilege",
L"SeMachineAccountPrivilege", L"SeTcbPrivilege",
L"SeSecurityPrivilege", L"SeTakeOwnershipPrivilege",
L"SeLoadDriverPrivilege", L"SeSystemProfilePrivilege",
L"SeSystemtimePrivilege", L"SeProfileSingleProcessPrivilege",
L"SeIncreaseBasePriorityPrivilege", L"SeCreatePagefilePrivilege",
L"SeCreatePermanentPrivilege", L"SeBackupPrivilege",
L"SeRestorePrivilege", L"SeShutdownPrivilege",
L"SeDebugPrivilege", L"SeAuditPrivilege",
L"SeSystemEnvironmentPrivilege", L"SeChangeNotifyPrivilege",
L"SeRemoteShutdownPrivilege",
};
static unsigned DefaultPrivilegeCount =
sizeof(DefaultPrivilegeNames) / sizeof(DefaultPrivilegeNames[0]);
int i;
for (i = 0; i < DefaultPrivilegeCount; i++)
{
if (!DefaultPrivilegeNames[i] ||
lstrcmpW(DefaultPrivilegeNames[i], lpName))
{
continue;
}
lpLuid->LowPart = i;
lpLuid->HighPart = 0;
return TRUE;
}
return FALSE;
}

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.44 2004/04/11 15:31:21 jfilby Exp $
/* $Id: driver.c,v 1.45 2004/04/12 15:22:53 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1514,11 +1514,14 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
* Check security privileges
*/
/* FIXME: Uncomment when privileges will be correctly implemented. */
#if 0
if (!SeSinglePrivilegeCheck(SeLoadDriverPrivilege, KeGetPreviousMode()))
{
DPRINT("Privilege not held\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
#endif
RtlInitUnicodeString(&ImagePath, NULL);

View file

@ -1,4 +1,4 @@
/* $Id: services.c,v 1.15 2004/04/11 16:10:05 jfilby Exp $
/* $Id: services.c,v 1.16 2004/04/12 15:22:53 navaraf Exp $
*
* service control manager
*
@ -243,25 +243,6 @@ BOOL StartScmNamedPipeThreadListener(void)
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
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@ -274,9 +255,6 @@ WinMain(HINSTANCE hInstance,
DPRINT("SERVICES: Service Control Manager\n");
/* Acquire privileges to load drivers */
AcquireLoadDriverPrivilege();
/* Create start event */
if (!ScmCreateStartEvent(&hScmStartEvent))
{