SHELL32/tests: make file operations to succeed on win9x too
Saulius Krasuckas
saulius2 at ar.fi.lt
Fri Aug 12 02:25:03 CDT 2005
I am not sure, if this is a right direction to go, but most of *W
functions fail on win9x and winME. So I changed them into their *A
counterparts. Maybe we need somehow link winetest binaries to MSLU (MS
Layer for Unicode)?
Log message:
Saulius Krasuckas <saulius.krasuckas at ieee.org>
Make file operations to succeed on win9x too.
Index: dlls/shell32/tests/shlfolder.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/shlfolder.c,v
retrieving revision 1.27
diff -p -u -r1.27 shlfolder.c
--- dlls/shell32/tests/shlfolder.c 8 Aug 2005 18:03:47 -0000 1.27
+++ dlls/shell32/tests/shlfolder.c 12 Aug 2005 07:07:18 -0000
@@ -211,6 +211,7 @@ static void test_BindToObject(void)
SHITEMID emptyitem = { 0, { 0 } };
LPITEMIDLIST pidlMyComputer, pidlSystemDir, pidlEmpty = (LPITEMIDLIST)&emptyitem;
WCHAR wszSystemDir[MAX_PATH];
+ char szSystemDir[MAX_PATH];
WCHAR wszMyComputer[] = {
':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
@@ -247,12 +248,13 @@ static void test_BindToObject(void)
hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08lx\n", hr);
- cChars = GetSystemDirectoryW(wszSystemDir, MAX_PATH);
- ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryW failed! LastError: %08lx\n", GetLastError());
+ cChars = GetSystemDirectoryA(szSystemDir, MAX_PATH);
+ ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryA failed! LastError: %08lx\n", GetLastError());
if (cChars == 0 || cChars >= MAX_PATH) {
IShellFolder_Release(psfMyComputer);
return;
}
+ MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszSystemDir, MAX_PATH);
hr = IShellFolder_ParseDisplayName(psfMyComputer, NULL, NULL, wszSystemDir, NULL, &pidlSystemDir, NULL);
ok (SUCCEEDED(hr), "MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08lx\n", hr);
@@ -284,6 +286,7 @@ static void test_GetDisplayName(void)
HRESULT hr;
HANDLE hTestFile;
WCHAR wszTestFile[MAX_PATH], wszTestFile2[MAX_PATH], wszTestDir[MAX_PATH];
+ char szTestFile[MAX_PATH], szTestDir[MAX_PATH];
STRRET strret;
LPSHELLFOLDER psfDesktop, psfPersonal;
IUnknown *psfFile;
@@ -309,16 +312,18 @@ static void test_GetDisplayName(void)
PathAddBackslashW(wszTestDir);
lstrcatW(wszTestDir, wszDirName);
- result = CreateDirectoryW(wszTestDir, NULL);
- ok(result, "CreateDirectoryW failed! Last error: %08lx\n", GetLastError());
+ WideCharToMultiByte(CP_ACP, 0, wszTestDir, -1, szTestDir, MAX_PATH, 0, 0);
+ result = CreateDirectoryA(szTestDir, NULL);
+ ok(result, "CreateDirectoryA failed! Last error: %08lx\n", GetLastError());
if (!result) return;
lstrcpyW(wszTestFile, wszTestDir);
PathAddBackslashW(wszTestFile);
lstrcatW(wszTestFile, wszFileName);
+ WideCharToMultiByte(CP_ACP, 0, wszTestFile, -1, szTestFile, MAX_PATH, 0, 0);
- hTestFile = CreateFileW(wszTestFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
- ok(hTestFile != INVALID_HANDLE_VALUE, "CreateFileW failed! Last error: %08lx\n", GetLastError());
+ hTestFile = CreateFileA(szTestFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ ok((hTestFile != INVALID_HANDLE_VALUE), "CreateFileA failed! Last error: %08lx\n", GetLastError());
if (hTestFile == INVALID_HANDLE_VALUE) return;
CloseHandle(hTestFile);
@@ -343,8 +348,8 @@ static void test_GetDisplayName(void)
}
/* Deleting the file and the directory */
- DeleteFileW(wszTestFile);
- RemoveDirectoryW(wszTestDir);
+ hr = DeleteFileA(szTestFile);
+ hr = RemoveDirectoryA(szTestDir);
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2);
More information about the wine-patches
mailing list