sync kernel32_winetest with wine 1.1.28
authorChristoph von Wittich <christoph_vw@reactos.org>
Sat, 22 Aug 2009 16:42:11 +0000 (16:42 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sat, 22 Aug 2009 16:42:11 +0000 (16:42 +0000)
svn path=/trunk/; revision=42853

rostests/winetests/kernel32/codepage.c
rostests/winetests/kernel32/drive.c
rostests/winetests/kernel32/format_msg.c
rostests/winetests/kernel32/process.c
rostests/winetests/kernel32/profile.c
rostests/winetests/kernel32/thread.c
rostests/winetests/kernel32/virtual.c
rostests/winetests/kernel32/volume.c

index 9061241..61d0c33 100755 (executable)
@@ -320,7 +320,7 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar)
     SetLastError(0xdeadbeef);
     ret = WideCharToMultiByte(950, 0, dbwcs, -1, mbs, sizeof(mbs), NULL, bUsedDefaultChar);
     ok(ret == 5, "ret is %d\n", ret);
-    ok(!strcmp(mbs, "µH©Ò"), "mbs is %s\n", mbs);
+    ok(!strcmp(mbs, "\xb5H\xa9\xd2"), "mbs is %s\n", mbs);
     if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar);
     ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError());
 
@@ -334,7 +334,7 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar)
     SetLastError(0xdeadbeef);
     ret = WideCharToMultiByte(950, 0, dbwcs, 1, mbs, sizeof(mbs), NULL, bUsedDefaultChar);
     ok(ret == 2, "ret is %d\n", ret);
-    ok(!strcmp(mbs, "µH"), "mbs is %s\n", mbs);
+    ok(!strcmp(mbs, "\xb5H"), "mbs is %s\n", mbs);
     if(bUsedDefaultChar) ok(*bUsedDefaultChar == FALSE, "bUsedDefaultChar is %d\n", *bUsedDefaultChar);
     ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError());
 
index af1cf7f..e4cb26c 100755 (executable)
@@ -125,6 +125,7 @@ static void test_GetDiskFreeSpaceA(void)
                    GetLastError() == ERROR_INVALID_DRIVE ||
                    GetLastError() == ERROR_PATH_NOT_FOUND ||
                    GetLastError() == ERROR_REQUEST_ABORTED ||
+                   GetLastError() == ERROR_NETNAME_DELETED ||
                    GetLastError() == ERROR_UNRECOGNIZED_VOLUME,
                    "GetDiskFreeSpaceA(%s): ret=%d GetLastError=%d\n",
                    drive, ret, GetLastError());
@@ -144,6 +145,7 @@ static void test_GetDiskFreeSpaceA(void)
                         GetLastError() == ERROR_INVALID_FUNCTION ||
                         GetLastError() == ERROR_PATH_NOT_FOUND ||
                         GetLastError() == ERROR_REQUEST_ABORTED ||
+                        GetLastError() == ERROR_NETNAME_DELETED ||
                         GetLastError() == ERROR_UNRECOGNIZED_VOLUME,
                         "GetDiskFreeSpaceExA( %s ) failed. GetLastError=%d\n", drive, GetLastError());
                     ok( bytes_per_sector == 0 || /* empty cd rom drive */
index 8cdb1e4..7019321 100755 (executable)
@@ -52,13 +52,6 @@ static DWORD doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id,
     return r;
 }
 
-static char buf[1024];
-static const char *debugstr_w(const WCHAR *str)
-{
-    WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
-    return buf;
-}
-
 static void test_message_from_string_wide(void)
 {
     static const WCHAR test[]        = {'t','e','s','t',0};
@@ -127,180 +120,180 @@ static void test_message_from_string_wide(void)
     /* the basics */
     r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, test, 0,
         0, out, sizeof(out)/sizeof(WCHAR), NULL);
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4, "failed: r=%d\n", r);
 
     /* using the format feature */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1s, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* no format */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* two pieces */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_12, 0,
         0, out, sizeof(out)/sizeof(WCHAR), te, st);
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* three pieces */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123, 0,
         0, out, sizeof(out)/sizeof(WCHAR), t, s, e);
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* s doesn't seem to work in format strings */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_s, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(&fmt_s[1], out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(&fmt_s[1], out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==3, "failed: r=%d\n", r);
 
     /* nor ls */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_ls, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(&fmt_ls[1], out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(&fmt_ls[1], out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4, "failed: r=%d\n", r);
 
     /* nor S */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_S, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(&fmt_S[1], out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(&fmt_S[1], out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==3, "failed: r=%d\n", r);
 
     /* nor ws */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_ws, 0,
         0, out, sizeof(out)/sizeof(WCHAR), test);
-    ok(!lstrcmpW(&fmt_ws[1], out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(&fmt_ws[1], out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4, "failed: r=%d\n", r);
 
     /* as characters */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123c, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 't', 'e', 's');
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* lc is unicode */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123lc, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 't', 'e', 's');
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* wc is unicode */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123wc, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 't', 'e', 's');
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* C is unicode */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123C, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 't', 'e', 's');
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* some numbers */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_123d, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 1, 2, 3);
-    ok(!lstrcmpW(s_123d, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_123d, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==3,"failed: r=%d\n", r);
 
     /* a single digit with some spacing */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_14d, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 1);
-    ok(!lstrcmpW(s_14d, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_14d, out), "failed out=%s\n", wine_dbgstr_w(out));
 
     /* a single digit, left justified */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1_4d, 0,
         0, out, sizeof(out)/sizeof(CHAR), 1);
-    ok(!lstrcmpW(s_1_4d, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_1_4d, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* two digit decimal number */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_14d, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 11);
-    ok(!lstrcmpW(s_14d2, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_14d2, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* a hex number */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_14x, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 11);
-    ok(!lstrcmpW(s_14x, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_14x, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* a hex number, upper case */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_14X, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 11);
-    ok(!lstrcmpW(s_14X, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_14X, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* a hex number, upper case, left justified */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1_4X, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 11);
-    ok(!lstrcmpW(s_1_4X, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_1_4X, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* a long hex number, upper case */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_14X, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 0x1ab);
-    ok(!lstrcmpW(s_1AB, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_1AB, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* two percent... */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_2pct, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_2pct, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_2pct, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* periods are special cases */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_2dot1d, 0,
         0, out, sizeof(out)/sizeof(WCHAR), 0x1ab);
-    ok(!lstrcmpW(s_2dot147, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_2dot147, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==8,"failed: r=%d\n", r);
 
     /* %0 ends the line */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_t0t, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(test, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* %! prints an exclamation */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_yah, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_yah, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_yah, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* %space */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_space, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_space, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_space, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_hi_lf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_hi_crlf, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_hi_crlf, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* carriage return line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_hi_crlf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_hi_crlf, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_hi_crlf, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* carriage return */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_cr, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_crlf, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_crlf, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==2,"failed: r=%d\n", r);
 
     /* double carriage return line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_crcrlf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_crlfcrlf, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_crlfcrlf, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==4,"failed: r=%d\n", r);
 
     /* change of pace... test the low byte of dwflags */
@@ -308,25 +301,25 @@ static void test_message_from_string_wide(void)
     /* line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, fmt_hi_lf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_hi_sp, out) || !lstrcmpW(s_hi_crlf, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_hi_sp, out) || !lstrcmpW(s_hi_crlf, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==3 || r==4,"failed: r=%d\n", r);
 
     /* carriage return line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, fmt_hi_crlf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_hi_sp, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_hi_sp, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==3,"failed: r=%d\n", r);
 
     /* carriage return */
     r = doitW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, fmt_cr, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_sp, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_sp, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==1,"failed: r=%d\n", r);
 
     /* double carriage return line feed */
     r = doitW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, fmt_crcrlf, 0,
         0, out, sizeof(out)/sizeof(WCHAR));
-    ok(!lstrcmpW(s_2sp, out), "failed out=[%s]\n", debugstr_w(out));
+    ok(!lstrcmpW(s_2sp, out), "failed out=%s\n", wine_dbgstr_w(out));
     ok(r==2,"failed: r=%d\n", r);
 }
 
index 9bcd302..52a670a 100755 (executable)
           wine_dbgstr_w(expected), wine_dbgstr_w(value)); \
     } while (0)
 
-/* A simpler version of wine_dbgstr_w. Note that the returned buffer will be
- * invalid after 16 calls to this funciton. */
-static const char *wine_dbgstr_w(LPCWSTR wstr)
-{
-  static char *buffers[16];
-  static int curr_buffer = 0;
-
-  int size;
-
-  curr_buffer = (curr_buffer + 1) % 16;
-  HeapFree(GetProcessHeap(), 0, buffers[curr_buffer]);
-  size = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
-  buffers[curr_buffer] = HeapAlloc(GetProcessHeap(), 0, size);
-  size = WideCharToMultiByte(CP_ACP, 0, wstr, -1, buffers[curr_buffer], size, NULL, NULL);
-  return buffers[curr_buffer];
-}
-
 static HINSTANCE hkernel32;
 static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
 static BOOL   (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
@@ -1243,6 +1226,7 @@ static  void    test_SuspendFlag(void)
 static  void    test_DebuggingFlag(void)
 {
     char                buffer[MAX_PATH];
+    void               *processbase = NULL;
     PROCESS_INFORMATION        info;
     STARTUPINFOA       startup, us;
     DEBUG_EVENT         de;
@@ -1263,7 +1247,15 @@ static  void    test_DebuggingFlag(void)
     {
         ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n");
         ContinueDebugEvent(de.dwProcessId, de.dwThreadId, DBG_CONTINUE);
+        if (!dbg)
+        {
+            ok(de.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT,
+               "first event: %d\n", de.dwDebugEventCode);
+            processbase = de.u.CreateProcessInfo.lpBaseOfImage;
+        }
         if (de.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) dbg++;
+        ok(de.dwDebugEventCode != LOAD_DLL_DEBUG_EVENT ||
+           de.u.LoadDll.lpBaseOfDll != processbase, "got LOAD_DLL for main module\n");
     } while (de.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT);
 
     ok(dbg, "I have seen a debug event\n");
index b9a71d3..4254c85 100755 (executable)
@@ -92,14 +92,23 @@ static void test_profile_int(void)
 
 static void test_profile_string(void)
 {
+    static WCHAR emptyW[] = { 0 };
+    static WCHAR keyW[] = { 'k','e','y',0 };
+    static WCHAR sW[] = { 's',0 };
+    static WCHAR TESTFILE2W[] = {'.','\\','t','e','s','t','w','i','n','e','2','.','i','n','i',0};
+    static WCHAR valsectionW[] = {'v','a','l','_','e','_','s','e','c','t','i','o','n',0 };
+    static WCHAR valnokeyW[] = {'v','a','l','_','n','o','_','k','e','y',0};
     HANDLE h;
     int ret;
     DWORD count;
     char buf[100];
+    WCHAR bufW[100];
     char *p;
     /* test that lines without an '=' will not be enumerated */
     /* in the case below, name2 is a key while name3 is not. */
     char content[]="[s]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n";
+    char content2[]="\r\nkey=val_no_section\r\n[]\r\nkey=val_e_section\r\n"
+                    "[s]\r\n=val_no_key\r\n[t]\r\n";
     DeleteFileA( TESTFILE2);
     h = CreateFileA( TESTFILE2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
         FILE_ATTRIBUTE_NORMAL, NULL);
@@ -126,6 +135,27 @@ static void test_profile_string(void)
     ok( ret == 24 && !strcmp( buf, "name1,name2,name4,name5"), "wrong keys returned(%d): %s\n",
             ret, buf);
 
+    h = CreateFileA( TESTFILE2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+        FILE_ATTRIBUTE_NORMAL, NULL);
+    ok( h != INVALID_HANDLE_VALUE, " cannot create %s\n", TESTFILE2);
+    if( h == INVALID_HANDLE_VALUE) return;
+    WriteFile( h, content2, sizeof(content2), &count, NULL);
+    CloseHandle( h);
+
+    /* works only in unicode, ascii crashes */
+    ret=GetPrivateProfileStringW(emptyW, keyW, emptyW, bufW,
+                                 sizeof(bufW)/sizeof(bufW[0]), TESTFILE2W);
+    todo_wine
+    ok(!lstrcmpW(valsectionW,bufW), "expected %s, got %s\n",
+        wine_dbgstr_w(valsectionW), wine_dbgstr_w(bufW) );
+
+    /* works only in unicode, ascii crashes */
+    ret=GetPrivateProfileStringW(sW, emptyW, emptyW, bufW,
+                                 sizeof(bufW)/sizeof(bufW[0]), TESTFILE2W);
+    todo_wine
+    ok(!lstrcmpW(valnokeyW,bufW), "expected %s, got %s\n",
+        wine_dbgstr_w(valnokeyW), wine_dbgstr_w(bufW) );
+
     DeleteFileA( TESTFILE2);
 }
 
index 2c699b4..e80c63e 100755 (executable)
@@ -812,22 +812,24 @@ static VOID test_thread_processor(void)
       "SetThreadAffinityMask passed for an illegal processor\n");
 /* NOTE: This only works on WinNT/2000/XP) */
    if (pSetThreadIdealProcessor) {
-     todo_wine {
-       SetLastError(0);
-       error=pSetThreadIdealProcessor(curthread,0);
-       if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
-         ok(error!=-1, "SetThreadIdealProcessor failed\n");
-       }
-     }
-     if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) {
-       error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1);
-       ok(error==-1,
-          "SetThreadIdealProcessor succeeded with an illegal processor #\n");
-       todo_wine {
-         error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
-         ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
-       }
+     SetLastError(0xdeadbeef);
+     error=pSetThreadIdealProcessor(curthread,0);
+     if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+     {
+       win_skip("SetThreadIdealProcessor is not implemented\n");
+       return;
      }
+     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());
+
+     error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS);
+     ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n");
    }
 }
 
index e665f0f..b7e97db 100755 (executable)
@@ -284,6 +284,40 @@ static void test_VirtualAlloc(void)
     ok(old_prot == PAGE_READONLY,
         "wrong old protection: got %04x instead of PAGE_READONLY\n", old_prot);
 
+    ok(VirtualQuery(addr1, &info, sizeof(info)) == sizeof(info),
+        "VirtualQuery failed\n");
+    ok(info.RegionSize == 0x1000, "%lx != 0x1000\n", info.RegionSize);
+    ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
+    ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
+    memset( addr1, 0x55, 20 );
+    ok( *(DWORD *)addr1 == 0x55555555, "wrong data %x\n", *(DWORD *)addr1 );
+
+    addr2 = VirtualAlloc( addr1, 0x1000, MEM_RESET, PAGE_NOACCESS );
+    ok( addr2 == addr1 || broken( !addr2 && GetLastError() == ERROR_INVALID_PARAMETER), /* win9x */
+        "VirtualAlloc failed err %u\n", GetLastError() );
+    ok( *(DWORD *)addr1 == 0x55555555 || *(DWORD *)addr1 == 0, "wrong data %x\n", *(DWORD *)addr1 );
+    if (addr2)
+    {
+        ok(VirtualQuery(addr1, &info, sizeof(info)) == sizeof(info),
+           "VirtualQuery failed\n");
+        ok(info.RegionSize == 0x1000, "%lx != 0x1000\n", info.RegionSize);
+        ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
+        ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
+
+        addr2 = VirtualAlloc( (char *)addr1 + 0x1000, 0x1000, MEM_RESET, PAGE_NOACCESS );
+        ok( (char *)addr2 == (char *)addr1 + 0x1000, "VirtualAlloc failed\n" );
+
+        ok(VirtualQuery(addr2, &info, sizeof(info)) == sizeof(info),
+           "VirtualQuery failed\n");
+        ok(info.RegionSize == 0xf000, "%lx != 0xf000\n", info.RegionSize);
+        ok(info.State == MEM_RESERVE, "%x != MEM_RESERVE\n", info.State);
+        ok(info.Protect == 0, "%x != 0\n", info.Protect);
+
+        addr2 = VirtualAlloc( (char *)addr1 + 0xf000, 0x2000, MEM_RESET, PAGE_NOACCESS );
+        ok( !addr2, "VirtualAlloc failed\n" );
+        ok( GetLastError() == ERROR_INVALID_ADDRESS, "wrong error %u\n", GetLastError() );
+    }
+
     /* invalid protection values */
     SetLastError(0xdeadbeef);
     addr2 = VirtualAlloc(NULL, 0x1000, MEM_RESERVE, 0);
@@ -329,7 +363,7 @@ static void test_MapViewOfFile(void)
     static const char testfile[] = "testfile.xxx";
     const char *name;
     HANDLE file, mapping, map2;
-    void *ptr, *ptr2;
+    void *ptr, *ptr2, *addr;
     MEMORY_BASIC_INFORMATION info;
     BOOL ret;
 
@@ -700,6 +734,10 @@ static void test_MapViewOfFile(void)
         ok(info.Type == MEM_MAPPED, "Type should have been MEM_MAPPED instead of 0x%x\n", info.Type);
     }
 
+    addr = VirtualAlloc( ptr, MAPPING_SIZE, MEM_RESET, PAGE_READONLY );
+    ok( addr == ptr || broken(!addr && GetLastError() == ERROR_INVALID_PARAMETER), /* win9x */
+        "VirtualAlloc failed with error %u\n", GetLastError() );
+
     ret = VirtualFree( ptr, 0x10000, MEM_DECOMMIT );
     ok( !ret || broken(ret) /* win9x */, "VirtualFree succeeded\n" );
     if (!ret)
index 2c25465..f569247 100644 (file)
@@ -160,7 +160,7 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
         "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
         temp_path, GetLastError());
 
-    /* Try on a non-existent dos drive */
+    /* Try on a nonexistent dos drive */
     path[2] = 0;
     for (;path[0] <= 'z'; path[0]++) {
         ret = QueryDosDeviceA( path, volume, len);
@@ -174,7 +174,7 @@ static void test_GetVolumeNameForVolumeMountPointA(void)
             "GetVolumeNameForVolumeMountPointA failed on %s, last=%d\n",
             path, GetLastError());
 
-        /* Try without trailing \ and on a non-existent dos drive  */
+        /* Try without trailing \ and on a nonexistent dos drive  */
         path[2] = 0;
         ret = pGetVolumeNameForVolumeMountPointA(path, volume, len);
         ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
@@ -299,6 +299,7 @@ static void test_GetVolumeInformationA(void)
     DWORD vol_name_size=MAX_PATH+1, vol_serial_num=-1, max_comp_len=0, fs_flags=0, fs_name_len=MAX_PATH+1;
     char vol_name_buf[MAX_PATH+1], fs_name_buf[MAX_PATH+1];
     char windowsdir[MAX_PATH+10];
+    char currentdir[MAX_PATH+1];
 
     if (!pGetVolumeInformationA) {
         win_skip("GetVolumeInformationA not found\n");
@@ -321,12 +322,40 @@ static void test_GetVolumeInformationA(void)
     ret = pGetVolumeNameForVolumeMountPointA(Root_Dir1, volume, MAX_PATH);
     ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
 
+    result = GetCurrentDirectory(MAX_PATH, currentdir);
+    ok(result, "GetCurrentDirectory: error %d\n", GetLastError());
+
     /*  ****  now start the tests       ****  */
     /* check for error on no trailing \   */
+    if (result > 3)
+    {
+        ret = pGetVolumeInformationA(Root_Dir0, vol_name_buf, vol_name_size, NULL,
+                NULL, NULL, fs_name_buf, fs_name_len);
+        ok(!ret && GetLastError() == ERROR_INVALID_NAME,
+            "GetVolumeInformationA w/o '\\' did not fail, last error %u\n", GetLastError());
+    }
+    else
+        skip("Running on a root directory\n");
+
+    /* check for error on no trailing \ when current dir is root dir */
+    ret = SetCurrentDirectory(Root_Dir1);
+    ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
+    ret = pGetVolumeInformationA(Root_Dir0, vol_name_buf, vol_name_size, NULL,
+            NULL, NULL, fs_name_buf, fs_name_len);
+    todo_wine
+    ok(ret, "GetVolumeInformationA failed, last error %u\n", GetLastError());
+
+    /* check for error on no trailing \ when current dir is windows dir */
+    ret = SetCurrentDirectory(windowsdir);
+    ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
     ret = pGetVolumeInformationA(Root_Dir0, vol_name_buf, vol_name_size, NULL,
             NULL, NULL, fs_name_buf, fs_name_len);
     ok(!ret && GetLastError() == ERROR_INVALID_NAME,
-        "GetVolumeInformationA w/o '\\' did not fail, last error %u\n", GetLastError());
+        "GetVolumeInformationA did not fail, last error %u\n", GetLastError());
+
+    /* reset current directory */
+    ret = SetCurrentDirectory(currentdir);
+    ok(ret, "SetCurrentDirectory: error %d\n", GetLastError());
 
     /* try null root directory to return "root of the current directory"  */
     ret = pGetVolumeInformationA(NULL, vol_name_buf, vol_name_size, NULL,