Commit c2cb2962 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

ntdll: Implement NtAllocateLocallyUniqueId with server call.

parent c54a0fc2
...@@ -1090,25 +1090,28 @@ NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action) ...@@ -1090,25 +1090,28 @@ NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action)
/****************************************************************************** /******************************************************************************
* NtAllocateLocallyUniqueId (NTDLL.@) * NtAllocateLocallyUniqueId (NTDLL.@)
*
* FIXME: the server should do that
*/ */
NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid) NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
{ {
static LUID luid = { SE_MAX_WELL_KNOWN_PRIVILEGE, 0 }; NTSTATUS status;
FIXME("%p\n", Luid); TRACE("%p\n", Luid);
if (!Luid) if (!Luid)
return STATUS_ACCESS_VIOLATION; return STATUS_ACCESS_VIOLATION;
luid.LowPart++; SERVER_START_REQ( allocate_locally_unique_id )
if (luid.LowPart==0) {
luid.HighPart++; status = wine_server_call( req );
Luid->HighPart = luid.HighPart; if (!status)
Luid->LowPart = luid.LowPart; {
Luid->LowPart = reply->luid.low_part;
Luid->HighPart = reply->luid.high_part;
}
}
SERVER_END_REQ;
return STATUS_SUCCESS; return status;
} }
/****************************************************************************** /******************************************************************************
......
...@@ -187,6 +187,12 @@ typedef struct ...@@ -187,6 +187,12 @@ typedef struct
unsigned short attr; unsigned short attr;
} char_info_t; } char_info_t;
typedef struct
{
unsigned int low_part;
int high_part;
} luid_t;
#define MAX_ACL_LEN 65535 #define MAX_ACL_LEN 65535
struct security_descriptor struct security_descriptor
...@@ -4005,6 +4011,17 @@ struct get_token_impersonation_level_reply ...@@ -4005,6 +4011,17 @@ struct get_token_impersonation_level_reply
}; };
struct allocate_locally_unique_id_request
{
struct request_header __header;
};
struct allocate_locally_unique_id_reply
{
struct reply_header __header;
luid_t luid;
};
enum request enum request
{ {
REQ_new_process, REQ_new_process,
...@@ -4224,6 +4241,7 @@ enum request ...@@ -4224,6 +4241,7 @@ enum request
REQ_query_symlink, REQ_query_symlink,
REQ_get_object_info, REQ_get_object_info,
REQ_get_token_impersonation_level, REQ_get_token_impersonation_level,
REQ_allocate_locally_unique_id,
REQ_NB_REQUESTS REQ_NB_REQUESTS
}; };
...@@ -4448,6 +4466,7 @@ union generic_request ...@@ -4448,6 +4466,7 @@ union generic_request
struct query_symlink_request query_symlink_request; struct query_symlink_request query_symlink_request;
struct get_object_info_request get_object_info_request; struct get_object_info_request get_object_info_request;
struct get_token_impersonation_level_request get_token_impersonation_level_request; struct get_token_impersonation_level_request get_token_impersonation_level_request;
struct allocate_locally_unique_id_request allocate_locally_unique_id_request;
}; };
union generic_reply union generic_reply
{ {
...@@ -4670,8 +4689,9 @@ union generic_reply ...@@ -4670,8 +4689,9 @@ union generic_reply
struct query_symlink_reply query_symlink_reply; struct query_symlink_reply query_symlink_reply;
struct get_object_info_reply get_object_info_reply; struct get_object_info_reply get_object_info_reply;
struct get_token_impersonation_level_reply get_token_impersonation_level_reply; struct get_token_impersonation_level_reply get_token_impersonation_level_reply;
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
}; };
#define SERVER_PROTOCOL_VERSION 279 #define SERVER_PROTOCOL_VERSION 280
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -203,6 +203,12 @@ typedef struct ...@@ -203,6 +203,12 @@ typedef struct
unsigned short attr; unsigned short attr;
} char_info_t; } char_info_t;
typedef struct
{
unsigned int low_part;
int high_part;
} luid_t;
#define MAX_ACL_LEN 65535 #define MAX_ACL_LEN 65535
struct security_descriptor struct security_descriptor
...@@ -2870,3 +2876,9 @@ enum message_type ...@@ -2870,3 +2876,9 @@ enum message_type
@REPLY @REPLY
int impersonation_level; /* impersonation level of the impersonation token */ int impersonation_level; /* impersonation level of the impersonation token */
@END @END
/* Allocate a locally-unique identifier */
@REQ(allocate_locally_unique_id)
@REPLY
luid_t luid;
@END
...@@ -327,6 +327,7 @@ DECL_HANDLER(open_symlink); ...@@ -327,6 +327,7 @@ DECL_HANDLER(open_symlink);
DECL_HANDLER(query_symlink); DECL_HANDLER(query_symlink);
DECL_HANDLER(get_object_info); DECL_HANDLER(get_object_info);
DECL_HANDLER(get_token_impersonation_level); DECL_HANDLER(get_token_impersonation_level);
DECL_HANDLER(allocate_locally_unique_id);
#ifdef WANT_REQUEST_HANDLERS #ifdef WANT_REQUEST_HANDLERS
...@@ -550,6 +551,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = ...@@ -550,6 +551,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_query_symlink, (req_handler)req_query_symlink,
(req_handler)req_get_object_info, (req_handler)req_get_object_info,
(req_handler)req_get_token_impersonation_level, (req_handler)req_get_token_impersonation_level,
(req_handler)req_allocate_locally_unique_id,
}; };
#endif /* WANT_REQUEST_HANDLERS */ #endif /* WANT_REQUEST_HANDLERS */
......
...@@ -365,6 +365,15 @@ static inline void allocate_luid( LUID *luid ) ...@@ -365,6 +365,15 @@ static inline void allocate_luid( LUID *luid )
*luid = prev_luid_value; *luid = prev_luid_value;
} }
DECL_HANDLER( allocate_locally_unique_id )
{
LUID luid;
allocate_luid( &luid );
reply->luid.low_part = luid.LowPart;
reply->luid.high_part = luid.HighPart;
}
static inline void luid_and_attr_from_privilege( LUID_AND_ATTRIBUTES *out, const struct privilege *in) static inline void luid_and_attr_from_privilege( LUID_AND_ATTRIBUTES *out, const struct privilege *in)
{ {
out->Luid = in->luid; out->Luid = in->luid;
......
...@@ -239,6 +239,11 @@ static void dump_apc_result( const apc_result_t *result ) ...@@ -239,6 +239,11 @@ static void dump_apc_result( const apc_result_t *result )
fputc( '}', stderr ); fputc( '}', stderr );
} }
static void dump_luid( const luid_t *luid )
{
fprintf( stderr, "%d.%u", luid->high_part, luid->low_part );
}
static void dump_context( const CONTEXT *context ) static void dump_context( const CONTEXT *context )
{ {
#ifdef __i386__ #ifdef __i386__
...@@ -3454,6 +3459,16 @@ static void dump_get_token_impersonation_level_reply( const struct get_token_imp ...@@ -3454,6 +3459,16 @@ static void dump_get_token_impersonation_level_reply( const struct get_token_imp
fprintf( stderr, " impersonation_level=%d", req->impersonation_level ); fprintf( stderr, " impersonation_level=%d", req->impersonation_level );
} }
static void dump_allocate_locally_unique_id_request( const struct allocate_locally_unique_id_request *req )
{
}
static void dump_allocate_locally_unique_id_reply( const struct allocate_locally_unique_id_reply *req )
{
fprintf( stderr, " luid=" );
dump_luid( &req->luid );
}
static const dump_func req_dumpers[REQ_NB_REQUESTS] = { static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_new_process_request, (dump_func)dump_new_process_request,
(dump_func)dump_get_new_process_info_request, (dump_func)dump_get_new_process_info_request,
...@@ -3672,6 +3687,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { ...@@ -3672,6 +3687,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_query_symlink_request, (dump_func)dump_query_symlink_request,
(dump_func)dump_get_object_info_request, (dump_func)dump_get_object_info_request,
(dump_func)dump_get_token_impersonation_level_request, (dump_func)dump_get_token_impersonation_level_request,
(dump_func)dump_allocate_locally_unique_id_request,
}; };
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
...@@ -3892,6 +3908,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { ...@@ -3892,6 +3908,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_query_symlink_reply, (dump_func)dump_query_symlink_reply,
(dump_func)dump_get_object_info_reply, (dump_func)dump_get_object_info_reply,
(dump_func)dump_get_token_impersonation_level_reply, (dump_func)dump_get_token_impersonation_level_reply,
(dump_func)dump_allocate_locally_unique_id_reply,
}; };
static const char * const req_names[REQ_NB_REQUESTS] = { static const char * const req_names[REQ_NB_REQUESTS] = {
...@@ -4112,6 +4129,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { ...@@ -4112,6 +4129,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"query_symlink", "query_symlink",
"get_object_info", "get_object_info",
"get_token_impersonation_level", "get_token_impersonation_level",
"allocate_locally_unique_id",
}; };
static const struct static const struct
......
...@@ -44,6 +44,7 @@ my %formats = ...@@ -44,6 +44,7 @@ my %formats =
"char_info_t" => "&dump_char_info", "char_info_t" => "&dump_char_info",
"apc_call_t" => "&dump_apc_call", "apc_call_t" => "&dump_apc_call",
"apc_result_t" => "&dump_apc_result", "apc_result_t" => "&dump_apc_result",
"luid_t" => "&dump_luid",
); );
my @requests = (); my @requests = ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment