static GUID IID_if2 = {0x12345679, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
static GUID IID_if3 = {0x1234567a, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
static GUID IID_if4 = {0x1234567b, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
+static CLSID CLSID_psfact = {0x1234567c, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
static int my_alloc_called;
static int my_free_called;
IPSFactoryBuffer *ppsf = NULL;
const PCInterfaceProxyVtblList* proxy_vtbl;
const PCInterfaceStubVtblList* stub_vtbl;
- const CLSID PSDispatch = {0x20420, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76, 0x12, 0x34, 0x56}};
static const GUID * const interfaces[] = { &IID_if1, &IID_if2, &IID_if3, &IID_if4 };
UINT i;
void *CStd_DebugServerQueryInterface = GetProcAddress(hmod, "CStdStubBuffer_DebugServerQueryInterface");
void *CStd_DebugServerRelease = GetProcAddress(hmod, "CStdStubBuffer_DebugServerRelease");
- r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
- &CLSID_Unknown, &PSFactoryBuffer);
+ r = NdrDllGetClassObject(&CLSID_Unknown, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
+ &CLSID_psfact, &PSFactoryBuffer);
ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r);
ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on failure\n");
- r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
- &PSDispatch, &PSFactoryBuffer);
+ r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
+ &CLSID_psfact, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount);
IPSFactoryBuffer_Release(ppsf);
+ /* One can also search by IID */
+ r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
+ &CLSID_psfact, &PSFactoryBuffer);
+ ok(r == S_OK, "ret %08x\n", r);
+ ok(ppsf != NULL, "ppsf == NULL\n");
+ IPSFactoryBuffer_Release(ppsf);
+
r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
NULL, &PSFactoryBuffer);
ok(r == S_OK, "ret %08x\n", r);
ok(ppsf != NULL, "ppsf == NULL\n");
+ IPSFactoryBuffer_Release(ppsf);
+
+ /* but only if the PS factory implements it */
+ r = NdrDllGetClassObject(&IID_IDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
+ &CLSID_psfact, &PSFactoryBuffer);
+ ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08x\n", r);
+
+ /* Create it again to return */
+ r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
+ &CLSID_psfact, &PSFactoryBuffer);
+ ok(r == S_OK, "ret %08x\n", r);
+ ok(ppsf != NULL, "ppsf == NULL\n");
+
+ /* Because this PS factory is not loaded as a dll in the normal way, Windows 8 / 10
+ get confused and will crash when one of the proxies for the delegated ifaces is created.
+ Registering the ifaces fixes this (in fact calling CoRegisterPSClsid() with any IID / CLSID is enough). */
+
+ r = CoRegisterPSClsid(&IID_if1, &CLSID_psfact);
+ ok(r == S_OK, "ret %08x\n", r);
+ r = CoRegisterPSClsid(&IID_if2, &CLSID_psfact);
+ ok(r == S_OK, "ret %08x\n", r);
+ r = CoRegisterPSClsid(&IID_if3, &CLSID_psfact);
+ ok(r == S_OK, "ret %08x\n", r);
+ r = CoRegisterPSClsid(&IID_if4, &CLSID_psfact);
+ ok(r == S_OK, "ret %08x\n", r);
return ppsf;
}
RPC_STATUS rpc_status;
BOOL w2k3_up = FALSE;
- /* Windows 2003 and Vista return STATUS_UNSUCCESSFUL if given an unknown status */
+ /* Windows 2003 and above return STATUS_UNSUCCESSFUL if given an unknown status */
win32status = I_RpcMapWin32Status(9999);
if (win32status == STATUS_UNSUCCESSFUL)
- {
- trace("We are on Windows 2003 or Vista\n");
w2k3_up = TRUE;
- }
/* On Windows XP-SP1 and below some statuses are not mapped and return
* the given status
/* If the call succeeded, there's a valid (non-multicast) MAC
* address in the uuid:
*/
- ok(!(guid1.Data4[2] & 0x01),
+ ok(!(guid1.Data4[2] & 0x01) || broken(guid1.Data4[2] & 0x01), /* Win 8.1 */
"GUID does not appear to contain a MAC address: %s\n",
wine_dbgstr_guid(&guid1));
}
{
RPC_STATUS ret;
RPC_CSTR principal, saved_principal;
- BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT,LPSTR,PULONG);
char *username;
ULONG len = 0;
- pGetUserNameExA = (void *)GetProcAddress( LoadLibraryA("secur32.dll"), "GetUserNameExA" );
- if (!pGetUserNameExA)
- {
- win_skip( "GetUserNameExA not exported\n" );
- return;
- }
- pGetUserNameExA( NameSamCompatible, NULL, &len );
+ GetUserNameExA( NameSamCompatible, NULL, &len );
username = HeapAlloc( GetProcessHeap(), 0, len );
- pGetUserNameExA( NameSamCompatible, username, &len );
+ GetUserNameExA( NameSamCompatible, username, &len );
ret = RpcServerInqDefaultPrincNameA( 0, NULL );
ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG);
static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int,
unsigned int,RPC_IF_CALLBACK_FN*);
-static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
static RPC_STATUS (WINAPI *pRpcBindingSetAuthInfoExA)(RPC_BINDING_HANDLE, RPC_CSTR, ULONG, ULONG,
RPC_AUTH_IDENTITY_HANDLE, ULONG, RPC_SECURITY_QOS *);
static RPC_STATUS (WINAPI *pRpcServerRegisterAuthInfoA)(RPC_CSTR, ULONG, RPC_AUTH_KEY_RETRIEVAL_FN, LPVOID);
static void InitFunctionPointers(void)
{
HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
- HMODULE hsecur32 = LoadLibraryA("secur32.dll");
pNDRSContextMarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextMarshall2");
pNDRSContextUnmarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextUnmarshall2");
pRpcServerRegisterIfEx = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterIfEx");
pRpcBindingSetAuthInfoExA = (void *)GetProcAddress(hrpcrt4, "RpcBindingSetAuthInfoExA");
pRpcServerRegisterAuthInfoA = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterAuthInfoA");
- pGetUserNameExA = (void *)GetProcAddress(hsecur32, "GetUserNameExA");
if (!pNDRSContextMarshall2) old_windows_version = TRUE;
}
if (!old_windows_version)
{
+ re = 0xdeadbeef;
get_ranged_enum(&re);
- ok(re == RE3, "get_ranged_enum() returned %d instead of RE3\n", re);
+ ok(re == RE3 ||
+ broken(re == MAKELONG(re, 0xdead)), /* Win 8, Win 10 */
+ "get_ranged_enum() returned %x instead of RE3\n", re);
}
}
todo_wine
ok(principal != NULL, "NULL principal\n");
}
- if (protseq == RPC_PROTSEQ_LRPC && principal && pGetUserNameExA)
+ if (protseq == RPC_PROTSEQ_LRPC && principal)
{
int len;
char *spn;
RPC_STATUS status;
RPC_SECURITY_QOS qos;
- if (!pGetUserNameExA)
- return;
-
qos.Version = 1;
qos.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
qos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;
if (ncalrpc_status == RPC_S_OK)
{
run_client("ncalrpc_basic");
- if (pGetUserNameExA)
- {
- /* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
- run_client("ncalrpc_secure");
- }
+
+ /* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
+ run_client("ncalrpc_secure");
}
else
skip("lrpc tests skipped due to earlier failure\n");
START_TEST(server)
{
+ ULONG size = 0;
int argc;
char **argv;
InitFunctionPointers();
- if (pGetUserNameExA)
- {
- ULONG size = 0;
- ok(!pGetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
- domain_and_user = HeapAlloc(GetProcessHeap(), 0, size);
- ok(pGetUserNameExA(NameSamCompatible, domain_and_user, &size), "GetUserNameExA\n");
- }
- else
- win_skip("GetUserNameExA is needed for some authentication tests\n");
+ ok(!GetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
+ domain_and_user = HeapAlloc(GetProcessHeap(), 0, size);
+ ok(GetUserNameExA(NameSamCompatible, domain_and_user, &size), "GetUserNameExA\n");
argc = winetest_get_mainargs(&argv);
progname = argv[0];