Skip to content

Commit abc34f7

Browse files
committed
-sync kernel32_winetest with wine 1.1.32
svn path=/trunk/; revision=43744
1 parent 01a9e74 commit abc34f7

File tree

15 files changed

+451
-295
lines changed

15 files changed

+451
-295
lines changed

rostests/winetests/kernel32/actctx.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ static BOOL create_wide_manifest(const char *filename, const char *manifest, BOO
246246

247247
typedef struct {
248248
ULONG format_version;
249-
ULONG assembly_cnt;
249+
ULONG assembly_cnt_min;
250+
ULONG assembly_cnt_max;
250251
ULONG root_manifest_type;
251252
LPWSTR root_manifest_path;
252253
ULONG root_config_type;
@@ -255,23 +256,24 @@ typedef struct {
255256
} detailed_info_t;
256257

257258
static const detailed_info_t detailed_info0 = {
258-
0, 0, 0, NULL, 0, 0, NULL
259+
0, 0, 0, 0, NULL, 0, 0, NULL
259260
};
260261

261262
static const detailed_info_t detailed_info1 = {
262-
1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
263+
1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
263264
ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
264265
work_dir,
265266
};
266267

267268
static const detailed_info_t detailed_info1_child = {
268-
1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, app_manifest_path,
269+
1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, app_manifest_path,
269270
ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
270271
app_dir,
271272
};
272273

274+
/* On Vista+, there's an extra assembly for Microsoft.Windows.Common-Controls.Resources */
273275
static const detailed_info_t detailed_info2 = {
274-
1, 2, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
276+
1, 2, 3, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
275277
ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
276278
work_dir,
277279
};
@@ -310,9 +312,10 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo)
310312
ok(detailed_info->ulFormatVersion == exinfo->format_version,
311313
"detailed_info->ulFormatVersion=%u, expected %u\n", detailed_info->ulFormatVersion,
312314
exinfo->format_version);
313-
ok(detailed_info->ulAssemblyCount == exinfo->assembly_cnt,
314-
"detailed_info->ulAssemblyCount=%u, expected %u\n", detailed_info->ulAssemblyCount,
315-
exinfo->assembly_cnt);
315+
ok(exinfo->assembly_cnt_min <= detailed_info->ulAssemblyCount &&
316+
detailed_info->ulAssemblyCount <= exinfo->assembly_cnt_max,
317+
"detailed_info->ulAssemblyCount=%u, expected between %u and %u\n", detailed_info->ulAssemblyCount,
318+
exinfo->assembly_cnt_min, exinfo->assembly_cnt_max);
316319
ok(detailed_info->ulRootManifestPathType == exinfo->root_manifest_type,
317320
"detailed_info->ulRootManifestPathType=%u, expected %u\n",
318321
detailed_info->ulRootManifestPathType, exinfo->root_manifest_type);
@@ -1139,6 +1142,8 @@ static void run_child_process(void)
11391142
char **argv;
11401143
PROCESS_INFORMATION pi;
11411144
STARTUPINFO si = { 0 };
1145+
HANDLE file;
1146+
FILETIME now;
11421147

11431148
GetModuleFileNameA(NULL, path, MAX_PATH);
11441149
strcat(path, ".manifest");
@@ -1149,6 +1154,15 @@ static void run_child_process(void)
11491154

11501155
si.cb = sizeof(si);
11511156
winetest_get_mainargs( &argv );
1157+
/* Vista+ seems to cache presence of .manifest files. Change last modified
1158+
date to defeat the cache */
1159+
file = CreateFileA(argv[0], FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE,
1160+
NULL, OPEN_EXISTING, 0, NULL);
1161+
if (file != INVALID_HANDLE_VALUE) {
1162+
GetSystemTimeAsFileTime(&now);
1163+
SetFileTime(file, NULL, NULL, &now);
1164+
CloseHandle(file);
1165+
}
11521166
sprintf(cmdline, "\"%s\" %s manifest1", argv[0], argv[1]);
11531167
ok(CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL,
11541168
&si, &pi) != 0, "Could not create process: %u\n", GetLastError());

rostests/winetests/kernel32/atom.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,10 @@ static void test_local_error_handling(void)
619619

620620
START_TEST(atom)
621621
{
622+
/* Global atom table seems to be available to GUI apps only in
623+
Win7, so let's turn this app into a GUI app */
624+
GetDesktopWindow();
625+
622626
test_add_atom();
623627
test_get_atom_name();
624628
test_error_handling();

rostests/winetests/kernel32/codepage.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ static void test_negative_source_length(void)
131131
SetLastError( 0xdeadbeef );
132132
memset(buf,'x',sizeof(buf));
133133
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL);
134-
ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef,
134+
ok(len == 7 && GetLastError() == 0xdeadbeef,
135135
"WideCharToMultiByte(-2002): len=%d error=%u\n", len, GetLastError());
136+
ok(!lstrcmpA(buf, "foobar"),
137+
"WideCharToMultiByte(-2002): expected \"foobar\" got \"%s\"\n", buf);
136138

137139
SetLastError( 0xdeadbeef );
138140
memset(bufW,'x',sizeof(bufW));

rostests/winetests/kernel32/comm.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,17 +684,20 @@ static HANDLE test_OpenComm(BOOL doOverlap)
684684
if (hcom == INVALID_HANDLE_VALUE)
685685
trace("Could not find a valid COM port. Skipping test_ReadTimeOut\n");
686686
else
687-
trace("Found Com port %s. Connected devices may disturbe results\n", port_name);
687+
trace("Found Com port %s. Connected devices may disturb results\n", port_name);
688688
/*shown = TRUE; */
689689
}
690690
if (hcom != INVALID_HANDLE_VALUE)
691691
{
692692
BOOL ret;
693693

694694
ret = ClearCommError(hcom, &errors, &comstat);
695-
if (!ret && GetLastError() == ERROR_NOT_READY)
695+
if (!ret && (GetLastError() == ERROR_NOT_READY || GetLastError() == ERROR_INVALID_HANDLE))
696696
{
697-
trace("%s doesn't respond, skipping the test\n", port_name);
697+
if (GetLastError() == ERROR_NOT_READY)
698+
trace("%s doesn't respond, skipping the test\n", port_name);
699+
else
700+
trace("%s is not a real serial port, skipping the test\n", port_name);
698701
CloseHandle(hcom);
699702
return INVALID_HANDLE_VALUE;
700703
}
@@ -1643,6 +1646,16 @@ static void test_WaitBreak(HANDLE hcom)
16431646
ok(ClearCommBreak(hcom), "ClearCommBreak failed\n");
16441647
}
16451648

1649+
static void test_stdio(void)
1650+
{
1651+
DCB dcb;
1652+
1653+
/* cygwin tries this to determine the stdin handle type */
1654+
ok( !GetCommState( GetStdHandle(STD_INPUT_HANDLE), &dcb ), "GetCommState succeeded on stdin\n" );
1655+
ok( GetLastError() == ERROR_INVALID_HANDLE || GetLastError() == ERROR_INVALID_FUNCTION,
1656+
"got error %u\n", GetLastError() );
1657+
}
1658+
16461659
START_TEST(comm)
16471660
{
16481661
HANDLE hcom;
@@ -1735,4 +1748,5 @@ START_TEST(comm)
17351748
test_WaitBreak(hcom);
17361749
CloseHandle(hcom);
17371750
}
1751+
test_stdio();
17381752
}

rostests/winetests/kernel32/console.c

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,7 @@ static void testCursorInfo(HANDLE hCon)
160160
ok(GetLastError() == 0xdeadbeef, "GetLastError: expecting %u got %u\n",
161161
0xdeadbeef, GetLastError());
162162

163-
if (info.dwSize == 12)
164-
{
165-
win_skip("NULL CONSOLE_CURSOR_INFO will crash on win9x\n");
166-
return;
167-
}
168-
169-
SetLastError(0xdeadbeef);
170-
ret = GetConsoleCursorInfo(hCon, NULL);
171-
ok(!ret, "Expected failure\n");
172-
ok(GetLastError() == ERROR_INVALID_ACCESS, "GetLastError: expecting %u got %u\n",
173-
ERROR_INVALID_ACCESS, GetLastError());
163+
/* Don't test NULL CONSOLE_CURSOR_INFO, it crashes on win9x and win7 */
174164
}
175165

176166
static void testEmptyWrite(HANDLE hCon)
@@ -280,6 +270,7 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
280270
const int mylen = strlen(mytest);
281271
const int mylen2 = strchr(mytest, '\n') - mytest;
282272
int p;
273+
WORD attr;
283274

284275
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT),
285276
"clearing wrap at EOL & setting processed output\n");
@@ -294,6 +285,15 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
294285
{
295286
okCHAR(hCon, c, mytest[c.X - sbSize.X + 5], TEST_ATTRIB);
296287
}
288+
289+
ReadConsoleOutputAttribute(hCon, &attr, 1, c, &len);
290+
/* Win9x and WinMe change the attribs for '\n' up to 'f' */
291+
if (attr == TEST_ATTRIB)
292+
{
293+
win_skip("Win9x/WinMe don't respect ~ENABLE_WRAP_AT_EOL_OUTPUT\n");
294+
return;
295+
}
296+
297297
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
298298

299299
c.X = 0; c.Y++;
@@ -391,6 +391,7 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
391391
const char* mytest = "abcd\nf\tg";
392392
const int mylen = strlen(mytest);
393393
int p;
394+
WORD attr;
394395

395396
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)),
396397
"setting wrap at EOL & processed output\n");
@@ -406,7 +407,11 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
406407
okCHAR(hCon, c, mytest[p], TEST_ATTRIB);
407408
}
408409
c.X = sbSize.X - 9 + p;
409-
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
410+
ReadConsoleOutputAttribute(hCon, &attr, 1, c, &len);
411+
if (attr == TEST_ATTRIB)
412+
win_skip("Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
413+
else
414+
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
410415
c.X = 0; c.Y++;
411416
okCHAR(hCon, c, mytest[5], TEST_ATTRIB);
412417
for (c.X = 1; c.X < 8; c.X++)
@@ -429,7 +434,11 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
429434
c.X = 0; c.Y++;
430435
okCHAR(hCon, c, mytest[3], TEST_ATTRIB);
431436
c.X++;
432-
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
437+
ReadConsoleOutputAttribute(hCon, &attr, 1, c, &len);
438+
if (attr == TEST_ATTRIB)
439+
win_skip("Win9x/WinMe changes attribs for '\\n' up to 'f'\n");
440+
else
441+
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
433442

434443
c.X = 0; c.Y++;
435444
okCHAR(hCon, c, mytest[5], TEST_ATTRIB);

rostests/winetests/kernel32/debugger.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
static int myARGC;
3535
static char** myARGV;
3636

37+
static BOOL (WINAPI *pCheckRemoteDebuggerPresent)(HANDLE,PBOOL);
3738
static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD);
3839
static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL);
3940

@@ -283,6 +284,7 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
283284
* detaching, then the debuggee gets a special exit code.
284285
*/
285286
ok(exit_code == STATUS_DEBUGGER_INACTIVE ||
287+
broken(exit_code == STATUS_ACCESS_VIOLATION) || /* Intermittent Vista+ */
286288
broken(exit_code == 0xffffffff) || /* Win9x */
287289
broken(exit_code == WAIT_ABANDONED), /* NT4, W2K */
288290
"wrong exit code : %08x\n", exit_code);
@@ -433,11 +435,42 @@ static void test_ExitCode(void)
433435
}
434436
}
435437

438+
static void test_RemoteDebugger(void)
439+
{
440+
BOOL bret, present;
441+
if(!pCheckRemoteDebuggerPresent)
442+
{
443+
win_skip("CheckRemoteDebuggerPresent is not available\n");
444+
return;
445+
}
446+
present = TRUE;
447+
SetLastError(0xdeadbeef);
448+
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),&present);
449+
ok(bret , "expected CheckRemoteDebuggerPresent to succeed\n");
450+
ok(0xdeadbeef == GetLastError(),
451+
"expected error to be unchanged, got %d/%x\n",GetLastError(), GetLastError());
452+
453+
present = TRUE;
454+
SetLastError(0xdeadbeef);
455+
bret = pCheckRemoteDebuggerPresent(NULL,&present);
456+
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
457+
ok(present, "expected parameter to be unchanged\n");
458+
ok(ERROR_INVALID_PARAMETER == GetLastError(),
459+
"expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
460+
461+
SetLastError(0xdeadbeef);
462+
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),NULL);
463+
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
464+
ok(ERROR_INVALID_PARAMETER == GetLastError(),
465+
"expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
466+
}
467+
436468
START_TEST(debugger)
437469
{
438470
HMODULE hdll;
439471

440472
hdll=GetModuleHandle("kernel32.dll");
473+
pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent");
441474
pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop");
442475
pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit");
443476

@@ -453,5 +486,6 @@ START_TEST(debugger)
453486
else
454487
{
455488
test_ExitCode();
489+
test_RemoteDebugger();
456490
}
457491
}

0 commit comments

Comments
 (0)