[0.4.11][ADVAPI32][PSDK] Selected Backports 2023-07-22

0.4.15-dev-5927-g bfc6a119c5 [ADVAPI32] Do not fail on creating a registry key if the security attributes have an invalid length. (#5230) fixes regression CORE-15471
partially 0.4.15-dev-999-g 889b077b23 [REACTOS] *.spec: Fix some function/parameter types (only the [ADVAPI32] part)
0.4.14-dev-1245-g 8ae8083378 [ADVAPI32][PSDK] CryptReleaseContext(): dwFlags parameter is DWORD, only
0.4.13-dev-666-g f3a9b524f1 [ADVAPI32] Fix copying the TokenSource string
0.4.13-dev-363-g 46259092f9 [ADVAPI32:REG] Remove some useless casts (#1614)
0.4.12-dev-237-g 446e13745c [ADVAPI32] Stop pretending our advapi32 is NT6+, inconsistent TEB definitions CORE-15526

also fix a bit of whitespace, wrong format-strings and missing \n in debugprints

---------

advapi32.dll master GCC8.4.0dbg            671.232
advapi32.dll 0.4.14 GCC4.7.2dbg 602.624 -> 602.624
advapi32.dll 0.4.13 GCC4.7.2dbg 602.112 -> 602.112
advapi32.dll 0.4.12 GCC4.7.2dbg 615.424 -> 615.424
advapi32.dll 0.4.11 GCC4.7.2dbg 613.888 -> 613.888
advapi32.dll 0.4.10 GCC4.7.2dbg 604.672 -> 604.672
advapi32.dll 0.4.9  GCC4.7.2dbg 607.744 -> 604.672
advapi32.dll 0.4.8  GCC4.7.2dbg 602.624 -> 589.824
advapi32.dll 0.4.7  GCC4.7.2dbg 601.600 -> 589.312
This commit is contained in:
Joachim Henze 2023-07-22 19:54:02 +02:00
parent 7ca95dffab
commit 4af355b795
12 changed files with 51 additions and 90 deletions

View file

@ -631,8 +631,8 @@
631 stdcall SystemFunction041(ptr long long) # RtlDecryptMemory
632 stdcall TraceEvent(double ptr) ntdll.EtwTraceEvent
633 stdcall TraceEventInstance(double ptr ptr ptr) ntdll.EtwTraceEventInstance
634 varargs TraceMessage(ptr long ptr long) ntdll.EtwTraceMessage
635 stdcall TraceMessageVa(double long ptr long ptr) ntdll.EtwTraceMessageVa
634 varargs TraceMessage() ntdll.EtwTraceMessage
635 stdcall TraceMessageVa() ntdll.EtwTraceMessageVa
636 stdcall TreeResetNamedSecurityInfoA(str ptr ptr ptr ptr ptr ptr long ptr ptr ptr)
637 stdcall TreeResetNamedSecurityInfoW(wstr long long ptr ptr ptr ptr long ptr long ptr)
638 stub TrusteeAccessToObjectA

View file

@ -161,11 +161,11 @@ GetCurrentHwProfileW(LPHW_PROFILE_INFOW lpHwProfileInfo)
swprintf(
lpHwProfileInfo->szHwProfileGuid,
L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
uuid.Data1,
uuid.Data2,
uuid.Data1,
uuid.Data2,
uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3], uuid.Data4[4], uuid.Data4[5],
uuid.Data4[2], uuid.Data4[3], uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
dwLength = (wcslen(lpHwProfileInfo->szHwProfileGuid) + 1) * sizeof(WCHAR);

View file

@ -11,6 +11,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
/* GLOBALS *****************************************************************/
static const CHAR AdvapiTokenSourceName[] = "Advapi ";
C_ASSERT(sizeof(AdvapiTokenSourceName) == RTL_FIELD_SIZE(TOKEN_SOURCE, SourceName) + 1);
HANDLE LsaHandle = NULL;
ULONG AuthenticationPackage = 0;
@ -668,7 +671,9 @@ LogonUserExW(
SE_GROUP_ENABLED_BY_DEFAULT;
/* Set the token source */
strncpy(TokenSource.SourceName, "Advapi ", sizeof(TokenSource.SourceName));
RtlCopyMemory(TokenSource.SourceName,
AdvapiTokenSourceName,
sizeof(TokenSource.SourceName));
AllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
Status = LsaLogonUser(LsaHandle,

View file

@ -39,7 +39,7 @@ GetKeyName(HKEY hKey, PUNICODE_STRING KeyName)
NameInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, InfoLength);
if (NameInformation == NULL)
{
ERR("Failed to allocate %lu bytes", InfoLength);
ERR("Failed to alloc %lu bytes\n", InfoLength);
return ERROR_NOT_ENOUGH_MEMORY;
}

View file

@ -759,8 +759,7 @@ RegCopyTreeW(IN HKEY hKeySrc,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
RtlInitUnicodeString(&SubKeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyName,
@ -817,8 +816,7 @@ RegCopyTreeA(IN HKEY hKeySrc,
LONG Ret;
if (lpSubKey != NULL &&
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
(LPSTR)lpSubKey))
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
{
return ERROR_NOT_ENOUGH_MEMORY;
}
@ -847,8 +845,7 @@ RegConnectRegistryA(IN LPCSTR lpMachineName,
LONG Ret;
if (lpMachineName != NULL &&
!RtlCreateUnicodeStringFromAsciiz(&MachineName,
(LPSTR)lpMachineName))
!RtlCreateUnicodeStringFromAsciiz(&MachineName, lpMachineName))
{
return ERROR_NOT_ENOUGH_MEMORY;
}
@ -1111,9 +1108,6 @@ RegCreateKeyExW(
TRACE("RegCreateKeyExW() called\n");
if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
return ERROR_INVALID_USER_BUFFER;
/* get the real parent key */
Status = MapDefaultKey(&ParentKey,
hKey);
@ -1324,8 +1318,7 @@ RegDeleteKeyExW(
ERR("Wow64 not yet supported!\n");
RtlInitUnicodeString(&SubKeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyName,
OBJ_CASE_INSENSITIVE,
@ -1380,8 +1373,7 @@ RegDeleteKeyValueW(IN HKEY hKey,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
RtlInitUnicodeString(&SubKeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyName,
@ -1402,8 +1394,7 @@ RegDeleteKeyValueW(IN HKEY hKey,
else
CurKey = KeyHandle;
RtlInitUnicodeString(&ValueName,
(LPWSTR)lpValueName);
RtlInitUnicodeString(&ValueName, lpValueName);
Status = NtDeleteValueKey(CurKey,
&ValueName);
@ -1439,15 +1430,13 @@ RegDeleteKeyValueA(IN HKEY hKey,
LONG Ret;
if (lpSubKey != NULL &&
!RtlCreateUnicodeStringFromAsciiz(&SubKey,
(LPSTR)lpSubKey))
!RtlCreateUnicodeStringFromAsciiz(&SubKey, lpSubKey))
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if (lpValueName != NULL &&
!RtlCreateUnicodeStringFromAsciiz(&ValueName,
(LPSTR)lpValueName))
!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
{
RtlFreeUnicodeString(&SubKey);
return ERROR_NOT_ENOUGH_MEMORY;
@ -1693,8 +1682,7 @@ RegDeleteTreeW(IN HKEY hKey,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
RtlInitUnicodeString(&SubKeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyName,
@ -1853,8 +1841,7 @@ RegDeleteTreeA(IN HKEY hKey,
LONG Ret;
if (lpSubKey != NULL &&
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
(LPSTR)lpSubKey))
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
{
return ERROR_NOT_ENOUGH_MEMORY;
}
@ -2202,8 +2189,7 @@ RegSetKeyValueW(IN HKEY hKey,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
RtlInitUnicodeString(&SubKeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyName,
@ -2273,8 +2259,7 @@ RegSetKeyValueA(IN HKEY hKey,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
(LPSTR)lpSubKey))
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
{
Ret = ERROR_NOT_ENOUGH_MEMORY;
goto Cleanup;
@ -2342,8 +2327,7 @@ RegDeleteValueA(HKEY hKey,
return RtlNtStatusToDosError(Status);
}
RtlCreateUnicodeStringFromAsciiz(&ValueName,
(LPSTR)lpValueName);
RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName);
Status = NtDeleteValueKey(KeyHandle,
&ValueName);
RtlFreeUnicodeString (&ValueName);
@ -2379,8 +2363,7 @@ RegDeleteValueW(HKEY hKey,
return RtlNtStatusToDosError(Status);
}
RtlInitUnicodeString(&ValueName,
(LPWSTR)lpValueName);
RtlInitUnicodeString(&ValueName, lpValueName);
Status = NtDeleteValueKey(KeyHandle,
&ValueName);
@ -2834,7 +2817,7 @@ RegEnumValueA(
/* Convert the name string */
RtlUnicodeToMultiByteN(lpName, *lpcbName, lpcbName, NameBuffer, NameBufferSize * sizeof(WCHAR));
((PSTR)lpName)[*lpcbName] = '\0';
lpName[*lpcbName] = ANSI_NULL;
Exit:
if (NameBuffer)
@ -3152,8 +3135,7 @@ RegLoadKeyW(HKEY hKey,
NULL,
NULL);
RtlInitUnicodeString(&KeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&KeyName, lpSubKey);
InitializeObjectAttributes(&KeyObjectAttributes,
&KeyName,
@ -3414,10 +3396,7 @@ RegOpenKeyExW(HKEY hKey,
if (ulOptions & REG_OPTION_OPEN_LINK)
Attributes |= OBJ_OPENLINK;
if (lpSubKey != NULL)
RtlInitUnicodeString(&SubKeyString, (LPWSTR)lpSubKey);
else
RtlInitUnicodeString(&SubKeyString, (LPWSTR)L"");
RtlInitUnicodeString(&SubKeyString, lpSubKey ? lpSubKey : L"");
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyString,
@ -3884,7 +3863,7 @@ RegQueryMultipleValuesA(HKEY hKey,
{
ULONG i;
DWORD maxBytes = *ldwTotsize;
LPSTR bufptr = (LPSTR)lpValueBuf;
LPSTR bufptr = lpValueBuf;
LONG ErrorCode;
if (maxBytes >= (1024*1024))
@ -4407,8 +4386,7 @@ RegReplaceKeyW(HKEY hKey,
/* Open the real key */
if (lpSubKey != NULL && *lpSubKey != (WCHAR)0)
{
RtlInitUnicodeString(&SubKeyName,
(PWSTR)lpSubKey);
RtlInitUnicodeString(&SubKeyName, lpSubKey);
InitializeObjectAttributes(&KeyObjectAttributes,
&SubKeyName,
OBJ_CASE_INSENSITIVE,
@ -4847,10 +4825,7 @@ RegSetValueExA(HKEY hKey,
/* Convert SubKey name to Unicode */
if (lpValueName != NULL && lpValueName[0] != '\0')
{
BOOL bConverted;
bConverted = RtlCreateUnicodeStringFromAsciiz(&ValueName,
(PSTR)lpValueName);
if(!bConverted)
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
return ERROR_NOT_ENOUGH_MEMORY;
}
else
@ -5130,8 +5105,7 @@ RegUnLoadKeyW(HKEY hKey,
return RtlNtStatusToDosError(Status);
}
RtlInitUnicodeString(&KeyName,
(LPWSTR)lpSubKey);
RtlInitUnicodeString(&KeyName, lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,

View file

@ -98,7 +98,7 @@ CheckNtMartaPresent(VOID)
#if DBG
else
{
ERR("Failed to initialize ntmarta.dll! Error: 0x%x", ErrorCode);
ERR("Failed to init ntmarta.dll! Error: 0x%x\n", ErrorCode);
}
#endif
}

View file

@ -240,7 +240,7 @@ SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
{
NTSTATUS Status;
Status = RtlSetControlSecurityDescriptor(pSecurityDescriptor,
ControlBitsOfInterest,
ControlBitsToSet);

View file

@ -218,8 +218,7 @@ ScConnectControlPipe(HANDLE *hPipe)
hPipe);
/* Get the service number and create the named pipe */
RtlZeroMemory(&QueryTable,
sizeof(QueryTable));
RtlZeroMemory(&QueryTable, sizeof(QueryTable));
QueryTable[0].Name = L"";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED;
@ -632,7 +631,7 @@ ScServiceDispatcher(HANDLE hPipe,
break;
default:
TRACE("Command %lu received", ControlPacket->dwControl);
TRACE("Cmd %lu received\n", ControlPacket->dwControl);
dwError = ScControlService(lpService, ControlPacket);
break;
}

View file

@ -604,7 +604,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
* PARAMS
* hProv [I] Handle to the CSP whose reference is being incremented.
* pdwReserved [IN] Reserved for future use and must be NULL.
* dwFlags [I] Reserved for future use and must be NULL.
* dwFlags [I] Reserved for future use and must be 0.
*
* RETURNS
* Success: TRUE
@ -639,22 +639,18 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
*
* PARAMS
* hProv [I] Handle of a CSP.
* dwFlags [I] Reserved for future use and must be NULL.
* dwFlags [I] Reserved for future use and must be 0.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
#ifdef __REACTOS__
BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
#else
BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, ULONG_PTR dwFlags)
#endif
{
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
BOOL ret = TRUE;
TRACE("(0x%lx, %08lx)\n", hProv, dwFlags);
TRACE("(0x%lx, %08x)\n", hProv, dwFlags);
if (!pProv)
{
@ -732,7 +728,7 @@ BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
* hProv [I] Handle of a CSP.
* Algid [I] Identifies the hash algorithm to use.
* hKey [I] Key for the hash (if required).
* dwFlags [I] Reserved for future use and must be NULL.
* dwFlags [I] Reserved for future use and must be 0.
* phHash [O] Address of the future handle to the new hash object.
*
* RETURNS
@ -967,7 +963,7 @@ BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey)
*
* PARAMS
* hHash [I] Handle to the hash to be copied.
* pdwReserved [I] Reserved for future use and must be zero.
* pdwReserved [I] Reserved for future use and must be NULL.
* dwFlags [I] Reserved for future use and must be zero.
* phHash [O] Address of the handle to receive the copy.
*

View file

@ -1,13 +0,0 @@
Index: crypt.c
===================================================================
--- crypt.c (Revision 48087)
+++ crypt.c (Arbeitskopie)
@@ -618,7 +618,7 @@
* Success: TRUE
* Failure: FALSE
*/
-BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, ULONG_PTR dwFlags)
+BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
{
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
BOOL ret = TRUE;

View file

@ -17,6 +17,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes);
#ifdef __REACTOS__
VOID WINAPI QuerySecurityAccessMask(SECURITY_INFORMATION,LPDWORD);
VOID WINAPI SetSecurityAccessMask(SECURITY_INFORMATION,LPDWORD);
#endif
typedef struct _ACEFLAG
{

View file

@ -97,7 +97,7 @@ typedef struct _HMAC_INFO {
BYTE* pbOuterString;
DWORD cbOuterString;
} HMAC_INFO, *PHMAC_INFO;
typedef struct _CRYPTOAPI_BLOB {
DWORD cbData;
BYTE* pbData;
@ -2192,7 +2192,7 @@ static const WCHAR MS_ENH_RSA_AES_PROV_XP_W[] = { 'M','i','c','r','o','s','o','f
#define CRYPT_MODE_OFB 3
#define CRYPT_MODE_CFB 4
#define CRYPT_ENCRYPT 0x0001
#define CRYPT_ENCRYPT 0x0001
#define CRYPT_DECRYPT 0x0002
#define CRYPT_EXPORT 0x0004
#define CRYPT_READ 0x0008
@ -2353,10 +2353,10 @@ static const WCHAR MS_ENH_RSA_AES_PROV_XP_W[] = { 'M','i','c','r','o','s','o','f
#define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
L"Software\\Policies\\Microsoft\\SystemCertificates"
#else
static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
{'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
{'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
't','i','f','i','c','a','t','e','s',0 };
@ -2616,7 +2616,7 @@ static const WCHAR CRYPT_OID_REG_FLAGS_VALUE_NAME[] =
# define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
L".AuthRoot"
#else
static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
{'.','D','e','f','a','u','l','t','0'};
static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
{'.','G','r','o','u','p','P','o','l','i','c','y',0};
@ -4393,11 +4393,7 @@ CryptImportKey(
_In_ DWORD dwFlags,
_Out_ HCRYPTKEY *phKey);
#if (NTDDI_VERSION >= NTDDI_WINXP)
WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ DWORD);
#else
WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ ULONG_PTR);
#endif
WINADVAPI
BOOL