[KERNEL32_WINETEST]

sync kernel32_winetest to wine 1.1.39

svn path=/trunk/; revision=45889
This commit is contained in:
Christoph von Wittich 2010-03-05 19:01:21 +00:00
parent 4731484299
commit 6063b53ab2
19 changed files with 3276 additions and 299 deletions

View file

@ -278,7 +278,7 @@ static const detailed_info_t detailed_info2 = {
work_dir,
};
static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo)
static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo, int line)
{
ACTIVATION_CONTEXT_DETAILED_INFORMATION detailed_info_tmp, *detailed_info;
SIZE_T size, exsize, retsize;
@ -293,9 +293,9 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo)
b = pQueryActCtxW(0, handle, NULL,
ActivationContextDetailedInformation, &detailed_info_tmp,
sizeof(detailed_info_tmp), &size);
ok(!b, "QueryActCtx succeeded\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok(size == exsize, "size=%ld, expected %ld\n", size, exsize);
ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok_(__FILE__, line)(size == exsize, "size=%ld, expected %ld\n", size, exsize);
}else {
size = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION);
}
@ -305,53 +305,53 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo)
b = pQueryActCtxW(0, handle, NULL,
ActivationContextDetailedInformation, detailed_info,
size, &retsize);
ok(b, "QueryActCtx failed: %u\n", GetLastError());
ok(retsize == exsize, "size=%ld, expected %ld\n", retsize, exsize);
ok_(__FILE__, line)(b, "QueryActCtx failed: %u\n", GetLastError());
ok_(__FILE__, line)(retsize == exsize, "size=%ld, expected %ld\n", retsize, exsize);
ok(detailed_info->dwFlags == 0, "detailed_info->dwFlags=%x\n", detailed_info->dwFlags);
ok(detailed_info->ulFormatVersion == exinfo->format_version,
ok_(__FILE__, line)(detailed_info->dwFlags == 0, "detailed_info->dwFlags=%x\n", detailed_info->dwFlags);
ok_(__FILE__, line)(detailed_info->ulFormatVersion == exinfo->format_version,
"detailed_info->ulFormatVersion=%u, expected %u\n", detailed_info->ulFormatVersion,
exinfo->format_version);
ok(exinfo->assembly_cnt_min <= detailed_info->ulAssemblyCount &&
ok_(__FILE__, line)(exinfo->assembly_cnt_min <= detailed_info->ulAssemblyCount &&
detailed_info->ulAssemblyCount <= exinfo->assembly_cnt_max,
"detailed_info->ulAssemblyCount=%u, expected between %u and %u\n", detailed_info->ulAssemblyCount,
exinfo->assembly_cnt_min, exinfo->assembly_cnt_max);
ok(detailed_info->ulRootManifestPathType == exinfo->root_manifest_type,
ok_(__FILE__, line)(detailed_info->ulRootManifestPathType == exinfo->root_manifest_type,
"detailed_info->ulRootManifestPathType=%u, expected %u\n",
detailed_info->ulRootManifestPathType, exinfo->root_manifest_type);
ok(detailed_info->ulRootManifestPathChars ==
ok_(__FILE__, line)(detailed_info->ulRootManifestPathChars ==
(exinfo->root_manifest_path ? lstrlenW(exinfo->root_manifest_path) : 0),
"detailed_info->ulRootManifestPathChars=%u, expected %u\n",
detailed_info->ulRootManifestPathChars,
exinfo->root_manifest_path ?lstrlenW(exinfo->root_manifest_path) : 0);
ok(detailed_info->ulRootConfigurationPathType == exinfo->root_config_type,
ok_(__FILE__, line)(detailed_info->ulRootConfigurationPathType == exinfo->root_config_type,
"detailed_info->ulRootConfigurationPathType=%u, expected %u\n",
detailed_info->ulRootConfigurationPathType, exinfo->root_config_type);
ok(detailed_info->ulRootConfigurationPathChars == 0,
ok_(__FILE__, line)(detailed_info->ulRootConfigurationPathChars == 0,
"detailed_info->ulRootConfigurationPathChars=%d\n", detailed_info->ulRootConfigurationPathChars);
ok(detailed_info->ulAppDirPathType == exinfo->app_dir_type,
ok_(__FILE__, line)(detailed_info->ulAppDirPathType == exinfo->app_dir_type,
"detailed_info->ulAppDirPathType=%u, expected %u\n", detailed_info->ulAppDirPathType,
exinfo->app_dir_type);
ok(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0),
ok_(__FILE__, line)(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0),
"detailed_info->ulAppDirPathChars=%u, expected %u\n",
detailed_info->ulAppDirPathChars, exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0);
if(exinfo->root_manifest_path) {
ok(detailed_info->lpRootManifestPath != NULL, "detailed_info->lpRootManifestPath == NULL\n");
ok_(__FILE__, line)(detailed_info->lpRootManifestPath != NULL, "detailed_info->lpRootManifestPath == NULL\n");
if(detailed_info->lpRootManifestPath)
ok(!lstrcmpiW(detailed_info->lpRootManifestPath, exinfo->root_manifest_path),
ok_(__FILE__, line)(!lstrcmpiW(detailed_info->lpRootManifestPath, exinfo->root_manifest_path),
"unexpected detailed_info->lpRootManifestPath\n");
}else {
ok(detailed_info->lpRootManifestPath == NULL, "detailed_info->lpRootManifestPath != NULL\n");
ok_(__FILE__, line)(detailed_info->lpRootManifestPath == NULL, "detailed_info->lpRootManifestPath != NULL\n");
}
ok(detailed_info->lpRootConfigurationPath == NULL,
ok_(__FILE__, line)(detailed_info->lpRootConfigurationPath == NULL,
"detailed_info->lpRootConfigurationPath=%p\n", detailed_info->lpRootConfigurationPath);
if(exinfo->app_dir) {
ok(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n");
ok_(__FILE__, line)(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n");
if(detailed_info->lpAppDirPath)
ok(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath),
ok_(__FILE__, line)(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath),
"unexpected detailed_info->lpAppDirPath\n%s\n",strw(detailed_info->lpAppDirPath));
}else {
ok(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n");
ok_(__FILE__, line)(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n");
}
HeapFree(GetProcessHeap(), 0, detailed_info);
@ -419,7 +419,7 @@ static const info_in_assembly manifest_comctrl_info = {
0, NULL, NULL, TRUE /* These values may differ between Windows installations */
};
static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembly *exinfo)
static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembly *exinfo, int line)
{
ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info, info_tmp;
SIZE_T size, exsize;
@ -434,10 +434,10 @@ static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembl
b = pQueryActCtxW(0, handle, &id,
AssemblyDetailedInformationInActivationContext, &info_tmp,
sizeof(info_tmp), &size);
ok(!b, "QueryActCtx succeeded\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok(size >= exsize, "size=%lu, expected %lu\n", size, exsize);
ok_(__FILE__, line)(size >= exsize, "size=%lu, expected %lu\n", size, exsize);
if (size == 0xdeadbeef)
{
@ -451,88 +451,88 @@ static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembl
size = 0xdeadbeef;
b = pQueryActCtxW(0, handle, &id,
AssemblyDetailedInformationInActivationContext, info, size, &size);
ok(b, "QueryActCtx failed: %u\n", GetLastError());
ok_(__FILE__, line)(b, "QueryActCtx failed: %u\n", GetLastError());
if (!exinfo->manifest_path)
exsize += info->ulManifestPathLength + sizeof(WCHAR);
if (!exinfo->encoded_assembly_id)
exsize += info->ulEncodedAssemblyIdentityLength + sizeof(WCHAR);
if (exinfo->has_assembly_dir)
exsize += info->ulAssemblyDirectoryNameLength + sizeof(WCHAR);
ok(size == exsize, "size=%lu, expected %lu\n", size, exsize);
ok_(__FILE__, line)(size == exsize, "size=%lu, expected %lu\n", size, exsize);
if (0) /* FIXME: flags meaning unknown */
{
ok((info->ulFlags) == exinfo->flags, "info->ulFlags = %x, expected %x\n",
ok_(__FILE__, line)((info->ulFlags) == exinfo->flags, "info->ulFlags = %x, expected %x\n",
info->ulFlags, exinfo->flags);
}
if(exinfo->encoded_assembly_id) {
len = strlen_aw(exinfo->encoded_assembly_id)*sizeof(WCHAR);
ok(info->ulEncodedAssemblyIdentityLength == len,
ok_(__FILE__, line)(info->ulEncodedAssemblyIdentityLength == len,
"info->ulEncodedAssemblyIdentityLength = %u, expected %u\n",
info->ulEncodedAssemblyIdentityLength, len);
} else {
ok(info->ulEncodedAssemblyIdentityLength != 0,
ok_(__FILE__, line)(info->ulEncodedAssemblyIdentityLength != 0,
"info->ulEncodedAssemblyIdentityLength == 0\n");
}
ok(info->ulManifestPathType == ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
ok_(__FILE__, line)(info->ulManifestPathType == ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
"info->ulManifestPathType = %x\n", info->ulManifestPathType);
if(exinfo->manifest_path) {
len = lstrlenW(exinfo->manifest_path)*sizeof(WCHAR);
ok(info->ulManifestPathLength == len, "info->ulManifestPathLength = %u, expected %u\n",
ok_(__FILE__, line)(info->ulManifestPathLength == len, "info->ulManifestPathLength = %u, expected %u\n",
info->ulManifestPathLength, len);
} else {
ok(info->ulManifestPathLength != 0, "info->ulManifestPathLength == 0\n");
ok_(__FILE__, line)(info->ulManifestPathLength != 0, "info->ulManifestPathLength == 0\n");
}
ok(info->ulPolicyPathType == ACTIVATION_CONTEXT_PATH_TYPE_NONE,
ok_(__FILE__, line)(info->ulPolicyPathType == ACTIVATION_CONTEXT_PATH_TYPE_NONE,
"info->ulPolicyPathType = %x\n", info->ulPolicyPathType);
ok(info->ulPolicyPathLength == 0,
ok_(__FILE__, line)(info->ulPolicyPathLength == 0,
"info->ulPolicyPathLength = %u, expected 0\n", info->ulPolicyPathLength);
ok(info->ulMetadataSatelliteRosterIndex == 0, "info->ulMetadataSatelliteRosterIndex = %x\n",
ok_(__FILE__, line)(info->ulMetadataSatelliteRosterIndex == 0, "info->ulMetadataSatelliteRosterIndex = %x\n",
info->ulMetadataSatelliteRosterIndex);
ok(info->ulManifestVersionMajor == 1,"info->ulManifestVersionMajor = %x\n",
ok_(__FILE__, line)(info->ulManifestVersionMajor == 1,"info->ulManifestVersionMajor = %x\n",
info->ulManifestVersionMajor);
ok(info->ulManifestVersionMinor == 0, "info->ulManifestVersionMinor = %x\n",
ok_(__FILE__, line)(info->ulManifestVersionMinor == 0, "info->ulManifestVersionMinor = %x\n",
info->ulManifestVersionMinor);
ok(info->ulPolicyVersionMajor == 0, "info->ulPolicyVersionMajor = %x\n",
ok_(__FILE__, line)(info->ulPolicyVersionMajor == 0, "info->ulPolicyVersionMajor = %x\n",
info->ulPolicyVersionMajor);
ok(info->ulPolicyVersionMinor == 0, "info->ulPolicyVersionMinor = %x\n",
ok_(__FILE__, line)(info->ulPolicyVersionMinor == 0, "info->ulPolicyVersionMinor = %x\n",
info->ulPolicyVersionMinor);
if(exinfo->has_assembly_dir)
ok(info->ulAssemblyDirectoryNameLength != 0,
ok_(__FILE__, line)(info->ulAssemblyDirectoryNameLength != 0,
"info->ulAssemblyDirectoryNameLength == 0\n");
else
ok(info->ulAssemblyDirectoryNameLength == 0,
ok_(__FILE__, line)(info->ulAssemblyDirectoryNameLength == 0,
"info->ulAssemblyDirectoryNameLength != 0\n");
ok(info->lpAssemblyEncodedAssemblyIdentity != NULL,
ok_(__FILE__, line)(info->lpAssemblyEncodedAssemblyIdentity != NULL,
"info->lpAssemblyEncodedAssemblyIdentity == NULL\n");
if(info->lpAssemblyEncodedAssemblyIdentity && exinfo->encoded_assembly_id) {
ok(!strcmp_aw(info->lpAssemblyEncodedAssemblyIdentity, exinfo->encoded_assembly_id),
ok_(__FILE__, line)(!strcmp_aw(info->lpAssemblyEncodedAssemblyIdentity, exinfo->encoded_assembly_id),
"unexpected info->lpAssemblyEncodedAssemblyIdentity %s / %s\n",
strw(info->lpAssemblyEncodedAssemblyIdentity), exinfo->encoded_assembly_id);
}
if(exinfo->manifest_path) {
ok(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
ok_(__FILE__, line)(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
if(info->lpAssemblyManifestPath)
ok(!lstrcmpiW(info->lpAssemblyManifestPath, exinfo->manifest_path),
ok_(__FILE__, line)(!lstrcmpiW(info->lpAssemblyManifestPath, exinfo->manifest_path),
"unexpected info->lpAssemblyManifestPath\n");
}else {
ok(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
ok_(__FILE__, line)(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
}
ok(info->lpAssemblyPolicyPath == NULL, "info->lpAssemblyPolicyPath != NULL\n");
ok_(__FILE__, line)(info->lpAssemblyPolicyPath == NULL, "info->lpAssemblyPolicyPath != NULL\n");
if(info->lpAssemblyPolicyPath)
ok(*(WORD*)info->lpAssemblyPolicyPath == 0, "info->lpAssemblyPolicyPath is not empty\n");
ok_(__FILE__, line)(*(WORD*)info->lpAssemblyPolicyPath == 0, "info->lpAssemblyPolicyPath is not empty\n");
if(exinfo->has_assembly_dir)
ok(info->lpAssemblyDirectoryName != NULL, "info->lpAssemblyDirectoryName == NULL\n");
ok_(__FILE__, line)(info->lpAssemblyDirectoryName != NULL, "info->lpAssemblyDirectoryName == NULL\n");
else
ok(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n",
ok_(__FILE__, line)(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n",
strw(info->lpAssemblyDirectoryName));
HeapFree(GetProcessHeap(), 0, info);
}
static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR filename)
static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR filename, int line)
{
ASSEMBLY_FILE_DETAILED_INFORMATION *info, info_tmp;
ACTIVATION_CONTEXT_QUERY_INDEX index = {assid, fileid};
@ -546,9 +546,9 @@ static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR fil
b = pQueryActCtxW(0, handle, &index,
FileInformationInAssemblyOfAssemblyInActivationContext, &info_tmp,
sizeof(info_tmp), &size);
ok(!b, "QueryActCtx succeeded\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok(size == exsize, "size=%lu, expected %lu\n", size, exsize);
ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
ok_(__FILE__, line)(size == exsize, "size=%lu, expected %lu\n", size, exsize);
if(size == 0xdeadbeef)
{
@ -561,18 +561,18 @@ static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR fil
b = pQueryActCtxW(0, handle, &index,
FileInformationInAssemblyOfAssemblyInActivationContext, info, size, &size);
ok(b, "QueryActCtx failed: %u\n", GetLastError());
ok(!size, "size=%lu, expected 0\n", size);
ok_(__FILE__, line)(b, "QueryActCtx failed: %u\n", GetLastError());
ok_(__FILE__, line)(!size, "size=%lu, expected 0\n", size);
ok(info->ulFlags == 2, "info->ulFlags=%x, expected 2\n", info->ulFlags);
ok(info->ulFilenameLength == lstrlenW(filename)*sizeof(WCHAR),
ok_(__FILE__, line)(info->ulFlags == 2, "info->ulFlags=%x, expected 2\n", info->ulFlags);
ok_(__FILE__, line)(info->ulFilenameLength == lstrlenW(filename)*sizeof(WCHAR),
"info->ulFilenameLength=%u, expected %u*sizeof(WCHAR)\n",
info->ulFilenameLength, lstrlenW(filename));
ok(info->ulPathLength == 0, "info->ulPathLength=%u\n", info->ulPathLength);
ok(info->lpFileName != NULL, "info->lpFileName == NULL\n");
ok_(__FILE__, line)(info->ulPathLength == 0, "info->ulPathLength=%u\n", info->ulPathLength);
ok_(__FILE__, line)(info->lpFileName != NULL, "info->lpFileName == NULL\n");
if(info->lpFileName)
ok(!lstrcmpiW(info->lpFileName, filename), "unexpected info->lpFileName\n");
ok(info->lpFilePath == NULL, "info->lpFilePath != NULL\n");
ok_(__FILE__, line)(!lstrcmpiW(info->lpFileName, filename), "unexpected info->lpFileName\n");
ok_(__FILE__, line)(info->lpFilePath == NULL, "info->lpFilePath != NULL\n");
HeapFree(GetProcessHeap(), 0, info);
}
@ -693,7 +693,7 @@ static void test_create_fail(void)
test_create_and_fail(manifest2, wrong_depmanifest1, 0 );
}
static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid)
static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid, int line)
{
ACTCTX_SECTION_KEYED_DATA data;
DWORD *p;
@ -705,32 +705,32 @@ static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid
ret = pFindActCtxSectionStringW(0, NULL,
ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
libname, &data);
ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
if(!ret)
{
skip("couldn't find %s\n",strw(libname));
return;
}
ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok(data.lpData != NULL, "data.lpData == NULL\n");
ok(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
ok_(__FILE__, line)(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
p = data.lpData;
if(ret && p) todo_wine {
ok(p[0] == 20 && p[1] == 2 && p[2] == 0 && p[3] == 0 && p[4] == 0,
ok_(__FILE__, line)(p[0] == 20 && p[1] == 2 && p[2] == 0 && p[3] == 0 && p[4] == 0,
"wrong data %u,%u,%u,%u,%u\n",p[0], p[1], p[2], p[3], p[4]);
}
ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
data.ulSectionGlobalDataLength);
ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok(data.ulSectionTotalLength == ??, "data.ulSectionTotalLength=%u\n",
ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok_(__FILE__, line)(data.ulSectionTotalLength == ??, "data.ulSectionTotalLength=%u\n",
data.ulSectionTotalLength); */
ok(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
data.ulAssemblyRosterIndex, exid);
memset(&data, 0xfe, sizeof(data));
@ -739,31 +739,31 @@ static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid
ret = pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
libname, &data);
ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
if(!ret)
{
skip("couldn't find\n");
return;
}
ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok(data.lpData != NULL, "data.lpData == NULL\n");
ok(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
ok_(__FILE__, line)(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
data.ulSectionGlobalDataLength);
ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok(data.ulSectionTotalLength == ?? , "data.ulSectionTotalLength=%u\n",
ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok_(__FILE__, line)(data.ulSectionTotalLength == ?? , "data.ulSectionTotalLength=%u\n",
data.ulSectionTotalLength); */
ok(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
ok_(__FILE__, line)(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
data.ulAssemblyRosterIndex, exid);
pReleaseActCtx(handle);
}
static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid)
static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid, int line)
{
ACTCTX_SECTION_KEYED_DATA data;
BOOL ret;
@ -774,25 +774,25 @@ static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid)
ret = pFindActCtxSectionStringW(0, NULL,
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
clsname, &data);
ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
if(!ret)
{
skip("couldn't find\n");
return;
}
ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok(data.lpData != NULL, "data.lpData == NULL\n");
/* ok(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); */
ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
/* ok_(__FILE__, line)(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); */
ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
data.ulSectionGlobalDataLength);
ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok_(__FILE__, line)(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
data.ulSectionTotalLength); FIXME */
ok(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
data.ulAssemblyRosterIndex, exid);
memset(&data, 0xfe, sizeof(data));
@ -801,25 +801,25 @@ static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid)
ret = pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
clsname, &data);
ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
if(!ret)
{
skip("couldn't find\n");
return;
}
ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok(data.lpData != NULL, "data.lpData == NULL\n");
/* ok(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); FIXME */
ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
/* ok_(__FILE__, line)(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); FIXME */
ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
data.ulSectionGlobalDataLength);
ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
/* ok_(__FILE__, line)(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
data.ulSectionTotalLength); FIXME */
ok(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
ok_(__FILE__, line)(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
data.ulAssemblyRosterIndex, exid);
pReleaseActCtx(handle);
@ -863,7 +863,7 @@ static void test_find_string_fail(void)
}
static void test_basic_info(HANDLE handle)
static void test_basic_info(HANDLE handle, int line)
{
ACTIVATION_CONTEXT_BASIC_INFORMATION basic;
SIZE_T size;
@ -873,10 +873,10 @@ static void test_basic_info(HANDLE handle)
ActivationContextBasicInformation, &basic,
sizeof(basic), &size);
ok (b,"ActivationContextBasicInformation failed\n");
ok (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
ok_(__FILE__, line) (b,"ActivationContextBasicInformation failed\n");
ok_(__FILE__, line) (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
b = pQueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX |
QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL,
@ -884,18 +884,18 @@ static void test_basic_info(HANDLE handle)
sizeof(basic), &size);
if (handle)
{
ok (!b,"ActivationContextBasicInformation succeeded\n");
ok (size == 0,"size mismatch\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER, "Wrong last error\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
ok_(__FILE__, line) (!b,"ActivationContextBasicInformation succeeded\n");
ok_(__FILE__, line) (size == 0,"size mismatch\n");
ok_(__FILE__, line) (GetLastError() == ERROR_INVALID_PARAMETER, "Wrong last error\n");
ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
}
else
{
ok (b,"ActivationContextBasicInformation failed\n");
ok (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
ok_(__FILE__, line) (b,"ActivationContextBasicInformation failed\n");
ok_(__FILE__, line) (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
}
}
@ -913,8 +913,8 @@ static void test_actctx(void)
ok(handle == NULL, "handle = %p, expected NULL\n", handle);
ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
if(b) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info0);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info0, __LINE__);
pReleaseActCtx(handle);
}
@ -928,9 +928,9 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_info, __LINE__);
if (pIsDebuggerPresent && !pIsDebuggerPresent())
{
@ -954,10 +954,10 @@ static void test_actctx(void)
DeleteFileA("test2.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest1_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info2, __LINE__);
test_info_in_assembly(handle, 1, &manifest2_info, __LINE__);
test_info_in_assembly(handle, 2, &depmanifest1_info, __LINE__);
pReleaseActCtx(handle);
}
@ -972,17 +972,17 @@ static void test_actctx(void)
DeleteFileA("test2-2.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest2_info);
test_file_info(handle, 1, 0, testlib_dll);
test_file_info(handle, 1, 1, testlib2_dll);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info2, __LINE__);
test_info_in_assembly(handle, 1, &manifest2_info, __LINE__);
test_info_in_assembly(handle, 2, &depmanifest2_info, __LINE__);
test_file_info(handle, 1, 0, testlib_dll, __LINE__);
test_file_info(handle, 1, 1, testlib2_dll, __LINE__);
b = pActivateActCtx(handle, &cookie);
ok(b, "ActivateActCtx failed: %u\n", GetLastError());
test_find_dll_redirection(handle, testlib_dll, 2);
test_find_dll_redirection(handle, testlib2_dll, 2);
test_find_dll_redirection(handle, testlib_dll, 2, __LINE__);
test_find_dll_redirection(handle, testlib2_dll, 2, __LINE__);
b = pDeactivateActCtx(0, cookie);
ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
@ -1000,19 +1000,19 @@ static void test_actctx(void)
DeleteFileA("test2-3.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest3_info);
test_file_info(handle, 1, 0, testlib_dll);
test_file_info(handle, 1, 1, testlib2_dll);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info2, __LINE__);
test_info_in_assembly(handle, 1, &manifest2_info, __LINE__);
test_info_in_assembly(handle, 2, &depmanifest3_info, __LINE__);
test_file_info(handle, 1, 0, testlib_dll, __LINE__);
test_file_info(handle, 1, 1, testlib2_dll, __LINE__);
b = pActivateActCtx(handle, &cookie);
ok(b, "ActivateActCtx failed: %u\n", GetLastError());
test_find_dll_redirection(handle, testlib_dll, 2);
test_find_dll_redirection(handle, testlib2_dll, 2);
test_find_window_class(handle, wndClassW, 2);
test_find_window_class(handle, wndClass2W, 2);
test_find_dll_redirection(handle, testlib_dll, 2, __LINE__);
test_find_dll_redirection(handle, testlib2_dll, 2, __LINE__);
test_find_window_class(handle, wndClassW, 2, __LINE__);
test_find_window_class(handle, wndClass2W, 2, __LINE__);
b = pDeactivateActCtx(0, cookie);
ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
@ -1029,15 +1029,15 @@ static void test_actctx(void)
handle = test_create("test3.manifest", manifest3);
DeleteFileA("test3.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest3_info);
test_file_info(handle, 0, 0, testlib_dll);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest3_info, __LINE__);
test_file_info(handle, 0, 0, testlib_dll, __LINE__);
b = pActivateActCtx(handle, &cookie);
ok(b, "ActivateActCtx failed: %u\n", GetLastError());
test_find_dll_redirection(handle, testlib_dll, 1);
test_find_dll_redirection(handle, testlib_dll, 1);
test_find_dll_redirection(handle, testlib_dll, 1, __LINE__);
test_find_dll_redirection(handle, testlib_dll, 1, __LINE__);
test_find_string_fail();
b = pDeactivateActCtx(0, cookie);
ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
@ -1056,10 +1056,10 @@ static void test_actctx(void)
DeleteFileA("test4.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest4_info);
test_info_in_assembly(handle, 2, &manifest_comctrl_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info2, __LINE__);
test_info_in_assembly(handle, 1, &manifest4_info, __LINE__);
test_info_in_assembly(handle, 2, &manifest_comctrl_info, __LINE__);
pReleaseActCtx(handle);
}
@ -1075,9 +1075,9 @@ static void test_actctx(void)
handle = test_create("..\\test1.manifest", manifest1);
DeleteFileA("..\\test1.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_info, __LINE__);
pReleaseActCtx(handle);
}
SetCurrentDirectoryW(work_dir);
@ -1095,9 +1095,9 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if (handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_info, __LINE__);
pReleaseActCtx(handle);
}
@ -1110,9 +1110,9 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if (handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_info, __LINE__);
pReleaseActCtx(handle);
}
@ -1129,9 +1129,9 @@ static void test_app_manifest(void)
ok(handle == NULL, "handle != NULL\n");
ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
if(b) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1_child);
test_info_in_assembly(handle, 1, &manifest1_child_info);
test_basic_info(handle, __LINE__);
test_detailed_info(handle, &detailed_info1_child, __LINE__);
test_info_in_assembly(handle, 1, &manifest1_child_info, __LINE__);
pReleaseActCtx(handle);
}
}

View file

@ -70,15 +70,9 @@ static void test_Heap(void)
heap=HeapCreate(0,2*memchunk,5*memchunk);
/* Check that HeapCreate allocated the right amount of ram */
todo_wine {
/* Today HeapCreate seems to return a memory block larger than specified.
MSDN says the maximum heap size should be dwMaximumSize rounded up to the
nearest page boundary
*/
mem1=HeapAlloc(heap,0,5*memchunk+1);
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n");
HeapFree(heap,0,mem1);
}
mem1=HeapAlloc(heap,0,5*memchunk+1);
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n");
HeapFree(heap,0,mem1);
/* Check that a normal alloc works */
mem1=HeapAlloc(heap,0,memchunk);

View file

@ -32,6 +32,7 @@
static const WCHAR foobarW[] = {'f','o','o','b','a','r',0};
static const WCHAR FOOBARW[] = {'F','O','O','B','A','R',0};
static const WCHAR _foobarW[] = {'_','f','o','o','b','a','r',0};
static const WCHAR integfmt[] = {'#','%','d',0};
static void do_initA(char* tmp, const char* pattern, int len)
{
@ -57,21 +58,6 @@ static void do_initW(WCHAR* tmp, const char* pattern, int len)
*tmp = '\0';
}
static void print_integral( WCHAR* buffer, int atom )
{
BOOL first = TRUE;
#define X(v) { if (atom >= v) {*buffer++ = '0' + atom / v; first = FALSE; } else if (!first || v == 1) *buffer++ = '0'; atom %= v; }
*buffer++ = '#';
X(10000);
X(1000);
X(100);
X(10);
X(1);
*buffer = '\0';
#undef X
}
static BOOL unicode_OS;
static void test_add_atom(void)
@ -281,7 +267,7 @@ static void test_get_atom_name(void)
WCHAR res[20];
ok( (len > 1) && (len < 7), "bad length %d\n", len );
print_integral( res, i );
wsprintfW( res, integfmt, i );
memset( res + lstrlenW(res) + 1, 'a', 10 * sizeof(WCHAR));
ok( !memcmp( res, outW, 10 * sizeof(WCHAR) ), "bad buffer contents for %d\n", i );
if (len <= 1 || len >= 7) break; /* don't bother testing all of them */
@ -552,7 +538,7 @@ static void test_local_get_atom_name(void)
WCHAR res[20];
ok( (len > 1) && (len < 7), "bad length %d\n", len );
print_integral( res, i );
wsprintfW( res, integfmt, i );
memset( res + lstrlenW(res) + 1, 'a', 10 * sizeof(WCHAR));
ok( !memcmp( res, outW, 10 * sizeof(WCHAR) ), "bad buffer contents for %d\n", i );
}

View file

@ -24,6 +24,7 @@
#include <stdio.h>
static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR);
static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD);
static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR);
/* DEFAULT_ATTRIB is used for all initial filling of the console.
@ -63,6 +64,7 @@ static void init_function_pointers(void)
hKernel32 = GetModuleHandleA("kernel32.dll");
KERNEL32_GET_PROC(GetConsoleInputExeNameA);
KERNEL32_GET_PROC(GetConsoleProcessList);
KERNEL32_GET_PROC(SetConsoleInputExeNameA);
#undef KERNEL32_GET_PROC
@ -926,6 +928,66 @@ static void test_GetSetConsoleInputExeName(void)
ok(!lstrcmpA(buffer, input_exe), "got %s expected %s\n", buffer, input_exe);
}
static void test_GetConsoleProcessList(void)
{
DWORD ret, *list = NULL;
if (!pGetConsoleProcessList)
{
win_skip("GetConsoleProcessList is not available\n");
return;
}
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(NULL, 0);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(NULL, 1);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
/* We should only have 1 process but only for these specific unit tests as
* we created our own console. An AttachConsole(ATTACH_PARENT_PROCESS) would
* give us two processes for example.
*/
list = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD));
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, 0);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, 1);
todo_wine
ok(ret == 1, "Expected 1, got %d\n", ret);
HeapFree(GetProcessHeap(), 0, list);
list = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(DWORD));
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, ret);
todo_wine
ok(ret == 1, "Expected 1, got %d\n", ret);
if (ret == 1)
{
DWORD pid = GetCurrentProcessId();
ok(list[0] == pid, "Expected %d, got %d\n", pid, list[0]);
}
HeapFree(GetProcessHeap(), 0, list);
}
START_TEST(console)
{
HANDLE hConIn, hConOut;
@ -971,10 +1033,9 @@ START_TEST(console)
/* still to be done: access rights & access on objects */
if (!pGetConsoleInputExeNameA || !pSetConsoleInputExeNameA)
{
win_skip("GetConsoleInputExeNameA and/or SetConsoleInputExeNameA is not available\n");
return;
}
else
test_GetSetConsoleInputExeName();
test_GetConsoleProcessList();
}

View file

@ -411,7 +411,10 @@ static void test_ExitCode(void)
crash_and_debug(hkey, test_exe, "dbg,none");
else
skip("\"none\" debugger test needs user interaction\n");
crash_and_debug(hkey, test_exe, "dbg,event,order");
if (disposition == REG_CREATED_NEW_KEY)
win_skip("'dbg,event,order' test doesn't finish on Win9x/WinMe\n");
else
crash_and_debug(hkey, test_exe, "dbg,event,order");
crash_and_debug(hkey, test_exe, "dbg,attach,event,code2");
if (pDebugSetProcessKillOnExit)
crash_and_debug(hkey, test_exe, "dbg,attach,event,nokill");

View file

@ -0,0 +1,197 @@
/*
* Unit tests for fiber functions
*
* Copyright (c) 2010 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/test.h"
static LPVOID (WINAPI *pCreateFiber)(SIZE_T,LPFIBER_START_ROUTINE,LPVOID);
static LPVOID (WINAPI *pConvertThreadToFiber)(LPVOID);
static BOOL (WINAPI *pConvertFiberToThread)(void);
static void (WINAPI *pSwitchToFiber)(LPVOID);
static void (WINAPI *pDeleteFiber)(LPVOID);
static LPVOID (WINAPI *pConvertThreadToFiberEx)(LPVOID,DWORD);
static LPVOID (WINAPI *pCreateFiberEx)(SIZE_T,SIZE_T,DWORD,LPFIBER_START_ROUTINE,LPVOID);
static BOOL (WINAPI *pIsThreadAFiber)(void);
static DWORD (WINAPI *pFlsAlloc)(PFLS_CALLBACK_FUNCTION);
static BOOL (WINAPI *pFlsFree)(DWORD);
static PVOID (WINAPI *pFlsGetValue)(DWORD);
static BOOL (WINAPI *pFlsSetValue)(DWORD,PVOID);
static LPVOID fibers[2];
static BYTE testparam = 185;
static WORD cbCount;
static VOID init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandle("kernel32");
#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f);
X(CreateFiber);
X(ConvertThreadToFiber);
X(ConvertFiberToThread);
X(SwitchToFiber);
X(DeleteFiber);
X(ConvertThreadToFiberEx);
X(CreateFiberEx);
X(IsThreadAFiber);
X(FlsAlloc);
X(FlsFree);
X(FlsGetValue);
X(FlsSetValue);
#undef X
}
static VOID WINAPI FiberLocalStorageProc(PVOID lpFlsData)
{
cbCount++;
ok(lpFlsData == (PVOID) 1587, "FlsData expected not to be changed\n");
}
static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter)
{
BYTE *tparam = (BYTE *)lpFiberParameter;
cbCount++;
ok(*tparam == 185, "Parameterdata expected not to be changed\n");
pSwitchToFiber(fibers[0]);
}
static void test_ConvertThreadToFiber(void)
{
if (pConvertThreadToFiber)
{
fibers[0] = pConvertThreadToFiber(&testparam);
ok(fibers[0] != 0, "ConvertThreadToFiber failed with error %d\n", GetLastError());
}
else
{
win_skip( "ConvertThreadToFiber not present\n" );
}
}
static void test_ConvertThreadToFiberEx(void)
{
if (pConvertThreadToFiberEx)
{
fibers[0] = pConvertThreadToFiberEx(&testparam, 0);
ok(fibers[0] != 0, "ConvertThreadToFiberEx failed with error %d\n", GetLastError());
}
else
{
win_skip( "ConvertThreadToFiberEx not present\n" );
}
}
static void test_ConvertFiberToThread(void)
{
if (pConvertFiberToThread)
{
ok(pConvertFiberToThread() , "ConvertFiberToThread failed with error %d\n", GetLastError());
}
else
{
win_skip( "ConvertFiberToThread not present\n" );
}
}
static void test_FiberHandling(void)
{
cbCount = 0;
fibers[0] = pCreateFiber(0,FiberMainProc,&testparam);
ok(fibers[0] != 0, "CreateFiber failed with error %d\n", GetLastError());
pDeleteFiber(fibers[0]);
test_ConvertThreadToFiber();
test_ConvertFiberToThread();
if (pConvertThreadToFiberEx)
test_ConvertThreadToFiberEx();
else
test_ConvertThreadToFiber();
fibers[1] = pCreateFiber(0,FiberMainProc,&testparam);
ok(fibers[1] != 0, "CreateFiber failed with error %d\n", GetLastError());
pSwitchToFiber(fibers[1]);
ok(cbCount == 1, "Wrong callback count: %d\n", cbCount);
pDeleteFiber(fibers[1]);
if (!pCreateFiberEx)
{
win_skip( "CreateFiberEx not present\n" );
return;
}
fibers[1] = pCreateFiberEx(0,0,0,FiberMainProc,&testparam);
ok(fibers[1] != 0, "CreateFiberEx failed with error %d\n", GetLastError());
pSwitchToFiber(fibers[1]);
ok(cbCount == 2, "Wrong callback count: %d\n", cbCount);
pDeleteFiber(fibers[1]);
if (!pIsThreadAFiber)
{
win_skip( "IsThreadAFiber not present\n" );
return;
}
ok(pIsThreadAFiber(), "IsThreadAFiber reported FALSE\n");
test_ConvertFiberToThread();
ok(!pIsThreadAFiber(), "IsThreadAFiber reported TRUE\n");
}
static void test_FiberLocalStorage(PFLS_CALLBACK_FUNCTION cbfunc)
{
DWORD fls;
BOOL ret;
PVOID val = (PVOID) 1587;
if (!pFlsAlloc)
{
win_skip( "Fiber Local Storage not supported\n" );
return;
}
cbCount = 0;
fls = pFlsAlloc(cbfunc);
ok(fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %d\n", GetLastError());
ret = pFlsSetValue(fls, val);
ok(ret, "FlsSetValue failed\n");
ok(val == pFlsGetValue(fls), "FlsGetValue failed\n");
ret = pFlsFree(fls);
ok(ret, "FlsFree failed\n");
if (cbfunc)
todo_wine ok(cbCount == 1, "Wrong callback count: %d\n", cbCount);
}
START_TEST(fiber)
{
init_funcs();
if (!pCreateFiber)
{
win_skip( "Fibers not supported by win95\n" );
return;
}
test_FiberHandling();
test_FiberLocalStorage(NULL);
test_FiberLocalStorage(FiberLocalStorageProc);
}

View file

@ -202,6 +202,8 @@ static void test__hwrite( void )
ret = DeleteFileA( filename );
ok( ret != 0, "DeleteFile failed (%d)\n", GetLastError( ) );
LocalFree( contents );
}
@ -251,7 +253,9 @@ static void test__lcreat( void )
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" );
find = FindFirstFileA( filename, &search_results );
ok( INVALID_HANDLE_VALUE != find, "should be able to find file\n" );
FindClose( find );
ret = DeleteFileA(filename);
ok( ret != 0, "DeleteFile failed (%d)\n", GetLastError());
@ -263,7 +267,9 @@ static void test__lcreat( void )
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" );
find = FindFirstFileA( filename, &search_results );
ok( INVALID_HANDLE_VALUE != find, "should be able to find file\n" );
FindClose( find );
ok( 0 == DeleteFileA( filename ), "shouldn't be able to delete a readonly file\n" );
@ -282,7 +288,9 @@ static void test__lcreat( void )
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" );
find = FindFirstFileA( filename, &search_results );
ok( INVALID_HANDLE_VALUE != find, "should STILL be able to find file\n" );
FindClose( find );
ret = DeleteFileA( filename );
ok( ret, "DeleteFile failed (%d)\n", GetLastError( ) );
@ -298,7 +306,9 @@ static void test__lcreat( void )
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" );
ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" );
find = FindFirstFileA( filename, &search_results );
ok( INVALID_HANDLE_VALUE != find, "should STILL be able to find file\n" );
FindClose( find );
ret = DeleteFileA( filename );
ok( ret, "DeleteFile failed (%d)\n", GetLastError( ) );
@ -555,6 +565,8 @@ static void test__lwrite( void )
ret = DeleteFileA( filename );
ok( ret, "DeleteFile failed (%d)\n", GetLastError( ) );
LocalFree( contents );
}
static void test_CopyFileA(void)
@ -702,33 +714,22 @@ static void test_CopyFileW(void)
/*
* Debugging routine to dump a buffer in a hexdump-like fashion.
*/
static void dumpmem(unsigned char* mem, int len) {
int x,y;
char buf[200];
int ln=0;
static void dumpmem(unsigned char *mem, int len)
{
int x = 0;
char hex[49], *p;
char txt[17], *c;
for (x=0; x<len; x+=16) {
ln += sprintf(buf+ln, "%04x: ",x);
for (y=0; y<16; y++) {
if ((x+y)>len) {
ln += sprintf(buf+ln, " ");
} else {
ln += sprintf(buf+ln, "%02hhx ",mem[x+y]);
}
}
ln += sprintf(buf+ln, "- ");
for (y=0; y<16; y++) {
if ((x+y)<=len) {
if (mem[x+y]<32 || mem[x+y]>127) {
ln += sprintf(buf+ln, ".");
} else {
ln += sprintf(buf+ln, "%c",mem[x+y]);
}
}
}
sprintf(buf+ln, "\n");
trace(buf);
ln = 0;
while (x < len)
{
p = hex;
c = txt;
do {
p += sprintf(p, "%02hhx ", mem[x]);
*c++ = (mem[x] >= 32 && mem[x] <= 127) ? mem[x] : '.';
} while (++x % 16 && x < len);
*c = '\0';
trace("%04x: %-48s- %s\n", x, hex, txt);
}
}

File diff suppressed because it is too large Load diff

View file

@ -21,14 +21,34 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#define WIN32_NO_STATUS
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
#include "windef.h"
#include "winbase.h"
#include "wine/test.h"
#define MAGIC_DEAD 0xdeadbeef
/* some undocumented flags (names are made up) */
#define HEAP_PAGE_ALLOCS 0x01000000
#define HEAP_VALIDATE 0x10000000
#define HEAP_VALIDATE_ALL 0x20000000
#define HEAP_VALIDATE_PARAMS 0x40000000
static BOOL (WINAPI *pHeapQueryInformation)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
static ULONG (WINAPI *pRtlGetNtGlobalFlags)(void);
struct heap_layout
{
DWORD_PTR unknown[2];
DWORD pattern;
DWORD flags;
DWORD force_flags;
};
static SIZE_T resize_9x(SIZE_T size)
{
@ -467,8 +487,307 @@ static void test_HeapQueryInformation(void)
ok(info == 0 || info == 1 || info == 2, "expected 0, 1 or 2, got %u\n", info);
}
static void test_heap_checks( DWORD flags )
{
BYTE old, *p, *p2;
BOOL ret;
SIZE_T i, size, large_size = 3000 * 1024 + 37;
if (flags & HEAP_PAGE_ALLOCS) return; /* no tests for that case yet */
trace( "testing heap flags %08x\n", flags );
p = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 17 );
ok( p != NULL, "HeapAlloc failed\n" );
ret = HeapValidate( GetProcessHeap(), 0, p );
ok( ret, "HeapValidate failed\n" );
size = HeapSize( GetProcessHeap(), 0, p );
ok( size == 17, "Wrong size %lu\n", size );
ok( p[14] == 0, "wrong data %x\n", p[14] );
ok( p[15] == 0, "wrong data %x\n", p[15] );
ok( p[16] == 0, "wrong data %x\n", p[16] );
if (flags & HEAP_TAIL_CHECKING_ENABLED)
{
ok( p[17] == 0xab, "wrong padding %x\n", p[17] );
ok( p[18] == 0xab, "wrong padding %x\n", p[18] );
ok( p[19] == 0xab, "wrong padding %x\n", p[19] );
}
p2 = HeapReAlloc( GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, p, 14 );
if (p2 == p)
{
if (flags & HEAP_TAIL_CHECKING_ENABLED)
{
ok( p[14] == 0xab, "wrong padding %x\n", p[14] );
ok( p[15] == 0xab, "wrong padding %x\n", p[15] );
ok( p[16] == 0xab, "wrong padding %x\n", p[16] );
}
else
{
ok( p[14] == 0, "wrong padding %x\n", p[14] );
ok( p[15] == 0, "wrong padding %x\n", p[15] );
}
}
else skip( "realloc in place failed\n ");
ret = HeapFree( GetProcessHeap(), 0, p );
ok( ret, "HeapFree failed\n" );
p = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 17 );
ok( p != NULL, "HeapAlloc failed\n" );
old = p[17];
p[17] = 0xcc;
if (flags & HEAP_TAIL_CHECKING_ENABLED)
{
ret = HeapValidate( GetProcessHeap(), 0, p );
ok( !ret, "HeapValidate succeeded\n" );
/* other calls only check when HEAP_VALIDATE is set */
if (flags & HEAP_VALIDATE)
{
size = HeapSize( GetProcessHeap(), 0, p );
ok( size == ~(SIZE_T)0 || broken(size == ~0u), "Wrong size %lu\n", size );
p2 = HeapReAlloc( GetProcessHeap(), 0, p, 14 );
ok( p2 == NULL, "HeapReAlloc succeeded\n" );
ret = HeapFree( GetProcessHeap(), 0, p );
ok( !ret || broken(sizeof(void*) == 8), /* not caught on xp64 */
"HeapFree succeeded\n" );
}
p[17] = old;
size = HeapSize( GetProcessHeap(), 0, p );
ok( size == 17, "Wrong size %lu\n", size );
p2 = HeapReAlloc( GetProcessHeap(), 0, p, 14 );
ok( p2 != NULL, "HeapReAlloc failed\n" );
p = p2;
}
ret = HeapFree( GetProcessHeap(), 0, p );
ok( ret, "HeapFree failed\n" );
p = HeapAlloc( GetProcessHeap(), 0, 37 );
ok( p != NULL, "HeapAlloc failed\n" );
memset( p, 0xcc, 37 );
ret = HeapFree( GetProcessHeap(), 0, p );
ok( ret, "HeapFree failed\n" );
if (flags & HEAP_FREE_CHECKING_ENABLED)
{
ok( p[16] == 0xee, "wrong data %x\n", p[16] );
ok( p[17] == 0xfe, "wrong data %x\n", p[17] );
ok( p[18] == 0xee, "wrong data %x\n", p[18] );
ok( p[19] == 0xfe, "wrong data %x\n", p[19] );
ret = HeapValidate( GetProcessHeap(), 0, NULL );
ok( ret, "HeapValidate failed\n" );
old = p[16];
p[16] = 0xcc;
ret = HeapValidate( GetProcessHeap(), 0, NULL );
ok( !ret, "HeapValidate succeeded\n" );
p[16] = old;
ret = HeapValidate( GetProcessHeap(), 0, NULL );
ok( ret, "HeapValidate failed\n" );
}
/* now test large blocks */
p = HeapAlloc( GetProcessHeap(), 0, large_size );
ok( p != NULL, "HeapAlloc failed\n" );
ret = HeapValidate( GetProcessHeap(), 0, p );
ok( ret, "HeapValidate failed\n" );
size = HeapSize( GetProcessHeap(), 0, p );
ok( size == large_size, "Wrong size %lu\n", size );
ok( p[large_size - 2] == 0, "wrong data %x\n", p[large_size - 2] );
ok( p[large_size - 1] == 0, "wrong data %x\n", p[large_size - 1] );
if (flags & HEAP_TAIL_CHECKING_ENABLED)
{
/* Windows doesn't do tail checking on large blocks */
ok( p[large_size] == 0xab || broken(p[large_size] == 0), "wrong data %x\n", p[large_size] );
ok( p[large_size+1] == 0xab || broken(p[large_size+1] == 0), "wrong data %x\n", p[large_size+1] );
ok( p[large_size+2] == 0xab || broken(p[large_size+2] == 0), "wrong data %x\n", p[large_size+2] );
if (p[large_size] == 0xab)
{
p[large_size] = 0xcc;
ret = HeapValidate( GetProcessHeap(), 0, p );
ok( !ret, "HeapValidate succeeded\n" );
/* other calls only check when HEAP_VALIDATE is set */
if (flags & HEAP_VALIDATE)
{
size = HeapSize( GetProcessHeap(), 0, p );
ok( size == ~(SIZE_T)0, "Wrong size %lu\n", size );
p2 = HeapReAlloc( GetProcessHeap(), 0, p, large_size - 3 );
ok( p2 == NULL, "HeapReAlloc succeeded\n" );
ret = HeapFree( GetProcessHeap(), 0, p );
ok( !ret, "HeapFree succeeded\n" );
}
p[large_size] = 0xab;
}
}
ret = HeapFree( GetProcessHeap(), 0, p );
ok( ret, "HeapFree failed\n" );
/* test block sizes when tail checking */
if (flags & HEAP_TAIL_CHECKING_ENABLED)
{
for (size = 0; size < 64; size++)
{
p = HeapAlloc( GetProcessHeap(), 0, size );
for (i = 0; i < 32; i++) if (p[size + i] != 0xab) break;
ok( i >= 8, "only %lu tail bytes for size %lu\n", i, size );
HeapFree( GetProcessHeap(), 0, p );
}
}
}
static void test_debug_heap( const char *argv0, DWORD flags )
{
char keyname[MAX_PATH];
char buffer[MAX_PATH];
PROCESS_INFORMATION info;
STARTUPINFOA startup;
BOOL ret;
DWORD err;
HKEY hkey;
const char *basename;
if ((basename = strrchr( argv0, '\\' ))) basename++;
else basename = argv0;
sprintf( keyname, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%s",
basename );
if (!strcmp( keyname + strlen(keyname) - 3, ".so" )) keyname[strlen(keyname) - 3] = 0;
err = RegCreateKeyA( HKEY_LOCAL_MACHINE, keyname, &hkey );
ok( !err, "failed to create '%s' error %u\n", keyname, err );
if (err) return;
if (flags == 0xdeadbeef) /* magic value for unsetting it */
RegDeleteValueA( hkey, "GlobalFlag" );
else
RegSetValueExA( hkey, "GlobalFlag", 0, REG_DWORD, (BYTE *)&flags, sizeof(flags) );
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
sprintf( buffer, "%s heap.c 0x%x", argv0, flags );
ret = CreateProcessA( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info );
ok( ret, "failed to create child process error %u\n", GetLastError() );
if (ret)
{
winetest_wait_child_process( info.hProcess );
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
RegDeleteValueA( hkey, "GlobalFlag" );
RegCloseKey( hkey );
RegDeleteKeyA( HKEY_LOCAL_MACHINE, keyname );
}
static DWORD heap_flags_from_global_flag( DWORD flag )
{
DWORD ret = 0;
if (flag & FLG_HEAP_ENABLE_TAIL_CHECK)
ret |= HEAP_TAIL_CHECKING_ENABLED;
if (flag & FLG_HEAP_ENABLE_FREE_CHECK)
ret |= HEAP_FREE_CHECKING_ENABLED;
if (flag & FLG_HEAP_VALIDATE_PARAMETERS)
ret |= HEAP_VALIDATE_PARAMS | HEAP_VALIDATE | HEAP_TAIL_CHECKING_ENABLED | HEAP_FREE_CHECKING_ENABLED;
if (flag & FLG_HEAP_VALIDATE_ALL)
ret |= HEAP_VALIDATE_ALL | HEAP_VALIDATE | HEAP_TAIL_CHECKING_ENABLED | HEAP_FREE_CHECKING_ENABLED;
if (flag & FLG_HEAP_DISABLE_COALESCING)
ret |= HEAP_DISABLE_COALESCE_ON_FREE;
if (flag & FLG_HEAP_PAGE_ALLOCS)
ret |= HEAP_PAGE_ALLOCS | HEAP_GROWABLE;
return ret;
}
static void test_child_heap( const char *arg )
{
struct heap_layout *heap = GetProcessHeap();
DWORD expected = strtoul( arg, 0, 16 );
DWORD expect_heap;
if (expected == 0xdeadbeef) /* expected value comes from Session Manager global flags */
{
HKEY hkey;
expected = 0;
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager", &hkey ))
{
char buffer[32];
DWORD type, size = sizeof(buffer);
if (!RegQueryValueExA( hkey, "GlobalFlag", 0, &type, (BYTE *)buffer, &size ))
{
if (type == REG_DWORD) expected = *(DWORD *)buffer;
else if (type == REG_SZ) expected = strtoul( buffer, 0, 16 );
}
RegCloseKey( hkey );
}
}
if (expected && !pRtlGetNtGlobalFlags()) /* not working on NT4 */
{
win_skip( "global flags not set\n" );
return;
}
ok( pRtlGetNtGlobalFlags() == expected,
"%s: got global flags %08x expected %08x\n", arg, pRtlGetNtGlobalFlags(), expected );
expect_heap = heap_flags_from_global_flag( expected );
if (!(heap->flags & HEAP_GROWABLE) || heap->pattern == 0xffeeffee) /* vista layout */
{
ok( heap->flags == 0, "%s: got heap flags %08x expected 0\n", arg, heap->flags );
}
else if (heap->pattern == 0xeeeeeeee && heap->flags == 0xeeeeeeee)
{
ok( expected & FLG_HEAP_PAGE_ALLOCS, "%s: got heap flags 0xeeeeeeee without page alloc\n", arg );
}
else
{
ok( heap->flags == (expect_heap | HEAP_GROWABLE),
"%s: got heap flags %08x expected %08x\n", arg, heap->flags, expect_heap );
ok( heap->force_flags == (expect_heap & ~0x18000080),
"%s: got heap force flags %08x expected %08x\n", arg, heap->force_flags, expect_heap );
expect_heap = heap->flags;
}
test_heap_checks( expect_heap );
}
START_TEST(heap)
{
int argc;
char **argv;
pRtlGetNtGlobalFlags = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "RtlGetNtGlobalFlags" );
argc = winetest_get_mainargs( &argv );
if (argc >= 3)
{
test_child_heap( argv[2] );
return;
}
test_heap();
test_obsolete_flags();
@ -480,4 +799,20 @@ START_TEST(heap)
test_sized_HeapReAlloc((1 << 20), (2 << 20));
test_sized_HeapReAlloc((1 << 20), 1);
test_HeapQueryInformation();
if (pRtlGetNtGlobalFlags)
{
test_debug_heap( argv[0], 0 );
test_debug_heap( argv[0], FLG_HEAP_ENABLE_TAIL_CHECK );
test_debug_heap( argv[0], FLG_HEAP_ENABLE_FREE_CHECK );
test_debug_heap( argv[0], FLG_HEAP_VALIDATE_PARAMETERS );
test_debug_heap( argv[0], FLG_HEAP_VALIDATE_ALL );
test_debug_heap( argv[0], FLG_POOL_ENABLE_TAGGING );
test_debug_heap( argv[0], FLG_HEAP_ENABLE_TAGGING );
test_debug_heap( argv[0], FLG_HEAP_ENABLE_TAG_BY_DLL );
test_debug_heap( argv[0], FLG_HEAP_DISABLE_COALESCING );
test_debug_heap( argv[0], FLG_HEAP_PAGE_ALLOCS );
test_debug_heap( argv[0], 0xdeadbeef );
}
else win_skip( "RtlGetNtGlobalFlags not found, skipping heap debug tests\n" );
}

View file

@ -17,6 +17,7 @@
<file>directory.c</file>
<file>drive.c</file>
<file>environ.c</file>
<file>fiber.c</file>
<file>file.c</file>
<file>format_msg.c</file>
<!-- <file>generated.c</file> -->

View file

@ -359,6 +359,24 @@ static void testLoadLibraryEx(void)
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
broken(GetLastError() == ERROR_INVALID_HANDLE), /* nt4 */
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
/* Free the loaded dll when its the first time this dll is loaded
in process - First time should pass, second fail */
SetLastError(0xdeadbeef);
hmodule = LoadLibraryExA("comctl32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
ok(hmodule != 0, "Expected valid module handle\n");
SetLastError(0xdeadbeef);
ok(FreeLibrary(hmodule),
"Expected to be able to free the module, failed with %d\n",
GetLastError());
SetLastError(0xdeadbeef);
ok(!FreeLibrary(hmodule),
"Unexpected ability to free the module, failed with %d\n",
GetLastError());
CloseHandle(hmodule);
}
START_TEST(module)

View file

@ -57,6 +57,9 @@ static DWORD (WINAPI *pGetLongPathNameW)(LPWSTR,LPWSTR,DWORD);
static BOOL (WINAPI *pNeedCurrentDirectoryForExePathA)(LPCSTR);
static BOOL (WINAPI *pNeedCurrentDirectoryForExePathW)(LPCWSTR);
static DWORD (WINAPI *pSearchPathA)(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
static DWORD (WINAPI *pSearchPathW)(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*);
/* a structure to deal with wine todos somewhat cleanly */
typedef struct {
DWORD shortlen;
@ -420,6 +423,7 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
{
CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH];
char *buffer;
DWORD len,len1;
/* Save the original directory, so that we can return to it at the end
of the test
@ -434,6 +438,45 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
ok(len1==len+1, "GetCurrentDirectoryA returned %d instead of %d\n",len1,len+1);
ok(lstrcmpiA(tmpstr,"aaaaaaa")==0,
"GetCurrentDirectoryA should not have modified the buffer\n");
buffer = HeapAlloc( GetProcessHeap(), 0, 2 * 65536 );
SetLastError( 0xdeadbeef );
strcpy( buffer, "foo" );
len = GetCurrentDirectoryA( 32767, buffer );
ok( len != 0 && len < MAX_PATH, "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
SetLastError( 0xdeadbeef );
strcpy( buffer, "foo" );
len = GetCurrentDirectoryA( 32768, buffer );
ok( len != 0 && len < MAX_PATH, "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
SetLastError( 0xdeadbeef );
strcpy( buffer, "foo" );
len = GetCurrentDirectoryA( 65535, buffer );
ok( (len != 0 && len < MAX_PATH) || broken(!len), /* nt4, win2k, xp */ "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
SetLastError( 0xdeadbeef );
strcpy( buffer, "foo" );
len = GetCurrentDirectoryA( 65536, buffer );
ok( (len != 0 && len < MAX_PATH) || broken(!len), /* nt4 */ "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
SetLastError( 0xdeadbeef );
strcpy( buffer, "foo" );
len = GetCurrentDirectoryA( 2 * 65536, buffer );
ok( (len != 0 && len < MAX_PATH) || broken(!len), /* nt4 */ "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
HeapFree( GetProcessHeap(), 0, buffer );
/* Check for crash prevention on swapped args. Crashes all but Win9x.
*/
if (0)
{
SetLastError( 0xdeadbeef );
len = GetCurrentDirectoryA( 42, (LPSTR)(MAX_PATH + 42) );
ok( len == 0 && GetLastError() == ERROR_INVALID_PARAMETER,
"GetCurrentDirectoryA failed to fail %u err %u\n", len, GetLastError() );
}
/* SetCurrentDirectoryA shouldn't care whether the string has a
trailing '\\' or not
*/
@ -1323,6 +1366,12 @@ static void test_GetWindowsDirectory(void)
static void test_NeedCurrentDirectoryForExePathA(void)
{
if (!pNeedCurrentDirectoryForExePathA)
{
win_skip("NeedCurrentDirectoryForExePathA is not available\n");
return;
}
/* Crashes in Windows */
if (0)
ok(pNeedCurrentDirectoryForExePathA(NULL), "returned FALSE for NULL\n");
@ -1344,6 +1393,12 @@ static void test_NeedCurrentDirectoryForExePathW(void)
const WCHAR fullpath[] = {'c', ':', '\\', 0};
const WCHAR cmdname[] = {'c', 'm', 'd', '.', 'e', 'x', 'e', 0};
if (!pNeedCurrentDirectoryForExePathW)
{
win_skip("NeedCurrentDirectoryForExePathW is not available\n");
return;
}
/* Crashes in Windows */
if (0)
ok(pNeedCurrentDirectoryForExePathW(NULL), "returned FALSE for NULL\n");
@ -1444,19 +1499,95 @@ static void test_drive_letter_case(void)
#undef is_upper_case_letter
}
static void test_SearchPathA(void)
{
CHAR pathA[MAX_PATH], fileA[] = "", buffA[MAX_PATH];
CHAR *ptrA = NULL;
DWORD ret;
if (!pSearchPathA)
{
win_skip("SearchPathA isn't available\n");
return;
}
GetWindowsDirectoryA(pathA, sizeof(pathA)/sizeof(CHAR));
/* NULL filename */
SetLastError(0xdeadbeef);
ret = pSearchPathA(pathA, NULL, NULL, sizeof(buffA)/sizeof(CHAR), buffA, &ptrA);
ok(ret == 0, "Expected failure, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %x\n", GetLastError());
/* empty filename */
SetLastError(0xdeadbeef);
ret = pSearchPathA(pathA, fileA, NULL, sizeof(buffA)/sizeof(CHAR), buffA, &ptrA);
ok(ret == 0, "Expected failure, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
broken(GetLastError() == ERROR_FILE_NOT_FOUND) /* win9x */,
"Expected ERROR_INVALID_PARAMETER, got %x\n", GetLastError());
}
static void test_SearchPathW(void)
{
WCHAR pathW[MAX_PATH], fileW[] = { 0 }, buffW[MAX_PATH];
WCHAR *ptrW = NULL;
DWORD ret;
if (!pSearchPathW)
{
win_skip("SearchPathW isn't available\n");
return;
}
/* SearchPathW is a stub on win9x and doesn't return sane error,
so quess if it's implemented indirectly */
SetLastError(0xdeadbeef);
GetWindowsDirectoryW(pathW, sizeof(pathW)/sizeof(WCHAR));
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("SearchPathW not implemented\n");
return;
}
if (0)
{
/* NULL filename, crashes on nt4 */
SetLastError(0xdeadbeef);
ret = pSearchPathW(pathW, NULL, NULL, sizeof(buffW)/sizeof(WCHAR), buffW, &ptrW);
ok(ret == 0, "Expected failure, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %x\n", GetLastError());
}
/* empty filename */
SetLastError(0xdeadbeef);
ret = pSearchPathW(pathW, fileW, NULL, sizeof(buffW)/sizeof(WCHAR), buffW, &ptrW);
ok(ret == 0, "Expected failure, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %x\n", GetLastError());
}
static void init_pointers(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hKernel32, #f))
MAKEFUNC(GetLongPathNameA);
MAKEFUNC(GetLongPathNameW);
MAKEFUNC(NeedCurrentDirectoryForExePathA);
MAKEFUNC(NeedCurrentDirectoryForExePathW);
MAKEFUNC(SearchPathA);
MAKEFUNC(SearchPathW);
#undef MAKEFUNC
}
START_TEST(path)
{
CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive;
pGetLongPathNameA = (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"GetLongPathNameA" );
pGetLongPathNameW = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll") ,
"GetLongPathNameW" );
pNeedCurrentDirectoryForExePathA =
(void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"NeedCurrentDirectoryForExePathA" );
pNeedCurrentDirectoryForExePathW =
(void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"NeedCurrentDirectoryForExePathW" );
init_pointers();
/* Report only once */
if (!pGetLongPathNameA)
@ -1474,13 +1605,9 @@ START_TEST(path)
test_GetShortPathNameW();
test_GetSystemDirectory();
test_GetWindowsDirectory();
if (pNeedCurrentDirectoryForExePathA)
{
test_NeedCurrentDirectoryForExePathA();
}
if (pNeedCurrentDirectoryForExePathW)
{
test_NeedCurrentDirectoryForExePathW();
}
test_NeedCurrentDirectoryForExePathA();
test_NeedCurrentDirectoryForExePathW();
test_drive_letter_case();
test_SearchPathA();
test_SearchPathW();
}

View file

@ -1,5 +1,5 @@
/*
* Unit test suite for CreateProcess function.
* Unit test suite for process functions
*
* Copyright 2002 Eric Pouech
* Copyright 2006 Dmitry Timoshkov

View file

@ -1,5 +1,5 @@
/*
* Unit test suite for environment functions.
* Unit test suite for resource functions.
*
* Copyright 2006 Mike McCormack
*

View file

@ -20,6 +20,7 @@ extern void func_console(void);
extern void func_directory(void);
extern void func_drive(void);
extern void func_environ(void);
extern void func_fiber(void);
extern void func_file(void);
extern void func_format_msg(void);
extern void func_heap(void);
@ -55,6 +56,7 @@ const struct test winetest_testlist[] =
{ "directory", func_directory },
{ "drive", func_drive },
{ "environ", func_environ },
{ "fiber", func_fiber },
{ "file", func_file },
{ "format_msg", func_format_msg },
{ "heap", func_heap },

View file

@ -1,5 +1,5 @@
/*
* Unit test suite for directory functions.
* Unit test suite for thread functions.
*
* Copyright 2002 Geoffrey Hausheer
*
@ -54,26 +54,17 @@
# endif
#endif
typedef BOOL (WINAPI *GetThreadPriorityBoost_t)(HANDLE,PBOOL);
static GetThreadPriorityBoost_t pGetThreadPriorityBoost=NULL;
typedef HANDLE (WINAPI *OpenThread_t)(DWORD,BOOL,DWORD);
static OpenThread_t pOpenThread=NULL;
typedef BOOL (WINAPI *QueueUserWorkItem_t)(LPTHREAD_START_ROUTINE,PVOID,ULONG);
static QueueUserWorkItem_t pQueueUserWorkItem=NULL;
typedef DWORD (WINAPI *SetThreadIdealProcessor_t)(HANDLE,DWORD);
static SetThreadIdealProcessor_t pSetThreadIdealProcessor=NULL;
typedef BOOL (WINAPI *SetThreadPriorityBoost_t)(HANDLE,BOOL);
static SetThreadPriorityBoost_t pSetThreadPriorityBoost=NULL;
typedef BOOL (WINAPI *RegisterWaitForSingleObject_t)(PHANDLE,HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG);
static RegisterWaitForSingleObject_t pRegisterWaitForSingleObject=NULL;
typedef BOOL (WINAPI *UnregisterWait_t)(HANDLE);
static UnregisterWait_t pUnregisterWait=NULL;
static BOOL (WINAPI *pGetThreadPriorityBoost)(HANDLE,PBOOL);
static HANDLE (WINAPI *pOpenThread)(DWORD,BOOL,DWORD);
static BOOL (WINAPI *pQueueUserWorkItem)(LPTHREAD_START_ROUTINE,PVOID,ULONG);
static DWORD (WINAPI *pSetThreadIdealProcessor)(HANDLE,DWORD);
static BOOL (WINAPI *pSetThreadPriorityBoost)(HANDLE,BOOL);
static BOOL (WINAPI *pRegisterWaitForSingleObject)(PHANDLE,HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG);
static BOOL (WINAPI *pUnregisterWait)(HANDLE);
static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);
static BOOL (WINAPI *pSetThreadErrorMode)(DWORD,PDWORD);
static DWORD (WINAPI *pGetThreadErrorMode)(void);
static DWORD (WINAPI *pRtlGetThreadErrorMode)(void);
static HANDLE create_target_process(const char *arg)
{
@ -792,6 +783,9 @@ static VOID test_thread_processor(void)
DWORD_PTR processMask,systemMask;
SYSTEM_INFO sysInfo;
int error=0;
BOOL is_wow64;
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
sysInfo.dwNumberOfProcessors=0;
GetSystemInfo(&sysInfo);
@ -820,12 +814,27 @@ static VOID test_thread_processor(void)
}
ok(error!=-1, "SetThreadIdealProcessor failed\n");
SetLastError(0xdeadbeef);
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
ok(error==-1,
"SetThreadIdealProcessor succeeded with an illegal processor #\n");
ok(GetLastError()==ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
if (is_wow64)
{
SetLastError(0xdeadbeef);
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
todo_wine
ok(error!=-1, "SetThreadIdealProcessor failed for %u on Wow64\n", MAXIMUM_PROCESSORS+1);
SetLastError(0xdeadbeef);
error=pSetThreadIdealProcessor(curthread,65);
ok(error==-1, "SetThreadIdealProcessor succeeded with an illegal processor #\n");
ok(GetLastError()==ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
else
{
SetLastError(0xdeadbeef);
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
ok(error==-1, "SetThreadIdealProcessor succeeded with an illegal processor #\n");
ok(GetLastError()==ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
@ -1203,9 +1212,103 @@ static void test_TLS(void)
cleanup_thread_sync_helpers();
}
static void test_ThreadErrorMode(void)
{
DWORD oldmode;
DWORD mode;
DWORD rtlmode;
BOOL ret;
if (!pSetThreadErrorMode || !pGetThreadErrorMode)
{
win_skip("SetThreadErrorMode and/or GetThreadErrorMode unavailable (added in Windows 7)\n");
return;
}
if (!pRtlGetThreadErrorMode) {
win_skip("RtlGetThreadErrorMode not available\n");
return;
}
oldmode = pGetThreadErrorMode();
ret = pSetThreadErrorMode(0, &mode);
ok(ret, "SetThreadErrorMode failed\n");
ok(mode == oldmode,
"SetThreadErrorMode returned old mode 0x%x, expected 0x%x\n",
mode, oldmode);
mode = pGetThreadErrorMode();
ok(mode == 0, "GetThreadErrorMode returned mode 0x%x, expected 0\n", mode);
rtlmode = pRtlGetThreadErrorMode();
ok(rtlmode == 0,
"RtlGetThreadErrorMode returned mode 0x%x, expected 0\n", mode);
ret = pSetThreadErrorMode(SEM_FAILCRITICALERRORS, &mode);
ok(ret, "SetThreadErrorMode failed\n");
ok(mode == 0,
"SetThreadErrorMode returned old mode 0x%x, expected 0\n", mode);
mode = pGetThreadErrorMode();
ok(mode == SEM_FAILCRITICALERRORS,
"GetThreadErrorMode returned mode 0x%x, expected SEM_FAILCRITICALERRORS\n",
mode);
rtlmode = pRtlGetThreadErrorMode();
ok(rtlmode == 0x10,
"RtlGetThreadErrorMode returned mode 0x%x, expected 0x10\n", mode);
ret = pSetThreadErrorMode(SEM_NOGPFAULTERRORBOX, &mode);
ok(ret, "SetThreadErrorMode failed\n");
ok(mode == SEM_FAILCRITICALERRORS,
"SetThreadErrorMode returned old mode 0x%x, expected SEM_FAILCRITICALERRORS\n",
mode);
mode = pGetThreadErrorMode();
ok(mode == SEM_NOGPFAULTERRORBOX,
"GetThreadErrorMode returned mode 0x%x, expected SEM_NOGPFAULTERRORBOX\n",
mode);
rtlmode = pRtlGetThreadErrorMode();
ok(rtlmode == 0x20,
"RtlGetThreadErrorMode returned mode 0x%x, expected 0x20\n", mode);
ret = pSetThreadErrorMode(SEM_NOOPENFILEERRORBOX, NULL);
ok(ret, "SetThreadErrorMode failed\n");
mode = pGetThreadErrorMode();
ok(mode == SEM_NOOPENFILEERRORBOX,
"GetThreadErrorMode returned mode 0x%x, expected SEM_NOOPENFILEERRORBOX\n",
mode);
rtlmode = pRtlGetThreadErrorMode();
ok(rtlmode == 0x40,
"RtlGetThreadErrorMode returned mode 0x%x, expected 0x40\n", rtlmode);
for (mode = 1; mode; mode <<= 1)
{
ret = pSetThreadErrorMode(mode, NULL);
if (mode & (SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX))
{
ok(ret,
"SetThreadErrorMode(0x%x,NULL) failed with error %d\n",
mode, GetLastError());
}
else
{
DWORD GLE = GetLastError();
ok(!ret,
"SetThreadErrorMode(0x%x,NULL) succeeded, expected failure\n",
mode);
ok(GLE == ERROR_INVALID_PARAMETER,
"SetThreadErrorMode(0x%x,NULL) failed with %d, "
"expected ERROR_INVALID_PARAMETER\n",
mode, GLE);
}
}
pSetThreadErrorMode(oldmode, NULL);
}
START_TEST(thread)
{
HINSTANCE lib;
HINSTANCE ntdll;
int argc;
char **argv;
argc = winetest_get_mainargs( &argv );
@ -1214,13 +1317,22 @@ START_TEST(thread)
*/
lib=GetModuleHandleA("kernel32.dll");
ok(lib!=NULL,"Couldn't get a handle for kernel32.dll\n");
pGetThreadPriorityBoost=(GetThreadPriorityBoost_t)GetProcAddress(lib,"GetThreadPriorityBoost");
pOpenThread=(OpenThread_t)GetProcAddress(lib,"OpenThread");
pQueueUserWorkItem=(QueueUserWorkItem_t)GetProcAddress(lib,"QueueUserWorkItem");
pSetThreadIdealProcessor=(SetThreadIdealProcessor_t)GetProcAddress(lib,"SetThreadIdealProcessor");
pSetThreadPriorityBoost=(SetThreadPriorityBoost_t)GetProcAddress(lib,"SetThreadPriorityBoost");
pRegisterWaitForSingleObject=(RegisterWaitForSingleObject_t)GetProcAddress(lib,"RegisterWaitForSingleObject");
pUnregisterWait=(UnregisterWait_t)GetProcAddress(lib,"UnregisterWait");
pGetThreadPriorityBoost=(void *)GetProcAddress(lib,"GetThreadPriorityBoost");
pOpenThread=(void *)GetProcAddress(lib,"OpenThread");
pQueueUserWorkItem=(void *)GetProcAddress(lib,"QueueUserWorkItem");
pSetThreadIdealProcessor=(void *)GetProcAddress(lib,"SetThreadIdealProcessor");
pSetThreadPriorityBoost=(void *)GetProcAddress(lib,"SetThreadPriorityBoost");
pRegisterWaitForSingleObject=(void *)GetProcAddress(lib,"RegisterWaitForSingleObject");
pUnregisterWait=(void *)GetProcAddress(lib,"UnregisterWait");
pIsWow64Process=(void *)GetProcAddress(lib,"IsWow64Process");
pSetThreadErrorMode=(void *)GetProcAddress(lib,"SetThreadErrorMode");
pGetThreadErrorMode=(void *)GetProcAddress(lib,"GetThreadErrorMode");
ntdll=GetModuleHandleA("ntdll.dll");
if (ntdll)
{
pRtlGetThreadErrorMode=(void *)GetProcAddress(ntdll,"RtlGetThreadErrorMode");
}
if (argc >= 3)
{
@ -1264,4 +1376,5 @@ START_TEST(thread)
test_QueueUserWorkItem();
test_RegisterWaitForSingleObject();
test_TLS();
test_ThreadErrorMode();
}

View file

@ -1,5 +1,5 @@
/*
* Unit test suite for time functions
* Unit test suite for timer functions
*
* Copyright 2004 Mike McCormack
*

View file

@ -872,13 +872,70 @@ static void test_CreateFileMapping(void)
CloseHandle( handle );
}
static void test_BadPtr(void)
static void test_IsBadReadPtr(void)
{
void *ptr = (void*)1;
/* We assume address 1 is not mapped. */
ok(IsBadReadPtr(ptr,1),"IsBadReadPtr(1) failed.\n");
ok(IsBadWritePtr(ptr,1),"IsBadWritePtr(1) failed.\n");
ok(IsBadCodePtr(ptr),"IsBadCodePtr(1) failed.\n");
BOOL ret;
void *ptr = (void *)0xdeadbeef;
char stackvar;
ret = IsBadReadPtr(NULL, 0);
ok(ret == FALSE, "Expected IsBadReadPtr to return FALSE, got %d\n", ret);
ret = IsBadReadPtr(NULL, 1);
ok(ret == TRUE, "Expected IsBadReadPtr to return TRUE, got %d\n", ret);
ret = IsBadReadPtr(ptr, 0);
ok(ret == FALSE, "Expected IsBadReadPtr to return FALSE, got %d\n", ret);
ret = IsBadReadPtr(ptr, 1);
ok(ret == TRUE, "Expected IsBadReadPtr to return TRUE, got %d\n", ret);
ret = IsBadReadPtr(&stackvar, 0);
ok(ret == FALSE, "Expected IsBadReadPtr to return FALSE, got %d\n", ret);
ret = IsBadReadPtr(&stackvar, sizeof(char));
ok(ret == FALSE, "Expected IsBadReadPtr to return FALSE, got %d\n", ret);
}
static void test_IsBadWritePtr(void)
{
BOOL ret;
void *ptr = (void *)0xdeadbeef;
char stackval;
ret = IsBadWritePtr(NULL, 0);
ok(ret == FALSE, "Expected IsBadWritePtr to return FALSE, got %d\n", ret);
ret = IsBadWritePtr(NULL, 1);
ok(ret == TRUE, "Expected IsBadWritePtr to return TRUE, got %d\n", ret);
ret = IsBadWritePtr(ptr, 0);
ok(ret == FALSE, "Expected IsBadWritePtr to return FALSE, got %d\n", ret);
ret = IsBadWritePtr(ptr, 1);
ok(ret == TRUE, "Expected IsBadWritePtr to return TRUE, got %d\n", ret);
ret = IsBadWritePtr(&stackval, 0);
ok(ret == FALSE, "Expected IsBadWritePtr to return FALSE, got %d\n", ret);
ret = IsBadWritePtr(&stackval, sizeof(char));
ok(ret == FALSE, "Expected IsBadWritePtr to return FALSE, got %d\n", ret);
}
static void test_IsBadCodePtr(void)
{
BOOL ret;
void *ptr = (void *)0xdeadbeef;
char stackval;
ret = IsBadCodePtr(NULL);
ok(ret == TRUE, "Expected IsBadCodePtr to return TRUE, got %d\n", ret);
ret = IsBadCodePtr(ptr);
ok(ret == TRUE, "Expected IsBadCodePtr to return TRUE, got %d\n", ret);
ret = IsBadCodePtr((void *)&stackval);
ok(ret == FALSE, "Expected IsBadCodePtr to return FALSE, got %d\n", ret);
}
static void test_write_watch(void)
@ -1220,6 +1277,8 @@ START_TEST(virtual)
test_MapViewOfFile();
test_NtMapViewOfSection();
test_CreateFileMapping();
test_BadPtr();
test_IsBadReadPtr();
test_IsBadWritePtr();
test_IsBadCodePtr();
test_write_watch();
}

View file

@ -1,5 +1,5 @@
/*
* Unit test suite
* Unit test suite for volume functions
*
* Copyright 2006 Stefan Leichter
*