Commit 4a297352 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit 13.0.1 upon wine-1.7.4

parent 637de623
......@@ -611,8 +611,9 @@ AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
{
NTSTATUS status;
TRACE("\n");
TRACE("(%p %d %p %d %p %p)\n", TokenHandle, DisableAllPrivileges, NewState, BufferLength,
PreviousState, ReturnLength);
status = NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges,
NewState, BufferLength, PreviousState,
ReturnLength);
......
......@@ -4649,6 +4649,41 @@ static void test_default_dacl_owner_sid(void)
CloseHandle( handle );
}
static void test_AdjustTokenPrivileges(void)
{
TOKEN_PRIVILEGES tp, prev;
HANDLE token;
DWORD len;
LUID luid;
BOOL ret;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token))
return;
if (!LookupPrivilegeValueA(NULL, SE_BACKUP_NAME, &luid))
{
CloseHandle(token);
return;
}
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
len = 0xdeadbeef;
ret = AdjustTokenPrivileges(token, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, &len);
ok(ret, "got %d\n", ret);
ok(len == 0xdeadbeef, "got length %d\n", len);
/* revert */
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = 0;
AdjustTokenPrivileges(token, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &prev, NULL);
CloseHandle(token);
}
START_TEST(security)
{
init();
......@@ -4688,4 +4723,5 @@ START_TEST(security)
test_CreateRestrictedToken();
test_TokenIntegrityLevel();
test_default_dacl_owner_sid();
test_AdjustTokenPrivileges();
}
dlls/inetcpl.cpl/inetcpl.ico

81 KB | W: | H:

dlls/inetcpl.cpl/inetcpl.ico

24.6 KB | W: | H:

dlls/inetcpl.cpl/inetcpl.ico
dlls/inetcpl.cpl/inetcpl.ico
dlls/inetcpl.cpl/inetcpl.ico
dlls/inetcpl.cpl/inetcpl.ico
  • 2-up
  • Swipe
  • Onion skin
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -223,7 +223,7 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
ret = wine_server_call( req );
if (PreviousState)
{
*ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
if (ReturnLength) *ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
PreviousState->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
}
}
......
......@@ -492,29 +492,21 @@ static void test_inputdesktop(void)
/* OpenInputDesktop creates new handles for each calls */
old_input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
todo_wine
ok(old_input_desk != NULL, "OpenInputDesktop failed!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(old_input_desk, UOI_NAME, name, 1024, NULL);
todo_wine
ok(ret, "GetUserObjectInformation failed!\n");
todo_wine
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
todo_wine
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
todo_wine
ok(ret, "GetUserObjectInformation failed!\n");
todo_wine
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
todo_wine
ok(old_input_desk != input_desk, "returned the same handle!\n");
ret = CloseDesktop(input_desk);
todo_wine
ok(ret, "CloseDesktop failed!\n");
/* by default, GetThreadDesktop is the input desktop, SendInput should success. */
......@@ -562,10 +554,8 @@ todo_wine
/* Set thread desktop to the input desktop, SendInput should success. */
ret = SetThreadDesktop(old_input_desk);
todo_wine
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
todo_wine
ok(thread_desk == old_input_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
......@@ -580,17 +570,14 @@ todo_wine
ret = SwitchDesktop(new_desk);
ok(ret, "SwitchDesktop failed!\n");
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
todo_wine
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
ok(input_desk != new_desk, "returned the same handle!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
todo_wine
ok(ret, "GetUserObjectInformation failed!\n");
todo_wine
ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
ret = CloseDesktop(input_desk);
todo_wine
ok(ret, "CloseDesktop failed!\n");
SetLastError(0xdeadbeef);
......@@ -617,15 +604,11 @@ todo_wine
* thread desktop, clean side effects. SendInput should success. */
ret = SwitchDesktop(old_input_desk);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
todo_wine
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
todo_wine
ok(input_desk != old_input_desk, "returned the same handle!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
todo_wine
ok(ret, "GetUserObjectInformation failed!\n");
todo_wine
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
ret = SetThreadDesktop(old_thread_desk);
......@@ -643,10 +626,8 @@ todo_wine
/* free resources */
ret = CloseDesktop(input_desk);
todo_wine
ok(ret, "CloseDesktop failed!\n");
ret = CloseDesktop(old_input_desk);
todo_wine
ok(ret, "CloseDesktop failed!\n");
ret = CloseDesktop(new_desk);
ok(ret, "CloseDesktop failed!\n");
......@@ -667,10 +648,8 @@ static void test_inputdesktop2(void)
ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
ok(!ret, "EnumDesktopsA failed!\n");
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
todo_wine
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
ret = CloseDesktop(input_desk);
todo_wine
ok(ret, "CloseDesktop failed!\n");
ret = SetProcessWindowStation(w2);
......@@ -687,7 +666,6 @@ todo_wine
SetLastError(0xdeadbeef);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk == NULL, "OpenInputDesktop should fail on non default winstation!\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_FUNCTION || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
hdesk = OpenDesktop("desk_test", 0, TRUE, DESKTOP_ALL_ACCESS);
......
......@@ -462,9 +462,23 @@ BOOL WINAPI EnumDesktopsW( HWINSTA winsta, DESKTOPENUMPROCW func, LPARAM lparam
*/
HDESK WINAPI OpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access )
{
FIXME( "(%x,%i,%x): stub\n", flags, inherit, access );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
HANDLE ret = 0;
TRACE( "(%x,%i,%x)\n", flags, inherit, access );
if (flags)
FIXME( "partial stub flags %08x\n", flags );
SERVER_START_REQ( open_input_desktop )
{
req->flags = flags;
req->access = access;
req->attributes = inherit ? OBJ_INHERIT : 0;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
}
......
......@@ -2761,7 +2761,7 @@ static DWORD start_next_chunk(chunked_stream_t *stream, http_request_t *req)
assert(!stream->chunk_size || stream->chunk_size == ~0u);
if (stream->end_of_data) return ERROR_NO_MORE_FILES;
if (stream->end_of_data) return ERROR_SUCCESS;
/* read terminator for the previous chunk */
if(!stream->chunk_size && (res = discard_chunked_eol(stream, req)) != ERROR_SUCCESS)
......
......@@ -734,7 +734,7 @@ static void InternetReadFile_chunked_test(void)
{
BOOL res;
CHAR buffer[4000];
DWORD length;
DWORD length, got;
const char *types[2] = { "*", NULL };
HINTERNET hi, hic = 0, hor = 0;
......@@ -814,7 +814,6 @@ static void InternetReadFile_chunked_test(void)
trace("got %u available\n",length);
if (length)
{
DWORD got;
char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
res = InternetReadFile(hor,buffer,length,&got);
......@@ -828,7 +827,13 @@ static void InternetReadFile_chunked_test(void)
if (!got) break;
}
if (length == 0)
{
got = 0xdeadbeef;
res = InternetReadFile( hor, buffer, 1, &got );
ok( res, "InternetReadFile failed: %u\n", GetLastError() );
ok( !got, "got %u\n", got );
break;
}
}
abort:
trace("aborting\n");
......
......@@ -3803,6 +3803,22 @@ struct open_desktop_reply
struct open_input_desktop_request
{
struct request_header __header;
unsigned int flags;
unsigned int access;
unsigned int attributes;
};
struct open_input_desktop_reply
{
struct reply_header __header;
obj_handle_t handle;
char __pad_12[4];
};
struct close_desktop_request
{
struct request_header __header;
......@@ -5232,6 +5248,7 @@ enum request
REQ_enum_winstation,
REQ_create_desktop,
REQ_open_desktop,
REQ_open_input_desktop,
REQ_close_desktop,
REQ_get_thread_desktop,
REQ_set_thread_desktop,
......@@ -5492,6 +5509,7 @@ union generic_request
struct enum_winstation_request enum_winstation_request;
struct create_desktop_request create_desktop_request;
struct open_desktop_request open_desktop_request;
struct open_input_desktop_request open_input_desktop_request;
struct close_desktop_request close_desktop_request;
struct get_thread_desktop_request get_thread_desktop_request;
struct set_thread_desktop_request set_thread_desktop_request;
......@@ -5750,6 +5768,7 @@ union generic_reply
struct enum_winstation_reply enum_winstation_reply;
struct create_desktop_reply create_desktop_reply;
struct open_desktop_reply open_desktop_reply;
struct open_input_desktop_reply open_input_desktop_reply;
struct close_desktop_reply close_desktop_reply;
struct get_thread_desktop_reply get_thread_desktop_reply;
struct set_thread_desktop_reply set_thread_desktop_reply;
......@@ -5825,6 +5844,6 @@ union generic_reply
struct set_suspend_context_reply set_suspend_context_reply;
};
#define SERVER_PROTOCOL_VERSION 450
#define SERVER_PROTOCOL_VERSION 451
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -2706,6 +2706,16 @@ enum coords_relative
@END
/* Open a handle to current input desktop */
@REQ(open_input_desktop)
unsigned int flags; /* desktop flags */
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
@REPLY
obj_handle_t handle; /* handle to the desktop */
@END
/* Close a desktop */
@REQ(close_desktop)
obj_handle_t handle; /* handle to the desktop */
......
......@@ -286,6 +286,7 @@ DECL_HANDLER(set_process_winstation);
DECL_HANDLER(enum_winstation);
DECL_HANDLER(create_desktop);
DECL_HANDLER(open_desktop);
DECL_HANDLER(open_input_desktop);
DECL_HANDLER(close_desktop);
DECL_HANDLER(get_thread_desktop);
DECL_HANDLER(set_thread_desktop);
......@@ -545,6 +546,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_enum_winstation,
(req_handler)req_create_desktop,
(req_handler)req_open_desktop,
(req_handler)req_open_input_desktop,
(req_handler)req_close_desktop,
(req_handler)req_get_thread_desktop,
(req_handler)req_set_thread_desktop,
......@@ -1735,6 +1737,12 @@ C_ASSERT( FIELD_OFFSET(struct open_desktop_request, attributes) == 24 );
C_ASSERT( sizeof(struct open_desktop_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct open_desktop_reply, handle) == 8 );
C_ASSERT( sizeof(struct open_desktop_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_input_desktop_request, flags) == 12 );
C_ASSERT( FIELD_OFFSET(struct open_input_desktop_request, access) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_input_desktop_request, attributes) == 20 );
C_ASSERT( sizeof(struct open_input_desktop_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct open_input_desktop_reply, handle) == 8 );
C_ASSERT( sizeof(struct open_input_desktop_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct close_desktop_request, handle) == 12 );
C_ASSERT( sizeof(struct close_desktop_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_thread_desktop_request, tid) == 12 );
......
......@@ -3192,6 +3192,18 @@ static void dump_open_desktop_reply( const struct open_desktop_reply *req )
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_open_input_desktop_request( const struct open_input_desktop_request *req )
{
fprintf( stderr, " flags=%08x", req->flags );
fprintf( stderr, ", access=%08x", req->access );
fprintf( stderr, ", attributes=%08x", req->attributes );
}
static void dump_open_input_desktop_reply( const struct open_input_desktop_reply *req )
{
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_close_desktop_request( const struct close_desktop_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
......@@ -4252,6 +4264,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_enum_winstation_request,
(dump_func)dump_create_desktop_request,
(dump_func)dump_open_desktop_request,
(dump_func)dump_open_input_desktop_request,
(dump_func)dump_close_desktop_request,
(dump_func)dump_get_thread_desktop_request,
(dump_func)dump_set_thread_desktop_request,
......@@ -4508,6 +4521,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_enum_winstation_reply,
(dump_func)dump_create_desktop_reply,
(dump_func)dump_open_desktop_reply,
(dump_func)dump_open_input_desktop_reply,
NULL,
(dump_func)dump_get_thread_desktop_reply,
NULL,
......@@ -4764,6 +4778,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"enum_winstation",
"create_desktop",
"open_desktop",
"open_input_desktop",
"close_desktop",
"get_thread_desktop",
"set_thread_desktop",
......
......@@ -551,6 +551,29 @@ DECL_HANDLER(open_desktop)
}
}
/* open a handle to current input desktop */
DECL_HANDLER(open_input_desktop)
{
/* FIXME: check access rights */
struct winstation *winstation = get_process_winstation( current->process, 0 );
struct desktop *desktop;
if (!winstation) return;
if (!(winstation->flags & WSF_VISIBLE))
{
set_error( STATUS_ILLEGAL_FUNCTION );
release_object( winstation );
return;
}
if ((desktop = get_desktop_obj( current->process, current->process->desktop, 0 )))
{
reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
release_object( desktop );
}
release_object( winstation );
}
/* close a desktop */
DECL_HANDLER(close_desktop)
......
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