From: Louis Lenders xerox.xerox2000x@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58903 --- dlls/combase/combase.c | 16 ++++++++++++++++ dlls/combase/combase.spec | 2 +- dlls/ole32/ole32.spec | 1 + dlls/ole32/tests/compobj.c | 13 +++++++++++++ include/objbase.h | 9 +++++++++ 5 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 34a9a42dc2a..361167b3ae3 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -3367,6 +3367,22 @@ HRESULT WINAPI CoGetCallerTID(DWORD *tid) return E_NOTIMPL; }
+/*********************************************************************** + * CoGetSystemSecurityPermissions (combase.@) + */ +HRESULT WINAPI CoGetSystemSecurityPermissions(COMSD type, PSECURITY_DESCRIPTOR *sys_sd) +{ + SECURITY_DESCRIPTOR *sd; + + FIXME("(%d, %p): stub\n", type, sys_sd); + + if (!(sd = LocalAlloc(LMEM_FIXED, SECURITY_DESCRIPTOR_MIN_LENGTH))) return E_OUTOFMEMORY; + InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + *sys_sd = sd; + + return S_OK; +} + /*********************************************************************** * CoIsHandlerConnected (combase.@) */ diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 9018b013823..2ba230033d2 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -119,7 +119,7 @@ @ stub CoGetProcessIdentifier @ stdcall CoGetStandardMarshal(ptr ptr long ptr long ptr) @ stub CoGetStdMarshalEx -@ stub CoGetSystemSecurityPermissions +@ stdcall CoGetSystemSecurityPermissions(long ptr) @ stdcall CoGetTreatAsClass(ptr ptr) @ stdcall CoImpersonateClient() @ stdcall CoIncrementMTAUsage(ptr) diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index c600bc3d97d..ce156ce915e 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -46,6 +46,7 @@ @ stdcall CoGetPSClsid(ptr ptr) combase.CoGetPSClsid @ stdcall CoGetStandardMarshal(ptr ptr long ptr long ptr) combase.CoGetStandardMarshal @ stdcall CoGetState(ptr) +@ stdcall CoGetSystemSecurityPermissions(long ptr) combase.CoGetSystemSecurityPermissions @ stub CoGetTIDFromIPID @ stdcall CoGetTreatAsClass(ptr ptr) combase.CoGetTreatAsClass @ stdcall CoImpersonateClient() combase.CoImpersonateClient diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index 2c4cc566f3a..1e43c414fd1 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -75,6 +75,7 @@ static HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv); static HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject); static HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token); static HRESULT (WINAPI * pCoGetApartmentType)(APTTYPE *type, APTTYPEQUALIFIER *qualifier); +static HRESULT (WINAPI * pCoGetSystemSecurityPermissions)(COMSD type, PSECURITY_DESCRIPTOR *sd); static HRESULT (WINAPI * pCoIncrementMTAUsage)(CO_MTA_USAGE_COOKIE *cookie); static HRESULT (WINAPI * pCoDecrementMTAUsage)(CO_MTA_USAGE_COOKIE cookie); static LONG (WINAPI * pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -4071,6 +4072,7 @@ static void init_funcs(void) pCoIncrementMTAUsage = (void*)GetProcAddress(hOle32, "CoIncrementMTAUsage"); pCoDecrementMTAUsage = (void*)GetProcAddress(hOle32, "CoDecrementMTAUsage"); pCoCreateInstanceFromApp = (void*)GetProcAddress(hOle32, "CoCreateInstanceFromApp"); + pCoGetSystemSecurityPermissions = (void*)GetProcAddress(hOle32, "CoGetSystemSecurityPermissions"); pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA"); pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
@@ -4472,6 +4474,16 @@ static void test_oletlsdata(void) "Unexpected flags %#lx.\n", flags); }
+static void test_CoGetSystemSecurityPermissions(void) +{ + PSECURITY_DESCRIPTOR psd; + HRESULT hr; + + hr = pCoGetSystemSecurityPermissions(SD_LAUNCHPERMISSIONS, &psd); + ok(IsValidSecurityDescriptor(psd) && (hr == S_OK), "Unexpected hr %#lx.\n", hr); + LocalFree(psd); +} + START_TEST(compobj) { init_funcs(); @@ -4524,6 +4536,7 @@ START_TEST(compobj) test_mta_usage(); test_CoCreateInstanceFromApp(); test_call_cancellation(); + test_CoGetSystemSecurityPermissions();
DeleteFileA( testlib ); } diff --git a/include/objbase.h b/include/objbase.h index 7f7763e8d20..c522ee8a2cf 100644 --- a/include/objbase.h +++ b/include/objbase.h @@ -304,6 +304,14 @@ typedef enum tagCOINIT COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */ } COINIT;
+typedef enum tagCOMSD +{ + SD_LAUNCHPERMISSIONS = 0, + SD_ACCESSPERMISSIONS = 1, + SD_LAUNCHRESTRICTIONS = 2, + SD_ACCESSRESTRICTIONS = 3 +} COMSD; + DECLARE_HANDLE(CO_MTA_USAGE_COOKIE);
WINOLE32API HRESULT WINAPI CoInitialize(LPVOID lpReserved); @@ -336,6 +344,7 @@ WINOLE32API HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy); WINOLE32API HRESULT WINAPI CoRevokeMallocSpy(void);
WINOLE32API HRESULT WINAPI CoGetContextToken( ULONG_PTR *token ); +WINOLE32API HRESULT WINAPI CoGetSystemSecurityPermissions( COMSD type, PSECURITY_DESCRIPTOR *sd );
/* class registration flags; passed to CoRegisterClassObject */ typedef enum tagREGCLS
If this returns static descriptors, unaffected by current user or some policies, I think we should simply do the same.
Returning an empty descriptor like in the patch is enough to fix the bug of the appliction not starting, and allows basic usage of the program. For anyone who would like to make the options under the Security tab to work: there's a clear FIXME in the patch. So the patch does for now what the bugreport is about: allow the program to start.
Further note: MSDN says this function has been around since windows 2000. The fact that it (probably) never has been called by a program in wine, tells me that likely no other programs will suffer from the poor "implementation" like in this patch.