- Implement SampGetObjectAttributeString to retrieve the size of a string, allocate a buffer and retrieve the string from the registry.
- Use SampGetObjectAttributeString to retrieve string attributes in SamrQueryInformationXxx functions.
- Add most missing cases to SamrQueryInformationUser.
- Fix a type mismatch in ntsam.h.

svn path=/trunk/; revision=56850
This commit is contained in:
Eric Kohl 2012-07-08 09:33:35 +00:00
parent c4dbf5a011
commit 87f0a30cfe
5 changed files with 862 additions and 582 deletions

View file

@ -705,5 +705,59 @@ SampGetObjectAttribute(PSAM_DB_OBJECT DbObject,
return Status;
}
NTSTATUS
SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject,
LPWSTR AttributeName,
RPC_UNICODE_STRING *String)
{
ULONG Length = 0;
NTSTATUS Status;
Status = SampGetObjectAttribute(DbObject,
AttributeName,
NULL,
NULL,
&Length);
if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW)
{
TRACE("Status 0x%08lx\n", Status);
goto done;
}
String->Length = Length - sizeof(WCHAR);
String->MaximumLength = Length;
String->Buffer = midl_user_allocate(Length);
if (String->Buffer == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
goto done;
}
TRACE("Length: %lu\n", Length);
Status = SampGetObjectAttribute(DbObject,
AttributeName,
NULL,
(PVOID)String->Buffer,
&Length);
if (!NT_SUCCESS(Status))
{
TRACE("Status 0x%08lx\n", Status);
goto done;
}
done:
if (!NT_SUCCESS(Status))
{
if (String->Buffer != NULL)
{
midl_user_free(String->Buffer);
String->Buffer = NULL;
}
}
return Status;
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -149,6 +149,11 @@ SampGetObjectAttribute(PSAM_DB_OBJECT DbObject,
LPVOID AttributeData,
PULONG AttributeSize);
NTSTATUS
SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject,
LPWSTR AttributeName,
RPC_UNICODE_STRING *String);
/* registry.h */
NTSTATUS
SampRegCloseKey(IN HANDLE KeyHandle);

View file

@ -185,22 +185,22 @@ typedef enum _ALIAS_INFORMATION_CLASS
AliasAdminCommentInformation
} ALIAS_INFORMATION_CLASS, *PALIAS_INFORMATION_CLASS;
typedef struct _SAMPR_ALIAS_GENERAL_INFORMATION
typedef struct _ALIAS_GENERAL_INFORMATION
{
UNICODE_STRING Name;
ULONG MemberCount;
UNICODE_STRING AdminComment;
} SAMPR_ALIAS_GENERAL_INFORMATION, *PSAMPR_ALIAS_GENERAL_INFORMATION;
} ALIAS_GENERAL_INFORMATION, *PALIAS_GENERAL_INFORMATION;
typedef struct _SAMPR_ALIAS_NAME_INFORMATION
typedef struct _ALIAS_NAME_INFORMATION
{
UNICODE_STRING Name;
} SAMPR_ALIAS_NAME_INFORMATION, *PSAMPR_ALIAS_NAME_INFORMATION;
} ALIAS_NAME_INFORMATION, *PALIAS_NAME_INFORMATION;
typedef struct _SAMPR_ALIAS_ADM_COMMENT_INFORMATION
typedef struct _ALIAS_ADM_COMMENT_INFORMATION
{
UNICODE_STRING AdminComment;
} SAMPR_ALIAS_ADM_COMMENT_INFORMATION, *PSAMPR_ALIAS_ADM_COMMENT_INFORMATION;
} ALIAS_ADM_COMMENT_INFORMATION, *PALIAS_ADM_COMMENT_INFORMATION;
typedef enum _DOMAIN_INFORMATION_CLASS

View file

@ -400,7 +400,6 @@ typedef [switch_type(GROUP_INFORMATION_CLASS)] union _SAMPR_GROUP_INFO_BUFFER
[case(GroupReplicationInformation)] SAMPR_GROUP_GENERAL_INFORMATION DoNotUse;
} SAMPR_GROUP_INFO_BUFFER, *PSAMPR_GROUP_INFO_BUFFER;
cpp_quote("#ifndef _NTSAM_")
typedef struct _SAMPR_ALIAS_GENERAL_INFORMATION
{
RPC_UNICODE_STRING Name;
@ -418,6 +417,7 @@ typedef struct _SAMPR_ALIAS_ADM_COMMENT_INFORMATION
RPC_UNICODE_STRING AdminComment;
} SAMPR_ALIAS_ADM_COMMENT_INFORMATION, *PSAMPR_ALIAS_ADM_COMMENT_INFORMATION;
cpp_quote("#ifndef _NTSAM_")
typedef enum _ALIAS_INFORMATION_CLASS
{
AliasGeneralInformation = 1,