2002-10-07 23:54:07 +02:00
|
|
|
/*
|
|
|
|
* Unit test suite for rpc functions
|
|
|
|
*
|
|
|
|
* Copyright 2002 Greg Turner
|
2016-12-08 13:24:46 +01:00
|
|
|
* Copyright 2008-2009 Robert Shearman
|
2002-10-07 23:54:07 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-10-07 23:54:07 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2006-06-01 21:25:15 +02:00
|
|
|
#include <stdio.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
2016-12-08 13:24:47 +01:00
|
|
|
#define COBJMACROS
|
2008-01-07 11:18:34 +01:00
|
|
|
#include <ntstatus.h>
|
|
|
|
#define WIN32_NO_STATUS
|
2002-10-07 23:54:07 +02:00
|
|
|
#include "wine/test.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <windef.h>
|
2002-10-07 23:54:07 +02:00
|
|
|
#include <winbase.h>
|
|
|
|
#include <winnt.h>
|
|
|
|
#include <winerror.h>
|
2013-11-08 11:50:20 +01:00
|
|
|
#include <ole2.h>
|
2016-12-08 13:24:47 +01:00
|
|
|
#include <oleauto.h>
|
2013-11-08 11:50:20 +01:00
|
|
|
#include <ntsecapi.h>
|
2016-12-08 13:24:47 +01:00
|
|
|
#include <initguid.h>
|
|
|
|
#include <netfw.h>
|
2002-10-07 23:54:07 +02:00
|
|
|
|
|
|
|
#include "rpc.h"
|
2004-12-23 12:29:54 +01:00
|
|
|
#include "rpcdce.h"
|
2012-05-09 12:06:29 +02:00
|
|
|
#include "secext.h"
|
2002-10-07 23:54:07 +02:00
|
|
|
|
2006-06-01 21:25:15 +02:00
|
|
|
typedef unsigned int unsigned32;
|
|
|
|
typedef struct twr_t
|
|
|
|
{
|
|
|
|
unsigned32 tower_length;
|
|
|
|
/* [size_is] */ byte tower_octet_string[ 1 ];
|
|
|
|
} twr_t;
|
|
|
|
|
|
|
|
RPC_STATUS WINAPI TowerExplode(const twr_t *tower, RPC_SYNTAX_IDENTIFIER *object, RPC_SYNTAX_IDENTIFIER *syntax, char **protseq, char **endpoint, char **address);
|
|
|
|
RPC_STATUS WINAPI TowerConstruct(const RPC_SYNTAX_IDENTIFIER *object, const RPC_SYNTAX_IDENTIFIER *syntax, const char *protseq, const char *endpoint, const char *address, twr_t **tower);
|
|
|
|
|
2002-10-07 23:54:07 +02:00
|
|
|
static UUID Uuid_Table[10] = {
|
|
|
|
{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 0 (null) */
|
|
|
|
{ 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8a} }, /* 1 */
|
|
|
|
{ 0xabadfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 2 */
|
|
|
|
{ 0x93da375c, 0x1324, 0x1355, {0x87, 0xff, 0x49, 0x44, 0x34, 0x44, 0x22, 0x19} }, /* 3 */
|
|
|
|
{ 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8b} }, /* 4 (~1) */
|
|
|
|
{ 0x9badfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 5 (~2) */
|
|
|
|
{ 0x00000000, 0x0001, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 6 (~0) */
|
|
|
|
{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} }, /* 7 (~0) */
|
|
|
|
{ 0x12312312, 0x1231, 0x1231, {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff} }, /* 8 */
|
|
|
|
{ 0x11111111, 0x1111, 0x1111, {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11} } /* 9 */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* index of "10" means "NULL" */
|
|
|
|
static BOOL Uuid_Comparison_Grid[11][11] = {
|
|
|
|
{ TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE },
|
|
|
|
{ FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE },
|
|
|
|
{ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE },
|
|
|
|
{ TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }
|
|
|
|
};
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void UuidConversionAndComparison(void) {
|
2002-10-07 23:54:07 +02:00
|
|
|
CHAR strx[100], x;
|
|
|
|
LPSTR str = strx;
|
|
|
|
WCHAR wstrx[100], wx;
|
|
|
|
LPWSTR wstr = wstrx;
|
|
|
|
|
|
|
|
UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
|
|
|
|
RPC_STATUS rslt;
|
|
|
|
|
|
|
|
int i1,i2;
|
|
|
|
|
|
|
|
/* Uuid Equality */
|
|
|
|
for (i1 = 0; i1 < 11; i1++)
|
|
|
|
for (i2 = 0; i2 < 11; i2++) {
|
|
|
|
if (i1 < 10) {
|
|
|
|
Uuid1 = Uuid_Table[i1];
|
|
|
|
PUuid1 = &Uuid1;
|
|
|
|
} else {
|
|
|
|
PUuid1 = NULL;
|
|
|
|
}
|
|
|
|
if (i2 < 10) {
|
|
|
|
Uuid2 = Uuid_Table[i2];
|
|
|
|
PUuid2 = &Uuid2;
|
|
|
|
} else {
|
|
|
|
PUuid2 = NULL;
|
|
|
|
}
|
2004-01-26 21:23:25 +01:00
|
|
|
ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality\n" );
|
2002-10-07 23:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Uuid to String to Uuid (char) */
|
|
|
|
for (i1 = 0; i1 < 10; i1++) {
|
|
|
|
Uuid1 = Uuid_Table[i1];
|
2004-01-26 21:23:25 +01:00
|
|
|
ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy\n" );
|
2005-09-06 12:26:13 +02:00
|
|
|
ok( (UuidFromStringA((unsigned char*)str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String\n" );
|
2004-01-26 21:23:25 +01:00
|
|
|
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform\n" );
|
2002-10-07 23:54:07 +02:00
|
|
|
/* invalid uuid tests -- size of valid UUID string=36 */
|
|
|
|
for (i2 = 0; i2 < 36; i2++) {
|
|
|
|
x = str[i2];
|
|
|
|
str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
|
2005-09-06 12:26:13 +02:00
|
|
|
ok( (UuidFromStringA((unsigned char*)str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String\n" );
|
2002-10-07 23:54:07 +02:00
|
|
|
str[i2] = x; /* change it back so remaining tests are interesting. */
|
|
|
|
}
|
2013-11-08 11:50:20 +01:00
|
|
|
RpcStringFreeA((unsigned char **)&str);
|
2002-10-07 23:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Uuid to String to Uuid (wchar) */
|
|
|
|
for (i1 = 0; i1 < 10; i1++) {
|
|
|
|
Uuid1 = Uuid_Table[i1];
|
2002-12-05 20:01:51 +01:00
|
|
|
rslt=UuidToStringW(&Uuid1, &wstr);
|
2011-02-26 02:50:35 +01:00
|
|
|
ok( (rslt == RPC_S_OK), "Simple UUID->WString copy\n" );
|
|
|
|
ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String\n" );
|
|
|
|
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform\n" );
|
2002-10-07 23:54:07 +02:00
|
|
|
/* invalid uuid tests -- size of valid UUID string=36 */
|
|
|
|
for (i2 = 0; i2 < 36; i2++) {
|
|
|
|
wx = wstr[i2];
|
|
|
|
wstr[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
|
2004-01-26 21:23:25 +01:00
|
|
|
ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString\n" );
|
2002-10-07 23:54:07 +02:00
|
|
|
wstr[i2] = wx; /* change it back so remaining tests are interesting. */
|
|
|
|
}
|
2008-01-31 15:45:59 +01:00
|
|
|
RpcStringFreeW(&wstr);
|
2002-10-07 23:54:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void TestDceErrorInqText (void)
|
2004-12-23 12:29:54 +01:00
|
|
|
{
|
|
|
|
char bufferInvalid [1024];
|
|
|
|
char buffer [1024]; /* The required size is not documented but would
|
|
|
|
* appear to be 256.
|
|
|
|
*/
|
|
|
|
DWORD dwCount;
|
|
|
|
|
|
|
|
dwCount = FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM |
|
|
|
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
|
|
NULL, RPC_S_NOT_RPC_ERROR, 0, bufferInvalid,
|
|
|
|
sizeof(bufferInvalid)/sizeof(bufferInvalid[0]), NULL);
|
|
|
|
|
|
|
|
/* A random sample of DceErrorInqText */
|
|
|
|
/* 0 is success */
|
2005-09-06 12:26:13 +02:00
|
|
|
ok ((DceErrorInqTextA (0, (unsigned char*)buffer) == RPC_S_OK),
|
2004-12-23 12:29:54 +01:00
|
|
|
"DceErrorInqTextA(0...)\n");
|
|
|
|
/* A real RPC_S error */
|
2005-09-06 12:26:13 +02:00
|
|
|
ok ((DceErrorInqTextA (RPC_S_INVALID_STRING_UUID, (unsigned char*)buffer) == RPC_S_OK),
|
2004-12-23 12:29:54 +01:00
|
|
|
"DceErrorInqTextA(valid...)\n");
|
|
|
|
|
|
|
|
if (dwCount)
|
|
|
|
{
|
|
|
|
/* A message for which FormatMessage should fail
|
|
|
|
* which should return RPC_S_OK and the
|
|
|
|
* fixed "not valid" message
|
|
|
|
*/
|
2005-09-06 12:26:13 +02:00
|
|
|
ok ((DceErrorInqTextA (35, (unsigned char*)buffer) == RPC_S_OK &&
|
2004-12-23 12:29:54 +01:00
|
|
|
strcmp (buffer, bufferInvalid) == 0),
|
|
|
|
"DceErrorInqTextA(unformattable...)\n");
|
|
|
|
/* One for which FormatMessage should succeed but
|
|
|
|
* DceErrorInqText should "fail"
|
|
|
|
* 3814 is generally quite a long message
|
|
|
|
*/
|
2005-09-06 12:26:13 +02:00
|
|
|
ok ((DceErrorInqTextA (3814, (unsigned char*)buffer) == RPC_S_OK &&
|
2004-12-23 12:29:54 +01:00
|
|
|
strcmp (buffer, bufferInvalid) == 0),
|
|
|
|
"DceErrorInqTextA(deviation...)\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ok (0, "Cannot set up for DceErrorInqText\n");
|
|
|
|
}
|
|
|
|
|
2007-04-13 02:12:20 +02:00
|
|
|
static RPC_DISPATCH_FUNCTION IFoo_table[] =
|
|
|
|
{
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2007-12-30 17:46:21 +01:00
|
|
|
static RPC_DISPATCH_TABLE IFoo_v0_0_DispatchTable =
|
2007-04-13 02:12:20 +02:00
|
|
|
{
|
|
|
|
0,
|
|
|
|
IFoo_table
|
|
|
|
};
|
|
|
|
|
|
|
|
static const RPC_SERVER_INTERFACE IFoo___RpcServerInterface =
|
|
|
|
{
|
|
|
|
sizeof(RPC_SERVER_INTERFACE),
|
|
|
|
{{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x34}},{0,0}},
|
|
|
|
{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
|
|
|
|
&IFoo_v0_0_DispatchTable,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
2007-12-30 17:46:21 +01:00
|
|
|
static RPC_IF_HANDLE IFoo_v0_0_s_ifspec = (RPC_IF_HANDLE)& IFoo___RpcServerInterface;
|
2007-04-13 02:12:20 +02:00
|
|
|
|
2006-05-18 12:06:30 +02:00
|
|
|
static void test_rpc_ncacn_ip_tcp(void)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
2009-11-12 14:46:23 +01:00
|
|
|
unsigned char *binding, *principal;
|
2007-04-13 02:12:20 +02:00
|
|
|
handle_t IFoo_IfHandle;
|
2009-11-12 14:46:23 +01:00
|
|
|
ULONG level, authnsvc, authzsvc;
|
|
|
|
RPC_AUTH_IDENTITY_HANDLE identity;
|
2007-01-12 14:09:59 +01:00
|
|
|
static unsigned char foo[] = "foo";
|
|
|
|
static unsigned char ncacn_ip_tcp[] = "ncacn_ip_tcp";
|
2007-04-13 02:12:20 +02:00
|
|
|
static unsigned char address[] = "127.0.0.1";
|
|
|
|
static unsigned char endpoint[] = "4114";
|
2009-11-12 14:46:23 +01:00
|
|
|
static unsigned char spn[] = "principal";
|
2006-05-18 12:06:30 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcNetworkIsProtseqValidA(foo);
|
2006-05-18 12:06:30 +02:00
|
|
|
ok(status == RPC_S_INVALID_RPC_PROTSEQ, "return wrong\n");
|
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcNetworkIsProtseqValidA(ncacn_ip_tcp);
|
2006-05-18 12:06:30 +02:00
|
|
|
ok(status == RPC_S_OK, "return wrong\n");
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcMgmtStopServerListening(NULL);
|
|
|
|
ok(status == RPC_S_NOT_LISTENING,
|
2009-01-04 01:49:14 +01:00
|
|
|
"wrong RpcMgmtStopServerListening error (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcMgmtWaitServerListen();
|
|
|
|
ok(status == RPC_S_NOT_LISTENING,
|
2009-01-04 01:49:14 +01:00
|
|
|
"wrong RpcMgmtWaitServerListen error status (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcServerListen(1, 20, FALSE);
|
|
|
|
ok(status == RPC_S_NO_PROTSEQS_REGISTERED,
|
2009-01-04 01:49:14 +01:00
|
|
|
"wrong RpcServerListen error (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcServerUseProtseqEpA(ncacn_ip_tcp, 20, endpoint, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseqEp failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcServerListen(1, 20, TRUE);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcServerListen(1, 20, TRUE);
|
|
|
|
ok(status == RPC_S_ALREADY_LISTENING,
|
2009-01-04 01:49:14 +01:00
|
|
|
"wrong RpcServerListen error (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address,
|
2007-04-13 02:12:20 +02:00
|
|
|
endpoint, NULL, &binding);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingFromStringBindingA(binding, &IFoo_IfHandle);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n",
|
2007-04-13 02:12:20 +02:00
|
|
|
status);
|
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingSetAuthInfoA(IFoo_IfHandle, NULL, RPC_C_AUTHN_LEVEL_NONE,
|
2008-06-23 09:52:23 +02:00
|
|
|
RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
|
2011-02-26 02:50:35 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
|
2008-06-23 09:52:23 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingInqAuthInfoA(IFoo_IfHandle, NULL, NULL, NULL, NULL, NULL);
|
2009-11-12 14:46:23 +01:00
|
|
|
ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%u)\n",
|
|
|
|
status);
|
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingSetAuthInfoA(IFoo_IfHandle, spn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
2009-11-12 14:46:23 +01:00
|
|
|
RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
|
|
|
|
ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
|
|
|
|
|
|
|
|
level = authnsvc = authzsvc = 0;
|
|
|
|
principal = (unsigned char *)0xdeadbeef;
|
|
|
|
identity = (RPC_AUTH_IDENTITY_HANDLE *)0xdeadbeef;
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingInqAuthInfoA(IFoo_IfHandle, &principal, &level, &authnsvc,
|
2009-11-12 14:46:23 +01:00
|
|
|
&identity, &authzsvc);
|
|
|
|
|
|
|
|
ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%u)\n", status);
|
2010-07-19 19:16:59 +02:00
|
|
|
ok(identity == NULL, "expected NULL identity, got %p\n", identity);
|
|
|
|
ok(principal != (unsigned char *)0xdeadbeef, "expected valid principal, got %p\n", principal);
|
|
|
|
ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %d\n", level);
|
|
|
|
ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %d\n", authnsvc);
|
|
|
|
todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %d\n", authzsvc);
|
2013-11-08 11:50:20 +01:00
|
|
|
if (status == RPC_S_OK) RpcStringFreeA(&principal);
|
2009-11-12 14:46:23 +01:00
|
|
|
|
2007-04-13 02:12:20 +02:00
|
|
|
status = RpcMgmtStopServerListening(NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
|
2007-04-13 02:12:20 +02:00
|
|
|
status);
|
|
|
|
|
|
|
|
status = RpcMgmtStopServerListening(NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
|
2007-04-13 02:12:20 +02:00
|
|
|
status);
|
|
|
|
|
|
|
|
status = RpcServerUnregisterIf(NULL, NULL, FALSE);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcMgmtWaitServerListen();
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcStringFreeA(&binding);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status);
|
2007-04-13 02:12:20 +02:00
|
|
|
|
|
|
|
status = RpcBindingFree(&IFoo_IfHandle);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcBindingFree failed (%u)\n", status);
|
2006-05-18 12:06:30 +02:00
|
|
|
}
|
|
|
|
|
2006-06-01 21:25:15 +02:00
|
|
|
/* this is what's generated with MS/RPC - it includes an extra 2
|
|
|
|
* bytes in the protocol floor */
|
|
|
|
static const unsigned char tower_data_tcp_ip1[] =
|
|
|
|
{
|
|
|
|
0x05,0x00,0x13,0x00,0x0d,0x00,0xdb,0xf1,
|
|
|
|
0xa4,0x47,0xca,0x67,0x10,0xb3,0x1f,0x00,
|
|
|
|
0xdd,0x01,0x06,0x62,0xda,0x00,0x00,0x02,
|
|
|
|
0x00,0x00,0x00,0x13,0x00,0x0d,0x04,0x5d,
|
|
|
|
0x88,0x8a,0xeb,0x1c,0xc9,0x11,0x9f,0xe8,
|
|
|
|
0x08,0x00,0x2b,0x10,0x48,0x60,0x02,0x00,
|
|
|
|
0x02,0x00,0x00,0x00,0x01,0x00,0x0b,0x02,
|
|
|
|
0x00,0x00,0x00,0x01,0x00,0x07,0x02,0x00,
|
|
|
|
0x00,0x87,0x01,0x00,0x09,0x04,0x00,0x0a,
|
|
|
|
0x00,0x00,0x01,
|
|
|
|
};
|
|
|
|
/* this is the optimal data that i think should be generated */
|
|
|
|
static const unsigned char tower_data_tcp_ip2[] =
|
|
|
|
{
|
|
|
|
0x05,0x00,0x13,0x00,0x0d,0x00,0xdb,0xf1,
|
|
|
|
0xa4,0x47,0xca,0x67,0x10,0xb3,0x1f,0x00,
|
|
|
|
0xdd,0x01,0x06,0x62,0xda,0x00,0x00,0x02,
|
|
|
|
0x00,0x00,0x00,0x13,0x00,0x0d,0x04,0x5d,
|
|
|
|
0x88,0x8a,0xeb,0x1c,0xc9,0x11,0x9f,0xe8,
|
|
|
|
0x08,0x00,0x2b,0x10,0x48,0x60,0x02,0x00,
|
|
|
|
0x02,0x00,0x00,0x00,0x01,0x00,0x0b,0x00,
|
|
|
|
0x00,0x01,0x00,0x07,0x02,0x00,0x00,0x87,
|
|
|
|
0x01,0x00,0x09,0x04,0x00,0x0a,0x00,0x00,
|
|
|
|
0x01,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void test_towers(void)
|
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
|
|
|
twr_t *tower;
|
|
|
|
static const RPC_SYNTAX_IDENTIFIER mapi_if_id = { { 0xa4f1db00, 0xca47, 0x1067, { 0xb3, 0x1f, 0x00, 0xdd, 0x01, 0x06, 0x62, 0xda } }, { 0, 0 } };
|
|
|
|
static const RPC_SYNTAX_IDENTIFIER ndr_syntax = { { 0x8a885d04, 0x1ceb, 0x11c9, { 0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60 } }, { 2, 0 } };
|
|
|
|
RPC_SYNTAX_IDENTIFIER object, syntax;
|
|
|
|
char *protseq, *endpoint, *address;
|
|
|
|
BOOL same;
|
|
|
|
|
|
|
|
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "10.0.0.1", &tower);
|
2008-09-03 05:41:36 +02:00
|
|
|
ok(ret == RPC_S_OK ||
|
|
|
|
broken(ret == RPC_S_INVALID_RPC_PROTSEQ), /* Vista */
|
2009-01-04 01:49:14 +01:00
|
|
|
"TowerConstruct failed with error %d\n", ret);
|
2008-02-08 10:51:14 +01:00
|
|
|
if (ret == RPC_S_INVALID_RPC_PROTSEQ)
|
|
|
|
{
|
|
|
|
/* Windows Vista fails with this error and crashes if we continue */
|
2009-03-26 06:53:30 +01:00
|
|
|
win_skip("TowerConstruct failed, we are most likely on Windows Vista\n");
|
2008-02-08 10:51:14 +01:00
|
|
|
return;
|
|
|
|
}
|
2006-06-01 21:25:15 +02:00
|
|
|
|
|
|
|
/* first check we have the right amount of data */
|
|
|
|
ok(tower->tower_length == sizeof(tower_data_tcp_ip1) ||
|
|
|
|
tower->tower_length == sizeof(tower_data_tcp_ip2),
|
2006-06-13 14:03:44 +02:00
|
|
|
"Wrong size of tower %d\n", tower->tower_length);
|
2006-06-01 21:25:15 +02:00
|
|
|
|
|
|
|
/* then do a byte-by-byte comparison */
|
|
|
|
same = ((tower->tower_length == sizeof(tower_data_tcp_ip1)) &&
|
|
|
|
!memcmp(&tower->tower_octet_string, tower_data_tcp_ip1, sizeof(tower_data_tcp_ip1))) ||
|
|
|
|
((tower->tower_length == sizeof(tower_data_tcp_ip2)) &&
|
|
|
|
!memcmp(&tower->tower_octet_string, tower_data_tcp_ip2, sizeof(tower_data_tcp_ip2)));
|
|
|
|
|
|
|
|
ok(same, "Tower data differs\n");
|
|
|
|
if (!same)
|
|
|
|
{
|
|
|
|
unsigned32 i;
|
|
|
|
for (i = 0; i < tower->tower_length; i++)
|
|
|
|
{
|
|
|
|
if (i % 8 == 0) printf(" ");
|
|
|
|
printf("0x%02x,", tower->tower_octet_string[i]);
|
|
|
|
if (i % 8 == 7) printf("\n");
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = TowerExplode(tower, &object, &syntax, &protseq, &endpoint, &address);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
|
2006-06-01 21:25:15 +02:00
|
|
|
ok(!memcmp(&object, &mapi_if_id, sizeof(mapi_if_id)), "object id didn't match\n");
|
|
|
|
ok(!memcmp(&syntax, &ndr_syntax, sizeof(syntax)), "syntax id didn't match\n");
|
|
|
|
ok(!strcmp(protseq, "ncacn_ip_tcp"), "protseq was \"%s\" instead of \"ncacn_ip_tcp\"\n", protseq);
|
|
|
|
ok(!strcmp(endpoint, "135"), "endpoint was \"%s\" instead of \"135\"\n", endpoint);
|
|
|
|
ok(!strcmp(address, "10.0.0.1"), "address was \"%s\" instead of \"10.0.0.1\"\n", address);
|
|
|
|
|
|
|
|
I_RpcFree(protseq);
|
|
|
|
I_RpcFree(endpoint);
|
|
|
|
I_RpcFree(address);
|
2006-06-01 21:25:26 +02:00
|
|
|
|
|
|
|
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
|
2006-06-01 21:25:26 +02:00
|
|
|
|
2006-06-01 21:25:15 +02:00
|
|
|
I_RpcFree(tower);
|
2006-06-02 21:46:29 +02:00
|
|
|
|
|
|
|
/* test the behaviour for ip_tcp with name instead of dotted IP notation */
|
|
|
|
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "localhost", &tower);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
|
2006-06-02 21:46:29 +02:00
|
|
|
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
|
2008-09-11 14:32:30 +02:00
|
|
|
ok(!strcmp(address, "0.0.0.0") ||
|
|
|
|
broken(!strcmp(address, "255.255.255.255")),
|
|
|
|
"address was \"%s\" instead of \"0.0.0.0\"\n", address);
|
2006-06-02 21:46:29 +02:00
|
|
|
|
|
|
|
I_RpcFree(address);
|
|
|
|
I_RpcFree(tower);
|
2008-01-15 13:09:52 +01:00
|
|
|
|
|
|
|
/* test the behaviour for np with no address */
|
|
|
|
ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_np", "\\pipe\\test", NULL, &tower);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
|
2008-01-15 13:09:52 +01:00
|
|
|
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
|
2008-07-02 06:22:39 +02:00
|
|
|
ok(ret == RPC_S_OK ||
|
|
|
|
broken(ret != RPC_S_OK), /* win2k, indeterminate */
|
2009-01-04 01:49:14 +01:00
|
|
|
"TowerExplode failed with error %d\n", ret);
|
2008-02-11 16:45:36 +01:00
|
|
|
/* Windows XP SP3 sets address to NULL */
|
2008-12-17 10:26:47 +01:00
|
|
|
ok(!address || !strcmp(address, ""), "address was \"%s\" instead of \"\" or NULL (XP SP3)\n", address);
|
2008-01-15 13:09:52 +01:00
|
|
|
|
|
|
|
I_RpcFree(address);
|
|
|
|
I_RpcFree(tower);
|
2006-06-01 21:25:15 +02:00
|
|
|
}
|
|
|
|
|
2008-01-07 11:18:34 +01:00
|
|
|
static void test_I_RpcMapWin32Status(void)
|
|
|
|
{
|
|
|
|
LONG win32status;
|
|
|
|
RPC_STATUS rpc_status;
|
2008-02-11 11:51:26 +01:00
|
|
|
BOOL w2k3_up = FALSE;
|
2008-02-08 10:32:18 +01:00
|
|
|
|
2016-09-01 15:15:49 +02:00
|
|
|
/* Windows 2003 and above return STATUS_UNSUCCESSFUL if given an unknown status */
|
2008-02-08 10:32:18 +01:00
|
|
|
win32status = I_RpcMapWin32Status(9999);
|
|
|
|
if (win32status == STATUS_UNSUCCESSFUL)
|
2008-02-11 11:51:26 +01:00
|
|
|
w2k3_up = TRUE;
|
2008-01-07 11:18:34 +01:00
|
|
|
|
2008-06-12 10:52:45 +02:00
|
|
|
/* On Windows XP-SP1 and below some statuses are not mapped and return
|
|
|
|
* the given status
|
|
|
|
*/
|
2008-01-07 11:18:34 +01:00
|
|
|
for (rpc_status = 0; rpc_status < 10000; rpc_status++)
|
|
|
|
{
|
|
|
|
LONG expected_win32status;
|
2008-06-12 10:52:45 +02:00
|
|
|
BOOL missing = FALSE;
|
|
|
|
|
2008-01-07 11:18:34 +01:00
|
|
|
win32status = I_RpcMapWin32Status(rpc_status);
|
|
|
|
switch (rpc_status)
|
|
|
|
{
|
2008-02-08 10:32:18 +01:00
|
|
|
case ERROR_SUCCESS: expected_win32status = ERROR_SUCCESS; break;
|
2008-01-07 11:18:34 +01:00
|
|
|
case ERROR_ACCESS_DENIED: expected_win32status = STATUS_ACCESS_DENIED; break;
|
|
|
|
case ERROR_INVALID_HANDLE: expected_win32status = RPC_NT_SS_CONTEXT_MISMATCH; break;
|
|
|
|
case ERROR_OUTOFMEMORY: expected_win32status = STATUS_NO_MEMORY; break;
|
|
|
|
case ERROR_INVALID_PARAMETER: expected_win32status = STATUS_INVALID_PARAMETER; break;
|
|
|
|
case ERROR_INSUFFICIENT_BUFFER: expected_win32status = STATUS_BUFFER_TOO_SMALL; break;
|
|
|
|
case ERROR_MAX_THRDS_REACHED: expected_win32status = STATUS_NO_MEMORY; break;
|
|
|
|
case ERROR_NOACCESS: expected_win32status = STATUS_ACCESS_VIOLATION; break;
|
|
|
|
case ERROR_NOT_ENOUGH_SERVER_MEMORY: expected_win32status = STATUS_INSUFF_SERVER_RESOURCES; break;
|
2008-06-12 10:52:45 +02:00
|
|
|
case ERROR_WRONG_PASSWORD: expected_win32status = STATUS_WRONG_PASSWORD; missing = TRUE; break;
|
|
|
|
case ERROR_INVALID_LOGON_HOURS: expected_win32status = STATUS_INVALID_LOGON_HOURS; missing = TRUE; break;
|
|
|
|
case ERROR_PASSWORD_EXPIRED: expected_win32status = STATUS_PASSWORD_EXPIRED; missing = TRUE; break;
|
|
|
|
case ERROR_ACCOUNT_DISABLED: expected_win32status = STATUS_ACCOUNT_DISABLED; missing = TRUE; break;
|
2008-01-07 11:18:34 +01:00
|
|
|
case ERROR_INVALID_SECURITY_DESCR: expected_win32status = STATUS_INVALID_SECURITY_DESCR; break;
|
|
|
|
case RPC_S_INVALID_STRING_BINDING: expected_win32status = RPC_NT_INVALID_STRING_BINDING; break;
|
|
|
|
case RPC_S_WRONG_KIND_OF_BINDING: expected_win32status = RPC_NT_WRONG_KIND_OF_BINDING; break;
|
|
|
|
case RPC_S_INVALID_BINDING: expected_win32status = RPC_NT_INVALID_BINDING; break;
|
|
|
|
case RPC_S_PROTSEQ_NOT_SUPPORTED: expected_win32status = RPC_NT_PROTSEQ_NOT_SUPPORTED; break;
|
|
|
|
case RPC_S_INVALID_RPC_PROTSEQ: expected_win32status = RPC_NT_INVALID_RPC_PROTSEQ; break;
|
|
|
|
case RPC_S_INVALID_STRING_UUID: expected_win32status = RPC_NT_INVALID_STRING_UUID; break;
|
|
|
|
case RPC_S_INVALID_ENDPOINT_FORMAT: expected_win32status = RPC_NT_INVALID_ENDPOINT_FORMAT; break;
|
|
|
|
case RPC_S_INVALID_NET_ADDR: expected_win32status = RPC_NT_INVALID_NET_ADDR; break;
|
|
|
|
case RPC_S_NO_ENDPOINT_FOUND: expected_win32status = RPC_NT_NO_ENDPOINT_FOUND; break;
|
|
|
|
case RPC_S_INVALID_TIMEOUT: expected_win32status = RPC_NT_INVALID_TIMEOUT; break;
|
|
|
|
case RPC_S_OBJECT_NOT_FOUND: expected_win32status = RPC_NT_OBJECT_NOT_FOUND; break;
|
|
|
|
case RPC_S_ALREADY_REGISTERED: expected_win32status = RPC_NT_ALREADY_REGISTERED; break;
|
|
|
|
case RPC_S_TYPE_ALREADY_REGISTERED: expected_win32status = RPC_NT_TYPE_ALREADY_REGISTERED; break;
|
|
|
|
case RPC_S_ALREADY_LISTENING: expected_win32status = RPC_NT_ALREADY_LISTENING; break;
|
|
|
|
case RPC_S_NO_PROTSEQS_REGISTERED: expected_win32status = RPC_NT_NO_PROTSEQS_REGISTERED; break;
|
|
|
|
case RPC_S_NOT_LISTENING: expected_win32status = RPC_NT_NOT_LISTENING; break;
|
|
|
|
case RPC_S_UNKNOWN_MGR_TYPE: expected_win32status = RPC_NT_UNKNOWN_MGR_TYPE; break;
|
|
|
|
case RPC_S_UNKNOWN_IF: expected_win32status = RPC_NT_UNKNOWN_IF; break;
|
|
|
|
case RPC_S_NO_BINDINGS: expected_win32status = RPC_NT_NO_BINDINGS; break;
|
|
|
|
case RPC_S_NO_PROTSEQS: expected_win32status = RPC_NT_NO_PROTSEQS; break;
|
|
|
|
case RPC_S_CANT_CREATE_ENDPOINT: expected_win32status = RPC_NT_CANT_CREATE_ENDPOINT; break;
|
|
|
|
case RPC_S_OUT_OF_RESOURCES: expected_win32status = RPC_NT_OUT_OF_RESOURCES; break;
|
|
|
|
case RPC_S_SERVER_UNAVAILABLE: expected_win32status = RPC_NT_SERVER_UNAVAILABLE; break;
|
|
|
|
case RPC_S_SERVER_TOO_BUSY: expected_win32status = RPC_NT_SERVER_TOO_BUSY; break;
|
|
|
|
case RPC_S_INVALID_NETWORK_OPTIONS: expected_win32status = RPC_NT_INVALID_NETWORK_OPTIONS; break;
|
|
|
|
case RPC_S_NO_CALL_ACTIVE: expected_win32status = RPC_NT_NO_CALL_ACTIVE; break;
|
|
|
|
case RPC_S_CALL_FAILED: expected_win32status = RPC_NT_CALL_FAILED; break;
|
|
|
|
case RPC_S_CALL_FAILED_DNE: expected_win32status = RPC_NT_CALL_FAILED_DNE; break;
|
|
|
|
case RPC_S_PROTOCOL_ERROR: expected_win32status = RPC_NT_PROTOCOL_ERROR; break;
|
|
|
|
case RPC_S_UNSUPPORTED_TRANS_SYN: expected_win32status = RPC_NT_UNSUPPORTED_TRANS_SYN; break;
|
|
|
|
case RPC_S_UNSUPPORTED_TYPE: expected_win32status = RPC_NT_UNSUPPORTED_TYPE; break;
|
|
|
|
case RPC_S_INVALID_TAG: expected_win32status = RPC_NT_INVALID_TAG; break;
|
|
|
|
case RPC_S_INVALID_BOUND: expected_win32status = RPC_NT_INVALID_BOUND; break;
|
|
|
|
case RPC_S_NO_ENTRY_NAME: expected_win32status = RPC_NT_NO_ENTRY_NAME; break;
|
|
|
|
case RPC_S_INVALID_NAME_SYNTAX: expected_win32status = RPC_NT_INVALID_NAME_SYNTAX; break;
|
|
|
|
case RPC_S_UNSUPPORTED_NAME_SYNTAX: expected_win32status = RPC_NT_UNSUPPORTED_NAME_SYNTAX; break;
|
|
|
|
case RPC_S_UUID_NO_ADDRESS: expected_win32status = RPC_NT_UUID_NO_ADDRESS; break;
|
|
|
|
case RPC_S_DUPLICATE_ENDPOINT: expected_win32status = RPC_NT_DUPLICATE_ENDPOINT; break;
|
|
|
|
case RPC_S_UNKNOWN_AUTHN_TYPE: expected_win32status = RPC_NT_UNKNOWN_AUTHN_TYPE; break;
|
|
|
|
case RPC_S_MAX_CALLS_TOO_SMALL: expected_win32status = RPC_NT_MAX_CALLS_TOO_SMALL; break;
|
|
|
|
case RPC_S_STRING_TOO_LONG: expected_win32status = RPC_NT_STRING_TOO_LONG; break;
|
|
|
|
case RPC_S_PROTSEQ_NOT_FOUND: expected_win32status = RPC_NT_PROTSEQ_NOT_FOUND; break;
|
|
|
|
case RPC_S_PROCNUM_OUT_OF_RANGE: expected_win32status = RPC_NT_PROCNUM_OUT_OF_RANGE; break;
|
|
|
|
case RPC_S_BINDING_HAS_NO_AUTH: expected_win32status = RPC_NT_BINDING_HAS_NO_AUTH; break;
|
|
|
|
case RPC_S_UNKNOWN_AUTHN_SERVICE: expected_win32status = RPC_NT_UNKNOWN_AUTHN_SERVICE; break;
|
|
|
|
case RPC_S_UNKNOWN_AUTHN_LEVEL: expected_win32status = RPC_NT_UNKNOWN_AUTHN_LEVEL; break;
|
|
|
|
case RPC_S_INVALID_AUTH_IDENTITY: expected_win32status = RPC_NT_INVALID_AUTH_IDENTITY; break;
|
|
|
|
case RPC_S_UNKNOWN_AUTHZ_SERVICE: expected_win32status = RPC_NT_UNKNOWN_AUTHZ_SERVICE; break;
|
|
|
|
case EPT_S_INVALID_ENTRY: expected_win32status = EPT_NT_INVALID_ENTRY; break;
|
|
|
|
case EPT_S_CANT_PERFORM_OP: expected_win32status = EPT_NT_CANT_PERFORM_OP; break;
|
|
|
|
case EPT_S_NOT_REGISTERED: expected_win32status = EPT_NT_NOT_REGISTERED; break;
|
|
|
|
case EPT_S_CANT_CREATE: expected_win32status = EPT_NT_CANT_CREATE; break;
|
|
|
|
case RPC_S_NOTHING_TO_EXPORT: expected_win32status = RPC_NT_NOTHING_TO_EXPORT; break;
|
|
|
|
case RPC_S_INCOMPLETE_NAME: expected_win32status = RPC_NT_INCOMPLETE_NAME; break;
|
|
|
|
case RPC_S_INVALID_VERS_OPTION: expected_win32status = RPC_NT_INVALID_VERS_OPTION; break;
|
|
|
|
case RPC_S_NO_MORE_MEMBERS: expected_win32status = RPC_NT_NO_MORE_MEMBERS; break;
|
|
|
|
case RPC_S_NOT_ALL_OBJS_UNEXPORTED: expected_win32status = RPC_NT_NOT_ALL_OBJS_UNEXPORTED; break;
|
|
|
|
case RPC_S_INTERFACE_NOT_FOUND: expected_win32status = RPC_NT_INTERFACE_NOT_FOUND; break;
|
|
|
|
case RPC_S_ENTRY_ALREADY_EXISTS: expected_win32status = RPC_NT_ENTRY_ALREADY_EXISTS; break;
|
|
|
|
case RPC_S_ENTRY_NOT_FOUND: expected_win32status = RPC_NT_ENTRY_NOT_FOUND; break;
|
|
|
|
case RPC_S_NAME_SERVICE_UNAVAILABLE: expected_win32status = RPC_NT_NAME_SERVICE_UNAVAILABLE; break;
|
|
|
|
case RPC_S_INVALID_NAF_ID: expected_win32status = RPC_NT_INVALID_NAF_ID; break;
|
|
|
|
case RPC_S_CANNOT_SUPPORT: expected_win32status = RPC_NT_CANNOT_SUPPORT; break;
|
|
|
|
case RPC_S_NO_CONTEXT_AVAILABLE: expected_win32status = RPC_NT_NO_CONTEXT_AVAILABLE; break;
|
|
|
|
case RPC_S_INTERNAL_ERROR: expected_win32status = RPC_NT_INTERNAL_ERROR; break;
|
|
|
|
case RPC_S_ZERO_DIVIDE: expected_win32status = RPC_NT_ZERO_DIVIDE; break;
|
|
|
|
case RPC_S_ADDRESS_ERROR: expected_win32status = RPC_NT_ADDRESS_ERROR; break;
|
|
|
|
case RPC_S_FP_DIV_ZERO: expected_win32status = RPC_NT_FP_DIV_ZERO; break;
|
|
|
|
case RPC_S_FP_UNDERFLOW: expected_win32status = RPC_NT_FP_UNDERFLOW; break;
|
|
|
|
case RPC_S_FP_OVERFLOW: expected_win32status = RPC_NT_FP_OVERFLOW; break;
|
|
|
|
case RPC_S_CALL_IN_PROGRESS: expected_win32status = RPC_NT_CALL_IN_PROGRESS; break;
|
|
|
|
case RPC_S_NO_MORE_BINDINGS: expected_win32status = RPC_NT_NO_MORE_BINDINGS; break;
|
2008-06-12 10:52:45 +02:00
|
|
|
case RPC_S_CALL_CANCELLED: expected_win32status = RPC_NT_CALL_CANCELLED; missing = TRUE; break;
|
2008-01-07 11:18:34 +01:00
|
|
|
case RPC_S_INVALID_OBJECT: expected_win32status = RPC_NT_INVALID_OBJECT; break;
|
2008-06-12 10:52:45 +02:00
|
|
|
case RPC_S_INVALID_ASYNC_HANDLE: expected_win32status = RPC_NT_INVALID_ASYNC_HANDLE; missing = TRUE; break;
|
|
|
|
case RPC_S_INVALID_ASYNC_CALL: expected_win32status = RPC_NT_INVALID_ASYNC_CALL; missing = TRUE; break;
|
2008-01-07 11:18:34 +01:00
|
|
|
case RPC_S_GROUP_MEMBER_NOT_FOUND: expected_win32status = RPC_NT_GROUP_MEMBER_NOT_FOUND; break;
|
|
|
|
case RPC_X_NO_MORE_ENTRIES: expected_win32status = RPC_NT_NO_MORE_ENTRIES; break;
|
|
|
|
case RPC_X_SS_CHAR_TRANS_OPEN_FAIL: expected_win32status = RPC_NT_SS_CHAR_TRANS_OPEN_FAIL; break;
|
|
|
|
case RPC_X_SS_CHAR_TRANS_SHORT_FILE: expected_win32status = RPC_NT_SS_CHAR_TRANS_SHORT_FILE; break;
|
|
|
|
case RPC_X_SS_IN_NULL_CONTEXT: expected_win32status = RPC_NT_SS_IN_NULL_CONTEXT; break;
|
|
|
|
case RPC_X_SS_CONTEXT_DAMAGED: expected_win32status = RPC_NT_SS_CONTEXT_DAMAGED; break;
|
|
|
|
case RPC_X_SS_HANDLES_MISMATCH: expected_win32status = RPC_NT_SS_HANDLES_MISMATCH; break;
|
|
|
|
case RPC_X_SS_CANNOT_GET_CALL_HANDLE: expected_win32status = RPC_NT_SS_CANNOT_GET_CALL_HANDLE; break;
|
|
|
|
case RPC_X_NULL_REF_POINTER: expected_win32status = RPC_NT_NULL_REF_POINTER; break;
|
|
|
|
case RPC_X_ENUM_VALUE_OUT_OF_RANGE: expected_win32status = RPC_NT_ENUM_VALUE_OUT_OF_RANGE; break;
|
|
|
|
case RPC_X_BYTE_COUNT_TOO_SMALL: expected_win32status = RPC_NT_BYTE_COUNT_TOO_SMALL; break;
|
|
|
|
case RPC_X_BAD_STUB_DATA: expected_win32status = RPC_NT_BAD_STUB_DATA; break;
|
2008-06-12 10:52:45 +02:00
|
|
|
case RPC_X_PIPE_CLOSED: expected_win32status = RPC_NT_PIPE_CLOSED; missing = TRUE; break;
|
|
|
|
case RPC_X_PIPE_DISCIPLINE_ERROR: expected_win32status = RPC_NT_PIPE_DISCIPLINE_ERROR; missing = TRUE; break;
|
|
|
|
case RPC_X_PIPE_EMPTY: expected_win32status = RPC_NT_PIPE_EMPTY; missing = TRUE; break;
|
|
|
|
case ERROR_PASSWORD_MUST_CHANGE: expected_win32status = STATUS_PASSWORD_MUST_CHANGE; missing = TRUE; break;
|
|
|
|
case ERROR_ACCOUNT_LOCKED_OUT: expected_win32status = STATUS_ACCOUNT_LOCKED_OUT; missing = TRUE; break;
|
2008-02-08 10:32:18 +01:00
|
|
|
default:
|
2008-02-11 11:51:26 +01:00
|
|
|
if (w2k3_up)
|
2008-02-08 10:32:18 +01:00
|
|
|
expected_win32status = STATUS_UNSUCCESSFUL;
|
|
|
|
else
|
|
|
|
expected_win32status = rpc_status;
|
2008-01-07 11:18:34 +01:00
|
|
|
}
|
2008-06-12 10:52:45 +02:00
|
|
|
|
|
|
|
ok(win32status == expected_win32status ||
|
|
|
|
broken(missing && win32status == rpc_status),
|
2009-01-04 01:49:14 +01:00
|
|
|
"I_RpcMapWin32Status(%d) should have returned 0x%x instead of 0x%x%s\n",
|
2008-06-12 10:52:45 +02:00
|
|
|
rpc_status, expected_win32status, win32status,
|
|
|
|
broken(missing) ? " (or have returned with the given status)" : "");
|
2008-01-07 11:18:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-27 20:03:04 +01:00
|
|
|
static void test_RpcStringBindingParseA(void)
|
|
|
|
{
|
|
|
|
static unsigned char valid_binding[] = "00000000-0000-0000-c000-000000000046@ncacn_np:.[endpoint=\\pipe\\test]";
|
|
|
|
static unsigned char valid_binding2[] = "00000000-0000-0000-c000-000000000046@ncacn_np:.[\\pipe\\test]";
|
|
|
|
static unsigned char invalid_uuid_binding[] = "{00000000-0000-0000-c000-000000000046}@ncacn_np:.[endpoint=\\pipe\\test]";
|
|
|
|
static unsigned char invalid_ep_binding[] = "00000000-0000-0000-c000-000000000046@ncacn_np:.[endpoint=test]";
|
|
|
|
static unsigned char invalid_binding[] = "00000000-0000-0000-c000-000000000046@ncacn_np";
|
|
|
|
RPC_STATUS status;
|
|
|
|
unsigned char *uuid;
|
|
|
|
unsigned char *protseq;
|
|
|
|
unsigned char *network_addr;
|
|
|
|
unsigned char *endpoint;
|
|
|
|
unsigned char *options;
|
|
|
|
|
|
|
|
/* test all parameters */
|
|
|
|
status = RpcStringBindingParseA(valid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
|
|
|
|
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
|
|
|
|
ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
|
|
|
|
ok(!strcmp((char *)endpoint, "pipetest"), "endpoint should have been pipetest instead of %s\n", endpoint);
|
2011-08-29 21:10:12 +02:00
|
|
|
if (options)
|
|
|
|
ok(!strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options);
|
|
|
|
else
|
|
|
|
todo_wine ok(FALSE, "options is NULL\n");
|
2008-02-27 20:03:04 +01:00
|
|
|
RpcStringFreeA(&uuid);
|
|
|
|
RpcStringFreeA(&protseq);
|
|
|
|
RpcStringFreeA(&network_addr);
|
|
|
|
RpcStringFreeA(&endpoint);
|
|
|
|
RpcStringFreeA(&options);
|
|
|
|
|
|
|
|
/* test all parameters with different type of string binding */
|
|
|
|
status = RpcStringBindingParseA(valid_binding2, &uuid, &protseq, &network_addr, &endpoint, &options);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
|
|
|
|
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
|
|
|
|
ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
|
|
|
|
ok(!strcmp((char *)endpoint, "pipetest"), "endpoint should have been pipetest instead of %s\n", endpoint);
|
2011-08-29 21:10:12 +02:00
|
|
|
if (options)
|
|
|
|
ok(!strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options);
|
|
|
|
else
|
|
|
|
todo_wine ok(FALSE, "options is NULL\n");
|
2008-02-27 20:03:04 +01:00
|
|
|
RpcStringFreeA(&uuid);
|
|
|
|
RpcStringFreeA(&protseq);
|
|
|
|
RpcStringFreeA(&network_addr);
|
|
|
|
RpcStringFreeA(&endpoint);
|
|
|
|
RpcStringFreeA(&options);
|
|
|
|
|
|
|
|
/* test with as many parameters NULL as possible */
|
|
|
|
status = RpcStringBindingParseA(valid_binding, NULL, &protseq, NULL, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
|
|
|
|
RpcStringFreeA(&protseq);
|
|
|
|
|
|
|
|
/* test with invalid uuid */
|
|
|
|
status = RpcStringBindingParseA(invalid_uuid_binding, NULL, &protseq, NULL, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_INVALID_STRING_UUID, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_UUID instead of %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
|
|
|
|
|
|
|
|
/* test with invalid endpoint */
|
|
|
|
status = RpcStringBindingParseA(invalid_ep_binding, NULL, &protseq, NULL, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
RpcStringFreeA(&protseq);
|
|
|
|
|
|
|
|
/* test with invalid binding */
|
|
|
|
status = RpcStringBindingParseA(invalid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
|
|
|
|
todo_wine
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_BINDING instead of %d\n", status);
|
2008-02-27 20:03:04 +01:00
|
|
|
todo_wine
|
|
|
|
ok(uuid == NULL, "uuid was %p instead of NULL\n", uuid);
|
2010-01-22 11:22:37 +01:00
|
|
|
if (uuid)
|
|
|
|
RpcStringFreeA(&uuid);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
|
|
|
|
todo_wine
|
|
|
|
ok(network_addr == NULL, "network_addr was %p instead of NULL\n", network_addr);
|
2010-01-22 11:22:37 +01:00
|
|
|
if (network_addr)
|
|
|
|
RpcStringFreeA(&network_addr);
|
2008-02-27 20:03:04 +01:00
|
|
|
ok(endpoint == NULL, "endpoint was %p instead of NULL\n", endpoint);
|
|
|
|
ok(options == NULL, "options was %p instead of NULL\n", options);
|
|
|
|
}
|
|
|
|
|
2008-04-15 22:50:14 +02:00
|
|
|
static void test_I_RpcExceptionFilter(void)
|
|
|
|
{
|
|
|
|
ULONG exception;
|
|
|
|
int retval;
|
2013-11-08 11:50:20 +01:00
|
|
|
int (WINAPI *pI_RpcExceptionFilter)(ULONG) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "I_RpcExceptionFilter");
|
2008-04-15 22:50:14 +02:00
|
|
|
|
|
|
|
if (!pI_RpcExceptionFilter)
|
|
|
|
{
|
2015-03-25 20:06:20 +01:00
|
|
|
win_skip("I_RpcExceptionFilter not exported\n");
|
2008-04-15 22:50:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (exception = 0; exception < STATUS_REG_NAT_CONSUMPTION; exception++)
|
|
|
|
{
|
|
|
|
/* skip over uninteresting bits of the number space */
|
|
|
|
if (exception == 2000) exception = 0x40000000;
|
|
|
|
if (exception == 0x40000005) exception = 0x80000000;
|
|
|
|
if (exception == 0x80000005) exception = 0xc0000000;
|
|
|
|
|
|
|
|
retval = pI_RpcExceptionFilter(exception);
|
|
|
|
switch (exception)
|
|
|
|
{
|
|
|
|
case STATUS_DATATYPE_MISALIGNMENT:
|
|
|
|
case STATUS_BREAKPOINT:
|
|
|
|
case STATUS_ACCESS_VIOLATION:
|
|
|
|
case STATUS_ILLEGAL_INSTRUCTION:
|
|
|
|
case STATUS_PRIVILEGED_INSTRUCTION:
|
2015-03-25 20:06:20 +01:00
|
|
|
case STATUS_INSTRUCTION_MISALIGNMENT:
|
2008-04-15 22:50:14 +02:00
|
|
|
case STATUS_STACK_OVERFLOW:
|
2015-03-25 20:06:20 +01:00
|
|
|
case STATUS_POSSIBLE_DEADLOCK:
|
2008-04-15 22:50:14 +02:00
|
|
|
ok(retval == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
|
|
|
|
exception, EXCEPTION_CONTINUE_SEARCH, retval);
|
|
|
|
break;
|
2008-09-11 14:32:30 +02:00
|
|
|
case STATUS_GUARD_PAGE_VIOLATION:
|
2008-05-26 07:21:16 +02:00
|
|
|
case STATUS_IN_PAGE_ERROR:
|
|
|
|
case STATUS_HANDLE_NOT_CLOSABLE:
|
|
|
|
trace("I_RpcExceptionFilter(0x%x) returned %d\n", exception, retval);
|
|
|
|
break;
|
2008-04-15 22:50:14 +02:00
|
|
|
default:
|
|
|
|
ok(retval == EXCEPTION_EXECUTE_HANDLER, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
|
|
|
|
exception, EXCEPTION_EXECUTE_HANDLER, retval);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:14:52 +02:00
|
|
|
static void test_RpcStringBindingFromBinding(void)
|
|
|
|
{
|
|
|
|
static unsigned char ncacn_np[] = "ncacn_np";
|
|
|
|
static unsigned char address[] = ".";
|
|
|
|
static unsigned char endpoint[] = "\\pipe\\wine_rpc_test";
|
|
|
|
RPC_STATUS status;
|
|
|
|
handle_t handle;
|
|
|
|
RPC_CSTR binding;
|
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcStringBindingComposeA(NULL, ncacn_np, address,
|
2008-08-14 10:14:52 +02:00
|
|
|
endpoint, NULL, &binding);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
|
2008-08-14 10:14:52 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingFromStringBindingA(binding, &handle);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n", status);
|
2013-11-08 11:50:20 +01:00
|
|
|
RpcStringFreeA(&binding);
|
2008-08-14 10:14:52 +02:00
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
status = RpcBindingToStringBindingA(handle, &binding);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %u\n", status);
|
2008-08-14 10:14:52 +02:00
|
|
|
|
|
|
|
ok(!strcmp((const char *)binding, "ncacn_np:.[\\\\pipe\\\\wine_rpc_test]"),
|
|
|
|
"binding string didn't match what was expected: \"%s\"\n", binding);
|
2013-11-08 11:50:20 +01:00
|
|
|
RpcStringFreeA(&binding);
|
2008-08-14 10:14:52 +02:00
|
|
|
|
|
|
|
status = RpcBindingFree(&handle);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcBindingFree failed with error %u\n", status);
|
2008-08-14 10:14:52 +02:00
|
|
|
}
|
|
|
|
|
2008-10-13 22:06:12 +02:00
|
|
|
static void test_UuidCreate(void)
|
|
|
|
{
|
|
|
|
UUID guid;
|
|
|
|
BYTE version;
|
|
|
|
|
|
|
|
UuidCreate(&guid);
|
|
|
|
version = (guid.Data3 & 0xf000) >> 12;
|
|
|
|
ok(version == 4 || broken(version == 1), "unexpected version %d\n",
|
|
|
|
version);
|
|
|
|
if (version == 4)
|
|
|
|
{
|
|
|
|
static UUID v4and = { 0, 0, 0x4000, { 0x80,0,0,0,0,0,0,0 } };
|
|
|
|
static UUID v4or = { 0xffffffff, 0xffff, 0x4fff,
|
|
|
|
{ 0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff } };
|
|
|
|
UUID and, or;
|
|
|
|
RPC_STATUS rslt;
|
|
|
|
int i;
|
|
|
|
|
2009-01-25 18:07:20 +01:00
|
|
|
and = guid;
|
|
|
|
or = guid;
|
2008-10-13 22:06:12 +02:00
|
|
|
/* Generate a bunch of UUIDs and mask them. By the end, we expect
|
|
|
|
* every randomly generated bit to have been zero at least once,
|
|
|
|
* resulting in no bits set in the and mask except those which are not
|
|
|
|
* randomly generated: the version number and the topmost bits of the
|
|
|
|
* Data4 field (treated as big-endian.) Similarly, we expect only
|
|
|
|
* the bits which are not randomly set to be cleared in the or mask.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < 1000; i++)
|
|
|
|
{
|
|
|
|
LPBYTE src, dst;
|
|
|
|
|
|
|
|
UuidCreate(&guid);
|
|
|
|
for (src = (LPBYTE)&guid, dst = (LPBYTE)∧
|
|
|
|
src - (LPBYTE)&guid < sizeof(guid); src++, dst++)
|
|
|
|
*dst &= *src;
|
|
|
|
for (src = (LPBYTE)&guid, dst = (LPBYTE)∨
|
|
|
|
src - (LPBYTE)&guid < sizeof(guid); src++, dst++)
|
|
|
|
*dst |= *src;
|
|
|
|
}
|
|
|
|
ok(UuidEqual(&and, &v4and, &rslt),
|
2014-01-25 15:24:44 +01:00
|
|
|
"unexpected bits set in V4 UUID: %s\n", wine_dbgstr_guid(&and));
|
2008-10-13 22:06:12 +02:00
|
|
|
ok(UuidEqual(&or, &v4or, &rslt),
|
2014-01-25 15:24:44 +01:00
|
|
|
"unexpected bits set in V4 UUID: %s\n", wine_dbgstr_guid(&or));
|
2008-10-13 22:06:12 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Older versions of Windows generate V1 UUIDs. For these, there are
|
|
|
|
* many stable bits, including at least the MAC address if one is
|
|
|
|
* present. Just check that Data4[0]'s most significant bits are
|
|
|
|
* set as expected.
|
|
|
|
*/
|
|
|
|
ok((guid.Data4[0] & 0xc0) == 0x80,
|
|
|
|
"unexpected value in Data4[0]: %02x\n", guid.Data4[0] & 0xc0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-03 23:36:32 +01:00
|
|
|
static void test_UuidCreateSequential(void)
|
|
|
|
{
|
|
|
|
UUID guid1;
|
|
|
|
BYTE version;
|
2013-11-08 11:50:20 +01:00
|
|
|
RPC_STATUS (WINAPI *pUuidCreateSequential)(UUID *) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "UuidCreateSequential");
|
2015-03-08 23:20:48 +01:00
|
|
|
RPC_STATUS (WINAPI *pI_UuidCreate)(UUID *) = (void*)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "I_UuidCreate");
|
2010-03-03 23:36:32 +01:00
|
|
|
RPC_STATUS ret;
|
|
|
|
|
|
|
|
if (!pUuidCreateSequential)
|
|
|
|
{
|
2015-03-08 23:20:48 +01:00
|
|
|
win_skip("UuidCreateSequential not exported\n");
|
2010-03-03 23:36:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-08 23:20:48 +01:00
|
|
|
|
|
|
|
ok(pI_UuidCreate != pUuidCreateSequential, "got %p, %p\n", pI_UuidCreate, pUuidCreateSequential);
|
|
|
|
|
2010-03-03 23:36:32 +01:00
|
|
|
ret = pUuidCreateSequential(&guid1);
|
|
|
|
ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
|
|
|
|
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
|
|
|
|
version = (guid1.Data3 & 0xf000) >> 12;
|
|
|
|
ok(version == 1, "unexpected version %d\n", version);
|
|
|
|
if (version == 1)
|
|
|
|
{
|
|
|
|
UUID guid2;
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
/* If the call succeeded, there's a valid (non-multicast) MAC
|
|
|
|
* address in the uuid:
|
|
|
|
*/
|
2016-09-01 18:08:00 +02:00
|
|
|
ok(!(guid1.Data4[2] & 0x01) || broken(guid1.Data4[2] & 0x01), /* Win 8.1 */
|
2013-02-11 15:36:36 +01:00
|
|
|
"GUID does not appear to contain a MAC address: %s\n",
|
2014-01-25 15:24:44 +01:00
|
|
|
wine_dbgstr_guid(&guid1));
|
2010-03-03 23:36:32 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise, there's a randomly generated multicast MAC address
|
|
|
|
* address in the uuid:
|
|
|
|
*/
|
|
|
|
ok((guid1.Data4[2] & 0x01),
|
2013-02-11 15:36:36 +01:00
|
|
|
"GUID does not appear to contain a multicast MAC address: %s\n",
|
2014-01-25 15:24:44 +01:00
|
|
|
wine_dbgstr_guid(&guid1));
|
2010-03-03 23:36:32 +01:00
|
|
|
}
|
|
|
|
/* Generate another GUID, and make sure its MAC address matches the
|
|
|
|
* first.
|
|
|
|
*/
|
|
|
|
ret = pUuidCreateSequential(&guid2);
|
|
|
|
ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
|
|
|
|
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
|
|
|
|
version = (guid2.Data3 & 0xf000) >> 12;
|
|
|
|
ok(version == 1, "unexpected version %d\n", version);
|
2015-03-08 23:20:48 +01:00
|
|
|
ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
|
|
|
|
"unexpected value in MAC address: %s\n",
|
|
|
|
wine_dbgstr_guid(&guid2));
|
|
|
|
|
|
|
|
/* I_UuidCreate does exactly the same */
|
|
|
|
pI_UuidCreate(&guid2);
|
|
|
|
version = (guid2.Data3 & 0xf000) >> 12;
|
|
|
|
ok(version == 1, "unexpected version %d\n", version);
|
2010-03-03 23:36:32 +01:00
|
|
|
ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
|
2013-02-11 15:36:36 +01:00
|
|
|
"unexpected value in MAC address: %s\n",
|
2014-01-25 15:24:44 +01:00
|
|
|
wine_dbgstr_guid(&guid2));
|
2010-03-03 23:36:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-16 15:40:26 +01:00
|
|
|
static void test_RpcBindingFree(void)
|
|
|
|
{
|
|
|
|
RPC_BINDING_HANDLE binding = NULL;
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
|
|
|
status = RpcBindingFree(&binding);
|
|
|
|
ok(status == RPC_S_INVALID_BINDING,
|
2011-08-03 23:50:18 +02:00
|
|
|
"RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %d\n",
|
2009-11-16 15:40:26 +01:00
|
|
|
status);
|
|
|
|
}
|
|
|
|
|
2012-05-09 12:06:29 +02:00
|
|
|
static void test_RpcServerInqDefaultPrincName(void)
|
|
|
|
{
|
|
|
|
RPC_STATUS ret;
|
|
|
|
RPC_CSTR principal, saved_principal;
|
|
|
|
char *username;
|
|
|
|
ULONG len = 0;
|
|
|
|
|
2016-08-29 17:30:10 +02:00
|
|
|
GetUserNameExA( NameSamCompatible, NULL, &len );
|
2012-05-09 12:06:29 +02:00
|
|
|
username = HeapAlloc( GetProcessHeap(), 0, len );
|
2016-08-29 17:30:10 +02:00
|
|
|
GetUserNameExA( NameSamCompatible, username, &len );
|
2012-05-09 12:06:29 +02:00
|
|
|
|
|
|
|
ret = RpcServerInqDefaultPrincNameA( 0, NULL );
|
|
|
|
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, NULL );
|
|
|
|
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
|
|
|
|
|
|
|
|
principal = (RPC_CSTR)0xdeadbeef;
|
|
|
|
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, &principal );
|
|
|
|
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
|
|
|
|
ok( principal == (RPC_CSTR)0xdeadbeef, "got unexpected principal\n" );
|
|
|
|
|
|
|
|
saved_principal = (RPC_CSTR)0xdeadbeef;
|
|
|
|
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &saved_principal );
|
|
|
|
ok( ret == RPC_S_OK, "got %u\n", ret );
|
|
|
|
ok( saved_principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
|
|
|
|
ok( !strcmp( (const char *)saved_principal, username ), "got \'%s\'\n", saved_principal );
|
|
|
|
trace("%s\n", saved_principal);
|
|
|
|
|
|
|
|
ret = RpcServerRegisterAuthInfoA( (RPC_CSTR)"wine\\test", RPC_C_AUTHN_WINNT, NULL, NULL );
|
|
|
|
ok( ret == RPC_S_OK, "got %u\n", ret );
|
|
|
|
|
|
|
|
principal = (RPC_CSTR)0xdeadbeef;
|
|
|
|
ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &principal );
|
|
|
|
ok( ret == RPC_S_OK, "got %u\n", ret );
|
|
|
|
ok( principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
|
|
|
|
ok( !strcmp( (const char *)principal, username ), "got \'%s\'\n", principal );
|
2013-11-08 11:50:20 +01:00
|
|
|
RpcStringFreeA( &principal );
|
2012-05-09 12:06:29 +02:00
|
|
|
|
|
|
|
ret = RpcServerRegisterAuthInfoA( saved_principal, RPC_C_AUTHN_WINNT, NULL, NULL );
|
|
|
|
ok( ret == RPC_S_OK, "got %u\n", ret );
|
|
|
|
|
2013-11-08 11:50:20 +01:00
|
|
|
RpcStringFreeA( &saved_principal );
|
2012-05-09 12:06:29 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, username );
|
|
|
|
}
|
|
|
|
|
2016-06-27 17:08:46 +02:00
|
|
|
static void test_RpcServerRegisterAuthInfo(void)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
|
|
|
|
status = RpcServerRegisterAuthInfoW(NULL, 600, NULL, NULL);
|
|
|
|
ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %x\n", status);
|
|
|
|
}
|
|
|
|
|
2016-12-08 13:24:46 +01:00
|
|
|
static void test_RpcServerUseProtseq(void)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
RPC_BINDING_VECTOR *bindings;
|
|
|
|
ULONG i;
|
|
|
|
ULONG binding_count_before;
|
|
|
|
ULONG binding_count_after1;
|
|
|
|
ULONG binding_count_after2;
|
|
|
|
ULONG endpoints_registered = 0;
|
|
|
|
static unsigned char iptcp[] = "ncacn_ip_tcp";
|
|
|
|
static unsigned char np[] = "ncacn_np";
|
|
|
|
static unsigned char ncalrpc[] = "ncalrpc";
|
|
|
|
BOOL iptcp_registered = FALSE, np_registered = FALSE, ncalrpc_registered = FALSE;
|
|
|
|
|
|
|
|
status = RpcServerInqBindings(&bindings);
|
|
|
|
if (status == RPC_S_NO_BINDINGS)
|
|
|
|
binding_count_before = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
binding_count_before = bindings->Count;
|
|
|
|
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
|
|
|
|
for (i = 0; i < bindings->Count; i++)
|
|
|
|
{
|
|
|
|
RPC_CSTR str_bind;
|
|
|
|
status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
|
|
|
|
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
|
|
|
|
if (lstrlenA((const char *)str_bind) > 12 && !memcmp(str_bind, "ncacn_ip_tcp", 12))
|
|
|
|
iptcp_registered = TRUE;
|
|
|
|
if (lstrlenA((const char *)str_bind) > 8 && !memcmp(str_bind, "ncacn_np", 8))
|
|
|
|
np_registered = TRUE;
|
|
|
|
if (lstrlenA((const char *)str_bind) > 7 && !memcmp(str_bind, "ncalrpc", 7))
|
|
|
|
ncalrpc_registered = TRUE;
|
|
|
|
RpcStringFreeA(&str_bind);
|
|
|
|
}
|
|
|
|
RpcBindingVectorFree(&bindings);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* show that RpcServerUseProtseqEp(..., NULL, ...) is the same as
|
|
|
|
* RpcServerUseProtseq(...) */
|
|
|
|
status = RpcServerUseProtseqEpA(ncalrpc, 0, NULL, NULL);
|
|
|
|
ok(status == RPC_S_OK || broken(status == RPC_S_INVALID_ENDPOINT_FORMAT),
|
|
|
|
"RpcServerUseProtseqEp with NULL endpoint failed with status %d\n",
|
|
|
|
status);
|
|
|
|
|
|
|
|
/* register protocol sequences without explicit endpoints */
|
|
|
|
status = RpcServerUseProtseqA(np, 0, NULL);
|
|
|
|
if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
|
|
|
|
win_skip("ncacn_np not supported\n");
|
|
|
|
else
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
|
|
|
|
if (status == RPC_S_OK && !np_registered) endpoints_registered++;
|
|
|
|
|
|
|
|
status = RpcServerUseProtseqA(iptcp, 0, NULL);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
|
|
|
|
if (status == RPC_S_OK && !iptcp_registered) endpoints_registered++;
|
|
|
|
|
|
|
|
status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
|
|
|
|
if (status == RPC_S_OK && !ncalrpc_registered) endpoints_registered++;
|
|
|
|
|
|
|
|
status = RpcServerInqBindings(&bindings);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
|
|
|
|
binding_count_after1 = bindings->Count;
|
|
|
|
ok(binding_count_after1 == binding_count_before + endpoints_registered,
|
|
|
|
"wrong binding count - before: %u, after %u, endpoints registered %u\n",
|
|
|
|
binding_count_before, binding_count_after1, endpoints_registered);
|
|
|
|
for (i = 0; i < bindings->Count; i++)
|
|
|
|
{
|
|
|
|
RPC_CSTR str_bind;
|
|
|
|
status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
|
|
|
|
ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
|
|
|
|
trace("string binding: %s\n", str_bind);
|
|
|
|
RpcStringFreeA(&str_bind);
|
|
|
|
}
|
|
|
|
RpcBindingVectorFree(&bindings);
|
|
|
|
|
|
|
|
/* re-register - endpoints should be reused */
|
|
|
|
status = RpcServerUseProtseqA(np, 0, NULL);
|
|
|
|
if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
|
|
|
|
win_skip("ncacn_np not supported\n");
|
|
|
|
else
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
|
|
|
|
|
|
|
|
status = RpcServerUseProtseqA(iptcp, 0, NULL);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
|
|
|
|
|
|
|
|
status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
|
|
|
|
|
|
|
|
status = RpcServerInqBindings(&bindings);
|
|
|
|
ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
|
|
|
|
binding_count_after2 = bindings->Count;
|
|
|
|
ok(binding_count_after2 == binding_count_after1,
|
|
|
|
"bindings should have been re-used - after1: %u after2: %u\n",
|
|
|
|
binding_count_after1, binding_count_after2);
|
|
|
|
RpcBindingVectorFree(&bindings);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_endpoint_mapper(RPC_CSTR protseq, RPC_CSTR address)
|
|
|
|
{
|
|
|
|
static unsigned char annotation[] = "Test annotation string.";
|
|
|
|
RPC_STATUS status;
|
|
|
|
RPC_BINDING_VECTOR *binding_vector;
|
|
|
|
handle_t handle;
|
|
|
|
unsigned char *binding;
|
|
|
|
|
|
|
|
status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcServerRegisterIf failed (%u)\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcServerInqBindings(&binding_vector);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcServerInqBindings failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
/* register endpoints created in test_RpcServerUseProtseq */
|
|
|
|
status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, annotation);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
|
|
|
|
/* reregister the same endpoint with no annotation */
|
|
|
|
status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, NULL);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcStringBindingComposeA(NULL, protseq, address,
|
|
|
|
NULL, NULL, &binding);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcStringBindingCompose failed (%u)\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcBindingFromStringBindingA(binding, &handle);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcBindingFromStringBinding failed (%u)\n", protseq, status);
|
|
|
|
|
|
|
|
RpcStringFreeA(&binding);
|
|
|
|
|
|
|
|
status = RpcBindingReset(handle);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcEpResolveBinding(handle, IFoo_v0_0_s_ifspec);
|
|
|
|
ok(status == RPC_S_OK || broken(status == RPC_S_SERVER_UNAVAILABLE), /* win9x */
|
|
|
|
"%s: RpcEpResolveBinding failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcBindingReset(handle);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcBindingFree(&handle);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcBindingFree failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcServerUnregisterIf(NULL, NULL, FALSE);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcServerUnregisterIf failed (%u)\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcEpUnregister(IFoo_v0_0_s_ifspec, binding_vector, NULL);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcEpUnregisterA failed with error %u\n", protseq, status);
|
|
|
|
|
|
|
|
status = RpcBindingVectorFree(&binding_vector);
|
|
|
|
ok(status == RPC_S_OK, "%s: RpcBindingVectorFree failed with error %u\n", protseq, status);
|
|
|
|
}
|
|
|
|
|
2016-12-08 13:24:47 +01:00
|
|
|
static BOOL is_process_elevated(void)
|
|
|
|
{
|
|
|
|
HANDLE token;
|
|
|
|
if (OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token ))
|
|
|
|
{
|
|
|
|
TOKEN_ELEVATION_TYPE type;
|
|
|
|
DWORD size;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
ret = GetTokenInformation( token, TokenElevationType, &type, sizeof(type), &size );
|
|
|
|
CloseHandle( token );
|
|
|
|
return (ret && type == TokenElevationTypeFull);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL is_firewall_enabled(void)
|
|
|
|
{
|
|
|
|
HRESULT hr, init;
|
|
|
|
INetFwMgr *mgr = NULL;
|
|
|
|
INetFwPolicy *policy = NULL;
|
|
|
|
INetFwProfile *profile = NULL;
|
|
|
|
VARIANT_BOOL enabled = VARIANT_FALSE;
|
|
|
|
|
|
|
|
init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
|
|
|
|
(void **)&mgr );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (policy) INetFwPolicy_Release( policy );
|
|
|
|
if (profile) INetFwProfile_Release( profile );
|
|
|
|
if (mgr) INetFwMgr_Release( mgr );
|
|
|
|
if (SUCCEEDED( init )) CoUninitialize();
|
|
|
|
return (enabled == VARIANT_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
enum firewall_op
|
|
|
|
{
|
|
|
|
APP_ADD,
|
|
|
|
APP_REMOVE
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT set_firewall( enum firewall_op op )
|
|
|
|
{
|
|
|
|
static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
|
|
|
|
HRESULT hr, init;
|
|
|
|
INetFwMgr *mgr = NULL;
|
|
|
|
INetFwPolicy *policy = NULL;
|
|
|
|
INetFwProfile *profile = NULL;
|
|
|
|
INetFwAuthorizedApplication *app = NULL;
|
|
|
|
INetFwAuthorizedApplications *apps = NULL;
|
|
|
|
BSTR name, image = SysAllocStringLen( NULL, MAX_PATH );
|
|
|
|
|
|
|
|
if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
|
|
|
|
{
|
|
|
|
SysFreeString( image );
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
|
|
|
|
(void **)&mgr );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
2017-05-14 22:32:17 +02:00
|
|
|
hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
|
2016-12-08 13:24:47 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_INetFwAuthorizedApplication, (void **)&app );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
name = SysAllocString( testW );
|
|
|
|
hr = INetFwAuthorizedApplication_put_Name( app, name );
|
|
|
|
SysFreeString( name );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
if (hr != S_OK) goto done;
|
|
|
|
|
|
|
|
if (op == APP_ADD)
|
|
|
|
hr = INetFwAuthorizedApplications_Add( apps, app );
|
|
|
|
else if (op == APP_REMOVE)
|
|
|
|
hr = INetFwAuthorizedApplications_Remove( apps, image );
|
|
|
|
else
|
|
|
|
hr = E_INVALIDARG;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (app) INetFwAuthorizedApplication_Release( app );
|
|
|
|
if (apps) INetFwAuthorizedApplications_Release( apps );
|
|
|
|
if (policy) INetFwPolicy_Release( policy );
|
|
|
|
if (profile) INetFwProfile_Release( profile );
|
|
|
|
if (mgr) INetFwMgr_Release( mgr );
|
|
|
|
if (SUCCEEDED( init )) CoUninitialize();
|
|
|
|
SysFreeString( image );
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2002-10-07 23:54:07 +02:00
|
|
|
START_TEST( rpc )
|
|
|
|
{
|
2016-12-08 13:24:46 +01:00
|
|
|
static unsigned char ncacn_np[] = "ncacn_np";
|
|
|
|
static unsigned char ncalrpc[] = "ncalrpc";
|
|
|
|
static unsigned char np_address[] = ".";
|
2016-12-08 13:24:47 +01:00
|
|
|
BOOL firewall_enabled = is_firewall_enabled();
|
|
|
|
|
|
|
|
if (firewall_enabled && !is_process_elevated())
|
|
|
|
{
|
|
|
|
skip("no privileges, skipping tests to avoid firewall dialog\n");
|
|
|
|
return;
|
|
|
|
}
|
2016-12-08 13:24:46 +01:00
|
|
|
|
2002-10-07 23:54:07 +02:00
|
|
|
UuidConversionAndComparison();
|
2004-12-23 12:29:54 +01:00
|
|
|
TestDceErrorInqText();
|
2006-06-01 21:25:15 +02:00
|
|
|
test_towers();
|
2008-01-07 11:18:34 +01:00
|
|
|
test_I_RpcMapWin32Status();
|
2008-02-27 20:03:04 +01:00
|
|
|
test_RpcStringBindingParseA();
|
2008-04-15 22:50:14 +02:00
|
|
|
test_I_RpcExceptionFilter();
|
2008-08-14 10:14:52 +02:00
|
|
|
test_RpcStringBindingFromBinding();
|
2008-10-13 22:06:12 +02:00
|
|
|
test_UuidCreate();
|
2010-03-03 23:36:32 +01:00
|
|
|
test_UuidCreateSequential();
|
2009-11-16 15:40:26 +01:00
|
|
|
test_RpcBindingFree();
|
2012-05-09 12:06:29 +02:00
|
|
|
test_RpcServerInqDefaultPrincName();
|
2016-06-27 17:08:46 +02:00
|
|
|
test_RpcServerRegisterAuthInfo();
|
2016-12-08 13:24:47 +01:00
|
|
|
|
|
|
|
if (firewall_enabled)
|
|
|
|
{
|
|
|
|
HRESULT hr = set_firewall(APP_ADD);
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
|
|
|
skip("can't authorize app in firewall %08x\n", hr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test_rpc_ncacn_ip_tcp();
|
2016-12-08 13:24:46 +01:00
|
|
|
test_RpcServerUseProtseq();
|
|
|
|
test_endpoint_mapper(ncacn_np, np_address);
|
|
|
|
test_endpoint_mapper(ncalrpc, NULL);
|
2016-12-08 13:24:47 +01:00
|
|
|
|
|
|
|
if (firewall_enabled) set_firewall(APP_REMOVE);
|
2002-10-07 23:54:07 +02:00
|
|
|
}
|