gdi32: Add support for .fot files in RemoveFontResource.

This commit is contained in:
Alexandre Julliard 2013-01-15 12:54:02 +01:00
parent 4fc8bf18f3
commit 46532e8d8a
2 changed files with 23 additions and 12 deletions

View File

@ -3565,7 +3565,25 @@ BOOL WINAPI RemoveFontResourceExA( LPCSTR str, DWORD fl, PVOID pdv )
*/
BOOL WINAPI RemoveFontResourceExW( LPCWSTR str, DWORD fl, PVOID pdv )
{
return WineEngRemoveFontResourceEx(str, fl, pdv);
int ret = WineEngRemoveFontResourceEx( str, fl, pdv );
WCHAR *filename;
if (ret == 0)
{
/* FreeType <2.3.5 has problems reading resources wrapped in PE files. */
HMODULE hModule = LoadLibraryExW(str, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hModule != NULL)
{
WARN("Can't unload resources from PE file %s\n", wine_dbgstr_w(str));
FreeLibrary(hModule);
}
else if ((filename = get_scalable_filename( str )) != NULL)
{
ret = WineEngRemoveFontResourceEx( filename, fl, pdv );
HeapFree( GetProcessHeap(), 0, filename );
}
}
return ret;
}
/***********************************************************************

View File

@ -4475,22 +4475,11 @@ static void test_CreateScalableFontResource(void)
SetLastError(0xdeadbeef);
ret = pRemoveFontResourceExA(fot_name, 0, 0);
todo_wine
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
todo_wine
ok(!ret, "font wine_test should not be enumerated\n");
/* FIXME: since RemoveFontResource is a stub correct testing is impossible */
if (ret)
{
/* remove once RemoveFontResource is implemented */
DeleteFile(fot_name);
DeleteFile(ttf_name);
return;
}
ret = pRemoveFontResourceExA(fot_name, 0, 0);
ok(!ret, "RemoveFontResourceEx() should fail\n");
@ -4509,17 +4498,21 @@ todo_wine
ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
todo_wine
ok(!ret, "font wine_test should not be enumerated\n");
/* XP allows removing a private font added with 0 flags */
SetLastError(0xdeadbeef);
ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
todo_wine
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
todo_wine
ok(!ret, "font wine_test should not be enumerated\n");
ret = pRemoveFontResourceExA(fot_name, 0, 0);
todo_wine
ok(!ret, "RemoveFontResourceEx() should fail\n");
DeleteFile(fot_name);