{
DWORD ErrorCode;
- if (InterlockedCompareExchangePointer(&NtMarta,
+ if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
NULL,
NULL) == NULL)
{
if (ErrorCode == ERROR_SUCCESS)
{
/* try change the NtMarta pointer */
- if (InterlockedCompareExchangePointer(&NtMarta,
+ if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
&NtMartaStatic,
NULL) != NULL)
{
VOID
UnloadNtMarta(VOID)
{
- if (InterlockedExchangePointer(&NtMarta,
+ if (InterlockedExchangePointer((PVOID)&NtMarta,
NULL) != NULL)
{
FreeLibrary(NtMartaStatic.hDllInstance);
else
{
*pdwDomainName = dwSrcLen;
- RtlCopyMemory ( pDomainName, ReferencedDomain->Domains[0].Name.Buffer, ReferencedDomain->Domains[0].Name.Length );
- pDomainName[ReferencedDomain->Domains[0].Name.Length / sizeof(WCHAR)] = L'\0';
+ if (pDomainName)
+ {
+ RtlCopyMemory ( pDomainName, ReferencedDomain->Domains[0].Name.Buffer, ReferencedDomain->Domains[0].Name.Length );
+ pDomainName[ReferencedDomain->Domains[0].Name.Length / sizeof(WCHAR)] = L'\0';
+ }
}
}
}
WideCharToMultiByte(CP_ACP,
0,
lpReferencedDomainNameW,
- *hReferencedDomainNameLength,
+ *hReferencedDomainNameLength + 1,
ReferencedDomainName,
- *hReferencedDomainNameLength,
+ *hReferencedDomainNameLength + 1,
NULL,
NULL);
}
TRACE("%s %s %p %p %p %p %p - stub\n", lpSystemName, lpAccountName,
Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse);
+ if (!ADVAPI_IsLocalComputer(lpSystemName))
+ {
+ SetLastError(RPC_S_SERVER_UNAVAILABLE);
+ return FALSE;
+ }
+
for (i = 0; i < (sizeof(ACCOUNT_SIDS) / sizeof(ACCOUNT_SIDS[0])); i++)
{
if (!wcscmp(lpAccountName, ACCOUNT_SIDS[i].account))
if (ReferencedDomainName != NULL && (*cchReferencedDomainName > wcslen(dm)))
wcscpy(ReferencedDomainName, dm);
- if (*cchReferencedDomainName <= wcslen(dm))
+ if ((*cchReferencedDomainName <= wcslen(dm)) || (!ret))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
ret = FALSE;
+ *cchReferencedDomainName = wcslen(dm) + 1;
+ }
+ else
+ {
+ *cchReferencedDomainName = wcslen(dm);
}
-
- *cchReferencedDomainName = wcslen(dm)+1;
FreeSid(pSid);
};
unsigned Priv;
+ if (!ADVAPI_IsLocalComputer(SystemName))
+ {
+ SetLastError(RPC_S_SERVER_UNAVAILABLE);
+ return FALSE;
+ }
+
if (NULL != SystemName && L'\0' != *SystemName)
{
FIXME("LookupPrivilegeValueW: not implemented for remote system\n");
SetLastError(RPC_S_SERVER_UNAVAILABLE);
return FALSE;
}
+
if (lpLuid->HighPart || (lpLuid->LowPart < SE_MIN_WELL_KNOWN_PRIVILEGE ||
lpLuid->LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE))
{
PACL *ppSacl,
PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
{
- UNICODE_STRING ObjectName;
- NTSTATUS Status;
- DWORD Ret;
+ DWORD len;
+ LPWSTR wstr = NULL;
+ DWORD r;
- Status = RtlCreateUnicodeStringFromAsciiz(&ObjectName,
- pObjectName);
- if (!NT_SUCCESS(Status))
+ TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo,
+ ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
+
+ if( pObjectName )
{
- return RtlNtStatusToDosError(Status);
+ len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 );
+ wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR));
+ MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len );
}
- Ret = GetNamedSecurityInfoW(ObjectName.Buffer,
- ObjectType,
- SecurityInfo,
- ppsidOwner,
- ppsidGroup,
- ppDacl,
- ppSacl,
- ppSecurityDescriptor);
+ r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner,
+ ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor );
- RtlFreeUnicodeString(&ObjectName);
+ HeapFree( GetProcessHeap(), 0, wstr );
- return Ret;
+ return r;
}
*/
BOOL
WINAPI
-GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
- SECURITY_INFORMATION SecurityInformation,
- PSECURITY_DESCRIPTOR ResultantDescriptor,
- DWORD DescriptorLength,
- PDWORD ReturnLength)
+GetPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ObjectDescriptor,
+ IN SECURITY_INFORMATION SecurityInformation,
+ OUT PSECURITY_DESCRIPTOR ResultantDescriptor OPTIONAL,
+ IN DWORD DescriptorLength,
+ OUT PDWORD ReturnLength)
{
NTSTATUS Status;
+ /* Call RTL */
Status = RtlQuerySecurityObject(ObjectDescriptor,
SecurityInformation,
ResultantDescriptor,
ReturnLength);
if (!NT_SUCCESS(Status))
{
+ /* Fail */
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
+ /* Success */
return TRUE;
}