strip whitespace from end of lines

svn path=/trunk/; revision=15169
This commit is contained in:
Steven Edwards 2005-05-09 01:43:41 +00:00
parent 395f5dc9e5
commit 189e9fae5c
15 changed files with 196 additions and 196 deletions

View file

@ -270,7 +270,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
SetLastError(NTE_BAD_PROV_TYPE);
return FALSE;
}
if (!phProv)
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -1001,19 +1001,19 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
{
DWORD numkeys;
WCHAR *provNameW;
RegQueryInfoKeyW(hKey, NULL, NULL, NULL, &numkeys, pcbProvName,
NULL, NULL, NULL, NULL, NULL, NULL);
if (!(provNameW = CRYPT_Alloc(*pcbProvName * sizeof(WCHAR))))
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
RegEnumKeyExW(hKey, dwIndex, provNameW, pcbProvName, NULL, NULL, NULL, NULL);
(*pcbProvName)++;
*pcbProvName *= sizeof(WCHAR);
CRYPT_Free(provNameW);
if (dwIndex >= numkeys)
CRYPT_ReturnLastError(ERROR_NO_MORE_ITEMS);
}
@ -1022,7 +1022,7 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
DWORD size = sizeof(DWORD);
DWORD result;
HKEY subkey;
result = RegEnumKeyW(hKey, dwIndex, pszProvName, *pcbProvName / sizeof(WCHAR));
if (result)
CRYPT_ReturnLastError(result);
@ -1123,7 +1123,7 @@ BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
*pdwProvType += (*(--ch) - '0') * 10;
*pdwProvType += (*(--ch) - '0') * 100;
CRYPT_Free(keyname);
result = RegQueryValueExA(hSubkey, "TypeName", NULL, &dwType, (LPBYTE)pszTypeName, pcbTypeName);
if (result)
CRYPT_ReturnLastError(result);
@ -1162,7 +1162,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
/******************************************************************************
* CryptExportKey (ADVAPI32.@)
*
*
* Exports a cryptographic key from a CSP.
*
* PARAMS
@ -1280,18 +1280,18 @@ BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
CRYPT_ReturnLastError(NTE_PROV_TYPE_NOT_DEF);
}
CRYPT_Free(keyname);
result = RegQueryValueExA(hKey, "Name", NULL, NULL, (LPBYTE)pszProvName, pcbProvName);
result = RegQueryValueExA(hKey, "Name", NULL, NULL, (LPBYTE)pszProvName, pcbProvName);
if (result)
{
if (result != ERROR_MORE_DATA)
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
else
SetLastError(result);
return FALSE;
}
RegCloseKey(hKey);
return TRUE;
}
@ -1498,7 +1498,7 @@ BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWOR
/******************************************************************************
* CryptHashSessionKey (ADVAPI32.@)
*
* PARAMS
* PARAMS
* hHash [I] Handle to the hash object.
* hKey [I] Handle to the key to be hashed.
* dwFlags [I] Can be CRYPT_LITTLE_ENDIAN.
@ -1729,7 +1729,7 @@ BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pd
if (dwFlags & ~(CRYPT_MACHINE_DEFAULT | CRYPT_USER_DEFAULT | CRYPT_DELETE_DEFAULT)
|| dwFlags == CRYPT_DELETE_DEFAULT)
CRYPT_ReturnLastError(NTE_BAD_FLAGS);
if (!(keyname = CRYPT_GetTypeKeyName(dwProvType, dwFlags & CRYPT_USER_DEFAULT)))
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
if (RegOpenKeyA((dwFlags & CRYPT_USER_DEFAULT) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
@ -1739,7 +1739,7 @@ BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pd
CRYPT_ReturnLastError(NTE_BAD_PROVIDER);
}
CRYPT_Free(keyname);
if (dwFlags & CRYPT_DELETE_DEFAULT)
{
RegDeleteValueA(hTypeKey, "Name");
@ -1759,14 +1759,14 @@ BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pd
CRYPT_ReturnLastError(NTE_BAD_PROVIDER);
}
CRYPT_Free(keyname);
if (RegSetValueExA(hTypeKey, "Name", 0, REG_SZ, (LPBYTE)pszProvName, strlen(pszProvName) + 1))
{
RegCloseKey(hTypeKey);
RegCloseKey(hProvKey);
return FALSE;
}
RegCloseKey(hProvKey);
}
RegCloseKey(hTypeKey);

View file

@ -221,7 +221,7 @@ VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
VOID WINAPI MD4Final(MD4_CTX *ctx)

View file

@ -231,7 +231,7 @@ VOID WINAPI MD5Update(MD5_CTX *ctx, const unsigned char *buf, unsigned int len)
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
VOID WINAPI MD5Final( MD5_CTX *ctx )

View file

@ -1229,7 +1229,7 @@ RegEnumValueA( HKEY hKey, DWORD index, LPSTR value, LPDWORD val_count,
/******************************************************************************
* RegEnumValueW [ADVAPI32.@]
* @implemented
*
*
* PARAMS
* hkey [I] Handle to key to query
* index [I] Index of value to query
@ -1260,7 +1260,7 @@ RegEnumValueW( HKEY hKey, DWORD index, LPWSTR value, PDWORD val_count,
/* NT only checks count, not val_count */
if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER;
status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(status))
{
@ -1690,7 +1690,7 @@ RegOpenKeyExW (HKEY hKey,
DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n",
hKey, lpSubKey, ulOptions, samDesired, phkResult);
Status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(Status))
{
@ -1738,13 +1738,13 @@ RegOpenUserClassesRoot (IN HANDLE hToken,
OBJECT_ATTRIBUTES ObjectAttributes;
LONG ErrorCode;
NTSTATUS Status;
/* check parameters */
if (hToken == NULL || dwOptions != 0 || phkResult == NULL)
{
return ERROR_INVALID_PARAMETER;
}
/*
* Get the user sid from the token
*/
@ -1789,14 +1789,14 @@ ReadTokenSid:
/* the information appears to have changed?! try again */
goto ReadTokenSid;
}
/* NOTE - as opposed to all other registry functions windows does indeed
change the last error code in case the caller supplied a invalid
handle for example! */
ErrorCode = RtlNtStatusToDosError (Status);
return ErrorCode;
}
/*
* Build the absolute path for the user's registry in the form
* "\Registry\User\<SID>_Classes"
@ -1814,7 +1814,7 @@ ReadTokenSid:
{
return RtlNtStatusToDosError (Status);
}
/* allocate enough memory for the entire key string */
UserClassesKeyRoot.Length = 0;
UserClassesKeyRoot.MaximumLength = UserSidString.Length +
@ -1828,7 +1828,7 @@ ReadTokenSid:
RtlFreeUnicodeString(&UserSidString);
return RtlNtStatusToDosError (Status);
}
/* build the string */
RtlAppendUnicodeToString(&UserClassesKeyRoot,
UserClassesKeyPrefix);
@ -1836,7 +1836,7 @@ ReadTokenSid:
&UserSidString);
RtlAppendUnicodeToString(&UserClassesKeyRoot,
UserClassesKeySuffix);
DPRINT("RegOpenUserClassesRoot: Absolute path: %wZ\n", &UserClassesKeyRoot);
/*
@ -1848,19 +1848,19 @@ ReadTokenSid:
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtOpenKey((PHANDLE)phkResult,
samDesired,
&ObjectAttributes);
RtlFreeUnicodeString(&UserSidString);
RtlFreeUnicodeString(&UserClassesKeyRoot);
if (!NT_SUCCESS(Status))
{
return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
}
@ -3037,7 +3037,7 @@ RegSetValueExA (HKEY hKey,
{
cbData++;
}
RtlInitAnsiString (&AnsiString,
NULL);
AnsiString.Buffer = (PSTR)lpData;
@ -3116,7 +3116,7 @@ RegSetValueExW (HKEY hKey,
RtlInitUnicodeString (&ValueName, L"");
}
pValueName = &ValueName;
if (((dwType == REG_SZ) ||
(dwType == REG_MULTI_SZ) ||
(dwType == REG_EXPAND_SZ)) &&
@ -3155,12 +3155,12 @@ RegSetValueA (HKEY hKey,
{
LONG ret;
HKEY hSubKey;
if (dwType != REG_SZ)
{
return ERROR_INVALID_PARAMETER;
}
if (lpSubKey != NULL && lpSubKey[0] != '\0')
{
ret = RegCreateKeyA(hKey,
@ -3174,14 +3174,14 @@ RegSetValueA (HKEY hKey,
}
else
hSubKey = hKey;
ret = RegSetValueExA(hSubKey,
NULL,
0,
REG_SZ,
(CONST BYTE*)lpData,
strlen(lpData) + 1);
if (hSubKey != hKey)
{
RegCloseKey(hSubKey);

View file

@ -53,7 +53,7 @@ AreAnyAccessesGranted(DWORD GrantedAccess,
*
* RETURNS
* Success: TRUE. pSecurityDescriptor contains the requested information.
* Failure: FALSE. lpnLengthNeeded contains the required space to return the info.
* Failure: FALSE. lpnLengthNeeded contains the required space to return the info.
*
* NOTES
* The information returned is constrained by the callers access rights and
@ -476,7 +476,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
UNICODE_STRING NameW;
ANSI_STRING NameA;
BOOL Ret;
/* apparently Win doesn't check whether lpSize is valid at all! */
NameW.Length = 0;
@ -487,23 +487,23 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
NameA.Length = 0;
NameA.MaximumLength = ((*lpSize) < 0xFFFF ? (USHORT)(*lpSize) : 0xFFFF);
NameA.Buffer = lpszName;
Ret = GetUserNameW(NameW.Buffer,
lpSize);
if(Ret)
{
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
NameA.Buffer[NameA.Length] = '\0';
*lpSize = NameA.Length + 1;
}
LocalFree(NameW.Buffer);
return Ret;
}
@ -634,18 +634,18 @@ LookupAccountSidA (LPCSTR lpSystemName,
UNICODE_STRING NameW, ReferencedDomainNameW, SystemNameW;
DWORD szName, szReferencedDomainName;
BOOL Ret;
/*
* save the buffer sizes the caller passed to us, as they may get modified and
* we require the original values when converting back to ansi
*/
szName = *cchName;
szReferencedDomainName = *cchReferencedDomainName;
/*
* allocate buffers for the unicode strings to receive
*/
if(szName > 0)
{
NameW.Length = 0;
@ -659,7 +659,7 @@ LookupAccountSidA (LPCSTR lpSystemName,
}
else
NameW.Buffer = NULL;
if(szReferencedDomainName > 0)
{
ReferencedDomainNameW.Length = 0;
@ -677,11 +677,11 @@ LookupAccountSidA (LPCSTR lpSystemName,
}
else
ReferencedDomainNameW.Buffer = NULL;
/*
* convert the system name to unicode - if present
*/
if(lpSystemName != NULL)
{
ANSI_STRING SystemNameA;
@ -691,11 +691,11 @@ LookupAccountSidA (LPCSTR lpSystemName,
}
else
SystemNameW.Buffer = NULL;
/*
* it's time to call the unicode version
*/
Ret = LookupAccountSidW(SystemNameW.Buffer,
lpSid,
NameW.Buffer,
@ -713,15 +713,15 @@ LookupAccountSidA (LPCSTR lpSystemName,
if(lpName != NULL)
{
ANSI_STRING NameA;
NameA.Length = 0;
NameA.MaximumLength = ((szName <= 0xFFFF) ? (USHORT)szName : 0xFFFF);
NameA.Buffer = lpName;
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
NameA.Buffer[NameA.Length] = '\0';
}
if(lpReferencedDomainName != NULL)
{
ANSI_STRING ReferencedDomainNameA;
@ -735,7 +735,7 @@ LookupAccountSidA (LPCSTR lpSystemName,
ReferencedDomainNameA.Buffer[ReferencedDomainNameA.Length] = '\0';
}
}
/*
* free previously allocated buffers
*/
@ -752,7 +752,7 @@ LookupAccountSidA (LPCSTR lpSystemName,
{
LocalFree(ReferencedDomainNameW.Buffer);
}
return Ret;
}
@ -1196,19 +1196,19 @@ SetSecurityInfo(HANDLE handle,
* GetSecurityInfoExW EXPORTED
*/
DWORD WINAPI GetSecurityInfoExA(
HANDLE hObject,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
HANDLE hObject,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
LPCSTR lpProvider,
LPCSTR lpProperty,
PACTRL_ACCESSA *ppAccessList,
PACTRL_AUDITA *ppAuditList,
LPSTR *lppOwner,
LPCSTR lpProperty,
PACTRL_ACCESSA *ppAccessList,
PACTRL_AUDITA *ppAuditList,
LPSTR *lppOwner,
LPSTR *lppGroup
)
{
DPRINT1("GetSecurityInfoExA stub!\n");
return ERROR_BAD_PROVIDER;
return ERROR_BAD_PROVIDER;
}
@ -1216,19 +1216,19 @@ DWORD WINAPI GetSecurityInfoExA(
* GetSecurityInfoExW EXPORTED
*/
DWORD WINAPI GetSecurityInfoExW(
HANDLE hObject,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
HANDLE hObject,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
LPCWSTR lpProvider,
LPCWSTR lpProperty,
PACTRL_ACCESSW *ppAccessList,
PACTRL_AUDITW *ppAuditList,
LPWSTR *lppOwner,
LPCWSTR lpProperty,
PACTRL_ACCESSW *ppAccessList,
PACTRL_AUDITW *ppAuditList,
LPWSTR *lppOwner,
LPWSTR *lppGroup
)
{
DPRINT1("GetSecurityInfoExW stub!\n");
return ERROR_BAD_PROVIDER;
return ERROR_BAD_PROVIDER;
}

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/advapi32/service/sctrl.c

View file

@ -1,5 +1,5 @@
/* $Id$
*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/advapi32/service/undoc.c

View file

@ -1,4 +1,4 @@
/* $Id$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries

View file

@ -261,7 +261,7 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
HANDLE NewToken;
NTSTATUS Status;
SECURITY_QUALITY_OF_SERVICE Sqos;
Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
Sqos.ImpersonationLevel = ImpersonationLevel;
Sqos.ContextTrackingMode = 0;
@ -285,7 +285,7 @@ DuplicateTokenEx (IN HANDLE ExistingTokenHandle,
}
ObjectAttributes.SecurityQualityOfService = &Sqos;
Status = NtDuplicateToken (ExistingTokenHandle,
dwDesiredAccess,
&ObjectAttributes,
@ -334,26 +334,26 @@ CheckTokenMembership (HANDLE ExistingTokenHandle,
DWORD i;
PTOKEN_GROUPS lpGroups = NULL;
TOKEN_TYPE TokenInformation;
if (IsMember == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (ExistingTokenHandle == NULL)
{
/* Get impersonation token of the calling thread */
if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &ExistingTokenHandle))
return FALSE;
if (!DuplicateToken(ExistingTokenHandle, SecurityAnonymous, &AccessToken))
{
CloseHandle(ExistingTokenHandle);
goto ByeBye;
}
CloseHandle(ExistingTokenHandle);
ReleaseToken = TRUE;
ReleaseToken = TRUE;
}
else
{
@ -369,7 +369,7 @@ CheckTokenMembership (HANDLE ExistingTokenHandle,
else
AccessToken = ExistingTokenHandle;
}
*IsMember = FALSE;
/* Search in groups of the token */
if (!GetTokenInformation(AccessToken, TokenGroups, NULL, 0, &dwSize))
@ -391,13 +391,13 @@ CheckTokenMembership (HANDLE ExistingTokenHandle,
/* FIXME: Search in users of the token? */
DPRINT1("CheckTokenMembership() partially implemented!\n");
Result = TRUE;
ByeBye:
if (lpGroups != NULL)
HeapFree(GetProcessHeap(), 0, lpGroups);
if (ReleaseToken)
CloseHandle(AccessToken);
return Result;
}

View file

@ -108,7 +108,7 @@ static void init_function_pointers(void)
static void init_environment(void)
{
HCRYPTPROV hProv;
/* Ensure that container "wine_test_keyset" does exist */
if (!pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0))
{
@ -155,39 +155,39 @@ static void test_acquire_context(void)
BOOL result;
HCRYPTPROV hProv;
/* Provoke all kinds of error conditions (which are easy to provoke).
/* Provoke all kinds of error conditions (which are easy to provoke).
* The order of the error tests seems to match Windows XP's rsaenh.dll CSP,
* but since this is likely to change between CSP versions, we don't check
* this. Please don't change the order of tests. */
result = pCryptAcquireContextA(&hProv, NULL, NULL, 0, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError());
result = pCryptAcquireContextA(&hProv, NULL, NULL, 1000, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError());
result = pCryptAcquireContextA(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%ld\n", GetLastError());
result = pCryptAcquireContextA(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%ld\n", GetLastError());
result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%ld\n", GetLastError());
/* This test fails under Win2k SP4:
result = TRUE, GetLastError() == ERROR_INVALID_PARAMETER
SetLastError(0xdeadbeef);
result = pCryptAcquireContextA(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d/%ld\n", result, GetLastError());
*/
/* Last not least, try to really acquire a context. */
hProv = 0;
SetLastError(0xdeadbeef);
result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0);
ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError());
if (hProv)
if (hProv)
pCryptReleaseContext(hProv, 0);
/* Try again, witch an empty ("\0") szProvider parameter */
@ -196,7 +196,7 @@ static void test_acquire_context(void)
result = pCryptAcquireContextA(&hProv, szKeySet, "", PROV_RSA_FULL, 0);
ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError());
if (hProv)
if (hProv)
pCryptReleaseContext(hProv, 0);
}
@ -209,17 +209,17 @@ static void test_incorrect_api_usage(void)
BYTE temp;
DWORD dwLen, dwTemp;
/* This is to document incorrect api usage in the
/* This is to document incorrect api usage in the
* "Uru - Ages beyond Myst Demo" installer as reported by Paul Vriens.
*
* The installer destroys a hash object after having released the context
* with which the hash was created. This is not allowed according to MSDN,
* since CryptReleaseContext destroys all hash and key objects belonging to
* the respective context. However, while wine used to crash, Windows is more
* The installer destroys a hash object after having released the context
* with which the hash was created. This is not allowed according to MSDN,
* since CryptReleaseContext destroys all hash and key objects belonging to
* the respective context. However, while wine used to crash, Windows is more
* robust here and returns an ERROR_INVALID_PARAMETER code.
*/
result = pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv,
result = pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
ok (result, "%08lx\n", GetLastError());
if (!result) return;
@ -239,15 +239,15 @@ static void test_incorrect_api_usage(void)
result = pCryptDestroyKey(hKey2);
ok (result, "%ld\n", GetLastError());
dwTemp = CRYPT_MODE_ECB;
dwTemp = CRYPT_MODE_ECB;
result = pCryptSetKeyParam(hKey2, KP_MODE, (BYTE*)&dwTemp, sizeof(DWORD));
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
result = pCryptAcquireContextA(&hProv2, szBadKeySet, NULL, PROV_RSA_FULL,
result = pCryptAcquireContextA(&hProv2, szBadKeySet, NULL, PROV_RSA_FULL,
CRYPT_DELETEKEYSET);
ok (result, "%ld\n", GetLastError());
if (!result) return;
result = pCryptReleaseContext(hProv, 0);
ok (result, "%ld\n", GetLastError());
if (!result) return;
@ -303,7 +303,7 @@ static void test_incorrect_api_usage(void)
dwLen = 1;
result = pCryptGetProvParam(hProv, 0, &temp, &dwLen, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
result = pCryptGetUserKey(hProv, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
@ -336,37 +336,37 @@ static void test_incorrect_api_usage(void)
result = pCryptDestroyHash(hHash);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
result = pCryptDestroyKey(hKey);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
}
static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName,
static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName,
DWORD *pcbProvName, DWORD *pdwProvCount)
{
HKEY hKey;
HKEY subkey;
DWORD size = sizeof(DWORD);
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider", &hKey))
return FALSE;
RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName,
RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwProvCount, pcbProvName,
NULL, NULL, NULL, NULL, NULL, NULL);
(*pcbProvName)++;
if (!(*pszProvName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbProvName))))
return FALSE;
RegEnumKeyEx(hKey, dwIndex, *pszProvName, pcbProvName, NULL, NULL, NULL, NULL);
(*pcbProvName)++;
RegOpenKey(hKey, *pszProvName, &subkey);
RegQueryValueEx(subkey, "Type", NULL, NULL, (BYTE*)pdwProvType, &size);
RegCloseKey(subkey);
RegCloseKey(hKey);
return TRUE;
}
@ -378,7 +378,7 @@ static void test_enum_providers(void)
DWORD dwType;
DWORD provCount;
DWORD dwIndex = 0;
/* actual results */
CHAR *provider = NULL;
DWORD providerLen;
@ -387,24 +387,24 @@ static void test_enum_providers(void)
BOOL result;
DWORD notNull = 5;
DWORD notZeroFlags = 5;
if(!pCryptEnumProvidersA)
{
trace("skipping CryptEnumProviders tests\n");
return;
}
if (!FindProvRegVals(dwIndex, &dwType, &pszProvName, &cbName, &provCount))
return;
/* check pdwReserved flag for NULL */
result = pCryptEnumProvidersA(dwIndex, &notNull, 0, &type, NULL, &providerLen);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
/* check dwFlags == 0 */
result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen);
ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError());
/* alloc provider to half the size required
* cbName holds the size required */
providerLen = cbName / 2;
@ -417,7 +417,7 @@ static void test_enum_providers(void)
LocalFree(provider);
/* loop through the providers to get the number of providers
/* loop through the providers to get the number of providers
* after loop ends, count should be provCount + 1 so subtract 1
* to get actual number of providers */
count = 0;
@ -425,48 +425,48 @@ static void test_enum_providers(void)
;
count--;
ok(count==provCount, "expected %i, got %i\n", (int)provCount, (int)count);
/* loop past the actual number of providers to get the error
* ERROR_NO_MORE_ITEMS */
for (count = 0; count < provCount + 1; count++)
result = pCryptEnumProvidersA(count, NULL, 0, &type, NULL, &providerLen);
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
ERROR_NO_MORE_ITEMS, GetLastError());
/* check expected versus actual values returned */
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, NULL, &providerLen);
ok(result && providerLen==cbName, "expected %i, got %i\n", (int)cbName, (int)providerLen);
if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen))))
return;
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen);
ok(result && type==dwType, "expected %ld, got %ld\n",
ok(result && type==dwType, "expected %ld, got %ld\n",
dwType, type);
ok(result && !strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider);
ok(result && cbName==providerLen, "expected %ld, got %ld\n",
ok(result && cbName==providerLen, "expected %ld, got %ld\n",
cbName, providerLen);
LocalFree(provider);
}
static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName,
static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName,
DWORD *pcbTypeName, DWORD *pdwTypeCount)
{
HKEY hKey;
HKEY hSubKey;
PSTR ch;
if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey))
return FALSE;
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL,
NULL, NULL, NULL, NULL, NULL))
return FALSE;
(*pcbTypeName)++;
if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
return FALSE;
if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL))
return FALSE;
(*pcbTypeName)++;
@ -475,22 +475,22 @@ static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTy
*pdwProvType = *(--ch) - '0';
*pdwProvType += (*(--ch) - '0') * 10;
*pdwProvType += (*(--ch) - '0') * 100;
if (RegOpenKey(hKey, *pszTypeName, &hSubKey))
return FALSE;
if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName))
return FALSE;
if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))))
return FALSE;
if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, *pszTypeName, pcbTypeName))
return FALSE;
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return TRUE;
}
@ -501,7 +501,7 @@ static void test_enum_provider_types()
LPSTR pszTypeName = NULL;
DWORD cbTypeName;
DWORD dwTypeCount;
/* actual values */
DWORD index = 0;
DWORD provType;
@ -511,29 +511,29 @@ static void test_enum_provider_types()
DWORD result;
DWORD notNull = 5;
DWORD notZeroFlags = 5;
if(!pCryptEnumProviderTypesA)
{
trace("skipping CryptEnumProviderTypes tests\n");
return;
}
if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount))
{
trace("could not find provider types in registry, skipping the test\n");
return;
}
/* check pdwReserved for NULL */
result = pCryptEnumProviderTypesA(index, &notNull, 0, &provType, typeName, &typeNameSize);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
ERROR_INVALID_PARAMETER, GetLastError());
/* check dwFlags == zero */
result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize);
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %ld\n",
ERROR_INVALID_PARAMETER, GetLastError());
/* alloc provider type to half the size required
* cbTypeName holds the size required */
typeNameSize = cbTypeName / 2;
@ -547,10 +547,10 @@ static void test_enum_provider_types()
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n",
result, GetLastError());
*/
LocalFree(typeName);
/* loop through the provider types to get the number of provider types
/* loop through the provider types to get the number of provider types
* after loop ends, count should be dwTypeCount + 1 so subtract 1
* to get actual number of provider types */
typeCount = 0;
@ -558,21 +558,21 @@ static void test_enum_provider_types()
;
typeCount--;
ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount);
/* loop past the actual number of provider types to get the error
* ERROR_NO_MORE_ITEMS */
for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++)
result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize);
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n",
ERROR_NO_MORE_ITEMS, GetLastError());
/* check expected versus actual values returned */
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize);
ok(result && typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize);
if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize))))
return;
typeNameSize = 0xdeadbeef;
result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize);
ok(result, "expected TRUE, got %ld\n", result);
@ -580,7 +580,7 @@ static void test_enum_provider_types()
if (pszTypeName)
ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName);
ok(typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize);
LocalFree(typeName);
}
@ -590,10 +590,10 @@ static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvN
PSTR keyname;
PSTR ptr;
DWORD user = dwFlags & CRYPT_USER_DEFAULT;
LPSTR MACHINESTR = "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types\\Type XXX";
LPSTR USERSTR = "Software\\Microsoft\\Cryptography\\Provider Type XXX";
keyname = LocalAlloc(LMEM_ZEROINIT, (user ? strlen(USERSTR) : strlen(MACHINESTR)) + 1);
if (keyname)
{
@ -604,33 +604,33 @@ static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvN
*(--ptr) = (dwProvType / 100) + '0';
} else
return FALSE;
if (RegOpenKey((dwFlags & CRYPT_USER_DEFAULT) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE ,keyname, &hKey))
{
LocalFree(keyname);
return FALSE;
}
LocalFree(keyname);
if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName))
{
if (GetLastError() != ERROR_MORE_DATA)
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
return FALSE;
}
if (!(*pszProvName = LocalAlloc(LMEM_ZEROINIT, *pcbProvName)))
return FALSE;
if (RegQueryValueEx(hKey, "Name", NULL, NULL, *pszProvName, pcbProvName))
{
if (GetLastError() != ERROR_MORE_DATA)
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
return FALSE;
}
RegCloseKey(hKey);
return TRUE;
}
@ -641,7 +641,7 @@ static void test_get_default_provider()
DWORD dwFlags = CRYPT_MACHINE_DEFAULT;
LPSTR pszProvName = NULL;
DWORD cbProvName;
/* actual results */
DWORD provType = PROV_RSA_FULL;
DWORD flags = CRYPT_MACHINE_DEFAULT;
@ -649,27 +649,27 @@ static void test_get_default_provider()
DWORD provNameSize;
DWORD result;
DWORD notNull = 5;
if(!pCryptGetDefaultProviderA)
{
trace("skipping CryptGetDefaultProvider tests\n");
return;
}
FindDfltProvRegVals(dwProvType, dwFlags, &pszProvName, &cbProvName);
/* check pdwReserved for NULL */
result = pCryptGetDefaultProviderA(provType, &notNull, flags, provName, &provNameSize);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
ERROR_INVALID_PARAMETER, GetLastError());
/* check for invalid flag */
flags = 0xdeadbeef;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %ld, got %ld\n",
NTE_BAD_FLAGS, GetLastError());
flags = CRYPT_MACHINE_DEFAULT;
/* check for invalid prov type */
provType = 0xdeadbeef;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
@ -678,29 +678,29 @@ static void test_get_default_provider()
"expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n",
result, GetLastError());
provType = PROV_RSA_FULL;
SetLastError(0);
/* alloc provName to half the size required
* cbProvName holds the size required */
provNameSize = cbProvName / 2;
if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize)))
return;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n",
ERROR_MORE_DATA, GetLastError());
LocalFree(provName);
/* check expected versus actual values returned */
result = pCryptGetDefaultProviderA(provType, NULL, flags, NULL, &provNameSize);
ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize);
provNameSize = cbProvName;
if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize)))
return;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(result && !strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName);
ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize);
@ -712,11 +712,11 @@ static void test_set_provider_ex()
{
DWORD result;
DWORD notNull = 5;
/* results */
LPSTR pszProvName = NULL;
DWORD cbProvName;
if(!pCryptGetDefaultProviderA || !pCryptSetProviderExA)
{
trace("skipping CryptSetProviderEx tests\n");
@ -734,7 +734,7 @@ static void test_set_provider_ex()
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT);
ok(result, "%ld\n", GetLastError());
/* call CryptGetDefaultProvider to see if they match */
result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName);
if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName)))
@ -756,7 +756,7 @@ START_TEST(crypt)
test_incorrect_api_usage();
clean_up_environment();
}
test_enum_providers();
test_enum_provider_types();
test_get_default_provider();

View file

@ -32,7 +32,7 @@ static void test_SystemFunction006()
static unsigned char lmhash[16 + 1];
unsigned char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned char expect[] =
unsigned char expect[] =
{ 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb,
0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee };
@ -55,7 +55,7 @@ START_TEST(crypt_lmhash)
if (!pSystemFunction006) goto out;
if (pSystemFunction006)
if (pSystemFunction006)
test_SystemFunction006();
out:

View file

@ -55,7 +55,7 @@ void test_md4_ctx()
HMODULE module;
MD4_CTX ctx;
MD4_CTX ctx_initialized =
MD4_CTX ctx_initialized =
{
{ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 },
{ 0, 0 }

View file

@ -55,7 +55,7 @@ void test_md5_ctx()
HMODULE module;
MD5_CTX ctx;
MD5_CTX ctx_initialized =
MD5_CTX ctx_initialized =
{
{ 0, 0 },
{ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }

View file

@ -64,14 +64,14 @@ static void create_test_entries(void)
SetEnvironmentVariableA("LONGSYSTEMVAR", "bar");
SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString");
ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1),
ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1),
"RegSetValueExA failed\n");
ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1),
ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1),
"RegSetValueExA failed\n");
ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1),
ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1),
"RegSetValueExA failed\n");
}
static void test_enum_value(void)
{
DWORD res;
@ -248,7 +248,7 @@ static void test_query_value_ex()
DWORD ret;
DWORD size;
DWORD type;
ret = RegQueryValueExA(hkey_main, "Test2", NULL, &type, NULL, &size);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(size == strlen(sTestpath1) + 1, "(%ld,%ld)\n", (DWORD)strlen(sTestpath1) + 1, size);
@ -341,7 +341,7 @@ static void test_reg_close_key()
ret = RegCloseKey(hkHandle); /* Windows 95 doesn't mind. */
ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_SUCCESS,
"expected ERROR_INVALID_HANDLE or ERROR_SUCCESS, got %ld\n", ret);
/* try to close a NULL handle */
ret = RegCloseKey(NULL);
ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */
@ -406,7 +406,7 @@ static BOOL set_privileges(LPCSTR privilege, BOOL set)
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
if (set)
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
else

View file

@ -169,7 +169,7 @@ void test_trustee()
pBuildTrusteeWithSidA( &trustee, psid );
ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n");
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
"MultipleTrusteeOperation wrong\n");
ok( trustee.TrusteeForm == TRUSTEE_IS_SID, "TrusteeForm wrong\n");
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
@ -181,13 +181,13 @@ void test_trustee()
pBuildTrusteeWithNameA( &trustee, str );
ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n");
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
"MultipleTrusteeOperation wrong\n");
ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n");
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
ok( trustee.ptstrName == str, "ptstrName wrong\n" );
}
/* If the first isn't defined, assume none is */
#ifndef SE_MIN_WELL_KNOWN_PRIVILEGE
#define SE_MIN_WELL_KNOWN_PRIVILEGE 2L
@ -425,9 +425,9 @@ static void test_FileSecurity(void)
SetLastError(NO_ERROR);
result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize);
ok(!result, "GetFileSecurityA should fail for not existing directories/files\n");
ok(!result, "GetFileSecurityA should fail for not existing directories/files\n");
ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) ||
(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ,
(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ,
"last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) "
"expected, got %ld\n", GetLastError());
}