mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[0.4.9][ADVAPI32][PSDK] Selected Backports 2023-07-22
0.4.15-dev-5927-gbfc6a119c5
[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-g889b077b23
[REACTOS] *.spec: Fix some function/parameter types (only the [ADVAPI32] part) 0.4.14-dev-1245-g8ae8083378
[ADVAPI32][PSDK] CryptReleaseContext(): dwFlags parameter is DWORD, only 0.4.13-dev-666-gf3a9b524f1
[ADVAPI32] Fix copying the TokenSource string 0.4.13-dev-363-g46259092f9
[ADVAPI32:REG] Remove some useless casts (#1614) 0.4.12-dev-237-g446e13745c
[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 --------- in 0.4.9 + 0.4.10: scm.c: fix wrong arguments count in 2 TRACEs, which were introduced by the guilty 0.4.9-dev-417-g32bb592e12
Contrary to that delete all those TRACEs in 0.4.7 and 0.4.8 because they have been touched a thousand times after their introduction to fix all their format-string-glitches. --------- in 0.4.7+0.4.8+0.4.9 reg.c: delete load_string() and RegLoadMUIStringW(), inspired by 0.4.10-dev-502-gd559ca9c98
Both were neither used, nor exported yet luckily in <=0.4.9 Tip: In 0.4.9 dxdiag network.c we got some interesting workaround code worth to look at if ever needed for older releases. Search for "RegLoadMUIString" within --------- 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:
parent
efbbffeb32
commit
1085d85043
15 changed files with 53 additions and 287 deletions
|
@ -2,9 +2,6 @@
|
||||||
spec2def(advapi32.dll advapi32.spec ADD_IMPORTLIB)
|
spec2def(advapi32.dll advapi32.spec ADD_IMPORTLIB)
|
||||||
add_definitions(-D_ADVAPI32_)
|
add_definitions(-D_ADVAPI32_)
|
||||||
|
|
||||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
|
||||||
add_definitions(-D_WIN32_WINNT=0x600)
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl
|
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl
|
||||||
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers/ksecdd
|
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers/ksecdd
|
||||||
|
|
|
@ -631,8 +631,8 @@
|
||||||
631 stdcall SystemFunction041(ptr long long) # RtlDecryptMemory
|
631 stdcall SystemFunction041(ptr long long) # RtlDecryptMemory
|
||||||
632 stdcall TraceEvent(double ptr) ntdll.EtwTraceEvent
|
632 stdcall TraceEvent(double ptr) ntdll.EtwTraceEvent
|
||||||
633 stdcall TraceEventInstance(double ptr ptr ptr) ntdll.EtwTraceEventInstance
|
633 stdcall TraceEventInstance(double ptr ptr ptr) ntdll.EtwTraceEventInstance
|
||||||
634 varargs TraceMessage(ptr long ptr long) ntdll.EtwTraceMessage
|
634 varargs TraceMessage() ntdll.EtwTraceMessage
|
||||||
635 stdcall TraceMessageVa(double long ptr long ptr) ntdll.EtwTraceMessageVa
|
635 stdcall TraceMessageVa() ntdll.EtwTraceMessageVa
|
||||||
636 stdcall TreeResetNamedSecurityInfoA(str ptr ptr ptr ptr ptr ptr long ptr ptr ptr)
|
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)
|
637 stdcall TreeResetNamedSecurityInfoW(wstr long long ptr ptr ptr ptr long ptr long ptr)
|
||||||
638 stub TrusteeAccessToObjectA
|
638 stub TrusteeAccessToObjectA
|
||||||
|
|
|
@ -11,6 +11,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
||||||
|
|
||||||
/* GLOBALS *****************************************************************/
|
/* GLOBALS *****************************************************************/
|
||||||
|
|
||||||
|
static const CHAR AdvapiTokenSourceName[] = "Advapi ";
|
||||||
|
C_ASSERT(sizeof(AdvapiTokenSourceName) == RTL_FIELD_SIZE(TOKEN_SOURCE, SourceName) + 1);
|
||||||
|
|
||||||
HANDLE LsaHandle = NULL;
|
HANDLE LsaHandle = NULL;
|
||||||
ULONG AuthenticationPackage = 0;
|
ULONG AuthenticationPackage = 0;
|
||||||
|
|
||||||
|
@ -528,7 +531,9 @@ LogonUserExW(
|
||||||
SE_GROUP_ENABLED_BY_DEFAULT;
|
SE_GROUP_ENABLED_BY_DEFAULT;
|
||||||
|
|
||||||
/* Set the token source */
|
/* Set the token source */
|
||||||
strncpy(TokenSource.SourceName, "Advapi ", sizeof(TokenSource.SourceName));
|
RtlCopyMemory(TokenSource.SourceName,
|
||||||
|
AdvapiTokenSourceName,
|
||||||
|
sizeof(TokenSource.SourceName));
|
||||||
AllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
|
AllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
|
||||||
|
|
||||||
Status = LsaLogonUser(LsaHandle,
|
Status = LsaLogonUser(LsaHandle,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: dll/win32/advapi32/misc/sysfun.c
|
|
||||||
* PURPOSE: advapi32.dll system functions (undocumented)
|
* PURPOSE: advapi32.dll system functions (undocumented)
|
||||||
* PROGRAMMER: Emanuele Aliberti
|
* PROGRAMMER: Emanuele Aliberti
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
|
|
|
@ -39,7 +39,7 @@ GetKeyName(HKEY hKey, PUNICODE_STRING KeyName)
|
||||||
NameInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, InfoLength);
|
NameInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, InfoLength);
|
||||||
if (NameInformation == NULL)
|
if (NameInformation == NULL)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate %lu bytes", InfoLength);
|
ERR("Failed to alloc %lu bytes\n", InfoLength);
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -759,8 +759,7 @@ RegCopyTreeW(IN HKEY hKeySrc,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName;
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
|
@ -817,8 +816,7 @@ RegCopyTreeA(IN HKEY hKeySrc,
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL &&
|
if (lpSubKey != NULL &&
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
{
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -847,8 +845,7 @@ RegConnectRegistryA(IN LPCSTR lpMachineName,
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpMachineName != NULL &&
|
if (lpMachineName != NULL &&
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&MachineName,
|
!RtlCreateUnicodeStringFromAsciiz(&MachineName, lpMachineName))
|
||||||
(LPSTR)lpMachineName))
|
|
||||||
{
|
{
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -1111,9 +1108,6 @@ RegCreateKeyExW(
|
||||||
|
|
||||||
TRACE("RegCreateKeyExW() called\n");
|
TRACE("RegCreateKeyExW() called\n");
|
||||||
|
|
||||||
if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
|
|
||||||
return ERROR_INVALID_USER_BUFFER;
|
|
||||||
|
|
||||||
/* get the real parent key */
|
/* get the real parent key */
|
||||||
Status = MapDefaultKey(&ParentKey,
|
Status = MapDefaultKey(&ParentKey,
|
||||||
hKey);
|
hKey);
|
||||||
|
@ -1324,8 +1318,7 @@ RegDeleteKeyExW(
|
||||||
ERR("Wow64 not yet supported!\n");
|
ERR("Wow64 not yet supported!\n");
|
||||||
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
@ -1380,8 +1373,7 @@ RegDeleteKeyValueW(IN HKEY hKey,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName;
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
|
@ -1402,8 +1394,7 @@ RegDeleteKeyValueW(IN HKEY hKey,
|
||||||
else
|
else
|
||||||
CurKey = KeyHandle;
|
CurKey = KeyHandle;
|
||||||
|
|
||||||
RtlInitUnicodeString(&ValueName,
|
RtlInitUnicodeString(&ValueName, lpValueName);
|
||||||
(LPWSTR)lpValueName);
|
|
||||||
|
|
||||||
Status = NtDeleteValueKey(CurKey,
|
Status = NtDeleteValueKey(CurKey,
|
||||||
&ValueName);
|
&ValueName);
|
||||||
|
@ -1439,15 +1430,13 @@ RegDeleteKeyValueA(IN HKEY hKey,
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL &&
|
if (lpSubKey != NULL &&
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&SubKey,
|
!RtlCreateUnicodeStringFromAsciiz(&SubKey, lpSubKey))
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
{
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpValueName != NULL &&
|
if (lpValueName != NULL &&
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
|
||||||
(LPSTR)lpValueName))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&SubKey);
|
RtlFreeUnicodeString(&SubKey);
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
@ -1693,8 +1682,7 @@ RegDeleteTreeW(IN HKEY hKey,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName;
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
|
@ -1853,8 +1841,7 @@ RegDeleteTreeA(IN HKEY hKey,
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL &&
|
if (lpSubKey != NULL &&
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
{
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -2202,8 +2189,7 @@ RegSetKeyValueW(IN HKEY hKey,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName;
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
|
@ -2273,8 +2259,7 @@ RegSetKeyValueA(IN HKEY hKey,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName;
|
||||||
|
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
{
|
||||||
Ret = ERROR_NOT_ENOUGH_MEMORY;
|
Ret = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
|
@ -2342,8 +2327,7 @@ RegDeleteValueA(HKEY hKey,
|
||||||
return RtlNtStatusToDosError(Status);
|
return RtlNtStatusToDosError(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName);
|
||||||
(LPSTR)lpValueName);
|
|
||||||
Status = NtDeleteValueKey(KeyHandle,
|
Status = NtDeleteValueKey(KeyHandle,
|
||||||
&ValueName);
|
&ValueName);
|
||||||
RtlFreeUnicodeString (&ValueName);
|
RtlFreeUnicodeString (&ValueName);
|
||||||
|
@ -2379,8 +2363,7 @@ RegDeleteValueW(HKEY hKey,
|
||||||
return RtlNtStatusToDosError(Status);
|
return RtlNtStatusToDosError(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString(&ValueName,
|
RtlInitUnicodeString(&ValueName, lpValueName);
|
||||||
(LPWSTR)lpValueName);
|
|
||||||
|
|
||||||
Status = NtDeleteValueKey(KeyHandle,
|
Status = NtDeleteValueKey(KeyHandle,
|
||||||
&ValueName);
|
&ValueName);
|
||||||
|
@ -2834,7 +2817,7 @@ RegEnumValueA(
|
||||||
|
|
||||||
/* Convert the name string */
|
/* Convert the name string */
|
||||||
RtlUnicodeToMultiByteN(lpName, *lpcbName, lpcbName, NameBuffer, NameBufferSize * sizeof(WCHAR));
|
RtlUnicodeToMultiByteN(lpName, *lpcbName, lpcbName, NameBuffer, NameBufferSize * sizeof(WCHAR));
|
||||||
((PSTR)lpName)[*lpcbName] = '\0';
|
lpName[*lpcbName] = ANSI_NULL;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
if (NameBuffer)
|
if (NameBuffer)
|
||||||
|
@ -3152,8 +3135,7 @@ RegLoadKeyW(HKEY hKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
RtlInitUnicodeString(&KeyName,
|
RtlInitUnicodeString(&KeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&KeyObjectAttributes,
|
InitializeObjectAttributes(&KeyObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
|
@ -3414,10 +3396,7 @@ RegOpenKeyExW(HKEY hKey,
|
||||||
if (ulOptions & REG_OPTION_OPEN_LINK)
|
if (ulOptions & REG_OPTION_OPEN_LINK)
|
||||||
Attributes |= OBJ_OPENLINK;
|
Attributes |= OBJ_OPENLINK;
|
||||||
|
|
||||||
if (lpSubKey != NULL)
|
RtlInitUnicodeString(&SubKeyString, lpSubKey ? lpSubKey : L"");
|
||||||
RtlInitUnicodeString(&SubKeyString, (LPWSTR)lpSubKey);
|
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&SubKeyString, (LPWSTR)L"");
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyString,
|
&SubKeyString,
|
||||||
|
@ -3884,7 +3863,7 @@ RegQueryMultipleValuesA(HKEY hKey,
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
DWORD maxBytes = *ldwTotsize;
|
DWORD maxBytes = *ldwTotsize;
|
||||||
LPSTR bufptr = (LPSTR)lpValueBuf;
|
LPSTR bufptr = lpValueBuf;
|
||||||
LONG ErrorCode;
|
LONG ErrorCode;
|
||||||
|
|
||||||
if (maxBytes >= (1024*1024))
|
if (maxBytes >= (1024*1024))
|
||||||
|
@ -4407,8 +4386,7 @@ RegReplaceKeyW(HKEY hKey,
|
||||||
/* Open the real key */
|
/* Open the real key */
|
||||||
if (lpSubKey != NULL && *lpSubKey != (WCHAR)0)
|
if (lpSubKey != NULL && *lpSubKey != (WCHAR)0)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
RtlInitUnicodeString(&SubKeyName, lpSubKey);
|
||||||
(PWSTR)lpSubKey);
|
|
||||||
InitializeObjectAttributes(&KeyObjectAttributes,
|
InitializeObjectAttributes(&KeyObjectAttributes,
|
||||||
&SubKeyName,
|
&SubKeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
@ -4847,10 +4825,7 @@ RegSetValueExA(HKEY hKey,
|
||||||
/* Convert SubKey name to Unicode */
|
/* Convert SubKey name to Unicode */
|
||||||
if (lpValueName != NULL && lpValueName[0] != '\0')
|
if (lpValueName != NULL && lpValueName[0] != '\0')
|
||||||
{
|
{
|
||||||
BOOL bConverted;
|
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
|
||||||
bConverted = RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
|
||||||
(PSTR)lpValueName);
|
|
||||||
if(!bConverted)
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5130,8 +5105,7 @@ RegUnLoadKeyW(HKEY hKey,
|
||||||
return RtlNtStatusToDosError(Status);
|
return RtlNtStatusToDosError(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString(&KeyName,
|
RtlInitUnicodeString(&KeyName, lpSubKey);
|
||||||
(LPWSTR)lpSubKey);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
|
@ -5151,195 +5125,4 @@ RegUnLoadKeyW(HKEY hKey,
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* load_string [Internal]
|
|
||||||
*
|
|
||||||
* This is basically a copy of user32/resource.c's LoadStringW. Necessary to
|
|
||||||
* avoid importing user32, which is higher level than advapi32. Helper for
|
|
||||||
* RegLoadMUIString.
|
|
||||||
*/
|
|
||||||
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
|
|
||||||
{
|
|
||||||
HGLOBAL hMemory;
|
|
||||||
HRSRC hResource;
|
|
||||||
WCHAR *pString;
|
|
||||||
int idxString;
|
|
||||||
|
|
||||||
/* Negative values have to be inverted. */
|
|
||||||
if (HIWORD(resId) == 0xffff)
|
|
||||||
resId = (UINT)(-((INT)resId));
|
|
||||||
|
|
||||||
/* Load the resource into memory and get a pointer to it. */
|
|
||||||
hResource = FindResourceW(hModule, MAKEINTRESOURCEW(LOWORD(resId >> 4) + 1), (LPWSTR)RT_STRING);
|
|
||||||
if (!hResource) return 0;
|
|
||||||
hMemory = LoadResource(hModule, hResource);
|
|
||||||
if (!hMemory) return 0;
|
|
||||||
pString = LockResource(hMemory);
|
|
||||||
|
|
||||||
/* Strings are length-prefixed. Lowest nibble of resId is an index. */
|
|
||||||
idxString = resId & 0xf;
|
|
||||||
while (idxString--) pString += *pString + 1;
|
|
||||||
|
|
||||||
/* If no buffer is given, return length of the string. */
|
|
||||||
if (!pwszBuffer) return *pString;
|
|
||||||
|
|
||||||
/* Else copy over the string, respecting the buffer size. */
|
|
||||||
cMaxChars = (*pString < cMaxChars) ? *pString : (cMaxChars - 1);
|
|
||||||
if (cMaxChars >= 0)
|
|
||||||
{
|
|
||||||
memcpy(pwszBuffer, pString+1, cMaxChars * sizeof(WCHAR));
|
|
||||||
pwszBuffer[cMaxChars] = L'\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
return cMaxChars;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* RegLoadMUIStringW
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
LONG WINAPI
|
|
||||||
RegLoadMUIStringW(IN HKEY hKey,
|
|
||||||
IN LPCWSTR pszValue OPTIONAL,
|
|
||||||
OUT LPWSTR pszOutBuf,
|
|
||||||
IN DWORD cbOutBuf,
|
|
||||||
OUT LPDWORD pcbData OPTIONAL,
|
|
||||||
IN DWORD Flags,
|
|
||||||
IN LPCWSTR pszDirectory OPTIONAL)
|
|
||||||
{
|
|
||||||
DWORD dwValueType, cbData;
|
|
||||||
LPWSTR pwszTempBuffer = NULL, pwszExpandedBuffer = NULL;
|
|
||||||
LONG result;
|
|
||||||
|
|
||||||
/* Parameter sanity checks. */
|
|
||||||
if (!hKey || !pszOutBuf)
|
|
||||||
return ERROR_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
if (pszDirectory && *pszDirectory)
|
|
||||||
{
|
|
||||||
FIXME("BaseDir parameter not yet supported!\n");
|
|
||||||
return ERROR_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for value existence and correctness of it's type, allocate a buffer and load it. */
|
|
||||||
result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, NULL, &cbData);
|
|
||||||
if (result != ERROR_SUCCESS) goto cleanup;
|
|
||||||
if (!(dwValueType == REG_SZ || dwValueType == REG_EXPAND_SZ) || !cbData)
|
|
||||||
{
|
|
||||||
result = ERROR_FILE_NOT_FOUND;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
pwszTempBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
|
|
||||||
if (!pwszTempBuffer)
|
|
||||||
{
|
|
||||||
result = ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData);
|
|
||||||
if (result != ERROR_SUCCESS) goto cleanup;
|
|
||||||
|
|
||||||
/* Expand environment variables, if appropriate, or copy the original string over. */
|
|
||||||
if (dwValueType == REG_EXPAND_SZ)
|
|
||||||
{
|
|
||||||
cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
|
|
||||||
if (!cbData) goto cleanup;
|
|
||||||
pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
|
|
||||||
if (!pwszExpandedBuffer)
|
|
||||||
{
|
|
||||||
result = ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ExpandEnvironmentStringsW(pwszTempBuffer, pwszExpandedBuffer, cbData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
|
|
||||||
memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the value references a resource based string, parse the value and load the string.
|
|
||||||
* Else just copy over the original value. */
|
|
||||||
result = ERROR_SUCCESS;
|
|
||||||
if (*pwszExpandedBuffer != L'@') /* '@' is the prefix for resource based string entries. */
|
|
||||||
{
|
|
||||||
lstrcpynW(pszOutBuf, pwszExpandedBuffer, cbOutBuf / sizeof(WCHAR));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WCHAR *pComma = wcsrchr(pwszExpandedBuffer, L',');
|
|
||||||
UINT uiStringId;
|
|
||||||
HMODULE hModule;
|
|
||||||
|
|
||||||
/* Format of the expanded value is 'path_to_dll,-resId' */
|
|
||||||
if (!pComma || pComma[1] != L'-')
|
|
||||||
{
|
|
||||||
result = ERROR_BADKEY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
uiStringId = _wtoi(pComma+2);
|
|
||||||
*pComma = L'\0';
|
|
||||||
|
|
||||||
hModule = LoadLibraryExW(pwszExpandedBuffer + 1, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
|
||||||
if (!hModule || !load_string(hModule, uiStringId, pszOutBuf, cbOutBuf / sizeof(WCHAR)))
|
|
||||||
result = ERROR_BADKEY;
|
|
||||||
FreeLibrary(hModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
HeapFree(GetProcessHeap(), 0, pwszTempBuffer);
|
|
||||||
HeapFree(GetProcessHeap(), 0, pwszExpandedBuffer);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* RegLoadMUIStringA
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
LONG WINAPI
|
|
||||||
RegLoadMUIStringA(IN HKEY hKey,
|
|
||||||
IN LPCSTR pszValue OPTIONAL,
|
|
||||||
OUT LPSTR pszOutBuf,
|
|
||||||
IN DWORD cbOutBuf,
|
|
||||||
OUT LPDWORD pcbData OPTIONAL,
|
|
||||||
IN DWORD Flags,
|
|
||||||
IN LPCSTR pszDirectory OPTIONAL)
|
|
||||||
{
|
|
||||||
UNICODE_STRING valueW, baseDirW;
|
|
||||||
WCHAR *pwszBuffer;
|
|
||||||
DWORD cbData = cbOutBuf * sizeof(WCHAR);
|
|
||||||
LONG result;
|
|
||||||
|
|
||||||
valueW.Buffer = baseDirW.Buffer = pwszBuffer = NULL;
|
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&valueW, pszValue) ||
|
|
||||||
!RtlCreateUnicodeStringFromAsciiz(&baseDirW, pszDirectory) ||
|
|
||||||
!(pwszBuffer = HeapAlloc(GetProcessHeap(), 0, cbData)))
|
|
||||||
{
|
|
||||||
result = ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = RegLoadMUIStringW(hKey, valueW.Buffer, pwszBuffer, cbData, NULL, Flags,
|
|
||||||
baseDirW.Buffer);
|
|
||||||
|
|
||||||
if (result == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
cbData = WideCharToMultiByte(CP_ACP, 0, pwszBuffer, -1, pszOutBuf, cbOutBuf, NULL, NULL);
|
|
||||||
if (pcbData)
|
|
||||||
*pcbData = cbData;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
HeapFree(GetProcessHeap(), 0, pwszBuffer);
|
|
||||||
RtlFreeUnicodeString(&baseDirW);
|
|
||||||
RtlFreeUnicodeString(&valueW);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -98,7 +98,7 @@ CheckNtMartaPresent(VOID)
|
||||||
#if DBG
|
#if DBG
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERR("Failed to initialize ntmarta.dll! Error: 0x%x", ErrorCode);
|
ERR("Failed to init ntmarta.dll! Error: 0x%x\n", ErrorCode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ ChangeServiceConfigA(SC_HANDLE hService,
|
||||||
LPWSTR lpPasswordW = NULL;
|
LPWSTR lpPasswordW = NULL;
|
||||||
LPBYTE lpEncryptedPassword = NULL;
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("ChangeServiceConfigA(%p %lu %lu %lu %s %s %p %s %s %s %s)\n",
|
TRACE("ChangeServiceConfigA(%lu %lu %lu %s %s %p %s %s %s %s)\n",
|
||||||
dwServiceType, dwStartType, dwErrorControl, debugstr_a(lpBinaryPathName),
|
dwServiceType, dwStartType, dwErrorControl, debugstr_a(lpBinaryPathName),
|
||||||
debugstr_a(lpLoadOrderGroup), lpdwTagId, debugstr_a(lpDependencies),
|
debugstr_a(lpLoadOrderGroup), lpdwTagId, debugstr_a(lpDependencies),
|
||||||
debugstr_a(lpServiceStartName), debugstr_a(lpPassword), debugstr_a(lpDisplayName));
|
debugstr_a(lpServiceStartName), debugstr_a(lpPassword), debugstr_a(lpDisplayName));
|
||||||
|
@ -400,7 +400,7 @@ ChangeServiceConfigW(SC_HANDLE hService,
|
||||||
DWORD dwPasswordLength = 0;
|
DWORD dwPasswordLength = 0;
|
||||||
LPBYTE lpEncryptedPassword = NULL;
|
LPBYTE lpEncryptedPassword = NULL;
|
||||||
|
|
||||||
TRACE("ChangeServiceConfigW(%p %lu %lu %lu %s %s %p %s %s %s %s)\n",
|
TRACE("ChangeServiceConfigW(%lu %lu %lu %s %s %p %s %s %s %s)\n",
|
||||||
dwServiceType, dwStartType, dwErrorControl, debugstr_w(lpBinaryPathName),
|
dwServiceType, dwStartType, dwErrorControl, debugstr_w(lpBinaryPathName),
|
||||||
debugstr_w(lpLoadOrderGroup), lpdwTagId, debugstr_w(lpDependencies),
|
debugstr_w(lpLoadOrderGroup), lpdwTagId, debugstr_w(lpDependencies),
|
||||||
debugstr_w(lpServiceStartName), debugstr_w(lpPassword), debugstr_w(lpDisplayName));
|
debugstr_w(lpServiceStartName), debugstr_w(lpPassword), debugstr_w(lpDisplayName));
|
||||||
|
|
|
@ -218,8 +218,7 @@ ScConnectControlPipe(HANDLE *hPipe)
|
||||||
hPipe);
|
hPipe);
|
||||||
|
|
||||||
/* Get the service number and create the named pipe */
|
/* Get the service number and create the named pipe */
|
||||||
RtlZeroMemory(&QueryTable,
|
RtlZeroMemory(&QueryTable, sizeof(QueryTable));
|
||||||
sizeof(QueryTable));
|
|
||||||
|
|
||||||
QueryTable[0].Name = L"";
|
QueryTable[0].Name = L"";
|
||||||
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED;
|
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED;
|
||||||
|
@ -631,7 +630,7 @@ ScServiceDispatcher(HANDLE hPipe,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TRACE("Command %lu received", ControlPacket->dwControl);
|
TRACE("Cmd %lu received\n", ControlPacket->dwControl);
|
||||||
dwError = ScControlService(lpService, ControlPacket);
|
dwError = ScControlService(lpService, ControlPacket);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* hProv [I] Handle to the CSP whose reference is being incremented.
|
* hProv [I] Handle to the CSP whose reference is being incremented.
|
||||||
* pdwReserved [IN] Reserved for future use and must be NULL.
|
* 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
|
* RETURNS
|
||||||
* Success: TRUE
|
* Success: TRUE
|
||||||
|
@ -639,22 +639,18 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* hProv [I] Handle of a CSP.
|
* 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
|
* RETURNS
|
||||||
* Success: TRUE
|
* Success: TRUE
|
||||||
* Failure: FALSE
|
* Failure: FALSE
|
||||||
*/
|
*/
|
||||||
#ifdef __REACTOS__
|
|
||||||
BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
|
BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
|
||||||
#else
|
|
||||||
BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, ULONG_PTR dwFlags)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
|
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
|
|
||||||
TRACE("(0x%lx, %08lx)\n", hProv, dwFlags);
|
TRACE("(0x%lx, %08x)\n", hProv, dwFlags);
|
||||||
|
|
||||||
if (!pProv)
|
if (!pProv)
|
||||||
{
|
{
|
||||||
|
@ -732,7 +728,7 @@ BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
|
||||||
* hProv [I] Handle of a CSP.
|
* hProv [I] Handle of a CSP.
|
||||||
* Algid [I] Identifies the hash algorithm to use.
|
* Algid [I] Identifies the hash algorithm to use.
|
||||||
* hKey [I] Key for the hash (if required).
|
* 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.
|
* phHash [O] Address of the future handle to the new hash object.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
|
@ -967,7 +963,7 @@ BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey)
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* hHash [I] Handle to the hash to be copied.
|
* 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.
|
* dwFlags [I] Reserved for future use and must be zero.
|
||||||
* phHash [O] Address of the handle to receive the copy.
|
* phHash [O] Address of the handle to receive the copy.
|
||||||
*
|
*
|
||||||
|
|
|
@ -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;
|
|
|
@ -17,6 +17,10 @@
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
||||||
|
|
||||||
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes);
|
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
|
typedef struct _ACEFLAG
|
||||||
{
|
{
|
||||||
|
|
|
@ -4393,11 +4393,7 @@ CryptImportKey(
|
||||||
_In_ DWORD dwFlags,
|
_In_ DWORD dwFlags,
|
||||||
_Out_ HCRYPTKEY *phKey);
|
_Out_ HCRYPTKEY *phKey);
|
||||||
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_WINXP)
|
|
||||||
WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ DWORD);
|
WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ DWORD);
|
||||||
#else
|
|
||||||
WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ ULONG_PTR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WINADVAPI
|
WINADVAPI
|
||||||
BOOL
|
BOOL
|
||||||
|
|
Loading…
Reference in a new issue