[FORMATTING] No code changes!

svn path=/trunk/; revision=36357
This commit is contained in:
Eric Kohl 2008-09-20 20:28:23 +00:00
parent 8c33fab48b
commit aa46f44e50
3 changed files with 635 additions and 614 deletions

View file

@ -405,8 +405,7 @@ AppendRidToSid(PSID SrcSid,
static PTOKEN_GROUPS
AllocateGroupSids(
OUT PSID *PrimaryGroupSid,
AllocateGroupSids(OUT PSID *PrimaryGroupSid,
OUT PSID *OwnerSid)
{
SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY};
@ -442,13 +441,13 @@ AllocateGroupSids(
/* Member of the domain */
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
*PrimaryGroupSid = Sid;
GroupCount++;
/* Member of 'Everyone' */
RtlAllocateAndInitializeSid(
&WorldAuthority,
RtlAllocateAndInitializeSid(&WorldAuthority,
1,
SECURITY_WORLD_RID,
SECURITY_NULL_RID,
@ -460,13 +459,13 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
#if 1
/* Member of 'Administrators' */
RtlAllocateAndInitializeSid(
&SystemAuthority,
RtlAllocateAndInitializeSid(&SystemAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
@ -478,15 +477,15 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
#else
TRACE("Not adding user to Administrators group\n");
#endif
/* Member of 'Users' */
RtlAllocateAndInitializeSid(
&SystemAuthority,
RtlAllocateAndInitializeSid(&SystemAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_USERS,
@ -498,12 +497,12 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
/* Logon SID */
RtlAllocateAndInitializeSid(
&SystemAuthority,
RtlAllocateAndInitializeSid(&SystemAuthority,
SECURITY_LOGON_IDS_RID_COUNT,
SECURITY_LOGON_IDS_RID,
Luid.HighPart,
@ -515,13 +514,13 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY | SE_GROUP_LOGON_ID;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY | SE_GROUP_LOGON_ID;
GroupCount++;
*OwnerSid = Sid;
/* Member of 'Local users */
RtlAllocateAndInitializeSid(
&LocalAuthority,
RtlAllocateAndInitializeSid(&LocalAuthority,
1,
SECURITY_LOCAL_RID,
SECURITY_NULL_RID,
@ -533,12 +532,12 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
/* Member of 'Interactive users' */
RtlAllocateAndInitializeSid(
&SystemAuthority,
RtlAllocateAndInitializeSid(&SystemAuthority,
1,
SECURITY_INTERACTIVE_RID,
SECURITY_NULL_RID,
@ -550,12 +549,12 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
/* Member of 'Authenticated users' */
RtlAllocateAndInitializeSid(
&SystemAuthority,
RtlAllocateAndInitializeSid(&SystemAuthority,
1,
SECURITY_AUTHENTICATED_USER_RID,
SECURITY_NULL_RID,
@ -567,7 +566,8 @@ AllocateGroupSids(
SECURITY_NULL_RID,
&Sid);
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
GroupCount++;
TokenGroups->GroupCount = GroupCount;
@ -670,6 +670,7 @@ LogonUserW (LPWSTR lpszUsername,
{
return FALSE;
}
ExpirationTime.QuadPart = -1;
/* Get the user SID from the registry */
@ -708,7 +709,8 @@ LogonUserW (LPWSTR lpszUsername,
TokenPrivileges->PrivilegeCount = 0;
for (i = 0; i < sizeof(DefaultPrivs) / sizeof(DefaultPrivs[0]); i++)
{
if (! LookupPrivilegeValueW(NULL, DefaultPrivs[i].PrivName,
if (! LookupPrivilegeValueW(NULL,
DefaultPrivs[i].PrivName,
&TokenPrivileges->Privileges[TokenPrivileges->PrivilegeCount].Luid))
{
WARN("Can't set privilege %S\n", DefaultPrivs[i].PrivName);
@ -723,7 +725,6 @@ LogonUserW (LPWSTR lpszUsername,
TokenOwner.Owner = OwnerSid;
TokenPrimaryGroup.PrimaryGroup = PrimaryGroupSid;
Dacl = RtlAllocateHeap(GetProcessHeap(), 0, 1024);
if (Dacl == NULL)
{
@ -773,6 +774,7 @@ LogonUserW (LPWSTR lpszUsername,
memcpy(TokenSource.SourceName,
"User32 ",
8);
Status = NtAllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
if (!NT_SUCCESS(Status))
{

View file

@ -43,10 +43,12 @@ AbortSystemShutdownA(LPCSTR lpMachineName)
RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
if (STATUS_SUCCESS != Status) {
if (STATUS_SUCCESS != Status)
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
rv = AbortSystemShutdownW(MachineNameW.Buffer);
RtlFreeUnicodeString(&MachineNameW);
SetLastError(ERROR_SUCCESS);
@ -60,8 +62,7 @@ AbortSystemShutdownA(LPCSTR lpMachineName)
* @unimplemented
*/
BOOL STDCALL
InitiateSystemShutdownW(
LPWSTR lpMachineName,
InitiateSystemShutdownW(LPWSTR lpMachineName,
LPWSTR lpMessage,
DWORD dwTimeout,
BOOL bForceAppsClosed,
@ -70,13 +71,17 @@ InitiateSystemShutdownW(
SHUTDOWN_ACTION Action = ShutdownNoReboot;
NTSTATUS Status;
if (lpMachineName) {
if (lpMachineName)
{
/* FIXME: remote machine shutdown not supported yet */
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
if (dwTimeout) {
if (dwTimeout)
{
}
Status = NtShutdownSystem(Action);
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
@ -90,8 +95,7 @@ InitiateSystemShutdownW(
*/
BOOL
STDCALL
InitiateSystemShutdownA(
LPSTR lpMachineName,
InitiateSystemShutdownA(LPSTR lpMachineName,
LPSTR lpMessage,
DWORD dwTimeout,
BOOL bForceAppsClosed,
@ -105,38 +109,49 @@ InitiateSystemShutdownA(
INT LastError;
BOOL rv;
if (lpMachineName) {
if (lpMachineName)
{
RtlInitAnsiString(&MachineNameA, lpMachineName);
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
if (STATUS_SUCCESS != Status) {
if (STATUS_SUCCESS != Status)
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
}
if (lpMessage) {
if (lpMessage)
{
RtlInitAnsiString(&MessageA, lpMessage);
Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
if (STATUS_SUCCESS != Status) {
if (MachineNameW.Length) {
if (STATUS_SUCCESS != Status)
{
if (MachineNameW.Length)
{
RtlFreeUnicodeString(&MachineNameW);
}
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
}
rv = InitiateSystemShutdownW(
MachineNameW.Buffer,
rv = InitiateSystemShutdownW(MachineNameW.Buffer,
MessageW.Buffer,
dwTimeout,
bForceAppsClosed,
bRebootAfterShutdown);
LastError = GetLastError();
if (lpMachineName) {
if (lpMachineName)
{
RtlFreeUnicodeString(&MachineNameW);
}
if (lpMessage) {
if (lpMessage)
{
RtlFreeUnicodeString(&MessageW);
}
SetLastError(LastError);
return rv;
}
@ -146,8 +161,12 @@ InitiateSystemShutdownA(
*
* see InitiateSystemShutdownExA
*/
BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
BOOL WINAPI
InitiateSystemShutdownExW(LPWSTR lpMachineName,
LPWSTR lpMessage,
DWORD dwTimeout,
BOOL bForceAppsClosed,
BOOL bRebootAfterShutdown,
DWORD dwReason)
{
UNIMPLEMENTED;