diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 2093959d98d..1bcb25a53fa 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -36,16 +36,6 @@ static NTSTATUS(NTAPI *pRtlFindActivationContextSectionString)(DWORD,const GUID static BOOLEAN (NTAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, PCSZ); static VOID (NTAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); -static const char* strw(LPCWSTR x) -{ - static char buffer[1024]; - char* p = buffer; - - if (!x) return "(nil)"; - else while ((*p++ = *x++)); - return buffer; -} - #ifdef __i386__ #define ARCH "x86" #elif defined __x86_64__ @@ -622,7 +612,7 @@ static const detailed_info_t detailed_info0 = { static const detailed_info_t detailed_info1 = { 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path, ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, - work_dir, + app_dir, }; static const detailed_info_t detailed_info1_child = { @@ -635,7 +625,7 @@ static const detailed_info_t detailed_info1_child = { static const detailed_info_t detailed_info2 = { 1, 2, 3, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path, ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, - work_dir, + app_dir, }; static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo, int line) @@ -706,7 +696,8 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo, int ok_(__FILE__, line)(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n"); if(detailed_info->lpAppDirPath) ok_(__FILE__, line)(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath), - "unexpected detailed_info->lpAppDirPath\n%s\n",strw(detailed_info->lpAppDirPath)); + "unexpected detailed_info->lpAppDirPath %s / %s\n", + wine_dbgstr_w(detailed_info->lpAppDirPath), wine_dbgstr_w( exinfo->app_dir )); }else { ok_(__FILE__, line)(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n"); } @@ -864,7 +855,7 @@ static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembl if(info->lpAssemblyEncodedAssemblyIdentity && exinfo->encoded_assembly_id) { ok_(__FILE__, line)(!lstrcmpW(info->lpAssemblyEncodedAssemblyIdentity, exinfo->encoded_assembly_id), "unexpected info->lpAssemblyEncodedAssemblyIdentity %s / %s\n", - strw(info->lpAssemblyEncodedAssemblyIdentity), wine_dbgstr_w(exinfo->encoded_assembly_id)); + wine_dbgstr_w(info->lpAssemblyEncodedAssemblyIdentity), wine_dbgstr_w(exinfo->encoded_assembly_id)); } if(exinfo->manifest_path) { ok_(__FILE__, line)(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n"); @@ -882,7 +873,7 @@ static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembl ok_(__FILE__, line)(info->lpAssemblyDirectoryName != NULL, "info->lpAssemblyDirectoryName == NULL\n"); else ok_(__FILE__, line)(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n", - strw(info->lpAssemblyDirectoryName)); + wine_dbgstr_w(info->lpAssemblyDirectoryName)); HeapFree(GetProcessHeap(), 0, info); } diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 0e45ad44ff3..f49af6d5bfe 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -1877,7 +1877,8 @@ static void test_SearchPathA(void) ok(ret && ret == strlen(path2A), "got %d\n", ret); bret = CopyFileA(path2A, pathA, FALSE); ok(bret != 0, "failed to copy test executable to temp directory, %u\n", GetLastError()); - sprintf(path3A, "%s%s%s", curdirA, curdirA[strlen(curdirA)-1] != '\\' ? "\\" : "", kernel32A); + GetModuleFileNameA( GetModuleHandleA(0), path3A, sizeof(path3A) ); + strcpy( strrchr( path3A, '\\' ) + 1, kernel32A ); bret = CopyFileA(path2A, path3A, FALSE); ok(bret != 0, "failed to copy test executable to launch directory, %u\n", GetLastError()); bret = SetCurrentDirectoryA(tmpdirA); diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index ca991ea170a..b0371c615e6 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -935,6 +935,11 @@ static void test_CommandLine(void) release_memory(); DeleteFileA(resfile); + GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart); + assert ( lpFilePart != 0); + *(lpFilePart -1 ) = 0; + SetCurrentDirectoryA( fullpath ); + /* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0] * and " escaping. */ @@ -970,9 +975,6 @@ static void test_CommandLine(void) DeleteFileA(resfile); get_file_name(resfile); - GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart); - assert ( lpFilePart != 0); - *(lpFilePart -1 ) = 0; p = strrchr(fullpath, '\\'); /* Use exename to avoid buffer containing things like 'C:' */ if (p) sprintf(buffer, "..%s/%s process dump \"%s\"", p, exename, resfile); @@ -1010,6 +1012,7 @@ static void test_CommandLine(void) okChildStringWA("Arguments", "CommandLineW", buffer2); release_memory(); DeleteFileA(resfile); + SetCurrentDirectoryA( base ); if (0) /* Test crashes on NT-based Windows. */ {