advapi32/tests: Win64 printf format warning fixes.

This commit is contained in:
Hans Leidekker 2006-10-04 12:37:30 +02:00 committed by Alexandre Julliard
parent 94a9b5a2bf
commit 53535d6e13
5 changed files with 278 additions and 279 deletions

View File

@ -5,7 +5,6 @@ VPATH = @srcdir@
TESTDLL = advapi32.dll
IMPORTS = ole32 advapi32 kernel32
EXTRALIBS = -luuid
EXTRADEFS = -DWINE_NO_LONG_AS_INT
CTESTS = \
crypt.c \

View File

@ -161,25 +161,25 @@ static void test_acquire_context(void)
* 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());
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%d\n", GetLastError());
result = pCryptAcquireContextA(&hProv, NULL, NULL, 1000, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%ld\n", GetLastError());
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%d\n", GetLastError());
result = pCryptAcquireContextA(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%ld\n", GetLastError());
ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%d\n", GetLastError());
result = pCryptAcquireContextA(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%ld\n", GetLastError());
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%d\n", GetLastError());
result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%ld\n", GetLastError());
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%d\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());
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d/%d\n", result, GetLastError());
*/
/* Last not least, try to really acquire a context. */
@ -191,7 +191,7 @@ static void test_acquire_context(void)
GLE == ERROR_SUCCESS ||
GLE == ERROR_RING2_STACK_IN_USE ||
GLE == NTE_FAIL ||
GLE == ERROR_NOT_LOGGED_ON), "%d/%ld\n", result, GLE);
GLE == ERROR_NOT_LOGGED_ON), "%d/%d\n", result, GLE);
if (hProv)
pCryptReleaseContext(hProv, 0);
@ -205,7 +205,7 @@ static void test_acquire_context(void)
GLE == ERROR_SUCCESS ||
GLE == ERROR_RING2_STACK_IN_USE ||
GLE == NTE_FAIL ||
GLE == ERROR_NOT_LOGGED_ON), "%d/%ld\n", result, GetLastError());
GLE == ERROR_NOT_LOGGED_ON), "%d/%d\n", result, GetLastError());
if (hProv)
pCryptReleaseContext(hProv, 0);
@ -232,124 +232,124 @@ static void test_incorrect_api_usage(void)
result = pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
ok (result, "%08lx\n", GetLastError());
ok (result, "%08x\n", GetLastError());
if (!result) return;
result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
if (!result) return;
result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
if (!result) return;
result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
if (!result) return;
result = pCryptDestroyKey(hKey2);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
dwTemp = CRYPT_MODE_ECB;
result = pCryptSetKeyParam(hKey2, KP_MODE, (BYTE*)&dwTemp, sizeof(DWORD));
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptAcquireContextA(&hProv2, szBadKeySet, NULL, PROV_RSA_FULL,
CRYPT_DELETEKEYSET);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
if (!result) return;
result = pCryptReleaseContext(hProv, 0);
ok (result, "%ld\n", GetLastError());
ok (result, "%d\n", GetLastError());
if (!result) return;
result = pCryptReleaseContext(hProv, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptGenRandom(hProv, 1, &temp);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
#ifdef CRASHES_ON_NT40
result = pCryptContextAddRef(hProv, NULL, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
#endif
result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen, 1);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptDeriveKey(hProv, CALG_RC4, hHash, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
#ifdef CRASHES_ON_NT40
result = pCryptDuplicateHash(hHash, NULL, 0, &hHash2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptDuplicateKey(hKey, NULL, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
#endif
dwLen = 1;
result = pCryptExportKey(hKey, (HCRYPTPROV)NULL, 0, 0, &temp, &dwLen);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptGetHashParam(hHash, 0, &temp, &dwLen, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptGetKeyParam(hKey, 0, &temp, &dwLen, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptGetProvParam(hProv, 0, &temp, &dwLen, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptGetUserKey(hProv, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptHashData(hHash, &temp, 1, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptHashSessionKey(hHash, hKey, 0);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptImportKey(hProv, &temp, 1, (HCRYPTKEY)NULL, 0, &hKey2);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
dwLen = 1;
result = pCryptSignHashW(hHash, 0, NULL, 0, &temp, &dwLen);
ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError());
GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%d\n", GetLastError());
result = pCryptSetKeyParam(hKey, 0, &temp, 1);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptSetHashParam(hHash, 0, &temp, 1);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptSetProvParam(hProv, 0, &temp, 1);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptVerifySignatureW(hHash, &temp, 1, hKey, NULL, 0);
ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError());
GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%d\n", GetLastError());
result = pCryptDestroyHash(hHash);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
result = pCryptDestroyKey(hKey);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
}
static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName,
@ -413,11 +413,11 @@ static void test_enum_providers(void)
/* check pdwReserved flag for NULL */
result = pCryptEnumProvidersA(dwIndex, &notNull, 0, &type, NULL, &providerLen);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError());
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
/* check dwFlags == 0 */
result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen);
ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError());
ok(!result && GetLastError()==NTE_BAD_FLAGS, "%d\n", GetLastError());
/* alloc provider to half the size required
* cbName holds the size required */
@ -426,7 +426,7 @@ static void test_enum_providers(void)
return;
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen);
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %d\n",
ERROR_MORE_DATA, GetLastError());
LocalFree(provider);
@ -444,7 +444,7 @@ static void test_enum_providers(void)
* 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 %d\n",
ERROR_NO_MORE_ITEMS, GetLastError());
/* check expected versus actual values returned */
@ -455,11 +455,11 @@ static void test_enum_providers(void)
providerLen = 0xdeadbeef;
result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen);
ok(result, "expected TRUE, got %ld\n", result);
ok(type==dwType, "expected %ld, got %ld\n", dwType, type);
ok(result, "expected TRUE, got %d\n", result);
ok(type==dwType, "expected %d, got %d\n", dwType, type);
if (pszProvName)
ok(!strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider);
ok(cbName==providerLen, "expected %ld, got %ld\n", cbName, providerLen);
ok(cbName==providerLen, "expected %d, got %d\n", cbName, providerLen);
LocalFree(provider);
}
@ -541,12 +541,12 @@ static void test_enum_provider_types(void)
/* 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 %d\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",
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %d\n",
ERROR_INVALID_PARAMETER, GetLastError());
/* alloc provider type to half the size required
@ -572,29 +572,29 @@ static void test_enum_provider_types(void)
while(pCryptEnumProviderTypesA(typeCount++, NULL, 0, &provType, NULL, &typeNameSize))
;
typeCount--;
ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount);
ok(typeCount==dwTypeCount, "expected %d, got %d\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 %d\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);
ok(result && typeNameSize==cbTypeName, "expected %d, got %d\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);
ok(provType==dwProvType, "expected %ld, got %ld\n", dwProvType, provType);
ok(result, "expected TRUE, got %d\n", result);
ok(provType==dwProvType, "expected %d, got %d\n", dwProvType, provType);
if (pszTypeName)
ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName);
ok(typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize);
ok(typeNameSize==cbTypeName, "expected %d, got %d\n", cbTypeName, typeNameSize);
LocalFree(typeName);
}
@ -679,13 +679,13 @@ static void test_get_default_provider(void)
/* check pdwReserved for NULL */
result = pCryptGetDefaultProviderA(provType, &notNull, flags, provName, &provNameSize);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %d\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",
ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %d, got %d\n",
NTE_BAD_FLAGS, GetLastError());
flags = CRYPT_MACHINE_DEFAULT;
@ -694,7 +694,7 @@ static void test_get_default_provider(void)
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(!result && (GetLastError() == NTE_BAD_PROV_TYPE ||
GetLastError() == ERROR_INVALID_PARAMETER),
"expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n",
"expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %d/%d\n",
result, GetLastError());
provType = PROV_RSA_FULL;
@ -707,14 +707,14 @@ static void test_get_default_provider(void)
return;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %d\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);
ok(result && provNameSize==cbProvName, "expected %d, got %d\n", cbProvName, provNameSize);
provNameSize = cbProvName;
if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize)))
@ -722,10 +722,10 @@ static void test_get_default_provider(void)
provNameSize = 0xdeadbeef;
result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize);
ok(result, "expected TRUE, got %ld\n", result);
ok(result, "expected TRUE, got %d\n", result);
if(pszProvName)
ok(!strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName);
ok(provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize);
ok(provNameSize==cbProvName, "expected %d, got %d\n", cbProvName, provNameSize);
LocalFree(provName);
}
@ -747,15 +747,15 @@ static void test_set_provider_ex(void)
/* check pdwReserved for NULL */
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, &notNull, CRYPT_MACHINE_DEFAULT);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n",
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %d\n",
ERROR_INVALID_PARAMETER, GetLastError());
/* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT);
ok(result, "%ld\n", GetLastError());
ok(result, "%d\n", GetLastError());
result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT);
ok(result, "%ld\n", GetLastError());
ok(result, "%d\n", GetLastError());
/* call CryptGetDefaultProvider to see if they match */
result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName);
@ -764,7 +764,7 @@ static void test_set_provider_ex(void)
result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName);
ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName);
ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %ld\n", (lstrlenA(MS_DEF_PROV) + 1), cbProvName);
ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %d\n", (lstrlenA(MS_DEF_PROV) + 1), cbProvName);
LocalFree(pszProvName);
}

View File

@ -71,13 +71,13 @@ static void test_lsa(void)
status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle);
ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status);
"LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x\n", status);
/* try a more restricted access mask if necessary */
if (status == STATUS_ACCESS_DENIED) {
trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION\n");
status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_VIEW_LOCAL_INFORMATION, &handle);
ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08x\n", status);
}
if (status == STATUS_SUCCESS) {
@ -87,13 +87,13 @@ static void test_lsa(void)
PPOLICY_DNS_DOMAIN_INFO dns_domain_info;
status = pLsaQueryInformationPolicy(handle, PolicyAuditEventsInformation, (PVOID*)&audit_events_info);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAuditEventsInformation) failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAuditEventsInformation) failed, returned 0x%08x\n", status);
if (status == STATUS_SUCCESS) {
pLsaFreeMemory((LPVOID)audit_events_info);
}
status = pLsaQueryInformationPolicy(handle, PolicyPrimaryDomainInformation, (PVOID*)&primary_domain_info);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyPrimaryDomainInformation) failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyPrimaryDomainInformation) failed, returned 0x%08x\n", status);
if (status == STATUS_SUCCESS) {
ok(primary_domain_info->Sid==0,"Sid should be NULL on the local computer\n");
if (primary_domain_info->Sid) {
@ -119,7 +119,7 @@ static void test_lsa(void)
}
status = pLsaQueryInformationPolicy(handle, PolicyAccountDomainInformation, (PVOID*)&account_domain_info);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) failed, returned 0x%08x\n", status);
if (status == STATUS_SUCCESS) {
pLsaFreeMemory((LPVOID)account_domain_info);
}
@ -127,7 +127,7 @@ static void test_lsa(void)
/* This isn't supported in NT4 */
status = pLsaQueryInformationPolicy(handle, PolicyDnsDomainInformation, (PVOID*)&dns_domain_info);
ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER,
"LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08lx\n", status);
"LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08x\n", status);
if (status == STATUS_SUCCESS) {
ok(IsEqualGUID(&dns_domain_info->DomainGuid, &GUID_NULL), "DomainGUID should be GUID_NULL on local computer\n");
ok(dns_domain_info->Sid==0,"Sid should be NULL on the local computer\n");
@ -173,7 +173,7 @@ static void test_lsa(void)
}
status = pLsaClose(handle);
ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08x\n", status);
}
}

View File

@ -68,14 +68,14 @@ static void test_hkey_main_Value_A(LPCSTR name, LPCSTR string)
ret = RegQueryValueExA(hkey_main, name, NULL, &type, NULL, &cbData);
GLE = GetLastError();
ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %ld, GLE=%ld\n", ret, GLE);
ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d, GLE=%d\n", ret, GLE);
if(GLE == ERROR_CALL_NOT_IMPLEMENTED) return;
str_byte_len = lstrlenA(string) + 1;
full_byte_len = sizeof(string);
ok(type == REG_SZ, "RegQueryValueExA returned type %ld\n", type);
ok(type == REG_SZ, "RegQueryValueExA returned type %d\n", type);
ok(cbData == full_byte_len || cbData == str_byte_len,
"cbData=%ld instead of %ld or %ld\n", cbData, full_byte_len, str_byte_len);
"cbData=%d instead of %d or %d\n", cbData, full_byte_len, str_byte_len);
}
static void test_hkey_main_Value_W(LPCWSTR name, LPCWSTR string)
@ -85,14 +85,14 @@ static void test_hkey_main_Value_W(LPCWSTR name, LPCWSTR string)
ret = RegQueryValueExW(hkey_main, name, NULL, &type, NULL, &cbData);
GLE = GetLastError();
ok(ret == ERROR_SUCCESS, "RegQueryValueExW failed: %ld, GLE=%ld\n", ret, GLE);
ok(ret == ERROR_SUCCESS, "RegQueryValueExW failed: %d, GLE=%d\n", ret, GLE);
if(GLE == ERROR_CALL_NOT_IMPLEMENTED) return;
str_byte_len = (lstrlenW(string) + 1) * sizeof(WCHAR);
full_byte_len = sizeof(string);
ok(type == REG_SZ, "RegQueryValueExW returned type %ld\n", type);
ok(type == REG_SZ, "RegQueryValueExW returned type %d\n", type);
ok(cbData == full_byte_len || cbData == str_byte_len,
"cbData=%ld instead of %ld or %ld\n", cbData, full_byte_len, str_byte_len);
"cbData=%d instead of %d or %d\n", cbData, full_byte_len, str_byte_len);
}
static void test_set_value(void)
@ -111,13 +111,13 @@ static void test_set_value(void)
/* test RegSetValueExA with normal string */
ret = RegSetValueExA(hkey_main, name1A, 0, REG_SZ, (const BYTE *)string1A, sizeof(string1A));
ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %ld, GLE=%ld\n", ret, GetLastError());
ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d, GLE=%d\n", ret, GetLastError());
test_hkey_main_Value_A(name1A, string1A);
test_hkey_main_Value_W(name1W, string1W);
/* test RegSetValueExA with intrazeroed string */
ret = RegSetValueExA(hkey_main, name2A, 0, REG_SZ, (const BYTE *)string2A, sizeof(string2A));
ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %ld, GLE=%ld\n", ret, GetLastError());
ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d, GLE=%d\n", ret, GetLastError());
test_hkey_main_Value_A(name1A, string1A);
test_hkey_main_Value_W(name1W, string1W);
@ -126,13 +126,13 @@ static void test_set_value(void)
/* test RegSetValueExW with normal string */
ret = RegSetValueExW(hkey_main, name1W, 0, REG_SZ, (const BYTE *)string1W, sizeof(string1W));
ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %ld, GLE=%ld\n", ret, GetLastError());
ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %d, GLE=%d\n", ret, GetLastError());
test_hkey_main_Value_A(name1A, string1A);
test_hkey_main_Value_W(name1W, string1W);
/* test RegSetValueExW with intrazeroed string */
ret = RegSetValueExW(hkey_main, name2W, 0, REG_SZ, (const BYTE *)string2W, sizeof(string2W));
ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %ld, GLE=%ld\n", ret, GetLastError());
ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %d, GLE=%d\n", ret, GetLastError());
test_hkey_main_Value_A(name1A, string1A);
test_hkey_main_Value_W(name1W, string1W);
}
@ -171,21 +171,21 @@ static void test_enum_value(void)
/* create the working key for new 'Test' value */
res = RegCreateKeyA( hkey_main, "TestKey", &test_key );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res);
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res);
/* check NULL data with zero length */
res = RegSetValueExA( test_key, "Test", 0, REG_SZ, NULL, 0 );
if (GetVersion() & 0x80000000)
ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res );
ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %d\n", res );
else
ok( !res, "RegSetValueExA returned %ld\n", res );
ok( !res, "RegSetValueExA returned %d\n", res );
res = RegSetValueExA( test_key, "Test", 0, REG_EXPAND_SZ, NULL, 0 );
ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res );
ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %d\n", res );
res = RegSetValueExA( test_key, "Test", 0, REG_BINARY, NULL, 0 );
ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res );
ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %d\n", res );
res = RegSetValueExA( test_key, "Test", 0, REG_SZ, (const BYTE *)"foobar", 7 );
ok( res == 0, "RegSetValueExA failed error %ld\n", res );
ok( res == 0, "RegSetValueExA failed error %d\n", res );
/* overflow both name and data */
val_count = 2;
@ -194,10 +194,10 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 2, "val_count set to %d\n", val_count );
ok( data_count == 7, "data_count set to %d instead of 7\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
@ -208,11 +208,11 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
/* Win9x returns 2 as specified by MSDN but NT returns 3... */
ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( val_count == 2 || val_count == 3, "val_count set to %d\n", val_count );
ok( data_count == 7, "data_count set to %d instead of 7\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
/* v5.1.2600.0 (XP Home and Proffesional) does not touch value or data in this case */
ok( !strcmp( value, "Te" ) || !strcmp( value, "xxxxxxxxxx" ),
"value set to '%s' instead of 'Te' or 'xxxxxxxxxx'\n", value );
@ -226,10 +226,10 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 0, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 0, "val_count set to %d\n", val_count );
ok( data_count == 7, "data_count set to %d instead of 7\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
/* v5.1.2600.0 (XP Home and Professional) does not touch data in this case */
ok( !strcmp( data, "foobar" ) || !strcmp( data, "xxxxxxx" ),
@ -242,10 +242,10 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 20, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 20, "val_count set to %d\n", val_count );
ok( data_count == 7, "data_count set to %d instead of 7\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
@ -256,10 +256,10 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, (LPBYTE)data, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res );
ok( val_count == 4, "val_count set to %d instead of 4\n", val_count );
ok( data_count == 7, "data_count set to %d instead of 7\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value );
ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data );
@ -269,7 +269,7 @@ static void test_enum_value(void)
res = RegSetValueExW( test_key, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) );
if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok( res == 0, "RegSetValueExW failed error %ld\n", res );
ok( res == 0, "RegSetValueExW failed error %d\n", res );
/* overflow both name and data */
val_count = 2;
@ -278,10 +278,10 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 2, "val_count set to %d\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
@ -292,10 +292,10 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 3, "val_count set to %d\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
@ -306,10 +306,10 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", res );
ok( val_count == 4, "val_count set to %d instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
@ -320,10 +320,10 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res );
ok( val_count == 4, "val_count set to %d instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %d is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" );
}
@ -336,22 +336,22 @@ static void test_query_value_ex(void)
BYTE buffer[10];
ret = RegQueryValueExA(hkey_main, "TP1_SZ", 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);
ok(type == REG_SZ, "type %ld is not REG_SZ\n", type);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(size == strlen(sTestpath1) + 1, "(%d,%d)\n", (DWORD)strlen(sTestpath1) + 1, size);
ok(type == REG_SZ, "type %d is not REG_SZ\n", type);
type = 0xdeadbeef;
size = 0xdeadbeef;
ret = RegQueryValueExA(HKEY_CLASSES_ROOT, "Non Existent Value", NULL, &type, NULL, &size);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
ok(size == 0, "size should have been set to 0 instead of %ld\n", size);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
ok(size == 0, "size should have been set to 0 instead of %d\n", size);
ok(type == (DWORD)HKEY_CLASSES_ROOT /* NT */ || type == 0 /* Win9x */,
"type should have been set to 0x80000000 or 0 instead of 0x%lx\n", type);
"type should have been set to 0x80000000 or 0 instead of 0x%x\n", type);
size = sizeof(buffer);
ret = RegQueryValueExA(HKEY_CLASSES_ROOT, "Non Existent Value", NULL, &type, buffer, &size);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
ok(size == sizeof(buffer), "size shouldn't have been changed to %ld\n", size);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
ok(size == sizeof(buffer), "size shouldn't have been changed to %d\n", size);
}
static void test_get_value(void)
@ -370,7 +370,7 @@ static void test_get_value(void)
hadvapi32 = LoadLibraryA("advapi32.dll");
if(!hadvapi32)
{
ok(0, "error=%ld\n", GetLastError());
ok(0, "error=%d\n", GetLastError());
return;
}
pRegGetValueA = (PVOID)GetProcAddress(hadvapi32, "RegGetValueA");
@ -380,116 +380,116 @@ static void test_get_value(void)
/* Query REG_DWORD using RRF_RT_REG_DWORD (ok) */
size = type = dw = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "DWORD", RRF_RT_REG_DWORD, &type, &dw, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == 4, "size=%ld\n", size);
ok(type == REG_DWORD, "type=%ld\n", type);
ok(dw == 0x12345678, "dw=%ld\n", dw);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == 4, "size=%d\n", size);
ok(type == REG_DWORD, "type=%d\n", type);
ok(dw == 0x12345678, "dw=%d\n", dw);
/* Query by subkey-name */
ret = pRegGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\Test", "DWORD", RRF_RT_REG_DWORD, NULL, NULL, NULL);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
/* Query REG_DWORD using RRF_RT_REG_BINARY (restricted) */
size = type = dw = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "DWORD", RRF_RT_REG_BINARY, &type, &dw, &size);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%ld\n", ret);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%d\n", ret);
/* Although the function failed all values are retrieved */
ok(size == 4, "size=%ld\n", size);
ok(type == REG_DWORD, "type=%ld\n", type);
ok(dw == 0x12345678, "dw=%ld\n", dw);
ok(size == 4, "size=%d\n", size);
ok(type == REG_DWORD, "type=%d\n", type);
ok(dw == 0x12345678, "dw=%d\n", dw);
/* Test RRF_ZEROONFAILURE */
type = dw = 0xdeadbeef; size = 4;
ret = pRegGetValueA(hkey_main, NULL, "DWORD", RRF_RT_REG_SZ|RRF_ZEROONFAILURE, &type, &dw, &size);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%ld\n", ret);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%d\n", ret);
/* Again all values are retrieved ... */
ok(size == 4, "size=%ld\n", size);
ok(type == REG_DWORD, "type=%ld\n", type);
ok(size == 4, "size=%d\n", size);
ok(type == REG_DWORD, "type=%d\n", type);
/* ... except the buffer, which is zeroed out */
ok(dw == 0, "dw=%ld\n", dw);
ok(dw == 0, "dw=%d\n", dw);
/* Query REG_DWORD using RRF_RT_DWORD (ok) */
size = type = dw = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "DWORD", RRF_RT_DWORD, &type, &dw, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == 4, "size=%ld\n", size);
ok(type == REG_DWORD, "type=%ld\n", type);
ok(dw == 0x12345678, "dw=%ld\n", dw);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == 4, "size=%d\n", size);
ok(type == REG_DWORD, "type=%d\n", type);
ok(dw == 0x12345678, "dw=%d\n", dw);
/* Query 32-bit REG_BINARY using RRF_RT_DWORD (ok) */
size = type = dw = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "BIN32", RRF_RT_DWORD, &type, &dw, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == 4, "size=%ld\n", size);
ok(type == REG_BINARY, "type=%ld\n", type);
ok(dw == 0x12345678, "dw=%ld\n", dw);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == 4, "size=%d\n", size);
ok(type == REG_BINARY, "type=%d\n", type);
ok(dw == 0x12345678, "dw=%d\n", dw);
/* Query 64-bit REG_BINARY using RRF_RT_DWORD (type mismatch) */
qw[0] = qw[1] = size = type = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "BIN64", RRF_RT_DWORD, &type, qw, &size);
ok(ret == ERROR_DATATYPE_MISMATCH, "ret=%ld\n", ret);
ok(size == 8, "size=%ld\n", size);
ok(type == REG_BINARY, "type=%ld\n", type);
ok(ret == ERROR_DATATYPE_MISMATCH, "ret=%d\n", ret);
ok(size == 8, "size=%d\n", size);
ok(type == REG_BINARY, "type=%d\n", type);
ok(qw[0] == 0x12345678 &&
qw[1] == 0x87654321, "qw={%ld,%ld}\n", qw[0], qw[1]);
qw[1] == 0x87654321, "qw={%d,%d}\n", qw[0], qw[1]);
/* Query 64-bit REG_BINARY using 32-bit buffer (buffer too small) */
type = dw = 0xdeadbeef; size = 4;
ret = pRegGetValueA(hkey_main, NULL, "BIN64", RRF_RT_REG_BINARY, &type, &dw, &size);
ok(ret == ERROR_MORE_DATA, "ret=%ld\n", ret);
ok(dw == 0xdeadbeef, "dw=%ld\n", dw);
ok(size == 8, "size=%ld\n", size);
ok(ret == ERROR_MORE_DATA, "ret=%d\n", ret);
ok(dw == 0xdeadbeef, "dw=%d\n", dw);
ok(size == 8, "size=%d\n", size);
/* Query 64-bit REG_BINARY using RRF_RT_QWORD (ok) */
qw[0] = qw[1] = size = type = 0xdeadbeef;
ret = pRegGetValueA(hkey_main, NULL, "BIN64", RRF_RT_QWORD, &type, qw, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == 8, "size=%ld\n", size);
ok(type == REG_BINARY, "type=%ld\n", type);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == 8, "size=%d\n", size);
ok(type == REG_BINARY, "type=%d\n", type);
ok(qw[0] == 0x12345678 &&
qw[1] == 0x87654321, "qw={%ld,%ld}\n", qw[0], qw[1]);
qw[1] == 0x87654321, "qw={%d,%d}\n", qw[0], qw[1]);
/* Query REG_SZ using RRF_RT_REG_SZ (ok) */
buf[0] = 0; type = 0xdeadbeef; size = sizeof(buf);
ret = pRegGetValueA(hkey_main, NULL, "TP1_SZ", RRF_RT_REG_SZ, &type, buf, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%ld\n", lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%ld\n", type);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%d\n", lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%d\n", type);
ok(!strcmp(sTestpath1, buf), "sTestpath=\"%s\" buf=\"%s\"\n", sTestpath1, buf);
/* Query REG_SZ using RRF_RT_REG_SZ|RRF_NOEXPAND (ok) */
buf[0] = 0; type = 0xdeadbeef; size = sizeof(buf);
ret = pRegGetValueA(hkey_main, NULL, "TP1_SZ", RRF_RT_REG_SZ|RRF_NOEXPAND, &type, buf, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%ld\n", lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%ld\n", type);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%d\n", lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%d\n", type);
ok(!strcmp(sTestpath1, buf), "sTestpath=\"%s\" buf=\"%s\"\n", sTestpath1, buf);
/* Query REG_EXPAND_SZ using RRF_RT_REG_SZ (ok, expands) */
buf[0] = 0; type = 0xdeadbeef; size = sizeof(buf);
ret = pRegGetValueA(hkey_main, NULL, "TP1_EXP_SZ", RRF_RT_REG_SZ, &type, buf, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
/* At least v5.2.3790.1830 (2003 SP1) returns the unexpanded sTestpath1 length + 1 here. */
ok((size == strlen(expanded)+1) || (size == strlen(sTestpath1)+1),
"strlen(expanded)=%d, strlen(sTestpath1)=%d, size=%ld\n", lstrlenA(expanded), lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%ld\n", type);
"strlen(expanded)=%d, strlen(sTestpath1)=%d, size=%d\n", lstrlenA(expanded), lstrlenA(sTestpath1), size);
ok(type == REG_SZ, "type=%d\n", type);
ok(!strcmp(expanded, buf), "expanded=\"%s\" buf=\"%s\"\n", expanded, buf);
/* Query REG_EXPAND_SZ using RRF_RT_REG_EXPAND_SZ|RRF_NOEXPAND (ok, doesn't expand) */
buf[0] = 0; type = 0xdeadbeef; size = sizeof(buf);
ret = pRegGetValueA(hkey_main, NULL, "TP1_EXP_SZ", RRF_RT_REG_EXPAND_SZ|RRF_NOEXPAND, &type, buf, &size);
ok(ret == ERROR_SUCCESS, "ret=%ld\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%ld\n", lstrlenA(sTestpath1), size);
ok(type == REG_EXPAND_SZ, "type=%ld\n", type);
ok(ret == ERROR_SUCCESS, "ret=%d\n", ret);
ok(size == strlen(sTestpath1)+1, "strlen(sTestpath1)=%d size=%d\n", lstrlenA(sTestpath1), size);
ok(type == REG_EXPAND_SZ, "type=%d\n", type);
ok(!strcmp(sTestpath1, buf), "sTestpath=\"%s\" buf=\"%s\"\n", sTestpath1, buf);
/* Query REG_EXPAND_SZ using RRF_RT_REG_SZ|RRF_NOEXPAND (type mismatch) */
ret = pRegGetValueA(hkey_main, NULL, "TP1_EXP_SZ", RRF_RT_REG_SZ|RRF_NOEXPAND, NULL, NULL, NULL);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%ld\n", ret);
ok(ret == ERROR_UNSUPPORTED_TYPE, "ret=%d\n", ret);
/* Query REG_EXPAND_SZ using RRF_RT_REG_EXPAND_SZ (not allowed without RRF_NOEXPAND) */
ret = pRegGetValueA(hkey_main, NULL, "TP1_EXP_SZ", RRF_RT_REG_EXPAND_SZ, NULL, NULL, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "ret=%ld\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "ret=%d\n", ret);
}
static void test_reg_open_key(void)
@ -500,7 +500,7 @@ static void test_reg_open_key(void)
/* successful open */
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(hkResult != NULL, "expected hkResult != NULL\n");
hkPreserve = hkResult;
@ -510,7 +510,7 @@ static void test_reg_open_key(void)
{
/* open same key twice */
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(hkResult != hkPreserve, "epxected hkResult != hkPreserve\n");
ok(hkResult != NULL, "hkResult != NULL\n");
RegCloseKey(hkResult);
@ -520,13 +520,13 @@ static void test_reg_open_key(void)
*/
hkResult = hkPreserve;
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
ok(hkResult == NULL, "expected hkResult == NULL\n");
/* open the same nonexistent key again to make sure the key wasn't created */
hkResult = hkPreserve;
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Nonexistent", &hkResult);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %ld\n", ret);
ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
ok(hkResult == NULL, "expected hkResult == NULL\n");
/* send in NULL lpSubKey
@ -534,13 +534,13 @@ static void test_reg_open_key(void)
*/
hkResult = hkPreserve;
ret = RegOpenKeyA(HKEY_CURRENT_USER, NULL, &hkResult);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n");
/* send empty-string in lpSubKey */
hkResult = hkPreserve;
ret = RegOpenKeyA(HKEY_CURRENT_USER, "", &hkResult);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(hkResult == HKEY_CURRENT_USER, "expected hkResult == HKEY_CURRENT_USER\n");
/* send in NULL lpSubKey and NULL hKey
@ -548,7 +548,7 @@ static void test_reg_open_key(void)
*/
hkResult = hkPreserve;
ret = RegOpenKeyA(NULL, NULL, &hkResult);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ok(hkResult == NULL, "expected hkResult == NULL\n");
}
@ -558,19 +558,19 @@ static void test_reg_open_key(void)
hkResult = hkPreserve;
ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", &hkResult);
ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret);
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n", ret);
ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n");
RegCloseKey(hkResult);
/* send in NULL hkResult */
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", ret);
/* beginning backslash character */
ret = RegOpenKeyA(HKEY_CURRENT_USER, "\\Software\\Wine\\Test", &hkResult);
ok(ret == ERROR_BAD_PATHNAME || /* NT/2k/XP */
ret == ERROR_FILE_NOT_FOUND /* Win9x,ME */
, "expected ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %ld\n", ret);
, "expected ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d\n", ret);
}
static void test_reg_create_key(void)
@ -578,11 +578,11 @@ static void test_reg_create_key(void)
LONG ret;
HKEY hkey1, hkey2;
ret = RegCreateKeyExA(hkey_main, "Subkey1", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL);
ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
/* should succeed: all versions of Windows ignore the access rights
* to the parent handle */
ret = RegCreateKeyExA(hkey1, "Subkey2", 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey2, NULL);
ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
/* clean up */
RegDeleteKey(hkey2, "");
@ -591,9 +591,9 @@ static void test_reg_create_key(void)
/* beginning backslash character */
ret = RegCreateKeyExA(hkey_main, "\\Subkey3", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL);
if (!(GetVersion() & 0x80000000))
ok(ret == ERROR_BAD_PATHNAME, "expected ERROR_BAD_PATHNAME, got %ld\n", ret);
ok(ret == ERROR_BAD_PATHNAME, "expected ERROR_BAD_PATHNAME, got %d\n", ret);
else {
ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
RegDeleteKey(hkey1, NULL);
}
}
@ -608,17 +608,17 @@ static void test_reg_close_key(void)
*/
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkHandle);
ret = RegCloseKey(hkHandle);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
/* try to close the key twice */
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);
"expected ERROR_INVALID_HANDLE or ERROR_SUCCESS, got %d\n", ret);
/* try to close a NULL handle */
ret = RegCloseKey(NULL);
ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret);
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n", ret);
}
static void test_reg_delete_key(void)
@ -629,7 +629,7 @@ static void test_reg_delete_key(void)
ok(ret == ERROR_INVALID_PARAMETER ||
ret == ERROR_ACCESS_DENIED ||
ret == ERROR_BADKEY, /* Win95 */
"ret=%ld\n", ret);
"ret=%d\n", ret);
}
static void test_reg_save_key(void)
@ -637,7 +637,7 @@ static void test_reg_save_key(void)
DWORD ret;
ret = RegSaveKey(hkey_main, "saved_key", NULL);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
}
static void test_reg_load_key(void)
@ -646,10 +646,10 @@ static void test_reg_load_key(void)
HKEY hkHandle;
ret = RegLoadKey(HKEY_LOCAL_MACHINE, "Test", "saved_key");
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
ret = RegOpenKey(HKEY_LOCAL_MACHINE, "Test", &hkHandle);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
RegCloseKey(hkHandle);
}
@ -659,7 +659,7 @@ static void test_reg_unload_key(void)
DWORD ret;
ret = RegUnLoadKey(HKEY_LOCAL_MACHINE, "Test");
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
DeleteFile("saved_key");
DeleteFile("saved_key.LOG");
@ -714,30 +714,30 @@ static void test_regconnectregistry( void)
DWORD GLE;
ret = GetComputerNameA(compName, &len);
ok( ret, "GetComputerName failed err = %ld\n", GetLastError());
ok( ret, "GetComputerName failed err = %d\n", GetLastError());
if( !ret) return;
lstrcpyA(netwName, "\\\\");
lstrcpynA(netwName+2, compName, MAX_COMPUTERNAME_LENGTH + 1);
retl = RegConnectRegistryA( compName, HKEY_LOCAL_MACHINE, &hkey);
ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %ld\n", retl);
ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %d\n", retl);
if( !retl) RegCloseKey( hkey);
retl = RegConnectRegistryA( netwName, HKEY_LOCAL_MACHINE, &hkey);
ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %ld\n", retl);
ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %d\n", retl);
if( !retl) RegCloseKey( hkey);
schnd = OpenSCManagerA( compName, NULL, GENERIC_READ);
GLE = GetLastError();
ok( schnd != NULL || GLE==ERROR_CALL_NOT_IMPLEMENTED,
"OpenSCManagerA failed err = %ld\n", GLE);
"OpenSCManagerA failed err = %d\n", GLE);
CloseServiceHandle( schnd);
schnd = OpenSCManagerA( netwName, NULL, GENERIC_READ);
GLE = GetLastError();
ok( schnd != NULL || GLE==ERROR_CALL_NOT_IMPLEMENTED,
"OpenSCManagerA failed err = %ld\n", GLE);
"OpenSCManagerA failed err = %d\n", GLE);
CloseServiceHandle( schnd);
}

View File

@ -104,7 +104,7 @@ static void test_str_sid(const char *str_sid)
else
{
if (GetLastError() != ERROR_INVALID_SID)
trace(" %s: couldn't be converted, returned %ld\n", str_sid, GetLastError());
trace(" %s: couldn't be converted, returned %d\n", str_sid, GetLastError());
else
trace(" %s: couldn't be converted\n", str_sid);
}
@ -140,24 +140,24 @@ static void test_sid(void)
if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED )
return;
ok( GetLastError() == ERROR_INVALID_PARAMETER,
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %d\n",
GetLastError() );
r = pConvertStringSidToSidA( refs[0].refStr, NULL );
ok( !r && GetLastError() == ERROR_INVALID_PARAMETER,
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %d\n",
GetLastError() );
r = pConvertStringSidToSidA( NULL, &str );
ok( !r && GetLastError() == ERROR_INVALID_PARAMETER,
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %ld\n",
"expected GetLastError() is ERROR_INVALID_PARAMETER, got %d\n",
GetLastError() );
r = pConvertStringSidToSidA( noSubAuthStr, &psid );
ok( !r,
"expected failure with no sub authorities\n" );
ok( GetLastError() == ERROR_INVALID_SID,
"expected GetLastError() is ERROR_INVALID_SID, got %ld\n",
"expected GetLastError() is ERROR_INVALID_SID, got %d\n",
GetLastError() );
for( i = 0; i < sizeof(refs) / sizeof(refs[0]); i++ )
@ -185,7 +185,7 @@ static void test_sid(void)
!memcmp( pisid->IdentifierAuthority.Value, refs[i].auth.Value,
sizeof(refs[i].auth) ),
"string sid %s didn't parse to expected value\n"
"(got 0x%04x%08lx, expected 0x%04x%08lx)\n",
"(got 0x%04x%08x, expected 0x%04x%08x)\n",
refs[i].refStr,
MAKEWORD( pisid->IdentifierAuthority.Value[1],
pisid->IdentifierAuthority.Value[0] ),
@ -443,17 +443,17 @@ static void test_allocateLuid(void)
return;
ok(ret,
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
"AllocateLocallyUniqueId failed: %d\n", GetLastError());
ret = pAllocateLocallyUniqueId(&luid2);
ok( ret,
"AllocateLocallyUniqueId failed: %ld\n", GetLastError());
"AllocateLocallyUniqueId failed: %d\n", GetLastError());
ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0,
"AllocateLocallyUniqueId returned a well-known LUID\n");
ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart,
"AllocateLocallyUniqueId returned non-unique LUIDs\n");
ret = pAllocateLocallyUniqueId(NULL);
ok( !ret && GetLastError() == ERROR_NOACCESS,
"AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n",
"AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %d\n",
GetLastError());
}
@ -479,18 +479,18 @@ static void test_lookupPrivilegeName(void)
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName);
ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n",
"LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %d\n",
GetLastError());
ok(cchName == strlen("SeCreateTokenPrivilege") + 1,
"LookupPrivilegeNameA returned an incorrect required length for\n"
"SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
"SeCreateTokenPrivilege (got %d, expected %d)\n", cchName,
lstrlenA("SeCreateTokenPrivilege") + 1);
/* check a known value and its returned length on success */
cchName = sizeof(buf);
ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) &&
cchName == strlen("SeCreateTokenPrivilege"),
"LookupPrivilegeNameA returned an incorrect output length for\n"
"SeCreateTokenPrivilege (got %ld, expected %d)\n", cchName,
"SeCreateTokenPrivilege (got %d, expected %d)\n", cchName,
(int)strlen("SeCreateTokenPrivilege"));
/* check known values */
for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++)
@ -499,21 +499,21 @@ static void test_lookupPrivilegeName(void)
cchName = sizeof(buf);
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
ok( ret || GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError());
"LookupPrivilegeNameA(0.%d) failed: %d\n", i, GetLastError());
}
/* check a bogus LUID */
luid.LowPart = 0xdeadbeef;
cchName = sizeof(buf);
ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
"LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %d\n",
GetLastError());
/* check on a bogus system */
luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
cchName = sizeof(buf);
ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName);
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
"LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
"LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %d\n",
GetLastError());
}
@ -571,22 +571,22 @@ static void test_lookupPrivilegeValue(void)
/* check a bogus system name */
ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid);
ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE,
"LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n",
"LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %d\n",
GetLastError());
/* check a NULL string */
ret = pLookupPrivilegeValueA(NULL, 0, &luid);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %d\n",
GetLastError());
/* check a bogus privilege name */
ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid);
ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE,
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n",
"LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %d\n",
GetLastError());
/* check case insensitive */
ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid);
ok( ret,
"LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n",
"LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %d\n",
GetLastError());
for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++)
{
@ -635,7 +635,7 @@ static void test_FileSecurity(void)
ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) ||
(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ,
"last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) "
"expected, got %ld\n", GetLastError());
"expected, got %d\n", GetLastError());
}
static void test_AccessCheck(void)
@ -674,38 +674,38 @@ static void test_AccessCheck(void)
trace("ACLs not implemented - skipping tests\n");
return;
}
ok(res, "InitializeAcl failed with error %ld\n", GetLastError());
ok(res, "InitializeAcl failed with error %d\n", GetLastError());
res = AllocateAndInitializeSid( &SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &EveryoneSid);
ok(res, "AllocateAndInitializeSid failed with error %ld\n", GetLastError());
ok(res, "AllocateAndInitializeSid failed with error %d\n", GetLastError());
res = AllocateAndInitializeSid( &SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdminSid);
ok(res, "AllocateAndInitializeSid failed with error %ld\n", GetLastError());
ok(res, "AllocateAndInitializeSid failed with error %d\n", GetLastError());
res = AllocateAndInitializeSid( &SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_USERS, 0, 0, 0, 0, 0, 0, &UsersSid);
ok(res, "AllocateAndInitializeSid failed with error %ld\n", GetLastError());
ok(res, "AllocateAndInitializeSid failed with error %d\n", GetLastError());
res = AddAccessAllowedAce(Acl, ACL_REVISION, KEY_READ, EveryoneSid);
ok(res, "AddAccessAllowedAceEx failed with error %ld\n", GetLastError());
ok(res, "AddAccessAllowedAceEx failed with error %d\n", GetLastError());
res = AddAccessAllowedAce(Acl, ACL_REVISION, KEY_ALL_ACCESS, AdminSid);
ok(res, "AddAccessAllowedAceEx failed with error %ld\n", GetLastError());
ok(res, "AddAccessAllowedAceEx failed with error %d\n", GetLastError());
SecurityDescriptor = HeapAlloc(GetProcessHeap(), 0, SECURITY_DESCRIPTOR_MIN_LENGTH);
res = InitializeSecurityDescriptor(SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
ok(res, "InitializeSecurityDescriptor failed with error %ld\n", GetLastError());
ok(res, "InitializeSecurityDescriptor failed with error %d\n", GetLastError());
res = SetSecurityDescriptorDacl(SecurityDescriptor, TRUE, Acl, FALSE);
ok(res, "SetSecurityDescriptorDacl failed with error %ld\n", GetLastError());
ok(res, "SetSecurityDescriptorDacl failed with error %d\n", GetLastError());
res = SetSecurityDescriptorOwner(SecurityDescriptor, AdminSid, FALSE);
ok(res, "SetSecurityDescriptorOwner failed with error %ld\n", GetLastError());
ok(res, "SetSecurityDescriptorOwner failed with error %d\n", GetLastError());
res = SetSecurityDescriptorGroup(SecurityDescriptor, UsersSid, TRUE);
ok(res, "SetSecurityDescriptorGroup failed with error %ld\n", GetLastError());
ok(res, "SetSecurityDescriptorGroup failed with error %d\n", GetLastError());
PrivSetLen = FIELD_OFFSET(PRIVILEGE_SET, Privilege[16]);
PrivSet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, PrivSetLen);
@ -717,29 +717,29 @@ static void test_AccessCheck(void)
ret = OpenThreadToken(GetCurrentThread(),
TOKEN_QUERY, TRUE, &Token);
ok(ret, "OpenThreadToken failed with error %ld\n", GetLastError());
ok(ret, "OpenThreadToken failed with error %d\n", GetLastError());
ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
ok(ret, "AccessCheck failed with error %ld\n", GetLastError());
ok(ret, "AccessCheck failed with error %d\n", GetLastError());
ok(AccessStatus && (Access == KEY_READ),
"AccessCheck failed to grant access with error %ld\n",
"AccessCheck failed to grant access with error %d\n",
GetLastError());
ret = AccessCheck(SecurityDescriptor, Token, MAXIMUM_ALLOWED, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
ok(ret, "AccessCheck failed with error %ld\n", GetLastError());
ok(ret, "AccessCheck failed with error %d\n", GetLastError());
ok(AccessStatus,
"AccessCheck failed to grant any access with error %ld\n",
"AccessCheck failed to grant any access with error %d\n",
GetLastError());
trace("AccessCheck with MAXIMUM_ALLOWED got Access 0x%08lx\n", Access);
trace("AccessCheck with MAXIMUM_ALLOWED got Access 0x%08x\n", Access);
SetLastError(0);
PrivSet->PrivilegeCount = 16;
ret = AccessCheck(SecurityDescriptor, Token, ACCESS_SYSTEM_SECURITY, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
ok(ret && !AccessStatus && GetLastError() == ERROR_PRIVILEGE_NOT_HELD,
"AccessCheck should have failed with ERROR_PRIVILEGE_NOT_HELD, instead of %ld\n",
"AccessCheck should have failed with ERROR_PRIVILEGE_NOT_HELD, instead of %d\n",
GetLastError());
ret = pRtlAdjustPrivilege(SE_SECURITY_PRIVILEGE, TRUE, TRUE, &Enabled);
@ -750,10 +750,10 @@ static void test_AccessCheck(void)
ret = AccessCheck(SecurityDescriptor, Token, ACCESS_SYSTEM_SECURITY, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
ok(ret && AccessStatus && GetLastError() == 0,
"AccessCheck should have succeeded, error %ld\n",
"AccessCheck should have succeeded, error %d\n",
GetLastError());
ok(Access == ACCESS_SYSTEM_SECURITY,
"Access should be equal to ACCESS_SYSTEM_SECURITY instead of 0x%08lx\n",
"Access should be equal to ACCESS_SYSTEM_SECURITY instead of 0x%08x\n",
Access);
}
else
@ -791,7 +791,7 @@ static void test_token_attr(void)
ret = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Token);
GLE = GetLastError();
ok(ret || (GLE == ERROR_CALL_NOT_IMPLEMENTED),
"OpenProcessToken failed with error %ld\n", GLE);
"OpenProcessToken failed with error %d\n", GLE);
if(!ret && (GLE == ERROR_CALL_NOT_IMPLEMENTED))
{
trace("OpenProcessToken() not implemented, skipping test_token_attr()\n");
@ -802,7 +802,7 @@ static void test_token_attr(void)
ret = GetTokenInformation(Token, TokenGroups, NULL, 0, &Size);
Groups = HeapAlloc(GetProcessHeap(), 0, Size);
ret = GetTokenInformation(Token, TokenGroups, Groups, Size, &Size);
ok(ret, "GetTokenInformation(TokenGroups) failed with error %ld\n", GetLastError());
ok(ret, "GetTokenInformation(TokenGroups) failed with error %d\n", GetLastError());
trace("TokenGroups:\n");
for (i = 0; i < Groups->GroupCount; i++)
{
@ -815,8 +815,8 @@ static void test_token_attr(void)
Name[0] = '\0';
Domain[0] = '\0';
ret = LookupAccountSid(NULL, Groups->Groups[i].Sid, Name, &NameLength, Domain, &DomainLength, &SidNameUse);
ok(ret, "LookupAccountSid(%s) failed with error %ld\n", SidString, GetLastError());
trace("\t%s, %s\\%s use: %d attr: 0x%08lx\n", SidString, Domain, Name, SidNameUse, Groups->Groups[i].Attributes);
ok(ret, "LookupAccountSid(%s) failed with error %d\n", SidString, GetLastError());
trace("\t%s, %s\\%s use: %d attr: 0x%08x\n", SidString, Domain, Name, SidNameUse, Groups->Groups[i].Attributes);
LocalFree(SidString);
}
HeapFree(GetProcessHeap(), 0, Groups);
@ -824,31 +824,31 @@ static void test_token_attr(void)
/* user */
ret = GetTokenInformation(Token, TokenUser, NULL, 0, &Size);
ok(!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
"GetTokenInformation(TokenUser) failed with error %ld\n", GetLastError());
"GetTokenInformation(TokenUser) failed with error %d\n", GetLastError());
User = HeapAlloc(GetProcessHeap(), 0, Size);
ret = GetTokenInformation(Token, TokenUser, User, Size, &Size);
ok(ret,
"GetTokenInformation(TokenUser) failed with error %ld\n", GetLastError());
"GetTokenInformation(TokenUser) failed with error %d\n", GetLastError());
pConvertSidToStringSidA(User->User.Sid, &SidString);
trace("TokenUser: %s attr: 0x%08lx\n", SidString, User->User.Attributes);
trace("TokenUser: %s attr: 0x%08x\n", SidString, User->User.Attributes);
LocalFree(SidString);
/* privileges */
ret = GetTokenInformation(Token, TokenPrivileges, NULL, 0, &Size);
ok(!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
"GetTokenInformation(TokenPrivileges) failed with error %ld\n", GetLastError());
"GetTokenInformation(TokenPrivileges) failed with error %d\n", GetLastError());
Privileges = HeapAlloc(GetProcessHeap(), 0, Size);
ret = GetTokenInformation(Token, TokenPrivileges, Privileges, Size, &Size);
ok(ret,
"GetTokenInformation(TokenPrivileges) failed with error %ld\n", GetLastError());
"GetTokenInformation(TokenPrivileges) failed with error %d\n", GetLastError());
trace("TokenPrivileges:\n");
for (i = 0; i < Privileges->PrivilegeCount; i++)
{
TCHAR Name[256];
DWORD NameLen = sizeof(Name)/sizeof(Name[0]);
LookupPrivilegeName(NULL, &Privileges->Privileges[i].Luid, Name, &NameLen);
trace("\t%s, 0x%lx\n", Name, Privileges->Privileges[i].Attributes);
trace("\t%s, 0x%x\n", Name, Privileges->Privileges[i].Attributes);
}
}
@ -862,7 +862,7 @@ static void test_sid_str(PSID * sid)
{
char *str_sid;
BOOL ret = pConvertSidToStringSidA(sid, &str_sid);
ok(ret, "ConvertSidToStringSidA() failed: %ld\n", GetLastError());
ok(ret, "ConvertSidToStringSidA() failed: %d\n", GetLastError());
if (ret)
{
char account[MAX_PATH], domain[MAX_PATH];
@ -871,7 +871,7 @@ static void test_sid_str(PSID * sid)
DWORD dom_size = MAX_PATH;
ret = LookupAccountSid(NULL, sid, account, &acc_size, domain, &dom_size, &use);
ok(ret || (!ret && (GetLastError() == ERROR_NONE_MAPPED)),
"LookupAccountSid(%s) failed: %ld\n", str_sid, GetLastError());
"LookupAccountSid(%s) failed: %d\n", str_sid, GetLastError());
if (ret)
trace(" %s %s\\%s %d\n", str_sid, domain, account, use);
else if (GetLastError() == ERROR_NONE_MAPPED)
@ -902,7 +902,7 @@ static void test_LookupAccountSid(void)
ret = AllocateAndInitializeSid(&SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_USERS, 0, 0, 0, 0, 0, 0, &pUsersSid);
ok(ret || (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED),
"AllocateAndInitializeSid failed with error %ld\n", GetLastError());
"AllocateAndInitializeSid failed with error %d\n", GetLastError());
/* not running on NT so give up */
if (!ret && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
@ -932,7 +932,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, accountA, &acc_sizeA, domainA, &dom_sizeA, &use);
ok(!ret, "LookupAccountSidA() Expected FALSE got TRUE\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupAccountSidA() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
"LookupAccountSidA() Expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
/* try a 0 sized account buffer */
acc_sizeA = 0;
@ -941,7 +941,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, accountA, &acc_sizeA, domainA, &dom_sizeA, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(acc_sizeA == real_acc_sizeA + 1,
"LookupAccountSidA() Expected acc_size = %lu, got %lu\n",
"LookupAccountSidA() Expected acc_size = %u, got %u\n",
real_acc_sizeA + 1, acc_sizeA);
/* try a 0 sized account buffer */
@ -950,7 +950,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, NULL, &acc_sizeA, domainA, &dom_sizeA, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(acc_sizeA == real_acc_sizeA + 1,
"LookupAccountSid() Expected acc_size = %lu, got %lu\n",
"LookupAccountSid() Expected acc_size = %u, got %u\n",
real_acc_sizeA + 1, acc_sizeA);
/* try a small domain buffer */
@ -960,7 +960,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, accountA, &acc_sizeA, domainA, &dom_sizeA, &use);
ok(!ret, "LookupAccountSidA() Expected FALSE got TRUE\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupAccountSidA() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
"LookupAccountSidA() Expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
/* try a 0 sized domain buffer */
dom_sizeA = 0;
@ -969,7 +969,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, accountA, &acc_sizeA, domainA, &dom_sizeA, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(dom_sizeA == real_dom_sizeA + 1,
"LookupAccountSidA() Expected dom_size = %lu, got %lu\n",
"LookupAccountSidA() Expected dom_size = %u, got %u\n",
real_dom_sizeA + 1, dom_sizeA);
/* try a 0 sized domain buffer */
@ -978,7 +978,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidA(NULL, pUsersSid, accountA, &acc_sizeA, NULL, &dom_sizeA, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(dom_sizeA == real_dom_sizeA + 1,
"LookupAccountSidA() Expected dom_size = %lu, got %lu\n",
"LookupAccountSidA() Expected dom_size = %u, got %u\n",
real_dom_sizeA + 1, dom_sizeA);
real_acc_sizeW = MAX_PATH;
@ -995,7 +995,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, accountW, &acc_sizeW, domainW, &dom_sizeW, &use);
ok(!ret, "LookupAccountSidW() Expected FALSE got TRUE\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupAccountSidW() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
"LookupAccountSidW() Expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
/* try a 0 sized account buffer */
acc_sizeW = 0;
@ -1004,7 +1004,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, accountW, &acc_sizeW, domainW, &dom_sizeW, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(acc_sizeW == real_acc_sizeW + 1,
"LookupAccountSidW() Expected acc_size = %lu, got %lu\n",
"LookupAccountSidW() Expected acc_size = %u, got %u\n",
real_acc_sizeW + 1, acc_sizeW);
/* try a 0 sized account buffer */
@ -1013,7 +1013,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, NULL, &acc_sizeW, domainW, &dom_sizeW, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(acc_sizeW == real_acc_sizeW + 1,
"LookupAccountSidW() Expected acc_size = %lu, got %lu\n",
"LookupAccountSidW() Expected acc_size = %u, got %u\n",
real_acc_sizeW + 1, acc_sizeW);
/* try a small domain buffer */
@ -1023,7 +1023,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, accountW, &acc_sizeW, domainW, &dom_sizeW, &use);
ok(!ret, "LookupAccountSidW() Expected FALSE got TRUE\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"LookupAccountSidW() Expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
"LookupAccountSidW() Expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
/* try a 0 sized domain buffer */
dom_sizeW = 0;
@ -1032,7 +1032,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, accountW, &acc_sizeW, domainW, &dom_sizeW, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(dom_sizeW == real_dom_sizeW + 1,
"LookupAccountSidW() Expected dom_size = %lu, got %lu\n",
"LookupAccountSidW() Expected dom_size = %u, got %u\n",
real_dom_sizeW + 1, dom_sizeW);
/* try a 0 sized domain buffer */
@ -1041,7 +1041,7 @@ static void test_LookupAccountSid(void)
ret = LookupAccountSidW(NULL, pUsersSid, accountW, &acc_sizeW, NULL, &dom_sizeW, &use);
/* this can fail or succeed depending on OS version but the size will always be returned */
ok(dom_sizeW == real_dom_sizeW + 1,
"LookupAccountSidW() Expected dom_size = %lu, got %lu\n",
"LookupAccountSidW() Expected dom_size = %u, got %u\n",
real_dom_sizeW + 1, dom_sizeW);
pCreateWellKnownSid = (fnCreateWellKnownSid)GetProcAddress( hmod, "CreateWellKnownSid" );
@ -1066,7 +1066,7 @@ static void test_LookupAccountSid(void)
else
{
if (GetLastError() != ERROR_INVALID_PARAMETER)
trace(" CreateWellKnownSid(%d) failed: %ld\n", i, GetLastError());
trace(" CreateWellKnownSid(%d) failed: %d\n", i, GetLastError());
else
trace(" %d: not supported\n", i);
}
@ -1088,20 +1088,20 @@ static void test_LookupAccountSid(void)
status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle);
ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status);
"LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x\n", status);
/* try a more restricted access mask if necessary */
if (status == STATUS_ACCESS_DENIED) {
trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION\n");
status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_VIEW_LOCAL_INFORMATION, &handle);
ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08x\n", status);
}
if (status == STATUS_SUCCESS)
{
PPOLICY_ACCOUNT_DOMAIN_INFO info;
status = pLsaQueryInformationPolicy(handle, PolicyAccountDomainInformation, (PVOID*)&info);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy() failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy() failed, returned 0x%08x\n", status);
if (status == STATUS_SUCCESS)
{
ok(info->DomainSid!=0, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) missing SID\n");
@ -1143,7 +1143,7 @@ static void test_LookupAccountSid(void)
}
status = pLsaClose(handle);
ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08lx\n", status);
ok(status == STATUS_SUCCESS, "LsaClose() failed, returned 0x%08x\n", status);
}
}
}